Skip to content

TON-1524: add fields for ton/jetton/nft transfer actions#470

Open
heyllog wants to merge 2 commits into
mainfrom
feat/TON-1524-jetton-transfer
Open

TON-1524: add fields for ton/jetton/nft transfer actions#470
heyllog wants to merge 2 commits into
mainfrom
feat/TON-1524-jetton-transfer

Conversation

@heyllog

@heyllog heyllog commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Jetton transfers now include optional advanced parameters: queryId, forwardAmount, forwardPayload, customPayload, and gasAmount
    • NFT transfers now include optional advanced parameters: responseDestination, queryId, forwardAmount, forwardPayload, customPayload, and gasAmount
    • TON transfers now support optional extraCurrency parameter
    • Breaking change: NFT transfer amount parameter renamed to gasAmount
  • Tests

    • Comprehensive test coverage added for transfer operations

@heyllog heyllog self-assigned this Jun 16, 2026
@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
appkit-minter Ready Ready Preview, Comment Jun 16, 2026 12:05pm
kit-demo-wallet Ready Ready Preview, Comment Jun 16, 2026 12:05pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Three transfer transaction builders (createTransferJettonTransaction, createTransferNftTransaction, createTransferTonTransaction) are extended with optional advanced parameters. Jetton and NFT builders are rewritten from helper-based construction to direct low-level cell serialization. NFT amount is renamed to gasAmount. ExtraCurrencies is re-exported from @ton/walletkit. Full Vitest suites are added for all three builders.

Changes

Advanced Transfer Parameters

Layer / File(s) Summary
TON transfer: ExtraCurrencies type and extraCurrency param
packages/appkit/src/types/transaction.ts, packages/appkit/src/actions/transaction/create-transfer-ton-transaction.ts, packages/appkit/src/actions/transaction/create-transfer-ton-transaction.test.ts
ExtraCurrencies is re-exported from @ton/walletkit; CreateTransferTonTransactionParameters gains optional extraCurrency; the builder destructures and forwards it into TransactionRequestMessage; new tests cover amount conversion, comment/payload precedence, stateInit/extraCurrency forwarding, and no-wallet error.
Jetton transfer: advanced params and direct cell construction
packages/appkit/src/actions/jettons/create-transfer-jetton-transaction.ts, packages/appkit/src/actions/jettons/create-transfer-jetton-transaction.test.ts
Imports switch from createJettonTransferPayload/createTransferTransaction to beginCell/storeJettonTransferMessage; CreateTransferJettonTransactionParameters gains optional queryId, forwardAmount, forwardPayload, customPayload, gasAmount; forwardPayload takes precedence over comment; message is serialized to base64 and returned as { messages, fromAddress }; tests verify defaults, comment encoding, precedence, all advanced fields, and no-wallet rejection.
NFT transfer: advanced params, gasAmount rename, and direct cell construction
packages/appkit/src/actions/nft/create-transfer-nft-transaction.ts, packages/appkit/src/actions/nft/create-transfer-nft-transaction.test.ts
CreateTransferNftTransactionParameters removes amount and adds gasAmount, responseDestination, queryId, forwardAmount, forwardPayload, customPayload; builder is rewritten using storeNftTransferMessage with the same forwardPayload-over-comment precedence; tests mirror the jetton suite plus responseDestination coverage.
Changeset documentation
.changeset/transfer-advanced-params.md
Documents the new optional advanced transfer parameters, payload encoding/format rules, precedence semantics, and the breaking amountgasAmount rename for NFT transfers.

Sequence Diagram(s)

sequenceDiagram
  rect rgba(100, 149, 237, 0.5)
    Note over Caller,storeJettonTransferMessage: Jetton Transfer
    Caller->>createTransferJettonTransaction: amount, forwardPayload?, comment?, queryId?, gasAmount?
    createTransferJettonTransaction->>getJettonWalletAddressFromClient: ownerAddress, jettonMasterAddress
    getJettonWalletAddressFromClient-->>createTransferJettonTransaction: jettonWalletAddress
    createTransferJettonTransaction->>storeJettonTransferMessage: queryId, parsed amount, addresses, customPayload, forwardAmount, forwardPayloadCell
    storeJettonTransferMessage-->>createTransferJettonTransaction: Cell
    createTransferJettonTransaction-->>Caller: messages[{address, amount: gasAmount, payload}], fromAddress
  end
  rect rgba(60, 179, 113, 0.5)
    Note over Caller,storeNftTransferMessage: NFT Transfer
    Caller->>createTransferNftTransaction: nftAddress, recipientAddress, forwardPayload?, comment?, gasAmount?, responseDestination?
    createTransferNftTransaction->>storeNftTransferMessage: queryId, newOwner, responseDestination, customPayload, forwardAmount, forwardPayloadCell
    storeNftTransferMessage-->>createTransferNftTransaction: Cell
    createTransferNftTransaction-->>Caller: messages[{address, amount: gasAmount, payload}], fromAddress
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐇 Hopping through cells and base64 bytes,
The rabbit encoded some payloads just right.
forwardPayload wins when both fields appear,
gasAmount replaces amount—now crystal clear!
Extra currencies, queryIds, and more—
The transfer API hops further than before! 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding optional advanced transfer parameters (fields) to TON, Jetton, and NFT transfer actions and their APIs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/TON-1524-jetton-transfer

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/appkit/src/actions/jettons/create-transfer-jetton-transaction.ts`:
- Around line 11-17: Replace direct imports from `@ton/walletkit` with imports
from local re-export modules to enforce consistent import boundaries. In
packages/appkit/src/actions/jettons/create-transfer-jetton-transaction.ts (lines
11-17), replace the imports of storeJettonTransferMessage, createCommentPayload,
getJettonWalletAddressFromClient, DEFAULT_JETTON_GAS_FEE,
DEFAULT_FORWARD_AMOUNT, and parseUnits with imports from a local jettons
re-export module. Create or update a re-export file (likely
packages/appkit/src/actions/jettons/index.ts or similar) that re-exports these
items from `@ton/walletkit`. In packages/appkit/src/types/transaction.ts (line
15), remove the direct re-export of ExtraCurrencies from `@ton/walletkit` and
instead import it from the local re-export module. In
packages/appkit/src/actions/jettons/create-transfer-jetton-transaction.test.ts
(line 11), update imports to consume these items from the local jettons
re-export module. In
packages/appkit/src/actions/nft/create-transfer-nft-transaction.ts (lines
10-15), replace direct `@ton/walletkit` imports with imports from a local nft
re-export module. In
packages/appkit/src/actions/nft/create-transfer-nft-transaction.test.ts (line
11), update imports to consume items from the local nft re-export module.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5cc237f7-c45f-4eb5-8fdf-d33490603257

📥 Commits

Reviewing files that changed from the base of the PR and between 131252a and f04e34f.

📒 Files selected for processing (8)
  • .changeset/transfer-advanced-params.md
  • packages/appkit/src/actions/jettons/create-transfer-jetton-transaction.test.ts
  • packages/appkit/src/actions/jettons/create-transfer-jetton-transaction.ts
  • packages/appkit/src/actions/nft/create-transfer-nft-transaction.test.ts
  • packages/appkit/src/actions/nft/create-transfer-nft-transaction.ts
  • packages/appkit/src/actions/transaction/create-transfer-ton-transaction.test.ts
  • packages/appkit/src/actions/transaction/create-transfer-ton-transaction.ts
  • packages/appkit/src/types/transaction.ts

Comment on lines +11 to 17
storeJettonTransferMessage,
createCommentPayload,
getJettonWalletAddressFromClient,
DEFAULT_JETTON_GAS_FEE,
DEFAULT_FORWARD_AMOUNT,
parseUnits,
} from '@ton/walletkit';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Route @ton/walletkit access through local AppKit re-export modules.

These changes add direct @ton/walletkit imports/re-exports inside packages/appkit/src/**, which breaks the import-boundary rule and creates inconsistent dependency direction across runtime and test code.

  • packages/appkit/src/actions/jettons/create-transfer-jetton-transaction.ts#L11-L17: replace direct imports with imports from a local src/<module>/index.ts re-export.
  • packages/appkit/src/types/transaction.ts#L15-L15: expose ExtraCurrencies via the same local re-export boundary instead of re-exporting directly from @ton/walletkit.
  • packages/appkit/src/actions/jettons/create-transfer-jetton-transaction.test.ts#L11-L11: consume constants/functions through local re-exports, matching app code boundaries.
  • packages/appkit/src/actions/nft/create-transfer-nft-transaction.ts#L10-L15: replace direct imports with local re-export imports.
  • packages/appkit/src/actions/nft/create-transfer-nft-transaction.test.ts#L11-L11: replace direct imports with local re-export imports.

As per coding guidelines, "packages/appkit/src/**/*.{ts,tsx}: Never import from @ton/walletkit directly in appkit code. Instead, create re-export files under src/<module>/index.ts that re-export types and functions from @ton/walletkit."

📍 Affects 5 files
  • packages/appkit/src/actions/jettons/create-transfer-jetton-transaction.ts#L11-L17 (this comment)
  • packages/appkit/src/types/transaction.ts#L15-L15
  • packages/appkit/src/actions/jettons/create-transfer-jetton-transaction.test.ts#L11-L11
  • packages/appkit/src/actions/nft/create-transfer-nft-transaction.ts#L10-L15
  • packages/appkit/src/actions/nft/create-transfer-nft-transaction.test.ts#L11-L11
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/appkit/src/actions/jettons/create-transfer-jetton-transaction.ts`
around lines 11 - 17, Replace direct imports from `@ton/walletkit` with imports
from local re-export modules to enforce consistent import boundaries. In
packages/appkit/src/actions/jettons/create-transfer-jetton-transaction.ts (lines
11-17), replace the imports of storeJettonTransferMessage, createCommentPayload,
getJettonWalletAddressFromClient, DEFAULT_JETTON_GAS_FEE,
DEFAULT_FORWARD_AMOUNT, and parseUnits with imports from a local jettons
re-export module. Create or update a re-export file (likely
packages/appkit/src/actions/jettons/index.ts or similar) that re-exports these
items from `@ton/walletkit`. In packages/appkit/src/types/transaction.ts (line
15), remove the direct re-export of ExtraCurrencies from `@ton/walletkit` and
instead import it from the local re-export module. In
packages/appkit/src/actions/jettons/create-transfer-jetton-transaction.test.ts
(line 11), update imports to consume these items from the local jettons
re-export module. In
packages/appkit/src/actions/nft/create-transfer-nft-transaction.ts (lines
10-15), replace direct `@ton/walletkit` imports with imports from a local nft
re-export module. In
packages/appkit/src/actions/nft/create-transfer-nft-transaction.test.ts (line
11), update imports to consume items from the local nft re-export module.

Source: Coding guidelines

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