RampManager orchestrates the full fiat ↔ token conversion lifecycle. It has two halves: an off-chain half that talks to a pluggable RampProvider for quotes, session creation, and status polling; and an optional on-chain half that talks to a deployed RampSettlement contract to hold tokens in custody during off-ramp flows and record on-ramp attestations.
The SDK ships two ready-made providers: ManualRampProvider for local development and testing, and StellarAnchorProvider for production use with any SEP-24-compatible Stellar anchor. For Yellow Card, Flutterwave, Transak, or other providers, implement the RampProvider interface and pass it to the constructor.
Import
Constructor
RampManager that uses the same provider for both on-ramp and off-ramp.
RampProvider
required
The
RampProvider implementation to use for quotes, session creation, and status polling.IAdapter
The
EVMAdapter or StellarAdapter for on-chain settlement. Required only if you want to call depositOffRamp, confirmOffRampSettlement, refundOffRamp, or recordOnRampSettlement.string
Address of a deployed
RampSettlement contract. Required for on-chain methods. Obtain this address by deploying with TokenFactory.deployRampSettlement().Static Methods
RampManager.withProviders
RampManager where on-ramp and off-ramp use independently configured providers. Use this when you want, for example, MoonPay for on-ramp and a Stellar anchor for off-ramp.
RampProvider
required
Provider to use for on-ramp quotes and session creation.
RampProvider
required
Provider to use for off-ramp quotes and session creation.
RampManager.connectAnchor
StellarAnchorProvider for you, then wraps it in a RampManager. The anchor’s stellar.toml and SEP-10 handshake are resolved lazily on the first real call — this method does not make any network requests.
string
required
The home domain of the Stellar anchor, e.g.
"cowrie.exchange" or "moneygram.com".StellarExternalSigner
required
A SEP-43-compatible external wallet signer (e.g. Freighter) that signs SEP-10 challenges and off-ramp withdrawal transactions.
Off-Chain Methods
These methods talk to theRampProvider only — they do not touch the chain.
getQuote
input.direction.
"on-ramp" | "off-ramp"
required
Whether the user is buying tokens with fiat (
"on-ramp") or selling tokens for fiat ("off-ramp").string
required
ISO 4217 fiat currency code, e.g.
"NGN", "KES", "GHS".string
required
Token ticker, e.g.
"USDC", "USDT".string
required
ISO 3166-1 alpha-2 country code, e.g.
"NG".string
Fiat amount to convert. Provide either
fiatAmount or tokenAmount, not both.string
Token amount to convert. Provide either
fiatAmount or tokenAmount, not both.Promise<RampQuote>
string
The fiat amount for this quote (may be calculated if you passed
tokenAmount).string
The token amount for this quote (may be calculated if you passed
fiatAmount).string
The exchange rate applied (tokens per 1 unit of fiat).
string
The provider fee in fiat currency.
number
Unix timestamp after which this quote is no longer valid.
initiateOnRamp
RampSession including a paymentUrl where the user completes the fiat payment. Does not touch the chain.
string
required
Fiat amount the user is paying.
string
required
ISO 4217 code, e.g.
"NGN".string
required
Token the user will receive, e.g.
"USDC".string
required
On-chain address where the tokens will be delivered.
string
required
ISO 3166-1 alpha-2 country code.
string
Optional internal reference string for your records.
Promise<RampSession>
string
Unique session identifier. Store this to query status or call on-chain methods.
string | undefined
URL where the user completes the fiat payment (on-ramp only).
RampSessionStatus
Initial status. Always
"pending" immediately after creation.initiateOffRamp
depositOffRamp separately to move tokens to the settlement contract.
string
required
Token amount to sell.
string
required
Token ticker, e.g.
"USDC".string
required
ISO 4217 code, e.g.
"NGN".RampPayoutAccount
required
Bank or mobile-money account for the fiat payout.
string
required
ISO 3166-1 alpha-2 country code.
RampPayoutAccount fields:
getStatus
string
required
The session ID returned from
initiateOnRamp or initiateOffRamp.enum
"pending" · "processing" · "settled" · "failed" · "refunded"On-Chain Methods
These methods require both anadapter and a settlementAddress to be configured on the RampManager. They throw if either is missing.
depositOffRamp
RampSettlement contract for custody during an off-ramp session. On EVM, you must approve the settlement contract to spend amount of tokenAddress before calling this. On Stellar, the nested transfer is authorized within the same call.
string
required
Session ID from
initiateOffRamp.string
required
Address of the token to deposit.
bigint
required
Amount in wei.
confirmOffRampSettlement
getStatus and observing "settled".
string
required
Session ID of the settled off-ramp session.
refundOffRamp
string
required
Session ID of the failed off-ramp session.
recordOnRampSettlement
string
required
Session ID of the completed on-ramp session.
string
required
On-chain address that received the minted/transferred tokens.
string
required
Address of the token that was minted.
bigint
required
Amount of tokens minted in wei.
getOffRampDeposit
string
Address that called
depositOffRamp.string
Token address deposited.
bigint
Deposited amount in wei.
RampSettlementStatus
NONE (0) · PENDING (1) · SETTLED (2) · REFUNDED (3) · RECORDED (4)getOnRampRecord
Properties
Provider Reference
ManualRampProvider
RampProvider for local development. Quotes are calculated from statically configured exchange rates; sessions only change status when you call markSettled() or markFailed() in your test code.
Record<string, number>
Map of fiat currency code → tokens per 1 unit of fiat. Defaults to
{ NGN: 1/1500, KES: 1/150, GHS: 1/15 }.number
Flat fee in basis points applied to the fiat amount. Defaults to
100 (1%).StellarAnchorProvider
RampProvider backed by any SEP-24 Stellar anchor. Authentication uses SEP-10 (challenge/response signed by the user’s wallet); quotes use SEP-38 where the anchor supports it. The stellar.toml is resolved lazily on first use.
string
required
The anchor’s home domain, e.g.
"cowrie.exchange".StellarExternalSigner
required
A SEP-43-compatible wallet signer. Use
RampManager.connectAnchor() as a shortcut to avoid constructing this provider directly.string
Stellar network passphrase. Defaults to the public testnet passphrase. Override with
Networks.PUBLIC for mainnet.