@suilend/springsui-cli 1.0.14 → 2.0.0

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 (57) hide show
  1. package/cli/src/bytecode.js +23 -25
  2. package/cli/src/index.js +80 -134
  3. package/package.json +1 -1
  4. package/sdk/src/_generated/_dependencies/source/0x1/ascii/structs.d.ts +7 -7
  5. package/sdk/src/_generated/_dependencies/source/0x1/ascii/structs.js +4 -4
  6. package/sdk/src/_generated/_dependencies/source/0x1/option/structs.d.ts +8 -3
  7. package/sdk/src/_generated/_dependencies/source/0x1/option/structs.js +3 -3
  8. package/sdk/src/_generated/_dependencies/source/0x1/string/structs.d.ts +4 -4
  9. package/sdk/src/_generated/_dependencies/source/0x1/string/structs.js +3 -3
  10. package/sdk/src/_generated/_dependencies/source/0x1/type-name/structs.d.ts +5 -5
  11. package/sdk/src/_generated/_dependencies/source/0x1/type-name/structs.js +3 -3
  12. package/sdk/src/_generated/_dependencies/source/0x2/bag/structs.d.ts +7 -7
  13. package/sdk/src/_generated/_dependencies/source/0x2/bag/structs.js +3 -3
  14. package/sdk/src/_generated/_dependencies/source/0x2/balance/structs.d.ts +7 -7
  15. package/sdk/src/_generated/_dependencies/source/0x2/balance/structs.js +4 -4
  16. package/sdk/src/_generated/_dependencies/source/0x2/coin/structs.d.ts +65 -51
  17. package/sdk/src/_generated/_dependencies/source/0x2/coin/structs.js +9 -9
  18. package/sdk/src/_generated/_dependencies/source/0x2/object/structs.d.ts +8 -8
  19. package/sdk/src/_generated/_dependencies/source/0x2/object/structs.js +6 -6
  20. package/sdk/src/_generated/_dependencies/source/0x2/sui/structs.d.ts +4 -4
  21. package/sdk/src/_generated/_dependencies/source/0x2/sui/structs.js +3 -3
  22. package/sdk/src/_generated/_dependencies/source/0x2/table/structs.d.ts +7 -7
  23. package/sdk/src/_generated/_dependencies/source/0x2/table/structs.js +3 -3
  24. package/sdk/src/_generated/_dependencies/source/0x2/url/structs.d.ts +5 -5
  25. package/sdk/src/_generated/_dependencies/source/0x2/url/structs.js +3 -3
  26. package/sdk/src/_generated/_dependencies/source/0x2/vec-map/structs.d.ts +6 -6
  27. package/sdk/src/_generated/_dependencies/source/0x2/vec-map/structs.js +4 -4
  28. package/sdk/src/_generated/_dependencies/source/0x3/staking-pool/structs.d.ts +66 -58
  29. package/sdk/src/_generated/_dependencies/source/0x3/staking-pool/structs.js +8 -8
  30. package/sdk/src/_generated/_framework/reified.d.ts +3 -3
  31. package/sdk/src/_generated/_framework/reified.js +4 -4
  32. package/sdk/src/_generated/_framework/util.d.ts +4 -4
  33. package/sdk/src/_generated/_framework/util.js +1 -1
  34. package/sdk/src/_generated/_framework/vector.d.ts +12 -1
  35. package/sdk/src/_generated/_framework/vector.js +1 -1
  36. package/sdk/src/_generated/liquid_staking/cell/structs.d.ts +10 -3
  37. package/sdk/src/_generated/liquid_staking/cell/structs.js +3 -3
  38. package/sdk/src/_generated/liquid_staking/fees/functions.d.ts +19 -19
  39. package/sdk/src/_generated/liquid_staking/fees/structs.d.ts +21 -21
  40. package/sdk/src/_generated/liquid_staking/fees/structs.js +4 -4
  41. package/sdk/src/_generated/liquid_staking/liquid-staking/functions.d.ts +20 -20
  42. package/sdk/src/_generated/liquid_staking/liquid-staking/structs.d.ts +194 -100
  43. package/sdk/src/_generated/liquid_staking/liquid-staking/structs.js +12 -12
  44. package/sdk/src/_generated/liquid_staking/storage/structs.d.ts +145 -33
  45. package/sdk/src/_generated/liquid_staking/storage/structs.js +6 -6
  46. package/sdk/src/_generated/liquid_staking/version/structs.d.ts +4 -4
  47. package/sdk/src/_generated/liquid_staking/version/structs.js +3 -3
  48. package/sdk/src/_generated/liquid_staking/weight/functions.d.ts +11 -11
  49. package/sdk/src/_generated/liquid_staking/weight/structs.d.ts +41 -41
  50. package/sdk/src/_generated/liquid_staking/weight/structs.js +9 -9
  51. package/sdk/src/client.d.ts +35 -25
  52. package/sdk/src/client.js +52 -59
  53. package/sdk/src/index.d.ts +0 -1
  54. package/sdk/src/index.js +0 -1
  55. package/sdk/src/lib/transactions.d.ts +4 -1
  56. package/sdk/src/grpcAdapter.d.ts +0 -50
  57. package/sdk/src/grpcAdapter.js +0 -75
@@ -7,10 +7,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ import assert from "assert";
10
11
  import { bcs } from "@mysten/bcs";
11
12
  import { update_constants, update_identifiers, } from "@mysten/move-bytecode-template";
12
13
  import init from "@mysten/move-bytecode-template";
13
- import { SuiGrpcClient } from "@mysten/sui/grpc";
14
+ import { SuiJsonRpcClient } from "@mysten/sui/jsonRpc";
14
15
  import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
15
16
  import { Transaction } from "@mysten/sui/transactions";
16
17
  import { fromBase64, normalizeSuiAddress } from "@mysten/sui/utils";
@@ -42,9 +43,9 @@ img_url) {
42
43
  }
43
44
  function main() {
44
45
  return __awaiter(this, void 0, void 0, function* () {
45
- var _a, _b, _c;
46
- const client = new SuiGrpcClient({
47
- baseUrl: "https://fullnode.mainnet.sui.io:443",
46
+ var _a;
47
+ const client = new SuiJsonRpcClient({
48
+ url: "https://fullnode.mainnet.sui.io",
48
49
  network: "mainnet",
49
50
  });
50
51
  console.log("asdf");
@@ -60,33 +61,30 @@ function main() {
60
61
  const txResponse = yield client.signAndExecuteTransaction({
61
62
  transaction: tx,
62
63
  signer: keypair,
63
- include: {
64
- events: true,
65
- effects: true,
66
- objectTypes: true,
64
+ options: {
65
+ showEvents: true,
66
+ showEffects: true,
67
+ showObjectChanges: true,
67
68
  },
68
69
  });
69
70
  console.log(txResponse);
70
71
  // Step 2: Get the treasury Cap id from the transaction
71
- const txResult = (_a = txResponse.Transaction) !== null && _a !== void 0 ? _a : txResponse.FailedTransaction;
72
- const treasuryCapObjectChange = txResult.effects.changedObjects.find((change) => change.idOperation === "Created" &&
73
- txResult.objectTypes[change.objectId].includes("TreasuryCap"));
74
- if (!treasuryCapObjectChange)
75
- throw new Error("TreasuryCap not found");
76
- const treasuryCapId = treasuryCapObjectChange.objectId;
77
- console.log(treasuryCapId);
78
- const coinType = (_c = (_b = txResult.objectTypes[treasuryCapId]) === null || _b === void 0 ? void 0 : _b.split("<")[1]) === null || _c === void 0 ? void 0 : _c.split(">")[0];
72
+ const treasuryCapObjectChange = (_a = txResponse.objectChanges) === null || _a === void 0 ? void 0 : _a.find((change) => change.type === "created" && change.objectType.includes("TreasuryCap"));
73
+ assert((treasuryCapObjectChange === null || treasuryCapObjectChange === void 0 ? void 0 : treasuryCapObjectChange.type) === "created");
74
+ const treasuryCapId = treasuryCapObjectChange === null || treasuryCapObjectChange === void 0 ? void 0 : treasuryCapObjectChange.objectId;
75
+ const coinType = treasuryCapObjectChange === null || treasuryCapObjectChange === void 0 ? void 0 : treasuryCapObjectChange.objectType.split("<")[1].split(">")[0];
79
76
  console.log(coinType);
77
+ console.log(treasuryCapId);
80
78
  // wait until the sui rpc recognizes the treasuryCapId
81
79
  while (true) {
82
- try {
83
- yield client.getObject({ objectId: treasuryCapId });
84
- break;
85
- }
86
- catch (_d) {
80
+ const object = yield client.getObject({ id: treasuryCapId });
81
+ if (object.error) {
87
82
  console.log("waiting for sui rpc to recognize the treasuryCapId");
88
83
  yield new Promise((resolve) => setTimeout(resolve, 1000));
89
84
  }
85
+ else {
86
+ break;
87
+ }
90
88
  }
91
89
  // Step 3: Create the lst
92
90
  const tx2 = new Transaction();
@@ -95,10 +93,10 @@ function main() {
95
93
  const txResponse2 = yield client.signAndExecuteTransaction({
96
94
  transaction: tx2,
97
95
  signer: keypair,
98
- include: {
99
- events: true,
100
- effects: true,
101
- objectTypes: true,
96
+ options: {
97
+ showEvents: true,
98
+ showEffects: true,
99
+ showObjectChanges: true,
102
100
  },
103
101
  });
104
102
  console.log(txResponse2);
package/cli/src/index.js CHANGED
@@ -7,7 +7,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { SuiGrpcClient } from "@mysten/sui/grpc";
11
10
  import { SuiJsonRpcClient } from "@mysten/sui/jsonRpc";
12
11
  import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
13
12
  import { Transaction } from "@mysten/sui/transactions";
@@ -16,27 +15,20 @@ import { program } from "commander";
16
15
  import { LstClient } from "@suilend/springsui-sdk";
17
16
  import * as sdk from "@suilend/springsui-sdk";
18
17
  import { PACKAGE_ID } from "@suilend/springsui-sdk/_generated/liquid_staking";
19
- const LIQUID_STAKING_OBJECT = {
18
+ const LIQUID_STAKING_INFO = {
20
19
  id: "0x15eda7330c8f99c30e430b4d82fd7ab2af3ead4ae17046fcb224aa9bad394f6b",
21
20
  type: "0x83556891f4a0f233ce7b05cfe7f957d4020492a34f5405b2cb9377d060bef4bf::spring_sui::SPRING_SUI",
22
21
  weightHookId: "0xbbafcb2d7399c0846f8185da3f273ad5b26b3b35993050affa44cfa890f1f144",
23
22
  };
24
- const RPC_URL = "https://fullnode.mainnet.sui.io:443";
23
+ const RPC_URL = "https://fullnode.mainnet.sui.io";
25
24
  const keypair = Ed25519Keypair.fromSecretKey(fromBase64(process.env.SUI_SECRET_KEY));
26
25
  // const keypair = Ed25519Keypair.fromSecretKey(
27
26
  // fromHex(fs.readFileSync(process.env.SUI_SECRET_KEY_PATH!).toString()),
28
27
  // );
29
28
  function mint(options) {
30
29
  return __awaiter(this, void 0, void 0, function* () {
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);
30
+ const client = new SuiJsonRpcClient({ url: RPC_URL, network: "mainnet" });
31
+ const lstClient = yield LstClient.initialize(client, LIQUID_STAKING_INFO);
40
32
  const tx = new Transaction();
41
33
  const [sui] = tx.splitCoins(tx.gas, [BigInt(options.amount)]);
42
34
  const rSui = lstClient.mint(tx, sui);
@@ -44,10 +36,10 @@ function mint(options) {
44
36
  const txResponse = yield client.signAndExecuteTransaction({
45
37
  transaction: tx,
46
38
  signer: keypair,
47
- include: {
48
- events: true,
49
- effects: true,
50
- objectTypes: true,
39
+ options: {
40
+ showEvents: true,
41
+ showEffects: true,
42
+ showObjectChanges: true,
51
43
  },
52
44
  });
53
45
  console.log(txResponse);
@@ -55,25 +47,18 @@ function mint(options) {
55
47
  }
56
48
  function redeem(options) {
57
49
  return __awaiter(this, void 0, void 0, function* () {
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({
50
+ const client = new SuiJsonRpcClient({ url: RPC_URL, network: "mainnet" });
51
+ const lstCoins = yield client.getCoins({
67
52
  owner: keypair.toSuiAddress(),
68
- coinType: LIQUID_STAKING_OBJECT.type,
53
+ coinType: LIQUID_STAKING_INFO.type,
69
54
  limit: 1000,
70
55
  });
71
56
  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));
57
+ const lstClient = yield LstClient.initialize(client, LIQUID_STAKING_INFO);
58
+ if (lstCoins.data.length > 1) {
59
+ tx.mergeCoins(lstCoins.data[0].coinObjectId, lstCoins.data.slice(1).map((c) => c.coinObjectId));
75
60
  }
76
- const [lst] = tx.splitCoins(lstCoins.objects[0].objectId, [
61
+ const [lst] = tx.splitCoins(lstCoins.data[0].coinObjectId, [
77
62
  BigInt(options.amount),
78
63
  ]);
79
64
  const sui = lstClient.redeem(tx, lst);
@@ -81,10 +66,10 @@ function redeem(options) {
81
66
  const txResponse = yield client.signAndExecuteTransaction({
82
67
  transaction: tx,
83
68
  signer: keypair,
84
- include: {
85
- events: true,
86
- effects: true,
87
- objectTypes: true,
69
+ options: {
70
+ showEvents: true,
71
+ showEffects: true,
72
+ showObjectChanges: true,
88
73
  },
89
74
  });
90
75
  console.log(txResponse);
@@ -92,15 +77,8 @@ function redeem(options) {
92
77
  }
93
78
  function increaseValidatorStake(options) {
94
79
  return __awaiter(this, void 0, void 0, function* () {
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);
80
+ const client = new SuiJsonRpcClient({ url: RPC_URL, network: "mainnet" });
81
+ const lstClient = yield LstClient.initialize(client, LIQUID_STAKING_INFO);
104
82
  const adminCapId = yield lstClient.getAdminCapId(keypair.toSuiAddress());
105
83
  if (!adminCapId)
106
84
  return;
@@ -109,10 +87,10 @@ function increaseValidatorStake(options) {
109
87
  const txResponse = yield client.signAndExecuteTransaction({
110
88
  transaction: tx,
111
89
  signer: keypair,
112
- include: {
113
- events: true,
114
- effects: true,
115
- objectTypes: true,
90
+ options: {
91
+ showEvents: true,
92
+ showEffects: true,
93
+ showObjectChanges: true,
116
94
  },
117
95
  });
118
96
  console.log(txResponse);
@@ -120,15 +98,8 @@ function increaseValidatorStake(options) {
120
98
  }
121
99
  function decreaseValidatorStake(options) {
122
100
  return __awaiter(this, void 0, void 0, function* () {
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);
101
+ const client = new SuiJsonRpcClient({ url: RPC_URL, network: "mainnet" });
102
+ const lstClient = yield LstClient.initialize(client, LIQUID_STAKING_INFO);
132
103
  const adminCapId = yield lstClient.getAdminCapId(keypair.toSuiAddress());
133
104
  if (!adminCapId)
134
105
  return;
@@ -137,10 +108,10 @@ function decreaseValidatorStake(options) {
137
108
  const txResponse = yield client.signAndExecuteTransaction({
138
109
  transaction: tx,
139
110
  signer: keypair,
140
- include: {
141
- events: true,
142
- effects: true,
143
- objectTypes: true,
111
+ options: {
112
+ showEvents: true,
113
+ showEffects: true,
114
+ showObjectChanges: true,
144
115
  },
145
116
  });
146
117
  console.log(txResponse);
@@ -148,20 +119,16 @@ function decreaseValidatorStake(options) {
148
119
  }
149
120
  function updateFees(options) {
150
121
  return __awaiter(this, void 0, void 0, function* () {
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({
122
+ var _a;
123
+ const client = new SuiJsonRpcClient({ url: RPC_URL, network: "mainnet" });
124
+ const lstClient = yield LstClient.initialize(client, LIQUID_STAKING_INFO);
125
+ const adminCap = (yield client.getOwnedObjects({
161
126
  owner: keypair.toSuiAddress(),
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;
127
+ filter: {
128
+ StructType: `${PACKAGE_ID}::liquid_staking::AdminCap<${LIQUID_STAKING_INFO.type}>`,
129
+ },
130
+ })).data[0];
131
+ const adminCapId = (_a = adminCap.data) === null || _a === void 0 ? void 0 : _a.objectId;
165
132
  if (!adminCapId)
166
133
  return;
167
134
  const tx = new Transaction();
@@ -169,10 +136,10 @@ function updateFees(options) {
169
136
  const txResponse = yield client.signAndExecuteTransaction({
170
137
  transaction: tx,
171
138
  signer: keypair,
172
- include: {
173
- events: true,
174
- effects: true,
175
- objectTypes: true,
139
+ options: {
140
+ showEvents: true,
141
+ showEffects: true,
142
+ showObjectChanges: true,
176
143
  },
177
144
  });
178
145
  console.log(txResponse);
@@ -180,15 +147,8 @@ function updateFees(options) {
180
147
  }
181
148
  function initializeWeightHook(options) {
182
149
  return __awaiter(this, void 0, void 0, function* () {
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);
150
+ const client = new SuiJsonRpcClient({ url: RPC_URL, network: "mainnet" });
151
+ const lstClient = yield LstClient.initialize(client, LIQUID_STAKING_INFO);
192
152
  const adminCapId = yield lstClient.getAdminCapId(keypair.toSuiAddress());
193
153
  if (!adminCapId)
194
154
  return;
@@ -198,10 +158,10 @@ function initializeWeightHook(options) {
198
158
  const txResponse = yield client.signAndExecuteTransaction({
199
159
  transaction: tx,
200
160
  signer: keypair,
201
- include: {
202
- events: true,
203
- effects: true,
204
- objectTypes: true,
161
+ options: {
162
+ showEvents: true,
163
+ showEffects: true,
164
+ showObjectChanges: true,
205
165
  },
206
166
  });
207
167
  console.log(txResponse);
@@ -209,15 +169,8 @@ function initializeWeightHook(options) {
209
169
  }
210
170
  function setValidatorAddressesAndWeights(options) {
211
171
  return __awaiter(this, void 0, void 0, function* () {
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);
172
+ const client = new SuiJsonRpcClient({ url: RPC_URL, network: "mainnet" });
173
+ const lstClient = yield LstClient.initialize(client, LIQUID_STAKING_INFO);
221
174
  if (options.validators.length != options.weights.length) {
222
175
  throw new Error("Validators and weights arrays must be of the same length");
223
176
  }
@@ -226,18 +179,18 @@ function setValidatorAddressesAndWeights(options) {
226
179
  validatorAddressesAndWeights[options.validators[i]] = options.weights[i];
227
180
  }
228
181
  console.log(validatorAddressesAndWeights);
229
- const weightHookAdminCapId = yield LstClient.getWeightHookAdminCapId(client, keypair.toSuiAddress(), LIQUID_STAKING_OBJECT.type);
182
+ const weightHookAdminCapId = yield LstClient.getWeightHookAdminCapId(client, keypair.toSuiAddress(), LIQUID_STAKING_INFO.type);
230
183
  if (!weightHookAdminCapId)
231
184
  return;
232
185
  const tx = new Transaction();
233
- lstClient.setValidatorAddressesAndWeights(tx, LIQUID_STAKING_OBJECT.weightHookId, weightHookAdminCapId, validatorAddressesAndWeights);
186
+ lstClient.setValidatorAddressesAndWeights(tx, LIQUID_STAKING_INFO.weightHookId, weightHookAdminCapId, validatorAddressesAndWeights);
234
187
  const txResponse = yield client.signAndExecuteTransaction({
235
188
  transaction: tx,
236
189
  signer: keypair,
237
- include: {
238
- events: true,
239
- effects: true,
240
- objectTypes: true,
190
+ options: {
191
+ showEvents: true,
192
+ showEffects: true,
193
+ showObjectChanges: true,
241
194
  },
242
195
  });
243
196
  console.log(txResponse);
@@ -245,24 +198,17 @@ function setValidatorAddressesAndWeights(options) {
245
198
  }
246
199
  function rebalance(options) {
247
200
  return __awaiter(this, void 0, void 0, function* () {
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);
201
+ const client = new SuiJsonRpcClient({ url: RPC_URL, network: "mainnet" });
202
+ const lstClient = yield LstClient.initialize(client, LIQUID_STAKING_INFO);
257
203
  const tx = new Transaction();
258
- lstClient.rebalance(tx, LIQUID_STAKING_OBJECT.weightHookId);
204
+ lstClient.rebalance(tx, LIQUID_STAKING_INFO.weightHookId);
259
205
  const txResponse = yield client.signAndExecuteTransaction({
260
206
  transaction: tx,
261
207
  signer: keypair,
262
- include: {
263
- events: true,
264
- effects: true,
265
- objectTypes: true,
208
+ options: {
209
+ showEvents: true,
210
+ showEffects: true,
211
+ showObjectChanges: true,
266
212
  },
267
213
  });
268
214
  console.log(txResponse);
@@ -270,16 +216,19 @@ function rebalance(options) {
270
216
  }
271
217
  function createNewLst(options) {
272
218
  return __awaiter(this, void 0, void 0, function* () {
273
- const client = new SuiGrpcClient({
274
- baseUrl: RPC_URL,
275
- network: "mainnet",
276
- });
219
+ var _a;
220
+ const client = new SuiJsonRpcClient({ url: RPC_URL, network: "mainnet" });
277
221
  const treasuryCap = yield client.getObject({
278
- objectId: options.treasuryCap,
222
+ id: options.treasuryCap,
223
+ options: {
224
+ showContent: true,
225
+ },
279
226
  });
280
227
  console.log(treasuryCap);
281
228
  // '0x2::coin::TreasuryCap<0xdc0c8026236f1be172ba03d7d689bfd663497cc5a730bf367bfb2e2c72ec6df8::ripleys::RIPLEYS>'
282
- const type = treasuryCap.object.type;
229
+ const type = ((_a = treasuryCap.data) === null || _a === void 0 ? void 0 : _a.content).type;
230
+ if (!type)
231
+ return;
283
232
  const coinType = type.substring(type.indexOf("<") + 1, type.lastIndexOf(">"));
284
233
  console.log(coinType);
285
234
  const tx = new Transaction();
@@ -288,10 +237,10 @@ function createNewLst(options) {
288
237
  const txResponse = yield client.signAndExecuteTransaction({
289
238
  transaction: tx,
290
239
  signer: keypair,
291
- include: {
292
- events: true,
293
- effects: true,
294
- objectTypes: true,
240
+ options: {
241
+ showEvents: true,
242
+ showEffects: true,
243
+ showObjectChanges: true,
295
244
  },
296
245
  });
297
246
  console.log(txResponse);
@@ -331,12 +280,9 @@ program
331
280
  .command("fetch-state")
332
281
  .description("fetch the current state of the liquid staking pool")
333
282
  .action(() => __awaiter(void 0, void 0, void 0, function* () {
334
- const client = new SuiGrpcClient({
335
- baseUrl: RPC_URL,
336
- network: "mainnet",
337
- });
283
+ const client = new SuiJsonRpcClient({ url: RPC_URL, network: "mainnet" });
338
284
  try {
339
- const state = yield sdk.fetchLiquidStakingInfo(LIQUID_STAKING_OBJECT, client);
285
+ const state = yield sdk.fetchLiquidStakingInfo(LIQUID_STAKING_INFO, client);
340
286
  console.log("Current Liquid Staking State:");
341
287
  console.log(JSON.stringify(state, null, 2));
342
288
  }
package/package.json CHANGED
@@ -1 +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"}}
1
+ {"name":"@suilend/springsui-cli","version":"2.0.0","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/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-v1/client";
6
+ import { SuiJsonRpcClient, SuiObjectData, SuiParsedData } from "@mysten/sui/jsonRpc";
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-v1/bcs").BcsStruct<{
28
- byte: import("@mysten/sui-v1/bcs").BcsType<number, number, "u8">;
27
+ static get bcs(): import("@mysten/bcs").BcsStruct<{
28
+ byte: import("@mysten/bcs").BcsType<number, number, "u8">;
29
29
  }, string>;
30
30
  static fromFields(fields: Record<string, any>): Char;
31
31
  static fromFieldsWithTypes(item: FieldsWithTypes): Char;
@@ -42,7 +42,7 @@ export declare class Char implements StructClass {
42
42
  static fromJSON(json: Record<string, any>): Char;
43
43
  static fromSuiParsedData(content: SuiParsedData): Char;
44
44
  static fromSuiObjectData(data: SuiObjectData): Char;
45
- static fetch(client: SuiClient, id: string): Promise<Char>;
45
+ static fetch(client: SuiJsonRpcClient, id: string): Promise<Char>;
46
46
  }
47
47
  export declare function isString(type: string): boolean;
48
48
  export interface StringFields {
@@ -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-v1/bcs").BcsStruct<{
68
- bytes: import("@mysten/sui-v1/bcs").BcsType<number[], Iterable<number> & {
67
+ static get bcs(): import("@mysten/bcs").BcsStruct<{
68
+ bytes: import("@mysten/bcs").BcsType<number[], Iterable<number> & {
69
69
  length: number;
70
70
  }, string>;
71
71
  }, string>;
@@ -84,5 +84,5 @@ export declare class String implements StructClass {
84
84
  static fromJSON(json: Record<string, any>): String;
85
85
  static fromSuiParsedData(content: SuiParsedData): String;
86
86
  static fromSuiObjectData(data: SuiObjectData): String;
87
- static fetch(client: SuiClient, id: string): Promise<String>;
87
+ static fetch(client: SuiJsonRpcClient, id: string): Promise<String>;
88
88
  }
@@ -11,8 +11,8 @@ import * as reified from "../../../../_framework/reified";
11
11
  import { decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, fieldToJSON, phantom, } from "../../../../_framework/reified";
12
12
  import { composeSuiType, compressSuiType, } from "../../../../_framework/util";
13
13
  import { PKG_V14 } from "../index";
14
- import { bcs } from "@mysten/sui-v1/bcs";
15
- import { fromB64 } from "@mysten/sui-v1/utils";
14
+ import { bcs } from "@mysten/sui/bcs";
15
+ import { fromBase64 } from "@mysten/sui/utils";
16
16
  /* ============================== Char =============================== */
17
17
  export function isChar(type) {
18
18
  type = compressSuiType(type);
@@ -108,7 +108,7 @@ export class Char {
108
108
  if (data.bcs.dataType !== "moveObject" || !isChar(data.bcs.type)) {
109
109
  throw new Error(`object at is not a Char object`);
110
110
  }
111
- return Char.fromBcs(fromB64(data.bcs.bcsBytes));
111
+ return Char.fromBcs(fromBase64(data.bcs.bcsBytes));
112
112
  }
113
113
  if (data.content) {
114
114
  return Char.fromSuiParsedData(data.content);
@@ -232,7 +232,7 @@ export class String {
232
232
  if (data.bcs.dataType !== "moveObject" || !isString(data.bcs.type)) {
233
233
  throw new Error(`object at is not a String object`);
234
234
  }
235
- return String.fromBcs(fromB64(data.bcs.bcsBytes));
235
+ return String.fromBcs(fromBase64(data.bcs.bcsBytes));
236
236
  }
237
237
  if (data.content) {
238
238
  return String.fromSuiParsedData(data.content);
@@ -3,7 +3,8 @@ import { PhantomReified, Reified, StructClass, ToField, ToTypeArgument, ToTypeSt
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-v1/client";
6
+ import { BcsType } from "@mysten/sui/bcs";
7
+ import { SuiJsonRpcClient, SuiObjectData, SuiParsedData } from "@mysten/sui/jsonRpc";
7
8
  export declare function isOption(type: string): boolean;
8
9
  export interface OptionFields<Element extends TypeArgument> {
9
10
  vec: ToField<Vector<Element>>;
@@ -25,7 +26,11 @@ export declare class Option<Element extends TypeArgument> implements StructClass
25
26
  static get r(): typeof Option.reified;
26
27
  static phantom<Element extends Reified<TypeArgument, any>>(Element: Element): PhantomReified<ToTypeStr<Option<ToTypeArgument<Element>>>>;
27
28
  static get p(): typeof Option.phantom;
28
- static get bcs(): any;
29
+ static get bcs(): <Element extends BcsType<any>>(Element: Element) => import("@mysten/bcs").BcsStruct<{
30
+ vec: BcsType<import("@mysten/bcs").InferBcsType<Element>[], Iterable<import("@mysten/bcs").InferBcsInput<Element>> & {
31
+ length: number;
32
+ }, string>;
33
+ }, string>;
29
34
  static fromFields<Element extends Reified<TypeArgument, any>>(typeArg: Element, fields: Record<string, any>): Option<ToTypeArgument<Element>>;
30
35
  static fromFieldsWithTypes<Element extends Reified<TypeArgument, any>>(typeArg: Element, item: FieldsWithTypes): Option<ToTypeArgument<Element>>;
31
36
  static fromBcs<Element extends Reified<TypeArgument, any>>(typeArg: Element, data: Uint8Array): Option<ToTypeArgument<Element>>;
@@ -41,5 +46,5 @@ export declare class Option<Element extends TypeArgument> implements StructClass
41
46
  static fromJSON<Element extends Reified<TypeArgument, any>>(typeArg: Element, json: Record<string, any>): Option<ToTypeArgument<Element>>;
42
47
  static fromSuiParsedData<Element extends Reified<TypeArgument, any>>(typeArg: Element, content: SuiParsedData): Option<ToTypeArgument<Element>>;
43
48
  static fromSuiObjectData<Element extends Reified<TypeArgument, any>>(typeArg: Element, data: SuiObjectData): Option<ToTypeArgument<Element>>;
44
- static fetch<Element extends Reified<TypeArgument, any>>(client: SuiClient, typeArg: Element, id: string): Promise<Option<ToTypeArgument<Element>>>;
49
+ static fetch<Element extends Reified<TypeArgument, any>>(client: SuiJsonRpcClient, typeArg: Element, id: string): Promise<Option<ToTypeArgument<Element>>>;
45
50
  }
@@ -11,8 +11,8 @@ import * as reified from "../../../../_framework/reified";
11
11
  import { assertFieldsWithTypesArgsMatch, assertReifiedTypeArgsMatch, decodeFromFields, decodeFromFieldsWithTypes, decodeFromJSONField, extractType, fieldToJSON, phantom, toBcs, } from "../../../../_framework/reified";
12
12
  import { composeSuiType, compressSuiType, parseTypeName, } from "../../../../_framework/util";
13
13
  import { PKG_V14 } from "../index";
14
- import { bcs } from "@mysten/sui-v1/bcs";
15
- import { fromB64 } from "@mysten/sui-v1/utils";
14
+ import { bcs } from "@mysten/sui/bcs";
15
+ import { fromBase64 } from "@mysten/sui/utils";
16
16
  /* ============================== Option =============================== */
17
17
  export function isOption(type) {
18
18
  type = compressSuiType(type);
@@ -125,7 +125,7 @@ export class Option {
125
125
  if (gotTypeArg !== compressSuiType(extractType(typeArg))) {
126
126
  throw new Error(`type argument mismatch: expected '${expectedTypeArg}' but got '${gotTypeArg}'`);
127
127
  }
128
- return Option.fromBcs(typeArg, fromB64(data.bcs.bcsBytes));
128
+ return Option.fromBcs(typeArg, fromBase64(data.bcs.bcsBytes));
129
129
  }
130
130
  if (data.content) {
131
131
  return Option.fromSuiParsedData(typeArg, data.content);