@across-protocol/sdk 4.3.143-alpha.3 → 4.3.143
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/dist/cjs/src/caching/Arweave/ArweaveClient.d.ts +6 -11
- package/dist/cjs/src/caching/Arweave/ArweaveClient.js +74 -98
- package/dist/cjs/src/caching/Arweave/ArweaveClient.js.map +1 -1
- package/dist/cjs/src/clients/BundleDataClient/utils/SuperstructUtils.d.ts +64 -63
- package/dist/cjs/src/clients/BundleDataClient/utils/SuperstructUtils.js +31 -13
- package/dist/cjs/src/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/esm/src/caching/Arweave/ArweaveClient.d.ts +8 -21
- package/dist/esm/src/caching/Arweave/ArweaveClient.js +80 -113
- package/dist/esm/src/caching/Arweave/ArweaveClient.js.map +1 -1
- package/dist/esm/src/clients/BundleDataClient/utils/SuperstructUtils.d.ts +64 -63
- package/dist/esm/src/clients/BundleDataClient/utils/SuperstructUtils.js +29 -11
- package/dist/esm/src/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/types/src/caching/Arweave/ArweaveClient.d.ts +8 -21
- package/dist/types/src/caching/Arweave/ArweaveClient.d.ts.map +1 -1
- package/dist/types/src/clients/BundleDataClient/utils/SuperstructUtils.d.ts +64 -63
- package/dist/types/src/clients/BundleDataClient/utils/SuperstructUtils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/caching/Arweave/ArweaveClient.ts +76 -126
- package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +26 -12
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Infer } from "superstruct";
|
|
2
|
-
import { BigNumber, EvmAddress, RawAddress, SvmAddress } from "../../../utils";
|
|
2
|
+
import { BigNumber, EvmAddress, RawAddress, SvmAddress, TvmAddress } from "../../../utils";
|
|
3
|
+
export declare const AddressType: import("superstruct").Struct<SvmAddress | EvmAddress | TvmAddress | RawAddress, null>;
|
|
3
4
|
export declare const SortableEventSS: {
|
|
4
5
|
blockNumber: import("superstruct").Struct<number, null>;
|
|
5
6
|
logIndex: import("superstruct").Struct<number, null>;
|
|
@@ -13,13 +14,13 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
13
14
|
message: string;
|
|
14
15
|
destinationChainId: number;
|
|
15
16
|
originChainId: number;
|
|
16
|
-
depositor: SvmAddress | EvmAddress | RawAddress;
|
|
17
|
-
recipient: SvmAddress | EvmAddress | RawAddress;
|
|
18
|
-
inputToken: SvmAddress | EvmAddress | RawAddress;
|
|
19
|
-
outputToken: SvmAddress | EvmAddress | RawAddress;
|
|
17
|
+
depositor: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
18
|
+
recipient: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
19
|
+
inputToken: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
20
|
+
outputToken: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
20
21
|
inputAmount: BigNumber;
|
|
21
22
|
outputAmount: BigNumber;
|
|
22
|
-
exclusiveRelayer: SvmAddress | EvmAddress | RawAddress;
|
|
23
|
+
exclusiveRelayer: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
23
24
|
quoteTimestamp: number;
|
|
24
25
|
fillDeadline: number;
|
|
25
26
|
depositId: BigNumber;
|
|
@@ -31,7 +32,7 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
31
32
|
blockNumber: number;
|
|
32
33
|
logIndex: number;
|
|
33
34
|
updatedOutputAmount?: BigNumber | undefined;
|
|
34
|
-
updatedRecipient?: SvmAddress | EvmAddress | RawAddress | undefined;
|
|
35
|
+
updatedRecipient?: SvmAddress | EvmAddress | TvmAddress | RawAddress | undefined;
|
|
35
36
|
updatedMessage?: string | undefined;
|
|
36
37
|
speedUpSignature?: string | undefined;
|
|
37
38
|
txnIndex?: number | undefined;
|
|
@@ -44,23 +45,23 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
44
45
|
fills: {
|
|
45
46
|
destinationChainId: number;
|
|
46
47
|
originChainId: number;
|
|
47
|
-
depositor: SvmAddress | EvmAddress | RawAddress;
|
|
48
|
-
recipient: SvmAddress | EvmAddress | RawAddress;
|
|
49
|
-
inputToken: SvmAddress | EvmAddress | RawAddress;
|
|
50
|
-
outputToken: SvmAddress | EvmAddress | RawAddress;
|
|
48
|
+
depositor: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
49
|
+
recipient: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
50
|
+
inputToken: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
51
|
+
outputToken: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
51
52
|
inputAmount: BigNumber;
|
|
52
53
|
outputAmount: BigNumber;
|
|
53
|
-
exclusiveRelayer: SvmAddress | EvmAddress | RawAddress;
|
|
54
|
+
exclusiveRelayer: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
54
55
|
quoteTimestamp: number;
|
|
55
56
|
fillDeadline: number;
|
|
56
57
|
depositId: BigNumber;
|
|
57
58
|
exclusivityDeadline: number;
|
|
58
59
|
repaymentChainId: number;
|
|
59
|
-
relayer: SvmAddress | EvmAddress | RawAddress;
|
|
60
|
+
relayer: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
60
61
|
messageHash: string;
|
|
61
62
|
relayExecutionInfo: {
|
|
62
63
|
updatedOutputAmount: BigNumber;
|
|
63
|
-
updatedRecipient: SvmAddress | EvmAddress | RawAddress;
|
|
64
|
+
updatedRecipient: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
64
65
|
updatedMessageHash: string;
|
|
65
66
|
fillType: number;
|
|
66
67
|
updatedMessage?: string | undefined;
|
|
@@ -82,13 +83,13 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
82
83
|
message: string;
|
|
83
84
|
destinationChainId: number;
|
|
84
85
|
originChainId: number;
|
|
85
|
-
depositor: SvmAddress | EvmAddress | RawAddress;
|
|
86
|
-
recipient: SvmAddress | EvmAddress | RawAddress;
|
|
87
|
-
inputToken: SvmAddress | EvmAddress | RawAddress;
|
|
88
|
-
outputToken: SvmAddress | EvmAddress | RawAddress;
|
|
86
|
+
depositor: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
87
|
+
recipient: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
88
|
+
inputToken: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
89
|
+
outputToken: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
89
90
|
inputAmount: BigNumber;
|
|
90
91
|
outputAmount: BigNumber;
|
|
91
|
-
exclusiveRelayer: SvmAddress | EvmAddress | RawAddress;
|
|
92
|
+
exclusiveRelayer: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
92
93
|
quoteTimestamp: number;
|
|
93
94
|
fillDeadline: number;
|
|
94
95
|
depositId: BigNumber;
|
|
@@ -101,7 +102,7 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
101
102
|
logIndex: number;
|
|
102
103
|
lpFeePct: BigNumber;
|
|
103
104
|
updatedOutputAmount?: BigNumber | undefined;
|
|
104
|
-
updatedRecipient?: SvmAddress | EvmAddress | RawAddress | undefined;
|
|
105
|
+
updatedRecipient?: SvmAddress | EvmAddress | TvmAddress | RawAddress | undefined;
|
|
105
106
|
updatedMessage?: string | undefined;
|
|
106
107
|
speedUpSignature?: string | undefined;
|
|
107
108
|
txnIndex?: number | undefined;
|
|
@@ -114,13 +115,13 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
114
115
|
message: string;
|
|
115
116
|
destinationChainId: number;
|
|
116
117
|
originChainId: number;
|
|
117
|
-
depositor: SvmAddress | EvmAddress | RawAddress;
|
|
118
|
-
recipient: SvmAddress | EvmAddress | RawAddress;
|
|
119
|
-
inputToken: SvmAddress | EvmAddress | RawAddress;
|
|
120
|
-
outputToken: SvmAddress | EvmAddress | RawAddress;
|
|
118
|
+
depositor: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
119
|
+
recipient: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
120
|
+
inputToken: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
121
|
+
outputToken: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
121
122
|
inputAmount: BigNumber;
|
|
122
123
|
outputAmount: BigNumber;
|
|
123
|
-
exclusiveRelayer: SvmAddress | EvmAddress | RawAddress;
|
|
124
|
+
exclusiveRelayer: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
124
125
|
quoteTimestamp: number;
|
|
125
126
|
fillDeadline: number;
|
|
126
127
|
depositId: BigNumber;
|
|
@@ -132,7 +133,7 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
132
133
|
blockNumber: number;
|
|
133
134
|
logIndex: number;
|
|
134
135
|
updatedOutputAmount?: BigNumber | undefined;
|
|
135
|
-
updatedRecipient?: SvmAddress | EvmAddress | RawAddress | undefined;
|
|
136
|
+
updatedRecipient?: SvmAddress | EvmAddress | TvmAddress | RawAddress | undefined;
|
|
136
137
|
updatedMessage?: string | undefined;
|
|
137
138
|
speedUpSignature?: string | undefined;
|
|
138
139
|
txnIndex?: number | undefined;
|
|
@@ -145,13 +146,13 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
145
146
|
message: string;
|
|
146
147
|
destinationChainId: number;
|
|
147
148
|
originChainId: number;
|
|
148
|
-
depositor: SvmAddress | EvmAddress | RawAddress;
|
|
149
|
-
recipient: SvmAddress | EvmAddress | RawAddress;
|
|
150
|
-
inputToken: SvmAddress | EvmAddress | RawAddress;
|
|
151
|
-
outputToken: SvmAddress | EvmAddress | RawAddress;
|
|
149
|
+
depositor: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
150
|
+
recipient: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
151
|
+
inputToken: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
152
|
+
outputToken: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
152
153
|
inputAmount: BigNumber;
|
|
153
154
|
outputAmount: BigNumber;
|
|
154
|
-
exclusiveRelayer: SvmAddress | EvmAddress | RawAddress;
|
|
155
|
+
exclusiveRelayer: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
155
156
|
quoteTimestamp: number;
|
|
156
157
|
fillDeadline: number;
|
|
157
158
|
depositId: BigNumber;
|
|
@@ -164,7 +165,7 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
164
165
|
logIndex: number;
|
|
165
166
|
lpFeePct: BigNumber;
|
|
166
167
|
updatedOutputAmount?: BigNumber | undefined;
|
|
167
|
-
updatedRecipient?: SvmAddress | EvmAddress | RawAddress | undefined;
|
|
168
|
+
updatedRecipient?: SvmAddress | EvmAddress | TvmAddress | RawAddress | undefined;
|
|
168
169
|
updatedMessage?: string | undefined;
|
|
169
170
|
speedUpSignature?: string | undefined;
|
|
170
171
|
txnIndex?: number | undefined;
|
|
@@ -178,13 +179,13 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
178
179
|
message: string;
|
|
179
180
|
destinationChainId: number;
|
|
180
181
|
originChainId: number;
|
|
181
|
-
depositor: SvmAddress | EvmAddress | RawAddress;
|
|
182
|
-
recipient: SvmAddress | EvmAddress | RawAddress;
|
|
183
|
-
inputToken: SvmAddress | EvmAddress | RawAddress;
|
|
184
|
-
outputToken: SvmAddress | EvmAddress | RawAddress;
|
|
182
|
+
depositor: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
183
|
+
recipient: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
184
|
+
inputToken: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
185
|
+
outputToken: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
185
186
|
inputAmount: BigNumber;
|
|
186
187
|
outputAmount: BigNumber;
|
|
187
|
-
exclusiveRelayer: SvmAddress | EvmAddress | RawAddress;
|
|
188
|
+
exclusiveRelayer: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
188
189
|
quoteTimestamp: number;
|
|
189
190
|
fillDeadline: number;
|
|
190
191
|
depositId: BigNumber;
|
|
@@ -196,7 +197,7 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
196
197
|
blockNumber: number;
|
|
197
198
|
logIndex: number;
|
|
198
199
|
updatedOutputAmount?: BigNumber | undefined;
|
|
199
|
-
updatedRecipient?: SvmAddress | EvmAddress | RawAddress | undefined;
|
|
200
|
+
updatedRecipient?: SvmAddress | EvmAddress | TvmAddress | RawAddress | undefined;
|
|
200
201
|
updatedMessage?: string | undefined;
|
|
201
202
|
speedUpSignature?: string | undefined;
|
|
202
203
|
txnIndex?: number | undefined;
|
|
@@ -209,13 +210,13 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
209
210
|
message: string;
|
|
210
211
|
destinationChainId: number;
|
|
211
212
|
originChainId: number;
|
|
212
|
-
depositor: SvmAddress | EvmAddress | RawAddress;
|
|
213
|
-
recipient: SvmAddress | EvmAddress | RawAddress;
|
|
214
|
-
inputToken: SvmAddress | EvmAddress | RawAddress;
|
|
215
|
-
outputToken: SvmAddress | EvmAddress | RawAddress;
|
|
213
|
+
depositor: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
214
|
+
recipient: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
215
|
+
inputToken: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
216
|
+
outputToken: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
216
217
|
inputAmount: BigNumber;
|
|
217
218
|
outputAmount: BigNumber;
|
|
218
|
-
exclusiveRelayer: SvmAddress | EvmAddress | RawAddress;
|
|
219
|
+
exclusiveRelayer: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
219
220
|
quoteTimestamp: number;
|
|
220
221
|
fillDeadline: number;
|
|
221
222
|
depositId: BigNumber;
|
|
@@ -227,7 +228,7 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
227
228
|
blockNumber: number;
|
|
228
229
|
logIndex: number;
|
|
229
230
|
updatedOutputAmount?: BigNumber | undefined;
|
|
230
|
-
updatedRecipient?: SvmAddress | EvmAddress | RawAddress | undefined;
|
|
231
|
+
updatedRecipient?: SvmAddress | EvmAddress | TvmAddress | RawAddress | undefined;
|
|
231
232
|
updatedMessage?: string | undefined;
|
|
232
233
|
speedUpSignature?: string | undefined;
|
|
233
234
|
txnIndex?: number | undefined;
|
|
@@ -240,13 +241,13 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
240
241
|
message: string;
|
|
241
242
|
destinationChainId: number;
|
|
242
243
|
originChainId: number;
|
|
243
|
-
depositor: SvmAddress | EvmAddress | RawAddress;
|
|
244
|
-
recipient: SvmAddress | EvmAddress | RawAddress;
|
|
245
|
-
inputToken: SvmAddress | EvmAddress | RawAddress;
|
|
246
|
-
outputToken: SvmAddress | EvmAddress | RawAddress;
|
|
244
|
+
depositor: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
245
|
+
recipient: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
246
|
+
inputToken: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
247
|
+
outputToken: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
247
248
|
inputAmount: BigNumber;
|
|
248
249
|
outputAmount: BigNumber;
|
|
249
|
-
exclusiveRelayer: SvmAddress | EvmAddress | RawAddress;
|
|
250
|
+
exclusiveRelayer: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
250
251
|
quoteTimestamp: number;
|
|
251
252
|
fillDeadline: number;
|
|
252
253
|
depositId: BigNumber;
|
|
@@ -259,7 +260,7 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
259
260
|
logIndex: number;
|
|
260
261
|
lpFeePct: BigNumber;
|
|
261
262
|
updatedOutputAmount?: BigNumber | undefined;
|
|
262
|
-
updatedRecipient?: SvmAddress | EvmAddress | RawAddress | undefined;
|
|
263
|
+
updatedRecipient?: SvmAddress | EvmAddress | TvmAddress | RawAddress | undefined;
|
|
263
264
|
updatedMessage?: string | undefined;
|
|
264
265
|
speedUpSignature?: string | undefined;
|
|
265
266
|
txnIndex?: number | undefined;
|
|
@@ -272,13 +273,13 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
272
273
|
message: string;
|
|
273
274
|
destinationChainId: number;
|
|
274
275
|
originChainId: number;
|
|
275
|
-
depositor: SvmAddress | EvmAddress | RawAddress;
|
|
276
|
-
recipient: SvmAddress | EvmAddress | RawAddress;
|
|
277
|
-
inputToken: SvmAddress | EvmAddress | RawAddress;
|
|
278
|
-
outputToken: SvmAddress | EvmAddress | RawAddress;
|
|
276
|
+
depositor: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
277
|
+
recipient: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
278
|
+
inputToken: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
279
|
+
outputToken: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
279
280
|
inputAmount: BigNumber;
|
|
280
281
|
outputAmount: BigNumber;
|
|
281
|
-
exclusiveRelayer: SvmAddress | EvmAddress | RawAddress;
|
|
282
|
+
exclusiveRelayer: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
282
283
|
quoteTimestamp: number;
|
|
283
284
|
fillDeadline: number;
|
|
284
285
|
depositId: BigNumber;
|
|
@@ -291,7 +292,7 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
291
292
|
logIndex: number;
|
|
292
293
|
lpFeePct: BigNumber;
|
|
293
294
|
updatedOutputAmount?: BigNumber | undefined;
|
|
294
|
-
updatedRecipient?: SvmAddress | EvmAddress | RawAddress | undefined;
|
|
295
|
+
updatedRecipient?: SvmAddress | EvmAddress | TvmAddress | RawAddress | undefined;
|
|
295
296
|
updatedMessage?: string | undefined;
|
|
296
297
|
speedUpSignature?: string | undefined;
|
|
297
298
|
txnIndex?: number | undefined;
|
|
@@ -304,23 +305,23 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
304
305
|
fills: {
|
|
305
306
|
destinationChainId: number;
|
|
306
307
|
originChainId: number;
|
|
307
|
-
depositor: SvmAddress | EvmAddress | RawAddress;
|
|
308
|
-
recipient: SvmAddress | EvmAddress | RawAddress;
|
|
309
|
-
inputToken: SvmAddress | EvmAddress | RawAddress;
|
|
310
|
-
outputToken: SvmAddress | EvmAddress | RawAddress;
|
|
308
|
+
depositor: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
309
|
+
recipient: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
310
|
+
inputToken: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
311
|
+
outputToken: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
311
312
|
inputAmount: BigNumber;
|
|
312
313
|
outputAmount: BigNumber;
|
|
313
|
-
exclusiveRelayer: SvmAddress | EvmAddress | RawAddress;
|
|
314
|
+
exclusiveRelayer: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
314
315
|
quoteTimestamp: number;
|
|
315
316
|
fillDeadline: number;
|
|
316
317
|
depositId: BigNumber;
|
|
317
318
|
exclusivityDeadline: number;
|
|
318
319
|
repaymentChainId: number;
|
|
319
|
-
relayer: SvmAddress | EvmAddress | RawAddress;
|
|
320
|
+
relayer: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
320
321
|
messageHash: string;
|
|
321
322
|
relayExecutionInfo: {
|
|
322
323
|
updatedOutputAmount: BigNumber;
|
|
323
|
-
updatedRecipient: SvmAddress | EvmAddress | RawAddress;
|
|
324
|
+
updatedRecipient: SvmAddress | EvmAddress | TvmAddress | RawAddress;
|
|
324
325
|
updatedMessageHash: string;
|
|
325
326
|
fillType: number;
|
|
326
327
|
updatedMessage?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuperstructUtils.d.ts","sourceRoot":"","sources":["../../../../../../src/clients/BundleDataClient/utils/SuperstructUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAcN,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"SuperstructUtils.d.ts","sourceRoot":"","sources":["../../../../../../src/clients/BundleDataClient/utils/SuperstructUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAcN,MAAM,aAAa,CAAC;AAMrB,OAAO,EAAE,SAAS,EAAQ,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAa,MAAM,gBAAgB,CAAC;AAuB5G,eAAO,MAAM,WAAW,uFAatB,CAAC;AAuBH,eAAO,MAAM,eAAe;;;;;;;CAS3B,CAAC;AA6EF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMvB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@across-protocol/sdk",
|
|
3
3
|
"author": "UMA Team",
|
|
4
|
-
"version": "4.3.143
|
|
4
|
+
"version": "4.3.143",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"homepage": "https://docs.across.to/reference/sdk",
|
|
7
7
|
"repository": {
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"@across-protocol/constants": "^3.1.109",
|
|
84
|
-
"@across-protocol/contracts": "5.0.
|
|
84
|
+
"@across-protocol/contracts": "5.0.7",
|
|
85
85
|
"@coral-xyz/anchor": "^0.30.1",
|
|
86
86
|
"@eth-optimism/sdk": "^3.3.1",
|
|
87
87
|
"@ethersproject/bignumber": "^5.7.0",
|
|
@@ -6,104 +6,37 @@ import winston from "winston";
|
|
|
6
6
|
import { ARWEAVE_TAG_APP_NAME, ARWEAVE_TAG_APP_VERSION, DEFAULT_ARWEAVE_STORAGE_ADDRESS } from "../../constants";
|
|
7
7
|
import { BigNumber, delay, fetchWithTimeout, isDefined, jsonReplacerWithBigNumbers, toBN } from "../../utils";
|
|
8
8
|
|
|
9
|
-
export interface ArweaveGatewayConfig {
|
|
10
|
-
host: string;
|
|
11
|
-
protocol?: string;
|
|
12
|
-
port?: number;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const DEFAULT_ARWEAVE_GATEWAYS: ArweaveGatewayConfig[] = [{ host: "arweave.net" }, { host: "ar-io.net" }];
|
|
16
|
-
|
|
17
|
-
interface Gateway {
|
|
18
|
-
client: Arweave;
|
|
19
|
-
url: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
9
|
export class ArweaveClient {
|
|
23
|
-
private
|
|
10
|
+
private client: Arweave;
|
|
11
|
+
private gatewayUrl: string;
|
|
24
12
|
|
|
25
13
|
public constructor(
|
|
26
14
|
private arweaveJWT: JWKInterface,
|
|
27
15
|
private logger: winston.Logger,
|
|
28
|
-
|
|
16
|
+
public gatewayURL = "arweave.net",
|
|
17
|
+
public protocol = "https",
|
|
18
|
+
port = 443,
|
|
29
19
|
private readonly retries = 2,
|
|
30
20
|
private readonly retryDelaySeconds = 1
|
|
31
21
|
) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
this.gateways = gateways.map(({ host, protocol = "https", port = 443 }) => ({
|
|
42
|
-
client: new Arweave({ host, port, protocol, timeout: 20000, logging: false }),
|
|
43
|
-
url: `${protocol}://${host}:${port}`,
|
|
44
|
-
}));
|
|
22
|
+
this.gatewayUrl = `${protocol}://${gatewayURL}:${port}`;
|
|
23
|
+
this.client = new Arweave({
|
|
24
|
+
host: gatewayURL,
|
|
25
|
+
port,
|
|
26
|
+
protocol,
|
|
27
|
+
timeout: 20000,
|
|
28
|
+
logging: false,
|
|
29
|
+
});
|
|
45
30
|
this.logger.debug({
|
|
46
31
|
at: "ArweaveClient:constructor",
|
|
47
32
|
message: "Arweave client initialized",
|
|
48
|
-
|
|
33
|
+
gateway: this.gatewayUrl,
|
|
49
34
|
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Races a request across all gateways, returning the first successful response.
|
|
54
|
-
* If all gateways fail, throws an error with details from each gateway.
|
|
55
|
-
*/
|
|
56
|
-
private async _raceGateways<T>(label: string, fn: (gw: Gateway) => Promise<T>): Promise<T> {
|
|
57
|
-
try {
|
|
58
|
-
return await Promise.any(this.gateways.map((gw) => this._retryRequest(() => fn(gw), 0)));
|
|
59
|
-
} catch (e) {
|
|
60
|
-
if (e instanceof AggregateError) {
|
|
61
|
-
const details = this.gateways.map((gw, i) => `${gw.url}: ${e.errors[i]}`).join("; ");
|
|
62
|
-
throw new Error(`All Arweave gateways failed for ${label}: ${details}`);
|
|
63
|
-
}
|
|
64
|
-
throw e;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Tries gateways sequentially, returning the first successful response.
|
|
70
|
-
* Used for write operations where we want exactly one successful submission.
|
|
71
|
-
*/
|
|
72
|
-
private async _failoverGateways<T>(label: string, fn: (gw: Gateway) => Promise<T>): Promise<T> {
|
|
73
|
-
const errors: Error[] = [];
|
|
74
|
-
for (const gw of this.gateways) {
|
|
75
|
-
try {
|
|
76
|
-
return await this._retryRequest(() => fn(gw), 0);
|
|
77
|
-
} catch (e) {
|
|
78
|
-
errors.push(e as Error);
|
|
79
|
-
this.logger.debug({
|
|
80
|
-
at: "ArweaveClient:failoverGateways",
|
|
81
|
-
message: `Gateway ${gw.url} failed for ${label}, trying next: ${e}`,
|
|
82
|
-
});
|
|
83
|
-
}
|
|
35
|
+
if (this.retries < 0) {
|
|
36
|
+
throw new Error(`retries cannot be < 0 and must be an integer. Currently set to ${this.retries}`);
|
|
84
37
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
private async _retryRequest<T>(request: () => Promise<T>, retryCount: number): Promise<T> {
|
|
90
|
-
try {
|
|
91
|
-
return await request();
|
|
92
|
-
} catch (e) {
|
|
93
|
-
if (retryCount < this.retries) {
|
|
94
|
-
// Implement a slightly aggressive exponential backoff to account for fierce parallelism.
|
|
95
|
-
const baseDelay = this.retryDelaySeconds * Math.pow(2, retryCount);
|
|
96
|
-
const delayS = baseDelay + baseDelay * Math.random();
|
|
97
|
-
this.logger.debug({
|
|
98
|
-
at: "ArweaveClient:retryRequest",
|
|
99
|
-
message: `Arweave request failed, retrying after waiting ${delayS} seconds: ${e}`,
|
|
100
|
-
retryCount,
|
|
101
|
-
});
|
|
102
|
-
await delay(delayS);
|
|
103
|
-
return this._retryRequest(request, retryCount + 1);
|
|
104
|
-
} else {
|
|
105
|
-
throw e;
|
|
106
|
-
}
|
|
38
|
+
if (this.retryDelaySeconds < 0) {
|
|
39
|
+
throw new Error(`delay cannot be < 0. Currently set to ${this.retryDelaySeconds}`);
|
|
107
40
|
}
|
|
108
41
|
}
|
|
109
42
|
|
|
@@ -114,12 +47,10 @@ export class ArweaveClient {
|
|
|
114
47
|
* @param value The value to store
|
|
115
48
|
* @param topicTag An optional topic tag to add to the transaction
|
|
116
49
|
* @returns The transaction ID of the stored value
|
|
50
|
+
* @
|
|
117
51
|
*/
|
|
118
52
|
async set(value: Record<string, unknown>, topicTag?: string | undefined): Promise<string | undefined> {
|
|
119
|
-
|
|
120
|
-
// it does not matter which gateway is used, so we just choose the first one.
|
|
121
|
-
const templateClient = this.gateways[0].client;
|
|
122
|
-
const transaction = await templateClient.createTransaction(
|
|
53
|
+
const transaction = await this.client.createTransaction(
|
|
123
54
|
{ data: JSON.stringify(value, jsonReplacerWithBigNumbers) },
|
|
124
55
|
this.arweaveJWT
|
|
125
56
|
);
|
|
@@ -133,32 +64,29 @@ export class ArweaveClient {
|
|
|
133
64
|
}
|
|
134
65
|
|
|
135
66
|
// Sign the transaction
|
|
136
|
-
await
|
|
67
|
+
await this.client.transactions.sign(transaction, this.arweaveJWT);
|
|
137
68
|
// Send the transaction
|
|
69
|
+
const result = await this.client.transactions.post(transaction);
|
|
138
70
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
});
|
|
153
|
-
throw new Error(message);
|
|
154
|
-
}
|
|
155
|
-
|
|
71
|
+
// Ensure that the result is successful
|
|
72
|
+
if (result.status !== 200) {
|
|
73
|
+
const message = result?.data?.error?.msg ?? "Unknown error";
|
|
74
|
+
this.logger.error({
|
|
75
|
+
at: "ArweaveClient:set",
|
|
76
|
+
message,
|
|
77
|
+
result,
|
|
78
|
+
txn: transaction.id,
|
|
79
|
+
address: await this.getAddress(),
|
|
80
|
+
balance: (await this.getBalance()).toString(),
|
|
81
|
+
});
|
|
82
|
+
throw new Error(message);
|
|
83
|
+
} else {
|
|
156
84
|
this.logger.debug({
|
|
157
85
|
at: "ArweaveClient:set",
|
|
158
86
|
message: `Arweave transaction posted with ${transaction.id}`,
|
|
159
87
|
});
|
|
160
|
-
|
|
161
|
-
|
|
88
|
+
}
|
|
89
|
+
return transaction.id;
|
|
162
90
|
}
|
|
163
91
|
|
|
164
92
|
/**
|
|
@@ -169,12 +97,15 @@ export class ArweaveClient {
|
|
|
169
97
|
* @returns The record if it exists, otherwise null
|
|
170
98
|
*/
|
|
171
99
|
async get<T>(transactionID: string, validator: Struct<T>): Promise<T | null> {
|
|
172
|
-
//
|
|
100
|
+
// Resolve the URL of the transaction
|
|
101
|
+
const transactionUrl = `${this.gatewayUrl}/${transactionID}`;
|
|
102
|
+
// We should query in via Axios directly to the gateway URL. The reasoning behind this is
|
|
173
103
|
// that the Arweave SDK's `getData` method is too slow and does not provide a way to set a timeout.
|
|
174
104
|
// Therefore, something that could take milliseconds to complete could take tens of minutes.
|
|
175
|
-
const
|
|
176
|
-
return await fetchWithTimeout(
|
|
177
|
-
}
|
|
105
|
+
const request = async () => {
|
|
106
|
+
return await fetchWithTimeout(transactionUrl, {}, {}, 20_000);
|
|
107
|
+
};
|
|
108
|
+
const data = await this._retryRequest(request, 0);
|
|
178
109
|
try {
|
|
179
110
|
// We should validate the data and perform any logical coercion here.
|
|
180
111
|
return create(data, validator);
|
|
@@ -218,15 +149,15 @@ export class ArweaveClient {
|
|
|
218
149
|
) { edges { node { id } } }
|
|
219
150
|
}`;
|
|
220
151
|
|
|
221
|
-
const response = await this.
|
|
222
|
-
const response = await client.api.post<{
|
|
152
|
+
const response = await this._retryRequest(async () => {
|
|
153
|
+
const response = await this.client.api.post<{
|
|
223
154
|
data: { transactions: { edges: { node: { id: string } }[] } };
|
|
224
155
|
}>("/graphql", { query });
|
|
225
156
|
if (!response.ok) {
|
|
226
157
|
throw new Error(`Arweave GraphQL request failed with status ${response.status}`);
|
|
227
158
|
}
|
|
228
159
|
return response;
|
|
229
|
-
});
|
|
160
|
+
}, 0);
|
|
230
161
|
|
|
231
162
|
const entries = response?.data?.data?.transactions?.edges ?? [];
|
|
232
163
|
this.logger.debug({
|
|
@@ -267,9 +198,7 @@ export class ArweaveClient {
|
|
|
267
198
|
* @returns The metadata of the transaction if it exists, otherwise null
|
|
268
199
|
*/
|
|
269
200
|
async getMetadata(transactionID: string): Promise<Record<string, string> | null> {
|
|
270
|
-
const transaction = await this.
|
|
271
|
-
return await client.transactions.get(transactionID);
|
|
272
|
-
});
|
|
201
|
+
const transaction = await this.client.transactions.get(transactionID);
|
|
273
202
|
if (!isDefined(transaction)) {
|
|
274
203
|
return null;
|
|
275
204
|
}
|
|
@@ -287,12 +216,32 @@ export class ArweaveClient {
|
|
|
287
216
|
}
|
|
288
217
|
|
|
289
218
|
/**
|
|
290
|
-
* Returns the address of the signer of the JWT
|
|
291
|
-
* operation and does not require a network call.
|
|
219
|
+
* Returns the address of the signer of the JWT
|
|
292
220
|
* @returns The address of the signer in this client
|
|
293
221
|
*/
|
|
294
222
|
getAddress(): Promise<string> {
|
|
295
|
-
return this.
|
|
223
|
+
return this.client.wallets.jwkToAddress(this.arweaveJWT);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
private async _retryRequest<T>(request: () => Promise<T>, retryCount: number): Promise<T> {
|
|
227
|
+
try {
|
|
228
|
+
return await request();
|
|
229
|
+
} catch (e) {
|
|
230
|
+
if (retryCount < this.retries) {
|
|
231
|
+
// Implement a slightly aggressive exponential backoff to account for fierce parallelism.
|
|
232
|
+
const baseDelay = this.retryDelaySeconds * Math.pow(2, retryCount); // ms; attempt = [0, 1, 2, ...]
|
|
233
|
+
const delayS = baseDelay + baseDelay * Math.random();
|
|
234
|
+
this.logger.debug({
|
|
235
|
+
at: "ArweaveClient:retryRequest",
|
|
236
|
+
message: `Arweave request failed, retrying after waiting ${delayS} seconds: ${e}`,
|
|
237
|
+
retryCount,
|
|
238
|
+
});
|
|
239
|
+
await delay(delayS);
|
|
240
|
+
return this._retryRequest(request, retryCount + 1);
|
|
241
|
+
} else {
|
|
242
|
+
throw e;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
296
245
|
}
|
|
297
246
|
|
|
298
247
|
/**
|
|
@@ -301,9 +250,9 @@ export class ArweaveClient {
|
|
|
301
250
|
*/
|
|
302
251
|
async getBalance(): Promise<BigNumber> {
|
|
303
252
|
const address = await this.getAddress();
|
|
304
|
-
|
|
305
|
-
const balanceInFloat = await client.wallets.getBalance(address);
|
|
306
|
-
// @dev The reason we add in the BN.from
|
|
253
|
+
const request = async () => {
|
|
254
|
+
const balanceInFloat = await this.client.wallets.getBalance(address);
|
|
255
|
+
// @dev The reason we add in the BN.from into this retry loop is because the client.getBalance call
|
|
307
256
|
// does not correctly throw an error if the request fails, instead it will return the error string as the
|
|
308
257
|
// balanceInFloat.
|
|
309
258
|
// Sometimes the balance is returned in scientific notation, so we need to
|
|
@@ -315,6 +264,7 @@ export class ArweaveClient {
|
|
|
315
264
|
} else {
|
|
316
265
|
return BigNumber.from(balanceInFloat);
|
|
317
266
|
}
|
|
318
|
-
}
|
|
267
|
+
};
|
|
268
|
+
return await this._retryRequest(request, 0);
|
|
319
269
|
}
|
|
320
270
|
}
|
|
@@ -14,8 +14,12 @@ import {
|
|
|
14
14
|
union,
|
|
15
15
|
type,
|
|
16
16
|
} from "superstruct";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
17
|
+
import { utils as ethersUtils } from "ethers";
|
|
18
|
+
import { isAddress as isValidEvmAddress } from "viem";
|
|
19
|
+
import { isAddress as isValidSvmAddress } from "@solana/kit";
|
|
20
|
+
import { TronWeb } from "tronweb";
|
|
21
|
+
import { UNDEFINED_MESSAGE_HASH } from "../../../constants";
|
|
22
|
+
import { BigNumber, bs58, EvmAddress, RawAddress, SvmAddress, TvmAddress, toBytes32 } from "../../../utils";
|
|
19
23
|
|
|
20
24
|
const PositiveIntegerStringSS = pattern(string(), /\d+/);
|
|
21
25
|
const Web3AddressSS = pattern(string(), /^0x[a-fA-F0-9]{64}$/);
|
|
@@ -31,16 +35,26 @@ const BigNumberType = coerce(instance(BigNumber), union([string(), number()]), (
|
|
|
31
35
|
}
|
|
32
36
|
});
|
|
33
37
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
const AddressInstanceSS = union([
|
|
39
|
+
instance(EvmAddress),
|
|
40
|
+
instance(SvmAddress),
|
|
41
|
+
instance(TvmAddress),
|
|
42
|
+
instance(RawAddress),
|
|
43
|
+
]);
|
|
44
|
+
|
|
45
|
+
export const AddressType = coerce(AddressInstanceSS, string(), (value) => {
|
|
46
|
+
// Each family is matched by its native-format validator plus a length gate where it
|
|
47
|
+
// disambiguates. Unknown shapes fall to `RawAddress`, forcing future families into explicit
|
|
48
|
+
// branches rather than being absorbed silently.
|
|
49
|
+
try {
|
|
50
|
+
// strict: false preserves the prior byte-level acceptance of all-upper / non-checksummed hex.
|
|
51
|
+
if (value.length === 42 && isValidEvmAddress(value, { strict: false })) return EvmAddress.from(value);
|
|
52
|
+
if (value.length === 34 && TronWeb.isAddress(value)) return TvmAddress.from(value);
|
|
53
|
+
if (isValidSvmAddress(value)) return SvmAddress.from(value);
|
|
54
|
+
} catch {
|
|
55
|
+
// Validator accepted but `from()` rejected (e.g. SVM 12-zero EVM-masquerade) → RawAddress.
|
|
56
|
+
}
|
|
57
|
+
return new RawAddress(value.startsWith("0x") ? ethersUtils.arrayify(value) : bs58.decode(value));
|
|
44
58
|
});
|
|
45
59
|
|
|
46
60
|
const Web3AddressType = coerce(Web3AddressSS, string(), (value) => {
|