@across-protocol/sdk 4.1.45 → 4.1.46-beta.1
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 +38 -27
- 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 +2 -1
- package/dist/cjs/clients/mocks/MockHubPoolClient.js +18 -1
- 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 +0 -1
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/cjs/utils/AddressUtils.d.ts +1 -0
- package/dist/cjs/utils/AddressUtils.js +3 -0
- package/dist/cjs/utils/AddressUtils.js.map +1 -1
- package/dist/cjs/utils/EventUtils.d.ts +2 -1
- package/dist/cjs/utils/EventUtils.js +21 -12
- 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 +46 -36
- 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 +2 -1
- package/dist/esm/clients/mocks/MockHubPoolClient.js +18 -1
- 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 +0 -1
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/esm/utils/AddressUtils.d.ts +1 -0
- package/dist/esm/utils/AddressUtils.js +3 -0
- package/dist/esm/utils/AddressUtils.js.map +1 -1
- package/dist/esm/utils/EventUtils.d.ts +2 -1
- package/dist/esm/utils/EventUtils.js +18 -10
- 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 +2 -1
- 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 +0 -1
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
- package/dist/types/utils/AddressUtils.d.ts +1 -0
- package/dist/types/utils/AddressUtils.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 +56 -47
- 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 +26 -2
- 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 +0 -1
- package/src/utils/AddressUtils.ts +4 -0
- package/src/utils/EventUtils.ts +19 -13
- package/src/utils/TokenUtils.ts +2 -0
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
|
|
|
@@ -226,8 +232,8 @@ export function sortEventsAscendingInPlace<T extends SortableEvent>(events: T[])
|
|
|
226
232
|
if (ex.blockNumber !== ey.blockNumber) {
|
|
227
233
|
return ex.blockNumber - ey.blockNumber;
|
|
228
234
|
}
|
|
229
|
-
if (ex.
|
|
230
|
-
return ex.
|
|
235
|
+
if (ex.txnIndex !== ey.txnIndex) {
|
|
236
|
+
return ex.txnIndex - ey.txnIndex;
|
|
231
237
|
}
|
|
232
238
|
return ex.logIndex - ey.logIndex;
|
|
233
239
|
});
|
|
@@ -245,8 +251,8 @@ export function sortEventsDescendingInPlace<T extends SortableEvent>(events: T[]
|
|
|
245
251
|
if (ex.blockNumber !== ey.blockNumber) {
|
|
246
252
|
return ey.blockNumber - ex.blockNumber;
|
|
247
253
|
}
|
|
248
|
-
if (ex.
|
|
249
|
-
return ey.
|
|
254
|
+
if (ex.txnIndex !== ey.txnIndex) {
|
|
255
|
+
return ey.txnIndex - ex.txnIndex;
|
|
250
256
|
}
|
|
251
257
|
return ey.logIndex - ex.logIndex;
|
|
252
258
|
});
|
|
@@ -257,16 +263,16 @@ export function isEventOlder<T extends SortableEvent>(ex: T, ey: T): boolean {
|
|
|
257
263
|
if (ex.blockNumber !== ey.blockNumber) {
|
|
258
264
|
return ex.blockNumber < ey.blockNumber;
|
|
259
265
|
}
|
|
260
|
-
if (ex.
|
|
261
|
-
return ex.
|
|
266
|
+
if (ex.txnIndex !== ey.txnIndex) {
|
|
267
|
+
return ex.txnIndex < ey.txnIndex;
|
|
262
268
|
}
|
|
263
269
|
return ex.logIndex < ey.logIndex;
|
|
264
270
|
}
|
|
265
271
|
|
|
266
|
-
export function
|
|
267
|
-
return [...Array.from(new Set(events.map((e) => e.
|
|
272
|
+
export function getTransactionRefs(events: SortableEvent[]): string[] {
|
|
273
|
+
return [...Array.from(new Set(events.map((e) => e.txnRef)))];
|
|
268
274
|
}
|
|
269
275
|
|
|
270
276
|
export function duplicateEvent(a: SortableEvent, b: SortableEvent): boolean {
|
|
271
|
-
return a.
|
|
277
|
+
return a.txnRef === b.txnRef && a.logIndex === b.logIndex;
|
|
272
278
|
}
|
package/src/utils/TokenUtils.ts
CHANGED
|
@@ -147,6 +147,8 @@ export function getUsdcSymbol(l2Token: string, chainId: number): string | undefi
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
export function getL1TokenInfo(l2TokenAddress: string, chainId: number): L1Token {
|
|
150
|
+
if (chainId === CHAIN_IDs.MAINNET)
|
|
151
|
+
throw new Error("chainId should be an L2 chainId because many mappings re-use the same L1 token address");
|
|
150
152
|
const tokenObject = Object.values(TOKEN_SYMBOLS_MAP).find(({ addresses }) => addresses[chainId] === l2TokenAddress);
|
|
151
153
|
const l1TokenAddress = tokenObject?.addresses[CHAIN_IDs.MAINNET];
|
|
152
154
|
if (!l1TokenAddress) {
|