@uniswap/token-list-bridge-utils 1.0.8 → 1.1.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.
@@ -6,5 +6,6 @@ export declare enum ChainId {
6
6
  OPTIMISM = 10,
7
7
  OPTIMISTIC_KOVAN = 69,
8
8
  POLYGON = 137,
9
- POLYGON_MUMBAI = 80001
9
+ POLYGON_MUMBAI = 80001,
10
+ CELO = 42220
10
11
  }
@@ -25,6 +25,9 @@ export interface PolygonMappedToken {
25
25
  updated_at: string;
26
26
  uri: string;
27
27
  }
28
+ export declare type GenericMappedTokenData = {
29
+ [key: string]: string | undefined;
30
+ };
28
31
  export declare type PolygonMappedTokenData = {
29
32
  [key: string]: PolygonMappedToken;
30
33
  };
package/dist/index.d.ts CHANGED
@@ -9,10 +9,10 @@ import { TokenListOrFetchableTokenList } from './utils';
9
9
  export declare function chainify(l1TokenListOrPathOrUrl: TokenListOrFetchableTokenList): Promise<TokenList>;
10
10
  /**
11
11
  * Given a network and a TokenList, returns the TokenList with `extensions` filled.
12
- * @param chainId chainId to operate on
12
+ * @param l2ChainIds layer 2 chainIds to operate on
13
13
  * @param l1TokenListOrPathOrUrl either an L1 TokenList object or a path/url to a TokenList
14
14
  * @returns L1 TokenList with `extensions` filled for the given network
15
15
  */
16
- export declare function chainifyTokenList(chainId: ChainId, l1TokenListOrPathOrUrl: TokenListOrFetchableTokenList): Promise<TokenList>;
16
+ export declare function chainifyTokenList(l2ChainIds: Array<ChainId>, l1TokenListOrPathOrUrl: TokenListOrFetchableTokenList): Promise<TokenList>;
17
17
  /** Merges two token lists, resolving conflicts to primary list. */
18
18
  export declare function mergeTokenLists(primary: TokenList, secondary: TokenList): TokenList;
@@ -1,12 +1,11 @@
1
1
  import { MappingProvider } from './MappingProvider';
2
2
  import { TokenList } from '@uniswap/token-lists';
3
+ import { GenericMappedTokenData } from '../constants/types';
3
4
  /**
4
5
  * This provider provides the l1->l2(Arbitrum) address mappings using the arbitrum SDK.
5
6
  */
6
7
  export declare class ArbitrumMappingProvider implements MappingProvider {
7
8
  l1TokenList: TokenList;
8
9
  constructor(l1TokenList: TokenList);
9
- provide(): Promise<{
10
- [key: string]: string | undefined;
11
- }>;
10
+ provide(): Promise<GenericMappedTokenData>;
12
11
  }
@@ -1,6 +1,4 @@
1
- import { PolygonMappedTokenData } from '../constants/types';
1
+ import { GenericMappedTokenData, PolygonMappedTokenData } from '../constants/types';
2
2
  export interface MappingProvider {
3
- provide(): Promise<PolygonMappedTokenData | {
4
- [key: string]: string | undefined;
5
- }>;
3
+ provide(): Promise<PolygonMappedTokenData | GenericMappedTokenData>;
6
4
  }
@@ -1,11 +1,10 @@
1
1
  import { MappingProvider } from './MappingProvider';
2
+ import { GenericMappedTokenData } from '../constants/types';
2
3
  /**
3
4
  * The Optimism L2 mapping (linked above) is manually maintained by the Optimism team.
4
5
  *
5
6
  * This provider provides the l1->l2(Optimism) token mappings.
6
7
  */
7
8
  export declare class OptimismMappingProvider implements MappingProvider {
8
- provide(): Promise<{
9
- [key: string]: string | undefined;
10
- }>;
9
+ provide(): Promise<GenericMappedTokenData>;
11
10
  }
@@ -1,3 +1,3 @@
1
1
  import { ChainId } from '../constants/chainId';
2
2
  import { TokenList } from '@uniswap/token-lists';
3
- export declare function buildList(chainId: ChainId, l1TokenList: TokenList): Promise<TokenList>;
3
+ export declare function buildList(l2ChainIds: Array<ChainId>, l1TokenList: TokenList): Promise<TokenList>;
@@ -896,6 +896,7 @@ var ChainId;
896
896
  ChainId[ChainId["OPTIMISTIC_KOVAN"] = 69] = "OPTIMISTIC_KOVAN";
897
897
  ChainId[ChainId["POLYGON"] = 137] = "POLYGON";
898
898
  ChainId[ChainId["POLYGON_MUMBAI"] = 80001] = "POLYGON_MUMBAI";
899
+ ChainId[ChainId["CELO"] = 42220] = "CELO";
899
900
  })(ChainId || (ChainId = {}));
900
901
 
901
902
  function compareTokenInfos(t1, t2) {
@@ -1098,7 +1099,8 @@ function getRpcUrl(chainId) {
1098
1099
  return 'https://cloudflare-eth.com/';
1099
1100
 
1100
1101
  case ChainId.OPTIMISM:
1101
- return 'https://mainnet.optimism.io';
1102
+ return 'https://rpc.ankr.com/optimism';
1103
+ // seems to have higher rate limit than https://mainnet.optimism.io/
1102
1104
 
1103
1105
  case ChainId.OPTIMISTIC_KOVAN:
1104
1106
  return 'https://kovan.optimism.io';
@@ -1614,103 +1616,139 @@ var abi = [{
1614
1616
  type: 'event'
1615
1617
  }];
1616
1618
 
1617
- var web3 = /*#__PURE__*/new Web3__default["default"]();
1619
+ var web3 = /*#__PURE__*/new Web3__default["default"](); // chains we support fetching mappings for (can be different than the l2ChainIds arg for buildList)
1620
+
1621
+ var SUPPORTED_L2_CHAINS = [ChainId.ARBITRUM_ONE, ChainId.POLYGON, ChainId.OPTIMISM];
1618
1622
  function buildList(_x, _x2) {
1619
1623
  return _buildList.apply(this, arguments);
1620
1624
  } // using a symbol lookup contract call to check whether the token exists on the L2
1621
1625
 
1622
1626
  function _buildList() {
1623
- _buildList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(chainId, l1TokenList) {
1624
- var tokenAddressMap, mappedTokens, _iterator, _step, rootToken, childToken, childTokenAddress, childTokenValid, _bridgeInfo, _bridgeInfo2, toRootExtensions, toChildExtensions, rootTokenInfo, childTokenInfo, tokenList;
1627
+ _buildList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(l2ChainIds, l1TokenList) {
1628
+ var multiChainedTokens, chainIdToMappingsMap, _loop, _iterator, _step, tokenList;
1625
1629
 
1626
- return _regeneratorRuntime.wrap(function _callee$(_context) {
1630
+ return _regeneratorRuntime.wrap(function _callee2$(_context3) {
1627
1631
  while (1) {
1628
- switch (_context.prev = _context.next) {
1632
+ switch (_context3.prev = _context3.next) {
1629
1633
  case 0:
1630
- web3.setProvider(getRpcUrl(chainId));
1631
- _context.next = 3;
1632
- return getMappingProvider(chainId, l1TokenList).provide();
1634
+ multiChainedTokens = [];
1635
+ _context3.next = 3;
1636
+ return generateTokenMappings(l2ChainIds, l1TokenList);
1633
1637
 
1634
1638
  case 3:
1635
- tokenAddressMap = _context.sent;
1636
- mappedTokens = [];
1639
+ chainIdToMappingsMap = _context3.sent;
1640
+ _loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop() {
1641
+ var l1Token, chainIdToChildTokenDetailsMap, l2MappingExtension;
1642
+ return _regeneratorRuntime.wrap(function _loop$(_context2) {
1643
+ while (1) {
1644
+ switch (_context2.prev = _context2.next) {
1645
+ case 0:
1646
+ l1Token = _step.value;
1647
+
1648
+ if (!(l1Token.chainId === ChainId.MAINNET)) {
1649
+ _context2.next = 7;
1650
+ break;
1651
+ }
1652
+
1653
+ chainIdToChildTokenDetailsMap = {};
1654
+ l2MappingExtension = {
1655
+ extensions: {
1656
+ bridgeInfo: {}
1657
+ }
1658
+ }; // build out the extensions.bridgeInfo data containing mappings for each L2 chain
1659
+
1660
+ _context2.next = 6;
1661
+ return Promise.all(l2ChainIds.map( /*#__PURE__*/function () {
1662
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(chainId) {
1663
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
1664
+ while (1) {
1665
+ switch (_context.prev = _context.next) {
1666
+ case 0:
1667
+ _context.next = 2;
1668
+ return getChildTokenDetails(l1Token, chainId, chainIdToMappingsMap);
1669
+
1670
+ case 2:
1671
+ chainIdToChildTokenDetailsMap[chainId] = _context.sent;
1672
+
1673
+ if (chainIdToChildTokenDetailsMap[chainId].childTokenValid) {
1674
+ l2MappingExtension.extensions.bridgeInfo[chainId] = {
1675
+ tokenAddress: chainIdToChildTokenDetailsMap[chainId].childTokenAddress
1676
+ };
1677
+ }
1678
+
1679
+ case 4:
1680
+ case "end":
1681
+ return _context.stop();
1682
+ }
1683
+ }
1684
+ }, _callee);
1685
+ }));
1686
+
1687
+ return function (_x10) {
1688
+ return _ref.apply(this, arguments);
1689
+ };
1690
+ }()));
1691
+
1692
+ case 6:
1693
+ // build the TokenInfo objects with bridgeInfo extension
1694
+ l2ChainIds.concat([ChainId.MAINNET]).forEach(function (chainId) {
1695
+ if (chainId === ChainId.MAINNET || chainIdToChildTokenDetailsMap[chainId].childTokenValid) {
1696
+ var _bridgeInfo;
1697
+
1698
+ var tokenInfo = chainId === ChainId.MAINNET ? _extends({}, l1Token, {
1699
+ extensions: Object.keys(l2MappingExtension.extensions.bridgeInfo).length > 0 ? {
1700
+ bridgeInfo: l2MappingExtension.extensions.bridgeInfo
1701
+ } : undefined
1702
+ }) : _extends({}, l1Token, {
1703
+ chainId: chainId,
1704
+ address: chainIdToChildTokenDetailsMap[chainId].childTokenAddress,
1705
+ extensions: {
1706
+ bridgeInfo: (_bridgeInfo = {}, _bridgeInfo[ChainId.MAINNET] = {
1707
+ tokenAddress: ethers.ethers.utils.getAddress(l1Token.address)
1708
+ }, _bridgeInfo)
1709
+ }
1710
+ });
1711
+ multiChainedTokens.push(tokenInfo);
1712
+ }
1713
+ });
1714
+
1715
+ case 7:
1716
+ case "end":
1717
+ return _context2.stop();
1718
+ }
1719
+ }
1720
+ }, _loop);
1721
+ });
1637
1722
  _iterator = _createForOfIteratorHelperLoose(l1TokenList.tokens);
1638
1723
 
1639
1724
  case 6:
1640
1725
  if ((_step = _iterator()).done) {
1641
- _context.next = 21;
1642
- break;
1643
- }
1644
-
1645
- rootToken = _step.value;
1646
- childToken = tokenAddressMap[rootToken.address.toLowerCase()];
1647
- childTokenAddress = childToken ? ethers.ethers.utils.getAddress(typeof childToken === 'object' ? childToken.child_token : childToken) : undefined;
1648
- _context.t0 = Boolean;
1649
- _context.t1 = childTokenAddress && (typeof childToken === 'object' ? !childToken.deleted : true);
1650
-
1651
- if (!_context.t1) {
1652
- _context.next = 16;
1726
+ _context3.next = 10;
1653
1727
  break;
1654
1728
  }
1655
1729
 
1656
- _context.next = 15;
1657
- return hasExistingTokenContract(childTokenAddress, chainId);
1658
-
1659
- case 15:
1660
- _context.t1 = _context.sent;
1661
-
1662
- case 16:
1663
- _context.t2 = _context.t1;
1664
- childTokenValid = (0, _context.t0)(_context.t2);
1665
-
1666
- if (rootToken.chainId === ChainId.MAINNET) {
1667
- // build extension info if available
1668
- toRootExtensions = childTokenValid ? {
1669
- extensions: {
1670
- bridgeInfo: (_bridgeInfo = {}, _bridgeInfo[rootToken.chainId] = {
1671
- tokenAddress: ethers.ethers.utils.getAddress(rootToken.address)
1672
- }, _bridgeInfo)
1673
- }
1674
- } : {};
1675
- toChildExtensions = childTokenValid ? {
1676
- extensions: {
1677
- bridgeInfo: (_bridgeInfo2 = {}, _bridgeInfo2[chainId] = {
1678
- tokenAddress: childTokenAddress
1679
- }, _bridgeInfo2)
1680
- }
1681
- } : {};
1682
- rootTokenInfo = _extends({}, rootToken, toChildExtensions);
1683
-
1684
- if (childTokenValid) {
1685
- childTokenInfo = _extends({}, rootToken, {
1686
- chainId: chainId,
1687
- address: childTokenAddress
1688
- }, toRootExtensions);
1689
- mappedTokens.push(childTokenInfo);
1690
- }
1691
-
1692
- mappedTokens.push(rootTokenInfo);
1693
- }
1730
+ return _context3.delegateYield(_loop(), "t0", 8);
1694
1731
 
1695
- case 19:
1696
- _context.next = 6;
1732
+ case 8:
1733
+ _context3.next = 6;
1697
1734
  break;
1698
1735
 
1699
- case 21:
1736
+ case 10:
1737
+ // build and return final chainified token list
1700
1738
  tokenList = {
1701
- name: "(ChainId: " + chainId + ") " + l1TokenList.name,
1739
+ name: "(ChainIds: " + l2ChainIds + ") " + l1TokenList.name,
1702
1740
  timestamp: new Date().toISOString(),
1703
1741
  version: l1TokenList.version,
1704
- tokens: mappedTokens.sort(compareTokenInfos)
1742
+ tokens: multiChainedTokens.sort(compareTokenInfos)
1705
1743
  };
1706
- return _context.abrupt("return", tokenList);
1744
+ return _context3.abrupt("return", tokenList);
1707
1745
 
1708
- case 23:
1746
+ case 12:
1709
1747
  case "end":
1710
- return _context.stop();
1748
+ return _context3.stop();
1711
1749
  }
1712
1750
  }
1713
- }, _callee);
1751
+ }, _callee2);
1714
1752
  }));
1715
1753
  return _buildList.apply(this, arguments);
1716
1754
  }
@@ -1720,35 +1758,36 @@ function hasExistingTokenContract(_x3, _x4) {
1720
1758
  }
1721
1759
 
1722
1760
  function _hasExistingTokenContract() {
1723
- _hasExistingTokenContract = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(address, chainId) {
1761
+ _hasExistingTokenContract = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(address, chainId) {
1724
1762
  var contract;
1725
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
1763
+ return _regeneratorRuntime.wrap(function _callee3$(_context4) {
1726
1764
  while (1) {
1727
- switch (_context2.prev = _context2.next) {
1765
+ switch (_context4.prev = _context4.next) {
1728
1766
  case 0:
1729
- _context2.prev = 0;
1767
+ web3.setProvider(getRpcUrl(chainId));
1768
+ _context4.prev = 1;
1730
1769
  contract = new web3.eth.Contract(abi, address);
1731
- _context2.next = 4;
1770
+ _context4.next = 5;
1732
1771
  return getTokenSymbolFromContract(contract);
1733
1772
 
1734
- case 4:
1735
- _context2.next = 9;
1773
+ case 5:
1774
+ _context4.next = 10;
1736
1775
  break;
1737
1776
 
1738
- case 6:
1739
- _context2.prev = 6;
1740
- _context2.t0 = _context2["catch"](0);
1741
- return _context2.abrupt("return", false);
1742
-
1743
- case 9:
1744
- return _context2.abrupt("return", true);
1777
+ case 7:
1778
+ _context4.prev = 7;
1779
+ _context4.t0 = _context4["catch"](1);
1780
+ return _context4.abrupt("return", false);
1745
1781
 
1746
1782
  case 10:
1783
+ return _context4.abrupt("return", true);
1784
+
1785
+ case 11:
1747
1786
  case "end":
1748
- return _context2.stop();
1787
+ return _context4.stop();
1749
1788
  }
1750
1789
  }
1751
- }, _callee2, null, [[0, 6]]);
1790
+ }, _callee3, null, [[1, 7]]);
1752
1791
  }));
1753
1792
  return _hasExistingTokenContract.apply(this, arguments);
1754
1793
  }
@@ -1765,10 +1804,123 @@ function getMappingProvider(chainId, l1TokenList) {
1765
1804
  return new PolygonMappingProvider();
1766
1805
 
1767
1806
  default:
1768
- throw new Error("Chain " + chainId + " not supported.");
1807
+ throw new Error("Chain " + chainId + " not supported for fetching mappings.");
1769
1808
  }
1770
1809
  }
1771
1810
 
1811
+ function generateTokenMappings(_x5, _x6) {
1812
+ return _generateTokenMappings.apply(this, arguments);
1813
+ } // handles both string and object cases for childToken (Polygon mappings return object)
1814
+
1815
+
1816
+ function _generateTokenMappings() {
1817
+ _generateTokenMappings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(chainIds, l1TokenList) {
1818
+ var chainIdToMappingsMap, _iterator2, _step2, chainId;
1819
+
1820
+ return _regeneratorRuntime.wrap(function _callee4$(_context5) {
1821
+ while (1) {
1822
+ switch (_context5.prev = _context5.next) {
1823
+ case 0:
1824
+ chainIdToMappingsMap = {};
1825
+ _iterator2 = _createForOfIteratorHelperLoose(chainIds);
1826
+
1827
+ case 2:
1828
+ if ((_step2 = _iterator2()).done) {
1829
+ _context5.next = 10;
1830
+ break;
1831
+ }
1832
+
1833
+ chainId = _step2.value;
1834
+
1835
+ if (!SUPPORTED_L2_CHAINS.includes(chainId)) {
1836
+ _context5.next = 8;
1837
+ break;
1838
+ }
1839
+
1840
+ _context5.next = 7;
1841
+ return getMappingProvider(chainId, l1TokenList).provide();
1842
+
1843
+ case 7:
1844
+ chainIdToMappingsMap[chainId] = _context5.sent;
1845
+
1846
+ case 8:
1847
+ _context5.next = 2;
1848
+ break;
1849
+
1850
+ case 10:
1851
+ return _context5.abrupt("return", chainIdToMappingsMap);
1852
+
1853
+ case 11:
1854
+ case "end":
1855
+ return _context5.stop();
1856
+ }
1857
+ }
1858
+ }, _callee4);
1859
+ }));
1860
+ return _generateTokenMappings.apply(this, arguments);
1861
+ }
1862
+
1863
+ function getChildTokenDetails(_x7, _x8, _x9) {
1864
+ return _getChildTokenDetails.apply(this, arguments);
1865
+ }
1866
+
1867
+ function _getChildTokenDetails() {
1868
+ _getChildTokenDetails = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(l1Token, chainId, chainIdToMappingsMap) {
1869
+ var _l1Token$extensions, _l1Token$extensions$b, _l1Token$extensions$b2;
1870
+
1871
+ var existingMapping, childToken, childTokenAddress, childTokenValid;
1872
+ return _regeneratorRuntime.wrap(function _callee5$(_context6) {
1873
+ while (1) {
1874
+ switch (_context6.prev = _context6.next) {
1875
+ case 0:
1876
+ existingMapping = l1Token == null ? void 0 : (_l1Token$extensions = l1Token.extensions) == null ? void 0 : (_l1Token$extensions$b = _l1Token$extensions.bridgeInfo) == null ? void 0 : (_l1Token$extensions$b2 = _l1Token$extensions$b[chainId]) == null ? void 0 : _l1Token$extensions$b2.tokenAddress; // use the externally fetched mappings if manual entry doesn't exist for the token/chain mapping
1877
+ // and the given L2 chain is supported for fetching mappings
1878
+
1879
+ if (!(SUPPORTED_L2_CHAINS.includes(chainId) && existingMapping === undefined)) {
1880
+ _context6.next = 13;
1881
+ break;
1882
+ }
1883
+
1884
+ childToken = chainIdToMappingsMap[chainId][l1Token.address.toLowerCase()];
1885
+ childTokenAddress = childToken ? ethers.ethers.utils.getAddress(typeof childToken === 'object' ? childToken.child_token : childToken) : undefined;
1886
+ _context6.t0 = Boolean;
1887
+ _context6.t1 = childTokenAddress && (typeof childToken === 'object' ? !childToken.deleted : true);
1888
+
1889
+ if (!_context6.t1) {
1890
+ _context6.next = 10;
1891
+ break;
1892
+ }
1893
+
1894
+ _context6.next = 9;
1895
+ return hasExistingTokenContract(childTokenAddress, chainId);
1896
+
1897
+ case 9:
1898
+ _context6.t1 = _context6.sent;
1899
+
1900
+ case 10:
1901
+ _context6.t2 = _context6.t1;
1902
+ childTokenValid = (0, _context6.t0)(_context6.t2);
1903
+ return _context6.abrupt("return", {
1904
+ childTokenValid: childTokenValid,
1905
+ childTokenAddress: childTokenAddress
1906
+ });
1907
+
1908
+ case 13:
1909
+ return _context6.abrupt("return", {
1910
+ childTokenValid: !!existingMapping,
1911
+ childTokenAddress: existingMapping
1912
+ });
1913
+
1914
+ case 14:
1915
+ case "end":
1916
+ return _context6.stop();
1917
+ }
1918
+ }
1919
+ }, _callee5);
1920
+ }));
1921
+ return _getChildTokenDetails.apply(this, arguments);
1922
+ }
1923
+
1772
1924
  /**
1773
1925
  * Verifies that for each token with extensions.bridgeInfo defined, for every
1774
1926
  * chainId there exists a token with that chainId at the root-level of the
@@ -1842,14 +1994,14 @@ function chainify(_x) {
1842
1994
  }
1843
1995
  /**
1844
1996
  * Given a network and a TokenList, returns the TokenList with `extensions` filled.
1845
- * @param chainId chainId to operate on
1997
+ * @param l2ChainIds layer 2 chainIds to operate on
1846
1998
  * @param l1TokenListOrPathOrUrl either an L1 TokenList object or a path/url to a TokenList
1847
1999
  * @returns L1 TokenList with `extensions` filled for the given network
1848
2000
  */
1849
2001
 
1850
2002
  function _chainify() {
1851
2003
  _chainify = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(l1TokenListOrPathOrUrl) {
1852
- var l1TokenList, optimisimed, polygoned, arbified;
2004
+ var l1TokenList, l2Chains, chainified;
1853
2005
  return _regeneratorRuntime.wrap(function _callee$(_context) {
1854
2006
  while (1) {
1855
2007
  switch (_context.prev = _context.next) {
@@ -1859,25 +2011,16 @@ function _chainify() {
1859
2011
 
1860
2012
  case 2:
1861
2013
  l1TokenList = _context.sent;
1862
- _context.next = 5;
1863
- return chainifyTokenList(ChainId.OPTIMISM, l1TokenListOrPathOrUrl);
1864
-
1865
- case 5:
1866
- optimisimed = _context.sent;
1867
- _context.next = 8;
1868
- return chainifyTokenList(ChainId.POLYGON, l1TokenListOrPathOrUrl);
1869
-
1870
- case 8:
1871
- polygoned = _context.sent;
1872
- _context.next = 11;
1873
- return chainifyTokenList(ChainId.ARBITRUM_ONE, l1TokenListOrPathOrUrl);
2014
+ l2Chains = [ChainId.POLYGON, ChainId.ARBITRUM_ONE, ChainId.OPTIMISM, ChainId.CELO];
2015
+ _context.next = 6;
2016
+ return chainifyTokenList(l2Chains, l1TokenListOrPathOrUrl);
1874
2017
 
1875
- case 11:
1876
- arbified = _context.sent;
2018
+ case 6:
2019
+ chainified = _context.sent;
1877
2020
  return _context.abrupt("return", mergeTokenLists(l1TokenList, // providing l1 first to make sure duplicated tokens resolve to this list
1878
- mergeTokenLists(mergeTokenLists(arbified, optimisimed), polygoned)));
2021
+ chainified));
1879
2022
 
1880
- case 13:
2023
+ case 8:
1881
2024
  case "end":
1882
2025
  return _context.stop();
1883
2026
  }
@@ -1893,7 +2036,7 @@ function chainifyTokenList(_x2, _x3) {
1893
2036
  /** Merges two token lists, resolving conflicts to primary list. */
1894
2037
 
1895
2038
  function _chainifyTokenList() {
1896
- _chainifyTokenList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(chainId, l1TokenListOrPathOrUrl) {
2039
+ _chainifyTokenList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(l2ChainIds, l1TokenListOrPathOrUrl) {
1897
2040
  var l1TokenList, tokenList;
1898
2041
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
1899
2042
  while (1) {
@@ -1906,7 +2049,7 @@ function _chainifyTokenList() {
1906
2049
  case 3:
1907
2050
  l1TokenList = _context2.sent;
1908
2051
  _context2.next = 6;
1909
- return buildList(chainId, l1TokenList);
2052
+ return buildList(l2ChainIds, l1TokenList);
1910
2053
 
1911
2054
  case 6:
1912
2055
  tokenList = _context2.sent;