@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,246 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
31
|
+
var _a, _b, _c, _d;
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
exports.MATIC_BNB_CHAIN = exports.ETH_BNB_CHAIN = exports.USDT_BNB_CHAIN = exports.CEUR_CELO_ALFAJORES = exports.CUSD_CELO_ALFAJORES = exports.CELO_CELO_ALFAJORES = exports.CMC02_CELO = exports.PORTAL_ETH_CELO = exports.CEUR_CELO = exports.CUSD_CELO = exports.CELO_CELO = exports.WETH_POLYGON = exports.WETH_POLYGON_MUMBAI = exports.SWISE = exports.rETH2 = exports.sETH2 = exports.ETH2X_FLI = exports.renBTC = exports.FXS = exports.FRAX = exports.TRIBE = exports.FEI = 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.USDC = exports.USDC_BASE = exports.USDC_BNB_CHAIN = exports.DAI_OPTIMISM = exports.DAI_ARBITRUM_ONE = exports.DAI = exports.AMPL = exports.USDC_CELO_ALFAJORES = exports.PORTAL_USDC_CELO = exports.USDC_POLYGON_MUMBAI = exports.USDC_POLYGON = exports.USDC_ARBITRUM_RINKEBY = exports.USDC_ARBITRUM = exports.USDC_OPTIMISM = exports.USDC_KOVAN = exports.USDC_GOERLI = exports.USDC_RINKEBY = exports.USDC_ROPSTEN = exports.USDC_MAINNET = void 0;
|
|
34
|
+
exports.TOKEN_SHORTHANDS = exports.nativeOnChain = exports.ExtendedEther = exports.isCelo = exports.WRAPPED_NATIVE_CURRENCY = exports.UNI = exports.DAI_BASE = exports.DAI_BNB_CHAIN = exports.BUSD_BNB_CHAIN = exports.CAKE_BNB_CHAIN = exports.BTC_BNB_CHAIN = exports.FRAX_BNB_CHAIN = void 0;
|
|
35
|
+
var sdk_core_1 = require("@uniswap/sdk-core");
|
|
36
|
+
var tiny_invariant_1 = __importDefault(require("tiny-invariant"));
|
|
37
|
+
var addresses_1 = require("./addresses");
|
|
38
|
+
var chains_1 = require("./chains");
|
|
39
|
+
exports.USDC_MAINNET = new sdk_core_1.Token(chains_1.SupportedChainId.MAINNET, '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', 6, 'USDC', 'USD//C');
|
|
40
|
+
exports.USDC_ROPSTEN = new sdk_core_1.Token(chains_1.SupportedChainId.ROPSTEN, '0x07865c6e87b9f70255377e024ace6630c1eaa37f', 6, 'USDC', 'USD//C');
|
|
41
|
+
exports.USDC_RINKEBY = new sdk_core_1.Token(chains_1.SupportedChainId.RINKEBY, '0x4DBCdF9B62e891a7cec5A2568C3F4FAF9E8Abe2b', 6, 'tUSDC', 'test USD//C');
|
|
42
|
+
exports.USDC_GOERLI = new sdk_core_1.Token(chains_1.SupportedChainId.GOERLI, '0x07865c6e87b9f70255377e024ace6630c1eaa37f', 6, 'USDC', 'USD//C');
|
|
43
|
+
exports.USDC_KOVAN = new sdk_core_1.Token(chains_1.SupportedChainId.KOVAN, '0x31eeb2d0f9b6fd8642914ab10f4dd473677d80df', 6, 'USDC', 'USD//C');
|
|
44
|
+
exports.USDC_OPTIMISM = new sdk_core_1.Token(chains_1.SupportedChainId.OPTIMISM, '0x7F5c764cBc14f9669B88837ca1490cCa17c31607', 6, 'USDC', 'USD//C');
|
|
45
|
+
var USDC_OPTIMISM_GOERLI = new sdk_core_1.Token(chains_1.SupportedChainId.OPTIMISM_GOERLI, '0x7E07E15D2a87A24492740D16f5bdF58c16db0c4E', 6, 'USDC', 'USD//C');
|
|
46
|
+
exports.USDC_ARBITRUM = new sdk_core_1.Token(chains_1.SupportedChainId.ARBITRUM_ONE, '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8', 6, 'USDC', 'USD//C');
|
|
47
|
+
exports.USDC_ARBITRUM_RINKEBY = new sdk_core_1.Token(chains_1.SupportedChainId.ARBITRUM_RINKEBY, '0x09b98f8b2395d076514037ff7d39a091a536206c', 6, 'USDC', 'USD//C');
|
|
48
|
+
exports.USDC_POLYGON = new sdk_core_1.Token(chains_1.SupportedChainId.POLYGON, '0x2791bca1f2de4661ed88a30c99a7a9449aa84174', 6, 'USDC', 'USD//C');
|
|
49
|
+
exports.USDC_POLYGON_MUMBAI = new sdk_core_1.Token(chains_1.SupportedChainId.POLYGON_MUMBAI, '0xe11a86849d99f524cac3e7a0ec1241828e332c62', 6, 'USDC', 'USD//C');
|
|
50
|
+
exports.PORTAL_USDC_CELO = new sdk_core_1.Token(chains_1.SupportedChainId.CELO, '0x37f750B7cC259A2f741AF45294f6a16572CF5cAd', 6, 'USDCet', 'USDC (Portal from Ethereum)');
|
|
51
|
+
exports.USDC_CELO_ALFAJORES = new sdk_core_1.Token(chains_1.SupportedChainId.CELO_ALFAJORES, '0x41F4a5d2632b019Ae6CE9625bE3c9CaC143AcC7D', 6, 'USDC', 'USD//C');
|
|
52
|
+
exports.AMPL = new sdk_core_1.Token(chains_1.SupportedChainId.MAINNET, '0xD46bA6D942050d489DBd938a2C909A5d5039A161', 9, 'AMPL', 'Ampleforth');
|
|
53
|
+
exports.DAI = new sdk_core_1.Token(chains_1.SupportedChainId.MAINNET, '0x6B175474E89094C44Da98b954EedeAC495271d0F', 18, 'DAI', 'Dai Stablecoin');
|
|
54
|
+
exports.DAI_ARBITRUM_ONE = new sdk_core_1.Token(chains_1.SupportedChainId.ARBITRUM_ONE, '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1', 18, 'DAI', 'Dai stable coin');
|
|
55
|
+
exports.DAI_OPTIMISM = new sdk_core_1.Token(chains_1.SupportedChainId.OPTIMISM, '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1', 18, 'DAI', 'Dai stable coin');
|
|
56
|
+
exports.USDC_BNB_CHAIN = new sdk_core_1.Token(chains_1.SupportedChainId.BNB, '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d', 18, 'USDC', 'USDC');
|
|
57
|
+
exports.USDC_BASE = new sdk_core_1.Token(chains_1.SupportedChainId.BASE, '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913', 6, 'USDC', 'USD Coin');
|
|
58
|
+
exports.USDC = (_a = {},
|
|
59
|
+
_a[chains_1.SupportedChainId.MAINNET] = exports.USDC_MAINNET,
|
|
60
|
+
_a[chains_1.SupportedChainId.ARBITRUM_ONE] = exports.USDC_ARBITRUM,
|
|
61
|
+
_a[chains_1.SupportedChainId.OPTIMISM] = exports.USDC_OPTIMISM,
|
|
62
|
+
_a[chains_1.SupportedChainId.ARBITRUM_RINKEBY] = exports.USDC_ARBITRUM_RINKEBY,
|
|
63
|
+
_a[chains_1.SupportedChainId.OPTIMISM_GOERLI] = USDC_OPTIMISM_GOERLI,
|
|
64
|
+
_a[chains_1.SupportedChainId.POLYGON] = exports.USDC_POLYGON,
|
|
65
|
+
_a[chains_1.SupportedChainId.POLYGON_MUMBAI] = exports.USDC_POLYGON_MUMBAI,
|
|
66
|
+
_a[chains_1.SupportedChainId.CELO] = exports.PORTAL_USDC_CELO,
|
|
67
|
+
_a[chains_1.SupportedChainId.CELO_ALFAJORES] = exports.USDC_CELO_ALFAJORES,
|
|
68
|
+
_a[chains_1.SupportedChainId.GOERLI] = exports.USDC_GOERLI,
|
|
69
|
+
_a[chains_1.SupportedChainId.RINKEBY] = exports.USDC_RINKEBY,
|
|
70
|
+
_a[chains_1.SupportedChainId.KOVAN] = exports.USDC_KOVAN,
|
|
71
|
+
_a[chains_1.SupportedChainId.ROPSTEN] = exports.USDC_ROPSTEN,
|
|
72
|
+
_a[chains_1.SupportedChainId.BNB] = exports.USDC_BNB_CHAIN,
|
|
73
|
+
_a[chains_1.SupportedChainId.BASE] = exports.USDC_BASE,
|
|
74
|
+
_a);
|
|
75
|
+
exports.DAI_POLYGON = new sdk_core_1.Token(chains_1.SupportedChainId.POLYGON, '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', 18, 'DAI', 'Dai Stablecoin');
|
|
76
|
+
exports.USDT_POLYGON = new sdk_core_1.Token(chains_1.SupportedChainId.POLYGON, '0xc2132d05d31c914a87c6611c10748aeb04b58e8f', 6, 'USDT', 'Tether USD');
|
|
77
|
+
exports.WBTC_POLYGON = new sdk_core_1.Token(chains_1.SupportedChainId.POLYGON, '0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6', 8, 'WBTC', 'Wrapped BTC');
|
|
78
|
+
exports.USDT = new sdk_core_1.Token(chains_1.SupportedChainId.MAINNET, '0xdAC17F958D2ee523a2206206994597C13D831ec7', 6, 'USDT', 'Tether USD');
|
|
79
|
+
exports.USDT_ARBITRUM_ONE = new sdk_core_1.Token(chains_1.SupportedChainId.ARBITRUM_ONE, '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9', 6, 'USDT', 'Tether USD');
|
|
80
|
+
exports.USDT_OPTIMISM = new sdk_core_1.Token(chains_1.SupportedChainId.OPTIMISM, '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58', 6, 'USDT', 'Tether USD');
|
|
81
|
+
exports.WBTC = new sdk_core_1.Token(chains_1.SupportedChainId.MAINNET, '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', 8, 'WBTC', 'Wrapped BTC');
|
|
82
|
+
exports.WBTC_ARBITRUM_ONE = new sdk_core_1.Token(chains_1.SupportedChainId.ARBITRUM_ONE, '0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f', 8, 'WBTC', 'Wrapped BTC');
|
|
83
|
+
exports.WBTC_OPTIMISM = new sdk_core_1.Token(chains_1.SupportedChainId.OPTIMISM, '0x68f180fcCe6836688e9084f035309E29Bf0A2095', 8, 'WBTC', 'Wrapped BTC');
|
|
84
|
+
exports.FEI = new sdk_core_1.Token(chains_1.SupportedChainId.MAINNET, '0x956F47F50A910163D8BF957Cf5846D573E7f87CA', 18, 'FEI', 'Fei USD');
|
|
85
|
+
exports.TRIBE = new sdk_core_1.Token(chains_1.SupportedChainId.MAINNET, '0xc7283b66Eb1EB5FB86327f08e1B5816b0720212B', 18, 'TRIBE', 'Tribe');
|
|
86
|
+
exports.FRAX = new sdk_core_1.Token(chains_1.SupportedChainId.MAINNET, '0x853d955aCEf822Db058eb8505911ED77F175b99e', 18, 'FRAX', 'Frax');
|
|
87
|
+
exports.FXS = new sdk_core_1.Token(chains_1.SupportedChainId.MAINNET, '0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0', 18, 'FXS', 'Frax Share');
|
|
88
|
+
exports.renBTC = new sdk_core_1.Token(chains_1.SupportedChainId.MAINNET, '0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D', 8, 'renBTC', 'renBTC');
|
|
89
|
+
exports.ETH2X_FLI = new sdk_core_1.Token(chains_1.SupportedChainId.MAINNET, '0xAa6E8127831c9DE45ae56bB1b0d4D4Da6e5665BD', 18, 'ETH2x-FLI', 'ETH 2x Flexible Leverage Index');
|
|
90
|
+
exports.sETH2 = new sdk_core_1.Token(chains_1.SupportedChainId.MAINNET, '0xFe2e637202056d30016725477c5da089Ab0A043A', 18, 'sETH2', 'StakeWise Staked ETH2');
|
|
91
|
+
exports.rETH2 = new sdk_core_1.Token(chains_1.SupportedChainId.MAINNET, '0x20BC832ca081b91433ff6c17f85701B6e92486c5', 18, 'rETH2', 'StakeWise Reward ETH2');
|
|
92
|
+
exports.SWISE = new sdk_core_1.Token(chains_1.SupportedChainId.MAINNET, '0x48C3399719B582dD63eB5AADf12A40B4C3f52FA2', 18, 'SWISE', 'StakeWise');
|
|
93
|
+
exports.WETH_POLYGON_MUMBAI = new sdk_core_1.Token(chains_1.SupportedChainId.POLYGON_MUMBAI, '0xa6fa4fb5f76172d178d61b04b0ecd319c5d1c0aa', 18, 'WETH', 'Wrapped Ether');
|
|
94
|
+
exports.WETH_POLYGON = new sdk_core_1.Token(chains_1.SupportedChainId.POLYGON, '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619', 18, 'WETH', 'Wrapped Ether');
|
|
95
|
+
exports.CELO_CELO = new sdk_core_1.Token(chains_1.SupportedChainId.CELO, '0x471EcE3750Da237f93B8E339c536989b8978a438', 18, 'CELO', 'Celo');
|
|
96
|
+
exports.CUSD_CELO = new sdk_core_1.Token(chains_1.SupportedChainId.CELO, '0x765DE816845861e75A25fCA122bb6898B8B1282a', 18, 'cUSD', 'Celo Dollar');
|
|
97
|
+
exports.CEUR_CELO = new sdk_core_1.Token(chains_1.SupportedChainId.CELO, '0xD8763CBa276a3738E6DE85b4b3bF5FDed6D6cA73', 18, 'cEUR', 'Celo Euro Stablecoin');
|
|
98
|
+
exports.PORTAL_ETH_CELO = new sdk_core_1.Token(chains_1.SupportedChainId.CELO, '0x66803FB87aBd4aaC3cbB3fAd7C3aa01f6F3FB207', 18, 'ETH', 'Portal Ether');
|
|
99
|
+
exports.CMC02_CELO = new sdk_core_1.Token(chains_1.SupportedChainId.CELO, '0x32A9FE697a32135BFd313a6Ac28792DaE4D9979d', 18, 'cMCO2', 'Celo Moss Carbon Credit');
|
|
100
|
+
exports.CELO_CELO_ALFAJORES = new sdk_core_1.Token(chains_1.SupportedChainId.CELO_ALFAJORES, '0xF194afDf50B03e69Bd7D057c1Aa9e10c9954E4C9', 18, 'CELO', 'Celo');
|
|
101
|
+
exports.CUSD_CELO_ALFAJORES = new sdk_core_1.Token(chains_1.SupportedChainId.CELO_ALFAJORES, '0x874069Fa1Eb16D44d622F2e0Ca25eeA172369bC1', 18, 'CUSD', 'Celo Dollar');
|
|
102
|
+
exports.CEUR_CELO_ALFAJORES = new sdk_core_1.Token(chains_1.SupportedChainId.CELO_ALFAJORES, '0x10c892A6EC43a53E45D0B916B4b7D383B1b78C0F', 18, 'CEUR', 'Celo Euro Stablecoin');
|
|
103
|
+
exports.USDT_BNB_CHAIN = new sdk_core_1.Token(chains_1.SupportedChainId.BNB, '0x55d398326f99059fF775485246999027B3197955', 18, 'USDT', 'USDT');
|
|
104
|
+
exports.ETH_BNB_CHAIN = new sdk_core_1.Token(chains_1.SupportedChainId.BNB, '0x2170Ed0880ac9A755fd29B2688956BD959F933F8', 18, 'ETH', 'Ethereum');
|
|
105
|
+
exports.MATIC_BNB_CHAIN = new sdk_core_1.Token(chains_1.SupportedChainId.BNB, '0xCC42724C6683B7E57334c4E856f4c9965ED682bD', 18, 'MATIC', 'Matic');
|
|
106
|
+
exports.FRAX_BNB_CHAIN = new sdk_core_1.Token(chains_1.SupportedChainId.BNB, '0x90C97F71E18723b0Cf0dfa30ee176Ab653E89F40', 18, 'FRAX', 'FRAX');
|
|
107
|
+
exports.BTC_BNB_CHAIN = new sdk_core_1.Token(chains_1.SupportedChainId.BNB, '0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c', 18, 'BTCB', 'BTCB');
|
|
108
|
+
exports.CAKE_BNB_CHAIN = new sdk_core_1.Token(chains_1.SupportedChainId.BNB, '0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82', 18, 'CAKE', 'Cake');
|
|
109
|
+
exports.BUSD_BNB_CHAIN = new sdk_core_1.Token(chains_1.SupportedChainId.BNB, '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', 18, 'BUSD', 'BUSD');
|
|
110
|
+
exports.DAI_BNB_CHAIN = new sdk_core_1.Token(chains_1.SupportedChainId.BNB, '0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3', 18, 'DAI', 'DAI');
|
|
111
|
+
exports.DAI_BASE = new sdk_core_1.Token(chains_1.SupportedChainId.BASE, '0x50c5725949a6f0c72e6c4a641f24049a917db0cb', 18, 'DAI', 'Dai Stablecoin');
|
|
112
|
+
function isBnbChain(chainId) {
|
|
113
|
+
return chainId === chains_1.SupportedChainId.BNB;
|
|
114
|
+
}
|
|
115
|
+
var BnbChainNativeCurrency = /** @class */ (function (_super) {
|
|
116
|
+
__extends(BnbChainNativeCurrency, _super);
|
|
117
|
+
function BnbChainNativeCurrency(chainId) {
|
|
118
|
+
if (!isBnbChain(chainId))
|
|
119
|
+
throw new Error('Not BNB Chain');
|
|
120
|
+
return _super.call(this, chainId, 18, 'BNB', 'BNB') || this;
|
|
121
|
+
}
|
|
122
|
+
BnbChainNativeCurrency.prototype.equals = function (other) {
|
|
123
|
+
return other.isNative && other.chainId === this.chainId;
|
|
124
|
+
};
|
|
125
|
+
Object.defineProperty(BnbChainNativeCurrency.prototype, "wrapped", {
|
|
126
|
+
get: function () {
|
|
127
|
+
if (!isBnbChain(this.chainId))
|
|
128
|
+
throw new Error('Not BNB Chain');
|
|
129
|
+
var wrapped = exports.WRAPPED_NATIVE_CURRENCY[this.chainId];
|
|
130
|
+
(0, tiny_invariant_1.default)(wrapped instanceof sdk_core_1.Token);
|
|
131
|
+
return wrapped;
|
|
132
|
+
},
|
|
133
|
+
enumerable: false,
|
|
134
|
+
configurable: true
|
|
135
|
+
});
|
|
136
|
+
return BnbChainNativeCurrency;
|
|
137
|
+
}(sdk_core_1.NativeCurrency));
|
|
138
|
+
exports.UNI = (_b = {},
|
|
139
|
+
_b[chains_1.SupportedChainId.MAINNET] = new sdk_core_1.Token(chains_1.SupportedChainId.MAINNET, addresses_1.UNI_ADDRESS[1], 18, 'UNI', 'Uniswap'),
|
|
140
|
+
_b[chains_1.SupportedChainId.RINKEBY] = new sdk_core_1.Token(chains_1.SupportedChainId.RINKEBY, addresses_1.UNI_ADDRESS[4], 18, 'UNI', 'Uniswap'),
|
|
141
|
+
_b[chains_1.SupportedChainId.ROPSTEN] = new sdk_core_1.Token(chains_1.SupportedChainId.ROPSTEN, addresses_1.UNI_ADDRESS[3], 18, 'UNI', 'Uniswap'),
|
|
142
|
+
_b[chains_1.SupportedChainId.GOERLI] = new sdk_core_1.Token(chains_1.SupportedChainId.GOERLI, addresses_1.UNI_ADDRESS[5], 18, 'UNI', 'Uniswap'),
|
|
143
|
+
_b[chains_1.SupportedChainId.KOVAN] = new sdk_core_1.Token(chains_1.SupportedChainId.KOVAN, addresses_1.UNI_ADDRESS[42], 18, 'UNI', 'Uniswap'),
|
|
144
|
+
_b);
|
|
145
|
+
exports.WRAPPED_NATIVE_CURRENCY = __assign(__assign({}, sdk_core_1.WETH9), (_c = {}, _c[chains_1.SupportedChainId.CELO] = exports.CELO_CELO, _c[chains_1.SupportedChainId.CELO_ALFAJORES] = exports.CELO_CELO_ALFAJORES, _c[chains_1.SupportedChainId.OPTIMISM] = new sdk_core_1.Token(chains_1.SupportedChainId.OPTIMISM, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'), _c[chains_1.SupportedChainId.OPTIMISM_GOERLI] = new sdk_core_1.Token(chains_1.SupportedChainId.OPTIMISM_GOERLI, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'), _c[chains_1.SupportedChainId.ARBITRUM_ONE] = new sdk_core_1.Token(chains_1.SupportedChainId.ARBITRUM_ONE, '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', 18, 'WETH', 'Wrapped Ether'), _c[chains_1.SupportedChainId.ARBITRUM_RINKEBY] = new sdk_core_1.Token(chains_1.SupportedChainId.ARBITRUM_RINKEBY, '0xB47e6A5f8b33b3F17603C83a0535A9dcD7E32681', 18, 'WETH', 'Wrapped Ether'), _c[chains_1.SupportedChainId.POLYGON] = new sdk_core_1.Token(chains_1.SupportedChainId.POLYGON, '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', 18, 'WMATIC', 'Wrapped MATIC'), _c[chains_1.SupportedChainId.POLYGON_MUMBAI] = new sdk_core_1.Token(chains_1.SupportedChainId.POLYGON_MUMBAI, '0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889', 18, 'WMATIC', 'Wrapped MATIC'), _c[chains_1.SupportedChainId.BNB] = new sdk_core_1.Token(chains_1.SupportedChainId.BNB, '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', 18, 'WBNB', 'Wrapped BNB'), _c[chains_1.SupportedChainId.BASE] = new sdk_core_1.Token(chains_1.SupportedChainId.BASE, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'), _c));
|
|
146
|
+
function isCelo(chainId) {
|
|
147
|
+
return chainId === chains_1.SupportedChainId.CELO_ALFAJORES || chainId === chains_1.SupportedChainId.CELO;
|
|
148
|
+
}
|
|
149
|
+
exports.isCelo = isCelo;
|
|
150
|
+
function getCeloNativeCurrency(chainId) {
|
|
151
|
+
switch (chainId) {
|
|
152
|
+
case chains_1.SupportedChainId.CELO_ALFAJORES:
|
|
153
|
+
return exports.CELO_CELO_ALFAJORES;
|
|
154
|
+
case chains_1.SupportedChainId.CELO:
|
|
155
|
+
return exports.CELO_CELO;
|
|
156
|
+
default:
|
|
157
|
+
throw new Error('Not celo');
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function isMatic(chainId) {
|
|
161
|
+
return chainId === chains_1.SupportedChainId.POLYGON_MUMBAI || chainId === chains_1.SupportedChainId.POLYGON;
|
|
162
|
+
}
|
|
163
|
+
var MaticNativeCurrency = /** @class */ (function (_super) {
|
|
164
|
+
__extends(MaticNativeCurrency, _super);
|
|
165
|
+
function MaticNativeCurrency(chainId) {
|
|
166
|
+
if (!isMatic(chainId))
|
|
167
|
+
throw new Error('Not matic');
|
|
168
|
+
return _super.call(this, chainId, 18, 'MATIC', 'Polygon Matic') || this;
|
|
169
|
+
}
|
|
170
|
+
MaticNativeCurrency.prototype.equals = function (other) {
|
|
171
|
+
return other.isNative && other.chainId === this.chainId;
|
|
172
|
+
};
|
|
173
|
+
Object.defineProperty(MaticNativeCurrency.prototype, "wrapped", {
|
|
174
|
+
get: function () {
|
|
175
|
+
if (!isMatic(this.chainId))
|
|
176
|
+
throw new Error('Not matic');
|
|
177
|
+
var wrapped = exports.WRAPPED_NATIVE_CURRENCY[this.chainId];
|
|
178
|
+
(0, tiny_invariant_1.default)(wrapped instanceof sdk_core_1.Token);
|
|
179
|
+
return wrapped;
|
|
180
|
+
},
|
|
181
|
+
enumerable: false,
|
|
182
|
+
configurable: true
|
|
183
|
+
});
|
|
184
|
+
return MaticNativeCurrency;
|
|
185
|
+
}(sdk_core_1.NativeCurrency));
|
|
186
|
+
var ExtendedEther = /** @class */ (function (_super) {
|
|
187
|
+
__extends(ExtendedEther, _super);
|
|
188
|
+
function ExtendedEther() {
|
|
189
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
190
|
+
}
|
|
191
|
+
Object.defineProperty(ExtendedEther.prototype, "wrapped", {
|
|
192
|
+
get: function () {
|
|
193
|
+
var wrapped = exports.WRAPPED_NATIVE_CURRENCY[this.chainId];
|
|
194
|
+
if (wrapped)
|
|
195
|
+
return wrapped;
|
|
196
|
+
throw new Error('Unsupported chain ID');
|
|
197
|
+
},
|
|
198
|
+
enumerable: false,
|
|
199
|
+
configurable: true
|
|
200
|
+
});
|
|
201
|
+
ExtendedEther.onChain = function (chainId) {
|
|
202
|
+
var _a;
|
|
203
|
+
return (_a = this._cachedExtendedEther[chainId]) !== null && _a !== void 0 ? _a : (this._cachedExtendedEther[chainId] = new ExtendedEther(chainId));
|
|
204
|
+
};
|
|
205
|
+
ExtendedEther._cachedExtendedEther = {};
|
|
206
|
+
return ExtendedEther;
|
|
207
|
+
}(sdk_core_1.Ether));
|
|
208
|
+
exports.ExtendedEther = ExtendedEther;
|
|
209
|
+
var cachedNativeCurrency = {};
|
|
210
|
+
function nativeOnChain(chainId) {
|
|
211
|
+
if (cachedNativeCurrency[chainId])
|
|
212
|
+
return cachedNativeCurrency[chainId];
|
|
213
|
+
var nativeCurrency;
|
|
214
|
+
if (isMatic(chainId)) {
|
|
215
|
+
nativeCurrency = new MaticNativeCurrency(chainId);
|
|
216
|
+
}
|
|
217
|
+
else if (isCelo(chainId)) {
|
|
218
|
+
nativeCurrency = getCeloNativeCurrency(chainId);
|
|
219
|
+
}
|
|
220
|
+
else if (isBnbChain(chainId)) {
|
|
221
|
+
nativeCurrency = new BnbChainNativeCurrency(chainId);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
nativeCurrency = ExtendedEther.onChain(chainId);
|
|
225
|
+
}
|
|
226
|
+
return (cachedNativeCurrency[chainId] = nativeCurrency);
|
|
227
|
+
}
|
|
228
|
+
exports.nativeOnChain = nativeOnChain;
|
|
229
|
+
exports.TOKEN_SHORTHANDS = {
|
|
230
|
+
USDC: (_d = {},
|
|
231
|
+
_d[chains_1.SupportedChainId.MAINNET] = exports.USDC_MAINNET.address,
|
|
232
|
+
_d[chains_1.SupportedChainId.ARBITRUM_ONE] = exports.USDC_ARBITRUM.address,
|
|
233
|
+
_d[chains_1.SupportedChainId.OPTIMISM] = exports.USDC_OPTIMISM.address,
|
|
234
|
+
_d[chains_1.SupportedChainId.ARBITRUM_RINKEBY] = exports.USDC_ARBITRUM_RINKEBY.address,
|
|
235
|
+
_d[chains_1.SupportedChainId.OPTIMISM_GOERLI] = USDC_OPTIMISM_GOERLI.address,
|
|
236
|
+
_d[chains_1.SupportedChainId.POLYGON] = exports.USDC_POLYGON.address,
|
|
237
|
+
_d[chains_1.SupportedChainId.POLYGON_MUMBAI] = exports.USDC_POLYGON_MUMBAI.address,
|
|
238
|
+
_d[chains_1.SupportedChainId.GOERLI] = exports.USDC_GOERLI.address,
|
|
239
|
+
_d[chains_1.SupportedChainId.RINKEBY] = exports.USDC_RINKEBY.address,
|
|
240
|
+
_d[chains_1.SupportedChainId.KOVAN] = exports.USDC_KOVAN.address,
|
|
241
|
+
_d[chains_1.SupportedChainId.ROPSTEN] = exports.USDC_ROPSTEN.address,
|
|
242
|
+
_d[chains_1.SupportedChainId.CELO] = exports.PORTAL_USDC_CELO.address,
|
|
243
|
+
_d[chains_1.SupportedChainId.CELO_ALFAJORES] = exports.USDC_CELO_ALFAJORES.address,
|
|
244
|
+
_d[chains_1.SupportedChainId.BASE] = exports.USDC_BASE.address,
|
|
245
|
+
_d),
|
|
246
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.constructSameAddressMap = void 0;
|
|
4
|
+
var chains_1 = require("../chains");
|
|
5
|
+
var DEFAULT_NETWORKS = [
|
|
6
|
+
chains_1.SupportedChainId.MAINNET,
|
|
7
|
+
chains_1.SupportedChainId.ROPSTEN,
|
|
8
|
+
chains_1.SupportedChainId.RINKEBY,
|
|
9
|
+
chains_1.SupportedChainId.GOERLI,
|
|
10
|
+
chains_1.SupportedChainId.KOVAN,
|
|
11
|
+
];
|
|
12
|
+
function constructSameAddressMap(address, additionalNetworks) {
|
|
13
|
+
if (additionalNetworks === void 0) { additionalNetworks = []; }
|
|
14
|
+
return DEFAULT_NETWORKS.concat(additionalNetworks).reduce(function (memo, chainId) {
|
|
15
|
+
memo[chainId] = address;
|
|
16
|
+
return memo;
|
|
17
|
+
}, {});
|
|
18
|
+
}
|
|
19
|
+
exports.constructSameAddressMap = constructSameAddressMap;
|
package/lib/index.d.ts
CHANGED
|
@@ -36,3 +36,5 @@ export declare const V2_INIT_CODE_HASH_MAINNET = "0x96e8ac4277198ff8b6f785478aa9
|
|
|
36
36
|
export declare const ROUTER_REWARDS_DISTRIBUTOR = "0x0000000000000000000000000000000000000000";
|
|
37
37
|
export declare const LOOKSRARE_REWARDS_DISTRIBUTOR = "0x0554f068365eD43dcC98dcd7Fd7A8208a5638C72";
|
|
38
38
|
export declare const LOOKSRARE_TOKEN = "0xf4d2888d29D722226FafA5d9B24F9164c092421E";
|
|
39
|
+
/** Returns the default transaction TTL for the chain, in minutes. */
|
|
40
|
+
export declare function getDefaultTransactionTtl(chainId: any): number;
|
package/lib/index.js
CHANGED
|
@@ -57,18 +57,18 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
|
-
exports.LOOKSRARE_TOKEN = exports.LOOKSRARE_REWARDS_DISTRIBUTOR = exports.ROUTER_REWARDS_DISTRIBUTOR = exports.V2_INIT_CODE_HASH_MAINNET = exports.V3_INIT_CODE_HASH_MAINNET = exports.V3_FACTORY_MAINNET = exports.V2_FACTORY_MAINNET = exports.NFTX_ERC_1155_VAULT_ID = exports.NFTX_ERC_1155_VAULT = exports.NFTX_MILADY_VAULT_ID = exports.NFTX_MILADY_VAULT = exports.NFTX_COVEN_VAULT_ID = exports.NFTX_COVEN_VAULT = exports.CRYPTOPUNKS_MARKET_ADDRESS = exports.ENS_NFT_ADDRESS = exports.CAMEO_ADDRESS = exports.MENTAL_WORLDS_ADDRESS = exports.ALPHABETTIES_ADDRESS = exports.MILADY_ADDRESS = exports.TWERKY_ADDRESS = exports.TOWNSTAR_ADDRESS = exports.DECENTRA_DRAGON_ADDRESS = exports.COVEN_ADDRESS = exports.OPENSEA_CONDUIT_KEY = exports.OPENSEA_CONDUIT = exports.SOURCE_ROUTER = exports.SOURCE_MSG_SENDER = exports.ADDRESS_THIS = exports.MSG_SENDER = exports.ONE_PERCENT_BIPS = exports.ZERO_ADDRESS = exports.ETH_ADDRESS = exports.ALICE_ADDRESS = exports.ALREADY_PAID = exports.CONTRACT_BALANCE = exports.DEADLINE = exports.MAX_UINT160 = exports.MAX_UINT = void 0;
|
|
60
|
+
exports.getDefaultTransactionTtl = exports.LOOKSRARE_TOKEN = exports.LOOKSRARE_REWARDS_DISTRIBUTOR = exports.ROUTER_REWARDS_DISTRIBUTOR = exports.V2_INIT_CODE_HASH_MAINNET = exports.V3_INIT_CODE_HASH_MAINNET = exports.V3_FACTORY_MAINNET = exports.V2_FACTORY_MAINNET = exports.NFTX_ERC_1155_VAULT_ID = exports.NFTX_ERC_1155_VAULT = exports.NFTX_MILADY_VAULT_ID = exports.NFTX_MILADY_VAULT = exports.NFTX_COVEN_VAULT_ID = exports.NFTX_COVEN_VAULT = exports.CRYPTOPUNKS_MARKET_ADDRESS = exports.ENS_NFT_ADDRESS = exports.CAMEO_ADDRESS = exports.MENTAL_WORLDS_ADDRESS = exports.ALPHABETTIES_ADDRESS = exports.MILADY_ADDRESS = exports.TWERKY_ADDRESS = exports.TOWNSTAR_ADDRESS = exports.DECENTRA_DRAGON_ADDRESS = exports.COVEN_ADDRESS = exports.OPENSEA_CONDUIT_KEY = exports.OPENSEA_CONDUIT = exports.SOURCE_ROUTER = exports.SOURCE_MSG_SENDER = exports.ADDRESS_THIS = exports.MSG_SENDER = exports.ONE_PERCENT_BIPS = exports.ZERO_ADDRESS = exports.ETH_ADDRESS = exports.ALICE_ADDRESS = exports.ALREADY_PAID = exports.CONTRACT_BALANCE = exports.DEADLINE = exports.MAX_UINT160 = exports.MAX_UINT = void 0;
|
|
61
61
|
var TAG = " | Uniswap | ";
|
|
62
62
|
var uuid = require('uuidv4').uuid;
|
|
63
63
|
var log = require('@pioneer-platform/loggerdog')();
|
|
64
64
|
var _a = require("@pioneer-platform/pioneer-caip"), caipToNetworkId = _a.caipToNetworkId, shortListSymbolToCaip = _a.shortListSymbolToCaip, ChainToNetworkId = _a.ChainToNetworkId;
|
|
65
65
|
var _b = require('@pioneer-platform/pioneer-coins'), createMemo = _b.createMemo, parseMemo = _b.parseMemo;
|
|
66
66
|
var _c = require('@uniswap/v2-sdk'), Pair = _c.Pair, WETH = _c.WETH, Route = _c.Route, Trade = _c.Trade, TokenAmount = _c.TokenAmount; // Import necessary components from v2-sdk
|
|
67
|
+
var constants_1 = require("./constants");
|
|
67
68
|
// import JSBI from 'jsbi'
|
|
68
69
|
// import { ethers } from 'ethers'
|
|
69
70
|
var sdk_core_1 = require("@uniswap/sdk-core");
|
|
70
71
|
var v3_sdk_1 = require("@uniswap/v3-sdk");
|
|
71
|
-
var router_sdk_1 = require("@uniswap/router-sdk");
|
|
72
72
|
var universal_router_sdk_1 = require("@uniswap/universal-router-sdk");
|
|
73
73
|
var _d = require('ethers'), ethers = _d.ethers, BigNumber = _d.BigNumber;
|
|
74
74
|
var PERMIT2_BASE = '0x000000000022D473030F116dDEE9F6B43aC78BA3';
|
|
@@ -80,8 +80,8 @@ var networkSupport = [
|
|
|
80
80
|
ChainToNetworkId["ETH"],
|
|
81
81
|
ChainToNetworkId["BASE"],
|
|
82
82
|
];
|
|
83
|
-
var
|
|
84
|
-
var protocols = [
|
|
83
|
+
var router_sdk_1 = require("@uniswap/router-sdk");
|
|
84
|
+
var protocols = [router_sdk_1.Protocol.V2, router_sdk_1.Protocol.V3, router_sdk_1.Protocol.MIXED];
|
|
85
85
|
module.exports = {
|
|
86
86
|
init: function (settings) {
|
|
87
87
|
return true;
|
|
@@ -147,7 +147,7 @@ var ETH_UNIVERSIAL_ROUTER = {
|
|
|
147
147
|
};
|
|
148
148
|
var BASE_CONTRACTS = {
|
|
149
149
|
Permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
150
|
-
UniversalRouter: "
|
|
150
|
+
UniversalRouter: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
|
|
151
151
|
V3CoreFactory: "0x33128a8fC17869897dcE68Ed026d694621f6FDfD",
|
|
152
152
|
Multicall: "0x091e99cb1C49331a94dD62755D168E941AbD0693",
|
|
153
153
|
ProxyAdmin: "0x3334d83e224aF5ef9C2E7DDA7c7C98Efd9621fA9",
|
|
@@ -171,6 +171,7 @@ var EIP155_MAINNET_CHAINS = {
|
|
|
171
171
|
permit2: universal_router_sdk_1.PERMIT2_ADDRESS,
|
|
172
172
|
universalRouter: universal_router_sdk_1.UNIVERSAL_ROUTER_ADDRESS,
|
|
173
173
|
rpc: 'https://eth.llamarpc.com',
|
|
174
|
+
defaultGasLimit: 250000,
|
|
174
175
|
namespace: 'eip155'
|
|
175
176
|
},
|
|
176
177
|
// 'eip155:43114': {
|
|
@@ -214,6 +215,7 @@ var EIP155_MAINNET_CHAINS = {
|
|
|
214
215
|
permit2: BASE_CONTRACTS.Permit2,
|
|
215
216
|
universalRouter: BASE_CONTRACTS.UniversalRouter,
|
|
216
217
|
rpc: 'https://mainnet.base.org',
|
|
218
|
+
defaultGasLimit: 135120,
|
|
217
219
|
namespace: 'eip155'
|
|
218
220
|
}
|
|
219
221
|
};
|
|
@@ -311,57 +313,76 @@ var getRoute = function (_a) {
|
|
|
311
313
|
var isZero = function isZero(hexNumberString) {
|
|
312
314
|
return hexNumberString === '0' || /^0x0*$/.test(hexNumberString);
|
|
313
315
|
};
|
|
316
|
+
/** Returns the default transaction TTL for the chain, in minutes. */
|
|
317
|
+
function getDefaultTransactionTtl(chainId) {
|
|
318
|
+
if (chainId && constants_1.L2_CHAIN_IDS.includes(chainId))
|
|
319
|
+
return constants_1.L2_DEADLINE_FROM_NOW / 60;
|
|
320
|
+
return constants_1.DEFAULT_DEADLINE_FROM_NOW / 60;
|
|
321
|
+
}
|
|
322
|
+
exports.getDefaultTransactionTtl = getDefaultTransactionTtl;
|
|
314
323
|
var buildTx = function (_a) {
|
|
315
324
|
var trade = _a.trade, from = _a.from, chainId = _a.chainId, provider = _a.provider;
|
|
316
325
|
return __awaiter(this, void 0, void 0, function () {
|
|
317
|
-
var BIPS_BASE, slippageTolerance,
|
|
318
|
-
return __generator(this, function (
|
|
319
|
-
switch (
|
|
326
|
+
var tag, BIPS_BASE, slippageTolerance, responseRouter, data, value, nonce, gas, estimatedGas, e_2, gasPrice, adjustedGasPrice, tx, e_3;
|
|
327
|
+
return __generator(this, function (_b) {
|
|
328
|
+
switch (_b.label) {
|
|
320
329
|
case 0:
|
|
321
|
-
|
|
330
|
+
tag = TAG + " | buildTx | ";
|
|
331
|
+
_b.label = 1;
|
|
332
|
+
case 1:
|
|
333
|
+
_b.trys.push([1, 8, , 9]);
|
|
322
334
|
BIPS_BASE = BigNumber.from(10000);
|
|
323
335
|
slippageTolerance = new sdk_core_1.Percent(BigNumber.from(200), BIPS_BASE);
|
|
324
|
-
|
|
336
|
+
log.info(tag, "slippageTolerance: ", slippageTolerance);
|
|
337
|
+
//buildTx
|
|
338
|
+
log.info(tag, "trade: ", trade.tradeType);
|
|
339
|
+
log.info(tag, "swaps: ", trade.swaps[0]);
|
|
340
|
+
log.info(tag, "routes: ", trade.routes[0]);
|
|
341
|
+
responseRouter = universal_router_sdk_1.SwapRouter.swapERC20CallParameters(trade, {
|
|
342
|
+
recipient: from,
|
|
325
343
|
slippageTolerance: slippageTolerance,
|
|
326
|
-
|
|
327
|
-
// deadlineOrPreviousBlockhash: options.deadline?.toString(),
|
|
344
|
+
deadlineOrPreviousBlockhash: getDefaultTransactionTtl(chainId),
|
|
328
345
|
// inputTokenPermit: options.permit,
|
|
329
346
|
// fee: options.feeOptions,
|
|
330
|
-
})
|
|
347
|
+
});
|
|
348
|
+
log.info(tag, "responseRouter: ", responseRouter);
|
|
349
|
+
data = responseRouter.calldata;
|
|
350
|
+
value = responseRouter.value;
|
|
331
351
|
return [4 /*yield*/, provider.getTransactionCount(from, "latest")];
|
|
332
|
-
case 1:
|
|
333
|
-
nonce = _c.sent();
|
|
334
|
-
gas = "0x".concat(BigInt("135120").toString(16));
|
|
335
|
-
_c.label = 2;
|
|
336
352
|
case 2:
|
|
337
|
-
|
|
353
|
+
nonce = _b.sent();
|
|
354
|
+
gas = "0x".concat(BigInt("135120").toString(16));
|
|
355
|
+
_b.label = 3;
|
|
356
|
+
case 3:
|
|
357
|
+
_b.trys.push([3, 5, , 6]);
|
|
338
358
|
return [4 /*yield*/, provider.estimateGas({
|
|
339
359
|
from: from,
|
|
340
|
-
to:
|
|
360
|
+
to: EIP155_MAINNET_CHAINS['eip155:' + chainId].universalRouter, // Uniswap Router address
|
|
341
361
|
data: data,
|
|
342
362
|
value: ethers.utils.parseEther("0"), // Value for token swaps
|
|
343
363
|
})];
|
|
344
|
-
case
|
|
345
|
-
estimatedGas =
|
|
364
|
+
case 4:
|
|
365
|
+
estimatedGas = _b.sent();
|
|
346
366
|
console.log("estimatedGas: ", estimatedGas);
|
|
347
367
|
gas = "0x".concat(estimatedGas.toString(16));
|
|
348
|
-
return [3 /*break*/,
|
|
349
|
-
case
|
|
350
|
-
e_2 =
|
|
368
|
+
return [3 /*break*/, 6];
|
|
369
|
+
case 5:
|
|
370
|
+
e_2 = _b.sent();
|
|
371
|
+
console.error("Error in estimateGas: ", e_2);
|
|
351
372
|
//@TODO get custom gas limit defaults per chain
|
|
352
373
|
gas = "0x".concat(BigInt("135120").toString(16));
|
|
353
|
-
return [3 /*break*/,
|
|
354
|
-
case
|
|
355
|
-
case
|
|
356
|
-
gasPrice =
|
|
374
|
+
return [3 /*break*/, 6];
|
|
375
|
+
case 6: return [4 /*yield*/, provider.getGasPrice()];
|
|
376
|
+
case 7:
|
|
377
|
+
gasPrice = _b.sent();
|
|
357
378
|
adjustedGasPrice = gasPrice.mul(ethers.BigNumber.from(110)).div(ethers.BigNumber.from(100));
|
|
358
379
|
tx = __assign(__assign({ from: from, to: EIP155_MAINNET_CHAINS['eip155:' + chainId].universalRouter, chainId: chainId, data: data }, (value && !isZero(value) ? { value: (0, v3_sdk_1.toHex)(value) } : {})), { gas: gas, gasPrice: (0, v3_sdk_1.toHex)(adjustedGasPrice), nonce: (0, v3_sdk_1.toHex)(nonce) });
|
|
359
380
|
return [2 /*return*/, tx];
|
|
360
|
-
case
|
|
361
|
-
e_3 =
|
|
381
|
+
case 8:
|
|
382
|
+
e_3 = _b.sent();
|
|
362
383
|
console.error(e_3);
|
|
363
|
-
return [3 /*break*/,
|
|
364
|
-
case
|
|
384
|
+
return [3 /*break*/, 9];
|
|
385
|
+
case 9: return [2 /*return*/];
|
|
365
386
|
}
|
|
366
387
|
});
|
|
367
388
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pioneer-platform/uniswap-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"dependencies": {
|
|
@@ -8,14 +8,18 @@
|
|
|
8
8
|
"@pioneer-platform/maya-network": "^8.3.7",
|
|
9
9
|
"@pioneer-platform/pioneer-caip": "^9.2.23",
|
|
10
10
|
"@pioneer-platform/pioneer-coins": "^9.2.13",
|
|
11
|
+
"@types/ms.macro": "^2.0.2",
|
|
12
|
+
"@uniswap/router-sdk": "1.6.0",
|
|
11
13
|
"@uniswap/sdk": "^3.0.3",
|
|
12
14
|
"@uniswap/sdk-core": "^4.0.7",
|
|
13
15
|
"@uniswap/smart-order-router": "^3.16.25",
|
|
16
|
+
"@uniswap/universal-router-sdk": "^1.5.7",
|
|
14
17
|
"@uniswap/token-lists": "^1.0.0-beta.34",
|
|
15
18
|
"@uniswap/v2-sdk": "^3.2.1",
|
|
16
19
|
"@uniswap/v3-sdk": "^3.10.0",
|
|
17
20
|
"axios": "^1.3.4",
|
|
18
21
|
"dotenv": "^8.2.0",
|
|
22
|
+
"ms.macro": "^2.0.0",
|
|
19
23
|
"rango-sdk": "^0.1.45",
|
|
20
24
|
"uuidv4": "^6.2.13"
|
|
21
25
|
},
|
|
@@ -32,6 +36,7 @@
|
|
|
32
36
|
"@types/jest": "^25.2.3",
|
|
33
37
|
"@types/node": "^13.13.21",
|
|
34
38
|
"@types/source-map-support": "^0.5.3",
|
|
39
|
+
"babel-plugin-macros": "^3.1.0",
|
|
35
40
|
"jest": "^26.4.2",
|
|
36
41
|
"onchange": "^7.0.2",
|
|
37
42
|
"serve": "^11.3.2",
|