@across-protocol/sdk 4.1.46-beta.2 → 4.1.46-beta.4
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/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +11 -15
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +6 -52
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +3 -3
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +20 -48
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js +6 -8
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/cjs/clients/HubPoolClient.js +6 -6
- package/dist/cjs/clients/HubPoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +1 -1
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +1 -1
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockConfigStoreClient.js +2 -2
- package/dist/cjs/clients/mocks/MockConfigStoreClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js +5 -5
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/cjs/interfaces/Common.d.ts +2 -2
- package/dist/cjs/utils/EventUtils.d.ts +1 -2
- package/dist/cjs/utils/EventUtils.js +12 -21
- package/dist/cjs/utils/EventUtils.js.map +1 -1
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +11 -15
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js +7 -58
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +3 -3
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +20 -48
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js +3 -5
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/esm/clients/HubPoolClient.js +6 -6
- package/dist/esm/clients/HubPoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +2 -2
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +1 -1
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockConfigStoreClient.js +3 -3
- package/dist/esm/clients/mocks/MockConfigStoreClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSpokePoolClient.js +5 -5
- package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/esm/interfaces/Common.d.ts +2 -2
- package/dist/esm/utils/EventUtils.d.ts +1 -2
- package/dist/esm/utils/EventUtils.js +10 -18
- package/dist/esm/utils/EventUtils.js.map +1 -1
- package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
- package/dist/types/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/BundleDataClient.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/FillUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +20 -48
- package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts.map +1 -1
- 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/mocks/MockConfigStoreClient.d.ts.map +1 -1
- package/dist/types/interfaces/Common.d.ts +2 -2
- package/dist/types/interfaces/Common.d.ts.map +1 -1
- package/dist/types/utils/EventUtils.d.ts +1 -2
- package/dist/types/utils/EventUtils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +15 -17
- package/src/clients/BundleDataClient/BundleDataClient.ts +5 -107
- package/src/clients/BundleDataClient/utils/FillUtils.ts +12 -6
- package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +3 -7
- package/src/clients/HubPoolClient.ts +10 -7
- package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +1 -2
- package/src/clients/SpokePoolClient/SpokePoolClient.ts +1 -1
- package/src/clients/mocks/MockConfigStoreClient.ts +3 -10
- package/src/clients/mocks/MockSpokePoolClient.ts +5 -5
- package/src/interfaces/Common.ts +2 -2
- package/src/utils/EventUtils.ts +13 -19
|
@@ -48,15 +48,11 @@ const V3RelayDataSS = {
|
|
|
48
48
|
message: string(),
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
const SortableEventSS = {
|
|
52
52
|
blockNumber: number(),
|
|
53
|
+
transactionIndex: number(),
|
|
53
54
|
logIndex: number(),
|
|
54
|
-
|
|
55
|
-
txnRef: optional(string()),
|
|
56
|
-
txnIndex: optional(number()),
|
|
57
|
-
|
|
58
|
-
transactionHash: optional(string()),
|
|
59
|
-
transactionIndex: optional(number()),
|
|
55
|
+
transactionHash: string(),
|
|
60
56
|
};
|
|
61
57
|
|
|
62
58
|
const V3DepositSS = {
|
|
@@ -884,13 +884,11 @@ export class HubPoolClient extends BaseAbstractClient {
|
|
|
884
884
|
if (eventsToQuery.includes("CrossChainContractsSet")) {
|
|
885
885
|
for (const event of events["CrossChainContractsSet"]) {
|
|
886
886
|
const args = spreadEventWithBlockNumber(event) as CrossChainContractsSet;
|
|
887
|
-
const dataToAdd
|
|
887
|
+
const dataToAdd = {
|
|
888
888
|
spokePool: args.spokePool,
|
|
889
889
|
blockNumber: args.blockNumber,
|
|
890
|
-
|
|
890
|
+
transactionIndex: args.transactionIndex,
|
|
891
891
|
logIndex: args.logIndex,
|
|
892
|
-
txnIndex: args.txnIndex,
|
|
893
|
-
l2ChainId: args.l2ChainId,
|
|
894
892
|
};
|
|
895
893
|
// If the chain is SVM then our `args.spokePool` will be set to the `solanaSpokePool.toAddressUnchecked()` in the
|
|
896
894
|
// hubpool event because our hub deals with `address` types and not byte32. Therefore, we should confirm that the
|
|
@@ -948,9 +946,9 @@ export class HubPoolClient extends BaseAbstractClient {
|
|
|
948
946
|
l1Token: args.l1Token,
|
|
949
947
|
l2Token: destinationToken,
|
|
950
948
|
blockNumber: args.blockNumber,
|
|
951
|
-
|
|
949
|
+
transactionIndex: args.transactionIndex,
|
|
952
950
|
logIndex: args.logIndex,
|
|
953
|
-
|
|
951
|
+
transactionHash: args.transactionHash,
|
|
954
952
|
},
|
|
955
953
|
]
|
|
956
954
|
);
|
|
@@ -996,7 +994,12 @@ export class HubPoolClient extends BaseAbstractClient {
|
|
|
996
994
|
this.proposedRootBundles.push(
|
|
997
995
|
...events["ProposeRootBundle"]
|
|
998
996
|
.filter((event) => !this.configOverride.ignoredHubProposedBundles.includes(event.blockNumber))
|
|
999
|
-
.map((event) =>
|
|
997
|
+
.map((event) => {
|
|
998
|
+
return {
|
|
999
|
+
...spreadEventWithBlockNumber(event),
|
|
1000
|
+
transactionHash: event.transactionHash,
|
|
1001
|
+
} as ProposedRootBundle;
|
|
1002
|
+
})
|
|
1000
1003
|
);
|
|
1001
1004
|
}
|
|
1002
1005
|
|
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
} from "../../utils";
|
|
20
20
|
import {
|
|
21
21
|
EventSearchConfig,
|
|
22
|
-
logToSortableEvent,
|
|
23
22
|
paginatedEventQuery,
|
|
24
23
|
sortEventsAscendingInPlace,
|
|
25
24
|
spreadEventWithBlockNumber,
|
|
@@ -128,7 +127,7 @@ export class EVMSpokePoolClient extends SpokePoolClient {
|
|
|
128
127
|
}
|
|
129
128
|
|
|
130
129
|
// Sort all events to ensure they are stored in a consistent order.
|
|
131
|
-
events.forEach((events) => sortEventsAscendingInPlace(events
|
|
130
|
+
events.forEach((events) => sortEventsAscendingInPlace(events));
|
|
132
131
|
|
|
133
132
|
return {
|
|
134
133
|
success: true,
|
|
@@ -401,7 +401,7 @@ export abstract class SpokePoolClient extends BaseAbstractClient {
|
|
|
401
401
|
|
|
402
402
|
// Log any invalid deposits with same deposit id but different params.
|
|
403
403
|
const invalidFillsForDeposit = invalidFills.filter((x) => {
|
|
404
|
-
const txnUid = `${x.
|
|
404
|
+
const txnUid = `${x.transactionHash}:${x.logIndex}`;
|
|
405
405
|
// if txnUid doesn't exist in the invalidFills set, add it now, but log the corresponding fill.
|
|
406
406
|
const newInvalidFill = x.depositId.eq(deposit.depositId) && !this.invalidFills.has(txnUid);
|
|
407
407
|
if (newInvalidFill) {
|
|
@@ -2,14 +2,7 @@ import assert from "assert";
|
|
|
2
2
|
import winston from "winston";
|
|
3
3
|
import { Contract, ethers } from "ethers";
|
|
4
4
|
import { Log } from "../../interfaces";
|
|
5
|
-
import {
|
|
6
|
-
getCurrentTime,
|
|
7
|
-
EventSearchConfig,
|
|
8
|
-
MakeOptional,
|
|
9
|
-
isDefined,
|
|
10
|
-
utf8ToHex,
|
|
11
|
-
spreadEventWithBlockNumber,
|
|
12
|
-
} from "../../utils";
|
|
5
|
+
import { getCurrentTime, EventSearchConfig, MakeOptional, isDefined, utf8ToHex } from "../../utils";
|
|
13
6
|
import {
|
|
14
7
|
AcrossConfigStoreClient,
|
|
15
8
|
ConfigStoreUpdate,
|
|
@@ -99,9 +92,9 @@ export class MockConfigStoreClient extends AcrossConfigStoreClient {
|
|
|
99
92
|
chainId: this.chainId as number,
|
|
100
93
|
searchEndBlock: this.eventSearchConfig.toBlock || latestBlockSearched,
|
|
101
94
|
events: {
|
|
102
|
-
updatedGlobalConfigEvents: events["UpdatedGlobalConfig"]
|
|
95
|
+
updatedGlobalConfigEvents: events["UpdatedGlobalConfig"],
|
|
103
96
|
globalConfigUpdateTimes,
|
|
104
|
-
updatedTokenConfigEvents: events["UpdatedTokenConfig"]
|
|
97
|
+
updatedTokenConfigEvents: events["UpdatedTokenConfig"],
|
|
105
98
|
},
|
|
106
99
|
});
|
|
107
100
|
}
|
|
@@ -129,7 +129,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
protected _deposit(event: string, deposit: Omit<Deposit, "messageHash"> & Partial<SortableEvent>): Log {
|
|
132
|
-
const { blockNumber,
|
|
132
|
+
const { blockNumber, transactionIndex } = deposit;
|
|
133
133
|
let { depositId, destinationChainId, inputAmount, outputAmount } = deposit;
|
|
134
134
|
depositId ??= this.numberOfDeposits;
|
|
135
135
|
this.numberOfDeposits = depositId.add(bnOne);
|
|
@@ -171,7 +171,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
171
171
|
topics: topics.map((topic) => topic.toString()),
|
|
172
172
|
args,
|
|
173
173
|
blockNumber,
|
|
174
|
-
transactionIndex
|
|
174
|
+
transactionIndex,
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
177
|
|
|
@@ -187,7 +187,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
187
187
|
event: string,
|
|
188
188
|
fill: Omit<Fill, "messageHash"> & { message: string } & Partial<SortableEvent>
|
|
189
189
|
): Log {
|
|
190
|
-
const { blockNumber,
|
|
190
|
+
const { blockNumber, transactionIndex } = fill;
|
|
191
191
|
let { originChainId, depositId, inputAmount, outputAmount, fillDeadline } = fill;
|
|
192
192
|
originChainId ??= random(1, 42161, false);
|
|
193
193
|
depositId ??= BigNumber.from(random(1, 100_000, false));
|
|
@@ -260,7 +260,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
260
260
|
topics: topics.map((topic) => topic.toString()),
|
|
261
261
|
args,
|
|
262
262
|
blockNumber,
|
|
263
|
-
transactionIndex
|
|
263
|
+
transactionIndex,
|
|
264
264
|
});
|
|
265
265
|
}
|
|
266
266
|
|
|
@@ -335,7 +335,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
335
335
|
exclusiveRelayer: addressModifier(args.exclusiveRelayer ?? ZERO_ADDRESS),
|
|
336
336
|
},
|
|
337
337
|
blockNumber: request.blockNumber,
|
|
338
|
-
transactionIndex: request.
|
|
338
|
+
transactionIndex: request.transactionIndex,
|
|
339
339
|
});
|
|
340
340
|
}
|
|
341
341
|
|
package/src/interfaces/Common.ts
CHANGED
package/src/utils/EventUtils.ts
CHANGED
|
@@ -204,19 +204,13 @@ export function getPaginatedBlockRanges({
|
|
|
204
204
|
return ranges;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
export function logToSortableEvent(log: Log): SortableEvent {
|
|
208
|
-
return {
|
|
209
|
-
txnIndex: log.transactionIndex,
|
|
210
|
-
txnRef: log.transactionHash,
|
|
211
|
-
logIndex: log.logIndex,
|
|
212
|
-
blockNumber: log.blockNumber,
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
|
|
216
207
|
export function spreadEventWithBlockNumber(event: Log): SortableEvent {
|
|
217
208
|
return {
|
|
218
209
|
...spreadEvent(event.args),
|
|
219
|
-
|
|
210
|
+
blockNumber: event.blockNumber,
|
|
211
|
+
transactionIndex: event.transactionIndex,
|
|
212
|
+
logIndex: event.logIndex,
|
|
213
|
+
transactionHash: event.transactionHash,
|
|
220
214
|
};
|
|
221
215
|
}
|
|
222
216
|
|
|
@@ -232,8 +226,8 @@ export function sortEventsAscendingInPlace<T extends SortableEvent>(events: T[])
|
|
|
232
226
|
if (ex.blockNumber !== ey.blockNumber) {
|
|
233
227
|
return ex.blockNumber - ey.blockNumber;
|
|
234
228
|
}
|
|
235
|
-
if (ex.
|
|
236
|
-
return ex.
|
|
229
|
+
if (ex.transactionIndex !== ey.transactionIndex) {
|
|
230
|
+
return ex.transactionIndex - ey.transactionIndex;
|
|
237
231
|
}
|
|
238
232
|
return ex.logIndex - ey.logIndex;
|
|
239
233
|
});
|
|
@@ -251,8 +245,8 @@ export function sortEventsDescendingInPlace<T extends SortableEvent>(events: T[]
|
|
|
251
245
|
if (ex.blockNumber !== ey.blockNumber) {
|
|
252
246
|
return ey.blockNumber - ex.blockNumber;
|
|
253
247
|
}
|
|
254
|
-
if (ex.
|
|
255
|
-
return ey.
|
|
248
|
+
if (ex.transactionIndex !== ey.transactionIndex) {
|
|
249
|
+
return ey.transactionIndex - ex.transactionIndex;
|
|
256
250
|
}
|
|
257
251
|
return ey.logIndex - ex.logIndex;
|
|
258
252
|
});
|
|
@@ -263,16 +257,16 @@ export function isEventOlder<T extends SortableEvent>(ex: T, ey: T): boolean {
|
|
|
263
257
|
if (ex.blockNumber !== ey.blockNumber) {
|
|
264
258
|
return ex.blockNumber < ey.blockNumber;
|
|
265
259
|
}
|
|
266
|
-
if (ex.
|
|
267
|
-
return ex.
|
|
260
|
+
if (ex.transactionIndex !== ey.transactionIndex) {
|
|
261
|
+
return ex.transactionIndex < ey.transactionIndex;
|
|
268
262
|
}
|
|
269
263
|
return ex.logIndex < ey.logIndex;
|
|
270
264
|
}
|
|
271
265
|
|
|
272
|
-
export function
|
|
273
|
-
return [...Array.from(new Set(events.map((e) => e.
|
|
266
|
+
export function getTransactionHashes(events: SortableEvent[]): string[] {
|
|
267
|
+
return [...Array.from(new Set(events.map((e) => e.transactionHash)))];
|
|
274
268
|
}
|
|
275
269
|
|
|
276
270
|
export function duplicateEvent(a: SortableEvent, b: SortableEvent): boolean {
|
|
277
|
-
return a.
|
|
271
|
+
return a.transactionHash === b.transactionHash && a.logIndex === b.logIndex;
|
|
278
272
|
}
|