@defisaver/sdk 1.0.57 → 1.0.59
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/DEV.md +43 -0
- package/esm/src/Action.d.ts +2 -2
- package/esm/src/addresses.d.ts +7 -7
- package/esm/src/addresses.js +9 -1
- package/esm/src/index.d.ts +28 -28
- package/esm/src/types.d.ts +20 -20
- package/package.json +1 -1
- package/src/addresses.ts +10 -1
- package/umd/index.js +83 -33
- package/yarn-error.log +3976 -0
package/DEV.md
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# DeFi Saver SDK
|
|
2
|
+
|
|
3
|
+
Every specific action is a class that has to extend base class [Action](https://github.com/defisaver/defisaver-sdk/blob/master/src/Action.ts) or [ActionWithL2](https://github.com/defisaver/defisaver-sdk/blob/master/src/ActionWithL2.ts)
|
|
4
|
+
|
|
5
|
+
When using an action in a recipe, you can pipe an output of an action used before it by putting $ and then the number of action which output you want to use (starting from 1, not 0)
|
|
6
|
+
e.g.
|
|
7
|
+
|
|
8
|
+
```js
|
|
9
|
+
const recipe = new Recipe('exampleLiquitySupply', [
|
|
10
|
+
// pull 1 WETH from user address
|
|
11
|
+
new dfs.actions.basic.PullToken('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', '0x123..', 1000000000000000000),
|
|
12
|
+
// $1 will use the output of the first action as that argument - in this case, it will be 1 WETH
|
|
13
|
+
new dfs.actions.liquity.LiquitySupplyAction('$1', '0xProxy', 'upperHint', 'lowerHint'),
|
|
14
|
+
]);
|
|
15
|
+
```
|
|
16
|
+
## Action
|
|
17
|
+
|
|
18
|
+
- ```constructor``` - here you should sanity check arguments, and call ```super(actionName, addressOfAction, types, args)``` where types are used for encoding args
|
|
19
|
+
- ```mappableArgs``` - if needed, have to be defined in ```constructor```
|
|
20
|
+
- ```getAssetsToApprove``` - if action pulls tokens from the address, this should return an array of tokens that need to be approved (erc20 and/or nfts). [Return type object](https://github.com/defisaver/defisaver-sdk/blob/29aa14835240b977ceb053dfc947faae5d19ff9d/src/Action.ts#L195) is defined here.
|
|
21
|
+
- ```getEthValue``` - needed if action is using pure ETH, then value is required when sending a tx
|
|
22
|
+
- ```encodeInputs``` - if Action extends ActionWithL2, it can have custom function for gas savings e.g. pack address as 20 bytes instead od 32
|
|
23
|
+
- ```encodeForDsProxyCall```
|
|
24
|
+
- ```encodeForL2DsProxyCall```
|
|
25
|
+
- ```encodeForRecipe```
|
|
26
|
+
- ```encodeForL2Recipe```
|
|
27
|
+
- ```encodeForStrategy```
|
|
28
|
+
|
|
29
|
+
## Recipe
|
|
30
|
+
|
|
31
|
+
- ```constructor(name, actions)``` - name of the recipe is required, actions are optional
|
|
32
|
+
- ```addAction``` - add Action to Recipe
|
|
33
|
+
- ```getAssetsToApprove``` - returns an array of all unique token approvals from all actions from the recipe
|
|
34
|
+
- ```getEthValue``` - sum of values from all actions
|
|
35
|
+
- ```encodeForDsProxyCall```
|
|
36
|
+
|
|
37
|
+
## Addresses
|
|
38
|
+
|
|
39
|
+
All contract addresses can be found [here](https://github.com/defisaver/defisaver-sdk/blob/master/src/addresses.ts)
|
|
40
|
+
|
|
41
|
+
## Examples
|
|
42
|
+
|
|
43
|
+
Examples and tests can be found [here](https://github.com/defisaver/defisaver-sdk/tree/master/test)
|
package/esm/src/Action.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AccessListItem, EthAddress } from './types';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type ParamTypes = Array<string | Array<any>>;
|
|
3
|
+
type Args = Array<any>;
|
|
4
4
|
/**
|
|
5
5
|
* Single action that can be executed directly, or combined into a set (ie. supply a vault)
|
|
6
6
|
*
|
package/esm/src/addresses.d.ts
CHANGED
|
@@ -370,6 +370,13 @@ export declare const actionAddresses: {
|
|
|
370
370
|
AaveV3Supply: string;
|
|
371
371
|
AaveV3SwapBorrowRateMode: string;
|
|
372
372
|
AaveV3Withdraw: string;
|
|
373
|
+
CompV3Allow: string;
|
|
374
|
+
CompV3Borrow: string;
|
|
375
|
+
CompV3Claim: string;
|
|
376
|
+
CompV3Payback: string;
|
|
377
|
+
CompV3Supply: string;
|
|
378
|
+
CompV3Transfer: string;
|
|
379
|
+
CompV3Withdraw: string;
|
|
373
380
|
FLAaveV3NoFee: string;
|
|
374
381
|
FLAaveV3: string;
|
|
375
382
|
FLBalancer: string;
|
|
@@ -507,13 +514,6 @@ export declare const actionAddresses: {
|
|
|
507
514
|
CBChickenOut?: undefined;
|
|
508
515
|
CBCreateRebondSub?: undefined;
|
|
509
516
|
FetchBondId?: undefined;
|
|
510
|
-
CompV3Allow?: undefined;
|
|
511
|
-
CompV3Borrow?: undefined;
|
|
512
|
-
CompV3Claim?: undefined;
|
|
513
|
-
CompV3Payback?: undefined;
|
|
514
|
-
CompV3Supply?: undefined;
|
|
515
|
-
CompV3Transfer?: undefined;
|
|
516
|
-
CompV3Withdraw?: undefined;
|
|
517
517
|
CurveUsdBorrow?: undefined;
|
|
518
518
|
CurveUsdCreate?: undefined;
|
|
519
519
|
CurveUsdPayback?: undefined;
|
package/esm/src/addresses.js
CHANGED
|
@@ -259,6 +259,14 @@ export const actionAddresses = {
|
|
|
259
259
|
AaveV3Supply: '0xF159c79077001E2a2C1a178BE68DB7F69a6Da486',
|
|
260
260
|
AaveV3SwapBorrowRateMode: '0x738042389A8d6B0F6D6ab009c42dfF84ebB737C0',
|
|
261
261
|
AaveV3Withdraw: '0xbf492F869DdB1A18BB4F41b6c3059D9f882Fe7ff',
|
|
262
|
+
// CompV3
|
|
263
|
+
CompV3Allow: '0x0380E8e13CdE0499c720999930CaA07A5744887c',
|
|
264
|
+
CompV3Borrow: '0x1C0eCc794fDA7c29aBd19E0b2F7dA166C237d616',
|
|
265
|
+
CompV3Claim: '0xDa135F74a24FE2B23ECc35De227f5d3b000c5AdA',
|
|
266
|
+
CompV3Payback: '0xeA8b80944a70e6C290eb00Ae0298d2953aD3aA0C',
|
|
267
|
+
CompV3Supply: '0x82bf73d2083e69344747fff0d51816059db0113c',
|
|
268
|
+
CompV3Transfer: '0x9EB98fA05E89a598288B0386e66052Ba0d0B9911',
|
|
269
|
+
CompV3Withdraw: '0xb6c2dC95201630cAF7568cBdF434d787CD84dB79',
|
|
262
270
|
// flashloan
|
|
263
271
|
FLAaveV3NoFee: '0x219ac6dA971dE6d943cffD1BD62abde71525d382',
|
|
264
272
|
FLAaveV3: '0x53953aCEe438c083e4299F7976f03Ff3cb862161',
|
|
@@ -282,7 +290,7 @@ export const actionAddresses = {
|
|
|
282
290
|
PullToken: '0x5B0B7E38C2a8e46CfAe13c360BC5927570BeEe94',
|
|
283
291
|
TokenBalance: '0xc44bcE580B1b3339fE9272D3bC3d6566083ea59C',
|
|
284
292
|
// Flashloan
|
|
285
|
-
FLAaveV3: '
|
|
293
|
+
FLAaveV3: '0x79Eb9cEe432Cd3e7b09A9eFdB21A733A6d7b4c3A',
|
|
286
294
|
FLBalancer: '0x862E533198C9656B75bB6A5dDF0953F7ED5E8507',
|
|
287
295
|
FLUniV3: '0x1bA6082D2ef1aB92a55B96264c72Eb8049C964Ce',
|
|
288
296
|
// AaveV3
|
package/esm/src/index.d.ts
CHANGED
|
@@ -381,6 +381,13 @@ declare const actionAddressesAllChains: {
|
|
|
381
381
|
AaveV3Supply: string;
|
|
382
382
|
AaveV3SwapBorrowRateMode: string;
|
|
383
383
|
AaveV3Withdraw: string;
|
|
384
|
+
CompV3Allow: string;
|
|
385
|
+
CompV3Borrow: string;
|
|
386
|
+
CompV3Claim: string;
|
|
387
|
+
CompV3Payback: string;
|
|
388
|
+
CompV3Supply: string;
|
|
389
|
+
CompV3Transfer: string;
|
|
390
|
+
CompV3Withdraw: string;
|
|
384
391
|
FLAaveV3NoFee: string;
|
|
385
392
|
FLAaveV3: string;
|
|
386
393
|
FLBalancer: string;
|
|
@@ -518,13 +525,6 @@ declare const actionAddressesAllChains: {
|
|
|
518
525
|
CBChickenOut?: undefined;
|
|
519
526
|
CBCreateRebondSub?: undefined;
|
|
520
527
|
FetchBondId?: undefined;
|
|
521
|
-
CompV3Allow?: undefined;
|
|
522
|
-
CompV3Borrow?: undefined;
|
|
523
|
-
CompV3Claim?: undefined;
|
|
524
|
-
CompV3Payback?: undefined;
|
|
525
|
-
CompV3Supply?: undefined;
|
|
526
|
-
CompV3Transfer?: undefined;
|
|
527
|
-
CompV3Withdraw?: undefined;
|
|
528
528
|
CurveUsdBorrow?: undefined;
|
|
529
529
|
CurveUsdCreate?: undefined;
|
|
530
530
|
CurveUsdPayback?: undefined;
|
|
@@ -1087,6 +1087,13 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
1087
1087
|
AaveV3Supply: string;
|
|
1088
1088
|
AaveV3SwapBorrowRateMode: string;
|
|
1089
1089
|
AaveV3Withdraw: string;
|
|
1090
|
+
CompV3Allow: string;
|
|
1091
|
+
CompV3Borrow: string;
|
|
1092
|
+
CompV3Claim: string;
|
|
1093
|
+
CompV3Payback: string;
|
|
1094
|
+
CompV3Supply: string;
|
|
1095
|
+
CompV3Transfer: string;
|
|
1096
|
+
CompV3Withdraw: string;
|
|
1090
1097
|
FLAaveV3NoFee: string;
|
|
1091
1098
|
FLAaveV3: string;
|
|
1092
1099
|
FLBalancer: string;
|
|
@@ -1224,13 +1231,6 @@ declare const actionAddresses: (chainId?: null) => {
|
|
|
1224
1231
|
CBChickenOut?: undefined;
|
|
1225
1232
|
CBCreateRebondSub?: undefined;
|
|
1226
1233
|
FetchBondId?: undefined;
|
|
1227
|
-
CompV3Allow?: undefined;
|
|
1228
|
-
CompV3Borrow?: undefined;
|
|
1229
|
-
CompV3Claim?: undefined;
|
|
1230
|
-
CompV3Payback?: undefined;
|
|
1231
|
-
CompV3Supply?: undefined;
|
|
1232
|
-
CompV3Transfer?: undefined;
|
|
1233
|
-
CompV3Withdraw?: undefined;
|
|
1234
1234
|
CurveUsdBorrow?: undefined;
|
|
1235
1235
|
CurveUsdCreate?: undefined;
|
|
1236
1236
|
CurveUsdPayback?: undefined;
|
|
@@ -1936,6 +1936,13 @@ declare const _default: {
|
|
|
1936
1936
|
AaveV3Supply: string;
|
|
1937
1937
|
AaveV3SwapBorrowRateMode: string;
|
|
1938
1938
|
AaveV3Withdraw: string;
|
|
1939
|
+
CompV3Allow: string;
|
|
1940
|
+
CompV3Borrow: string;
|
|
1941
|
+
CompV3Claim: string;
|
|
1942
|
+
CompV3Payback: string;
|
|
1943
|
+
CompV3Supply: string;
|
|
1944
|
+
CompV3Transfer: string;
|
|
1945
|
+
CompV3Withdraw: string;
|
|
1939
1946
|
FLAaveV3NoFee: string;
|
|
1940
1947
|
FLAaveV3: string;
|
|
1941
1948
|
FLBalancer: string;
|
|
@@ -2073,13 +2080,6 @@ declare const _default: {
|
|
|
2073
2080
|
CBChickenOut?: undefined;
|
|
2074
2081
|
CBCreateRebondSub?: undefined;
|
|
2075
2082
|
FetchBondId?: undefined;
|
|
2076
|
-
CompV3Allow?: undefined;
|
|
2077
|
-
CompV3Borrow?: undefined;
|
|
2078
|
-
CompV3Claim?: undefined;
|
|
2079
|
-
CompV3Payback?: undefined;
|
|
2080
|
-
CompV3Supply?: undefined;
|
|
2081
|
-
CompV3Transfer?: undefined;
|
|
2082
|
-
CompV3Withdraw?: undefined;
|
|
2083
2083
|
CurveUsdBorrow?: undefined;
|
|
2084
2084
|
CurveUsdCreate?: undefined;
|
|
2085
2085
|
CurveUsdPayback?: undefined;
|
|
@@ -2642,6 +2642,13 @@ declare const _default: {
|
|
|
2642
2642
|
AaveV3Supply: string;
|
|
2643
2643
|
AaveV3SwapBorrowRateMode: string;
|
|
2644
2644
|
AaveV3Withdraw: string;
|
|
2645
|
+
CompV3Allow: string;
|
|
2646
|
+
CompV3Borrow: string;
|
|
2647
|
+
CompV3Claim: string;
|
|
2648
|
+
CompV3Payback: string;
|
|
2649
|
+
CompV3Supply: string;
|
|
2650
|
+
CompV3Transfer: string;
|
|
2651
|
+
CompV3Withdraw: string;
|
|
2645
2652
|
FLAaveV3NoFee: string;
|
|
2646
2653
|
FLAaveV3: string;
|
|
2647
2654
|
FLBalancer: string;
|
|
@@ -2779,13 +2786,6 @@ declare const _default: {
|
|
|
2779
2786
|
CBChickenOut?: undefined;
|
|
2780
2787
|
CBCreateRebondSub?: undefined;
|
|
2781
2788
|
FetchBondId?: undefined;
|
|
2782
|
-
CompV3Allow?: undefined;
|
|
2783
|
-
CompV3Borrow?: undefined;
|
|
2784
|
-
CompV3Claim?: undefined;
|
|
2785
|
-
CompV3Payback?: undefined;
|
|
2786
|
-
CompV3Supply?: undefined;
|
|
2787
|
-
CompV3Transfer?: undefined;
|
|
2788
|
-
CompV3Withdraw?: undefined;
|
|
2789
2789
|
CurveUsdBorrow?: undefined;
|
|
2790
2790
|
CurveUsdCreate?: undefined;
|
|
2791
2791
|
CurveUsdPayback?: undefined;
|
package/esm/src/types.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
type AccessListItem = {
|
|
2
2
|
address: EthAddress;
|
|
3
3
|
storageKeys: Array<any>;
|
|
4
4
|
};
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
type AccessList = Array<Array<any>>;
|
|
6
|
+
type AccessLists = {
|
|
7
7
|
[key: string]: AccessList;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
type Config = {
|
|
10
10
|
chainId: number;
|
|
11
11
|
testingMode: boolean;
|
|
12
12
|
[key: string]: any;
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
type Network = {
|
|
15
15
|
chainId: number;
|
|
16
16
|
chainName: string;
|
|
17
17
|
blockExplorerUrls: Array<string>;
|
|
@@ -23,24 +23,24 @@ declare type Network = {
|
|
|
23
23
|
symbol: string;
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
type Networks = {
|
|
27
27
|
ethereum: Network;
|
|
28
28
|
optimism: Network;
|
|
29
29
|
arbitrum: Network;
|
|
30
30
|
base: Network;
|
|
31
31
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
32
|
+
type EthAddress = string;
|
|
33
|
+
type bytes32 = string;
|
|
34
|
+
type bytes = string | Array<any>;
|
|
35
|
+
type uint256 = string;
|
|
36
|
+
type uint32 = string;
|
|
37
|
+
type uint160 = string;
|
|
38
|
+
type uint128 = string;
|
|
39
|
+
type uint80 = string;
|
|
40
|
+
type uint64 = string;
|
|
41
|
+
type uint24 = string;
|
|
42
|
+
type uint16 = string;
|
|
43
|
+
type uint8 = string;
|
|
44
|
+
type int256 = string;
|
|
45
|
+
type int24 = string;
|
|
46
46
|
export { AccessList, AccessListItem, AccessLists, Config, Network, Networks, EthAddress, bytes32, bytes, uint256, uint160, uint32, uint128, uint80, uint64, uint24, uint16, uint8, int256, int24, };
|
package/package.json
CHANGED
package/src/addresses.ts
CHANGED
|
@@ -302,6 +302,15 @@ export const actionAddresses = {
|
|
|
302
302
|
AaveV3SwapBorrowRateMode: '0x738042389A8d6B0F6D6ab009c42dfF84ebB737C0',
|
|
303
303
|
AaveV3Withdraw: '0xbf492F869DdB1A18BB4F41b6c3059D9f882Fe7ff',
|
|
304
304
|
|
|
305
|
+
// CompV3
|
|
306
|
+
CompV3Allow: '0x0380E8e13CdE0499c720999930CaA07A5744887c',
|
|
307
|
+
CompV3Borrow: '0x1C0eCc794fDA7c29aBd19E0b2F7dA166C237d616',
|
|
308
|
+
CompV3Claim: '0xDa135F74a24FE2B23ECc35De227f5d3b000c5AdA',
|
|
309
|
+
CompV3Payback: '0xeA8b80944a70e6C290eb00Ae0298d2953aD3aA0C',
|
|
310
|
+
CompV3Supply: '0x82bf73d2083e69344747fff0d51816059db0113c',
|
|
311
|
+
CompV3Transfer: '0x9EB98fA05E89a598288B0386e66052Ba0d0B9911',
|
|
312
|
+
CompV3Withdraw: '0xb6c2dC95201630cAF7568cBdF434d787CD84dB79',
|
|
313
|
+
|
|
305
314
|
// flashloan
|
|
306
315
|
FLAaveV3NoFee: '0x219ac6dA971dE6d943cffD1BD62abde71525d382',
|
|
307
316
|
FLAaveV3: '0x53953aCEe438c083e4299F7976f03Ff3cb862161',
|
|
@@ -328,7 +337,7 @@ export const actionAddresses = {
|
|
|
328
337
|
TokenBalance: '0xc44bcE580B1b3339fE9272D3bC3d6566083ea59C',
|
|
329
338
|
|
|
330
339
|
// Flashloan
|
|
331
|
-
FLAaveV3: '
|
|
340
|
+
FLAaveV3: '0x79Eb9cEe432Cd3e7b09A9eFdB21A733A6d7b4c3A',
|
|
332
341
|
FLBalancer: '0x862E533198C9656B75bB6A5dDF0953F7ED5E8507',
|
|
333
342
|
FLUniV3: '0x1bA6082D2ef1aB92a55B96264c72Eb8049C964Ce',
|
|
334
343
|
|