@defisaver/sdk 1.0.4 → 1.0.5
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/esm/src/actions/curve/CurveDepositAction.js +1 -1
- package/esm/src/actions/curve/CurveWithdrawAction.d.ts +10 -9
- package/esm/src/actions/curve/CurveWithdrawAction.js +11 -10
- package/esm/src/addresses.js +1 -1
- package/esm/src/utils/curve-utils.d.ts +1 -1
- package/esm/src/utils/curve-utils.js +1 -1
- package/package-lock.json +8791 -0
- package/package.json +5 -3
- package/src/actions/curve/CurveDepositAction.ts +2 -2
- package/src/actions/curve/CurveWithdrawAction.ts +21 -19
- package/src/addresses.ts +1 -1
- package/src/utils/curve-utils.ts +2 -1
- package/umd/index.js +16 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defisaver/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./umd/index.js",
|
|
6
6
|
"module": "./esm/src/index.js",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"@babel/preset-env": "^7.12.11",
|
|
36
36
|
"@babel/preset-typescript": "^7.12.7",
|
|
37
37
|
"@types/node": "^18.11.8",
|
|
38
|
+
"@types/web3": "^1.2.2",
|
|
38
39
|
"@typescript-eslint/eslint-plugin": "^5.42.0",
|
|
39
40
|
"@typescript-eslint/parser": "^5.42.0",
|
|
40
41
|
"babel-loader": "^8.2.2",
|
|
@@ -45,6 +46,8 @@
|
|
|
45
46
|
"eslint-config-airbnb-typescript": "^17.0.0",
|
|
46
47
|
"eslint-import-resolver-typescript": "^3.5.1",
|
|
47
48
|
"eslint-plugin-import": "^2.22.0",
|
|
49
|
+
"eslint-plugin-jsx-a11y": "^6.6.1",
|
|
50
|
+
"eslint-plugin-react": "^7.31.11",
|
|
48
51
|
"jsdoc-to-markdown": "^6.0.1",
|
|
49
52
|
"mocha": "^8.2.1",
|
|
50
53
|
"ts-node": "^10.9.1",
|
|
@@ -52,7 +55,6 @@
|
|
|
52
55
|
"typedoc-plugin-markdown": "^3.13.6",
|
|
53
56
|
"typescript": "^4.8.4",
|
|
54
57
|
"webpack": "^5.13.0",
|
|
55
|
-
"webpack-cli": "^4.10.0"
|
|
56
|
-
"@types/web3": "^1.2.2"
|
|
58
|
+
"webpack-cli": "^4.10.0"
|
|
57
59
|
}
|
|
58
60
|
}
|
|
@@ -59,7 +59,7 @@ export class CurveDepositAction extends Action {
|
|
|
59
59
|
receiver,
|
|
60
60
|
depositTarget,
|
|
61
61
|
minMintAmount,
|
|
62
|
-
makeFlags(depositTargetType, explicitUnderlying, 0),
|
|
62
|
+
makeFlags(depositTargetType, explicitUnderlying, 0, 0),
|
|
63
63
|
amounts,
|
|
64
64
|
],
|
|
65
65
|
);
|
|
@@ -81,4 +81,4 @@ export class CurveDepositAction extends Action {
|
|
|
81
81
|
owner: this.args[0],
|
|
82
82
|
}));
|
|
83
83
|
}
|
|
84
|
-
}
|
|
84
|
+
}
|
|
@@ -9,25 +9,27 @@ import { EthAddress, uint256 } from '../../types';
|
|
|
9
9
|
* @category Curve
|
|
10
10
|
*/
|
|
11
11
|
export class CurveWithdrawAction extends Action {
|
|
12
|
-
lpToken:EthAddress;
|
|
12
|
+
lpToken: EthAddress;
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
* @param sender
|
|
16
|
+
* @param receiver
|
|
17
|
+
* @param poolAddr
|
|
18
|
+
* @param burnAmount
|
|
19
|
+
* @param useUnderlying
|
|
20
|
+
* @param withdrawExact
|
|
21
|
+
* @param minAmounts
|
|
22
|
+
* @param removeOneCoin
|
|
23
|
+
*/
|
|
23
24
|
constructor(
|
|
24
|
-
sender:EthAddress,
|
|
25
|
-
receiver:EthAddress,
|
|
26
|
-
poolAddr:EthAddress,
|
|
27
|
-
burnAmount:uint256,
|
|
28
|
-
useUnderlying:boolean,
|
|
29
|
-
withdrawExact:boolean,
|
|
30
|
-
|
|
25
|
+
sender: EthAddress,
|
|
26
|
+
receiver: EthAddress,
|
|
27
|
+
poolAddr: EthAddress,
|
|
28
|
+
burnAmount: uint256,
|
|
29
|
+
useUnderlying: boolean,
|
|
30
|
+
withdrawExact: boolean,
|
|
31
|
+
removeOneCoin: boolean,
|
|
32
|
+
minAmounts: Array<uint256> = [],
|
|
31
33
|
) {
|
|
32
34
|
requireAddress(sender);
|
|
33
35
|
requireAddress(receiver);
|
|
@@ -36,7 +38,7 @@ export class CurveWithdrawAction extends Action {
|
|
|
36
38
|
let depositTargetType = 0;
|
|
37
39
|
let explicitUnderlying = false;
|
|
38
40
|
|
|
39
|
-
const pool = poolInfo.find((e:any) => e.swapAddr.toLowerCase() === poolAddr.toLowerCase())!;
|
|
41
|
+
const pool = poolInfo.find((e: any) => e.swapAddr.toLowerCase() === poolAddr.toLowerCase())!;
|
|
40
42
|
if (useUnderlying) {
|
|
41
43
|
if (pool.depositContract) {
|
|
42
44
|
depositTarget = pool.depositContract;
|
|
@@ -58,7 +60,7 @@ export class CurveWithdrawAction extends Action {
|
|
|
58
60
|
receiver,
|
|
59
61
|
depositTarget,
|
|
60
62
|
burnAmount,
|
|
61
|
-
makeFlags(depositTargetType, explicitUnderlying, withdrawExact),
|
|
63
|
+
makeFlags(depositTargetType, explicitUnderlying, withdrawExact, removeOneCoin),
|
|
62
64
|
minAmounts,
|
|
63
65
|
],
|
|
64
66
|
);
|
|
@@ -77,4 +79,4 @@ export class CurveWithdrawAction extends Action {
|
|
|
77
79
|
async getAssetsToApprove() {
|
|
78
80
|
return [{ asset: this.lpToken, owner: this.args[0] }];
|
|
79
81
|
}
|
|
80
|
-
}
|
|
82
|
+
}
|
package/src/addresses.ts
CHANGED
|
@@ -133,7 +133,7 @@ export const actionAddresses = {
|
|
|
133
133
|
CurveStethPoolWithdraw: '0x4089731d843Ce52699Fe64F68556aBbD95D70D00',
|
|
134
134
|
|
|
135
135
|
CurveDeposit: '0x160225c24300bD9fAA03Bc007D5e72bDbbcA9257',
|
|
136
|
-
CurveWithdraw: '
|
|
136
|
+
CurveWithdraw: '0xb6Be5c486dD65c2cb18A388671b348E62307F0B3',
|
|
137
137
|
|
|
138
138
|
// Euler
|
|
139
139
|
FLEuler: '0x66DC6444CdC099153f89332e0d4C87af5C966A75',
|
package/src/utils/curve-utils.ts
CHANGED
|
@@ -10,5 +10,6 @@ export const makeFlags = (
|
|
|
10
10
|
depositTargetType: any,
|
|
11
11
|
explicitUnderlying: any,
|
|
12
12
|
withdrawExact: any,
|
|
13
|
+
removeOneCoin: any,
|
|
13
14
|
// eslint-disable-next-line
|
|
14
|
-
) => depositTargetType | explicitUnderlying << 2 | withdrawExact << 3;
|
|
15
|
+
) => depositTargetType | explicitUnderlying << 2 | withdrawExact << 3 | removeOneCoin << 4;
|
package/umd/index.js
CHANGED
|
@@ -1322,7 +1322,7 @@ var actionAddresses = {
|
|
|
1322
1322
|
CurveStethPoolDeposit: '0x5Ae5870dC0C780e9eb68bE7a223eCd7F3BDad12B',
|
|
1323
1323
|
CurveStethPoolWithdraw: '0x4089731d843Ce52699Fe64F68556aBbD95D70D00',
|
|
1324
1324
|
CurveDeposit: '0x160225c24300bD9fAA03Bc007D5e72bDbbcA9257',
|
|
1325
|
-
CurveWithdraw: '
|
|
1325
|
+
CurveWithdraw: '0xb6Be5c486dD65c2cb18A388671b348E62307F0B3',
|
|
1326
1326
|
// Euler
|
|
1327
1327
|
FLEuler: '0x66DC6444CdC099153f89332e0d4C87af5C966A75',
|
|
1328
1328
|
TrailingStopTrigger: '0x0000000000000000000000000000000000000000',
|
|
@@ -6004,7 +6004,7 @@ class CurveDepositAction extends _Action__WEBPACK_IMPORTED_MODULE_1__.Action {
|
|
|
6004
6004
|
depositTarget = pool.swapAddr;
|
|
6005
6005
|
tokensForApproval = pool.coins;
|
|
6006
6006
|
}
|
|
6007
|
-
super('CurveDeposit', (0,_addresses__WEBPACK_IMPORTED_MODULE_3__.getAddr)('CurveDeposit'), ['address', 'address', 'address', 'uint256', 'uint8', 'uint256[]'], [sender, receiver, depositTarget, minMintAmount, (0,_utils_curve_utils__WEBPACK_IMPORTED_MODULE_4__.makeFlags)(depositTargetType, explicitUnderlying, 0), amounts]);
|
|
6007
|
+
super('CurveDeposit', (0,_addresses__WEBPACK_IMPORTED_MODULE_3__.getAddr)('CurveDeposit'), ['address', 'address', 'address', 'uint256', 'uint8', 'uint256[]'], [sender, receiver, depositTarget, minMintAmount, (0,_utils_curve_utils__WEBPACK_IMPORTED_MODULE_4__.makeFlags)(depositTargetType, explicitUnderlying, 0, 0), amounts]);
|
|
6008
6008
|
_defineProperty(this, "tokensForApproval", void 0);
|
|
6009
6009
|
this.tokensForApproval = tokensForApproval;
|
|
6010
6010
|
this.mappableArgs = [this.args[0], this.args[1], this.args[2], this.args[3], this.args[4], ...this.args[5]];
|
|
@@ -6037,9 +6037,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6037
6037
|
* Make Flags
|
|
6038
6038
|
*
|
|
6039
6039
|
* */
|
|
6040
|
-
var makeFlags = (depositTargetType, explicitUnderlying, withdrawExact
|
|
6040
|
+
var makeFlags = (depositTargetType, explicitUnderlying, withdrawExact, removeOneCoin
|
|
6041
6041
|
// eslint-disable-next-line
|
|
6042
|
-
) => depositTargetType | explicitUnderlying << 2 | withdrawExact << 3;
|
|
6042
|
+
) => depositTargetType | explicitUnderlying << 2 | withdrawExact << 3 | removeOneCoin << 4;
|
|
6043
6043
|
|
|
6044
6044
|
/***/ }),
|
|
6045
6045
|
/* 153 */
|
|
@@ -6071,16 +6071,17 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
6071
6071
|
*/
|
|
6072
6072
|
class CurveWithdrawAction extends _Action__WEBPACK_IMPORTED_MODULE_0__.Action {
|
|
6073
6073
|
/**
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6074
|
+
* @param sender
|
|
6075
|
+
* @param receiver
|
|
6076
|
+
* @param poolAddr
|
|
6077
|
+
* @param burnAmount
|
|
6078
|
+
* @param useUnderlying
|
|
6079
|
+
* @param withdrawExact
|
|
6080
|
+
* @param minAmounts
|
|
6081
|
+
* @param removeOneCoin
|
|
6082
|
+
*/
|
|
6083
|
+
constructor(sender, receiver, poolAddr, burnAmount, useUnderlying, withdrawExact, removeOneCoin) {
|
|
6084
|
+
var minAmounts = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : [];
|
|
6084
6085
|
(0,_utils_general__WEBPACK_IMPORTED_MODULE_1__.requireAddress)(sender);
|
|
6085
6086
|
(0,_utils_general__WEBPACK_IMPORTED_MODULE_1__.requireAddress)(receiver);
|
|
6086
6087
|
var depositTarget;
|
|
@@ -6099,7 +6100,7 @@ class CurveWithdrawAction extends _Action__WEBPACK_IMPORTED_MODULE_0__.Action {
|
|
|
6099
6100
|
} else {
|
|
6100
6101
|
depositTarget = pool.swapAddr;
|
|
6101
6102
|
}
|
|
6102
|
-
super('CurveWithdraw', (0,_addresses__WEBPACK_IMPORTED_MODULE_2__.getAddr)('CurveWithdraw'), ['address', 'address', 'address', 'uint256', 'uint8', 'uint256[]'], [sender, receiver, depositTarget, burnAmount, (0,_utils_curve_utils__WEBPACK_IMPORTED_MODULE_3__.makeFlags)(depositTargetType, explicitUnderlying, withdrawExact), minAmounts]);
|
|
6103
|
+
super('CurveWithdraw', (0,_addresses__WEBPACK_IMPORTED_MODULE_2__.getAddr)('CurveWithdraw'), ['address', 'address', 'address', 'uint256', 'uint8', 'uint256[]'], [sender, receiver, depositTarget, burnAmount, (0,_utils_curve_utils__WEBPACK_IMPORTED_MODULE_3__.makeFlags)(depositTargetType, explicitUnderlying, withdrawExact, removeOneCoin), minAmounts]);
|
|
6103
6104
|
_defineProperty(this, "lpToken", void 0);
|
|
6104
6105
|
this.lpToken = pool.lpToken;
|
|
6105
6106
|
this.mappableArgs = [this.args[0], this.args[1], this.args[2], this.args[3], this.args[4], ...this.args[5]];
|