@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
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
import { ChainId, Currency, NativeCurrency, Token } from '@uniswap/sdk-core';
|
|
2
2
|
export declare const NATIVE_CHAIN_ID = "NATIVE";
|
|
3
|
-
export declare const USDC_MAINNET:
|
|
4
|
-
export declare const USDC_GOERLI:
|
|
5
|
-
export declare const USDC_SEPOLIA:
|
|
6
|
-
export declare const USDC_OPTIMISM:
|
|
7
|
-
export declare const USDC_OPTIMISM_GOERLI:
|
|
8
|
-
export declare const USDC_ARBITRUM:
|
|
9
|
-
export declare const USDC_ARBITRUM_GOERLI:
|
|
10
|
-
export declare const USDC_POLYGON:
|
|
11
|
-
export declare const USDC_POLYGON_MUMBAI:
|
|
12
|
-
export declare const USDC_CELO:
|
|
13
|
-
export declare const USDC_BASE:
|
|
14
|
-
export declare const DAI:
|
|
15
|
-
export declare const DAI_ARBITRUM_ONE:
|
|
16
|
-
export declare const DAI_OPTIMISM:
|
|
17
|
-
export declare const MATIC_MAINNET:
|
|
18
|
-
export declare const MATIC_POLYGON:
|
|
19
|
-
export declare const DAI_POLYGON:
|
|
20
|
-
export declare const USDT_POLYGON:
|
|
21
|
-
export declare const WBTC_POLYGON:
|
|
22
|
-
export declare const USDT:
|
|
23
|
-
export declare const USDT_ARBITRUM_ONE:
|
|
24
|
-
export declare const USDT_OPTIMISM:
|
|
25
|
-
export declare const WBTC:
|
|
26
|
-
export declare const WBTC_ARBITRUM_ONE:
|
|
27
|
-
export declare const WBTC_OPTIMISM:
|
|
28
|
-
export declare const WETH_POLYGON_MUMBAI:
|
|
29
|
-
export declare const WETH_POLYGON:
|
|
30
|
-
export declare const CUSD_CELO:
|
|
31
|
-
export declare const CEUR_CELO:
|
|
32
|
-
export declare const PORTAL_ETH_CELO:
|
|
33
|
-
export declare const WBTC_CELO:
|
|
34
|
-
export declare const CUSD_CELO_ALFAJORES:
|
|
35
|
-
export declare const CEUR_CELO_ALFAJORES:
|
|
36
|
-
export declare const USDC_BSC:
|
|
37
|
-
export declare const USDT_BSC:
|
|
38
|
-
export declare const ETH_BSC:
|
|
39
|
-
export declare const BTC_BSC:
|
|
40
|
-
export declare const BUSD_BSC:
|
|
41
|
-
export declare const DAI_BSC:
|
|
42
|
-
export declare const USDB_BLAST:
|
|
43
|
-
export declare const USDC_AVALANCHE:
|
|
44
|
-
export declare const USDT_AVALANCHE:
|
|
45
|
-
export declare const WETH_AVALANCHE:
|
|
46
|
-
export declare const DAI_AVALANCHE:
|
|
3
|
+
export declare const USDC_MAINNET: any;
|
|
4
|
+
export declare const USDC_GOERLI: any;
|
|
5
|
+
export declare const USDC_SEPOLIA: any;
|
|
6
|
+
export declare const USDC_OPTIMISM: any;
|
|
7
|
+
export declare const USDC_OPTIMISM_GOERLI: any;
|
|
8
|
+
export declare const USDC_ARBITRUM: any;
|
|
9
|
+
export declare const USDC_ARBITRUM_GOERLI: any;
|
|
10
|
+
export declare const USDC_POLYGON: any;
|
|
11
|
+
export declare const USDC_POLYGON_MUMBAI: any;
|
|
12
|
+
export declare const USDC_CELO: any;
|
|
13
|
+
export declare const USDC_BASE: any;
|
|
14
|
+
export declare const DAI: any;
|
|
15
|
+
export declare const DAI_ARBITRUM_ONE: any;
|
|
16
|
+
export declare const DAI_OPTIMISM: any;
|
|
17
|
+
export declare const MATIC_MAINNET: any;
|
|
18
|
+
export declare const MATIC_POLYGON: any;
|
|
19
|
+
export declare const DAI_POLYGON: any;
|
|
20
|
+
export declare const USDT_POLYGON: any;
|
|
21
|
+
export declare const WBTC_POLYGON: any;
|
|
22
|
+
export declare const USDT: any;
|
|
23
|
+
export declare const USDT_ARBITRUM_ONE: any;
|
|
24
|
+
export declare const USDT_OPTIMISM: any;
|
|
25
|
+
export declare const WBTC: any;
|
|
26
|
+
export declare const WBTC_ARBITRUM_ONE: any;
|
|
27
|
+
export declare const WBTC_OPTIMISM: any;
|
|
28
|
+
export declare const WETH_POLYGON_MUMBAI: any;
|
|
29
|
+
export declare const WETH_POLYGON: any;
|
|
30
|
+
export declare const CUSD_CELO: any;
|
|
31
|
+
export declare const CEUR_CELO: any;
|
|
32
|
+
export declare const PORTAL_ETH_CELO: any;
|
|
33
|
+
export declare const WBTC_CELO: any;
|
|
34
|
+
export declare const CUSD_CELO_ALFAJORES: any;
|
|
35
|
+
export declare const CEUR_CELO_ALFAJORES: any;
|
|
36
|
+
export declare const USDC_BSC: any;
|
|
37
|
+
export declare const USDT_BSC: any;
|
|
38
|
+
export declare const ETH_BSC: any;
|
|
39
|
+
export declare const BTC_BSC: any;
|
|
40
|
+
export declare const BUSD_BSC: any;
|
|
41
|
+
export declare const DAI_BSC: any;
|
|
42
|
+
export declare const USDB_BLAST: any;
|
|
43
|
+
export declare const USDC_AVALANCHE: any;
|
|
44
|
+
export declare const USDT_AVALANCHE: any;
|
|
45
|
+
export declare const WETH_AVALANCHE: any;
|
|
46
|
+
export declare const DAI_AVALANCHE: any;
|
|
47
47
|
export declare const UNI: {
|
|
48
48
|
[chainId: number]: Token;
|
|
49
49
|
};
|
|
50
|
-
export declare const ARB:
|
|
51
|
-
export declare const OP:
|
|
52
|
-
export declare const LDO:
|
|
53
|
-
export declare const NMR:
|
|
54
|
-
export declare const MNW:
|
|
50
|
+
export declare const ARB: any;
|
|
51
|
+
export declare const OP: any;
|
|
52
|
+
export declare const LDO: any;
|
|
53
|
+
export declare const NMR: any;
|
|
54
|
+
export declare const MNW: any;
|
|
55
55
|
export declare const WRAPPED_NATIVE_CURRENCY: {
|
|
56
56
|
[chainId: number]: Token | undefined;
|
|
57
57
|
};
|
package/lib/constants/tokens.js
CHANGED
|
@@ -1,39 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __assign = (this && this.__assign) || function () {
|
|
18
|
-
__assign = Object.assign || function(t) {
|
|
19
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
-
s = arguments[i];
|
|
21
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
-
t[p] = s[p];
|
|
23
|
-
}
|
|
24
|
-
return t;
|
|
25
|
-
};
|
|
26
|
-
return __assign.apply(this, arguments);
|
|
27
|
-
};
|
|
28
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
4
|
};
|
|
31
|
-
var _a, _b, _c, _d;
|
|
32
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
6
|
exports.NMR = exports.LDO = exports.OP = exports.ARB = exports.UNI = exports.DAI_AVALANCHE = exports.WETH_AVALANCHE = exports.USDT_AVALANCHE = exports.USDC_AVALANCHE = exports.USDB_BLAST = exports.DAI_BSC = exports.BUSD_BSC = exports.BTC_BSC = exports.ETH_BSC = exports.USDT_BSC = exports.USDC_BSC = exports.CEUR_CELO_ALFAJORES = exports.CUSD_CELO_ALFAJORES = exports.WBTC_CELO = exports.PORTAL_ETH_CELO = exports.CEUR_CELO = exports.CUSD_CELO = exports.WETH_POLYGON = exports.WETH_POLYGON_MUMBAI = exports.WBTC_OPTIMISM = exports.WBTC_ARBITRUM_ONE = exports.WBTC = exports.USDT_OPTIMISM = exports.USDT_ARBITRUM_ONE = exports.USDT = exports.WBTC_POLYGON = exports.USDT_POLYGON = exports.DAI_POLYGON = exports.MATIC_POLYGON = exports.MATIC_MAINNET = exports.DAI_OPTIMISM = exports.DAI_ARBITRUM_ONE = exports.DAI = exports.USDC_BASE = exports.USDC_CELO = exports.USDC_POLYGON_MUMBAI = exports.USDC_POLYGON = exports.USDC_ARBITRUM_GOERLI = exports.USDC_ARBITRUM = exports.USDC_OPTIMISM_GOERLI = exports.USDC_OPTIMISM = exports.USDC_SEPOLIA = exports.USDC_GOERLI = exports.USDC_MAINNET = exports.NATIVE_CHAIN_ID = void 0;
|
|
34
|
-
exports.UNKNOWN_TOKEN_NAME = exports.UNKNOWN_TOKEN_SYMBOL = exports.
|
|
35
|
-
|
|
36
|
-
|
|
7
|
+
exports.UNKNOWN_TOKEN_NAME = exports.UNKNOWN_TOKEN_SYMBOL = exports.TOKEN_SHORTHANDS = exports.WRAPPED_NATIVE_CURRENCY = exports.MNW = void 0;
|
|
8
|
+
exports.isCelo = isCelo;
|
|
9
|
+
exports.isPolygon = isPolygon;
|
|
10
|
+
exports.isBsc = isBsc;
|
|
11
|
+
exports.isAvalanche = isAvalanche;
|
|
12
|
+
exports.nativeOnChain = nativeOnChain;
|
|
13
|
+
exports.isStablecoin = isStablecoin;
|
|
14
|
+
const sdk_core_1 = require("@uniswap/sdk-core");
|
|
15
|
+
const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
|
|
37
16
|
// eslint-disable-next-line no-restricted-syntax
|
|
38
17
|
exports.NATIVE_CHAIN_ID = 'NATIVE';
|
|
39
18
|
exports.USDC_MAINNET = new sdk_core_1.Token(sdk_core_1.ChainId.MAINNET, '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', 6, 'USDC', 'USD//C');
|
|
@@ -63,12 +42,12 @@ exports.WBTC_ARBITRUM_ONE = new sdk_core_1.Token(sdk_core_1.ChainId.ARBITRUM_ONE
|
|
|
63
42
|
exports.WBTC_OPTIMISM = new sdk_core_1.Token(sdk_core_1.ChainId.OPTIMISM, '0x68f180fcCe6836688e9084f035309E29Bf0A2095', 8, 'WBTC', 'Wrapped BTC');
|
|
64
43
|
exports.WETH_POLYGON_MUMBAI = new sdk_core_1.Token(sdk_core_1.ChainId.POLYGON_MUMBAI, '0xa6fa4fb5f76172d178d61b04b0ecd319c5d1c0aa', 18, 'WETH', 'Wrapped Ether');
|
|
65
44
|
exports.WETH_POLYGON = new sdk_core_1.Token(sdk_core_1.ChainId.POLYGON, '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619', 18, 'WETH', 'Wrapped Ether');
|
|
66
|
-
|
|
45
|
+
const CELO_CELO = new sdk_core_1.Token(sdk_core_1.ChainId.CELO, '0x471EcE3750Da237f93B8E339c536989b8978a438', 18, 'CELO', 'Celo');
|
|
67
46
|
exports.CUSD_CELO = new sdk_core_1.Token(sdk_core_1.ChainId.CELO, '0x765DE816845861e75A25fCA122bb6898B8B1282a', 18, 'cUSD', 'Celo Dollar');
|
|
68
47
|
exports.CEUR_CELO = new sdk_core_1.Token(sdk_core_1.ChainId.CELO, '0xD8763CBa276a3738E6DE85b4b3bF5FDed6D6cA73', 18, 'cEUR', 'Celo Euro Stablecoin');
|
|
69
48
|
exports.PORTAL_ETH_CELO = new sdk_core_1.Token(sdk_core_1.ChainId.CELO, '0x66803FB87aBd4aaC3cbB3fAd7C3aa01f6F3FB207', 18, 'ETH', 'Portal Ether');
|
|
70
49
|
exports.WBTC_CELO = new sdk_core_1.Token(sdk_core_1.ChainId.CELO, '0xd71Ffd0940c920786eC4DbB5A12306669b5b81EF', 18, 'WBTC', 'Wrapped BTC');
|
|
71
|
-
|
|
50
|
+
const CELO_CELO_ALFAJORES = new sdk_core_1.Token(sdk_core_1.ChainId.CELO_ALFAJORES, '0xF194afDf50B03e69Bd7D057c1Aa9e10c9954E4C9', 18, 'CELO', 'Celo');
|
|
72
51
|
exports.CUSD_CELO_ALFAJORES = new sdk_core_1.Token(sdk_core_1.ChainId.CELO_ALFAJORES, '0x874069Fa1Eb16D44d622F2e0Ca25eeA172369bC1', 18, 'CUSD', 'Celo Dollar');
|
|
73
52
|
exports.CEUR_CELO_ALFAJORES = new sdk_core_1.Token(sdk_core_1.ChainId.CELO_ALFAJORES, '0x10c892A6EC43a53E45D0B916B4b7D383B1b78C0F', 18, 'CEUR', 'Celo Euro Stablecoin');
|
|
74
53
|
exports.USDC_BSC = new sdk_core_1.Token(sdk_core_1.ChainId.BNB, '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d', 18, 'USDC', 'USDC');
|
|
@@ -82,21 +61,35 @@ exports.USDC_AVALANCHE = new sdk_core_1.Token(sdk_core_1.ChainId.AVALANCHE, '0xB
|
|
|
82
61
|
exports.USDT_AVALANCHE = new sdk_core_1.Token(sdk_core_1.ChainId.AVALANCHE, '0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7', 6, 'USDT', 'Tether USD');
|
|
83
62
|
exports.WETH_AVALANCHE = new sdk_core_1.Token(sdk_core_1.ChainId.AVALANCHE, '0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB', 18, 'WETH', 'Wrapped Ether');
|
|
84
63
|
exports.DAI_AVALANCHE = new sdk_core_1.Token(sdk_core_1.ChainId.AVALANCHE, '0xd586E7F844cEa2F87f50152665BCbc2C279D8d70', 18, 'DAI.e', 'Dai.e Token');
|
|
85
|
-
exports.UNI =
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
64
|
+
exports.UNI = {
|
|
65
|
+
[sdk_core_1.ChainId.MAINNET]: new sdk_core_1.Token(sdk_core_1.ChainId.MAINNET, sdk_core_1.UNI_ADDRESSES[sdk_core_1.ChainId.MAINNET], 18, 'UNI', 'Uniswap'),
|
|
66
|
+
[sdk_core_1.ChainId.GOERLI]: new sdk_core_1.Token(sdk_core_1.ChainId.GOERLI, sdk_core_1.UNI_ADDRESSES[sdk_core_1.ChainId.GOERLI], 18, 'UNI', 'Uniswap'),
|
|
67
|
+
[sdk_core_1.ChainId.SEPOLIA]: new sdk_core_1.Token(sdk_core_1.ChainId.SEPOLIA, sdk_core_1.UNI_ADDRESSES[sdk_core_1.ChainId.SEPOLIA], 18, 'UNI', 'Uniswap'),
|
|
68
|
+
};
|
|
90
69
|
exports.ARB = new sdk_core_1.Token(sdk_core_1.ChainId.ARBITRUM_ONE, '0x912CE59144191C1204E64559FE8253a0e49E6548', 18, 'ARB', 'Arbitrum');
|
|
91
70
|
exports.OP = new sdk_core_1.Token(sdk_core_1.ChainId.OPTIMISM, '0x4200000000000000000000000000000000000042', 18, 'OP', 'Optimism');
|
|
92
71
|
exports.LDO = new sdk_core_1.Token(sdk_core_1.ChainId.MAINNET, '0x5A98FcBEA516Cf06857215779Fd812CA3beF1B32', 18, 'LDO', 'Lido DAO Token');
|
|
93
72
|
exports.NMR = new sdk_core_1.Token(sdk_core_1.ChainId.MAINNET, '0x1776e1F26f98b1A5dF9cD347953a26dd3Cb46671', 18, 'NMR', 'Numeraire');
|
|
94
73
|
exports.MNW = new sdk_core_1.Token(sdk_core_1.ChainId.MAINNET, '0xd3E4Ba569045546D09CF021ECC5dFe42b1d7f6E4', 18, 'MNW', 'Morpheus.Network');
|
|
95
|
-
exports.WRAPPED_NATIVE_CURRENCY =
|
|
74
|
+
exports.WRAPPED_NATIVE_CURRENCY = {
|
|
75
|
+
...sdk_core_1.WETH9,
|
|
76
|
+
[sdk_core_1.ChainId.OPTIMISM]: new sdk_core_1.Token(sdk_core_1.ChainId.OPTIMISM, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'),
|
|
77
|
+
[sdk_core_1.ChainId.OPTIMISM_GOERLI]: new sdk_core_1.Token(sdk_core_1.ChainId.OPTIMISM_GOERLI, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'),
|
|
78
|
+
[sdk_core_1.ChainId.BASE]: new sdk_core_1.Token(sdk_core_1.ChainId.BASE, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'),
|
|
79
|
+
[sdk_core_1.ChainId.ARBITRUM_ONE]: new sdk_core_1.Token(sdk_core_1.ChainId.ARBITRUM_ONE, '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', 18, 'WETH', 'Wrapped Ether'),
|
|
80
|
+
[sdk_core_1.ChainId.ARBITRUM_GOERLI]: new sdk_core_1.Token(sdk_core_1.ChainId.ARBITRUM_GOERLI, '0xe39Ab88f8A4777030A534146A9Ca3B52bd5D43A3', 18, 'WETH', 'Wrapped Ether'),
|
|
81
|
+
[sdk_core_1.ChainId.SEPOLIA]: new sdk_core_1.Token(sdk_core_1.ChainId.SEPOLIA, '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14', 18, 'WETH', 'Wrapped Ether'),
|
|
82
|
+
[sdk_core_1.ChainId.POLYGON]: new sdk_core_1.Token(sdk_core_1.ChainId.POLYGON, '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', 18, 'WMATIC', 'Wrapped MATIC'),
|
|
83
|
+
[sdk_core_1.ChainId.POLYGON_MUMBAI]: new sdk_core_1.Token(sdk_core_1.ChainId.POLYGON_MUMBAI, '0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889', 18, 'WMATIC', 'Wrapped MATIC'),
|
|
84
|
+
[sdk_core_1.ChainId.CELO]: new sdk_core_1.Token(sdk_core_1.ChainId.CELO, '0x471ece3750da237f93b8e339c536989b8978a438', 18, 'CELO', 'Celo native asset'),
|
|
85
|
+
[sdk_core_1.ChainId.CELO_ALFAJORES]: new sdk_core_1.Token(sdk_core_1.ChainId.CELO_ALFAJORES, '0xf194afdf50b03e69bd7d057c1aa9e10c9954e4c9', 18, 'CELO', 'Celo native asset'),
|
|
86
|
+
[sdk_core_1.ChainId.BNB]: new sdk_core_1.Token(sdk_core_1.ChainId.BNB, '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', 18, 'WBNB', 'Wrapped BNB'),
|
|
87
|
+
[sdk_core_1.ChainId.AVALANCHE]: new sdk_core_1.Token(sdk_core_1.ChainId.AVALANCHE, '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7', 18, 'WAVAX', 'Wrapped AVAX'),
|
|
88
|
+
[sdk_core_1.ChainId.BLAST]: new sdk_core_1.Token(sdk_core_1.ChainId.BLAST, '0x4300000000000000000000000000000000000004', 18, 'WETH', 'Wrapped Ether'),
|
|
89
|
+
};
|
|
96
90
|
function isCelo(chainId) {
|
|
97
91
|
return chainId === sdk_core_1.ChainId.CELO_ALFAJORES || chainId === sdk_core_1.ChainId.CELO;
|
|
98
92
|
}
|
|
99
|
-
exports.isCelo = isCelo;
|
|
100
93
|
function getCeloNativeCurrency(chainId) {
|
|
101
94
|
switch (chainId) {
|
|
102
95
|
case sdk_core_1.ChainId.CELO_ALFAJORES:
|
|
@@ -110,114 +103,86 @@ function getCeloNativeCurrency(chainId) {
|
|
|
110
103
|
function isPolygon(chainId) {
|
|
111
104
|
return chainId === sdk_core_1.ChainId.POLYGON_MUMBAI || chainId === sdk_core_1.ChainId.POLYGON;
|
|
112
105
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
106
|
+
class PolygonNativeCurrency extends sdk_core_1.NativeCurrency {
|
|
107
|
+
equals(other) {
|
|
108
|
+
return other.isNative && other.chainId === this.chainId;
|
|
109
|
+
}
|
|
110
|
+
get wrapped() {
|
|
111
|
+
if (!isPolygon(this.chainId))
|
|
112
|
+
throw new Error('Not Polygon');
|
|
113
|
+
const wrapped = exports.WRAPPED_NATIVE_CURRENCY[this.chainId];
|
|
114
|
+
(0, tiny_invariant_1.default)(wrapped instanceof sdk_core_1.Token);
|
|
115
|
+
return wrapped;
|
|
116
|
+
}
|
|
117
|
+
constructor(chainId) {
|
|
117
118
|
if (!isPolygon(chainId))
|
|
118
119
|
throw new Error('Not Polygon');
|
|
119
|
-
|
|
120
|
+
super(chainId, 18, 'MATIC', 'Matic');
|
|
120
121
|
}
|
|
121
|
-
|
|
122
|
-
return other.isNative && other.chainId === this.chainId;
|
|
123
|
-
};
|
|
124
|
-
Object.defineProperty(PolygonNativeCurrency.prototype, "wrapped", {
|
|
125
|
-
get: function () {
|
|
126
|
-
if (!isPolygon(this.chainId))
|
|
127
|
-
throw new Error('Not Polygon');
|
|
128
|
-
var wrapped = exports.WRAPPED_NATIVE_CURRENCY[this.chainId];
|
|
129
|
-
(0, tiny_invariant_1.default)(wrapped instanceof sdk_core_1.Token);
|
|
130
|
-
return wrapped;
|
|
131
|
-
},
|
|
132
|
-
enumerable: false,
|
|
133
|
-
configurable: true
|
|
134
|
-
});
|
|
135
|
-
return PolygonNativeCurrency;
|
|
136
|
-
}(sdk_core_1.NativeCurrency));
|
|
122
|
+
}
|
|
137
123
|
function isBsc(chainId) {
|
|
138
124
|
return chainId === sdk_core_1.ChainId.BNB;
|
|
139
125
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
126
|
+
class BscNativeCurrency extends sdk_core_1.NativeCurrency {
|
|
127
|
+
equals(other) {
|
|
128
|
+
return other.isNative && other.chainId === this.chainId;
|
|
129
|
+
}
|
|
130
|
+
get wrapped() {
|
|
131
|
+
if (!isBsc(this.chainId))
|
|
132
|
+
throw new Error('Not bnb');
|
|
133
|
+
const wrapped = exports.WRAPPED_NATIVE_CURRENCY[this.chainId];
|
|
134
|
+
(0, tiny_invariant_1.default)(wrapped instanceof sdk_core_1.Token);
|
|
135
|
+
return wrapped;
|
|
136
|
+
}
|
|
137
|
+
constructor(chainId) {
|
|
144
138
|
if (!isBsc(chainId))
|
|
145
139
|
throw new Error('Not bnb');
|
|
146
|
-
|
|
140
|
+
super(chainId, 18, 'BNB', 'BNB');
|
|
147
141
|
}
|
|
148
|
-
|
|
149
|
-
return other.isNative && other.chainId === this.chainId;
|
|
150
|
-
};
|
|
151
|
-
Object.defineProperty(BscNativeCurrency.prototype, "wrapped", {
|
|
152
|
-
get: function () {
|
|
153
|
-
if (!isBsc(this.chainId))
|
|
154
|
-
throw new Error('Not bnb');
|
|
155
|
-
var wrapped = exports.WRAPPED_NATIVE_CURRENCY[this.chainId];
|
|
156
|
-
(0, tiny_invariant_1.default)(wrapped instanceof sdk_core_1.Token);
|
|
157
|
-
return wrapped;
|
|
158
|
-
},
|
|
159
|
-
enumerable: false,
|
|
160
|
-
configurable: true
|
|
161
|
-
});
|
|
162
|
-
return BscNativeCurrency;
|
|
163
|
-
}(sdk_core_1.NativeCurrency));
|
|
142
|
+
}
|
|
164
143
|
function isAvalanche(chainId) {
|
|
165
144
|
return chainId === sdk_core_1.ChainId.AVALANCHE;
|
|
166
145
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
146
|
+
class AvaxNativeCurrency extends sdk_core_1.NativeCurrency {
|
|
147
|
+
equals(other) {
|
|
148
|
+
return other.isNative && other.chainId === this.chainId;
|
|
149
|
+
}
|
|
150
|
+
get wrapped() {
|
|
151
|
+
if (!isAvalanche(this.chainId))
|
|
152
|
+
throw new Error('Not avalanche');
|
|
153
|
+
const wrapped = exports.WRAPPED_NATIVE_CURRENCY[this.chainId];
|
|
154
|
+
(0, tiny_invariant_1.default)(wrapped instanceof sdk_core_1.Token);
|
|
155
|
+
return wrapped;
|
|
156
|
+
}
|
|
157
|
+
constructor(chainId) {
|
|
171
158
|
if (!isAvalanche(chainId))
|
|
172
159
|
throw new Error('Not avalanche');
|
|
173
|
-
|
|
160
|
+
super(chainId, 18, 'AVAX', 'AVAX');
|
|
174
161
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
if (!isAvalanche(this.chainId))
|
|
181
|
-
throw new Error('Not avalanche');
|
|
182
|
-
var wrapped = exports.WRAPPED_NATIVE_CURRENCY[this.chainId];
|
|
183
|
-
(0, tiny_invariant_1.default)(wrapped instanceof sdk_core_1.Token);
|
|
162
|
+
}
|
|
163
|
+
class ExtendedEther extends sdk_core_1.NativeCurrency {
|
|
164
|
+
get wrapped() {
|
|
165
|
+
const wrapped = exports.WRAPPED_NATIVE_CURRENCY[this.chainId];
|
|
166
|
+
if (wrapped)
|
|
184
167
|
return wrapped;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
__extends(ExtendedEther, _super);
|
|
193
|
-
function ExtendedEther(chainId) {
|
|
194
|
-
return _super.call(this, chainId, 18, 'ETH', 'Ethereum') || this;
|
|
168
|
+
throw new Error(`Unsupported chain ID: ${this.chainId}`);
|
|
169
|
+
}
|
|
170
|
+
constructor(chainId) {
|
|
171
|
+
super(chainId, 18, 'ETH', 'Ethereum');
|
|
172
|
+
}
|
|
173
|
+
static onChain(chainId) {
|
|
174
|
+
return this._cachedExtendedEther[chainId] ?? (this._cachedExtendedEther[chainId] = new ExtendedEther(chainId));
|
|
195
175
|
}
|
|
196
|
-
|
|
197
|
-
get: function () {
|
|
198
|
-
var wrapped = exports.WRAPPED_NATIVE_CURRENCY[this.chainId];
|
|
199
|
-
if (wrapped)
|
|
200
|
-
return wrapped;
|
|
201
|
-
throw new Error("Unsupported chain ID: ".concat(this.chainId));
|
|
202
|
-
},
|
|
203
|
-
enumerable: false,
|
|
204
|
-
configurable: true
|
|
205
|
-
});
|
|
206
|
-
ExtendedEther.onChain = function (chainId) {
|
|
207
|
-
var _a;
|
|
208
|
-
return (_a = this._cachedExtendedEther[chainId]) !== null && _a !== void 0 ? _a : (this._cachedExtendedEther[chainId] = new ExtendedEther(chainId));
|
|
209
|
-
};
|
|
210
|
-
ExtendedEther.prototype.equals = function (other) {
|
|
176
|
+
equals(other) {
|
|
211
177
|
return other.isNative && other.chainId === this.chainId;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
var cachedNativeCurrency = {};
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
ExtendedEther._cachedExtendedEther = {};
|
|
181
|
+
const cachedNativeCurrency = {};
|
|
217
182
|
function nativeOnChain(chainId) {
|
|
218
183
|
if (cachedNativeCurrency[chainId])
|
|
219
184
|
return cachedNativeCurrency[chainId];
|
|
220
|
-
|
|
185
|
+
let nativeCurrency;
|
|
221
186
|
if (isPolygon(chainId)) {
|
|
222
187
|
nativeCurrency = new PolygonNativeCurrency(chainId);
|
|
223
188
|
}
|
|
@@ -235,55 +200,53 @@ function nativeOnChain(chainId) {
|
|
|
235
200
|
}
|
|
236
201
|
return (cachedNativeCurrency[chainId] = nativeCurrency);
|
|
237
202
|
}
|
|
238
|
-
exports.nativeOnChain = nativeOnChain;
|
|
239
203
|
exports.TOKEN_SHORTHANDS = {
|
|
240
|
-
USDC:
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
204
|
+
USDC: {
|
|
205
|
+
[sdk_core_1.ChainId.MAINNET]: exports.USDC_MAINNET.address,
|
|
206
|
+
[sdk_core_1.ChainId.ARBITRUM_ONE]: exports.USDC_ARBITRUM.address,
|
|
207
|
+
[sdk_core_1.ChainId.ARBITRUM_GOERLI]: exports.USDC_ARBITRUM_GOERLI.address,
|
|
208
|
+
[sdk_core_1.ChainId.OPTIMISM]: exports.USDC_OPTIMISM.address,
|
|
209
|
+
[sdk_core_1.ChainId.OPTIMISM_GOERLI]: exports.USDC_OPTIMISM_GOERLI.address,
|
|
210
|
+
[sdk_core_1.ChainId.POLYGON]: exports.USDC_POLYGON.address,
|
|
211
|
+
[sdk_core_1.ChainId.POLYGON_MUMBAI]: exports.USDC_POLYGON_MUMBAI.address,
|
|
212
|
+
[sdk_core_1.ChainId.BNB]: exports.USDC_BSC.address,
|
|
213
|
+
[sdk_core_1.ChainId.BASE]: exports.USDC_BASE.address,
|
|
214
|
+
[sdk_core_1.ChainId.CELO]: exports.USDC_CELO.address,
|
|
215
|
+
[sdk_core_1.ChainId.CELO_ALFAJORES]: exports.USDC_CELO.address,
|
|
216
|
+
[sdk_core_1.ChainId.GOERLI]: exports.USDC_GOERLI.address,
|
|
217
|
+
[sdk_core_1.ChainId.SEPOLIA]: exports.USDC_SEPOLIA.address,
|
|
218
|
+
[sdk_core_1.ChainId.AVALANCHE]: exports.USDC_AVALANCHE.address,
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
const STABLECOINS = {
|
|
222
|
+
[sdk_core_1.ChainId.MAINNET]: [exports.USDC_MAINNET, exports.DAI, exports.USDT],
|
|
223
|
+
[sdk_core_1.ChainId.ARBITRUM_ONE]: [exports.USDC_ARBITRUM, exports.DAI_ARBITRUM_ONE],
|
|
224
|
+
[sdk_core_1.ChainId.ARBITRUM_GOERLI]: [exports.USDC_ARBITRUM_GOERLI],
|
|
225
|
+
[sdk_core_1.ChainId.OPTIMISM]: [exports.USDC_OPTIMISM, exports.DAI_OPTIMISM],
|
|
226
|
+
[sdk_core_1.ChainId.OPTIMISM_GOERLI]: [exports.USDC_OPTIMISM_GOERLI],
|
|
227
|
+
[sdk_core_1.ChainId.POLYGON]: [exports.USDC_POLYGON, exports.DAI_POLYGON],
|
|
228
|
+
[sdk_core_1.ChainId.POLYGON_MUMBAI]: [exports.USDC_POLYGON_MUMBAI],
|
|
229
|
+
[sdk_core_1.ChainId.BNB]: [exports.USDC_BSC],
|
|
230
|
+
[sdk_core_1.ChainId.BASE]: [exports.USDC_BASE],
|
|
231
|
+
[sdk_core_1.ChainId.CELO]: [exports.USDC_CELO],
|
|
232
|
+
[sdk_core_1.ChainId.CELO_ALFAJORES]: [exports.USDC_CELO],
|
|
233
|
+
[sdk_core_1.ChainId.GOERLI]: [exports.USDC_GOERLI],
|
|
234
|
+
[sdk_core_1.ChainId.SEPOLIA]: [exports.USDC_SEPOLIA],
|
|
235
|
+
[sdk_core_1.ChainId.AVALANCHE]: [exports.USDC_AVALANCHE],
|
|
236
|
+
[sdk_core_1.ChainId.GNOSIS]: [],
|
|
237
|
+
[sdk_core_1.ChainId.MOONBEAM]: [],
|
|
238
|
+
[sdk_core_1.ChainId.BASE_GOERLI]: [],
|
|
239
|
+
[sdk_core_1.ChainId.OPTIMISM_SEPOLIA]: [exports.USDC_SEPOLIA],
|
|
240
|
+
[sdk_core_1.ChainId.ARBITRUM_SEPOLIA]: [],
|
|
241
|
+
[sdk_core_1.ChainId.ZORA_SEPOLIA]: [],
|
|
242
|
+
[sdk_core_1.ChainId.ZORA]: [],
|
|
243
|
+
[sdk_core_1.ChainId.ROOTSTOCK]: [],
|
|
244
|
+
[sdk_core_1.ChainId.BLAST]: [exports.USDB_BLAST],
|
|
256
245
|
};
|
|
257
|
-
var STABLECOINS = (_d = {},
|
|
258
|
-
_d[sdk_core_1.ChainId.MAINNET] = [exports.USDC_MAINNET, exports.DAI, exports.USDT],
|
|
259
|
-
_d[sdk_core_1.ChainId.ARBITRUM_ONE] = [exports.USDC_ARBITRUM, exports.DAI_ARBITRUM_ONE],
|
|
260
|
-
_d[sdk_core_1.ChainId.ARBITRUM_GOERLI] = [exports.USDC_ARBITRUM_GOERLI],
|
|
261
|
-
_d[sdk_core_1.ChainId.OPTIMISM] = [exports.USDC_OPTIMISM, exports.DAI_OPTIMISM],
|
|
262
|
-
_d[sdk_core_1.ChainId.OPTIMISM_GOERLI] = [exports.USDC_OPTIMISM_GOERLI],
|
|
263
|
-
_d[sdk_core_1.ChainId.POLYGON] = [exports.USDC_POLYGON, exports.DAI_POLYGON],
|
|
264
|
-
_d[sdk_core_1.ChainId.POLYGON_MUMBAI] = [exports.USDC_POLYGON_MUMBAI],
|
|
265
|
-
_d[sdk_core_1.ChainId.BNB] = [exports.USDC_BSC],
|
|
266
|
-
_d[sdk_core_1.ChainId.BASE] = [exports.USDC_BASE],
|
|
267
|
-
_d[sdk_core_1.ChainId.CELO] = [exports.USDC_CELO],
|
|
268
|
-
_d[sdk_core_1.ChainId.CELO_ALFAJORES] = [exports.USDC_CELO],
|
|
269
|
-
_d[sdk_core_1.ChainId.GOERLI] = [exports.USDC_GOERLI],
|
|
270
|
-
_d[sdk_core_1.ChainId.SEPOLIA] = [exports.USDC_SEPOLIA],
|
|
271
|
-
_d[sdk_core_1.ChainId.AVALANCHE] = [exports.USDC_AVALANCHE],
|
|
272
|
-
_d[sdk_core_1.ChainId.GNOSIS] = [],
|
|
273
|
-
_d[sdk_core_1.ChainId.MOONBEAM] = [],
|
|
274
|
-
_d[sdk_core_1.ChainId.BASE_GOERLI] = [],
|
|
275
|
-
_d[sdk_core_1.ChainId.OPTIMISM_SEPOLIA] = [exports.USDC_SEPOLIA],
|
|
276
|
-
_d[sdk_core_1.ChainId.ARBITRUM_SEPOLIA] = [],
|
|
277
|
-
_d[sdk_core_1.ChainId.ZORA_SEPOLIA] = [],
|
|
278
|
-
_d[sdk_core_1.ChainId.ZORA] = [],
|
|
279
|
-
_d[sdk_core_1.ChainId.ROOTSTOCK] = [],
|
|
280
|
-
_d[sdk_core_1.ChainId.BLAST] = [exports.USDB_BLAST],
|
|
281
|
-
_d);
|
|
282
246
|
function isStablecoin(currency) {
|
|
283
247
|
if (!currency)
|
|
284
248
|
return false;
|
|
285
|
-
return STABLECOINS[currency.chainId].some(
|
|
249
|
+
return STABLECOINS[currency.chainId].some((stablecoin) => stablecoin.equals(currency));
|
|
286
250
|
}
|
|
287
|
-
exports.isStablecoin = isStablecoin;
|
|
288
251
|
exports.UNKNOWN_TOKEN_SYMBOL = 'UNKNOWN';
|
|
289
252
|
exports.UNKNOWN_TOKEN_NAME = 'Unknown Token';
|