@across-protocol/sdk 4.1.47 → 4.1.49
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/BundleDataClient/utils/SuperstructUtils.d.ts +8 -8
- package/dist/cjs/clients/HubPoolClient.d.ts +0 -1
- package/dist/cjs/clients/HubPoolClient.js +0 -4
- package/dist/cjs/clients/HubPoolClient.js.map +1 -1
- package/dist/cjs/coingecko/Coingecko.js +1 -1
- package/dist/cjs/coingecko/Coingecko.js.map +1 -1
- package/dist/cjs/constants.d.ts +1 -1
- package/dist/cjs/constants.js +4 -1
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/gasPriceOracle/oracle.js +1 -0
- package/dist/cjs/gasPriceOracle/oracle.js.map +1 -1
- package/dist/cjs/relayFeeCalculator/chain-queries/factory.d.ts +56 -0
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +56 -0
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +13 -6
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/cjs/utils/EventUtils.d.ts +7 -5
- package/dist/cjs/utils/EventUtils.js.map +1 -1
- package/dist/cjs/utils/TokenUtils.d.ts +118 -7
- package/dist/cjs/utils/TokenUtils.js +12 -20
- package/dist/cjs/utils/TokenUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +8 -8
- package/dist/esm/clients/HubPoolClient.d.ts +0 -1
- package/dist/esm/clients/HubPoolClient.js +0 -4
- package/dist/esm/clients/HubPoolClient.js.map +1 -1
- package/dist/esm/coingecko/Coingecko.js +1 -1
- package/dist/esm/coingecko/Coingecko.js.map +1 -1
- package/dist/esm/constants.d.ts +1 -1
- package/dist/esm/constants.js +3 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/gasPriceOracle/oracle.js +1 -0
- package/dist/esm/gasPriceOracle/oracle.js.map +1 -1
- package/dist/esm/relayFeeCalculator/chain-queries/factory.d.ts +56 -0
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +61 -11
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +14 -7
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/esm/utils/EventUtils.d.ts +7 -5
- package/dist/esm/utils/EventUtils.js.map +1 -1
- package/dist/esm/utils/TokenUtils.d.ts +138 -15
- package/dist/esm/utils/TokenUtils.js +12 -19
- package/dist/esm/utils/TokenUtils.js.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +8 -8
- package/dist/types/clients/HubPoolClient.d.ts +0 -1
- package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
- package/dist/types/constants.d.ts +1 -1
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/gasPriceOracle/oracle.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts +56 -0
- package/dist/types/relayFeeCalculator/chain-queries/factory.d.ts.map +1 -1
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts +61 -11
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
- package/dist/types/utils/EventUtils.d.ts +7 -5
- package/dist/types/utils/EventUtils.d.ts.map +1 -1
- package/dist/types/utils/TokenUtils.d.ts +138 -15
- package/dist/types/utils/TokenUtils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/clients/HubPoolClient.ts +0 -5
- package/src/coingecko/Coingecko.ts +1 -1
- package/src/constants.ts +3 -0
- package/src/gasPriceOracle/oracle.ts +1 -0
- package/src/relayFeeCalculator/relayFeeCalculator.ts +21 -5
- package/src/utils/EventUtils.ts +7 -5
- package/src/utils/TokenUtils.ts +10 -19
|
@@ -170,6 +170,15 @@ export declare class RelayFeeCalculator {
|
|
|
170
170
|
};
|
|
171
171
|
coingeckoId: string;
|
|
172
172
|
};
|
|
173
|
+
BNB: {
|
|
174
|
+
name: string;
|
|
175
|
+
symbol: string;
|
|
176
|
+
decimals: number;
|
|
177
|
+
addresses: {
|
|
178
|
+
[x: number]: string;
|
|
179
|
+
};
|
|
180
|
+
coingeckoId: string;
|
|
181
|
+
};
|
|
173
182
|
BOBA: {
|
|
174
183
|
name: string;
|
|
175
184
|
symbol: string;
|
|
@@ -179,6 +188,15 @@ export declare class RelayFeeCalculator {
|
|
|
179
188
|
};
|
|
180
189
|
coingeckoId: string;
|
|
181
190
|
};
|
|
191
|
+
CAKE: {
|
|
192
|
+
name: string;
|
|
193
|
+
symbol: string;
|
|
194
|
+
decimals: number;
|
|
195
|
+
addresses: {
|
|
196
|
+
[x: number]: string;
|
|
197
|
+
};
|
|
198
|
+
coingeckoId: string;
|
|
199
|
+
};
|
|
182
200
|
DAI: {
|
|
183
201
|
name: string;
|
|
184
202
|
symbol: string;
|
|
@@ -324,6 +342,16 @@ export declare class RelayFeeCalculator {
|
|
|
324
342
|
};
|
|
325
343
|
coingeckoId: string;
|
|
326
344
|
};
|
|
345
|
+
"USDC-BNB": {
|
|
346
|
+
name: string;
|
|
347
|
+
symbol: string;
|
|
348
|
+
decimals: number;
|
|
349
|
+
addresses: {
|
|
350
|
+
[x: number]: string;
|
|
351
|
+
};
|
|
352
|
+
l1TokenDecimals: number;
|
|
353
|
+
coingeckoId: string;
|
|
354
|
+
};
|
|
327
355
|
USDC: {
|
|
328
356
|
name: string;
|
|
329
357
|
symbol: string;
|
|
@@ -361,6 +389,16 @@ export declare class RelayFeeCalculator {
|
|
|
361
389
|
};
|
|
362
390
|
coingeckoId: string;
|
|
363
391
|
};
|
|
392
|
+
"USDT-BNB": {
|
|
393
|
+
name: string;
|
|
394
|
+
symbol: string;
|
|
395
|
+
decimals: number;
|
|
396
|
+
addresses: {
|
|
397
|
+
[x: number]: string;
|
|
398
|
+
};
|
|
399
|
+
l1TokenDecimals: number;
|
|
400
|
+
coingeckoId: string;
|
|
401
|
+
};
|
|
364
402
|
USDT: {
|
|
365
403
|
name: string;
|
|
366
404
|
symbol: string;
|
|
@@ -370,6 +408,15 @@ export declare class RelayFeeCalculator {
|
|
|
370
408
|
};
|
|
371
409
|
coingeckoId: string;
|
|
372
410
|
};
|
|
411
|
+
VLR: {
|
|
412
|
+
name: string;
|
|
413
|
+
symbol: string;
|
|
414
|
+
decimals: number;
|
|
415
|
+
addresses: {
|
|
416
|
+
[x: number]: string;
|
|
417
|
+
};
|
|
418
|
+
coingeckoId: string;
|
|
419
|
+
};
|
|
373
420
|
WAZERO: {
|
|
374
421
|
name: string;
|
|
375
422
|
symbol: string;
|
|
@@ -394,16 +441,7 @@ export declare class RelayFeeCalculator {
|
|
|
394
441
|
decimals: number;
|
|
395
442
|
addresses: {
|
|
396
443
|
[x: number]: string;
|
|
397
|
-
};
|
|
398
|
-
* Type guard to check if a config is a CapitalCostConfigOverride or a CapitalCostConfig.
|
|
399
|
-
* @param config CapitalCostConfig or CapitalCostConfigOverride
|
|
400
|
-
* @returns true if the config is a CapitalCostConfigOverride, false otherwise.
|
|
401
|
-
* @private
|
|
402
|
-
* @dev This is a type guard that is used to check if a config is a CapitalCostConfigOverride or a CapitalCostConfig.
|
|
403
|
-
* This is needed because the config can be either a CapitalCostConfig or a CapitalCostConfigOverride. If it's a
|
|
404
|
-
* CapitalCostConfig, then we need to convert it to a CapitalCostConfigOverride with the default config set with no route
|
|
405
|
-
* overrides.
|
|
406
|
-
*/
|
|
444
|
+
};
|
|
407
445
|
coingeckoId: string;
|
|
408
446
|
};
|
|
409
447
|
WGHO: {
|
|
@@ -424,6 +462,15 @@ export declare class RelayFeeCalculator {
|
|
|
424
462
|
};
|
|
425
463
|
coingeckoId: string;
|
|
426
464
|
};
|
|
465
|
+
WLD: {
|
|
466
|
+
name: string;
|
|
467
|
+
symbol: string;
|
|
468
|
+
decimals: number;
|
|
469
|
+
addresses: {
|
|
470
|
+
[x: number]: string;
|
|
471
|
+
};
|
|
472
|
+
coingeckoId: string;
|
|
473
|
+
};
|
|
427
474
|
WMATIC: {
|
|
428
475
|
name: string;
|
|
429
476
|
symbol: string;
|
|
@@ -450,7 +497,10 @@ export declare class RelayFeeCalculator {
|
|
|
450
497
|
addresses: {
|
|
451
498
|
[x: number]: string;
|
|
452
499
|
};
|
|
453
|
-
coingeckoId: string;
|
|
500
|
+
coingeckoId: string; /**
|
|
501
|
+
* Validates a CapitalCostConfig.
|
|
502
|
+
* @param capitalCosts CapitalCostConfig
|
|
503
|
+
*/
|
|
454
504
|
};
|
|
455
505
|
}, gasPrice?: BigNumberish, gasLimit?: BigNumberish, _tokenGasCost?: BigNumberish, transport?: Transport): Promise<BigNumber>;
|
|
456
506
|
capitalFeePercent(_amountToRelay: BigNumberish, _tokenSymbol: string, _originRoute?: ChainIdAsString, _destinationRoute?: ChainIdAsString): BigNumber;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relayFeeCalculator.d.ts","sourceRoot":"","sources":["../../../src/relayFeeCalculator/relayFeeCalculator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,SAAS,EACT,YAAY,EAEZ,uBAAuB,
|
|
1
|
+
{"version":3,"file":"relayFeeCalculator.d.ts","sourceRoot":"","sources":["../../../src/relayFeeCalculator/relayFeeCalculator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,SAAS,EACT,YAAY,EAEZ,uBAAuB,EAaxB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAGjC,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,CACX,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,EACrC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,OAAO,CAAC;QAChB,QAAQ,EAAE,YAAY,CAAC;QACvB,QAAQ,EAAE,YAAY,CAAC;QACvB,iBAAiB,EAAE,SAAS,CAAC;QA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AAE,MAAM,EACpB,YAAY,CAAC,EAAE,eAAe,EAC9B,iBAAiB,CAAC,EAAE,eAAe,GAClC,SAAS;IAkDZ;;;;;;;;;;;;;;OAcG;IACG,iBAAiB,CACrB,OAAO,EAAE,OAAO,EAChB,aAAa,CAAC,EAAE,YAAY,EAC5B,gBAAgB,UAAQ,EACxB,cAAc,SAAoC,EAClD,WAAW,CAAC,EAAE,MAAM,EACpB,QAAQ,CAAC,EAAE,YAAY,EACvB,QAAQ,CAAC,EAAE,YAAY,EACvB,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,iBAAiB,CAAC;CAqE9B"}
|
|
@@ -28,11 +28,13 @@ export declare function paginatedEventQuery(contract: Contract, filter: EventFil
|
|
|
28
28
|
export declare function getPaginatedBlockRanges({ fromBlock, toBlock, maxBlockLookBack, }: EventSearchConfig): [number, number][];
|
|
29
29
|
export declare function logToSortableEvent(log: Log): SortableEvent;
|
|
30
30
|
export declare function spreadEventWithBlockNumber(event: Log): SortableEvent;
|
|
31
|
-
|
|
32
|
-
export declare function
|
|
33
|
-
export declare function
|
|
34
|
-
export declare function
|
|
35
|
-
export declare function
|
|
31
|
+
type PartialSortableEvent = Pick<SortableEvent, "blockNumber" | "logIndex">;
|
|
32
|
+
export declare function sortEventsAscending<T extends PartialSortableEvent>(events: T[]): T[];
|
|
33
|
+
export declare function sortEventsAscendingInPlace<T extends PartialSortableEvent>(events: T[]): T[];
|
|
34
|
+
export declare function sortEventsDescending<T extends PartialSortableEvent>(events: T[]): T[];
|
|
35
|
+
export declare function sortEventsDescendingInPlace<T extends PartialSortableEvent>(events: T[]): T[];
|
|
36
|
+
export declare function isEventOlder<T extends PartialSortableEvent>(ex: T, ey: T): boolean;
|
|
36
37
|
export declare function getTransactionRefs(events: SortableEvent[]): string[];
|
|
37
38
|
export declare function duplicateEvent(a: SortableEvent, b: SortableEvent): boolean;
|
|
39
|
+
export {};
|
|
38
40
|
//# sourceMappingURL=EventUtils.d.ts.map
|
|
@@ -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,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAwBnD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAuE1F;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,eAAO,MAAM,UAAU,UAAW,KAAK,KAAG,GAA0E,CAAC;AAErH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,WAAW,EACnB,YAAY,EAAE,iBAAiB,EAC/B,UAAU,SAAI,GACb,OAAO,CAAC,GAAG,EAAE,CAAC,CAgChB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,SAAS,EACT,OAAO,EACP,gBAAgB,GACjB,EAAE,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAuCxC;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,GAAG,GAAG,aAAa,CAO1D;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,GAAG,GAAG,aAAa,CAKpE;
|
|
1
|
+
{"version":3,"file":"EventUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/EventUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,O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,CAAC,CAAC,SAAS,oBAAoB,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAErF;AAID,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,oBAAoB,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAI5F;AAGD,wBAAgB,YAAY,CAAC,CAAC,SAAS,oBAAoB,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,OAAO,CAElF;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,EAAE,CAEpE;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa,GAAG,OAAO,CAE1E"}
|
|
@@ -68,6 +68,15 @@ export declare const resolveContractFromSymbol: (symbol: string, chainId: string
|
|
|
68
68
|
};
|
|
69
69
|
coingeckoId: string;
|
|
70
70
|
};
|
|
71
|
+
BNB: {
|
|
72
|
+
name: string;
|
|
73
|
+
symbol: string;
|
|
74
|
+
decimals: number;
|
|
75
|
+
addresses: {
|
|
76
|
+
[x: number]: string;
|
|
77
|
+
};
|
|
78
|
+
coingeckoId: string;
|
|
79
|
+
};
|
|
71
80
|
BOBA: {
|
|
72
81
|
name: string;
|
|
73
82
|
symbol: string;
|
|
@@ -77,6 +86,15 @@ export declare const resolveContractFromSymbol: (symbol: string, chainId: string
|
|
|
77
86
|
};
|
|
78
87
|
coingeckoId: string;
|
|
79
88
|
};
|
|
89
|
+
CAKE: {
|
|
90
|
+
name: string;
|
|
91
|
+
symbol: string;
|
|
92
|
+
decimals: number;
|
|
93
|
+
addresses: {
|
|
94
|
+
[x: number]: string;
|
|
95
|
+
};
|
|
96
|
+
coingeckoId: string;
|
|
97
|
+
};
|
|
80
98
|
DAI: {
|
|
81
99
|
name: string;
|
|
82
100
|
symbol: string;
|
|
@@ -222,6 +240,16 @@ export declare const resolveContractFromSymbol: (symbol: string, chainId: string
|
|
|
222
240
|
};
|
|
223
241
|
coingeckoId: string;
|
|
224
242
|
};
|
|
243
|
+
"USDC-BNB": {
|
|
244
|
+
name: string;
|
|
245
|
+
symbol: string;
|
|
246
|
+
decimals: number;
|
|
247
|
+
addresses: {
|
|
248
|
+
[x: number]: string;
|
|
249
|
+
};
|
|
250
|
+
l1TokenDecimals: number;
|
|
251
|
+
coingeckoId: string;
|
|
252
|
+
};
|
|
225
253
|
USDC: {
|
|
226
254
|
name: string;
|
|
227
255
|
symbol: string;
|
|
@@ -239,6 +267,12 @@ export declare const resolveContractFromSymbol: (symbol: string, chainId: string
|
|
|
239
267
|
addresses: {
|
|
240
268
|
[x: number]: string;
|
|
241
269
|
};
|
|
270
|
+
/**
|
|
271
|
+
* Get the USDC symbol for the given token address and chain ID.
|
|
272
|
+
* @param l2Token A Web3 token address (not case sensitive)
|
|
273
|
+
* @param chainId A chain Id to reference
|
|
274
|
+
* @returns Either USDC (if native) or USDbC/USDC.e (if bridged) or undefined if the token address is not recognized.
|
|
275
|
+
*/
|
|
242
276
|
coingeckoId: string;
|
|
243
277
|
};
|
|
244
278
|
USDbC: {
|
|
@@ -259,6 +293,16 @@ export declare const resolveContractFromSymbol: (symbol: string, chainId: string
|
|
|
259
293
|
};
|
|
260
294
|
coingeckoId: string;
|
|
261
295
|
};
|
|
296
|
+
"USDT-BNB": {
|
|
297
|
+
name: string;
|
|
298
|
+
symbol: string;
|
|
299
|
+
decimals: number;
|
|
300
|
+
addresses: {
|
|
301
|
+
[x: number]: string;
|
|
302
|
+
};
|
|
303
|
+
l1TokenDecimals: number;
|
|
304
|
+
coingeckoId: string;
|
|
305
|
+
};
|
|
262
306
|
USDT: {
|
|
263
307
|
name: string;
|
|
264
308
|
symbol: string;
|
|
@@ -268,6 +312,15 @@ export declare const resolveContractFromSymbol: (symbol: string, chainId: string
|
|
|
268
312
|
};
|
|
269
313
|
coingeckoId: string;
|
|
270
314
|
};
|
|
315
|
+
VLR: {
|
|
316
|
+
name: string;
|
|
317
|
+
symbol: string;
|
|
318
|
+
decimals: number;
|
|
319
|
+
addresses: {
|
|
320
|
+
[x: number]: string;
|
|
321
|
+
};
|
|
322
|
+
coingeckoId: string;
|
|
323
|
+
};
|
|
271
324
|
WAZERO: {
|
|
272
325
|
name: string;
|
|
273
326
|
symbol: string;
|
|
@@ -313,6 +366,15 @@ export declare const resolveContractFromSymbol: (symbol: string, chainId: string
|
|
|
313
366
|
};
|
|
314
367
|
coingeckoId: string;
|
|
315
368
|
};
|
|
369
|
+
WLD: {
|
|
370
|
+
name: string;
|
|
371
|
+
symbol: string;
|
|
372
|
+
decimals: number;
|
|
373
|
+
addresses: {
|
|
374
|
+
[x: number]: string;
|
|
375
|
+
};
|
|
376
|
+
coingeckoId: string;
|
|
377
|
+
};
|
|
316
378
|
WMATIC: {
|
|
317
379
|
name: string;
|
|
318
380
|
symbol: string;
|
|
@@ -342,7 +404,19 @@ export declare const resolveContractFromSymbol: (symbol: string, chainId: string
|
|
|
342
404
|
coingeckoId: string;
|
|
343
405
|
};
|
|
344
406
|
}) => string | undefined;
|
|
345
|
-
export declare function
|
|
407
|
+
export declare function getCoingeckoTokenIdByAddress(contractAddress: string, chainId: number): string;
|
|
408
|
+
/**
|
|
409
|
+
* Retrieves the ERC20 balance for a given address and token address.
|
|
410
|
+
* @param address The address to retrieve the balance for.
|
|
411
|
+
* @param tokenAddress The token address
|
|
412
|
+
* @param signerOrProvider A valid ethers.js Signer or Provider object.
|
|
413
|
+
* @param blockTag The block tag to retrieve the balance at.
|
|
414
|
+
* @returns The balance of the given address for the given token address.
|
|
415
|
+
*/
|
|
416
|
+
export declare function getTokenBalance(address: string, tokenAddress: string, signerOrProvider: SignerOrProvider, blockTag?: BlockTag): Promise<BigNumber>;
|
|
417
|
+
export declare function isBridgedUsdc(tokenSymbol: string): boolean;
|
|
418
|
+
export declare function isStablecoin(tokenSymbol: string): boolean;
|
|
419
|
+
export declare function getTokenInfo(l2TokenAddress: string, chainId: number, tokenMapping?: {
|
|
346
420
|
ACX: {
|
|
347
421
|
name: string;
|
|
348
422
|
symbol: string;
|
|
@@ -388,6 +462,15 @@ export declare function getTokenInformationFromAddress(address: string, tokenMap
|
|
|
388
462
|
};
|
|
389
463
|
coingeckoId: string;
|
|
390
464
|
};
|
|
465
|
+
BNB: {
|
|
466
|
+
name: string;
|
|
467
|
+
symbol: string;
|
|
468
|
+
decimals: number;
|
|
469
|
+
addresses: {
|
|
470
|
+
[x: number]: string;
|
|
471
|
+
};
|
|
472
|
+
coingeckoId: string;
|
|
473
|
+
};
|
|
391
474
|
BOBA: {
|
|
392
475
|
name: string;
|
|
393
476
|
symbol: string;
|
|
@@ -397,6 +480,15 @@ export declare function getTokenInformationFromAddress(address: string, tokenMap
|
|
|
397
480
|
};
|
|
398
481
|
coingeckoId: string;
|
|
399
482
|
};
|
|
483
|
+
CAKE: {
|
|
484
|
+
name: string;
|
|
485
|
+
symbol: string;
|
|
486
|
+
decimals: number;
|
|
487
|
+
addresses: {
|
|
488
|
+
[x: number]: string;
|
|
489
|
+
};
|
|
490
|
+
coingeckoId: string;
|
|
491
|
+
};
|
|
400
492
|
DAI: {
|
|
401
493
|
name: string;
|
|
402
494
|
symbol: string;
|
|
@@ -542,6 +634,16 @@ export declare function getTokenInformationFromAddress(address: string, tokenMap
|
|
|
542
634
|
};
|
|
543
635
|
coingeckoId: string;
|
|
544
636
|
};
|
|
637
|
+
"USDC-BNB": {
|
|
638
|
+
name: string;
|
|
639
|
+
symbol: string;
|
|
640
|
+
decimals: number;
|
|
641
|
+
addresses: {
|
|
642
|
+
[x: number]: string;
|
|
643
|
+
};
|
|
644
|
+
l1TokenDecimals: number;
|
|
645
|
+
coingeckoId: string;
|
|
646
|
+
};
|
|
545
647
|
USDC: {
|
|
546
648
|
name: string;
|
|
547
649
|
symbol: string;
|
|
@@ -559,6 +661,12 @@ export declare function getTokenInformationFromAddress(address: string, tokenMap
|
|
|
559
661
|
addresses: {
|
|
560
662
|
[x: number]: string;
|
|
561
663
|
};
|
|
664
|
+
/**
|
|
665
|
+
* Get the USDC symbol for the given token address and chain ID.
|
|
666
|
+
* @param l2Token A Web3 token address (not case sensitive)
|
|
667
|
+
* @param chainId A chain Id to reference
|
|
668
|
+
* @returns Either USDC (if native) or USDbC/USDC.e (if bridged) or undefined if the token address is not recognized.
|
|
669
|
+
*/
|
|
562
670
|
coingeckoId: string;
|
|
563
671
|
};
|
|
564
672
|
USDbC: {
|
|
@@ -579,6 +687,16 @@ export declare function getTokenInformationFromAddress(address: string, tokenMap
|
|
|
579
687
|
};
|
|
580
688
|
coingeckoId: string;
|
|
581
689
|
};
|
|
690
|
+
"USDT-BNB": {
|
|
691
|
+
name: string;
|
|
692
|
+
symbol: string;
|
|
693
|
+
decimals: number;
|
|
694
|
+
addresses: {
|
|
695
|
+
[x: number]: string;
|
|
696
|
+
};
|
|
697
|
+
l1TokenDecimals: number;
|
|
698
|
+
coingeckoId: string;
|
|
699
|
+
};
|
|
582
700
|
USDT: {
|
|
583
701
|
name: string;
|
|
584
702
|
symbol: string;
|
|
@@ -588,6 +706,15 @@ export declare function getTokenInformationFromAddress(address: string, tokenMap
|
|
|
588
706
|
};
|
|
589
707
|
coingeckoId: string;
|
|
590
708
|
};
|
|
709
|
+
VLR: {
|
|
710
|
+
name: string;
|
|
711
|
+
symbol: string;
|
|
712
|
+
decimals: number;
|
|
713
|
+
addresses: {
|
|
714
|
+
[x: number]: string;
|
|
715
|
+
};
|
|
716
|
+
coingeckoId: string;
|
|
717
|
+
};
|
|
591
718
|
WAZERO: {
|
|
592
719
|
name: string;
|
|
593
720
|
symbol: string;
|
|
@@ -633,6 +760,15 @@ export declare function getTokenInformationFromAddress(address: string, tokenMap
|
|
|
633
760
|
};
|
|
634
761
|
coingeckoId: string;
|
|
635
762
|
};
|
|
763
|
+
WLD: {
|
|
764
|
+
name: string;
|
|
765
|
+
symbol: string;
|
|
766
|
+
decimals: number;
|
|
767
|
+
addresses: {
|
|
768
|
+
[x: number]: string;
|
|
769
|
+
};
|
|
770
|
+
coingeckoId: string;
|
|
771
|
+
};
|
|
636
772
|
WMATIC: {
|
|
637
773
|
name: string;
|
|
638
774
|
symbol: string;
|
|
@@ -661,20 +797,7 @@ export declare function getTokenInformationFromAddress(address: string, tokenMap
|
|
|
661
797
|
};
|
|
662
798
|
coingeckoId: string;
|
|
663
799
|
};
|
|
664
|
-
}): L1Token
|
|
665
|
-
export declare function getCoingeckoTokenIdByAddress(contractAddress: string): string;
|
|
666
|
-
/**
|
|
667
|
-
* Retrieves the ERC20 balance for a given address and token address.
|
|
668
|
-
* @param address The address to retrieve the balance for.
|
|
669
|
-
* @param tokenAddress The token address
|
|
670
|
-
* @param signerOrProvider A valid ethers.js Signer or Provider object.
|
|
671
|
-
* @param blockTag The block tag to retrieve the balance at.
|
|
672
|
-
* @returns The balance of the given address for the given token address.
|
|
673
|
-
*/
|
|
674
|
-
export declare function getTokenBalance(address: string, tokenAddress: string, signerOrProvider: SignerOrProvider, blockTag?: BlockTag): Promise<BigNumber>;
|
|
675
|
-
export declare function isBridgedUsdc(tokenSymbol: string): boolean;
|
|
676
|
-
export declare function isStablecoin(tokenSymbol: string): boolean;
|
|
677
|
-
export declare function getTokenInfo(l2TokenAddress: string, chainId: number): L1Token;
|
|
800
|
+
}): L1Token;
|
|
678
801
|
/**
|
|
679
802
|
* Get the USDC symbol for the given token address and chain ID.
|
|
680
803
|
* @param l2Token A Web3 token address (not case sensitive)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/TokenUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAY,SAAS,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAM7C,KAAK,gBAAgB,GAAG,SAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAzBmG,GAAG,OAAO,CAkB/G;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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@across-protocol/sdk",
|
|
3
3
|
"author": "UMA Team",
|
|
4
|
-
"version": "4.1.
|
|
4
|
+
"version": "4.1.49",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"homepage": "https://docs.across.to/reference/sdk",
|
|
7
7
|
"files": [
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
106
|
"@across-protocol/across-token": "^1.0.0",
|
|
107
|
-
"@across-protocol/constants": "^3.1.
|
|
107
|
+
"@across-protocol/constants": "^3.1.57",
|
|
108
108
|
"@across-protocol/contracts": "^4.0.5",
|
|
109
109
|
"@coral-xyz/anchor": "^0.30.1",
|
|
110
110
|
"@eth-optimism/sdk": "^3.3.1",
|
|
@@ -498,11 +498,6 @@ export class HubPoolClient extends BaseAbstractClient {
|
|
|
498
498
|
return this.lpTokens[l1Token];
|
|
499
499
|
}
|
|
500
500
|
|
|
501
|
-
getL1TokenInfoForL2Token(l2Token: string, chainId: number): L1Token | undefined {
|
|
502
|
-
const l1TokenCounterpart = this.getL1TokenForL2TokenAtBlock(l2Token, chainId, this.latestBlockSearched);
|
|
503
|
-
return this.getTokenInfoForL1Token(l1TokenCounterpart);
|
|
504
|
-
}
|
|
505
|
-
|
|
506
501
|
areTokensEquivalent(
|
|
507
502
|
tokenA: string,
|
|
508
503
|
chainIdA: number,
|
|
@@ -131,7 +131,7 @@ export class Coingecko {
|
|
|
131
131
|
protected async getCoingeckoTokenId(address: string, chainId: number): Promise<string> {
|
|
132
132
|
let id: string | undefined;
|
|
133
133
|
try {
|
|
134
|
-
id = getCoingeckoTokenIdByAddress(address);
|
|
134
|
+
id = getCoingeckoTokenIdByAddress(address, chainId);
|
|
135
135
|
|
|
136
136
|
return id;
|
|
137
137
|
} catch (error) {
|
package/src/constants.ts
CHANGED
|
@@ -8,6 +8,7 @@ export {
|
|
|
8
8
|
PUBLIC_NETWORKS,
|
|
9
9
|
TESTNET_CHAIN_IDs,
|
|
10
10
|
TOKEN_SYMBOLS_MAP,
|
|
11
|
+
TOKEN_EQUIVALENCE_REMAPPING,
|
|
11
12
|
} from "@across-protocol/constants";
|
|
12
13
|
|
|
13
14
|
export const { AddressZero: ZERO_ADDRESS, HashZero: ZERO_BYTES } = ethersConstants;
|
|
@@ -64,6 +65,7 @@ export const BRIDGED_USDC_SYMBOLS = [
|
|
|
64
65
|
TOKEN_SYMBOLS_MAP["USDC.e"].symbol,
|
|
65
66
|
TOKEN_SYMBOLS_MAP.USDbC.symbol,
|
|
66
67
|
TOKEN_SYMBOLS_MAP.USDzC.symbol,
|
|
68
|
+
TOKEN_SYMBOLS_MAP["USDC-BNB"].symbol,
|
|
67
69
|
];
|
|
68
70
|
|
|
69
71
|
export const STABLE_COIN_SYMBOLS = [
|
|
@@ -80,6 +82,7 @@ export const STABLE_COIN_SYMBOLS = [
|
|
|
80
82
|
];
|
|
81
83
|
|
|
82
84
|
export const CUSTOM_GAS_TOKENS = {
|
|
85
|
+
[CHAIN_IDs.BNB]: "BNB",
|
|
83
86
|
[CHAIN_IDs.POLYGON]: "MATIC",
|
|
84
87
|
[CHAIN_IDs.POLYGON_AMOY]: "MATIC",
|
|
85
88
|
[CHAIN_IDs.ALEPH_ZERO]: "AZERO",
|
|
@@ -87,6 +87,7 @@ function _getEthersGasPriceEstimate(
|
|
|
87
87
|
const gasPriceFeeds = {
|
|
88
88
|
[CHAIN_IDs.ALEPH_ZERO]: arbitrum.eip1559,
|
|
89
89
|
[CHAIN_IDs.ARBITRUM]: arbitrum.eip1559,
|
|
90
|
+
[CHAIN_IDs.BNB]: ethereum.eip1559,
|
|
90
91
|
[CHAIN_IDs.MAINNET]: ethereum.eip1559,
|
|
91
92
|
[CHAIN_IDs.POLYGON]: polygon.gasStation,
|
|
92
93
|
[CHAIN_IDs.SCROLL]: ethereum.legacy,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
TransactionCostEstimate,
|
|
9
9
|
bnZero,
|
|
10
10
|
fixedPointAdjustment,
|
|
11
|
-
|
|
11
|
+
getTokenInfo,
|
|
12
12
|
isDefined,
|
|
13
13
|
max,
|
|
14
14
|
min,
|
|
@@ -16,6 +16,8 @@ import {
|
|
|
16
16
|
percent,
|
|
17
17
|
toBN,
|
|
18
18
|
toBNWei,
|
|
19
|
+
isZeroAddress,
|
|
20
|
+
compareAddressesSimple,
|
|
19
21
|
} from "../utils";
|
|
20
22
|
import { Transport } from "viem";
|
|
21
23
|
|
|
@@ -243,8 +245,20 @@ export class RelayFeeCalculator {
|
|
|
243
245
|
): Promise<BigNumber> {
|
|
244
246
|
if (toBN(amountToRelay).eq(bnZero)) return MAX_BIG_INT;
|
|
245
247
|
|
|
246
|
-
const { inputToken } = deposit;
|
|
247
|
-
|
|
248
|
+
const { inputToken, destinationChainId, originChainId } = deposit;
|
|
249
|
+
// It's fine if we resolve a destination token which is not the "canonical" L1 token (e.g. USDB for DAI or USDC.e for USDC), since `getTokenInfo` will re-map
|
|
250
|
+
// the output token to the canonical version. What matters here is that we find an entry in the token map which has defined addresses for BOTH the origin
|
|
251
|
+
// and destination chain. This prevents the call to `getTokenInfo` to mistakenly return token info for a token which has a defined address on origin and an
|
|
252
|
+
// undefined address on destination.
|
|
253
|
+
const destinationChainTokenDetails = Object.values(tokenMapping).find(
|
|
254
|
+
(details) =>
|
|
255
|
+
compareAddressesSimple(details.addresses[originChainId], inputToken) &&
|
|
256
|
+
isDefined(details.addresses[destinationChainId])
|
|
257
|
+
);
|
|
258
|
+
const outputToken = isZeroAddress(deposit.outputToken)
|
|
259
|
+
? destinationChainTokenDetails!.addresses[destinationChainId]
|
|
260
|
+
: deposit.outputToken;
|
|
261
|
+
const token = getTokenInfo(outputToken, destinationChainId, tokenMapping);
|
|
248
262
|
if (!isDefined(token)) {
|
|
249
263
|
throw new Error(`Could not find token information for ${inputToken}`);
|
|
250
264
|
}
|
|
@@ -369,8 +383,10 @@ export class RelayFeeCalculator {
|
|
|
369
383
|
// If the amount to relay is not provided, then we
|
|
370
384
|
// should use the full deposit amount.
|
|
371
385
|
amountToRelay ??= deposit.outputAmount;
|
|
372
|
-
const { inputToken } = deposit;
|
|
373
|
-
|
|
386
|
+
const { inputToken, originChainId } = deposit;
|
|
387
|
+
// We can perform a simple lookup with `getTokenInfo` here without resolving the exact token to resolve since we only need to
|
|
388
|
+
// resolve the L1 token symbol and not the L2 token decimals.
|
|
389
|
+
const token = getTokenInfo(inputToken, originChainId);
|
|
374
390
|
if (!isDefined(token)) {
|
|
375
391
|
throw new Error(`Could not find token information for ${inputToken}`);
|
|
376
392
|
}
|
package/src/utils/EventUtils.ts
CHANGED
|
@@ -220,34 +220,36 @@ export function spreadEventWithBlockNumber(event: Log): SortableEvent {
|
|
|
220
220
|
};
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
+
type PartialSortableEvent = Pick<SortableEvent, "blockNumber" | "logIndex">;
|
|
224
|
+
|
|
223
225
|
// This copies the array and sorts it, returning a new array with the new ordering.
|
|
224
|
-
export function sortEventsAscending<T extends
|
|
226
|
+
export function sortEventsAscending<T extends PartialSortableEvent>(events: T[]): T[] {
|
|
225
227
|
return sortEventsAscendingInPlace([...events]);
|
|
226
228
|
}
|
|
227
229
|
|
|
228
230
|
// This sorts the events in place, meaning it modifies the passed array and returns a reference to the same array.
|
|
229
231
|
// Note: this method should only be used in cases where modifications are acceptable.
|
|
230
|
-
export function sortEventsAscendingInPlace<T extends
|
|
232
|
+
export function sortEventsAscendingInPlace<T extends PartialSortableEvent>(events: T[]): T[] {
|
|
231
233
|
return events.sort((ex, ey) =>
|
|
232
234
|
ex.blockNumber === ey.blockNumber ? ex.logIndex - ey.logIndex : ex.blockNumber - ey.blockNumber
|
|
233
235
|
);
|
|
234
236
|
}
|
|
235
237
|
|
|
236
238
|
// This copies the array and sorts it, returning a new array with the new ordering.
|
|
237
|
-
export function sortEventsDescending<T extends
|
|
239
|
+
export function sortEventsDescending<T extends PartialSortableEvent>(events: T[]): T[] {
|
|
238
240
|
return sortEventsDescendingInPlace([...events]);
|
|
239
241
|
}
|
|
240
242
|
|
|
241
243
|
// This sorts the events in place, meaning it modifies the passed array and returns a reference to the same array.
|
|
242
244
|
// Note: this method should only be used in cases where modifications are acceptable.
|
|
243
|
-
export function sortEventsDescendingInPlace<T extends
|
|
245
|
+
export function sortEventsDescendingInPlace<T extends PartialSortableEvent>(events: T[]): T[] {
|
|
244
246
|
return events.sort((ex, ey) =>
|
|
245
247
|
ex.blockNumber === ey.blockNumber ? ey.logIndex - ex.logIndex : ey.blockNumber - ex.blockNumber
|
|
246
248
|
);
|
|
247
249
|
}
|
|
248
250
|
|
|
249
251
|
// Returns true if ex is older than ey.
|
|
250
|
-
export function isEventOlder<T extends
|
|
252
|
+
export function isEventOlder<T extends PartialSortableEvent>(ex: T, ey: T): boolean {
|
|
251
253
|
return ex.blockNumber === ey.blockNumber ? ex.logIndex < ey.logIndex : ex.blockNumber < ey.blockNumber;
|
|
252
254
|
}
|
|
253
255
|
|