@suilend/springsui-cli 1.0.5 → 1.0.7
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 +24 -26
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.7","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): {
|
|
33
|
+
$kind: "NestedResult";
|
|
34
|
+
NestedResult: [number, number];
|
|
35
|
+
};
|
|
36
|
+
redeemAmountAndSendToUser(tx: Transaction, address: string, amount: string): 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
|
@@ -46,6 +46,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
46
46
|
};
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
48
|
exports.fetchLiquidStakingInfo = exports.LstClient = exports.SUILEND_VALIDATOR_ADDRESS = void 0;
|
|
49
|
+
const transactions_1 = require("@mysten/sui/transactions");
|
|
49
50
|
const utils_1 = require("@mysten/sui/utils");
|
|
50
51
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
51
52
|
const reified_1 = require("./_generated/_framework/reified");
|
|
@@ -115,16 +116,6 @@ class LstClient {
|
|
|
115
116
|
});
|
|
116
117
|
}
|
|
117
118
|
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
119
|
this.liquidStakingObject = liquidStakingObject;
|
|
129
120
|
this.client = client;
|
|
130
121
|
}
|
|
@@ -152,8 +143,18 @@ class LstClient {
|
|
|
152
143
|
});
|
|
153
144
|
return lst;
|
|
154
145
|
}
|
|
146
|
+
mintAmountAndRebalance(tx, address, amount) {
|
|
147
|
+
const [sui] = tx.splitCoins(tx.gas, [BigInt(amount)]);
|
|
148
|
+
const lst = this.mint(tx, sui);
|
|
149
|
+
this.rebalance(tx, this.liquidStakingObject.weightHookId);
|
|
150
|
+
return lst;
|
|
151
|
+
}
|
|
152
|
+
mintAmountAndRebalanceAndSendToUser(tx, address, amount) {
|
|
153
|
+
const lst = this.mintAmountAndRebalance(tx, address, amount);
|
|
154
|
+
tx.transferObjects([lst], address);
|
|
155
|
+
}
|
|
155
156
|
// returns the sui coin
|
|
156
|
-
|
|
157
|
+
redeem(tx, lstId) {
|
|
157
158
|
const [sui] = generated.redeem(tx, this.liquidStakingObject.type, {
|
|
158
159
|
self: this.liquidStakingObject.id,
|
|
159
160
|
systemState: SUI_SYSTEM_STATE_ID,
|
|
@@ -161,21 +162,18 @@ class LstClient {
|
|
|
161
162
|
});
|
|
162
163
|
return sui;
|
|
163
164
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
const sui = this.redeemLst(tx, lst);
|
|
177
|
-
tx.transferObjects([sui], address);
|
|
178
|
-
});
|
|
165
|
+
redeemAmount(tx, address, amount) {
|
|
166
|
+
const lstCoin = (0, transactions_1.coinWithBalance)({
|
|
167
|
+
balance: BigInt(amount),
|
|
168
|
+
type: this.liquidStakingObject.type,
|
|
169
|
+
useGasCoin: false,
|
|
170
|
+
})(tx);
|
|
171
|
+
const sui = this.redeem(tx, lstCoin);
|
|
172
|
+
return sui;
|
|
173
|
+
}
|
|
174
|
+
redeemAmountAndSendToUser(tx, address, amount) {
|
|
175
|
+
const suiCoin = this.redeemAmount(tx, address, amount);
|
|
176
|
+
tx.transferObjects([suiCoin], address);
|
|
179
177
|
}
|
|
180
178
|
// admin functions
|
|
181
179
|
increaseValidatorStake(tx, adminCapId, validatorAddress, suiAmount) {
|