feat(sdk): add approve/revoke delegation for light-token ATAs#2351
feat(sdk): add approve/revoke delegation for light-token ATAs#2351SwenSchaeferjohann merged 14 commits intomainfrom
Conversation
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (24)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
84166d7 to
13ab9fe
Compare
… ATAs Add TypeScript SDK functions to call the on-chain CTokenApprove (discriminator 4) and CTokenRevoke (discriminator 5) instruction handlers for light-token associated token accounts. New files: - instructions/approve-revoke.ts: sync instruction builders matching Rust SDK layout - actions/approve-interface.ts: async actions with cold loading + tx sending - tests/e2e/approve-revoke-light-token.test.ts: unit + E2E tests Also adds getLightTokenDelegate helper and extends FrozenOperation type.
Avoid unnecessary getMintInterface RPC call when caller provides decimals.
Add transferDelegatedInterface action and unified wrapper, completing the approve → transfer → revoke delegation flow for light-token ATAs.
Update transferDelegatedInterface and createTransferDelegatedInterfaceInstructions to accept a recipient wallet address instead of an explicit destination token account, matching the transferInterface convention from PR #2354. ATA derivation and idempotent creation now happen internally for all programId variants (light-token, SPL, Token-2022).
13ab9fe to
81d9662
Compare
js/compressed-token/src/v3/actions/transfer-delegated-interface.ts
Outdated
Show resolved
Hide resolved
…ner==feePayer E2E test Add @remarks to approve/revoke functions documenting that for light-token mints, all cold (compressed) balances are loaded into the hot ATA regardless of the delegation amount. Add E2E test covering the owner==feePayer code path which was previously only tested at the unit level.
Summary
createLightTokenApproveInstruction(discriminator 4) andcreateLightTokenRevokeInstruction(discriminator 5) instruction builders matching Rust SDK account layoutapproveInterface/revokeInterfaceasync actions with cold loading + tx sending, following thetransferInterfacepatterngetLightTokenDelegatetest helper and extendFrozenOperationtype with'approve' | 'revoke'src/index.tsandsrc/v3/unified/index.tsTest plan
LIGHT_PROTOCOL_VERSION=V2 pnpm run buildpasses (all 5 bundles)LIGHT_PROTOCOL_VERSION=V2 npx vitest run tests/e2e/approve-revoke-light-token.test.ts