@curvefi/api 1.10.0 → 1.11.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 +2 -2
- 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/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} +44 -12
- package/lib/constants/coins-polygon.d.ts +31 -0
- package/lib/constants/coins-polygon.js +74 -0
- package/lib/curve.d.ts +22 -6
- package/lib/curve.js +99 -80
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lib/interfaces.d.ts +1 -0
- package/lib/pools.d.ts +1 -0
- package/lib/pools.js +190 -67
- 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,7 +103,7 @@ 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, _i, _b, pool, _c, _d, coinAddr, _e, _f, coinAddr, _g, _h, coinAddr, addressProviderContract, _j;
|
|
106
|
+
var cTokens, yTokens, ycTokens, aTokens, network, customAbiTokens, _a, _i, _b, pool, _c, _d, coinAddr, _e, _f, coinAddr, _g, _h, coinAddr, addressProviderContract, _j;
|
|
135
107
|
return __generator(this, function (_k) {
|
|
136
108
|
switch (_k.label) {
|
|
137
109
|
case 0:
|
|
@@ -165,75 +137,122 @@ var Curve = /** @class */ (function () {
|
|
|
165
137
|
else {
|
|
166
138
|
throw Error('Wrong providerType');
|
|
167
139
|
}
|
|
168
|
-
|
|
169
|
-
this.multicallProvider = new ethers_multicall_1.Provider(this.provider, options.chainId);
|
|
170
|
-
return [3 /*break*/, 3];
|
|
140
|
+
return [4 /*yield*/, this.provider._networkPromise];
|
|
171
141
|
case 1:
|
|
172
|
-
|
|
173
|
-
|
|
142
|
+
network = _k.sent();
|
|
143
|
+
console.log("CURVE-JS IS CONNECTED TO NETWORK:", network);
|
|
144
|
+
this.chainId = network.chainId;
|
|
145
|
+
if (network.chainId === 1) {
|
|
146
|
+
cTokens = coins_ethereum_1.cTokensEthereum;
|
|
147
|
+
yTokens = coins_ethereum_1.yTokensEthereum;
|
|
148
|
+
ycTokens = coins_ethereum_1.ycTokensEthereum;
|
|
149
|
+
aTokens = coins_ethereum_1.aTokensEthereum;
|
|
150
|
+
exports.ALIASES = aliases_1.ALIASES_ETHEREUM;
|
|
151
|
+
exports.POOLS_DATA = abis_ethereum_1.POOLS_DATA_ETHEREUM;
|
|
152
|
+
exports.BTC_COINS = coins_ethereum_1.BTC_COINS_ETHEREUM;
|
|
153
|
+
exports.BTC_COINS_LOWER_CASE = coins_ethereum_1.BTC_COINS_LOWER_CASE_ETHEREUM;
|
|
154
|
+
exports.ETH_COINS = coins_ethereum_1.ETH_COINS_ETHEREUM;
|
|
155
|
+
exports.ETH_COINS_LOWER_CASE = coins_ethereum_1.ETH_COINS_LOWER_CASE_ETHEREUM;
|
|
156
|
+
exports.LINK_COINS = coins_ethereum_1.LINK_COINS_ETHEREUM;
|
|
157
|
+
exports.LINK_COINS_LOWER_CASE = coins_ethereum_1.LINK_COINS_LOWER_CASE_ETHEREUM;
|
|
158
|
+
exports.EUR_COINS = coins_ethereum_1.EUR_COINS_ETHEREUM;
|
|
159
|
+
exports.EUR_COINS_LOWER_CASE = coins_ethereum_1.EUR_COINS_LOWER_CASE_ETHEREUM;
|
|
160
|
+
exports.USD_COINS = coins_ethereum_1.USD_COINS_ETHEREUM;
|
|
161
|
+
exports.USD_COINS_LOWER_CASE = coins_ethereum_1.USD_COINS_LOWER_CASE_ETHEREUM;
|
|
162
|
+
exports.COINS = coins_ethereum_1.COINS_ETHEREUM;
|
|
163
|
+
exports.DECIMALS = coins_ethereum_1.DECIMALS_ETHEREUM;
|
|
164
|
+
exports.DECIMALS_LOWER_CASE = coins_ethereum_1.DECIMALS_LOWER_CASE_ETHEREUM;
|
|
165
|
+
}
|
|
166
|
+
else if (network.chainId === 137) {
|
|
167
|
+
cTokens = coins_polygon_1.cTokensPolygon;
|
|
168
|
+
yTokens = coins_polygon_1.yTokensPolygon;
|
|
169
|
+
ycTokens = coins_polygon_1.ycTokensPolygon;
|
|
170
|
+
aTokens = coins_polygon_1.aTokensPolygon;
|
|
171
|
+
exports.ALIASES = aliases_1.ALIASES_POLYGON;
|
|
172
|
+
exports.POOLS_DATA = abis_polygon_1.POOLS_DATA_POLYGON;
|
|
173
|
+
exports.BTC_COINS = coins_polygon_1.BTC_COINS_POLYGON;
|
|
174
|
+
exports.BTC_COINS_LOWER_CASE = coins_polygon_1.BTC_COINS_LOWER_CASE_POLYGON;
|
|
175
|
+
exports.ETH_COINS = coins_polygon_1.ETH_COINS_POLYGON;
|
|
176
|
+
exports.ETH_COINS_LOWER_CASE = coins_polygon_1.ETH_COINS_LOWER_CASE_POLYGON;
|
|
177
|
+
exports.LINK_COINS = coins_polygon_1.LINK_COINS_POLYGON;
|
|
178
|
+
exports.LINK_COINS_LOWER_CASE = coins_polygon_1.LINK_COINS_LOWER_CASE_POLYGON;
|
|
179
|
+
exports.EUR_COINS = coins_polygon_1.EUR_COINS_POLYGON;
|
|
180
|
+
exports.EUR_COINS_LOWER_CASE = coins_polygon_1.EUR_COINS_LOWER_CASE_POLYGON;
|
|
181
|
+
exports.USD_COINS = coins_polygon_1.USD_COINS_POLYGON;
|
|
182
|
+
exports.USD_COINS_LOWER_CASE = coins_polygon_1.USD_COINS_LOWER_CASE_POLYGON;
|
|
183
|
+
exports.COINS = coins_polygon_1.COINS_POLYGON;
|
|
184
|
+
exports.DECIMALS = coins_polygon_1.DECIMALS_POLYGON;
|
|
185
|
+
exports.DECIMALS_LOWER_CASE = coins_polygon_1.DECIMALS_LOWER_CASE_POLYGON;
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
throw Error("Network with chainId ".concat(this.provider.network.chainId, " is not supported"));
|
|
189
|
+
}
|
|
190
|
+
exports.LP_TOKENS = Object.values(exports.POOLS_DATA).map(function (data) { return data.token_address.toLowerCase(); });
|
|
191
|
+
exports.GAUGES = Object.values(exports.POOLS_DATA).map(function (data) { return data.gauge_address.toLowerCase(); });
|
|
192
|
+
customAbiTokens = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], cTokens, true), yTokens, true), ycTokens, true), aTokens, true);
|
|
193
|
+
this.multicallProvider = new ethcall_1.Provider();
|
|
194
|
+
return [4 /*yield*/, this.multicallProvider.init(this.provider)];
|
|
174
195
|
case 2:
|
|
175
196
|
_k.sent();
|
|
176
|
-
|
|
177
|
-
case 3:
|
|
178
|
-
if (!this.signer) return [3 /*break*/, 5];
|
|
197
|
+
if (!this.signer) return [3 /*break*/, 4];
|
|
179
198
|
_a = this;
|
|
180
199
|
return [4 /*yield*/, this.signer.getAddress()];
|
|
181
|
-
case
|
|
200
|
+
case 3:
|
|
182
201
|
_a.signerAddress = _k.sent();
|
|
183
|
-
_k.label =
|
|
184
|
-
case
|
|
202
|
+
_k.label = 4;
|
|
203
|
+
case 4:
|
|
185
204
|
this.feeData = { gasPrice: options.gasPrice, maxFeePerGas: options.maxFeePerGas, maxPriorityFeePerGas: options.maxPriorityFeePerGas };
|
|
186
205
|
return [4 /*yield*/, this.updateFeeData()];
|
|
187
|
-
case
|
|
206
|
+
case 5:
|
|
188
207
|
_k.sent();
|
|
189
208
|
// TODO delete toLowerCase()
|
|
190
|
-
for (_i = 0, _b = Object.values(
|
|
209
|
+
for (_i = 0, _b = Object.values(exports.POOLS_DATA); _i < _b.length; _i++) {
|
|
191
210
|
pool = _b[_i];
|
|
192
211
|
this.contracts[pool.swap_address] = {
|
|
193
212
|
contract: new ethers_1.Contract(pool.swap_address, pool.swap_abi, this.signer || this.provider),
|
|
194
|
-
multicallContract: new
|
|
213
|
+
multicallContract: new ethcall_1.Contract(pool.swap_address, pool.swap_abi),
|
|
195
214
|
};
|
|
196
215
|
this.contracts[pool.swap_address.toLowerCase()] = {
|
|
197
216
|
contract: new ethers_1.Contract(pool.swap_address, pool.swap_abi, this.signer || this.provider),
|
|
198
|
-
multicallContract: new
|
|
217
|
+
multicallContract: new ethcall_1.Contract(pool.swap_address, pool.swap_abi),
|
|
199
218
|
};
|
|
200
219
|
if (pool.token_address !== pool.swap_address) {
|
|
201
220
|
this.contracts[pool.token_address] = {
|
|
202
221
|
contract: new ethers_1.Contract(pool.token_address, ERC20_json_1.default, this.signer || this.provider),
|
|
203
|
-
multicallContract: new
|
|
222
|
+
multicallContract: new ethcall_1.Contract(pool.token_address, ERC20_json_1.default),
|
|
204
223
|
};
|
|
205
224
|
this.contracts[pool.token_address.toLowerCase()] = {
|
|
206
225
|
contract: new ethers_1.Contract(pool.token_address, ERC20_json_1.default, this.signer || this.provider),
|
|
207
|
-
multicallContract: new
|
|
226
|
+
multicallContract: new ethcall_1.Contract(pool.token_address, ERC20_json_1.default),
|
|
208
227
|
};
|
|
209
228
|
}
|
|
210
229
|
this.contracts[pool.gauge_address] = {
|
|
211
230
|
contract: new ethers_1.Contract(pool.gauge_address, gauge_json_1.default, this.signer || this.provider),
|
|
212
|
-
multicallContract: new
|
|
231
|
+
multicallContract: new ethcall_1.Contract(pool.gauge_address, gauge_json_1.default),
|
|
213
232
|
};
|
|
214
233
|
this.contracts[pool.gauge_address.toLowerCase()] = {
|
|
215
234
|
contract: new ethers_1.Contract(pool.gauge_address, gauge_json_1.default, this.signer || this.provider),
|
|
216
|
-
multicallContract: new
|
|
235
|
+
multicallContract: new ethcall_1.Contract(pool.gauge_address, gauge_json_1.default),
|
|
217
236
|
};
|
|
218
237
|
if (pool.deposit_address && this.contracts[pool.deposit_address] === undefined) {
|
|
219
238
|
this.contracts[pool.deposit_address] = {
|
|
220
239
|
contract: new ethers_1.Contract(pool.deposit_address, pool.deposit_abi, this.signer || this.provider),
|
|
221
|
-
multicallContract: new
|
|
240
|
+
multicallContract: new ethcall_1.Contract(pool.deposit_address, pool.deposit_abi),
|
|
222
241
|
};
|
|
223
242
|
this.contracts[pool.deposit_address.toLowerCase()] = {
|
|
224
243
|
contract: new ethers_1.Contract(pool.deposit_address, pool.deposit_abi, this.signer || this.provider),
|
|
225
|
-
multicallContract: new
|
|
244
|
+
multicallContract: new ethcall_1.Contract(pool.deposit_address, pool.deposit_abi),
|
|
226
245
|
};
|
|
227
246
|
}
|
|
228
247
|
for (_c = 0, _d = pool.underlying_coin_addresses; _c < _d.length; _c++) {
|
|
229
248
|
coinAddr = _d[_c];
|
|
230
249
|
this.contracts[coinAddr] = {
|
|
231
250
|
contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
|
|
232
|
-
multicallContract: new
|
|
251
|
+
multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
|
|
233
252
|
};
|
|
234
253
|
this.contracts[coinAddr.toLowerCase()] = {
|
|
235
254
|
contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
|
|
236
|
-
multicallContract: new
|
|
255
|
+
multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
|
|
237
256
|
};
|
|
238
257
|
}
|
|
239
258
|
for (_e = 0, _f = pool.coin_addresses; _e < _f.length; _e++) {
|
|
@@ -242,11 +261,11 @@ var Curve = /** @class */ (function () {
|
|
|
242
261
|
continue;
|
|
243
262
|
this.contracts[coinAddr] = {
|
|
244
263
|
contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
|
|
245
|
-
multicallContract: new
|
|
264
|
+
multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
|
|
246
265
|
};
|
|
247
266
|
this.contracts[coinAddr.toLowerCase()] = {
|
|
248
267
|
contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
|
|
249
|
-
multicallContract: new
|
|
268
|
+
multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
|
|
250
269
|
};
|
|
251
270
|
}
|
|
252
271
|
// TODO add all coins
|
|
@@ -255,87 +274,87 @@ var Curve = /** @class */ (function () {
|
|
|
255
274
|
if (cTokens.includes(coinAddr)) {
|
|
256
275
|
this.contracts[coinAddr] = {
|
|
257
276
|
contract: new ethers_1.Contract(coinAddr, cERC20_json_1.default, this.signer || this.provider),
|
|
258
|
-
multicallContract: new
|
|
277
|
+
multicallContract: new ethcall_1.Contract(coinAddr, cERC20_json_1.default),
|
|
259
278
|
};
|
|
260
279
|
this.contracts[coinAddr.toLowerCase()] = {
|
|
261
280
|
contract: new ethers_1.Contract(coinAddr, cERC20_json_1.default, this.signer || this.provider),
|
|
262
|
-
multicallContract: new
|
|
281
|
+
multicallContract: new ethcall_1.Contract(coinAddr, cERC20_json_1.default),
|
|
263
282
|
};
|
|
264
283
|
}
|
|
265
284
|
if (aTokens.includes(coinAddr)) {
|
|
266
285
|
this.contracts[coinAddr] = {
|
|
267
286
|
contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
|
|
268
|
-
multicallContract: new
|
|
287
|
+
multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
|
|
269
288
|
};
|
|
270
289
|
this.contracts[coinAddr.toLowerCase()] = {
|
|
271
290
|
contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
|
|
272
|
-
multicallContract: new
|
|
291
|
+
multicallContract: new ethcall_1.Contract(coinAddr, ERC20_json_1.default),
|
|
273
292
|
};
|
|
274
293
|
}
|
|
275
294
|
if (yTokens.includes(coinAddr) || ycTokens.includes(coinAddr)) {
|
|
276
295
|
this.contracts[coinAddr] = {
|
|
277
296
|
contract: new ethers_1.Contract(coinAddr, yERC20_json_1.default, this.signer || this.provider),
|
|
278
|
-
multicallContract: new
|
|
297
|
+
multicallContract: new ethcall_1.Contract(coinAddr, yERC20_json_1.default),
|
|
279
298
|
};
|
|
280
299
|
this.contracts[coinAddr.toLowerCase()] = {
|
|
281
300
|
contract: new ethers_1.Contract(coinAddr, yERC20_json_1.default, this.signer || this.provider),
|
|
282
|
-
multicallContract: new
|
|
301
|
+
multicallContract: new ethcall_1.Contract(coinAddr, yERC20_json_1.default),
|
|
283
302
|
};
|
|
284
303
|
}
|
|
285
304
|
}
|
|
286
305
|
}
|
|
287
306
|
this.contracts[exports.ALIASES.crv] = {
|
|
288
307
|
contract: new ethers_1.Contract(exports.ALIASES.crv, ERC20_json_1.default, this.signer || this.provider),
|
|
289
|
-
multicallContract: new
|
|
308
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.crv, ERC20_json_1.default),
|
|
290
309
|
};
|
|
291
310
|
this.contracts[exports.ALIASES.crv.toLowerCase()] = {
|
|
292
311
|
contract: new ethers_1.Contract(exports.ALIASES.crv, ERC20_json_1.default, this.signer || this.provider),
|
|
293
|
-
multicallContract: new
|
|
312
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.crv, ERC20_json_1.default),
|
|
294
313
|
};
|
|
295
314
|
this.contracts[exports.ALIASES.voting_escrow] = {
|
|
296
315
|
contract: new ethers_1.Contract(exports.ALIASES.voting_escrow, votingescrow_json_1.default, this.signer || this.provider),
|
|
297
|
-
multicallContract: new
|
|
316
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.voting_escrow, votingescrow_json_1.default),
|
|
298
317
|
};
|
|
299
318
|
this.contracts[exports.ALIASES.voting_escrow.toLowerCase()] = {
|
|
300
319
|
contract: new ethers_1.Contract(exports.ALIASES.voting_escrow, votingescrow_json_1.default, this.signer || this.provider),
|
|
301
|
-
multicallContract: new
|
|
320
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.voting_escrow, votingescrow_json_1.default),
|
|
302
321
|
};
|
|
303
322
|
this.contracts[exports.ALIASES.address_provider] = {
|
|
304
323
|
contract: new ethers_1.Contract(exports.ALIASES.address_provider, address_provider_json_1.default, this.signer || this.provider),
|
|
305
|
-
multicallContract: new
|
|
324
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.address_provider, address_provider_json_1.default),
|
|
306
325
|
};
|
|
307
326
|
this.contracts[exports.ALIASES.address_provider.toLowerCase()] = {
|
|
308
327
|
contract: new ethers_1.Contract(exports.ALIASES.address_provider, address_provider_json_1.default, this.signer || this.provider),
|
|
309
|
-
multicallContract: new
|
|
328
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.address_provider, address_provider_json_1.default),
|
|
310
329
|
};
|
|
311
330
|
addressProviderContract = this.contracts[exports.ALIASES.address_provider].contract;
|
|
312
331
|
_j = exports.ALIASES;
|
|
313
332
|
return [4 /*yield*/, addressProviderContract.get_address(2, this.constantOptions)];
|
|
314
|
-
case
|
|
333
|
+
case 6:
|
|
315
334
|
_j.registry_exchange = _k.sent();
|
|
316
335
|
this.contracts[exports.ALIASES.registry_exchange] = {
|
|
317
336
|
contract: new ethers_1.Contract(exports.ALIASES.registry_exchange, registry_exchange_json_1.default, this.signer || this.provider),
|
|
318
|
-
multicallContract: new
|
|
337
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.registry_exchange, registry_exchange_json_1.default),
|
|
319
338
|
};
|
|
320
339
|
this.contracts[exports.ALIASES.registry_exchange.toLowerCase()] = {
|
|
321
340
|
contract: new ethers_1.Contract(exports.ALIASES.registry_exchange, registry_exchange_json_1.default, this.signer || this.provider),
|
|
322
|
-
multicallContract: new
|
|
341
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.registry_exchange, registry_exchange_json_1.default),
|
|
323
342
|
};
|
|
324
343
|
this.contracts[exports.ALIASES.gauge_controller] = {
|
|
325
344
|
contract: new ethers_1.Contract(exports.ALIASES.gauge_controller, gaugecontroller_json_1.default, this.signer || this.provider),
|
|
326
|
-
multicallContract: new
|
|
345
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.gauge_controller, gaugecontroller_json_1.default),
|
|
327
346
|
};
|
|
328
347
|
this.contracts[exports.ALIASES.gauge_controller.toLowerCase()] = {
|
|
329
348
|
contract: new ethers_1.Contract(exports.ALIASES.gauge_controller, gaugecontroller_json_1.default, this.signer || this.provider),
|
|
330
|
-
multicallContract: new
|
|
349
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.gauge_controller, gaugecontroller_json_1.default),
|
|
331
350
|
};
|
|
332
351
|
this.contracts[exports.ALIASES.router] = {
|
|
333
352
|
contract: new ethers_1.Contract(exports.ALIASES.router, router_json_1.default, this.signer || this.provider),
|
|
334
|
-
multicallContract: new
|
|
353
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.router, router_json_1.default),
|
|
335
354
|
};
|
|
336
355
|
this.contracts[exports.ALIASES.router.toLowerCase()] = {
|
|
337
356
|
contract: new ethers_1.Contract(exports.ALIASES.router, router_json_1.default, this.signer || this.provider),
|
|
338
|
-
multicallContract: new
|
|
357
|
+
multicallContract: new ethcall_1.Contract(exports.ALIASES.router, router_json_1.default),
|
|
339
358
|
};
|
|
340
359
|
return [2 /*return*/];
|
|
341
360
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -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