@chainlink/ccip-sdk 0.92.0 → 0.93.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.
- package/README.md +20 -18
- package/dist/api/index.d.ts +103 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +141 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/types.d.ts +38 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +2 -0
- package/dist/api/types.js.map +1 -0
- package/dist/aptos/index.d.ts +20 -33
- package/dist/aptos/index.d.ts.map +1 -1
- package/dist/aptos/index.js +34 -26
- package/dist/aptos/index.js.map +1 -1
- package/dist/aptos/logs.js +1 -1
- package/dist/aptos/logs.js.map +1 -1
- package/dist/aptos/token.js.map +1 -1
- package/dist/chain.d.ts +206 -71
- package/dist/chain.d.ts.map +1 -1
- package/dist/chain.js +89 -20
- package/dist/chain.js.map +1 -1
- package/dist/commits.d.ts +2 -2
- package/dist/commits.d.ts.map +1 -1
- package/dist/commits.js +4 -4
- package/dist/commits.js.map +1 -1
- package/dist/errors/CCIPError.d.ts.map +1 -1
- package/dist/errors/CCIPError.js +3 -2
- package/dist/errors/CCIPError.js.map +1 -1
- package/dist/errors/codes.d.ts +4 -1
- package/dist/errors/codes.d.ts.map +1 -1
- package/dist/errors/codes.js +6 -1
- package/dist/errors/codes.js.map +1 -1
- package/dist/errors/index.d.ts +5 -2
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +8 -2
- package/dist/errors/index.js.map +1 -1
- package/dist/errors/recovery.d.ts.map +1 -1
- package/dist/errors/recovery.js +4 -1
- package/dist/errors/recovery.js.map +1 -1
- package/dist/errors/specialized.d.ts +29 -4
- package/dist/errors/specialized.d.ts.map +1 -1
- package/dist/errors/specialized.js +48 -6
- package/dist/errors/specialized.js.map +1 -1
- package/dist/evm/errors.js.map +1 -1
- package/dist/evm/index.d.ts +24 -48
- package/dist/evm/index.d.ts.map +1 -1
- package/dist/evm/index.js +71 -59
- package/dist/evm/index.js.map +1 -1
- package/dist/evm/logs.js.map +1 -1
- package/dist/evm/offchain.js +3 -2
- package/dist/evm/offchain.js.map +1 -1
- package/dist/evm/viem/client-adapter.d.ts +68 -0
- package/dist/evm/viem/client-adapter.d.ts.map +1 -0
- package/dist/evm/viem/client-adapter.js +104 -0
- package/dist/evm/viem/client-adapter.js.map +1 -0
- package/dist/evm/viem/index.d.ts +29 -0
- package/dist/evm/viem/index.d.ts.map +1 -0
- package/dist/evm/viem/index.js +28 -0
- package/dist/evm/viem/index.js.map +1 -0
- package/dist/evm/viem/types.d.ts +13 -0
- package/dist/evm/viem/types.d.ts.map +1 -0
- package/dist/evm/viem/types.js +2 -0
- package/dist/evm/viem/types.js.map +1 -0
- package/dist/evm/viem/wallet-adapter.d.ts +58 -0
- package/dist/evm/viem/wallet-adapter.d.ts.map +1 -0
- package/dist/evm/viem/wallet-adapter.js +197 -0
- package/dist/evm/viem/wallet-adapter.js.map +1 -0
- package/dist/execution.d.ts +1 -1
- package/dist/execution.d.ts.map +1 -1
- package/dist/execution.js +2 -2
- package/dist/execution.js.map +1 -1
- package/dist/explorer.d.ts +74 -0
- package/dist/explorer.d.ts.map +1 -0
- package/dist/explorer.js +67 -0
- package/dist/explorer.js.map +1 -0
- package/dist/gas.js.map +1 -1
- package/dist/hasher/merklemulti.js.map +1 -1
- package/dist/http-status.d.ts +20 -0
- package/dist/http-status.d.ts.map +1 -0
- package/dist/http-status.js +25 -0
- package/dist/http-status.js.map +1 -0
- package/dist/index.d.ts +11 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/offchain.js.map +1 -1
- package/dist/requests.d.ts +4 -4
- package/dist/requests.d.ts.map +1 -1
- package/dist/requests.js +6 -6
- package/dist/requests.js.map +1 -1
- package/dist/solana/cleanup.js +2 -2
- package/dist/solana/cleanup.js.map +1 -1
- package/dist/solana/exec.js +1 -5
- package/dist/solana/exec.js.map +1 -1
- package/dist/solana/index.d.ts +28 -57
- package/dist/solana/index.d.ts.map +1 -1
- package/dist/solana/index.js +66 -70
- package/dist/solana/index.js.map +1 -1
- package/dist/solana/logs.js +2 -2
- package/dist/solana/logs.js.map +1 -1
- package/dist/solana/offchain.js +3 -3
- package/dist/solana/offchain.js.map +1 -1
- package/dist/solana/send.js +1 -1
- package/dist/solana/send.js.map +1 -1
- package/dist/solana/utils.js +1 -1
- package/dist/solana/utils.js.map +1 -1
- package/dist/sui/discovery.d.ts.map +1 -1
- package/dist/sui/discovery.js +2 -5
- package/dist/sui/discovery.js.map +1 -1
- package/dist/sui/events.d.ts.map +1 -1
- package/dist/sui/events.js +2 -8
- package/dist/sui/events.js.map +1 -1
- package/dist/sui/index.d.ts +18 -29
- package/dist/sui/index.d.ts.map +1 -1
- package/dist/sui/index.js +24 -26
- package/dist/sui/index.js.map +1 -1
- package/dist/sui/manuallyExec/encoder.d.ts.map +1 -1
- package/dist/sui/manuallyExec/encoder.js +0 -3
- package/dist/sui/manuallyExec/encoder.js.map +1 -1
- package/dist/sui/manuallyExec/index.d.ts.map +1 -1
- package/dist/sui/manuallyExec/index.js +1 -2
- package/dist/sui/manuallyExec/index.js.map +1 -1
- package/dist/sui/objects.js +4 -4
- package/dist/sui/objects.js.map +1 -1
- package/dist/ton/exec.d.ts +2 -2
- package/dist/ton/exec.d.ts.map +1 -1
- package/dist/ton/exec.js.map +1 -1
- package/dist/ton/hasher.js +5 -5
- package/dist/ton/hasher.js.map +1 -1
- package/dist/ton/index.d.ts +54 -49
- package/dist/ton/index.d.ts.map +1 -1
- package/dist/ton/index.js +331 -236
- package/dist/ton/index.js.map +1 -1
- package/dist/ton/logs.d.ts +11 -22
- package/dist/ton/logs.d.ts.map +1 -1
- package/dist/ton/logs.js +95 -118
- package/dist/ton/logs.js.map +1 -1
- package/dist/ton/types.d.ts +9 -9
- package/dist/ton/types.d.ts.map +1 -1
- package/dist/ton/types.js +5 -9
- package/dist/ton/types.js.map +1 -1
- package/dist/ton/utils.d.ts +8 -27
- package/dist/ton/utils.d.ts.map +1 -1
- package/dist/ton/utils.js +31 -111
- package/dist/ton/utils.js.map +1 -1
- package/dist/types.d.ts +34 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +30 -0
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +6 -5
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +76 -52
- package/dist/utils.js.map +1 -1
- package/dist/viem.d.ts +6 -0
- package/dist/viem.d.ts.map +1 -0
- package/dist/viem.js +6 -0
- package/dist/viem.js.map +1 -0
- package/package.json +18 -3
- package/src/api/index.ts +167 -0
- package/src/api/types.ts +39 -0
- package/src/aptos/index.ts +57 -64
- package/src/aptos/logs.ts +10 -10
- package/src/aptos/token.ts +1 -1
- package/src/chain.ts +274 -97
- package/src/commits.ts +5 -5
- package/src/errors/CCIPError.ts +5 -2
- package/src/errors/codes.ts +8 -1
- package/src/errors/index.ts +15 -2
- package/src/errors/recovery.ts +9 -1
- package/src/errors/specialized.ts +61 -6
- package/src/evm/errors.ts +2 -2
- package/src/evm/index.ts +107 -120
- package/src/evm/logs.ts +4 -4
- package/src/evm/offchain.ts +5 -4
- package/src/evm/viem/client-adapter.ts +124 -0
- package/src/evm/viem/index.ts +29 -0
- package/src/evm/viem/types.ts +14 -0
- package/src/evm/viem/wallet-adapter.ts +233 -0
- package/src/execution.ts +9 -9
- package/src/explorer.ts +90 -0
- package/src/gas.ts +2 -2
- package/src/hasher/merklemulti.ts +7 -7
- package/src/http-status.ts +31 -0
- package/src/index.ts +19 -1
- package/src/offchain.ts +1 -1
- package/src/requests.ts +9 -12
- package/src/solana/cleanup.ts +4 -4
- package/src/solana/exec.ts +13 -18
- package/src/solana/index.ts +92 -117
- package/src/solana/logs.ts +8 -8
- package/src/solana/offchain.ts +3 -3
- package/src/solana/send.ts +20 -20
- package/src/solana/utils.ts +4 -4
- package/src/sui/discovery.ts +4 -10
- package/src/sui/events.ts +5 -12
- package/src/sui/index.ts +36 -48
- package/src/sui/manuallyExec/encoder.ts +0 -4
- package/src/sui/manuallyExec/index.ts +1 -3
- package/src/sui/objects.ts +14 -14
- package/src/ton/exec.ts +2 -5
- package/src/ton/hasher.ts +5 -5
- package/src/ton/index.ts +392 -316
- package/src/ton/logs.ts +122 -143
- package/src/ton/types.ts +17 -21
- package/src/ton/utils.ts +39 -145
- package/src/types.ts +36 -0
- package/src/utils.ts +96 -66
- package/src/viem.ts +5 -0
- package/tsconfig.json +3 -2
- package/dist/ton/bindings/offramp.d.ts +0 -48
- package/dist/ton/bindings/offramp.d.ts.map +0 -1
- package/dist/ton/bindings/offramp.js +0 -63
- package/dist/ton/bindings/offramp.js.map +0 -1
- package/dist/ton/bindings/onramp.d.ts +0 -40
- package/dist/ton/bindings/onramp.d.ts.map +0 -1
- package/dist/ton/bindings/onramp.js +0 -51
- package/dist/ton/bindings/onramp.js.map +0 -1
- package/dist/ton/bindings/router.d.ts +0 -47
- package/dist/ton/bindings/router.d.ts.map +0 -1
- package/dist/ton/bindings/router.js +0 -51
- package/dist/ton/bindings/router.js.map +0 -1
- package/src/ton/bindings/offramp.ts +0 -96
- package/src/ton/bindings/onramp.ts +0 -72
- package/src/ton/bindings/router.ts +0 -65
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
// TODO: FIXME: Remove local copies and import when chainlink-ton is published as npm package
|
|
2
|
-
import type { Address, ContractProvider } from '@ton/core'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Configuration for a source chain on the TON OffRamp contract.
|
|
6
|
-
*/
|
|
7
|
-
export interface SourceChainConfig {
|
|
8
|
-
router: Address
|
|
9
|
-
isEnabled: boolean
|
|
10
|
-
minSeqNr: bigint
|
|
11
|
-
isRMNVerificationDisabled: boolean
|
|
12
|
-
onRamp: Buffer
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Dynamic configuration for the OffRamp contract.
|
|
17
|
-
* Contains addresses that can be updated without redeploying the contract.
|
|
18
|
-
*/
|
|
19
|
-
export interface DynamicConfig {
|
|
20
|
-
router: Address
|
|
21
|
-
feeQuoter: Address
|
|
22
|
-
permissionlessExecutionThresholdSeconds: number
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* TON OffRamp contract binding.
|
|
27
|
-
* The OffRamp receives and executes cross-chain messages on the destination (TON) chain.
|
|
28
|
-
*/
|
|
29
|
-
export class OffRamp {
|
|
30
|
-
readonly address: Address
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Creates a new OffRamp instance.
|
|
34
|
-
* @param address - The OffRamp contract address on TON.
|
|
35
|
-
*/
|
|
36
|
-
constructor(address: Address) {
|
|
37
|
-
this.address = address
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Creates an OffRamp instance from a contract address.
|
|
42
|
-
* @param address - The OffRamp contract address on TON.
|
|
43
|
-
* @returns A new OffRamp instance.
|
|
44
|
-
*/
|
|
45
|
-
static createFromAddress(address: Address): OffRamp {
|
|
46
|
-
return new OffRamp(address)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Retrieves the source chain configuration for a given chain selector.
|
|
51
|
-
*
|
|
52
|
-
* @param provider - TON contract provider for making RPC calls.
|
|
53
|
-
* @param sourceChainSelector - The CCIP chain selector of the source chain.
|
|
54
|
-
* @returns The source chain configuration.
|
|
55
|
-
* @throws Error with exitCode 266 if the source chain is not enabled.
|
|
56
|
-
*/
|
|
57
|
-
async getSourceChainConfig(
|
|
58
|
-
provider: ContractProvider,
|
|
59
|
-
sourceChainSelector: bigint,
|
|
60
|
-
): Promise<SourceChainConfig> {
|
|
61
|
-
const result = await provider.get('sourceChainConfig', [
|
|
62
|
-
{ type: 'int', value: sourceChainSelector },
|
|
63
|
-
])
|
|
64
|
-
|
|
65
|
-
// Tolk returns struct as tuple
|
|
66
|
-
const router = result.stack.readAddress()
|
|
67
|
-
const isEnabled = result.stack.readBoolean()
|
|
68
|
-
const minSeqNr = result.stack.readBigNumber()
|
|
69
|
-
const isRMNVerificationDisabled = result.stack.readBoolean()
|
|
70
|
-
|
|
71
|
-
// onRamp is stored as CrossChainAddress cell
|
|
72
|
-
const onRampCell = result.stack.readCell()
|
|
73
|
-
const onRampSlice = onRampCell.beginParse()
|
|
74
|
-
|
|
75
|
-
// Check if length-prefixed or raw format based on cell bit length
|
|
76
|
-
const cellBits = onRampCell.bits.length
|
|
77
|
-
let onRamp: Buffer
|
|
78
|
-
|
|
79
|
-
if (cellBits === 160) {
|
|
80
|
-
// Raw 20-byte EVM address (no length prefix)
|
|
81
|
-
onRamp = onRampSlice.loadBuffer(20)
|
|
82
|
-
} else {
|
|
83
|
-
// Length-prefixed format: 8-bit length + data
|
|
84
|
-
const onRampLength = onRampSlice.loadUint(8)
|
|
85
|
-
onRamp = onRampSlice.loadBuffer(onRampLength)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return {
|
|
89
|
-
router,
|
|
90
|
-
isEnabled,
|
|
91
|
-
minSeqNr,
|
|
92
|
-
isRMNVerificationDisabled,
|
|
93
|
-
onRamp,
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
// TODO: FIXME: Remove local copies and import when chainlink-ton is published as npm package
|
|
2
|
-
import { type Address, type ContractProvider, Dictionary } from '@ton/core'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Configuration for a destination chain on the TON OnRamp contract.
|
|
6
|
-
* Contains routing and access control settings for messages going to a specific destination chain.
|
|
7
|
-
*/
|
|
8
|
-
export interface DestChainConfig {
|
|
9
|
-
router: Address
|
|
10
|
-
sequenceNumber: bigint
|
|
11
|
-
allowlistEnabled: boolean
|
|
12
|
-
allowedSenders: Dictionary<Address, boolean>
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* TON OnRamp contract binding.
|
|
17
|
-
* The OnRamp sends cross-chain messages from the source (TON) chain to destination chains.
|
|
18
|
-
* It validates messages, assigns sequence numbers, and emits events for the CCIP network.
|
|
19
|
-
*/
|
|
20
|
-
export class OnRamp {
|
|
21
|
-
readonly address: Address
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Creates a new OnRamp instance.
|
|
25
|
-
* @param address - The OnRamp contract address on TON.
|
|
26
|
-
*/
|
|
27
|
-
constructor(address: Address) {
|
|
28
|
-
this.address = address
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Creates an OnRamp instance from a contract address.
|
|
33
|
-
* @param address - The OnRamp contract address on TON.
|
|
34
|
-
* @returns A new OnRamp instance.
|
|
35
|
-
*/
|
|
36
|
-
static createFromAddress(address: Address): OnRamp {
|
|
37
|
-
return new OnRamp(address)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Retrieves the destination chain configuration for a given chain selector.
|
|
42
|
-
* This includes the router, current sequence number, and allowlist settings.
|
|
43
|
-
*
|
|
44
|
-
* @param provider - TON contract provider for making RPC calls.
|
|
45
|
-
* @param destChainSelector - The CCIP chain selector of the destination chain.
|
|
46
|
-
* @returns The destination chain configuration.
|
|
47
|
-
*/
|
|
48
|
-
async getDestChainConfig(
|
|
49
|
-
provider: ContractProvider,
|
|
50
|
-
destChainSelector: bigint,
|
|
51
|
-
): Promise<DestChainConfig> {
|
|
52
|
-
const { stack } = await provider.get('destChainConfig', [
|
|
53
|
-
{ type: 'int', value: destChainSelector },
|
|
54
|
-
])
|
|
55
|
-
const router = stack.readAddress()
|
|
56
|
-
const sequenceNumber = stack.readBigNumber()
|
|
57
|
-
const allowlistEnabled = stack.readBoolean()
|
|
58
|
-
const allowedSendersCell = stack.readCellOpt()
|
|
59
|
-
return {
|
|
60
|
-
router,
|
|
61
|
-
sequenceNumber,
|
|
62
|
-
allowlistEnabled,
|
|
63
|
-
allowedSenders: allowedSendersCell
|
|
64
|
-
? Dictionary.loadDirect(
|
|
65
|
-
Dictionary.Keys.Address(),
|
|
66
|
-
Dictionary.Values.Bool(),
|
|
67
|
-
allowedSendersCell,
|
|
68
|
-
)
|
|
69
|
-
: Dictionary.empty(),
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// TODO: FIXME: Remove local copies and import when chainlink-ton is published as npm package
|
|
2
|
-
import type { Address, ContractProvider } from '@ton/core'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Represents a ramp (OnRamp or OffRamp) configuration in the Router.
|
|
6
|
-
*/
|
|
7
|
-
export interface Ramp {
|
|
8
|
-
chainSelector: bigint
|
|
9
|
-
address: Address
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* TON Router contract binding.
|
|
14
|
-
* The Router is the main entry point for CCIP on TON. It routes messages to the appropriate
|
|
15
|
-
* OnRamp (for sending) or OffRamp (for receiving) based on the chain selector.
|
|
16
|
-
*/
|
|
17
|
-
export class Router {
|
|
18
|
-
readonly address: Address
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Creates a new Router instance.
|
|
22
|
-
* @param address - The Router contract address on TON.
|
|
23
|
-
*/
|
|
24
|
-
constructor(address: Address) {
|
|
25
|
-
this.address = address
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Creates a Router instance from a contract address.
|
|
30
|
-
* @param address - The Router contract address on TON.
|
|
31
|
-
* @returns A new Router instance.
|
|
32
|
-
*/
|
|
33
|
-
static createFromAddress(address: Address): Router {
|
|
34
|
-
return new Router(address)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Gets the OffRamp address for a given source chain selector.
|
|
39
|
-
* The OffRamp handles incoming messages from the specified source chain.
|
|
40
|
-
*
|
|
41
|
-
* @param provider - TON contract provider for making RPC calls.
|
|
42
|
-
* @param chainSelector - The CCIP chain selector of the source chain.
|
|
43
|
-
* @returns The OffRamp contract address.
|
|
44
|
-
* @throws Error with exitCode 261 if the source chain is not enabled.
|
|
45
|
-
*/
|
|
46
|
-
async getOffRamp(provider: ContractProvider, chainSelector: bigint): Promise<Address> {
|
|
47
|
-
return provider
|
|
48
|
-
.get('offRamp', [{ type: 'int', value: chainSelector }])
|
|
49
|
-
.then((r) => r.stack.readAddress())
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Gets the OnRamp address for a given destination chain selector.
|
|
54
|
-
* The OnRamp handles outgoing messages to the specified destination chain.
|
|
55
|
-
*
|
|
56
|
-
* @param provider - TON contract provider for making RPC calls.
|
|
57
|
-
* @param destChainSelector - The CCIP chain selector of the destination chain.
|
|
58
|
-
* @returns The OnRamp contract address.
|
|
59
|
-
*/
|
|
60
|
-
async getOnRamp(provider: ContractProvider, destChainSelector: bigint): Promise<Address> {
|
|
61
|
-
return provider
|
|
62
|
-
.get('onRamp', [{ type: 'int', value: destChainSelector }])
|
|
63
|
-
.then((r) => r.stack.readAddress())
|
|
64
|
-
}
|
|
65
|
-
}
|