@across-protocol/sdk 4.1.46 → 4.1.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/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +15 -11
- package/dist/cjs/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js +52 -6
- package/dist/cjs/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +48 -20
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js +8 -6
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/cjs/clients/HubPoolClient.d.ts +0 -3
- package/dist/cjs/clients/HubPoolClient.js +6 -16
- 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/MockHubPoolClient.d.ts +0 -3
- package/dist/cjs/clients/mocks/MockHubPoolClient.js +0 -7
- package/dist/cjs/clients/mocks/MockHubPoolClient.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/relayFeeCalculator/chain-queries/baseQuery.d.ts +0 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js +0 -5
- package/dist/cjs/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +1 -1
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +6 -8
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/cjs/utils/EventUtils.d.ts +2 -1
- package/dist/cjs/utils/EventUtils.js +18 -27
- package/dist/cjs/utils/EventUtils.js.map +1 -1
- package/dist/cjs/utils/TokenUtils.js +2 -0
- package/dist/cjs/utils/TokenUtils.js.map +1 -1
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.d.ts +3 -3
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js +15 -11
- package/dist/esm/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js +58 -7
- package/dist/esm/clients/BundleDataClient/BundleDataClient.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js +1 -1
- package/dist/esm/clients/BundleDataClient/utils/FillUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +48 -20
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js +5 -3
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/esm/clients/HubPoolClient.d.ts +0 -10
- package/dist/esm/clients/HubPoolClient.js +7 -24
- 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/MockHubPoolClient.d.ts +0 -3
- package/dist/esm/clients/mocks/MockHubPoolClient.js +0 -7
- package/dist/esm/clients/mocks/MockHubPoolClient.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/relayFeeCalculator/chain-queries/baseQuery.d.ts +0 -6
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js +0 -10
- package/dist/esm/relayFeeCalculator/chain-queries/baseQuery.js.map +1 -1
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +11 -2
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +7 -8
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/esm/utils/EventUtils.d.ts +2 -1
- package/dist/esm/utils/EventUtils.js +15 -25
- package/dist/esm/utils/EventUtils.js.map +1 -1
- package/dist/esm/utils/TokenUtils.js +2 -0
- package/dist/esm/utils/TokenUtils.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 +48 -20
- package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts.map +1 -1
- package/dist/types/clients/HubPoolClient.d.ts +0 -10
- 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/clients/mocks/MockHubPoolClient.d.ts +0 -3
- package/dist/types/clients/mocks/MockHubPoolClient.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/relayFeeCalculator/chain-queries/baseQuery.d.ts +0 -6
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +11 -2
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
- package/dist/types/utils/EventUtils.d.ts +2 -1
- package/dist/types/utils/EventUtils.d.ts.map +1 -1
- package/dist/types/utils/TokenUtils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/clients/AcrossConfigStoreClient/AcrossConfigStoreClient.ts +17 -15
- package/src/clients/BundleDataClient/BundleDataClient.ts +107 -5
- package/src/clients/BundleDataClient/utils/FillUtils.ts +1 -3
- package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +7 -3
- package/src/clients/HubPoolClient.ts +7 -33
- package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +2 -1
- package/src/clients/SpokePoolClient/SpokePoolClient.ts +1 -1
- package/src/clients/mocks/MockConfigStoreClient.ts +10 -3
- package/src/clients/mocks/MockHubPoolClient.ts +0 -9
- package/src/clients/mocks/MockSpokePoolClient.ts +5 -5
- package/src/interfaces/Common.ts +2 -2
- package/src/relayFeeCalculator/chain-queries/baseQuery.ts +0 -10
- package/src/relayFeeCalculator/relayFeeCalculator.ts +7 -8
- package/src/utils/EventUtils.ts +20 -32
- package/src/utils/TokenUtils.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/EventUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAoB,GAAG,OAAO,GAAG,SAAS,CAWrH;AAED,wBAAgB,4BAA4B,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAM5E;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,gBAAgB,EAAE,gBAAgB,EAClC,QAAQ,GAAE,QAAmB,GAC5B,OAAO,CAAC,SAAS,CAAC,CAGpB;AAED,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAI1D;AAED,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAIzD;AAED,wBAAgB,YAAY,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAc7E;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAOlF;AAED,wBAAgB,cAAc,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAe/E"}
|
package/package.json
CHANGED
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
DisabledChainsUpdate,
|
|
25
25
|
GlobalConfigUpdate,
|
|
26
26
|
LiteChainsIdListUpdate,
|
|
27
|
-
Log,
|
|
28
27
|
ParsedTokenConfig,
|
|
29
28
|
RateModelUpdate,
|
|
30
29
|
RouteRateModelUpdate,
|
|
@@ -43,8 +42,8 @@ type ConfigStoreUpdateSuccess = {
|
|
|
43
42
|
chainId: number;
|
|
44
43
|
searchEndBlock: number;
|
|
45
44
|
events: {
|
|
46
|
-
updatedTokenConfigEvents:
|
|
47
|
-
updatedGlobalConfigEvents:
|
|
45
|
+
updatedTokenConfigEvents: SortableEvent[];
|
|
46
|
+
updatedGlobalConfigEvents: SortableEvent[];
|
|
48
47
|
globalConfigUpdateTimes: number[];
|
|
49
48
|
};
|
|
50
49
|
};
|
|
@@ -341,8 +340,13 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
|
|
|
341
340
|
paginatedEventQuery(this.configStore, this.configStore.filters.UpdatedGlobalConfig(), searchConfig),
|
|
342
341
|
]);
|
|
343
342
|
|
|
343
|
+
const updatedTokenConfigSortableEvents = updatedTokenConfigEvents.map(spreadEventWithBlockNumber);
|
|
344
|
+
const updatedGlobalConfigSortableEvents = updatedGlobalConfigEvents.map(spreadEventWithBlockNumber);
|
|
345
|
+
|
|
344
346
|
// Events *should* normally be received in ascending order, but explicitly enforce the ordering.
|
|
345
|
-
[
|
|
347
|
+
[updatedTokenConfigSortableEvents, updatedGlobalConfigSortableEvents].forEach((events) =>
|
|
348
|
+
sortEventsAscendingInPlace(events)
|
|
349
|
+
);
|
|
346
350
|
|
|
347
351
|
const globalConfigUpdateTimes = (
|
|
348
352
|
await Promise.all(updatedGlobalConfigEvents.map((event) => this.configStore.provider.getBlock(event.blockNumber)))
|
|
@@ -353,8 +357,8 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
|
|
|
353
357
|
chainId,
|
|
354
358
|
searchEndBlock: searchConfig.toBlock,
|
|
355
359
|
events: {
|
|
356
|
-
updatedTokenConfigEvents,
|
|
357
|
-
updatedGlobalConfigEvents,
|
|
360
|
+
updatedTokenConfigEvents: updatedTokenConfigSortableEvents,
|
|
361
|
+
updatedGlobalConfigEvents: updatedGlobalConfigSortableEvents,
|
|
358
362
|
globalConfigUpdateTimes,
|
|
359
363
|
},
|
|
360
364
|
};
|
|
@@ -380,13 +384,11 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
|
|
|
380
384
|
// Save new TokenConfig updates.
|
|
381
385
|
for (const event of updatedTokenConfigEvents) {
|
|
382
386
|
// If transaction hash is known to be invalid, skip it immediately to avoid creating extra logs.
|
|
383
|
-
if (KNOWN_INVALID_TOKEN_CONFIG_UPDATE_HASHES.includes(event.
|
|
387
|
+
if (KNOWN_INVALID_TOKEN_CONFIG_UPDATE_HASHES.includes(event.txnRef.toLowerCase())) {
|
|
384
388
|
continue;
|
|
385
389
|
}
|
|
386
390
|
|
|
387
|
-
const args =
|
|
388
|
-
...(spreadEventWithBlockNumber(event) as TokenConfig),
|
|
389
|
-
};
|
|
391
|
+
const args = event as TokenConfig;
|
|
390
392
|
|
|
391
393
|
try {
|
|
392
394
|
const { rateModel, routeRateModel, spokeTargetBalances } = this.validateTokenConfigUpdate(args);
|
|
@@ -418,7 +420,7 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
|
|
|
418
420
|
this.logger.debug({
|
|
419
421
|
at: "ConfigStoreClient::update",
|
|
420
422
|
message: `Skipping invalid historical update at block ${event.blockNumber}`,
|
|
421
|
-
|
|
423
|
+
txnRef: event.txnRef,
|
|
422
424
|
});
|
|
423
425
|
}
|
|
424
426
|
continue;
|
|
@@ -427,7 +429,7 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
|
|
|
427
429
|
|
|
428
430
|
// Save new Global config updates.
|
|
429
431
|
for (let i = 0; i < updatedGlobalConfigEvents.length; i++) {
|
|
430
|
-
const args =
|
|
432
|
+
const args = updatedGlobalConfigEvents[i] as SortableEvent & {
|
|
431
433
|
key: string;
|
|
432
434
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
433
435
|
value: any;
|
|
@@ -562,7 +564,7 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
|
|
|
562
564
|
rateModel: string | undefined;
|
|
563
565
|
routeRateModel: RouteRateModelUpdate["routeRateModel"];
|
|
564
566
|
} {
|
|
565
|
-
const { value, key,
|
|
567
|
+
const { value, key, txnRef } = args;
|
|
566
568
|
const parsedValue = parseJSONWithNumericString(value) as ParsedTokenConfig;
|
|
567
569
|
const l1Token = key;
|
|
568
570
|
|
|
@@ -578,7 +580,7 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
|
|
|
578
580
|
const rateModel = parsedValue.rateModel;
|
|
579
581
|
assert(
|
|
580
582
|
this.isValidRateModel(rateModel),
|
|
581
|
-
`Invalid rateModel UBar for ${l1Token} at transaction ${
|
|
583
|
+
`Invalid rateModel UBar for ${l1Token} at transaction ${txnRef}, ${JSON.stringify(rateModel)}`
|
|
582
584
|
);
|
|
583
585
|
rateModelForToken = JSON.stringify(rateModel);
|
|
584
586
|
|
|
@@ -601,7 +603,7 @@ export class AcrossConfigStoreClient extends BaseAbstractClient {
|
|
|
601
603
|
Object.entries(parsedValue.routeRateModel).map(([path, routeRateModel]) => {
|
|
602
604
|
assert(
|
|
603
605
|
this.isValidRateModel(routeRateModel) &&
|
|
604
|
-
`Invalid routeRateModel UBar for ${path} for ${l1Token} at transaction ${
|
|
606
|
+
`Invalid routeRateModel UBar for ${path} for ${l1Token} at transaction ${txnRef}, ${JSON.stringify(
|
|
605
607
|
routeRateModel
|
|
606
608
|
)}`
|
|
607
609
|
);
|
|
@@ -237,13 +237,115 @@ export class BundleDataClient {
|
|
|
237
237
|
{} as Record<number, Record<string, UnderlyingType>>
|
|
238
238
|
);
|
|
239
239
|
|
|
240
|
+
const convertSortableEventFieldsIntoRequiredFields = <
|
|
241
|
+
T extends {
|
|
242
|
+
txnIndex?: number;
|
|
243
|
+
transactionIndex?: number;
|
|
244
|
+
txnRef?: string;
|
|
245
|
+
transactionHash?: string;
|
|
246
|
+
},
|
|
247
|
+
>(
|
|
248
|
+
data: T[]
|
|
249
|
+
): Array<
|
|
250
|
+
Omit<T, "txnIndex" | "transactionIndex" | "txnRef" | "transactionHash"> & {
|
|
251
|
+
txnIndex: number;
|
|
252
|
+
txnRef: string;
|
|
253
|
+
}
|
|
254
|
+
> => {
|
|
255
|
+
return data.map((item) => {
|
|
256
|
+
// For txnIndex/transactionIndex: throw if both are defined or both are missing.
|
|
257
|
+
if (
|
|
258
|
+
(item.txnIndex !== undefined && item.transactionIndex !== undefined) ||
|
|
259
|
+
(item.txnIndex === undefined && item.transactionIndex === undefined)
|
|
260
|
+
) {
|
|
261
|
+
throw new Error("Either txnIndex or transactionIndex must be defined, but not both.");
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// For txnRef/transactionHash: throw if both are defined or both are missing.
|
|
265
|
+
if (
|
|
266
|
+
(item.txnRef !== undefined && item.transactionHash !== undefined) ||
|
|
267
|
+
(item.txnRef === undefined && item.transactionHash === undefined)
|
|
268
|
+
) {
|
|
269
|
+
throw new Error("Either txnRef or transactionHash must be defined, but not both.");
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// Destructure the fields we don't need anymore
|
|
273
|
+
const { txnIndex, transactionIndex, txnRef, transactionHash, ...rest } = item;
|
|
274
|
+
|
|
275
|
+
// Return a new object with normalized fields.
|
|
276
|
+
// The non-null assertion (!) is safe here because our conditions ensure that one of each pair is defined.
|
|
277
|
+
return {
|
|
278
|
+
...rest,
|
|
279
|
+
txnIndex: txnIndex ?? transactionIndex!,
|
|
280
|
+
txnRef: txnRef ?? transactionHash!,
|
|
281
|
+
};
|
|
282
|
+
});
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
const convertEmbeddedSortableEventFieldsIntoRequiredFields = <
|
|
286
|
+
T extends {
|
|
287
|
+
txnIndex?: number;
|
|
288
|
+
transactionIndex?: number;
|
|
289
|
+
txnRef?: string;
|
|
290
|
+
transactionHash?: string;
|
|
291
|
+
},
|
|
292
|
+
>(
|
|
293
|
+
data: Record<string, Record<string, T[]>>
|
|
294
|
+
) => {
|
|
295
|
+
return Object.fromEntries(
|
|
296
|
+
Object.entries(data).map(([chainId, tokenData]) => [
|
|
297
|
+
chainId,
|
|
298
|
+
Object.fromEntries(
|
|
299
|
+
Object.entries(tokenData).map(([token, data]) => [
|
|
300
|
+
token,
|
|
301
|
+
convertSortableEventFieldsIntoRequiredFields(data),
|
|
302
|
+
])
|
|
303
|
+
),
|
|
304
|
+
])
|
|
305
|
+
);
|
|
306
|
+
};
|
|
307
|
+
|
|
240
308
|
const data = persistedData[0].data;
|
|
309
|
+
|
|
310
|
+
// This section processes and transforms bundle data loaded from Arweave storage into the correct format:
|
|
311
|
+
// 1. Each field (bundleFillsV3, expiredDepositsToRefundV3, etc.) contains nested records keyed by chainId and token
|
|
312
|
+
// 2. The chainId keys are converted from strings to numbers using convertTypedStringRecordIntoNumericRecord
|
|
313
|
+
// 3. For arrays of events (fills, deposits, etc.), the transaction fields are normalized:
|
|
314
|
+
// - txnIndex/transactionIndex -> txnIndex
|
|
315
|
+
// - txnRef/transactionHash -> txnRef
|
|
316
|
+
// This ensures consistent field names across all event objects
|
|
317
|
+
// 4. The data structure maintains all other fields like refunds, totalRefundAmount, and realizedLpFees
|
|
241
318
|
const bundleData = {
|
|
242
|
-
bundleFillsV3: convertTypedStringRecordIntoNumericRecord(
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
319
|
+
bundleFillsV3: convertTypedStringRecordIntoNumericRecord(
|
|
320
|
+
Object.fromEntries(
|
|
321
|
+
Object.entries(data.bundleFillsV3).map(([chainId, tokenData]) => [
|
|
322
|
+
chainId,
|
|
323
|
+
Object.fromEntries(
|
|
324
|
+
Object.entries(tokenData).map(([token, data]) => [
|
|
325
|
+
token,
|
|
326
|
+
{
|
|
327
|
+
refunds: data.refunds,
|
|
328
|
+
totalRefundAmount: data.totalRefundAmount,
|
|
329
|
+
realizedLpFees: data.realizedLpFees,
|
|
330
|
+
fills: convertSortableEventFieldsIntoRequiredFields(data.fills),
|
|
331
|
+
},
|
|
332
|
+
])
|
|
333
|
+
),
|
|
334
|
+
])
|
|
335
|
+
)
|
|
336
|
+
),
|
|
337
|
+
expiredDepositsToRefundV3: convertTypedStringRecordIntoNumericRecord(
|
|
338
|
+
convertEmbeddedSortableEventFieldsIntoRequiredFields(data.expiredDepositsToRefundV3)
|
|
339
|
+
),
|
|
340
|
+
bundleDepositsV3: convertTypedStringRecordIntoNumericRecord(
|
|
341
|
+
convertEmbeddedSortableEventFieldsIntoRequiredFields(data.bundleDepositsV3)
|
|
342
|
+
),
|
|
343
|
+
unexecutableSlowFills: convertTypedStringRecordIntoNumericRecord(
|
|
344
|
+
convertEmbeddedSortableEventFieldsIntoRequiredFields(data.unexecutableSlowFills)
|
|
345
|
+
),
|
|
346
|
+
bundleSlowFillsV3: convertTypedStringRecordIntoNumericRecord(
|
|
347
|
+
convertEmbeddedSortableEventFieldsIntoRequiredFields(data.bundleSlowFillsV3)
|
|
348
|
+
),
|
|
247
349
|
};
|
|
248
350
|
this.logger.debug({
|
|
249
351
|
at: "BundleDataClient#loadPersistedDataFromArweave",
|
|
@@ -91,9 +91,7 @@ export async function verifyFillRepayment(
|
|
|
91
91
|
if (_repaymentAddressNeedsToBeOverwritten(fill)) {
|
|
92
92
|
// TODO: Handle case where fill was sent on non-EVM chain, in which case the following call would fail
|
|
93
93
|
// or return something unexpected. We'd want to return undefined here.
|
|
94
|
-
|
|
95
|
-
// @todo: If chainIsEvm:
|
|
96
|
-
const fillTransaction = await destinationChainProvider.getTransaction(fill.transactionHash);
|
|
94
|
+
const fillTransaction = await destinationChainProvider.getTransaction(fill.txnRef);
|
|
97
95
|
const destinationRelayer = fillTransaction?.from;
|
|
98
96
|
// Repayment chain is still an EVM chain, but the msg.sender is a bytes32 address, so the fill is invalid.
|
|
99
97
|
if (!isDefined(destinationRelayer) || !isValidEvmAddress(destinationRelayer)) {
|
|
@@ -48,11 +48,15 @@ const V3RelayDataSS = {
|
|
|
48
48
|
message: string(),
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
const SortableEventSS = {
|
|
51
|
+
export const SortableEventSS = {
|
|
52
52
|
blockNumber: number(),
|
|
53
|
-
transactionIndex: number(),
|
|
54
53
|
logIndex: number(),
|
|
55
|
-
|
|
54
|
+
|
|
55
|
+
txnRef: optional(string()),
|
|
56
|
+
txnIndex: optional(number()),
|
|
57
|
+
|
|
58
|
+
transactionHash: optional(string()),
|
|
59
|
+
transactionIndex: optional(number()),
|
|
56
60
|
};
|
|
57
61
|
|
|
58
62
|
const V3DepositSS = {
|
|
@@ -43,7 +43,6 @@ import {
|
|
|
43
43
|
toBN,
|
|
44
44
|
getTokenInfo,
|
|
45
45
|
getUsdcSymbol,
|
|
46
|
-
getL1TokenInfo,
|
|
47
46
|
compareAddressesSimple,
|
|
48
47
|
chainIsSvm,
|
|
49
48
|
getDeployedAddress,
|
|
@@ -285,17 +284,6 @@ export class HubPoolClient extends BaseAbstractClient {
|
|
|
285
284
|
return tokenInfo;
|
|
286
285
|
}
|
|
287
286
|
|
|
288
|
-
/**
|
|
289
|
-
* @dev If tokenAddress + chain do not exist in TOKEN_SYMBOLS_MAP then this will throw.
|
|
290
|
-
* @dev if the token matched in TOKEN_SYMBOLS_MAP does not have an L1 token address then this will throw.
|
|
291
|
-
* @param tokenAddress Token address on `chain`
|
|
292
|
-
* @param chain Chain where the `tokenAddress` exists in TOKEN_SYMBOLS_MAP.
|
|
293
|
-
* @returns Token info for the given token address on the Hub chain including symbol and decimal and L1 address.
|
|
294
|
-
*/
|
|
295
|
-
getL1TokenInfoForAddress(tokenAddress: string, chain: number): L1Token {
|
|
296
|
-
return getL1TokenInfo(tokenAddress, chain);
|
|
297
|
-
}
|
|
298
|
-
|
|
299
287
|
/**
|
|
300
288
|
* Resolve a given timestamp to a block number on the HubPool chain.
|
|
301
289
|
* @param timestamp A single timestamp to be resolved to a block number on the HubPool chain.
|
|
@@ -515,17 +503,6 @@ export class HubPoolClient extends BaseAbstractClient {
|
|
|
515
503
|
return this.getTokenInfoForL1Token(l1TokenCounterpart);
|
|
516
504
|
}
|
|
517
505
|
|
|
518
|
-
getTokenInfoForDeposit(deposit: Pick<Deposit, "inputToken" | "originChainId">): L1Token | undefined {
|
|
519
|
-
return this.getTokenInfoForL1Token(
|
|
520
|
-
this.getL1TokenForL2TokenAtBlock(deposit.inputToken, deposit.originChainId, this.latestBlockSearched)
|
|
521
|
-
);
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
getTokenInfo(chainId: number | string, tokenAddress: string): L1Token | undefined {
|
|
525
|
-
const deposit = { originChainId: parseInt(chainId.toString()), inputToken: tokenAddress };
|
|
526
|
-
return this.getTokenInfoForDeposit(deposit);
|
|
527
|
-
}
|
|
528
|
-
|
|
529
506
|
areTokensEquivalent(
|
|
530
507
|
tokenA: string,
|
|
531
508
|
chainIdA: number,
|
|
@@ -907,11 +884,13 @@ export class HubPoolClient extends BaseAbstractClient {
|
|
|
907
884
|
if (eventsToQuery.includes("CrossChainContractsSet")) {
|
|
908
885
|
for (const event of events["CrossChainContractsSet"]) {
|
|
909
886
|
const args = spreadEventWithBlockNumber(event) as CrossChainContractsSet;
|
|
910
|
-
const dataToAdd = {
|
|
887
|
+
const dataToAdd: CrossChainContractsSet = {
|
|
911
888
|
spokePool: args.spokePool,
|
|
912
889
|
blockNumber: args.blockNumber,
|
|
913
|
-
|
|
890
|
+
txnRef: args.txnRef,
|
|
914
891
|
logIndex: args.logIndex,
|
|
892
|
+
txnIndex: args.txnIndex,
|
|
893
|
+
l2ChainId: args.l2ChainId,
|
|
915
894
|
};
|
|
916
895
|
// If the chain is SVM then our `args.spokePool` will be set to the `solanaSpokePool.toAddressUnchecked()` in the
|
|
917
896
|
// hubpool event because our hub deals with `address` types and not byte32. Therefore, we should confirm that the
|
|
@@ -969,9 +948,9 @@ export class HubPoolClient extends BaseAbstractClient {
|
|
|
969
948
|
l1Token: args.l1Token,
|
|
970
949
|
l2Token: destinationToken,
|
|
971
950
|
blockNumber: args.blockNumber,
|
|
972
|
-
|
|
951
|
+
txnIndex: args.txnIndex,
|
|
973
952
|
logIndex: args.logIndex,
|
|
974
|
-
|
|
953
|
+
txnRef: args.txnRef,
|
|
975
954
|
},
|
|
976
955
|
]
|
|
977
956
|
);
|
|
@@ -1017,12 +996,7 @@ export class HubPoolClient extends BaseAbstractClient {
|
|
|
1017
996
|
this.proposedRootBundles.push(
|
|
1018
997
|
...events["ProposeRootBundle"]
|
|
1019
998
|
.filter((event) => !this.configOverride.ignoredHubProposedBundles.includes(event.blockNumber))
|
|
1020
|
-
.map((event) =>
|
|
1021
|
-
return {
|
|
1022
|
-
...spreadEventWithBlockNumber(event),
|
|
1023
|
-
transactionHash: event.transactionHash,
|
|
1024
|
-
} as ProposedRootBundle;
|
|
1025
|
-
})
|
|
999
|
+
.map((event) => spreadEventWithBlockNumber(event) as ProposedRootBundle)
|
|
1026
1000
|
);
|
|
1027
1001
|
}
|
|
1028
1002
|
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
} from "../../utils";
|
|
20
20
|
import {
|
|
21
21
|
EventSearchConfig,
|
|
22
|
+
logToSortableEvent,
|
|
22
23
|
paginatedEventQuery,
|
|
23
24
|
sortEventsAscendingInPlace,
|
|
24
25
|
spreadEventWithBlockNumber,
|
|
@@ -127,7 +128,7 @@ export class EVMSpokePoolClient extends SpokePoolClient {
|
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
// Sort all events to ensure they are stored in a consistent order.
|
|
130
|
-
events.forEach((events) => sortEventsAscendingInPlace(events));
|
|
131
|
+
events.forEach((events) => sortEventsAscendingInPlace(events.map(logToSortableEvent)));
|
|
131
132
|
|
|
132
133
|
return {
|
|
133
134
|
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.txnRef}:${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,7 +2,14 @@ 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 {
|
|
5
|
+
import {
|
|
6
|
+
getCurrentTime,
|
|
7
|
+
EventSearchConfig,
|
|
8
|
+
MakeOptional,
|
|
9
|
+
isDefined,
|
|
10
|
+
utf8ToHex,
|
|
11
|
+
spreadEventWithBlockNumber,
|
|
12
|
+
} from "../../utils";
|
|
6
13
|
import {
|
|
7
14
|
AcrossConfigStoreClient,
|
|
8
15
|
ConfigStoreUpdate,
|
|
@@ -92,9 +99,9 @@ export class MockConfigStoreClient extends AcrossConfigStoreClient {
|
|
|
92
99
|
chainId: this.chainId as number,
|
|
93
100
|
searchEndBlock: this.eventSearchConfig.toBlock || latestBlockSearched,
|
|
94
101
|
events: {
|
|
95
|
-
updatedGlobalConfigEvents: events["UpdatedGlobalConfig"],
|
|
102
|
+
updatedGlobalConfigEvents: events["UpdatedGlobalConfig"].map(spreadEventWithBlockNumber),
|
|
96
103
|
globalConfigUpdateTimes,
|
|
97
|
-
updatedTokenConfigEvents: events["UpdatedTokenConfig"],
|
|
104
|
+
updatedTokenConfigEvents: events["UpdatedTokenConfig"].map(spreadEventWithBlockNumber),
|
|
98
105
|
},
|
|
99
106
|
});
|
|
100
107
|
}
|
|
@@ -23,7 +23,6 @@ export class MockHubPoolClient extends HubPoolClient {
|
|
|
23
23
|
private realizedLpFeePctOverride = false;
|
|
24
24
|
|
|
25
25
|
private l1TokensMock: L1Token[] = []; // L1Tokens and their associated info.
|
|
26
|
-
private tokenInfoToReturn: L1Token = { address: "", decimals: 0, symbol: "" };
|
|
27
26
|
|
|
28
27
|
private spokePoolTokens: { [l1Token: string]: { [chainId: number]: string } } = {};
|
|
29
28
|
|
|
@@ -91,10 +90,6 @@ export class MockHubPoolClient extends HubPoolClient {
|
|
|
91
90
|
return this.l1TokensMock;
|
|
92
91
|
}
|
|
93
92
|
|
|
94
|
-
getTokenInfoForDeposit() {
|
|
95
|
-
return this.tokenInfoToReturn;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
93
|
setTokenMapping(l1Token: string, chainId: number, l2Token: string) {
|
|
99
94
|
this.spokePoolTokens[l1Token] ??= {};
|
|
100
95
|
this.spokePoolTokens[l1Token][chainId] = l2Token;
|
|
@@ -136,10 +131,6 @@ export class MockHubPoolClient extends HubPoolClient {
|
|
|
136
131
|
return this.l1TokensMock.find((token) => token.address === l1Token);
|
|
137
132
|
}
|
|
138
133
|
|
|
139
|
-
setTokenInfoToReturn(tokenInfo: L1Token) {
|
|
140
|
-
this.tokenInfoToReturn = tokenInfo;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
134
|
_update(eventNames: string[]): Promise<HubPoolUpdate> {
|
|
144
135
|
// Generate new "on chain" responses.
|
|
145
136
|
const latestBlockSearched = this.eventManager.blockNumber;
|
|
@@ -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, txnIndex } = 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: txnIndex,
|
|
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, txnIndex } = 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: txnIndex,
|
|
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.txnIndex,
|
|
339
339
|
});
|
|
340
340
|
}
|
|
341
341
|
|
package/src/interfaces/Common.ts
CHANGED
|
@@ -252,14 +252,4 @@ export class QueryBase implements QueryInterface {
|
|
|
252
252
|
);
|
|
253
253
|
return price;
|
|
254
254
|
}
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Resolves the number of decimal places a token can have
|
|
258
|
-
* @param tokenSymbol A valid Across-Enabled Token ID
|
|
259
|
-
* @returns The number of decimals of precision for the corresponding tokenSymbol
|
|
260
|
-
*/
|
|
261
|
-
getTokenDecimals(tokenSymbol: string): number {
|
|
262
|
-
if (!this.symbolMapping[tokenSymbol]) throw new Error(`${tokenSymbol} does not exist in mapping`);
|
|
263
|
-
return this.symbolMapping[tokenSymbol].decimals;
|
|
264
|
-
}
|
|
265
255
|
}
|
|
@@ -34,7 +34,6 @@ export interface QueryInterface {
|
|
|
34
34
|
}>
|
|
35
35
|
) => Promise<TransactionCostEstimate>;
|
|
36
36
|
getTokenPrice: (tokenSymbol: string) => Promise<number>;
|
|
37
|
-
getTokenDecimals: (tokenSymbol: string) => number;
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
export const expectedCapitalCostsKeys = ["lowerBound", "upperBound", "cutoff", "decimals"];
|
|
@@ -48,6 +47,7 @@ type ChainIdAsString = string;
|
|
|
48
47
|
export interface CapitalCostConfigOverride {
|
|
49
48
|
default: CapitalCostConfig;
|
|
50
49
|
routeOverrides?: Record<ChainIdAsString, Record<ChainIdAsString, CapitalCostConfig>>;
|
|
50
|
+
destinationChainOverrides?: Record<ChainIdAsString, CapitalCostConfig>;
|
|
51
51
|
}
|
|
52
52
|
export type RelayCapitalCostConfig = CapitalCostConfigOverride | CapitalCostConfig;
|
|
53
53
|
export interface BaseRelayFeeCalculatorConfig {
|
|
@@ -190,10 +190,10 @@ export class RelayFeeCalculator {
|
|
|
190
190
|
this.validateCapitalCostsConfig(config.default);
|
|
191
191
|
// Iterate over all the route overrides and validate them.
|
|
192
192
|
for (const toChainIdRoutes of Object.values(config.routeOverrides || {})) {
|
|
193
|
-
|
|
194
|
-
this.validateCapitalCostsConfig(override);
|
|
195
|
-
}
|
|
193
|
+
Object.values(toChainIdRoutes).forEach(this.validateCapitalCostsConfig);
|
|
196
194
|
}
|
|
195
|
+
// Validate destination chain overrides
|
|
196
|
+
Object.values(config.destinationChainOverrides || {}).forEach(this.validateCapitalCostsConfig);
|
|
197
197
|
return config;
|
|
198
198
|
}
|
|
199
199
|
|
|
@@ -311,10 +311,9 @@ export class RelayFeeCalculator {
|
|
|
311
311
|
// bound to an upper bound. After the kink, the fee % increase will be fixed, and slowly approach the upper bound
|
|
312
312
|
// for very large amount inputs.
|
|
313
313
|
else {
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
: tokenCostConfig.default;
|
|
314
|
+
const destinationChainOverride = tokenCostConfig?.destinationChainOverrides?.[_destinationRoute || ""];
|
|
315
|
+
const routeOverride = tokenCostConfig?.routeOverrides?.[_originRoute || ""]?.[_destinationRoute || ""];
|
|
316
|
+
const config: CapitalCostConfig = routeOverride ?? destinationChainOverride ?? tokenCostConfig.default;
|
|
318
317
|
|
|
319
318
|
// Scale amount "y" to 18 decimals.
|
|
320
319
|
const y = toBN(_amountToRelay).mul(toBNWei("1", 18 - config.decimals));
|
package/src/utils/EventUtils.ts
CHANGED
|
@@ -204,13 +204,19 @@ 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
|
+
|
|
207
216
|
export function spreadEventWithBlockNumber(event: Log): SortableEvent {
|
|
208
217
|
return {
|
|
209
218
|
...spreadEvent(event.args),
|
|
210
|
-
|
|
211
|
-
transactionIndex: event.transactionIndex,
|
|
212
|
-
logIndex: event.logIndex,
|
|
213
|
-
transactionHash: event.transactionHash,
|
|
219
|
+
...logToSortableEvent(event),
|
|
214
220
|
};
|
|
215
221
|
}
|
|
216
222
|
|
|
@@ -222,15 +228,9 @@ export function sortEventsAscending<T extends SortableEvent>(events: T[]): T[] {
|
|
|
222
228
|
// This sorts the events in place, meaning it modifies the passed array and returns a reference to the same array.
|
|
223
229
|
// Note: this method should only be used in cases where modifications are acceptable.
|
|
224
230
|
export function sortEventsAscendingInPlace<T extends SortableEvent>(events: T[]): T[] {
|
|
225
|
-
return events.sort((ex, ey) =>
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
if (ex.transactionIndex !== ey.transactionIndex) {
|
|
230
|
-
return ex.transactionIndex - ey.transactionIndex;
|
|
231
|
-
}
|
|
232
|
-
return ex.logIndex - ey.logIndex;
|
|
233
|
-
});
|
|
231
|
+
return events.sort((ex, ey) =>
|
|
232
|
+
ex.blockNumber === ey.blockNumber ? ex.logIndex - ey.logIndex : ex.blockNumber - ey.blockNumber
|
|
233
|
+
);
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
// This copies the array and sorts it, returning a new array with the new ordering.
|
|
@@ -241,32 +241,20 @@ export function sortEventsDescending<T extends SortableEvent>(events: T[]): T[]
|
|
|
241
241
|
// This sorts the events in place, meaning it modifies the passed array and returns a reference to the same array.
|
|
242
242
|
// Note: this method should only be used in cases where modifications are acceptable.
|
|
243
243
|
export function sortEventsDescendingInPlace<T extends SortableEvent>(events: T[]): T[] {
|
|
244
|
-
return events.sort((ex, ey) =>
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
if (ex.transactionIndex !== ey.transactionIndex) {
|
|
249
|
-
return ey.transactionIndex - ex.transactionIndex;
|
|
250
|
-
}
|
|
251
|
-
return ey.logIndex - ex.logIndex;
|
|
252
|
-
});
|
|
244
|
+
return events.sort((ex, ey) =>
|
|
245
|
+
ex.blockNumber === ey.blockNumber ? ey.logIndex - ex.logIndex : ey.blockNumber - ex.blockNumber
|
|
246
|
+
);
|
|
253
247
|
}
|
|
254
248
|
|
|
255
249
|
// Returns true if ex is older than ey.
|
|
256
250
|
export function isEventOlder<T extends SortableEvent>(ex: T, ey: T): boolean {
|
|
257
|
-
|
|
258
|
-
return ex.blockNumber < ey.blockNumber;
|
|
259
|
-
}
|
|
260
|
-
if (ex.transactionIndex !== ey.transactionIndex) {
|
|
261
|
-
return ex.transactionIndex < ey.transactionIndex;
|
|
262
|
-
}
|
|
263
|
-
return ex.logIndex < ey.logIndex;
|
|
251
|
+
return ex.blockNumber === ey.blockNumber ? ex.logIndex < ey.logIndex : ex.blockNumber < ey.blockNumber;
|
|
264
252
|
}
|
|
265
253
|
|
|
266
|
-
export function
|
|
267
|
-
return [...Array.from(new Set(events.map((e) => e.
|
|
254
|
+
export function getTransactionRefs(events: SortableEvent[]): string[] {
|
|
255
|
+
return [...Array.from(new Set(events.map((e) => e.txnRef)))];
|
|
268
256
|
}
|
|
269
257
|
|
|
270
258
|
export function duplicateEvent(a: SortableEvent, b: SortableEvent): boolean {
|
|
271
|
-
return a.
|
|
259
|
+
return a.txnRef === b.txnRef && a.logIndex === b.logIndex;
|
|
272
260
|
}
|