feat(sdk-coin-sol): derive SPL token (ATA) deposit addresses#9080
Open
rajangarg047 wants to merge 1 commit into
Open
feat(sdk-coin-sol): derive SPL token (ATA) deposit addresses#9080rajangarg047 wants to merge 1 commit into
rajangarg047 wants to merge 1 commit into
Conversation
Extend SOL deriveAddress to support SPL token deposit addresses. When a tokenName (e.g. sol:usdc) is supplied, derive the native owner address as before, then return the owner's Associated Token Account (ATA) for that token's mint — using the same getAssociatedTokenAccountAddress helper (statics mint + programId lookup, token-2022 aware) that the rest of the SOL coin uses, so the derived address matches what BitGo assigns as the token receive address. - sdk-core: add tokenName to DeriveAddressOptions. - express: accept tokenName on the address/derive request body. - tests: exact ATA for sol:usdc at a known index, parity with getAssociatedTokenAccountAddress, and unknown-token error. WCN-1054 Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Summary
Extends SOL
deriveAddressto support SPL token deposit addresses. When atokenName(e.g.sol:usdc) is supplied, it derives the native owner address as before, then returns the owner's Associated Token Account (ATA) for that token's mint.It reuses the existing
getAssociatedTokenAccountAddresshelper — same statics mint +programIdlookup (token-2022 aware) that the rest of the SOL coin uses to build token addresses — so the derived value matches what BitGo assigns as the token receive address. No token requested → native address as before (unchanged).Changes
tokenNametoDeriveAddressOptions.deriveAddress.tokenNameon theaddress/deriverequest body.sol:usdcat a known index (FG1XMJdXBQ5uYaNoKposABg6erxsvzbwC283W2ipnjQB), parity check againstgetAssociatedTokenAccountAddress, and unknown-token error.Context
WCN-1054 (FR-465 Phase 2) — Bullish confirmed SPL tokens are needed. ERC-20 on EVM needs nothing extra (tokens reuse the wallet/forwarder address); this is Solana-specific because token deposits go to a per-mint ATA.
Test plan
tscclean (sdk-core, sdk-coin-sol, express)eslintclean (0 errors)deriveAddressunit tests pass (incl. 3 new token tests); ATA matches the independentgetAssociatedTokenAccountAddresscomputationtokenNamefield🤖 Generated with Claude Code