@uniswap/token-list-bridge-utils 2.1.0 → 2.2.0
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/constants/chainId.d.ts +1 -0
- package/dist/constants/tokens.d.ts +4 -0
- package/dist/fixtures/index.d.ts +12 -0
- package/dist/providers/BaseMappingProvider.d.ts +9 -0
- package/dist/token-list-bridge-utils.cjs.development.js +122 -42
- package/dist/token-list-bridge-utils.cjs.development.js.map +1 -1
- package/dist/token-list-bridge-utils.cjs.production.min.js +1 -1
- package/dist/token-list-bridge-utils.cjs.production.min.js.map +1 -1
- package/dist/token-list-bridge-utils.esm.js +122 -42
- package/dist/token-list-bridge-utils.esm.js.map +1 -1
- package/package.json +14 -23
- package/src/arbitrum/instantiate_bridge.ts +10 -2
- package/src/constants/chainId.ts +1 -0
- package/src/constants/tokens.ts +33 -1
- package/src/fixtures/index.ts +42 -0
- package/src/index.test.ts +73 -85
- package/src/index.ts +6 -8
- package/src/providers/BaseGoerliMappingProvider.ts +1 -1
- package/src/providers/BaseMappingProvider.ts +42 -0
- package/src/providers/OptimismMappingProvider.ts +19 -6
- package/src/providers/index.ts +14 -5
- package/src/utils.ts +2 -0
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { Token } from '@uniswap/sdk-core';
|
|
2
2
|
export declare const COINBASE_WRAPPED_STAKED_ETH: Token;
|
|
3
3
|
export declare const COINBASE_WRAPPED_STAKED_ETH_BASE_GOERLI: Token;
|
|
4
|
+
export declare const COINBASE_WRAPPED_STAKED_ETH_BASE: Token;
|
|
4
5
|
export declare const COINBASE_WRAPPED_STAKED_ETH_ARBITRUM_ONE: Token;
|
|
6
|
+
export declare const COINBASE_WRAPPED_STAKED_ETH_OPTIMISM: Token;
|
|
5
7
|
export declare const DAI: Token;
|
|
6
8
|
export declare const DAI_ARBITRUM_ONE: Token;
|
|
7
9
|
export declare const DAI_OPTIMISM: Token;
|
|
8
10
|
export declare const DAI_POLYGON: Token;
|
|
9
11
|
export declare const DAI_BNB: Token;
|
|
10
12
|
export declare const DAI_AVALANCHE: Token;
|
|
13
|
+
export declare const DAI_BASE: Token;
|
|
14
|
+
export declare const DAI_BASE_GOERLI: Token;
|
|
11
15
|
export declare const USDT: Token;
|
|
12
16
|
export declare const USDT_BNB: Token;
|
package/dist/fixtures/index.d.ts
CHANGED
|
@@ -78,6 +78,18 @@ export declare const baseGoerliSampleTokenList_3: {
|
|
|
78
78
|
tags?: import("@uniswap/token-lists").Tags | undefined;
|
|
79
79
|
logoURI?: string | undefined;
|
|
80
80
|
};
|
|
81
|
+
export declare const baseSampleTokenList_3: {
|
|
82
|
+
name: string;
|
|
83
|
+
tokens: TokenInfo[];
|
|
84
|
+
timestamp: string;
|
|
85
|
+
version: import("@uniswap/token-lists").Version;
|
|
86
|
+
tokenMap?: {
|
|
87
|
+
readonly [key: string]: TokenInfo;
|
|
88
|
+
} | undefined;
|
|
89
|
+
keywords?: string[] | undefined;
|
|
90
|
+
tags?: import("@uniswap/token-lists").Tags | undefined;
|
|
91
|
+
logoURI?: string | undefined;
|
|
92
|
+
};
|
|
81
93
|
export declare const optimizedSampleTokenList: {
|
|
82
94
|
name: string;
|
|
83
95
|
tokens: TokenInfo[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MappingProvider } from './MappingProvider';
|
|
2
|
+
import { GenericMappedTokenData } from '../constants/types';
|
|
3
|
+
/**
|
|
4
|
+
* The Base mapping (linked above) is manually maintained by the Coinbase team
|
|
5
|
+
* in this repository: https://github.com/ethereum-optimism/ethereum-optimism.github.io.
|
|
6
|
+
*/
|
|
7
|
+
export declare class BaseMappingProvider implements MappingProvider {
|
|
8
|
+
provide(): Promise<GenericMappedTokenData>;
|
|
9
|
+
}
|
|
@@ -899,6 +899,7 @@ var ChainId;
|
|
|
899
899
|
ChainId[ChainId["CELO"] = 42220] = "CELO";
|
|
900
900
|
ChainId[ChainId["BNB"] = 56] = "BNB";
|
|
901
901
|
ChainId[ChainId["AVALANCHE"] = 43114] = "AVALANCHE";
|
|
902
|
+
ChainId[ChainId["BASE"] = 8453] = "BASE";
|
|
902
903
|
ChainId[ChainId["BASE_GOERLI"] = 84531] = "BASE_GOERLI";
|
|
903
904
|
})(ChainId || (ChainId = {}));
|
|
904
905
|
|
|
@@ -1126,6 +1127,9 @@ function getRpcUrl(chainId) {
|
|
|
1126
1127
|
case ChainId.AVALANCHE:
|
|
1127
1128
|
return 'https://api.avax.network/ext/bc/C/rpc';
|
|
1128
1129
|
|
|
1130
|
+
case ChainId.BASE:
|
|
1131
|
+
return 'https://mainnet.base.org';
|
|
1132
|
+
|
|
1129
1133
|
case ChainId.BASE_GOERLI:
|
|
1130
1134
|
return 'https://goerli.base.org';
|
|
1131
1135
|
}
|
|
@@ -1165,7 +1169,13 @@ var _process$env, _process$env$MAINNET_;
|
|
|
1165
1169
|
dotenv.config();
|
|
1166
1170
|
(_process$env$MAINNET_ = (_process$env = process.env).MAINNET_RPC) != null ? _process$env$MAINNET_ : _process$env.MAINNET_RPC = /*#__PURE__*/getRpcUrl(ChainId.MAINNET);
|
|
1167
1171
|
|
|
1168
|
-
var networkID = 42161;
|
|
1172
|
+
var networkID = 42161;
|
|
1173
|
+
|
|
1174
|
+
var l2Rpc = function l2Rpc(chainId) {
|
|
1175
|
+
if (chainId === 42161) return 'https://arb1.arbitrum.io/rpc';else if (chainId === 421611) return 'https://rinkeby.arbitrum.io/rpc';else if (chainId === 42170) return 'https://nova.arbitrum.io/rpc';else if (chainId === 421613) return 'https://goerli-rollup.arbitrum.io/rpc';
|
|
1176
|
+
throw new Error('No L2 RPC detected');
|
|
1177
|
+
}; // ref: https://github.com/OffchainLabs/arb-token-lists/blob/master/src/lib/instantiate_bridge.ts
|
|
1178
|
+
|
|
1169
1179
|
|
|
1170
1180
|
var getNetworkConfig = /*#__PURE__*/function () {
|
|
1171
1181
|
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
@@ -1193,8 +1203,8 @@ var getNetworkConfig = /*#__PURE__*/function () {
|
|
|
1193
1203
|
|
|
1194
1204
|
case 11:
|
|
1195
1205
|
l1Network = _context.sent;
|
|
1196
|
-
arbProvider = new ethers.providers.JsonRpcProvider(l2Network.
|
|
1197
|
-
ethProvider = new ethers.providers.JsonRpcProvider(
|
|
1206
|
+
arbProvider = new ethers.providers.JsonRpcProvider(l2Rpc(l2Network.chainID));
|
|
1207
|
+
ethProvider = new ethers.providers.JsonRpcProvider(process.env.MAINNET_RPC);
|
|
1198
1208
|
_context.next = 16;
|
|
1199
1209
|
return MultiCaller.fromProvider(ethProvider);
|
|
1200
1210
|
|
|
@@ -1329,7 +1339,7 @@ var ArbitrumMappingProvider = /*#__PURE__*/function () {
|
|
|
1329
1339
|
return ArbitrumMappingProvider;
|
|
1330
1340
|
}();
|
|
1331
1341
|
|
|
1332
|
-
var optimismTokenListURL = 'https://raw.githubusercontent.com/' + 'ethereum-optimism/ethereum-optimism.github.io/
|
|
1342
|
+
var optimismTokenListURL = 'https://raw.githubusercontent.com/' + 'ethereum-optimism/ethereum-optimism.github.io/master/optimism.tokenlist.json';
|
|
1333
1343
|
/**
|
|
1334
1344
|
* The Optimism L2 mapping (linked above) is manually maintained by the Optimism team.
|
|
1335
1345
|
*
|
|
@@ -1343,8 +1353,7 @@ var OptimismMappingProvider = /*#__PURE__*/function () {
|
|
|
1343
1353
|
|
|
1344
1354
|
_proto.provide = /*#__PURE__*/function () {
|
|
1345
1355
|
var _provide = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
1346
|
-
var tokens,
|
|
1347
|
-
|
|
1356
|
+
var tokens, allTokens, opTokenId_baseAddressMap;
|
|
1348
1357
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
1349
1358
|
while (1) {
|
|
1350
1359
|
switch (_context.prev = _context.next) {
|
|
@@ -1354,19 +1363,27 @@ var OptimismMappingProvider = /*#__PURE__*/function () {
|
|
|
1354
1363
|
return getTokenList(optimismTokenListURL);
|
|
1355
1364
|
|
|
1356
1365
|
case 3:
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
token
|
|
1366
|
+
allTokens = _context.sent;
|
|
1367
|
+
opTokenId_baseAddressMap = {};
|
|
1368
|
+
allTokens.tokens.forEach(function (token) {
|
|
1369
|
+
if (token.chainId === ChainId.OPTIMISM) {
|
|
1370
|
+
var _token$extensions;
|
|
1361
1371
|
|
|
1362
|
-
|
|
1363
|
-
|
|
1372
|
+
if (typeof ((_token$extensions = token.extensions) == null ? void 0 : _token$extensions.opTokenId) === 'string') {
|
|
1373
|
+
opTokenId_baseAddressMap[token.extensions.opTokenId] = token.address;
|
|
1374
|
+
}
|
|
1364
1375
|
}
|
|
1365
|
-
}
|
|
1376
|
+
});
|
|
1377
|
+
allTokens.tokens.forEach(function (token) {
|
|
1378
|
+
var _token$extensions2;
|
|
1366
1379
|
|
|
1380
|
+
if (token.chainId === ChainId.MAINNET && typeof ((_token$extensions2 = token.extensions) == null ? void 0 : _token$extensions2.opTokenId) === 'string' && token.extensions.opTokenId in opTokenId_baseAddressMap) {
|
|
1381
|
+
tokens[token.address.toLowerCase()] = opTokenId_baseAddressMap[token.extensions.opTokenId];
|
|
1382
|
+
}
|
|
1383
|
+
});
|
|
1367
1384
|
return _context.abrupt("return", tokens);
|
|
1368
1385
|
|
|
1369
|
-
case
|
|
1386
|
+
case 8:
|
|
1370
1387
|
case "end":
|
|
1371
1388
|
return _context.stop();
|
|
1372
1389
|
}
|
|
@@ -5694,7 +5711,7 @@ var AvalancheMappingProvider = /*#__PURE__*/function () {
|
|
|
5694
5711
|
return AvalancheMappingProvider;
|
|
5695
5712
|
}();
|
|
5696
5713
|
|
|
5697
|
-
var baseGoerliTokenListURL = 'https://raw.githubusercontent.com/' + 'ethereum-optimism/ethereum-optimism.github.io/master/optimism.tokenlist.json';
|
|
5714
|
+
var baseGoerliTokenListURL$1 = 'https://raw.githubusercontent.com/' + 'ethereum-optimism/ethereum-optimism.github.io/master/optimism.tokenlist.json';
|
|
5698
5715
|
/**
|
|
5699
5716
|
* The Base Goerli mapping (linked above) is manually maintained by the Coinbase team
|
|
5700
5717
|
* in this repository: https://github.com/ethereum-optimism/ethereum-optimism.github.io.
|
|
@@ -5714,7 +5731,7 @@ var BaseGoerliMappingProvider = /*#__PURE__*/function () {
|
|
|
5714
5731
|
case 0:
|
|
5715
5732
|
tokens = {};
|
|
5716
5733
|
_context.next = 3;
|
|
5717
|
-
return getTokenList(baseGoerliTokenListURL);
|
|
5734
|
+
return getTokenList(baseGoerliTokenListURL$1);
|
|
5718
5735
|
|
|
5719
5736
|
case 3:
|
|
5720
5737
|
allTokens = _context.sent;
|
|
@@ -5755,9 +5772,70 @@ var BaseGoerliMappingProvider = /*#__PURE__*/function () {
|
|
|
5755
5772
|
return BaseGoerliMappingProvider;
|
|
5756
5773
|
}();
|
|
5757
5774
|
|
|
5775
|
+
var baseGoerliTokenListURL = 'https://raw.githubusercontent.com/' + 'ethereum-optimism/ethereum-optimism.github.io/master/optimism.tokenlist.json';
|
|
5776
|
+
/**
|
|
5777
|
+
* The Base mapping (linked above) is manually maintained by the Coinbase team
|
|
5778
|
+
* in this repository: https://github.com/ethereum-optimism/ethereum-optimism.github.io.
|
|
5779
|
+
*/
|
|
5780
|
+
|
|
5781
|
+
var BaseMappingProvider = /*#__PURE__*/function () {
|
|
5782
|
+
function BaseMappingProvider() {}
|
|
5783
|
+
|
|
5784
|
+
var _proto = BaseMappingProvider.prototype;
|
|
5785
|
+
|
|
5786
|
+
_proto.provide = /*#__PURE__*/function () {
|
|
5787
|
+
var _provide = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
5788
|
+
var tokens, allTokens, opTokenId_baseAddressMap;
|
|
5789
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
5790
|
+
while (1) {
|
|
5791
|
+
switch (_context.prev = _context.next) {
|
|
5792
|
+
case 0:
|
|
5793
|
+
tokens = {};
|
|
5794
|
+
_context.next = 3;
|
|
5795
|
+
return getTokenList(baseGoerliTokenListURL);
|
|
5796
|
+
|
|
5797
|
+
case 3:
|
|
5798
|
+
allTokens = _context.sent;
|
|
5799
|
+
opTokenId_baseAddressMap = {};
|
|
5800
|
+
allTokens.tokens.forEach(function (token) {
|
|
5801
|
+
if (token.chainId === ChainId.BASE) {
|
|
5802
|
+
var _token$extensions;
|
|
5803
|
+
|
|
5804
|
+
if (typeof ((_token$extensions = token.extensions) == null ? void 0 : _token$extensions.opTokenId) === 'string') {
|
|
5805
|
+
opTokenId_baseAddressMap[token.extensions.opTokenId] = token.address;
|
|
5806
|
+
}
|
|
5807
|
+
}
|
|
5808
|
+
});
|
|
5809
|
+
allTokens.tokens.forEach(function (token) {
|
|
5810
|
+
var _token$extensions2;
|
|
5811
|
+
|
|
5812
|
+
if (token.chainId === ChainId.MAINNET && typeof ((_token$extensions2 = token.extensions) == null ? void 0 : _token$extensions2.opTokenId) === 'string' && token.extensions.opTokenId in opTokenId_baseAddressMap) {
|
|
5813
|
+
tokens[token.address.toLowerCase()] = opTokenId_baseAddressMap[token.extensions.opTokenId];
|
|
5814
|
+
}
|
|
5815
|
+
});
|
|
5816
|
+
return _context.abrupt("return", tokens);
|
|
5817
|
+
|
|
5818
|
+
case 8:
|
|
5819
|
+
case "end":
|
|
5820
|
+
return _context.stop();
|
|
5821
|
+
}
|
|
5822
|
+
}
|
|
5823
|
+
}, _callee);
|
|
5824
|
+
}));
|
|
5825
|
+
|
|
5826
|
+
function provide() {
|
|
5827
|
+
return _provide.apply(this, arguments);
|
|
5828
|
+
}
|
|
5829
|
+
|
|
5830
|
+
return provide;
|
|
5831
|
+
}();
|
|
5832
|
+
|
|
5833
|
+
return BaseMappingProvider;
|
|
5834
|
+
}();
|
|
5835
|
+
|
|
5758
5836
|
var web3 = /*#__PURE__*/new Web3__default["default"](); // chains we support fetching mappings for (can be different than the l2ChainIds arg for buildList)
|
|
5759
5837
|
|
|
5760
|
-
var CHAINS_WITH_MAPPING_PROVIDERS = [ChainId.ARBITRUM_ONE, ChainId.POLYGON, ChainId.OPTIMISM, ChainId.BNB, ChainId.AVALANCHE, ChainId.BASE_GOERLI];
|
|
5838
|
+
var CHAINS_WITH_MAPPING_PROVIDERS = [ChainId.ARBITRUM_ONE, ChainId.POLYGON, ChainId.OPTIMISM, ChainId.BNB, ChainId.AVALANCHE, ChainId.BASE, ChainId.BASE_GOERLI];
|
|
5761
5839
|
function buildList(_x, _x2) {
|
|
5762
5840
|
return _buildList.apply(this, arguments);
|
|
5763
5841
|
} // using a symbol lookup contract call to check whether the token exists on the L2
|
|
@@ -5949,6 +6027,9 @@ function getMappingProvider(chainId, l1TokenList) {
|
|
|
5949
6027
|
case ChainId.AVALANCHE:
|
|
5950
6028
|
return new AvalancheMappingProvider();
|
|
5951
6029
|
|
|
6030
|
+
case ChainId.BASE:
|
|
6031
|
+
return new BaseMappingProvider();
|
|
6032
|
+
|
|
5952
6033
|
case ChainId.BASE_GOERLI:
|
|
5953
6034
|
return new BaseGoerliMappingProvider();
|
|
5954
6035
|
|
|
@@ -6015,18 +6096,27 @@ function getChildTokenDetails(_x7, _x8, _x9) {
|
|
|
6015
6096
|
|
|
6016
6097
|
function _getChildTokenDetails() {
|
|
6017
6098
|
_getChildTokenDetails = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(l1Token, chainId, chainIdToMappingsMap) {
|
|
6018
|
-
var _l1Token$extensions
|
|
6099
|
+
var _l1Token$extensions;
|
|
6019
6100
|
|
|
6020
|
-
var existingMapping, childToken, childTokenAddress, childTokenValid, decimals;
|
|
6101
|
+
var bridgeInfo, existingMapping, bridgeInfoForChain, childToken, childTokenAddress, childTokenValid, decimals;
|
|
6021
6102
|
return _regeneratorRuntime.wrap(function _callee5$(_context6) {
|
|
6022
6103
|
while (1) {
|
|
6023
6104
|
switch (_context6.prev = _context6.next) {
|
|
6024
6105
|
case 0:
|
|
6025
|
-
|
|
6106
|
+
bridgeInfo = l1Token == null ? void 0 : (_l1Token$extensions = l1Token.extensions) == null ? void 0 : _l1Token$extensions.bridgeInfo;
|
|
6107
|
+
|
|
6108
|
+
if (bridgeInfo && typeof bridgeInfo === 'object') {
|
|
6109
|
+
bridgeInfoForChain = bridgeInfo[chainId];
|
|
6110
|
+
|
|
6111
|
+
if (bridgeInfoForChain && typeof bridgeInfoForChain === 'object') {
|
|
6112
|
+
existingMapping = bridgeInfoForChain.tokenAddress;
|
|
6113
|
+
}
|
|
6114
|
+
} // use the externally fetched mappings if manual entry doesn't exist for the token/chain mapping
|
|
6026
6115
|
// and the given chain is supported for fetching mappings
|
|
6027
6116
|
|
|
6117
|
+
|
|
6028
6118
|
if (!(CHAINS_WITH_MAPPING_PROVIDERS.includes(chainId) && existingMapping === undefined)) {
|
|
6029
|
-
_context6.next =
|
|
6119
|
+
_context6.next = 15;
|
|
6030
6120
|
break;
|
|
6031
6121
|
}
|
|
6032
6122
|
|
|
@@ -6036,17 +6126,17 @@ function _getChildTokenDetails() {
|
|
|
6036
6126
|
_context6.t1 = childTokenAddress;
|
|
6037
6127
|
|
|
6038
6128
|
if (!_context6.t1) {
|
|
6039
|
-
_context6.next =
|
|
6129
|
+
_context6.next = 11;
|
|
6040
6130
|
break;
|
|
6041
6131
|
}
|
|
6042
6132
|
|
|
6043
|
-
_context6.next =
|
|
6133
|
+
_context6.next = 10;
|
|
6044
6134
|
return hasExistingTokenContract(childTokenAddress, chainId);
|
|
6045
6135
|
|
|
6046
|
-
case
|
|
6136
|
+
case 10:
|
|
6047
6137
|
_context6.t1 = _context6.sent;
|
|
6048
6138
|
|
|
6049
|
-
case
|
|
6139
|
+
case 11:
|
|
6050
6140
|
_context6.t2 = _context6.t1;
|
|
6051
6141
|
childTokenValid = (0, _context6.t0)(_context6.t2);
|
|
6052
6142
|
decimals = childToken && (chainId === ChainId.BNB || chainId === ChainId.AVALANCHE) ? childToken.decimals : undefined;
|
|
@@ -6056,13 +6146,13 @@ function _getChildTokenDetails() {
|
|
|
6056
6146
|
decimals: decimals
|
|
6057
6147
|
});
|
|
6058
6148
|
|
|
6059
|
-
case
|
|
6149
|
+
case 15:
|
|
6060
6150
|
return _context6.abrupt("return", {
|
|
6061
6151
|
childTokenValid: !!existingMapping,
|
|
6062
6152
|
childTokenAddress: existingMapping
|
|
6063
6153
|
});
|
|
6064
6154
|
|
|
6065
|
-
case
|
|
6155
|
+
case 16:
|
|
6066
6156
|
case "end":
|
|
6067
6157
|
return _context6.stop();
|
|
6068
6158
|
}
|
|
@@ -6152,7 +6242,7 @@ function chainify(_x) {
|
|
|
6152
6242
|
|
|
6153
6243
|
function _chainify() {
|
|
6154
6244
|
_chainify = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(l1TokenListOrPathOrUrl) {
|
|
6155
|
-
var l1TokenList, l2Chains, chainified, merged
|
|
6245
|
+
var l1TokenList, l2Chains, chainified, merged;
|
|
6156
6246
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
6157
6247
|
while (1) {
|
|
6158
6248
|
switch (_context.prev = _context.next) {
|
|
@@ -6162,7 +6252,7 @@ function _chainify() {
|
|
|
6162
6252
|
|
|
6163
6253
|
case 2:
|
|
6164
6254
|
l1TokenList = _context.sent;
|
|
6165
|
-
l2Chains = [ChainId.POLYGON, ChainId.ARBITRUM_ONE, ChainId.OPTIMISM, ChainId.CELO, ChainId.BNB, ChainId.AVALANCHE, ChainId.BASE_GOERLI];
|
|
6255
|
+
l2Chains = [ChainId.POLYGON, ChainId.ARBITRUM_ONE, ChainId.OPTIMISM, ChainId.CELO, ChainId.BNB, ChainId.AVALANCHE, ChainId.BASE, ChainId.BASE_GOERLI];
|
|
6166
6256
|
_context.next = 6;
|
|
6167
6257
|
return chainifyTokenList(l2Chains, l1TokenListOrPathOrUrl);
|
|
6168
6258
|
|
|
@@ -6170,19 +6260,9 @@ function _chainify() {
|
|
|
6170
6260
|
chainified = _context.sent;
|
|
6171
6261
|
merged = mergeTokenLists(l1TokenList, // providing l1 first to make sure duplicated tokens resolve to this list
|
|
6172
6262
|
chainified);
|
|
6173
|
-
|
|
6263
|
+
return _context.abrupt("return", merged);
|
|
6174
6264
|
|
|
6175
|
-
|
|
6176
|
-
merged.tokens.forEach(function (token) {
|
|
6177
|
-
tokenMap[token.chainId + "_" + token.address] = token;
|
|
6178
|
-
});
|
|
6179
|
-
}
|
|
6180
|
-
|
|
6181
|
-
return _context.abrupt("return", _extends({}, merged, {
|
|
6182
|
-
tokenMap: tokenMap
|
|
6183
|
-
}));
|
|
6184
|
-
|
|
6185
|
-
case 11:
|
|
6265
|
+
case 9:
|
|
6186
6266
|
case "end":
|
|
6187
6267
|
return _context.stop();
|
|
6188
6268
|
}
|
|
@@ -6247,7 +6327,7 @@ function mergeTokenLists(primary, secondary) {
|
|
|
6247
6327
|
|
|
6248
6328
|
var merged = lodash.merge(group[0], group[1]);
|
|
6249
6329
|
|
|
6250
|
-
if ((_merged$extensions = merged.extensions) != null && _merged$extensions.bridgeInfo) {
|
|
6330
|
+
if ((_merged$extensions = merged.extensions) != null && _merged$extensions.bridgeInfo && typeof merged.extensions.bridgeInfo === 'object') {
|
|
6251
6331
|
// remove reference to self-chain from merge
|
|
6252
6332
|
delete merged.extensions.bridgeInfo[merged.chainId];
|
|
6253
6333
|
}
|