@chainlink/ccip-cli 0.93.0 → 0.95.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +96 -40
  2. package/dist/commands/manual-exec.d.ts.map +1 -1
  3. package/dist/commands/manual-exec.js +11 -11
  4. package/dist/commands/manual-exec.js.map +1 -1
  5. package/dist/commands/send.d.ts +6 -10
  6. package/dist/commands/send.d.ts.map +1 -1
  7. package/dist/commands/send.js +72 -89
  8. package/dist/commands/send.js.map +1 -1
  9. package/dist/commands/show.d.ts.map +1 -1
  10. package/dist/commands/show.js +2 -4
  11. package/dist/commands/show.js.map +1 -1
  12. package/dist/commands/supported-tokens.d.ts +2 -2
  13. package/dist/commands/supported-tokens.d.ts.map +1 -1
  14. package/dist/commands/supported-tokens.js +22 -10
  15. package/dist/commands/supported-tokens.js.map +1 -1
  16. package/dist/commands/token.d.ts +26 -0
  17. package/dist/commands/token.d.ts.map +1 -0
  18. package/dist/commands/token.js +105 -0
  19. package/dist/commands/token.js.map +1 -0
  20. package/dist/commands/utils.d.ts.map +1 -1
  21. package/dist/commands/utils.js +21 -7
  22. package/dist/commands/utils.js.map +1 -1
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.js +2 -2
  25. package/dist/index.js.map +1 -1
  26. package/dist/providers/index.d.ts.map +1 -1
  27. package/dist/providers/index.js +3 -3
  28. package/dist/providers/index.js.map +1 -1
  29. package/package.json +17 -17
  30. package/src/commands/manual-exec.ts +13 -23
  31. package/src/commands/send.ts +78 -107
  32. package/src/commands/show.ts +1 -4
  33. package/src/commands/supported-tokens.ts +21 -10
  34. package/src/commands/token.ts +132 -0
  35. package/src/commands/utils.ts +23 -6
  36. package/src/index.ts +2 -2
  37. package/src/providers/index.ts +7 -3
package/README.md CHANGED
@@ -44,8 +44,8 @@ alias ccip-cli="$PWD/ccip-cli/ccip-cli" # optional, to run from local repo dire
44
44
  All commands require a list of RPCs endpoints for the networks of interest (source and destination).
45
45
  Both `http[s]` and `ws[s]` (websocket) URLs are supported.
46
46
 
47
- This list can be passed in the command line, through the `-r/--rpcs` option; it may be passed
48
- multiple times, e.g. `-r <source_rpc> -r <dest_rpc>`, and are merged with those fetched from the
47
+ This list can be passed in the command line, through the `--rpc/--rpcs` option; it may be passed
48
+ multiple times, e.g. `--rpc <source_rpc> --rpc <dest_rpc>`, and are merged with those fetched from the
49
49
  rpcs file (`--rpcs-file`, default=`./.env`), which may contain multiple endpoints, one per line,
50
50
  with any prefix or suffix (only URLs are parsed).
51
51
 
@@ -112,7 +112,10 @@ don't support large ranges)
112
112
  ### `send`
113
113
 
114
114
  ```sh
115
- ccip-cli send 11155111 0x0BF3dE8c5D3e8A2B34D2BEeB17ABfCeBaf363A59 ethereum-testnet-sepolia-arbitrum-1 \
115
+ ccip-cli send \
116
+ --source ethereum-testnet-sepolia \
117
+ --dest ethereum-testnet-sepolia-arbitrum-1 \
118
+ --router 0x0BF3dE8c5D3e8A2B34D2BEeB17ABfCeBaf363A59 \
116
119
  --receiver 0xAB4f961939BFE6A93567cC57C59eEd7084CE2131 \
117
120
  --data 'hello world' \
118
121
  --gas-limit 300000 \
@@ -120,37 +123,49 @@ ccip-cli send 11155111 0x0BF3dE8c5D3e8A2B34D2BEeB17ABfCeBaf363A59 ethereum-testn
120
123
  --transfer-tokens 0xFd57b4ddBf88a4e07fF4e34C487b99af2Fe82a05=0.1
121
124
  ```
122
125
 
123
- Sends a message from router on source network, to dest; positional parameters are:
126
+ Sends a CCIP message from source to destination chain.
124
127
 
125
- 1. `source`: chainId or name
126
- 2. `router`: address on source
127
- 3. `dest`: chainId or name
128
+ **Required options:**
128
129
 
129
- If `--receiver` is omitted, sends to self (sender, see [Wallet](#wallet) section above) address on
130
- dest, if to same chain family (e.g. EVM-to-EVM). If not same chain family, it is mandatory.
130
+ | Option | Alias | Description |
131
+ |--------|-------|-------------|
132
+ | `--source` | `-s` | Source chain (chainId, selector, or name) |
133
+ | `--dest` | `-d` | Destination chain (chainId, selector, or name) |
134
+ | `--router` | `-r` | Router contract address on source |
131
135
 
132
- If `--data` is not a hex-string, it will be UTF-8 encoded.
136
+ **Message options:**
133
137
 
134
- If `--gas-limit` is omitted, ramp default config (usually 200k) is used.
135
- It can be `0` to disable execution on receiver.
136
- `--estimate-gas-limit` can be provided instead, to estimate the gas limit for the message execution.
137
- It receives a percentage margin (e.g. `--estimate-gas-limit=10` for +10% margin), which is added to
138
- the estimation before sending the message.
139
- `--only-estimate` prints gas estimation then exits.
138
+ | Option | Alias | Description |
139
+ |--------|-------|-------------|
140
+ | `--receiver` | `--to` | Receiver address; defaults to sender if same chain family |
141
+ | `--data` | | Data payload (non-hex = UTF-8 encoded) |
142
+ | `--gas-limit` | `-L` | Gas limit for receiver callback (default: ramp config) |
143
+ | `--estimate-gas-limit` | | Auto-estimate with % margin; conflicts with `--gas-limit` |
144
+ | `--allow-out-of-order-exec` | `--ooo` | Skip sender nonce enforcement (v1.5+ lanes) |
140
145
 
141
- If `--fee-token` is not provided, CCIP fee will be paid in native token.
142
- `--only-get-fee` prints CCIP fee then exits.
146
+ **Token options:**
143
147
 
144
- `--transfer-tokens` can receive multiple pairs of `0xTokenAddr=amount` (source token addresses,
145
- separated by spaces, terminated with `--` if needed). `amount` will be converted using token
146
- decimals (e.g. 0.1 = 10^5 of the smallest unit for USDC, which is 6 decimals).
148
+ | Option | Alias | Description |
149
+ |--------|-------|-------------|
150
+ | `--fee-token` | | Pay fee in ERC20 (default: native token) |
151
+ | `--transfer-tokens` | `-t` | Token transfers as `token=amount` (e.g., `0xToken=0.1`) |
152
+ | `--approve-max` | | Approve max allowance instead of exact |
147
153
 
148
- `--allow-out-of-order-exec` (`--ooo`) is only available on v1.5+ lanes, and opt-out of _sender_
149
- `nonce` order enforcement. It's useful for destinations where execution can't be guaranteed
150
- (e.g. zkOverflow), and required for many destinations. You can read about this config [here](https://docs.chain.link/ccip/tutorials/svm/source/token-transfers#understanding-the-configuration-fields).
154
+ **Utility options:**
151
155
 
152
- `--approve-max` will approve the maximum possible amount of tokens, if approval is needed for
153
- either transfer or fee tokens. Default behavior is to approve the strictly needed allowance.
156
+ | Option | Alias | Description |
157
+ |--------|-------|-------------|
158
+ | `--only-get-fee` | | Print fee and exit |
159
+ | `--only-estimate` | | Print gas estimate and exit (requires `--estimate-gas-limit`) |
160
+ | `--wait` | | Wait for execution on destination |
161
+ | `--wallet` | `-w` | Wallet (ledger[:index] or private key) |
162
+
163
+ **Solana/Sui options:**
164
+
165
+ | Option | Description |
166
+ |--------|-------------|
167
+ | `--token-receiver` | Solana token receiver if different from program |
168
+ | `--account` | Solana accounts (append `=rw` for writable) or Sui object IDs |
154
169
 
155
170
  ### `show` (default command)
156
171
 
@@ -231,28 +246,35 @@ It'll recursively try to decode `returnData` and `error` arguments.
231
246
  ### `getSupportedTokens`
232
247
 
233
248
  ```sh
234
- ccip-cli getSupportedTokens <source> <router> # lists supported tokens
235
- ccip-cli getSupportedTokens <source> <router> [token] # show token and pool details for this token
236
- ccip-cli getSupportedTokens <source> <tokenPool> # same as above, for the pool directly
249
+ ccip-cli getSupportedTokens --network <network> --address <address> [--token <token>]
237
250
  ```
238
251
 
239
- Source is the network to be queried, as chainID or name.
240
- If a CCIP `router` address is provided as second parameter, lists all the tokens and its information
241
- supported in that lane. Type to filter the list.
252
+ List supported tokens in a given Router/OnRamp/TokenAdminRegistry, or show info about a specific token/pool.
242
253
 
243
- If `token` address is supported as 3rd parameter, pre-selects the token in the list.
254
+ **Required options:**
244
255
 
245
- If `tokenPool` address is provided as 2nd parameter, uses it the same as if having provided
246
- router + token addresses.
256
+ | Option | Alias | Description |
257
+ |--------|-------|-------------|
258
+ | `--network` | `-n` | Source network: chainId or name |
259
+ | `--address` | `-a` | Router/OnRamp/TokenAdminRegistry/TokenPool contract address |
247
260
 
248
- In any case, details of the TokenPool and Token will be printed, including all connected remote
249
- chains and its rate limits state.
261
+ **Optional:**
250
262
 
251
- #### Example
263
+ | Option | Alias | Description |
264
+ |--------|-------|-------------|
265
+ | `--token` | `-t` | Token address to query (pre-selects from list if address is a registry) |
266
+
267
+ #### Examples
252
268
 
253
269
  ```sh
254
- # Check tokens supported for transfer from Ethereum to Polygon
255
- ccip-cli getSupportedTokens ethereum-mainnet 0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D
270
+ # List all supported tokens from a router
271
+ ccip-cli getSupportedTokens -n ethereum-mainnet -a 0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D
272
+
273
+ # Get details for a specific token
274
+ ccip-cli getSupportedTokens -n ethereum-mainnet -a 0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D -t 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
275
+
276
+ # Query a token pool directly
277
+ ccip-cli getSupportedTokens -n ethereum-mainnet -a 0xTokenPoolAddress
256
278
  ```
257
279
 
258
280
  #### Output Format Options
@@ -260,3 +282,37 @@ ccip-cli getSupportedTokens ethereum-mainnet 0x80226fc0Ee2b096224EeAc085Bb9a8cba
260
282
  - `--format pretty` (default): Human-readable output
261
283
  - `--format log`: Basic console logging
262
284
  - `--format json`: Machine-readable JSON
285
+
286
+ ### `token`
287
+
288
+ ```sh
289
+ ccip-cli token --network <network> --holder <address> [--token <token>]
290
+ ```
291
+
292
+ Query native or token balance for an address.
293
+
294
+ **Required options:**
295
+
296
+ | Option | Alias | Description |
297
+ |--------|-------|-------------|
298
+ | `--network` | `-n` | Network: chainId or name (e.g., ethereum-mainnet, solana-devnet) |
299
+ | `--holder` | `-H` | Wallet address to query balance for |
300
+
301
+ **Optional:**
302
+
303
+ | Option | Alias | Description |
304
+ |--------|-------|-------------|
305
+ | `--token` | `-t` | Token address (omit for native token balance) |
306
+
307
+ #### Examples
308
+
309
+ ```sh
310
+ # Native ETH balance
311
+ ccip-cli token -n ethereum-mainnet -H 0x1234...abcd
312
+
313
+ # ERC-20 token balance
314
+ ccip-cli token -n ethereum-mainnet -H 0x1234...abcd -t 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
315
+
316
+ # Solana native SOL balance
317
+ ccip-cli token -n solana-devnet -H EPUjBP3Xf76K1VKsDSc6GupBWE8uykNksCLJgXZn87CB
318
+ ```
@@ -1 +1 @@
1
- {"version":3,"file":"manual-exec.d.ts","sourceRoot":"","sources":["../../src/commands/manual-exec.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAiB7C,eAAO,MAAM,OAAO,yBAAyB,CAAA;AAC7C,eAAO,MAAM,QAAQ,gDAAgD,CAAA;AAErE;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiE7B,CAAA;AAEN;;;GAGG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,iBAW3F"}
1
+ {"version":3,"file":"manual-exec.d.ts","sourceRoot":"","sources":["../../src/commands/manual-exec.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAiB7C,eAAO,MAAM,OAAO,yBAAyB,CAAA;AAC7C,eAAO,MAAM,QAAQ,gDAAgD,CAAA;AAErE;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiE7B,CAAA;AAEN;;;GAGG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,iBAW3F"}
@@ -1,4 +1,4 @@
1
- import { CCIPChainFamilyUnsupportedError, ChainFamily, bigIntReplacer, calculateManualExecProof, discoverOffRamp, estimateExecGasForRequest, isSupportedTxHash, } from '@chainlink/ccip-sdk';
1
+ import { bigIntReplacer, calculateManualExecProof, discoverOffRamp, estimateReceiveExecution, isSupportedTxHash, } from '@chainlink/ccip-sdk';
2
2
  import { Format } from "./types.js";
3
3
  import { getCtx, logParsedError, prettyCommit, prettyReceipt, prettyRequest, selectRequest, withDateTimestamp, } from "./utils.js";
4
4
  import { fetchChainsFromRpcs, loadChainWallet } from "../providers/index.js";
@@ -133,18 +133,18 @@ async function manualExec(ctx, argv) {
133
133
  message: request.message,
134
134
  offchainTokenData,
135
135
  };
136
- if (argv.estimateGasLimit != null &&
137
- 'gasLimit' in request.message &&
138
- 'extraArgs' in request.message) {
139
- if (dest.network.family !== ChainFamily.EVM)
140
- throw new CCIPChainFamilyUnsupportedError(dest.network.family, {
141
- context: { feature: 'gas estimation' },
142
- });
143
- let estimated = await estimateExecGasForRequest(source, dest, request);
136
+ if (argv.estimateGasLimit != null) {
137
+ let estimated = await estimateReceiveExecution({
138
+ source,
139
+ dest,
140
+ routerOrRamp: offRamp,
141
+ message: request.message,
142
+ });
144
143
  logger.info('Estimated gasLimit override:', estimated);
145
144
  estimated += Math.ceil((estimated * argv.estimateGasLimit) / 100);
146
- if (request.message.gasLimit >= estimated) {
147
- logger.warn('Estimated +', argv.estimateGasLimit, '% margin =', estimated, '< original gasLimit =', request.message.gasLimit, '. Leaving unchanged.');
145
+ const origLimit = Number('gasLimit' in request.message ? request.message.gasLimit : request.message.computeUnits);
146
+ if (origLimit >= estimated) {
147
+ logger.warn('Estimated +', argv.estimateGasLimit, '% =', estimated, '< original gasLimit =', origLimit, '. Leaving unchanged.');
148
148
  }
149
149
  else {
150
150
  argv.gasLimit = estimated;
@@ -1 +1 @@
1
- {"version":3,"file":"manual-exec.js","sourceRoot":"","sources":["../../src/commands/manual-exec.ts"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I,CAAC,aAAa,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAA;IAElF,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,MAAM,CAAC,GAAG;YACb,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAA;YACnD,MAAK;QACP,KAAK,MAAM,CAAC,MAAM;YAChB,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;YAC9B,aAAa,CAAC,IAAI,CAChB,GAAG,EACH,OAAO,EACP,OAAO,EACP,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI;gBAClB,CAAC,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CACnF,CAAA;YACD,MAAK;QACP,KAAK,MAAM,CAAC,IAAI;YACd,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,CAAA;YACvD,MAAK;IACT,CAAC;AACH,CAAC;AAED,8CAA8C"}
@@ -1,7 +1,7 @@
1
1
  import type { Argv } from 'yargs';
2
2
  import type { GlobalOpts } from '../index.ts';
3
- export declare const command = "send <source> <router> <dest>";
4
- export declare const describe = "Send a CCIP message from router on source to dest";
3
+ export declare const command = "send";
4
+ export declare const describe = "Send a CCIP message from source to destination chain";
5
5
  /**
6
6
  * Yargs builder for the send command.
7
7
  * @param yargs - Yargs instance.
@@ -9,10 +9,10 @@ export declare const describe = "Send a CCIP message from router on source to de
9
9
  */
10
10
  export declare const builder: (yargs: Argv) => Argv<import("yargs").Omit<{
11
11
  source: string;
12
- } & {
13
- router: string;
14
12
  } & {
15
13
  dest: string;
14
+ } & {
15
+ router: string;
16
16
  }, "data" | "wallet" | "receiver" | "account" | "gas-limit" | "estimate-gas-limit" | "wait" | "allow-out-of-order-exec" | "fee-token" | "transfer-tokens" | "token-receiver" | "only-get-fee" | "only-estimate" | "approve-max"> & import("yargs").InferredOptionTypes<{
17
17
  receiver: {
18
18
  alias: string;
@@ -20,21 +20,17 @@ export declare const builder: (yargs: Argv) => Argv<import("yargs").Omit<{
20
20
  describe: string;
21
21
  };
22
22
  data: {
23
- alias: string;
24
23
  type: "string";
25
24
  describe: string;
26
- example: string;
27
25
  };
28
26
  'gas-limit': {
29
27
  alias: string[];
30
28
  type: "number";
31
29
  describe: string;
32
- default: number;
33
30
  };
34
31
  'estimate-gas-limit': {
35
32
  type: "number";
36
33
  describe: string;
37
- example: string;
38
34
  conflicts: string;
39
35
  };
40
36
  'allow-out-of-order-exec': {
@@ -51,7 +47,6 @@ export declare const builder: (yargs: Argv) => Argv<import("yargs").Omit<{
51
47
  type: "array";
52
48
  string: true;
53
49
  describe: string;
54
- example: string;
55
50
  };
56
51
  wallet: {
57
52
  alias: string;
@@ -63,10 +58,10 @@ export declare const builder: (yargs: Argv) => Argv<import("yargs").Omit<{
63
58
  describe: string;
64
59
  };
65
60
  account: {
61
+ alias: string;
66
62
  type: "array";
67
63
  string: true;
68
64
  describe: string;
69
- example: string;
70
65
  };
71
66
  'only-get-fee': {
72
67
  type: "boolean";
@@ -75,6 +70,7 @@ export declare const builder: (yargs: Argv) => Argv<import("yargs").Omit<{
75
70
  'only-estimate': {
76
71
  type: "boolean";
77
72
  describe: string;
73
+ implies: string;
78
74
  };
79
75
  'approve-max': {
80
76
  type: "boolean";
@@ -1 +1 @@
1
- {"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../src/commands/send.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAM7C,eAAO,MAAM,OAAO,kCAAkC,CAAA;AACtD,eAAO,MAAM,QAAQ,sDAAsD,CAAA;AAE3E;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuG9B,CAAA;AAEL;;;GAGG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,iBAQ3F"}
1
+ {"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../src/commands/send.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAM7C,eAAO,MAAM,OAAO,SAAS,CAAA;AAC7B,eAAO,MAAM,QAAQ,yDAAyD,CAAA;AAE9E;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsG7B,CAAA;AAEN;;;GAGG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,iBAQ3F"}
@@ -1,107 +1,114 @@
1
- import { CCIPArgumentInvalidError, CCIPChainFamilyUnsupportedError, CCIPTokenNotFoundError, ChainFamily, estimateExecGasForRequest, getDataBytes, networkInfo, sourceToDestTokenAmounts, } from '@chainlink/ccip-sdk';
2
- import { dataLength, formatUnits, toUtf8Bytes } from 'ethers';
1
+ import { CCIPArgumentInvalidError, CCIPTokenNotFoundError, ChainFamily, estimateReceiveExecution, getDataBytes, networkInfo, } from '@chainlink/ccip-sdk';
2
+ import { formatUnits, toUtf8Bytes } from 'ethers';
3
3
  import { showRequests } from "./show.js";
4
4
  import { getCtx, logParsedError, parseTokenAmounts } from "./utils.js";
5
5
  import { fetchChainsFromRpcs, loadChainWallet } from "../providers/index.js";
6
- export const command = 'send <source> <router> <dest>';
7
- export const describe = 'Send a CCIP message from router on source to dest';
6
+ export const command = 'send';
7
+ export const describe = 'Send a CCIP message from source to destination chain';
8
8
  /**
9
9
  * Yargs builder for the send command.
10
10
  * @param yargs - Yargs instance.
11
11
  * @returns Configured yargs instance with command options.
12
12
  */
13
13
  export const builder = (yargs) => yargs
14
- .positional('source', {
14
+ .option('source', {
15
+ alias: 's',
15
16
  type: 'string',
16
17
  demandOption: true,
17
- describe: 'source network, chainId or name',
18
- example: 'ethereum-testnet-sepolia',
18
+ describe: 'Source chain: chainId, selector, or name',
19
19
  })
20
- .positional('router', {
20
+ .option('dest', {
21
+ alias: 'd',
21
22
  type: 'string',
22
23
  demandOption: true,
23
- describe: 'router contract address on source',
24
+ describe: 'Destination chain: chainId, selector, or name',
24
25
  })
25
- .positional('dest', {
26
+ .option('router', {
27
+ alias: 'r',
26
28
  type: 'string',
27
29
  demandOption: true,
28
- describe: 'destination network, chainId or name',
29
- example: 'ethereum-testnet-sepolia-arbitrum-1',
30
+ describe: 'Router contract address on source',
30
31
  })
31
32
  .options({
32
33
  receiver: {
33
- alias: 'R',
34
+ alias: 'to',
34
35
  type: 'string',
35
- describe: 'Receiver of the message; defaults to the sender wallet address if same network family',
36
+ describe: 'Receiver address on destination; defaults to sender if same chain family',
36
37
  },
37
38
  data: {
38
- alias: 'd',
39
39
  type: 'string',
40
- describe: 'Data to send in the message (non-hex will be utf-8 encoded)',
41
- example: '0x1234',
40
+ describe: 'Data payload to send (non-hex will be UTF-8 encoded)',
42
41
  },
43
42
  'gas-limit': {
44
43
  alias: ['L', 'compute-units'],
45
44
  type: 'number',
46
- describe: 'Gas limit for receiver callback execution; defaults to default configured on ramps',
47
- default: 0,
45
+ describe: 'Gas limit for receiver callback; defaults to ramp config',
48
46
  },
49
47
  'estimate-gas-limit': {
50
48
  type: 'number',
51
- describe: 'Estimate gas limit for receiver callback execution; argument is a % margin to add to the estimate',
52
- example: '10',
49
+ describe: 'Estimate gas limit with % margin (e.g., 10 for +10%)',
53
50
  conflicts: 'gas-limit',
54
51
  },
55
52
  'allow-out-of-order-exec': {
56
53
  alias: 'ooo',
57
54
  type: 'boolean',
58
- describe: 'Allow execution of messages out of order (i.e. sender nonce not enforced, only v1.5+ lanes, mandatory for some dests)',
55
+ describe: 'Allow out-of-order execution (v1.5+ lanes)',
59
56
  },
60
57
  'fee-token': {
61
58
  type: 'string',
62
- describe: 'Address or symbol of the fee token (e.g. LINK address on source); if not provided, will pay in native',
59
+ describe: 'Fee token address or symbol (default: native)',
63
60
  },
64
61
  'transfer-tokens': {
65
62
  alias: 't',
66
63
  type: 'array',
67
64
  string: true,
68
- describe: 'List of token amounts (on source) to transfer to the receiver',
69
- example: '0xtoken=0.1',
65
+ describe: 'Token amounts to transfer: token=amount',
70
66
  },
71
67
  wallet: {
72
68
  alias: 'w',
73
69
  type: 'string',
74
- describe: 'Wallet to send transactions with; pass `ledger[:index_or_derivation]` to use Ledger USB hardware wallet, or private key in `USER_KEY` environment variable',
70
+ describe: 'Wallet: ledger[:index] or private key',
75
71
  },
76
72
  'token-receiver': {
77
73
  type: 'string',
78
- describe: "Address of the Solana tokenReceiver (if different than program's receiver)",
74
+ describe: 'Solana token receiver (if different from program receiver)',
79
75
  },
80
76
  account: {
77
+ alias: 'receiver-object-id',
81
78
  type: 'array',
82
79
  string: true,
83
- describe: 'List of accounts needed by Solana receiver program; append `=rw` to specify account as writable; can be specified multiple times',
84
- example: 'requiredPdaAddress=rw',
80
+ describe: 'Solana accounts (append =rw for writable) or Sui object IDs',
85
81
  },
86
82
  'only-get-fee': {
87
83
  type: 'boolean',
88
- describe: 'Fetch and print the fee for the transaction, then exit',
84
+ describe: 'Print fee and exit',
89
85
  },
90
86
  'only-estimate': {
91
87
  type: 'boolean',
92
- describe: 'Only estimate dest exec gasLimit',
88
+ describe: 'Print gas estimate and exit',
89
+ implies: 'estimate-gas-limit',
93
90
  },
94
91
  'approve-max': {
95
92
  type: 'boolean',
96
- describe: "Approve the maximum amount of tokens to transfer; default=false approves only what's needed",
93
+ describe: 'Approve max token amount instead of exact',
97
94
  },
98
95
  wait: {
99
96
  type: 'boolean',
100
97
  default: false,
101
- describe: 'Wait for execution',
98
+ describe: 'Wait for execution on destination',
102
99
  },
103
100
  })
104
- .check(({ 'transfer-tokens': transferTokens }) => !transferTokens || transferTokens.every((t) => /^[^=]+=\d+(\.\d+)?$/.test(t)));
101
+ .check(({ 'transfer-tokens': transferTokens }) => !transferTokens || transferTokens.every((t) => /^[^=]+=\d+(\.\d+)?$/.test(t)))
102
+ .example([
103
+ [
104
+ 'ccip-cli send -s ethereum-testnet-sepolia -d arbitrum-sepolia -r 0x0BF3dE8c5D3e8A2B34D2BEeB17ABfCeBaf363A59 --only-get-fee',
105
+ 'Get fee estimate',
106
+ ],
107
+ [
108
+ 'ccip-cli send -s ethereum-testnet-sepolia -d arbitrum-sepolia -r 0x0BF3... --to 0xABC... --data "Hello"',
109
+ 'Send message with data',
110
+ ],
111
+ ]);
105
112
  /**
106
113
  * Handler for the send command.
107
114
  * @param argv - Command line arguments.
@@ -131,30 +138,14 @@ async function sendMessage(ctx, argv) {
131
138
  data = toUtf8Bytes(argv.data);
132
139
  }
133
140
  }
134
- else {
135
- data = '0x';
136
- }
137
141
  const tokenAmounts = argv.transferTokens?.length
138
142
  ? await parseTokenAmounts(source, argv.transferTokens)
139
143
  : [];
140
144
  let receiver = argv.receiver;
141
- let tokenReceiver;
142
145
  let accounts, accountIsWritableBitmap = 0n;
143
146
  if (destNetwork.family === ChainFamily.Solana) {
144
- if (argv.tokenReceiver)
145
- tokenReceiver = argv.tokenReceiver;
146
- else if (!tokenAmounts.length) {
147
- tokenReceiver = '11111111111111111111111111111111';
148
- }
149
- else if (!dataLength(data)) {
150
- // sending tokens without data, i.e. not for a receiver contract
151
- tokenReceiver = receiver;
152
- receiver = '11111111111111111111111111111111';
153
- }
154
- else {
155
- throw new CCIPArgumentInvalidError('token-receiver', 'required when sending tokens with data to Solana');
156
- }
157
- if (argv.account) {
147
+ // parse accounts with or without `=rw` suffix
148
+ if (argv.account?.length) {
158
149
  accounts = argv.account.map((account, i) => {
159
150
  if (account.endsWith('=rw')) {
160
151
  accountIsWritableBitmap |= 1n << BigInt(i);
@@ -163,11 +154,6 @@ async function sendMessage(ctx, argv) {
163
154
  return account;
164
155
  });
165
156
  }
166
- else
167
- accounts = [];
168
- }
169
- else if (argv.tokenReceiver || argv.account?.length) {
170
- throw new CCIPArgumentInvalidError('token-receiver/account', 'only valid for Solana destination');
171
157
  }
172
158
  let walletAddress, wallet;
173
159
  if (!receiver) {
@@ -178,46 +164,45 @@ async function sendMessage(ctx, argv) {
178
164
  }
179
165
  if (argv.estimateGasLimit != null || argv.onlyEstimate) {
180
166
  // TODO: implement for all chain families
181
- if (destNetwork.family !== ChainFamily.EVM)
182
- throw new CCIPChainFamilyUnsupportedError(destNetwork.family, {
183
- context: { feature: 'gas estimation' },
184
- });
185
- const dest = (await getChain(destNetwork.chainSelector));
186
- const onRamp = await source.getOnRampForRouter(argv.router, destNetwork.chainSelector);
187
- const lane = {
188
- sourceChainSelector: source.network.chainSelector,
189
- destChainSelector: destNetwork.chainSelector,
190
- onRamp,
191
- version: (await source.typeAndVersion(onRamp))[1],
192
- };
193
- const destTokenAmounts = await sourceToDestTokenAmounts(source, destNetwork.chainSelector, onRamp, tokenAmounts);
194
- if (!walletAddress)
195
- [walletAddress, wallet] = await loadChainWallet(source, argv);
196
- const estimated = await estimateExecGasForRequest(source, dest, {
197
- lane,
167
+ const dest = await getChain(destNetwork.chainSelector);
168
+ if (!walletAddress) {
169
+ try {
170
+ ;
171
+ [walletAddress, wallet] = await loadChainWallet(source, argv);
172
+ }
173
+ catch {
174
+ // pass undefined sender for default
175
+ }
176
+ }
177
+ const estimated = await estimateReceiveExecution({
178
+ source,
179
+ dest,
180
+ routerOrRamp: argv.router,
198
181
  message: {
199
182
  sender: walletAddress,
200
183
  receiver,
201
184
  data,
202
- tokenAmounts: destTokenAmounts,
185
+ tokenAmounts,
203
186
  },
204
187
  });
205
- logger.log('Estimated gasLimit:', estimated);
206
188
  argv.gasLimit = Math.ceil(estimated * (1 + (argv.estimateGasLimit ?? 0) / 100));
189
+ logger.log('Estimated gasLimit for sender =', walletAddress, ':', estimated, ...(argv.estimateGasLimit ? ['+', argv.estimateGasLimit, '% =', argv.gasLimit] : []));
207
190
  if (argv.onlyEstimate)
208
191
  return;
209
192
  }
210
- // `--allow-out-of-order-exec` forces EVMExtraArgsV2, which shouldn't work on v1.2 lanes;
211
- // otherwise, fallsback to EVMExtraArgsV1 (compatible with v1.2 & v1.5)
193
+ // builds a catch-all extraArgs object, which can be massaged by
194
+ // [[Chain.buildMessageForDest]] to create suitable extraArgs with defaults if needed
212
195
  const extraArgs = {
213
- ...(argv.allowOutOfOrderExec != null || destNetwork.family !== ChainFamily.EVM
214
- ? { allowOutOfOrderExecution: !!argv.allowOutOfOrderExec }
215
- : {}),
216
- ...(destNetwork.family === ChainFamily.Solana
217
- ? { computeUnits: BigInt(argv.gasLimit) }
218
- : { gasLimit: BigInt(argv.gasLimit) }),
219
- ...(tokenReceiver ? { tokenReceiver } : {}),
220
- ...(accounts ? { accounts, accountIsWritableBitmap } : {}),
196
+ ...(argv.allowOutOfOrderExec != null && {
197
+ allowOutOfOrderExecution: !!argv.allowOutOfOrderExec,
198
+ }),
199
+ ...(argv.gasLimit == null
200
+ ? {}
201
+ : destNetwork.family === ChainFamily.Solana
202
+ ? { computeUnits: BigInt(argv.gasLimit) }
203
+ : { gasLimit: BigInt(argv.gasLimit) }),
204
+ ...(!!argv.tokenReceiver && { tokenReceiver: argv.tokenReceiver }),
205
+ ...(!!accounts && { accounts, accountIsWritableBitmap }), // accounts also used as Sui receiverObjectIds
221
206
  };
222
207
  let feeToken, feeTokenInfo;
223
208
  if (argv.feeToken) {
@@ -269,9 +254,7 @@ async function sendMessage(ctx, argv) {
269
254
  message: { ...message, fee },
270
255
  wallet,
271
256
  });
272
- logger.info('🚀 Sending message to', tokenReceiver && tokenReceiver !== '11111111111111111111111111111111'
273
- ? tokenReceiver
274
- : receiver, '@', destNetwork.name, ', tx =>', request.tx.hash, ', messageId =>', request.message.messageId);
257
+ logger.info('🚀 Sending message to', receiver, '@', destNetwork.name, ', tx =>', request.tx.hash, ', messageId =>', request.message.messageId);
275
258
  await showRequests(ctx, {
276
259
  ...argv,
277
260
  txHash: request.tx.hash,