@pioneer-platform/uniswap-client 0.0.21 → 0.0.24
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/chainInfo.d.ts +19 -22
- package/lib/constants/chainInfo.js +134 -117
- package/lib/constants/chains.d.ts +36 -47
- package/lib/constants/chains.js +118 -83
- package/lib/constants/chains.test.js +22 -25
- package/lib/constants/governance.d.ts +8 -0
- package/lib/constants/governance.js +24 -0
- package/lib/constants/lists.d.ts +12 -0
- package/lib/constants/lists.js +64 -0
- package/lib/constants/localCurrencies.d.ts +6 -0
- package/lib/constants/localCurrencies.js +94 -0
- package/lib/constants/localCurrencyIcons.d.ts +18 -0
- package/lib/constants/localCurrencyIcons.js +298 -0
- package/lib/constants/locales.d.ts +1 -1
- package/lib/constants/locales.js +0 -3
- package/lib/constants/misc.d.ts +2 -7
- package/lib/constants/misc.js +17 -23
- package/lib/constants/networks.d.ts +21 -0
- package/lib/constants/networks.js +170 -0
- package/lib/constants/proposals/index.d.ts +5 -0
- package/lib/constants/proposals/index.js +8 -0
- package/lib/constants/proposals/polygon_proposal_title.d.ts +1 -0
- package/lib/constants/proposals/polygon_proposal_title.js +4 -0
- package/lib/constants/proposals/uniswap_grants_proposal_description.d.ts +1 -0
- package/lib/constants/proposals/uniswap_grants_proposal_description.js +4 -0
- package/lib/constants/providers.d.ts +19 -0
- package/lib/constants/providers.js +33 -0
- package/lib/constants/routing.d.ts +9 -13
- package/lib/constants/routing.js +91 -55
- package/lib/constants/routing.test.d.ts +1 -0
- package/lib/constants/routing.test.js +32 -0
- package/lib/constants/supportArticles.d.ts +13 -0
- package/lib/constants/supportArticles.js +17 -0
- package/lib/constants/tokenLists/broken.tokenlist.json +22 -0
- package/lib/constants/tokenLogoLookup.d.ts +8 -0
- package/lib/constants/tokenLogoLookup.js +48 -0
- package/lib/constants/tokenSafety.js +129 -0
- package/lib/constants/tokenSafetyLookup.d.ts +18 -0
- package/lib/constants/tokenSafetyLookup.js +66 -0
- package/lib/constants/tokenSaftey.test.d.ts +1 -0
- package/lib/constants/tokenSaftey.test.js +31 -0
- package/lib/constants/tokens.d.ts +34 -42
- package/lib/constants/tokens.js +190 -147
- package/lib/index.d.ts +1 -40
- package/lib/index.js +150 -570
- package/lib/routing/clientSideSmartOrderRouter.d.ts +5 -0
- package/lib/routing/clientSideSmartOrderRouter.js +136 -0
- package/lib/routing/gas.d.ts +5 -0
- package/lib/routing/gas.js +158 -0
- package/lib/routing/types.d.ts +393 -0
- package/lib/routing/types.js +424 -0
- package/lib/routing/utils.d.ts +28 -0
- package/lib/routing/utils.js +319 -0
- package/lib/rpc/AppJsonRpcProvider.d.ts +44 -0
- package/lib/rpc/AppJsonRpcProvider.js +183 -0
- package/lib/rpc/ConfiguredJsonRpcProvider.d.ts +8 -0
- package/lib/rpc/ConfiguredJsonRpcProvider.js +35 -0
- package/lib/utils/contracts/getContract.d.ts +3 -0
- package/lib/utils/contracts/getContract.js +29 -0
- package/lib/utils/transformSwapRouteToGetQuoteResult.d.ts +4 -0
- package/lib/utils/transformSwapRouteToGetQuoteResult.js +116 -0
- package/lib/utils/uniswapData.d.ts +21 -0
- package/lib/utils/uniswapData.js +217 -0
- package/package.json +12 -8
- package/lib/constants/addresses.d.ts +0 -9
- package/lib/constants/addresses.js +0 -41
- package/lib/constants/eip1193.d.ts +0 -8
- package/lib/constants/eip1193.js +0 -14
- package/lib/constants/index.d.ts +0 -9
- package/lib/constants/index.js +0 -26
- package/lib/constants/jsonRpcEndpoints.d.ts +0 -12
- package/lib/constants/jsonRpcEndpoints.js +0 -101
- package/lib/constants/utils/constructSameAddressMap.d.ts +0 -4
- package/lib/constants/utils/constructSameAddressMap.js +0 -19
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformSwapRouteToGetQuoteResult = void 0;
|
|
4
|
+
var router_sdk_1 = require("@uniswap/router-sdk");
|
|
5
|
+
var sdk_core_1 = require("@uniswap/sdk-core");
|
|
6
|
+
// This file is lazy-loaded, so the import of smart-order-router is intentional.
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
8
|
+
var smart_order_router_1 = require("@uniswap/smart-order-router");
|
|
9
|
+
var v3_sdk_1 = require("@uniswap/v3-sdk");
|
|
10
|
+
var types_1 = require("../routing/types");
|
|
11
|
+
// from routing-api (https://github.com/Uniswap/routing-api/blob/main/lib/handlers/quote/quote.ts#L243-L311)
|
|
12
|
+
function transformSwapRouteToGetQuoteResult(tradeType, amount, _a) {
|
|
13
|
+
var quote = _a.quote, quoteGasAdjusted = _a.quoteGasAdjusted, route = _a.route, estimatedGasUsed = _a.estimatedGasUsed, estimatedGasUsedQuoteToken = _a.estimatedGasUsedQuoteToken, estimatedGasUsedUSD = _a.estimatedGasUsedUSD, gasPriceWei = _a.gasPriceWei, methodParameters = _a.methodParameters, blockNumber = _a.blockNumber;
|
|
14
|
+
var routeResponse = [];
|
|
15
|
+
for (var _i = 0, route_1 = route; _i < route_1.length; _i++) {
|
|
16
|
+
var subRoute = route_1[_i];
|
|
17
|
+
var amount_1 = subRoute.amount, quote_1 = subRoute.quote, tokenPath = subRoute.tokenPath;
|
|
18
|
+
var pools = subRoute.protocol === router_sdk_1.Protocol.V2 ? subRoute.route.pairs : subRoute.route.pools;
|
|
19
|
+
var curRoute = [];
|
|
20
|
+
for (var i = 0; i < pools.length; i++) {
|
|
21
|
+
var nextPool = pools[i];
|
|
22
|
+
var tokenIn = tokenPath[i];
|
|
23
|
+
var tokenOut = tokenPath[i + 1];
|
|
24
|
+
var edgeAmountIn = undefined;
|
|
25
|
+
if (i === 0) {
|
|
26
|
+
edgeAmountIn = tradeType === sdk_core_1.TradeType.EXACT_INPUT ? amount_1.quotient.toString() : quote_1.quotient.toString();
|
|
27
|
+
}
|
|
28
|
+
var edgeAmountOut = undefined;
|
|
29
|
+
if (i === pools.length - 1) {
|
|
30
|
+
edgeAmountOut = tradeType === sdk_core_1.TradeType.EXACT_INPUT ? quote_1.quotient.toString() : amount_1.quotient.toString();
|
|
31
|
+
}
|
|
32
|
+
if (nextPool instanceof v3_sdk_1.Pool) {
|
|
33
|
+
curRoute.push({
|
|
34
|
+
type: 'v3-pool',
|
|
35
|
+
tokenIn: {
|
|
36
|
+
chainId: tokenIn.chainId,
|
|
37
|
+
decimals: tokenIn.decimals,
|
|
38
|
+
address: tokenIn.address,
|
|
39
|
+
symbol: tokenIn.symbol,
|
|
40
|
+
},
|
|
41
|
+
tokenOut: {
|
|
42
|
+
chainId: tokenOut.chainId,
|
|
43
|
+
decimals: tokenOut.decimals,
|
|
44
|
+
address: tokenOut.address,
|
|
45
|
+
symbol: tokenOut.symbol,
|
|
46
|
+
},
|
|
47
|
+
fee: nextPool.fee.toString(),
|
|
48
|
+
liquidity: nextPool.liquidity.toString(),
|
|
49
|
+
sqrtRatioX96: nextPool.sqrtRatioX96.toString(),
|
|
50
|
+
tickCurrent: nextPool.tickCurrent.toString(),
|
|
51
|
+
amountIn: edgeAmountIn,
|
|
52
|
+
amountOut: edgeAmountOut,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
var reserve0 = nextPool.reserve0;
|
|
57
|
+
var reserve1 = nextPool.reserve1;
|
|
58
|
+
curRoute.push({
|
|
59
|
+
type: 'v2-pool',
|
|
60
|
+
tokenIn: {
|
|
61
|
+
chainId: tokenIn.chainId,
|
|
62
|
+
decimals: tokenIn.decimals,
|
|
63
|
+
address: tokenIn.address,
|
|
64
|
+
symbol: tokenIn.symbol,
|
|
65
|
+
},
|
|
66
|
+
tokenOut: {
|
|
67
|
+
chainId: tokenOut.chainId,
|
|
68
|
+
decimals: tokenOut.decimals,
|
|
69
|
+
address: tokenOut.address,
|
|
70
|
+
symbol: tokenOut.symbol,
|
|
71
|
+
},
|
|
72
|
+
reserve0: {
|
|
73
|
+
token: {
|
|
74
|
+
chainId: reserve0.currency.wrapped.chainId,
|
|
75
|
+
decimals: reserve0.currency.wrapped.decimals,
|
|
76
|
+
address: reserve0.currency.wrapped.address,
|
|
77
|
+
symbol: reserve0.currency.wrapped.symbol,
|
|
78
|
+
},
|
|
79
|
+
quotient: reserve0.quotient.toString(),
|
|
80
|
+
},
|
|
81
|
+
reserve1: {
|
|
82
|
+
token: {
|
|
83
|
+
chainId: reserve1.currency.wrapped.chainId,
|
|
84
|
+
decimals: reserve1.currency.wrapped.decimals,
|
|
85
|
+
address: reserve1.currency.wrapped.address,
|
|
86
|
+
symbol: reserve1.currency.wrapped.symbol,
|
|
87
|
+
},
|
|
88
|
+
quotient: reserve1.quotient.toString(),
|
|
89
|
+
},
|
|
90
|
+
amountIn: edgeAmountIn,
|
|
91
|
+
amountOut: edgeAmountOut,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
routeResponse.push(curRoute);
|
|
96
|
+
}
|
|
97
|
+
var result = {
|
|
98
|
+
methodParameters: methodParameters,
|
|
99
|
+
blockNumber: blockNumber.toString(),
|
|
100
|
+
amount: amount.quotient.toString(),
|
|
101
|
+
amountDecimals: amount.toExact(),
|
|
102
|
+
quote: quote.quotient.toString(),
|
|
103
|
+
quoteDecimals: quote.toExact(),
|
|
104
|
+
quoteGasAdjusted: quoteGasAdjusted.quotient.toString(),
|
|
105
|
+
quoteGasAdjustedDecimals: quoteGasAdjusted.toExact(),
|
|
106
|
+
gasUseEstimateQuote: estimatedGasUsedQuoteToken.quotient.toString(),
|
|
107
|
+
gasUseEstimateQuoteDecimals: estimatedGasUsedQuoteToken.toExact(),
|
|
108
|
+
gasUseEstimate: estimatedGasUsed.toString(),
|
|
109
|
+
gasUseEstimateUSD: estimatedGasUsedUSD.toExact(),
|
|
110
|
+
gasPriceWei: gasPriceWei.toString(),
|
|
111
|
+
route: routeResponse,
|
|
112
|
+
routeString: (0, smart_order_router_1.routeAmountsToString)(route),
|
|
113
|
+
};
|
|
114
|
+
return { state: types_1.QuoteState.SUCCESS, data: { routing: types_1.URAQuoteType.CLASSIC, quote: result, allQuotes: [] } };
|
|
115
|
+
}
|
|
116
|
+
exports.transformSwapRouteToGetQuoteResult = transformSwapRouteToGetQuoteResult;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { MixedRouteTrade, Trade as RouterTrade } from '@uniswap/router-sdk';
|
|
2
|
+
import { Trade as V2Trade, Pair } from '@uniswap/v2-sdk';
|
|
3
|
+
import { Trade as V3Trade, Pool, FeeAmount } from '@uniswap/v3-sdk';
|
|
4
|
+
import { TradeType, Ether, Token, Currency } from '@uniswap/sdk-core';
|
|
5
|
+
export declare const ETHER: Ether;
|
|
6
|
+
export declare const WETH: Token;
|
|
7
|
+
export declare const DAI: Token;
|
|
8
|
+
export declare const USDC: Token;
|
|
9
|
+
export declare const FEE_AMOUNT = FeeAmount.MEDIUM;
|
|
10
|
+
type UniswapPools = {
|
|
11
|
+
WETH_USDC_V2: Pair;
|
|
12
|
+
USDC_DAI_V2: Pair;
|
|
13
|
+
WETH_USDC_V3: Pool;
|
|
14
|
+
WETH_USDC_V3_LOW_FEE: Pool;
|
|
15
|
+
USDC_DAI_V3: Pool;
|
|
16
|
+
};
|
|
17
|
+
export declare function getUniswapPools(forkBlock?: number): Promise<UniswapPools>;
|
|
18
|
+
export declare function getPair(tokenA: Token, tokenB: Token, blockNumber: number): Promise<Pair>;
|
|
19
|
+
export declare function getPool(tokenA: Token, tokenB: Token, feeAmount: FeeAmount, blockNumber: number): Promise<Pool>;
|
|
20
|
+
export declare function buildTrade(trades: (V2Trade<Currency, Currency, TradeType> | V3Trade<Currency, Currency, TradeType> | MixedRouteTrade<Currency, Currency, TradeType>)[]): RouterTrade<Currency, Currency, TradeType>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.buildTrade = exports.getPool = exports.getPair = exports.getUniswapPools = exports.FEE_AMOUNT = exports.USDC = exports.DAI = exports.WETH = exports.ETHER = void 0;
|
|
43
|
+
var jsbi_1 = __importDefault(require("jsbi"));
|
|
44
|
+
var ethers_1 = require("ethers");
|
|
45
|
+
var router_sdk_1 = require("@uniswap/router-sdk");
|
|
46
|
+
var v2_sdk_1 = require("@uniswap/v2-sdk");
|
|
47
|
+
var v3_sdk_1 = require("@uniswap/v3-sdk");
|
|
48
|
+
// import { SwapOptions } from '../../src'
|
|
49
|
+
var sdk_core_1 = require("@uniswap/sdk-core");
|
|
50
|
+
var UniswapV3Pool_json_1 = __importDefault(require("@uniswap/v3-core/artifacts/contracts/UniswapV3Pool.sol/UniswapV3Pool.json"));
|
|
51
|
+
// import { TEST_RECIPIENT_ADDRESS } from './addresses'
|
|
52
|
+
var V2_FACTORY = '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f';
|
|
53
|
+
var V2_ABI = [
|
|
54
|
+
{
|
|
55
|
+
constant: true,
|
|
56
|
+
inputs: [],
|
|
57
|
+
name: 'getReserves',
|
|
58
|
+
outputs: [
|
|
59
|
+
{
|
|
60
|
+
internalType: 'uint112',
|
|
61
|
+
name: 'reserve0',
|
|
62
|
+
type: 'uint112',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
internalType: 'uint112',
|
|
66
|
+
name: 'reserve1',
|
|
67
|
+
type: 'uint112',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
internalType: 'uint32',
|
|
71
|
+
name: 'blockTimestampLast',
|
|
72
|
+
type: 'uint32',
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
payable: false,
|
|
76
|
+
stateMutability: 'view',
|
|
77
|
+
type: 'function',
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
var FORK_BLOCK = 16075500;
|
|
81
|
+
exports.ETHER = sdk_core_1.Ether.onChain(1);
|
|
82
|
+
exports.WETH = new sdk_core_1.Token(1, '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', 18, 'WETH', 'Wrapped Ether');
|
|
83
|
+
exports.DAI = new sdk_core_1.Token(1, '0x6B175474E89094C44Da98b954EedeAC495271d0F', 18, 'DAI', 'dai');
|
|
84
|
+
exports.USDC = new sdk_core_1.Token(1, '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', 6, 'USDC', 'USD Coin');
|
|
85
|
+
exports.FEE_AMOUNT = v3_sdk_1.FeeAmount.MEDIUM;
|
|
86
|
+
function getUniswapPools(forkBlock) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
88
|
+
var fork, WETH_USDC_V2, USDC_DAI_V2, WETH_USDC_V3, WETH_USDC_V3_LOW_FEE, USDC_DAI_V3;
|
|
89
|
+
return __generator(this, function (_a) {
|
|
90
|
+
switch (_a.label) {
|
|
91
|
+
case 0:
|
|
92
|
+
fork = forkBlock !== null && forkBlock !== void 0 ? forkBlock : FORK_BLOCK;
|
|
93
|
+
return [4 /*yield*/, getPair(exports.WETH, exports.USDC, fork)];
|
|
94
|
+
case 1:
|
|
95
|
+
WETH_USDC_V2 = _a.sent();
|
|
96
|
+
return [4 /*yield*/, getPair(exports.USDC, exports.DAI, fork)];
|
|
97
|
+
case 2:
|
|
98
|
+
USDC_DAI_V2 = _a.sent();
|
|
99
|
+
return [4 /*yield*/, getPool(exports.WETH, exports.USDC, exports.FEE_AMOUNT, fork)];
|
|
100
|
+
case 3:
|
|
101
|
+
WETH_USDC_V3 = _a.sent();
|
|
102
|
+
return [4 /*yield*/, getPool(exports.WETH, exports.USDC, v3_sdk_1.FeeAmount.LOW, fork)];
|
|
103
|
+
case 4:
|
|
104
|
+
WETH_USDC_V3_LOW_FEE = _a.sent();
|
|
105
|
+
return [4 /*yield*/, getPool(exports.USDC, exports.DAI, v3_sdk_1.FeeAmount.LOW, fork)];
|
|
106
|
+
case 5:
|
|
107
|
+
USDC_DAI_V3 = _a.sent();
|
|
108
|
+
return [2 /*return*/, {
|
|
109
|
+
WETH_USDC_V2: WETH_USDC_V2,
|
|
110
|
+
USDC_DAI_V2: USDC_DAI_V2,
|
|
111
|
+
WETH_USDC_V3: WETH_USDC_V3,
|
|
112
|
+
WETH_USDC_V3_LOW_FEE: WETH_USDC_V3_LOW_FEE,
|
|
113
|
+
USDC_DAI_V3: USDC_DAI_V3,
|
|
114
|
+
}];
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
exports.getUniswapPools = getUniswapPools;
|
|
120
|
+
function getProvider() {
|
|
121
|
+
return new ethers_1.ethers.providers.JsonRpcProvider(process.env['FORK_URL']);
|
|
122
|
+
}
|
|
123
|
+
function getPair(tokenA, tokenB, blockNumber) {
|
|
124
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
125
|
+
var pairAddress, contract, _a, reserve0, reserve1, _b, token0, token1;
|
|
126
|
+
return __generator(this, function (_c) {
|
|
127
|
+
switch (_c.label) {
|
|
128
|
+
case 0:
|
|
129
|
+
pairAddress = (0, v2_sdk_1.computePairAddress)({ factoryAddress: V2_FACTORY, tokenA: tokenA, tokenB: tokenB });
|
|
130
|
+
contract = new ethers_1.ethers.Contract(pairAddress, V2_ABI, getProvider());
|
|
131
|
+
return [4 /*yield*/, contract.getReserves({ blockTag: blockNumber })];
|
|
132
|
+
case 1:
|
|
133
|
+
_a = _c.sent(), reserve0 = _a.reserve0, reserve1 = _a.reserve1;
|
|
134
|
+
_b = tokenA.sortsBefore(tokenB) ? [tokenA, tokenB] : [tokenB, tokenA] // does safety checks
|
|
135
|
+
, token0 = _b[0], token1 = _b[1];
|
|
136
|
+
return [2 /*return*/, new v2_sdk_1.Pair(sdk_core_1.CurrencyAmount.fromRawAmount(token0, reserve0), sdk_core_1.CurrencyAmount.fromRawAmount(token1, reserve1))];
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
exports.getPair = getPair;
|
|
142
|
+
function getPool(tokenA, tokenB, feeAmount, blockNumber) {
|
|
143
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
144
|
+
var _a, token0, token1, poolAddress, contract, liquidity, _b, sqrtPriceX96, tick;
|
|
145
|
+
return __generator(this, function (_c) {
|
|
146
|
+
switch (_c.label) {
|
|
147
|
+
case 0:
|
|
148
|
+
_a = tokenA.sortsBefore(tokenB) ? [tokenA, tokenB] : [tokenB, tokenA] // does safety checks
|
|
149
|
+
, token0 = _a[0], token1 = _a[1];
|
|
150
|
+
poolAddress = v3_sdk_1.Pool.getAddress(token0, token1, feeAmount);
|
|
151
|
+
contract = new ethers_1.ethers.Contract(poolAddress, UniswapV3Pool_json_1.default.abi, getProvider());
|
|
152
|
+
return [4 /*yield*/, contract.liquidity({ blockTag: blockNumber })];
|
|
153
|
+
case 1:
|
|
154
|
+
liquidity = _c.sent();
|
|
155
|
+
return [4 /*yield*/, contract.slot0({ blockTag: blockNumber })];
|
|
156
|
+
case 2:
|
|
157
|
+
_b = _c.sent(), sqrtPriceX96 = _b.sqrtPriceX96, tick = _b.tick;
|
|
158
|
+
liquidity = jsbi_1.default.BigInt(liquidity.toString());
|
|
159
|
+
sqrtPriceX96 = jsbi_1.default.BigInt(sqrtPriceX96.toString());
|
|
160
|
+
return [2 /*return*/, new v3_sdk_1.Pool(token0, token1, feeAmount, sqrtPriceX96, liquidity, tick, [
|
|
161
|
+
{
|
|
162
|
+
index: (0, v3_sdk_1.nearestUsableTick)(v3_sdk_1.TickMath.MIN_TICK, v3_sdk_1.TICK_SPACINGS[feeAmount]),
|
|
163
|
+
liquidityNet: liquidity,
|
|
164
|
+
liquidityGross: liquidity,
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
index: (0, v3_sdk_1.nearestUsableTick)(v3_sdk_1.TickMath.MAX_TICK, v3_sdk_1.TICK_SPACINGS[feeAmount]),
|
|
168
|
+
liquidityNet: jsbi_1.default.multiply(liquidity, jsbi_1.default.BigInt('-1')),
|
|
169
|
+
liquidityGross: liquidity,
|
|
170
|
+
},
|
|
171
|
+
])];
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
exports.getPool = getPool;
|
|
177
|
+
// use some sane defaults
|
|
178
|
+
// export function swapOptions(options: Partial<SwapOptions>): SwapOptions {
|
|
179
|
+
// // If theres a fee this counts as "slippage" for the amount out, so take it into account
|
|
180
|
+
// let slippageTolerance = new Percent(5, 100)
|
|
181
|
+
// if (!!options.fee) slippageTolerance = slippageTolerance.add(options.fee.fee)
|
|
182
|
+
// return Object.assign(
|
|
183
|
+
// {
|
|
184
|
+
// slippageTolerance,
|
|
185
|
+
// recipient: TEST_RECIPIENT_ADDRESS,
|
|
186
|
+
// },
|
|
187
|
+
// options
|
|
188
|
+
// )
|
|
189
|
+
// }
|
|
190
|
+
// alternative constructor to create from protocol-specific sdks
|
|
191
|
+
function buildTrade(trades) {
|
|
192
|
+
return new router_sdk_1.Trade({
|
|
193
|
+
v2Routes: trades
|
|
194
|
+
.filter(function (trade) { return trade instanceof v2_sdk_1.Trade; })
|
|
195
|
+
.map(function (trade) { return ({
|
|
196
|
+
routev2: trade.route,
|
|
197
|
+
inputAmount: trade.inputAmount,
|
|
198
|
+
outputAmount: trade.outputAmount,
|
|
199
|
+
}); }),
|
|
200
|
+
v3Routes: trades
|
|
201
|
+
.filter(function (trade) { return trade instanceof v3_sdk_1.Trade; })
|
|
202
|
+
.map(function (trade) { return ({
|
|
203
|
+
routev3: trade.route,
|
|
204
|
+
inputAmount: trade.inputAmount,
|
|
205
|
+
outputAmount: trade.outputAmount,
|
|
206
|
+
}); }),
|
|
207
|
+
mixedRoutes: trades
|
|
208
|
+
.filter(function (trade) { return trade instanceof router_sdk_1.MixedRouteTrade; })
|
|
209
|
+
.map(function (trade) { return ({
|
|
210
|
+
mixedRoute: trade.route,
|
|
211
|
+
inputAmount: trade.inputAmount,
|
|
212
|
+
outputAmount: trade.outputAmount,
|
|
213
|
+
}); }),
|
|
214
|
+
tradeType: trades[0].tradeType,
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
exports.buildTrade = buildTrade;
|
package/package.json
CHANGED
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pioneer-platform/uniswap-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"types": "./lib/index.d.ts",
|
|
6
6
|
"dependencies": {
|
|
7
|
+
"@keepkey/keepkey-sdk": "^0.2.57",
|
|
7
8
|
"@pioneer-platform/loggerdog": "^8.3.1",
|
|
8
9
|
"@pioneer-platform/maya-network": "^8.3.7",
|
|
9
10
|
"@pioneer-platform/pioneer-caip": "^9.2.23",
|
|
10
11
|
"@pioneer-platform/pioneer-coins": "^9.2.13",
|
|
12
|
+
"@types/ms": "^0.7.34",
|
|
11
13
|
"@types/ms.macro": "^2.0.2",
|
|
12
|
-
"@uniswap/router-sdk": "1.
|
|
14
|
+
"@uniswap/router-sdk": "1.9.0",
|
|
13
15
|
"@uniswap/sdk": "^3.0.3",
|
|
14
|
-
"@uniswap/sdk-core": "
|
|
15
|
-
"@uniswap/smart-order-router": "
|
|
16
|
-
"@uniswap/universal-router-sdk": "^1.5.7",
|
|
16
|
+
"@uniswap/sdk-core": "4.2.0",
|
|
17
|
+
"@uniswap/smart-order-router": "3.26.0",
|
|
17
18
|
"@uniswap/token-lists": "^1.0.0-beta.34",
|
|
18
|
-
"@uniswap/
|
|
19
|
-
"@uniswap/
|
|
19
|
+
"@uniswap/uniswapx-sdk": "^2.0.1-alpha.10",
|
|
20
|
+
"@uniswap/universal-router-sdk": "1.8.2",
|
|
21
|
+
"@uniswap/v2-sdk": "4.3.0",
|
|
22
|
+
"@uniswap/v3-sdk": "3.11.0",
|
|
20
23
|
"axios": "^1.3.4",
|
|
24
|
+
"dayjs": "^1.11.10",
|
|
21
25
|
"dotenv": "^8.2.0",
|
|
26
|
+
"ms": "^2.1.3",
|
|
22
27
|
"ms.macro": "^2.0.0",
|
|
23
|
-
"rango-sdk": "^0.1.45",
|
|
24
28
|
"uuidv4": "^6.2.13"
|
|
25
29
|
},
|
|
26
30
|
"scripts": {
|
|
@@ -1,9 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,41 +0,0 @@
|
|
|
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);
|
package/lib/constants/eip1193.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
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 = {}));
|
package/lib/constants/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
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';
|
package/lib/constants/index.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
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);
|
|
@@ -1,12 +0,0 @@
|
|
|
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[]>;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.JSON_RPC_FALLBACK_ENDPOINTS = void 0;
|
|
5
|
-
var chains_1 = require("./chains");
|
|
6
|
-
/**
|
|
7
|
-
* Fallback JSON RPC endpoints.
|
|
8
|
-
* These are used if the integrator does not provide an endpoint, or if the endpoint does not work.
|
|
9
|
-
*
|
|
10
|
-
* MetaMask allows switching to any URL, but displays a warning if it is not on the "Safe" list:
|
|
11
|
-
* https://github.com/MetaMask/metamask-mobile/blob/bdb7f37c90e4fc923881a07fca38d4e77c73a579/app/core/RPCMethods/wallet_addEthereumChain.js#L228-L235
|
|
12
|
-
* https://chainid.network/chains.json
|
|
13
|
-
*
|
|
14
|
-
* These "Safe" URLs are listed first, followed by other fallback URLs, which are taken from chainlist.org.
|
|
15
|
-
*/
|
|
16
|
-
exports.JSON_RPC_FALLBACK_ENDPOINTS = (_a = {},
|
|
17
|
-
_a[chains_1.SupportedChainId.MAINNET] = [
|
|
18
|
-
// "Safe" URLs
|
|
19
|
-
'https://cloudflare-eth.com',
|
|
20
|
-
// "Fallback" URLs
|
|
21
|
-
'https://rpc.ankr.com/eth',
|
|
22
|
-
'https://eth-mainnet.public.blastapi.io',
|
|
23
|
-
],
|
|
24
|
-
_a[chains_1.SupportedChainId.ROPSTEN] = [
|
|
25
|
-
// "Fallback" URLs
|
|
26
|
-
'https://rpc.ankr.com/eth_ropsten',
|
|
27
|
-
],
|
|
28
|
-
_a[chains_1.SupportedChainId.RINKEBY] = [
|
|
29
|
-
// "Fallback" URLs
|
|
30
|
-
'https://rinkeby-light.eth.linkpool.io/',
|
|
31
|
-
],
|
|
32
|
-
_a[chains_1.SupportedChainId.GOERLI] = [
|
|
33
|
-
// "Safe" URLs
|
|
34
|
-
'https://rpc.goerli.mudit.blog/',
|
|
35
|
-
// "Fallback" URLs
|
|
36
|
-
'https://rpc.ankr.com/eth_goerli',
|
|
37
|
-
],
|
|
38
|
-
_a[chains_1.SupportedChainId.KOVAN] = [
|
|
39
|
-
// "Fallback" URLs
|
|
40
|
-
'https://eth-kovan.public.blastapi.io',
|
|
41
|
-
],
|
|
42
|
-
_a[chains_1.SupportedChainId.POLYGON] = [
|
|
43
|
-
// "Safe" URLs
|
|
44
|
-
'https://polygon-rpc.com/',
|
|
45
|
-
],
|
|
46
|
-
_a[chains_1.SupportedChainId.POLYGON_MUMBAI] = [
|
|
47
|
-
// "Safe" URLs
|
|
48
|
-
'https://matic-mumbai.chainstacklabs.com',
|
|
49
|
-
'https://rpc-mumbai.maticvigil.com',
|
|
50
|
-
'https://matic-testnet-archive-rpc.bwarelabs.com',
|
|
51
|
-
],
|
|
52
|
-
_a[chains_1.SupportedChainId.ARBITRUM_ONE] = [
|
|
53
|
-
// "Safe" URLs
|
|
54
|
-
'https://arb1.arbitrum.io/rpc',
|
|
55
|
-
// "Fallback" URLs
|
|
56
|
-
'https://arbitrum.public-rpc.com',
|
|
57
|
-
],
|
|
58
|
-
_a[chains_1.SupportedChainId.ARBITRUM_RINKEBY] = [
|
|
59
|
-
// "Safe" URLs
|
|
60
|
-
'https://rinkeby.arbitrum.io/rpc',
|
|
61
|
-
],
|
|
62
|
-
_a[chains_1.SupportedChainId.OPTIMISM] = [
|
|
63
|
-
// "Safe" URLs
|
|
64
|
-
'https://mainnet.optimism.io/',
|
|
65
|
-
// "Fallback" URLs
|
|
66
|
-
'https://rpc.ankr.com/optimism',
|
|
67
|
-
],
|
|
68
|
-
_a[chains_1.SupportedChainId.OPTIMISM_GOERLI] = [
|
|
69
|
-
// "Safe" URLs
|
|
70
|
-
'https://goerli.optimism.io',
|
|
71
|
-
],
|
|
72
|
-
_a[chains_1.SupportedChainId.CELO] = [
|
|
73
|
-
// "Safe" URLs
|
|
74
|
-
'https://forno.celo.org',
|
|
75
|
-
],
|
|
76
|
-
_a[chains_1.SupportedChainId.CELO_ALFAJORES] = [
|
|
77
|
-
// "Safe" URLs
|
|
78
|
-
'https://alfajores-forno.celo-testnet.org',
|
|
79
|
-
],
|
|
80
|
-
_a[chains_1.SupportedChainId.BNB] = [
|
|
81
|
-
// "Safe" URLs
|
|
82
|
-
'https://endpoints.omniatech.io/v1/bsc/mainnet/public',
|
|
83
|
-
'https://bsc-mainnet.gateway.pokt.network/v1/lb/6136201a7bad1500343e248d',
|
|
84
|
-
'https://1rpc.io/bnb',
|
|
85
|
-
'https://bsc-dataseed3.binance.org',
|
|
86
|
-
'https://bsc-dataseed2.defibit.io',
|
|
87
|
-
'https://bsc-dataseed1.ninicoin.io',
|
|
88
|
-
'https://binance.nodereal.io',
|
|
89
|
-
'https://bsc-dataseed4.defibit.io',
|
|
90
|
-
'https://rpc.ankr.com/bsc',
|
|
91
|
-
],
|
|
92
|
-
_a[chains_1.SupportedChainId.BASE] = [
|
|
93
|
-
// "Safe" URLs
|
|
94
|
-
'https://mainnet.base.org',
|
|
95
|
-
'https://base.gateway.tenderly.co',
|
|
96
|
-
'https://base.publicnode.com',
|
|
97
|
-
// "Fallback" URLs
|
|
98
|
-
'https://1rpc.io/base',
|
|
99
|
-
'https://base.meowrpc.com',
|
|
100
|
-
],
|
|
101
|
-
_a);
|
|
@@ -1,19 +0,0 @@
|
|
|
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;
|