@chainlink/ccip-sdk 0.91.1 → 0.92.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 +127 -80
- package/dist/aptos/hasher.d.ts.map +1 -1
- package/dist/aptos/hasher.js +7 -6
- package/dist/aptos/hasher.js.map +1 -1
- package/dist/aptos/index.d.ts +7 -2
- package/dist/aptos/index.d.ts.map +1 -1
- package/dist/aptos/index.js +29 -20
- package/dist/aptos/index.js.map +1 -1
- package/dist/aptos/logs.d.ts +5 -3
- package/dist/aptos/logs.d.ts.map +1 -1
- package/dist/aptos/logs.js +64 -27
- package/dist/aptos/logs.js.map +1 -1
- package/dist/aptos/token.d.ts.map +1 -1
- package/dist/aptos/token.js +2 -1
- package/dist/aptos/token.js.map +1 -1
- package/dist/aptos/types.js +6 -6
- package/dist/aptos/types.js.map +1 -1
- package/dist/chain.d.ts +36 -11
- package/dist/chain.d.ts.map +1 -1
- package/dist/chain.js +34 -2
- package/dist/chain.js.map +1 -1
- package/dist/commits.d.ts +2 -3
- package/dist/commits.d.ts.map +1 -1
- package/dist/commits.js +19 -8
- package/dist/commits.js.map +1 -1
- package/dist/errors/CCIPError.d.ts +48 -0
- package/dist/errors/CCIPError.d.ts.map +1 -0
- package/dist/errors/CCIPError.js +65 -0
- package/dist/errors/CCIPError.js.map +1 -0
- package/dist/errors/codes.d.ts +120 -0
- package/dist/errors/codes.d.ts.map +1 -0
- package/dist/errors/codes.js +156 -0
- package/dist/errors/codes.js.map +1 -0
- package/dist/errors/index.d.ts +26 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +51 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/recovery.d.ts +6 -0
- package/dist/errors/recovery.d.ts.map +1 -0
- package/dist/errors/recovery.js +118 -0
- package/dist/errors/recovery.js.map +1 -0
- package/dist/errors/specialized.d.ts +637 -0
- package/dist/errors/specialized.d.ts.map +1 -0
- package/dist/errors/specialized.js +1298 -0
- package/dist/errors/specialized.js.map +1 -0
- package/dist/errors/utils.d.ts +11 -0
- package/dist/errors/utils.d.ts.map +1 -0
- package/dist/errors/utils.js +61 -0
- package/dist/errors/utils.js.map +1 -0
- package/dist/evm/abi/CommitStore_1_5.js +1 -1
- package/dist/evm/abi/LockReleaseTokenPool_1_5.js +1 -1
- package/dist/evm/abi/OffRamp_1_5.js +1 -1
- package/dist/evm/abi/OnRamp_1_5.js +1 -1
- package/dist/evm/abi/PriceRegistry_1_2.d.ts +443 -0
- package/dist/evm/abi/PriceRegistry_1_2.d.ts.map +1 -0
- package/dist/evm/abi/PriceRegistry_1_2.js +439 -0
- package/dist/evm/abi/PriceRegistry_1_2.js.map +1 -0
- package/dist/evm/const.d.ts +1 -0
- package/dist/evm/const.d.ts.map +1 -1
- package/dist/evm/const.js +2 -0
- package/dist/evm/const.js.map +1 -1
- package/dist/evm/hasher.d.ts.map +1 -1
- package/dist/evm/hasher.js +7 -6
- package/dist/evm/hasher.js.map +1 -1
- package/dist/evm/index.d.ts +9 -13
- package/dist/evm/index.d.ts.map +1 -1
- package/dist/evm/index.js +85 -68
- package/dist/evm/index.js.map +1 -1
- package/dist/evm/logs.d.ts.map +1 -1
- package/dist/evm/logs.js +47 -16
- package/dist/evm/logs.js.map +1 -1
- package/dist/evm/messages.d.ts +7 -6
- package/dist/evm/messages.d.ts.map +1 -1
- package/dist/evm/offchain.js +1 -1
- package/dist/evm/offchain.js.map +1 -1
- package/dist/evm/types.d.ts +10 -0
- package/dist/evm/types.d.ts.map +1 -0
- package/dist/evm/types.js +2 -0
- package/dist/evm/types.js.map +1 -0
- package/dist/execution.d.ts.map +1 -1
- package/dist/execution.js +9 -5
- package/dist/execution.js.map +1 -1
- package/dist/extra-args.d.ts.map +1 -1
- package/dist/extra-args.js +4 -3
- package/dist/extra-args.js.map +1 -1
- package/dist/gas.d.ts.map +1 -1
- package/dist/gas.js +3 -2
- package/dist/gas.js.map +1 -1
- package/dist/hasher/hasher.d.ts.map +1 -1
- package/dist/hasher/hasher.js +2 -1
- package/dist/hasher/hasher.js.map +1 -1
- package/dist/hasher/merklemulti.d.ts.map +1 -1
- package/dist/hasher/merklemulti.js +9 -8
- package/dist/hasher/merklemulti.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/offchain.d.ts.map +1 -1
- package/dist/offchain.js +5 -8
- package/dist/offchain.js.map +1 -1
- package/dist/requests.d.ts +1 -1
- package/dist/requests.d.ts.map +1 -1
- package/dist/requests.js +37 -43
- package/dist/requests.js.map +1 -1
- package/dist/selectors.d.ts.map +1 -1
- package/dist/selectors.js +22 -0
- package/dist/selectors.js.map +1 -1
- package/dist/solana/cleanup.d.ts +2 -2
- package/dist/solana/cleanup.d.ts.map +1 -1
- package/dist/solana/cleanup.js +2 -3
- package/dist/solana/cleanup.js.map +1 -1
- package/dist/solana/exec.d.ts.map +1 -1
- package/dist/solana/exec.js +12 -12
- package/dist/solana/exec.js.map +1 -1
- package/dist/solana/hasher.d.ts.map +1 -1
- package/dist/solana/hasher.js +6 -5
- package/dist/solana/hasher.js.map +1 -1
- package/dist/solana/index.d.ts +30 -13
- package/dist/solana/index.d.ts.map +1 -1
- package/dist/solana/index.js +96 -143
- package/dist/solana/index.js.map +1 -1
- package/dist/solana/logs.d.ts +15 -0
- package/dist/solana/logs.d.ts.map +1 -0
- package/dist/solana/logs.js +106 -0
- package/dist/solana/logs.js.map +1 -0
- package/dist/solana/offchain.d.ts.map +1 -1
- package/dist/solana/offchain.js +6 -5
- package/dist/solana/offchain.js.map +1 -1
- package/dist/solana/patchBorsh.d.ts.map +1 -1
- package/dist/solana/patchBorsh.js +3 -2
- package/dist/solana/patchBorsh.js.map +1 -1
- package/dist/solana/send.d.ts.map +1 -1
- package/dist/solana/send.js +8 -7
- package/dist/solana/send.js.map +1 -1
- package/dist/solana/utils.d.ts +7 -8
- package/dist/solana/utils.d.ts.map +1 -1
- package/dist/solana/utils.js +23 -11
- package/dist/solana/utils.js.map +1 -1
- package/dist/sui/discovery.d.ts +18 -0
- package/dist/sui/discovery.d.ts.map +1 -0
- package/dist/sui/discovery.js +116 -0
- package/dist/sui/discovery.js.map +1 -0
- package/dist/sui/events.d.ts +36 -0
- package/dist/sui/events.d.ts.map +1 -0
- package/dist/sui/events.js +179 -0
- package/dist/sui/events.js.map +1 -0
- package/dist/sui/hasher.d.ts.map +1 -1
- package/dist/sui/hasher.js +6 -5
- package/dist/sui/hasher.js.map +1 -1
- package/dist/sui/index.d.ts +69 -41
- package/dist/sui/index.d.ts.map +1 -1
- package/dist/sui/index.js +402 -65
- package/dist/sui/index.js.map +1 -1
- package/dist/sui/manuallyExec/encoder.d.ts +8 -0
- package/dist/sui/manuallyExec/encoder.d.ts.map +1 -0
- package/dist/sui/manuallyExec/encoder.js +76 -0
- package/dist/sui/manuallyExec/encoder.js.map +1 -0
- package/dist/sui/manuallyExec/index.d.ts +37 -0
- package/dist/sui/manuallyExec/index.d.ts.map +1 -0
- package/dist/sui/manuallyExec/index.js +81 -0
- package/dist/sui/manuallyExec/index.js.map +1 -0
- package/dist/sui/objects.d.ts +46 -0
- package/dist/sui/objects.d.ts.map +1 -0
- package/dist/sui/objects.js +259 -0
- package/dist/sui/objects.js.map +1 -0
- package/dist/ton/bindings/offramp.d.ts +48 -0
- package/dist/ton/bindings/offramp.d.ts.map +1 -0
- package/dist/ton/bindings/offramp.js +63 -0
- package/dist/ton/bindings/offramp.js.map +1 -0
- package/dist/ton/bindings/onramp.d.ts +40 -0
- package/dist/ton/bindings/onramp.d.ts.map +1 -0
- package/dist/ton/bindings/onramp.js +51 -0
- package/dist/ton/bindings/onramp.js.map +1 -0
- package/dist/ton/bindings/router.d.ts +47 -0
- package/dist/ton/bindings/router.d.ts.map +1 -0
- package/dist/ton/bindings/router.js +51 -0
- package/dist/ton/bindings/router.js.map +1 -0
- package/dist/ton/exec.d.ts +18 -0
- package/dist/ton/exec.d.ts.map +1 -0
- package/dist/ton/exec.js +28 -0
- package/dist/ton/exec.js.map +1 -0
- package/dist/ton/hasher.d.ts +27 -0
- package/dist/ton/hasher.d.ts.map +1 -0
- package/dist/ton/hasher.js +134 -0
- package/dist/ton/hasher.js.map +1 -0
- package/dist/ton/index.d.ts +247 -0
- package/dist/ton/index.d.ts.map +1 -0
- package/dist/ton/index.js +781 -0
- package/dist/ton/index.js.map +1 -0
- package/dist/ton/logs.d.ts +26 -0
- package/dist/ton/logs.d.ts.map +1 -0
- package/dist/ton/logs.js +126 -0
- package/dist/ton/logs.js.map +1 -0
- package/dist/ton/types.d.ts +37 -0
- package/dist/ton/types.d.ts.map +1 -0
- package/dist/ton/types.js +92 -0
- package/dist/ton/types.js.map +1 -0
- package/dist/ton/utils.d.ts +67 -0
- package/dist/ton/utils.d.ts.map +1 -0
- package/dist/ton/utils.js +425 -0
- package/dist/ton/utils.js.map +1 -0
- package/dist/types.d.ts +4 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +10 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +52 -17
- package/dist/utils.js.map +1 -1
- package/package.json +12 -10
- package/src/aptos/hasher.ts +10 -6
- package/src/aptos/index.ts +50 -31
- package/src/aptos/logs.ts +85 -29
- package/src/aptos/token.ts +5 -1
- package/src/aptos/types.ts +6 -6
- package/src/chain.ts +83 -12
- package/src/commits.ts +23 -11
- package/src/errors/CCIPError.ts +86 -0
- package/src/errors/codes.ts +179 -0
- package/src/errors/index.ts +175 -0
- package/src/errors/recovery.ts +170 -0
- package/src/errors/specialized.ts +1655 -0
- package/src/errors/utils.ts +73 -0
- package/src/evm/abi/CommitStore_1_5.ts +1 -1
- package/src/evm/abi/LockReleaseTokenPool_1_5.ts +1 -1
- package/src/evm/abi/OffRamp_1_5.ts +1 -1
- package/src/evm/abi/OnRamp_1_5.ts +1 -1
- package/src/evm/abi/PriceRegistry_1_2.ts +438 -0
- package/src/evm/const.ts +2 -0
- package/src/evm/hasher.ts +7 -6
- package/src/evm/index.ts +104 -86
- package/src/evm/logs.ts +64 -16
- package/src/evm/messages.ts +14 -14
- package/src/evm/offchain.ts +1 -1
- package/src/evm/types.ts +11 -0
- package/src/execution.ts +13 -9
- package/src/extra-args.ts +4 -3
- package/src/gas.ts +10 -3
- package/src/hasher/hasher.ts +2 -1
- package/src/hasher/merklemulti.ts +18 -8
- package/src/index.ts +14 -2
- package/src/offchain.ts +10 -14
- package/src/requests.ts +51 -53
- package/src/selectors.ts +23 -0
- package/src/solana/cleanup.ts +2 -4
- package/src/solana/exec.ts +13 -13
- package/src/solana/hasher.ts +9 -5
- package/src/solana/index.ts +126 -200
- package/src/solana/logs.ts +155 -0
- package/src/solana/offchain.ts +10 -7
- package/src/solana/patchBorsh.ts +3 -2
- package/src/solana/send.ts +14 -7
- package/src/solana/utils.ts +31 -17
- package/src/sui/discovery.ts +163 -0
- package/src/sui/events.ts +328 -0
- package/src/sui/hasher.ts +6 -5
- package/src/sui/index.ts +528 -80
- package/src/sui/manuallyExec/encoder.ts +88 -0
- package/src/sui/manuallyExec/index.ts +137 -0
- package/src/sui/objects.ts +358 -0
- package/src/ton/bindings/offramp.ts +96 -0
- package/src/ton/bindings/onramp.ts +72 -0
- package/src/ton/bindings/router.ts +65 -0
- package/src/ton/exec.ts +44 -0
- package/src/ton/hasher.ts +184 -0
- package/src/ton/index.ts +989 -0
- package/src/ton/logs.ts +157 -0
- package/src/ton/types.ts +143 -0
- package/src/ton/utils.ts +514 -0
- package/src/types.ts +6 -2
- package/src/utils.ts +58 -23
- package/tsconfig.json +2 -1
|
@@ -0,0 +1,1298 @@
|
|
|
1
|
+
import { CCIPError } from "./CCIPError.js";
|
|
2
|
+
import { CCIPErrorCode } from "./codes.js";
|
|
3
|
+
// Chain/Network
|
|
4
|
+
/** Thrown when chain not found by chainId, selector, or name. */
|
|
5
|
+
export class CCIPChainNotFoundError extends CCIPError {
|
|
6
|
+
name = 'CCIPChainNotFoundError';
|
|
7
|
+
/** Creates a chain not found error. */
|
|
8
|
+
constructor(chainIdOrSelector, options) {
|
|
9
|
+
super(CCIPErrorCode.CHAIN_NOT_FOUND, `Chain not found: ${chainIdOrSelector}`, {
|
|
10
|
+
...options,
|
|
11
|
+
isTransient: false,
|
|
12
|
+
context: { ...options?.context, chainIdOrSelector },
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/** Thrown when chain family is not supported. */
|
|
17
|
+
export class CCIPChainFamilyUnsupportedError extends CCIPError {
|
|
18
|
+
name = 'CCIPChainFamilyUnsupportedError';
|
|
19
|
+
/** Creates a chain family unsupported error. */
|
|
20
|
+
constructor(family, options) {
|
|
21
|
+
super(CCIPErrorCode.CHAIN_FAMILY_UNSUPPORTED, `Unsupported chain family: ${family}`, {
|
|
22
|
+
...options,
|
|
23
|
+
isTransient: false,
|
|
24
|
+
context: { ...options?.context, family },
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// Block & Transaction
|
|
29
|
+
/** Thrown when block not found. Transient: block may not be indexed yet. */
|
|
30
|
+
export class CCIPBlockNotFoundError extends CCIPError {
|
|
31
|
+
name = 'CCIPBlockNotFoundError';
|
|
32
|
+
/** Creates a block not found error. */
|
|
33
|
+
constructor(block, options) {
|
|
34
|
+
super(CCIPErrorCode.BLOCK_NOT_FOUND, `Block not found: ${block}`, {
|
|
35
|
+
...options,
|
|
36
|
+
isTransient: true,
|
|
37
|
+
retryAfterMs: 12000,
|
|
38
|
+
context: { ...options?.context, block },
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** Thrown when transaction not found. Transient: tx may be pending. */
|
|
43
|
+
export class CCIPTransactionNotFoundError extends CCIPError {
|
|
44
|
+
name = 'CCIPTransactionNotFoundError';
|
|
45
|
+
/** Creates a transaction not found error. */
|
|
46
|
+
constructor(hash, options) {
|
|
47
|
+
super(CCIPErrorCode.TRANSACTION_NOT_FOUND, `Transaction not found: ${hash}`, {
|
|
48
|
+
...options,
|
|
49
|
+
isTransient: true,
|
|
50
|
+
retryAfterMs: 5000,
|
|
51
|
+
context: { ...options?.context, hash },
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// CCIP Message
|
|
56
|
+
/** Thrown when message format is invalid. */
|
|
57
|
+
export class CCIPMessageInvalidError extends CCIPError {
|
|
58
|
+
name = 'CCIPMessageInvalidError';
|
|
59
|
+
/** Creates a message invalid error. */
|
|
60
|
+
constructor(data, options) {
|
|
61
|
+
const dataStr = typeof data === 'object' && data !== null ? JSON.stringify(data) : String(data);
|
|
62
|
+
super(CCIPErrorCode.MESSAGE_INVALID, `Invalid CCIP message format: ${dataStr}`, {
|
|
63
|
+
...options,
|
|
64
|
+
isTransient: false,
|
|
65
|
+
context: { ...options?.context, data },
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/** Thrown when no CCIPSendRequested event in tx. Transient: tx may not be indexed. */
|
|
70
|
+
export class CCIPMessageNotFoundInTxError extends CCIPError {
|
|
71
|
+
name = 'CCIPMessageNotFoundInTxError';
|
|
72
|
+
/** Creates a message not found in transaction error. */
|
|
73
|
+
constructor(txHash, options) {
|
|
74
|
+
super(CCIPErrorCode.MESSAGE_NOT_FOUND_IN_TX, `Could not find any CCIPSendRequested message in tx: ${txHash}`, {
|
|
75
|
+
...options,
|
|
76
|
+
isTransient: true,
|
|
77
|
+
retryAfterMs: 30000,
|
|
78
|
+
context: { ...options?.context, txHash },
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** Thrown when message with messageId not found. Transient: message may be in transit. */
|
|
83
|
+
export class CCIPMessageIdNotFoundError extends CCIPError {
|
|
84
|
+
name = 'CCIPMessageIdNotFoundError';
|
|
85
|
+
/** Creates a message ID not found error. */
|
|
86
|
+
constructor(messageId, options) {
|
|
87
|
+
super(CCIPErrorCode.MESSAGE_ID_NOT_FOUND, `Could not find a CCIPSendRequested message with messageId: ${messageId}`, {
|
|
88
|
+
...options,
|
|
89
|
+
isTransient: true,
|
|
90
|
+
retryAfterMs: 30000,
|
|
91
|
+
context: { ...options?.context, messageId },
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/** Thrown when not all messages in batch were found. Transient: may still be indexing. */
|
|
96
|
+
export class CCIPMessageBatchIncompleteError extends CCIPError {
|
|
97
|
+
name = 'CCIPMessageBatchIncompleteError';
|
|
98
|
+
/** Creates a message batch incomplete error. */
|
|
99
|
+
constructor(seqNumRange, foundSeqNums, options) {
|
|
100
|
+
super(CCIPErrorCode.MESSAGE_BATCH_INCOMPLETE, `Could not find all messages in batch [${seqNumRange.min}..${seqNumRange.max}], got=[${foundSeqNums.join(',')}]`, {
|
|
101
|
+
...options,
|
|
102
|
+
isTransient: true,
|
|
103
|
+
retryAfterMs: 30000,
|
|
104
|
+
context: { ...options?.context, seqNumRange, foundSeqNums },
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/** Thrown when message not in expected batch. */
|
|
109
|
+
export class CCIPMessageNotInBatchError extends CCIPError {
|
|
110
|
+
name = 'CCIPMessageNotInBatchError';
|
|
111
|
+
/** Creates a message not in batch error. */
|
|
112
|
+
constructor(messageId, seqNumRange, options) {
|
|
113
|
+
super(CCIPErrorCode.MESSAGE_NOT_IN_BATCH, `Could not find ${messageId} in batch seqNums=[${seqNumRange.min}..${seqNumRange.max}]`, {
|
|
114
|
+
...options,
|
|
115
|
+
isTransient: false,
|
|
116
|
+
context: { ...options?.context, messageId, seqNumRange },
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
// Lane & Routing
|
|
121
|
+
/** Thrown when no offRamp found for lane. */
|
|
122
|
+
export class CCIPOffRampNotFoundError extends CCIPError {
|
|
123
|
+
name = 'CCIPOffRampNotFoundError';
|
|
124
|
+
/** Creates an offRamp not found error. */
|
|
125
|
+
constructor(onRamp, destNetwork, options) {
|
|
126
|
+
super(CCIPErrorCode.OFFRAMP_NOT_FOUND, `No matching offRamp found for "${onRamp}" on "${destNetwork}"`, {
|
|
127
|
+
...options,
|
|
128
|
+
isTransient: false,
|
|
129
|
+
context: { ...options?.context, onRamp, destNetwork },
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/** Thrown when onRamp required but not provided. */
|
|
134
|
+
export class CCIPOnRampRequiredError extends CCIPError {
|
|
135
|
+
name = 'CCIPOnRampRequiredError';
|
|
136
|
+
/** Creates an onRamp required error. */
|
|
137
|
+
constructor(options) {
|
|
138
|
+
super(CCIPErrorCode.ONRAMP_REQUIRED, 'onRamp address is required for this operation', {
|
|
139
|
+
...options,
|
|
140
|
+
isTransient: false,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
// Commit & Merkle
|
|
145
|
+
/** Thrown when commit report not found. Transient: DON may not have committed yet. */
|
|
146
|
+
export class CCIPCommitNotFoundError extends CCIPError {
|
|
147
|
+
name = 'CCIPCommitNotFoundError';
|
|
148
|
+
/** Creates a commit not found error. */
|
|
149
|
+
constructor(startBlock, sequenceNumber, options) {
|
|
150
|
+
super(CCIPErrorCode.COMMIT_NOT_FOUND, `Could not find commit after ${startBlock} for sequenceNumber=${sequenceNumber}`, {
|
|
151
|
+
...options,
|
|
152
|
+
isTransient: true,
|
|
153
|
+
retryAfterMs: 60000,
|
|
154
|
+
context: { ...options?.context, startBlock, sequenceNumber },
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/** Thrown when merkle root verification fails. */
|
|
159
|
+
export class CCIPMerkleRootMismatchError extends CCIPError {
|
|
160
|
+
name = 'CCIPMerkleRootMismatchError';
|
|
161
|
+
/** Creates a merkle root mismatch error. */
|
|
162
|
+
constructor(expected, got, options) {
|
|
163
|
+
super(CCIPErrorCode.MERKLE_ROOT_MISMATCH, `Merkle root created from send events doesn't match ReportAccepted merkle root: expected=${expected}, got=${got}`, {
|
|
164
|
+
...options,
|
|
165
|
+
isTransient: false,
|
|
166
|
+
context: { ...options?.context, expected, got },
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/** Thrown when attempting to create tree without leaves. */
|
|
171
|
+
export class CCIPMerkleTreeEmptyError extends CCIPError {
|
|
172
|
+
name = 'CCIPMerkleTreeEmptyError';
|
|
173
|
+
/** Creates a merkle tree empty error. */
|
|
174
|
+
constructor(options) {
|
|
175
|
+
super(CCIPErrorCode.MERKLE_TREE_EMPTY, 'Cannot construct merkle tree: no leaf hashes provided', {
|
|
176
|
+
...options,
|
|
177
|
+
isTransient: false,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
// Version
|
|
182
|
+
/** Thrown when CCIP version not supported. */
|
|
183
|
+
export class CCIPVersionUnsupportedError extends CCIPError {
|
|
184
|
+
name = 'CCIPVersionUnsupportedError';
|
|
185
|
+
/** Creates a version unsupported error. */
|
|
186
|
+
constructor(version, options) {
|
|
187
|
+
super(CCIPErrorCode.VERSION_UNSUPPORTED, `Unsupported version: ${version}`, {
|
|
188
|
+
...options,
|
|
189
|
+
isTransient: false,
|
|
190
|
+
context: { ...options?.context, version },
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
/** Thrown when hasher version not supported for chain. */
|
|
195
|
+
export class CCIPHasherVersionUnsupportedError extends CCIPError {
|
|
196
|
+
name = 'CCIPHasherVersionUnsupportedError';
|
|
197
|
+
/** Creates a hasher version unsupported error. */
|
|
198
|
+
constructor(chain, version, options) {
|
|
199
|
+
super(CCIPErrorCode.HASHER_VERSION_UNSUPPORTED, `Unsupported hasher version for ${chain}: ${version}`, {
|
|
200
|
+
...options,
|
|
201
|
+
isTransient: false,
|
|
202
|
+
context: { ...options?.context, chain, version },
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
// ExtraArgs
|
|
207
|
+
/** Thrown when extraArgs cannot be parsed. */
|
|
208
|
+
export class CCIPExtraArgsParseError extends CCIPError {
|
|
209
|
+
name = 'CCIPExtraArgsParseError';
|
|
210
|
+
/** Creates an extraArgs parse error. */
|
|
211
|
+
constructor(from, options) {
|
|
212
|
+
super(CCIPErrorCode.EXTRA_ARGS_PARSE_FAILED, `Could not parse extraArgs from "${from}"`, {
|
|
213
|
+
...options,
|
|
214
|
+
isTransient: false,
|
|
215
|
+
context: { ...options?.context, from },
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Thrown when extraArgs format invalid for chain family.
|
|
221
|
+
*
|
|
222
|
+
* @param chainFamily - Display name for the chain family (user-facing, differs from ChainFamily enum)
|
|
223
|
+
* @param extraArgs - The actual invalid extraArgs value (for debugging)
|
|
224
|
+
*/
|
|
225
|
+
export class CCIPExtraArgsInvalidError extends CCIPError {
|
|
226
|
+
name = 'CCIPExtraArgsInvalidError';
|
|
227
|
+
/** Creates an extraArgs invalid error. */
|
|
228
|
+
constructor(chainFamily, extraArgs, options) {
|
|
229
|
+
const ERROR_CODE_MAP = {
|
|
230
|
+
EVM: CCIPErrorCode.EXTRA_ARGS_INVALID_EVM,
|
|
231
|
+
SVM: CCIPErrorCode.EXTRA_ARGS_INVALID_SVM,
|
|
232
|
+
Sui: CCIPErrorCode.EXTRA_ARGS_INVALID_SUI,
|
|
233
|
+
Aptos: CCIPErrorCode.EXTRA_ARGS_INVALID_APTOS,
|
|
234
|
+
TON: CCIPErrorCode.EXTRA_ARGS_INVALID_TON,
|
|
235
|
+
};
|
|
236
|
+
const code = ERROR_CODE_MAP[chainFamily];
|
|
237
|
+
const message = extraArgs
|
|
238
|
+
? `Invalid extraArgs "${extraArgs}" for ${chainFamily}`
|
|
239
|
+
: `Invalid extraArgs for ${chainFamily}`;
|
|
240
|
+
super(code, message, {
|
|
241
|
+
...options,
|
|
242
|
+
isTransient: false,
|
|
243
|
+
context: { ...options?.context, chainFamily, extraArgs },
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
// Token & Registry
|
|
248
|
+
/** Thrown when token not found in registry. */
|
|
249
|
+
export class CCIPTokenNotInRegistryError extends CCIPError {
|
|
250
|
+
name = 'CCIPTokenNotInRegistryError';
|
|
251
|
+
/** Creates a token not in registry error. */
|
|
252
|
+
constructor(token, registry, options) {
|
|
253
|
+
super(CCIPErrorCode.TOKEN_NOT_IN_REGISTRY, `Token=${token} not found in registry=${registry}`, {
|
|
254
|
+
...options,
|
|
255
|
+
isTransient: false,
|
|
256
|
+
context: { ...options?.context, token, registry },
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
/** Thrown when token not configured in registry. */
|
|
261
|
+
export class CCIPTokenNotConfiguredError extends CCIPError {
|
|
262
|
+
name = 'CCIPTokenNotConfiguredError';
|
|
263
|
+
/** Creates a token not configured error. */
|
|
264
|
+
constructor(token, registry, options) {
|
|
265
|
+
super(CCIPErrorCode.TOKEN_NOT_CONFIGURED, `Token ${token} is not configured in registry ${registry}`, {
|
|
266
|
+
...options,
|
|
267
|
+
isTransient: false,
|
|
268
|
+
context: { ...options?.context, token, registry },
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
/** Thrown when destination token decimals insufficient. */
|
|
273
|
+
export class CCIPTokenDecimalsInsufficientError extends CCIPError {
|
|
274
|
+
name = 'CCIPTokenDecimalsInsufficientError';
|
|
275
|
+
/** Creates a token decimals insufficient error. */
|
|
276
|
+
constructor(token, destDecimals, destChain, amount, options) {
|
|
277
|
+
super(CCIPErrorCode.TOKEN_DECIMALS_INSUFFICIENT, `not enough decimals=${destDecimals} for token=${token} on dest=${destChain} to express ${amount}`, {
|
|
278
|
+
...options,
|
|
279
|
+
isTransient: false,
|
|
280
|
+
context: { ...options?.context, token, destDecimals, destChain, amount },
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
// Contract Type
|
|
285
|
+
/** Thrown when contract type is not as expected. */
|
|
286
|
+
export class CCIPContractTypeInvalidError extends CCIPError {
|
|
287
|
+
name = 'CCIPContractTypeInvalidError';
|
|
288
|
+
/** Creates a contract type invalid error. */
|
|
289
|
+
constructor(address, actualType, expectedTypes, options) {
|
|
290
|
+
super(CCIPErrorCode.CONTRACT_TYPE_INVALID, `Not a ${expectedTypes.join(', ')}: ${address} is "${actualType}"`, {
|
|
291
|
+
...options,
|
|
292
|
+
isTransient: false,
|
|
293
|
+
context: { ...options?.context, address, actualType, expectedTypes },
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
// Wallet & Signer
|
|
298
|
+
/** Thrown when wallet must be Signer but isn't. */
|
|
299
|
+
export class CCIPWalletNotSignerError extends CCIPError {
|
|
300
|
+
name = 'CCIPWalletNotSignerError';
|
|
301
|
+
/** Creates a wallet not signer error. */
|
|
302
|
+
constructor(wallet, options) {
|
|
303
|
+
super(CCIPErrorCode.WALLET_NOT_SIGNER, `Wallet must be a Signer, got=${typeof wallet}`, {
|
|
304
|
+
...options,
|
|
305
|
+
isTransient: false,
|
|
306
|
+
context: { ...options?.context, walletType: typeof wallet },
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
// Execution
|
|
311
|
+
/** Thrown when exec tx not confirmed. Transient: may need more time. */
|
|
312
|
+
export class CCIPExecTxNotConfirmedError extends CCIPError {
|
|
313
|
+
name = 'CCIPExecTxNotConfirmedError';
|
|
314
|
+
/** Creates an exec transaction not confirmed error. */
|
|
315
|
+
constructor(txHash, options) {
|
|
316
|
+
super(CCIPErrorCode.EXEC_TX_NOT_CONFIRMED, `Could not confirm exec tx: ${txHash}`, {
|
|
317
|
+
...options,
|
|
318
|
+
isTransient: true,
|
|
319
|
+
retryAfterMs: 5000,
|
|
320
|
+
context: { ...options?.context, txHash },
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
/** Thrown when exec tx reverted. */
|
|
325
|
+
export class CCIPExecTxRevertedError extends CCIPError {
|
|
326
|
+
name = 'CCIPExecTxRevertedError';
|
|
327
|
+
/** Creates an exec transaction reverted error. */
|
|
328
|
+
constructor(txHash, options) {
|
|
329
|
+
super(CCIPErrorCode.EXEC_TX_REVERTED, `Exec transaction reverted: ${txHash}`, {
|
|
330
|
+
...options,
|
|
331
|
+
isTransient: false,
|
|
332
|
+
context: { ...options?.context, txHash },
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
// Attestation (USDC/LBTC)
|
|
337
|
+
/** Thrown when USDC attestation fetch fails. Transient: attestation may not be ready. */
|
|
338
|
+
export class CCIPUsdcAttestationError extends CCIPError {
|
|
339
|
+
name = 'CCIPUsdcAttestationError';
|
|
340
|
+
/** Creates a USDC attestation error. */
|
|
341
|
+
constructor(messageHash, response, options) {
|
|
342
|
+
super(CCIPErrorCode.USDC_ATTESTATION_FAILED, `Could not fetch USDC attestation for hash: ${messageHash}`, {
|
|
343
|
+
...options,
|
|
344
|
+
isTransient: true,
|
|
345
|
+
retryAfterMs: 10000,
|
|
346
|
+
context: { ...options?.context, messageHash, response },
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
/** Thrown when LBTC attestation fetch fails. Transient: attestation may not be ready. */
|
|
351
|
+
export class CCIPLbtcAttestationError extends CCIPError {
|
|
352
|
+
name = 'CCIPLbtcAttestationError';
|
|
353
|
+
/** Creates an LBTC attestation error. */
|
|
354
|
+
constructor(response, options) {
|
|
355
|
+
super(CCIPErrorCode.LBTC_ATTESTATION_ERROR, `Error while fetching LBTC attestation. Response: ${JSON.stringify(response)}`, {
|
|
356
|
+
...options,
|
|
357
|
+
isTransient: true,
|
|
358
|
+
retryAfterMs: 10000,
|
|
359
|
+
context: { ...options?.context, response },
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
/** Thrown when LBTC attestation not found for payload hash. Transient: may not be processed yet. */
|
|
364
|
+
export class CCIPLbtcAttestationNotFoundError extends CCIPError {
|
|
365
|
+
name = 'CCIPLbtcAttestationNotFoundError';
|
|
366
|
+
/** Creates an LBTC attestation not found error. */
|
|
367
|
+
constructor(payloadHash, response, options) {
|
|
368
|
+
super(CCIPErrorCode.LBTC_ATTESTATION_NOT_FOUND, `Could not find LBTC attestation for hash: ${payloadHash}`, {
|
|
369
|
+
...options,
|
|
370
|
+
isTransient: true,
|
|
371
|
+
retryAfterMs: 30000,
|
|
372
|
+
context: { ...options?.context, payloadHash, response },
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
/** Thrown when LBTC attestation is not yet approved. Transient: may be pending notarization. */
|
|
377
|
+
export class CCIPLbtcAttestationNotApprovedError extends CCIPError {
|
|
378
|
+
name = 'CCIPLbtcAttestationNotApprovedError';
|
|
379
|
+
/** Creates an LBTC attestation not approved error. */
|
|
380
|
+
constructor(payloadHash, attestation, options) {
|
|
381
|
+
super(CCIPErrorCode.LBTC_ATTESTATION_NOT_APPROVED, `LBTC attestation not yet approved for hash: ${payloadHash}`, {
|
|
382
|
+
...options,
|
|
383
|
+
isTransient: true,
|
|
384
|
+
retryAfterMs: 30000,
|
|
385
|
+
context: { ...options?.context, payloadHash, attestation },
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
// Solana
|
|
390
|
+
/** Thrown when lookup table not found. Transient: may not be synced yet. */
|
|
391
|
+
export class CCIPSolanaLookupTableNotFoundError extends CCIPError {
|
|
392
|
+
name = 'CCIPSolanaLookupTableNotFoundError';
|
|
393
|
+
/** Creates a Solana lookup table not found error. */
|
|
394
|
+
constructor(address, options) {
|
|
395
|
+
super(CCIPErrorCode.SOLANA_LOOKUP_TABLE_NOT_FOUND, `Lookup table account not found: ${address}`, {
|
|
396
|
+
...options,
|
|
397
|
+
isTransient: true,
|
|
398
|
+
retryAfterMs: 5000,
|
|
399
|
+
context: { ...options?.context, address },
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
// Aptos
|
|
404
|
+
/** Thrown for invalid Aptos transaction hash or version. */
|
|
405
|
+
export class CCIPAptosTransactionInvalidError extends CCIPError {
|
|
406
|
+
name = 'CCIPAptosTransactionInvalidError';
|
|
407
|
+
/** Creates an Aptos transaction invalid error. */
|
|
408
|
+
constructor(hashOrVersion, options) {
|
|
409
|
+
super(CCIPErrorCode.APTOS_TX_INVALID, `Invalid transaction hash or version: ${hashOrVersion}`, {
|
|
410
|
+
...options,
|
|
411
|
+
isTransient: false,
|
|
412
|
+
context: { ...options?.context, hashOrVersion },
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
// HTTP & Data
|
|
417
|
+
/** Thrown for HTTP errors. Transient if 429 or 5xx. */
|
|
418
|
+
export class CCIPHttpError extends CCIPError {
|
|
419
|
+
name = 'CCIPHttpError';
|
|
420
|
+
/** Creates an HTTP error. */
|
|
421
|
+
constructor(status, statusText, options) {
|
|
422
|
+
super(CCIPErrorCode.HTTP_ERROR, `HTTP ${status}: ${statusText}`, {
|
|
423
|
+
...options,
|
|
424
|
+
isTransient: status === 429 || status >= 500,
|
|
425
|
+
context: { ...options?.context, status, statusText },
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
/** Thrown for not implemented features. */
|
|
430
|
+
export class CCIPNotImplementedError extends CCIPError {
|
|
431
|
+
name = 'CCIPNotImplementedError';
|
|
432
|
+
/** Creates a not implemented error. */
|
|
433
|
+
constructor(feature, options) {
|
|
434
|
+
super(CCIPErrorCode.NOT_IMPLEMENTED, feature ? `Not implemented: ${feature}` : 'Not implemented', {
|
|
435
|
+
...options,
|
|
436
|
+
isTransient: false,
|
|
437
|
+
context: { ...options?.context, feature },
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
// Data Format & Parsing
|
|
442
|
+
/** Thrown when data format is not supported. */
|
|
443
|
+
export class CCIPDataFormatUnsupportedError extends CCIPError {
|
|
444
|
+
name = 'CCIPDataFormatUnsupportedError';
|
|
445
|
+
/** Creates a data format unsupported error. */
|
|
446
|
+
constructor(data, options) {
|
|
447
|
+
super(CCIPErrorCode.DATA_FORMAT_UNSUPPORTED, `Unsupported data format: ${String(data)}`, {
|
|
448
|
+
...options,
|
|
449
|
+
isTransient: false,
|
|
450
|
+
context: { ...options?.context, data },
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
/** Thrown when typeAndVersion string cannot be parsed. */
|
|
455
|
+
export class CCIPTypeVersionInvalidError extends CCIPError {
|
|
456
|
+
name = 'CCIPTypeVersionInvalidError';
|
|
457
|
+
/** Creates a type version invalid error. */
|
|
458
|
+
constructor(typeAndVersion, options) {
|
|
459
|
+
super(CCIPErrorCode.TYPE_VERSION_INVALID, `Invalid typeAndVersion: "${typeAndVersion}"`, {
|
|
460
|
+
...options,
|
|
461
|
+
isTransient: false,
|
|
462
|
+
context: { ...options?.context, typeAndVersion },
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
/** Thrown when no block found before timestamp. */
|
|
467
|
+
export class CCIPBlockBeforeTimestampNotFoundError extends CCIPError {
|
|
468
|
+
name = 'CCIPBlockBeforeTimestampNotFoundError';
|
|
469
|
+
/** Creates a block before timestamp not found error. */
|
|
470
|
+
constructor(timestamp, options) {
|
|
471
|
+
super(CCIPErrorCode.BLOCK_BEFORE_TIMESTAMP_NOT_FOUND, `Could not find a block prior to timestamp=${timestamp}`, {
|
|
472
|
+
...options,
|
|
473
|
+
isTransient: false,
|
|
474
|
+
context: { ...options?.context, timestamp },
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
/** Thrown when message decoding fails. */
|
|
479
|
+
export class CCIPMessageDecodeError extends CCIPError {
|
|
480
|
+
name = 'CCIPMessageDecodeError';
|
|
481
|
+
/** Creates a message decode error. */
|
|
482
|
+
constructor(reason, options) {
|
|
483
|
+
super(CCIPErrorCode.MESSAGE_DECODE_FAILED, reason ? `Failed to decode message: ${reason}` : 'Failed to decode message', {
|
|
484
|
+
...options,
|
|
485
|
+
isTransient: false,
|
|
486
|
+
context: { ...options?.context, reason },
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
/** Thrown when network family is not supported for an operation. */
|
|
491
|
+
export class CCIPNetworkFamilyUnsupportedError extends CCIPError {
|
|
492
|
+
name = 'CCIPNetworkFamilyUnsupportedError';
|
|
493
|
+
/** Creates a network family unsupported error. */
|
|
494
|
+
constructor(family, options) {
|
|
495
|
+
super(CCIPErrorCode.NETWORK_FAMILY_UNSUPPORTED, `Unsupported network family: ${family}`, {
|
|
496
|
+
...options,
|
|
497
|
+
isTransient: false,
|
|
498
|
+
context: { ...options?.context, family },
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
/** Thrown when RPC endpoint not found. */
|
|
503
|
+
export class CCIPRpcNotFoundError extends CCIPError {
|
|
504
|
+
name = 'CCIPRpcNotFoundError';
|
|
505
|
+
/** Creates an RPC not found error. */
|
|
506
|
+
constructor(chainId, options) {
|
|
507
|
+
super(CCIPErrorCode.RPC_NOT_FOUND, `No RPC found for chainId=${chainId}`, {
|
|
508
|
+
...options,
|
|
509
|
+
isTransient: false,
|
|
510
|
+
context: { ...options?.context, chainId },
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
/** Thrown when logs not found for filter criteria. */
|
|
515
|
+
export class CCIPLogsNotFoundError extends CCIPError {
|
|
516
|
+
name = 'CCIPLogsNotFoundError';
|
|
517
|
+
/** Creates a logs not found error. */
|
|
518
|
+
constructor(filter, options) {
|
|
519
|
+
super(CCIPErrorCode.LOGS_NOT_FOUND, 'No logs found matching the filter criteria', {
|
|
520
|
+
...options,
|
|
521
|
+
isTransient: true,
|
|
522
|
+
retryAfterMs: 5000,
|
|
523
|
+
context: { ...options?.context, filter },
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
/** Thrown when log topics not found. */
|
|
528
|
+
export class CCIPLogTopicsNotFoundError extends CCIPError {
|
|
529
|
+
name = 'CCIPLogTopicsNotFoundError';
|
|
530
|
+
/** Creates a log topics not found error. */
|
|
531
|
+
constructor(topics, options) {
|
|
532
|
+
super(CCIPErrorCode.LOG_TOPICS_NOT_FOUND, `Could not find matching topics: ${String(topics)}`, {
|
|
533
|
+
...options,
|
|
534
|
+
isTransient: false,
|
|
535
|
+
context: { ...options?.context, topics },
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
/** Thrown when trying to `watch` logs but giving a fixed `endBlock` */
|
|
540
|
+
export class CCIPLogsWatchRequiresFinalityError extends CCIPError {
|
|
541
|
+
name = 'CCIPLogsWatchRequiresFinalityError';
|
|
542
|
+
/** Creates a block not found error. */
|
|
543
|
+
constructor(endBlock, options) {
|
|
544
|
+
super(CCIPErrorCode.LOGS_WATCH_REQUIRES_FINALITY, `Watch mode requires finality config for endBlock (latest, finalized or block depth=negative)`, { ...options, isTransient: false, context: { ...options?.context, endBlock } });
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
/** Thrown when trying to `watch` logs but giving a fixed `endBlock` */
|
|
548
|
+
export class CCIPLogsWatchRequiresStartError extends CCIPError {
|
|
549
|
+
name = 'CCIPLogsWatchRequiresStartError';
|
|
550
|
+
/** Creates a block not found error. */
|
|
551
|
+
constructor(options) {
|
|
552
|
+
super(CCIPErrorCode.LOGS_WATCH_REQUIRES_START, `Watch mode requires startBlock or startTime`, {
|
|
553
|
+
...options,
|
|
554
|
+
isTransient: false,
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
/** Thrown when address is required for logs filtering, but not provided. */
|
|
559
|
+
export class CCIPLogsAddressRequiredError extends CCIPError {
|
|
560
|
+
name = 'CCIPLogsAddressRequiredError';
|
|
561
|
+
/** Creates a Solana program address required error. */
|
|
562
|
+
constructor(options) {
|
|
563
|
+
super(CCIPErrorCode.LOGS_ADDRESS_REQUIRED, 'Address is required for logs filtering', {
|
|
564
|
+
...options,
|
|
565
|
+
isTransient: false,
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
// Chain Family
|
|
570
|
+
/** Thrown when network family does not match expected for a Chain constructor. */
|
|
571
|
+
export class CCIPChainFamilyMismatchError extends CCIPError {
|
|
572
|
+
name = 'CCIPChainFamilyMismatchError';
|
|
573
|
+
/** Creates a chain family mismatch error. */
|
|
574
|
+
constructor(chainName, expected, actual, options) {
|
|
575
|
+
super(CCIPErrorCode.CHAIN_FAMILY_MISMATCH, `Invalid network family for ${chainName}: expected ${expected}, got ${actual}`, {
|
|
576
|
+
...options,
|
|
577
|
+
isTransient: false,
|
|
578
|
+
context: { ...options?.context, chainName, expected, actual },
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
// Token Pool
|
|
583
|
+
/** Thrown when legacy (pre-1.5) token pools are not supported. */
|
|
584
|
+
export class CCIPLegacyTokenPoolsUnsupportedError extends CCIPError {
|
|
585
|
+
name = 'CCIPLegacyTokenPoolsUnsupportedError';
|
|
586
|
+
/** Creates a legacy token pools unsupported error. */
|
|
587
|
+
constructor(options) {
|
|
588
|
+
super(CCIPErrorCode.LEGACY_TOKEN_POOLS_UNSUPPORTED, 'Legacy <1.5 token pools not supported', {
|
|
589
|
+
...options,
|
|
590
|
+
isTransient: false,
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
// Merkle Validation
|
|
595
|
+
/** Thrown when merkle proof is empty. */
|
|
596
|
+
export class CCIPMerkleProofEmptyError extends CCIPError {
|
|
597
|
+
name = 'CCIPMerkleProofEmptyError';
|
|
598
|
+
/** Creates a merkle proof empty error. */
|
|
599
|
+
constructor(options) {
|
|
600
|
+
super(CCIPErrorCode.MERKLE_PROOF_EMPTY, 'Cannot verify merkle proof: leaves and proofs are empty', {
|
|
601
|
+
...options,
|
|
602
|
+
isTransient: false,
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
/** Thrown when merkle leaves or proofs exceed max limit. */
|
|
607
|
+
export class CCIPMerkleProofTooLargeError extends CCIPError {
|
|
608
|
+
name = 'CCIPMerkleProofTooLargeError';
|
|
609
|
+
/** Creates a merkle proof too large error. */
|
|
610
|
+
constructor(limit, options) {
|
|
611
|
+
super(CCIPErrorCode.MERKLE_PROOF_TOO_LARGE, `Leaves or proofs exceed limit of ${limit}`, {
|
|
612
|
+
...options,
|
|
613
|
+
isTransient: false,
|
|
614
|
+
context: { ...options?.context, limit },
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
/** Thrown when total hashes exceed max merkle tree size. */
|
|
619
|
+
export class CCIPMerkleHashesTooLargeError extends CCIPError {
|
|
620
|
+
name = 'CCIPMerkleHashesTooLargeError';
|
|
621
|
+
/** Creates a merkle hashes too large error. */
|
|
622
|
+
constructor(totalHashes, limit, options) {
|
|
623
|
+
super(CCIPErrorCode.MERKLE_HASHES_TOO_LARGE, `Total hashes ${totalHashes} exceeds limit ${limit}`, {
|
|
624
|
+
...options,
|
|
625
|
+
isTransient: false,
|
|
626
|
+
context: { ...options?.context, totalHashes, limit },
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
/** Thrown when source flags count does not match expected total. */
|
|
631
|
+
export class CCIPMerkleFlagsMismatchError extends CCIPError {
|
|
632
|
+
name = 'CCIPMerkleFlagsMismatchError';
|
|
633
|
+
/** Creates a merkle flags mismatch error. */
|
|
634
|
+
constructor(totalHashes, flagsLength, options) {
|
|
635
|
+
super(CCIPErrorCode.MERKLE_FLAGS_MISMATCH, `Hashes ${totalHashes} != sourceFlags ${flagsLength}`, {
|
|
636
|
+
...options,
|
|
637
|
+
isTransient: false,
|
|
638
|
+
context: { ...options?.context, totalHashes, flagsLength },
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
/** Thrown when proof source flags count does not match proof hashes. */
|
|
643
|
+
export class CCIPMerkleProofFlagsMismatchError extends CCIPError {
|
|
644
|
+
name = 'CCIPMerkleProofFlagsMismatchError';
|
|
645
|
+
/** Creates a merkle proof flags mismatch error. */
|
|
646
|
+
constructor(sourceProofCount, proofsLength, options) {
|
|
647
|
+
super(CCIPErrorCode.MERKLE_PROOF_FLAGS_MISMATCH, `Proof source flags ${sourceProofCount} != proof hashes ${proofsLength}`, {
|
|
648
|
+
...options,
|
|
649
|
+
isTransient: false,
|
|
650
|
+
context: { ...options?.context, sourceProofCount, proofsLength },
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
/** Thrown when not all proofs were consumed during verification. */
|
|
655
|
+
export class CCIPMerkleProofIncompleteError extends CCIPError {
|
|
656
|
+
name = 'CCIPMerkleProofIncompleteError';
|
|
657
|
+
/** Creates a merkle proof incomplete error. */
|
|
658
|
+
constructor(options) {
|
|
659
|
+
super(CCIPErrorCode.MERKLE_PROOF_INCOMPLETE, 'Merkle verification failed: not all proofs were consumed', {
|
|
660
|
+
...options,
|
|
661
|
+
isTransient: false,
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
/** Thrown on internal merkle computation error. */
|
|
666
|
+
export class CCIPMerkleInternalError extends CCIPError {
|
|
667
|
+
name = 'CCIPMerkleInternalError';
|
|
668
|
+
/** Creates a merkle internal error. */
|
|
669
|
+
constructor(message, options) {
|
|
670
|
+
super(CCIPErrorCode.MERKLE_INTERNAL_ERROR, message, {
|
|
671
|
+
...options,
|
|
672
|
+
isTransient: false,
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
// Address Validation
|
|
677
|
+
/** Thrown when EVM address is invalid. */
|
|
678
|
+
export class CCIPAddressInvalidEvmError extends CCIPError {
|
|
679
|
+
name = 'CCIPAddressInvalidEvmError';
|
|
680
|
+
/** Creates an EVM address invalid error. */
|
|
681
|
+
constructor(address, options) {
|
|
682
|
+
super(CCIPErrorCode.ADDRESS_INVALID_EVM, `Invalid EVM address: ${address}`, {
|
|
683
|
+
...options,
|
|
684
|
+
isTransient: false,
|
|
685
|
+
context: { ...options?.context, address },
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
// Version Requirements
|
|
690
|
+
/** Thrown when CCIP version requires lane info. */
|
|
691
|
+
export class CCIPVersionRequiresLaneError extends CCIPError {
|
|
692
|
+
name = 'CCIPVersionRequiresLaneError';
|
|
693
|
+
/** Creates a version requires lane error. */
|
|
694
|
+
constructor(version, options) {
|
|
695
|
+
super(CCIPErrorCode.VERSION_REQUIRES_LANE, `Decoding commits from CCIP ${version} requires lane`, {
|
|
696
|
+
...options,
|
|
697
|
+
isTransient: false,
|
|
698
|
+
context: { ...options?.context, version },
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
/** Thrown when version feature is unavailable. */
|
|
703
|
+
export class CCIPVersionFeatureUnavailableError extends CCIPError {
|
|
704
|
+
name = 'CCIPVersionFeatureUnavailableError';
|
|
705
|
+
/** Creates a version feature unavailable error. */
|
|
706
|
+
constructor(feature, version, minVersion, options) {
|
|
707
|
+
const msg = minVersion
|
|
708
|
+
? `${feature} requires version >= ${minVersion}, got ${version}`
|
|
709
|
+
: `${feature} not available in version ${version}`;
|
|
710
|
+
super(CCIPErrorCode.VERSION_FEATURE_UNAVAILABLE, msg, {
|
|
711
|
+
...options,
|
|
712
|
+
isTransient: false,
|
|
713
|
+
context: { ...options?.context, feature, version, minVersion },
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
// Contract Validation
|
|
718
|
+
/** Thrown when contract is not a Router or expected CCIP contract. */
|
|
719
|
+
export class CCIPContractNotRouterError extends CCIPError {
|
|
720
|
+
name = 'CCIPContractNotRouterError';
|
|
721
|
+
/** Creates a contract not router error. */
|
|
722
|
+
constructor(address, typeAndVersion, options) {
|
|
723
|
+
super(CCIPErrorCode.CONTRACT_NOT_ROUTER, `Not a Router, Ramp or expected contract: ${address} is "${typeAndVersion}"`, {
|
|
724
|
+
...options,
|
|
725
|
+
isTransient: false,
|
|
726
|
+
context: { ...options?.context, address, typeAndVersion },
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
// Log Data
|
|
731
|
+
/** Thrown when log data is invalid. */
|
|
732
|
+
export class CCIPLogDataInvalidError extends CCIPError {
|
|
733
|
+
name = 'CCIPLogDataInvalidError';
|
|
734
|
+
/** Creates a log data invalid error. */
|
|
735
|
+
constructor(data, options) {
|
|
736
|
+
super(CCIPErrorCode.LOG_DATA_INVALID, `Invalid log data: ${String(data)}`, {
|
|
737
|
+
...options,
|
|
738
|
+
isTransient: false,
|
|
739
|
+
context: { ...options?.context, data },
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
// Wallet
|
|
744
|
+
/** Thrown when wallet is not a valid signer. */
|
|
745
|
+
export class CCIPWalletInvalidError extends CCIPError {
|
|
746
|
+
name = 'CCIPWalletInvalidError';
|
|
747
|
+
/** Creates a wallet invalid error. */
|
|
748
|
+
constructor(wallet, options) {
|
|
749
|
+
super(CCIPErrorCode.WALLET_INVALID, `Wallet must be a Signer, got ${String(wallet)}`, {
|
|
750
|
+
...options,
|
|
751
|
+
isTransient: false,
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
// Source Chain
|
|
756
|
+
/** Thrown when source chain is unsupported for EVM hasher. */
|
|
757
|
+
export class CCIPSourceChainUnsupportedError extends CCIPError {
|
|
758
|
+
name = 'CCIPSourceChainUnsupportedError';
|
|
759
|
+
/** Creates a source chain unsupported error. */
|
|
760
|
+
constructor(chainSelector, options) {
|
|
761
|
+
super(CCIPErrorCode.SOLANA_SOURCE_CHAIN_UNSUPPORTED, `Unsupported source chain: ${chainSelector}`, {
|
|
762
|
+
...options,
|
|
763
|
+
isTransient: false,
|
|
764
|
+
context: { ...options?.context, chainSelector: String(chainSelector) },
|
|
765
|
+
});
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
// Solana-specific errors
|
|
769
|
+
/** Thrown when block time cannot be retrieved for a slot. */
|
|
770
|
+
export class CCIPBlockTimeNotFoundError extends CCIPError {
|
|
771
|
+
name = 'CCIPBlockTimeNotFoundError';
|
|
772
|
+
/** Creates a block time not found error. */
|
|
773
|
+
constructor(block, options) {
|
|
774
|
+
super(CCIPErrorCode.BLOCK_TIME_NOT_FOUND, `Could not get block time for slot ${block}`, {
|
|
775
|
+
...options,
|
|
776
|
+
isTransient: true,
|
|
777
|
+
retryAfterMs: 5000,
|
|
778
|
+
context: { ...options?.context, block },
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
/** Thrown when Solana topics are not valid strings. */
|
|
783
|
+
export class CCIPSolanaTopicsInvalidError extends CCIPError {
|
|
784
|
+
name = 'CCIPSolanaTopicsInvalidError';
|
|
785
|
+
/** Creates a Solana topics invalid error. */
|
|
786
|
+
constructor(options) {
|
|
787
|
+
super(CCIPErrorCode.SOLANA_TOPICS_INVALID, 'Solana event topics must be string values', {
|
|
788
|
+
...options,
|
|
789
|
+
isTransient: false,
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
/** Thrown when reference addresses account not found for offRamp. */
|
|
794
|
+
export class CCIPSolanaRefAddressesNotFoundError extends CCIPError {
|
|
795
|
+
name = 'CCIPSolanaRefAddressesNotFoundError';
|
|
796
|
+
/** Creates a reference addresses not found error. */
|
|
797
|
+
constructor(offRamp, options) {
|
|
798
|
+
super(CCIPErrorCode.SOLANA_REF_ADDRESSES_NOT_FOUND, `referenceAddresses account not found for offRamp=${offRamp}`, {
|
|
799
|
+
...options,
|
|
800
|
+
isTransient: true,
|
|
801
|
+
retryAfterMs: 5000,
|
|
802
|
+
context: { ...options?.context, offRamp },
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
/** Thrown when OffRamp events not found in feeQuoter transactions. */
|
|
807
|
+
export class CCIPSolanaOffRampEventsNotFoundError extends CCIPError {
|
|
808
|
+
name = 'CCIPSolanaOffRampEventsNotFoundError';
|
|
809
|
+
/** Creates an offRamp events not found error. */
|
|
810
|
+
constructor(feeQuoter, options) {
|
|
811
|
+
super(CCIPErrorCode.SOLANA_OFFRAMP_EVENTS_NOT_FOUND, `Could not find OffRamp events in feeQuoter=${feeQuoter} txs`, {
|
|
812
|
+
...options,
|
|
813
|
+
isTransient: true,
|
|
814
|
+
retryAfterMs: 10000,
|
|
815
|
+
context: { ...options?.context, feeQuoter },
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
/** Thrown when token pool info not found. */
|
|
820
|
+
export class CCIPTokenPoolInfoNotFoundError extends CCIPError {
|
|
821
|
+
name = 'CCIPTokenPoolInfoNotFoundError';
|
|
822
|
+
/** Creates a token pool info not found error. */
|
|
823
|
+
constructor(tokenPool, options) {
|
|
824
|
+
super(CCIPErrorCode.TOKEN_POOL_INFO_NOT_FOUND, `TokenPool info not found: ${tokenPool}`, {
|
|
825
|
+
...options,
|
|
826
|
+
isTransient: false,
|
|
827
|
+
context: { ...options?.context, tokenPool },
|
|
828
|
+
});
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
/** Thrown when SPL token is invalid or not Token-2022. */
|
|
832
|
+
export class CCIPSplTokenInvalidError extends CCIPError {
|
|
833
|
+
name = 'CCIPSplTokenInvalidError';
|
|
834
|
+
/** Creates an SPL token invalid error. */
|
|
835
|
+
constructor(token, options) {
|
|
836
|
+
super(CCIPErrorCode.TOKEN_INVALID_SPL, `Invalid SPL token or Token-2022: ${token}`, {
|
|
837
|
+
...options,
|
|
838
|
+
isTransient: false,
|
|
839
|
+
context: { ...options?.context, token },
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
/** Thrown when token data cannot be parsed. */
|
|
844
|
+
export class CCIPTokenDataParseError extends CCIPError {
|
|
845
|
+
name = 'CCIPTokenDataParseError';
|
|
846
|
+
/** Creates a token data parse error. */
|
|
847
|
+
constructor(token, options) {
|
|
848
|
+
super(CCIPErrorCode.TOKEN_DATA_PARSE_FAILED, `Unable to parse token data for ${token}`, {
|
|
849
|
+
...options,
|
|
850
|
+
isTransient: false,
|
|
851
|
+
context: { ...options?.context, token },
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
/** Thrown when EVMExtraArgsV2 has unsupported length. */
|
|
856
|
+
export class CCIPExtraArgsLengthInvalidError extends CCIPError {
|
|
857
|
+
name = 'CCIPExtraArgsLengthInvalidError';
|
|
858
|
+
/** Creates an extraArgs length invalid error. */
|
|
859
|
+
constructor(length, options) {
|
|
860
|
+
super(CCIPErrorCode.EXTRA_ARGS_LENGTH_INVALID, `Unsupported EVMExtraArgsV2 length: ${length}`, {
|
|
861
|
+
...options,
|
|
862
|
+
isTransient: false,
|
|
863
|
+
context: { ...options?.context, length },
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
/** Thrown when Solana can only encode EVMExtraArgsV2 but got different args. */
|
|
868
|
+
export class CCIPSolanaExtraArgsEncodingError extends CCIPError {
|
|
869
|
+
name = 'CCIPSolanaExtraArgsEncodingError';
|
|
870
|
+
/** Creates a Solana extraArgs encoding error. */
|
|
871
|
+
constructor(options) {
|
|
872
|
+
super(CCIPErrorCode.EXTRA_ARGS_SOLANA_EVM_ONLY, 'Solana extraArgs encoding only supports EVMExtraArgsV2 format', {
|
|
873
|
+
...options,
|
|
874
|
+
isTransient: false,
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
/** Thrown when log data is missing or not a string. */
|
|
879
|
+
export class CCIPLogDataMissingError extends CCIPError {
|
|
880
|
+
name = 'CCIPLogDataMissingError';
|
|
881
|
+
/** Creates a log data missing error. */
|
|
882
|
+
constructor(options) {
|
|
883
|
+
super(CCIPErrorCode.LOG_DATA_MISSING, 'Log data is missing or invalid: expected string value', {
|
|
884
|
+
...options,
|
|
885
|
+
isTransient: false,
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
/** Thrown when ExecutionState is invalid. */
|
|
890
|
+
export class CCIPExecutionStateInvalidError extends CCIPError {
|
|
891
|
+
name = 'CCIPExecutionStateInvalidError';
|
|
892
|
+
/** Creates an execution state invalid error. */
|
|
893
|
+
constructor(state, options) {
|
|
894
|
+
super(CCIPErrorCode.EXECUTION_STATE_INVALID, `Invalid ExecutionState: ${String(state)}`, {
|
|
895
|
+
...options,
|
|
896
|
+
isTransient: false,
|
|
897
|
+
context: { ...options?.context, state },
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
/** Thrown when execution report message is not for Solana. */
|
|
902
|
+
export class CCIPExecutionReportChainMismatchError extends CCIPError {
|
|
903
|
+
name = 'CCIPExecutionReportChainMismatchError';
|
|
904
|
+
/** Creates an execution report chain mismatch error. */
|
|
905
|
+
constructor(chain, options) {
|
|
906
|
+
super(CCIPErrorCode.MESSAGE_CHAIN_MISMATCH, `ExecutionReport's message not for ${chain}`, {
|
|
907
|
+
...options,
|
|
908
|
+
isTransient: false,
|
|
909
|
+
context: { ...options?.context, chain },
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
/** Thrown when token pool state PDA not found. */
|
|
914
|
+
export class CCIPTokenPoolStateNotFoundError extends CCIPError {
|
|
915
|
+
name = 'CCIPTokenPoolStateNotFoundError';
|
|
916
|
+
/** Creates a token pool state not found error. */
|
|
917
|
+
constructor(tokenPool, options) {
|
|
918
|
+
super(CCIPErrorCode.TOKEN_POOL_STATE_NOT_FOUND, `TokenPool State PDA not found at ${tokenPool}`, {
|
|
919
|
+
...options,
|
|
920
|
+
isTransient: false,
|
|
921
|
+
context: { ...options?.context, tokenPool },
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
/** Thrown when ChainConfig not found for token pool and remote chain. */
|
|
926
|
+
export class CCIPTokenPoolChainConfigNotFoundError extends CCIPError {
|
|
927
|
+
name = 'CCIPTokenPoolChainConfigNotFoundError';
|
|
928
|
+
/** Creates a token pool chain config not found error. */
|
|
929
|
+
constructor(address, tokenPool, remoteNetwork, options) {
|
|
930
|
+
super(CCIPErrorCode.TOKEN_NOT_CONFIGURED, `ChainConfig not found at ${address} for tokenPool=${tokenPool} and remoteNetwork=${remoteNetwork}`, {
|
|
931
|
+
...options,
|
|
932
|
+
isTransient: false,
|
|
933
|
+
context: { ...options?.context, address, tokenPool, remoteNetwork },
|
|
934
|
+
});
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
// Aptos-specific errors
|
|
938
|
+
/** Thrown when Aptos network is unknown. */
|
|
939
|
+
export class CCIPAptosNetworkUnknownError extends CCIPError {
|
|
940
|
+
name = 'CCIPAptosNetworkUnknownError';
|
|
941
|
+
/** Creates an Aptos network unknown error. */
|
|
942
|
+
constructor(url, options) {
|
|
943
|
+
super(CCIPErrorCode.APTOS_NETWORK_UNKNOWN, `Unknown Aptos network: ${url}`, {
|
|
944
|
+
...options,
|
|
945
|
+
isTransient: false,
|
|
946
|
+
context: { ...options?.context, url },
|
|
947
|
+
});
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
/** Thrown when Aptos transaction type is invalid. */
|
|
951
|
+
export class CCIPAptosTransactionTypeInvalidError extends CCIPError {
|
|
952
|
+
name = 'CCIPAptosTransactionTypeInvalidError';
|
|
953
|
+
/** Creates an Aptos transaction type invalid error. */
|
|
954
|
+
constructor(options) {
|
|
955
|
+
super(CCIPErrorCode.APTOS_TX_TYPE_INVALID, 'Invalid Aptos transaction type: expected user_transaction', {
|
|
956
|
+
...options,
|
|
957
|
+
isTransient: false,
|
|
958
|
+
});
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
/** Thrown when Aptos registry type is invalid. */
|
|
962
|
+
export class CCIPAptosRegistryTypeInvalidError extends CCIPError {
|
|
963
|
+
name = 'CCIPAptosRegistryTypeInvalidError';
|
|
964
|
+
/** Creates an Aptos registry type invalid error. */
|
|
965
|
+
constructor(registry, actualType, options) {
|
|
966
|
+
super(CCIPErrorCode.REGISTRY_TYPE_INVALID, `Expected ${registry} to have TokenAdminRegistry type, got=${actualType}`, {
|
|
967
|
+
...options,
|
|
968
|
+
isTransient: false,
|
|
969
|
+
context: { ...options?.context, registry, actualType },
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
/** Thrown when Aptos log data is invalid. */
|
|
974
|
+
export class CCIPAptosLogInvalidError extends CCIPError {
|
|
975
|
+
name = 'CCIPAptosLogInvalidError';
|
|
976
|
+
/** Creates an Aptos log invalid error. */
|
|
977
|
+
constructor(log, options) {
|
|
978
|
+
super(CCIPErrorCode.LOG_APTOS_INVALID, `Invalid aptos log: ${String(log)}`, {
|
|
979
|
+
...options,
|
|
980
|
+
isTransient: false,
|
|
981
|
+
context: { ...options?.context, log },
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
/** Thrown when Aptos address is invalid. */
|
|
986
|
+
export class CCIPAptosAddressInvalidError extends CCIPError {
|
|
987
|
+
name = 'CCIPAptosAddressInvalidError';
|
|
988
|
+
/** Creates an Aptos address invalid error. */
|
|
989
|
+
constructor(address, options) {
|
|
990
|
+
super(CCIPErrorCode.ADDRESS_INVALID_APTOS, `Invalid aptos address: "${address}"`, {
|
|
991
|
+
...options,
|
|
992
|
+
isTransient: false,
|
|
993
|
+
context: { ...options?.context, address },
|
|
994
|
+
});
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
/** Thrown when Aptos can only encode specific extra args types. */
|
|
998
|
+
export class CCIPAptosExtraArgsEncodingError extends CCIPError {
|
|
999
|
+
name = 'CCIPAptosExtraArgsEncodingError';
|
|
1000
|
+
/** Creates an Aptos extraArgs encoding error. */
|
|
1001
|
+
constructor(options) {
|
|
1002
|
+
super(CCIPErrorCode.EXTRA_ARGS_APTOS_RESTRICTION, 'Aptos can only encode EVMExtraArgsV2 & SVMExtraArgsV1', {
|
|
1003
|
+
...options,
|
|
1004
|
+
isTransient: false,
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
/** Thrown when Aptos wallet is invalid. */
|
|
1009
|
+
export class CCIPAptosWalletInvalidError extends CCIPError {
|
|
1010
|
+
name = 'CCIPAptosWalletInvalidError';
|
|
1011
|
+
/** Creates an Aptos wallet invalid error. */
|
|
1012
|
+
constructor(className, wallet, options) {
|
|
1013
|
+
super(CCIPErrorCode.WALLET_INVALID, `${className}.sendMessage requires an Aptos account wallet, got=${wallet}`, {
|
|
1014
|
+
...options,
|
|
1015
|
+
isTransient: false,
|
|
1016
|
+
context: { ...options?.context, className, wallet },
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
/** Thrown when Aptos expects EVMExtraArgsV2 reports. */
|
|
1021
|
+
export class CCIPAptosExtraArgsV2RequiredError extends CCIPError {
|
|
1022
|
+
name = 'CCIPAptosExtraArgsV2RequiredError';
|
|
1023
|
+
/** Creates an Aptos EVMExtraArgsV2 required error. */
|
|
1024
|
+
constructor(options) {
|
|
1025
|
+
super(CCIPErrorCode.EXTRA_ARGS_APTOS_V2_REQUIRED, 'Aptos expects EVMExtraArgsV2 reports', {
|
|
1026
|
+
...options,
|
|
1027
|
+
isTransient: false,
|
|
1028
|
+
});
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
/** Thrown when token is not registered in Aptos registry. */
|
|
1032
|
+
export class CCIPAptosTokenNotRegisteredError extends CCIPError {
|
|
1033
|
+
name = 'CCIPAptosTokenNotRegisteredError';
|
|
1034
|
+
/** Creates an Aptos token not registered error. */
|
|
1035
|
+
constructor(token, registry, options) {
|
|
1036
|
+
super(CCIPErrorCode.TOKEN_NOT_REGISTERED, `Token=${token} not registered in registry=${registry}`, {
|
|
1037
|
+
...options,
|
|
1038
|
+
isTransient: false,
|
|
1039
|
+
context: { ...options?.context, token, registry },
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
/** Thrown for unexpected Aptos transaction type. */
|
|
1044
|
+
export class CCIPAptosTransactionTypeUnexpectedError extends CCIPError {
|
|
1045
|
+
name = 'CCIPAptosTransactionTypeUnexpectedError';
|
|
1046
|
+
/** Creates an Aptos transaction type unexpected error. */
|
|
1047
|
+
constructor(type, options) {
|
|
1048
|
+
super(CCIPErrorCode.APTOS_TX_TYPE_UNEXPECTED, `Unexpected transaction type="${type}"`, {
|
|
1049
|
+
...options,
|
|
1050
|
+
isTransient: false,
|
|
1051
|
+
context: { ...options?.context, type },
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
/** Thrown when Aptos address with module is required. */
|
|
1056
|
+
export class CCIPAptosAddressModuleRequiredError extends CCIPError {
|
|
1057
|
+
name = 'CCIPAptosAddressModuleRequiredError';
|
|
1058
|
+
/** Creates an Aptos address module required error. */
|
|
1059
|
+
constructor(options) {
|
|
1060
|
+
super(CCIPErrorCode.APTOS_ADDRESS_MODULE_REQUIRED, 'Aptos address with module name is required for this operation', {
|
|
1061
|
+
...options,
|
|
1062
|
+
isTransient: false,
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
/** Thrown when Aptos topic is invalid. */
|
|
1067
|
+
export class CCIPAptosTopicInvalidError extends CCIPError {
|
|
1068
|
+
name = 'CCIPAptosTopicInvalidError';
|
|
1069
|
+
/** Creates an Aptos topic invalid error. */
|
|
1070
|
+
constructor(topic, options) {
|
|
1071
|
+
super(CCIPErrorCode.APTOS_TOPIC_INVALID, topic ? `Unknown topic event handler="${topic}"` : 'single string topic required', {
|
|
1072
|
+
...options,
|
|
1073
|
+
isTransient: false,
|
|
1074
|
+
context: { ...options?.context, topic },
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
// Borsh
|
|
1079
|
+
/** Thrown when Borsh type is unknown. */
|
|
1080
|
+
export class CCIPBorshTypeUnknownError extends CCIPError {
|
|
1081
|
+
name = 'CCIPBorshTypeUnknownError';
|
|
1082
|
+
/** Creates a Borsh type unknown error. */
|
|
1083
|
+
constructor(name, options) {
|
|
1084
|
+
super(CCIPErrorCode.BORSH_TYPE_UNKNOWN, `Unknown type: ${name}`, {
|
|
1085
|
+
...options,
|
|
1086
|
+
isTransient: false,
|
|
1087
|
+
context: { ...options?.context, name },
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
/** Thrown when Borsh method is unknown. */
|
|
1092
|
+
export class CCIPBorshMethodUnknownError extends CCIPError {
|
|
1093
|
+
name = 'CCIPBorshMethodUnknownError';
|
|
1094
|
+
/** Creates a Borsh method unknown error. */
|
|
1095
|
+
constructor(method, options) {
|
|
1096
|
+
super(CCIPErrorCode.BORSH_METHOD_UNKNOWN, `Unknown method: ${method}`, {
|
|
1097
|
+
...options,
|
|
1098
|
+
isTransient: false,
|
|
1099
|
+
context: { ...options?.context, method },
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
// CLI & Validation
|
|
1104
|
+
/** Thrown when CLI argument is invalid. */
|
|
1105
|
+
export class CCIPArgumentInvalidError extends CCIPError {
|
|
1106
|
+
name = 'CCIPArgumentInvalidError';
|
|
1107
|
+
/** Creates an argument invalid error. */
|
|
1108
|
+
constructor(argument, reason, options) {
|
|
1109
|
+
super(CCIPErrorCode.ARGUMENT_INVALID, `Invalid argument "${argument}": ${reason}`, {
|
|
1110
|
+
...options,
|
|
1111
|
+
isTransient: false,
|
|
1112
|
+
context: { ...options?.context, argument, reason },
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
/** Thrown when execution receipt not found in tx logs. Transient: receipt may not be indexed yet. */
|
|
1117
|
+
export class CCIPReceiptNotFoundError extends CCIPError {
|
|
1118
|
+
name = 'CCIPReceiptNotFoundError';
|
|
1119
|
+
/** Creates a receipt not found error. */
|
|
1120
|
+
constructor(txHash, options) {
|
|
1121
|
+
super(CCIPErrorCode.RECEIPT_NOT_FOUND, `Could not find receipt in tx logs: ${txHash}`, {
|
|
1122
|
+
...options,
|
|
1123
|
+
isTransient: true,
|
|
1124
|
+
retryAfterMs: 5000,
|
|
1125
|
+
context: { ...options?.context, txHash },
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
/** Thrown when data cannot be parsed. */
|
|
1130
|
+
export class CCIPDataParseError extends CCIPError {
|
|
1131
|
+
name = 'CCIPDataParseError';
|
|
1132
|
+
/** Creates a data parse error. */
|
|
1133
|
+
constructor(data, options) {
|
|
1134
|
+
const truncated = data.length > 66 ? `${data.slice(0, 66)}...` : data;
|
|
1135
|
+
super(CCIPErrorCode.DATA_PARSE_FAILED, `Could not parse data: ${truncated}`, {
|
|
1136
|
+
...options,
|
|
1137
|
+
isTransient: false,
|
|
1138
|
+
context: { ...options?.context, data },
|
|
1139
|
+
});
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
/** Thrown when token not found in supported tokens list. */
|
|
1143
|
+
export class CCIPTokenNotFoundError extends CCIPError {
|
|
1144
|
+
name = 'CCIPTokenNotFoundError';
|
|
1145
|
+
/** Creates a token not found error. */
|
|
1146
|
+
constructor(token, options) {
|
|
1147
|
+
super(CCIPErrorCode.TOKEN_NOT_FOUND, `Token not found: ${token}`, {
|
|
1148
|
+
...options,
|
|
1149
|
+
isTransient: false,
|
|
1150
|
+
context: { ...options?.context, token },
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
// Solana-specific (additional)
|
|
1155
|
+
/** Thrown when router config not found at PDA. */
|
|
1156
|
+
export class CCIPSolanaRouterConfigNotFoundError extends CCIPError {
|
|
1157
|
+
name = 'CCIPSolanaRouterConfigNotFoundError';
|
|
1158
|
+
/** Creates a Solana router config not found error. */
|
|
1159
|
+
constructor(configPda, options) {
|
|
1160
|
+
super(CCIPErrorCode.SOLANA_ROUTER_CONFIG_NOT_FOUND, `Router config not found at ${configPda}`, {
|
|
1161
|
+
...options,
|
|
1162
|
+
isTransient: false,
|
|
1163
|
+
context: { ...options?.context, configPda },
|
|
1164
|
+
});
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
/** Thrown when fee result from router is invalid. */
|
|
1168
|
+
export class CCIPSolanaFeeResultInvalidError extends CCIPError {
|
|
1169
|
+
name = 'CCIPSolanaFeeResultInvalidError';
|
|
1170
|
+
/** Creates a Solana fee result invalid error. */
|
|
1171
|
+
constructor(result, options) {
|
|
1172
|
+
super(CCIPErrorCode.SOLANA_FEE_RESULT_INVALID, `Invalid fee result from router: ${result}`, {
|
|
1173
|
+
...options,
|
|
1174
|
+
isTransient: false,
|
|
1175
|
+
context: { ...options?.context, result },
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
/** Thrown when token mint not found. */
|
|
1180
|
+
export class CCIPTokenMintNotFoundError extends CCIPError {
|
|
1181
|
+
name = 'CCIPTokenMintNotFoundError';
|
|
1182
|
+
/** Creates a token mint not found error. */
|
|
1183
|
+
constructor(token, options) {
|
|
1184
|
+
super(CCIPErrorCode.TOKEN_MINT_NOT_FOUND, `Mint ${token} not found`, {
|
|
1185
|
+
...options,
|
|
1186
|
+
isTransient: false,
|
|
1187
|
+
context: { ...options?.context, token },
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
/** Thrown when token amount is invalid. */
|
|
1192
|
+
export class CCIPTokenAmountInvalidError extends CCIPError {
|
|
1193
|
+
name = 'CCIPTokenAmountInvalidError';
|
|
1194
|
+
/** Creates a token amount invalid error. */
|
|
1195
|
+
constructor(options) {
|
|
1196
|
+
super(CCIPErrorCode.TOKEN_AMOUNT_INVALID, 'Invalid token amount: token address and positive amount required', {
|
|
1197
|
+
...options,
|
|
1198
|
+
isTransient: false,
|
|
1199
|
+
});
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
/** Thrown when transaction not finalized after timeout. */
|
|
1203
|
+
export class CCIPTransactionNotFinalizedError extends CCIPError {
|
|
1204
|
+
name = 'CCIPTransactionNotFinalizedError';
|
|
1205
|
+
/** Creates a transaction not finalized error. */
|
|
1206
|
+
constructor(signature, options) {
|
|
1207
|
+
super(CCIPErrorCode.TRANSACTION_NOT_FINALIZED, `Transaction ${signature} not finalized after timeout`, {
|
|
1208
|
+
...options,
|
|
1209
|
+
isTransient: true,
|
|
1210
|
+
retryAfterMs: 10000,
|
|
1211
|
+
context: { ...options?.context, signature },
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
/** Thrown when CCTP event decode fails. */
|
|
1216
|
+
export class CCIPCctpDecodeError extends CCIPError {
|
|
1217
|
+
name = 'CCIPCctpDecodeError';
|
|
1218
|
+
/** Creates a CCTP decode error. */
|
|
1219
|
+
constructor(log, options) {
|
|
1220
|
+
super(CCIPErrorCode.CCTP_DECODE_FAILED, `Failed to decode CCTP event: ${log}`, {
|
|
1221
|
+
...options,
|
|
1222
|
+
isTransient: false,
|
|
1223
|
+
context: { ...options?.context, log },
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
/** Thrown when Sui hasher version is unsupported. */
|
|
1228
|
+
export class CCIPSuiHasherVersionUnsupportedError extends CCIPError {
|
|
1229
|
+
name = 'CCIPSuiHasherVersionUnsupportedError';
|
|
1230
|
+
/** Creates a Sui hasher version unsupported error. */
|
|
1231
|
+
constructor(version, options) {
|
|
1232
|
+
super(CCIPErrorCode.HASHER_VERSION_UNSUPPORTED, `Unsupported hasher version for Sui: ${version}`, {
|
|
1233
|
+
...options,
|
|
1234
|
+
isTransient: false,
|
|
1235
|
+
context: { ...options?.context, version },
|
|
1236
|
+
});
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
/** Thrown when Sui message version is invalid. */
|
|
1240
|
+
export class CCIPSuiMessageVersionInvalidError extends CCIPError {
|
|
1241
|
+
name = 'CCIPSuiMessageVersionInvalidError';
|
|
1242
|
+
/** Creates a Sui message version invalid error. */
|
|
1243
|
+
constructor(options) {
|
|
1244
|
+
super(CCIPErrorCode.MESSAGE_VERSION_INVALID, 'Invalid Sui message: only CCIP v1.6 format is supported', {
|
|
1245
|
+
...options,
|
|
1246
|
+
isTransient: false,
|
|
1247
|
+
});
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
/** Thrown when Solana lane version is unsupported. */
|
|
1251
|
+
export class CCIPSolanaLaneVersionUnsupportedError extends CCIPError {
|
|
1252
|
+
name = 'CCIPSolanaLaneVersionUnsupportedError';
|
|
1253
|
+
/** Creates a Solana lane version unsupported error. */
|
|
1254
|
+
constructor(version, options) {
|
|
1255
|
+
super(CCIPErrorCode.LANE_VERSION_UNSUPPORTED, `Unsupported lane version: ${version}`, {
|
|
1256
|
+
...options,
|
|
1257
|
+
isTransient: false,
|
|
1258
|
+
context: { ...options?.context, version },
|
|
1259
|
+
});
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
/** Thrown when multiple CCTP events found in transaction. */
|
|
1263
|
+
export class CCIPCctpMultipleEventsError extends CCIPError {
|
|
1264
|
+
name = 'CCIPCctpMultipleEventsError';
|
|
1265
|
+
/** Creates a CCTP multiple events error. */
|
|
1266
|
+
constructor(count, txSignature, options) {
|
|
1267
|
+
super(CCIPErrorCode.CCTP_MULTIPLE_EVENTS, `Expected only 1 CcipCctpMessageSentEvent, found ${count} in transaction ${txSignature}`, {
|
|
1268
|
+
...options,
|
|
1269
|
+
isTransient: false,
|
|
1270
|
+
context: { ...options?.context, count, txSignature },
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
/** Thrown when compute units exceed limit. */
|
|
1275
|
+
export class CCIPSolanaComputeUnitsExceededError extends CCIPError {
|
|
1276
|
+
name = 'CCIPSolanaComputeUnitsExceededError';
|
|
1277
|
+
/** Creates a compute units exceeded error. */
|
|
1278
|
+
constructor(simulated, limit, options) {
|
|
1279
|
+
super(CCIPErrorCode.SOLANA_COMPUTE_UNITS_EXCEEDED, `Main simulation exceeds specified computeUnits limit. simulated=${simulated}, limit=${limit}`, {
|
|
1280
|
+
...options,
|
|
1281
|
+
isTransient: false,
|
|
1282
|
+
context: { ...options?.context, simulated, limit },
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
/** Thrown when Aptos hasher version is unsupported. */
|
|
1287
|
+
export class CCIPAptosHasherVersionUnsupportedError extends CCIPError {
|
|
1288
|
+
name = 'CCIPAptosHasherVersionUnsupportedError';
|
|
1289
|
+
/** Creates an Aptos hasher version unsupported error. */
|
|
1290
|
+
constructor(version, options) {
|
|
1291
|
+
super(CCIPErrorCode.APTOS_HASHER_VERSION_UNSUPPORTED, `Unsupported hasher version for Aptos: ${version}`, {
|
|
1292
|
+
...options,
|
|
1293
|
+
isTransient: false,
|
|
1294
|
+
context: { ...options?.context, version },
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
//# sourceMappingURL=specialized.js.map
|