@curvefi/api 1.9.1 → 1.13.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/lib/constants/abis/abis-ethereum.d.ts +1 -1
- package/lib/constants/abis/abis-ethereum.js +118 -3
- package/lib/constants/abis/abis-polygon.d.ts +4 -0
- package/lib/constants/abis/abis-polygon.js +146 -0
- package/lib/constants/abis/json/atricrypto3/swap.json +1269 -0
- package/lib/constants/abis/json/atricrypto3/zap.json +239 -0
- package/lib/constants/abis/json/crveth/swap.json +1258 -0
- package/lib/constants/abis/json/eurt/swap.json +845 -0
- package/lib/constants/abis/json/eurtusd/deposit.json +257 -0
- package/lib/constants/abis/json/eurtusd/swap.json +1199 -0
- package/lib/constants/abis/json/paave/rewards.json +657 -0
- package/lib/constants/abis/json/ren-polygon/swap.json +1112 -0
- package/lib/constants/aliases.d.ts +16 -0
- package/lib/constants/aliases.js +19 -0
- package/lib/constants/coins-ethereum.d.ts +31 -0
- package/lib/constants/{coins.js → coins-ethereum.js} +51 -15
- package/lib/constants/coins-polygon.d.ts +31 -0
- package/lib/constants/coins-polygon.js +74 -0
- package/lib/curve.d.ts +23 -7
- package/lib/curve.js +122 -91
- package/lib/index.d.ts +2 -1
- package/lib/index.js +3 -0
- package/lib/interfaces.d.ts +2 -0
- package/lib/pools.d.ts +2 -0
- package/lib/pools.js +264 -114
- package/lib/utils.js +9 -12
- package/package.json +6 -5
- package/lib/constants/coins.d.ts +0 -25
package/lib/curve.js
CHANGED
|
@@ -59,9 +59,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
59
59
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
60
60
|
};
|
|
61
61
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
-
exports.curve = exports.ALIASES = void 0;
|
|
62
|
+
exports.curve = exports.ALIASES = exports.DECIMALS_LOWER_CASE = exports.DECIMALS = exports.COINS = exports.USD_COINS_LOWER_CASE = exports.USD_COINS = exports.EUR_COINS_LOWER_CASE = exports.EUR_COINS = exports.LINK_COINS_LOWER_CASE = exports.LINK_COINS = exports.ETH_COINS_LOWER_CASE = exports.ETH_COINS = exports.BTC_COINS_LOWER_CASE = exports.BTC_COINS = exports.GAUGES = exports.LP_TOKENS = exports.POOLS_DATA = void 0;
|
|
63
63
|
var ethers_1 = require("ethers");
|
|
64
|
-
var
|
|
64
|
+
var ethcall_1 = require("ethcall");
|
|
65
65
|
var ERC20_json_1 = __importDefault(require("./constants/abis/json/ERC20.json"));
|
|
66
66
|
var cERC20_json_1 = __importDefault(require("./constants/abis/json/cERC20.json"));
|
|
67
67
|
var yERC20_json_1 = __importDefault(require("./constants/abis/json/yERC20.json"));
|
|
@@ -72,47 +72,18 @@ var gaugecontroller_json_1 = __importDefault(require("./constants/abis/json/gaug
|
|
|
72
72
|
var router_json_1 = __importDefault(require("./constants/abis/json/router.json"));
|
|
73
73
|
var registry_exchange_json_1 = __importDefault(require("./constants/abis/json/registry_exchange.json"));
|
|
74
74
|
var abis_ethereum_1 = require("./constants/abis/abis-ethereum");
|
|
75
|
+
var abis_polygon_1 = require("./constants/abis/abis-polygon");
|
|
76
|
+
var coins_ethereum_1 = require("./constants/coins-ethereum");
|
|
77
|
+
var coins_polygon_1 = require("./constants/coins-polygon");
|
|
78
|
+
var aliases_1 = require("./constants/aliases");
|
|
75
79
|
exports.ALIASES = {
|
|
76
80
|
"crv": "0xD533a949740bb3306d119CC777fa900bA034cd52",
|
|
77
|
-
"pool_proxy": "0xeCb456EA5365865EbAb8a2661B0c503410e9B347",
|
|
78
|
-
"gauge_proxy": "0x519AFB566c05E00cfB9af73496D00217A630e4D5",
|
|
79
81
|
"voting_escrow": "0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2",
|
|
80
82
|
"gauge_controller": "0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB",
|
|
81
|
-
"minter": "0xd061D61a4d941c39E5453435B6345Dc261C2fcE0",
|
|
82
|
-
"fee_distributor": "0xA464e6DCda8AC41e03616F95f4BC98a13b8922Dc",
|
|
83
83
|
"address_provider": "0x0000000022d53366457f9d5e68ec105046fc4383",
|
|
84
84
|
"router": "0xfA9a30350048B2BF66865ee20363067c66f67e58",
|
|
85
85
|
"registry_exchange": "",
|
|
86
86
|
};
|
|
87
|
-
var cTokens = [
|
|
88
|
-
'0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643',
|
|
89
|
-
'0x39AA39c021dfbaE8faC545936693aC917d5E7563',
|
|
90
|
-
"0x8e595470ed749b85c6f7669de83eae304c2ec68f",
|
|
91
|
-
"0x48759f220ed983db51fa7a8c0d2aab8f3ce4166a",
|
|
92
|
-
"0x76eb2fe28b36b3ee97f3adae0c69606eedb2a37c", // cyUSDC
|
|
93
|
-
];
|
|
94
|
-
var yTokens = [
|
|
95
|
-
"0xC2cB1040220768554cf699b0d863A3cd4324ce32",
|
|
96
|
-
"0x26EA744E5B887E5205727f55dFBE8685e3b21951",
|
|
97
|
-
"0xE6354ed5bC4b393a5Aad09f21c46E101e692d447",
|
|
98
|
-
"0x16de59092dAE5CcF4A1E6439D611fd0653f0Bd01",
|
|
99
|
-
"0xd6aD7a6750A7593E092a9B218d66C0A814a3436e",
|
|
100
|
-
"0x83f798e925BcD4017Eb265844FDDAbb448f1707D",
|
|
101
|
-
"0x04bC0Ab673d88aE9dbC9DA2380cB6B79C4BCa9aE",
|
|
102
|
-
"0x73a052500105205d34Daf004eAb301916DA8190f", // yTUSD
|
|
103
|
-
];
|
|
104
|
-
var ycTokens = [
|
|
105
|
-
"0x99d1Fa417f94dcD62BfE781a1213c092a47041Bc",
|
|
106
|
-
"0x9777d7E2b60bB01759D0E2f8be2095df444cb07E",
|
|
107
|
-
"0x1bE5d71F2dA660BFdee8012dDc58D024448A0A59", // ycUSDT
|
|
108
|
-
];
|
|
109
|
-
var aTokens = [
|
|
110
|
-
"0x028171bCA77440897B824Ca71D1c56caC55b68A3",
|
|
111
|
-
"0xBcca60bB61934080951369a648Fb03DF4F96263C",
|
|
112
|
-
"0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811",
|
|
113
|
-
"0x6c5024cd4f8a59110119c56f8933403a539555eb", // sSUSD
|
|
114
|
-
];
|
|
115
|
-
var customAbiTokens = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], cTokens, true), yTokens, true), ycTokens, true), aTokens, true);
|
|
116
87
|
var Curve = /** @class */ (function () {
|
|
117
88
|
function Curve() {
|
|
118
89
|
// @ts-ignore
|
|
@@ -120,6 +91,7 @@ var Curve = /** @class */ (function () {
|
|
|
120
91
|
// @ts-ignore
|
|
121
92
|
this.signer = null;
|
|
122
93
|
this.signerAddress = '';
|
|
94
|
+
this.chainId = 0;
|
|
123
95
|
// @ts-ignore
|
|
124
96
|
this.multicallProvider = null;
|
|
125
97
|
this.contracts = {};
|
|
@@ -131,9 +103,9 @@ var Curve = /** @class */ (function () {
|
|
|
131
103
|
) {
|
|
132
104
|
if (options === void 0) { options = {}; }
|
|
133
105
|
return __awaiter(this, void 0, void 0, function () {
|
|
134
|
-
var _a,
|
|
135
|
-
return __generator(this, function (
|
|
136
|
-
switch (
|
|
106
|
+
var cTokens, yTokens, ycTokens, aTokens, network, _a, customAbiTokens, _b, _i, _c, pool, _d, _e, coinAddr, _f, _g, coinAddr, _h, _j, coinAddr, addressProviderContract, _k;
|
|
107
|
+
return __generator(this, function (_l) {
|
|
108
|
+
switch (_l.label) {
|
|
137
109
|
case 0:
|
|
138
110
|
// JsonRpc provider
|
|
139
111
|
if (providerType.toLowerCase() === 'JsonRpc'.toLowerCase()) {
|
|
@@ -162,180 +134,239 @@ var Curve = /** @class */ (function () {
|
|
|
162
134
|
providerSettings = providerSettings;
|
|
163
135
|
this.provider = new ethers_1.ethers.providers.InfuraProvider(providerSettings.network, providerSettings.apiKey);
|
|
164
136
|
}
|
|
137
|
+
else if (providerType.toLowerCase() === 'Alchemy'.toLowerCase()) {
|
|
138
|
+
providerSettings = providerSettings;
|
|
139
|
+
this.provider = new ethers_1.ethers.providers.AlchemyProvider(providerSettings.network, providerSettings.apiKey);
|
|
140
|
+
}
|
|
165
141
|
else {
|
|
166
142
|
throw Error('Wrong providerType');
|
|
167
143
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
return [
|
|
144
|
+
_a = this.provider.network;
|
|
145
|
+
if (_a) return [3 /*break*/, 2];
|
|
146
|
+
return [4 /*yield*/, this.provider._networkPromise];
|
|
171
147
|
case 1:
|
|
172
|
-
|
|
173
|
-
|
|
148
|
+
_a = (_l.sent());
|
|
149
|
+
_l.label = 2;
|
|
174
150
|
case 2:
|
|
175
|
-
|
|
176
|
-
|
|
151
|
+
network = _a;
|
|
152
|
+
console.log("CURVE-JS IS CONNECTED TO NETWORK:", network);
|
|
153
|
+
this.chainId = network.chainId;
|
|
154
|
+
if (network.chainId === 1 || network.chainId === 1337) {
|
|
155
|
+
cTokens = coins_ethereum_1.cTokensEthereum;
|
|
156
|
+
yTokens = coins_ethereum_1.yTokensEthereum;
|
|
157
|
+
ycTokens = coins_ethereum_1.ycTokensEthereum;
|
|
158
|
+
aTokens = coins_ethereum_1.aTokensEthereum;
|
|
159
|
+
exports.ALIASES = aliases_1.ALIASES_ETHEREUM;
|
|
160
|
+
exports.POOLS_DATA = abis_ethereum_1.POOLS_DATA_ETHEREUM;
|
|
161
|
+
exports.BTC_COINS = coins_ethereum_1.BTC_COINS_ETHEREUM;
|
|
162
|
+
exports.BTC_COINS_LOWER_CASE = coins_ethereum_1.BTC_COINS_LOWER_CASE_ETHEREUM;
|
|
163
|
+
exports.ETH_COINS = coins_ethereum_1.ETH_COINS_ETHEREUM;
|
|
164
|
+
exports.ETH_COINS_LOWER_CASE = coins_ethereum_1.ETH_COINS_LOWER_CASE_ETHEREUM;
|
|
165
|
+
exports.LINK_COINS = coins_ethereum_1.LINK_COINS_ETHEREUM;
|
|
166
|
+
exports.LINK_COINS_LOWER_CASE = coins_ethereum_1.LINK_COINS_LOWER_CASE_ETHEREUM;
|
|
167
|
+
exports.EUR_COINS = coins_ethereum_1.EUR_COINS_ETHEREUM;
|
|
168
|
+
exports.EUR_COINS_LOWER_CASE = coins_ethereum_1.EUR_COINS_LOWER_CASE_ETHEREUM;
|
|
169
|
+
exports.USD_COINS = coins_ethereum_1.USD_COINS_ETHEREUM;
|
|
170
|
+
exports.USD_COINS_LOWER_CASE = coins_ethereum_1.USD_COINS_LOWER_CASE_ETHEREUM;
|
|
171
|
+
exports.COINS = coins_ethereum_1.COINS_ETHEREUM;
|
|
172
|
+
exports.DECIMALS = coins_ethereum_1.DECIMALS_ETHEREUM;
|
|
173
|
+
exports.DECIMALS_LOWER_CASE = coins_ethereum_1.DECIMALS_LOWER_CASE_ETHEREUM;
|
|
174
|
+
}
|
|
175
|
+
else if (network.chainId === 137) {
|
|
176
|
+
cTokens = coins_polygon_1.cTokensPolygon;
|
|
177
|
+
yTokens = coins_polygon_1.yTokensPolygon;
|
|
178
|
+
ycTokens = coins_polygon_1.ycTokensPolygon;
|
|
179
|
+
aTokens = coins_polygon_1.aTokensPolygon;
|
|
180
|
+
exports.ALIASES = aliases_1.ALIASES_POLYGON;
|
|
181
|
+
exports.POOLS_DATA = abis_polygon_1.POOLS_DATA_POLYGON;
|
|
182
|
+
exports.BTC_COINS = coins_polygon_1.BTC_COINS_POLYGON;
|
|
183
|
+
exports.BTC_COINS_LOWER_CASE = coins_polygon_1.BTC_COINS_LOWER_CASE_POLYGON;
|
|
184
|
+
exports.ETH_COINS = coins_polygon_1.ETH_COINS_POLYGON;
|
|
185
|
+
exports.ETH_COINS_LOWER_CASE = coins_polygon_1.ETH_COINS_LOWER_CASE_POLYGON;
|
|
186
|
+
exports.LINK_COINS = coins_polygon_1.LINK_COINS_POLYGON;
|
|
187
|
+
exports.LINK_COINS_LOWER_CASE = coins_polygon_1.LINK_COINS_LOWER_CASE_POLYGON;
|
|
188
|
+
exports.EUR_COINS = coins_polygon_1.EUR_COINS_POLYGON;
|
|
189
|
+
exports.EUR_COINS_LOWER_CASE = coins_polygon_1.EUR_COINS_LOWER_CASE_POLYGON;
|
|
190
|
+
exports.USD_COINS = coins_polygon_1.USD_COINS_POLYGON;
|
|
191
|
+
exports.USD_COINS_LOWER_CASE = coins_polygon_1.USD_COINS_LOWER_CASE_POLYGON;
|
|
192
|
+
exports.COINS = coins_polygon_1.COINS_POLYGON;
|
|
193
|
+
exports.DECIMALS = coins_polygon_1.DECIMALS_POLYGON;
|
|
194
|
+
exports.DECIMALS_LOWER_CASE = coins_polygon_1.DECIMALS_LOWER_CASE_POLYGON;
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
throw Error("Network with chainId ".concat(this.provider.network.chainId, " is not supported"));
|
|
198
|
+
}
|
|
199
|
+
exports.LP_TOKENS = Object.values(exports.POOLS_DATA).map(function (data) { return data.token_address.toLowerCase(); });
|
|
200
|
+
exports.GAUGES = Object.values(exports.POOLS_DATA).map(function (data) { return data.gauge_address.toLowerCase(); });
|
|
201
|
+
customAbiTokens = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], cTokens, true), yTokens, true), ycTokens, true), aTokens, true);
|
|
202
|
+
this.multicallProvider = new ethcall_1.Provider();
|
|
203
|
+
return [4 /*yield*/, this.multicallProvider.init(this.provider)];
|
|
177
204
|
case 3:
|
|
205
|
+
_l.sent();
|
|
178
206
|
if (!this.signer) return [3 /*break*/, 5];
|
|
179
|
-
|
|
207
|
+
_b = this;
|
|
180
208
|
return [4 /*yield*/, this.signer.getAddress()];
|
|
181
209
|
case 4:
|
|
182
|
-
|
|
183
|
-
|
|
210
|
+
_b.signerAddress = _l.sent();
|
|
211
|
+
return [3 /*break*/, 6];
|
|
184
212
|
case 5:
|
|
213
|
+
this.signerAddress = '';
|
|
214
|
+
_l.label = 6;
|
|
215
|
+
case 6:
|
|
185
216
|
this.feeData = { gasPrice: options.gasPrice, maxFeePerGas: options.maxFeePerGas, maxPriorityFeePerGas: options.maxPriorityFeePerGas };
|
|
186
217
|
return [4 /*yield*/, this.updateFeeData()];
|
|
187
|
-
case
|
|
188
|
-
|
|
218
|
+
case 7:
|
|
219
|
+
_l.sent();
|
|
189
220
|
// TODO delete toLowerCase()
|
|
190
|
-
for (_i = 0,
|
|
191
|
-
pool =
|
|
221
|
+
for (_i = 0, _c = Object.values(exports.POOLS_DATA); _i < _c.length; _i++) {
|
|
222
|
+
pool = _c[_i];
|
|
192
223
|
this.contracts[pool.swap_address] = {
|
|
193
224
|
contract: new ethers_1.Contract(pool.swap_address, pool.swap_abi, this.signer || this.provider),
|
|
194
|
-
multicallContract: new
|
|
225
|
+
multicallContract: new ethcall_1.Contract(pool.swap_address, pool.swap_abi),
|
|
195
226
|
};
|
|
196
227
|
this.contracts[pool.swap_address.toLowerCase()] = {
|
|
197
228
|
contract: new ethers_1.Contract(pool.swap_address, pool.swap_abi, this.signer || this.provider),
|
|
198
|
-
multicallContract: new
|
|
229
|
+
multicallContract: new ethcall_1.Contract(pool.swap_address, pool.swap_abi),
|
|
199
230
|
};
|
|
200
231
|
if (pool.token_address !== pool.swap_address) {
|
|
201
232
|
this.contracts[pool.token_address] = {
|
|
202
233
|
contract: new ethers_1.Contract(pool.token_address, ERC20_json_1.default, this.signer || this.provider),
|
|
203
|
-
multicallContract: new
|
|
234
|
+
multicallContract: new ethcall_1.Contract(pool.token_address, ERC20_json_1.default),
|
|
204
235
|
};
|
|
205
236
|
this.contracts[pool.token_address.toLowerCase()] = {
|
|
206
237
|
contract: new ethers_1.Contract(pool.token_address, ERC20_json_1.default, this.signer || this.provider),
|
|
207
|
-
multicallContract: new
|
|
238
|
+
multicallContract: new ethcall_1.Contract(pool.token_address, ERC20_json_1.default),
|
|
208
239
|
};
|
|
209
240
|
}
|
|
210
241
|
this.contracts[pool.gauge_address] = {
|
|
211
242
|
contract: new ethers_1.Contract(pool.gauge_address, gauge_json_1.default, this.signer || this.provider),
|
|
212
|
-
multicallContract: new
|
|
243
|
+
multicallContract: new ethcall_1.Contract(pool.gauge_address, gauge_json_1.default),
|
|
213
244
|
};
|
|
214
245
|
this.contracts[pool.gauge_address.toLowerCase()] = {
|
|
215
246
|
contract: new ethers_1.Contract(pool.gauge_address, gauge_json_1.default, this.signer || this.provider),
|
|
216
|
-
multicallContract: new
|
|
247
|
+
multicallContract: new ethcall_1.Contract(pool.gauge_address, gauge_json_1.default),
|
|
217
248
|
};
|
|
218
249
|
if (pool.deposit_address && this.contracts[pool.deposit_address] === undefined) {
|
|
219
250
|
this.contracts[pool.deposit_address] = {
|
|
220
251
|
contract: new ethers_1.Contract(pool.deposit_address, pool.deposit_abi, this.signer || this.provider),
|
|
221
|
-
multicallContract: new
|
|
252
|
+
multicallContract: new ethcall_1.Contract(pool.deposit_address, pool.deposit_abi),
|
|
222
253
|
};
|
|
223
254
|
this.contracts[pool.deposit_address.toLowerCase()] = {
|
|
224
255
|
contract: new ethers_1.Contract(pool.deposit_address, pool.deposit_abi, this.signer || this.provider),
|
|
225
|
-
multicallContract: new
|
|
256
|
+
multicallContract: new ethcall_1.Contract(pool.deposit_address, pool.deposit_abi),
|
|
226
257
|
};
|
|
227
258
|
}
|
|
228
|
-
for (
|
|
229
|
-
coinAddr = _d
|
|
259
|
+
for (_d = 0, _e = pool.underlying_coin_addresses; _d < _e.length; _d++) {
|
|
260
|
+
coinAddr = _e[_d];
|
|
230
261
|
this.contracts[coinAddr] = {
|
|
231
262
|
contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
|
|
232
|
-
multicallContract: new
|
|
263
|
+
multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
|
|
233
264
|
};
|
|
234
265
|
this.contracts[coinAddr.toLowerCase()] = {
|
|
235
266
|
contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
|
|
236
|
-
multicallContract: new
|
|
267
|
+
multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
|
|
237
268
|
};
|
|
238
269
|
}
|
|
239
|
-
for (
|
|
240
|
-
coinAddr = _f
|
|
270
|
+
for (_f = 0, _g = pool.coin_addresses; _f < _g.length; _f++) {
|
|
271
|
+
coinAddr = _g[_f];
|
|
241
272
|
if (customAbiTokens.includes(coinAddr))
|
|
242
273
|
continue;
|
|
243
274
|
this.contracts[coinAddr] = {
|
|
244
275
|
contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
|
|
245
|
-
multicallContract: new
|
|
276
|
+
multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
|
|
246
277
|
};
|
|
247
278
|
this.contracts[coinAddr.toLowerCase()] = {
|
|
248
279
|
contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
|
|
249
|
-
multicallContract: new
|
|
280
|
+
multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
|
|
250
281
|
};
|
|
251
282
|
}
|
|
252
283
|
// TODO add all coins
|
|
253
|
-
for (
|
|
254
|
-
coinAddr = _h
|
|
284
|
+
for (_h = 0, _j = pool.coin_addresses; _h < _j.length; _h++) {
|
|
285
|
+
coinAddr = _j[_h];
|
|
255
286
|
if (cTokens.includes(coinAddr)) {
|
|
256
287
|
this.contracts[coinAddr] = {
|
|
257
288
|
contract: new ethers_1.Contract(coinAddr, cERC20_json_1.default, this.signer || this.provider),
|
|
258
|
-
multicallContract: new
|
|
289
|
+
multicallContract: new ethcall_1.Contract(coinAddr, cERC20_json_1.default),
|
|
259
290
|
};
|
|
260
291
|
this.contracts[coinAddr.toLowerCase()] = {
|
|
261
292
|
contract: new ethers_1.Contract(coinAddr, cERC20_json_1.default, this.signer || this.provider),
|
|
262
|
-
multicallContract: new
|
|
293
|
+
multicallContract: new ethcall_1.Contract(coinAddr, cERC20_json_1.default),
|
|
263
294
|
};
|
|
264
295
|
}
|
|
265
296
|
if (aTokens.includes(coinAddr)) {
|
|
266
297
|
this.contracts[coinAddr] = {
|
|
267
298
|
contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
|
|
268
|
-
multicallContract: new
|
|
299
|
+
multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
|
|
269
300
|
};
|
|
270
301
|
this.contracts[coinAddr.toLowerCase()] = {
|
|
271
302
|
contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
|
|
272
|
-
multicallContract: new
|
|
303
|
+
multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
|
|
273
304
|
};
|
|
274
305
|
}
|
|
275
306
|
if (yTokens.includes(coinAddr) || ycTokens.includes(coinAddr)) {
|
|
276
307
|
this.contracts[coinAddr] = {
|
|
277
308
|
contract: new ethers_1.Contract(coinAddr, yERC20_json_1.default, this.signer || this.provider),
|
|
278
|
-
multicallContract: new
|
|
309
|
+
multicallContract: new ethcall_1.Contract(coinAddr, yERC20_json_1.default),
|
|
279
310
|
};
|
|
280
311
|
this.contracts[coinAddr.toLowerCase()] = {
|
|
281
312
|
contract: new ethers_1.Contract(coinAddr, yERC20_json_1.default, this.signer || this.provider),
|
|
282
|
-
multicallContract: new
|
|
313
|
+
multicallContract: new ethcall_1.Contract(coinAddr, yERC20_json_1.default),
|
|
283
314
|
};
|
|
284
315
|
}
|
|
285
316
|
}
|
|
286
317
|
}
|
|
287
318
|
this.contracts[exports.ALIASES.crv] = {
|
|
288
319
|
contract: new ethers_1.Contract(exports.ALIASES.crv, ERC20_json_1.default, this.signer || this.provider),
|
|
289
|
-
multicallContract: new
|
|
320
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.crv, ERC20_json_1.default),
|
|
290
321
|
};
|
|
291
322
|
this.contracts[exports.ALIASES.crv.toLowerCase()] = {
|
|
292
323
|
contract: new ethers_1.Contract(exports.ALIASES.crv, ERC20_json_1.default, this.signer || this.provider),
|
|
293
|
-
multicallContract: new
|
|
324
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.crv, ERC20_json_1.default),
|
|
294
325
|
};
|
|
295
326
|
this.contracts[exports.ALIASES.voting_escrow] = {
|
|
296
327
|
contract: new ethers_1.Contract(exports.ALIASES.voting_escrow, votingescrow_json_1.default, this.signer || this.provider),
|
|
297
|
-
multicallContract: new
|
|
328
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.voting_escrow, votingescrow_json_1.default),
|
|
298
329
|
};
|
|
299
330
|
this.contracts[exports.ALIASES.voting_escrow.toLowerCase()] = {
|
|
300
331
|
contract: new ethers_1.Contract(exports.ALIASES.voting_escrow, votingescrow_json_1.default, this.signer || this.provider),
|
|
301
|
-
multicallContract: new
|
|
332
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.voting_escrow, votingescrow_json_1.default),
|
|
302
333
|
};
|
|
303
334
|
this.contracts[exports.ALIASES.address_provider] = {
|
|
304
335
|
contract: new ethers_1.Contract(exports.ALIASES.address_provider, address_provider_json_1.default, this.signer || this.provider),
|
|
305
|
-
multicallContract: new
|
|
336
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.address_provider, address_provider_json_1.default),
|
|
306
337
|
};
|
|
307
338
|
this.contracts[exports.ALIASES.address_provider.toLowerCase()] = {
|
|
308
339
|
contract: new ethers_1.Contract(exports.ALIASES.address_provider, address_provider_json_1.default, this.signer || this.provider),
|
|
309
|
-
multicallContract: new
|
|
340
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.address_provider, address_provider_json_1.default),
|
|
310
341
|
};
|
|
311
342
|
addressProviderContract = this.contracts[exports.ALIASES.address_provider].contract;
|
|
312
|
-
|
|
343
|
+
_k = exports.ALIASES;
|
|
313
344
|
return [4 /*yield*/, addressProviderContract.get_address(2, this.constantOptions)];
|
|
314
|
-
case
|
|
315
|
-
|
|
345
|
+
case 8:
|
|
346
|
+
_k.registry_exchange = _l.sent();
|
|
316
347
|
this.contracts[exports.ALIASES.registry_exchange] = {
|
|
317
348
|
contract: new ethers_1.Contract(exports.ALIASES.registry_exchange, registry_exchange_json_1.default, this.signer || this.provider),
|
|
318
|
-
multicallContract: new
|
|
349
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.registry_exchange, registry_exchange_json_1.default),
|
|
319
350
|
};
|
|
320
351
|
this.contracts[exports.ALIASES.registry_exchange.toLowerCase()] = {
|
|
321
352
|
contract: new ethers_1.Contract(exports.ALIASES.registry_exchange, registry_exchange_json_1.default, this.signer || this.provider),
|
|
322
|
-
multicallContract: new
|
|
353
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.registry_exchange, registry_exchange_json_1.default),
|
|
323
354
|
};
|
|
324
355
|
this.contracts[exports.ALIASES.gauge_controller] = {
|
|
325
356
|
contract: new ethers_1.Contract(exports.ALIASES.gauge_controller, gaugecontroller_json_1.default, this.signer || this.provider),
|
|
326
|
-
multicallContract: new
|
|
357
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.gauge_controller, gaugecontroller_json_1.default),
|
|
327
358
|
};
|
|
328
359
|
this.contracts[exports.ALIASES.gauge_controller.toLowerCase()] = {
|
|
329
360
|
contract: new ethers_1.Contract(exports.ALIASES.gauge_controller, gaugecontroller_json_1.default, this.signer || this.provider),
|
|
330
|
-
multicallContract: new
|
|
361
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.gauge_controller, gaugecontroller_json_1.default),
|
|
331
362
|
};
|
|
332
363
|
this.contracts[exports.ALIASES.router] = {
|
|
333
364
|
contract: new ethers_1.Contract(exports.ALIASES.router, router_json_1.default, this.signer || this.provider),
|
|
334
|
-
multicallContract: new
|
|
365
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.router, router_json_1.default),
|
|
335
366
|
};
|
|
336
367
|
this.contracts[exports.ALIASES.router.toLowerCase()] = {
|
|
337
368
|
contract: new ethers_1.Contract(exports.ALIASES.router, router_json_1.default, this.signer || this.provider),
|
|
338
|
-
multicallContract: new
|
|
369
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.router, router_json_1.default),
|
|
339
370
|
};
|
|
340
371
|
return [2 /*return*/];
|
|
341
372
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ethers } from "ethers";
|
|
2
2
|
import { Networkish } from "@ethersproject/networks";
|
|
3
3
|
import { Pool } from "./pools";
|
|
4
|
-
declare function init(providerType: 'JsonRpc' | 'Web3' | 'Infura', providerSettings: {
|
|
4
|
+
declare function init(providerType: 'JsonRpc' | 'Web3' | 'Infura' | 'Alchemy', providerSettings: {
|
|
5
5
|
url?: string;
|
|
6
6
|
privateKey?: string;
|
|
7
7
|
} | {
|
|
@@ -24,6 +24,7 @@ declare const curve: {
|
|
|
24
24
|
init: typeof init;
|
|
25
25
|
setCustomFeeData: typeof setCustomFeeData;
|
|
26
26
|
signerAddress: string;
|
|
27
|
+
chainId: number;
|
|
27
28
|
Pool: typeof Pool;
|
|
28
29
|
getBalances: (coins: string[], ...addresses: string[] | string[][]) => Promise<string[] | import("./interfaces").DictInterface<string[]>>;
|
|
29
30
|
getAllowance: (coins: string[], address: string, spender: string) => Promise<string[]>;
|
package/lib/index.js
CHANGED
|
@@ -50,6 +50,8 @@ function init(providerType, providerSettings, options) {
|
|
|
50
50
|
_a.sent();
|
|
51
51
|
// @ts-ignore
|
|
52
52
|
this.signerAddress = curve_1.curve.signerAddress;
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
this.chainId = curve_1.curve.chainId;
|
|
53
55
|
return [2 /*return*/];
|
|
54
56
|
}
|
|
55
57
|
});
|
|
@@ -62,6 +64,7 @@ var curve = {
|
|
|
62
64
|
init: init,
|
|
63
65
|
setCustomFeeData: setCustomFeeData,
|
|
64
66
|
signerAddress: '',
|
|
67
|
+
chainId: 0,
|
|
65
68
|
Pool: pools_1.Pool,
|
|
66
69
|
getBalances: utils_1.getBalances,
|
|
67
70
|
getAllowance: utils_1.getAllowance,
|
package/lib/interfaces.d.ts
CHANGED