Skip to content

feat: integrate custom off-ramp API for USDC withdrawals#286

Open
ShantelPeters wants to merge 2 commits intodavedumto:mainfrom
ShantelPeters:feat/custom-offramp
Open

feat: integrate custom off-ramp API for USDC withdrawals#286
ShantelPeters wants to merge 2 commits intodavedumto:mainfrom
ShantelPeters:feat/custom-offramp

Conversation

@ShantelPeters
Copy link
Copy Markdown

@ShantelPeters ShantelPeters commented Mar 24, 2026

Description
This PR integrates a new Custom Off-ramp API for processing USDC withdrawals to Nigerian bank accounts, transitioning away from the legacy Yellow Card integration. It implements secure payload signing, updates the main withdrawal route to enforce USDC deduction before initiation, and introduces comprehensive unit tests to ensure stability.

🔑 Key Changes
Environment config (.env.example): Replaced YELLOW_CARD variables with new OFFRAMP_API_* credentials (key, secret, URL).
Core Integration (
lib/offramp.ts
): Created the initiateOfframp client method. It signs the request timestamp and JSON payload using an HMAC-SHA256 signature to prevent unauthorized or replay attacks.
Withdrawal Route (
app/api/withdrawals/route.ts
):
Integrated the new initiateOfframp method.
Plumbed a deductStellarUSDC step that deducts USDC from the user's non-custodial Stellar wallet before pinging the off-ramp API.
Implemented robust error catching and fallback responses (returns 400 or 500 appropriately).
Test Coverage (
tests/withdrawals.test.ts
):
Added new test suites mimicking successful and failed API states using vitest.
Scenarios covered: successful withdrawal, insufficient balance, invalid bank account, and 500 API availability failures.

CLOSES #280

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 24, 2026

Someone is attempting to deploy a commit to the david's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 24, 2026

@ShantelPeters Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@davedumto
Copy link
Copy Markdown
Owner

this description is vague, please do a proper pull request description

@ShantelPeters
Copy link
Copy Markdown
Author

this description is vague, please do a proper pull request description
description added sir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Blocker] Integrate custom off-ramp API for USDC → NGN withdrawal

2 participants