@defisaver/sdk 1.0.23 → 1.0.24

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.
Files changed (53) hide show
  1. package/esm/src/Action.js +1 -2
  2. package/esm/src/actions/curveusd/CurveUsdBorrowAction.d.ts +15 -0
  3. package/esm/src/actions/curveusd/CurveUsdBorrowAction.js +22 -0
  4. package/esm/src/actions/curveusd/CurveUsdCreateAction.d.ts +22 -0
  5. package/esm/src/actions/curveusd/CurveUsdCreateAction.js +46 -0
  6. package/esm/src/actions/curveusd/CurveUsdPaybackAction.d.ts +22 -0
  7. package/esm/src/actions/curveusd/CurveUsdPaybackAction.js +43 -0
  8. package/esm/src/actions/curveusd/CurveUsdSupplyAction.d.ts +20 -0
  9. package/esm/src/actions/curveusd/CurveUsdSupplyAction.js +42 -0
  10. package/esm/src/actions/curveusd/CurveUsdWithdrawAction.d.ts +15 -0
  11. package/esm/src/actions/curveusd/CurveUsdWithdrawAction.js +22 -0
  12. package/esm/src/actions/curveusd/index.d.ts +5 -0
  13. package/esm/src/actions/curveusd/index.js +5 -0
  14. package/esm/src/actions/index.d.ts +2 -1
  15. package/esm/src/actions/index.js +2 -1
  16. package/esm/src/actions/morpho/index.d.ts +0 -4
  17. package/esm/src/actions/morpho/index.js +0 -4
  18. package/esm/src/addresses.d.ts +0 -12
  19. package/esm/src/addresses.js +0 -5
  20. package/esm/src/index.d.ts +0 -48
  21. package/esm/src/types.d.ts +2 -1
  22. package/esm/src/utils/curveusd-utils.d.ts +10 -0
  23. package/esm/src/utils/curveusd-utils.js +6 -0
  24. package/esm/src/utils/index.d.ts +2 -1
  25. package/esm/src/utils/index.js +2 -1
  26. package/package.json +1 -1
  27. package/src/Action.ts +1 -2
  28. package/src/actions/curveusd/CurveUsdBorrowAction.ts +34 -0
  29. package/src/actions/curveusd/CurveUsdCreateAction.ts +53 -0
  30. package/src/actions/curveusd/CurveUsdPaybackAction.ts +48 -0
  31. package/src/actions/curveusd/CurveUsdSupplyAction.ts +48 -0
  32. package/src/actions/curveusd/CurveUsdWithdrawAction.ts +34 -0
  33. package/src/actions/curveusd/index.ts +5 -0
  34. package/src/actions/index.ts +2 -0
  35. package/src/actions/morpho/index.ts +0 -4
  36. package/src/addresses.ts +0 -6
  37. package/src/types.ts +2 -1
  38. package/src/utils/curveusd-utils.ts +8 -0
  39. package/src/utils/index.ts +2 -0
  40. package/umd/index.js +316 -200
  41. package/yarn-error.log +3976 -0
  42. package/esm/src/actions/morpho/aaveV3/MorphoAaveV3BorrowAction.d.ts +0 -18
  43. package/esm/src/actions/morpho/aaveV3/MorphoAaveV3BorrowAction.js +0 -27
  44. package/esm/src/actions/morpho/aaveV3/MorphoAaveV3PaybackAction.d.ts +0 -21
  45. package/esm/src/actions/morpho/aaveV3/MorphoAaveV3PaybackAction.js +0 -44
  46. package/esm/src/actions/morpho/aaveV3/MorphoAaveV3SupplyAction.d.ts +0 -23
  47. package/esm/src/actions/morpho/aaveV3/MorphoAaveV3SupplyAction.js +0 -47
  48. package/esm/src/actions/morpho/aaveV3/MorphoAaveV3WithdrawAction.d.ts +0 -19
  49. package/esm/src/actions/morpho/aaveV3/MorphoAaveV3WithdrawAction.js +0 -29
  50. package/src/actions/morpho/aaveV3/MorphoAaveV3BorrowAction.ts +0 -42
  51. package/src/actions/morpho/aaveV3/MorphoAaveV3PaybackAction.ts +0 -47
  52. package/src/actions/morpho/aaveV3/MorphoAaveV3SupplyAction.ts +0 -52
  53. package/src/actions/morpho/aaveV3/MorphoAaveV3WithdrawAction.ts +0 -45
@@ -1,18 +0,0 @@
1
- import { Action } from '../../../Action';
2
- import { EthAddress, uint256 } from '../../../types';
3
- /**
4
- * MorphoAaveV3BorrowAction - Borrow token from Morpho AaveV3
5
- *
6
- * @category Morpho
7
- */
8
- export declare class MorphoAaveV3BorrowAction extends Action {
9
- /**
10
- * @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
11
- * @param tokenAddr - Address of tokenAddr (underlying)
12
- * @param amount - Token amount
13
- * @param to - The address we are sending the borrowed tokens to
14
- * @param onBehalf - For what user we are borrowing the tokens, defaults to proxy
15
- * @param maxIterations - Max number of iterations for p2p matching, 0 will use default num of iterations
16
- */
17
- constructor(emodeId: uint256, tokenAddr: EthAddress, amount: uint256, to: EthAddress, onBehalf?: EthAddress, maxIterations?: uint256);
18
- }
@@ -1,27 +0,0 @@
1
- import { Action } from '../../../Action';
2
- import { getAddr } from '../../../addresses';
3
- /**
4
- * MorphoAaveV3BorrowAction - Borrow token from Morpho AaveV3
5
- *
6
- * @category Morpho
7
- */
8
- export class MorphoAaveV3BorrowAction extends Action {
9
- /**
10
- * @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
11
- * @param tokenAddr - Address of tokenAddr (underlying)
12
- * @param amount - Token amount
13
- * @param to - The address we are sending the borrowed tokens to
14
- * @param onBehalf - For what user we are borrowing the tokens, defaults to proxy
15
- * @param maxIterations - Max number of iterations for p2p matching, 0 will use default num of iterations
16
- */
17
- constructor(emodeId, tokenAddr, amount, to, onBehalf = getAddr('Empty'), maxIterations = '4') {
18
- super('MorphoAaveV3Borrow', getAddr('MorphoAaveV3Borrow'), ['uint256', 'address', 'uint256', 'address', 'address', 'uint256'], [emodeId, tokenAddr, amount, to, onBehalf, maxIterations]);
19
- this.mappableArgs = [
20
- this.args[0],
21
- this.args[1],
22
- this.args[2],
23
- this.args[3],
24
- this.args[4],
25
- ];
26
- }
27
- }
@@ -1,21 +0,0 @@
1
- import { Action } from '../../../Action';
2
- import { EthAddress, uint256 } from '../../../types';
3
- /**
4
- * MorphoAaveV3PaybackAction - Payback token to Morpho AaveV3
5
- *
6
- * @category Morpho
7
- */
8
- export declare class MorphoAaveV3PaybackAction extends Action {
9
- /**
10
- * @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
11
- * @param tokenAddr - Address of tokenAddr (underlying)
12
- * @param amount - Token amount
13
- * @param from - Tokens will be sent from this address
14
- * @param onBehalf - For what user we are paying back the debt, defaults to proxy
15
- */
16
- constructor(emodeId: uint256, tokenAddr: EthAddress, amount: uint256, from: EthAddress, onBehalf?: EthAddress);
17
- getAssetsToApprove(): Promise<{
18
- asset: any;
19
- owner: any;
20
- }[]>;
21
- }
@@ -1,44 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { getAssetInfoByAddress } from '@defisaver/tokens';
11
- import { Action } from '../../../Action';
12
- import { getAddr } from '../../../addresses';
13
- /**
14
- * MorphoAaveV3PaybackAction - Payback token to Morpho AaveV3
15
- *
16
- * @category Morpho
17
- */
18
- export class MorphoAaveV3PaybackAction extends Action {
19
- /**
20
- * @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
21
- * @param tokenAddr - Address of tokenAddr (underlying)
22
- * @param amount - Token amount
23
- * @param from - Tokens will be sent from this address
24
- * @param onBehalf - For what user we are paying back the debt, defaults to proxy
25
- */
26
- constructor(emodeId, tokenAddr, amount, from, onBehalf = getAddr('Empty')) {
27
- super('MorphoAaveV3Payback', getAddr('MorphoAaveV3Payback'), ['uint256', 'address', 'uint256', 'address', 'address'], [emodeId, tokenAddr, amount, from, onBehalf]);
28
- this.mappableArgs = [
29
- this.args[0],
30
- this.args[1],
31
- this.args[2],
32
- this.args[3],
33
- this.args[4],
34
- ];
35
- }
36
- getAssetsToApprove() {
37
- return __awaiter(this, void 0, void 0, function* () {
38
- const asset = getAssetInfoByAddress(this.args[1]);
39
- if (asset.symbol !== 'ETH')
40
- return [{ asset: this.args[1], owner: this.args[3] }];
41
- return [];
42
- });
43
- }
44
- }
@@ -1,23 +0,0 @@
1
- import { Action } from '../../../Action';
2
- import { EthAddress, uint256 } from '../../../types';
3
- /**
4
- * MorphoAaveV3SupplyAction - Supply token to morpho aaveV3
5
- *
6
- * @category Morpho
7
- */
8
- export declare class MorphoAaveV3SupplyAction extends Action {
9
- /**
10
- * @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
11
- * @param tokenAddr - Address of tokenAddr (underlying)
12
- * @param amount - Token amount
13
- * @param from - Tokens will be sent from this address
14
- * @param onBehalf - For what user we are paying back the debt, defaults to proxy
15
- * @param supplyAsColl Whether to supplyAsCollateral or regular supply
16
- * @param maxIterations Max number of iterations for p2p matching, 0 will use default num of iterations
17
- */
18
- constructor(emodeId: uint256, tokenAddr: EthAddress, amount: uint256, from: EthAddress, onBehalf?: EthAddress, supplyAsColl?: boolean, maxIterations?: uint256);
19
- getAssetsToApprove(): Promise<{
20
- asset: any;
21
- owner: any;
22
- }[]>;
23
- }
@@ -1,47 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { getAssetInfoByAddress } from '@defisaver/tokens';
11
- import { Action } from '../../../Action';
12
- import { getAddr } from '../../../addresses';
13
- /**
14
- * MorphoAaveV3SupplyAction - Supply token to morpho aaveV3
15
- *
16
- * @category Morpho
17
- */
18
- export class MorphoAaveV3SupplyAction extends Action {
19
- /**
20
- * @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
21
- * @param tokenAddr - Address of tokenAddr (underlying)
22
- * @param amount - Token amount
23
- * @param from - Tokens will be sent from this address
24
- * @param onBehalf - For what user we are paying back the debt, defaults to proxy
25
- * @param supplyAsColl Whether to supplyAsCollateral or regular supply
26
- * @param maxIterations Max number of iterations for p2p matching, 0 will use default num of iterations
27
- */
28
- constructor(emodeId, tokenAddr, amount, from, onBehalf = getAddr('Empty'), supplyAsColl = true, maxIterations = '4') {
29
- super('MorphoAaveV3Supply', getAddr('MorphoAaveV3Supply'), ['uint256', 'address', 'uint256', 'address', 'address', 'bool', 'uint256'], [emodeId, tokenAddr, amount, from, onBehalf, supplyAsColl, maxIterations]);
30
- this.mappableArgs = [
31
- this.args[0],
32
- this.args[1],
33
- this.args[2],
34
- this.args[3],
35
- this.args[4],
36
- this.args[5],
37
- ];
38
- }
39
- getAssetsToApprove() {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- const asset = getAssetInfoByAddress(this.args[1]);
42
- if (asset.symbol !== 'ETH')
43
- return [{ asset: this.args[1], owner: this.args[3] }];
44
- return [];
45
- });
46
- }
47
- }
@@ -1,19 +0,0 @@
1
- import { Action } from '../../../Action';
2
- import { EthAddress, uint256 } from '../../../types';
3
- /**
4
- * MorphoAaveV3WithdrawAction - Withdraw token from Morpho AaveV3
5
- *
6
- * @category Morpho
7
- */
8
- export declare class MorphoAaveV3WithdrawAction extends Action {
9
- /**
10
- * @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
11
- * @param tokenAddr - Address of tokenAddr (underlying)
12
- * @param amount - Token amount
13
- * @param to - Tokens will be sent to this address
14
- * @param onBehalf - For what user we are withdrawing the tokens, defaults to proxy
15
- * @param withdrawAsColl - If we want to withdraw from collateral or from pure supply
16
- * @param maxIterations - Max number of iterations for p2p matching, 0 will use default num of iterations
17
- */
18
- constructor(emodeId: uint256, tokenAddr: EthAddress, amount: uint256, to: EthAddress, onBehalf?: EthAddress, withdrawAsColl?: boolean, maxIterations?: uint256);
19
- }
@@ -1,29 +0,0 @@
1
- import { Action } from '../../../Action';
2
- import { getAddr } from '../../../addresses';
3
- /**
4
- * MorphoAaveV3WithdrawAction - Withdraw token from Morpho AaveV3
5
- *
6
- * @category Morpho
7
- */
8
- export class MorphoAaveV3WithdrawAction extends Action {
9
- /**
10
- * @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
11
- * @param tokenAddr - Address of tokenAddr (underlying)
12
- * @param amount - Token amount
13
- * @param to - Tokens will be sent to this address
14
- * @param onBehalf - For what user we are withdrawing the tokens, defaults to proxy
15
- * @param withdrawAsColl - If we want to withdraw from collateral or from pure supply
16
- * @param maxIterations - Max number of iterations for p2p matching, 0 will use default num of iterations
17
- */
18
- constructor(emodeId, tokenAddr, amount, to, onBehalf = getAddr('Empty'), withdrawAsColl = true, maxIterations = '4') {
19
- super('MorphoAaveV3Withdraw', getAddr('MorphoAaveV3Withdraw'), ['uint256', 'address', 'uint256', 'address', 'address', 'bool', 'uint256'], [emodeId, tokenAddr, amount, to, onBehalf, withdrawAsColl, maxIterations]);
20
- this.mappableArgs = [
21
- this.args[0],
22
- this.args[1],
23
- this.args[2],
24
- this.args[3],
25
- this.args[4],
26
- this.args[5],
27
- ];
28
- }
29
- }
@@ -1,42 +0,0 @@
1
- import { Action } from '../../../Action';
2
- import { getAddr } from '../../../addresses';
3
- import { EthAddress, uint256 } from '../../../types';
4
-
5
- /**
6
- * MorphoAaveV3BorrowAction - Borrow token from Morpho AaveV3
7
- *
8
- * @category Morpho
9
- */
10
- export class MorphoAaveV3BorrowAction extends Action {
11
- /**
12
- * @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
13
- * @param tokenAddr - Address of tokenAddr (underlying)
14
- * @param amount - Token amount
15
- * @param to - The address we are sending the borrowed tokens to
16
- * @param onBehalf - For what user we are borrowing the tokens, defaults to proxy
17
- * @param maxIterations - Max number of iterations for p2p matching, 0 will use default num of iterations
18
- */
19
- constructor(
20
- emodeId: uint256,
21
- tokenAddr: EthAddress,
22
- amount: uint256,
23
- to: EthAddress,
24
- onBehalf: EthAddress = getAddr('Empty'),
25
- maxIterations: uint256 = '4',
26
- ) {
27
- super(
28
- 'MorphoAaveV3Borrow',
29
- getAddr('MorphoAaveV3Borrow'),
30
- ['uint256', 'address', 'uint256', 'address', 'address', 'uint256'],
31
- [emodeId, tokenAddr, amount, to, onBehalf, maxIterations],
32
- );
33
-
34
- this.mappableArgs = [
35
- this.args[0],
36
- this.args[1],
37
- this.args[2],
38
- this.args[3],
39
- this.args[4],
40
- ];
41
- }
42
- }
@@ -1,47 +0,0 @@
1
- import { getAssetInfoByAddress } from '@defisaver/tokens';
2
- import { Action } from '../../../Action';
3
- import { getAddr } from '../../../addresses';
4
- import { EthAddress, uint256 } from '../../../types';
5
-
6
- /**
7
- * MorphoAaveV3PaybackAction - Payback token to Morpho AaveV3
8
- *
9
- * @category Morpho
10
- */
11
- export class MorphoAaveV3PaybackAction extends Action {
12
- /**
13
- * @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
14
- * @param tokenAddr - Address of tokenAddr (underlying)
15
- * @param amount - Token amount
16
- * @param from - Tokens will be sent from this address
17
- * @param onBehalf - For what user we are paying back the debt, defaults to proxy
18
- */
19
- constructor(
20
- emodeId: uint256,
21
- tokenAddr: EthAddress,
22
- amount: uint256,
23
- from: EthAddress,
24
- onBehalf: EthAddress = getAddr('Empty'),
25
- ) {
26
- super(
27
- 'MorphoAaveV3Payback',
28
- getAddr('MorphoAaveV3Payback'),
29
- ['uint256', 'address', 'uint256', 'address', 'address'],
30
- [emodeId, tokenAddr, amount, from, onBehalf],
31
- );
32
-
33
- this.mappableArgs = [
34
- this.args[0],
35
- this.args[1],
36
- this.args[2],
37
- this.args[3],
38
- this.args[4],
39
- ];
40
- }
41
-
42
- async getAssetsToApprove() {
43
- const asset = getAssetInfoByAddress(this.args[1]);
44
- if (asset.symbol !== 'ETH') return [{ asset: this.args[1], owner: this.args[3] }];
45
- return [];
46
- }
47
- }
@@ -1,52 +0,0 @@
1
- import { getAssetInfoByAddress } from '@defisaver/tokens';
2
- import { Action } from '../../../Action';
3
- import { getAddr } from '../../../addresses';
4
- import { EthAddress, uint256 } from '../../../types';
5
-
6
- /**
7
- * MorphoAaveV3SupplyAction - Supply token to morpho aaveV3
8
- *
9
- * @category Morpho
10
- */
11
- export class MorphoAaveV3SupplyAction extends Action {
12
- /**
13
- * @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
14
- * @param tokenAddr - Address of tokenAddr (underlying)
15
- * @param amount - Token amount
16
- * @param from - Tokens will be sent from this address
17
- * @param onBehalf - For what user we are paying back the debt, defaults to proxy
18
- * @param supplyAsColl Whether to supplyAsCollateral or regular supply
19
- * @param maxIterations Max number of iterations for p2p matching, 0 will use default num of iterations
20
- */
21
- constructor(
22
- emodeId:uint256,
23
- tokenAddr:EthAddress,
24
- amount:uint256,
25
- from:EthAddress,
26
- onBehalf:EthAddress = getAddr('Empty'),
27
- supplyAsColl:boolean = true,
28
- maxIterations:uint256 = '4',
29
- ) {
30
- super(
31
- 'MorphoAaveV3Supply',
32
- getAddr('MorphoAaveV3Supply'),
33
- ['uint256', 'address', 'uint256', 'address', 'address', 'bool', 'uint256'],
34
- [emodeId, tokenAddr, amount, from, onBehalf, supplyAsColl, maxIterations],
35
- );
36
-
37
- this.mappableArgs = [
38
- this.args[0],
39
- this.args[1],
40
- this.args[2],
41
- this.args[3],
42
- this.args[4],
43
- this.args[5],
44
- ];
45
- }
46
-
47
- async getAssetsToApprove() {
48
- const asset = getAssetInfoByAddress(this.args[1]);
49
- if (asset.symbol !== 'ETH') return [{ asset: this.args[1], owner: this.args[3] }];
50
- return [];
51
- }
52
- }
@@ -1,45 +0,0 @@
1
- import { Action } from '../../../Action';
2
- import { getAddr } from '../../../addresses';
3
- import { EthAddress, uint256 } from '../../../types';
4
-
5
- /**
6
- * MorphoAaveV3WithdrawAction - Withdraw token from Morpho AaveV3
7
- *
8
- * @category Morpho
9
- */
10
- export class MorphoAaveV3WithdrawAction extends Action {
11
- /**
12
- * @param emodeId Type of emode we are entering in, each one is different deployment on Morpho
13
- * @param tokenAddr - Address of tokenAddr (underlying)
14
- * @param amount - Token amount
15
- * @param to - Tokens will be sent to this address
16
- * @param onBehalf - For what user we are withdrawing the tokens, defaults to proxy
17
- * @param withdrawAsColl - If we want to withdraw from collateral or from pure supply
18
- * @param maxIterations - Max number of iterations for p2p matching, 0 will use default num of iterations
19
- */
20
- constructor(
21
- emodeId: uint256,
22
- tokenAddr: EthAddress,
23
- amount: uint256,
24
- to: EthAddress,
25
- onBehalf: EthAddress = getAddr('Empty'),
26
- withdrawAsColl: boolean = true,
27
- maxIterations: uint256 = '4',
28
- ) {
29
- super(
30
- 'MorphoAaveV3Withdraw',
31
- getAddr('MorphoAaveV3Withdraw'),
32
- ['uint256', 'address', 'uint256', 'address', 'address', 'bool', 'uint256'],
33
- [emodeId, tokenAddr, amount, to, onBehalf, withdrawAsColl, maxIterations],
34
- );
35
-
36
- this.mappableArgs = [
37
- this.args[0],
38
- this.args[1],
39
- this.args[2],
40
- this.args[3],
41
- this.args[4],
42
- this.args[5],
43
- ];
44
- }
45
- }