@defisaver/sdk 1.3.26 → 1.3.27

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.
@@ -0,0 +1,20 @@
1
+ import { Action } from '../../Action';
2
+ import { EthAddress, uint256 } from '../../types';
3
+ /**
4
+ * EtherFiStakeFromLidoAction - Converts wstETH to weETH through Ether.fi's Lido staking route
5
+ *
6
+ * @category EtherFi
7
+ */
8
+ export declare class EtherFiStakeFromLidoAction extends Action {
9
+ /**
10
+ * @param amount - amount of wstETH to pull
11
+ * @param minAmountOut - minimum amount of weETH to receive
12
+ * @param from - address from which to pull wstETH
13
+ * @param to - address where received weETH will be sent
14
+ */
15
+ constructor(amount: uint256, minAmountOut: uint256, from: EthAddress, to: EthAddress);
16
+ getAssetsToApprove(): Promise<{
17
+ asset: string;
18
+ owner: any;
19
+ }[]>;
20
+ }
@@ -0,0 +1,41 @@
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 { getAssetInfo } from '@defisaver/tokens';
11
+ import { Action } from '../../Action';
12
+ import { getAddr } from '../../addresses';
13
+ import { requireAddress } from '../../utils/general';
14
+ /**
15
+ * EtherFiStakeFromLidoAction - Converts wstETH to weETH through Ether.fi's Lido staking route
16
+ *
17
+ * @category EtherFi
18
+ */
19
+ export class EtherFiStakeFromLidoAction extends Action {
20
+ /**
21
+ * @param amount - amount of wstETH to pull
22
+ * @param minAmountOut - minimum amount of weETH to receive
23
+ * @param from - address from which to pull wstETH
24
+ * @param to - address where received weETH will be sent
25
+ */
26
+ constructor(amount, minAmountOut, from, to) {
27
+ requireAddress(to);
28
+ super('EtherFiStakeFromLido', getAddr('EtherFiStakeFromLido'), ['uint256', 'uint256', 'address', 'address'], [amount, minAmountOut, from, to]);
29
+ this.mappableArgs = [
30
+ this.args[0],
31
+ this.args[1],
32
+ this.args[2],
33
+ this.args[3],
34
+ ];
35
+ }
36
+ getAssetsToApprove() {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ return [{ asset: getAssetInfo('WSTETH').address, owner: this.args[2] }];
39
+ });
40
+ }
41
+ }
@@ -1,3 +1,4 @@
1
1
  export * from './EtherFiStakeAction';
2
+ export * from './EtherFiStakeFromLidoAction';
2
3
  export * from './EtherFiWrapAction';
3
4
  export * from './EtherFiUnwrapAction';
@@ -1,3 +1,4 @@
1
1
  export * from './EtherFiStakeAction';
2
+ export * from './EtherFiStakeFromLidoAction';
2
3
  export * from './EtherFiWrapAction';
3
4
  export * from './EtherFiUnwrapAction';
@@ -256,6 +256,7 @@ export declare const actionAddresses: {
256
256
  MerklClaim: string;
257
257
  RenzoStake: string;
258
258
  EtherFiStake: string;
259
+ EtherFiStakeFromLido: string;
259
260
  EtherFiWrap: string;
260
261
  EtherFiUnwrap: string;
261
262
  KingClaim: string;
@@ -555,6 +556,7 @@ export declare const actionAddresses: {
555
556
  EulerV2View?: undefined;
556
557
  RenzoStake?: undefined;
557
558
  EtherFiStake?: undefined;
559
+ EtherFiStakeFromLido?: undefined;
558
560
  EtherFiWrap?: undefined;
559
561
  EtherFiUnwrap?: undefined;
560
562
  KingClaim?: undefined;
@@ -860,6 +862,7 @@ export declare const actionAddresses: {
860
862
  EulerV2View?: undefined;
861
863
  RenzoStake?: undefined;
862
864
  EtherFiStake?: undefined;
865
+ EtherFiStakeFromLido?: undefined;
863
866
  EtherFiWrap?: undefined;
864
867
  EtherFiUnwrap?: undefined;
865
868
  KingClaim?: undefined;
@@ -1152,6 +1155,7 @@ export declare const actionAddresses: {
1152
1155
  EulerV2View?: undefined;
1153
1156
  RenzoStake?: undefined;
1154
1157
  EtherFiStake?: undefined;
1158
+ EtherFiStakeFromLido?: undefined;
1155
1159
  EtherFiWrap?: undefined;
1156
1160
  EtherFiUnwrap?: undefined;
1157
1161
  KingClaim?: undefined;
@@ -1428,6 +1432,7 @@ export declare const actionAddresses: {
1428
1432
  EulerV2View?: undefined;
1429
1433
  RenzoStake?: undefined;
1430
1434
  EtherFiStake?: undefined;
1435
+ EtherFiStakeFromLido?: undefined;
1431
1436
  EtherFiWrap?: undefined;
1432
1437
  EtherFiUnwrap?: undefined;
1433
1438
  KingClaim?: undefined;
@@ -1734,6 +1739,7 @@ export declare const actionAddresses: {
1734
1739
  EulerV2View?: undefined;
1735
1740
  RenzoStake?: undefined;
1736
1741
  EtherFiStake?: undefined;
1742
+ EtherFiStakeFromLido?: undefined;
1737
1743
  EtherFiWrap?: undefined;
1738
1744
  EtherFiUnwrap?: undefined;
1739
1745
  KingClaim?: undefined;
@@ -292,6 +292,7 @@ export const actionAddresses = {
292
292
  RenzoStake: '0x17DCF7132E30a0dC3d515C605E7c3D750c61E73c',
293
293
  // etherFi
294
294
  EtherFiStake: '0xcadB650B6a60C89f7847Cba555A7eeCC220EA2e8',
295
+ EtherFiStakeFromLido: '0xd4815aa46fc39e667fd7ab3194458639b59bcd82',
295
296
  EtherFiWrap: '0x086464be5c73f66cfbe6b64ec23aa5a86749ef58',
296
297
  EtherFiUnwrap: '0x6Eb09948DDf9332d628d156950b9B1C0c091e8D8',
297
298
  KingClaim: '0xd4C4D1Ef0e79389173EBc247972F355c6f2FEC76',
@@ -267,6 +267,7 @@ declare const actionAddressesAllChains: {
267
267
  MerklClaim: string;
268
268
  RenzoStake: string;
269
269
  EtherFiStake: string;
270
+ EtherFiStakeFromLido: string;
270
271
  EtherFiWrap: string;
271
272
  EtherFiUnwrap: string;
272
273
  KingClaim: string;
@@ -566,6 +567,7 @@ declare const actionAddressesAllChains: {
566
567
  EulerV2View?: undefined;
567
568
  RenzoStake?: undefined;
568
569
  EtherFiStake?: undefined;
570
+ EtherFiStakeFromLido?: undefined;
569
571
  EtherFiWrap?: undefined;
570
572
  EtherFiUnwrap?: undefined;
571
573
  KingClaim?: undefined;
@@ -871,6 +873,7 @@ declare const actionAddressesAllChains: {
871
873
  EulerV2View?: undefined;
872
874
  RenzoStake?: undefined;
873
875
  EtherFiStake?: undefined;
876
+ EtherFiStakeFromLido?: undefined;
874
877
  EtherFiWrap?: undefined;
875
878
  EtherFiUnwrap?: undefined;
876
879
  KingClaim?: undefined;
@@ -1163,6 +1166,7 @@ declare const actionAddressesAllChains: {
1163
1166
  EulerV2View?: undefined;
1164
1167
  RenzoStake?: undefined;
1165
1168
  EtherFiStake?: undefined;
1169
+ EtherFiStakeFromLido?: undefined;
1166
1170
  EtherFiWrap?: undefined;
1167
1171
  EtherFiUnwrap?: undefined;
1168
1172
  KingClaim?: undefined;
@@ -1439,6 +1443,7 @@ declare const actionAddressesAllChains: {
1439
1443
  EulerV2View?: undefined;
1440
1444
  RenzoStake?: undefined;
1441
1445
  EtherFiStake?: undefined;
1446
+ EtherFiStakeFromLido?: undefined;
1442
1447
  EtherFiWrap?: undefined;
1443
1448
  EtherFiUnwrap?: undefined;
1444
1449
  KingClaim?: undefined;
@@ -1745,6 +1750,7 @@ declare const actionAddressesAllChains: {
1745
1750
  EulerV2View?: undefined;
1746
1751
  RenzoStake?: undefined;
1747
1752
  EtherFiStake?: undefined;
1753
+ EtherFiStakeFromLido?: undefined;
1748
1754
  EtherFiWrap?: undefined;
1749
1755
  EtherFiUnwrap?: undefined;
1750
1756
  KingClaim?: undefined;
@@ -2027,6 +2033,7 @@ declare const actionAddresses: (chainId?: null) => {
2027
2033
  MerklClaim: string;
2028
2034
  RenzoStake: string;
2029
2035
  EtherFiStake: string;
2036
+ EtherFiStakeFromLido: string;
2030
2037
  EtherFiWrap: string;
2031
2038
  EtherFiUnwrap: string;
2032
2039
  KingClaim: string;
@@ -2326,6 +2333,7 @@ declare const actionAddresses: (chainId?: null) => {
2326
2333
  EulerV2View?: undefined;
2327
2334
  RenzoStake?: undefined;
2328
2335
  EtherFiStake?: undefined;
2336
+ EtherFiStakeFromLido?: undefined;
2329
2337
  EtherFiWrap?: undefined;
2330
2338
  EtherFiUnwrap?: undefined;
2331
2339
  KingClaim?: undefined;
@@ -2631,6 +2639,7 @@ declare const actionAddresses: (chainId?: null) => {
2631
2639
  EulerV2View?: undefined;
2632
2640
  RenzoStake?: undefined;
2633
2641
  EtherFiStake?: undefined;
2642
+ EtherFiStakeFromLido?: undefined;
2634
2643
  EtherFiWrap?: undefined;
2635
2644
  EtherFiUnwrap?: undefined;
2636
2645
  KingClaim?: undefined;
@@ -2923,6 +2932,7 @@ declare const actionAddresses: (chainId?: null) => {
2923
2932
  EulerV2View?: undefined;
2924
2933
  RenzoStake?: undefined;
2925
2934
  EtherFiStake?: undefined;
2935
+ EtherFiStakeFromLido?: undefined;
2926
2936
  EtherFiWrap?: undefined;
2927
2937
  EtherFiUnwrap?: undefined;
2928
2938
  KingClaim?: undefined;
@@ -3199,6 +3209,7 @@ declare const actionAddresses: (chainId?: null) => {
3199
3209
  EulerV2View?: undefined;
3200
3210
  RenzoStake?: undefined;
3201
3211
  EtherFiStake?: undefined;
3212
+ EtherFiStakeFromLido?: undefined;
3202
3213
  EtherFiWrap?: undefined;
3203
3214
  EtherFiUnwrap?: undefined;
3204
3215
  KingClaim?: undefined;
@@ -3505,6 +3516,7 @@ declare const actionAddresses: (chainId?: null) => {
3505
3516
  EulerV2View?: undefined;
3506
3517
  RenzoStake?: undefined;
3507
3518
  EtherFiStake?: undefined;
3519
+ EtherFiStakeFromLido?: undefined;
3508
3520
  EtherFiWrap?: undefined;
3509
3521
  EtherFiUnwrap?: undefined;
3510
3522
  KingClaim?: undefined;
@@ -4024,6 +4036,7 @@ declare const _default: {
4024
4036
  MerklClaim: string;
4025
4037
  RenzoStake: string;
4026
4038
  EtherFiStake: string;
4039
+ EtherFiStakeFromLido: string;
4027
4040
  EtherFiWrap: string;
4028
4041
  EtherFiUnwrap: string;
4029
4042
  KingClaim: string;
@@ -4323,6 +4336,7 @@ declare const _default: {
4323
4336
  EulerV2View?: undefined;
4324
4337
  RenzoStake?: undefined;
4325
4338
  EtherFiStake?: undefined;
4339
+ EtherFiStakeFromLido?: undefined;
4326
4340
  EtherFiWrap?: undefined;
4327
4341
  EtherFiUnwrap?: undefined;
4328
4342
  KingClaim?: undefined;
@@ -4628,6 +4642,7 @@ declare const _default: {
4628
4642
  EulerV2View?: undefined;
4629
4643
  RenzoStake?: undefined;
4630
4644
  EtherFiStake?: undefined;
4645
+ EtherFiStakeFromLido?: undefined;
4631
4646
  EtherFiWrap?: undefined;
4632
4647
  EtherFiUnwrap?: undefined;
4633
4648
  KingClaim?: undefined;
@@ -4920,6 +4935,7 @@ declare const _default: {
4920
4935
  EulerV2View?: undefined;
4921
4936
  RenzoStake?: undefined;
4922
4937
  EtherFiStake?: undefined;
4938
+ EtherFiStakeFromLido?: undefined;
4923
4939
  EtherFiWrap?: undefined;
4924
4940
  EtherFiUnwrap?: undefined;
4925
4941
  KingClaim?: undefined;
@@ -5196,6 +5212,7 @@ declare const _default: {
5196
5212
  EulerV2View?: undefined;
5197
5213
  RenzoStake?: undefined;
5198
5214
  EtherFiStake?: undefined;
5215
+ EtherFiStakeFromLido?: undefined;
5199
5216
  EtherFiWrap?: undefined;
5200
5217
  EtherFiUnwrap?: undefined;
5201
5218
  KingClaim?: undefined;
@@ -5502,6 +5519,7 @@ declare const _default: {
5502
5519
  EulerV2View?: undefined;
5503
5520
  RenzoStake?: undefined;
5504
5521
  EtherFiStake?: undefined;
5522
+ EtherFiStakeFromLido?: undefined;
5505
5523
  EtherFiWrap?: undefined;
5506
5524
  EtherFiUnwrap?: undefined;
5507
5525
  KingClaim?: undefined;
@@ -5784,6 +5802,7 @@ declare const _default: {
5784
5802
  MerklClaim: string;
5785
5803
  RenzoStake: string;
5786
5804
  EtherFiStake: string;
5805
+ EtherFiStakeFromLido: string;
5787
5806
  EtherFiWrap: string;
5788
5807
  EtherFiUnwrap: string;
5789
5808
  KingClaim: string;
@@ -6083,6 +6102,7 @@ declare const _default: {
6083
6102
  EulerV2View?: undefined;
6084
6103
  RenzoStake?: undefined;
6085
6104
  EtherFiStake?: undefined;
6105
+ EtherFiStakeFromLido?: undefined;
6086
6106
  EtherFiWrap?: undefined;
6087
6107
  EtherFiUnwrap?: undefined;
6088
6108
  KingClaim?: undefined;
@@ -6388,6 +6408,7 @@ declare const _default: {
6388
6408
  EulerV2View?: undefined;
6389
6409
  RenzoStake?: undefined;
6390
6410
  EtherFiStake?: undefined;
6411
+ EtherFiStakeFromLido?: undefined;
6391
6412
  EtherFiWrap?: undefined;
6392
6413
  EtherFiUnwrap?: undefined;
6393
6414
  KingClaim?: undefined;
@@ -6680,6 +6701,7 @@ declare const _default: {
6680
6701
  EulerV2View?: undefined;
6681
6702
  RenzoStake?: undefined;
6682
6703
  EtherFiStake?: undefined;
6704
+ EtherFiStakeFromLido?: undefined;
6683
6705
  EtherFiWrap?: undefined;
6684
6706
  EtherFiUnwrap?: undefined;
6685
6707
  KingClaim?: undefined;
@@ -6956,6 +6978,7 @@ declare const _default: {
6956
6978
  EulerV2View?: undefined;
6957
6979
  RenzoStake?: undefined;
6958
6980
  EtherFiStake?: undefined;
6981
+ EtherFiStakeFromLido?: undefined;
6959
6982
  EtherFiWrap?: undefined;
6960
6983
  EtherFiUnwrap?: undefined;
6961
6984
  KingClaim?: undefined;
@@ -7262,6 +7285,7 @@ declare const _default: {
7262
7285
  EulerV2View?: undefined;
7263
7286
  RenzoStake?: undefined;
7264
7287
  EtherFiStake?: undefined;
7288
+ EtherFiStakeFromLido?: undefined;
7265
7289
  EtherFiWrap?: undefined;
7266
7290
  EtherFiUnwrap?: undefined;
7267
7291
  KingClaim?: undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/sdk",
3
- "version": "1.3.26",
3
+ "version": "1.3.27",
4
4
  "description": "",
5
5
  "main": "./umd/index.js",
6
6
  "module": "./esm/src/index.js",
@@ -0,0 +1,38 @@
1
+ import { getAssetInfo } from '@defisaver/tokens';
2
+ import { Action } from '../../Action';
3
+ import { getAddr } from '../../addresses';
4
+ import { EthAddress, uint256 } from '../../types';
5
+ import { requireAddress } from '../../utils/general';
6
+
7
+ /**
8
+ * EtherFiStakeFromLidoAction - Converts wstETH to weETH through Ether.fi's Lido staking route
9
+ *
10
+ * @category EtherFi
11
+ */
12
+ export class EtherFiStakeFromLidoAction extends Action {
13
+ /**
14
+ * @param amount - amount of wstETH to pull
15
+ * @param minAmountOut - minimum amount of weETH to receive
16
+ * @param from - address from which to pull wstETH
17
+ * @param to - address where received weETH will be sent
18
+ */
19
+ constructor(amount:uint256, minAmountOut:uint256, from:EthAddress, to:EthAddress) {
20
+ requireAddress(to);
21
+ super(
22
+ 'EtherFiStakeFromLido',
23
+ getAddr('EtherFiStakeFromLido'),
24
+ ['uint256', 'uint256', 'address', 'address'],
25
+ [amount, minAmountOut, from, to],
26
+ );
27
+ this.mappableArgs = [
28
+ this.args[0],
29
+ this.args[1],
30
+ this.args[2],
31
+ this.args[3],
32
+ ];
33
+ }
34
+
35
+ async getAssetsToApprove() {
36
+ return [{ asset: getAssetInfo('WSTETH').address, owner: this.args[2] }];
37
+ }
38
+ }
@@ -1,3 +1,4 @@
1
1
  export * from './EtherFiStakeAction';
2
+ export * from './EtherFiStakeFromLidoAction';
2
3
  export * from './EtherFiWrapAction';
3
- export * from './EtherFiUnwrapAction';
4
+ export * from './EtherFiUnwrapAction';
package/src/addresses.ts CHANGED
@@ -358,6 +358,7 @@ export const actionAddresses = {
358
358
 
359
359
  // etherFi
360
360
  EtherFiStake: '0xcadB650B6a60C89f7847Cba555A7eeCC220EA2e8',
361
+ EtherFiStakeFromLido: '0xd4815aa46fc39e667fd7ab3194458639b59bcd82',
361
362
  EtherFiWrap: '0x086464be5c73f66cfbe6b64ec23aa5a86749ef58',
362
363
  EtherFiUnwrap: '0x6Eb09948DDf9332d628d156950b9B1C0c091e8D8',
363
364
 
@@ -0,0 +1,40 @@
1
+ const dfs = require('../../../src');
2
+ const { getAssetInfo } = require('@defisaver/tokens');
3
+ const { encodeForDsProxyCall, encodeForRecipe } = require('../../_actionUtils');
4
+ const { assert } = require('chai');
5
+
6
+ describe('Action: EtherFiStakeFromLidoAction', () => {
7
+ let action;
8
+ const amount = 100;
9
+ const minAmountOut = 90;
10
+ const from = '0x80788de454ad3681d357dc7FcB13c72333f684a7';
11
+ const to = '0x968Cc941aD9074EE687E0423a33E6f2D33d7c327';
12
+
13
+ it('constructor', () => {
14
+ action = new dfs.actions.etherfi.EtherFiStakeFromLidoAction(
15
+ amount,
16
+ minAmountOut,
17
+ from,
18
+ to,
19
+ );
20
+
21
+ assert.equal(action.args[0], amount);
22
+ assert.equal(action.args[1], minAmountOut);
23
+ assert.equal(action.args[2], from);
24
+ assert.equal(action.args[3], to);
25
+ });
26
+
27
+ it('encodeForDsProxyCall', () => encodeForDsProxyCall(action));
28
+ it('encodeForRecipe', () => encodeForRecipe(action));
29
+
30
+ it('getEthValue', async () => {
31
+ assert.equal(await action.getEthValue(), '0');
32
+ });
33
+
34
+ it('getAssetsToApprove', async () => {
35
+ const assetOwnerPairs = await action.getAssetsToApprove();
36
+ assert.lengthOf(assetOwnerPairs, 1);
37
+ assert.equal(assetOwnerPairs[0].asset, getAssetInfo('WSTETH').address);
38
+ assert.equal(assetOwnerPairs[0].owner, from);
39
+ });
40
+ });