@suilend/springsui-cli 1.0.5 → 1.0.6
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/cli/src/index.js +1 -1
- package/package.json +1 -1
- package/sdk/src/index.d.ts +8 -4
- package/sdk/src/index.js +19 -13
package/cli/src/index.js
CHANGED
|
@@ -96,7 +96,7 @@ function redeem(options) {
|
|
|
96
96
|
const [lst] = tx.splitCoins(lstCoins.data[0].coinObjectId, [
|
|
97
97
|
BigInt(options.amount),
|
|
98
98
|
]);
|
|
99
|
-
const sui = lstClient.
|
|
99
|
+
const sui = lstClient.redeem(tx, lst);
|
|
100
100
|
tx.transferObjects([sui], keypair.toSuiAddress());
|
|
101
101
|
const txResponse = yield client.signAndExecuteTransaction({
|
|
102
102
|
transaction: tx,
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@suilend/springsui-cli","version":"1.0.
|
|
1
|
+
{"name":"@suilend/springsui-cli","version":"1.0.6","private":false,"description":"A CLI for interacting with the SpringSui program","author":"Suilend","license":"MIT","main":"./index.js","exports":{".":"./index.js","./cli/src":"./cli/src/index.js","./sdk/src":"./sdk/src/index.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":{"@mysten/bcs":"1.2.0","@mysten/sui":"1.17.0","commander":"^12.1.0"},"devDependencies":{"ts-node":"^10.9.2"}}
|
package/sdk/src/index.d.ts
CHANGED
|
@@ -20,16 +20,20 @@ export declare class LstClient {
|
|
|
20
20
|
$kind: "NestedResult";
|
|
21
21
|
NestedResult: [number, number];
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
mintAmountAndRebalance(tx: Transaction, address: string, amount: string): {
|
|
24
24
|
$kind: "NestedResult";
|
|
25
25
|
NestedResult: [number, number];
|
|
26
26
|
};
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
mintAmountAndRebalanceAndSendToUser(tx: Transaction, address: string, amount: string): void;
|
|
28
|
+
redeem(tx: Transaction, lstId: TransactionObjectInput): {
|
|
29
29
|
$kind: "NestedResult";
|
|
30
30
|
NestedResult: [number, number];
|
|
31
31
|
};
|
|
32
|
-
|
|
32
|
+
redeemAmount(tx: Transaction, address: string, amount: string): Promise<{
|
|
33
|
+
$kind: "NestedResult";
|
|
34
|
+
NestedResult: [number, number];
|
|
35
|
+
}>;
|
|
36
|
+
redeemAmountAndSendToUser(tx: Transaction, address: string, amount: string): Promise<void>;
|
|
33
37
|
increaseValidatorStake(tx: Transaction, adminCapId: TransactionObjectInput, validatorAddress: string, suiAmount: number): void;
|
|
34
38
|
decreaseValidatorStake(tx: Transaction, adminCapId: TransactionObjectInput, validatorAddress: string, targetUnstakeSuiAmount: bigint): void;
|
|
35
39
|
collectFees(tx: Transaction, weightHookAdminCapId: TransactionObjectInput): {
|
package/sdk/src/index.js
CHANGED
|
@@ -115,16 +115,6 @@ class LstClient {
|
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
constructor(liquidStakingObject, client) {
|
|
118
|
-
this.mintAndRebalance = (tx, amount) => {
|
|
119
|
-
const [sui] = tx.splitCoins(tx.gas, [BigInt(amount)]);
|
|
120
|
-
const lst = this.mint(tx, sui);
|
|
121
|
-
this.rebalance(tx, this.liquidStakingObject.weightHookId);
|
|
122
|
-
return lst;
|
|
123
|
-
};
|
|
124
|
-
this.mintAndRebalanceAndSendToUser = (tx, address, amount) => {
|
|
125
|
-
const lst = this.mintAndRebalance(tx, amount);
|
|
126
|
-
tx.transferObjects([lst], address);
|
|
127
|
-
};
|
|
128
118
|
this.liquidStakingObject = liquidStakingObject;
|
|
129
119
|
this.client = client;
|
|
130
120
|
}
|
|
@@ -152,8 +142,18 @@ class LstClient {
|
|
|
152
142
|
});
|
|
153
143
|
return lst;
|
|
154
144
|
}
|
|
145
|
+
mintAmountAndRebalance(tx, address, amount) {
|
|
146
|
+
const [sui] = tx.splitCoins(tx.gas, [BigInt(amount)]);
|
|
147
|
+
const lst = this.mint(tx, sui);
|
|
148
|
+
this.rebalance(tx, this.liquidStakingObject.weightHookId);
|
|
149
|
+
return lst;
|
|
150
|
+
}
|
|
151
|
+
mintAmountAndRebalanceAndSendToUser(tx, address, amount) {
|
|
152
|
+
const lst = this.mintAmountAndRebalance(tx, address, amount);
|
|
153
|
+
tx.transferObjects([lst], address);
|
|
154
|
+
}
|
|
155
155
|
// returns the sui coin
|
|
156
|
-
|
|
156
|
+
redeem(tx, lstId) {
|
|
157
157
|
const [sui] = generated.redeem(tx, this.liquidStakingObject.type, {
|
|
158
158
|
self: this.liquidStakingObject.id,
|
|
159
159
|
systemState: SUI_SYSTEM_STATE_ID,
|
|
@@ -161,7 +161,7 @@ class LstClient {
|
|
|
161
161
|
});
|
|
162
162
|
return sui;
|
|
163
163
|
}
|
|
164
|
-
|
|
164
|
+
redeemAmount(tx, address, amount) {
|
|
165
165
|
return __awaiter(this, void 0, void 0, function* () {
|
|
166
166
|
const coins = (yield this.client.getCoins({
|
|
167
167
|
owner: address,
|
|
@@ -173,7 +173,13 @@ class LstClient {
|
|
|
173
173
|
const [lst] = tx.splitCoins(tx.object(coins[0].coinObjectId), [
|
|
174
174
|
BigInt(amount),
|
|
175
175
|
]);
|
|
176
|
-
const sui = this.
|
|
176
|
+
const sui = this.redeem(tx, lst);
|
|
177
|
+
return sui;
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
redeemAmountAndSendToUser(tx, address, amount) {
|
|
181
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
182
|
+
const sui = yield this.redeemAmount(tx, address, amount);
|
|
177
183
|
tx.transferObjects([sui], address);
|
|
178
184
|
});
|
|
179
185
|
}
|