-
Notifications
You must be signed in to change notification settings - Fork 271
Sam/infinite ramp plugin #5715
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
base: develop
Are you sure you want to change the base?
Sam/infinite ramp plugin #5715
Conversation
This is an attempt to get the agent to automatically document lessons learned to the docs/ directory. This way conventions are maintained and over time as the agent is course corrected.
- Create docs/localization-guidelines.md with mandatory UI string localization rules - Create docs/component-styling-guidelines.md with styled HOC usage patterns - Update AGENTS.md with Documentation section indexing all docs/ files - Add rule requiring all docs/ markdown files to be indexed in AGENTS.md - Add localized strings for TradeRegionSelectScene to en_US.ts
This file contains run configuration such as RN_SIMULATOR and RN_PORT to be used by a rn-ios script. This is for development purposes
This is a consistent card design for the new fiat buy UI.
This component can be used with the PaymentOptionCard as the renderRight prop. This is apart of the new fiat buy UI design.
Initial architecture design.
Include plugin IDs in React Query key so quotes refetch when region/currency/wallet changes affect available plugins. Simplify queryFn to always check current plugins while reusing valid cached quotes.
- Move all API types and cleaners into infiniteApi.ts - Keep infiniteRampTypes.ts focused on plugin-specific types (init options, network mappings) - Implement full API client with auth, quote, and transfer methods - Add checkSupport logic validating regions, currencies, and networks - Add fetchQuote implementation with quote creation and approval flow - Include proper error handling and type safety throughout
- Create infiniteApiTypes.ts to separate types/cleaners from implementation - Fix critical bug where infiniteApi was using Edge info server's fetchInfo - Refactor to use cleanFetch for type-safe API calls - Maintain existing API interface while improving implementation
The apiKey field was not being used anywhere in the Infinite API implementation. Removing it simplifies the configuration and reduces unnecessary parameters.
- Add customer and bank account API methods to infiniteApi - Add types for customer creation and bank account management - Implement wallet-based authentication using challenge/response flow - Add KYC form integration that collects email and creates customer profile - Add bank account management with navigation to RampBankFormScene - Update approveQuote to handle full authentication workflow: - Check if authenticated, if not authenticate with wallet - Check if KYC completed, if not navigate to KYC form - Check if bank account exists, if not navigate to bank form - Create transfer with proper bank account ID - Support both buy (onramp) and sell (offramp) flows
- Add @noble/curves and @noble/hashes dependencies for secp256k1 crypto - Add createPrivateKey method to generate random 32-byte private keys - Add signChallenge method to sign messages with SHA-256 hash - Add getPublicKeyFromPrivate method to derive public keys - Update authentication flow to use dedicated private key instead of wallet signing - Store private key in Edge's secure dataStore with proper scoping - Use Uint8Array consistently for private key representation
- Remove cleanFetch dependency and inline fetch logic - Add fetchInfinite wrapper that handles base URL construction and error checking - Wrap all response cleaners with asJSON for direct JSON string parsing - Update signature generation to avoid deprecated toCompactRawBytes method - Simplify API methods by removing asJSON calls since cleaners handle JSON parsing
This reverts commit 004fb62.
…ibility The API expects the public key in Ethereum format (64 bytes without the uncompressed prefix byte). This fixes the 'Invalid public key format' error by slicing off the first byte (0x04) from the uncompressed secp256k1 public key.
…vate Replace the previous implementation that removed the 0x04 prefix with a Keccak256 hash of the entire uncompressed public key. This follows the standard approach used in Ethereum address derivation and should properly format the public key for the Infinite API.
… address The function now properly derives an Ethereum address by taking only the last 20 bytes (160 bits) of the Keccak256 hash, following the standard Ethereum address derivation process. This should resolve any remaining 'Invalid public key format' errors.
… address The Ethereum address derivation requires hashing only the x,y coordinates without the 0x04 uncompressed prefix byte. This fix ensures the function produces the same address as standard Ethereum tools like 'cast wallet address'.
- Replace SHA-256 with Keccak256 hashing - Add EIP-191 message prefix: '\x19Ethereum Signed Message:\n' + message.length - Include recovery id (v) in signature output (r + s + v format) - Remove unused sha256 import This matches the behavior of 'cast wallet sign' and standard Ethereum personal_sign implementations.
This is also where the dummy data was introduced.
- Extract authentication, KYC, and bank account logic into separate workflow modules - Create generic workflow pattern with Exit error for graceful termination - Add withWorkflow wrapper for unified error handling - Add InfiniteWorkflowUtils interface for consistent dependency injection - Create module-file-guidelines.md documenting file organization rules - Follow strict ordering: types → constants → functions, with exports before non-exports
- Remove custom styling and use EdgeRow components with EdgeCard sections - Add SectionHeader with localized 'Confirm Buy/Sell' text - Create reusable useBackEvent hook for handling back navigation - Add onCancel callback to RampBankFormScene with Exit error handling - Remove navigation logic from scenes, handled in workflows instead
…ion scene - Use navigation.replace in bankAccountWorkflow when showing bank form - Add replace parameter to confirmationWorkflow for conditional navigation - Track whether bank accounts exist before bankAccountWorkflow runs - Replace KYC verification scene with confirmation when bank exists - Add comment explaining the navigation replacement logic
…cement - Add kycSceneShown and bankFormShown flags to InfinitePluginState - Set kycSceneShown=true when showing KYC verification scene - Set bankFormShown=true/false based on whether bank form is shown - Only use navigation.replace in bankAccountWorkflow if KYC scene was shown - Only use navigation.replace in confirmationWorkflow if KYC was shown but bank form wasn't - This ensures proper navigation stack management based on actual workflow progression
@@ -53,7 +53,7 @@ if (ENV.SENTRY_ORGANIZATION_SLUG.includes('SENTRY_ORGANIZATION')) { | |||
} | |||
|
|||
// Uncomment the next line to remove popup warning/error boxes. | |||
// LogBox.ignoreAllLogs() | |||
LogBox.ignoreAllLogs() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Debugging Code Left Enabled
LogBox.ignoreAllLogs()
was uncommented, suppressing all React Native warnings and errors. This appears to be debugging code accidentally left enabled, which makes debugging much harder, particularly in production. The preceding comment indicates this line should typically remain commented out.
) | ||
if (token == null) return { supported: false } | ||
currencyCode = token.currencyCode | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Token Support Validation Uses Incorrect Wallet
In checkSupport
, the code arbitrarily picks the first wallet from account.currencyWallets
instead of finding one that matches cryptoAsset.pluginId
. This can cause incorrect token support validation, as the currencyConfig
from an unrelated wallet might be used.
CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
noneRequirements
If you have made any visual changes to the GUI. Make sure you have: