@pioneer-platform/uniswap-client 0.0.21 → 0.0.24

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.
Files changed (74) hide show
  1. package/lib/constants/chainInfo.d.ts +19 -22
  2. package/lib/constants/chainInfo.js +134 -117
  3. package/lib/constants/chains.d.ts +36 -47
  4. package/lib/constants/chains.js +118 -83
  5. package/lib/constants/chains.test.js +22 -25
  6. package/lib/constants/governance.d.ts +8 -0
  7. package/lib/constants/governance.js +24 -0
  8. package/lib/constants/lists.d.ts +12 -0
  9. package/lib/constants/lists.js +64 -0
  10. package/lib/constants/localCurrencies.d.ts +6 -0
  11. package/lib/constants/localCurrencies.js +94 -0
  12. package/lib/constants/localCurrencyIcons.d.ts +18 -0
  13. package/lib/constants/localCurrencyIcons.js +298 -0
  14. package/lib/constants/locales.d.ts +1 -1
  15. package/lib/constants/locales.js +0 -3
  16. package/lib/constants/misc.d.ts +2 -7
  17. package/lib/constants/misc.js +17 -23
  18. package/lib/constants/networks.d.ts +21 -0
  19. package/lib/constants/networks.js +170 -0
  20. package/lib/constants/proposals/index.d.ts +5 -0
  21. package/lib/constants/proposals/index.js +8 -0
  22. package/lib/constants/proposals/polygon_proposal_title.d.ts +1 -0
  23. package/lib/constants/proposals/polygon_proposal_title.js +4 -0
  24. package/lib/constants/proposals/uniswap_grants_proposal_description.d.ts +1 -0
  25. package/lib/constants/proposals/uniswap_grants_proposal_description.js +4 -0
  26. package/lib/constants/providers.d.ts +19 -0
  27. package/lib/constants/providers.js +33 -0
  28. package/lib/constants/routing.d.ts +9 -13
  29. package/lib/constants/routing.js +91 -55
  30. package/lib/constants/routing.test.d.ts +1 -0
  31. package/lib/constants/routing.test.js +32 -0
  32. package/lib/constants/supportArticles.d.ts +13 -0
  33. package/lib/constants/supportArticles.js +17 -0
  34. package/lib/constants/tokenLists/broken.tokenlist.json +22 -0
  35. package/lib/constants/tokenLogoLookup.d.ts +8 -0
  36. package/lib/constants/tokenLogoLookup.js +48 -0
  37. package/lib/constants/tokenSafety.js +129 -0
  38. package/lib/constants/tokenSafetyLookup.d.ts +18 -0
  39. package/lib/constants/tokenSafetyLookup.js +66 -0
  40. package/lib/constants/tokenSaftey.test.d.ts +1 -0
  41. package/lib/constants/tokenSaftey.test.js +31 -0
  42. package/lib/constants/tokens.d.ts +34 -42
  43. package/lib/constants/tokens.js +190 -147
  44. package/lib/index.d.ts +1 -40
  45. package/lib/index.js +150 -570
  46. package/lib/routing/clientSideSmartOrderRouter.d.ts +5 -0
  47. package/lib/routing/clientSideSmartOrderRouter.js +136 -0
  48. package/lib/routing/gas.d.ts +5 -0
  49. package/lib/routing/gas.js +158 -0
  50. package/lib/routing/types.d.ts +393 -0
  51. package/lib/routing/types.js +424 -0
  52. package/lib/routing/utils.d.ts +28 -0
  53. package/lib/routing/utils.js +319 -0
  54. package/lib/rpc/AppJsonRpcProvider.d.ts +44 -0
  55. package/lib/rpc/AppJsonRpcProvider.js +183 -0
  56. package/lib/rpc/ConfiguredJsonRpcProvider.d.ts +8 -0
  57. package/lib/rpc/ConfiguredJsonRpcProvider.js +35 -0
  58. package/lib/utils/contracts/getContract.d.ts +3 -0
  59. package/lib/utils/contracts/getContract.js +29 -0
  60. package/lib/utils/transformSwapRouteToGetQuoteResult.d.ts +4 -0
  61. package/lib/utils/transformSwapRouteToGetQuoteResult.js +116 -0
  62. package/lib/utils/uniswapData.d.ts +21 -0
  63. package/lib/utils/uniswapData.js +217 -0
  64. package/package.json +12 -8
  65. package/lib/constants/addresses.d.ts +0 -9
  66. package/lib/constants/addresses.js +0 -41
  67. package/lib/constants/eip1193.d.ts +0 -8
  68. package/lib/constants/eip1193.js +0 -14
  69. package/lib/constants/index.d.ts +0 -9
  70. package/lib/constants/index.js +0 -26
  71. package/lib/constants/jsonRpcEndpoints.d.ts +0 -12
  72. package/lib/constants/jsonRpcEndpoints.js +0 -101
  73. package/lib/constants/utils/constructSameAddressMap.d.ts +0 -4
  74. package/lib/constants/utils/constructSameAddressMap.js +0 -19
@@ -1,102 +1,137 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.isPolygonChain = exports.L2_CHAIN_IDS = exports.L1_CHAIN_IDS = exports.SUPPORTED_GAS_ESTIMATE_CHAIN_IDS = exports.ALL_SUPPORTED_CHAIN_IDS = exports.CHAIN_NAMES_TO_IDS = exports.ChainName = exports.SupportedChainId = void 0;
5
- /**
6
- * List of all the networks supported by the Uniswap Interface
7
- */
8
- var SupportedChainId;
9
- (function (SupportedChainId) {
10
- SupportedChainId[SupportedChainId["MAINNET"] = 1] = "MAINNET";
11
- SupportedChainId[SupportedChainId["ROPSTEN"] = 3] = "ROPSTEN";
12
- SupportedChainId[SupportedChainId["RINKEBY"] = 4] = "RINKEBY";
13
- SupportedChainId[SupportedChainId["GOERLI"] = 5] = "GOERLI";
14
- SupportedChainId[SupportedChainId["KOVAN"] = 42] = "KOVAN";
15
- SupportedChainId[SupportedChainId["ARBITRUM_ONE"] = 42161] = "ARBITRUM_ONE";
16
- SupportedChainId[SupportedChainId["ARBITRUM_RINKEBY"] = 421611] = "ARBITRUM_RINKEBY";
17
- SupportedChainId[SupportedChainId["OPTIMISM"] = 10] = "OPTIMISM";
18
- SupportedChainId[SupportedChainId["OPTIMISM_GOERLI"] = 420] = "OPTIMISM_GOERLI";
19
- SupportedChainId[SupportedChainId["POLYGON"] = 137] = "POLYGON";
20
- SupportedChainId[SupportedChainId["POLYGON_MUMBAI"] = 80001] = "POLYGON_MUMBAI";
21
- SupportedChainId[SupportedChainId["CELO"] = 42220] = "CELO";
22
- SupportedChainId[SupportedChainId["CELO_ALFAJORES"] = 44787] = "CELO_ALFAJORES";
23
- SupportedChainId[SupportedChainId["BNB"] = 56] = "BNB";
24
- SupportedChainId[SupportedChainId["BASE"] = 8453] = "BASE";
25
- })(SupportedChainId || (exports.SupportedChainId = SupportedChainId = {}));
26
- var ChainName;
27
- (function (ChainName) {
28
- ChainName["MAINNET"] = "mainnet";
29
- ChainName["ROPSTEN"] = "ropsten";
30
- ChainName["RINKEBY"] = "rinkeby";
31
- ChainName["GOERLI"] = "goerli";
32
- ChainName["KOVAN"] = "kovan";
33
- ChainName["OPTIMISM"] = "optimism-mainnet";
34
- ChainName["OPTIMISM_GOERLI"] = "optimism-goerli";
35
- ChainName["ARBITRUM_ONE"] = "arbitrum-mainnet";
36
- ChainName["ARBITRUM_RINKEBY"] = "arbitrum-rinkeby";
37
- ChainName["POLYGON"] = "polygon-mainnet";
38
- ChainName["POLYGON_MUMBAI"] = "polygon-mumbai";
39
- ChainName["CELO"] = "celo";
40
- ChainName["CELO_ALFAJORES"] = "celo-alfajores";
41
- ChainName["BNB"] = "bnb";
42
- ChainName["BASE"] = "base";
43
- })(ChainName || (exports.ChainName = ChainName = {}));
44
- exports.CHAIN_NAMES_TO_IDS = (_a = {},
45
- _a[ChainName.MAINNET] = SupportedChainId.MAINNET,
46
- _a[ChainName.ROPSTEN] = SupportedChainId.ROPSTEN,
47
- _a[ChainName.RINKEBY] = SupportedChainId.RINKEBY,
48
- _a[ChainName.GOERLI] = SupportedChainId.GOERLI,
49
- _a[ChainName.KOVAN] = SupportedChainId.KOVAN,
50
- _a[ChainName.POLYGON] = SupportedChainId.POLYGON,
51
- _a[ChainName.POLYGON_MUMBAI] = SupportedChainId.POLYGON_MUMBAI,
52
- _a[ChainName.ARBITRUM_ONE] = SupportedChainId.ARBITRUM_ONE,
53
- _a[ChainName.ARBITRUM_RINKEBY] = SupportedChainId.ARBITRUM_RINKEBY,
54
- _a[ChainName.OPTIMISM] = SupportedChainId.OPTIMISM,
55
- _a[ChainName.OPTIMISM_GOERLI] = SupportedChainId.OPTIMISM_GOERLI,
56
- _a[ChainName.CELO] = SupportedChainId.CELO,
57
- _a[ChainName.CELO_ALFAJORES] = SupportedChainId.CELO_ALFAJORES,
58
- _a[ChainName.BNB] = SupportedChainId.BNB,
59
- _a[ChainName.BASE] = SupportedChainId.BASE,
4
+ exports.isUniswapXSupportedChain = exports.getChainPriority = exports.L2_CHAIN_IDS = exports.L1_CHAIN_IDS = exports.TESTNET_CHAIN_IDS = exports.SUPPORTED_V2POOL_CHAIN_IDS = exports.SUPPORTED_V2POOL_CHAIN_IDS_DEPRECATED = exports.SUPPORTED_GAS_ESTIMATE_CHAIN_IDS = exports.asSupportedChain = exports.isSupportedChain = exports.CHAIN_IDS_TO_NAMES = void 0;
5
+ var sdk_core_1 = require("@uniswap/sdk-core");
6
+ exports.CHAIN_IDS_TO_NAMES = (_a = {},
7
+ _a[sdk_core_1.ChainId.MAINNET] = 'mainnet',
8
+ _a[sdk_core_1.ChainId.GOERLI] = 'goerli',
9
+ _a[sdk_core_1.ChainId.SEPOLIA] = 'sepolia',
10
+ _a[sdk_core_1.ChainId.POLYGON] = 'polygon',
11
+ _a[sdk_core_1.ChainId.POLYGON_MUMBAI] = 'polygon_mumbai',
12
+ _a[sdk_core_1.ChainId.CELO] = 'celo',
13
+ _a[sdk_core_1.ChainId.CELO_ALFAJORES] = 'celo_alfajores',
14
+ _a[sdk_core_1.ChainId.ARBITRUM_ONE] = 'arbitrum',
15
+ _a[sdk_core_1.ChainId.ARBITRUM_GOERLI] = 'arbitrum_goerli',
16
+ _a[sdk_core_1.ChainId.OPTIMISM] = 'optimism',
17
+ _a[sdk_core_1.ChainId.OPTIMISM_GOERLI] = 'optimism_goerli',
18
+ _a[sdk_core_1.ChainId.BNB] = 'bnb',
19
+ _a[sdk_core_1.ChainId.AVALANCHE] = 'avalanche',
20
+ _a[sdk_core_1.ChainId.BASE] = 'base',
21
+ _a[sdk_core_1.ChainId.BLAST] = 'blast',
60
22
  _a);
23
+ // Include ChainIds in this array if they are not supported by the UX yet, but are already in the SDK.
24
+ var NOT_YET_UX_SUPPORTED_CHAIN_IDS = [
25
+ sdk_core_1.ChainId.BASE_GOERLI,
26
+ sdk_core_1.ChainId.ARBITRUM_SEPOLIA,
27
+ sdk_core_1.ChainId.OPTIMISM_SEPOLIA,
28
+ sdk_core_1.ChainId.ROOTSTOCK,
29
+ sdk_core_1.ChainId.ZORA,
30
+ sdk_core_1.ChainId.ZORA_SEPOLIA,
31
+ ];
32
+ function isSupportedChain(chainId, featureFlags) {
33
+ if (featureFlags && chainId && chainId in featureFlags) {
34
+ return featureFlags[chainId];
35
+ }
36
+ return !!chainId && sdk_core_1.SUPPORTED_CHAINS.indexOf(chainId) !== -1 && NOT_YET_UX_SUPPORTED_CHAIN_IDS.indexOf(chainId) === -1;
37
+ }
38
+ exports.isSupportedChain = isSupportedChain;
39
+ function asSupportedChain(chainId, featureFlags) {
40
+ if (!chainId)
41
+ return undefined;
42
+ if (featureFlags && chainId in featureFlags && !featureFlags[chainId]) {
43
+ return undefined;
44
+ }
45
+ return isSupportedChain(chainId) ? chainId : undefined;
46
+ }
47
+ exports.asSupportedChain = asSupportedChain;
48
+ exports.SUPPORTED_GAS_ESTIMATE_CHAIN_IDS = [
49
+ sdk_core_1.ChainId.MAINNET,
50
+ sdk_core_1.ChainId.POLYGON,
51
+ sdk_core_1.ChainId.CELO,
52
+ sdk_core_1.ChainId.OPTIMISM,
53
+ sdk_core_1.ChainId.ARBITRUM_ONE,
54
+ sdk_core_1.ChainId.BNB,
55
+ sdk_core_1.ChainId.AVALANCHE,
56
+ sdk_core_1.ChainId.BASE,
57
+ sdk_core_1.ChainId.BLAST,
58
+ ];
61
59
  /**
62
- * Array of all the supported chain IDs
60
+ * @deprecated when v2 pools are enabled on chains supported through sdk-core
63
61
  */
64
- exports.ALL_SUPPORTED_CHAIN_IDS = Object.values(SupportedChainId).filter(function (id) { return typeof id === 'number'; });
65
- exports.SUPPORTED_GAS_ESTIMATE_CHAIN_IDS = [
66
- SupportedChainId.MAINNET,
67
- SupportedChainId.POLYGON,
68
- SupportedChainId.OPTIMISM,
69
- SupportedChainId.ARBITRUM_ONE,
70
- SupportedChainId.CELO,
71
- SupportedChainId.BNB,
72
- SupportedChainId.BASE,
62
+ exports.SUPPORTED_V2POOL_CHAIN_IDS_DEPRECATED = [sdk_core_1.ChainId.MAINNET, sdk_core_1.ChainId.GOERLI];
63
+ exports.SUPPORTED_V2POOL_CHAIN_IDS = Object.keys(sdk_core_1.V2_ROUTER_ADDRESSES).map(function (chainId) { return parseInt(chainId); });
64
+ exports.TESTNET_CHAIN_IDS = [
65
+ sdk_core_1.ChainId.GOERLI,
66
+ sdk_core_1.ChainId.SEPOLIA,
67
+ sdk_core_1.ChainId.POLYGON_MUMBAI,
68
+ sdk_core_1.ChainId.ARBITRUM_GOERLI,
69
+ sdk_core_1.ChainId.OPTIMISM_GOERLI,
70
+ sdk_core_1.ChainId.CELO_ALFAJORES,
73
71
  ];
74
72
  /**
75
73
  * All the chain IDs that are running the Ethereum protocol.
76
74
  */
77
75
  exports.L1_CHAIN_IDS = [
78
- SupportedChainId.MAINNET,
79
- SupportedChainId.ROPSTEN,
80
- SupportedChainId.RINKEBY,
81
- SupportedChainId.GOERLI,
82
- SupportedChainId.KOVAN,
83
- SupportedChainId.POLYGON,
84
- SupportedChainId.POLYGON_MUMBAI,
85
- SupportedChainId.CELO,
86
- SupportedChainId.CELO_ALFAJORES,
76
+ sdk_core_1.ChainId.MAINNET,
77
+ sdk_core_1.ChainId.GOERLI,
78
+ sdk_core_1.ChainId.SEPOLIA,
79
+ sdk_core_1.ChainId.POLYGON,
80
+ sdk_core_1.ChainId.POLYGON_MUMBAI,
81
+ sdk_core_1.ChainId.CELO,
82
+ sdk_core_1.ChainId.CELO_ALFAJORES,
83
+ sdk_core_1.ChainId.BNB,
84
+ sdk_core_1.ChainId.AVALANCHE,
87
85
  ];
88
86
  /**
89
87
  * Controls some L2 specific behavior, e.g. slippage tolerance, special UI behavior.
90
88
  * The expectation is that all of these networks have immediate transaction confirmation.
91
89
  */
92
90
  exports.L2_CHAIN_IDS = [
93
- SupportedChainId.ARBITRUM_ONE,
94
- SupportedChainId.ARBITRUM_RINKEBY,
95
- SupportedChainId.OPTIMISM,
96
- SupportedChainId.OPTIMISM_GOERLI,
97
- SupportedChainId.BASE,
91
+ sdk_core_1.ChainId.ARBITRUM_ONE,
92
+ sdk_core_1.ChainId.ARBITRUM_GOERLI,
93
+ sdk_core_1.ChainId.OPTIMISM,
94
+ sdk_core_1.ChainId.OPTIMISM_GOERLI,
95
+ sdk_core_1.ChainId.BASE,
96
+ sdk_core_1.ChainId.BLAST,
98
97
  ];
99
- function isPolygonChain(chainId) {
100
- return chainId === SupportedChainId.POLYGON || chainId === SupportedChainId.POLYGON_MUMBAI;
98
+ /**
99
+ * Get the priority of a chainId based on its relevance to the user.
100
+ * @param {ChainId} chainId - The chainId to determine the priority for.
101
+ * @returns {number} The priority of the chainId, the lower the priority, the earlier it should be displayed, with base of MAINNET=0.
102
+ */
103
+ function getChainPriority(chainId) {
104
+ switch (chainId) {
105
+ case sdk_core_1.ChainId.MAINNET:
106
+ case sdk_core_1.ChainId.GOERLI:
107
+ case sdk_core_1.ChainId.SEPOLIA:
108
+ return 0;
109
+ case sdk_core_1.ChainId.ARBITRUM_ONE:
110
+ case sdk_core_1.ChainId.ARBITRUM_GOERLI:
111
+ return 1;
112
+ case sdk_core_1.ChainId.OPTIMISM:
113
+ case sdk_core_1.ChainId.OPTIMISM_GOERLI:
114
+ return 2;
115
+ case sdk_core_1.ChainId.POLYGON:
116
+ case sdk_core_1.ChainId.POLYGON_MUMBAI:
117
+ return 3;
118
+ case sdk_core_1.ChainId.BASE:
119
+ return 4;
120
+ case sdk_core_1.ChainId.BNB:
121
+ return 5;
122
+ case sdk_core_1.ChainId.AVALANCHE:
123
+ return 6;
124
+ case sdk_core_1.ChainId.CELO:
125
+ case sdk_core_1.ChainId.CELO_ALFAJORES:
126
+ return 7;
127
+ case sdk_core_1.ChainId.BLAST:
128
+ return 8;
129
+ default:
130
+ return Infinity;
131
+ }
132
+ }
133
+ exports.getChainPriority = getChainPriority;
134
+ function isUniswapXSupportedChain(chainId) {
135
+ return chainId === sdk_core_1.ChainId.MAINNET;
101
136
  }
102
- exports.isPolygonChain = isPolygonChain;
137
+ exports.isUniswapXSupportedChain = isUniswapXSupportedChain;
@@ -1,29 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ var sdk_core_1 = require("@uniswap/sdk-core");
3
4
  var chains_1 = require("./chains");
4
- describe('chains', function () {
5
- describe('ALL_SUPPORTED_CHAIN_IDS', function () {
6
- it('contains all the values in the SupportedChainId enum', function () {
7
- Object.values(chains_1.SupportedChainId).forEach(function (chainId) {
8
- if (typeof chainId === 'number')
9
- expect(chains_1.ALL_SUPPORTED_CHAIN_IDS.includes(chainId)).toBeTruthy();
10
- });
11
- });
12
- it('contains no duplicates', function () {
13
- var set = new Set();
14
- chains_1.ALL_SUPPORTED_CHAIN_IDS.forEach(function (chainId) {
15
- expect(set.has(chainId)).toEqual(false);
16
- set.add(chainId);
17
- });
18
- });
19
- it('all values are in the SupportedChainId mapping', function () {
20
- chains_1.ALL_SUPPORTED_CHAIN_IDS.forEach(function (chainId) {
21
- // takes advantage of the reverse mapping
22
- expect(chains_1.SupportedChainId[chainId]).toBeTruthy();
23
- });
24
- });
25
- it('all values are numeric', function () {
26
- expect(chains_1.ALL_SUPPORTED_CHAIN_IDS.every(function (chainId) { return typeof chainId === 'number'; })).toBeTruthy();
27
- });
28
- });
5
+ // Define an array of test cases with chainId and expected priority
6
+ var chainPriorityTestCases = [
7
+ [sdk_core_1.ChainId.MAINNET, 0],
8
+ [sdk_core_1.ChainId.GOERLI, 0],
9
+ [sdk_core_1.ChainId.SEPOLIA, 0],
10
+ [sdk_core_1.ChainId.ARBITRUM_ONE, 1],
11
+ [sdk_core_1.ChainId.ARBITRUM_GOERLI, 1],
12
+ [sdk_core_1.ChainId.OPTIMISM, 2],
13
+ [sdk_core_1.ChainId.OPTIMISM_GOERLI, 2],
14
+ [sdk_core_1.ChainId.POLYGON, 3],
15
+ [sdk_core_1.ChainId.POLYGON_MUMBAI, 3],
16
+ [sdk_core_1.ChainId.BASE, 4],
17
+ [sdk_core_1.ChainId.BNB, 5],
18
+ [sdk_core_1.ChainId.AVALANCHE, 6],
19
+ [sdk_core_1.ChainId.CELO, 7],
20
+ [sdk_core_1.ChainId.CELO_ALFAJORES, 7],
21
+ [sdk_core_1.ChainId.BLAST, 8],
22
+ ];
23
+ test.each(chainPriorityTestCases)('getChainPriority returns expected priority for a given ChainId %O', function (chainId, expectedPriority) {
24
+ var priority = (0, chains_1.getChainPriority)(chainId);
25
+ expect(priority).toBe(expectedPriority);
29
26
  });
@@ -0,0 +1,8 @@
1
+ export declare const COMMON_CONTRACT_NAMES: Record<number, {
2
+ [address: string]: string;
3
+ }>;
4
+ export declare const DEFAULT_AVERAGE_BLOCK_TIME_IN_SECS = 12;
5
+ export declare const AVERAGE_BLOCK_TIME_IN_SECS: {
6
+ [chainId: number]: number;
7
+ };
8
+ export declare const LATEST_GOVERNOR_INDEX = 2;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var _a, _b;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.LATEST_GOVERNOR_INDEX = exports.AVERAGE_BLOCK_TIME_IN_SECS = exports.DEFAULT_AVERAGE_BLOCK_TIME_IN_SECS = exports.COMMON_CONTRACT_NAMES = void 0;
5
+ var sdk_core_1 = require("@uniswap/sdk-core");
6
+ exports.COMMON_CONTRACT_NAMES = (_a = {},
7
+ _a[sdk_core_1.ChainId.MAINNET] = (_b = {},
8
+ _b[sdk_core_1.UNI_ADDRESSES[sdk_core_1.ChainId.MAINNET]] = 'UNI',
9
+ _b[sdk_core_1.TIMELOCK_ADDRESSES[sdk_core_1.ChainId.MAINNET]] = 'Timelock',
10
+ _b[sdk_core_1.GOVERNANCE_ALPHA_V0_ADDRESSES[sdk_core_1.ChainId.MAINNET]] = 'Governance (V0)',
11
+ _b[sdk_core_1.GOVERNANCE_ALPHA_V1_ADDRESSES[sdk_core_1.ChainId.MAINNET]] = 'Governance (V1)',
12
+ _b[sdk_core_1.GOVERNANCE_BRAVO_ADDRESSES[sdk_core_1.ChainId.MAINNET]] = 'Governance',
13
+ _b['0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e'] = 'ENS Registry',
14
+ _b['0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41'] = 'ENS Public Resolver',
15
+ _b['0xf754A7E347F81cFdc70AF9FbCCe9Df3D826360FA'] = 'Franchiser Factory',
16
+ _b),
17
+ _a);
18
+ // in PoS, ethereum block time is 12s, see https://ethereum.org/en/developers/docs/blocks/#block-time
19
+ exports.DEFAULT_AVERAGE_BLOCK_TIME_IN_SECS = 12;
20
+ // Block time here is slightly higher (~1s) than average in order to avoid ongoing proposals past the displayed time
21
+ exports.AVERAGE_BLOCK_TIME_IN_SECS = {
22
+ 1: exports.DEFAULT_AVERAGE_BLOCK_TIME_IN_SECS,
23
+ };
24
+ exports.LATEST_GOVERNOR_INDEX = 2;
@@ -0,0 +1,12 @@
1
+ export declare const UNI_LIST = "https://cloudflare-ipfs.com/ipns/tokens.uniswap.org";
2
+ export declare const UNI_EXTENDED_LIST = "https://cloudflare-ipfs.com/ipns/extendedtokens.uniswap.org";
3
+ export declare const OPTIMISM_LIST = "https://static.optimism.io/optimism.tokenlist.json";
4
+ export declare const ARBITRUM_LIST = "https://bridge.arbitrum.io/token-list-42161.json";
5
+ export declare const CELO_LIST = "https://celo-org.github.io/celo-token-list/celo.tokenlist.json";
6
+ export declare const PLASMA_BNB_LIST = "https://raw.githubusercontent.com/plasmadlt/plasma-finance-token-list/master/bnb.json";
7
+ export declare const AVALANCHE_LIST = "https://raw.githubusercontent.com/ava-labs/avalanche-bridge-resources/main/token_list.json";
8
+ export declare const BASE_LIST = "https://raw.githubusercontent.com/ethereum-optimism/ethereum-optimism.github.io/master/optimism.tokenlist.json";
9
+ export declare const UNSUPPORTED_LIST_URLS: string[];
10
+ export declare const DEFAULT_ACTIVE_LIST_URLS: string[];
11
+ export declare const DEFAULT_INACTIVE_LIST_URLS: string[];
12
+ export declare const DEFAULT_LIST_OF_LISTS: string[];
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.DEFAULT_LIST_OF_LISTS = exports.DEFAULT_INACTIVE_LIST_URLS = exports.DEFAULT_ACTIVE_LIST_URLS = exports.UNSUPPORTED_LIST_URLS = exports.BASE_LIST = exports.AVALANCHE_LIST = exports.PLASMA_BNB_LIST = exports.CELO_LIST = exports.ARBITRUM_LIST = exports.OPTIMISM_LIST = exports.UNI_EXTENDED_LIST = exports.UNI_LIST = void 0;
13
+ exports.UNI_LIST = 'https://cloudflare-ipfs.com/ipns/tokens.uniswap.org';
14
+ exports.UNI_EXTENDED_LIST = 'https://cloudflare-ipfs.com/ipns/extendedtokens.uniswap.org';
15
+ var UNI_UNSUPPORTED_LIST = 'https://cloudflare-ipfs.com/ipns/unsupportedtokens.uniswap.org';
16
+ var AAVE_LIST = 'tokenlist.aave.eth';
17
+ var BA_LIST = 'https://raw.githubusercontent.com/The-Blockchain-Association/sec-notice-list/master/ba-sec-list.json';
18
+ // TODO(WEB-2282): Re-enable CMC list once we have a better solution for handling large lists.
19
+ // const CMC_ALL_LIST = 'https://s3.coinmarketcap.com/generated/dex/tokens/eth-tokens-all.json'
20
+ var COINGECKO_LIST = 'https://tokens.coingecko.com/uniswap/all.json';
21
+ var COINGECKO_BNB_LIST = 'https://tokens.coingecko.com/binance-smart-chain/all.json';
22
+ var COINGECKO_ARBITRUM_LIST = 'https://tokens.coingecko.com/arbitrum-one/all.json';
23
+ var COINGECKO_OPTIMISM_LIST = 'https://tokens.coingecko.com/optimistic-ethereum/all.json';
24
+ var COINGECKO_CELO_LIST = 'https://tokens.coingecko.com/celo/all.json';
25
+ var COINGECKO_POLYGON_LIST = 'https://tokens.coingecko.com/polygon-pos/all.json';
26
+ var COINGECKO_AVAX_LIST = 'https://tokens.coingecko.com/avalanche/all.json';
27
+ var COMPOUND_LIST = 'https://raw.githubusercontent.com/compound-finance/token-list/master/compound.tokenlist.json';
28
+ var GEMINI_LIST = 'https://www.gemini.com/uniswap/manifest.json';
29
+ var KLEROS_LIST = 't2crtokens.eth';
30
+ var SET_LIST = 'https://raw.githubusercontent.com/SetProtocol/uniswap-tokenlist/main/set.tokenlist.json';
31
+ var WRAPPED_LIST = 'wrapped.tokensoft.eth';
32
+ exports.OPTIMISM_LIST = 'https://static.optimism.io/optimism.tokenlist.json';
33
+ exports.ARBITRUM_LIST = 'https://bridge.arbitrum.io/token-list-42161.json';
34
+ exports.CELO_LIST = 'https://celo-org.github.io/celo-token-list/celo.tokenlist.json';
35
+ exports.PLASMA_BNB_LIST = 'https://raw.githubusercontent.com/plasmadlt/plasma-finance-token-list/master/bnb.json';
36
+ exports.AVALANCHE_LIST = 'https://raw.githubusercontent.com/ava-labs/avalanche-bridge-resources/main/token_list.json';
37
+ exports.BASE_LIST = 'https://raw.githubusercontent.com/ethereum-optimism/ethereum-optimism.github.io/master/optimism.tokenlist.json';
38
+ exports.UNSUPPORTED_LIST_URLS = [BA_LIST, UNI_UNSUPPORTED_LIST];
39
+ // default lists to be 'active' aka searched across
40
+ exports.DEFAULT_ACTIVE_LIST_URLS = [exports.UNI_LIST];
41
+ exports.DEFAULT_INACTIVE_LIST_URLS = __spreadArray([
42
+ exports.UNI_EXTENDED_LIST,
43
+ COMPOUND_LIST,
44
+ AAVE_LIST,
45
+ // CMC_ALL_LIST,
46
+ COINGECKO_LIST,
47
+ COINGECKO_BNB_LIST,
48
+ COINGECKO_ARBITRUM_LIST,
49
+ COINGECKO_OPTIMISM_LIST,
50
+ COINGECKO_CELO_LIST,
51
+ COINGECKO_POLYGON_LIST,
52
+ COINGECKO_AVAX_LIST,
53
+ KLEROS_LIST,
54
+ GEMINI_LIST,
55
+ WRAPPED_LIST,
56
+ SET_LIST,
57
+ exports.ARBITRUM_LIST,
58
+ exports.OPTIMISM_LIST,
59
+ exports.CELO_LIST,
60
+ exports.PLASMA_BNB_LIST,
61
+ exports.AVALANCHE_LIST,
62
+ exports.BASE_LIST
63
+ ], exports.UNSUPPORTED_LIST_URLS, true);
64
+ exports.DEFAULT_LIST_OF_LISTS = __spreadArray(__spreadArray([], exports.DEFAULT_ACTIVE_LIST_URLS, true), exports.DEFAULT_INACTIVE_LIST_URLS, true);
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from 'react';
2
+ export declare const SUPPORTED_LOCAL_CURRENCIES: readonly [any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any];
3
+ export type SupportedLocalCurrency = (typeof SUPPORTED_LOCAL_CURRENCIES)[number];
4
+ export declare const DEFAULT_LOCAL_CURRENCY: SupportedLocalCurrency;
5
+ export declare const LOCAL_CURRENCY_SYMBOL_DISPLAY_TYPE: Record<SupportedLocalCurrency, 'narrowSymbol' | 'symbol'>;
6
+ export declare function getLocalCurrencyIcon(localCurrency: SupportedLocalCurrency, size?: number): ReactNode;
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getLocalCurrencyIcon = exports.LOCAL_CURRENCY_SYMBOL_DISPLAY_TYPE = exports.DEFAULT_LOCAL_CURRENCY = exports.SUPPORTED_LOCAL_CURRENCIES = void 0;
4
+ var types_and_hooks_1 = require("uniswap/src/data/graphql/uniswap-data-api/__generated__/types-and-hooks");
5
+ var localCurrencyIcons_1 = require("./localCurrencyIcons");
6
+ exports.SUPPORTED_LOCAL_CURRENCIES = [
7
+ types_and_hooks_1.Currency.Usd,
8
+ types_and_hooks_1.Currency.Aud,
9
+ types_and_hooks_1.Currency.Brl,
10
+ types_and_hooks_1.Currency.Cad,
11
+ types_and_hooks_1.Currency.Eur,
12
+ types_and_hooks_1.Currency.Gbp,
13
+ types_and_hooks_1.Currency.Hkd,
14
+ types_and_hooks_1.Currency.Idr,
15
+ types_and_hooks_1.Currency.Inr,
16
+ types_and_hooks_1.Currency.Jpy,
17
+ types_and_hooks_1.Currency.Ngn,
18
+ types_and_hooks_1.Currency.Pkr,
19
+ types_and_hooks_1.Currency.Rub,
20
+ types_and_hooks_1.Currency.Sgd,
21
+ types_and_hooks_1.Currency.Thb,
22
+ types_and_hooks_1.Currency.Try,
23
+ types_and_hooks_1.Currency.Uah,
24
+ types_and_hooks_1.Currency.Vnd,
25
+ ];
26
+ exports.DEFAULT_LOCAL_CURRENCY = types_and_hooks_1.Currency.Usd;
27
+ // some currencies need to be forced to use the narrow symbol and others need to be forced to use symbol
28
+ // for example: when CAD is set to narrowSymbol it is displayed as $ which offers no differentiation from USD
29
+ // but when set to symbol it is displayed as CA$ which is correct
30
+ // On the other hand when TBH is set to symbol it is displayed as THB, but when set to narrowSymbol it is ฿ which is correct
31
+ exports.LOCAL_CURRENCY_SYMBOL_DISPLAY_TYPE = {
32
+ USD: 'narrowSymbol',
33
+ EUR: 'narrowSymbol',
34
+ RUB: 'narrowSymbol',
35
+ INR: 'narrowSymbol',
36
+ GBP: 'narrowSymbol',
37
+ JPY: 'narrowSymbol',
38
+ VND: 'narrowSymbol',
39
+ SGD: 'symbol',
40
+ BRL: 'symbol',
41
+ HKD: 'symbol',
42
+ CAD: 'symbol',
43
+ IDR: 'narrowSymbol',
44
+ TRY: 'narrowSymbol',
45
+ NGN: 'narrowSymbol',
46
+ UAH: 'narrowSymbol',
47
+ PKR: 'narrowSymbol',
48
+ AUD: 'symbol',
49
+ THB: 'narrowSymbol',
50
+ };
51
+ function getLocalCurrencyIcon(localCurrency, size) {
52
+ if (size === void 0) { size = 20; }
53
+ switch (localCurrency) {
54
+ case types_and_hooks_1.Currency.Usd:
55
+ return <localCurrencyIcons_1.USD_ICON width={size} height={size}/>;
56
+ case types_and_hooks_1.Currency.Eur:
57
+ return <localCurrencyIcons_1.EUR_ICON width={size} height={size}/>;
58
+ case types_and_hooks_1.Currency.Rub:
59
+ return <localCurrencyIcons_1.RUB_ICON width={size} height={size}/>;
60
+ case types_and_hooks_1.Currency.Inr:
61
+ return <localCurrencyIcons_1.INR_ICON width={size} height={size}/>;
62
+ case types_and_hooks_1.Currency.Gbp:
63
+ return <localCurrencyIcons_1.GBP_ICON width={size} height={size}/>;
64
+ case types_and_hooks_1.Currency.Jpy:
65
+ return <localCurrencyIcons_1.JPY_ICON width={size} height={size}/>;
66
+ case types_and_hooks_1.Currency.Vnd:
67
+ return <localCurrencyIcons_1.VND_ICON width={size} height={size}/>;
68
+ case types_and_hooks_1.Currency.Sgd:
69
+ return <localCurrencyIcons_1.SGD_ICON width={size} height={size}/>;
70
+ case types_and_hooks_1.Currency.Brl:
71
+ return <localCurrencyIcons_1.BRL_ICON width={size} height={size}/>;
72
+ case types_and_hooks_1.Currency.Hkd:
73
+ return <localCurrencyIcons_1.HKD_ICON width={size} height={size}/>;
74
+ case types_and_hooks_1.Currency.Cad:
75
+ return <localCurrencyIcons_1.CAD_ICON width={size} height={size}/>;
76
+ case types_and_hooks_1.Currency.Idr:
77
+ return <localCurrencyIcons_1.IDR_ICON width={size} height={size}/>;
78
+ case types_and_hooks_1.Currency.Try:
79
+ return <localCurrencyIcons_1.TRY_ICON width={size} height={size}/>;
80
+ case types_and_hooks_1.Currency.Ngn:
81
+ return <localCurrencyIcons_1.NGN_ICON width={size} height={size}/>;
82
+ case types_and_hooks_1.Currency.Aud:
83
+ return <localCurrencyIcons_1.AUD_ICON width={size} height={size}/>;
84
+ case types_and_hooks_1.Currency.Pkr:
85
+ return <localCurrencyIcons_1.PKR_ICON width={size} height={size}/>;
86
+ case types_and_hooks_1.Currency.Uah:
87
+ return <localCurrencyIcons_1.UAH_ICON width={size} height={size}/>;
88
+ case types_and_hooks_1.Currency.Thb:
89
+ return <localCurrencyIcons_1.THB_ICON width={size} height={size}/>;
90
+ default:
91
+ return null;
92
+ }
93
+ }
94
+ exports.getLocalCurrencyIcon = getLocalCurrencyIcon;
@@ -0,0 +1,18 @@
1
+ export declare const USD_ICON: (props: React.SVGProps<SVGSVGElement>) => any;
2
+ export declare const EUR_ICON: (props: React.SVGProps<SVGSVGElement>) => any;
3
+ export declare const RUB_ICON: (props: React.SVGProps<SVGSVGElement>) => any;
4
+ export declare const INR_ICON: (props: React.SVGProps<SVGSVGElement>) => any;
5
+ export declare const GBP_ICON: (props: React.SVGProps<SVGSVGElement>) => any;
6
+ export declare const JPY_ICON: (props: React.SVGProps<SVGSVGElement>) => any;
7
+ export declare const VND_ICON: (props: React.SVGProps<SVGSVGElement>) => any;
8
+ export declare const SGD_ICON: (props: React.SVGProps<SVGSVGElement>) => any;
9
+ export declare const BRL_ICON: (props: React.SVGProps<SVGSVGElement>) => any;
10
+ export declare const HKD_ICON: (props: React.SVGProps<SVGSVGElement>) => any;
11
+ export declare const CAD_ICON: (props: React.SVGProps<SVGSVGElement>) => any;
12
+ export declare const IDR_ICON: (props: React.SVGProps<SVGSVGElement>) => any;
13
+ export declare const TRY_ICON: (props: React.SVGProps<SVGSVGElement>) => any;
14
+ export declare const NGN_ICON: (props: React.SVGProps<SVGSVGElement>) => any;
15
+ export declare const AUD_ICON: (props: React.SVGProps<SVGSVGElement>) => any;
16
+ export declare const PKR_ICON: (props: React.SVGProps<SVGSVGElement>) => any;
17
+ export declare const UAH_ICON: (props: React.SVGProps<SVGSVGElement>) => any;
18
+ export declare const THB_ICON: (props: React.SVGProps<SVGSVGElement>) => any;