import { VortexSdk, FiatToken, EvmToken, Networks, RampDirection } from "@vortexfi/sdk";
import type { VortexSdkConfig } from "@vortexfi/sdk";
const config: VortexSdkConfig = {
apiBaseUrl: "https://api.vortexfinance.co",
publicKey: "pk_live_...", // optional today; required after grace period
secretKey: "sk_live_...", // optional today; required after grace period
storeEphemeralKeys: true // default
};
const sdk = new VortexSdk(config);
publicKey is attached to quote requests for partner attribution and discount eligibility. secretKey is sent as the X-API-Key header on every request and authenticates the partner. Secret keys must only be used in trusted server-side environments.Create a quote (BRL → USDC on Polygon, via PIX):const quote = await sdk.createQuote({
rampType: RampDirection.BUY,
from: "pix",
to: Networks.Polygon,
inputAmount: "150000",
inputCurrency: FiatToken.BRL,
outputCurrency: EvmToken.USDC
});
const { rampProcess } = await sdk.registerRamp(quote, {
destinationAddress: "0x1234567890123456789012345678901234567890",
taxId: "12345678900"
});
For BRL buy flows, the ramp process contains a PIX payment payload:console.log(rampProcess.depositQrCode);
After the user completes the fiat payment, start the ramp. startRamp takes only the ramp ID:const startedRamp = await sdk.startRamp(rampProcess.id);
Poll status or use webhooks:const status = await sdk.getRampStatus(rampProcess.id);
Why The SDK Is Preferred#
The SDK creates fresh ephemeral accounts for each ramp (one each on Stellar, Pendulum, and Moonbeam), signs the transactions returned by Vortex, submits required update calls, and can store a local backup of ephemeral secrets. This removes several integration risks from partner applications.If you disable SDK key storage with storeEphemeralKeys: false, your application must provide an equivalent secure backup mechanism.The default local backup is a JSON file named ephemerals_{rampId}.json written to the Node process's current working directory. It is not encrypted at rest. For production, run the SDK from a directory with restricted filesystem permissions, encrypt the file yourself, or disable storeEphemeralKeys and implement a custom store.
Modified at 2026-05-16 09:36:10