rspace-online/modules/rflows/lib/onramp-provider.ts

30 lines
722 B
TypeScript

/**
* On-ramp provider abstraction — common interface for fiat-to-crypto providers.
*
* Each provider implements this interface to produce a widget URL
* that the frontend can embed in an iframe for card purchases.
*/
export type OnrampProviderId = 'transak' | 'coinbase' | 'ramp';
export interface OnrampSessionRequest {
walletAddress: string;
email: string;
fiatAmount: number;
fiatCurrency: string;
sessionId: string;
returnUrl?: string;
}
export interface OnrampSessionResult {
widgetUrl: string;
provider: OnrampProviderId;
}
export interface OnrampProvider {
id: OnrampProviderId;
name: string;
isAvailable(): boolean;
createSession(req: OnrampSessionRequest): Promise<OnrampSessionResult>;
}