@suilend/springsui-cli 1.0.11 → 1.0.12

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/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@suilend/springsui-cli","version":"1.0.11","private":false,"description":"A CLI for interacting with the SpringSui program","author":"Suilend","license":"MIT","main":"./index.js","exports":{".":"./index.js","./cli/src/bytecode":"./cli/src/bytecode.js","./cli/src":"./cli/src/index.js","./sdk/src/client":"./sdk/src/client.js","./sdk/src":"./sdk/src/index.js","./sdk/src/lib":"./sdk/src/lib/index.js","./sdk/src/lib/transactions":"./sdk/src/lib/transactions.js","./sdk/src/_generated/_framework/reified":"./sdk/src/_generated/_framework/reified.js","./sdk/src/_generated/_framework/util":"./sdk/src/_generated/_framework/util.js","./sdk/src/_generated/_framework/vector":"./sdk/src/_generated/_framework/vector.js","./sdk/src/_generated/liquid_staking":"./sdk/src/_generated/liquid_staking/index.js","./sdk/src/_generated/liquid_staking/cell/structs":"./sdk/src/_generated/liquid_staking/cell/structs.js","./sdk/src/_generated/liquid_staking/fees/functions":"./sdk/src/_generated/liquid_staking/fees/functions.js","./sdk/src/_generated/liquid_staking/fees/structs":"./sdk/src/_generated/liquid_staking/fees/structs.js","./sdk/src/_generated/liquid_staking/liquid-staking/functions":"./sdk/src/_generated/liquid_staking/liquid-staking/functions.js","./sdk/src/_generated/liquid_staking/liquid-staking/structs":"./sdk/src/_generated/liquid_staking/liquid-staking/structs.js","./sdk/src/_generated/liquid_staking/storage/structs":"./sdk/src/_generated/liquid_staking/storage/structs.js","./sdk/src/_generated/liquid_staking/version/structs":"./sdk/src/_generated/liquid_staking/version/structs.js","./sdk/src/_generated/liquid_staking/weight/functions":"./sdk/src/_generated/liquid_staking/weight/functions.js","./sdk/src/_generated/liquid_staking/weight/structs":"./sdk/src/_generated/liquid_staking/weight/structs.js","./sdk/src/_generated/_dependencies/source/0x1":"./sdk/src/_generated/_dependencies/source/0x1/index.js","./sdk/src/_generated/_dependencies/source/0x2":"./sdk/src/_generated/_dependencies/source/0x2/index.js","./sdk/src/_generated/_dependencies/source/0x3":"./sdk/src/_generated/_dependencies/source/0x3/index.js","./sdk/src/_generated/_dependencies/source/0x1/ascii/structs":"./sdk/src/_generated/_dependencies/source/0x1/ascii/structs.js","./sdk/src/_generated/_dependencies/source/0x1/option/structs":"./sdk/src/_generated/_dependencies/source/0x1/option/structs.js","./sdk/src/_generated/_dependencies/source/0x1/string/structs":"./sdk/src/_generated/_dependencies/source/0x1/string/structs.js","./sdk/src/_generated/_dependencies/source/0x1/type-name/structs":"./sdk/src/_generated/_dependencies/source/0x1/type-name/structs.js","./sdk/src/_generated/_dependencies/source/0x2/bag/structs":"./sdk/src/_generated/_dependencies/source/0x2/bag/structs.js","./sdk/src/_generated/_dependencies/source/0x2/balance/structs":"./sdk/src/_generated/_dependencies/source/0x2/balance/structs.js","./sdk/src/_generated/_dependencies/source/0x2/coin/structs":"./sdk/src/_generated/_dependencies/source/0x2/coin/structs.js","./sdk/src/_generated/_dependencies/source/0x2/object/structs":"./sdk/src/_generated/_dependencies/source/0x2/object/structs.js","./sdk/src/_generated/_dependencies/source/0x2/sui/structs":"./sdk/src/_generated/_dependencies/source/0x2/sui/structs.js","./sdk/src/_generated/_dependencies/source/0x2/table/structs":"./sdk/src/_generated/_dependencies/source/0x2/table/structs.js","./sdk/src/_generated/_dependencies/source/0x2/url/structs":"./sdk/src/_generated/_dependencies/source/0x2/url/structs.js","./sdk/src/_generated/_dependencies/source/0x2/vec-map/structs":"./sdk/src/_generated/_dependencies/source/0x2/vec-map/structs.js","./sdk/src/_generated/_dependencies/source/0x3/staking-pool/structs":"./sdk/src/_generated/_dependencies/source/0x3/staking-pool/structs.js"},"types":"./index.js","scripts":{"build":"rm -rf ./dist && bun tsc","eslint":"eslint --fix \"./src/**/*.ts\"","prettier":"prettier --write \"./src/**/*\"","lint":"bun eslint && bun prettier && bun tsc --noEmit","release":"bun run build && bun ts-node ./release.ts && cd ./dist && npm publish --access public"},"repository":{"type":"git","url":"git+https://github.com/solendprotocol/liquid-staking.git"},"bugs":{"url":"https://github.com/solendprotocol/liquid-staking/issues"},"dependencies":{"commander":"^12.1.0","@mysten/move-bytecode-template":"0.1.0"},"devDependencies":{"ts-node":"^10.9.2"},"peerDependencies":{"@mysten/bcs":"1.6.0","@mysten/sui":"1.28.2"}}
1
+ {"name":"@suilend/springsui-cli","version":"1.0.12","private":false,"description":"A CLI for interacting with the SpringSui program","author":"Suilend","license":"MIT","main":"./index.js","exports":{".":"./index.js","./cli/src/bytecode":"./cli/src/bytecode.js","./cli/src":"./cli/src/index.js","./sdk/src/client":"./sdk/src/client.js","./sdk/src":"./sdk/src/index.js","./sdk/src/lib":"./sdk/src/lib/index.js","./sdk/src/lib/transactions":"./sdk/src/lib/transactions.js","./sdk/src/_generated/_framework/reified":"./sdk/src/_generated/_framework/reified.js","./sdk/src/_generated/_framework/util":"./sdk/src/_generated/_framework/util.js","./sdk/src/_generated/_framework/vector":"./sdk/src/_generated/_framework/vector.js","./sdk/src/_generated/liquid_staking":"./sdk/src/_generated/liquid_staking/index.js","./sdk/src/_generated/liquid_staking/cell/structs":"./sdk/src/_generated/liquid_staking/cell/structs.js","./sdk/src/_generated/liquid_staking/fees/functions":"./sdk/src/_generated/liquid_staking/fees/functions.js","./sdk/src/_generated/liquid_staking/fees/structs":"./sdk/src/_generated/liquid_staking/fees/structs.js","./sdk/src/_generated/liquid_staking/liquid-staking/functions":"./sdk/src/_generated/liquid_staking/liquid-staking/functions.js","./sdk/src/_generated/liquid_staking/liquid-staking/structs":"./sdk/src/_generated/liquid_staking/liquid-staking/structs.js","./sdk/src/_generated/liquid_staking/storage/structs":"./sdk/src/_generated/liquid_staking/storage/structs.js","./sdk/src/_generated/liquid_staking/version/structs":"./sdk/src/_generated/liquid_staking/version/structs.js","./sdk/src/_generated/liquid_staking/weight/functions":"./sdk/src/_generated/liquid_staking/weight/functions.js","./sdk/src/_generated/liquid_staking/weight/structs":"./sdk/src/_generated/liquid_staking/weight/structs.js","./sdk/src/_generated/_dependencies/source/0x1":"./sdk/src/_generated/_dependencies/source/0x1/index.js","./sdk/src/_generated/_dependencies/source/0x2":"./sdk/src/_generated/_dependencies/source/0x2/index.js","./sdk/src/_generated/_dependencies/source/0x3":"./sdk/src/_generated/_dependencies/source/0x3/index.js","./sdk/src/_generated/_dependencies/source/0x1/ascii/structs":"./sdk/src/_generated/_dependencies/source/0x1/ascii/structs.js","./sdk/src/_generated/_dependencies/source/0x1/option/structs":"./sdk/src/_generated/_dependencies/source/0x1/option/structs.js","./sdk/src/_generated/_dependencies/source/0x1/string/structs":"./sdk/src/_generated/_dependencies/source/0x1/string/structs.js","./sdk/src/_generated/_dependencies/source/0x1/type-name/structs":"./sdk/src/_generated/_dependencies/source/0x1/type-name/structs.js","./sdk/src/_generated/_dependencies/source/0x2/bag/structs":"./sdk/src/_generated/_dependencies/source/0x2/bag/structs.js","./sdk/src/_generated/_dependencies/source/0x2/balance/structs":"./sdk/src/_generated/_dependencies/source/0x2/balance/structs.js","./sdk/src/_generated/_dependencies/source/0x2/coin/structs":"./sdk/src/_generated/_dependencies/source/0x2/coin/structs.js","./sdk/src/_generated/_dependencies/source/0x2/object/structs":"./sdk/src/_generated/_dependencies/source/0x2/object/structs.js","./sdk/src/_generated/_dependencies/source/0x2/sui/structs":"./sdk/src/_generated/_dependencies/source/0x2/sui/structs.js","./sdk/src/_generated/_dependencies/source/0x2/table/structs":"./sdk/src/_generated/_dependencies/source/0x2/table/structs.js","./sdk/src/_generated/_dependencies/source/0x2/url/structs":"./sdk/src/_generated/_dependencies/source/0x2/url/structs.js","./sdk/src/_generated/_dependencies/source/0x2/vec-map/structs":"./sdk/src/_generated/_dependencies/source/0x2/vec-map/structs.js","./sdk/src/_generated/_dependencies/source/0x3/staking-pool/structs":"./sdk/src/_generated/_dependencies/source/0x3/staking-pool/structs.js"},"types":"./index.js","scripts":{"build":"rm -rf ./dist && bun tsc","eslint":"eslint --fix \"./src/**/*.ts\"","prettier":"prettier --write \"./src/**/*\"","lint":"bun eslint && bun prettier && bun tsc --noEmit","release":"bun run build && bun ts-node ./release.ts && cd ./dist && npm publish --access public"},"repository":{"type":"git","url":"git+https://github.com/suilend/springsui-fe-public.git"},"bugs":{"url":"https://github.com/suilend/springsui-fe-public/issues"},"dependencies":{"commander":"^12.1.0","@mysten/move-bytecode-template":"0.1.0"},"devDependencies":{"ts-node":"^10.9.2"},"peerDependencies":{"@mysten/bcs":"1.6.0","@mysten/sui":"1.28.2"},"overrides":{"chalk":"5.3.0","strip-ansi":"7.1.0","color-convert":"2.0.1","color-name":"1.1.4","is-core-module":"2.13.1","error-ex":"1.3.2","has-ansi":"5.0.1"}}
@@ -1,4 +1,4 @@
1
- import { SuiClient } from "@mysten/sui/client";
1
+ import { SuiClient, ValidatorApy } from "@mysten/sui/client";
2
2
  import { Transaction, TransactionObjectInput } from "@mysten/sui/transactions";
3
3
  import BigNumber from "bignumber.js";
4
4
  import { LiquidStakingInfo } from "./_generated/liquid_staking/liquid-staking/structs";
@@ -13,12 +13,15 @@ export interface FeeConfigArgs {
13
13
  spreadFeeBps?: number;
14
14
  }
15
15
  export declare const SUILEND_VALIDATOR_ADDRESS = "0xce8e537664ba5d1d5a6a857b17bd142097138706281882be6805e17065ecde89";
16
+ export declare const SPRING_SUI_UPGRADE_CAP_ID = "0x4dc657b6c0fe896f4b94fee1ceac96312dde0a36b94e799caaec30deb53dcd67";
17
+ export declare const ADMIN_ADDRESS = "0xb1ffbc2e1915f44b8f271a703becc1bf8aa79bc22431a58900a102892b783c25";
18
+ export declare function getLatestPackageId(client: SuiClient, upgradeCapId: string): Promise<string>;
16
19
  export declare class LstClient {
17
20
  liquidStakingObject: LiquidStakingObjectInfo;
18
21
  client: SuiClient;
19
- static initialize(client: SuiClient, liquidStakingObjectInfo: LiquidStakingObjectInfo): Promise<LstClient>;
22
+ static initialize(client: SuiClient, liquidStakingObjectInfo: LiquidStakingObjectInfo, _publishedAt?: string, logPackageId?: boolean): Promise<LstClient>;
20
23
  static createNewLst(tx: Transaction, treasuryCap: string, coinType: string): TransactionObjectInput;
21
- static getWeightHookAdminCapId(client: SuiClient, address: string, weightHookAdminCapId: string): Promise<string | null | undefined>;
24
+ static getWeightHookAdminCapId(client: SuiClient, address: string, coinType: string): Promise<string | null | undefined>;
22
25
  constructor(liquidStakingObject: LiquidStakingObjectInfo, client: SuiClient);
23
26
  getAdminCapId(address: string): Promise<string | null | undefined>;
24
27
  mint(tx: Transaction, suiCoinId: TransactionObjectInput): {
@@ -34,11 +37,11 @@ export declare class LstClient {
34
37
  $kind: "NestedResult";
35
38
  NestedResult: [number, number];
36
39
  };
37
- redeemAmount(tx: Transaction, address: string, amount: string): {
40
+ redeemAmountAndRebalance(tx: Transaction, address: string, amount: string, client: SuiClient): Promise<{
38
41
  $kind: "NestedResult";
39
42
  NestedResult: [number, number];
40
- };
41
- redeemAmountAndSendToUser(tx: Transaction, address: string, amount: string): void;
43
+ }>;
44
+ redeemAmountAndRebalanceAndSendToUser(tx: Transaction, address: string, amount: string, client: SuiClient): Promise<void>;
42
45
  increaseValidatorStake(tx: Transaction, adminCapId: TransactionObjectInput, validatorAddress: string, suiAmount: number): void;
43
46
  decreaseValidatorStake(tx: Transaction, adminCapId: TransactionObjectInput, validatorAddress: string, targetUnstakeSuiAmount: bigint): void;
44
47
  collectFees(tx: Transaction, weightHookAdminCapId: TransactionObjectInput): {
@@ -53,7 +56,7 @@ export declare class LstClient {
53
56
  };
54
57
  setValidatorAddressesAndWeights(tx: Transaction, weightHookId: TransactionObjectInput, weightHookAdminCap: TransactionObjectInput, validatorAddressesAndWeights: Record<string, number>): void;
55
58
  rebalance(tx: Transaction, weightHookId: TransactionObjectInput): void;
56
- getSpringSuiApy(): Promise<BigNumber>;
59
+ getSpringSuiApy(_validatorApys?: ValidatorApy[]): Promise<BigNumber>;
57
60
  }
58
61
  export declare const fetchLiquidStakingInfo: (info: LiquidStakingObjectInfo, client: SuiClient) => Promise<LiquidStakingInfo<any>>;
59
62
  export declare const fetchRegistryLiquidStakingInfoMap: (client: SuiClient) => Promise<{
package/sdk/src/client.js CHANGED
@@ -45,8 +45,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
45
45
  return (mod && mod.__esModule) ? mod : { "default": mod };
46
46
  };
47
47
  Object.defineProperty(exports, "__esModule", { value: true });
48
- exports.fetchRegistryLiquidStakingInfoMap = exports.fetchLiquidStakingInfo = exports.LstClient = exports.SUILEND_VALIDATOR_ADDRESS = void 0;
49
- const transactions_1 = require("@mysten/sui/transactions");
48
+ exports.fetchRegistryLiquidStakingInfoMap = exports.fetchLiquidStakingInfo = exports.LstClient = exports.ADMIN_ADDRESS = exports.SPRING_SUI_UPGRADE_CAP_ID = exports.SUILEND_VALIDATOR_ADDRESS = void 0;
49
+ exports.getLatestPackageId = getLatestPackageId;
50
50
  const utils_1 = require("@mysten/sui/utils");
51
51
  const bignumber_js_1 = __importDefault(require("bignumber.js"));
52
52
  const reified_1 = require("./_generated/_framework/reified");
@@ -58,7 +58,8 @@ const weightHookGenerated = __importStar(require("./_generated/liquid_staking/we
58
58
  const structs_2 = require("./_generated/liquid_staking/weight/structs");
59
59
  const SUI_SYSTEM_STATE_ID = "0x0000000000000000000000000000000000000000000000000000000000000005";
60
60
  exports.SUILEND_VALIDATOR_ADDRESS = "0xce8e537664ba5d1d5a6a857b17bd142097138706281882be6805e17065ecde89";
61
- const SPRING_SUI_UPGRADE_CAP_ID = "0x4dc657b6c0fe896f4b94fee1ceac96312dde0a36b94e799caaec30deb53dcd67";
61
+ exports.SPRING_SUI_UPGRADE_CAP_ID = "0x4dc657b6c0fe896f4b94fee1ceac96312dde0a36b94e799caaec30deb53dcd67";
62
+ exports.ADMIN_ADDRESS = "0xb1ffbc2e1915f44b8f271a703becc1bf8aa79bc22431a58900a102892b783c25";
62
63
  function getLatestPackageId(client, upgradeCapId) {
63
64
  return __awaiter(this, void 0, void 0, function* () {
64
65
  var _a;
@@ -72,11 +73,12 @@ function getLatestPackageId(client, upgradeCapId) {
72
73
  });
73
74
  }
74
75
  class LstClient {
75
- static initialize(client, liquidStakingObjectInfo) {
76
+ static initialize(client, liquidStakingObjectInfo, _publishedAt, logPackageId) {
76
77
  return __awaiter(this, void 0, void 0, function* () {
77
- const publishedAt = yield getLatestPackageId(client, SPRING_SUI_UPGRADE_CAP_ID);
78
+ const publishedAt = _publishedAt !== null && _publishedAt !== void 0 ? _publishedAt : (yield getLatestPackageId(client, exports.SPRING_SUI_UPGRADE_CAP_ID));
79
+ if (logPackageId)
80
+ console.log("@suilend/springsui-sdk | publishedAt:", publishedAt);
78
81
  (0, liquid_staking_1.setPublishedAt)(publishedAt);
79
- console.log(`Initialized LstClient with package ID: ${publishedAt}`);
80
82
  return new LstClient(liquidStakingObjectInfo, client);
81
83
  });
82
84
  }
@@ -105,13 +107,13 @@ class LstClient {
105
107
  });
106
108
  return weightHookAdminCap;
107
109
  }
108
- static getWeightHookAdminCapId(client, address, weightHookAdminCapId) {
110
+ static getWeightHookAdminCapId(client, address, coinType) {
109
111
  return __awaiter(this, void 0, void 0, function* () {
110
112
  var _a;
111
113
  const res = (yield client.getOwnedObjects({
112
114
  owner: address,
113
115
  filter: {
114
- StructType: `${liquid_staking_1.PACKAGE_ID}::weight::WeightHookAdminCap<${weightHookAdminCapId}>`,
116
+ StructType: `${liquid_staking_1.PACKAGE_ID}::weight::WeightHookAdminCap<${coinType}>`,
115
117
  },
116
118
  })).data;
117
119
  if (res.length == 0) {
@@ -149,8 +151,8 @@ class LstClient {
149
151
  return lst;
150
152
  }
151
153
  mintAmountAndRebalance(tx, address, amount) {
152
- const [sui] = tx.splitCoins(tx.gas, [BigInt(amount)]);
153
- const lst = this.mint(tx, sui);
154
+ const [suiCoin] = tx.splitCoins(tx.gas, [BigInt(amount)]);
155
+ const lst = this.mint(tx, suiCoin);
154
156
  this.rebalance(tx, this.liquidStakingObject.weightHookId);
155
157
  return lst;
156
158
  }
@@ -160,25 +162,36 @@ class LstClient {
160
162
  }
161
163
  // returns the sui coin
162
164
  redeem(tx, lstId) {
163
- const [sui] = generated.redeem(tx, this.liquidStakingObject.type, {
165
+ const [suiCoin] = generated.redeem(tx, this.liquidStakingObject.type, {
164
166
  self: this.liquidStakingObject.id,
165
167
  systemState: SUI_SYSTEM_STATE_ID,
166
168
  lst: lstId,
167
169
  });
168
- return sui;
170
+ return suiCoin;
169
171
  }
170
- redeemAmount(tx, address, amount) {
171
- const lstCoin = (0, transactions_1.coinWithBalance)({
172
- balance: BigInt(amount),
173
- type: this.liquidStakingObject.type,
174
- useGasCoin: false,
175
- })(tx);
176
- const sui = this.redeem(tx, lstCoin);
177
- return sui;
172
+ redeemAmountAndRebalance(tx, address, amount, client) {
173
+ return __awaiter(this, void 0, void 0, function* () {
174
+ const coins = (yield client.getCoins({
175
+ owner: address,
176
+ coinType: this.liquidStakingObject.type,
177
+ })).data;
178
+ const mergeCoin = coins[0];
179
+ if (coins.length > 1) {
180
+ tx.mergeCoins(tx.object(mergeCoin.coinObjectId), coins.map((c) => tx.object(c.coinObjectId)).slice(1));
181
+ }
182
+ const [lstCoin] = tx.splitCoins(tx.object(mergeCoin.coinObjectId), [
183
+ BigInt(amount),
184
+ ]);
185
+ const suiCoin = this.redeem(tx, lstCoin);
186
+ this.rebalance(tx, this.liquidStakingObject.weightHookId);
187
+ return suiCoin;
188
+ });
178
189
  }
179
- redeemAmountAndSendToUser(tx, address, amount) {
180
- const suiCoin = this.redeemAmount(tx, address, amount);
181
- tx.transferObjects([suiCoin], address);
190
+ redeemAmountAndRebalanceAndSendToUser(tx, address, amount, client) {
191
+ return __awaiter(this, void 0, void 0, function* () {
192
+ const suiCoin = yield this.redeemAmountAndRebalance(tx, address, amount, client);
193
+ tx.transferObjects([suiCoin], address);
194
+ });
182
195
  }
183
196
  // admin functions
184
197
  increaseValidatorStake(tx, adminCapId, validatorAddress, suiAmount) {
@@ -285,10 +298,10 @@ class LstClient {
285
298
  liquidStakingInfo: this.liquidStakingObject.id,
286
299
  });
287
300
  }
288
- getSpringSuiApy() {
301
+ getSpringSuiApy(_validatorApys) {
289
302
  return __awaiter(this, void 0, void 0, function* () {
290
303
  var _a, _b;
291
- const validatorApys = (yield this.client.getValidatorsApy()).apys;
304
+ const validatorApys = _validatorApys !== null && _validatorApys !== void 0 ? _validatorApys : (yield this.client.getValidatorsApy()).apys;
292
305
  const liquidStakingInfo = yield (0, exports.fetchLiquidStakingInfo)(this.liquidStakingObject, this.client);
293
306
  const totalSuiSupply = new bignumber_js_1.default(liquidStakingInfo.storage.totalSuiSupply.toString()).div(10 ** utils_1.SUI_DECIMALS);
294
307
  const spreadFeePercent = new bignumber_js_1.default((_b = (_a = liquidStakingInfo.feeConfig.element) === null || _a === void 0 ? void 0 : _a.spreadFeeBps.toString()) !== null && _b !== void 0 ? _b : 0).div(100);
@@ -311,7 +324,18 @@ const fetchLiquidStakingInfo = (info, client) => structs_1.LiquidStakingInfo.fet
311
324
  exports.fetchLiquidStakingInfo = fetchLiquidStakingInfo;
312
325
  const fetchRegistryLiquidStakingInfoMap = (client) => __awaiter(void 0, void 0, void 0, function* () {
313
326
  const REGISTRY_ID = "0x06d6b6881ef14ad1a8cc29d1f97ba3397ecea56af5afa0642093e981b1fda3f4";
314
- const registryObjectIds = (yield client.getDynamicFields({ parentId: REGISTRY_ID })).data.map((d) => d.objectId);
327
+ const registryObjectIds = [];
328
+ let cursor = null;
329
+ let hasNextPage = true;
330
+ while (hasNextPage) {
331
+ const page = yield client.getDynamicFields({
332
+ parentId: REGISTRY_ID,
333
+ cursor,
334
+ });
335
+ registryObjectIds.push(...page.data.map((d) => d.objectId));
336
+ cursor = page.nextCursor;
337
+ hasNextPage = page.hasNextPage;
338
+ }
315
339
  const registryObjects = yield Promise.all(registryObjectIds.map((objectId) => client.getObject({
316
340
  id: objectId,
317
341
  options: {
@@ -1,7 +1,7 @@
1
1
  import { Transaction } from "@mysten/sui/transactions";
2
2
  import { LstClient } from "../client";
3
- export declare const convertLsts: (inLstClient: LstClient, outLstClient: LstClient, transaction: Transaction, address: string, amount: string) => {
3
+ export declare const convertLstsAndRebalance: (inLstClient: LstClient, outLstClient: LstClient, transaction: Transaction, address: string, amount: string) => Promise<{
4
4
  $kind: "NestedResult";
5
5
  NestedResult: [number, number];
6
- };
7
- export declare const convertLstsAndSendToUser: (inLstClient: LstClient, outLstClient: LstClient, transaction: Transaction, address: string, amount: string) => void;
6
+ }>;
7
+ export declare const convertLstsAndRebalanceAndSendToUser: (inLstClient: LstClient, outLstClient: LstClient, transaction: Transaction, address: string, amount: string) => Promise<void>;
@@ -1,15 +1,24 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertLstsAndSendToUser = exports.convertLsts = void 0;
4
- const convertLsts = (inLstClient, outLstClient, transaction, address, amount) => {
5
- const suiCoin = inLstClient.redeemAmount(transaction, address, amount);
12
+ exports.convertLstsAndRebalanceAndSendToUser = exports.convertLstsAndRebalance = void 0;
13
+ const convertLstsAndRebalance = (inLstClient, outLstClient, transaction, address, amount) => __awaiter(void 0, void 0, void 0, function* () {
14
+ const suiCoin = yield inLstClient.redeemAmountAndRebalance(transaction, address, amount, inLstClient.client);
6
15
  const lstCoin = outLstClient.mint(transaction, suiCoin);
7
16
  outLstClient.rebalance(transaction, outLstClient.liquidStakingObject.weightHookId);
8
17
  return lstCoin;
9
- };
10
- exports.convertLsts = convertLsts;
11
- const convertLstsAndSendToUser = (inLstClient, outLstClient, transaction, address, amount) => {
12
- const lstCoin = (0, exports.convertLsts)(inLstClient, outLstClient, transaction, address, amount);
18
+ });
19
+ exports.convertLstsAndRebalance = convertLstsAndRebalance;
20
+ const convertLstsAndRebalanceAndSendToUser = (inLstClient, outLstClient, transaction, address, amount) => __awaiter(void 0, void 0, void 0, function* () {
21
+ const lstCoin = yield (0, exports.convertLstsAndRebalance)(inLstClient, outLstClient, transaction, address, amount);
13
22
  transaction.transferObjects([lstCoin], address);
14
- };
15
- exports.convertLstsAndSendToUser = convertLstsAndSendToUser;
23
+ });
24
+ exports.convertLstsAndRebalanceAndSendToUser = convertLstsAndRebalanceAndSendToUser;