@curvefi/api 2.63.0 → 2.63.2
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/boosting.js +247 -645
- package/lib/constants/L2Networks.js +1 -1
- package/lib/constants/aliases.js +19 -19
- package/lib/constants/coins/arbitrum.js +5 -5
- package/lib/constants/coins/aurora.js +5 -5
- package/lib/constants/coins/avalanche.js +6 -6
- package/lib/constants/coins/base.js +5 -5
- package/lib/constants/coins/bsc.js +5 -5
- package/lib/constants/coins/celo.js +5 -5
- package/lib/constants/coins/ethereum.js +9 -9
- package/lib/constants/coins/fantom.js +7 -7
- package/lib/constants/coins/fraxtal.js +5 -5
- package/lib/constants/coins/kava.js +5 -5
- package/lib/constants/coins/mantle.js +5 -5
- package/lib/constants/coins/moonbeam.js +5 -5
- package/lib/constants/coins/optimism.js +5 -5
- package/lib/constants/coins/polygon.js +6 -6
- package/lib/constants/coins/xdai.js +5 -5
- package/lib/constants/coins/xlayer.js +5 -5
- package/lib/constants/coins/zksync.js +5 -5
- package/lib/constants/pools/arbitrum.js +1 -1
- package/lib/constants/pools/aurora.js +1 -1
- package/lib/constants/pools/avalanche.js +1 -1
- package/lib/constants/pools/base.js +1 -1
- package/lib/constants/pools/bsc.js +1 -1
- package/lib/constants/pools/celo.js +1 -1
- package/lib/constants/pools/ethereum.js +2 -2
- package/lib/constants/pools/fantom.js +1 -1
- package/lib/constants/pools/fraxtal.js +1 -1
- package/lib/constants/pools/kava.js +1 -1
- package/lib/constants/pools/mantle.js +1 -1
- package/lib/constants/pools/moonbeam.js +1 -1
- package/lib/constants/pools/optimism.js +1 -1
- package/lib/constants/pools/polygon.js +1 -1
- package/lib/constants/pools/xdai.js +1 -1
- package/lib/constants/pools/xlayer.js +1 -1
- package/lib/constants/pools/zksync.js +1 -1
- package/lib/constants/tricryptoDeployImplementations.js +1 -1
- package/lib/constants/utils.js +18 -19
- package/lib/constants/volumeNetworks.js +1 -1
- package/lib/curve.d.ts +10 -6
- package/lib/curve.js +534 -909
- package/lib/dao.js +351 -705
- package/lib/external-api.js +127 -256
- package/lib/factory/common.js +4 -4
- package/lib/factory/constants-crypto.js +33 -33
- package/lib/factory/constants.js +34 -34
- package/lib/factory/deploy.js +542 -907
- package/lib/factory/factory-api.js +205 -269
- package/lib/factory/factory-crypto.js +202 -342
- package/lib/factory/factory-tricrypto.js +164 -286
- package/lib/factory/factory-twocrypto.js +151 -269
- package/lib/factory/factory.js +245 -385
- package/lib/index.js +109 -198
- package/lib/interfaces.d.ts +46 -6
- package/lib/pools/PoolTemplate.js +1774 -3027
- package/lib/pools/gaugePool.js +112 -251
- package/lib/pools/mixins/common.js +22 -93
- package/lib/pools/mixins/depositBalancedAmountsMixins.js +52 -118
- package/lib/pools/mixins/depositMixins.js +160 -386
- package/lib/pools/mixins/depositWrappedMixins.js +79 -205
- package/lib/pools/mixins/poolBalancesMixin.js +24 -87
- package/lib/pools/mixins/swapMixins.js +139 -324
- package/lib/pools/mixins/swapWrappedMixins.js +111 -265
- package/lib/pools/mixins/withdrawExpectedMixins.js +27 -91
- package/lib/pools/mixins/withdrawImbalanceMixins.js +111 -293
- package/lib/pools/mixins/withdrawImbalanceWrappedMixins.js +58 -169
- package/lib/pools/mixins/withdrawMixins.js +139 -359
- package/lib/pools/mixins/withdrawOneCoinExpectedMixins.js +20 -75
- package/lib/pools/mixins/withdrawOneCoinMixins.js +140 -360
- package/lib/pools/mixins/withdrawOneCoinWrappedExpectedMixins.js +10 -51
- package/lib/pools/mixins/withdrawOneCoinWrappedMixins.js +60 -167
- package/lib/pools/mixins/withdrawWrappedMixins.js +57 -167
- package/lib/pools/poolConstructor.js +11 -31
- package/lib/pools/utils.js +301 -469
- package/lib/route-finder.worker.d.ts +9 -0
- package/lib/route-finder.worker.js +112 -0
- package/lib/route-graph.worker.d.ts +11 -0
- package/lib/route-graph.worker.js +334 -0
- package/lib/router.js +323 -912
- package/lib/utils.d.ts +8 -7
- package/lib/utils.js +540 -927
- package/package.json +3 -2
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
if (typeof b !== "function" && b !== null)
|
|
10
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
-
extendStatics(d, b);
|
|
12
|
-
function __() { this.constructor = d; }
|
|
13
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
-
};
|
|
15
|
-
})();
|
|
16
1
|
import { curve } from "../curve.js";
|
|
17
2
|
import { PoolTemplate } from "./PoolTemplate.js";
|
|
18
3
|
import { poolBalancesMetaMixin, poolBalancesLendingMixin } from "./mixins/poolBalancesMixin.js";
|
|
@@ -30,21 +15,16 @@ import { withdrawOneCoinWrappedExpected2argsMixin, withdrawOneCoinWrappedExpecte
|
|
|
30
15
|
import { withdrawOneCoinWrappedLendingOrCryptoMixin, withdrawOneCoinWrappedMixin } from "./mixins/withdrawOneCoinWrappedMixins.js";
|
|
31
16
|
import { swapTricrypto2Mixin, swapMetaFactoryMixin, swapCryptoMetaFactoryMixin, swapMixin } from "./mixins/swapMixins.js";
|
|
32
17
|
import { swapWrappedExpectedAndApproveMixin, swapWrappedTricrypto2Mixin, swapWrappedMixin, swapWrappedRequiredMixin, } from "./mixins/swapWrappedMixins.js";
|
|
33
|
-
import {
|
|
34
|
-
export
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
function Pool() {
|
|
39
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
40
|
-
}
|
|
41
|
-
return Pool;
|
|
42
|
-
}(PoolTemplate));
|
|
18
|
+
import { getCountArgsOfMethodByAbi, findAbiSignature } from "../utils.js";
|
|
19
|
+
export const getPool = (poolId) => {
|
|
20
|
+
const poolDummy = new PoolTemplate(poolId);
|
|
21
|
+
class Pool extends PoolTemplate {
|
|
22
|
+
}
|
|
43
23
|
// statsBalances
|
|
44
24
|
if (poolDummy.isMeta) {
|
|
45
25
|
Object.assign(Pool.prototype, poolBalancesMetaMixin);
|
|
46
26
|
}
|
|
47
|
-
else if (poolDummy.useLending.reduce(
|
|
27
|
+
else if (poolDummy.useLending.reduce((x, y) => x || y)) {
|
|
48
28
|
Object.assign(Pool.prototype, poolBalancesLendingMixin);
|
|
49
29
|
}
|
|
50
30
|
// depositBalancedAmounts
|
|
@@ -75,7 +55,7 @@ export var getPool = function (poolId) {
|
|
|
75
55
|
else if (poolDummy.zap && poolId !== 'susd') {
|
|
76
56
|
Object.assign(Pool.prototype, depositZapMixin);
|
|
77
57
|
}
|
|
78
|
-
else if (
|
|
58
|
+
else if (getCountArgsOfMethodByAbi(curve.contracts[poolDummy.address].abi, 'add_liquidity') > 2) {
|
|
79
59
|
Object.assign(Pool.prototype, depositLendingOrCryptoMixin);
|
|
80
60
|
}
|
|
81
61
|
else {
|
|
@@ -112,7 +92,7 @@ export var getPool = function (poolId) {
|
|
|
112
92
|
else if (poolDummy.zap && poolId !== 'susd') {
|
|
113
93
|
Object.assign(Pool.prototype, withdrawZapMixin);
|
|
114
94
|
}
|
|
115
|
-
else if (
|
|
95
|
+
else if (getCountArgsOfMethodByAbi(curve.contracts[poolDummy.address].abi, 'remove_liquidity') > 2) {
|
|
116
96
|
Object.assign(Pool.prototype, withdrawLendingOrCryptoMixin);
|
|
117
97
|
}
|
|
118
98
|
else {
|
|
@@ -178,7 +158,7 @@ export var getPool = function (poolId) {
|
|
|
178
158
|
else if (poolDummy.zap) { // including susd
|
|
179
159
|
Object.assign(Pool.prototype, withdrawOneCoinZapMixin);
|
|
180
160
|
}
|
|
181
|
-
else if (
|
|
161
|
+
else if (getCountArgsOfMethodByAbi(curve.contracts[poolDummy.address].abi, 'remove_liquidity_one_coin') > 3) {
|
|
182
162
|
Object.assign(Pool.prototype, withdrawOneCoinLendingOrCryptoMixin);
|
|
183
163
|
}
|
|
184
164
|
else {
|
|
@@ -203,7 +183,7 @@ export var getPool = function (poolId) {
|
|
|
203
183
|
}
|
|
204
184
|
}
|
|
205
185
|
// swap and swapEstimateGas
|
|
206
|
-
if ('exchange
|
|
186
|
+
if (findAbiSignature(curve.contracts[poolDummy.address].abi, 'exchange', 'uint256,uint256,uint256,uint256,bool') &&
|
|
207
187
|
!(curve.chainId === 100 && poolDummy.id === "tricrypto")) { // tricrypto2 (eth), tricrypto (arbitrum), avaxcrypto (avalanche); 100 is xDAI
|
|
208
188
|
Object.assign(Pool.prototype, swapTricrypto2Mixin);
|
|
209
189
|
}
|
|
@@ -222,7 +202,7 @@ export var getPool = function (poolId) {
|
|
|
222
202
|
if (!poolDummy.isPlain && !poolDummy.isFake) {
|
|
223
203
|
Object.assign(Pool.prototype, swapWrappedExpectedAndApproveMixin);
|
|
224
204
|
Object.assign(Pool.prototype, swapWrappedRequiredMixin);
|
|
225
|
-
if ('exchange
|
|
205
|
+
if (findAbiSignature(curve.contracts[poolDummy.address].abi, 'exchange', 'uint256,uint256,uint256,uint256,bool')) { // tricrypto2 (eth), tricrypto (arbitrum)
|
|
226
206
|
Object.assign(Pool.prototype, swapWrappedTricrypto2Mixin);
|
|
227
207
|
}
|
|
228
208
|
else {
|