feat(frontend): send imported Solana balances to the user's own wallet - #13651
Draft
sbpublic wants to merge 3 commits into
Draft
feat(frontend): send imported Solana balances to the user's own wallet#13651sbpublic wants to merge 3 commits into
sbpublic wants to merge 3 commits into
Conversation
Native SOL and SPL tokens are signed by the imported wallet's own canister and broadcast by OISY. Solana signing is raw Ed25519 over the message bytes, which is exactly what a TransactionPartialSigner produces — so the imported signer drops into OISY's own sendSol in place of the default. sendSol gains one optional signerOverride parameter, backward-compatible for its existing callers, and everything else is reused: building the transfer, creating the destination token account when the OISY side does not hold that token yet, broadcast, and confirm. The fee is paid in SOL from the imported account, so a native send moves balance minus fee and an SPL send needs SOL present. SPL sufficiency beyond the base fee — the token-account rent — is left to the network to reject, rather than estimated up front. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Generalises the EVM-specific send gating to a shared fee-chain concept, so Solana reuses it rather than duplicating: isPlugFeeChain covers EVM and Solana, isPlugGasToken covers the tokens that need a native coin for their fee (ERC-20/ERC-4626 and SPL), and the "needs gas" reason names the native coin — BNB, ETH or SOL — accordingly. The Solana destination is the user's own OISY Solana address, mirroring the EVM path's use of the OISY EVM address. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Notes that sign_sol fits OISY's TransactionPartialSigner directly, that sendSol is reused via an injected signer, and that the fee gating is shared with EVM. BTC remains the one unbuilt chain, with its broadcast path still an open question. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
PR4 moves EVM balances of an imported wallet; this does the same for Solana — native SOL and SPL tokens.
Like the EVM addresses, the imported wallet's Solana address is a threshold key rooted in its own helper canister, so only that canister can sign for it. We ask it via
sign_soland broadcast ourselves.Stacked on #13650; review that first. This PR targets its branch.
Note
Draft. Not exercised against a funded Solana account —
sign_solhas not been called with a real transaction message, and the SPL path (which may create a destination token account) is untested end-to-end. One small real send would validate it.Changes
sign_solis raw Ed25519 over the message bytes — exactly what aTransactionPartialSignerproduces — so the imported signer drops into OISY's ownsendSolin place of the default.sendSolgains one optionalsignerOverrideparameter (backward-compatible; its three existing callers are unchanged). Everything else is reused: building the transfer, creating the destination token account when the OISY side does not yet hold that token, broadcast, and confirm.PRODUCT.mdand the spec.Two design points:
balance - feeand an SPL send needs SOL present. Rather than duplicate EVM's gating, this generalises it:isPlugFeeChaincovers EVM and Solana,isPlugGasTokencovers the tokens that need a native coin for their fee (ERC-20/ERC-4626 and SPL), and the "needs gas" message names the right coin — BNB, ETH or SOL. The tested EVM behaviour rides on the same predicates, so the EVM tests are the regression guard for the generalisation.The Solana destination is the user's own OISY Solana address, mirroring the EVM path.
Tests
plug-sol.services.spec.ts(4 cases): native reserves the fee and injects the imported signer; native below the fee refuses without sending; SPL sends the full balance; SPL with no SOL refuses without sending.PlugImportAccount.spec.ts(+3 cases): native SOL and funded-SPL rows offer an action; an SPL row with no SOL is blocked and names SOL.sol-send.services.spec.tsstill passes unchanged — thesignerOverrideaddition did not disturb the default path.Local gates, all green:
npm run formatnpm run lint -- --max-warnings 0(whole repo)npm run checknpm run check:testsvitestNot run locally: the full suite (unrelated
localStorage/jsdom failures onmain) andtest-coverage.compare-sizeswill fail as across the stack; the increase is known and accepted.🤖 Generated with Claude Code