A stateless SDK that abstracts Vortex's API and ephemeral key handling for cross-chain ramp operations.
This SDK is currently working only on Node.js environment.
npm install @vortexfi/sdkimport { VortexSdk } from "@vortexfi/sdk";
import { FiatToken, EvmToken, Networks} from "@vortexfi/sdk";
import type { VortexSdkConfig } from "@vortexfi/sdk";
const config: VortexSdkConfig = {
apiBaseUrl: "http://localhost:3000",
};
const sdk = new VortexSdk(config);
const quoteRequest = {
from: "pix" as const,
inputAmount: "150000",
inputCurrency: FiatToken.BRL,
outputCurrency: EvmToken.USDC,
rampType: "on" as const,
to: Networks.Polygon,
};
const quote = await sdk.createQuote(quoteRequest);
const brlOnrampData = {
destinationAddress: "0x1234567890123456789012345678901234567890",
taxId: "123.456.789-00"
};
const { rampProcess } = await sdk.registerRamp(quote, brlOnrampData);
// Make the FIAT payment.
// The sdk will provide the information to make the payment.
const { depositQrCode } = rampProcess
console.log("Please do the pix transfer using the following code: ", depositQrCode)
//Once the payment is done, start the ramp.
const startedRamp = await sdk.startRamp(quote, rampProcess.id);- Ephemerals abstracted: No need to keep track of the ephemeral accounts used in the ramp process. If
storeEphemeralKeysis enabled, keys are stored in a JSON file in Node.js. - Stateless Design: No internal state management - you control persistence of the rampId for status checking
new VortexSdk(config: VortexSdkConfig)Creates a new quote for a ramp operation.
Retrieves an existing quote by ID.
Gets the current status of a ramp process.
registerRamp<Q extends QuoteResponse>(quote: Q, additionalData: RegisterRampAdditionalData<Q>): Promise<RampProcess>
Registers a new onramp process. Returns the ramp process, and a
list of transaction data objects (unsignedTransactions) that must be signed and sent before starting the ramp.
Starts a registered onramp process.
interface VortexSdkConfig {
apiBaseUrl: string;
pendulumWsUrl?: string;
moonbeamWsUrl?: string;
autoReconnect?: boolean;
alchemyApiKey?: string;
storeEphemeralKeys?: boolean;
}Only the base Vortex API is required. If the RPC URL's are not provided, default public ones will be used.
# Install dependencies
bun install
# Run example
bun run example.ts