@chainlink/ccip-sdk 0.0.0 → 0.90.1
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.
- package/LICENSE +21 -0
- package/README.md +109 -0
- package/dist/aptos/exec.d.ts +18 -0
- package/dist/aptos/exec.d.ts.map +1 -0
- package/dist/aptos/exec.js +55 -0
- package/dist/aptos/exec.js.map +1 -0
- package/dist/aptos/hasher.d.ts +11 -0
- package/dist/aptos/hasher.d.ts.map +1 -0
- package/dist/aptos/hasher.js +62 -0
- package/dist/aptos/hasher.js.map +1 -0
- package/dist/aptos/index.d.ts +92 -0
- package/dist/aptos/index.d.ts.map +1 -0
- package/dist/aptos/index.js +482 -0
- package/dist/aptos/index.js.map +1 -0
- package/dist/aptos/logs.d.ts +9 -0
- package/dist/aptos/logs.d.ts.map +1 -0
- package/dist/aptos/logs.js +167 -0
- package/dist/aptos/logs.js.map +1 -0
- package/dist/aptos/send.d.ts +11 -0
- package/dist/aptos/send.d.ts.map +1 -0
- package/dist/aptos/send.js +78 -0
- package/dist/aptos/send.js.map +1 -0
- package/dist/aptos/token.d.ts +4 -0
- package/dist/aptos/token.d.ts.map +1 -0
- package/dist/aptos/token.js +134 -0
- package/dist/aptos/token.js.map +1 -0
- package/dist/aptos/types.d.ts +78 -0
- package/dist/aptos/types.d.ts.map +1 -0
- package/dist/aptos/types.js +60 -0
- package/dist/aptos/types.js.map +1 -0
- package/dist/aptos/utils.d.ts +12 -0
- package/dist/aptos/utils.d.ts.map +1 -0
- package/dist/aptos/utils.js +15 -0
- package/dist/aptos/utils.js.map +1 -0
- package/dist/chain.d.ts +344 -0
- package/dist/chain.d.ts.map +1 -0
- package/dist/chain.js +41 -0
- package/dist/chain.js.map +1 -0
- package/dist/commits.d.ts +25 -0
- package/dist/commits.d.ts.map +1 -0
- package/dist/commits.js +29 -0
- package/dist/commits.js.map +1 -0
- package/dist/evm/abi/BurnMintERC677Token.d.ts +602 -0
- package/dist/evm/abi/BurnMintERC677Token.d.ts.map +1 -0
- package/dist/evm/abi/BurnMintERC677Token.js +488 -0
- package/dist/evm/abi/BurnMintERC677Token.js.map +1 -0
- package/dist/evm/abi/CommitStore_1_2.d.ts +688 -0
- package/dist/evm/abi/CommitStore_1_2.d.ts.map +1 -0
- package/dist/evm/abi/CommitStore_1_2.js +638 -0
- package/dist/evm/abi/CommitStore_1_2.js.map +1 -0
- package/dist/evm/abi/CommitStore_1_5.d.ts +708 -0
- package/dist/evm/abi/CommitStore_1_5.d.ts.map +1 -0
- package/dist/evm/abi/CommitStore_1_5.js +675 -0
- package/dist/evm/abi/CommitStore_1_5.js.map +1 -0
- package/dist/evm/abi/FeeQuoter_1_6.d.ts +1770 -0
- package/dist/evm/abi/FeeQuoter_1_6.d.ts.map +1 -0
- package/dist/evm/abi/FeeQuoter_1_6.js +1904 -0
- package/dist/evm/abi/FeeQuoter_1_6.js.map +1 -0
- package/dist/evm/abi/LockReleaseTokenPool_1_5.d.ts +1116 -0
- package/dist/evm/abi/LockReleaseTokenPool_1_5.d.ts.map +1 -0
- package/dist/evm/abi/LockReleaseTokenPool_1_5.js +1096 -0
- package/dist/evm/abi/LockReleaseTokenPool_1_5.js.map +1 -0
- package/dist/evm/abi/LockReleaseTokenPool_1_5_1.d.ts +1306 -0
- package/dist/evm/abi/LockReleaseTokenPool_1_5_1.d.ts.map +1 -0
- package/dist/evm/abi/LockReleaseTokenPool_1_5_1.js +1278 -0
- package/dist/evm/abi/LockReleaseTokenPool_1_5_1.js.map +1 -0
- package/dist/evm/abi/LockReleaseTokenPool_1_6_1.d.ts +1290 -0
- package/dist/evm/abi/LockReleaseTokenPool_1_6_1.d.ts.map +1 -0
- package/dist/evm/abi/LockReleaseTokenPool_1_6_1.js +1288 -0
- package/dist/evm/abi/LockReleaseTokenPool_1_6_1.js.map +1 -0
- package/dist/evm/abi/OffRamp_1_2.d.ts +1217 -0
- package/dist/evm/abi/OffRamp_1_2.d.ts.map +1 -0
- package/dist/evm/abi/OffRamp_1_2.js +1204 -0
- package/dist/evm/abi/OffRamp_1_2.js.map +1 -0
- package/dist/evm/abi/OffRamp_1_5.d.ts +1271 -0
- package/dist/evm/abi/OffRamp_1_5.d.ts.map +1 -0
- package/dist/evm/abi/OffRamp_1_5.js +1273 -0
- package/dist/evm/abi/OffRamp_1_5.js.map +1 -0
- package/dist/evm/abi/OffRamp_1_6.d.ts +1472 -0
- package/dist/evm/abi/OffRamp_1_6.d.ts.map +1 -0
- package/dist/evm/abi/OffRamp_1_6.js +1529 -0
- package/dist/evm/abi/OffRamp_1_6.js.map +1 -0
- package/dist/evm/abi/OnRamp_1_2.d.ts +1391 -0
- package/dist/evm/abi/OnRamp_1_2.d.ts.map +1 -0
- package/dist/evm/abi/OnRamp_1_2.js +1343 -0
- package/dist/evm/abi/OnRamp_1_2.js.map +1 -0
- package/dist/evm/abi/OnRamp_1_5.d.ts +1443 -0
- package/dist/evm/abi/OnRamp_1_5.d.ts.map +1 -0
- package/dist/evm/abi/OnRamp_1_5.js +1427 -0
- package/dist/evm/abi/OnRamp_1_5.js.map +1 -0
- package/dist/evm/abi/OnRamp_1_6.d.ts +796 -0
- package/dist/evm/abi/OnRamp_1_6.d.ts.map +1 -0
- package/dist/evm/abi/OnRamp_1_6.js +880 -0
- package/dist/evm/abi/OnRamp_1_6.js.map +1 -0
- package/dist/evm/abi/Router.d.ts +541 -0
- package/dist/evm/abi/Router.d.ts.map +1 -0
- package/dist/evm/abi/Router.js +508 -0
- package/dist/evm/abi/Router.js.map +1 -0
- package/dist/evm/abi/TokenAdminRegistry_1_5.d.ts +373 -0
- package/dist/evm/abi/TokenAdminRegistry_1_5.d.ts.map +1 -0
- package/dist/evm/abi/TokenAdminRegistry_1_5.js +333 -0
- package/dist/evm/abi/TokenAdminRegistry_1_5.js.map +1 -0
- package/dist/evm/const.d.ts +27 -0
- package/dist/evm/const.d.ts.map +1 -0
- package/dist/evm/const.js +63 -0
- package/dist/evm/const.js.map +1 -0
- package/dist/evm/errors.d.ts +36 -0
- package/dist/evm/errors.d.ts.map +1 -0
- package/dist/evm/errors.js +192 -0
- package/dist/evm/errors.js.map +1 -0
- package/dist/evm/hasher.d.ts +5 -0
- package/dist/evm/hasher.d.ts.map +1 -0
- package/dist/evm/hasher.js +116 -0
- package/dist/evm/hasher.js.map +1 -0
- package/dist/evm/index.d.ts +121 -0
- package/dist/evm/index.d.ts.map +1 -0
- package/dist/evm/index.js +904 -0
- package/dist/evm/index.js.map +1 -0
- package/dist/evm/messages.d.ts +35 -0
- package/dist/evm/messages.d.ts.map +1 -0
- package/dist/evm/messages.js +11 -0
- package/dist/evm/messages.js.map +1 -0
- package/dist/evm/offchain.d.ts +16 -0
- package/dist/evm/offchain.d.ts.map +1 -0
- package/dist/evm/offchain.js +142 -0
- package/dist/evm/offchain.js.map +1 -0
- package/dist/execution.d.ts +80 -0
- package/dist/execution.d.ts.map +1 -0
- package/dist/execution.js +91 -0
- package/dist/execution.js.map +1 -0
- package/dist/extra-args.d.ts +45 -0
- package/dist/extra-args.d.ts.map +1 -0
- package/dist/extra-args.js +44 -0
- package/dist/extra-args.js.map +1 -0
- package/dist/gas.d.ts +27 -0
- package/dist/gas.d.ts.map +1 -0
- package/dist/gas.js +80 -0
- package/dist/gas.js.map +1 -0
- package/dist/hasher/common.d.ts +12 -0
- package/dist/hasher/common.d.ts.map +1 -0
- package/dist/hasher/common.js +19 -0
- package/dist/hasher/common.js.map +1 -0
- package/dist/hasher/hasher.d.ts +4 -0
- package/dist/hasher/hasher.d.ts.map +1 -0
- package/dist/hasher/hasher.js +11 -0
- package/dist/hasher/hasher.js.map +1 -0
- package/dist/hasher/index.d.ts +4 -0
- package/dist/hasher/index.d.ts.map +1 -0
- package/dist/hasher/index.js +4 -0
- package/dist/hasher/index.js.map +1 -0
- package/dist/hasher/merklemulti.d.ts +58 -0
- package/dist/hasher/merklemulti.d.ts.map +1 -0
- package/dist/hasher/merklemulti.js +257 -0
- package/dist/hasher/merklemulti.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/offchain.d.ts +20 -0
- package/dist/offchain.d.ts.map +1 -0
- package/dist/offchain.js +59 -0
- package/dist/offchain.js.map +1 -0
- package/dist/requests.d.ts +48 -0
- package/dist/requests.d.ts.map +1 -0
- package/dist/requests.js +286 -0
- package/dist/requests.js.map +1 -0
- package/dist/selectors.d.ts +9 -0
- package/dist/selectors.d.ts.map +1 -0
- package/dist/selectors.js +1330 -0
- package/dist/selectors.js.map +1 -0
- package/dist/solana/cleanup.d.ts +15 -0
- package/dist/solana/cleanup.d.ts.map +1 -0
- package/dist/solana/cleanup.js +159 -0
- package/dist/solana/cleanup.js.map +1 -0
- package/dist/solana/exec.d.ts +15 -0
- package/dist/solana/exec.d.ts.map +1 -0
- package/dist/solana/exec.js +417 -0
- package/dist/solana/exec.js.map +1 -0
- package/dist/solana/hasher.d.ts +4 -0
- package/dist/solana/hasher.d.ts.map +1 -0
- package/dist/solana/hasher.js +81 -0
- package/dist/solana/hasher.js.map +1 -0
- package/dist/solana/idl/1.6.0/BASE_TOKEN_POOL.d.ts +866 -0
- package/dist/solana/idl/1.6.0/BASE_TOKEN_POOL.d.ts.map +1 -0
- package/dist/solana/idl/1.6.0/BASE_TOKEN_POOL.js +866 -0
- package/dist/solana/idl/1.6.0/BASE_TOKEN_POOL.js.map +1 -0
- package/dist/solana/idl/1.6.0/BURN_MINT_TOKEN_POOL.d.ts +949 -0
- package/dist/solana/idl/1.6.0/BURN_MINT_TOKEN_POOL.d.ts.map +1 -0
- package/dist/solana/idl/1.6.0/BURN_MINT_TOKEN_POOL.js +949 -0
- package/dist/solana/idl/1.6.0/BURN_MINT_TOKEN_POOL.js.map +1 -0
- package/dist/solana/idl/1.6.0/CCIP_CCTP_TOKEN_POOL.d.ts +1374 -0
- package/dist/solana/idl/1.6.0/CCIP_CCTP_TOKEN_POOL.d.ts.map +1 -0
- package/dist/solana/idl/1.6.0/CCIP_CCTP_TOKEN_POOL.js +1374 -0
- package/dist/solana/idl/1.6.0/CCIP_CCTP_TOKEN_POOL.js.map +1 -0
- package/dist/solana/idl/1.6.0/CCIP_COMMON.d.ts +104 -0
- package/dist/solana/idl/1.6.0/CCIP_COMMON.d.ts.map +1 -0
- package/dist/solana/idl/1.6.0/CCIP_COMMON.js +104 -0
- package/dist/solana/idl/1.6.0/CCIP_COMMON.js.map +1 -0
- package/dist/solana/idl/1.6.0/CCIP_OFFRAMP.d.ts +2746 -0
- package/dist/solana/idl/1.6.0/CCIP_OFFRAMP.d.ts.map +1 -0
- package/dist/solana/idl/1.6.0/CCIP_OFFRAMP.js +2746 -0
- package/dist/solana/idl/1.6.0/CCIP_OFFRAMP.js.map +1 -0
- package/dist/solana/idl/1.6.0/CCIP_ROUTER.d.ts +2332 -0
- package/dist/solana/idl/1.6.0/CCIP_ROUTER.d.ts.map +1 -0
- package/dist/solana/idl/1.6.0/CCIP_ROUTER.js +2332 -0
- package/dist/solana/idl/1.6.0/CCIP_ROUTER.js.map +1 -0
- package/dist/solana/index.d.ts +205 -0
- package/dist/solana/index.d.ts.map +1 -0
- package/dist/solana/index.js +1085 -0
- package/dist/solana/index.js.map +1 -0
- package/dist/solana/offchain.d.ts +31 -0
- package/dist/solana/offchain.d.ts.map +1 -0
- package/dist/solana/offchain.js +152 -0
- package/dist/solana/offchain.js.map +1 -0
- package/dist/solana/patchBorsh.d.ts +2 -0
- package/dist/solana/patchBorsh.d.ts.map +1 -0
- package/dist/solana/patchBorsh.js +60 -0
- package/dist/solana/patchBorsh.js.map +1 -0
- package/dist/solana/send.d.ts +14 -0
- package/dist/solana/send.d.ts.map +1 -0
- package/dist/solana/send.js +272 -0
- package/dist/solana/send.js.map +1 -0
- package/dist/solana/types.d.ts +4 -0
- package/dist/solana/types.d.ts.map +1 -0
- package/dist/solana/types.js +2 -0
- package/dist/solana/types.js.map +1 -0
- package/dist/solana/utils.d.ts +58 -0
- package/dist/solana/utils.d.ts.map +1 -0
- package/dist/solana/utils.js +211 -0
- package/dist/solana/utils.js.map +1 -0
- package/dist/sui/hasher.d.ts +12 -0
- package/dist/sui/hasher.d.ts.map +1 -0
- package/dist/sui/hasher.js +63 -0
- package/dist/sui/hasher.js.map +1 -0
- package/dist/sui/index.d.ts +72 -0
- package/dist/sui/index.d.ts.map +1 -0
- package/dist/sui/index.js +128 -0
- package/dist/sui/index.js.map +1 -0
- package/dist/sui/types.d.ts +17 -0
- package/dist/sui/types.d.ts.map +1 -0
- package/dist/sui/types.js +17 -0
- package/dist/sui/types.js.map +1 -0
- package/dist/supported-chains.d.ts +5 -0
- package/dist/supported-chains.d.ts.map +1 -0
- package/dist/supported-chains.js +3 -0
- package/dist/supported-chains.js.map +1 -0
- package/dist/types.d.ts +118 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +11 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +117 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +336 -0
- package/dist/utils.js.map +1 -0
- package/package.json +66 -8
- package/src/aptos/exec.ts +69 -0
- package/src/aptos/hasher.ts +92 -0
- package/src/aptos/index.ts +660 -0
- package/src/aptos/logs.ts +210 -0
- package/src/aptos/send.ts +120 -0
- package/src/aptos/token.ts +150 -0
- package/src/aptos/types.ts +85 -0
- package/src/aptos/utils.ts +24 -0
- package/src/chain.ts +398 -0
- package/src/commits.ts +44 -0
- package/src/evm/abi/BurnMintERC677Token.ts +487 -0
- package/src/evm/abi/CommitStore_1_2.ts +637 -0
- package/src/evm/abi/CommitStore_1_5.ts +674 -0
- package/src/evm/abi/FeeQuoter_1_6.ts +1903 -0
- package/src/evm/abi/LockReleaseTokenPool_1_5.ts +1095 -0
- package/src/evm/abi/LockReleaseTokenPool_1_5_1.ts +1277 -0
- package/src/evm/abi/LockReleaseTokenPool_1_6_1.ts +1287 -0
- package/src/evm/abi/OffRamp_1_2.ts +1203 -0
- package/src/evm/abi/OffRamp_1_5.ts +1272 -0
- package/src/evm/abi/OffRamp_1_6.ts +1528 -0
- package/src/evm/abi/OnRamp_1_2.ts +1342 -0
- package/src/evm/abi/OnRamp_1_5.ts +1426 -0
- package/src/evm/abi/OnRamp_1_6.ts +879 -0
- package/src/evm/abi/Router.ts +507 -0
- package/src/evm/abi/TokenAdminRegistry_1_5.ts +332 -0
- package/src/evm/const.ts +69 -0
- package/src/evm/errors.ts +212 -0
- package/src/evm/hasher.ts +166 -0
- package/src/evm/index.ts +1262 -0
- package/src/evm/messages.ts +73 -0
- package/src/evm/offchain.ts +189 -0
- package/src/execution.ts +131 -0
- package/src/extra-args.ts +71 -0
- package/src/gas.ts +135 -0
- package/src/hasher/common.ts +23 -0
- package/src/hasher/hasher.ts +12 -0
- package/src/hasher/index.ts +3 -0
- package/src/hasher/merklemulti.ts +309 -0
- package/src/index.ts +51 -0
- package/src/offchain.ts +86 -0
- package/src/requests.ts +339 -0
- package/src/selectors.ts +1340 -0
- package/src/solana/cleanup.ts +216 -0
- package/src/solana/exec.ts +645 -0
- package/src/solana/hasher.ts +104 -0
- package/src/solana/idl/1.6.0/BASE_TOKEN_POOL.ts +1734 -0
- package/src/solana/idl/1.6.0/BURN_MINT_TOKEN_POOL.ts +1900 -0
- package/src/solana/idl/1.6.0/CCIP_CCTP_TOKEN_POOL.ts +2750 -0
- package/src/solana/idl/1.6.0/CCIP_COMMON.ts +210 -0
- package/src/solana/idl/1.6.0/CCIP_OFFRAMP.ts +5494 -0
- package/src/solana/idl/1.6.0/CCIP_ROUTER.ts +4671 -0
- package/src/solana/index.ts +1454 -0
- package/src/solana/offchain.ts +209 -0
- package/src/solana/patchBorsh.ts +67 -0
- package/src/solana/send.ts +436 -0
- package/src/solana/types.ts +6 -0
- package/src/solana/utils.ts +272 -0
- package/src/sui/hasher.ts +90 -0
- package/src/sui/index.ts +198 -0
- package/src/sui/types.ts +22 -0
- package/src/supported-chains.ts +4 -0
- package/src/types.ts +153 -0
- package/src/utils.ts +405 -0
- package/tsconfig.json +18 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 SmartContract Chainlink Limited SEZC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# @chainlink/ccip-sdk
|
|
2
|
+
|
|
3
|
+
## Typescript SDK to interact with CCIP.
|
|
4
|
+
|
|
5
|
+
This tool can be used to query and interact with [CCIP](https://ccip.chain.link) contracts deployed
|
|
6
|
+
in supported blockchains, through its publicly accessible data and methods, requiring only
|
|
7
|
+
compatible RPCs for each involved network.
|
|
8
|
+
|
|
9
|
+
> [!IMPORTANT]
|
|
10
|
+
> This tool is provided under an MIT license and is for convenience and illustration purposes only.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
To install it from latest NpmJS release, do:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm install @smartcontractkit/ccip-sdk
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
> [!NOTE]
|
|
21
|
+
> NodeJS version v20+ is required, with v23+ recommended.
|
|
22
|
+
|
|
23
|
+
## Chain
|
|
24
|
+
|
|
25
|
+
The [Chain](./src/chain.ts) abstract class provides the specification of an interface which must be
|
|
26
|
+
implemented to provide support for a given chain family. Static methods are required by the
|
|
27
|
+
`ChainStatic` interface, and are used for functions that don't require an instance or provider.
|
|
28
|
+
|
|
29
|
+
Currently, there are implementations for:
|
|
30
|
+
- [EVM](./src/evm/index.ts): uses [ethers.js](https://docs.ethers.org/v6/)
|
|
31
|
+
- [Solana](./src/solana/index.ts): uses [solana-web3.js](https://github.com/solana-foundation/solana-web3.js) and [Anchor](https://github.com/solana-foundation/anchor)
|
|
32
|
+
- [Aptos](./src/aptos/index.ts): uses [aptos-ts-sdk](https://github.com/aptos-labs/aptos-ts-sdk)
|
|
33
|
+
|
|
34
|
+
We try to not expose or require users to comply with these libraries, returning generic values and
|
|
35
|
+
errors, but some factories may receive specific providers types.
|
|
36
|
+
|
|
37
|
+
The Chain class defines some methods, which can be overriden by specific families to offer optimized
|
|
38
|
+
implementations. One can extend any of the subclasses and get them registered in the
|
|
39
|
+
[supportedChains](./src/supported-chains.ts) mapping, or even construct directly.
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { SolanaChain, supportedChains, ChainFamily } from '@chainlink/ccip-sdk'
|
|
43
|
+
class MySolanaChain extends SolanaChain {
|
|
44
|
+
// ...custom implementation
|
|
45
|
+
}
|
|
46
|
+
supportedChains[ChainFamily.Solana] = MySolanaChain
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Async constructors
|
|
50
|
+
|
|
51
|
+
Each chain family class has an static async constructor, which can be used to create a new instance
|
|
52
|
+
of the chain class with a provider. The only common/required signature is
|
|
53
|
+
`fromUrl(url: string): Promise<Chain>`, but each chain family class usually also provides a
|
|
54
|
+
constructor from the specific library provider (e.g. `EVMChain.fromProvider(provider: ethers.JsonRpcApiProvider)`)
|
|
55
|
+
|
|
56
|
+
## Wallet
|
|
57
|
+
|
|
58
|
+
Most chain families classes have a *cached* `getWallet` method, which handles creating a signer or
|
|
59
|
+
wallet from raw private keys. They receive a generic `{ wallet?: unknown }` object, which may be
|
|
60
|
+
passed from other methods, or CLI's `argv` options, to aid in wallet creation.
|
|
61
|
+
|
|
62
|
+
If they can't, users may override the *static* `getWallet` function (with parameters depending on
|
|
63
|
+
chain family implementation), which is called to try to construct a wallet or signer instead.
|
|
64
|
+
This can be used to extend the library to create signers according to each environment, without
|
|
65
|
+
requiring a full class inheritance.
|
|
66
|
+
|
|
67
|
+
Example:
|
|
68
|
+
```ts
|
|
69
|
+
import { EVMChain } from '@chainlink/ccip-sdk'
|
|
70
|
+
|
|
71
|
+
EVMChain.getWallet = async function(opts?: { provider?: Provider, wallet?: unknown }): Promise<Signer> {
|
|
72
|
+
// instantiate Signer
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
> [!TIP]
|
|
77
|
+
> For EVMChain on Browsers, there's no need to override like the above, since providing a `{ wallet: number | address }` option object will make it create a signer from `provider.getSigner(number)`, which should load the account from the browser's wallet extension.
|
|
78
|
+
|
|
79
|
+
## Recipes
|
|
80
|
+
|
|
81
|
+
### Fetching details of a custom message, per transaction
|
|
82
|
+
```ts
|
|
83
|
+
import { AptosChain, fetchCCIPMessagesInTx } from '@chainlink/ccip-sdk'
|
|
84
|
+
const source = await AptosChain.fromUrl('mainnet')
|
|
85
|
+
const tx = await source.getTransaction('0xTransactionHash')
|
|
86
|
+
const messages = await fetchCCIPMessagesInTx(tx)
|
|
87
|
+
console.log(messages[0])
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Sending a message
|
|
91
|
+
```ts
|
|
92
|
+
import { SolanaChain, AnyMessage, fetchCCIPRequestsInTx, networkInfo } from '@chainlink/ccip-sdk'
|
|
93
|
+
const source = await SolanaChain.fromUrl('https://api.mainnet-beta.solana.com')
|
|
94
|
+
const router = 'Ccip842gzYHhvdDkSyi2YVCoAWPbYJoApMFzSxQroE9C' // https://docs.chain.link/ccip/directory/mainnet
|
|
95
|
+
const dest = networkInfo('ethereum-mainnet')
|
|
96
|
+
const message: AnyMessage = {
|
|
97
|
+
receiver: '0xReceiverAddress',
|
|
98
|
+
data: '0xbeef',
|
|
99
|
+
extraArgs: { gasLimit: 250000, allowOutOfOrderExecution: true },
|
|
100
|
+
}
|
|
101
|
+
const fee = await source.getFee(router, dest.chainSelector, message)
|
|
102
|
+
const tx = await source.sendMessage(
|
|
103
|
+
router,
|
|
104
|
+
dest.chainSelector,
|
|
105
|
+
{ ...message, fee },
|
|
106
|
+
{ wallet: process.env['SOLANA_PRIVATE_KEY'] },
|
|
107
|
+
)
|
|
108
|
+
const messageId = (await fetchCCIPRequestsInTx(tx))[0].message.header.messageId
|
|
109
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Aptos } from '@aptos-labs/ts-sdk';
|
|
2
|
+
import type { ExecutionReport } from '../types.ts';
|
|
3
|
+
import { type AptosAsyncAccount } from './types.ts';
|
|
4
|
+
import type { CCIPMessage_V1_6_EVM } from '../evm/messages.ts';
|
|
5
|
+
/**
|
|
6
|
+
* Executes as single message report in offramp
|
|
7
|
+
*
|
|
8
|
+
* @param provider - Aptos provider instance
|
|
9
|
+
* @param account - async Account
|
|
10
|
+
* @param offRamp - Offramp contract address (with or without `::offramp` suffix)
|
|
11
|
+
* @param execReport - Aptos uses EVMExtraArgsV2, so same message as EVM v1.6
|
|
12
|
+
* @param opts - options like gasLimit override
|
|
13
|
+
* @returns exec txHash
|
|
14
|
+
*/
|
|
15
|
+
export declare function executeReport(provider: Aptos, account: AptosAsyncAccount, offRamp: string, execReport: ExecutionReport<CCIPMessage_V1_6_EVM>, opts?: {
|
|
16
|
+
gasLimit?: number;
|
|
17
|
+
}): Promise<string>;
|
|
18
|
+
//# sourceMappingURL=exec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/aptos/exec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,KAAK,iBAAiB,EAA4B,MAAM,YAAY,CAAA;AAC7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAE9D;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,KAAK,EACf,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,eAAe,CAAC,oBAAoB,CAAC,EACjD,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,mBA+C7B"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { serializeExecutionReport } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Executes as single message report in offramp
|
|
4
|
+
*
|
|
5
|
+
* @param provider - Aptos provider instance
|
|
6
|
+
* @param account - async Account
|
|
7
|
+
* @param offRamp - Offramp contract address (with or without `::offramp` suffix)
|
|
8
|
+
* @param execReport - Aptos uses EVMExtraArgsV2, so same message as EVM v1.6
|
|
9
|
+
* @param opts - options like gasLimit override
|
|
10
|
+
* @returns exec txHash
|
|
11
|
+
*/
|
|
12
|
+
export async function executeReport(provider, account, offRamp, execReport, opts) {
|
|
13
|
+
// Prepare proofs as byte arrays
|
|
14
|
+
const serialized = serializeExecutionReport(execReport);
|
|
15
|
+
// Build the transaction to call manually_execute
|
|
16
|
+
// The function signature should be something like:
|
|
17
|
+
// public entry fun manually_execute(
|
|
18
|
+
// caller: &signer,
|
|
19
|
+
// merkle_root: vector<u8>,
|
|
20
|
+
// proofs: vector<vector<u8>>,
|
|
21
|
+
// proof_flag_bits: u256,
|
|
22
|
+
// message_id: vector<u8>,
|
|
23
|
+
// source_chain_selector: u64,
|
|
24
|
+
// dest_chain_selector: u64,
|
|
25
|
+
// sequence_number: u64,
|
|
26
|
+
// nonce: u64,
|
|
27
|
+
// sender: vector<u8>,
|
|
28
|
+
// receiver: vector<u8>,
|
|
29
|
+
// data: vector<u8>,
|
|
30
|
+
// token_addresses: vector<address>,
|
|
31
|
+
// token_amounts: vector<u256>,
|
|
32
|
+
// offchain_token_data: vector<vector<u8>>,
|
|
33
|
+
// gas_limit: u256
|
|
34
|
+
// )
|
|
35
|
+
const transaction = await provider.transaction.build.simple({
|
|
36
|
+
sender: account.accountAddress,
|
|
37
|
+
data: {
|
|
38
|
+
function: `${offRamp.includes('::') ? offRamp : offRamp + '::offramp'}::manually_execute`,
|
|
39
|
+
functionArguments: [serialized],
|
|
40
|
+
},
|
|
41
|
+
options: { maxGasAmount: opts?.gasLimit },
|
|
42
|
+
});
|
|
43
|
+
// Sign and submit the transaction
|
|
44
|
+
const signed = await account.signTransactionWithAuthenticator(transaction);
|
|
45
|
+
const pendingTxn = await provider.transaction.submit.simple({
|
|
46
|
+
transaction,
|
|
47
|
+
senderAuthenticator: signed,
|
|
48
|
+
});
|
|
49
|
+
// Wait for the transaction to be confirmed
|
|
50
|
+
const { hash } = await provider.waitForTransaction({
|
|
51
|
+
transactionHash: pendingTxn.hash,
|
|
52
|
+
});
|
|
53
|
+
return hash;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=exec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../../src/aptos/exec.ts"],"names":[],"mappings":"AAGA,OAAO,EAA0B,wBAAwB,EAAE,MAAM,YAAY,C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ACjC,CAAC,CAAA;IACF,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type LeafHasher } from '../hasher/common.ts';
|
|
2
|
+
import { type CCIPMessage, type CCIPMessage_V1_6, CCIPVersion } from '../types.ts';
|
|
3
|
+
export declare function getAptosLeafHasher<V extends CCIPVersion = CCIPVersion>({ sourceChainSelector, destChainSelector, onRamp, version, }: {
|
|
4
|
+
sourceChainSelector: bigint;
|
|
5
|
+
destChainSelector: bigint;
|
|
6
|
+
onRamp: string;
|
|
7
|
+
version: V;
|
|
8
|
+
}): LeafHasher<V>;
|
|
9
|
+
export declare function hashV16AptosMessage(message: CCIPMessage_V1_6 | CCIPMessage<typeof CCIPVersion.V1_6>, metadataHash: string): string;
|
|
10
|
+
export declare const hashAptosMetadata: (sourceChainSelector: bigint, destChainSelector: bigint, onRamp: string) => string;
|
|
11
|
+
//# sourceMappingURL=hasher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasher.d.ts","sourceRoot":"","sources":["../../src/aptos/hasher.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,UAAU,EAAyB,MAAM,qBAAqB,CAAA;AAC5E,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAIlF,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,EACtE,mBAAmB,EACnB,iBAAiB,EACjB,MAAM,EACN,OAAO,GACR,EAAE;IACD,mBAAmB,EAAE,MAAM,CAAA;IAC3B,iBAAiB,EAAE,MAAM,CAAA;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,CAAC,CAAA;CACX,GAAG,UAAU,CAAC,CAAC,CAAC,CAUhB;AAED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,gBAAgB,GAAG,WAAW,CAAC,OAAO,WAAW,CAAC,IAAI,CAAC,EAChE,YAAY,EAAE,MAAM,GACnB,MAAM,CA6CR;AAED,eAAO,MAAM,iBAAiB,GAC5B,qBAAqB,MAAM,EAC3B,mBAAmB,MAAM,EACzB,QAAQ,MAAM,KACb,MAOF,CAAA"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { concat, id, keccak256, zeroPadValue } from 'ethers';
|
|
2
|
+
import { decodeExtraArgs } from "../extra-args.js";
|
|
3
|
+
import { LEAF_DOMAIN_SEPARATOR } from "../hasher/common.js";
|
|
4
|
+
import { CCIPVersion } from "../types.js";
|
|
5
|
+
import { getAddressBytes, networkInfo } from "../utils.js";
|
|
6
|
+
import { encodeNumber, encodeRawBytes } from "./utils.js";
|
|
7
|
+
export function getAptosLeafHasher({ sourceChainSelector, destChainSelector, onRamp, version, }) {
|
|
8
|
+
let metadataHash;
|
|
9
|
+
switch (version) {
|
|
10
|
+
case CCIPVersion.V1_6:
|
|
11
|
+
metadataHash = hashAptosMetadata(sourceChainSelector, destChainSelector, onRamp);
|
|
12
|
+
return ((message) => hashV16AptosMessage(message, metadataHash));
|
|
13
|
+
default:
|
|
14
|
+
throw new Error(`Unsupported hasher version for Aptos: ${version}`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export function hashV16AptosMessage(message, metadataHash) {
|
|
18
|
+
let gasLimit;
|
|
19
|
+
if (!('gasLimit' in message)) {
|
|
20
|
+
const parsedArgs = decodeExtraArgs(message.extraArgs, networkInfo(message.header.sourceChainSelector).family);
|
|
21
|
+
if (!parsedArgs || !('gasLimit' in parsedArgs))
|
|
22
|
+
throw new Error('Invalid extraArgs, not EVMExtraArgsV1|2');
|
|
23
|
+
gasLimit = parsedArgs.gasLimit;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
gasLimit = message.gasLimit;
|
|
27
|
+
}
|
|
28
|
+
const innerHash = concat([
|
|
29
|
+
message.header.messageId,
|
|
30
|
+
zeroPadValue(message.receiver, 32),
|
|
31
|
+
encodeNumber(message.header.sequenceNumber),
|
|
32
|
+
encodeNumber(gasLimit), // Aptos as dest uses EVMExtraArgs
|
|
33
|
+
encodeNumber(message.header.nonce),
|
|
34
|
+
]);
|
|
35
|
+
const tokenHash = concat([
|
|
36
|
+
encodeNumber(message.tokenAmounts.length),
|
|
37
|
+
...message.tokenAmounts.map((token) => concat([
|
|
38
|
+
encodeRawBytes(getAddressBytes(token.sourcePoolAddress)),
|
|
39
|
+
zeroPadValue(token.destTokenAddress, 32),
|
|
40
|
+
encodeNumber(token.destGasAmount),
|
|
41
|
+
encodeRawBytes(token.extraData),
|
|
42
|
+
encodeNumber(token.amount),
|
|
43
|
+
])),
|
|
44
|
+
]);
|
|
45
|
+
const outerHash = concat([
|
|
46
|
+
zeroPadValue(LEAF_DOMAIN_SEPARATOR, 32),
|
|
47
|
+
metadataHash,
|
|
48
|
+
keccak256(innerHash),
|
|
49
|
+
keccak256(getAddressBytes(message.sender)),
|
|
50
|
+
keccak256(message.data),
|
|
51
|
+
keccak256(tokenHash),
|
|
52
|
+
]);
|
|
53
|
+
return keccak256(outerHash);
|
|
54
|
+
}
|
|
55
|
+
export const hashAptosMetadata = (sourceChainSelector, destChainSelector, onRamp) => {
|
|
56
|
+
const versionHash = id('Any2AptosMessageHashV1');
|
|
57
|
+
const encodedSource = encodeNumber(sourceChainSelector);
|
|
58
|
+
const encodedDest = encodeNumber(destChainSelector);
|
|
59
|
+
const onrampHash = keccak256(onRamp);
|
|
60
|
+
return keccak256(concat([versionHash, encodedSource, encodedDest, onrampHash]));
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=hasher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasher.js","sourceRoot":"","sources":["../../src/aptos/hasher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAE5D,OAAO,EAAE,eAAe,EAAE,MAAM,kB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AG,YAAY,CAAC,mBAAmB,CAAC,CAAA;IACvD,MAAM,WAAW,GAAG,YAAY,CAAC,iBAAiB,CAAC,CAAA;IACnD,MAAM,UAAU,GAAG,SAAS,CAAC,MAAM,CAAC,CAAA;IAEpC,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,CAAA;AACjF,CAAC,CAAA"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Aptos, AptosConfig, Network } from '@aptos-labs/ts-sdk';
|
|
2
|
+
import { type BytesLike } from 'ethers';
|
|
3
|
+
import { type ChainTransaction, type LogFilter, type TokenInfo, type TokenPoolRemote, Chain, ChainFamily } from '../chain.ts';
|
|
4
|
+
import { type EVMExtraArgsV2, type ExtraArgs, type SVMExtraArgsV1 } from '../extra-args.ts';
|
|
5
|
+
import type { LeafHasher } from '../hasher/common.ts';
|
|
6
|
+
import type { AnyMessage, CCIPMessage, CCIPRequest, CommitReport, ExecutionReceipt, ExecutionReport, Lane, Log_, NetworkInfo, OffchainTokenData } from '../types.ts';
|
|
7
|
+
import { type AptosAsyncAccount } from './types.ts';
|
|
8
|
+
export declare class AptosChain extends Chain<typeof ChainFamily.Aptos> {
|
|
9
|
+
static readonly family: "aptos";
|
|
10
|
+
static readonly decimals = 8;
|
|
11
|
+
readonly network: NetworkInfo<typeof ChainFamily.Aptos>;
|
|
12
|
+
readonly provider: Aptos;
|
|
13
|
+
getTokenInfo: (token: string) => Promise<TokenInfo>;
|
|
14
|
+
_getAccountModulesNames: (address: string) => Promise<string[]>;
|
|
15
|
+
constructor(provider: Aptos, network: NetworkInfo);
|
|
16
|
+
static fromProvider(provider: Aptos): Promise<AptosChain>;
|
|
17
|
+
static fromAptosConfig(config: AptosConfig): Promise<AptosChain>;
|
|
18
|
+
static fromUrl(url: string | Network, network?: Network): Promise<AptosChain>;
|
|
19
|
+
destroy(): Promise<void>;
|
|
20
|
+
getBlockTimestamp(version: number | 'finalized'): Promise<number>;
|
|
21
|
+
getTransaction(hashOrVersion: string | number): Promise<ChainTransaction>;
|
|
22
|
+
getLogs(opts: LogFilter & {
|
|
23
|
+
versionAsHash?: boolean;
|
|
24
|
+
}): AsyncIterableIterator<Log_>;
|
|
25
|
+
typeAndVersion(address: string): Promise<[type_: string, version: string, typeAndVersion: string] | [type_: string, version: string, typeAndVersion: string, suffix: string]>;
|
|
26
|
+
getRouterForOnRamp(onRamp: string, _destChainSelector: bigint): Promise<string>;
|
|
27
|
+
getRouterForOffRamp(offRamp: string, _sourceChainSelector: bigint): Promise<string>;
|
|
28
|
+
getNativeTokenForRouter(_router: string): Promise<string>;
|
|
29
|
+
getOffRampsForRouter(router: string, _sourceChainSelector: bigint): Promise<string[]>;
|
|
30
|
+
getOnRampForRouter(router: string, _destChainSelector: bigint): Promise<string>;
|
|
31
|
+
getOnRampForOffRamp(offRamp: string, sourceChainSelector: bigint): Promise<string>;
|
|
32
|
+
getCommitStoreForOffRamp(offRamp: string): Promise<string>;
|
|
33
|
+
getTokenForTokenPool(tokenPool: string): Promise<string>;
|
|
34
|
+
getTokenAdminRegistryFor(address: string): Promise<string>;
|
|
35
|
+
static getWallet(_opts?: {
|
|
36
|
+
wallet?: unknown;
|
|
37
|
+
}): Promise<AptosAsyncAccount>;
|
|
38
|
+
getWallet(opts?: {
|
|
39
|
+
wallet?: unknown;
|
|
40
|
+
}): Promise<AptosAsyncAccount>;
|
|
41
|
+
getWalletAddress(opts?: {
|
|
42
|
+
wallet?: unknown;
|
|
43
|
+
}): Promise<string>;
|
|
44
|
+
static decodeMessage(log: {
|
|
45
|
+
data: BytesLike | Record<string, unknown>;
|
|
46
|
+
}): CCIPMessage | undefined;
|
|
47
|
+
static decodeExtraArgs(extraArgs: BytesLike): (EVMExtraArgsV2 & {
|
|
48
|
+
_tag: 'EVMExtraArgsV2';
|
|
49
|
+
}) | (SVMExtraArgsV1 & {
|
|
50
|
+
_tag: 'SVMExtraArgsV1';
|
|
51
|
+
}) | undefined;
|
|
52
|
+
static encodeExtraArgs(extraArgs: ExtraArgs): string;
|
|
53
|
+
static decodeCommits({ data }: Pick<Log_, 'data'>, lane?: Lane): CommitReport[] | undefined;
|
|
54
|
+
static decodeReceipt({ data }: Pick<Log_, 'data'>): ExecutionReceipt | undefined;
|
|
55
|
+
static getAddress(bytes: BytesLike): string;
|
|
56
|
+
static getDestLeafHasher(lane: Lane): LeafHasher;
|
|
57
|
+
getFee(router: string, destChainSelector: bigint, message: AnyMessage): Promise<bigint>;
|
|
58
|
+
sendMessage(router: string, destChainSelector: bigint, message: AnyMessage & {
|
|
59
|
+
fee: bigint;
|
|
60
|
+
}, opts?: {
|
|
61
|
+
wallet?: unknown;
|
|
62
|
+
approveMax?: boolean;
|
|
63
|
+
}): Promise<ChainTransaction>;
|
|
64
|
+
fetchOffchainTokenData(request: CCIPRequest): Promise<OffchainTokenData[]>;
|
|
65
|
+
executeReport(offRamp: string, execReport: ExecutionReport, opts?: {
|
|
66
|
+
wallet?: unknown;
|
|
67
|
+
gasLimit?: number;
|
|
68
|
+
}): Promise<ChainTransaction>;
|
|
69
|
+
static parse(data: unknown): (import("../extra-args.ts").EVMExtraArgsV1 & {
|
|
70
|
+
allowOutOfOrderExecution: boolean;
|
|
71
|
+
} & {
|
|
72
|
+
_tag: "EVMExtraArgsV2";
|
|
73
|
+
}) | (SVMExtraArgsV1 & {
|
|
74
|
+
_tag: "SVMExtraArgsV1";
|
|
75
|
+
}) | undefined;
|
|
76
|
+
getSupportedTokens(address: string, opts?: {
|
|
77
|
+
page?: number;
|
|
78
|
+
}): Promise<string[]>;
|
|
79
|
+
getRegistryTokenConfig(registry: string, token: string): Promise<{
|
|
80
|
+
administrator: string;
|
|
81
|
+
pendingAdministrator?: string;
|
|
82
|
+
tokenPool?: string;
|
|
83
|
+
}>;
|
|
84
|
+
getTokenPoolConfigs(tokenPool: string): Promise<{
|
|
85
|
+
token: string;
|
|
86
|
+
router: string;
|
|
87
|
+
typeAndVersion?: string;
|
|
88
|
+
}>;
|
|
89
|
+
getTokenPoolRemotes(tokenPool: string, remoteChainSelector?: bigint): Promise<Record<string, TokenPoolRemote>>;
|
|
90
|
+
listFeeTokens(router: string): Promise<Record<string, TokenInfo>>;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/aptos/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,EACL,WAAW,EAEX,OAAO,EAER,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,KAAK,SAAS,EAUf,MAAM,QAAQ,CAAA;AAIf,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,EACL,WAAW,EACZ,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,cAAc,EAGpB,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAErD,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,IAAI,EACJ,IAAI,EACJ,WAAW,EACX,iBAAiB,EAClB,MAAM,aAAa,CAAA;AAcpB,OAAO,EAAE,KAAK,iBAAiB,EAA4C,MAAM,YAAY,CAAA;AAI7F,qBAAa,UAAW,SAAQ,KAAK,CAAC,OAAO,WAAW,CAAC,KAAK,CAAC;IAC7D,MAAM,CAAC,QAAQ,CAAC,MAAM,UAAoB;IAC1C,MAAM,CAAC,QAAQ,CAAC,QAAQ,KAAI;IAE5B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,WAAW,CAAC,KAAK,CAAC,CAAA;IACvD,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAA;IAExB,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