@across-protocol/sdk 4.1.47-beta.0 → 4.1.48
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/HubPoolClient.d.ts +0 -4
- package/dist/cjs/clients/HubPoolClient.js +0 -14
- package/dist/cjs/clients/HubPoolClient.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/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/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/chain-queries/factory.d.ts +56 -0
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.d.ts +57 -1
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js +19 -14
- package/dist/cjs/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/cjs/utils/EventUtils.js +3 -21
- package/dist/cjs/utils/EventUtils.js.map +1 -1
- package/dist/cjs/utils/TokenUtils.d.ts +118 -7
- package/dist/cjs/utils/TokenUtils.js +14 -20
- package/dist/cjs/utils/TokenUtils.js.map +1 -1
- package/dist/esm/clients/HubPoolClient.d.ts +0 -11
- package/dist/esm/clients/HubPoolClient.js +1 -22
- package/dist/esm/clients/HubPoolClient.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/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/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/chain-queries/factory.d.ts +56 -0
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.d.ts +61 -2
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js +21 -15
- package/dist/esm/relayFeeCalculator/relayFeeCalculator.js.map +1 -1
- package/dist/esm/utils/EventUtils.js +3 -21
- package/dist/esm/utils/EventUtils.js.map +1 -1
- package/dist/esm/utils/TokenUtils.d.ts +138 -15
- package/dist/esm/utils/TokenUtils.js +14 -19
- package/dist/esm/utils/TokenUtils.js.map +1 -1
- package/dist/types/clients/HubPoolClient.d.ts +0 -11
- package/dist/types/clients/HubPoolClient.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/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/baseQuery.d.ts +0 -6
- package/dist/types/relayFeeCalculator/chain-queries/baseQuery.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 -2
- package/dist/types/relayFeeCalculator/relayFeeCalculator.d.ts.map +1 -1
- 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 -28
- package/src/clients/mocks/MockHubPoolClient.ts +0 -9
- package/src/coingecko/Coingecko.ts +1 -1
- package/src/constants.ts +3 -0
- package/src/gasPriceOracle/oracle.ts +1 -0
- package/src/relayFeeCalculator/chain-queries/baseQuery.ts +0 -10
- package/src/relayFeeCalculator/relayFeeCalculator.ts +28 -13
- package/src/utils/EventUtils.ts +7 -25
- package/src/utils/TokenUtils.ts +12 -19
|
@@ -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,SAAS,CAAC,QAAQ,GAAG,MAAM,CAAC;AAEpD,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,CAI1G;AAED,eAAO,MAAM,mBAAmB,mBACd,MAAM;;aAMvB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAY7E;AAED;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,WAC5B,MAAM,WACL,MAAM
|
|
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,SAAS,CAAC,QAAQ,GAAG,MAAM,CAAC;AAEpD,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,CAI1G;AAED,eAAO,MAAM,mBAAmB,mBACd,MAAM;;aAMvB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAY7E;AAED;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,WAC5B,MAAM,WACL,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAkEjB;;;;;WAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MArEA,MAAM,GAAG,SAIX,CAAC;AAEF,wBAAgB,4BAA4B,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAM7F;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,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAoBlF;;;;;WAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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.48",
|
|
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",
|
|
@@ -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.
|
|
@@ -510,22 +498,6 @@ export class HubPoolClient extends BaseAbstractClient {
|
|
|
510
498
|
return this.lpTokens[l1Token];
|
|
511
499
|
}
|
|
512
500
|
|
|
513
|
-
getL1TokenInfoForL2Token(l2Token: string, chainId: number): L1Token | undefined {
|
|
514
|
-
const l1TokenCounterpart = this.getL1TokenForL2TokenAtBlock(l2Token, chainId, this.latestBlockSearched);
|
|
515
|
-
return this.getTokenInfoForL1Token(l1TokenCounterpart);
|
|
516
|
-
}
|
|
517
|
-
|
|
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
501
|
areTokensEquivalent(
|
|
530
502
|
tokenA: string,
|
|
531
503
|
chainIdA: number,
|
|
@@ -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;
|
|
@@ -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,
|
|
@@ -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
|
}
|
|
@@ -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
|
|
|
@@ -34,7 +36,6 @@ export interface QueryInterface {
|
|
|
34
36
|
}>
|
|
35
37
|
) => Promise<TransactionCostEstimate>;
|
|
36
38
|
getTokenPrice: (tokenSymbol: string) => Promise<number>;
|
|
37
|
-
getTokenDecimals: (tokenSymbol: string) => number;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
export const expectedCapitalCostsKeys = ["lowerBound", "upperBound", "cutoff", "decimals"];
|
|
@@ -48,6 +49,7 @@ type ChainIdAsString = string;
|
|
|
48
49
|
export interface CapitalCostConfigOverride {
|
|
49
50
|
default: CapitalCostConfig;
|
|
50
51
|
routeOverrides?: Record<ChainIdAsString, Record<ChainIdAsString, CapitalCostConfig>>;
|
|
52
|
+
destinationChainOverrides?: Record<ChainIdAsString, CapitalCostConfig>;
|
|
51
53
|
}
|
|
52
54
|
export type RelayCapitalCostConfig = CapitalCostConfigOverride | CapitalCostConfig;
|
|
53
55
|
export interface BaseRelayFeeCalculatorConfig {
|
|
@@ -190,10 +192,10 @@ export class RelayFeeCalculator {
|
|
|
190
192
|
this.validateCapitalCostsConfig(config.default);
|
|
191
193
|
// Iterate over all the route overrides and validate them.
|
|
192
194
|
for (const toChainIdRoutes of Object.values(config.routeOverrides || {})) {
|
|
193
|
-
|
|
194
|
-
this.validateCapitalCostsConfig(override);
|
|
195
|
-
}
|
|
195
|
+
Object.values(toChainIdRoutes).forEach(this.validateCapitalCostsConfig);
|
|
196
196
|
}
|
|
197
|
+
// Validate destination chain overrides
|
|
198
|
+
Object.values(config.destinationChainOverrides || {}).forEach(this.validateCapitalCostsConfig);
|
|
197
199
|
return config;
|
|
198
200
|
}
|
|
199
201
|
|
|
@@ -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
|
}
|
|
@@ -311,10 +325,9 @@ export class RelayFeeCalculator {
|
|
|
311
325
|
// bound to an upper bound. After the kink, the fee % increase will be fixed, and slowly approach the upper bound
|
|
312
326
|
// for very large amount inputs.
|
|
313
327
|
else {
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
: tokenCostConfig.default;
|
|
328
|
+
const destinationChainOverride = tokenCostConfig?.destinationChainOverrides?.[_destinationRoute || ""];
|
|
329
|
+
const routeOverride = tokenCostConfig?.routeOverrides?.[_originRoute || ""]?.[_destinationRoute || ""];
|
|
330
|
+
const config: CapitalCostConfig = routeOverride ?? destinationChainOverride ?? tokenCostConfig.default;
|
|
318
331
|
|
|
319
332
|
// Scale amount "y" to 18 decimals.
|
|
320
333
|
const y = toBN(_amountToRelay).mul(toBNWei("1", 18 - config.decimals));
|
|
@@ -370,8 +383,10 @@ export class RelayFeeCalculator {
|
|
|
370
383
|
// If the amount to relay is not provided, then we
|
|
371
384
|
// should use the full deposit amount.
|
|
372
385
|
amountToRelay ??= deposit.outputAmount;
|
|
373
|
-
const { inputToken } = deposit;
|
|
374
|
-
|
|
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);
|
|
375
390
|
if (!isDefined(token)) {
|
|
376
391
|
throw new Error(`Could not find token information for ${inputToken}`);
|
|
377
392
|
}
|
package/src/utils/EventUtils.ts
CHANGED
|
@@ -228,15 +228,9 @@ export function sortEventsAscending<T extends SortableEvent>(events: T[]): T[] {
|
|
|
228
228
|
// This sorts the events in place, meaning it modifies the passed array and returns a reference to the same array.
|
|
229
229
|
// Note: this method should only be used in cases where modifications are acceptable.
|
|
230
230
|
export function sortEventsAscendingInPlace<T extends SortableEvent>(events: T[]): T[] {
|
|
231
|
-
return events.sort((ex, ey) =>
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
}
|
|
235
|
-
if (ex.txnIndex !== ey.txnIndex) {
|
|
236
|
-
return ex.txnIndex - ey.txnIndex;
|
|
237
|
-
}
|
|
238
|
-
return ex.logIndex - ey.logIndex;
|
|
239
|
-
});
|
|
231
|
+
return events.sort((ex, ey) =>
|
|
232
|
+
ex.blockNumber === ey.blockNumber ? ex.logIndex - ey.logIndex : ex.blockNumber - ey.blockNumber
|
|
233
|
+
);
|
|
240
234
|
}
|
|
241
235
|
|
|
242
236
|
// This copies the array and sorts it, returning a new array with the new ordering.
|
|
@@ -247,26 +241,14 @@ export function sortEventsDescending<T extends SortableEvent>(events: T[]): T[]
|
|
|
247
241
|
// This sorts the events in place, meaning it modifies the passed array and returns a reference to the same array.
|
|
248
242
|
// Note: this method should only be used in cases where modifications are acceptable.
|
|
249
243
|
export function sortEventsDescendingInPlace<T extends SortableEvent>(events: T[]): T[] {
|
|
250
|
-
return events.sort((ex, ey) =>
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}
|
|
254
|
-
if (ex.txnIndex !== ey.txnIndex) {
|
|
255
|
-
return ey.txnIndex - ex.txnIndex;
|
|
256
|
-
}
|
|
257
|
-
return ey.logIndex - ex.logIndex;
|
|
258
|
-
});
|
|
244
|
+
return events.sort((ex, ey) =>
|
|
245
|
+
ex.blockNumber === ey.blockNumber ? ey.logIndex - ex.logIndex : ey.blockNumber - ex.blockNumber
|
|
246
|
+
);
|
|
259
247
|
}
|
|
260
248
|
|
|
261
249
|
// Returns true if ex is older than ey.
|
|
262
250
|
export function isEventOlder<T extends SortableEvent>(ex: T, ey: T): boolean {
|
|
263
|
-
|
|
264
|
-
return ex.blockNumber < ey.blockNumber;
|
|
265
|
-
}
|
|
266
|
-
if (ex.txnIndex !== ey.txnIndex) {
|
|
267
|
-
return ex.txnIndex < ey.txnIndex;
|
|
268
|
-
}
|
|
269
|
-
return ex.logIndex < ey.logIndex;
|
|
251
|
+
return ex.blockNumber === ey.blockNumber ? ex.logIndex < ey.logIndex : ex.blockNumber < ey.blockNumber;
|
|
270
252
|
}
|
|
271
253
|
|
|
272
254
|
export function getTransactionRefs(events: SortableEvent[]): string[] {
|
package/src/utils/TokenUtils.ts
CHANGED
|
@@ -4,10 +4,10 @@ import * as constants from "../constants";
|
|
|
4
4
|
import { L1Token } from "../interfaces";
|
|
5
5
|
import { ERC20__factory } from "../typechain";
|
|
6
6
|
import { BigNumber } from "./BigNumberUtils";
|
|
7
|
-
import { getNetworkName } from "./NetworkUtils";
|
|
7
|
+
import { getNetworkName, chainIsL1 } from "./NetworkUtils";
|
|
8
8
|
import { isDefined } from "./TypeGuards";
|
|
9
9
|
import { compareAddressesSimple } from "./AddressUtils";
|
|
10
|
-
const { TOKEN_SYMBOLS_MAP, CHAIN_IDs } = constants;
|
|
10
|
+
const { TOKEN_SYMBOLS_MAP, CHAIN_IDs, TOKEN_EQUIVALENCE_REMAPPING } = constants;
|
|
11
11
|
|
|
12
12
|
type SignerOrProvider = providers.Provider | Signer;
|
|
13
13
|
|
|
@@ -64,21 +64,8 @@ export const resolveContractFromSymbol = (
|
|
|
64
64
|
})?.addresses[Number(chainId)];
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
export function
|
|
68
|
-
const
|
|
69
|
-
return Object.values(details.addresses).some((t) => t.toLowerCase() === address.toLowerCase());
|
|
70
|
-
});
|
|
71
|
-
return isDefined(details)
|
|
72
|
-
? {
|
|
73
|
-
decimals: details.decimals,
|
|
74
|
-
symbol: details.symbol,
|
|
75
|
-
address,
|
|
76
|
-
}
|
|
77
|
-
: undefined;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export function getCoingeckoTokenIdByAddress(contractAddress: string): string {
|
|
81
|
-
const token = getTokenInformationFromAddress(contractAddress);
|
|
67
|
+
export function getCoingeckoTokenIdByAddress(contractAddress: string, chainId: number): string {
|
|
68
|
+
const token = getTokenInfo(contractAddress, chainId);
|
|
82
69
|
if (!token) {
|
|
83
70
|
throw new Error(`Token with address ${contractAddress} not found in token mapping`);
|
|
84
71
|
}
|
|
@@ -115,15 +102,19 @@ export function isStablecoin(tokenSymbol: string): boolean {
|
|
|
115
102
|
);
|
|
116
103
|
}
|
|
117
104
|
|
|
118
|
-
export function getTokenInfo(l2TokenAddress: string, chainId: number): L1Token {
|
|
105
|
+
export function getTokenInfo(l2TokenAddress: string, chainId: number, tokenMapping = TOKEN_SYMBOLS_MAP): L1Token {
|
|
119
106
|
// @dev This might give false positives if tokens on different networks have the same address. I'm not sure how
|
|
120
107
|
// to get around this...
|
|
121
|
-
|
|
108
|
+
let tokenObject = Object.values(tokenMapping).find(({ addresses }) => addresses[chainId] === l2TokenAddress);
|
|
122
109
|
if (!tokenObject) {
|
|
123
110
|
throw new Error(
|
|
124
111
|
`TokenUtils#getTokenInfo: Unable to resolve token in TOKEN_SYMBOLS_MAP for ${l2TokenAddress} on chain ${chainId}`
|
|
125
112
|
);
|
|
126
113
|
}
|
|
114
|
+
if (chainIsL1(chainId)) {
|
|
115
|
+
const l1TokenSymbol = TOKEN_EQUIVALENCE_REMAPPING[tokenObject.symbol] ?? tokenObject.symbol;
|
|
116
|
+
tokenObject = tokenMapping[l1TokenSymbol as keyof typeof tokenMapping];
|
|
117
|
+
}
|
|
127
118
|
return {
|
|
128
119
|
address: l2TokenAddress,
|
|
129
120
|
symbol: tokenObject.symbol,
|
|
@@ -147,6 +138,8 @@ export function getUsdcSymbol(l2Token: string, chainId: number): string | undefi
|
|
|
147
138
|
}
|
|
148
139
|
|
|
149
140
|
export function getL1TokenInfo(l2TokenAddress: string, chainId: number): L1Token {
|
|
141
|
+
if (chainId === CHAIN_IDs.MAINNET)
|
|
142
|
+
throw new Error("chainId should be an L2 chainId because many mappings re-use the same L1 token address");
|
|
150
143
|
const tokenObject = Object.values(TOKEN_SYMBOLS_MAP).find(({ addresses }) => addresses[chainId] === l2TokenAddress);
|
|
151
144
|
const l1TokenAddress = tokenObject?.addresses[CHAIN_IDs.MAINNET];
|
|
152
145
|
if (!l1TokenAddress) {
|