@curvefi/api 2.68.18 → 2.68.22
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/route-graph.worker.js +2 -2
- package/lib/router.js +9 -5
- package/package.json +12 -12
|
@@ -274,10 +274,10 @@ export function routeGraphWorker() {
|
|
|
274
274
|
if (poolData.is_ng)
|
|
275
275
|
poolType *= 10;
|
|
276
276
|
const tvlMultiplier = poolData.is_crypto ? 1 : ((_a = amplificationCoefficientDict[poolData.swap_address]) !== null && _a !== void 0 ? _a : 1);
|
|
277
|
-
const basePool = poolData.is_meta ? Object.assign(Object.assign({}, constants.POOLS_DATA), constants.FACTORY_POOLS_DATA)[poolData.base_pool] : null;
|
|
277
|
+
const basePool = poolData.is_meta ? Object.assign(Object.assign(Object.assign(Object.assign({}, constants.POOLS_DATA), constants.FACTORY_POOLS_DATA), constants.STABLE_NG_FACTORY_POOLS_DATA), constants.CRVUSD_FACTORY_POOLS_DATA)[poolData.base_pool] : null;
|
|
278
278
|
const basePoolAddress = basePool ? basePool.swap_address.toLowerCase() : constants.ZERO_ADDRESS;
|
|
279
279
|
let baseTokenAddress = basePool ? basePool.token_address.toLowerCase() : constants.ZERO_ADDRESS;
|
|
280
|
-
const secondBasePool = basePool && basePool.base_pool ? Object.assign(Object.assign(Object.assign({}, constants.POOLS_DATA), constants.FACTORY_POOLS_DATA), constants.CRVUSD_FACTORY_POOLS_DATA)[basePool.base_pool] : null;
|
|
280
|
+
const secondBasePool = basePool && basePool.base_pool ? Object.assign(Object.assign(Object.assign(Object.assign({}, constants.POOLS_DATA), constants.FACTORY_POOLS_DATA), constants.STABLE_NG_FACTORY_POOLS_DATA), constants.CRVUSD_FACTORY_POOLS_DATA)[basePool.base_pool] : null;
|
|
281
281
|
const secondBasePoolAddress = secondBasePool ? secondBasePool.swap_address.toLowerCase() : constants.ZERO_ADDRESS;
|
|
282
282
|
// for double meta underlying (crv/tricrypto, wmatic/tricrypto)
|
|
283
283
|
if (basePool && secondBasePoolAddress !== constants.ZERO_ADDRESS)
|
package/lib/router.js
CHANGED
|
@@ -390,7 +390,7 @@ export function swapEstimateGas(inputCoin, outputCoin, amount) {
|
|
|
390
390
|
return gas;
|
|
391
391
|
});
|
|
392
392
|
}
|
|
393
|
-
|
|
393
|
+
function prepareSwap(inputCoin_1, outputCoin_1, amount_1) {
|
|
394
394
|
return __awaiter(this, arguments, void 0, function* (inputCoin, outputCoin, amount, slippage = 0.5) {
|
|
395
395
|
const [inputCoinAddress, outputCoinAddress] = _getCoinAddresses.call(this, inputCoin, outputCoin);
|
|
396
396
|
const [inputCoinDecimals, outputCoinDecimals] = _getCoinDecimals.call(this, inputCoinAddress, outputCoinAddress);
|
|
@@ -410,10 +410,14 @@ export function swap(inputCoin_1, outputCoin_1, amount_1) {
|
|
|
410
410
|
const gasLimit = (DIGas(yield contract.exchange.estimateGas(_route, _swapParams, _amount, _minRecvAmount, _pools, Object.assign(Object.assign({}, this.constantOptions), { value })))) * (this.chainId === 1 ? this.parseUnits("130", 0) : this.parseUnits("160", 0)) / this.parseUnits("100", 0);
|
|
411
411
|
return yield contract.exchange(_route, _swapParams, _amount, _minRecvAmount, _pools, Object.assign(Object.assign({}, this.options), { value, gasLimit }));
|
|
412
412
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
413
|
+
const gasLimit = (DIGas(yield contract.exchange.estimateGas(_route, _swapParams, _amount, _minRecvAmount, Object.assign(Object.assign({}, this.constantOptions), { value })))) * this.parseUnits("160", 0) / this.parseUnits("100", 0);
|
|
414
|
+
return [contract, [_route, _swapParams, _amount, _minRecvAmount], Object.assign(Object.assign({}, this.options), { value, gasLimit })];
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
export function swap(inputCoin_1, outputCoin_1, amount_1) {
|
|
418
|
+
return __awaiter(this, arguments, void 0, function* (inputCoin, outputCoin, amount, slippage = 0.5) {
|
|
419
|
+
const [contract, params, options] = yield prepareSwap.call(this, inputCoin, outputCoin, amount, slippage);
|
|
420
|
+
return yield contract.exchange(...params, options);
|
|
417
421
|
});
|
|
418
422
|
}
|
|
419
423
|
export function populateSwap(inputCoin_1, outputCoin_1, amount_1) {
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@curvefi/api",
|
|
3
|
-
"version": "2.68.
|
|
3
|
+
"version": "2.68.22",
|
|
4
4
|
"description": "JavaScript library for curve.finance",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "Macket",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"private": false,
|
|
9
9
|
"engines": {
|
|
10
|
-
"node": "
|
|
10
|
+
"node": "24"
|
|
11
11
|
},
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
@@ -25,20 +25,20 @@
|
|
|
25
25
|
},
|
|
26
26
|
"type": "module",
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@babel/eslint-parser": "^7.28.
|
|
28
|
+
"@babel/eslint-parser": "^7.28.5",
|
|
29
29
|
"@eslint/eslintrc": "^3.3.1",
|
|
30
|
-
"@eslint/js": "^9.
|
|
31
|
-
"@types/chai": "^5.2.
|
|
30
|
+
"@eslint/js": "^9.38.0",
|
|
31
|
+
"@types/chai": "^5.2.3",
|
|
32
32
|
"@types/memoizee": "^0.4.12",
|
|
33
33
|
"@types/mocha": "^10.0.10",
|
|
34
|
-
"@types/node": "^24.
|
|
35
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
36
|
-
"@typescript-eslint/parser": "^8.
|
|
34
|
+
"@types/node": "^24.9.2",
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^8.46.2",
|
|
36
|
+
"@typescript-eslint/parser": "^8.46.2",
|
|
37
37
|
"chai": "^5.3.3",
|
|
38
|
-
"eslint": "^9.
|
|
39
|
-
"globals": "^16.
|
|
40
|
-
"mocha": "^11.7.
|
|
41
|
-
"typescript": "^5.9.
|
|
38
|
+
"eslint": "^9.38.0",
|
|
39
|
+
"globals": "^16.4.0",
|
|
40
|
+
"mocha": "^11.7.4",
|
|
41
|
+
"typescript": "^5.9.3",
|
|
42
42
|
"vue-eslint-parser": "^10.2.0"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|