@across-protocol/sdk 4.3.45 → 4.3.47
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/arch/evm/SpokeUtils.js +30 -28
- package/dist/cjs/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/SpokeUtils.d.ts +21 -10
- package/dist/cjs/arch/svm/SpokeUtils.js +129 -11
- package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/encoders.d.ts +19 -0
- package/dist/cjs/arch/svm/encoders.js +52 -0
- package/dist/cjs/arch/svm/encoders.js.map +1 -0
- package/dist/cjs/arch/svm/index.d.ts +1 -0
- package/dist/cjs/arch/svm/index.js +1 -0
- package/dist/cjs/arch/svm/index.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js +4 -6
- package/dist/cjs/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +0 -5
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js +0 -1
- package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +58 -58
- package/dist/cjs/clients/HubPoolClient.d.ts +9 -3
- package/dist/cjs/clients/HubPoolClient.js +81 -56
- package/dist/cjs/clients/HubPoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +7 -5
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +13 -16
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockHubPoolClient.d.ts +2 -2
- package/dist/cjs/clients/mocks/MockHubPoolClient.js +1 -1
- package/dist/cjs/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/cjs/constants.d.ts +3 -0
- package/dist/cjs/constants.js +10 -2
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/providers/solana/retryRpcFactory.js +14 -10
- package/dist/cjs/providers/solana/retryRpcFactory.js.map +1 -1
- package/dist/esm/arch/evm/SpokeUtils.js +33 -29
- package/dist/esm/arch/evm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/SpokeUtils.d.ts +38 -10
- package/dist/esm/arch/svm/SpokeUtils.js +152 -11
- package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/encoders.d.ts +19 -0
- package/dist/esm/arch/svm/encoders.js +43 -0
- package/dist/esm/arch/svm/encoders.js.map +1 -0
- package/dist/esm/arch/svm/index.d.ts +1 -0
- package/dist/esm/arch/svm/index.js +1 -0
- package/dist/esm/arch/svm/index.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js +5 -7
- package/dist/esm/clients/BundleDataClient/utils/DataworkerUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +1 -6
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +0 -1
- package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +58 -58
- package/dist/esm/clients/HubPoolClient.d.ts +9 -3
- package/dist/esm/clients/HubPoolClient.js +87 -60
- package/dist/esm/clients/HubPoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +8 -6
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +13 -18
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockHubPoolClient.d.ts +2 -2
- package/dist/esm/clients/mocks/MockHubPoolClient.js +1 -1
- package/dist/esm/clients/mocks/MockHubPoolClient.js.map +1 -1
- package/dist/esm/constants.d.ts +3 -0
- package/dist/esm/constants.js +12 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/providers/solana/retryRpcFactory.js +15 -10
- package/dist/esm/providers/solana/retryRpcFactory.js.map +1 -1
- package/dist/types/arch/evm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts +38 -10
- package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/encoders.d.ts +20 -0
- package/dist/types/arch/svm/encoders.d.ts.map +1 -0
- package/dist/types/arch/svm/index.d.ts +1 -0
- package/dist/types/arch/svm/index.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/DataworkerUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/PoolRebalanceUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +58 -58
- package/dist/types/clients/HubPoolClient.d.ts +9 -3
- package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/EVMSpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockHubPoolClient.d.ts +2 -2
- package/dist/types/clients/mocks/MockHubPoolClient.d.ts.map +1 -1
- package/dist/types/constants.d.ts +3 -0
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/providers/solana/retryRpcFactory.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/arch/evm/SpokeUtils.ts +16 -9
- package/src/arch/svm/SpokeUtils.ts +199 -11
- package/src/arch/svm/encoders.ts +86 -0
- package/src/arch/svm/index.ts +1 -0
- package/src/clients/BundleDataClient/utils/DataworkerUtils.ts +20 -14
- package/src/clients/BundleDataClient/utils/FillUtils.ts +1 -7
- package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +0 -2
- package/src/clients/HubPoolClient.ts +79 -50
- package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +22 -8
- package/src/clients/SpokePoolClient/SpokePoolClient.ts +31 -39
- package/src/clients/mocks/MockHubPoolClient.ts +3 -3
- package/src/constants.ts +12 -0
- package/src/providers/solana/retryRpcFactory.ts +6 -2
|
@@ -24,21 +24,21 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
24
24
|
exclusivityDeadline: number;
|
|
25
25
|
destinationChainId: number;
|
|
26
26
|
messageHash: string;
|
|
27
|
+
blockNumber: number;
|
|
28
|
+
logIndex: number;
|
|
27
29
|
quoteTimestamp: number;
|
|
28
30
|
fromLiteChain: boolean;
|
|
29
31
|
toLiteChain: boolean;
|
|
30
|
-
blockNumber: number;
|
|
31
|
-
logIndex: number;
|
|
32
32
|
quoteBlockNumber: number;
|
|
33
33
|
updatedRecipient?: SvmAddress | EvmAddress | RawAddress | undefined;
|
|
34
34
|
updatedOutputAmount?: BigNumber | undefined;
|
|
35
35
|
updatedMessage?: string | undefined;
|
|
36
|
-
transactionHash?: string | undefined;
|
|
37
|
-
transactionIndex?: number | undefined;
|
|
38
|
-
relayerFeePct?: BigNumber | undefined;
|
|
39
|
-
speedUpSignature?: string | undefined;
|
|
40
36
|
txnIndex?: number | undefined;
|
|
41
37
|
txnRef?: string | undefined;
|
|
38
|
+
relayerFeePct?: BigNumber | undefined;
|
|
39
|
+
speedUpSignature?: string | undefined;
|
|
40
|
+
transactionHash?: string | undefined;
|
|
41
|
+
transactionIndex?: number | undefined;
|
|
42
42
|
}[]>>;
|
|
43
43
|
bundleFillsV3: Record<string, Record<string, {
|
|
44
44
|
fills: {
|
|
@@ -54,25 +54,25 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
54
54
|
exclusiveRelayer: SvmAddress | EvmAddress | RawAddress;
|
|
55
55
|
exclusivityDeadline: number;
|
|
56
56
|
destinationChainId: number;
|
|
57
|
+
relayer: SvmAddress | EvmAddress | RawAddress;
|
|
57
58
|
messageHash: string;
|
|
58
59
|
repaymentChainId: number;
|
|
59
|
-
quoteTimestamp: number;
|
|
60
|
-
relayer: SvmAddress | EvmAddress | RawAddress;
|
|
61
60
|
relayExecutionInfo: {
|
|
62
61
|
updatedRecipient: SvmAddress | EvmAddress | RawAddress;
|
|
63
62
|
updatedOutputAmount: BigNumber;
|
|
64
|
-
fillType: number;
|
|
65
63
|
updatedMessageHash: string;
|
|
64
|
+
fillType: number;
|
|
66
65
|
updatedMessage?: string | undefined;
|
|
67
66
|
};
|
|
68
67
|
blockNumber: number;
|
|
69
68
|
logIndex: number;
|
|
69
|
+
quoteTimestamp: number;
|
|
70
70
|
lpFeePct: BigNumber;
|
|
71
71
|
message?: string | undefined;
|
|
72
|
-
transactionHash?: string | undefined;
|
|
73
|
-
transactionIndex?: number | undefined;
|
|
74
72
|
txnIndex?: number | undefined;
|
|
75
73
|
txnRef?: string | undefined;
|
|
74
|
+
transactionHash?: string | undefined;
|
|
75
|
+
transactionIndex?: number | undefined;
|
|
76
76
|
}[];
|
|
77
77
|
refunds: Record<string, BigNumber>;
|
|
78
78
|
realizedLpFees: BigNumber;
|
|
@@ -93,22 +93,22 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
93
93
|
exclusivityDeadline: number;
|
|
94
94
|
destinationChainId: number;
|
|
95
95
|
messageHash: string;
|
|
96
|
+
blockNumber: number;
|
|
97
|
+
logIndex: number;
|
|
96
98
|
quoteTimestamp: number;
|
|
97
99
|
fromLiteChain: boolean;
|
|
98
100
|
toLiteChain: boolean;
|
|
99
|
-
blockNumber: number;
|
|
100
|
-
logIndex: number;
|
|
101
101
|
quoteBlockNumber: number;
|
|
102
102
|
lpFeePct: BigNumber;
|
|
103
103
|
updatedRecipient?: SvmAddress | EvmAddress | RawAddress | undefined;
|
|
104
104
|
updatedOutputAmount?: BigNumber | undefined;
|
|
105
105
|
updatedMessage?: string | undefined;
|
|
106
|
-
transactionHash?: string | undefined;
|
|
107
|
-
transactionIndex?: number | undefined;
|
|
108
|
-
relayerFeePct?: BigNumber | undefined;
|
|
109
|
-
speedUpSignature?: string | undefined;
|
|
110
106
|
txnIndex?: number | undefined;
|
|
111
107
|
txnRef?: string | undefined;
|
|
108
|
+
relayerFeePct?: BigNumber | undefined;
|
|
109
|
+
speedUpSignature?: string | undefined;
|
|
110
|
+
transactionHash?: string | undefined;
|
|
111
|
+
transactionIndex?: number | undefined;
|
|
112
112
|
}[]>>;
|
|
113
113
|
expiredDepositsToRefundV3: Record<string, Record<string, {
|
|
114
114
|
message: string;
|
|
@@ -125,21 +125,21 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
125
125
|
exclusivityDeadline: number;
|
|
126
126
|
destinationChainId: number;
|
|
127
127
|
messageHash: string;
|
|
128
|
+
blockNumber: number;
|
|
129
|
+
logIndex: number;
|
|
128
130
|
quoteTimestamp: number;
|
|
129
131
|
fromLiteChain: boolean;
|
|
130
132
|
toLiteChain: boolean;
|
|
131
|
-
blockNumber: number;
|
|
132
|
-
logIndex: number;
|
|
133
133
|
quoteBlockNumber: number;
|
|
134
134
|
updatedRecipient?: SvmAddress | EvmAddress | RawAddress | undefined;
|
|
135
135
|
updatedOutputAmount?: BigNumber | undefined;
|
|
136
136
|
updatedMessage?: string | undefined;
|
|
137
|
-
transactionHash?: string | undefined;
|
|
138
|
-
transactionIndex?: number | undefined;
|
|
139
|
-
relayerFeePct?: BigNumber | undefined;
|
|
140
|
-
speedUpSignature?: string | undefined;
|
|
141
137
|
txnIndex?: number | undefined;
|
|
142
138
|
txnRef?: string | undefined;
|
|
139
|
+
relayerFeePct?: BigNumber | undefined;
|
|
140
|
+
speedUpSignature?: string | undefined;
|
|
141
|
+
transactionHash?: string | undefined;
|
|
142
|
+
transactionIndex?: number | undefined;
|
|
143
143
|
}[]>>;
|
|
144
144
|
unexecutableSlowFills: Record<string, Record<string, {
|
|
145
145
|
message: string;
|
|
@@ -156,22 +156,22 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
156
156
|
exclusivityDeadline: number;
|
|
157
157
|
destinationChainId: number;
|
|
158
158
|
messageHash: string;
|
|
159
|
+
blockNumber: number;
|
|
160
|
+
logIndex: number;
|
|
159
161
|
quoteTimestamp: number;
|
|
160
162
|
fromLiteChain: boolean;
|
|
161
163
|
toLiteChain: boolean;
|
|
162
|
-
blockNumber: number;
|
|
163
|
-
logIndex: number;
|
|
164
164
|
quoteBlockNumber: number;
|
|
165
165
|
lpFeePct: BigNumber;
|
|
166
166
|
updatedRecipient?: SvmAddress | EvmAddress | RawAddress | undefined;
|
|
167
167
|
updatedOutputAmount?: BigNumber | undefined;
|
|
168
168
|
updatedMessage?: string | undefined;
|
|
169
|
-
transactionHash?: string | undefined;
|
|
170
|
-
transactionIndex?: number | undefined;
|
|
171
|
-
relayerFeePct?: BigNumber | undefined;
|
|
172
|
-
speedUpSignature?: string | undefined;
|
|
173
169
|
txnIndex?: number | undefined;
|
|
174
170
|
txnRef?: string | undefined;
|
|
171
|
+
relayerFeePct?: BigNumber | undefined;
|
|
172
|
+
speedUpSignature?: string | undefined;
|
|
173
|
+
transactionHash?: string | undefined;
|
|
174
|
+
transactionIndex?: number | undefined;
|
|
175
175
|
}[]>>;
|
|
176
176
|
}, {
|
|
177
177
|
bundleDepositsV3: import("superstruct").Struct<Record<string, Record<string, {
|
|
@@ -189,21 +189,21 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
189
189
|
exclusivityDeadline: number;
|
|
190
190
|
destinationChainId: number;
|
|
191
191
|
messageHash: string;
|
|
192
|
+
blockNumber: number;
|
|
193
|
+
logIndex: number;
|
|
192
194
|
quoteTimestamp: number;
|
|
193
195
|
fromLiteChain: boolean;
|
|
194
196
|
toLiteChain: boolean;
|
|
195
|
-
blockNumber: number;
|
|
196
|
-
logIndex: number;
|
|
197
197
|
quoteBlockNumber: number;
|
|
198
198
|
updatedRecipient?: SvmAddress | EvmAddress | RawAddress | undefined;
|
|
199
199
|
updatedOutputAmount?: BigNumber | undefined;
|
|
200
200
|
updatedMessage?: string | undefined;
|
|
201
|
-
transactionHash?: string | undefined;
|
|
202
|
-
transactionIndex?: number | undefined;
|
|
203
|
-
relayerFeePct?: BigNumber | undefined;
|
|
204
|
-
speedUpSignature?: string | undefined;
|
|
205
201
|
txnIndex?: number | undefined;
|
|
206
202
|
txnRef?: string | undefined;
|
|
203
|
+
relayerFeePct?: BigNumber | undefined;
|
|
204
|
+
speedUpSignature?: string | undefined;
|
|
205
|
+
transactionHash?: string | undefined;
|
|
206
|
+
transactionIndex?: number | undefined;
|
|
207
207
|
}[]>>, null>;
|
|
208
208
|
expiredDepositsToRefundV3: import("superstruct").Struct<Record<string, Record<string, {
|
|
209
209
|
message: string;
|
|
@@ -220,21 +220,21 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
220
220
|
exclusivityDeadline: number;
|
|
221
221
|
destinationChainId: number;
|
|
222
222
|
messageHash: string;
|
|
223
|
+
blockNumber: number;
|
|
224
|
+
logIndex: number;
|
|
223
225
|
quoteTimestamp: number;
|
|
224
226
|
fromLiteChain: boolean;
|
|
225
227
|
toLiteChain: boolean;
|
|
226
|
-
blockNumber: number;
|
|
227
|
-
logIndex: number;
|
|
228
228
|
quoteBlockNumber: number;
|
|
229
229
|
updatedRecipient?: SvmAddress | EvmAddress | RawAddress | undefined;
|
|
230
230
|
updatedOutputAmount?: BigNumber | undefined;
|
|
231
231
|
updatedMessage?: string | undefined;
|
|
232
|
-
transactionHash?: string | undefined;
|
|
233
|
-
transactionIndex?: number | undefined;
|
|
234
|
-
relayerFeePct?: BigNumber | undefined;
|
|
235
|
-
speedUpSignature?: string | undefined;
|
|
236
232
|
txnIndex?: number | undefined;
|
|
237
233
|
txnRef?: string | undefined;
|
|
234
|
+
relayerFeePct?: BigNumber | undefined;
|
|
235
|
+
speedUpSignature?: string | undefined;
|
|
236
|
+
transactionHash?: string | undefined;
|
|
237
|
+
transactionIndex?: number | undefined;
|
|
238
238
|
}[]>>, null>;
|
|
239
239
|
unexecutableSlowFills: import("superstruct").Struct<Record<string, Record<string, {
|
|
240
240
|
message: string;
|
|
@@ -251,22 +251,22 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
251
251
|
exclusivityDeadline: number;
|
|
252
252
|
destinationChainId: number;
|
|
253
253
|
messageHash: string;
|
|
254
|
+
blockNumber: number;
|
|
255
|
+
logIndex: number;
|
|
254
256
|
quoteTimestamp: number;
|
|
255
257
|
fromLiteChain: boolean;
|
|
256
258
|
toLiteChain: boolean;
|
|
257
|
-
blockNumber: number;
|
|
258
|
-
logIndex: number;
|
|
259
259
|
quoteBlockNumber: number;
|
|
260
260
|
lpFeePct: BigNumber;
|
|
261
261
|
updatedRecipient?: SvmAddress | EvmAddress | RawAddress | undefined;
|
|
262
262
|
updatedOutputAmount?: BigNumber | undefined;
|
|
263
263
|
updatedMessage?: string | undefined;
|
|
264
|
-
transactionHash?: string | undefined;
|
|
265
|
-
transactionIndex?: number | undefined;
|
|
266
|
-
relayerFeePct?: BigNumber | undefined;
|
|
267
|
-
speedUpSignature?: string | undefined;
|
|
268
264
|
txnIndex?: number | undefined;
|
|
269
265
|
txnRef?: string | undefined;
|
|
266
|
+
relayerFeePct?: BigNumber | undefined;
|
|
267
|
+
speedUpSignature?: string | undefined;
|
|
268
|
+
transactionHash?: string | undefined;
|
|
269
|
+
transactionIndex?: number | undefined;
|
|
270
270
|
}[]>>, null>;
|
|
271
271
|
bundleSlowFillsV3: import("superstruct").Struct<Record<string, Record<string, {
|
|
272
272
|
message: string;
|
|
@@ -283,22 +283,22 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
283
283
|
exclusivityDeadline: number;
|
|
284
284
|
destinationChainId: number;
|
|
285
285
|
messageHash: string;
|
|
286
|
+
blockNumber: number;
|
|
287
|
+
logIndex: number;
|
|
286
288
|
quoteTimestamp: number;
|
|
287
289
|
fromLiteChain: boolean;
|
|
288
290
|
toLiteChain: boolean;
|
|
289
|
-
blockNumber: number;
|
|
290
|
-
logIndex: number;
|
|
291
291
|
quoteBlockNumber: number;
|
|
292
292
|
lpFeePct: BigNumber;
|
|
293
293
|
updatedRecipient?: SvmAddress | EvmAddress | RawAddress | undefined;
|
|
294
294
|
updatedOutputAmount?: BigNumber | undefined;
|
|
295
295
|
updatedMessage?: string | undefined;
|
|
296
|
-
transactionHash?: string | undefined;
|
|
297
|
-
transactionIndex?: number | undefined;
|
|
298
|
-
relayerFeePct?: BigNumber | undefined;
|
|
299
|
-
speedUpSignature?: string | undefined;
|
|
300
296
|
txnIndex?: number | undefined;
|
|
301
297
|
txnRef?: string | undefined;
|
|
298
|
+
relayerFeePct?: BigNumber | undefined;
|
|
299
|
+
speedUpSignature?: string | undefined;
|
|
300
|
+
transactionHash?: string | undefined;
|
|
301
|
+
transactionIndex?: number | undefined;
|
|
302
302
|
}[]>>, null>;
|
|
303
303
|
bundleFillsV3: import("superstruct").Struct<Record<string, Record<string, {
|
|
304
304
|
fills: {
|
|
@@ -314,25 +314,25 @@ export declare const BundleDataSS: import("superstruct").Struct<{
|
|
|
314
314
|
exclusiveRelayer: SvmAddress | EvmAddress | RawAddress;
|
|
315
315
|
exclusivityDeadline: number;
|
|
316
316
|
destinationChainId: number;
|
|
317
|
+
relayer: SvmAddress | EvmAddress | RawAddress;
|
|
317
318
|
messageHash: string;
|
|
318
319
|
repaymentChainId: number;
|
|
319
|
-
quoteTimestamp: number;
|
|
320
|
-
relayer: SvmAddress | EvmAddress | RawAddress;
|
|
321
320
|
relayExecutionInfo: {
|
|
322
321
|
updatedRecipient: SvmAddress | EvmAddress | RawAddress;
|
|
323
322
|
updatedOutputAmount: BigNumber;
|
|
324
|
-
fillType: number;
|
|
325
323
|
updatedMessageHash: string;
|
|
324
|
+
fillType: number;
|
|
326
325
|
updatedMessage?: string | undefined;
|
|
327
326
|
};
|
|
328
327
|
blockNumber: number;
|
|
329
328
|
logIndex: number;
|
|
329
|
+
quoteTimestamp: number;
|
|
330
330
|
lpFeePct: BigNumber;
|
|
331
331
|
message?: string | undefined;
|
|
332
|
-
transactionHash?: string | undefined;
|
|
333
|
-
transactionIndex?: number | undefined;
|
|
334
332
|
txnIndex?: number | undefined;
|
|
335
333
|
txnRef?: string | undefined;
|
|
334
|
+
transactionHash?: string | undefined;
|
|
335
|
+
transactionIndex?: number | undefined;
|
|
336
336
|
}[];
|
|
337
337
|
refunds: Record<string, BigNumber>;
|
|
338
338
|
realizedLpFees: BigNumber;
|
|
@@ -18,6 +18,11 @@ type HubPoolUpdateFailure = {
|
|
|
18
18
|
};
|
|
19
19
|
export type HubPoolUpdate = HubPoolUpdateSuccess | HubPoolUpdateFailure;
|
|
20
20
|
type HubPoolEvent = "SetPoolRebalanceRoute" | "L1TokenEnabledForLiquidityProvision" | "ProposeRootBundle" | "RootBundleCanceled" | "RootBundleDisputed" | "RootBundleExecuted" | "CrossChainContractsSet";
|
|
21
|
+
type L1TokensToDestinationTokens = {
|
|
22
|
+
[l1Token: string]: {
|
|
23
|
+
[destinationChainId: number]: Address;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
21
26
|
export type LpFeeRequest = Pick<Deposit, "originChainId" | "inputToken" | "inputAmount" | "quoteTimestamp"> & {
|
|
22
27
|
paymentChainId?: number;
|
|
23
28
|
};
|
|
@@ -32,6 +37,7 @@ export declare class HubPoolClient extends BaseAbstractClient {
|
|
|
32
37
|
ignoredHubProposedBundles: number[];
|
|
33
38
|
timeToCache?: number;
|
|
34
39
|
};
|
|
40
|
+
protected l1TokensToDestinationTokens: L1TokensToDestinationTokens;
|
|
35
41
|
protected l1Tokens: L1TokenInfo[];
|
|
36
42
|
protected lpTokens: {
|
|
37
43
|
[token: string]: LpToken;
|
|
@@ -65,9 +71,9 @@ export declare class HubPoolClient extends BaseAbstractClient {
|
|
|
65
71
|
getExecutedRootBundles(): ExecutedRootBundle[];
|
|
66
72
|
getSpokePoolForBlock(chain: number, block?: number): Address;
|
|
67
73
|
getSpokePoolActivationBlock(chain: number, spokePool: Address): number | undefined;
|
|
68
|
-
getL2TokenForL1TokenAtBlock(l1Token: EvmAddress, destinationChainId: number, latestHubBlock?: number): Address
|
|
69
|
-
getL1TokenForL2TokenAtBlock(l2Token: Address, destinationChainId: number, latestHubBlock?: number): EvmAddress
|
|
70
|
-
protected getL1TokenForDeposit(deposit: Pick<DepositWithBlock, "originChainId" | "inputToken" | "quoteBlockNumber">): EvmAddress
|
|
74
|
+
getL2TokenForL1TokenAtBlock(l1Token: EvmAddress, destinationChainId: number, latestHubBlock?: number): Address;
|
|
75
|
+
getL1TokenForL2TokenAtBlock(l2Token: Address, destinationChainId: number, latestHubBlock?: number): EvmAddress;
|
|
76
|
+
protected getL1TokenForDeposit(deposit: Pick<DepositWithBlock, "originChainId" | "inputToken" | "quoteBlockNumber">): EvmAddress;
|
|
71
77
|
l2TokenEnabledForL1Token(l1Token: EvmAddress, destinationChainId: number): boolean;
|
|
72
78
|
l2TokenEnabledForL1TokenAtBlock(l1Token: EvmAddress, destinationChainId: number, hubBlockNumber: number): boolean;
|
|
73
79
|
l2TokenHasPoolRebalanceRoute(l2Token: Address, l2ChainId: number, hubPoolBlock?: number): boolean;
|
|
@@ -26,6 +26,7 @@ var HubPoolClient = (function (_super) {
|
|
|
26
26
|
_this.deploymentBlock = deploymentBlock;
|
|
27
27
|
_this.chainId = chainId;
|
|
28
28
|
_this.configOverride = configOverride;
|
|
29
|
+
_this.l1TokensToDestinationTokens = {};
|
|
29
30
|
_this.l1Tokens = [];
|
|
30
31
|
_this.lpTokens = {};
|
|
31
32
|
_this.proposedRootBundles = [];
|
|
@@ -89,41 +90,69 @@ var HubPoolClient = (function (_super) {
|
|
|
89
90
|
return mostRecentSpokePoolUpdateBeforeBlock === null || mostRecentSpokePoolUpdateBeforeBlock === void 0 ? void 0 : mostRecentSpokePoolUpdateBeforeBlock.blockNumber;
|
|
90
91
|
};
|
|
91
92
|
HubPoolClient.prototype.getL2TokenForL1TokenAtBlock = function (l1Token, destinationChainId, latestHubBlock) {
|
|
92
|
-
var _a, _b;
|
|
93
|
+
var _a, _b, _c, _d;
|
|
93
94
|
if (latestHubBlock === void 0) { latestHubBlock = Number.MAX_SAFE_INTEGER; }
|
|
94
95
|
if (!((_b = (_a = this.l1TokensToDestinationTokensWithBlock) === null || _a === void 0 ? void 0 : _a[l1Token.toEvmAddress()]) === null || _b === void 0 ? void 0 : _b[destinationChainId])) {
|
|
95
|
-
|
|
96
|
+
var chain = (0, utils_1.getNetworkName)(destinationChainId);
|
|
97
|
+
var symbol = ((_c = this.l1Tokens.find(function (_a) {
|
|
98
|
+
var address = _a.address;
|
|
99
|
+
return address.eq(l1Token);
|
|
100
|
+
})) !== null && _c !== void 0 ? _c : { symbol: l1Token.toString() }).symbol;
|
|
101
|
+
throw new Error("Could not find SpokePool mapping for ".concat(symbol, " on ").concat(chain, " and L1 token ").concat(l1Token));
|
|
102
|
+
}
|
|
103
|
+
var l2Token = (0, utils_1.sortEventsDescending)(this.l1TokensToDestinationTokensWithBlock[l1Token.toEvmAddress()][destinationChainId]).find(function (mapping) { return mapping.blockNumber <= latestHubBlock; });
|
|
104
|
+
if (!l2Token) {
|
|
105
|
+
var chain = (0, utils_1.getNetworkName)(destinationChainId);
|
|
106
|
+
var symbol = ((_d = this.l1Tokens.find(function (_a) {
|
|
107
|
+
var address = _a.address;
|
|
108
|
+
return address.eq(l1Token);
|
|
109
|
+
})) !== null && _d !== void 0 ? _d : { symbol: l1Token.toString() }).symbol;
|
|
110
|
+
throw new Error("Could not find SpokePool mapping for ".concat(symbol, " on ").concat(chain, " at or before HubPool block ").concat(latestHubBlock, "!"));
|
|
96
111
|
}
|
|
97
|
-
|
|
98
|
-
return !l2Token || l2Token.l2Token.isZeroAddress() ? undefined : l2Token.l2Token;
|
|
112
|
+
return l2Token.l2Token;
|
|
99
113
|
};
|
|
100
114
|
HubPoolClient.prototype.getL1TokenForL2TokenAtBlock = function (l2Token, destinationChainId, latestHubBlock) {
|
|
101
115
|
var _this = this;
|
|
102
116
|
if (latestHubBlock === void 0) { latestHubBlock = Number.MAX_SAFE_INTEGER; }
|
|
103
|
-
var l2Tokens = Object.keys(this.l1TokensToDestinationTokensWithBlock)
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
117
|
+
var l2Tokens = Object.keys(this.l1TokensToDestinationTokensWithBlock)
|
|
118
|
+
.filter(function (l1Token) { return _this.l2TokenEnabledForL1Token(utils_1.EvmAddress.from(l1Token), destinationChainId); })
|
|
119
|
+
.map(function (l1Token) {
|
|
120
|
+
return _this.l1TokensToDestinationTokensWithBlock[l1Token][destinationChainId].filter(function (dstTokenWithBlock) {
|
|
121
|
+
return dstTokenWithBlock.l2Token.truncateToBytes20() === l2Token.truncateToBytes20() &&
|
|
122
|
+
dstTokenWithBlock.blockNumber <= latestHubBlock;
|
|
123
|
+
});
|
|
124
|
+
})
|
|
125
|
+
.flat();
|
|
126
|
+
if (l2Tokens.length === 0) {
|
|
127
|
+
var chain = (0, utils_1.getNetworkName)(destinationChainId);
|
|
128
|
+
throw new Error("Could not find HubPool mapping for ".concat(l2Token, " on ").concat(chain, " at or before HubPool block ").concat(latestHubBlock, "!"));
|
|
129
|
+
}
|
|
130
|
+
return (0, utils_1.sortEventsDescending)(l2Tokens)[0].l1Token;
|
|
111
131
|
};
|
|
112
132
|
HubPoolClient.prototype.getL1TokenForDeposit = function (deposit) {
|
|
113
133
|
return this.getL1TokenForL2TokenAtBlock(deposit.inputToken, deposit.originChainId, deposit.quoteBlockNumber);
|
|
114
134
|
};
|
|
115
135
|
HubPoolClient.prototype.l2TokenEnabledForL1Token = function (l1Token, destinationChainId) {
|
|
116
|
-
|
|
136
|
+
var _a, _b;
|
|
137
|
+
return ((_b = (_a = this.l1TokensToDestinationTokens) === null || _a === void 0 ? void 0 : _a[l1Token.toEvmAddress()]) === null || _b === void 0 ? void 0 : _b[destinationChainId]) != undefined;
|
|
117
138
|
};
|
|
118
139
|
HubPoolClient.prototype.l2TokenEnabledForL1TokenAtBlock = function (l1Token, destinationChainId, hubBlockNumber) {
|
|
119
140
|
var _a, _b, _c;
|
|
120
141
|
var l2Token = (0, utils_1.sortEventsDescending)((_c = (_b = (_a = this.l1TokensToDestinationTokensWithBlock) === null || _a === void 0 ? void 0 : _a[l1Token.toEvmAddress()]) === null || _b === void 0 ? void 0 : _b[destinationChainId]) !== null && _c !== void 0 ? _c : []).find(function (mapping) { return mapping.blockNumber <= hubBlockNumber; });
|
|
121
|
-
return l2Token !== undefined
|
|
142
|
+
return l2Token !== undefined;
|
|
122
143
|
};
|
|
123
144
|
HubPoolClient.prototype.l2TokenHasPoolRebalanceRoute = function (l2Token, l2ChainId, hubPoolBlock) {
|
|
124
145
|
if (hubPoolBlock === void 0) { hubPoolBlock = this.latestHeightSearched; }
|
|
125
|
-
|
|
126
|
-
|
|
146
|
+
return Object.values(this.l1TokensToDestinationTokensWithBlock).some(function (destinationTokenMapping) {
|
|
147
|
+
return Object.entries(destinationTokenMapping).some(function (_a) {
|
|
148
|
+
var _l2ChainId = _a[0], setPoolRebalanceRouteEvents = _a[1];
|
|
149
|
+
return setPoolRebalanceRouteEvents.some(function (e) {
|
|
150
|
+
return (e.blockNumber <= hubPoolBlock &&
|
|
151
|
+
e.l2Token.truncateToBytes20() === l2Token.truncateToBytes20() &&
|
|
152
|
+
Number(_l2ChainId) === l2ChainId);
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
});
|
|
127
156
|
};
|
|
128
157
|
HubPoolClient.prototype.getTokenInfoForAddress = function (address, chainId) {
|
|
129
158
|
var _a;
|
|
@@ -265,11 +294,11 @@ var HubPoolClient = (function (_super) {
|
|
|
265
294
|
getHubPoolToken = function (deposit, quoteBlockNumber) {
|
|
266
295
|
var _a;
|
|
267
296
|
var tokenKey = "".concat(deposit.originChainId, "-").concat(deposit.inputToken);
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
return undefined;
|
|
297
|
+
if (_this.l2TokenHasPoolRebalanceRoute(deposit.inputToken, deposit.originChainId, quoteBlockNumber)) {
|
|
298
|
+
return ((_a = hubPoolTokens[tokenKey]) !== null && _a !== void 0 ? _a : (hubPoolTokens[tokenKey] = _this.getL1TokenForDeposit(tslib_1.__assign(tslib_1.__assign({}, deposit), { quoteBlockNumber: quoteBlockNumber }))));
|
|
271
299
|
}
|
|
272
|
-
|
|
300
|
+
else
|
|
301
|
+
return undefined;
|
|
273
302
|
};
|
|
274
303
|
getHubPoolTokens = function () { return (0, utils_1.dedupArray)(Object.values(hubPoolTokens).filter(utils_1.isDefined)); };
|
|
275
304
|
resolveUniqueQuoteTimestamps = function (deposit) {
|
|
@@ -397,12 +426,12 @@ var HubPoolClient = (function (_super) {
|
|
|
397
426
|
}
|
|
398
427
|
var l1TokenA = this.getL1TokenForL2TokenAtBlock(tokenA, chainIdA, hubPoolBlock);
|
|
399
428
|
var l1TokenB = this.getL1TokenForL2TokenAtBlock(tokenB, chainIdB, hubPoolBlock);
|
|
400
|
-
if (!l1TokenA
|
|
429
|
+
if (!l1TokenA.eq(l1TokenB)) {
|
|
401
430
|
return false;
|
|
402
431
|
}
|
|
403
432
|
var _tokenA = this.getL2TokenForL1TokenAtBlock(l1TokenA, chainIdA, hubPoolBlock);
|
|
404
433
|
var _tokenB = this.getL2TokenForL1TokenAtBlock(l1TokenB, chainIdB, hubPoolBlock);
|
|
405
|
-
return
|
|
434
|
+
return tokenA.eq(_tokenA) && tokenB.eq(_tokenB);
|
|
406
435
|
};
|
|
407
436
|
HubPoolClient.prototype.getSpokeActivationBlockForChain = function (chainId) {
|
|
408
437
|
var _a;
|
|
@@ -636,21 +665,20 @@ var HubPoolClient = (function (_super) {
|
|
|
636
665
|
});
|
|
637
666
|
};
|
|
638
667
|
HubPoolClient.prototype.update = function (eventsToQuery) {
|
|
639
|
-
var _a;
|
|
640
668
|
if (eventsToQuery === void 0) { eventsToQuery = Object.keys(this.hubPoolEventFilters()); }
|
|
641
669
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
642
|
-
var update, events, currentTime, pendingRootBundleProposal, searchEndBlock, _i,
|
|
643
|
-
var _j, _k
|
|
670
|
+
var update, events, currentTime, pendingRootBundleProposal, searchEndBlock, _i, _a, event_1, args, dataToAdd, solanaSpokePool, svmSpoke, truncatedAddress, _b, _c, event_2, args, destinationToken, usdcTokenSol, svmUsdc, uniqueL1Tokens, _d, tokenInfo, lpTokenInfo_1, _loop_1, this_1, _e, tokenInfo_1, info, _f, _g, event_3, executedRootBundle, l1Tokens, runningBalances, nTokens, mostRecentProposedRootBundle;
|
|
671
|
+
var _h, _j, _k;
|
|
644
672
|
var _this = this;
|
|
645
|
-
return tslib_1.__generator(this, function (
|
|
646
|
-
switch (
|
|
673
|
+
return tslib_1.__generator(this, function (_l) {
|
|
674
|
+
switch (_l.label) {
|
|
647
675
|
case 0:
|
|
648
676
|
if (!this.configStoreClient.isUpdated) {
|
|
649
677
|
throw new Error("ConfigStoreClient not updated");
|
|
650
678
|
}
|
|
651
679
|
return [4, this._update(eventsToQuery)];
|
|
652
680
|
case 1:
|
|
653
|
-
update =
|
|
681
|
+
update = _l.sent();
|
|
654
682
|
if (!update.success) {
|
|
655
683
|
if (update.reason !== BaseAbstractClient_1.UpdateFailureReason.AlreadyUpdated) {
|
|
656
684
|
throw new Error("Unable to update HubPoolClient: ".concat(update.reason));
|
|
@@ -659,8 +687,8 @@ var HubPoolClient = (function (_super) {
|
|
|
659
687
|
}
|
|
660
688
|
events = update.events, currentTime = update.currentTime, pendingRootBundleProposal = update.pendingRootBundleProposal, searchEndBlock = update.searchEndBlock;
|
|
661
689
|
if (eventsToQuery.includes("CrossChainContractsSet")) {
|
|
662
|
-
for (_i = 0,
|
|
663
|
-
event_1 =
|
|
690
|
+
for (_i = 0, _a = events["CrossChainContractsSet"]; _i < _a.length; _i++) {
|
|
691
|
+
event_1 = _a[_i];
|
|
664
692
|
args = (0, utils_1.spreadEventWithBlockNumber)(event_1);
|
|
665
693
|
dataToAdd = {
|
|
666
694
|
spokePool: utils_1.EvmAddress.from(args.spokePool),
|
|
@@ -687,8 +715,8 @@ var HubPoolClient = (function (_super) {
|
|
|
687
715
|
}
|
|
688
716
|
}
|
|
689
717
|
if (eventsToQuery.includes("SetPoolRebalanceRoute")) {
|
|
690
|
-
for (
|
|
691
|
-
event_2 =
|
|
718
|
+
for (_b = 0, _c = events["SetPoolRebalanceRoute"]; _b < _c.length; _b++) {
|
|
719
|
+
event_2 = _c[_b];
|
|
692
720
|
args = (0, utils_1.spreadEventWithBlockNumber)(event_2);
|
|
693
721
|
destinationToken = utils_1.EvmAddress.from(args.destinationToken);
|
|
694
722
|
if ((0, utils_1.chainIsSvm)(args.destinationChainId)) {
|
|
@@ -700,21 +728,18 @@ var HubPoolClient = (function (_super) {
|
|
|
700
728
|
}
|
|
701
729
|
destinationToken = svmUsdc;
|
|
702
730
|
}
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
]
|
|
715
|
-
}
|
|
716
|
-
else {
|
|
717
|
-
(0, utils_1.assign)(this.l1TokensToDestinationTokensWithBlock, [args.l1Token, args.destinationChainId], [newRoute]);
|
|
731
|
+
if (!destinationToken.isZeroAddress()) {
|
|
732
|
+
(0, utils_1.assign)(this.l1TokensToDestinationTokens, [args.l1Token, args.destinationChainId], destinationToken);
|
|
733
|
+
(0, utils_1.assign)(this.l1TokensToDestinationTokensWithBlock, [args.l1Token, args.destinationChainId], [
|
|
734
|
+
{
|
|
735
|
+
l1Token: utils_1.EvmAddress.from(args.l1Token),
|
|
736
|
+
l2Token: destinationToken,
|
|
737
|
+
blockNumber: args.blockNumber,
|
|
738
|
+
txnIndex: args.txnIndex,
|
|
739
|
+
logIndex: args.logIndex,
|
|
740
|
+
txnRef: args.txnRef,
|
|
741
|
+
},
|
|
742
|
+
]);
|
|
718
743
|
}
|
|
719
744
|
}
|
|
720
745
|
}
|
|
@@ -740,7 +765,7 @@ var HubPoolClient = (function (_super) {
|
|
|
740
765
|
}); }); })),
|
|
741
766
|
])];
|
|
742
767
|
case 2:
|
|
743
|
-
|
|
768
|
+
_d = _l.sent(), tokenInfo = _d[0], lpTokenInfo_1 = _d[1];
|
|
744
769
|
_loop_1 = function (info) {
|
|
745
770
|
if (!this_1.l1Tokens.find(function (token) { return token.address.eq(info.address); })) {
|
|
746
771
|
if (info.decimals > 0 && info.decimals <= 18) {
|
|
@@ -752,8 +777,8 @@ var HubPoolClient = (function (_super) {
|
|
|
752
777
|
}
|
|
753
778
|
};
|
|
754
779
|
this_1 = this;
|
|
755
|
-
for (
|
|
756
|
-
info = tokenInfo_1[
|
|
780
|
+
for (_e = 0, tokenInfo_1 = tokenInfo; _e < tokenInfo_1.length; _e++) {
|
|
781
|
+
info = tokenInfo_1[_e];
|
|
757
782
|
_loop_1(info);
|
|
758
783
|
}
|
|
759
784
|
uniqueL1Tokens.forEach(function (token, i) {
|
|
@@ -762,10 +787,10 @@ var HubPoolClient = (function (_super) {
|
|
|
762
787
|
liquidReserves: lpTokenInfo_1[i].liquidReserves,
|
|
763
788
|
};
|
|
764
789
|
});
|
|
765
|
-
|
|
790
|
+
_l.label = 3;
|
|
766
791
|
case 3:
|
|
767
792
|
if (eventsToQuery.includes("ProposeRootBundle")) {
|
|
768
|
-
(
|
|
793
|
+
(_h = this.proposedRootBundles).push.apply(_h, events["ProposeRootBundle"]
|
|
769
794
|
.filter(function (event) { return !_this.configOverride.ignoredHubProposedBundles.includes(event.blockNumber); })
|
|
770
795
|
.map(function (_event) {
|
|
771
796
|
var args = (0, utils_1.spreadEventWithBlockNumber)(_event);
|
|
@@ -773,14 +798,14 @@ var HubPoolClient = (function (_super) {
|
|
|
773
798
|
}));
|
|
774
799
|
}
|
|
775
800
|
if (eventsToQuery.includes("RootBundleCanceled")) {
|
|
776
|
-
(
|
|
801
|
+
(_j = this.canceledRootBundles).push.apply(_j, events["RootBundleCanceled"].map(function (event) { return (0, utils_1.spreadEventWithBlockNumber)(event); }));
|
|
777
802
|
}
|
|
778
803
|
if (eventsToQuery.includes("RootBundleDisputed")) {
|
|
779
|
-
(
|
|
804
|
+
(_k = this.disputedRootBundles).push.apply(_k, events["RootBundleDisputed"].map(function (event) { return (0, utils_1.spreadEventWithBlockNumber)(event); }));
|
|
780
805
|
}
|
|
781
806
|
if (eventsToQuery.includes("RootBundleExecuted")) {
|
|
782
|
-
for (
|
|
783
|
-
event_3 =
|
|
807
|
+
for (_f = 0, _g = events["RootBundleExecuted"]; _f < _g.length; _f++) {
|
|
808
|
+
event_3 = _g[_f];
|
|
784
809
|
if (this.configOverride.ignoredHubExecutedBundles.includes(event_3.blockNumber)) {
|
|
785
810
|
continue;
|
|
786
811
|
}
|