@curvefi/api 2.68.33 → 2.68.34
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/README.md +77 -1
- package/lib/interfaces.d.ts +1 -1
- package/lib/pools/PoolTemplate.d.ts +13 -5
- package/lib/pools/PoolTemplate.js +24 -0
- package/lib/pools/mixins/depositMixins.d.ts +13 -7
- package/lib/pools/mixins/depositMixins.js +70 -10
- package/lib/pools/mixins/depositWrappedMixins.d.ts +5 -2
- package/lib/pools/mixins/depositWrappedMixins.js +28 -4
- package/lib/pools/mixins/swapMixins.d.ts +9 -9
- package/lib/pools/mixins/swapWrappedMixins.d.ts +5 -5
- package/lib/pools/mixins/withdrawOneCoinMixins.d.ts +11 -5
- package/lib/pools/mixins/withdrawOneCoinMixins.js +70 -10
- package/lib/pools/mixins/withdrawOneCoinWrappedMixins.d.ts +5 -2
- package/lib/pools/mixins/withdrawOneCoinWrappedMixins.js +28 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -994,13 +994,89 @@ import curve from "@curvefi/api";
|
|
|
994
994
|
- `pool.withdrawOneCoinExpectedBigInt(lpTokenAmount: bigint, coin: string | number): Promise<bigint>`
|
|
995
995
|
- `pool.withdrawOneCoinWrappedExpectedBigInt(lpTokenAmount: bigint, coin: string | number): Promise<bigint>`
|
|
996
996
|
|
|
997
|
-
### Getting
|
|
997
|
+
### Getting method ABI metadata
|
|
998
998
|
```ts
|
|
999
999
|
(async () => {
|
|
1000
1000
|
await curve.init('JsonRpc', {}, { gasPrice: 0, maxFeePerGas: 0, maxPriorityFeePerGas: 0 });
|
|
1001
1001
|
|
|
1002
1002
|
const pool = curve.getPool('mim');
|
|
1003
1003
|
|
|
1004
|
+
// Get exact ABI information for deposit (underlying) without executing the transaction
|
|
1005
|
+
const depositInfo = await pool.abi.deposit();
|
|
1006
|
+
console.log(depositInfo);
|
|
1007
|
+
// {
|
|
1008
|
+
// address: '0xa79828df1850e8a3a3064576f380d90aecdd3359', // Contract address (zap or pool)
|
|
1009
|
+
// method: 'add_liquidity', // Method name
|
|
1010
|
+
// abi: {
|
|
1011
|
+
// type: 'function',
|
|
1012
|
+
// name: 'add_liquidity',
|
|
1013
|
+
// inputs: [
|
|
1014
|
+
// { name: '_pool', type: 'address' },
|
|
1015
|
+
// { name: '_deposit_amounts', type: 'uint256[4]' },
|
|
1016
|
+
// { name: '_min_mint_amount', type: 'uint256' }
|
|
1017
|
+
// ],
|
|
1018
|
+
// outputs: [ { name: '', type: 'uint256' } ],
|
|
1019
|
+
// stateMutability: 'nonpayable'
|
|
1020
|
+
// }
|
|
1021
|
+
// }
|
|
1022
|
+
|
|
1023
|
+
// Get exact ABI information for deposit wrapped without executing the transaction
|
|
1024
|
+
const depositWrappedInfo = await pool.abi.depositWrapped();
|
|
1025
|
+
console.log(depositWrappedInfo);
|
|
1026
|
+
// {
|
|
1027
|
+
// address: '0x5a6a4d54456819380173272a5e8e9b9904bdf41b', // Contract address (pool)
|
|
1028
|
+
// method: 'add_liquidity', // Method name
|
|
1029
|
+
// abi: {
|
|
1030
|
+
// type: 'function',
|
|
1031
|
+
// name: 'add_liquidity',
|
|
1032
|
+
// inputs: [
|
|
1033
|
+
// { name: 'amounts', type: 'uint256[2]' },
|
|
1034
|
+
// { name: 'min_mint_amount', type: 'uint256' }
|
|
1035
|
+
// ],
|
|
1036
|
+
// outputs: [ { name: '', type: 'uint256' } ],
|
|
1037
|
+
// stateMutability: 'nonpayable'
|
|
1038
|
+
// }
|
|
1039
|
+
// }
|
|
1040
|
+
|
|
1041
|
+
// Get exact ABI information for withdrawOneCoin (underlying) without executing the transaction
|
|
1042
|
+
const withdrawOneCoinInfo = await pool.abi.withdrawOneCoin();
|
|
1043
|
+
console.log(withdrawOneCoinInfo);
|
|
1044
|
+
// {
|
|
1045
|
+
// address: '0xa79828df1850e8a3a3064576f380d90aecdd3359', // Contract address (zap or pool)
|
|
1046
|
+
// method: 'remove_liquidity_one_coin', // Method name
|
|
1047
|
+
// abi: {
|
|
1048
|
+
// type: 'function',
|
|
1049
|
+
// name: 'remove_liquidity_one_coin',
|
|
1050
|
+
// inputs: [
|
|
1051
|
+
// { name: '_pool', type: 'address' },
|
|
1052
|
+
// { name: '_burn_amount', type: 'uint256' },
|
|
1053
|
+
// { name: 'i', type: 'int128' },
|
|
1054
|
+
// { name: '_min_amount', type: 'uint256' }
|
|
1055
|
+
// ],
|
|
1056
|
+
// outputs: [ { name: '', type: 'uint256' } ],
|
|
1057
|
+
// stateMutability: 'nonpayable'
|
|
1058
|
+
// }
|
|
1059
|
+
// }
|
|
1060
|
+
|
|
1061
|
+
// Get exact ABI information for withdrawOneCoin wrapped without executing the transaction
|
|
1062
|
+
const withdrawOneCoinWrappedInfo = await pool.abi.withdrawOneCoinWrapped();
|
|
1063
|
+
console.log(withdrawOneCoinWrappedInfo);
|
|
1064
|
+
// {
|
|
1065
|
+
// address: '0x5a6a4d54456819380173272a5e8e9b9904bdf41b', // Contract address (pool)
|
|
1066
|
+
// method: 'remove_liquidity_one_coin', // Method name
|
|
1067
|
+
// abi: {
|
|
1068
|
+
// type: 'function',
|
|
1069
|
+
// name: 'remove_liquidity_one_coin',
|
|
1070
|
+
// inputs: [
|
|
1071
|
+
// { name: '_token_amount', type: 'uint256' },
|
|
1072
|
+
// { name: 'i', type: 'int128' },
|
|
1073
|
+
// { name: '_min_amount', type: 'uint256' }
|
|
1074
|
+
// ],
|
|
1075
|
+
// outputs: [ { name: '', type: 'uint256' } ],
|
|
1076
|
+
// stateMutability: 'nonpayable'
|
|
1077
|
+
// }
|
|
1078
|
+
// }
|
|
1079
|
+
|
|
1004
1080
|
// Get exact ABI information for swap (underlying) without executing the transaction
|
|
1005
1081
|
const swapInfo = await pool.abi.swap();
|
|
1006
1082
|
console.log(swapInfo);
|
package/lib/interfaces.d.ts
CHANGED
|
@@ -349,7 +349,7 @@ export type AbiError = {
|
|
|
349
349
|
name: string;
|
|
350
350
|
};
|
|
351
351
|
export type Abi = (AbiConstructor | AbiError | AbiEvent | AbiFallback | AbiFunction | AbiReceive)[];
|
|
352
|
-
export interface
|
|
352
|
+
export interface IMethodInfo {
|
|
353
353
|
address: string;
|
|
354
354
|
method: string;
|
|
355
355
|
abi: any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
2
|
import memoize from "memoizee";
|
|
3
|
-
import { IDict, IProfit,
|
|
3
|
+
import { IDict, IProfit, IMethodInfo } from '../interfaces';
|
|
4
4
|
import { Curve } from "../curve.js";
|
|
5
5
|
import { CorePool } from "./subClasses/corePool.js";
|
|
6
6
|
import { StatsPool } from "./subClasses/statsPool.js";
|
|
@@ -37,8 +37,12 @@ export declare class PoolTemplate extends CorePool {
|
|
|
37
37
|
swapWrapped: (inputCoin: string | number, outputCoin: string | number, amount: number | string, slippage: number) => Promise<number | number[]>;
|
|
38
38
|
};
|
|
39
39
|
abi: {
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
deposit: () => Promise<IMethodInfo>;
|
|
41
|
+
depositWrapped: () => Promise<IMethodInfo>;
|
|
42
|
+
withdrawOneCoin: () => Promise<IMethodInfo>;
|
|
43
|
+
withdrawOneCoinWrapped: () => Promise<IMethodInfo>;
|
|
44
|
+
swap: () => Promise<IMethodInfo>;
|
|
45
|
+
swapWrapped: () => Promise<IMethodInfo>;
|
|
42
46
|
};
|
|
43
47
|
stats: StatsPool;
|
|
44
48
|
wallet: WalletPool;
|
|
@@ -63,6 +67,7 @@ export declare class PoolTemplate extends CorePool {
|
|
|
63
67
|
depositApprove(amounts: (number | string)[], isMax?: boolean): Promise<string[]>;
|
|
64
68
|
private depositEstimateGas;
|
|
65
69
|
deposit(amounts: (number | string)[], slippage?: number): Promise<string>;
|
|
70
|
+
getDepositInfo(): Promise<IMethodInfo>;
|
|
66
71
|
depositWrappedBalancedAmounts(): Promise<string[]>;
|
|
67
72
|
depositWrappedExpected(amounts: (number | string)[]): Promise<string>;
|
|
68
73
|
depositWrappedExpectedBigInt(amounts: bigint[]): Promise<bigint>;
|
|
@@ -72,6 +77,7 @@ export declare class PoolTemplate extends CorePool {
|
|
|
72
77
|
depositWrappedApprove(amounts: (number | string)[]): Promise<string[]>;
|
|
73
78
|
private depositWrappedEstimateGas;
|
|
74
79
|
depositWrapped(amounts: (number | string)[], slippage?: number): Promise<string>;
|
|
80
|
+
getDepositWrappedInfo(): Promise<IMethodInfo>;
|
|
75
81
|
stakeIsApproved(lpTokenAmount: number | string): Promise<boolean>;
|
|
76
82
|
private stakeApproveEstimateGas;
|
|
77
83
|
stakeApprove(lpTokenAmount: number | string): Promise<string[]>;
|
|
@@ -152,12 +158,14 @@ export declare class PoolTemplate extends CorePool {
|
|
|
152
158
|
withdrawOneCoinApprove(lpTokenAmount: number | string): Promise<string[]>;
|
|
153
159
|
private withdrawOneCoinEstimateGas;
|
|
154
160
|
withdrawOneCoin(lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
161
|
+
getWithdrawOneCoinInfo(): Promise<IMethodInfo>;
|
|
155
162
|
_withdrawOneCoinWrappedExpected(_lpTokenAmount: bigint, i: number): Promise<bigint>;
|
|
156
163
|
withdrawOneCoinWrappedExpected(lpTokenAmount: number | string, coin: string | number): Promise<string>;
|
|
157
164
|
withdrawOneCoinWrappedExpectedBigInt(lpTokenAmount: bigint, coin: string | number): Promise<bigint>;
|
|
158
165
|
withdrawOneCoinWrappedBonus(lpTokenAmount: number | string, coin: string | number): Promise<string>;
|
|
159
166
|
private withdrawOneCoinWrappedEstimateGas;
|
|
160
167
|
withdrawOneCoinWrapped(lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
168
|
+
getWithdrawOneCoinWrappedInfo(): Promise<IMethodInfo>;
|
|
161
169
|
private _userLpTotalBalance;
|
|
162
170
|
userBalances(address?: string): Promise<string[]>;
|
|
163
171
|
userWrappedBalances(address?: string): Promise<string[]>;
|
|
@@ -189,7 +197,7 @@ export declare class PoolTemplate extends CorePool {
|
|
|
189
197
|
swapApprove(inputCoin: string | number, amount: number | string): Promise<string[]>;
|
|
190
198
|
private swapEstimateGas;
|
|
191
199
|
swap(inputCoin: string | number, outputCoin: string | number, amount: number | string, slippage?: number): Promise<string>;
|
|
192
|
-
getSwapInfo(): Promise<
|
|
200
|
+
getSwapInfo(): Promise<IMethodInfo>;
|
|
193
201
|
_swapWrappedExpected(i: number, j: number, _amount: bigint): Promise<bigint>;
|
|
194
202
|
swapWrappedExpected(inputCoin: string | number, outputCoin: string | number, amount: number | string): Promise<string>;
|
|
195
203
|
swapWrappedExpectedBigInt(inputCoin: string | number, outputCoin: string | number, amount: bigint): Promise<bigint>;
|
|
@@ -199,7 +207,7 @@ export declare class PoolTemplate extends CorePool {
|
|
|
199
207
|
swapWrappedApprove(inputCoin: string | number, amount: number | string): Promise<string[]>;
|
|
200
208
|
private swapWrappedEstimateGas;
|
|
201
209
|
swapWrapped(inputCoin: string | number, outputCoin: string | number, amount: number | string, slippage?: number): Promise<string>;
|
|
202
|
-
getSwapWrappedInfo(): Promise<
|
|
210
|
+
getSwapWrappedInfo(): Promise<IMethodInfo>;
|
|
203
211
|
gaugeOptimalDeposits: (...accounts: string[]) => Promise<IDict<string>>;
|
|
204
212
|
_getCoinIdx: (coin: string | number, useUnderlying?: boolean) => number;
|
|
205
213
|
_getRates: () => Promise<bigint[]>;
|
|
@@ -575,6 +575,10 @@ export class PoolTemplate extends CorePool {
|
|
|
575
575
|
swapWrapped: this.swapWrappedEstimateGas.bind(this),
|
|
576
576
|
};
|
|
577
577
|
this.abi = {
|
|
578
|
+
deposit: this.getDepositInfo.bind(this),
|
|
579
|
+
depositWrapped: this.getDepositWrappedInfo.bind(this),
|
|
580
|
+
withdrawOneCoin: this.getWithdrawOneCoinInfo.bind(this),
|
|
581
|
+
withdrawOneCoinWrapped: this.getWithdrawOneCoinWrappedInfo.bind(this),
|
|
578
582
|
swap: this.getSwapInfo.bind(this),
|
|
579
583
|
swapWrapped: this.getSwapWrappedInfo.bind(this),
|
|
580
584
|
};
|
|
@@ -794,6 +798,11 @@ export class PoolTemplate extends CorePool {
|
|
|
794
798
|
throw Error(`deposit method doesn't exist for pool ${this.name} (id: ${this.name})`);
|
|
795
799
|
});
|
|
796
800
|
}
|
|
801
|
+
getDepositInfo() {
|
|
802
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
803
|
+
throw Error(`getDepositInfo method doesn't exist for pool ${this.name} (id: ${this.id})`);
|
|
804
|
+
});
|
|
805
|
+
}
|
|
797
806
|
// ---------------- DEPOSIT WRAPPED ----------------
|
|
798
807
|
depositWrappedBalancedAmounts() {
|
|
799
808
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -863,6 +872,11 @@ export class PoolTemplate extends CorePool {
|
|
|
863
872
|
throw Error(`depositWrapped method doesn't exist for pool ${this.name} (id: ${this.name})`);
|
|
864
873
|
});
|
|
865
874
|
}
|
|
875
|
+
getDepositWrappedInfo() {
|
|
876
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
877
|
+
throw Error(`getDepositWrappedInfo method doesn't exist for pool ${this.name} (id: ${this.id})`);
|
|
878
|
+
});
|
|
879
|
+
}
|
|
866
880
|
// ---------------- STAKING ----------------
|
|
867
881
|
stakeIsApproved(lpTokenAmount) {
|
|
868
882
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1580,6 +1594,11 @@ export class PoolTemplate extends CorePool {
|
|
|
1580
1594
|
throw Error(`withdrawOneCoin method doesn't exist for pool ${this.name} (id: ${this.name})`);
|
|
1581
1595
|
});
|
|
1582
1596
|
}
|
|
1597
|
+
getWithdrawOneCoinInfo() {
|
|
1598
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1599
|
+
throw Error(`getWithdrawOneCoinInfo method doesn't exist for pool ${this.name} (id: ${this.id})`);
|
|
1600
|
+
});
|
|
1601
|
+
}
|
|
1583
1602
|
// ---------------- WITHDRAW ONE COIN WRAPPED ----------------
|
|
1584
1603
|
// OVERRIDE
|
|
1585
1604
|
_withdrawOneCoinWrappedExpected(_lpTokenAmount, i) {
|
|
@@ -1624,6 +1643,11 @@ export class PoolTemplate extends CorePool {
|
|
|
1624
1643
|
throw Error(`withdrawOneCoinWrapped method doesn't exist for pool ${this.name} (id: ${this.name})`);
|
|
1625
1644
|
});
|
|
1626
1645
|
}
|
|
1646
|
+
getWithdrawOneCoinWrappedInfo() {
|
|
1647
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1648
|
+
throw Error(`getWithdrawOneCoinWrappedInfo method doesn't exist for pool ${this.name} (id: ${this.id})`);
|
|
1649
|
+
});
|
|
1650
|
+
}
|
|
1627
1651
|
// ---------------- USER BALANCES, BASE PROFIT AND SHARE ----------------
|
|
1628
1652
|
_userLpTotalBalance(address) {
|
|
1629
1653
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
import { PoolTemplate } from "../PoolTemplate.js";
|
|
2
|
+
import { IMethodInfo } from "../../interfaces.js";
|
|
2
3
|
export declare const depositMetaFactoryMixin: {
|
|
3
|
-
_deposit(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
4
|
-
depositEstimateGas(this: PoolTemplate, amounts: (number | string)[]): Promise<
|
|
5
|
-
deposit(this: PoolTemplate, amounts: (number | string)[], slippage?: number): Promise<string
|
|
4
|
+
_deposit(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
5
|
+
depositEstimateGas(this: PoolTemplate, amounts: (number | string)[]): Promise<number>;
|
|
6
|
+
deposit(this: PoolTemplate, amounts: (number | string)[], slippage?: number): Promise<string>;
|
|
7
|
+
getDepositInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
6
8
|
};
|
|
7
9
|
export declare const depositCryptoMetaFactoryMixin: {
|
|
8
|
-
_deposit(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
10
|
+
_deposit(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
9
11
|
depositEstimateGas(this: PoolTemplate, amounts: (number | string)[]): Promise<number | number[]>;
|
|
10
12
|
deposit(this: PoolTemplate, amounts: (number | string)[], slippage?: number): Promise<string>;
|
|
13
|
+
getDepositInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
11
14
|
};
|
|
12
15
|
export declare const depositZapMixin: {
|
|
13
|
-
_deposit(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
16
|
+
_deposit(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
14
17
|
depositEstimateGas(this: PoolTemplate, amounts: (number | string)[]): Promise<number | number[]>;
|
|
15
18
|
deposit(this: PoolTemplate, amounts: (number | string)[], slippage?: number): Promise<string>;
|
|
19
|
+
getDepositInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
16
20
|
};
|
|
17
21
|
export declare const depositLendingOrCryptoMixin: {
|
|
18
|
-
_deposit(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
22
|
+
_deposit(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
19
23
|
depositEstimateGas(this: PoolTemplate, amounts: (number | string)[]): Promise<number | number[]>;
|
|
20
24
|
deposit(this: PoolTemplate, amounts: (number | string)[], slippage?: number): Promise<string>;
|
|
25
|
+
getDepositInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
21
26
|
};
|
|
22
27
|
export declare const depositPlainMixin: {
|
|
23
|
-
_deposit(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
28
|
+
_deposit(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
24
29
|
depositEstimateGas(this: PoolTemplate, amounts: (number | string)[]): Promise<number | number[]>;
|
|
25
30
|
deposit(this: PoolTemplate, amounts: (number | string)[], slippage?: number): Promise<string>;
|
|
31
|
+
getDepositInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
26
32
|
};
|
|
@@ -36,13 +36,20 @@ function _depositMinAmount(_amounts_1) {
|
|
|
36
36
|
}
|
|
37
37
|
export const depositMetaFactoryMixin = {
|
|
38
38
|
_deposit(_amounts_1, slippage_1) {
|
|
39
|
-
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false) {
|
|
39
|
+
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false, getInfo = false) {
|
|
40
|
+
const contract = this.curve.contracts[this.zap].contract;
|
|
41
|
+
if (getInfo) {
|
|
42
|
+
return {
|
|
43
|
+
address: this.zap,
|
|
44
|
+
method: 'add_liquidity',
|
|
45
|
+
abi: contract.add_liquidity.fragment,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
40
48
|
if (!estimateGas)
|
|
41
49
|
yield _ensureAllowance.call(this.curve, this.underlyingCoinAddresses, _amounts, this.zap);
|
|
42
50
|
const _minMintAmount = yield _depositMinAmount.call(this, _amounts, slippage);
|
|
43
51
|
const ethIndex = this.curve.getEthIndex(this.underlyingCoinAddresses);
|
|
44
52
|
const value = _amounts[ethIndex] || parseUnits("0");
|
|
45
|
-
const contract = this.curve.contracts[this.zap].contract;
|
|
46
53
|
const gas = yield contract.add_liquidity.estimateGas(this.address, _amounts, _minMintAmount, Object.assign(Object.assign({}, this.curve.constantOptions), { value }));
|
|
47
54
|
if (estimateGas)
|
|
48
55
|
return smartNumber(gas);
|
|
@@ -62,16 +69,28 @@ export const depositMetaFactoryMixin = {
|
|
|
62
69
|
return yield depositMetaFactoryMixin._deposit.call(this, _amounts, slippage);
|
|
63
70
|
});
|
|
64
71
|
},
|
|
72
|
+
getDepositInfo() {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
return yield depositMetaFactoryMixin._deposit.call(this, [], 0, false, true);
|
|
75
|
+
});
|
|
76
|
+
},
|
|
65
77
|
};
|
|
66
78
|
export const depositCryptoMetaFactoryMixin = {
|
|
67
79
|
_deposit(_amounts_1, slippage_1) {
|
|
68
|
-
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false) {
|
|
80
|
+
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false, getInfo = false) {
|
|
81
|
+
const contract = this.curve.contracts[this.zap].contract;
|
|
82
|
+
if (getInfo) {
|
|
83
|
+
return {
|
|
84
|
+
address: this.zap,
|
|
85
|
+
method: 'add_liquidity',
|
|
86
|
+
abi: contract.add_liquidity.fragment,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
69
89
|
if (!estimateGas)
|
|
70
90
|
yield _ensureAllowance.call(this.curve, this.underlyingCoinAddresses, _amounts, this.zap);
|
|
71
91
|
const _minMintAmount = yield _depositMinAmount.call(this, _amounts, slippage);
|
|
72
92
|
const ethIndex = this.curve.getEthIndex(this.underlyingCoinAddresses);
|
|
73
93
|
const value = _amounts[ethIndex] || this.curve.parseUnits("0");
|
|
74
|
-
const contract = this.curve.contracts[this.zap].contract;
|
|
75
94
|
const gas = yield contract.add_liquidity.estimateGas(this.address, _amounts, _minMintAmount, true, Object.assign(Object.assign({}, this.curve.constantOptions), { value }));
|
|
76
95
|
if (estimateGas)
|
|
77
96
|
return smartNumber(gas);
|
|
@@ -91,16 +110,28 @@ export const depositCryptoMetaFactoryMixin = {
|
|
|
91
110
|
return yield depositCryptoMetaFactoryMixin._deposit.call(this, _amounts, slippage);
|
|
92
111
|
});
|
|
93
112
|
},
|
|
113
|
+
getDepositInfo() {
|
|
114
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
return yield depositCryptoMetaFactoryMixin._deposit.call(this, [], 0, false, true);
|
|
116
|
+
});
|
|
117
|
+
},
|
|
94
118
|
};
|
|
95
119
|
export const depositZapMixin = {
|
|
96
120
|
_deposit(_amounts_1, slippage_1) {
|
|
97
|
-
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false) {
|
|
121
|
+
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false, getInfo = false) {
|
|
122
|
+
const contract = this.curve.contracts[this.zap].contract;
|
|
123
|
+
if (getInfo) {
|
|
124
|
+
return {
|
|
125
|
+
address: this.zap,
|
|
126
|
+
method: 'add_liquidity',
|
|
127
|
+
abi: contract.add_liquidity.fragment,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
98
130
|
if (!estimateGas)
|
|
99
131
|
yield _ensureAllowance.call(this.curve, this.underlyingCoinAddresses, _amounts, this.zap);
|
|
100
132
|
const _minMintAmount = yield _depositMinAmount.call(this, _amounts, slippage);
|
|
101
133
|
const ethIndex = this.curve.getEthIndex(this.underlyingCoinAddresses);
|
|
102
134
|
const value = _amounts[ethIndex] || this.curve.parseUnits("0");
|
|
103
|
-
const contract = this.curve.contracts[this.zap].contract;
|
|
104
135
|
const args = [_amounts, _minMintAmount];
|
|
105
136
|
if (`add_liquidity(uint256[${this.underlyingCoinAddresses.length}],uint256,bool)` in contract)
|
|
106
137
|
args.push(true);
|
|
@@ -123,16 +154,28 @@ export const depositZapMixin = {
|
|
|
123
154
|
return yield depositZapMixin._deposit.call(this, _amounts, slippage);
|
|
124
155
|
});
|
|
125
156
|
},
|
|
157
|
+
getDepositInfo() {
|
|
158
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
159
|
+
return yield depositZapMixin._deposit.call(this, [], 0, false, true);
|
|
160
|
+
});
|
|
161
|
+
},
|
|
126
162
|
};
|
|
127
163
|
export const depositLendingOrCryptoMixin = {
|
|
128
164
|
_deposit(_amounts_1, slippage_1) {
|
|
129
|
-
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false) {
|
|
165
|
+
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false, getInfo = false) {
|
|
166
|
+
const contract = this.curve.contracts[this.address].contract;
|
|
167
|
+
if (getInfo) {
|
|
168
|
+
return {
|
|
169
|
+
address: this.address,
|
|
170
|
+
method: 'add_liquidity',
|
|
171
|
+
abi: contract.add_liquidity.fragment,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
130
174
|
if (!estimateGas)
|
|
131
175
|
yield _ensureAllowance.call(this.curve, this.underlyingCoinAddresses, _amounts, this.address);
|
|
132
176
|
const _minMintAmount = yield _depositMinAmount.call(this, _amounts, slippage);
|
|
133
177
|
const ethIndex = this.curve.getEthIndex(this.underlyingCoinAddresses);
|
|
134
178
|
const value = _amounts[ethIndex] || this.curve.parseUnits("0");
|
|
135
|
-
const contract = this.curve.contracts[this.address].contract;
|
|
136
179
|
const gas = yield contract.add_liquidity.estimateGas(_amounts, _minMintAmount, true, Object.assign(Object.assign({}, this.curve.constantOptions), { value }));
|
|
137
180
|
if (estimateGas)
|
|
138
181
|
return smartNumber(gas);
|
|
@@ -152,16 +195,28 @@ export const depositLendingOrCryptoMixin = {
|
|
|
152
195
|
return yield depositLendingOrCryptoMixin._deposit.call(this, _amounts, slippage);
|
|
153
196
|
});
|
|
154
197
|
},
|
|
198
|
+
getDepositInfo() {
|
|
199
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
200
|
+
return yield depositLendingOrCryptoMixin._deposit.call(this, [], 0, false, true);
|
|
201
|
+
});
|
|
202
|
+
},
|
|
155
203
|
};
|
|
156
204
|
export const depositPlainMixin = {
|
|
157
205
|
_deposit(_amounts_1, slippage_1) {
|
|
158
|
-
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false) {
|
|
206
|
+
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false, getInfo = false) {
|
|
207
|
+
const contract = this.curve.contracts[this.address].contract;
|
|
208
|
+
if (getInfo) {
|
|
209
|
+
return {
|
|
210
|
+
address: this.address,
|
|
211
|
+
method: 'add_liquidity',
|
|
212
|
+
abi: contract.add_liquidity.fragment,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
159
215
|
if (!estimateGas)
|
|
160
216
|
yield _ensureAllowance.call(this.curve, this.wrappedCoinAddresses, _amounts, this.address);
|
|
161
217
|
const _minMintAmount = yield _depositMinAmount.call(this, _amounts, slippage);
|
|
162
218
|
const ethIndex = this.curve.getEthIndex(this.wrappedCoinAddresses);
|
|
163
219
|
const value = _amounts[ethIndex] || this.curve.parseUnits("0");
|
|
164
|
-
const contract = this.curve.contracts[this.address].contract;
|
|
165
220
|
const gas = yield contract.add_liquidity.estimateGas(_amounts, _minMintAmount, Object.assign(Object.assign({}, this.curve.constantOptions), { value }));
|
|
166
221
|
if (estimateGas)
|
|
167
222
|
return smartNumber(gas);
|
|
@@ -181,4 +236,9 @@ export const depositPlainMixin = {
|
|
|
181
236
|
return yield depositPlainMixin._deposit.call(this, _amounts, slippage);
|
|
182
237
|
});
|
|
183
238
|
},
|
|
239
|
+
getDepositInfo() {
|
|
240
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
241
|
+
return yield depositPlainMixin._deposit.call(this, [], 0, false, true);
|
|
242
|
+
});
|
|
243
|
+
},
|
|
184
244
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { PoolTemplate } from "../PoolTemplate.js";
|
|
2
|
+
import { IMethodInfo } from "../../interfaces.js";
|
|
2
3
|
export declare const depositWrapped2argsMixin: {
|
|
3
|
-
_depositWrapped(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
4
|
+
_depositWrapped(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
4
5
|
depositWrappedEstimateGas(this: PoolTemplate, amounts: (number | string)[]): Promise<number>;
|
|
5
6
|
depositWrapped(this: PoolTemplate, amounts: (number | string)[], slippage?: number): Promise<string>;
|
|
7
|
+
getDepositWrappedInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
6
8
|
};
|
|
7
9
|
export declare const depositWrapped3argsMixin: {
|
|
8
|
-
_depositWrapped(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
10
|
+
_depositWrapped(this: PoolTemplate, _amounts: bigint[], slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
9
11
|
depositWrappedEstimateGas(this: PoolTemplate, amounts: (number | string)[]): Promise<number>;
|
|
10
12
|
depositWrapped(this: PoolTemplate, amounts: (number | string)[], slippage?: number): Promise<string>;
|
|
13
|
+
getDepositWrappedInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
11
14
|
};
|
|
@@ -39,13 +39,20 @@ function _depositWrappedMinAmount(_amounts_1) {
|
|
|
39
39
|
}
|
|
40
40
|
export const depositWrapped2argsMixin = {
|
|
41
41
|
_depositWrapped(_amounts_1, slippage_1) {
|
|
42
|
-
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false) {
|
|
42
|
+
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false, getInfo = false) {
|
|
43
|
+
const contract = this.curve.contracts[this.address].contract;
|
|
44
|
+
if (getInfo) {
|
|
45
|
+
return {
|
|
46
|
+
address: this.address,
|
|
47
|
+
method: 'add_liquidity',
|
|
48
|
+
abi: contract.add_liquidity.fragment,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
43
51
|
if (!estimateGas)
|
|
44
52
|
yield _ensureAllowance.call(this.curve, this.wrappedCoinAddresses, _amounts, this.address);
|
|
45
53
|
const _minMintAmount = yield _depositWrappedMinAmount.call(this, _amounts, slippage);
|
|
46
54
|
const ethIndex = this.curve.getEthIndex(this.wrappedCoinAddresses);
|
|
47
55
|
const value = _amounts[ethIndex] || this.curve.parseUnits("0");
|
|
48
|
-
const contract = this.curve.contracts[this.address].contract;
|
|
49
56
|
const gas = yield contract.add_liquidity.estimateGas(_amounts, _minMintAmount, Object.assign(Object.assign({}, this.curve.constantOptions), { value }));
|
|
50
57
|
if (estimateGas)
|
|
51
58
|
return smartNumber(gas);
|
|
@@ -65,16 +72,28 @@ export const depositWrapped2argsMixin = {
|
|
|
65
72
|
return yield depositWrapped2argsMixin._depositWrapped.call(this, _amounts, slippage);
|
|
66
73
|
});
|
|
67
74
|
},
|
|
75
|
+
getDepositWrappedInfo() {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
return yield depositWrapped2argsMixin._depositWrapped.call(this, [], 0, false, true);
|
|
78
|
+
});
|
|
79
|
+
},
|
|
68
80
|
};
|
|
69
81
|
export const depositWrapped3argsMixin = {
|
|
70
82
|
_depositWrapped(_amounts_1, slippage_1) {
|
|
71
|
-
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false) {
|
|
83
|
+
return __awaiter(this, arguments, void 0, function* (_amounts, slippage, estimateGas = false, getInfo = false) {
|
|
84
|
+
const contract = this.curve.contracts[this.address].contract;
|
|
85
|
+
if (getInfo) {
|
|
86
|
+
return {
|
|
87
|
+
address: this.address,
|
|
88
|
+
method: 'add_liquidity',
|
|
89
|
+
abi: contract.add_liquidity.fragment,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
72
92
|
if (!estimateGas)
|
|
73
93
|
yield _ensureAllowance.call(this.curve, this.wrappedCoinAddresses, _amounts, this.address);
|
|
74
94
|
const _minMintAmount = yield _depositWrappedMinAmount.call(this, _amounts, slippage);
|
|
75
95
|
const ethIndex = this.curve.getEthIndex(this.wrappedCoinAddresses);
|
|
76
96
|
const value = _amounts[ethIndex] || this.curve.parseUnits("0");
|
|
77
|
-
const contract = this.curve.contracts[this.address].contract;
|
|
78
97
|
const gas = yield contract.add_liquidity.estimateGas(_amounts, _minMintAmount, false, Object.assign(Object.assign({}, this.curve.constantOptions), { value }));
|
|
79
98
|
if (estimateGas)
|
|
80
99
|
return smartNumber(gas);
|
|
@@ -94,4 +113,9 @@ export const depositWrapped3argsMixin = {
|
|
|
94
113
|
return yield depositWrapped3argsMixin._depositWrapped.call(this, _amounts, slippage);
|
|
95
114
|
});
|
|
96
115
|
},
|
|
116
|
+
getDepositWrappedInfo() {
|
|
117
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
return yield depositWrapped3argsMixin._depositWrapped.call(this, [], 0, false, true);
|
|
119
|
+
});
|
|
120
|
+
},
|
|
97
121
|
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { PoolTemplate } from "../PoolTemplate.js";
|
|
2
|
-
import {
|
|
2
|
+
import { IMethodInfo } from "../../interfaces.js";
|
|
3
3
|
export declare const swapTricrypto2Mixin: {
|
|
4
|
-
_swap(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] |
|
|
4
|
+
_swap(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
5
5
|
swapEstimateGas(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string): Promise<number>;
|
|
6
6
|
swap(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string, slippage?: number): Promise<string>;
|
|
7
|
-
getSwapInfo(this: PoolTemplate): Promise<
|
|
7
|
+
getSwapInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
8
8
|
};
|
|
9
9
|
export declare const swapMetaFactoryMixin: {
|
|
10
|
-
_swap(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] |
|
|
10
|
+
_swap(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
11
11
|
swapEstimateGas(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string): Promise<number>;
|
|
12
12
|
swap(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string, slippage?: number): Promise<string>;
|
|
13
|
-
getSwapInfo(this: PoolTemplate): Promise<
|
|
13
|
+
getSwapInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
14
14
|
};
|
|
15
15
|
export declare const swapCryptoMetaFactoryMixin: {
|
|
16
|
-
_swap(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] |
|
|
16
|
+
_swap(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
17
17
|
swapEstimateGas(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string): Promise<number>;
|
|
18
18
|
swap(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string, slippage?: number): Promise<string>;
|
|
19
|
-
getSwapInfo(this: PoolTemplate): Promise<
|
|
19
|
+
getSwapInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
20
20
|
};
|
|
21
21
|
export declare const swapMixin: {
|
|
22
|
-
_swap(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] |
|
|
22
|
+
_swap(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
23
23
|
swapEstimateGas(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string): Promise<number>;
|
|
24
24
|
swap(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string, slippage?: number): Promise<string>;
|
|
25
|
-
getSwapInfo(this: PoolTemplate): Promise<
|
|
25
|
+
getSwapInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
26
26
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { PoolTemplate } from "../PoolTemplate.js";
|
|
2
|
-
import {
|
|
2
|
+
import { IMethodInfo } from "../../interfaces.js";
|
|
3
3
|
export declare const swapWrappedTricrypto2Mixin: {
|
|
4
|
-
_swapWrapped(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] |
|
|
4
|
+
_swapWrapped(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
5
5
|
swapWrappedEstimateGas(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string): Promise<number>;
|
|
6
6
|
swapWrapped(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string, slippage?: number): Promise<string>;
|
|
7
|
-
getSwapWrappedInfo(this: PoolTemplate): Promise<
|
|
7
|
+
getSwapWrappedInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
8
8
|
};
|
|
9
9
|
export declare const swapWrappedMixin: {
|
|
10
|
-
_swapWrapped(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] |
|
|
10
|
+
_swapWrapped(this: PoolTemplate, i: number, j: number, _amount: bigint, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
11
11
|
swapWrappedEstimateGas(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string): Promise<number>;
|
|
12
12
|
swapWrapped(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string, slippage?: number): Promise<string>;
|
|
13
|
-
getSwapWrappedInfo(this: PoolTemplate): Promise<
|
|
13
|
+
getSwapWrappedInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
14
14
|
};
|
|
15
15
|
export declare const swapWrappedExpectedAndApproveMixin: {
|
|
16
16
|
swapWrappedExpected(this: PoolTemplate, inputCoin: string | number, outputCoin: string | number, amount: number | string): Promise<string>;
|
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
import { PoolTemplate } from "../PoolTemplate.js";
|
|
2
|
+
import { IMethodInfo } from "../../interfaces.js";
|
|
2
3
|
export declare const withdrawOneCoinMetaFactoryMixin: {
|
|
3
|
-
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
4
|
+
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
4
5
|
withdrawOneCoinEstimateGas(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number): Promise<number | number[]>;
|
|
5
6
|
withdrawOneCoin(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
7
|
+
getWithdrawOneCoinInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
6
8
|
};
|
|
7
9
|
export declare const withdrawOneCoinCryptoMetaFactoryMixin: {
|
|
8
|
-
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
10
|
+
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
9
11
|
withdrawOneCoinEstimateGas(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number): Promise<number | number[]>;
|
|
10
12
|
withdrawOneCoin(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
13
|
+
getWithdrawOneCoinInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
11
14
|
};
|
|
12
15
|
export declare const withdrawOneCoinZapMixin: {
|
|
13
|
-
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
16
|
+
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
14
17
|
withdrawOneCoinEstimateGas(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number): Promise<number | number[]>;
|
|
15
18
|
withdrawOneCoin(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
19
|
+
getWithdrawOneCoinInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
16
20
|
};
|
|
17
21
|
export declare const withdrawOneCoinLendingOrCryptoMixin: {
|
|
18
|
-
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
22
|
+
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
19
23
|
withdrawOneCoinEstimateGas(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number): Promise<number | number[]>;
|
|
20
24
|
withdrawOneCoin(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
25
|
+
getWithdrawOneCoinInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
21
26
|
};
|
|
22
27
|
export declare const withdrawOneCoinPlainMixin: {
|
|
23
|
-
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
28
|
+
_withdrawOneCoin(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
24
29
|
withdrawOneCoinEstimateGas(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number): Promise<number | number[]>;
|
|
25
30
|
withdrawOneCoin(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
31
|
+
getWithdrawOneCoinInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
26
32
|
};
|
|
@@ -33,11 +33,18 @@ function _withdrawOneCoinMinAmount(_lpTokenAmount_1, i_1) {
|
|
|
33
33
|
}
|
|
34
34
|
export const withdrawOneCoinMetaFactoryMixin = {
|
|
35
35
|
_withdrawOneCoin(_lpTokenAmount_1, i_1, slippage_1) {
|
|
36
|
-
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false) {
|
|
36
|
+
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false, getInfo = false) {
|
|
37
|
+
const contract = this.curve.contracts[this.zap].contract;
|
|
38
|
+
if (getInfo) {
|
|
39
|
+
return {
|
|
40
|
+
address: this.zap,
|
|
41
|
+
method: 'remove_liquidity_one_coin',
|
|
42
|
+
abi: contract.remove_liquidity_one_coin.fragment,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
37
45
|
if (!estimateGas)
|
|
38
46
|
yield _ensureAllowance.bind(this.curve, [this.lpToken], [_lpTokenAmount], this.zap);
|
|
39
47
|
const _minAmount = yield _withdrawOneCoinMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
40
|
-
const contract = this.curve.contracts[this.zap].contract;
|
|
41
48
|
const gas = yield contract.remove_liquidity_one_coin.estimateGas(this.address, _lpTokenAmount, i, _minAmount, this.curve.constantOptions);
|
|
42
49
|
if (estimateGas)
|
|
43
50
|
return smartNumber(gas);
|
|
@@ -57,14 +64,26 @@ export const withdrawOneCoinMetaFactoryMixin = {
|
|
|
57
64
|
return yield withdrawOneCoinMetaFactoryMixin._withdrawOneCoin.call(this, _lpTokenAmount, i, slippage);
|
|
58
65
|
});
|
|
59
66
|
},
|
|
67
|
+
getWithdrawOneCoinInfo() {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
return yield withdrawOneCoinMetaFactoryMixin._withdrawOneCoin.call(this, BigInt(0), 0, 0, false, true);
|
|
70
|
+
});
|
|
71
|
+
},
|
|
60
72
|
};
|
|
61
73
|
export const withdrawOneCoinCryptoMetaFactoryMixin = {
|
|
62
74
|
_withdrawOneCoin(_lpTokenAmount_1, i_1, slippage_1) {
|
|
63
|
-
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false) {
|
|
75
|
+
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false, getInfo = false) {
|
|
76
|
+
const contract = this.curve.contracts[this.zap].contract;
|
|
77
|
+
if (getInfo) {
|
|
78
|
+
return {
|
|
79
|
+
address: this.zap,
|
|
80
|
+
method: 'remove_liquidity_one_coin',
|
|
81
|
+
abi: contract.remove_liquidity_one_coin.fragment,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
64
84
|
if (!estimateGas)
|
|
65
85
|
yield _ensureAllowance.bind(this.curve, [this.lpToken], [_lpTokenAmount], this.zap);
|
|
66
86
|
const _minAmount = yield _withdrawOneCoinMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
67
|
-
const contract = this.curve.contracts[this.zap].contract;
|
|
68
87
|
const gas = yield contract.remove_liquidity_one_coin.estimateGas(this.address, _lpTokenAmount, i, _minAmount, true, this.curve.constantOptions);
|
|
69
88
|
if (estimateGas)
|
|
70
89
|
return smartNumber(gas);
|
|
@@ -84,14 +103,26 @@ export const withdrawOneCoinCryptoMetaFactoryMixin = {
|
|
|
84
103
|
return yield withdrawOneCoinCryptoMetaFactoryMixin._withdrawOneCoin.call(this, _lpTokenAmount, i, slippage);
|
|
85
104
|
});
|
|
86
105
|
},
|
|
106
|
+
getWithdrawOneCoinInfo() {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
return yield withdrawOneCoinCryptoMetaFactoryMixin._withdrawOneCoin.call(this, BigInt(0), 0, 0, false, true);
|
|
109
|
+
});
|
|
110
|
+
},
|
|
87
111
|
};
|
|
88
112
|
export const withdrawOneCoinZapMixin = {
|
|
89
113
|
_withdrawOneCoin(_lpTokenAmount_1, i_1, slippage_1) {
|
|
90
|
-
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false) {
|
|
114
|
+
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false, getInfo = false) {
|
|
115
|
+
const contract = this.curve.contracts[this.zap].contract;
|
|
116
|
+
if (getInfo) {
|
|
117
|
+
return {
|
|
118
|
+
address: this.zap,
|
|
119
|
+
method: 'remove_liquidity_one_coin',
|
|
120
|
+
abi: contract.remove_liquidity_one_coin.fragment,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
91
123
|
if (!estimateGas)
|
|
92
124
|
yield _ensureAllowance.bind(this.curve, [this.lpToken], [_lpTokenAmount], this.zap);
|
|
93
125
|
const _minAmount = yield _withdrawOneCoinMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
94
|
-
const contract = this.curve.contracts[this.zap].contract;
|
|
95
126
|
const args = [_lpTokenAmount, i, _minAmount];
|
|
96
127
|
if (`remove_liquidity_one_coin(uint256,uint256,uint256,bool)` in contract)
|
|
97
128
|
args.push(true);
|
|
@@ -114,12 +145,24 @@ export const withdrawOneCoinZapMixin = {
|
|
|
114
145
|
return yield withdrawOneCoinZapMixin._withdrawOneCoin.call(this, _lpTokenAmount, i, slippage);
|
|
115
146
|
});
|
|
116
147
|
},
|
|
148
|
+
getWithdrawOneCoinInfo() {
|
|
149
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
150
|
+
return yield withdrawOneCoinZapMixin._withdrawOneCoin.call(this, BigInt(0), 0, 0, false, true);
|
|
151
|
+
});
|
|
152
|
+
},
|
|
117
153
|
};
|
|
118
154
|
export const withdrawOneCoinLendingOrCryptoMixin = {
|
|
119
155
|
_withdrawOneCoin(_lpTokenAmount_1, i_1, slippage_1) {
|
|
120
|
-
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false) {
|
|
121
|
-
const _minAmount = yield _withdrawOneCoinMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
156
|
+
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false, getInfo = false) {
|
|
122
157
|
const contract = this.curve.contracts[this.address].contract;
|
|
158
|
+
if (getInfo) {
|
|
159
|
+
return {
|
|
160
|
+
address: this.address,
|
|
161
|
+
method: 'remove_liquidity_one_coin',
|
|
162
|
+
abi: contract.remove_liquidity_one_coin.fragment,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const _minAmount = yield _withdrawOneCoinMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
123
166
|
const gas = yield contract.remove_liquidity_one_coin.estimateGas(_lpTokenAmount, i, _minAmount, true, this.curve.constantOptions);
|
|
124
167
|
if (estimateGas)
|
|
125
168
|
return smartNumber(gas);
|
|
@@ -139,12 +182,24 @@ export const withdrawOneCoinLendingOrCryptoMixin = {
|
|
|
139
182
|
return yield withdrawOneCoinLendingOrCryptoMixin._withdrawOneCoin.call(this, _lpTokenAmount, i, slippage);
|
|
140
183
|
});
|
|
141
184
|
},
|
|
185
|
+
getWithdrawOneCoinInfo() {
|
|
186
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
187
|
+
return yield withdrawOneCoinLendingOrCryptoMixin._withdrawOneCoin.call(this, BigInt(0), 0, 0, false, true);
|
|
188
|
+
});
|
|
189
|
+
},
|
|
142
190
|
};
|
|
143
191
|
export const withdrawOneCoinPlainMixin = {
|
|
144
192
|
_withdrawOneCoin(_lpTokenAmount_1, i_1, slippage_1) {
|
|
145
|
-
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false) {
|
|
146
|
-
const _minAmount = yield _withdrawOneCoinMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
193
|
+
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false, getInfo = false) {
|
|
147
194
|
const contract = this.curve.contracts[this.address].contract;
|
|
195
|
+
if (getInfo) {
|
|
196
|
+
return {
|
|
197
|
+
address: this.address,
|
|
198
|
+
method: 'remove_liquidity_one_coin',
|
|
199
|
+
abi: contract.remove_liquidity_one_coin.fragment,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
const _minAmount = yield _withdrawOneCoinMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
148
203
|
const gas = yield contract.remove_liquidity_one_coin.estimateGas(_lpTokenAmount, i, _minAmount, this.curve.constantOptions);
|
|
149
204
|
if (estimateGas)
|
|
150
205
|
return smartNumber(gas);
|
|
@@ -164,4 +219,9 @@ export const withdrawOneCoinPlainMixin = {
|
|
|
164
219
|
return yield withdrawOneCoinPlainMixin._withdrawOneCoin.call(this, _lpTokenAmount, i, slippage);
|
|
165
220
|
});
|
|
166
221
|
},
|
|
222
|
+
getWithdrawOneCoinInfo() {
|
|
223
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
224
|
+
return yield withdrawOneCoinPlainMixin._withdrawOneCoin.call(this, BigInt(0), 0, 0, false, true);
|
|
225
|
+
});
|
|
226
|
+
},
|
|
167
227
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { PoolTemplate } from "../PoolTemplate.js";
|
|
2
|
+
import { IMethodInfo } from "../../interfaces.js";
|
|
2
3
|
export declare const withdrawOneCoinWrappedLendingOrCryptoMixin: {
|
|
3
|
-
_withdrawOneCoinWrapped(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
4
|
+
_withdrawOneCoinWrapped(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
4
5
|
withdrawOneCoinWrappedEstimateGas(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number): Promise<number>;
|
|
5
6
|
withdrawOneCoinWrapped(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
7
|
+
getWithdrawOneCoinWrappedInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
6
8
|
};
|
|
7
9
|
export declare const withdrawOneCoinWrappedMixin: {
|
|
8
|
-
_withdrawOneCoinWrapped(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean): Promise<string | number | number[]>;
|
|
10
|
+
_withdrawOneCoinWrapped(this: PoolTemplate, _lpTokenAmount: bigint, i: number, slippage?: number, estimateGas?: boolean, getInfo?: boolean): Promise<string | number | number[] | IMethodInfo>;
|
|
9
11
|
withdrawOneCoinWrappedEstimateGas(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number): Promise<number>;
|
|
10
12
|
withdrawOneCoinWrapped(this: PoolTemplate, lpTokenAmount: number | string, coin: string | number, slippage?: number): Promise<string>;
|
|
13
|
+
getWithdrawOneCoinWrappedInfo(this: PoolTemplate): Promise<IMethodInfo>;
|
|
11
14
|
};
|
|
@@ -29,9 +29,16 @@ function _withdrawOneCoinWrappedMinAmount(_lpTokenAmount_1, i_1) {
|
|
|
29
29
|
}
|
|
30
30
|
export const withdrawOneCoinWrappedLendingOrCryptoMixin = {
|
|
31
31
|
_withdrawOneCoinWrapped(_lpTokenAmount_1, i_1, slippage_1) {
|
|
32
|
-
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false) {
|
|
33
|
-
const _minAmount = yield _withdrawOneCoinWrappedMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
32
|
+
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false, getInfo = false) {
|
|
34
33
|
const contract = this.curve.contracts[this.address].contract;
|
|
34
|
+
if (getInfo) {
|
|
35
|
+
return {
|
|
36
|
+
address: this.address,
|
|
37
|
+
method: 'remove_liquidity_one_coin',
|
|
38
|
+
abi: contract.remove_liquidity_one_coin.fragment,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const _minAmount = yield _withdrawOneCoinWrappedMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
35
42
|
const gas = yield contract.remove_liquidity_one_coin.estimateGas(_lpTokenAmount, i, _minAmount, false, this.curve.constantOptions);
|
|
36
43
|
if (estimateGas)
|
|
37
44
|
return smartNumber(gas);
|
|
@@ -51,12 +58,24 @@ export const withdrawOneCoinWrappedLendingOrCryptoMixin = {
|
|
|
51
58
|
return yield withdrawOneCoinWrappedLendingOrCryptoMixin._withdrawOneCoinWrapped.call(this, _lpTokenAmount, i, slippage);
|
|
52
59
|
});
|
|
53
60
|
},
|
|
61
|
+
getWithdrawOneCoinWrappedInfo() {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
return yield withdrawOneCoinWrappedLendingOrCryptoMixin._withdrawOneCoinWrapped.call(this, BigInt(0), 0, 0, false, true);
|
|
64
|
+
});
|
|
65
|
+
},
|
|
54
66
|
};
|
|
55
67
|
export const withdrawOneCoinWrappedMixin = {
|
|
56
68
|
_withdrawOneCoinWrapped(_lpTokenAmount_1, i_1, slippage_1) {
|
|
57
|
-
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false) {
|
|
58
|
-
const _minAmount = yield _withdrawOneCoinWrappedMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
69
|
+
return __awaiter(this, arguments, void 0, function* (_lpTokenAmount, i, slippage, estimateGas = false, getInfo = false) {
|
|
59
70
|
const contract = this.curve.contracts[this.address].contract;
|
|
71
|
+
if (getInfo) {
|
|
72
|
+
return {
|
|
73
|
+
address: this.address,
|
|
74
|
+
method: 'remove_liquidity_one_coin',
|
|
75
|
+
abi: contract.remove_liquidity_one_coin.fragment,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
const _minAmount = yield _withdrawOneCoinWrappedMinAmount.call(this, _lpTokenAmount, i, slippage);
|
|
60
79
|
const gas = yield contract.remove_liquidity_one_coin.estimateGas(_lpTokenAmount, i, _minAmount, this.curve.constantOptions);
|
|
61
80
|
if (estimateGas)
|
|
62
81
|
return smartNumber(gas);
|
|
@@ -76,4 +95,9 @@ export const withdrawOneCoinWrappedMixin = {
|
|
|
76
95
|
return yield withdrawOneCoinWrappedMixin._withdrawOneCoinWrapped.call(this, _lpTokenAmount, i, slippage);
|
|
77
96
|
});
|
|
78
97
|
},
|
|
98
|
+
getWithdrawOneCoinWrappedInfo() {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
return yield withdrawOneCoinWrappedMixin._withdrawOneCoinWrapped.call(this, BigInt(0), 0, 0, false, true);
|
|
101
|
+
});
|
|
102
|
+
},
|
|
79
103
|
};
|