Skip to content

Comments

feat: add TransferChecked (discriminator 12) to TypeScript SDK#2308

Open
tilo-14 wants to merge 1 commit intomainfrom
feat/transfer-checked-ts
Open

feat: add TransferChecked (discriminator 12) to TypeScript SDK#2308
tilo-14 wants to merge 1 commit intomainfrom
feat/transfer-checked-ts

Conversation

@tilo-14
Copy link
Contributor

@tilo-14 tilo-14 commented Feb 21, 2026

Summary

  • Adds createLightTokenTransferCheckedInstruction (discriminator 12, 10-byte data: disc + u64 LE amount + u8 decimals, 4 accounts: source/mint/dest/authority)
  • Adds createTransferInterfaceInstruction and createTransferInterfaceCheckedInstruction as interface-level routers that dispatch to light-token, SPL, or T22
  • Adds transferInterfaceChecked high-level action with decimals parameter
  • Adds checkedDecimals option to TransferOptions for instruction-level control
  • Exports all new functions from index.ts and unified/index.ts

Based on #2271 — TypeScript-only subset adapted to current naming (LIGHT_TOKEN_PROGRAM_ID, createLightTokenTransferInstruction).

Test plan

  • pnpm build succeeds in js/compressed-token
  • Generated .d.ts includes all new exports
  • Unit tests: instruction account layout, data encoding (disc=12, amount, decimals), interface routing
  • E2e tests: hot balance checked transfer, wrong decimals rejection, cold auto-load checked transfer

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 21, 2026

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (5)
  • js/compressed-token/src/index.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/transfer-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/transfer-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/unified/index.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/transfer-interface.test.ts is excluded by none and included by none

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/transfer-checked-ts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Add checked transfer variant that validates decimals on-chain, matching
SPL Token's transferChecked semantics.

New instruction builders:
- createLightTokenTransferCheckedInstruction: light-token specific (disc 12)
- createTransferInterfaceInstruction: interface router for basic transfer
- createTransferInterfaceCheckedInstruction: interface router for checked

New action:
- transferInterfaceChecked: high-level action with decimals validation

TransferOptions gains checkedDecimals field used by
createTransferInterfaceInstructions to select checked vs basic transfer.
@tilo-14 tilo-14 force-pushed the feat/transfer-checked-ts branch from fbe3f5c to b908d37 Compare February 21, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant