-
Notifications
You must be signed in to change notification settings - Fork 274
max button ramp plugins #5700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
max button ramp plugins #5700
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
5ea9d21
Add learning technique to AGENTS.md
samholmes 32d5292
Add comprehensive documentation system and localization guidelines
samholmes c810d05
Add opencode.json
samholmes faf5b39
Document Edge scene architecture patterns and header management rules
samholmes a519144
Added .run.env to .gitignore
samholmes 896f608
Factor out PillButton component from SwapInput
samholmes 130458d
Redesign payment option cards
samholmes 3adfe59
Add DEBUG_LOGBOX to ENV
samholmes 023246a
feat(ramp): add new plugin architecture for fiat on/off ramps
samholmes 4431c6d
Restructure into Initialization and Workflow sections for clarity
samholmes c5a03ed
future! sam/ramp-plugins
samholmes 16bf87c
Add Moonpay Ramp Plugin
samholmes 70f4d71
Add Revolut Ramp Plugin
samholmes 0889a19
Add Simplex Ramp Plugin
samholmes 6609819
Add Banxa Ramp Plugin
samholmes 05920da
Add Bity Ramp Plugin
samholmes 269e057
Fix ramp quotes not refetching when plugins change
samholmes 645ae3a
Fix verify script
samholmes 4f7ab91
Use the util to make cursor-bot happy
samholmes 212ac91
Rename partnerUrl to apiUrl for paybis ramp plugin
samholmes b5bbe5f
future! sam/all-ramp-plugins
samholmes ff48745
Implement max button function on TradeCreateScene
samholmes 895bc92
Fixups
samholmes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add Simplex Ramp Plugin
- Loading branch information
commit 0889a19c533b1d5087c313299b876626d9023e5f
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 137 additions & 0 deletions
docs/simplex-provider-comparison-report.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,137 @@ | ||
| # Simplex Provider vs Ramp Plugin Comparison Report | ||
|
|
||
| This document provides a detailed comparison between the legacy `simplexProvider.ts` implementation and the new `simplexRampPlugin.ts` implementation, highlighting key differences and potential inconsistencies. | ||
|
|
||
| ## 1. Direction Support Differences | ||
|
|
||
| ### Old Provider (simplexProvider.ts) | ||
| - **Buy only**: Strictly enforces buy-only support | ||
| - Direction check in `getSupportedAssets`: `if (direction !== 'buy' || regionCode.countryCode === 'GB')` | ||
| - Direction check in `getQuote`: `if (direction !== 'buy')` | ||
| - Direction check in deeplink handler: `if (link.direction !== 'buy') return` | ||
|
|
||
| ### New Plugin (simplexRampPlugin.ts) | ||
| - **Buy only**: Same restriction but implemented differently | ||
| - Separate validation function: `validateDirection(direction: 'buy' | 'sell'): boolean` | ||
| - Consistent checks in both `checkSupport` and `fetchQuote` | ||
| - Same deeplink handler check: `if (link.direction !== 'buy') return` | ||
|
|
||
| **Consistency**: ✅ Both implementations only support 'buy' direction | ||
|
|
||
| ## 2. Region/Country Validation Differences | ||
|
|
||
| ### Old Provider (simplexProvider.ts) | ||
| - **GB restriction**: Combined with direction check: `if (direction !== 'buy' || regionCode.countryCode === 'GB')` | ||
| - **Daily check**: Uses `isDailyCheckDue(lastChecked)` for 24-hour caching | ||
| - **Storage**: Uses module-level variables for caching | ||
| - **Validation**: Direct `validateExactRegion` call in `getSupportedAssets` and `getQuote` | ||
|
|
||
| ### New Plugin (simplexRampPlugin.ts) | ||
| - **GB restriction**: Separate check in `validateRegion`: `if (regionCode.countryCode === 'GB') return false` | ||
| - **TTL-based caching**: Uses 2-minute TTL (`PROVIDER_CONFIG_TTL_MS = 2 * 60 * 1000`) | ||
| - **Storage**: Uses instance-level `providerConfig` with `lastUpdated` timestamp | ||
| - **Validation**: Wrapped in try-catch for better error handling | ||
|
|
||
| **Inconsistency**: ⚠️ Caching duration differs significantly (24 hours vs 2 minutes) | ||
|
|
||
| ## 3. Fiat Currency Support Differences | ||
|
|
||
| ### Old Provider (simplexProvider.ts) | ||
| - **Format**: Stores with 'iso:' prefix: `allowedCurrencyCodes.fiat['iso:' + fc.ticker_symbol] = fc` | ||
| - **API endpoint**: `https://api.simplexcc.com/v2/supported_fiat_currencies` | ||
| - **Storage**: Global `allowedCurrencyCodes` object | ||
|
|
||
| ### New Plugin (simplexRampPlugin.ts) | ||
| - **Format**: Same 'iso:' prefix: `newConfig.fiat['iso:' + fc.ticker_symbol] = fc` | ||
| - **API endpoint**: Same URL via constant `SIMPLEX_API_URL` | ||
| - **Validation**: Adds 'iso:' prefix during validation: `validateFiat('iso:${fiatAsset.currencyCode}')` | ||
|
|
||
| **Consistency**: ✅ Both use the same fiat currency format and API | ||
|
|
||
| ## 4. Crypto Currency Support Differences | ||
|
|
||
| ### Old Provider (simplexProvider.ts) | ||
| - **Token support**: Uses `getTokenId` to check token validity | ||
| - **Storage**: Adds tokens with `addTokenToArray({ tokenId }, tokens)` | ||
| - **Validation**: Implicit through presence in `allowedCurrencyCodes` | ||
|
|
||
| ### New Plugin (simplexRampPlugin.ts) | ||
| - **Token support**: Only supports native currencies (tokenId === null) | ||
| - **Storage**: Adds with `addTokenToArray({ tokenId: null }, tokens)` | ||
| - **Validation**: Explicit check: `if (cryptoAsset.tokenId === null)` | ||
| - **Error handling**: Returns `{ supported: false }` for tokens | ||
|
|
||
| **Inconsistency**: ⚠️ New plugin explicitly rejects tokens while old provider could support them | ||
|
|
||
| ## 5. Payment Type Support Differences | ||
|
|
||
| ### Old Provider (simplexProvider.ts) | ||
| - **Supported types**: `applepay: true, credit: true, googlepay: true` | ||
| - **Validation**: Checks array of payment types | ||
| - **Error**: Throws `FiatProviderError` with `errorType: 'paymentUnsupported'` | ||
|
|
||
| ### New Plugin (simplexRampPlugin.ts) | ||
| - **Supported types**: Defined in types file with same values | ||
| - **Quote response**: Always returns `paymentType: 'credit'` in quotes | ||
| - **No validation**: Doesn't validate payment types in `checkSupport` or `fetchQuote` | ||
|
|
||
| **Inconsistency**: ⚠️ New plugin doesn't validate payment types and always returns 'credit' | ||
|
|
||
| ## 6. Quote Workflow Differences | ||
|
|
||
| ### Old Provider (simplexProvider.ts) | ||
| - **JWT endpoint**: `v1/jwtSign/simplex` for quote JWT | ||
| - **Quote URL**: `https://partners.simplex.com/api/quote?partner=${partner}&t=${token}` | ||
| - **Expiration**: 8 seconds (`Date.now() + 8000`) | ||
| - **Multiple payment type checks**: Validates payment types twice | ||
|
|
||
| ### New Plugin (simplexRampPlugin.ts) | ||
| - **JWT endpoint**: Same endpoint via centralized function | ||
| - **Quote URL**: Same URL structure | ||
| - **Expiration**: Same 8 seconds | ||
| - **Settlement range**: Adds new feature: `10-60 minutes` | ||
|
|
||
| **Enhancement**: ✅ New plugin adds settlement range information | ||
|
|
||
| ## 7. Error Handling Differences | ||
|
|
||
| ### Old Provider (simplexProvider.ts) | ||
| - **Network errors**: Uses `.catch(e => undefined)` pattern | ||
| - **Generic errors**: Throws `new Error('Simplex unknown error')` | ||
| - **Toast messages**: Uses `NOT_SUCCESS_TOAST_HIDE_MS` constant | ||
|
|
||
| ### New Plugin (simplexRampPlugin.ts) | ||
| - **Network errors**: More explicit error logging | ||
| - **Error propagation**: Re-throws `FiatProviderError` instances | ||
| - **Toast messages**: Direct `showToast` calls with same timeout | ||
|
|
||
| **Improvement**: ✅ New plugin has better error logging and handling | ||
|
|
||
| ## 8. API Endpoint Differences | ||
|
|
||
| ### Old Provider (simplexProvider.ts) | ||
| - **Hardcoded URLs**: Direct string literals in code | ||
| - **JWT endpoint**: `v1/jwtSign/${jwtTokenProvider}` for approval | ||
|
|
||
| ### New Plugin (simplexRampPlugin.ts) | ||
| - **Centralized URLs**: Constants in types file | ||
| - **Same endpoints**: Uses identical API URLs | ||
| - **Better organization**: All URLs in one place | ||
|
|
||
| **Improvement**: ✅ New plugin has better URL management | ||
|
|
||
| ## Key Inconsistencies Summary | ||
|
|
||
| 1. **Caching Duration**: 24 hours vs 2 minutes - This could impact API rate limits | ||
| 2. **Token Support**: Old supports tokens, new explicitly rejects them | ||
| 3. **Payment Type Validation**: New plugin doesn't validate payment types | ||
| 4. **WebView Handling**: New uses platform-specific libraries (SafariView/CustomTabs) | ||
| 5. **User ID Generation**: Different fallback patterns when makeUuid unavailable | ||
|
|
||
| ## Recommendations | ||
|
|
||
| 1. **Align caching duration**: Consider if 2-minute TTL is too aggressive | ||
| 2. **Clarify token support**: Document why tokens are not supported in new plugin | ||
| 3. **Add payment type validation**: Implement validation in checkSupport/fetchQuote | ||
| 4. **Document behavior changes**: Create migration guide for these differences | ||
| 5. **Test edge cases**: Verify behavior when makeUuid is unavailable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.