-
Notifications
You must be signed in to change notification settings - Fork 34
feat: Export browser compatible Sui depositAndCall function #435
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: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThis pull request adds Sui chain support with browser-based signing capabilities, refactors account data utility functions into a dedicated module, updates all corresponding imports across utility files, and adds BIP32/BIP39 cryptographic dependencies to the package configuration. Changes
Sequence Diagram(s)sequenceDiagram
participant Browser
participant prepareSuiDepositAndCall as prepareSuiDepositAndCall
participant buildSuiDepositAndCallTransaction as buildSuiDepositAndCallTransaction
participant suiClient as Sui Client
Browser->>prepareSuiDepositAndCall: Call with options (chainId, signerAddress, etc.)
prepareSuiDepositAndCall->>prepareSuiDepositAndCall: Validate options against suiBrowserOptionsSchema
prepareSuiDepositAndCall->>buildSuiDepositAndCallTransaction: Invoke builder with validated options
alt Native SUI Transfer
buildSuiDepositAndCallTransaction->>buildSuiDepositAndCallTransaction: Process without signerAddress requirement
else Non-Native Token Transfer
buildSuiDepositAndCallTransaction->>buildSuiDepositAndCallTransaction: Validate signerAddress present
buildSuiDepositAndCallTransaction->>suiClient: Fetch coinObjectId using signerAddress
end
buildSuiDepositAndCallTransaction->>buildSuiDepositAndCallTransaction: Construct unsigned transaction
buildSuiDepositAndCallTransaction-->>prepareSuiDepositAndCall: Return { client, transaction }
prepareSuiDepositAndCall-->>Browser: Return unsigned transaction for browser signing
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Added browser-compatible Sui functionality by replacing Node.js-specific dependencies with browser-safe alternatives and creating a new
prepareSuiDepositAndCallfunction for wallet adapter integration.Key Changes
Browser-Safe Dependencies
bip39→@scure/bip39ethereum-cryptography/hdkey→@scure/bip32getAccountDatato separate file for better tree-shakingNew Browser-Compatible API
prepareSuiDepositAndCall- Returns unsigned transaction for browser wallet signingsuiBrowserOptionsSchema- Browser-friendly options withoutEd25519Keypairrequirement./chains/suipackage export for browser importsRefactored for DRY
buildSuiDepositAndCallTransactionhelperAPI Design
CLI (Node.js)
Browser (Wallet Adapters)
Benefits
Summary by CodeRabbit
Release Notes
New Features
Dependencies