@pioneer-platform/uniswap-client 0.0.28 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/lib/constants/chainInfo.d.ts +2 -2
- package/lib/constants/chainInfo.js +40 -43
- package/lib/constants/chains.d.ts +20 -20
- package/lib/constants/chains.js +25 -26
- package/lib/constants/governance.js +13 -14
- package/lib/constants/lists.js +20 -28
- package/lib/constants/misc.d.ts +4 -5
- package/lib/constants/misc.js +2 -2
- package/lib/constants/networks.js +45 -46
- package/lib/constants/proposals/uniswap_grants_proposal_description.js +106 -1
- package/lib/constants/providers.d.ts +16 -15
- package/lib/constants/providers.js +23 -24
- package/lib/constants/routing.js +44 -61
- package/lib/constants/tokens.d.ts +49 -49
- package/lib/constants/tokens.js +133 -170
- package/lib/index.js +556 -877
- package/lib/routing/clientSideSmartOrderRouter.js +72 -121
- package/lib/routing/gas.js +63 -150
- package/lib/routing/types.d.ts +7 -7
- package/lib/routing/types.js +160 -264
- package/lib/routing/utils.js +141 -196
- package/lib/rpc/AppJsonRpcProvider.js +40 -131
- package/lib/rpc/ConfiguredJsonRpcProvider.d.ts +1 -1
- package/lib/rpc/ConfiguredJsonRpcProvider.js +8 -27
- package/lib/utils/contracts/getContract.js +6 -7
- package/lib/utils/transformSwapRouteToGetQuoteResult.js +24 -27
- package/lib/utils/uniswapData.d.ts +6 -6
- package/lib/utils/uniswapData.js +64 -142
- package/package.json +19 -19
- package/tsconfig.json +27 -8
- package/lib/constants/chains.test.d.ts +0 -1
- package/lib/constants/chains.test.js +0 -26
- package/lib/constants/localCurrencies.d.ts +0 -6
- package/lib/constants/localCurrencies.js +0 -94
- package/lib/constants/localCurrencyIcons.d.ts +0 -18
- package/lib/constants/localCurrencyIcons.js +0 -298
- package/lib/constants/routing.test.d.ts +0 -1
- package/lib/constants/routing.test.js +0 -32
- package/lib/constants/tokenLists/broken.tokenlist.json +0 -22
- package/lib/constants/tokenLogoLookup.d.ts +0 -8
- package/lib/constants/tokenLogoLookup.js +0 -48
- package/lib/constants/tokenSafety.js +0 -129
- package/lib/constants/tokenSafetyLookup.d.ts +0 -18
- package/lib/constants/tokenSafetyLookup.js +0 -66
- package/lib/constants/tokenSaftey.test.d.ts +0 -1
- package/lib/constants/tokenSaftey.test.js +0 -31
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# @pioneer-platform/uniswap-client
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Release: minor version bump for all packages
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @pioneer-platform/maya-network@8.4.0
|
|
13
|
+
- @pioneer-platform/loggerdog@8.4.0
|
|
14
|
+
- @pioneer-platform/pioneer-coins@9.4.0
|
|
15
|
+
- @pioneer-platform/pioneer-caip@9.3.0
|
|
16
|
+
- @pioneer-platform/pioneer-discovery@0.1.0
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChainId } from '@uniswap/sdk-core';
|
|
2
2
|
import { SupportedL1ChainId, SupportedL2ChainId } from './chains';
|
|
3
|
-
export declare const AVERAGE_L1_BLOCK_TIME:
|
|
4
|
-
export declare const DEFAULT_MS_BEFORE_WARNING:
|
|
3
|
+
export declare const AVERAGE_L1_BLOCK_TIME: any;
|
|
4
|
+
export declare const DEFAULT_MS_BEFORE_WARNING: any;
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
7
7
|
* @param chainId
|
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
-
var _a;
|
|
6
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
8
|
-
|
|
6
|
+
exports.NetworkType = exports.DEFAULT_MS_BEFORE_WARNING = exports.AVERAGE_L1_BLOCK_TIME = void 0;
|
|
7
|
+
exports.getBlocksPerMainnetEpochForChainId = getBlocksPerMainnetEpochForChainId;
|
|
8
|
+
exports.getChainInfo = getChainInfo;
|
|
9
|
+
exports.getChainInfoOrDefault = getChainInfoOrDefault;
|
|
10
|
+
const sdk_core_1 = require("@uniswap/sdk-core");
|
|
9
11
|
// @ts-ignore
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
exports.AVERAGE_L1_BLOCK_TIME = (0, ms_1.default)(
|
|
13
|
-
exports.DEFAULT_MS_BEFORE_WARNING = (0, ms_1.default)(
|
|
12
|
+
const ms_1 = __importDefault(require("ms"));
|
|
13
|
+
const lists_1 = require("./lists");
|
|
14
|
+
exports.AVERAGE_L1_BLOCK_TIME = (0, ms_1.default)(`12s`);
|
|
15
|
+
exports.DEFAULT_MS_BEFORE_WARNING = (0, ms_1.default)(`10m`);
|
|
14
16
|
/**
|
|
15
17
|
*
|
|
16
18
|
* @param chainId
|
|
@@ -39,14 +41,13 @@ function getBlocksPerMainnetEpochForChainId(chainId) {
|
|
|
39
41
|
return 1;
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
|
-
exports.getBlocksPerMainnetEpochForChainId = getBlocksPerMainnetEpochForChainId;
|
|
43
44
|
var NetworkType;
|
|
44
45
|
(function (NetworkType) {
|
|
45
46
|
NetworkType[NetworkType["L1"] = 0] = "L1";
|
|
46
47
|
NetworkType[NetworkType["L2"] = 1] = "L2";
|
|
47
48
|
})(NetworkType || (exports.NetworkType = NetworkType = {}));
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
const CHAIN_INFO = {
|
|
50
|
+
[sdk_core_1.ChainId.MAINNET]: {
|
|
50
51
|
networkType: NetworkType.L1,
|
|
51
52
|
docs: 'https://docs.uniswap.org/',
|
|
52
53
|
explorer: 'https://etherscan.io/',
|
|
@@ -55,7 +56,7 @@ var CHAIN_INFO = (_a = {},
|
|
|
55
56
|
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
|
|
56
57
|
color: '#fcfc03',
|
|
57
58
|
},
|
|
58
|
-
|
|
59
|
+
[sdk_core_1.ChainId.GOERLI]: {
|
|
59
60
|
networkType: NetworkType.L1,
|
|
60
61
|
docs: 'https://docs.uniswap.org/',
|
|
61
62
|
explorer: 'https://goerli.etherscan.io/',
|
|
@@ -64,7 +65,7 @@ var CHAIN_INFO = (_a = {},
|
|
|
64
65
|
nativeCurrency: { name: 'Görli Ether', symbol: 'görETH', decimals: 18 },
|
|
65
66
|
color: '#fcfc03',
|
|
66
67
|
},
|
|
67
|
-
|
|
68
|
+
[sdk_core_1.ChainId.SEPOLIA]: {
|
|
68
69
|
networkType: NetworkType.L1,
|
|
69
70
|
docs: 'https://docs.uniswap.org/',
|
|
70
71
|
explorer: 'https://sepolia.etherscan.io/',
|
|
@@ -73,9 +74,9 @@ var CHAIN_INFO = (_a = {},
|
|
|
73
74
|
nativeCurrency: { name: 'Sepolia Ether', symbol: 'SepoliaETH', decimals: 18 },
|
|
74
75
|
color: '#fcfc03',
|
|
75
76
|
},
|
|
76
|
-
|
|
77
|
+
[sdk_core_1.ChainId.OPTIMISM]: {
|
|
77
78
|
networkType: NetworkType.L2,
|
|
78
|
-
blockWaitMsBeforeWarning: (0, ms_1.default)(
|
|
79
|
+
blockWaitMsBeforeWarning: (0, ms_1.default)(`25m`),
|
|
79
80
|
bridge: 'https://app.optimism.io/bridge',
|
|
80
81
|
defaultListUrl: lists_1.OPTIMISM_LIST,
|
|
81
82
|
docs: 'https://optimism.io/',
|
|
@@ -88,9 +89,9 @@ var CHAIN_INFO = (_a = {},
|
|
|
88
89
|
color: '#fcfc03',
|
|
89
90
|
backgroundColor: '#fcfc03',
|
|
90
91
|
},
|
|
91
|
-
|
|
92
|
+
[sdk_core_1.ChainId.OPTIMISM_GOERLI]: {
|
|
92
93
|
networkType: NetworkType.L2,
|
|
93
|
-
blockWaitMsBeforeWarning: (0, ms_1.default)(
|
|
94
|
+
blockWaitMsBeforeWarning: (0, ms_1.default)(`25m`),
|
|
94
95
|
bridge: 'https://app.optimism.io/bridge',
|
|
95
96
|
defaultListUrl: lists_1.OPTIMISM_LIST,
|
|
96
97
|
docs: 'https://optimism.io/',
|
|
@@ -102,9 +103,9 @@ var CHAIN_INFO = (_a = {},
|
|
|
102
103
|
nativeCurrency: { name: 'Optimism Goerli Ether', symbol: 'görOpETH', decimals: 18 },
|
|
103
104
|
color: '#fcfc03',
|
|
104
105
|
},
|
|
105
|
-
|
|
106
|
+
[sdk_core_1.ChainId.ARBITRUM_ONE]: {
|
|
106
107
|
networkType: NetworkType.L2,
|
|
107
|
-
blockWaitMsBeforeWarning: (0, ms_1.default)(
|
|
108
|
+
blockWaitMsBeforeWarning: (0, ms_1.default)(`10m`),
|
|
108
109
|
bridge: 'https://bridge.arbitrum.io/',
|
|
109
110
|
docs: 'https://offchainlabs.com/',
|
|
110
111
|
explorer: 'https://arbiscan.io/',
|
|
@@ -116,9 +117,9 @@ var CHAIN_INFO = (_a = {},
|
|
|
116
117
|
color: '#fcfc03',
|
|
117
118
|
backgroundColor: '#fcfc03',
|
|
118
119
|
},
|
|
119
|
-
|
|
120
|
+
[sdk_core_1.ChainId.ARBITRUM_GOERLI]: {
|
|
120
121
|
networkType: NetworkType.L2,
|
|
121
|
-
blockWaitMsBeforeWarning: (0, ms_1.default)(
|
|
122
|
+
blockWaitMsBeforeWarning: (0, ms_1.default)(`10m`),
|
|
122
123
|
bridge: 'https://bridge.arbitrum.io/',
|
|
123
124
|
docs: 'https://offchainlabs.com/',
|
|
124
125
|
explorer: 'https://goerli.arbiscan.io/',
|
|
@@ -129,9 +130,9 @@ var CHAIN_INFO = (_a = {},
|
|
|
129
130
|
nativeCurrency: { name: 'Goerli Arbitrum Ether', symbol: 'goerliArbETH', decimals: 18 },
|
|
130
131
|
color: '#fcfc03',
|
|
131
132
|
},
|
|
132
|
-
|
|
133
|
+
[sdk_core_1.ChainId.POLYGON]: {
|
|
133
134
|
networkType: NetworkType.L1,
|
|
134
|
-
blockWaitMsBeforeWarning: (0, ms_1.default)(
|
|
135
|
+
blockWaitMsBeforeWarning: (0, ms_1.default)(`10m`),
|
|
135
136
|
bridge: 'https://wallet.polygon.technology/polygon/bridge',
|
|
136
137
|
docs: 'https://polygon.io/',
|
|
137
138
|
explorer: 'https://polygonscan.com/',
|
|
@@ -141,9 +142,9 @@ var CHAIN_INFO = (_a = {},
|
|
|
141
142
|
color: '#fcfc03',
|
|
142
143
|
backgroundColor: '#fcfc03',
|
|
143
144
|
},
|
|
144
|
-
|
|
145
|
+
[sdk_core_1.ChainId.POLYGON_MUMBAI]: {
|
|
145
146
|
networkType: NetworkType.L1,
|
|
146
|
-
blockWaitMsBeforeWarning: (0, ms_1.default)(
|
|
147
|
+
blockWaitMsBeforeWarning: (0, ms_1.default)(`10m`),
|
|
147
148
|
bridge: 'https://wallet.polygon.technology/polygon/bridge/deposit',
|
|
148
149
|
docs: 'https://polygon.io/',
|
|
149
150
|
explorer: 'https://mumbai.polygonscan.com/',
|
|
@@ -151,9 +152,9 @@ var CHAIN_INFO = (_a = {},
|
|
|
151
152
|
label: 'Polygon Mumbai',
|
|
152
153
|
nativeCurrency: { name: 'Polygon Mumbai Matic', symbol: 'mMATIC', decimals: 18 },
|
|
153
154
|
},
|
|
154
|
-
|
|
155
|
+
[sdk_core_1.ChainId.CELO]: {
|
|
155
156
|
networkType: NetworkType.L1,
|
|
156
|
-
blockWaitMsBeforeWarning: (0, ms_1.default)(
|
|
157
|
+
blockWaitMsBeforeWarning: (0, ms_1.default)(`10m`),
|
|
157
158
|
bridge: 'https://www.portalbridge.com/#/transfer',
|
|
158
159
|
docs: 'https://docs.celo.org/',
|
|
159
160
|
explorer: 'https://celoscan.io/',
|
|
@@ -162,9 +163,9 @@ var CHAIN_INFO = (_a = {},
|
|
|
162
163
|
nativeCurrency: { name: 'Celo', symbol: 'CELO', decimals: 18 },
|
|
163
164
|
defaultListUrl: lists_1.CELO_LIST,
|
|
164
165
|
},
|
|
165
|
-
|
|
166
|
+
[sdk_core_1.ChainId.CELO_ALFAJORES]: {
|
|
166
167
|
networkType: NetworkType.L1,
|
|
167
|
-
blockWaitMsBeforeWarning: (0, ms_1.default)(
|
|
168
|
+
blockWaitMsBeforeWarning: (0, ms_1.default)(`10m`),
|
|
168
169
|
bridge: 'https://www.portalbridge.com/#/transfer',
|
|
169
170
|
docs: 'https://docs.celo.org/',
|
|
170
171
|
explorer: 'https://alfajores-blockscout.celo-testnet.org/',
|
|
@@ -173,9 +174,9 @@ var CHAIN_INFO = (_a = {},
|
|
|
173
174
|
nativeCurrency: { name: 'Celo', symbol: 'CELO', decimals: 18 },
|
|
174
175
|
defaultListUrl: lists_1.CELO_LIST,
|
|
175
176
|
},
|
|
176
|
-
|
|
177
|
+
[sdk_core_1.ChainId.BNB]: {
|
|
177
178
|
networkType: NetworkType.L1,
|
|
178
|
-
blockWaitMsBeforeWarning: (0, ms_1.default)(
|
|
179
|
+
blockWaitMsBeforeWarning: (0, ms_1.default)(`10m`),
|
|
179
180
|
bridge: 'https://cbridge.celer.network/1/56',
|
|
180
181
|
docs: 'https://docs.bnbchain.org/',
|
|
181
182
|
explorer: 'https://bscscan.com/',
|
|
@@ -186,9 +187,9 @@ var CHAIN_INFO = (_a = {},
|
|
|
186
187
|
color: '#fcfc03',
|
|
187
188
|
backgroundColor: '#fcfc03',
|
|
188
189
|
},
|
|
189
|
-
|
|
190
|
+
[sdk_core_1.ChainId.AVALANCHE]: {
|
|
190
191
|
networkType: NetworkType.L1,
|
|
191
|
-
blockWaitMsBeforeWarning: (0, ms_1.default)(
|
|
192
|
+
blockWaitMsBeforeWarning: (0, ms_1.default)(`10m`),
|
|
192
193
|
bridge: 'https://core.app/bridge/',
|
|
193
194
|
docs: 'https://docs.avax.network/',
|
|
194
195
|
explorer: 'https://snowtrace.io/',
|
|
@@ -199,9 +200,9 @@ var CHAIN_INFO = (_a = {},
|
|
|
199
200
|
color: '#fcfc03',
|
|
200
201
|
backgroundColor: '#fcfc03',
|
|
201
202
|
},
|
|
202
|
-
|
|
203
|
+
[sdk_core_1.ChainId.BASE]: {
|
|
203
204
|
networkType: NetworkType.L2,
|
|
204
|
-
blockWaitMsBeforeWarning: (0, ms_1.default)(
|
|
205
|
+
blockWaitMsBeforeWarning: (0, ms_1.default)(`25m`),
|
|
205
206
|
bridge: 'https://bridge.base.org/deposit',
|
|
206
207
|
defaultListUrl: lists_1.BASE_LIST,
|
|
207
208
|
docs: 'https://docs.base.org',
|
|
@@ -212,7 +213,7 @@ var CHAIN_INFO = (_a = {},
|
|
|
212
213
|
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
|
|
213
214
|
color: '#fcfc03',
|
|
214
215
|
},
|
|
215
|
-
|
|
216
|
+
[sdk_core_1.ChainId.BLAST]: {
|
|
216
217
|
networkType: NetworkType.L2,
|
|
217
218
|
bridge: 'https://blast.io/bridge',
|
|
218
219
|
defaultListUrl: '',
|
|
@@ -223,7 +224,7 @@ var CHAIN_INFO = (_a = {},
|
|
|
223
224
|
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
|
|
224
225
|
color: '#fcfc03', //'#fcfc03'
|
|
225
226
|
},
|
|
226
|
-
|
|
227
|
+
};
|
|
227
228
|
/**
|
|
228
229
|
* Overloaded method for returning ChainInfo given a chainID
|
|
229
230
|
* Return type varies depending on input type:
|
|
@@ -233,19 +234,15 @@ var CHAIN_INFO = (_a = {},
|
|
|
233
234
|
* SupportedL2ChainId -> returns L2ChainInfo
|
|
234
235
|
*/
|
|
235
236
|
function getChainInfo(chainId, featureFlags) {
|
|
236
|
-
var _a;
|
|
237
237
|
if (featureFlags && chainId in featureFlags) {
|
|
238
238
|
return featureFlags[chainId] ? CHAIN_INFO[chainId] : undefined;
|
|
239
239
|
}
|
|
240
240
|
if (chainId) {
|
|
241
|
-
return
|
|
241
|
+
return CHAIN_INFO[chainId] ?? undefined;
|
|
242
242
|
}
|
|
243
243
|
return undefined;
|
|
244
244
|
}
|
|
245
|
-
|
|
246
|
-
var MAINNET_INFO = CHAIN_INFO[sdk_core_1.ChainId.MAINNET];
|
|
245
|
+
const MAINNET_INFO = CHAIN_INFO[sdk_core_1.ChainId.MAINNET];
|
|
247
246
|
function getChainInfoOrDefault(chainId, featureFlags) {
|
|
248
|
-
|
|
249
|
-
return (_a = getChainInfo(chainId, featureFlags)) !== null && _a !== void 0 ? _a : MAINNET_INFO;
|
|
247
|
+
return getChainInfo(chainId, featureFlags) ?? MAINNET_INFO;
|
|
250
248
|
}
|
|
251
|
-
exports.getChainInfoOrDefault = getChainInfoOrDefault;
|
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
import { ChainId, SupportedChainsType } from '@uniswap/sdk-core';
|
|
2
2
|
export declare const CHAIN_IDS_TO_NAMES: {
|
|
3
|
-
readonly
|
|
4
|
-
readonly
|
|
5
|
-
readonly
|
|
6
|
-
readonly
|
|
7
|
-
readonly
|
|
8
|
-
readonly
|
|
9
|
-
readonly
|
|
10
|
-
readonly
|
|
11
|
-
readonly
|
|
12
|
-
readonly
|
|
13
|
-
readonly
|
|
14
|
-
readonly
|
|
15
|
-
readonly
|
|
16
|
-
readonly
|
|
17
|
-
readonly
|
|
3
|
+
readonly [ChainId.MAINNET]: "mainnet";
|
|
4
|
+
readonly [ChainId.GOERLI]: "goerli";
|
|
5
|
+
readonly [ChainId.SEPOLIA]: "sepolia";
|
|
6
|
+
readonly [ChainId.POLYGON]: "polygon";
|
|
7
|
+
readonly [ChainId.POLYGON_MUMBAI]: "polygon_mumbai";
|
|
8
|
+
readonly [ChainId.CELO]: "celo";
|
|
9
|
+
readonly [ChainId.CELO_ALFAJORES]: "celo_alfajores";
|
|
10
|
+
readonly [ChainId.ARBITRUM_ONE]: "arbitrum";
|
|
11
|
+
readonly [ChainId.ARBITRUM_GOERLI]: "arbitrum_goerli";
|
|
12
|
+
readonly [ChainId.OPTIMISM]: "optimism";
|
|
13
|
+
readonly [ChainId.OPTIMISM_GOERLI]: "optimism_goerli";
|
|
14
|
+
readonly [ChainId.BNB]: "bnb";
|
|
15
|
+
readonly [ChainId.AVALANCHE]: "avalanche";
|
|
16
|
+
readonly [ChainId.BASE]: "base";
|
|
17
|
+
readonly [ChainId.BLAST]: "blast";
|
|
18
18
|
};
|
|
19
19
|
export type SupportedInterfaceChain = Exclude<SupportedChainsType, ChainId.BASE_GOERLI | ChainId.ARBITRUM_SEPOLIA | ChainId.OPTIMISM_SEPOLIA | ChainId.ROOTSTOCK | ChainId.ZORA | ChainId.ZORA_SEPOLIA>;
|
|
20
20
|
export declare function isSupportedChain(chainId: number | null | undefined | ChainId, featureFlags?: Record<number, boolean>): chainId is SupportedInterfaceChain;
|
|
21
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 [
|
|
22
|
+
export declare const SUPPORTED_GAS_ESTIMATE_CHAIN_IDS: readonly [any, any, any, any, any, any, any, any, any];
|
|
23
23
|
/**
|
|
24
24
|
* @deprecated when v2 pools are enabled on chains supported through sdk-core
|
|
25
25
|
*/
|
|
26
|
-
export declare const SUPPORTED_V2POOL_CHAIN_IDS_DEPRECATED: readonly [
|
|
26
|
+
export declare const SUPPORTED_V2POOL_CHAIN_IDS_DEPRECATED: readonly [any, any];
|
|
27
27
|
export declare const SUPPORTED_V2POOL_CHAIN_IDS: number[];
|
|
28
|
-
export declare const TESTNET_CHAIN_IDS: readonly [
|
|
28
|
+
export declare const TESTNET_CHAIN_IDS: readonly [any, any, any, any, any, any];
|
|
29
29
|
/**
|
|
30
30
|
* All the chain IDs that are running the Ethereum protocol.
|
|
31
31
|
*/
|
|
32
|
-
export declare const L1_CHAIN_IDS: readonly [
|
|
32
|
+
export declare const L1_CHAIN_IDS: readonly [any, any, any, any, any, any, any, any, any];
|
|
33
33
|
export type SupportedL1ChainId = (typeof L1_CHAIN_IDS)[number];
|
|
34
34
|
/**
|
|
35
35
|
* Controls some L2 specific behavior, e.g. slippage tolerance, special UI behavior.
|
|
36
36
|
* The expectation is that all of these networks have immediate transaction confirmation.
|
|
37
37
|
*/
|
|
38
|
-
export declare const L2_CHAIN_IDS: readonly [
|
|
38
|
+
export declare const L2_CHAIN_IDS: readonly [any, any, any, any, any, any];
|
|
39
39
|
export type SupportedL2ChainId = (typeof L2_CHAIN_IDS)[number];
|
|
40
40
|
/**
|
|
41
41
|
* Get the priority of a chainId based on its relevance to the user.
|
package/lib/constants/chains.js
CHANGED
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
5
|
-
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
3
|
+
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.CHAIN_IDS_TO_NAMES = void 0;
|
|
4
|
+
exports.isSupportedChain = isSupportedChain;
|
|
5
|
+
exports.asSupportedChain = asSupportedChain;
|
|
6
|
+
exports.getChainPriority = getChainPriority;
|
|
7
|
+
exports.isUniswapXSupportedChain = isUniswapXSupportedChain;
|
|
8
|
+
const sdk_core_1 = require("@uniswap/sdk-core");
|
|
9
|
+
exports.CHAIN_IDS_TO_NAMES = {
|
|
10
|
+
[sdk_core_1.ChainId.MAINNET]: 'mainnet',
|
|
11
|
+
[sdk_core_1.ChainId.GOERLI]: 'goerli',
|
|
12
|
+
[sdk_core_1.ChainId.SEPOLIA]: 'sepolia',
|
|
13
|
+
[sdk_core_1.ChainId.POLYGON]: 'polygon',
|
|
14
|
+
[sdk_core_1.ChainId.POLYGON_MUMBAI]: 'polygon_mumbai',
|
|
15
|
+
[sdk_core_1.ChainId.CELO]: 'celo',
|
|
16
|
+
[sdk_core_1.ChainId.CELO_ALFAJORES]: 'celo_alfajores',
|
|
17
|
+
[sdk_core_1.ChainId.ARBITRUM_ONE]: 'arbitrum',
|
|
18
|
+
[sdk_core_1.ChainId.ARBITRUM_GOERLI]: 'arbitrum_goerli',
|
|
19
|
+
[sdk_core_1.ChainId.OPTIMISM]: 'optimism',
|
|
20
|
+
[sdk_core_1.ChainId.OPTIMISM_GOERLI]: 'optimism_goerli',
|
|
21
|
+
[sdk_core_1.ChainId.BNB]: 'bnb',
|
|
22
|
+
[sdk_core_1.ChainId.AVALANCHE]: 'avalanche',
|
|
23
|
+
[sdk_core_1.ChainId.BASE]: 'base',
|
|
24
|
+
[sdk_core_1.ChainId.BLAST]: 'blast',
|
|
25
|
+
};
|
|
23
26
|
// Include ChainIds in this array if they are not supported by the UX yet, but are already in the SDK.
|
|
24
|
-
|
|
27
|
+
const NOT_YET_UX_SUPPORTED_CHAIN_IDS = [
|
|
25
28
|
sdk_core_1.ChainId.BASE_GOERLI,
|
|
26
29
|
sdk_core_1.ChainId.ARBITRUM_SEPOLIA,
|
|
27
30
|
sdk_core_1.ChainId.OPTIMISM_SEPOLIA,
|
|
@@ -35,7 +38,6 @@ function isSupportedChain(chainId, featureFlags) {
|
|
|
35
38
|
}
|
|
36
39
|
return !!chainId && sdk_core_1.SUPPORTED_CHAINS.indexOf(chainId) !== -1 && NOT_YET_UX_SUPPORTED_CHAIN_IDS.indexOf(chainId) === -1;
|
|
37
40
|
}
|
|
38
|
-
exports.isSupportedChain = isSupportedChain;
|
|
39
41
|
function asSupportedChain(chainId, featureFlags) {
|
|
40
42
|
if (!chainId)
|
|
41
43
|
return undefined;
|
|
@@ -44,7 +46,6 @@ function asSupportedChain(chainId, featureFlags) {
|
|
|
44
46
|
}
|
|
45
47
|
return isSupportedChain(chainId) ? chainId : undefined;
|
|
46
48
|
}
|
|
47
|
-
exports.asSupportedChain = asSupportedChain;
|
|
48
49
|
exports.SUPPORTED_GAS_ESTIMATE_CHAIN_IDS = [
|
|
49
50
|
sdk_core_1.ChainId.MAINNET,
|
|
50
51
|
sdk_core_1.ChainId.POLYGON,
|
|
@@ -60,7 +61,7 @@ exports.SUPPORTED_GAS_ESTIMATE_CHAIN_IDS = [
|
|
|
60
61
|
* @deprecated when v2 pools are enabled on chains supported through sdk-core
|
|
61
62
|
*/
|
|
62
63
|
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(
|
|
64
|
+
exports.SUPPORTED_V2POOL_CHAIN_IDS = Object.keys(sdk_core_1.V2_ROUTER_ADDRESSES).map((chainId) => parseInt(chainId));
|
|
64
65
|
exports.TESTNET_CHAIN_IDS = [
|
|
65
66
|
sdk_core_1.ChainId.GOERLI,
|
|
66
67
|
sdk_core_1.ChainId.SEPOLIA,
|
|
@@ -130,8 +131,6 @@ function getChainPriority(chainId) {
|
|
|
130
131
|
return Infinity;
|
|
131
132
|
}
|
|
132
133
|
}
|
|
133
|
-
exports.getChainPriority = getChainPriority;
|
|
134
134
|
function isUniswapXSupportedChain(chainId) {
|
|
135
135
|
return chainId === sdk_core_1.ChainId.MAINNET;
|
|
136
136
|
}
|
|
137
|
-
exports.isUniswapXSupportedChain = isUniswapXSupportedChain;
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a, _b;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.LATEST_GOVERNOR_INDEX = exports.AVERAGE_BLOCK_TIME_IN_SECS = exports.DEFAULT_AVERAGE_BLOCK_TIME_IN_SECS = exports.COMMON_CONTRACT_NAMES = void 0;
|
|
5
|
-
|
|
6
|
-
exports.COMMON_CONTRACT_NAMES =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
const sdk_core_1 = require("@uniswap/sdk-core");
|
|
5
|
+
exports.COMMON_CONTRACT_NAMES = {
|
|
6
|
+
[sdk_core_1.ChainId.MAINNET]: {
|
|
7
|
+
[sdk_core_1.UNI_ADDRESSES[sdk_core_1.ChainId.MAINNET]]: 'UNI',
|
|
8
|
+
[sdk_core_1.TIMELOCK_ADDRESSES[sdk_core_1.ChainId.MAINNET]]: 'Timelock',
|
|
9
|
+
[sdk_core_1.GOVERNANCE_ALPHA_V0_ADDRESSES[sdk_core_1.ChainId.MAINNET]]: 'Governance (V0)',
|
|
10
|
+
[sdk_core_1.GOVERNANCE_ALPHA_V1_ADDRESSES[sdk_core_1.ChainId.MAINNET]]: 'Governance (V1)',
|
|
11
|
+
[sdk_core_1.GOVERNANCE_BRAVO_ADDRESSES[sdk_core_1.ChainId.MAINNET]]: 'Governance',
|
|
12
|
+
'0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e': 'ENS Registry',
|
|
13
|
+
'0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41': 'ENS Public Resolver',
|
|
14
|
+
'0xf754A7E347F81cFdc70AF9FbCCe9Df3D826360FA': 'Franchiser Factory',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
18
17
|
// in PoS, ethereum block time is 12s, see https://ethereum.org/en/developers/docs/blocks/#block-time
|
|
19
18
|
exports.DEFAULT_AVERAGE_BLOCK_TIME_IN_SECS = 12;
|
|
20
19
|
// Block time here is slightly higher (~1s) than average in order to avoid ongoing proposals past the displayed time
|
package/lib/constants/lists.js
CHANGED
|
@@ -1,34 +1,25 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
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
4
|
exports.UNI_LIST = 'https://cloudflare-ipfs.com/ipns/tokens.uniswap.org';
|
|
14
5
|
exports.UNI_EXTENDED_LIST = 'https://cloudflare-ipfs.com/ipns/extendedtokens.uniswap.org';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
const UNI_UNSUPPORTED_LIST = 'https://cloudflare-ipfs.com/ipns/unsupportedtokens.uniswap.org';
|
|
7
|
+
const AAVE_LIST = 'tokenlist.aave.eth';
|
|
8
|
+
const BA_LIST = 'https://raw.githubusercontent.com/The-Blockchain-Association/sec-notice-list/master/ba-sec-list.json';
|
|
18
9
|
// TODO(WEB-2282): Re-enable CMC list once we have a better solution for handling large lists.
|
|
19
10
|
// const CMC_ALL_LIST = 'https://s3.coinmarketcap.com/generated/dex/tokens/eth-tokens-all.json'
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
11
|
+
const COINGECKO_LIST = 'https://tokens.coingecko.com/uniswap/all.json';
|
|
12
|
+
const COINGECKO_BNB_LIST = 'https://tokens.coingecko.com/binance-smart-chain/all.json';
|
|
13
|
+
const COINGECKO_ARBITRUM_LIST = 'https://tokens.coingecko.com/arbitrum-one/all.json';
|
|
14
|
+
const COINGECKO_OPTIMISM_LIST = 'https://tokens.coingecko.com/optimistic-ethereum/all.json';
|
|
15
|
+
const COINGECKO_CELO_LIST = 'https://tokens.coingecko.com/celo/all.json';
|
|
16
|
+
const COINGECKO_POLYGON_LIST = 'https://tokens.coingecko.com/polygon-pos/all.json';
|
|
17
|
+
const COINGECKO_AVAX_LIST = 'https://tokens.coingecko.com/avalanche/all.json';
|
|
18
|
+
const COMPOUND_LIST = 'https://raw.githubusercontent.com/compound-finance/token-list/master/compound.tokenlist.json';
|
|
19
|
+
const GEMINI_LIST = 'https://www.gemini.com/uniswap/manifest.json';
|
|
20
|
+
const KLEROS_LIST = 't2crtokens.eth';
|
|
21
|
+
const SET_LIST = 'https://raw.githubusercontent.com/SetProtocol/uniswap-tokenlist/main/set.tokenlist.json';
|
|
22
|
+
const WRAPPED_LIST = 'wrapped.tokensoft.eth';
|
|
32
23
|
exports.OPTIMISM_LIST = 'https://static.optimism.io/optimism.tokenlist.json';
|
|
33
24
|
exports.ARBITRUM_LIST = 'https://bridge.arbitrum.io/token-list-42161.json';
|
|
34
25
|
exports.CELO_LIST = 'https://celo-org.github.io/celo-token-list/celo.tokenlist.json';
|
|
@@ -38,7 +29,7 @@ exports.BASE_LIST = 'https://raw.githubusercontent.com/ethereum-optimism/ethereu
|
|
|
38
29
|
exports.UNSUPPORTED_LIST_URLS = [BA_LIST, UNI_UNSUPPORTED_LIST];
|
|
39
30
|
// default lists to be 'active' aka searched across
|
|
40
31
|
exports.DEFAULT_ACTIVE_LIST_URLS = [exports.UNI_LIST];
|
|
41
|
-
exports.DEFAULT_INACTIVE_LIST_URLS =
|
|
32
|
+
exports.DEFAULT_INACTIVE_LIST_URLS = [
|
|
42
33
|
exports.UNI_EXTENDED_LIST,
|
|
43
34
|
COMPOUND_LIST,
|
|
44
35
|
AAVE_LIST,
|
|
@@ -59,6 +50,7 @@ exports.DEFAULT_INACTIVE_LIST_URLS = __spreadArray([
|
|
|
59
50
|
exports.CELO_LIST,
|
|
60
51
|
exports.PLASMA_BNB_LIST,
|
|
61
52
|
exports.AVALANCHE_LIST,
|
|
62
|
-
exports.BASE_LIST
|
|
63
|
-
|
|
64
|
-
|
|
53
|
+
exports.BASE_LIST,
|
|
54
|
+
...exports.UNSUPPORTED_LIST_URLS,
|
|
55
|
+
];
|
|
56
|
+
exports.DEFAULT_LIST_OF_LISTS = [...exports.DEFAULT_ACTIVE_LIST_URLS, ...exports.DEFAULT_INACTIVE_LIST_URLS];
|
package/lib/constants/misc.d.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { Percent } from '@uniswap/sdk-core';
|
|
2
|
-
import JSBI from 'jsbi';
|
|
3
2
|
export declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
4
3
|
export declare const DEFAULT_DEADLINE_FROM_NOW: number;
|
|
5
4
|
export declare const L2_DEADLINE_FROM_NOW: number;
|
|
6
5
|
export declare const DEFAULT_TXN_DISMISS_MS = 10000;
|
|
7
6
|
export declare const L2_TXN_DISMISS_MS = 5000;
|
|
8
|
-
export declare const BIG_INT_ZERO:
|
|
7
|
+
export declare const BIG_INT_ZERO: any;
|
|
9
8
|
export declare const BIPS_BASE = 10000;
|
|
10
|
-
export declare const ONE_BIPS:
|
|
9
|
+
export declare const ONE_BIPS: any;
|
|
11
10
|
export declare const ALLOWED_PRICE_IMPACT_LOW: Percent;
|
|
12
11
|
export declare const ALLOWED_PRICE_IMPACT_MEDIUM: Percent;
|
|
13
12
|
export declare const ALLOWED_PRICE_IMPACT_HIGH: Percent;
|
|
14
13
|
export declare const PRICE_IMPACT_WITHOUT_FEE_CONFIRM_MIN: Percent;
|
|
15
14
|
export declare const BLOCKED_PRICE_IMPACT_NON_EXPERT: Percent;
|
|
16
|
-
export declare const ZERO_PERCENT:
|
|
17
|
-
export declare const ONE_HUNDRED_PERCENT:
|
|
15
|
+
export declare const ZERO_PERCENT: any;
|
|
16
|
+
export declare const ONE_HUNDRED_PERCENT: any;
|
package/lib/constants/misc.js
CHANGED
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ONE_HUNDRED_PERCENT = exports.ZERO_PERCENT = exports.BLOCKED_PRICE_IMPACT_NON_EXPERT = exports.PRICE_IMPACT_WITHOUT_FEE_CONFIRM_MIN = exports.ALLOWED_PRICE_IMPACT_HIGH = exports.ALLOWED_PRICE_IMPACT_MEDIUM = exports.ALLOWED_PRICE_IMPACT_LOW = exports.ONE_BIPS = exports.BIPS_BASE = exports.BIG_INT_ZERO = exports.L2_TXN_DISMISS_MS = exports.DEFAULT_TXN_DISMISS_MS = exports.L2_DEADLINE_FROM_NOW = exports.DEFAULT_DEADLINE_FROM_NOW = exports.ZERO_ADDRESS = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const sdk_core_1 = require("@uniswap/sdk-core");
|
|
8
|
+
const jsbi_1 = __importDefault(require("jsbi"));
|
|
9
9
|
exports.ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
|
10
10
|
// TODO(WEB-1984): Convert the deadline to minutes and remove unecessary conversions from
|
|
11
11
|
// seconds to minutes in the codebase.
|