Skip to content

Support TON → Solana sends in ccip-cli #211

Open
huangzhen1997 wants to merge 9 commits intomainfrom
fix-ton-to-solana
Open

Support TON → Solana sends in ccip-cli #211
huangzhen1997 wants to merge 9 commits intomainfrom
fix-ton-to-solana

Conversation

@huangzhen1997
Copy link
Copy Markdown
Contributor

@huangzhen1997 huangzhen1997 commented Mar 30, 2026

Adds SVMExtraArgsV1 encoding support for TON source chain, enabling TON → Solana CCIP messages.

  • encodeExtraArgsCell now detects SVM extraArgs (via computeUnits field) and encodes using TON TL-B format matching the on-chain SVMExtraArgsV1 struct (0x1f3b3aba tag)
  • buildCcipSendCell and getFee use getAddressBytes instead of getDataBytes for receiver addresses, supporting base58 Solana addresses directly
  • Fixes BUFFER_OVERRUN errors when passing Solana base58 addresses as --to or in tokenReceiver/accounts fields
  • Fix anyToSVM msg.receiver decoding

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 30, 2026

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

Project Deployment Actions Updated (UTC)
ccip-tools-ts Ready Ready Preview, Comment Apr 17, 2026 2:12pm

Request Review

@github-actions
Copy link
Copy Markdown

👋 huangzhen1997, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 30, 2026

Coverage Report

ℹ tests 774
ℹ suites 227
ℹ pass 772
ℹ fail 0
ℹ cancelled 0
ℹ skipped 2
ℹ todo 0
ℹ duration_ms 76056.983311

> @chainlink/ccip-cli@1.4.1 test
> node --test

▶ lane-latency command
  ✔ should output JSON format correctly (6.27461ms)
  ✔ should resolve chain IDs to chain selectors (0.732007ms)
  ✔ should use custom API URL when provided (2.650483ms)
  ✔ should output log format correctly (1.565314ms)
  ✔ should handle chain IDs as input (1.832132ms)
  ✔ should handle chain selectors as input (0.624937ms)
  ✔ should throw CCIPApiClientNotAvailableError when --no-api flag is set (1.409854ms)
  ✔ should work normally when --no-api flag is false (1.236167ms)
  ✔ should forward blockConfirmations to API URL (0.638062ms)
  ✔ should not include numOfBlocks when blockConfirmations is not provided (0.670673ms)
  ▶ CCIP_API environment variable integration
    ✔ should respect CCIP_API=false environment variable (0.640456ms)
  ✔ CCIP_API environment variable integration (1.136844ms)
✔ lane-latency command (20.926938ms)
▶ search messages command
  ✔ should throw CCIPApiClientNotAvailableError when --no-api flag is set (3.738403ms)
  ✔ should output JSON format correctly (18.114875ms)
  ✔ should pass sender filter to API (13.728492ms)
  ✔ should pass receiver filter to API (5.944994ms)
  ✔ should resolve source chain to selector (7.982079ms)
  ✔ should resolve dest chain to selector (7.895888ms)
  ✔ should pass manual-exec-only filter to API (5.684767ms)
  ✔ should treat limit 0 as unlimited (8.491721ms)
  ✔ should respect limit parameter (10.453691ms)
  ✔ should warn when no results found (1.532482ms)
  ✔ should use custom API URL when provided (3.119356ms)
  ✔ should warn on negative limit and fall back to default (11.784058ms)
  ✔ should output log format (2.986277ms)
✔ search messages command (104.076537ms)
▶ e2e command show EVM
  ▶ pretty format (default)
    ✔ should show complete CCIP transaction details EVM to EVM (9773.871973ms)
  ✔ pretty format (default) (9774.941711ms)
  ▶ json format
    ✔ should output valid JSON with all expected fields (8080.739849ms)
  ✔ json format (8080.957606ms)
  ▶ log format
    ✔ should output in log format with object assignments (7714.124904ms)
  ✔ log format (7714.39512ms)
  ▶ verbose flag
    ✔ should work with verbose flag enabled (8700.67594ms)
  ✔ verbose flag (8700.919564ms)
  ▶ error handling
    ✔ should handle invalid transaction hash gracefully (12576.585356ms)
    ✔ should require transaction hash argument (1536.046263ms)
  ✔ error handling (14112.972987ms)
  ✔ should show complete CCIP transaction details EVM to Aptos (8184.043605ms)
  ✔ should show complete CCIP transaction details EVM to Solana (5757.339076ms)
✔ e2e command show EVM (62327.017281ms)
▶ e2e command show Solana
  ✔ should show complete CCIP transaction details Solana to EVM (9895.543516ms)
✔ e2e command show Solana (9895.846191ms)
▶ e2e command show Aptos
  ✔ should show complete CCIP transaction details Aptos to EVM (7909.923699ms)
✔ e2e command show Aptos (7910.151936ms)
﹣ e2e command show TON (0.060112ms) # SKIP
▶ formatCCIPError
  ✔ should return null for non-CCIPError instances (1.080749ms)
  ✔ should format CCIPError with code and message (0.424283ms)
  ✔ should include help section with recovery hint (0.151673ms)
  ✔ should include note section for transient errors (0.245188ms)
  ✔ should include retry timing for transient errors with retryAfterMs (0.2459ms)
  ✔ should not include note section for permanent errors (0.168906ms)
  ✔ should format error with structured output (0.195566ms)
  ✔ should include stack trace when verbose is true (0.295001ms)
  ✔ should not include stack trace when verbose is false (0.169907ms)
✔ formatCCIPError (4.368088ms)
ℹ tests 43
ℹ suites 13
ℹ pass 43
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 80342.138933
-------------------------------|---------|----------|---------|---------|---------------------------
File                           | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s         
-------------------------------|---------|----------|---------|---------|---------------------------
All files                      |   74.88 |    76.63 |   60.55 |   74.88 |                           
 ccip-cli/src                  |   83.78 |    77.77 |      50 |   83.78 |                           
  index.ts                     |   83.78 |    77.77 |      50 |   83.78 | ...64,87-91,97-98,103-108 
 ccip-cli/src/commands         |   52.67 |    71.55 |   51.85 |   52.67 |                           
  index.ts                     |     100 |      100 |     100 |     100 |                           
  lane-latency.ts              |   72.56 |     90.9 |   33.33 |   72.56 | 41-56,63-70,105-111       
  manual-exec.ts               |   26.33 |      100 |       0 |   26.33 | 61-114,121-131,133-260    
  parse.ts                     |   57.14 |      100 |       0 |   57.14 | 46-50,57-64,66-91         
  search.ts                    |   81.25 |      100 |       0 |   81.25 | 24-29                     
  send.ts                      |   16.66 |      100 |       0 |   16.66 | ...72-179,189-218,220-414 
  show.ts                      |   85.86 |    59.32 |      60 |   85.86 | ...90-191,204-213,244-245 
  supported-tokens.ts          |   19.93 |      100 |       0 |   19.93 | ...04-224,226-281,283-296 
  token.ts                     |   22.72 |      100 |       0 |   22.72 | 24-53,60-67,69-132        
  types.ts                     |     100 |      100 |     100 |     100 |                           
  utils.ts                     |   85.31 |    73.57 |    92.3 |   85.31 | ...86-596,604-612,622-628 
 ccip-cli/src/commands/search  |   49.37 |     87.5 |   14.28 |   49.37 |                           
  messages.ts                  |   49.37 |     87.5 |   14.28 |   49.37 | ...78-180,182-204,206-241 
 ccip-cli/src/providers        |    51.9 |    75.51 |      16 |    51.9 |                           
  aptos.ts                     |   53.65 |      100 |       0 |   53.65 | ...70,78-85,91-92,101-123 
  evm.ts                       |    39.7 |      100 |       0 |    39.7 | 23,40-50,56-85,97-136     
  index.ts                     |   81.65 |    72.72 |      80 |   81.65 | 50-51,190-229             
  solana.ts                    |   50.42 |      100 |       0 |   50.42 | ...-71,79-85,89-90,99-117 
  sui.ts                       |   64.28 |      100 |       0 |   64.28 | 10-14                     
  ton.ts                       |   14.58 |      100 |       0 |   14.58 | 22-144                    
 ccip-sdk/src                  |   94.38 |    82.04 |    92.4 |   94.38 |                           
  chain.ts                     |   93.25 |    81.33 |   71.42 |   93.25 | ...18,1667-1668,1701-1702 
  commits.ts                   |     100 |    95.23 |     100 |     100 | 52                        
  execution.ts                 |   92.19 |     92.3 |     100 |   92.19 | 130-137,149-156           
  explorer.ts                  |     100 |      100 |     100 |     100 |                           
  extra-args.ts                |     100 |    86.66 |     100 |     100 | 179,214                   
  gas.ts                       |   89.75 |       40 |     100 |   89.75 | 108-119,147-151           
  http-status.ts               |     100 |      100 |     100 |     100 |                           
  index.ts                     |     100 |      100 |     100 |     100 |                           
  messages.ts                  |   88.48 |    45.09 |     100 |   88.48 | ...19-220,229-230,254-255 
  offchain.ts                  |   91.94 |    76.74 |     100 |   91.94 | ...90,208,223-225,227-233 
  requests.ts                  |   90.61 |    82.07 |     100 |   90.61 | ...81-282,350-363,365-369 
  supported-chains.ts          |     100 |      100 |     100 |     100 |                           
  types.ts                     |     100 |      100 |     100 |     100 |                           
  utils.ts                     |    96.3 |    90.16 |     100 |    96.3 | ...52,768,869-870,877-885 
 ccip-sdk/src/api              |   93.73 |    84.87 |   94.11 |   93.73 |                           
  index.ts                     |   93.73 |    84.87 |   94.11 |   93.73 | ...37-742,753-756,759-762 
 ccip-sdk/src/aptos            |    55.7 |    69.46 |   55.73 |    55.7 |                           
  exec.ts                      |   29.31 |      100 |       0 |   29.31 | 18-58                     
  hasher.ts                    |   76.31 |       80 |   66.66 |   76.31 | 19-38,52-58               
  index.ts                     |    56.4 |       75 |   58.13 |    56.4 | ...26-828,832-858,862-873 
  logs.ts                      |   78.52 |    57.44 |      75 |   78.52 | ...90-196,200-233,264-268 
  send.ts                      |    25.2 |      100 |       0 |    25.2 | 10-51,62-79,92-123        
  token.ts                     |   23.75 |       75 |     100 |   23.75 | 35-156                    
  types.ts                     |   65.62 |      100 |       0 |   65.62 | 25-32,64-88               
 ccip-sdk/src/errors           |   87.33 |    75.94 |   47.96 |   87.33 |                           
  CCIPError.ts                 |     100 |      100 |     100 |     100 |                           
  codes.ts                     |     100 |      100 |     100 |     100 |                           
  index.ts                     |     100 |      100 |     100 |     100 |                           
  recovery.ts                  |     100 |      100 |     100 |     100 |                           
  specialized.ts               |   84.59 |    70.88 |   45.29 |   84.59 | ...12,3333-3342,3363-3372 
  utils.ts                     |   94.44 |    81.48 |     100 |   94.44 | 15,17,22,24               
 ccip-sdk/src/evm              |   83.15 |    74.31 |   88.88 |   83.15 |                           
  const.ts                     |     100 |      100 |     100 |     100 |                           
  errors.ts                    |   84.03 |    78.57 |     100 |   84.03 | ...57-164,170-172,219-237 
  extra-args.ts                |   94.45 |    61.66 |     100 |   94.45 | ...83-184,209-210,327-339 
  fork.test.data.ts            |     100 |      100 |     100 |     100 |                           
  gas.ts                       |   97.97 |    53.33 |     100 |   97.97 | 72-73,75                  
  hasher.ts                    |     100 |     92.3 |     100 |     100 | 134                       
  index.ts                     |   80.49 |       75 |      90 |   80.49 | ...72,2137-2153,2179-2186 
  logs.ts                      |   34.32 |    68.42 |      25 |   34.32 | ...13-214,229-258,275-302 
  messages.ts                  |     100 |      100 |     100 |     100 |                           
  offchain.ts                  |   81.25 |    33.33 |     100 |   81.25 | 11,13-14                  
  types.ts                     |     100 |      100 |     100 |     100 |                           
 ccip-sdk/src/evm/viem         |   77.72 |       92 |   69.23 |   77.72 |                           
  client-adapter.ts            |     100 |     92.3 |     100 |     100 | 48                        
  index.ts                     |     100 |      100 |     100 |     100 |                           
  wallet-adapter.ts            |   63.09 |     90.9 |   55.55 |   63.09 | ...6,53-73,91-124,131-157 
 ccip-sdk/src/hasher           |   94.29 |    78.94 |     100 |   94.29 |                           
  common.ts                    |     100 |      100 |     100 |     100 |                           
  hasher.ts                    |     100 |    66.66 |     100 |     100 | 19                        
  index.ts                     |     100 |      100 |     100 |     100 |                           
  merklemulti.ts               |   93.43 |       78 |     100 |   93.43 | ...59-260,306-307,315-316 
 ccip-sdk/src/shared           |   88.05 |    69.23 |     100 |   88.05 |                           
  bcs-codecs.ts                |   87.87 |    66.66 |     100 |   87.87 | 75-87,104-106             
  constants.ts                 |     100 |      100 |     100 |     100 |                           
 ccip-sdk/src/solana           |   72.59 |    67.02 |   77.01 |   72.59 |                           
  cleanup.ts                   |   26.63 |    66.66 |   33.33 |   26.63 | 43-53,59-101,113-226      
  exec.ts                      |   68.47 |    63.63 |   66.66 |   68.47 | ...66,283-290,433,450-452 
  fork.test.data.ts            |     100 |      100 |     100 |     100 |                           
  hasher.ts                    |   96.58 |    81.81 |     100 |   96.58 | 67-70                     
  index.ts                     |   76.88 |       75 |   78.84 |   76.88 | ...52,1556-1577,1581-1614 
  logs.ts                      |   74.83 |    38.88 |     100 |   74.83 | 38-39,50-51,53-54,56-88   
  offchain.ts                  |   68.88 |    33.33 |     100 |   68.88 | 30-43                     
  patchBorsh.ts                |   78.31 |       50 |     100 |   78.31 | 34-35,41-47,65-66,72-78   
  send.ts                      |    76.5 |    38.09 |      80 |    76.5 | ...71-272,277-285,327-366 
  types.ts                     |     100 |      100 |     100 |     100 |                           
  utils.ts                     |   67.28 |    65.38 |   63.63 |   67.28 | ...34-437,440-442,474-489 
 ccip-sdk/src/sui              |   32.85 |    89.47 |   17.24 |   32.85 |                           
  discovery.ts                 |   15.13 |      100 |       0 |   15.13 | 20-36,49-185,188-218      
  events.ts                    |   19.85 |      100 |       0 |   19.85 | ...18-275,280-398,407-428 
  exec.ts                      |   31.29 |      100 |       0 |   31.29 | 31-74,86-131              
  hasher.ts                    |   98.16 |    66.66 |     100 |   98.16 | 33,49                     
  index.ts                     |   41.01 |    93.18 |   17.94 |   41.01 | ...97-798,802-803,807-808 
  objects.ts                   |   18.93 |      100 |       0 |   18.93 | ...04-119,133-184,195-338 
 ccip-sdk/src/sui/manuallyExec |   39.63 |      100 |       0 |   39.63 |                           
  encoder.ts                   |   47.67 |      100 |       0 |   47.67 | 42-86                     
  index.ts                     |   34.35 |      100 |       0 |   34.35 | 46-131                    
 ccip-sdk/src/ton              |   73.69 |    81.13 |   64.47 |   73.69 |                           
  exec.ts                      |     100 |      100 |     100 |     100 |                           
  hasher.ts                    |   77.95 |    77.77 |      75 |   77.95 | 99-107,155-186            
  index.ts                     |   70.77 |    75.86 |   52.27 |   70.77 | ...08,1215-1216,1223-1224 
  logs.ts                      |     100 |    98.43 |     100 |     100 | 56                        
  send.ts                      |   81.94 |    64.51 |      80 |   81.94 | ...,86-87,130-155,167-191 
  types.ts                     |   77.94 |    69.23 |   66.66 |   77.94 | ...-73,91,118-131,133-136 
  utils.ts                     |   60.88 |    83.72 |    87.5 |   60.88 | ...55-261,269-327,329-332 
-------------------------------|---------|----------|---------|---------|---------------------------

Farber98
Farber98 previously approved these changes Mar 31, 2026
Copy link
Copy Markdown
Collaborator

@andrevmatos andrevmatos left a comment

Choose a reason for hiding this comment

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

Some simplifications, but mostly lgtm

Comment thread ccip-sdk/src/ton/send.ts Outdated
Comment thread ccip-sdk/src/ton/send.ts Outdated
Comment thread ccip-sdk/src/ton/send.ts Outdated
Copy link
Copy Markdown
Contributor

@krebernisak krebernisak left a comment

Choose a reason for hiding this comment

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

LGTM - I second feedback from Andre, and would be great to add SUI in the same PR

Comment thread ccip-sdk/src/ton/send.ts
Comment thread ccip-sdk/src/ton/send.ts
.storeUint(tokenReceiver, 256) // uint256
.storeRef(accountsCell) // SnakedCell<uint256>

return builder.endCell()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we please test TONChain.encodeExtraArgs() with these, and decodeExtraArgs its result?
The encode method isn't actively used right now, as we build the cells directly here from the ExtraArgs object when we need to ccipSend below, so we use the Cell result directly, which should be fine.

But in ccip-o11y, we'll need to serialize those to store in ccip-o11y-db, and it'd be good to have a consistent way to serialize them here (we may eventually pull ccip-sdk into ccip-o11y, and then we'll need this). Also, the serialized extraArgs coming from ccip-o11y db through CCIP-API for these will be decoded.

So far for EVM, our idea was to store only the bits content of the cell in serialized form (i.e. NOT the whole serialized cell), so it can begin with the tag, for consistency with all other chain families. But we need to make sure this also works for these snaked cells.

Comment thread ccip-sdk/src/ton/send.ts Outdated
Comment thread ccip-sdk/src/ton/send.ts Outdated
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.

4 participants