@pioneer-platform/uniswap-client 0.0.9 → 0.0.11
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/lib/constants/addresses.d.ts +9 -0
- package/lib/constants/addresses.js +41 -0
- package/lib/constants/chainInfo.d.ts +50 -0
- package/lib/constants/chainInfo.js +234 -0
- package/lib/constants/chains.d.ts +57 -0
- package/lib/constants/chains.js +102 -0
- package/lib/constants/chains.test.d.ts +1 -0
- package/lib/constants/chains.test.js +29 -0
- package/lib/constants/eip1193.d.ts +8 -0
- package/lib/constants/eip1193.js +14 -0
- package/lib/constants/index.d.ts +9 -0
- package/lib/constants/index.js +26 -0
- package/lib/constants/jsonRpcEndpoints.d.ts +12 -0
- package/lib/constants/jsonRpcEndpoints.js +101 -0
- package/lib/constants/locales.d.ts +6 -0
- package/lib/constants/locales.js +74 -0
- package/lib/constants/misc.d.ts +22 -0
- package/lib/constants/misc.js +37 -0
- package/lib/constants/routing.d.ts +20 -0
- package/lib/constants/routing.js +87 -0
- package/lib/constants/tokens.d.ts +78 -0
- package/lib/constants/tokens.js +246 -0
- package/lib/constants/utils/constructSameAddressMap.d.ts +4 -0
- package/lib/constants/utils/constructSameAddressMap.js +19 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +53 -32
- package/package.json +6 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type AddressMap = {
|
|
2
|
+
[chainId: number]: string;
|
|
3
|
+
};
|
|
4
|
+
export declare const UNI_ADDRESS: AddressMap;
|
|
5
|
+
export declare const MULTICALL_ADDRESS: AddressMap;
|
|
6
|
+
export declare const SWAP_ROUTER_ADDRESSES: AddressMap;
|
|
7
|
+
export declare const ARGENT_WALLET_DETECTOR_ADDRESS: AddressMap;
|
|
8
|
+
export declare const ENS_REGISTRAR_ADDRESSES: AddressMap;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var _a, _b, _c, _d;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ENS_REGISTRAR_ADDRESSES = exports.ARGENT_WALLET_DETECTOR_ADDRESS = exports.SWAP_ROUTER_ADDRESSES = exports.MULTICALL_ADDRESS = exports.UNI_ADDRESS = void 0;
|
|
16
|
+
var chains_1 = require("./chains");
|
|
17
|
+
var constructSameAddressMap_1 = require("./utils/constructSameAddressMap");
|
|
18
|
+
exports.UNI_ADDRESS = (0, constructSameAddressMap_1.constructSameAddressMap)('0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984');
|
|
19
|
+
exports.MULTICALL_ADDRESS = __assign(__assign({}, (0, constructSameAddressMap_1.constructSameAddressMap)('0x1F98415757620B543A52E61c46B32eB19261F984', [
|
|
20
|
+
chains_1.SupportedChainId.OPTIMISM_GOERLI,
|
|
21
|
+
chains_1.SupportedChainId.OPTIMISM,
|
|
22
|
+
chains_1.SupportedChainId.POLYGON_MUMBAI,
|
|
23
|
+
chains_1.SupportedChainId.POLYGON,
|
|
24
|
+
])), (_a = {}, _a[chains_1.SupportedChainId.ARBITRUM_ONE] = '0xadF885960B47eA2CD9B55E6DAc6B42b7Cb2806dB', _a[chains_1.SupportedChainId.ARBITRUM_RINKEBY] = '0xa501c031958F579dB7676fF1CE78AD305794d579', _a[chains_1.SupportedChainId.CELO] = '0x633987602DE5C4F337e3DbF265303A1080324204', _a[chains_1.SupportedChainId.CELO_ALFAJORES] = '0x633987602DE5C4F337e3DbF265303A1080324204', _a[chains_1.SupportedChainId.BASE] = '0x091e99cb1C49331a94dD62755D168E941AbD0693', _a));
|
|
25
|
+
exports.SWAP_ROUTER_ADDRESSES = __assign(__assign({}, (0, constructSameAddressMap_1.constructSameAddressMap)('0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', [
|
|
26
|
+
chains_1.SupportedChainId.OPTIMISM,
|
|
27
|
+
chains_1.SupportedChainId.OPTIMISM_GOERLI,
|
|
28
|
+
chains_1.SupportedChainId.ARBITRUM_ONE,
|
|
29
|
+
chains_1.SupportedChainId.ARBITRUM_RINKEBY,
|
|
30
|
+
chains_1.SupportedChainId.POLYGON,
|
|
31
|
+
chains_1.SupportedChainId.POLYGON_MUMBAI,
|
|
32
|
+
])), (_b = {}, _b[chains_1.SupportedChainId.CELO] = '0x5615CDAb10dc425a742d643d949a7F474C01abc4', _b[chains_1.SupportedChainId.CELO_ALFAJORES] = '0x5615CDAb10dc425a742d643d949a7F474C01abc4', _b[chains_1.SupportedChainId.BASE] = '0x2626664c2603336E57B271c5C0b26F421741e481', _b));
|
|
33
|
+
exports.ARGENT_WALLET_DETECTOR_ADDRESS = (_c = {},
|
|
34
|
+
_c[chains_1.SupportedChainId.MAINNET] = '0xeca4B0bDBf7c55E9b7925919d03CbF8Dc82537E8',
|
|
35
|
+
_c);
|
|
36
|
+
exports.ENS_REGISTRAR_ADDRESSES = (_d = {},
|
|
37
|
+
_d[chains_1.SupportedChainId.MAINNET] = '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
|
|
38
|
+
_d[chains_1.SupportedChainId.ROPSTEN] = '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
|
|
39
|
+
_d[chains_1.SupportedChainId.GOERLI] = '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
|
|
40
|
+
_d[chains_1.SupportedChainId.RINKEBY] = '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
|
|
41
|
+
_d);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { SupportedChainId, SupportedL1ChainId, SupportedL2ChainId } from './chains';
|
|
2
|
+
export declare const STANDARD_L1_BLOCK_TIME: number;
|
|
3
|
+
export declare enum NetworkType {
|
|
4
|
+
L1 = 0,
|
|
5
|
+
L2 = 1
|
|
6
|
+
}
|
|
7
|
+
interface BaseChainInfo {
|
|
8
|
+
readonly networkType: NetworkType;
|
|
9
|
+
readonly blockWaitMsBeforeWarning?: number;
|
|
10
|
+
readonly docs: string;
|
|
11
|
+
readonly bridge?: string;
|
|
12
|
+
readonly explorer: string;
|
|
13
|
+
readonly infoLink: string;
|
|
14
|
+
readonly safe?: {
|
|
15
|
+
label?: string;
|
|
16
|
+
symbol?: string;
|
|
17
|
+
};
|
|
18
|
+
readonly label: string;
|
|
19
|
+
readonly helpCenterUrl?: string;
|
|
20
|
+
readonly nativeCurrency: {
|
|
21
|
+
name: string;
|
|
22
|
+
symbol: string;
|
|
23
|
+
decimals: 18;
|
|
24
|
+
};
|
|
25
|
+
readonly color?: string;
|
|
26
|
+
readonly backgroundColor?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface L1ChainInfo extends BaseChainInfo {
|
|
29
|
+
readonly networkType: NetworkType.L1;
|
|
30
|
+
}
|
|
31
|
+
export interface L2ChainInfo extends BaseChainInfo {
|
|
32
|
+
readonly networkType: NetworkType.L2;
|
|
33
|
+
readonly bridge: string;
|
|
34
|
+
readonly statusPage?: string;
|
|
35
|
+
}
|
|
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;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
// import ms from 'ms.macro'
|
|
4
|
+
var _a;
|
|
5
|
+
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;
|
|
9
|
+
var NetworkType;
|
|
10
|
+
(function (NetworkType) {
|
|
11
|
+
NetworkType[NetworkType["L1"] = 0] = "L1";
|
|
12
|
+
NetworkType[NetworkType["L2"] = 1] = "L2";
|
|
13
|
+
})(NetworkType || (exports.NetworkType = NetworkType = {}));
|
|
14
|
+
var CHAIN_INFO = (_a = {},
|
|
15
|
+
_a[chains_1.SupportedChainId.MAINNET] = {
|
|
16
|
+
networkType: NetworkType.L1,
|
|
17
|
+
docs: 'https://docs.uniswap.org/',
|
|
18
|
+
explorer: 'https://etherscan.io/',
|
|
19
|
+
infoLink: 'https://info.uniswap.org/#/',
|
|
20
|
+
label: 'Ethereum',
|
|
21
|
+
//logoUrl: ethereumLogoUrl,
|
|
22
|
+
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',
|
|
44
|
+
},
|
|
45
|
+
_a[chains_1.SupportedChainId.KOVAN] = {
|
|
46
|
+
networkType: NetworkType.L1,
|
|
47
|
+
docs: 'https://docs.uniswap.org/',
|
|
48
|
+
explorer: 'https://kovan.etherscan.io/',
|
|
49
|
+
infoLink: 'https://info.uniswap.org/#/',
|
|
50
|
+
label: 'Kovan',
|
|
51
|
+
//logoUrl: ethereumLogoUrl,
|
|
52
|
+
nativeCurrency: { name: 'Kovan Ether', symbol: 'kovETH', decimals: 18 },
|
|
53
|
+
color: '#FF0420',
|
|
54
|
+
},
|
|
55
|
+
_a[chains_1.SupportedChainId.GOERLI] = {
|
|
56
|
+
networkType: NetworkType.L1,
|
|
57
|
+
docs: 'https://docs.uniswap.org/',
|
|
58
|
+
explorer: 'https://goerli.etherscan.io/',
|
|
59
|
+
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',
|
|
64
|
+
},
|
|
65
|
+
_a[chains_1.SupportedChainId.OPTIMISM] = {
|
|
66
|
+
networkType: NetworkType.L2,
|
|
67
|
+
blockWaitMsBeforeWarning: 1500000,
|
|
68
|
+
bridge: 'https://app.optimism.io/bridge',
|
|
69
|
+
docs: 'https://optimism.io/',
|
|
70
|
+
explorer: 'https://optimistic.etherscan.io/',
|
|
71
|
+
infoLink: 'https://info.uniswap.org/#/optimism/',
|
|
72
|
+
label: 'Optimism',
|
|
73
|
+
//logoUrl: optimismLogoUrl,
|
|
74
|
+
statusPage: 'https://optimism.io/status',
|
|
75
|
+
helpCenterUrl: 'https://help.uniswap.org/en/collections/3137778-uniswap-on-optimistic-ethereum-oξ',
|
|
76
|
+
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
|
|
77
|
+
color: '#FF0420',
|
|
78
|
+
backgroundColor: '#ff042029',
|
|
79
|
+
},
|
|
80
|
+
_a[chains_1.SupportedChainId.OPTIMISM_GOERLI] = {
|
|
81
|
+
networkType: NetworkType.L2,
|
|
82
|
+
blockWaitMsBeforeWarning: 1500000,
|
|
83
|
+
bridge: 'https://app.optimism.io/bridge',
|
|
84
|
+
docs: 'https://optimism.io/',
|
|
85
|
+
explorer: 'https://goerli-optimism.etherscan.io/',
|
|
86
|
+
infoLink: 'https://info.uniswap.org/#/optimism/',
|
|
87
|
+
safe: { label: 'Optimism Goerli Testnet', symbol: 'ETH' },
|
|
88
|
+
label: 'Optimism Görli',
|
|
89
|
+
//logoUrl: optimismLogoUrl,
|
|
90
|
+
statusPage: 'https://optimism.io/status',
|
|
91
|
+
helpCenterUrl: 'https://help.uniswap.org/en/collections/3137778-uniswap-on-optimistic-ethereum-oξ',
|
|
92
|
+
nativeCurrency: { name: 'Optimism Goerli Ether', symbol: 'görOpETH', decimals: 18 },
|
|
93
|
+
color: '#FF0420',
|
|
94
|
+
backgroundColor: '#ff042029',
|
|
95
|
+
},
|
|
96
|
+
_a[chains_1.SupportedChainId.ARBITRUM_ONE] = {
|
|
97
|
+
networkType: NetworkType.L2,
|
|
98
|
+
blockWaitMsBeforeWarning: 600000,
|
|
99
|
+
bridge: 'https://bridge.arbitrum.io/',
|
|
100
|
+
docs: 'https://offchainlabs.com/',
|
|
101
|
+
explorer: 'https://arbiscan.io/',
|
|
102
|
+
infoLink: 'https://info.uniswap.org/#/arbitrum',
|
|
103
|
+
label: 'Arbitrum',
|
|
104
|
+
//logoUrl: arbitrumLogoUrl,
|
|
105
|
+
helpCenterUrl: 'https://help.uniswap.org/en/collections/3137787-uniswap-on-arbitrum',
|
|
106
|
+
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
|
|
107
|
+
color: '#28A0F0',
|
|
108
|
+
backgroundColor: '#28a0f029',
|
|
109
|
+
},
|
|
110
|
+
_a[chains_1.SupportedChainId.ARBITRUM_RINKEBY] = {
|
|
111
|
+
networkType: NetworkType.L2,
|
|
112
|
+
blockWaitMsBeforeWarning: 600000,
|
|
113
|
+
bridge: 'https://bridge.arbitrum.io/',
|
|
114
|
+
docs: 'https://offchainlabs.com/',
|
|
115
|
+
explorer: 'https://rinkeby-explorer.arbitrum.io/',
|
|
116
|
+
infoLink: 'https://info.uniswap.org/#/arbitrum/',
|
|
117
|
+
label: 'Arbitrum Rinkeby',
|
|
118
|
+
//logoUrl: arbitrumLogoUrl,
|
|
119
|
+
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',
|
|
123
|
+
},
|
|
124
|
+
_a[chains_1.SupportedChainId.POLYGON] = {
|
|
125
|
+
networkType: NetworkType.L1,
|
|
126
|
+
blockWaitMsBeforeWarning: 600000,
|
|
127
|
+
bridge: 'https://wallet.polygon.technology/login?redirectTo=%2Fpolygon%2Fbridge',
|
|
128
|
+
docs: 'https://polygon.io/',
|
|
129
|
+
explorer: 'https://polygonscan.com/',
|
|
130
|
+
infoLink: 'https://info.uniswap.org/#/polygon/',
|
|
131
|
+
safe: { label: 'Polygon Mainnet' },
|
|
132
|
+
label: 'Polygon',
|
|
133
|
+
//logoUrl: polygonMaticLogo,
|
|
134
|
+
nativeCurrency: { name: 'Polygon Matic', symbol: 'MATIC', decimals: 18 },
|
|
135
|
+
color: '#A457FF',
|
|
136
|
+
backgroundColor: '#a457ff29',
|
|
137
|
+
},
|
|
138
|
+
_a[chains_1.SupportedChainId.POLYGON_MUMBAI] = {
|
|
139
|
+
networkType: NetworkType.L1,
|
|
140
|
+
blockWaitMsBeforeWarning: 600000,
|
|
141
|
+
bridge: 'https://wallet.polygon.technology/login?redirectTo=%2Fpolygon%2Fbridge',
|
|
142
|
+
docs: 'https://polygon.io/',
|
|
143
|
+
explorer: 'https://mumbai.polygonscan.com/',
|
|
144
|
+
infoLink: 'https://info.uniswap.org/#/polygon/',
|
|
145
|
+
safe: { symbol: 'MATIC' },
|
|
146
|
+
label: 'Polygon Mumbai',
|
|
147
|
+
//logoUrl: polygonMaticLogo,
|
|
148
|
+
nativeCurrency: { name: 'Polygon Mumbai Matic', symbol: 'mMATIC', decimals: 18 },
|
|
149
|
+
color: '#A457FF',
|
|
150
|
+
backgroundColor: '#a457ff29',
|
|
151
|
+
},
|
|
152
|
+
_a[chains_1.SupportedChainId.CELO] = {
|
|
153
|
+
networkType: NetworkType.L1,
|
|
154
|
+
blockWaitMsBeforeWarning: 600000,
|
|
155
|
+
bridge: 'https://www.portalbridge.com/#/transfer',
|
|
156
|
+
docs: 'https://docs.celo.org/',
|
|
157
|
+
explorer: 'https://celoscan.io/',
|
|
158
|
+
infoLink: 'https://info.uniswap.org/#/celo',
|
|
159
|
+
safe: { label: 'Celo Mainnet' },
|
|
160
|
+
label: 'Celo',
|
|
161
|
+
//logoUrl: celoLogo,
|
|
162
|
+
nativeCurrency: { name: 'Celo', symbol: 'CELO', decimals: 18 },
|
|
163
|
+
color: '#35D07F',
|
|
164
|
+
backgroundColor: '#34d07f1f',
|
|
165
|
+
},
|
|
166
|
+
_a[chains_1.SupportedChainId.CELO_ALFAJORES] = {
|
|
167
|
+
networkType: NetworkType.L1,
|
|
168
|
+
blockWaitMsBeforeWarning: 600000,
|
|
169
|
+
bridge: 'https://www.portalbridge.com/#/transfer',
|
|
170
|
+
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' },
|
|
174
|
+
label: 'Celo Alfajores',
|
|
175
|
+
//logoUrl: celoLogo,
|
|
176
|
+
nativeCurrency: { name: 'Celo', symbol: 'aCELO', decimals: 18 },
|
|
177
|
+
color: '#35D07F',
|
|
178
|
+
backgroundColor: '#34d07f1f',
|
|
179
|
+
},
|
|
180
|
+
_a[chains_1.SupportedChainId.BNB] = {
|
|
181
|
+
networkType: NetworkType.L1,
|
|
182
|
+
blockWaitMsBeforeWarning: 600000,
|
|
183
|
+
bridge: 'https://cbridge.celer.network/1/56',
|
|
184
|
+
docs: 'https://docs.bnbchain.org/',
|
|
185
|
+
explorer: 'https://bscscan.com/',
|
|
186
|
+
infoLink: 'https://info.uniswap.org/#/bnb/',
|
|
187
|
+
label: 'BNB Chain',
|
|
188
|
+
//logoUrl: bnbLogo,
|
|
189
|
+
nativeCurrency: { name: 'BNB', symbol: 'BNB', decimals: 18 },
|
|
190
|
+
color: '#F0B90B',
|
|
191
|
+
backgroundColor: '#F0B90B',
|
|
192
|
+
},
|
|
193
|
+
_a[chains_1.SupportedChainId.BASE] = {
|
|
194
|
+
networkType: NetworkType.L2,
|
|
195
|
+
blockWaitMsBeforeWarning: 1500000,
|
|
196
|
+
bridge: 'https://bridge.base.org/',
|
|
197
|
+
docs: 'https://docs.base.org/',
|
|
198
|
+
explorer: 'https://basescan.org/',
|
|
199
|
+
infoLink: 'https://info.uniswap.org/#/base/',
|
|
200
|
+
label: 'Base',
|
|
201
|
+
//logoUrl: baseLogo,
|
|
202
|
+
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
|
|
203
|
+
color: '#0152ff',
|
|
204
|
+
backgroundColor: '#0152ff',
|
|
205
|
+
},
|
|
206
|
+
_a);
|
|
207
|
+
/**
|
|
208
|
+
* Overloaded method for returning ChainInfo given a chainID
|
|
209
|
+
* Return type varies depending on input type:
|
|
210
|
+
* number | undefined -> returns chaininfo | undefined
|
|
211
|
+
* SupportedChainId -> returns L1ChainInfo | L2ChainInfo
|
|
212
|
+
* SupportedL1ChainId -> returns L1ChainInfo
|
|
213
|
+
* SupportedL2ChainId -> returns L2ChainInfo
|
|
214
|
+
*/
|
|
215
|
+
function getChainInfo(chainId) {
|
|
216
|
+
var _a;
|
|
217
|
+
if (chainId) {
|
|
218
|
+
return (_a = CHAIN_INFO[chainId]) !== null && _a !== void 0 ? _a : undefined;
|
|
219
|
+
}
|
|
220
|
+
return undefined;
|
|
221
|
+
}
|
|
222
|
+
exports.getChainInfo = getChainInfo;
|
|
223
|
+
exports.MAINNET_INFO = CHAIN_INFO[chains_1.SupportedChainId.MAINNET];
|
|
224
|
+
function getChainInfoOrDefault(chainId) {
|
|
225
|
+
var _a;
|
|
226
|
+
return (_a = getChainInfo(chainId)) !== null && _a !== void 0 ? _a : exports.MAINNET_INFO;
|
|
227
|
+
}
|
|
228
|
+
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;
|
|
@@ -0,0 +1,57 @@
|
|
|
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;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Array of all the supported chain IDs
|
|
43
|
+
*/
|
|
44
|
+
export declare const ALL_SUPPORTED_CHAIN_IDS: SupportedChainId[];
|
|
45
|
+
export declare const SUPPORTED_GAS_ESTIMATE_CHAIN_IDS: SupportedChainId[];
|
|
46
|
+
/**
|
|
47
|
+
* All the chain IDs that are running the Ethereum protocol.
|
|
48
|
+
*/
|
|
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];
|
|
51
|
+
/**
|
|
52
|
+
* Controls some L2 specific behavior, e.g. slippage tolerance, special UI behavior.
|
|
53
|
+
* The expectation is that all of these networks have immediate transaction confirmation.
|
|
54
|
+
*/
|
|
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;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.isPolygonChain = exports.L2_CHAIN_IDS = exports.L1_CHAIN_IDS = exports.SUPPORTED_GAS_ESTIMATE_CHAIN_IDS = exports.ALL_SUPPORTED_CHAIN_IDS = exports.CHAIN_NAMES_TO_IDS = exports.ChainName = exports.SupportedChainId = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* List of all the networks supported by the Uniswap Interface
|
|
7
|
+
*/
|
|
8
|
+
var SupportedChainId;
|
|
9
|
+
(function (SupportedChainId) {
|
|
10
|
+
SupportedChainId[SupportedChainId["MAINNET"] = 1] = "MAINNET";
|
|
11
|
+
SupportedChainId[SupportedChainId["ROPSTEN"] = 3] = "ROPSTEN";
|
|
12
|
+
SupportedChainId[SupportedChainId["RINKEBY"] = 4] = "RINKEBY";
|
|
13
|
+
SupportedChainId[SupportedChainId["GOERLI"] = 5] = "GOERLI";
|
|
14
|
+
SupportedChainId[SupportedChainId["KOVAN"] = 42] = "KOVAN";
|
|
15
|
+
SupportedChainId[SupportedChainId["ARBITRUM_ONE"] = 42161] = "ARBITRUM_ONE";
|
|
16
|
+
SupportedChainId[SupportedChainId["ARBITRUM_RINKEBY"] = 421611] = "ARBITRUM_RINKEBY";
|
|
17
|
+
SupportedChainId[SupportedChainId["OPTIMISM"] = 10] = "OPTIMISM";
|
|
18
|
+
SupportedChainId[SupportedChainId["OPTIMISM_GOERLI"] = 420] = "OPTIMISM_GOERLI";
|
|
19
|
+
SupportedChainId[SupportedChainId["POLYGON"] = 137] = "POLYGON";
|
|
20
|
+
SupportedChainId[SupportedChainId["POLYGON_MUMBAI"] = 80001] = "POLYGON_MUMBAI";
|
|
21
|
+
SupportedChainId[SupportedChainId["CELO"] = 42220] = "CELO";
|
|
22
|
+
SupportedChainId[SupportedChainId["CELO_ALFAJORES"] = 44787] = "CELO_ALFAJORES";
|
|
23
|
+
SupportedChainId[SupportedChainId["BNB"] = 56] = "BNB";
|
|
24
|
+
SupportedChainId[SupportedChainId["BASE"] = 8453] = "BASE";
|
|
25
|
+
})(SupportedChainId || (exports.SupportedChainId = SupportedChainId = {}));
|
|
26
|
+
var ChainName;
|
|
27
|
+
(function (ChainName) {
|
|
28
|
+
ChainName["MAINNET"] = "mainnet";
|
|
29
|
+
ChainName["ROPSTEN"] = "ropsten";
|
|
30
|
+
ChainName["RINKEBY"] = "rinkeby";
|
|
31
|
+
ChainName["GOERLI"] = "goerli";
|
|
32
|
+
ChainName["KOVAN"] = "kovan";
|
|
33
|
+
ChainName["OPTIMISM"] = "optimism-mainnet";
|
|
34
|
+
ChainName["OPTIMISM_GOERLI"] = "optimism-goerli";
|
|
35
|
+
ChainName["ARBITRUM_ONE"] = "arbitrum-mainnet";
|
|
36
|
+
ChainName["ARBITRUM_RINKEBY"] = "arbitrum-rinkeby";
|
|
37
|
+
ChainName["POLYGON"] = "polygon-mainnet";
|
|
38
|
+
ChainName["POLYGON_MUMBAI"] = "polygon-mumbai";
|
|
39
|
+
ChainName["CELO"] = "celo";
|
|
40
|
+
ChainName["CELO_ALFAJORES"] = "celo-alfajores";
|
|
41
|
+
ChainName["BNB"] = "bnb";
|
|
42
|
+
ChainName["BASE"] = "base";
|
|
43
|
+
})(ChainName || (exports.ChainName = ChainName = {}));
|
|
44
|
+
exports.CHAIN_NAMES_TO_IDS = (_a = {},
|
|
45
|
+
_a[ChainName.MAINNET] = SupportedChainId.MAINNET,
|
|
46
|
+
_a[ChainName.ROPSTEN] = SupportedChainId.ROPSTEN,
|
|
47
|
+
_a[ChainName.RINKEBY] = SupportedChainId.RINKEBY,
|
|
48
|
+
_a[ChainName.GOERLI] = SupportedChainId.GOERLI,
|
|
49
|
+
_a[ChainName.KOVAN] = SupportedChainId.KOVAN,
|
|
50
|
+
_a[ChainName.POLYGON] = SupportedChainId.POLYGON,
|
|
51
|
+
_a[ChainName.POLYGON_MUMBAI] = SupportedChainId.POLYGON_MUMBAI,
|
|
52
|
+
_a[ChainName.ARBITRUM_ONE] = SupportedChainId.ARBITRUM_ONE,
|
|
53
|
+
_a[ChainName.ARBITRUM_RINKEBY] = SupportedChainId.ARBITRUM_RINKEBY,
|
|
54
|
+
_a[ChainName.OPTIMISM] = SupportedChainId.OPTIMISM,
|
|
55
|
+
_a[ChainName.OPTIMISM_GOERLI] = SupportedChainId.OPTIMISM_GOERLI,
|
|
56
|
+
_a[ChainName.CELO] = SupportedChainId.CELO,
|
|
57
|
+
_a[ChainName.CELO_ALFAJORES] = SupportedChainId.CELO_ALFAJORES,
|
|
58
|
+
_a[ChainName.BNB] = SupportedChainId.BNB,
|
|
59
|
+
_a[ChainName.BASE] = SupportedChainId.BASE,
|
|
60
|
+
_a);
|
|
61
|
+
/**
|
|
62
|
+
* Array of all the supported chain IDs
|
|
63
|
+
*/
|
|
64
|
+
exports.ALL_SUPPORTED_CHAIN_IDS = Object.values(SupportedChainId).filter(function (id) { return typeof id === 'number'; });
|
|
65
|
+
exports.SUPPORTED_GAS_ESTIMATE_CHAIN_IDS = [
|
|
66
|
+
SupportedChainId.MAINNET,
|
|
67
|
+
SupportedChainId.POLYGON,
|
|
68
|
+
SupportedChainId.OPTIMISM,
|
|
69
|
+
SupportedChainId.ARBITRUM_ONE,
|
|
70
|
+
SupportedChainId.CELO,
|
|
71
|
+
SupportedChainId.BNB,
|
|
72
|
+
SupportedChainId.BASE,
|
|
73
|
+
];
|
|
74
|
+
/**
|
|
75
|
+
* All the chain IDs that are running the Ethereum protocol.
|
|
76
|
+
*/
|
|
77
|
+
exports.L1_CHAIN_IDS = [
|
|
78
|
+
SupportedChainId.MAINNET,
|
|
79
|
+
SupportedChainId.ROPSTEN,
|
|
80
|
+
SupportedChainId.RINKEBY,
|
|
81
|
+
SupportedChainId.GOERLI,
|
|
82
|
+
SupportedChainId.KOVAN,
|
|
83
|
+
SupportedChainId.POLYGON,
|
|
84
|
+
SupportedChainId.POLYGON_MUMBAI,
|
|
85
|
+
SupportedChainId.CELO,
|
|
86
|
+
SupportedChainId.CELO_ALFAJORES,
|
|
87
|
+
];
|
|
88
|
+
/**
|
|
89
|
+
* Controls some L2 specific behavior, e.g. slippage tolerance, special UI behavior.
|
|
90
|
+
* The expectation is that all of these networks have immediate transaction confirmation.
|
|
91
|
+
*/
|
|
92
|
+
exports.L2_CHAIN_IDS = [
|
|
93
|
+
SupportedChainId.ARBITRUM_ONE,
|
|
94
|
+
SupportedChainId.ARBITRUM_RINKEBY,
|
|
95
|
+
SupportedChainId.OPTIMISM,
|
|
96
|
+
SupportedChainId.OPTIMISM_GOERLI,
|
|
97
|
+
SupportedChainId.BASE,
|
|
98
|
+
];
|
|
99
|
+
function isPolygonChain(chainId) {
|
|
100
|
+
return chainId === SupportedChainId.POLYGON || chainId === SupportedChainId.POLYGON_MUMBAI;
|
|
101
|
+
}
|
|
102
|
+
exports.isPolygonChain = isPolygonChain;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var chains_1 = require("./chains");
|
|
4
|
+
describe('chains', function () {
|
|
5
|
+
describe('ALL_SUPPORTED_CHAIN_IDS', function () {
|
|
6
|
+
it('contains all the values in the SupportedChainId enum', function () {
|
|
7
|
+
Object.values(chains_1.SupportedChainId).forEach(function (chainId) {
|
|
8
|
+
if (typeof chainId === 'number')
|
|
9
|
+
expect(chains_1.ALL_SUPPORTED_CHAIN_IDS.includes(chainId)).toBeTruthy();
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
it('contains no duplicates', function () {
|
|
13
|
+
var set = new Set();
|
|
14
|
+
chains_1.ALL_SUPPORTED_CHAIN_IDS.forEach(function (chainId) {
|
|
15
|
+
expect(set.has(chainId)).toEqual(false);
|
|
16
|
+
set.add(chainId);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
it('all values are in the SupportedChainId mapping', function () {
|
|
20
|
+
chains_1.ALL_SUPPORTED_CHAIN_IDS.forEach(function (chainId) {
|
|
21
|
+
// takes advantage of the reverse mapping
|
|
22
|
+
expect(chains_1.SupportedChainId[chainId]).toBeTruthy();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
it('all values are numeric', function () {
|
|
26
|
+
expect(chains_1.ALL_SUPPORTED_CHAIN_IDS.every(function (chainId) { return typeof chainId === 'number'; })).toBeTruthy();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ErrorCode = void 0;
|
|
4
|
+
// https://eips.ethereum.org/EIPS/eip-1193#provider-errors
|
|
5
|
+
var ErrorCode;
|
|
6
|
+
(function (ErrorCode) {
|
|
7
|
+
ErrorCode[ErrorCode["USER_REJECTED_REQUEST"] = 4001] = "USER_REJECTED_REQUEST";
|
|
8
|
+
ErrorCode[ErrorCode["UNAUTHORIZED"] = 4100] = "UNAUTHORIZED";
|
|
9
|
+
ErrorCode[ErrorCode["UNSUPPORTED_METHOD"] = 4200] = "UNSUPPORTED_METHOD";
|
|
10
|
+
ErrorCode[ErrorCode["DISCONNECTED"] = 4900] = "DISCONNECTED";
|
|
11
|
+
ErrorCode[ErrorCode["CHAIN_DISCONNECTED"] = 4901] = "CHAIN_DISCONNECTED";
|
|
12
|
+
// https://docs.metamask.io/guide/rpc-api.html#unrestricted-methods
|
|
13
|
+
ErrorCode[ErrorCode["CHAIN_NOT_ADDED"] = 4902] = "CHAIN_NOT_ADDED";
|
|
14
|
+
})(ErrorCode || (exports.ErrorCode = ErrorCode = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './addresses';
|
|
2
|
+
export * from './chainInfo';
|
|
3
|
+
export * from './chains';
|
|
4
|
+
export * from './eip1193';
|
|
5
|
+
export * from './jsonRpcEndpoints';
|
|
6
|
+
export * from './locales';
|
|
7
|
+
export * from './misc';
|
|
8
|
+
export * from './routing';
|
|
9
|
+
export * from './tokens';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// Exporting everything
|
|
18
|
+
__exportStar(require("./addresses"), exports);
|
|
19
|
+
__exportStar(require("./chainInfo"), exports);
|
|
20
|
+
__exportStar(require("./chains"), exports);
|
|
21
|
+
__exportStar(require("./eip1193"), exports);
|
|
22
|
+
__exportStar(require("./jsonRpcEndpoints"), exports);
|
|
23
|
+
__exportStar(require("./locales"), exports);
|
|
24
|
+
__exportStar(require("./misc"), exports);
|
|
25
|
+
__exportStar(require("./routing"), exports);
|
|
26
|
+
__exportStar(require("./tokens"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SupportedChainId } from './chains';
|
|
2
|
+
/**
|
|
3
|
+
* Fallback JSON RPC endpoints.
|
|
4
|
+
* These are used if the integrator does not provide an endpoint, or if the endpoint does not work.
|
|
5
|
+
*
|
|
6
|
+
* MetaMask allows switching to any URL, but displays a warning if it is not on the "Safe" list:
|
|
7
|
+
* https://github.com/MetaMask/metamask-mobile/blob/bdb7f37c90e4fc923881a07fca38d4e77c73a579/app/core/RPCMethods/wallet_addEthereumChain.js#L228-L235
|
|
8
|
+
* https://chainid.network/chains.json
|
|
9
|
+
*
|
|
10
|
+
* These "Safe" URLs are listed first, followed by other fallback URLs, which are taken from chainlist.org.
|
|
11
|
+
*/
|
|
12
|
+
export declare const JSON_RPC_FALLBACK_ENDPOINTS: Record<SupportedChainId, string[]>;
|