[READY] add Alfredpay (USD/MXN/COP) on/off-ramp support to SDK#1173
[READY] add Alfredpay (USD/MXN/COP) on/off-ramp support to SDK#1173Sharqiewicz wants to merge 3 commits into
Conversation
✅ Deploy Preview for vortexfi ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for vortex-sandbox ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
ebma
left a comment
There was a problem hiding this comment.
@Sharqiewicz does this branch already have the latest changes from staging? I can see that it's using stellar ephemerals, from which we want to move away from. Please adjust that in the new files and fix the type issues and merge conflicts.
There was a problem hiding this comment.
Pull request overview
This PR extends @vortexfi/sdk beyond BRL-only ramps by adding Alfredpay-based USD/MXN/COP onramp and offramp support, including SDK routing, handler implementation, new quote/additional-data types, typed errors, regression tests, and README examples.
Changes:
- Added
AlfredpayHandlerand wiredVortexSdk.registerRamp()/updateRamp()to route Alfredpay flows viaisAlfredpayToken(...). - Expanded SDK type system to include Alfredpay quotes and (register/update) additional-data mappings.
- Added Alfredpay-specific error types + API error parsing, plus a new regression test suite and README usage examples.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/sdk/test/alfredpayHandler.test.ts | Adds regression tests for Alfredpay handler behavior, routing, and update semantics. |
| packages/sdk/src/VortexSdk.ts | Routes USD/MXN/COP ramps to AlfredpayHandler for register/update flows. |
| packages/sdk/src/types.ts | Introduces Alfredpay quote/additional-data types and updates conditional type mappings. |
| packages/sdk/src/handlers/AlfredpayHandler.ts | Implements Alfredpay onramp/offramp register + offramp update flow (ephemerals + signing + update). |
| packages/sdk/src/errors.ts | Adds Alfredpay-specific error classes and API error parsing hooks. |
| packages/sdk/README.md | Documents Alfredpay onramp/offramp usage patterns for SDK consumers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export type ExtendedQuoteResponse<T extends CreateQuoteRequest> = T extends { rampType: RampDirection.BUY; from: "pix" } | ||
| ? BrlOnrampQuote | ||
| : T extends { rampType: RampDirection.BUY; from: "sepa" } | ||
| ? EurOnrampQuote | ||
| : T extends { rampType: RampDirection.SELL; to: "pix" } | ||
| ? BrlOfframpQuote | ||
| : T extends { rampType: RampDirection.SELL; to: "sepa" } | ||
| ? EurOfframpQuote | ||
| : AnyQuote; | ||
| : T extends { rampType: RampDirection.BUY; inputCurrency: AlfredpayCurrency } |
| export interface AlfredpayOnrampAdditionalData { | ||
| destinationAddress: string; | ||
| fiatAccountId: string; | ||
| walletAddress?: string; | ||
| sessionId?: string; |
| async registerAlfredpayOnramp(quoteId: string, additionalData: AlfredpayOnrampAdditionalData): Promise<RampProcess> { | ||
| if (!additionalData.destinationAddress || !additionalData.fiatAccountId) { | ||
| throw new MissingAlfredpayOnrampParametersError(); | ||
| } |
| const result = await handler.registerAlfredpayOnramp("quote_1", { | ||
| destinationAddress: WALLET, | ||
| fiatAccountId: FIAT_ACCOUNT, | ||
| walletAddress: WALLET | ||
| }); |
| export class MissingAlfredpayOnrampParametersError extends AlfredpayOnrampError { | ||
| constructor() { | ||
| super("Parameters destinationAddress and fiatAccountId are required for Alfredpay onramp", 400); | ||
| this.name = "MissingAlfredpayOnrampParametersError"; | ||
| } |
| const { rampProcess } = await sdk.registerRamp(quote, { | ||
| destinationAddress: "0x1234567890123456789012345678901234567890", | ||
| fiatAccountId: "<the user's Alfredpay fiat account id>", | ||
| walletAddress: "0x1234567890123456789012345678901234567890" | ||
| }); |
Previously the SDK only supported BRL on/off-ramps. This adds MXN and COP (and USD) support in both directions - onramp and offramp - using the BRL integration as the reference pattern.
Closes #1161.
What changed
Core feature (packages/sdk)
discriminated ExtendedQuoteResponse / RegisterRampAdditionalData / UpdateRampAdditionalData mappings.