@suilend/springsui-cli 1.0.13 → 1.0.14

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.
Files changed (66) hide show
  1. package/cli/src/bytecode.js +48 -48
  2. package/cli/src/index.js +165 -146
  3. package/package.json +1 -1
  4. package/sdk/src/_generated/_dependencies/source/0x1/ascii/structs.d.ts +5 -5
  5. package/sdk/src/_generated/_dependencies/source/0x1/ascii/structs.js +35 -75
  6. package/sdk/src/_generated/_dependencies/source/0x1/index.js +3 -6
  7. package/sdk/src/_generated/_dependencies/source/0x1/option/structs.d.ts +2 -7
  8. package/sdk/src/_generated/_dependencies/source/0x1/option/structs.js +31 -69
  9. package/sdk/src/_generated/_dependencies/source/0x1/string/structs.d.ts +3 -3
  10. package/sdk/src/_generated/_dependencies/source/0x1/string/structs.js +21 -59
  11. package/sdk/src/_generated/_dependencies/source/0x1/type-name/structs.d.ts +4 -4
  12. package/sdk/src/_generated/_dependencies/source/0x1/type-name/structs.js +20 -25
  13. package/sdk/src/_generated/_dependencies/source/0x2/bag/structs.d.ts +6 -6
  14. package/sdk/src/_generated/_dependencies/source/0x2/bag/structs.js +24 -29
  15. package/sdk/src/_generated/_dependencies/source/0x2/balance/structs.d.ts +5 -5
  16. package/sdk/src/_generated/_dependencies/source/0x2/balance/structs.js +49 -56
  17. package/sdk/src/_generated/_dependencies/source/0x2/coin/structs.d.ts +44 -58
  18. package/sdk/src/_generated/_dependencies/source/0x2/coin/structs.js +206 -223
  19. package/sdk/src/_generated/_dependencies/source/0x2/index.js +3 -6
  20. package/sdk/src/_generated/_dependencies/source/0x2/object/structs.d.ts +6 -6
  21. package/sdk/src/_generated/_dependencies/source/0x2/object/structs.js +34 -41
  22. package/sdk/src/_generated/_dependencies/source/0x2/sui/structs.d.ts +3 -3
  23. package/sdk/src/_generated/_dependencies/source/0x2/sui/structs.js +19 -24
  24. package/sdk/src/_generated/_dependencies/source/0x2/table/structs.d.ts +6 -6
  25. package/sdk/src/_generated/_dependencies/source/0x2/table/structs.js +31 -36
  26. package/sdk/src/_generated/_dependencies/source/0x2/url/structs.d.ts +4 -4
  27. package/sdk/src/_generated/_dependencies/source/0x2/url/structs.js +20 -25
  28. package/sdk/src/_generated/_dependencies/source/0x2/vec-map/structs.d.ts +4 -4
  29. package/sdk/src/_generated/_dependencies/source/0x2/vec-map/structs.js +57 -97
  30. package/sdk/src/_generated/_dependencies/source/0x3/index.js +3 -6
  31. package/sdk/src/_generated/_dependencies/source/0x3/staking-pool/structs.d.ts +52 -60
  32. package/sdk/src/_generated/_dependencies/source/0x3/staking-pool/structs.js +170 -218
  33. package/sdk/src/_generated/_framework/reified.d.ts +2 -2
  34. package/sdk/src/_generated/_framework/reified.js +27 -40
  35. package/sdk/src/_generated/_framework/util.d.ts +4 -16
  36. package/sdk/src/_generated/_framework/util.js +26 -40
  37. package/sdk/src/_generated/_framework/vector.d.ts +1 -12
  38. package/sdk/src/_generated/_framework/vector.js +16 -21
  39. package/sdk/src/_generated/liquid_staking/cell/structs.d.ts +2 -9
  40. package/sdk/src/_generated/liquid_staking/cell/structs.js +31 -36
  41. package/sdk/src/_generated/liquid_staking/fees/functions.d.ts +19 -19
  42. package/sdk/src/_generated/liquid_staking/fees/functions.js +55 -75
  43. package/sdk/src/_generated/liquid_staking/fees/structs.d.ts +19 -19
  44. package/sdk/src/_generated/liquid_staking/fees/structs.js +58 -65
  45. package/sdk/src/_generated/liquid_staking/index.js +6 -10
  46. package/sdk/src/_generated/liquid_staking/liquid-staking/functions.d.ts +20 -20
  47. package/sdk/src/_generated/liquid_staking/liquid-staking/functions.js +86 -107
  48. package/sdk/src/_generated/liquid_staking/liquid-staking/structs.d.ts +90 -184
  49. package/sdk/src/_generated/liquid_staking/liquid-staking/structs.js +264 -320
  50. package/sdk/src/_generated/liquid_staking/storage/structs.d.ts +31 -143
  51. package/sdk/src/_generated/liquid_staking/storage/structs.js +85 -125
  52. package/sdk/src/_generated/liquid_staking/version/structs.d.ts +3 -3
  53. package/sdk/src/_generated/liquid_staking/version/structs.js +19 -24
  54. package/sdk/src/_generated/liquid_staking/weight/functions.d.ts +11 -11
  55. package/sdk/src/_generated/liquid_staking/weight/functions.js +44 -56
  56. package/sdk/src/_generated/liquid_staking/weight/structs.d.ts +36 -36
  57. package/sdk/src/_generated/liquid_staking/weight/structs.js +128 -141
  58. package/sdk/src/client.d.ts +26 -36
  59. package/sdk/src/client.js +90 -126
  60. package/sdk/src/grpcAdapter.d.ts +50 -0
  61. package/sdk/src/grpcAdapter.js +75 -0
  62. package/sdk/src/index.d.ts +1 -0
  63. package/sdk/src/index.js +3 -18
  64. package/sdk/src/lib/index.js +1 -17
  65. package/sdk/src/lib/transactions.d.ts +1 -4
  66. package/sdk/src/lib/transactions.js +3 -8
package/cli/src/index.js CHANGED
@@ -1,37 +1,3 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -41,40 +7,47 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
41
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
42
8
  });
43
9
  };
44
- Object.defineProperty(exports, "__esModule", { value: true });
45
- const client_1 = require("@mysten/sui/client");
46
- const ed25519_1 = require("@mysten/sui/keypairs/ed25519");
47
- const transactions_1 = require("@mysten/sui/transactions");
48
- const utils_1 = require("@mysten/sui/utils");
49
- const commander_1 = require("commander");
50
- const springsui_sdk_1 = require("@suilend/springsui-sdk");
51
- const sdk = __importStar(require("@suilend/springsui-sdk"));
52
- const liquid_staking_1 = require("@suilend/springsui-sdk/_generated/liquid_staking");
53
- const LIQUID_STAKING_INFO = {
10
+ import { SuiGrpcClient } from "@mysten/sui/grpc";
11
+ import { SuiJsonRpcClient } from "@mysten/sui/jsonRpc";
12
+ import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
13
+ import { Transaction } from "@mysten/sui/transactions";
14
+ import { fromBase64 } from "@mysten/sui/utils";
15
+ import { program } from "commander";
16
+ import { LstClient } from "@suilend/springsui-sdk";
17
+ import * as sdk from "@suilend/springsui-sdk";
18
+ import { PACKAGE_ID } from "@suilend/springsui-sdk/_generated/liquid_staking";
19
+ const LIQUID_STAKING_OBJECT = {
54
20
  id: "0x15eda7330c8f99c30e430b4d82fd7ab2af3ead4ae17046fcb224aa9bad394f6b",
55
21
  type: "0x83556891f4a0f233ce7b05cfe7f957d4020492a34f5405b2cb9377d060bef4bf::spring_sui::SPRING_SUI",
56
22
  weightHookId: "0xbbafcb2d7399c0846f8185da3f273ad5b26b3b35993050affa44cfa890f1f144",
57
23
  };
58
- const RPC_URL = "https://fullnode.mainnet.sui.io";
59
- const keypair = ed25519_1.Ed25519Keypair.fromSecretKey((0, utils_1.fromBase64)(process.env.SUI_SECRET_KEY));
24
+ const RPC_URL = "https://fullnode.mainnet.sui.io:443";
25
+ const keypair = Ed25519Keypair.fromSecretKey(fromBase64(process.env.SUI_SECRET_KEY));
60
26
  // const keypair = Ed25519Keypair.fromSecretKey(
61
27
  // fromHex(fs.readFileSync(process.env.SUI_SECRET_KEY_PATH!).toString()),
62
28
  // );
63
29
  function mint(options) {
64
30
  return __awaiter(this, void 0, void 0, function* () {
65
- const client = new client_1.SuiClient({ url: RPC_URL });
66
- const lstClient = yield springsui_sdk_1.LstClient.initialize(client, LIQUID_STAKING_INFO);
67
- const tx = new transactions_1.Transaction();
31
+ const client = new SuiGrpcClient({
32
+ baseUrl: RPC_URL,
33
+ network: "mainnet",
34
+ });
35
+ const jsonRpcClient = new SuiJsonRpcClient({
36
+ url: RPC_URL,
37
+ network: "mainnet",
38
+ });
39
+ const lstClient = yield LstClient.initialize(client, jsonRpcClient, LIQUID_STAKING_OBJECT);
40
+ const tx = new Transaction();
68
41
  const [sui] = tx.splitCoins(tx.gas, [BigInt(options.amount)]);
69
42
  const rSui = lstClient.mint(tx, sui);
70
43
  tx.transferObjects([rSui], keypair.toSuiAddress());
71
44
  const txResponse = yield client.signAndExecuteTransaction({
72
45
  transaction: tx,
73
46
  signer: keypair,
74
- options: {
75
- showEvents: true,
76
- showEffects: true,
77
- showObjectChanges: true,
47
+ include: {
48
+ events: true,
49
+ effects: true,
50
+ objectTypes: true,
78
51
  },
79
52
  });
80
53
  console.log(txResponse);
@@ -82,18 +55,25 @@ function mint(options) {
82
55
  }
83
56
  function redeem(options) {
84
57
  return __awaiter(this, void 0, void 0, function* () {
85
- const client = new client_1.SuiClient({ url: RPC_URL });
86
- const lstCoins = yield client.getCoins({
58
+ const client = new SuiGrpcClient({
59
+ baseUrl: RPC_URL,
60
+ network: "mainnet",
61
+ });
62
+ const jsonRpcClient = new SuiJsonRpcClient({
63
+ url: RPC_URL,
64
+ network: "mainnet",
65
+ });
66
+ const lstCoins = yield client.listCoins({
87
67
  owner: keypair.toSuiAddress(),
88
- coinType: LIQUID_STAKING_INFO.type,
68
+ coinType: LIQUID_STAKING_OBJECT.type,
89
69
  limit: 1000,
90
70
  });
91
- const tx = new transactions_1.Transaction();
92
- const lstClient = yield springsui_sdk_1.LstClient.initialize(client, LIQUID_STAKING_INFO);
93
- if (lstCoins.data.length > 1) {
94
- tx.mergeCoins(lstCoins.data[0].coinObjectId, lstCoins.data.slice(1).map((c) => c.coinObjectId));
71
+ const tx = new Transaction();
72
+ const lstClient = yield LstClient.initialize(client, jsonRpcClient, LIQUID_STAKING_OBJECT);
73
+ if (lstCoins.objects.length > 1) {
74
+ tx.mergeCoins(lstCoins.objects[0].objectId, lstCoins.objects.slice(1).map((c) => c.objectId));
95
75
  }
96
- const [lst] = tx.splitCoins(lstCoins.data[0].coinObjectId, [
76
+ const [lst] = tx.splitCoins(lstCoins.objects[0].objectId, [
97
77
  BigInt(options.amount),
98
78
  ]);
99
79
  const sui = lstClient.redeem(tx, lst);
@@ -101,10 +81,10 @@ function redeem(options) {
101
81
  const txResponse = yield client.signAndExecuteTransaction({
102
82
  transaction: tx,
103
83
  signer: keypair,
104
- options: {
105
- showEvents: true,
106
- showEffects: true,
107
- showObjectChanges: true,
84
+ include: {
85
+ events: true,
86
+ effects: true,
87
+ objectTypes: true,
108
88
  },
109
89
  });
110
90
  console.log(txResponse);
@@ -112,20 +92,27 @@ function redeem(options) {
112
92
  }
113
93
  function increaseValidatorStake(options) {
114
94
  return __awaiter(this, void 0, void 0, function* () {
115
- const client = new client_1.SuiClient({ url: RPC_URL });
116
- const lstClient = yield springsui_sdk_1.LstClient.initialize(client, LIQUID_STAKING_INFO);
95
+ const client = new SuiGrpcClient({
96
+ baseUrl: RPC_URL,
97
+ network: "mainnet",
98
+ });
99
+ const jsonRpcClient = new SuiJsonRpcClient({
100
+ url: RPC_URL,
101
+ network: "mainnet",
102
+ });
103
+ const lstClient = yield LstClient.initialize(client, jsonRpcClient, LIQUID_STAKING_OBJECT);
117
104
  const adminCapId = yield lstClient.getAdminCapId(keypair.toSuiAddress());
118
105
  if (!adminCapId)
119
106
  return;
120
- const tx = new transactions_1.Transaction();
107
+ const tx = new Transaction();
121
108
  lstClient.increaseValidatorStake(tx, adminCapId, options.validatorAddress, options.amount);
122
109
  const txResponse = yield client.signAndExecuteTransaction({
123
110
  transaction: tx,
124
111
  signer: keypair,
125
- options: {
126
- showEvents: true,
127
- showEffects: true,
128
- showObjectChanges: true,
112
+ include: {
113
+ events: true,
114
+ effects: true,
115
+ objectTypes: true,
129
116
  },
130
117
  });
131
118
  console.log(txResponse);
@@ -133,20 +120,27 @@ function increaseValidatorStake(options) {
133
120
  }
134
121
  function decreaseValidatorStake(options) {
135
122
  return __awaiter(this, void 0, void 0, function* () {
136
- const client = new client_1.SuiClient({ url: RPC_URL });
137
- const lstClient = yield springsui_sdk_1.LstClient.initialize(client, LIQUID_STAKING_INFO);
123
+ const client = new SuiGrpcClient({
124
+ baseUrl: RPC_URL,
125
+ network: "mainnet",
126
+ });
127
+ const jsonRpcClient = new SuiJsonRpcClient({
128
+ url: RPC_URL,
129
+ network: "mainnet",
130
+ });
131
+ const lstClient = yield LstClient.initialize(client, jsonRpcClient, LIQUID_STAKING_OBJECT);
138
132
  const adminCapId = yield lstClient.getAdminCapId(keypair.toSuiAddress());
139
133
  if (!adminCapId)
140
134
  return;
141
- const tx = new transactions_1.Transaction();
135
+ const tx = new Transaction();
142
136
  lstClient.decreaseValidatorStake(tx, adminCapId, options.validatorIndex, options.amount);
143
137
  const txResponse = yield client.signAndExecuteTransaction({
144
138
  transaction: tx,
145
139
  signer: keypair,
146
- options: {
147
- showEvents: true,
148
- showEffects: true,
149
- showObjectChanges: true,
140
+ include: {
141
+ events: true,
142
+ effects: true,
143
+ objectTypes: true,
150
144
  },
151
145
  });
152
146
  console.log(txResponse);
@@ -154,27 +148,31 @@ function decreaseValidatorStake(options) {
154
148
  }
155
149
  function updateFees(options) {
156
150
  return __awaiter(this, void 0, void 0, function* () {
157
- var _a;
158
- const client = new client_1.SuiClient({ url: RPC_URL });
159
- const lstClient = yield springsui_sdk_1.LstClient.initialize(client, LIQUID_STAKING_INFO);
160
- const adminCap = (yield client.getOwnedObjects({
151
+ const client = new SuiGrpcClient({
152
+ baseUrl: RPC_URL,
153
+ network: "mainnet",
154
+ });
155
+ const jsonRpcClient = new SuiJsonRpcClient({
156
+ url: RPC_URL,
157
+ network: "mainnet",
158
+ });
159
+ const lstClient = yield LstClient.initialize(client, jsonRpcClient, LIQUID_STAKING_OBJECT);
160
+ const adminCap = (yield client.listOwnedObjects({
161
161
  owner: keypair.toSuiAddress(),
162
- filter: {
163
- StructType: `${liquid_staking_1.PACKAGE_ID}::liquid_staking::AdminCap<${LIQUID_STAKING_INFO.type}>`,
164
- },
165
- })).data[0];
166
- const adminCapId = (_a = adminCap.data) === null || _a === void 0 ? void 0 : _a.objectId;
162
+ type: `${PACKAGE_ID}::liquid_staking::AdminCap<${LIQUID_STAKING_OBJECT.type}>`,
163
+ })).objects[0];
164
+ const adminCapId = adminCap === null || adminCap === void 0 ? void 0 : adminCap.objectId;
167
165
  if (!adminCapId)
168
166
  return;
169
- const tx = new transactions_1.Transaction();
167
+ const tx = new Transaction();
170
168
  lstClient.updateFees(tx, adminCapId, options);
171
169
  const txResponse = yield client.signAndExecuteTransaction({
172
170
  transaction: tx,
173
171
  signer: keypair,
174
- options: {
175
- showEvents: true,
176
- showEffects: true,
177
- showObjectChanges: true,
172
+ include: {
173
+ events: true,
174
+ effects: true,
175
+ objectTypes: true,
178
176
  },
179
177
  });
180
178
  console.log(txResponse);
@@ -182,21 +180,28 @@ function updateFees(options) {
182
180
  }
183
181
  function initializeWeightHook(options) {
184
182
  return __awaiter(this, void 0, void 0, function* () {
185
- const client = new client_1.SuiClient({ url: RPC_URL });
186
- const lstClient = yield springsui_sdk_1.LstClient.initialize(client, LIQUID_STAKING_INFO);
183
+ const client = new SuiGrpcClient({
184
+ baseUrl: RPC_URL,
185
+ network: "mainnet",
186
+ });
187
+ const jsonRpcClient = new SuiJsonRpcClient({
188
+ url: RPC_URL,
189
+ network: "mainnet",
190
+ });
191
+ const lstClient = yield LstClient.initialize(client, jsonRpcClient, LIQUID_STAKING_OBJECT);
187
192
  const adminCapId = yield lstClient.getAdminCapId(keypair.toSuiAddress());
188
193
  if (!adminCapId)
189
194
  return;
190
- const tx = new transactions_1.Transaction();
195
+ const tx = new Transaction();
191
196
  const weightHookAdminCap = lstClient.initializeWeightHook(tx, adminCapId);
192
197
  tx.transferObjects([weightHookAdminCap], keypair.toSuiAddress());
193
198
  const txResponse = yield client.signAndExecuteTransaction({
194
199
  transaction: tx,
195
200
  signer: keypair,
196
- options: {
197
- showEvents: true,
198
- showEffects: true,
199
- showObjectChanges: true,
201
+ include: {
202
+ events: true,
203
+ effects: true,
204
+ objectTypes: true,
200
205
  },
201
206
  });
202
207
  console.log(txResponse);
@@ -204,8 +209,15 @@ function initializeWeightHook(options) {
204
209
  }
205
210
  function setValidatorAddressesAndWeights(options) {
206
211
  return __awaiter(this, void 0, void 0, function* () {
207
- const client = new client_1.SuiClient({ url: RPC_URL });
208
- const lstClient = yield springsui_sdk_1.LstClient.initialize(client, LIQUID_STAKING_INFO);
212
+ const client = new SuiGrpcClient({
213
+ baseUrl: RPC_URL,
214
+ network: "mainnet",
215
+ });
216
+ const jsonRpcClient = new SuiJsonRpcClient({
217
+ url: RPC_URL,
218
+ network: "mainnet",
219
+ });
220
+ const lstClient = yield LstClient.initialize(client, jsonRpcClient, LIQUID_STAKING_OBJECT);
209
221
  if (options.validators.length != options.weights.length) {
210
222
  throw new Error("Validators and weights arrays must be of the same length");
211
223
  }
@@ -214,18 +226,18 @@ function setValidatorAddressesAndWeights(options) {
214
226
  validatorAddressesAndWeights[options.validators[i]] = options.weights[i];
215
227
  }
216
228
  console.log(validatorAddressesAndWeights);
217
- const weightHookAdminCapId = yield springsui_sdk_1.LstClient.getWeightHookAdminCapId(client, keypair.toSuiAddress(), LIQUID_STAKING_INFO.type);
229
+ const weightHookAdminCapId = yield LstClient.getWeightHookAdminCapId(client, keypair.toSuiAddress(), LIQUID_STAKING_OBJECT.type);
218
230
  if (!weightHookAdminCapId)
219
231
  return;
220
- const tx = new transactions_1.Transaction();
221
- lstClient.setValidatorAddressesAndWeights(tx, LIQUID_STAKING_INFO.weightHookId, weightHookAdminCapId, validatorAddressesAndWeights);
232
+ const tx = new Transaction();
233
+ lstClient.setValidatorAddressesAndWeights(tx, LIQUID_STAKING_OBJECT.weightHookId, weightHookAdminCapId, validatorAddressesAndWeights);
222
234
  const txResponse = yield client.signAndExecuteTransaction({
223
235
  transaction: tx,
224
236
  signer: keypair,
225
- options: {
226
- showEvents: true,
227
- showEffects: true,
228
- showObjectChanges: true,
237
+ include: {
238
+ events: true,
239
+ effects: true,
240
+ objectTypes: true,
229
241
  },
230
242
  });
231
243
  console.log(txResponse);
@@ -233,17 +245,24 @@ function setValidatorAddressesAndWeights(options) {
233
245
  }
234
246
  function rebalance(options) {
235
247
  return __awaiter(this, void 0, void 0, function* () {
236
- const client = new client_1.SuiClient({ url: RPC_URL });
237
- const lstClient = yield springsui_sdk_1.LstClient.initialize(client, LIQUID_STAKING_INFO);
238
- const tx = new transactions_1.Transaction();
239
- lstClient.rebalance(tx, LIQUID_STAKING_INFO.weightHookId);
248
+ const client = new SuiGrpcClient({
249
+ baseUrl: RPC_URL,
250
+ network: "mainnet",
251
+ });
252
+ const jsonRpcClient = new SuiJsonRpcClient({
253
+ url: RPC_URL,
254
+ network: "mainnet",
255
+ });
256
+ const lstClient = yield LstClient.initialize(client, jsonRpcClient, LIQUID_STAKING_OBJECT);
257
+ const tx = new Transaction();
258
+ lstClient.rebalance(tx, LIQUID_STAKING_OBJECT.weightHookId);
240
259
  const txResponse = yield client.signAndExecuteTransaction({
241
260
  transaction: tx,
242
261
  signer: keypair,
243
- options: {
244
- showEvents: true,
245
- showEffects: true,
246
- showObjectChanges: true,
262
+ include: {
263
+ events: true,
264
+ effects: true,
265
+ objectTypes: true,
247
266
  },
248
267
  });
249
268
  console.log(txResponse);
@@ -251,73 +270,73 @@ function rebalance(options) {
251
270
  }
252
271
  function createNewLst(options) {
253
272
  return __awaiter(this, void 0, void 0, function* () {
254
- var _a;
255
- const client = new client_1.SuiClient({ url: RPC_URL });
273
+ const client = new SuiGrpcClient({
274
+ baseUrl: RPC_URL,
275
+ network: "mainnet",
276
+ });
256
277
  const treasuryCap = yield client.getObject({
257
- id: options.treasuryCap,
258
- options: {
259
- showContent: true,
260
- },
278
+ objectId: options.treasuryCap,
261
279
  });
262
280
  console.log(treasuryCap);
263
281
  // '0x2::coin::TreasuryCap<0xdc0c8026236f1be172ba03d7d689bfd663497cc5a730bf367bfb2e2c72ec6df8::ripleys::RIPLEYS>'
264
- const type = ((_a = treasuryCap.data) === null || _a === void 0 ? void 0 : _a.content).type;
265
- if (!type)
266
- return;
282
+ const type = treasuryCap.object.type;
267
283
  const coinType = type.substring(type.indexOf("<") + 1, type.lastIndexOf(">"));
268
284
  console.log(coinType);
269
- const tx = new transactions_1.Transaction();
270
- const weightHookAdminCap = springsui_sdk_1.LstClient.createNewLst(tx, options.treasuryCap, coinType);
285
+ const tx = new Transaction();
286
+ const weightHookAdminCap = LstClient.createNewLst(tx, options.treasuryCap, coinType);
271
287
  tx.transferObjects([tx.object(weightHookAdminCap)], keypair.toSuiAddress());
272
288
  const txResponse = yield client.signAndExecuteTransaction({
273
289
  transaction: tx,
274
290
  signer: keypair,
275
- options: {
276
- showEvents: true,
277
- showEffects: true,
278
- showObjectChanges: true,
291
+ include: {
292
+ events: true,
293
+ effects: true,
294
+ objectTypes: true,
279
295
  },
280
296
  });
281
297
  console.log(txResponse);
282
298
  });
283
299
  }
284
- commander_1.program.version("1.0.0").description("Spring Sui CLI");
285
- commander_1.program
300
+ program.version("1.0.0").description("Spring Sui CLI");
301
+ program
286
302
  .command("mint")
287
303
  .description("mint some rSui")
288
304
  .option("--amount <SUI>", "Amount of SUI in MIST")
289
305
  .action(mint);
290
- commander_1.program
306
+ program
291
307
  .command("redeem")
292
308
  .description("redeem some SUI")
293
309
  .option("--amount <LST>", "Amount of LST to redeem")
294
310
  .action(redeem);
295
- commander_1.program
311
+ program
296
312
  .command("increase-validator-stake")
297
313
  .description("increase validator stake")
298
314
  .option("--validator-address <VALIDATOR>", "Validator address")
299
315
  .option("--amount <SUI>", "Amount of SUI to delegate to validator")
300
316
  .action(increaseValidatorStake);
301
- commander_1.program
317
+ program
302
318
  .command("decrease-validator-stake")
303
319
  .description("decrease validator stake")
304
320
  .option("--validator-index <VALIDATOR_INDEX>", "Validator index")
305
321
  .option("--amount <SUI>", "Amount of SUI to undelegate from validator")
306
322
  .action(decreaseValidatorStake);
307
- commander_1.program
323
+ program
308
324
  .command("update-fees")
309
325
  .description("update fees")
310
326
  .option("--mint-fee-bps <MINT_FEE_BPS>", "Mint fee bps")
311
327
  .option("--redeem-fee-bps <REDEEM_FEE_BPS>", "Redeem fee bps")
312
328
  .option("--spread-fee <SPREAD_FEE>", "Spread fee")
313
329
  .action(updateFees);
314
- commander_1.program
330
+ program
315
331
  .command("fetch-state")
316
332
  .description("fetch the current state of the liquid staking pool")
317
333
  .action(() => __awaiter(void 0, void 0, void 0, function* () {
318
- const client = new client_1.SuiClient({ url: RPC_URL });
334
+ const client = new SuiGrpcClient({
335
+ baseUrl: RPC_URL,
336
+ network: "mainnet",
337
+ });
319
338
  try {
320
- const state = yield sdk.fetchLiquidStakingInfo(LIQUID_STAKING_INFO, client);
339
+ const state = yield sdk.fetchLiquidStakingInfo(LIQUID_STAKING_OBJECT, client);
321
340
  console.log("Current Liquid Staking State:");
322
341
  console.log(JSON.stringify(state, null, 2));
323
342
  }
@@ -325,7 +344,7 @@ commander_1.program
325
344
  console.error("Error fetching state:", error);
326
345
  }
327
346
  }));
328
- commander_1.program
347
+ program
329
348
  .command("initialize-weight-hook")
330
349
  .description("initialize weight hook")
331
350
  .action(initializeWeightHook);
@@ -336,19 +355,19 @@ function collect(pair, previous) {
336
355
  }
337
356
  return Object.assign(Object.assign({}, previous), { [key]: value });
338
357
  }
339
- commander_1.program
358
+ program
340
359
  .command("set-validator-addresses-and-weights")
341
360
  .description("set validator addresses and weights")
342
361
  .option("-v, --validators <VALIDATOR_ADDRESSES...>", "Validator addresses")
343
362
  .option("-w, --weights <WEIGHTS...>", "Weights")
344
363
  .action(setValidatorAddressesAndWeights);
345
- commander_1.program
364
+ program
346
365
  .command("rebalance")
347
366
  .description("rebalance the validator set")
348
367
  .action(rebalance);
349
- commander_1.program
368
+ program
350
369
  .command("create-new-lst")
351
370
  .description("create a new liquid staking pool")
352
371
  .option("--treasury-cap <TREASURY_CAP>", "Treasury cap")
353
372
  .action(createNewLst);
354
- commander_1.program.parse(process.argv);
373
+ program.parse(process.argv);
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@suilend/springsui-cli","version":"1.0.13","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.8.1","@mysten/sui":"1.42.0"},"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
+ {"name":"@suilend/springsui-cli","version":"1.0.14","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","./cli/src/bytecode":"./cli/src/bytecode.js","./sdk/src/client":"./sdk/src/client.js","./sdk/src":"./sdk/src/index.js","./sdk/src/grpcAdapter":"./sdk/src/grpcAdapter.js","./sdk/src/lib/transactions":"./sdk/src/lib/transactions.js","./sdk/src/lib":"./sdk/src/lib/index.js","./sdk/src/_generated/liquid_staking":"./sdk/src/_generated/liquid_staking/index.js","./sdk/src/_generated/_framework/util":"./sdk/src/_generated/_framework/util.js","./sdk/src/_generated/_framework/reified":"./sdk/src/_generated/_framework/reified.js","./sdk/src/_generated/_framework/vector":"./sdk/src/_generated/_framework/vector.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/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/cell/structs":"./sdk/src/_generated/liquid_staking/cell/structs.js","./sdk/src/_generated/liquid_staking/version/structs":"./sdk/src/_generated/liquid_staking/version/structs.js","./sdk/src/_generated/_dependencies/source/0x3":"./sdk/src/_generated/_dependencies/source/0x3/index.js","./sdk/src/_generated/_dependencies/source/0x2":"./sdk/src/_generated/_dependencies/source/0x2/index.js","./sdk/src/_generated/_dependencies/source/0x1":"./sdk/src/_generated/_dependencies/source/0x1/index.js","./sdk/src/_generated/_dependencies/source/0x3/staking-pool/structs":"./sdk/src/_generated/_dependencies/source/0x3/staking-pool/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/balance/structs":"./sdk/src/_generated/_dependencies/source/0x2/balance/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/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/table/structs":"./sdk/src/_generated/_dependencies/source/0x2/table/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/vec-map/structs":"./sdk/src/_generated/_dependencies/source/0x2/vec-map/structs.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/type-name/structs":"./sdk/src/_generated/_dependencies/source/0x1/type-name/structs.js","./sdk/src/_generated/_dependencies/source/0x1/string/structs":"./sdk/src/_generated/_dependencies/source/0x1/string/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 ./release.js && 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":"2.0.1","@mysten/sui":"2.3.1"},"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"}}
@@ -3,7 +3,7 @@ import { PhantomReified, Reified, StructClass, ToField, ToTypeStr } from "../../
3
3
  import { FieldsWithTypes } from "../../../../_framework/util";
4
4
  import { Vector } from "../../../../_framework/vector";
5
5
  import { PKG_V14 } from "../index";
6
- import { SuiClient, SuiObjectData, SuiParsedData } from "@mysten/sui/client";
6
+ import { SuiClient, SuiObjectData, SuiParsedData } from "@mysten/sui-v1/client";
7
7
  export declare function isChar(type: string): boolean;
8
8
  export interface CharFields {
9
9
  byte: ToField<"u8">;
@@ -24,8 +24,8 @@ export declare class Char implements StructClass {
24
24
  static get r(): reified.StructClassReified<Char, CharFields>;
25
25
  static phantom(): PhantomReified<ToTypeStr<Char>>;
26
26
  static get p(): reified.PhantomReified<"0x1::ascii::Char">;
27
- static get bcs(): import("@mysten/sui/bcs").BcsStruct<{
28
- byte: import("@mysten/sui/bcs").BcsType<number, number, "u8">;
27
+ static get bcs(): import("@mysten/sui-v1/bcs").BcsStruct<{
28
+ byte: import("@mysten/sui-v1/bcs").BcsType<number, number, "u8">;
29
29
  }, string>;
30
30
  static fromFields(fields: Record<string, any>): Char;
31
31
  static fromFieldsWithTypes(item: FieldsWithTypes): Char;
@@ -64,8 +64,8 @@ export declare class String implements StructClass {
64
64
  static get r(): reified.StructClassReified<String, StringFields>;
65
65
  static phantom(): PhantomReified<ToTypeStr<String>>;
66
66
  static get p(): reified.PhantomReified<"0x1::ascii::String">;
67
- static get bcs(): import("@mysten/sui/bcs").BcsStruct<{
68
- bytes: import("@mysten/sui/bcs").BcsType<number[], Iterable<number> & {
67
+ static get bcs(): import("@mysten/sui-v1/bcs").BcsStruct<{
68
+ bytes: import("@mysten/sui-v1/bcs").BcsType<number[], Iterable<number> & {
69
69
  length: number;
70
70
  }, string>;
71
71
  }, string>;