@avalabs/bridge-unified 2.1.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +115 -31
  3. package/dist/index.cjs +36 -10
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.cts +252 -84
  6. package/dist/index.d.ts +252 -84
  7. package/dist/index.js +9 -4
  8. package/dist/index.js.map +1 -1
  9. package/package.json +14 -4
  10. package/.turbo/turbo-build.log +0 -22
  11. package/.turbo/turbo-lint.log +0 -4
  12. package/.turbo/turbo-test.log +0 -26
  13. package/CHANGELOG.md +0 -37
  14. package/jest.config.js +0 -9
  15. package/src/bridges/cctp/__mocks__/asset.mock.ts +0 -15
  16. package/src/bridges/cctp/__mocks__/bridge-transfer.mock.ts +0 -48
  17. package/src/bridges/cctp/__mocks__/chain.mocks.ts +0 -33
  18. package/src/bridges/cctp/__mocks__/config.mock.ts +0 -45
  19. package/src/bridges/cctp/abis/erc20.ts +0 -117
  20. package/src/bridges/cctp/abis/message-transmitter.ts +0 -318
  21. package/src/bridges/cctp/abis/token-router.ts +0 -843
  22. package/src/bridges/cctp/factory.test.ts +0 -73
  23. package/src/bridges/cctp/factory.ts +0 -36
  24. package/src/bridges/cctp/handlers/estimate-gas.test.ts +0 -110
  25. package/src/bridges/cctp/handlers/estimate-gas.ts +0 -58
  26. package/src/bridges/cctp/handlers/get-assets.test.ts +0 -47
  27. package/src/bridges/cctp/handlers/get-assets.ts +0 -27
  28. package/src/bridges/cctp/handlers/get-fees.test.ts +0 -61
  29. package/src/bridges/cctp/handlers/get-fees.ts +0 -26
  30. package/src/bridges/cctp/handlers/track-transfer.test.ts +0 -779
  31. package/src/bridges/cctp/handlers/track-transfer.ts +0 -365
  32. package/src/bridges/cctp/handlers/transfer-asset.test.ts +0 -429
  33. package/src/bridges/cctp/handlers/transfer-asset.ts +0 -179
  34. package/src/bridges/cctp/index.ts +0 -1
  35. package/src/bridges/cctp/types/chain.ts +0 -9
  36. package/src/bridges/cctp/types/config.ts +0 -20
  37. package/src/bridges/cctp/utils/build-tx.ts +0 -30
  38. package/src/bridges/cctp/utils/config.test.ts +0 -49
  39. package/src/bridges/cctp/utils/config.ts +0 -36
  40. package/src/bridges/cctp/utils/transfer-data.test.ts +0 -83
  41. package/src/bridges/cctp/utils/transfer-data.ts +0 -48
  42. package/src/errors/bridge-error.ts +0 -11
  43. package/src/errors/bridge-initialization-error.ts +0 -9
  44. package/src/errors/bridge-unavailable-error.ts +0 -9
  45. package/src/errors/index.ts +0 -4
  46. package/src/errors/invalid-params-error.ts +0 -9
  47. package/src/index.ts +0 -3
  48. package/src/types/asset.ts +0 -26
  49. package/src/types/bridge.ts +0 -64
  50. package/src/types/chain.ts +0 -10
  51. package/src/types/config.ts +0 -10
  52. package/src/types/environment.ts +0 -4
  53. package/src/types/error.ts +0 -19
  54. package/src/types/index.ts +0 -9
  55. package/src/types/provider.ts +0 -12
  56. package/src/types/signer.ts +0 -18
  57. package/src/types/transfer.ts +0 -35
  58. package/src/unified-bridge-service.test.ts +0 -209
  59. package/src/unified-bridge-service.ts +0 -97
  60. package/src/utils/bridge-types.test.ts +0 -103
  61. package/src/utils/bridge-types.ts +0 -32
  62. package/src/utils/caip2.test.ts +0 -44
  63. package/src/utils/caip2.ts +0 -41
  64. package/src/utils/client.test.ts +0 -97
  65. package/src/utils/client.ts +0 -44
  66. package/src/utils/ensure-config.test.ts +0 -43
  67. package/src/utils/ensure-config.ts +0 -12
  68. package/src/utils/index.ts +0 -2
  69. package/src/utils/network-fee.test.ts +0 -24
  70. package/src/utils/network-fee.ts +0 -6
  71. package/src/utils/retry-promise.test.ts +0 -115
  72. package/src/utils/retry-promise.ts +0 -72
  73. package/src/utils/wait.test.ts +0 -33
  74. package/src/utils/wait.ts +0 -4
  75. package/tsconfig.jest.json +0 -7
  76. package/tsconfig.json +0 -9
  77. package/tsup.config.ts +0 -4
@@ -1,318 +0,0 @@
1
- export const MESSAGE_TRANSMITTER_ABI = [
2
- {
3
- inputs: [
4
- { internalType: 'uint32', name: '_localDomain', type: 'uint32' },
5
- { internalType: 'address', name: '_attester', type: 'address' },
6
- { internalType: 'uint32', name: '_maxMessageBodySize', type: 'uint32' },
7
- { internalType: 'uint32', name: '_version', type: 'uint32' },
8
- ],
9
- stateMutability: 'nonpayable',
10
- type: 'constructor',
11
- },
12
- {
13
- anonymous: false,
14
- inputs: [{ indexed: true, internalType: 'address', name: 'attester', type: 'address' }],
15
- name: 'AttesterDisabled',
16
- type: 'event',
17
- },
18
- {
19
- anonymous: false,
20
- inputs: [{ indexed: true, internalType: 'address', name: 'attester', type: 'address' }],
21
- name: 'AttesterEnabled',
22
- type: 'event',
23
- },
24
- {
25
- anonymous: false,
26
- inputs: [
27
- { indexed: true, internalType: 'address', name: 'previousAttesterManager', type: 'address' },
28
- { indexed: true, internalType: 'address', name: 'newAttesterManager', type: 'address' },
29
- ],
30
- name: 'AttesterManagerUpdated',
31
- type: 'event',
32
- },
33
- {
34
- anonymous: false,
35
- inputs: [{ indexed: false, internalType: 'uint256', name: 'newMaxMessageBodySize', type: 'uint256' }],
36
- name: 'MaxMessageBodySizeUpdated',
37
- type: 'event',
38
- },
39
- {
40
- anonymous: false,
41
- inputs: [
42
- { indexed: true, internalType: 'address', name: 'caller', type: 'address' },
43
- { indexed: false, internalType: 'uint32', name: 'sourceDomain', type: 'uint32' },
44
- { indexed: true, internalType: 'uint64', name: 'nonce', type: 'uint64' },
45
- { indexed: false, internalType: 'bytes32', name: 'sender', type: 'bytes32' },
46
- { indexed: false, internalType: 'bytes', name: 'messageBody', type: 'bytes' },
47
- ],
48
- name: 'MessageReceived',
49
- type: 'event',
50
- },
51
- {
52
- anonymous: false,
53
- inputs: [{ indexed: false, internalType: 'bytes', name: 'message', type: 'bytes' }],
54
- name: 'MessageSent',
55
- type: 'event',
56
- },
57
- {
58
- anonymous: false,
59
- inputs: [
60
- { indexed: true, internalType: 'address', name: 'previousOwner', type: 'address' },
61
- { indexed: true, internalType: 'address', name: 'newOwner', type: 'address' },
62
- ],
63
- name: 'OwnershipTransferStarted',
64
- type: 'event',
65
- },
66
- {
67
- anonymous: false,
68
- inputs: [
69
- { indexed: true, internalType: 'address', name: 'previousOwner', type: 'address' },
70
- { indexed: true, internalType: 'address', name: 'newOwner', type: 'address' },
71
- ],
72
- name: 'OwnershipTransferred',
73
- type: 'event',
74
- },
75
- { anonymous: false, inputs: [], name: 'Pause', type: 'event' },
76
- {
77
- anonymous: false,
78
- inputs: [{ indexed: true, internalType: 'address', name: 'newAddress', type: 'address' }],
79
- name: 'PauserChanged',
80
- type: 'event',
81
- },
82
- {
83
- anonymous: false,
84
- inputs: [{ indexed: true, internalType: 'address', name: 'newRescuer', type: 'address' }],
85
- name: 'RescuerChanged',
86
- type: 'event',
87
- },
88
- {
89
- anonymous: false,
90
- inputs: [
91
- { indexed: false, internalType: 'uint256', name: 'oldSignatureThreshold', type: 'uint256' },
92
- { indexed: false, internalType: 'uint256', name: 'newSignatureThreshold', type: 'uint256' },
93
- ],
94
- name: 'SignatureThresholdUpdated',
95
- type: 'event',
96
- },
97
- { anonymous: false, inputs: [], name: 'Unpause', type: 'event' },
98
- { inputs: [], name: 'acceptOwnership', outputs: [], stateMutability: 'nonpayable', type: 'function' },
99
- {
100
- inputs: [],
101
- name: 'attesterManager',
102
- outputs: [{ internalType: 'address', name: '', type: 'address' }],
103
- stateMutability: 'view',
104
- type: 'function',
105
- },
106
- {
107
- inputs: [{ internalType: 'address', name: 'attester', type: 'address' }],
108
- name: 'disableAttester',
109
- outputs: [],
110
- stateMutability: 'nonpayable',
111
- type: 'function',
112
- },
113
- {
114
- inputs: [{ internalType: 'address', name: 'newAttester', type: 'address' }],
115
- name: 'enableAttester',
116
- outputs: [],
117
- stateMutability: 'nonpayable',
118
- type: 'function',
119
- },
120
- {
121
- inputs: [{ internalType: 'uint256', name: 'index', type: 'uint256' }],
122
- name: 'getEnabledAttester',
123
- outputs: [{ internalType: 'address', name: '', type: 'address' }],
124
- stateMutability: 'view',
125
- type: 'function',
126
- },
127
- {
128
- inputs: [],
129
- name: 'getNumEnabledAttesters',
130
- outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
131
- stateMutability: 'view',
132
- type: 'function',
133
- },
134
- {
135
- inputs: [{ internalType: 'address', name: 'attester', type: 'address' }],
136
- name: 'isEnabledAttester',
137
- outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
138
- stateMutability: 'view',
139
- type: 'function',
140
- },
141
- {
142
- inputs: [],
143
- name: 'localDomain',
144
- outputs: [{ internalType: 'uint32', name: '', type: 'uint32' }],
145
- stateMutability: 'view',
146
- type: 'function',
147
- },
148
- {
149
- inputs: [],
150
- name: 'maxMessageBodySize',
151
- outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
152
- stateMutability: 'view',
153
- type: 'function',
154
- },
155
- {
156
- inputs: [],
157
- name: 'nextAvailableNonce',
158
- outputs: [{ internalType: 'uint64', name: '', type: 'uint64' }],
159
- stateMutability: 'view',
160
- type: 'function',
161
- },
162
- {
163
- inputs: [],
164
- name: 'owner',
165
- outputs: [{ internalType: 'address', name: '', type: 'address' }],
166
- stateMutability: 'view',
167
- type: 'function',
168
- },
169
- { inputs: [], name: 'pause', outputs: [], stateMutability: 'nonpayable', type: 'function' },
170
- {
171
- inputs: [],
172
- name: 'paused',
173
- outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
174
- stateMutability: 'view',
175
- type: 'function',
176
- },
177
- {
178
- inputs: [],
179
- name: 'pauser',
180
- outputs: [{ internalType: 'address', name: '', type: 'address' }],
181
- stateMutability: 'view',
182
- type: 'function',
183
- },
184
- {
185
- inputs: [],
186
- name: 'pendingOwner',
187
- outputs: [{ internalType: 'address', name: '', type: 'address' }],
188
- stateMutability: 'view',
189
- type: 'function',
190
- },
191
- {
192
- inputs: [
193
- { internalType: 'bytes', name: 'message', type: 'bytes' },
194
- { internalType: 'bytes', name: 'attestation', type: 'bytes' },
195
- ],
196
- name: 'receiveMessage',
197
- outputs: [{ internalType: 'bool', name: 'success', type: 'bool' }],
198
- stateMutability: 'nonpayable',
199
- type: 'function',
200
- },
201
- {
202
- inputs: [
203
- { internalType: 'bytes', name: 'originalMessage', type: 'bytes' },
204
- { internalType: 'bytes', name: 'originalAttestation', type: 'bytes' },
205
- { internalType: 'bytes', name: 'newMessageBody', type: 'bytes' },
206
- { internalType: 'bytes32', name: 'newDestinationCaller', type: 'bytes32' },
207
- ],
208
- name: 'replaceMessage',
209
- outputs: [],
210
- stateMutability: 'nonpayable',
211
- type: 'function',
212
- },
213
- {
214
- inputs: [
215
- { internalType: 'contract IERC20', name: 'tokenContract', type: 'address' },
216
- { internalType: 'address', name: 'to', type: 'address' },
217
- { internalType: 'uint256', name: 'amount', type: 'uint256' },
218
- ],
219
- name: 'rescueERC20',
220
- outputs: [],
221
- stateMutability: 'nonpayable',
222
- type: 'function',
223
- },
224
- {
225
- inputs: [],
226
- name: 'rescuer',
227
- outputs: [{ internalType: 'address', name: '', type: 'address' }],
228
- stateMutability: 'view',
229
- type: 'function',
230
- },
231
- {
232
- inputs: [
233
- { internalType: 'uint32', name: 'destinationDomain', type: 'uint32' },
234
- { internalType: 'bytes32', name: 'recipient', type: 'bytes32' },
235
- { internalType: 'bytes', name: 'messageBody', type: 'bytes' },
236
- ],
237
- name: 'sendMessage',
238
- outputs: [{ internalType: 'uint64', name: '', type: 'uint64' }],
239
- stateMutability: 'nonpayable',
240
- type: 'function',
241
- },
242
- {
243
- inputs: [
244
- { internalType: 'uint32', name: 'destinationDomain', type: 'uint32' },
245
- { internalType: 'bytes32', name: 'recipient', type: 'bytes32' },
246
- { internalType: 'bytes32', name: 'destinationCaller', type: 'bytes32' },
247
- { internalType: 'bytes', name: 'messageBody', type: 'bytes' },
248
- ],
249
- name: 'sendMessageWithCaller',
250
- outputs: [{ internalType: 'uint64', name: '', type: 'uint64' }],
251
- stateMutability: 'nonpayable',
252
- type: 'function',
253
- },
254
- {
255
- inputs: [{ internalType: 'uint256', name: 'newMaxMessageBodySize', type: 'uint256' }],
256
- name: 'setMaxMessageBodySize',
257
- outputs: [],
258
- stateMutability: 'nonpayable',
259
- type: 'function',
260
- },
261
- {
262
- inputs: [{ internalType: 'uint256', name: 'newSignatureThreshold', type: 'uint256' }],
263
- name: 'setSignatureThreshold',
264
- outputs: [],
265
- stateMutability: 'nonpayable',
266
- type: 'function',
267
- },
268
- {
269
- inputs: [],
270
- name: 'signatureThreshold',
271
- outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
272
- stateMutability: 'view',
273
- type: 'function',
274
- },
275
- {
276
- inputs: [{ internalType: 'address', name: 'newOwner', type: 'address' }],
277
- name: 'transferOwnership',
278
- outputs: [],
279
- stateMutability: 'nonpayable',
280
- type: 'function',
281
- },
282
- { inputs: [], name: 'unpause', outputs: [], stateMutability: 'nonpayable', type: 'function' },
283
- {
284
- inputs: [{ internalType: 'address', name: 'newAttesterManager', type: 'address' }],
285
- name: 'updateAttesterManager',
286
- outputs: [],
287
- stateMutability: 'nonpayable',
288
- type: 'function',
289
- },
290
- {
291
- inputs: [{ internalType: 'address', name: '_newPauser', type: 'address' }],
292
- name: 'updatePauser',
293
- outputs: [],
294
- stateMutability: 'nonpayable',
295
- type: 'function',
296
- },
297
- {
298
- inputs: [{ internalType: 'address', name: 'newRescuer', type: 'address' }],
299
- name: 'updateRescuer',
300
- outputs: [],
301
- stateMutability: 'nonpayable',
302
- type: 'function',
303
- },
304
- {
305
- inputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }],
306
- name: 'usedNonces',
307
- outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
308
- stateMutability: 'view',
309
- type: 'function',
310
- },
311
- {
312
- inputs: [],
313
- name: 'version',
314
- outputs: [{ internalType: 'uint32', name: '', type: 'uint32' }],
315
- stateMutability: 'view',
316
- type: 'function',
317
- },
318
- ] as const;