@pioneer-platform/uniswap-client 0.0.22 → 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 -641
  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 +11 -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,5 +1,13 @@
1
- import { SupportedChainId, SupportedL1ChainId, SupportedL2ChainId } from './chains';
2
- export declare const STANDARD_L1_BLOCK_TIME: number;
1
+ import { ChainId } from '@uniswap/sdk-core';
2
+ import { SupportedL1ChainId, SupportedL2ChainId } from './chains';
3
+ export declare const AVERAGE_L1_BLOCK_TIME: any;
4
+ export declare const DEFAULT_MS_BEFORE_WARNING: any;
5
+ /**
6
+ *
7
+ * @param chainId
8
+ * @returns The approximate whole number of blocks written to the corresponding chainId per Ethereum mainnet epoch.
9
+ */
10
+ export declare function getBlocksPerMainnetEpochForChainId(chainId: number | undefined): number;
3
11
  export declare enum NetworkType {
4
12
  L1 = 0,
5
13
  L2 = 1
@@ -11,40 +19,29 @@ interface BaseChainInfo {
11
19
  readonly bridge?: string;
12
20
  readonly explorer: string;
13
21
  readonly infoLink: string;
14
- readonly safe?: {
15
- label?: string;
16
- symbol?: string;
17
- };
18
22
  readonly label: string;
19
23
  readonly helpCenterUrl?: string;
20
24
  readonly nativeCurrency: {
21
25
  name: string;
22
26
  symbol: string;
23
- decimals: 18;
27
+ decimals: number;
24
28
  };
25
29
  readonly color?: string;
26
30
  readonly backgroundColor?: string;
27
31
  }
28
- export interface L1ChainInfo extends BaseChainInfo {
32
+ interface L1ChainInfo extends BaseChainInfo {
29
33
  readonly networkType: NetworkType.L1;
34
+ readonly defaultListUrl?: string;
30
35
  }
31
36
  export interface L2ChainInfo extends BaseChainInfo {
32
37
  readonly networkType: NetworkType.L2;
33
38
  readonly bridge: string;
34
39
  readonly statusPage?: string;
40
+ readonly defaultListUrl: string;
35
41
  }
36
- export type ChainInfoMap = {
37
- readonly [chainId: number]: L1ChainInfo | L2ChainInfo;
38
- } & {
39
- readonly [chainId in SupportedL2ChainId]: L2ChainInfo;
40
- } & {
41
- readonly [chainId in SupportedL1ChainId]: L1ChainInfo;
42
- };
43
- export declare function getChainInfo(chainId: SupportedL1ChainId): L1ChainInfo;
44
- export declare function getChainInfo(chainId: SupportedL2ChainId): L2ChainInfo;
45
- export declare function getChainInfo(chainId: SupportedChainId): L1ChainInfo | L2ChainInfo;
46
- export declare function getChainInfo(chainId: SupportedChainId | SupportedL1ChainId | SupportedL2ChainId | number | undefined): L1ChainInfo | L2ChainInfo | undefined;
47
- export declare const MAINNET_INFO: L1ChainInfo;
48
- export declare function getChainInfoOrDefault(chainId: number | undefined): L1ChainInfo | L2ChainInfo;
49
- export declare function isSupportedChainId(chainId: number | undefined): chainId is SupportedChainId;
42
+ export declare function getChainInfo(chainId: SupportedL1ChainId, featureFlags?: Record<ChainId | SupportedL1ChainId | SupportedL2ChainId | number, boolean>): L1ChainInfo;
43
+ export declare function getChainInfo(chainId: SupportedL2ChainId, featureFlags?: Record<ChainId | SupportedL1ChainId | SupportedL2ChainId | number, boolean>): L2ChainInfo;
44
+ export declare function getChainInfo(chainId: ChainId, featureFlags?: Record<ChainId | SupportedL1ChainId | SupportedL2ChainId | number, boolean>): L1ChainInfo | L2ChainInfo;
45
+ export declare function getChainInfo(chainId: ChainId | SupportedL1ChainId | SupportedL2ChainId | number | undefined, featureFlags?: Record<ChainId | SupportedL1ChainId | SupportedL2ChainId | number, boolean>): L1ChainInfo | L2ChainInfo | undefined;
46
+ export declare function getChainInfoOrDefault(chainId: number | undefined, featureFlags?: Record<number, boolean>): L1ChainInfo | L2ChainInfo;
50
47
  export {};
@@ -1,234 +1,251 @@
1
1
  "use strict";
2
- // @ts-ignore
3
- // import ms from 'ms.macro'
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
4
5
  var _a;
5
6
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isSupportedChainId = exports.getChainInfoOrDefault = exports.MAINNET_INFO = exports.getChainInfo = exports.NetworkType = exports.STANDARD_L1_BLOCK_TIME = void 0;
7
- var chains_1 = require("./chains");
8
- exports.STANDARD_L1_BLOCK_TIME = 12 * 1000;
7
+ exports.getChainInfoOrDefault = exports.getChainInfo = exports.NetworkType = exports.getBlocksPerMainnetEpochForChainId = exports.DEFAULT_MS_BEFORE_WARNING = exports.AVERAGE_L1_BLOCK_TIME = void 0;
8
+ var sdk_core_1 = require("@uniswap/sdk-core");
9
+ // @ts-ignore
10
+ var ms_1 = __importDefault(require("ms"));
11
+ var lists_1 = require("./lists");
12
+ exports.AVERAGE_L1_BLOCK_TIME = (0, ms_1.default)("12s");
13
+ exports.DEFAULT_MS_BEFORE_WARNING = (0, ms_1.default)("10m");
14
+ /**
15
+ *
16
+ * @param chainId
17
+ * @returns The approximate whole number of blocks written to the corresponding chainId per Ethereum mainnet epoch.
18
+ */
19
+ function getBlocksPerMainnetEpochForChainId(chainId) {
20
+ // Average block times were pulled from https://dune.com/jacobdcastro/avg-block-times on 2024-03-14,
21
+ // and corroborated with that chain's documentation/explorer.
22
+ // Blocks per mainnet epoch is computed as `Math.floor(12s / AVG_BLOCK_TIME)` and hard-coded.
23
+ switch (chainId) {
24
+ case sdk_core_1.ChainId.ARBITRUM_ONE:
25
+ return 46;
26
+ case sdk_core_1.ChainId.OPTIMISM:
27
+ return 6;
28
+ case sdk_core_1.ChainId.POLYGON:
29
+ return 5;
30
+ case sdk_core_1.ChainId.BASE:
31
+ return 6;
32
+ case sdk_core_1.ChainId.BNB:
33
+ return 4;
34
+ case sdk_core_1.ChainId.AVALANCHE:
35
+ return 6;
36
+ case sdk_core_1.ChainId.CELO:
37
+ return 2;
38
+ default:
39
+ return 1;
40
+ }
41
+ }
42
+ exports.getBlocksPerMainnetEpochForChainId = getBlocksPerMainnetEpochForChainId;
9
43
  var NetworkType;
10
44
  (function (NetworkType) {
11
45
  NetworkType[NetworkType["L1"] = 0] = "L1";
12
46
  NetworkType[NetworkType["L2"] = 1] = "L2";
13
47
  })(NetworkType || (exports.NetworkType = NetworkType = {}));
14
48
  var CHAIN_INFO = (_a = {},
15
- _a[chains_1.SupportedChainId.MAINNET] = {
49
+ _a[sdk_core_1.ChainId.MAINNET] = {
16
50
  networkType: NetworkType.L1,
17
51
  docs: 'https://docs.uniswap.org/',
18
52
  explorer: 'https://etherscan.io/',
19
53
  infoLink: 'https://info.uniswap.org/#/',
20
54
  label: 'Ethereum',
21
- //logoUrl: ethereumLogoUrl,
22
55
  nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
23
- color: '#627EEA',
24
- },
25
- _a[chains_1.SupportedChainId.RINKEBY] = {
26
- networkType: NetworkType.L1,
27
- docs: 'https://docs.uniswap.org/',
28
- explorer: 'https://rinkeby.etherscan.io/',
29
- infoLink: 'https://info.uniswap.org/#/',
30
- label: 'Rinkeby',
31
- //logoUrl: ethereumLogoUrl,
32
- nativeCurrency: { name: 'Rinkeby Ether', symbol: 'rETH', decimals: 18 },
33
- color: '#FB118E',
34
- },
35
- _a[chains_1.SupportedChainId.ROPSTEN] = {
36
- networkType: NetworkType.L1,
37
- docs: 'https://docs.uniswap.org/',
38
- explorer: 'https://ropsten.etherscan.io/',
39
- infoLink: 'https://info.uniswap.org/#/',
40
- label: 'Ropsten',
41
- //logoUrl: ethereumLogoUrl,
42
- nativeCurrency: { name: 'Ropsten Ether', symbol: 'ropETH', decimals: 18 },
43
- color: '#A08116',
56
+ color: '#fcfc03',
44
57
  },
45
- _a[chains_1.SupportedChainId.KOVAN] = {
58
+ _a[sdk_core_1.ChainId.GOERLI] = {
46
59
  networkType: NetworkType.L1,
47
60
  docs: 'https://docs.uniswap.org/',
48
- explorer: 'https://kovan.etherscan.io/',
61
+ explorer: 'https://goerli.etherscan.io/',
49
62
  infoLink: 'https://info.uniswap.org/#/',
50
- label: 'Kovan',
51
- //logoUrl: ethereumLogoUrl,
52
- nativeCurrency: { name: 'Kovan Ether', symbol: 'kovETH', decimals: 18 },
53
- color: '#FF0420',
63
+ label: 'Görli',
64
+ nativeCurrency: { name: 'Görli Ether', symbol: 'görETH', decimals: 18 },
65
+ color: '#fcfc03',
54
66
  },
55
- _a[chains_1.SupportedChainId.GOERLI] = {
67
+ _a[sdk_core_1.ChainId.SEPOLIA] = {
56
68
  networkType: NetworkType.L1,
57
69
  docs: 'https://docs.uniswap.org/',
58
- explorer: 'https://goerli.etherscan.io/',
70
+ explorer: 'https://sepolia.etherscan.io/',
59
71
  infoLink: 'https://info.uniswap.org/#/',
60
- label: 'Görli',
61
- //logoUrl: ethereumLogoUrl,
62
- nativeCurrency: { name: 'Görli Ether', symbol: 'görETH', decimals: 18 },
63
- color: '#209853',
72
+ label: 'Sepolia',
73
+ nativeCurrency: { name: 'Sepolia Ether', symbol: 'SepoliaETH', decimals: 18 },
74
+ color: '#fcfc03',
64
75
  },
65
- _a[chains_1.SupportedChainId.OPTIMISM] = {
76
+ _a[sdk_core_1.ChainId.OPTIMISM] = {
66
77
  networkType: NetworkType.L2,
67
- blockWaitMsBeforeWarning: 1500000,
78
+ blockWaitMsBeforeWarning: (0, ms_1.default)("25m"),
68
79
  bridge: 'https://app.optimism.io/bridge',
80
+ defaultListUrl: lists_1.OPTIMISM_LIST,
69
81
  docs: 'https://optimism.io/',
70
82
  explorer: 'https://optimistic.etherscan.io/',
71
83
  infoLink: 'https://info.uniswap.org/#/optimism/',
72
84
  label: 'Optimism',
73
- //logoUrl: optimismLogoUrl,
74
85
  statusPage: 'https://optimism.io/status',
75
86
  helpCenterUrl: 'https://help.uniswap.org/en/collections/3137778-uniswap-on-optimistic-ethereum-oξ',
76
87
  nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
77
- color: '#FF0420',
78
- backgroundColor: '#ff042029',
88
+ color: '#fcfc03',
89
+ backgroundColor: '#fcfc03',
79
90
  },
80
- _a[chains_1.SupportedChainId.OPTIMISM_GOERLI] = {
91
+ _a[sdk_core_1.ChainId.OPTIMISM_GOERLI] = {
81
92
  networkType: NetworkType.L2,
82
- blockWaitMsBeforeWarning: 1500000,
93
+ blockWaitMsBeforeWarning: (0, ms_1.default)("25m"),
83
94
  bridge: 'https://app.optimism.io/bridge',
95
+ defaultListUrl: lists_1.OPTIMISM_LIST,
84
96
  docs: 'https://optimism.io/',
85
97
  explorer: 'https://goerli-optimism.etherscan.io/',
86
98
  infoLink: 'https://info.uniswap.org/#/optimism/',
87
- safe: { label: 'Optimism Goerli Testnet', symbol: 'ETH' },
88
99
  label: 'Optimism Görli',
89
- //logoUrl: optimismLogoUrl,
90
100
  statusPage: 'https://optimism.io/status',
91
101
  helpCenterUrl: 'https://help.uniswap.org/en/collections/3137778-uniswap-on-optimistic-ethereum-oξ',
92
102
  nativeCurrency: { name: 'Optimism Goerli Ether', symbol: 'görOpETH', decimals: 18 },
93
- color: '#FF0420',
94
- backgroundColor: '#ff042029',
103
+ color: '#fcfc03',
95
104
  },
96
- _a[chains_1.SupportedChainId.ARBITRUM_ONE] = {
105
+ _a[sdk_core_1.ChainId.ARBITRUM_ONE] = {
97
106
  networkType: NetworkType.L2,
98
- blockWaitMsBeforeWarning: 600000,
107
+ blockWaitMsBeforeWarning: (0, ms_1.default)("10m"),
99
108
  bridge: 'https://bridge.arbitrum.io/',
100
109
  docs: 'https://offchainlabs.com/',
101
110
  explorer: 'https://arbiscan.io/',
102
111
  infoLink: 'https://info.uniswap.org/#/arbitrum',
103
112
  label: 'Arbitrum',
104
- //logoUrl: arbitrumLogoUrl,
113
+ defaultListUrl: lists_1.ARBITRUM_LIST,
105
114
  helpCenterUrl: 'https://help.uniswap.org/en/collections/3137787-uniswap-on-arbitrum',
106
115
  nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
107
- color: '#28A0F0',
108
- backgroundColor: '#28a0f029',
116
+ color: '#fcfc03',
117
+ backgroundColor: '#fcfc03',
109
118
  },
110
- _a[chains_1.SupportedChainId.ARBITRUM_RINKEBY] = {
119
+ _a[sdk_core_1.ChainId.ARBITRUM_GOERLI] = {
111
120
  networkType: NetworkType.L2,
112
- blockWaitMsBeforeWarning: 600000,
121
+ blockWaitMsBeforeWarning: (0, ms_1.default)("10m"),
113
122
  bridge: 'https://bridge.arbitrum.io/',
114
123
  docs: 'https://offchainlabs.com/',
115
- explorer: 'https://rinkeby-explorer.arbitrum.io/',
124
+ explorer: 'https://goerli.arbiscan.io/',
116
125
  infoLink: 'https://info.uniswap.org/#/arbitrum/',
117
- label: 'Arbitrum Rinkeby',
118
- //logoUrl: arbitrumLogoUrl,
126
+ label: 'Arbitrum Goerli',
127
+ defaultListUrl: lists_1.ARBITRUM_LIST, // TODO: use arbitrum goerli token list
119
128
  helpCenterUrl: 'https://help.uniswap.org/en/collections/3137787-uniswap-on-arbitrum',
120
- nativeCurrency: { name: 'Rinkeby Arbitrum Ether', symbol: 'rinkArbETH', decimals: 18 },
121
- color: '#28A0F0',
122
- backgroundColor: '#28a0f029',
129
+ nativeCurrency: { name: 'Goerli Arbitrum Ether', symbol: 'goerliArbETH', decimals: 18 },
130
+ color: '#fcfc03',
123
131
  },
124
- _a[chains_1.SupportedChainId.POLYGON] = {
132
+ _a[sdk_core_1.ChainId.POLYGON] = {
125
133
  networkType: NetworkType.L1,
126
- blockWaitMsBeforeWarning: 600000,
127
- bridge: 'https://wallet.polygon.technology/login?redirectTo=%2Fpolygon%2Fbridge',
134
+ blockWaitMsBeforeWarning: (0, ms_1.default)("10m"),
135
+ bridge: 'https://wallet.polygon.technology/polygon/bridge',
128
136
  docs: 'https://polygon.io/',
129
137
  explorer: 'https://polygonscan.com/',
130
138
  infoLink: 'https://info.uniswap.org/#/polygon/',
131
- safe: { label: 'Polygon Mainnet' },
132
139
  label: 'Polygon',
133
- //logoUrl: polygonMaticLogo,
134
140
  nativeCurrency: { name: 'Polygon Matic', symbol: 'MATIC', decimals: 18 },
135
- color: '#A457FF',
136
- backgroundColor: '#a457ff29',
141
+ color: '#fcfc03',
142
+ backgroundColor: '#fcfc03',
137
143
  },
138
- _a[chains_1.SupportedChainId.POLYGON_MUMBAI] = {
144
+ _a[sdk_core_1.ChainId.POLYGON_MUMBAI] = {
139
145
  networkType: NetworkType.L1,
140
- blockWaitMsBeforeWarning: 600000,
141
- bridge: 'https://wallet.polygon.technology/login?redirectTo=%2Fpolygon%2Fbridge',
146
+ blockWaitMsBeforeWarning: (0, ms_1.default)("10m"),
147
+ bridge: 'https://wallet.polygon.technology/polygon/bridge/deposit',
142
148
  docs: 'https://polygon.io/',
143
149
  explorer: 'https://mumbai.polygonscan.com/',
144
150
  infoLink: 'https://info.uniswap.org/#/polygon/',
145
- safe: { symbol: 'MATIC' },
146
151
  label: 'Polygon Mumbai',
147
- //logoUrl: polygonMaticLogo,
148
152
  nativeCurrency: { name: 'Polygon Mumbai Matic', symbol: 'mMATIC', decimals: 18 },
149
- color: '#A457FF',
150
- backgroundColor: '#a457ff29',
151
153
  },
152
- _a[chains_1.SupportedChainId.CELO] = {
154
+ _a[sdk_core_1.ChainId.CELO] = {
153
155
  networkType: NetworkType.L1,
154
- blockWaitMsBeforeWarning: 600000,
156
+ blockWaitMsBeforeWarning: (0, ms_1.default)("10m"),
155
157
  bridge: 'https://www.portalbridge.com/#/transfer',
156
158
  docs: 'https://docs.celo.org/',
157
159
  explorer: 'https://celoscan.io/',
158
- infoLink: 'https://info.uniswap.org/#/celo',
159
- safe: { label: 'Celo Mainnet' },
160
+ infoLink: 'https://info.uniswap.org/#/celo/',
160
161
  label: 'Celo',
161
- //logoUrl: celoLogo,
162
162
  nativeCurrency: { name: 'Celo', symbol: 'CELO', decimals: 18 },
163
- color: '#35D07F',
164
- backgroundColor: '#34d07f1f',
163
+ defaultListUrl: lists_1.CELO_LIST,
165
164
  },
166
- _a[chains_1.SupportedChainId.CELO_ALFAJORES] = {
165
+ _a[sdk_core_1.ChainId.CELO_ALFAJORES] = {
167
166
  networkType: NetworkType.L1,
168
- blockWaitMsBeforeWarning: 600000,
167
+ blockWaitMsBeforeWarning: (0, ms_1.default)("10m"),
169
168
  bridge: 'https://www.portalbridge.com/#/transfer',
170
169
  docs: 'https://docs.celo.org/',
171
- explorer: 'https://alfajores.celoscan.io/',
172
- infoLink: 'https://info.uniswap.org/#/celo',
173
- safe: { label: 'Celo Alfajores Testnet', symbol: 'CELO' },
170
+ explorer: 'https://alfajores-blockscout.celo-testnet.org/',
171
+ infoLink: 'https://info.uniswap.org/#/celo/',
174
172
  label: 'Celo Alfajores',
175
- //logoUrl: celoLogo,
176
- nativeCurrency: { name: 'Celo', symbol: 'aCELO', decimals: 18 },
177
- color: '#35D07F',
178
- backgroundColor: '#34d07f1f',
173
+ nativeCurrency: { name: 'Celo', symbol: 'CELO', decimals: 18 },
174
+ defaultListUrl: lists_1.CELO_LIST,
179
175
  },
180
- _a[chains_1.SupportedChainId.BNB] = {
176
+ _a[sdk_core_1.ChainId.BNB] = {
181
177
  networkType: NetworkType.L1,
182
- blockWaitMsBeforeWarning: 600000,
178
+ blockWaitMsBeforeWarning: (0, ms_1.default)("10m"),
183
179
  bridge: 'https://cbridge.celer.network/1/56',
184
180
  docs: 'https://docs.bnbchain.org/',
185
181
  explorer: 'https://bscscan.com/',
186
182
  infoLink: 'https://info.uniswap.org/#/bnb/',
187
183
  label: 'BNB Chain',
188
- //logoUrl: bnbLogo,
189
184
  nativeCurrency: { name: 'BNB', symbol: 'BNB', decimals: 18 },
190
- color: '#F0B90B',
191
- backgroundColor: '#F0B90B',
185
+ defaultListUrl: lists_1.PLASMA_BNB_LIST,
186
+ color: '#fcfc03',
187
+ backgroundColor: '#fcfc03',
192
188
  },
193
- _a[chains_1.SupportedChainId.BASE] = {
189
+ _a[sdk_core_1.ChainId.AVALANCHE] = {
190
+ networkType: NetworkType.L1,
191
+ blockWaitMsBeforeWarning: (0, ms_1.default)("10m"),
192
+ bridge: 'https://core.app/bridge/',
193
+ docs: 'https://docs.avax.network/',
194
+ explorer: 'https://snowtrace.io/',
195
+ infoLink: 'https://info.uniswap.org/#/avax/', // TODO(WEB-2336): Add avax support to info site
196
+ label: 'Avalanche',
197
+ nativeCurrency: { name: 'AVAX', symbol: 'AVAX', decimals: 18 },
198
+ defaultListUrl: lists_1.AVALANCHE_LIST,
199
+ color: '#fcfc03',
200
+ backgroundColor: '#fcfc03',
201
+ },
202
+ _a[sdk_core_1.ChainId.BASE] = {
194
203
  networkType: NetworkType.L2,
195
- blockWaitMsBeforeWarning: 1500000,
196
- bridge: 'https://bridge.base.org/',
197
- docs: 'https://docs.base.org/',
204
+ blockWaitMsBeforeWarning: (0, ms_1.default)("25m"),
205
+ bridge: 'https://bridge.base.org/deposit',
206
+ defaultListUrl: lists_1.BASE_LIST,
207
+ docs: 'https://docs.base.org',
198
208
  explorer: 'https://basescan.org/',
199
209
  infoLink: 'https://info.uniswap.org/#/base/',
200
210
  label: 'Base',
201
- //logoUrl: baseLogo,
211
+ statusPage: 'https://status.base.org/',
202
212
  nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
203
- color: '#0152ff',
204
- backgroundColor: '#0152ff',
213
+ color: '#fcfc03',
214
+ },
215
+ _a[sdk_core_1.ChainId.BLAST] = {
216
+ networkType: NetworkType.L2,
217
+ bridge: 'https://blast.io/bridge',
218
+ defaultListUrl: '',
219
+ docs: 'https://docs.blast.io',
220
+ explorer: 'https://blastscan.io/',
221
+ infoLink: 'https://info.uniswap.org/#/blast/',
222
+ label: 'Blast',
223
+ nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
224
+ color: '#fcfc03', //'#fcfc03'
205
225
  },
206
226
  _a);
207
227
  /**
208
228
  * Overloaded method for returning ChainInfo given a chainID
209
229
  * Return type varies depending on input type:
210
230
  * number | undefined -> returns chaininfo | undefined
211
- * SupportedChainId -> returns L1ChainInfo | L2ChainInfo
231
+ * ChainId -> returns L1ChainInfo | L2ChainInfo
212
232
  * SupportedL1ChainId -> returns L1ChainInfo
213
233
  * SupportedL2ChainId -> returns L2ChainInfo
214
234
  */
215
- function getChainInfo(chainId) {
235
+ function getChainInfo(chainId, featureFlags) {
216
236
  var _a;
237
+ if (featureFlags && chainId in featureFlags) {
238
+ return featureFlags[chainId] ? CHAIN_INFO[chainId] : undefined;
239
+ }
217
240
  if (chainId) {
218
241
  return (_a = CHAIN_INFO[chainId]) !== null && _a !== void 0 ? _a : undefined;
219
242
  }
220
243
  return undefined;
221
244
  }
222
245
  exports.getChainInfo = getChainInfo;
223
- exports.MAINNET_INFO = CHAIN_INFO[chains_1.SupportedChainId.MAINNET];
224
- function getChainInfoOrDefault(chainId) {
246
+ var MAINNET_INFO = CHAIN_INFO[sdk_core_1.ChainId.MAINNET];
247
+ function getChainInfoOrDefault(chainId, featureFlags) {
225
248
  var _a;
226
- return (_a = getChainInfo(chainId)) !== null && _a !== void 0 ? _a : exports.MAINNET_INFO;
249
+ return (_a = getChainInfo(chainId, featureFlags)) !== null && _a !== void 0 ? _a : MAINNET_INFO;
227
250
  }
228
251
  exports.getChainInfoOrDefault = getChainInfoOrDefault;
229
- function isSupportedChainId(chainId) {
230
- if (chainId === undefined)
231
- return false;
232
- return !!chains_1.SupportedChainId[chainId];
233
- }
234
- exports.isSupportedChainId = isSupportedChainId;
@@ -1,57 +1,46 @@
1
- /**
2
- * List of all the networks supported by the Uniswap Interface
3
- */
4
- export declare enum SupportedChainId {
5
- MAINNET = 1,
6
- ROPSTEN = 3,
7
- RINKEBY = 4,
8
- GOERLI = 5,
9
- KOVAN = 42,
10
- ARBITRUM_ONE = 42161,
11
- ARBITRUM_RINKEBY = 421611,
12
- OPTIMISM = 10,
13
- OPTIMISM_GOERLI = 420,
14
- POLYGON = 137,
15
- POLYGON_MUMBAI = 80001,
16
- CELO = 42220,
17
- CELO_ALFAJORES = 44787,
18
- BNB = 56,
19
- BASE = 8453
20
- }
21
- export declare enum ChainName {
22
- MAINNET = "mainnet",
23
- ROPSTEN = "ropsten",
24
- RINKEBY = "rinkeby",
25
- GOERLI = "goerli",
26
- KOVAN = "kovan",
27
- OPTIMISM = "optimism-mainnet",
28
- OPTIMISM_GOERLI = "optimism-goerli",
29
- ARBITRUM_ONE = "arbitrum-mainnet",
30
- ARBITRUM_RINKEBY = "arbitrum-rinkeby",
31
- POLYGON = "polygon-mainnet",
32
- POLYGON_MUMBAI = "polygon-mumbai",
33
- CELO = "celo",
34
- CELO_ALFAJORES = "celo-alfajores",
35
- BNB = "bnb",
36
- BASE = "base"
37
- }
38
- export declare const CHAIN_NAMES_TO_IDS: {
39
- [chainName: string]: SupportedChainId;
1
+ import { ChainId, SupportedChainsType } from '@uniswap/sdk-core';
2
+ export declare const CHAIN_IDS_TO_NAMES: {
3
+ readonly 1: "mainnet";
4
+ readonly 5: "goerli";
5
+ readonly 11155111: "sepolia";
6
+ readonly 137: "polygon";
7
+ readonly 80001: "polygon_mumbai";
8
+ readonly 42220: "celo";
9
+ readonly 44787: "celo_alfajores";
10
+ readonly 42161: "arbitrum";
11
+ readonly 421613: "arbitrum_goerli";
12
+ readonly 10: "optimism";
13
+ readonly 420: "optimism_goerli";
14
+ readonly 56: "bnb";
15
+ readonly 43114: "avalanche";
16
+ readonly 8453: "base";
17
+ readonly 81457: "blast";
40
18
  };
19
+ export type SupportedInterfaceChain = Exclude<SupportedChainsType, ChainId.BASE_GOERLI | ChainId.ARBITRUM_SEPOLIA | ChainId.OPTIMISM_SEPOLIA | ChainId.ROOTSTOCK | ChainId.ZORA | ChainId.ZORA_SEPOLIA>;
20
+ export declare function isSupportedChain(chainId: number | null | undefined | ChainId, featureFlags?: Record<number, boolean>): chainId is SupportedInterfaceChain;
21
+ export declare function asSupportedChain(chainId: number | null | undefined | ChainId, featureFlags?: Record<number, boolean>): SupportedInterfaceChain | undefined;
22
+ export declare const SUPPORTED_GAS_ESTIMATE_CHAIN_IDS: readonly [ChainId.MAINNET, ChainId.POLYGON, ChainId.CELO, ChainId.OPTIMISM, ChainId.ARBITRUM_ONE, ChainId.BNB, ChainId.AVALANCHE, ChainId.BASE, ChainId.BLAST];
41
23
  /**
42
- * Array of all the supported chain IDs
24
+ * @deprecated when v2 pools are enabled on chains supported through sdk-core
43
25
  */
44
- export declare const ALL_SUPPORTED_CHAIN_IDS: SupportedChainId[];
45
- export declare const SUPPORTED_GAS_ESTIMATE_CHAIN_IDS: SupportedChainId[];
26
+ export declare const SUPPORTED_V2POOL_CHAIN_IDS_DEPRECATED: readonly [ChainId.MAINNET, ChainId.GOERLI];
27
+ export declare const SUPPORTED_V2POOL_CHAIN_IDS: number[];
28
+ export declare const TESTNET_CHAIN_IDS: readonly [ChainId.GOERLI, ChainId.SEPOLIA, ChainId.POLYGON_MUMBAI, ChainId.ARBITRUM_GOERLI, ChainId.OPTIMISM_GOERLI, ChainId.CELO_ALFAJORES];
46
29
  /**
47
30
  * All the chain IDs that are running the Ethereum protocol.
48
31
  */
49
- export declare const L1_CHAIN_IDS: readonly [SupportedChainId.MAINNET, SupportedChainId.ROPSTEN, SupportedChainId.RINKEBY, SupportedChainId.GOERLI, SupportedChainId.KOVAN, SupportedChainId.POLYGON, SupportedChainId.POLYGON_MUMBAI, SupportedChainId.CELO, SupportedChainId.CELO_ALFAJORES];
50
- export type SupportedL1ChainId = typeof L1_CHAIN_IDS[number];
32
+ export declare const L1_CHAIN_IDS: readonly [ChainId.MAINNET, ChainId.GOERLI, ChainId.SEPOLIA, ChainId.POLYGON, ChainId.POLYGON_MUMBAI, ChainId.CELO, ChainId.CELO_ALFAJORES, ChainId.BNB, ChainId.AVALANCHE];
33
+ export type SupportedL1ChainId = (typeof L1_CHAIN_IDS)[number];
51
34
  /**
52
35
  * Controls some L2 specific behavior, e.g. slippage tolerance, special UI behavior.
53
36
  * The expectation is that all of these networks have immediate transaction confirmation.
54
37
  */
55
- export declare const L2_CHAIN_IDS: readonly [SupportedChainId.ARBITRUM_ONE, SupportedChainId.ARBITRUM_RINKEBY, SupportedChainId.OPTIMISM, SupportedChainId.OPTIMISM_GOERLI, SupportedChainId.BASE];
56
- export type SupportedL2ChainId = typeof L2_CHAIN_IDS[number];
57
- export declare function isPolygonChain(chainId: number): chainId is SupportedChainId.POLYGON | SupportedChainId.POLYGON_MUMBAI;
38
+ export declare const L2_CHAIN_IDS: readonly [ChainId.ARBITRUM_ONE, ChainId.ARBITRUM_GOERLI, ChainId.OPTIMISM, ChainId.OPTIMISM_GOERLI, ChainId.BASE, ChainId.BLAST];
39
+ export type SupportedL2ChainId = (typeof L2_CHAIN_IDS)[number];
40
+ /**
41
+ * Get the priority of a chainId based on its relevance to the user.
42
+ * @param {ChainId} chainId - The chainId to determine the priority for.
43
+ * @returns {number} The priority of the chainId, the lower the priority, the earlier it should be displayed, with base of MAINNET=0.
44
+ */
45
+ export declare function getChainPriority(chainId: ChainId): number;
46
+ export declare function isUniswapXSupportedChain(chainId: number): boolean;