@defisaver/sdk 1.0.7 → 1.0.9

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.
@@ -1,6 +1,6 @@
1
1
  import { AccessListItem, EthAddress } from './types';
2
- declare type ParamTypes = Array<string | Array<any>>;
3
- declare type Args = Array<any>;
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
  *
@@ -62,6 +62,13 @@ export declare class Action {
62
62
  getAssetsToApprove(): Promise<Array<{
63
63
  owner?: string;
64
64
  asset?: string;
65
+ specialApproveLabel?: string;
66
+ [key: string]: any;
67
+ } | {
68
+ owner: string;
69
+ nft: EthAddress;
70
+ tokenId: string;
71
+ specialApproveLabel?: string;
65
72
  [key: string]: any;
66
73
  }>>;
67
74
  /**
@@ -1,5 +1,5 @@
1
1
  import { Action } from './Action';
2
- import { AccessListItem } from './types';
2
+ import { AccessListItem, EthAddress } from './types';
3
3
  /**
4
4
  * Set of Actions to be performed sequentially in a single transaction
5
5
  *
@@ -36,6 +36,12 @@ export declare class Recipe {
36
36
  getAssetsToApprove(): Promise<Array<{
37
37
  owner: string;
38
38
  asset: string;
39
+ specialApproveLabel?: string;
40
+ } | {
41
+ owner: string;
42
+ nft: EthAddress;
43
+ tokenId: string;
44
+ specialApproveLabel?: string;
39
45
  }>>;
40
46
  /**
41
47
  * ETH value to be sent with transaction
package/esm/src/Recipe.js CHANGED
@@ -86,7 +86,17 @@ export class Recipe {
86
86
  for (const pair of pairsPerAction) {
87
87
  const isNft = !pair.asset;
88
88
  if (!uniqueAssetOwnerPairs.find(_pair => _pair.owner === pair.owner && (isNft ? _pair.tokenId === pair.tokenId : _pair.asset === pair.asset))) {
89
- uniqueAssetOwnerPairs.push({ owner: pair.owner, asset: pair.asset });
89
+ if (isNft) {
90
+ uniqueAssetOwnerPairs.push({
91
+ owner: pair.owner,
92
+ nft: pair.nft,
93
+ tokenId: pair.tokenId,
94
+ specialApproveLabel: pair.specialApproveLabel,
95
+ });
96
+ }
97
+ else {
98
+ uniqueAssetOwnerPairs.push({ owner: pair.owner, asset: pair.asset, specialApproveLabel: pair.specialApproveLabel });
99
+ }
90
100
  }
91
101
  }
92
102
  }
@@ -104,6 +104,7 @@ export declare const actionAddresses: {
104
104
  CBChickenIn: string;
105
105
  CBChickenOut: string;
106
106
  CBCreateRebondSub: string;
107
+ FetchBondId: string;
107
108
  CompV3Allow: string;
108
109
  CompV3Borrow: string;
109
110
  CompV3Claim: string;
@@ -241,6 +242,7 @@ export declare const actionAddresses: {
241
242
  CBChickenIn?: undefined;
242
243
  CBChickenOut?: undefined;
243
244
  CBCreateRebondSub?: undefined;
245
+ FetchBondId?: undefined;
244
246
  CompV3Allow?: undefined;
245
247
  CompV3Borrow?: undefined;
246
248
  CompV3Claim?: undefined;
@@ -363,6 +365,7 @@ export declare const actionAddresses: {
363
365
  CBChickenIn?: undefined;
364
366
  CBChickenOut?: undefined;
365
367
  CBCreateRebondSub?: undefined;
368
+ FetchBondId?: undefined;
366
369
  CompV3Allow?: undefined;
367
370
  CompV3Borrow?: undefined;
368
371
  CompV3Claim?: undefined;
@@ -13,9 +13,9 @@ export const actionAddresses = {
13
13
  AutomationV2Unsub: '0xe35Fb12fE9796847751076aCf5ee7d124108612C',
14
14
  SendTokenAndUnwrap: '0xeecd376026335261c89faD40D89625391b1eFF6a',
15
15
  ToggleSub: '0x9A78E9d6538cfDbA0242Ca5eC46771E6132E8085',
16
- UpdateSub: '0x92e93a50F75dF380f0A34327Ce7243E43B74303c',
16
+ UpdateSub: '0xF6Cb8f7e61a64075ec8FAC3f298745605E543233',
17
17
  TransferNFT: '0x861e893E1796F81248e75F06C0b09Abdc8fe2f6F',
18
- CreateSub: '0x6C94C856361aB12165120a3A9A936c41Af238121',
18
+ CreateSub: '0x7308e88BB21B934478E75bB6A2143b8cfDFf2961',
19
19
  // exchange
20
20
  DFSSell: '0x951D7B421f45FF0e4A8ddE0288aE3f9C2C69b784',
21
21
  // maker
@@ -75,7 +75,7 @@ export const actionAddresses = {
75
75
  LiquityClose: '0x4B2d174129789a88e92D46342201F207132144b7',
76
76
  LiquityBorrow: '0xF978d6C5c8af80a059AdB85EEb64F14C9c436D68',
77
77
  LiquityOpen: '0x4EFF392cc69B31Ad159EcfA10305251b2d8E40E0',
78
- LiquityPayback: '0x5eaa94e6E1044F8fe396f76682D4a4546d374527',
78
+ LiquityPayback: '0xe686Fd57D93Ee713Ba974bC5540FF740fb6DB94F',
79
79
  LiquityWithdraw: '0x733F53579bEcdd3Ed07e745A55Ee9af8B9669048',
80
80
  LiquitySupply: '0xD539943e080C2a29e3f1DB2d45Ea7240d7ddDEE2',
81
81
  LiquitySPDeposit: '0x5aB0244a00a733f16E6b238B462bdF3538C698E1',
@@ -125,7 +125,8 @@ export const actionAddresses = {
125
125
  CBRedeem: '0xdD06754cA5367B03af7014AB359332eD82D988d1',
126
126
  CBChickenIn: '0x1E990AF6dCf9E9f8a0b2fc76f3BC032A34fFfD14',
127
127
  CBChickenOut: '0x3d2f2d88749BB387abD07A2408b68D2Bf2D4be3f',
128
- CBCreateRebondSub: '0x31Ebd23C00f3266ae84531025C91c030347CBCAA',
128
+ CBCreateRebondSub: '0xe4bD188cc2e2787518D6762F22E5afe5A21b30E4',
129
+ FetchBondId: '0xA3331A6aE1BC901b8136E6Fe622890B3Fa3dC80e',
129
130
  // CompV3
130
131
  CompV3Allow: '0xC4a80f22bf56E0dFa2CB378561B934F41E14bc9f',
131
132
  CompV3Borrow: '0x11e7b984299a771C92CD42A87358a32791A75CEA',
@@ -115,6 +115,7 @@ declare const actionAddressesAllChains: {
115
115
  CBChickenIn: string;
116
116
  CBChickenOut: string;
117
117
  CBCreateRebondSub: string;
118
+ FetchBondId: string;
118
119
  CompV3Allow: string;
119
120
  CompV3Borrow: string;
120
121
  CompV3Claim: string;
@@ -252,6 +253,7 @@ declare const actionAddressesAllChains: {
252
253
  CBChickenIn?: undefined;
253
254
  CBChickenOut?: undefined;
254
255
  CBCreateRebondSub?: undefined;
256
+ FetchBondId?: undefined;
255
257
  CompV3Allow?: undefined;
256
258
  CompV3Borrow?: undefined;
257
259
  CompV3Claim?: undefined;
@@ -374,6 +376,7 @@ declare const actionAddressesAllChains: {
374
376
  CBChickenIn?: undefined;
375
377
  CBChickenOut?: undefined;
376
378
  CBCreateRebondSub?: undefined;
379
+ FetchBondId?: undefined;
377
380
  CompV3Allow?: undefined;
378
381
  CompV3Borrow?: undefined;
379
382
  CompV3Claim?: undefined;
@@ -489,6 +492,7 @@ declare const actionAddresses: (chainId?: null) => {
489
492
  CBChickenIn: string;
490
493
  CBChickenOut: string;
491
494
  CBCreateRebondSub: string;
495
+ FetchBondId: string;
492
496
  CompV3Allow: string;
493
497
  CompV3Borrow: string;
494
498
  CompV3Claim: string;
@@ -626,6 +630,7 @@ declare const actionAddresses: (chainId?: null) => {
626
630
  CBChickenIn?: undefined;
627
631
  CBChickenOut?: undefined;
628
632
  CBCreateRebondSub?: undefined;
633
+ FetchBondId?: undefined;
629
634
  CompV3Allow?: undefined;
630
635
  CompV3Borrow?: undefined;
631
636
  CompV3Claim?: undefined;
@@ -748,6 +753,7 @@ declare const actionAddresses: (chainId?: null) => {
748
753
  CBChickenIn?: undefined;
749
754
  CBChickenOut?: undefined;
750
755
  CBCreateRebondSub?: undefined;
756
+ FetchBondId?: undefined;
751
757
  CompV3Allow?: undefined;
752
758
  CompV3Borrow?: undefined;
753
759
  CompV3Claim?: undefined;
@@ -960,6 +966,7 @@ declare const _default: {
960
966
  CBChickenIn: string;
961
967
  CBChickenOut: string;
962
968
  CBCreateRebondSub: string;
969
+ FetchBondId: string;
963
970
  CompV3Allow: string;
964
971
  CompV3Borrow: string;
965
972
  CompV3Claim: string;
@@ -1097,6 +1104,7 @@ declare const _default: {
1097
1104
  CBChickenIn?: undefined;
1098
1105
  CBChickenOut?: undefined;
1099
1106
  CBCreateRebondSub?: undefined;
1107
+ FetchBondId?: undefined;
1100
1108
  CompV3Allow?: undefined;
1101
1109
  CompV3Borrow?: undefined;
1102
1110
  CompV3Claim?: undefined;
@@ -1219,6 +1227,7 @@ declare const _default: {
1219
1227
  CBChickenIn?: undefined;
1220
1228
  CBChickenOut?: undefined;
1221
1229
  CBCreateRebondSub?: undefined;
1230
+ FetchBondId?: undefined;
1222
1231
  CompV3Allow?: undefined;
1223
1232
  CompV3Borrow?: undefined;
1224
1233
  CompV3Claim?: undefined;
@@ -1334,6 +1343,7 @@ declare const _default: {
1334
1343
  CBChickenIn: string;
1335
1344
  CBChickenOut: string;
1336
1345
  CBCreateRebondSub: string;
1346
+ FetchBondId: string;
1337
1347
  CompV3Allow: string;
1338
1348
  CompV3Borrow: string;
1339
1349
  CompV3Claim: string;
@@ -1471,6 +1481,7 @@ declare const _default: {
1471
1481
  CBChickenIn?: undefined;
1472
1482
  CBChickenOut?: undefined;
1473
1483
  CBCreateRebondSub?: undefined;
1484
+ FetchBondId?: undefined;
1474
1485
  CompV3Allow?: undefined;
1475
1486
  CompV3Borrow?: undefined;
1476
1487
  CompV3Claim?: undefined;
@@ -1593,6 +1604,7 @@ declare const _default: {
1593
1604
  CBChickenIn?: undefined;
1594
1605
  CBChickenOut?: undefined;
1595
1606
  CBCreateRebondSub?: undefined;
1607
+ FetchBondId?: undefined;
1596
1608
  CompV3Allow?: undefined;
1597
1609
  CompV3Borrow?: undefined;
1598
1610
  CompV3Claim?: undefined;
@@ -0,0 +1,10 @@
1
+ import { Action } from '../Action';
2
+ import { EthAddress, uint256, uint8 } from '../types';
3
+ /**
4
+ *
5
+ *
6
+ * @category Triggers
7
+ */
8
+ export declare class AaveV3QuotePriceTrigger extends Action {
9
+ constructor(baseTokenAddr: EthAddress, quoteTokenAddr: EthAddress, price: uint256, state: uint8);
10
+ }
@@ -0,0 +1,12 @@
1
+ import { Action } from '../Action';
2
+ import { getAddr } from '../addresses';
3
+ /**
4
+ *
5
+ *
6
+ * @category Triggers
7
+ */
8
+ export class AaveV3QuotePriceTrigger extends Action {
9
+ constructor(baseTokenAddr, quoteTokenAddr, price, state) {
10
+ super('AaveV3QuotePriceTrigger', getAddr('AaveV3QuotePriceTrigger'), [['address', 'address', 'uint256', 'uint8']], [[baseTokenAddr, quoteTokenAddr, price, state]]);
11
+ }
12
+ }
@@ -10,3 +10,4 @@ export * from './AaveV3RatioTrigger';
10
10
  export * from './CompV3RatioTrigger';
11
11
  export * from './TrailingStopTrigger';
12
12
  export * from './CBRebondTrigger';
13
+ export * from './AaveV3QuotePriceTrigger';
@@ -10,3 +10,4 @@ export * from './AaveV3RatioTrigger';
10
10
  export * from './CompV3RatioTrigger';
11
11
  export * from './TrailingStopTrigger';
12
12
  export * from './CBRebondTrigger';
13
+ export * from './AaveV3QuotePriceTrigger';
@@ -1,17 +1,17 @@
1
- declare type AccessListItem = {
1
+ type AccessListItem = {
2
2
  address: EthAddress;
3
3
  storageKeys: Array<any>;
4
4
  };
5
- declare type AccessList = Array<Array<any>>;
6
- declare type AccessLists = {
5
+ type AccessList = Array<Array<any>>;
6
+ type AccessLists = {
7
7
  [key: string]: AccessList;
8
8
  };
9
- declare type Config = {
9
+ type Config = {
10
10
  chainId: number;
11
11
  testingMode: boolean;
12
12
  [key: string]: any;
13
13
  };
14
- declare type Network = {
14
+ type Network = {
15
15
  chainId: number;
16
16
  chainName: string;
17
17
  blockExplorerUrls: Array<string>;
@@ -23,21 +23,21 @@ declare type Network = {
23
23
  symbol: string;
24
24
  };
25
25
  };
26
- declare type Networks = {
26
+ type Networks = {
27
27
  ethereum: Network;
28
28
  optimism: Network;
29
29
  arbitrum: Network;
30
30
  };
31
- declare type EthAddress = string;
32
- declare type bytes32 = string;
33
- declare type bytes = string | Array<any>;
34
- declare type uint256 = string;
35
- declare type uint160 = string;
36
- declare type uint128 = string;
37
- declare type uint80 = string;
38
- declare type uint64 = string;
39
- declare type uint24 = string;
40
- declare type uint16 = string;
41
- declare type uint8 = string;
42
- declare type int24 = string;
31
+ type EthAddress = string;
32
+ type bytes32 = string;
33
+ type bytes = string | Array<any>;
34
+ type uint256 = string;
35
+ type uint160 = string;
36
+ type uint128 = string;
37
+ type uint80 = string;
38
+ type uint64 = string;
39
+ type uint24 = string;
40
+ type uint16 = string;
41
+ type uint8 = string;
42
+ type int24 = string;
43
43
  export { AccessList, AccessListItem, AccessLists, Config, Network, Networks, EthAddress, bytes32, bytes, uint256, uint160, uint128, uint80, uint64, uint24, uint16, uint8, int24, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/sdk",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "",
5
5
  "main": "./umd/index.js",
6
6
  "module": "./esm/src/index.js",
package/src/Action.ts CHANGED
@@ -191,7 +191,7 @@ export class Action {
191
191
  * Assets requiring approval to be used by DsProxy
192
192
  * Approval is done from owner to DsProxy
193
193
  */
194
- async getAssetsToApprove(): Promise<Array<{ owner?: string, asset?: string, [key: string]:any }>> {
194
+ async getAssetsToApprove(): Promise<Array<{ owner?: string, asset?: string, specialApproveLabel?: string, [key: string]:any } | { owner: string, nft: EthAddress, tokenId: string, specialApproveLabel?: string, [key: string]:any }>> {
195
195
  return [];
196
196
  }
197
197
 
package/src/Recipe.ts CHANGED
@@ -89,14 +89,23 @@ export class Recipe {
89
89
  * Assets requiring approval to be used by DsProxy
90
90
  * Approval is done from owner to DsProxy
91
91
  */
92
- async getAssetsToApprove() : Promise<Array<{ owner: string, asset: string }>> {
93
- const uniqueAssetOwnerPairs : Array<{ owner: string, asset: string, [key: string]:any }> = [];
92
+ async getAssetsToApprove() : Promise<Array<{ owner: string, asset: string, specialApproveLabel?: string } | { owner: string, nft: EthAddress, tokenId: string, specialApproveLabel?: string }>> {
93
+ const uniqueAssetOwnerPairs : Array<{ owner: string, asset: string, specialApproveLabel?: string, [key: string]:any } | { owner: string, nft: EthAddress, tokenId: string, specialApproveLabel?: string, [key: string]:any }> = [];
94
94
  const assetOwnerPairs = await Promise.all(this.actions.map(a => a.getAssetsToApprove()));
95
95
  for (const pairsPerAction of assetOwnerPairs) {
96
96
  for (const pair of pairsPerAction) {
97
97
  const isNft = !pair.asset;
98
98
  if (!uniqueAssetOwnerPairs.find(_pair => _pair.owner === pair.owner && (isNft ? _pair.tokenId === pair.tokenId : _pair.asset === pair.asset))) {
99
- uniqueAssetOwnerPairs.push({ owner: pair.owner!, asset: pair.asset! });
99
+ if (isNft) {
100
+ uniqueAssetOwnerPairs.push({
101
+ owner: pair.owner!,
102
+ nft: pair.nft!,
103
+ tokenId: pair.tokenId!,
104
+ specialApproveLabel: pair.specialApproveLabel!,
105
+ });
106
+ } else {
107
+ uniqueAssetOwnerPairs.push({ owner: pair.owner!, asset: pair.asset!, specialApproveLabel: pair.specialApproveLabel! });
108
+ }
100
109
  }
101
110
  }
102
111
  }
package/src/addresses.ts CHANGED
@@ -15,9 +15,9 @@ export const actionAddresses = {
15
15
  AutomationV2Unsub: '0xe35Fb12fE9796847751076aCf5ee7d124108612C',
16
16
  SendTokenAndUnwrap: '0xeecd376026335261c89faD40D89625391b1eFF6a',
17
17
  ToggleSub: '0x9A78E9d6538cfDbA0242Ca5eC46771E6132E8085',
18
- UpdateSub: '0x92e93a50F75dF380f0A34327Ce7243E43B74303c',
18
+ UpdateSub: '0xF6Cb8f7e61a64075ec8FAC3f298745605E543233',
19
19
  TransferNFT: '0x861e893E1796F81248e75F06C0b09Abdc8fe2f6F',
20
- CreateSub: '0x6C94C856361aB12165120a3A9A936c41Af238121',
20
+ CreateSub: '0x7308e88BB21B934478E75bB6A2143b8cfDFf2961',
21
21
  // exchange
22
22
  DFSSell: '0x951D7B421f45FF0e4A8ddE0288aE3f9C2C69b784',
23
23
 
@@ -88,7 +88,7 @@ export const actionAddresses = {
88
88
  LiquityClose: '0x4B2d174129789a88e92D46342201F207132144b7',
89
89
  LiquityBorrow: '0xF978d6C5c8af80a059AdB85EEb64F14C9c436D68',
90
90
  LiquityOpen: '0x4EFF392cc69B31Ad159EcfA10305251b2d8E40E0',
91
- LiquityPayback: '0x5eaa94e6E1044F8fe396f76682D4a4546d374527',
91
+ LiquityPayback: '0xe686Fd57D93Ee713Ba974bC5540FF740fb6DB94F',
92
92
  LiquityWithdraw: '0x733F53579bEcdd3Ed07e745A55Ee9af8B9669048',
93
93
  LiquitySupply: '0xD539943e080C2a29e3f1DB2d45Ea7240d7ddDEE2',
94
94
  LiquitySPDeposit: '0x5aB0244a00a733f16E6b238B462bdF3538C698E1',
@@ -152,7 +152,8 @@ export const actionAddresses = {
152
152
  CBRedeem: '0xdD06754cA5367B03af7014AB359332eD82D988d1',
153
153
  CBChickenIn: '0x1E990AF6dCf9E9f8a0b2fc76f3BC032A34fFfD14',
154
154
  CBChickenOut: '0x3d2f2d88749BB387abD07A2408b68D2Bf2D4be3f',
155
- CBCreateRebondSub: '0x31Ebd23C00f3266ae84531025C91c030347CBCAA',
155
+ CBCreateRebondSub: '0xe4bD188cc2e2787518D6762F22E5afe5A21b30E4',
156
+ FetchBondId: '0xA3331A6aE1BC901b8136E6Fe622890B3Fa3dC80e',
156
157
  // CompV3
157
158
  CompV3Allow: '0xC4a80f22bf56E0dFa2CB378561B934F41E14bc9f',
158
159
  CompV3Borrow: '0x11e7b984299a771C92CD42A87358a32791A75CEA',
@@ -0,0 +1,14 @@
1
+ import { Action } from '../Action';
2
+ import { getAddr } from '../addresses';
3
+ import { EthAddress, uint256, uint8 } from '../types';
4
+
5
+ /**
6
+ *
7
+ *
8
+ * @category Triggers
9
+ */
10
+ export class AaveV3QuotePriceTrigger extends Action {
11
+ constructor(baseTokenAddr:EthAddress, quoteTokenAddr:EthAddress, price:uint256, state:uint8) {
12
+ super('AaveV3QuotePriceTrigger', getAddr('AaveV3QuotePriceTrigger'), [['address', 'address', 'uint256', 'uint8']], [[baseTokenAddr, quoteTokenAddr, price, state]]);
13
+ }
14
+ }
@@ -10,3 +10,4 @@ export * from './AaveV3RatioTrigger';
10
10
  export * from './CompV3RatioTrigger';
11
11
  export * from './TrailingStopTrigger';
12
12
  export * from './CBRebondTrigger';
13
+ export * from './AaveV3QuotePriceTrigger';