@defisaver/sdk 1.3.28 → 1.3.30-aave-v4-delegate-dev
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/Action.js +23 -5
- package/esm/src/actions/aavev4/AaveV4DelegateBorrowAction.d.ts +16 -0
- package/esm/src/actions/aavev4/AaveV4DelegateBorrowAction.js +24 -0
- package/esm/src/actions/aavev4/AaveV4DelegateSetUsingAsCollateralAction.d.ts +15 -0
- package/esm/src/actions/aavev4/AaveV4DelegateSetUsingAsCollateralAction.js +22 -0
- package/esm/src/actions/aavev4/AaveV4DelegateWithdrawAction.d.ts +16 -0
- package/esm/src/actions/aavev4/AaveV4DelegateWithdrawAction.js +24 -0
- package/esm/src/actions/aavev4/AaveV4SetUserManagersAction.d.ts +14 -0
- package/esm/src/actions/aavev4/AaveV4SetUserManagersAction.js +16 -0
- package/esm/src/actions/aavev4/index.d.ts +4 -0
- package/esm/src/actions/aavev4/index.js +4 -0
- package/esm/src/actions/checkers/SparkRatioCheckAction.d.ts +4 -2
- package/esm/src/actions/checkers/SparkRatioCheckAction.js +6 -2
- package/esm/src/actions/checkers/SparkTargetRatioCheck.d.ts +2 -1
- package/esm/src/actions/checkers/SparkTargetRatioCheck.js +4 -2
- package/esm/src/actions/index.d.ts +2 -1
- package/esm/src/actions/index.js +2 -1
- package/esm/src/actions/midnight/MidnightBorrowFromOrdersAction.d.ts +18 -0
- package/esm/src/actions/midnight/MidnightBorrowFromOrdersAction.js +28 -0
- package/esm/src/actions/midnight/MidnightPaybackDirectAction.d.ts +16 -0
- package/esm/src/actions/midnight/MidnightPaybackDirectAction.js +24 -0
- package/esm/src/actions/midnight/MidnightPaybackFromOrdersAction.d.ts +18 -0
- package/esm/src/actions/midnight/MidnightPaybackFromOrdersAction.js +28 -0
- package/esm/src/actions/midnight/MidnightSupplyCollateralAction.d.ts +17 -0
- package/esm/src/actions/midnight/MidnightSupplyCollateralAction.js +26 -0
- package/esm/src/actions/midnight/MidnightWithdrawCollateralAction.d.ts +17 -0
- package/esm/src/actions/midnight/MidnightWithdrawCollateralAction.js +26 -0
- package/esm/src/actions/midnight/index.d.ts +5 -0
- package/esm/src/actions/midnight/index.js +5 -0
- package/esm/src/addresses.d.ts +60 -0
- package/esm/src/addresses.js +12 -2
- package/esm/src/index.d.ts +240 -0
- package/package.json +1 -1
- package/src/Action.ts +21 -5
- package/src/actions/aavev4/AaveV4DelegateBorrowAction.ts +36 -0
- package/src/actions/aavev4/AaveV4DelegateSetUsingAsCollateralAction.ts +33 -0
- package/src/actions/aavev4/AaveV4DelegateWithdrawAction.ts +36 -0
- package/src/actions/aavev4/AaveV4SetUserManagersAction.ts +26 -0
- package/src/actions/aavev4/index.ts +5 -1
- package/src/actions/checkers/SparkRatioCheckAction.ts +18 -4
- package/src/actions/checkers/SparkTargetRatioCheck.ts +14 -3
- package/src/actions/index.ts +2 -0
- package/src/actions/midnight/MidnightBorrowFromOrdersAction.ts +44 -0
- package/src/actions/midnight/MidnightPaybackDirectAction.ts +36 -0
- package/src/actions/midnight/MidnightPaybackFromOrdersAction.ts +44 -0
- package/src/actions/midnight/MidnightSupplyCollateralAction.ts +39 -0
- package/src/actions/midnight/MidnightWithdrawCollateralAction.ts +39 -0
- package/src/actions/midnight/index.ts +5 -0
- package/src/addresses.ts +13 -2
- package/umd/index.js +443 -98
package/esm/src/Action.js
CHANGED
|
@@ -63,14 +63,32 @@ export class Action {
|
|
|
63
63
|
}
|
|
64
64
|
_parseParamType(paramType, arg) {
|
|
65
65
|
if (typeof (paramType) === 'string') {
|
|
66
|
-
if (paramType.startsWith('(')) {
|
|
67
|
-
let _paramType = paramType.replace('(', '');
|
|
68
|
-
_paramType = _paramType.replace(')', '');
|
|
69
|
-
return _paramType.split(',');
|
|
70
|
-
}
|
|
71
66
|
if (paramType.endsWith('[]')) {
|
|
72
67
|
return Array.from(Array(arg.length).fill(paramType.replace('[]', '')));
|
|
73
68
|
}
|
|
69
|
+
if (paramType.startsWith('(') || paramType.startsWith('tuple(')) {
|
|
70
|
+
const tupleStart = paramType.indexOf('(');
|
|
71
|
+
const tupleEnd = paramType.lastIndexOf(')');
|
|
72
|
+
const tupleContents = paramType.slice(tupleStart + 1, tupleEnd);
|
|
73
|
+
const tupleTypes = [];
|
|
74
|
+
let currentType = '';
|
|
75
|
+
let nestingDepth = 0;
|
|
76
|
+
for (const character of tupleContents) {
|
|
77
|
+
if (character === ',' && nestingDepth === 0) {
|
|
78
|
+
tupleTypes.push(currentType);
|
|
79
|
+
currentType = '';
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
currentType += character;
|
|
83
|
+
if (character === '(')
|
|
84
|
+
nestingDepth += 1;
|
|
85
|
+
if (character === ')')
|
|
86
|
+
nestingDepth -= 1;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
tupleTypes.push(currentType);
|
|
90
|
+
return tupleTypes;
|
|
91
|
+
}
|
|
74
92
|
}
|
|
75
93
|
return paramType;
|
|
76
94
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* AaveV4DelegateBorrowAction - Approves a spender to borrow from the specified reserve on behalf of the wallet.
|
|
5
|
+
*
|
|
6
|
+
* @category AaveV4DelegateBorrow
|
|
7
|
+
*/
|
|
8
|
+
export declare class AaveV4DelegateBorrowAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param spoke Address of the spoke.
|
|
11
|
+
* @param reserveId Reserve id.
|
|
12
|
+
* @param spender Address that will receive the borrow allowance.
|
|
13
|
+
* @param amount Amount of borrow allowance.
|
|
14
|
+
*/
|
|
15
|
+
constructor(spoke: EthAddress, reserveId: uint256, spender: EthAddress, amount: uint256);
|
|
16
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* AaveV4DelegateBorrowAction - Approves a spender to borrow from the specified reserve on behalf of the wallet.
|
|
5
|
+
*
|
|
6
|
+
* @category AaveV4DelegateBorrow
|
|
7
|
+
*/
|
|
8
|
+
export class AaveV4DelegateBorrowAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param spoke Address of the spoke.
|
|
11
|
+
* @param reserveId Reserve id.
|
|
12
|
+
* @param spender Address that will receive the borrow allowance.
|
|
13
|
+
* @param amount Amount of borrow allowance.
|
|
14
|
+
*/
|
|
15
|
+
constructor(spoke, reserveId, spender, amount) {
|
|
16
|
+
super('AaveV4DelegateBorrow', getAddr('AaveV4DelegateBorrow'), ['address', 'uint256', 'address', 'uint256'], [spoke, reserveId, spender, amount]);
|
|
17
|
+
this.mappableArgs = [
|
|
18
|
+
this.args[0],
|
|
19
|
+
this.args[1],
|
|
20
|
+
this.args[2],
|
|
21
|
+
this.args[3],
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* AaveV4DelegateSetUsingAsCollateralAction - Approves a delegatee to set using as collateral on behalf of the wallet.
|
|
5
|
+
*
|
|
6
|
+
* @category AaveV4DelegateSetUsingAsCollateral
|
|
7
|
+
*/
|
|
8
|
+
export declare class AaveV4DelegateSetUsingAsCollateralAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param spoke Address of the spoke.
|
|
11
|
+
* @param delegatee Address that will receive the permission.
|
|
12
|
+
* @param permission Whether the delegatee can set using as collateral.
|
|
13
|
+
*/
|
|
14
|
+
constructor(spoke: EthAddress, delegatee: EthAddress, permission: boolean);
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* AaveV4DelegateSetUsingAsCollateralAction - Approves a delegatee to set using as collateral on behalf of the wallet.
|
|
5
|
+
*
|
|
6
|
+
* @category AaveV4DelegateSetUsingAsCollateral
|
|
7
|
+
*/
|
|
8
|
+
export class AaveV4DelegateSetUsingAsCollateralAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param spoke Address of the spoke.
|
|
11
|
+
* @param delegatee Address that will receive the permission.
|
|
12
|
+
* @param permission Whether the delegatee can set using as collateral.
|
|
13
|
+
*/
|
|
14
|
+
constructor(spoke, delegatee, permission) {
|
|
15
|
+
super('AaveV4DelegateSetUsingAsCollateral', getAddr('AaveV4DelegateSetUsingAsCollateral'), ['address', 'address', 'bool'], [spoke, delegatee, permission]);
|
|
16
|
+
this.mappableArgs = [
|
|
17
|
+
this.args[0],
|
|
18
|
+
this.args[1],
|
|
19
|
+
this.args[2],
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* AaveV4DelegateWithdrawAction - Approves a spender to withdraw from the specified reserve on behalf of the wallet.
|
|
5
|
+
*
|
|
6
|
+
* @category AaveV4DelegateWithdraw
|
|
7
|
+
*/
|
|
8
|
+
export declare class AaveV4DelegateWithdrawAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param spoke Address of the spoke.
|
|
11
|
+
* @param reserveId Reserve id.
|
|
12
|
+
* @param spender Address that will receive the withdraw allowance.
|
|
13
|
+
* @param amount Amount of withdraw allowance.
|
|
14
|
+
*/
|
|
15
|
+
constructor(spoke: EthAddress, reserveId: uint256, spender: EthAddress, amount: uint256);
|
|
16
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* AaveV4DelegateWithdrawAction - Approves a spender to withdraw from the specified reserve on behalf of the wallet.
|
|
5
|
+
*
|
|
6
|
+
* @category AaveV4DelegateWithdraw
|
|
7
|
+
*/
|
|
8
|
+
export class AaveV4DelegateWithdrawAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param spoke Address of the spoke.
|
|
11
|
+
* @param reserveId Reserve id.
|
|
12
|
+
* @param spender Address that will receive the withdraw allowance.
|
|
13
|
+
* @param amount Amount of withdraw allowance.
|
|
14
|
+
*/
|
|
15
|
+
constructor(spoke, reserveId, spender, amount) {
|
|
16
|
+
super('AaveV4DelegateWithdraw', getAddr('AaveV4DelegateWithdraw'), ['address', 'uint256', 'address', 'uint256'], [spoke, reserveId, spender, amount]);
|
|
17
|
+
this.mappableArgs = [
|
|
18
|
+
this.args[0],
|
|
19
|
+
this.args[1],
|
|
20
|
+
this.args[2],
|
|
21
|
+
this.args[3],
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* AaveV4SetUserManagersAction - Sets position managers for the user's wallet.
|
|
5
|
+
*
|
|
6
|
+
* @category AaveV4
|
|
7
|
+
*/
|
|
8
|
+
export declare class AaveV4SetUserManagersAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param spoke Address of the spoke.
|
|
11
|
+
* @param updates The array of position manager updates.
|
|
12
|
+
*/
|
|
13
|
+
constructor(spoke: EthAddress, updates: Array<[EthAddress, boolean]>);
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* AaveV4SetUserManagersAction - Sets position managers for the user's wallet.
|
|
5
|
+
*
|
|
6
|
+
* @category AaveV4
|
|
7
|
+
*/
|
|
8
|
+
export class AaveV4SetUserManagersAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param spoke Address of the spoke.
|
|
11
|
+
* @param updates The array of position manager updates.
|
|
12
|
+
*/
|
|
13
|
+
constructor(spoke, updates) {
|
|
14
|
+
super('AaveV4SetUserManagers', getAddr('AaveV4SetUserManagers'), ['address', 'tuple(address,bool)[]'], [spoke, updates]);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -9,3 +9,7 @@ export * from './AaveV4DelegateBorrowWithSigAction';
|
|
|
9
9
|
export * from './AaveV4DelegateWithdrawWithSigAction';
|
|
10
10
|
export * from './AaveV4SetUserManagersWithSigAction';
|
|
11
11
|
export * from './AaveV4DelegateSetUsingAsCollateralWithSigAction';
|
|
12
|
+
export * from './AaveV4DelegateBorrowAction';
|
|
13
|
+
export * from './AaveV4DelegateWithdrawAction';
|
|
14
|
+
export * from './AaveV4DelegateSetUsingAsCollateralAction';
|
|
15
|
+
export * from './AaveV4SetUserManagersAction';
|
|
@@ -9,3 +9,7 @@ export * from './AaveV4DelegateBorrowWithSigAction';
|
|
|
9
9
|
export * from './AaveV4DelegateWithdrawWithSigAction';
|
|
10
10
|
export * from './AaveV4SetUserManagersWithSigAction';
|
|
11
11
|
export * from './AaveV4DelegateSetUsingAsCollateralWithSigAction';
|
|
12
|
+
export * from './AaveV4DelegateBorrowAction';
|
|
13
|
+
export * from './AaveV4DelegateWithdrawAction';
|
|
14
|
+
export * from './AaveV4DelegateSetUsingAsCollateralAction';
|
|
15
|
+
export * from './AaveV4SetUserManagersAction';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Action } from '../../Action';
|
|
2
|
-
import { uint8, uint256 } from '../../types';
|
|
2
|
+
import { uint8, uint256, EthAddress } from '../../types';
|
|
3
3
|
/**
|
|
4
4
|
* SparkRatioCheckAction - Checks spark ratio for users proxy position and reverts if faulty
|
|
5
5
|
*
|
|
@@ -9,6 +9,8 @@ export declare class SparkRatioCheckAction extends Action {
|
|
|
9
9
|
/**
|
|
10
10
|
* @param ratioState If it should lower/higher
|
|
11
11
|
* @param targetRatio The ratio user want to be at
|
|
12
|
+
* @param market Address provider for specific market. This param was added later
|
|
13
|
+
* @param user Address of the user (EOA/SW). This param was added later
|
|
12
14
|
*/
|
|
13
|
-
constructor(ratioState: uint8, targetRatio: uint256);
|
|
15
|
+
constructor(ratioState: uint8, targetRatio: uint256, market?: EthAddress, user?: EthAddress);
|
|
14
16
|
}
|
|
@@ -9,12 +9,16 @@ export class SparkRatioCheckAction extends Action {
|
|
|
9
9
|
/**
|
|
10
10
|
* @param ratioState If it should lower/higher
|
|
11
11
|
* @param targetRatio The ratio user want to be at
|
|
12
|
+
* @param market Address provider for specific market. This param was added later
|
|
13
|
+
* @param user Address of the user (EOA/SW). This param was added later
|
|
12
14
|
*/
|
|
13
|
-
constructor(ratioState, targetRatio) {
|
|
14
|
-
super('SparkRatioCheck', getAddr('Empty'), ['uint8', 'uint256'], [ratioState, targetRatio]);
|
|
15
|
+
constructor(ratioState, targetRatio, market = getAddr('Empty'), user = getAddr('Empty')) {
|
|
16
|
+
super('SparkRatioCheck', getAddr('Empty'), ['uint8', 'uint256', 'address', 'address'], [ratioState, targetRatio, market, user]);
|
|
15
17
|
this.mappableArgs = [
|
|
16
18
|
this.args[0],
|
|
17
19
|
this.args[1],
|
|
20
|
+
this.args[2],
|
|
21
|
+
this.args[3],
|
|
18
22
|
];
|
|
19
23
|
}
|
|
20
24
|
}
|
|
@@ -9,6 +9,7 @@ export declare class SparkTargetRatioCheck extends Action {
|
|
|
9
9
|
/**
|
|
10
10
|
* @param targetRatio The ratio user want to be at
|
|
11
11
|
* @param market Address of the market
|
|
12
|
+
* @param user Address of the user (EOA/SW). This param was added later
|
|
12
13
|
*/
|
|
13
|
-
constructor(targetRatio: uint256, market: EthAddress);
|
|
14
|
+
constructor(targetRatio: uint256, market: EthAddress, user?: EthAddress);
|
|
14
15
|
}
|
|
@@ -9,12 +9,14 @@ export class SparkTargetRatioCheck extends Action {
|
|
|
9
9
|
/**
|
|
10
10
|
* @param targetRatio The ratio user want to be at
|
|
11
11
|
* @param market Address of the market
|
|
12
|
+
* @param user Address of the user (EOA/SW). This param was added later
|
|
12
13
|
*/
|
|
13
|
-
constructor(targetRatio, market) {
|
|
14
|
-
super('SparkTargetRatioCheck', getAddr('Empty'), ['uint256', 'address'], [targetRatio, market]);
|
|
14
|
+
constructor(targetRatio, market, user = getAddr('Empty')) {
|
|
15
|
+
super('SparkTargetRatioCheck', getAddr('Empty'), ['uint256', 'address', 'address'], [targetRatio, market, user]);
|
|
15
16
|
this.mappableArgs = [
|
|
16
17
|
this.args[0],
|
|
17
18
|
this.args[1],
|
|
19
|
+
this.args[2],
|
|
18
20
|
];
|
|
19
21
|
}
|
|
20
22
|
}
|
|
@@ -40,4 +40,5 @@ import * as fluid from './fluid';
|
|
|
40
40
|
import * as pendle from './pendle';
|
|
41
41
|
import * as umbrella from './umbrella';
|
|
42
42
|
import * as aaveV4 from './aavev4';
|
|
43
|
-
|
|
43
|
+
import * as midnight from './midnight';
|
|
44
|
+
export { aave, maker, compound, basic, flashloan, uniswap, reflexer, dydx, uniswapV3, checkers, liquity, yearn, lido, insta, balancer, curve, guni, mstable, rari, aaveV3, convex, chickenBonds, compoundV3, morpho, bprotocol, lsv, spark, curveusd, morphoblue, summerfi, llamalend, merkl, eulerV2, sky, liquityV2, stkgho, renzo, etherfi, fluid, pendle, umbrella, aaveV4, midnight, };
|
package/esm/src/actions/index.js
CHANGED
|
@@ -40,4 +40,5 @@ import * as fluid from './fluid';
|
|
|
40
40
|
import * as pendle from './pendle';
|
|
41
41
|
import * as umbrella from './umbrella';
|
|
42
42
|
import * as aaveV4 from './aavev4';
|
|
43
|
-
|
|
43
|
+
import * as midnight from './midnight';
|
|
44
|
+
export { aave, maker, compound, basic, flashloan, uniswap, reflexer, dydx, uniswapV3, checkers, liquity, yearn, lido, insta, balancer, curve, guni, mstable, rari, aaveV3, convex, chickenBonds, compoundV3, morpho, bprotocol, lsv, spark, curveusd, morphoblue, summerfi, llamalend, merkl, eulerV2, sky, liquityV2, stkgho, renzo, etherfi, fluid, pendle, umbrella, aaveV4, midnight, };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, bytes32, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* MidnightBorrowFromOrdersAction - Borrow from one or more Midnight offers.
|
|
5
|
+
*
|
|
6
|
+
* @category MidnightBorrowFromOrders
|
|
7
|
+
*/
|
|
8
|
+
export declare class MidnightBorrowFromOrdersAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param marketId Market id.
|
|
11
|
+
* @param onBehalf Address to borrow tokens on behalf of. Defaults to the user's wallet if not provided.
|
|
12
|
+
* @param to Address to send the borrowed tokens to.
|
|
13
|
+
* @param amount Amount of tokens to borrow.
|
|
14
|
+
* @param maxUnits Maximum number of units to take from the orders (slippage protection).
|
|
15
|
+
* @param offerFills Array of offer fills to borrow from.
|
|
16
|
+
*/
|
|
17
|
+
constructor(marketId: bytes32, onBehalf: EthAddress, to: EthAddress, amount: uint256, maxUnits: uint256, offerFills: Array<any>);
|
|
18
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
const offerFillsParamType = 'tuple(tuple(tuple(uint256,address,address,tuple(address,uint256,uint256,address)[],uint256,uint256,address,address),bool,address,uint256,uint256,uint256,bytes32,address,bytes,address,address,bool,uint128,uint128,uint256),bytes,uint256)[]';
|
|
4
|
+
/**
|
|
5
|
+
* MidnightBorrowFromOrdersAction - Borrow from one or more Midnight offers.
|
|
6
|
+
*
|
|
7
|
+
* @category MidnightBorrowFromOrders
|
|
8
|
+
*/
|
|
9
|
+
export class MidnightBorrowFromOrdersAction extends Action {
|
|
10
|
+
/**
|
|
11
|
+
* @param marketId Market id.
|
|
12
|
+
* @param onBehalf Address to borrow tokens on behalf of. Defaults to the user's wallet if not provided.
|
|
13
|
+
* @param to Address to send the borrowed tokens to.
|
|
14
|
+
* @param amount Amount of tokens to borrow.
|
|
15
|
+
* @param maxUnits Maximum number of units to take from the orders (slippage protection).
|
|
16
|
+
* @param offerFills Array of offer fills to borrow from.
|
|
17
|
+
*/
|
|
18
|
+
constructor(marketId, onBehalf, to, amount, maxUnits, offerFills) {
|
|
19
|
+
super('MidnightBorrowFromOrders', getAddr('MidnightBorrowFromOrders'), ['bytes32', 'address', 'address', 'uint256', 'uint256', offerFillsParamType], [marketId, onBehalf, to, amount, maxUnits, offerFills]);
|
|
20
|
+
this.mappableArgs = [
|
|
21
|
+
this.args[0],
|
|
22
|
+
this.args[1],
|
|
23
|
+
this.args[2],
|
|
24
|
+
this.args[3],
|
|
25
|
+
this.args[4],
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, bytes32, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* MidnightPaybackDirectAction - Payback a debt directly to the Midnight protocol.
|
|
5
|
+
*
|
|
6
|
+
* @category MidnightPaybackDirect
|
|
7
|
+
*/
|
|
8
|
+
export declare class MidnightPaybackDirectAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param marketId Market id.
|
|
11
|
+
* @param onBehalf Address to payback tokens on behalf of.
|
|
12
|
+
* @param from Address from which to pull the payback tokens.
|
|
13
|
+
* @param amount Amount of tokens to payback. Send type(uint).max to payback whole amount.
|
|
14
|
+
*/
|
|
15
|
+
constructor(marketId: bytes32, onBehalf: EthAddress, from: EthAddress, amount: uint256);
|
|
16
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* MidnightPaybackDirectAction - Payback a debt directly to the Midnight protocol.
|
|
5
|
+
*
|
|
6
|
+
* @category MidnightPaybackDirect
|
|
7
|
+
*/
|
|
8
|
+
export class MidnightPaybackDirectAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param marketId Market id.
|
|
11
|
+
* @param onBehalf Address to payback tokens on behalf of.
|
|
12
|
+
* @param from Address from which to pull the payback tokens.
|
|
13
|
+
* @param amount Amount of tokens to payback. Send type(uint).max to payback whole amount.
|
|
14
|
+
*/
|
|
15
|
+
constructor(marketId, onBehalf, from, amount) {
|
|
16
|
+
super('MidnightPaybackDirect', getAddr('MidnightPaybackDirect'), ['bytes32', 'address', 'address', 'uint256'], [marketId, onBehalf, from, amount]);
|
|
17
|
+
this.mappableArgs = [
|
|
18
|
+
this.args[0],
|
|
19
|
+
this.args[1],
|
|
20
|
+
this.args[2],
|
|
21
|
+
this.args[3],
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, bytes32, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* MidnightPaybackFromOrdersAction - Pay back debt through one or more Midnight offers.
|
|
5
|
+
*
|
|
6
|
+
* @category MidnightPaybackFromOrders
|
|
7
|
+
*/
|
|
8
|
+
export declare class MidnightPaybackFromOrdersAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param marketId Market id.
|
|
11
|
+
* @param onBehalf Address whose debt is repaid. Defaults to the user's wallet if not provided.
|
|
12
|
+
* @param from Address from which to pull the payback tokens.
|
|
13
|
+
* @param amount Amount of tokens to spend. Send type(uint).max to pay back the whole debt.
|
|
14
|
+
* @param minUnits Minimum number of debt units to repay (slippage protection).
|
|
15
|
+
* @param offerFills Array of offer fills to pay back from.
|
|
16
|
+
*/
|
|
17
|
+
constructor(marketId: bytes32, onBehalf: EthAddress, from: EthAddress, amount: uint256, minUnits: uint256, offerFills: Array<any>);
|
|
18
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
const offerFillsParamType = 'tuple(tuple(tuple(uint256,address,address,tuple(address,uint256,uint256,address)[],uint256,uint256,address,address),bool,address,uint256,uint256,uint256,bytes32,address,bytes,address,address,bool,uint128,uint128,uint256),bytes,uint256)[]';
|
|
4
|
+
/**
|
|
5
|
+
* MidnightPaybackFromOrdersAction - Pay back debt through one or more Midnight offers.
|
|
6
|
+
*
|
|
7
|
+
* @category MidnightPaybackFromOrders
|
|
8
|
+
*/
|
|
9
|
+
export class MidnightPaybackFromOrdersAction extends Action {
|
|
10
|
+
/**
|
|
11
|
+
* @param marketId Market id.
|
|
12
|
+
* @param onBehalf Address whose debt is repaid. Defaults to the user's wallet if not provided.
|
|
13
|
+
* @param from Address from which to pull the payback tokens.
|
|
14
|
+
* @param amount Amount of tokens to spend. Send type(uint).max to pay back the whole debt.
|
|
15
|
+
* @param minUnits Minimum number of debt units to repay (slippage protection).
|
|
16
|
+
* @param offerFills Array of offer fills to pay back from.
|
|
17
|
+
*/
|
|
18
|
+
constructor(marketId, onBehalf, from, amount, minUnits, offerFills) {
|
|
19
|
+
super('MidnightPaybackFromOrders', getAddr('MidnightPaybackFromOrders'), ['bytes32', 'address', 'address', 'uint256', 'uint256', offerFillsParamType], [marketId, onBehalf, from, amount, minUnits, offerFills]);
|
|
20
|
+
this.mappableArgs = [
|
|
21
|
+
this.args[0],
|
|
22
|
+
this.args[1],
|
|
23
|
+
this.args[2],
|
|
24
|
+
this.args[3],
|
|
25
|
+
this.args[4],
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, bytes32, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* MidnightSupplyCollateralAction
|
|
5
|
+
*
|
|
6
|
+
* @category MidnightSupplyCollateral
|
|
7
|
+
*/
|
|
8
|
+
export declare class MidnightSupplyCollateralAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param marketId Market id.
|
|
11
|
+
* @param onBehalf Address to supply tokens on behalf of.
|
|
12
|
+
* @param from Address from which to pull collateral asset.
|
|
13
|
+
* @param amount Amount of tokens to supply.
|
|
14
|
+
* @param collateralIndex Collateral index (0-based).
|
|
15
|
+
*/
|
|
16
|
+
constructor(marketId: bytes32, onBehalf: EthAddress, from: EthAddress, amount: uint256, collateralIndex: uint256);
|
|
17
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* MidnightSupplyCollateralAction
|
|
5
|
+
*
|
|
6
|
+
* @category MidnightSupplyCollateral
|
|
7
|
+
*/
|
|
8
|
+
export class MidnightSupplyCollateralAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param marketId Market id.
|
|
11
|
+
* @param onBehalf Address to supply tokens on behalf of.
|
|
12
|
+
* @param from Address from which to pull collateral asset.
|
|
13
|
+
* @param amount Amount of tokens to supply.
|
|
14
|
+
* @param collateralIndex Collateral index (0-based).
|
|
15
|
+
*/
|
|
16
|
+
constructor(marketId, onBehalf, from, amount, collateralIndex) {
|
|
17
|
+
super('MidnightSupplyCollateral', getAddr('MidnightSupplyCollateral'), ['bytes32', 'address', 'address', 'uint256', 'uint256'], [marketId, onBehalf, from, amount, collateralIndex]);
|
|
18
|
+
this.mappableArgs = [
|
|
19
|
+
this.args[0],
|
|
20
|
+
this.args[1],
|
|
21
|
+
this.args[2],
|
|
22
|
+
this.args[3],
|
|
23
|
+
this.args[4],
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { EthAddress, bytes32, uint256 } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* MidnightWithdrawCollateralAction
|
|
5
|
+
*
|
|
6
|
+
* @category MidnightWithdrawCollateral
|
|
7
|
+
*/
|
|
8
|
+
export declare class MidnightWithdrawCollateralAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param marketId Market id.
|
|
11
|
+
* @param onBehalf Address to withdraw tokens on behalf of.
|
|
12
|
+
* @param to Address that will receive the withdrawn tokens.
|
|
13
|
+
* @param amount Amount of tokens to withdraw. Send type(uint).max to withdraw whole amount.
|
|
14
|
+
* @param collateralIndex Collateral index (0-based).
|
|
15
|
+
*/
|
|
16
|
+
constructor(marketId: bytes32, onBehalf: EthAddress, to: EthAddress, amount: uint256, collateralIndex: uint256);
|
|
17
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Action } from '../../Action';
|
|
2
|
+
import { getAddr } from '../../addresses';
|
|
3
|
+
/**
|
|
4
|
+
* MidnightWithdrawCollateralAction
|
|
5
|
+
*
|
|
6
|
+
* @category MidnightWithdrawCollateral
|
|
7
|
+
*/
|
|
8
|
+
export class MidnightWithdrawCollateralAction extends Action {
|
|
9
|
+
/**
|
|
10
|
+
* @param marketId Market id.
|
|
11
|
+
* @param onBehalf Address to withdraw tokens on behalf of.
|
|
12
|
+
* @param to Address that will receive the withdrawn tokens.
|
|
13
|
+
* @param amount Amount of tokens to withdraw. Send type(uint).max to withdraw whole amount.
|
|
14
|
+
* @param collateralIndex Collateral index (0-based).
|
|
15
|
+
*/
|
|
16
|
+
constructor(marketId, onBehalf, to, amount, collateralIndex) {
|
|
17
|
+
super('MidnightWithdrawCollateral', getAddr('MidnightWithdrawCollateral'), ['bytes32', 'address', 'address', 'uint256', 'uint256'], [marketId, onBehalf, to, amount, collateralIndex]);
|
|
18
|
+
this.mappableArgs = [
|
|
19
|
+
this.args[0],
|
|
20
|
+
this.args[1],
|
|
21
|
+
this.args[2],
|
|
22
|
+
this.args[3],
|
|
23
|
+
this.args[4],
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
}
|