@pioneer-platform/uniswap-client 0.0.29 → 0.1.1

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 (68) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/package.json +16 -25
  3. package/tsconfig.json +28 -8
  4. package/LICENSE +0 -674
  5. package/lib/constants/chainInfo.d.ts +0 -47
  6. package/lib/constants/chainInfo.js +0 -251
  7. package/lib/constants/chains.d.ts +0 -46
  8. package/lib/constants/chains.js +0 -137
  9. package/lib/constants/chains.test.d.ts +0 -1
  10. package/lib/constants/chains.test.js +0 -26
  11. package/lib/constants/governance.d.ts +0 -8
  12. package/lib/constants/governance.js +0 -24
  13. package/lib/constants/lists.d.ts +0 -12
  14. package/lib/constants/lists.js +0 -64
  15. package/lib/constants/localCurrencies.d.ts +0 -6
  16. package/lib/constants/localCurrencies.js +0 -94
  17. package/lib/constants/localCurrencyIcons.d.ts +0 -18
  18. package/lib/constants/localCurrencyIcons.js +0 -298
  19. package/lib/constants/locales.d.ts +0 -6
  20. package/lib/constants/locales.js +0 -71
  21. package/lib/constants/misc.d.ts +0 -17
  22. package/lib/constants/misc.js +0 -31
  23. package/lib/constants/networks.d.ts +0 -21
  24. package/lib/constants/networks.js +0 -170
  25. package/lib/constants/proposals/index.d.ts +0 -5
  26. package/lib/constants/proposals/index.js +0 -8
  27. package/lib/constants/proposals/polygon_proposal_title.d.ts +0 -1
  28. package/lib/constants/proposals/polygon_proposal_title.js +0 -4
  29. package/lib/constants/proposals/uniswap_grants_proposal_description.d.ts +0 -1
  30. package/lib/constants/proposals/uniswap_grants_proposal_description.js +0 -4
  31. package/lib/constants/providers.d.ts +0 -19
  32. package/lib/constants/providers.js +0 -33
  33. package/lib/constants/routing.d.ts +0 -16
  34. package/lib/constants/routing.js +0 -123
  35. package/lib/constants/routing.test.d.ts +0 -1
  36. package/lib/constants/routing.test.js +0 -32
  37. package/lib/constants/supportArticles.d.ts +0 -13
  38. package/lib/constants/supportArticles.js +0 -17
  39. package/lib/constants/tokenLists/broken.tokenlist.json +0 -22
  40. package/lib/constants/tokenLogoLookup.d.ts +0 -8
  41. package/lib/constants/tokenLogoLookup.js +0 -48
  42. package/lib/constants/tokenSafety.js +0 -129
  43. package/lib/constants/tokenSafetyLookup.d.ts +0 -18
  44. package/lib/constants/tokenSafetyLookup.js +0 -66
  45. package/lib/constants/tokenSaftey.test.d.ts +0 -1
  46. package/lib/constants/tokenSaftey.test.js +0 -31
  47. package/lib/constants/tokens.d.ts +0 -70
  48. package/lib/constants/tokens.js +0 -289
  49. package/lib/index.d.ts +0 -1
  50. package/lib/index.js +0 -1045
  51. package/lib/routing/clientSideSmartOrderRouter.d.ts +0 -5
  52. package/lib/routing/clientSideSmartOrderRouter.js +0 -151
  53. package/lib/routing/gas.d.ts +0 -5
  54. package/lib/routing/gas.js +0 -158
  55. package/lib/routing/types.d.ts +0 -393
  56. package/lib/routing/types.js +0 -424
  57. package/lib/routing/utils.d.ts +0 -28
  58. package/lib/routing/utils.js +0 -319
  59. package/lib/rpc/AppJsonRpcProvider.d.ts +0 -44
  60. package/lib/rpc/AppJsonRpcProvider.js +0 -183
  61. package/lib/rpc/ConfiguredJsonRpcProvider.d.ts +0 -8
  62. package/lib/rpc/ConfiguredJsonRpcProvider.js +0 -35
  63. package/lib/utils/contracts/getContract.d.ts +0 -3
  64. package/lib/utils/contracts/getContract.js +0 -29
  65. package/lib/utils/transformSwapRouteToGetQuoteResult.d.ts +0 -4
  66. package/lib/utils/transformSwapRouteToGetQuoteResult.js +0 -116
  67. package/lib/utils/uniswapData.d.ts +0 -21
  68. package/lib/utils/uniswapData.js +0 -217
@@ -1,47 +0,0 @@
1
- import { ChainId } from '@uniswap/sdk-core';
2
- import { SupportedL1ChainId, SupportedL2ChainId } from './chains';
3
- export declare const AVERAGE_L1_BLOCK_TIME: number;
4
- export declare const DEFAULT_MS_BEFORE_WARNING: number;
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;
11
- export declare enum NetworkType {
12
- L1 = 0,
13
- L2 = 1
14
- }
15
- interface BaseChainInfo {
16
- readonly networkType: NetworkType;
17
- readonly blockWaitMsBeforeWarning?: number;
18
- readonly docs: string;
19
- readonly bridge?: string;
20
- readonly explorer: string;
21
- readonly infoLink: string;
22
- readonly label: string;
23
- readonly helpCenterUrl?: string;
24
- readonly nativeCurrency: {
25
- name: string;
26
- symbol: string;
27
- decimals: number;
28
- };
29
- readonly color?: string;
30
- readonly backgroundColor?: string;
31
- }
32
- interface L1ChainInfo extends BaseChainInfo {
33
- readonly networkType: NetworkType.L1;
34
- readonly defaultListUrl?: string;
35
- }
36
- export interface L2ChainInfo extends BaseChainInfo {
37
- readonly networkType: NetworkType.L2;
38
- readonly bridge: string;
39
- readonly statusPage?: string;
40
- readonly defaultListUrl: string;
41
- }
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;
47
- export {};
@@ -1,251 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- var _a;
6
- Object.defineProperty(exports, "__esModule", { value: true });
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;
43
- var NetworkType;
44
- (function (NetworkType) {
45
- NetworkType[NetworkType["L1"] = 0] = "L1";
46
- NetworkType[NetworkType["L2"] = 1] = "L2";
47
- })(NetworkType || (exports.NetworkType = NetworkType = {}));
48
- var CHAIN_INFO = (_a = {},
49
- _a[sdk_core_1.ChainId.MAINNET] = {
50
- networkType: NetworkType.L1,
51
- docs: 'https://docs.uniswap.org/',
52
- explorer: 'https://etherscan.io/',
53
- infoLink: 'https://info.uniswap.org/#/',
54
- label: 'Ethereum',
55
- nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
56
- color: '#fcfc03',
57
- },
58
- _a[sdk_core_1.ChainId.GOERLI] = {
59
- networkType: NetworkType.L1,
60
- docs: 'https://docs.uniswap.org/',
61
- explorer: 'https://goerli.etherscan.io/',
62
- infoLink: 'https://info.uniswap.org/#/',
63
- label: 'Görli',
64
- nativeCurrency: { name: 'Görli Ether', symbol: 'görETH', decimals: 18 },
65
- color: '#fcfc03',
66
- },
67
- _a[sdk_core_1.ChainId.SEPOLIA] = {
68
- networkType: NetworkType.L1,
69
- docs: 'https://docs.uniswap.org/',
70
- explorer: 'https://sepolia.etherscan.io/',
71
- infoLink: 'https://info.uniswap.org/#/',
72
- label: 'Sepolia',
73
- nativeCurrency: { name: 'Sepolia Ether', symbol: 'SepoliaETH', decimals: 18 },
74
- color: '#fcfc03',
75
- },
76
- _a[sdk_core_1.ChainId.OPTIMISM] = {
77
- networkType: NetworkType.L2,
78
- blockWaitMsBeforeWarning: (0, ms_1.default)("25m"),
79
- bridge: 'https://app.optimism.io/bridge',
80
- defaultListUrl: lists_1.OPTIMISM_LIST,
81
- docs: 'https://optimism.io/',
82
- explorer: 'https://optimistic.etherscan.io/',
83
- infoLink: 'https://info.uniswap.org/#/optimism/',
84
- label: 'Optimism',
85
- statusPage: 'https://optimism.io/status',
86
- helpCenterUrl: 'https://help.uniswap.org/en/collections/3137778-uniswap-on-optimistic-ethereum-oξ',
87
- nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
88
- color: '#fcfc03',
89
- backgroundColor: '#fcfc03',
90
- },
91
- _a[sdk_core_1.ChainId.OPTIMISM_GOERLI] = {
92
- networkType: NetworkType.L2,
93
- blockWaitMsBeforeWarning: (0, ms_1.default)("25m"),
94
- bridge: 'https://app.optimism.io/bridge',
95
- defaultListUrl: lists_1.OPTIMISM_LIST,
96
- docs: 'https://optimism.io/',
97
- explorer: 'https://goerli-optimism.etherscan.io/',
98
- infoLink: 'https://info.uniswap.org/#/optimism/',
99
- label: 'Optimism Görli',
100
- statusPage: 'https://optimism.io/status',
101
- helpCenterUrl: 'https://help.uniswap.org/en/collections/3137778-uniswap-on-optimistic-ethereum-oξ',
102
- nativeCurrency: { name: 'Optimism Goerli Ether', symbol: 'görOpETH', decimals: 18 },
103
- color: '#fcfc03',
104
- },
105
- _a[sdk_core_1.ChainId.ARBITRUM_ONE] = {
106
- networkType: NetworkType.L2,
107
- blockWaitMsBeforeWarning: (0, ms_1.default)("10m"),
108
- bridge: 'https://bridge.arbitrum.io/',
109
- docs: 'https://offchainlabs.com/',
110
- explorer: 'https://arbiscan.io/',
111
- infoLink: 'https://info.uniswap.org/#/arbitrum',
112
- label: 'Arbitrum',
113
- defaultListUrl: lists_1.ARBITRUM_LIST,
114
- helpCenterUrl: 'https://help.uniswap.org/en/collections/3137787-uniswap-on-arbitrum',
115
- nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
116
- color: '#fcfc03',
117
- backgroundColor: '#fcfc03',
118
- },
119
- _a[sdk_core_1.ChainId.ARBITRUM_GOERLI] = {
120
- networkType: NetworkType.L2,
121
- blockWaitMsBeforeWarning: (0, ms_1.default)("10m"),
122
- bridge: 'https://bridge.arbitrum.io/',
123
- docs: 'https://offchainlabs.com/',
124
- explorer: 'https://goerli.arbiscan.io/',
125
- infoLink: 'https://info.uniswap.org/#/arbitrum/',
126
- label: 'Arbitrum Goerli',
127
- defaultListUrl: lists_1.ARBITRUM_LIST, // TODO: use arbitrum goerli token list
128
- helpCenterUrl: 'https://help.uniswap.org/en/collections/3137787-uniswap-on-arbitrum',
129
- nativeCurrency: { name: 'Goerli Arbitrum Ether', symbol: 'goerliArbETH', decimals: 18 },
130
- color: '#fcfc03',
131
- },
132
- _a[sdk_core_1.ChainId.POLYGON] = {
133
- networkType: NetworkType.L1,
134
- blockWaitMsBeforeWarning: (0, ms_1.default)("10m"),
135
- bridge: 'https://wallet.polygon.technology/polygon/bridge',
136
- docs: 'https://polygon.io/',
137
- explorer: 'https://polygonscan.com/',
138
- infoLink: 'https://info.uniswap.org/#/polygon/',
139
- label: 'Polygon',
140
- nativeCurrency: { name: 'Polygon Matic', symbol: 'MATIC', decimals: 18 },
141
- color: '#fcfc03',
142
- backgroundColor: '#fcfc03',
143
- },
144
- _a[sdk_core_1.ChainId.POLYGON_MUMBAI] = {
145
- networkType: NetworkType.L1,
146
- blockWaitMsBeforeWarning: (0, ms_1.default)("10m"),
147
- bridge: 'https://wallet.polygon.technology/polygon/bridge/deposit',
148
- docs: 'https://polygon.io/',
149
- explorer: 'https://mumbai.polygonscan.com/',
150
- infoLink: 'https://info.uniswap.org/#/polygon/',
151
- label: 'Polygon Mumbai',
152
- nativeCurrency: { name: 'Polygon Mumbai Matic', symbol: 'mMATIC', decimals: 18 },
153
- },
154
- _a[sdk_core_1.ChainId.CELO] = {
155
- networkType: NetworkType.L1,
156
- blockWaitMsBeforeWarning: (0, ms_1.default)("10m"),
157
- bridge: 'https://www.portalbridge.com/#/transfer',
158
- docs: 'https://docs.celo.org/',
159
- explorer: 'https://celoscan.io/',
160
- infoLink: 'https://info.uniswap.org/#/celo/',
161
- label: 'Celo',
162
- nativeCurrency: { name: 'Celo', symbol: 'CELO', decimals: 18 },
163
- defaultListUrl: lists_1.CELO_LIST,
164
- },
165
- _a[sdk_core_1.ChainId.CELO_ALFAJORES] = {
166
- networkType: NetworkType.L1,
167
- blockWaitMsBeforeWarning: (0, ms_1.default)("10m"),
168
- bridge: 'https://www.portalbridge.com/#/transfer',
169
- docs: 'https://docs.celo.org/',
170
- explorer: 'https://alfajores-blockscout.celo-testnet.org/',
171
- infoLink: 'https://info.uniswap.org/#/celo/',
172
- label: 'Celo Alfajores',
173
- nativeCurrency: { name: 'Celo', symbol: 'CELO', decimals: 18 },
174
- defaultListUrl: lists_1.CELO_LIST,
175
- },
176
- _a[sdk_core_1.ChainId.BNB] = {
177
- networkType: NetworkType.L1,
178
- blockWaitMsBeforeWarning: (0, ms_1.default)("10m"),
179
- bridge: 'https://cbridge.celer.network/1/56',
180
- docs: 'https://docs.bnbchain.org/',
181
- explorer: 'https://bscscan.com/',
182
- infoLink: 'https://info.uniswap.org/#/bnb/',
183
- label: 'BNB Chain',
184
- nativeCurrency: { name: 'BNB', symbol: 'BNB', decimals: 18 },
185
- defaultListUrl: lists_1.PLASMA_BNB_LIST,
186
- color: '#fcfc03',
187
- backgroundColor: '#fcfc03',
188
- },
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] = {
203
- networkType: NetworkType.L2,
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',
208
- explorer: 'https://basescan.org/',
209
- infoLink: 'https://info.uniswap.org/#/base/',
210
- label: 'Base',
211
- statusPage: 'https://status.base.org/',
212
- nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
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'
225
- },
226
- _a);
227
- /**
228
- * Overloaded method for returning ChainInfo given a chainID
229
- * Return type varies depending on input type:
230
- * number | undefined -> returns chaininfo | undefined
231
- * ChainId -> returns L1ChainInfo | L2ChainInfo
232
- * SupportedL1ChainId -> returns L1ChainInfo
233
- * SupportedL2ChainId -> returns L2ChainInfo
234
- */
235
- function getChainInfo(chainId, featureFlags) {
236
- var _a;
237
- if (featureFlags && chainId in featureFlags) {
238
- return featureFlags[chainId] ? CHAIN_INFO[chainId] : undefined;
239
- }
240
- if (chainId) {
241
- return (_a = CHAIN_INFO[chainId]) !== null && _a !== void 0 ? _a : undefined;
242
- }
243
- return undefined;
244
- }
245
- exports.getChainInfo = getChainInfo;
246
- var MAINNET_INFO = CHAIN_INFO[sdk_core_1.ChainId.MAINNET];
247
- function getChainInfoOrDefault(chainId, featureFlags) {
248
- var _a;
249
- return (_a = getChainInfo(chainId, featureFlags)) !== null && _a !== void 0 ? _a : MAINNET_INFO;
250
- }
251
- exports.getChainInfoOrDefault = getChainInfoOrDefault;
@@ -1,46 +0,0 @@
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";
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];
23
- /**
24
- * @deprecated when v2 pools are enabled on chains supported through sdk-core
25
- */
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];
29
- /**
30
- * All the chain IDs that are running the Ethereum protocol.
31
- */
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];
34
- /**
35
- * Controls some L2 specific behavior, e.g. slippage tolerance, special UI behavior.
36
- * The expectation is that all of these networks have immediate transaction confirmation.
37
- */
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;
@@ -1,137 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
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',
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
- ];
59
- /**
60
- * @deprecated when v2 pools are enabled on chains supported through sdk-core
61
- */
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,
71
- ];
72
- /**
73
- * All the chain IDs that are running the Ethereum protocol.
74
- */
75
- exports.L1_CHAIN_IDS = [
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,
85
- ];
86
- /**
87
- * Controls some L2 specific behavior, e.g. slippage tolerance, special UI behavior.
88
- * The expectation is that all of these networks have immediate transaction confirmation.
89
- */
90
- exports.L2_CHAIN_IDS = [
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,
97
- ];
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;
136
- }
137
- exports.isUniswapXSupportedChain = isUniswapXSupportedChain;
@@ -1 +0,0 @@
1
- export {};
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var sdk_core_1 = require("@uniswap/sdk-core");
4
- var chains_1 = require("./chains");
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);
26
- });
@@ -1,8 +0,0 @@
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;
@@ -1,24 +0,0 @@
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;
@@ -1,12 +0,0 @@
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[];
@@ -1,64 +0,0 @@
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);
@@ -1,6 +0,0 @@
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;