@suilend/springsui-cli 1.0.13 → 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 (60) hide show
  1. package/cli/src/bytecode.js +28 -30
  2. package/cli/src/index.js +51 -86
  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 +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 +3 -3
  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 +4 -4
  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 +5 -5
  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 +7 -7
  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 +7 -7
  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 +52 -52
  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 +8 -8
  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 +4 -4
  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 +7 -7
  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 +5 -5
  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 +5 -5
  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 +60 -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 +2 -14
  36. package/sdk/src/_generated/_framework/util.js +26 -40
  37. package/sdk/src/_generated/_framework/vector.d.ts +4 -4
  38. package/sdk/src/_generated/_framework/vector.js +16 -21
  39. package/sdk/src/_generated/liquid_staking/cell/structs.d.ts +4 -4
  40. package/sdk/src/_generated/liquid_staking/cell/structs.js +31 -36
  41. package/sdk/src/_generated/liquid_staking/fees/functions.js +55 -75
  42. package/sdk/src/_generated/liquid_staking/fees/structs.d.ts +21 -21
  43. package/sdk/src/_generated/liquid_staking/fees/structs.js +58 -65
  44. package/sdk/src/_generated/liquid_staking/index.js +6 -10
  45. package/sdk/src/_generated/liquid_staking/liquid-staking/functions.js +86 -107
  46. package/sdk/src/_generated/liquid_staking/liquid-staking/structs.d.ts +98 -98
  47. package/sdk/src/_generated/liquid_staking/liquid-staking/structs.js +264 -320
  48. package/sdk/src/_generated/liquid_staking/storage/structs.d.ts +31 -31
  49. package/sdk/src/_generated/liquid_staking/storage/structs.js +85 -125
  50. package/sdk/src/_generated/liquid_staking/version/structs.d.ts +4 -4
  51. package/sdk/src/_generated/liquid_staking/version/structs.js +19 -24
  52. package/sdk/src/_generated/liquid_staking/weight/functions.js +44 -56
  53. package/sdk/src/_generated/liquid_staking/weight/structs.d.ts +41 -41
  54. package/sdk/src/_generated/liquid_staking/weight/structs.js +128 -141
  55. package/sdk/src/client.d.ts +16 -16
  56. package/sdk/src/client.js +39 -82
  57. package/sdk/src/index.js +2 -18
  58. package/sdk/src/lib/index.js +1 -17
  59. package/sdk/src/lib/transactions.d.ts +1 -1
  60. package/sdk/src/lib/transactions.js +3 -8
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
2
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
3
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,21 +7,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
8
  });
10
9
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- const assert_1 = __importDefault(require("assert"));
16
- const bcs_1 = require("@mysten/bcs");
17
- const move_bytecode_template_1 = require("@mysten/move-bytecode-template");
18
- const move_bytecode_template_2 = __importDefault(require("@mysten/move-bytecode-template"));
19
- const client_1 = require("@mysten/sui/client");
20
- const ed25519_1 = require("@mysten/sui/keypairs/ed25519");
21
- const transactions_1 = require("@mysten/sui/transactions");
22
- const utils_1 = require("@mysten/sui/utils");
23
- const springsui_sdk_1 = require("@suilend/springsui-sdk");
10
+ import assert from "assert";
11
+ import { bcs } from "@mysten/bcs";
12
+ import { update_constants, update_identifiers, } from "@mysten/move-bytecode-template";
13
+ import init from "@mysten/move-bytecode-template";
14
+ import { SuiJsonRpcClient } from "@mysten/sui/jsonRpc";
15
+ import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
16
+ import { Transaction } from "@mysten/sui/transactions";
17
+ import { fromBase64, normalizeSuiAddress } from "@mysten/sui/utils";
18
+ import { LstClient } from "@suilend/springsui-sdk";
24
19
  // import url from "@mysten/move-bytecode-template/move_bytecode_template_bg.wasm?url";
25
- const keypair = ed25519_1.Ed25519Keypair.fromSecretKey((0, utils_1.fromBase64)(process.env.SUI_SECRET_KEY));
20
+ const keypair = Ed25519Keypair.fromSecretKey(fromBase64(process.env.SUI_SECRET_KEY));
26
21
  function generate_bytecode(lst_type, // eg K_SUI
27
22
  module_name, // eg ksui
28
23
  symbol, // eg sSUI
@@ -30,34 +25,37 @@ name, // eg Spring SUI
30
25
  description, // eg Spring SUI is a liquid staking protocol on Sui
31
26
  img_url) {
32
27
  const bytecode = Buffer.from("oRzrCwYAAAAKAQAMAgweAyonBFEIBVlMB6UBywEI8AJgBtADXQqtBAUMsgQoABABCwIGAhECEgITAAICAAEBBwEAAAIADAEAAQIDDAEAAQQEAgAFBQcAAAkAAQABDwUGAQACBwgJAQIDDAUBAQwDDQ0BAQwEDgoLAAUKAwQAAQQCBwQMAwICCAAHCAQAAQsCAQgAAQoCAQgFAQkAAQsBAQkAAQgABwkAAgoCCgIKAgsBAQgFBwgEAgsDAQkACwIBCQABBggEAQUBCwMBCAACCQAFDENvaW5NZXRhZGF0YQZPcHRpb24IVEVNUExBVEULVHJlYXN1cnlDYXAJVHhDb250ZXh0A1VybARjb2luD2NyZWF0ZV9jdXJyZW5jeQtkdW1teV9maWVsZARpbml0FW5ld191bnNhZmVfZnJvbV9ieXRlcwZvcHRpb24TcHVibGljX3NoYXJlX29iamVjdA9wdWJsaWNfdHJhbnNmZXIGc2VuZGVyBHNvbWUIdGVtcGxhdGUIdHJhbnNmZXIKdHhfY29udGV4dAN1cmwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAICAQkKAgUEVE1QTAoCDg1UZW1wbGF0ZSBDb2luCgIaGVRlbXBsYXRlIENvaW4gRGVzY3JpcHRpb24KAiEgaHR0cHM6Ly9leGFtcGxlLmNvbS90ZW1wbGF0ZS5wbmcAAgEIAQAAAAACEgsABwAHAQcCBwMHBBEGOAAKATgBDAILAS4RBTgCCwI4AwIA=", "base64");
33
- let updated = (0, move_bytecode_template_1.update_identifiers)(bytecode, {
28
+ let updated = update_identifiers(bytecode, {
34
29
  TEMPLATE: lst_type,
35
30
  template: module_name,
36
31
  });
37
- updated = (0, move_bytecode_template_1.update_constants)(updated, bcs_1.bcs.string().serialize(symbol).toBytes(), bcs_1.bcs.string().serialize("TMPL").toBytes(), "Vector(U8)");
38
- updated = (0, move_bytecode_template_1.update_constants)(updated, bcs_1.bcs.string().serialize(name).toBytes(), // new value
39
- bcs_1.bcs.string().serialize("Template Coin").toBytes(), // current value
32
+ updated = update_constants(updated, bcs.string().serialize(symbol).toBytes(), bcs.string().serialize("TMPL").toBytes(), "Vector(U8)");
33
+ updated = update_constants(updated, bcs.string().serialize(name).toBytes(), // new value
34
+ bcs.string().serialize("Template Coin").toBytes(), // current value
40
35
  "Vector(U8)");
41
- updated = (0, move_bytecode_template_1.update_constants)(updated, bcs_1.bcs.string().serialize(description).toBytes(), // new value
42
- bcs_1.bcs.string().serialize("Template Coin Description").toBytes(), // current value
36
+ updated = update_constants(updated, bcs.string().serialize(description).toBytes(), // new value
37
+ bcs.string().serialize("Template Coin Description").toBytes(), // current value
43
38
  "Vector(U8)");
44
- updated = (0, move_bytecode_template_1.update_constants)(updated, bcs_1.bcs.string().serialize(img_url).toBytes(), // new value
45
- bcs_1.bcs.string().serialize("https://example.com/template.png").toBytes(), // current value
39
+ updated = update_constants(updated, bcs.string().serialize(img_url).toBytes(), // new value
40
+ bcs.string().serialize("https://example.com/template.png").toBytes(), // current value
46
41
  "Vector(U8)");
47
42
  return updated;
48
43
  }
49
44
  function main() {
50
45
  return __awaiter(this, void 0, void 0, function* () {
51
46
  var _a;
52
- const client = new client_1.SuiClient({ url: "https://fullnode.mainnet.sui.io" });
47
+ const client = new SuiJsonRpcClient({
48
+ url: "https://fullnode.mainnet.sui.io",
49
+ network: "mainnet",
50
+ });
53
51
  console.log("asdf");
54
- yield (0, move_bytecode_template_2.default)();
52
+ yield init();
55
53
  const bytecode = generate_bytecode("RIPLEYS_SUI", "ripleys_sui", "rSui", "Ripleys Staked Sui", "Ripleys Staked Sui is a liquid staking protocol on Sui", "https://example.com/ripleys.png");
56
54
  // Step 1: Create the coin
57
- const tx = new transactions_1.Transaction();
55
+ const tx = new Transaction();
58
56
  const [upgradeCap] = tx.publish({
59
57
  modules: [[...bytecode]],
60
- dependencies: [(0, utils_1.normalizeSuiAddress)("0x1"), (0, utils_1.normalizeSuiAddress)("0x2")],
58
+ dependencies: [normalizeSuiAddress("0x1"), normalizeSuiAddress("0x2")],
61
59
  });
62
60
  tx.transferObjects([upgradeCap], tx.pure.address(keypair.toSuiAddress()));
63
61
  const txResponse = yield client.signAndExecuteTransaction({
@@ -72,7 +70,7 @@ function main() {
72
70
  console.log(txResponse);
73
71
  // Step 2: Get the treasury Cap id from the transaction
74
72
  const treasuryCapObjectChange = (_a = txResponse.objectChanges) === null || _a === void 0 ? void 0 : _a.find((change) => change.type === "created" && change.objectType.includes("TreasuryCap"));
75
- (0, assert_1.default)((treasuryCapObjectChange === null || treasuryCapObjectChange === void 0 ? void 0 : treasuryCapObjectChange.type) === "created");
73
+ assert((treasuryCapObjectChange === null || treasuryCapObjectChange === void 0 ? void 0 : treasuryCapObjectChange.type) === "created");
76
74
  const treasuryCapId = treasuryCapObjectChange === null || treasuryCapObjectChange === void 0 ? void 0 : treasuryCapObjectChange.objectId;
77
75
  const coinType = treasuryCapObjectChange === null || treasuryCapObjectChange === void 0 ? void 0 : treasuryCapObjectChange.objectType.split("<")[1].split(">")[0];
78
76
  console.log(coinType);
@@ -89,8 +87,8 @@ function main() {
89
87
  }
90
88
  }
91
89
  // Step 3: Create the lst
92
- const tx2 = new transactions_1.Transaction();
93
- const weightHookAdminCap = springsui_sdk_1.LstClient.createNewLst(tx2, treasuryCapId, coinType);
90
+ const tx2 = new Transaction();
91
+ const weightHookAdminCap = LstClient.createNewLst(tx2, treasuryCapId, coinType);
94
92
  tx2.transferObjects([tx2.object(weightHookAdminCap)], keypair.toSuiAddress());
95
93
  const txResponse2 = yield client.signAndExecuteTransaction({
96
94
  transaction: tx2,
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,30 +7,29 @@ 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");
10
+ import { SuiJsonRpcClient } from "@mysten/sui/jsonRpc";
11
+ import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
12
+ import { Transaction } from "@mysten/sui/transactions";
13
+ import { fromBase64 } from "@mysten/sui/utils";
14
+ import { program } from "commander";
15
+ import { LstClient } from "@suilend/springsui-sdk";
16
+ import * as sdk from "@suilend/springsui-sdk";
17
+ import { PACKAGE_ID } from "@suilend/springsui-sdk/_generated/liquid_staking";
53
18
  const LIQUID_STAKING_INFO = {
54
19
  id: "0x15eda7330c8f99c30e430b4d82fd7ab2af3ead4ae17046fcb224aa9bad394f6b",
55
20
  type: "0x83556891f4a0f233ce7b05cfe7f957d4020492a34f5405b2cb9377d060bef4bf::spring_sui::SPRING_SUI",
56
21
  weightHookId: "0xbbafcb2d7399c0846f8185da3f273ad5b26b3b35993050affa44cfa890f1f144",
57
22
  };
58
23
  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 keypair = Ed25519Keypair.fromSecretKey(fromBase64(process.env.SUI_SECRET_KEY));
60
25
  // const keypair = Ed25519Keypair.fromSecretKey(
61
26
  // fromHex(fs.readFileSync(process.env.SUI_SECRET_KEY_PATH!).toString()),
62
27
  // );
63
28
  function mint(options) {
64
29
  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();
30
+ const client = new SuiJsonRpcClient({ url: RPC_URL, network: "mainnet" });
31
+ const lstClient = yield LstClient.initialize(client, LIQUID_STAKING_INFO);
32
+ const tx = new Transaction();
68
33
  const [sui] = tx.splitCoins(tx.gas, [BigInt(options.amount)]);
69
34
  const rSui = lstClient.mint(tx, sui);
70
35
  tx.transferObjects([rSui], keypair.toSuiAddress());
@@ -82,14 +47,14 @@ function mint(options) {
82
47
  }
83
48
  function redeem(options) {
84
49
  return __awaiter(this, void 0, void 0, function* () {
85
- const client = new client_1.SuiClient({ url: RPC_URL });
50
+ const client = new SuiJsonRpcClient({ url: RPC_URL, network: "mainnet" });
86
51
  const lstCoins = yield client.getCoins({
87
52
  owner: keypair.toSuiAddress(),
88
53
  coinType: LIQUID_STAKING_INFO.type,
89
54
  limit: 1000,
90
55
  });
91
- const tx = new transactions_1.Transaction();
92
- const lstClient = yield springsui_sdk_1.LstClient.initialize(client, LIQUID_STAKING_INFO);
56
+ const tx = new Transaction();
57
+ const lstClient = yield LstClient.initialize(client, LIQUID_STAKING_INFO);
93
58
  if (lstCoins.data.length > 1) {
94
59
  tx.mergeCoins(lstCoins.data[0].coinObjectId, lstCoins.data.slice(1).map((c) => c.coinObjectId));
95
60
  }
@@ -112,12 +77,12 @@ function redeem(options) {
112
77
  }
113
78
  function increaseValidatorStake(options) {
114
79
  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);
80
+ const client = new SuiJsonRpcClient({ url: RPC_URL, network: "mainnet" });
81
+ const lstClient = yield LstClient.initialize(client, LIQUID_STAKING_INFO);
117
82
  const adminCapId = yield lstClient.getAdminCapId(keypair.toSuiAddress());
118
83
  if (!adminCapId)
119
84
  return;
120
- const tx = new transactions_1.Transaction();
85
+ const tx = new Transaction();
121
86
  lstClient.increaseValidatorStake(tx, adminCapId, options.validatorAddress, options.amount);
122
87
  const txResponse = yield client.signAndExecuteTransaction({
123
88
  transaction: tx,
@@ -133,12 +98,12 @@ function increaseValidatorStake(options) {
133
98
  }
134
99
  function decreaseValidatorStake(options) {
135
100
  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);
101
+ const client = new SuiJsonRpcClient({ url: RPC_URL, network: "mainnet" });
102
+ const lstClient = yield LstClient.initialize(client, LIQUID_STAKING_INFO);
138
103
  const adminCapId = yield lstClient.getAdminCapId(keypair.toSuiAddress());
139
104
  if (!adminCapId)
140
105
  return;
141
- const tx = new transactions_1.Transaction();
106
+ const tx = new Transaction();
142
107
  lstClient.decreaseValidatorStake(tx, adminCapId, options.validatorIndex, options.amount);
143
108
  const txResponse = yield client.signAndExecuteTransaction({
144
109
  transaction: tx,
@@ -155,18 +120,18 @@ function decreaseValidatorStake(options) {
155
120
  function updateFees(options) {
156
121
  return __awaiter(this, void 0, void 0, function* () {
157
122
  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);
123
+ const client = new SuiJsonRpcClient({ url: RPC_URL, network: "mainnet" });
124
+ const lstClient = yield LstClient.initialize(client, LIQUID_STAKING_INFO);
160
125
  const adminCap = (yield client.getOwnedObjects({
161
126
  owner: keypair.toSuiAddress(),
162
127
  filter: {
163
- StructType: `${liquid_staking_1.PACKAGE_ID}::liquid_staking::AdminCap<${LIQUID_STAKING_INFO.type}>`,
128
+ StructType: `${PACKAGE_ID}::liquid_staking::AdminCap<${LIQUID_STAKING_INFO.type}>`,
164
129
  },
165
130
  })).data[0];
166
131
  const adminCapId = (_a = adminCap.data) === null || _a === void 0 ? void 0 : _a.objectId;
167
132
  if (!adminCapId)
168
133
  return;
169
- const tx = new transactions_1.Transaction();
134
+ const tx = new Transaction();
170
135
  lstClient.updateFees(tx, adminCapId, options);
171
136
  const txResponse = yield client.signAndExecuteTransaction({
172
137
  transaction: tx,
@@ -182,12 +147,12 @@ function updateFees(options) {
182
147
  }
183
148
  function initializeWeightHook(options) {
184
149
  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);
150
+ const client = new SuiJsonRpcClient({ url: RPC_URL, network: "mainnet" });
151
+ const lstClient = yield LstClient.initialize(client, LIQUID_STAKING_INFO);
187
152
  const adminCapId = yield lstClient.getAdminCapId(keypair.toSuiAddress());
188
153
  if (!adminCapId)
189
154
  return;
190
- const tx = new transactions_1.Transaction();
155
+ const tx = new Transaction();
191
156
  const weightHookAdminCap = lstClient.initializeWeightHook(tx, adminCapId);
192
157
  tx.transferObjects([weightHookAdminCap], keypair.toSuiAddress());
193
158
  const txResponse = yield client.signAndExecuteTransaction({
@@ -204,8 +169,8 @@ function initializeWeightHook(options) {
204
169
  }
205
170
  function setValidatorAddressesAndWeights(options) {
206
171
  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);
172
+ const client = new SuiJsonRpcClient({ url: RPC_URL, network: "mainnet" });
173
+ const lstClient = yield LstClient.initialize(client, LIQUID_STAKING_INFO);
209
174
  if (options.validators.length != options.weights.length) {
210
175
  throw new Error("Validators and weights arrays must be of the same length");
211
176
  }
@@ -214,10 +179,10 @@ function setValidatorAddressesAndWeights(options) {
214
179
  validatorAddressesAndWeights[options.validators[i]] = options.weights[i];
215
180
  }
216
181
  console.log(validatorAddressesAndWeights);
217
- const weightHookAdminCapId = yield springsui_sdk_1.LstClient.getWeightHookAdminCapId(client, keypair.toSuiAddress(), LIQUID_STAKING_INFO.type);
182
+ const weightHookAdminCapId = yield LstClient.getWeightHookAdminCapId(client, keypair.toSuiAddress(), LIQUID_STAKING_INFO.type);
218
183
  if (!weightHookAdminCapId)
219
184
  return;
220
- const tx = new transactions_1.Transaction();
185
+ const tx = new Transaction();
221
186
  lstClient.setValidatorAddressesAndWeights(tx, LIQUID_STAKING_INFO.weightHookId, weightHookAdminCapId, validatorAddressesAndWeights);
222
187
  const txResponse = yield client.signAndExecuteTransaction({
223
188
  transaction: tx,
@@ -233,9 +198,9 @@ function setValidatorAddressesAndWeights(options) {
233
198
  }
234
199
  function rebalance(options) {
235
200
  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();
201
+ const client = new SuiJsonRpcClient({ url: RPC_URL, network: "mainnet" });
202
+ const lstClient = yield LstClient.initialize(client, LIQUID_STAKING_INFO);
203
+ const tx = new Transaction();
239
204
  lstClient.rebalance(tx, LIQUID_STAKING_INFO.weightHookId);
240
205
  const txResponse = yield client.signAndExecuteTransaction({
241
206
  transaction: tx,
@@ -252,7 +217,7 @@ function rebalance(options) {
252
217
  function createNewLst(options) {
253
218
  return __awaiter(this, void 0, void 0, function* () {
254
219
  var _a;
255
- const client = new client_1.SuiClient({ url: RPC_URL });
220
+ const client = new SuiJsonRpcClient({ url: RPC_URL, network: "mainnet" });
256
221
  const treasuryCap = yield client.getObject({
257
222
  id: options.treasuryCap,
258
223
  options: {
@@ -266,8 +231,8 @@ function createNewLst(options) {
266
231
  return;
267
232
  const coinType = type.substring(type.indexOf("<") + 1, type.lastIndexOf(">"));
268
233
  console.log(coinType);
269
- const tx = new transactions_1.Transaction();
270
- const weightHookAdminCap = springsui_sdk_1.LstClient.createNewLst(tx, options.treasuryCap, coinType);
234
+ const tx = new Transaction();
235
+ const weightHookAdminCap = LstClient.createNewLst(tx, options.treasuryCap, coinType);
271
236
  tx.transferObjects([tx.object(weightHookAdminCap)], keypair.toSuiAddress());
272
237
  const txResponse = yield client.signAndExecuteTransaction({
273
238
  transaction: tx,
@@ -281,41 +246,41 @@ function createNewLst(options) {
281
246
  console.log(txResponse);
282
247
  });
283
248
  }
284
- commander_1.program.version("1.0.0").description("Spring Sui CLI");
285
- commander_1.program
249
+ program.version("1.0.0").description("Spring Sui CLI");
250
+ program
286
251
  .command("mint")
287
252
  .description("mint some rSui")
288
253
  .option("--amount <SUI>", "Amount of SUI in MIST")
289
254
  .action(mint);
290
- commander_1.program
255
+ program
291
256
  .command("redeem")
292
257
  .description("redeem some SUI")
293
258
  .option("--amount <LST>", "Amount of LST to redeem")
294
259
  .action(redeem);
295
- commander_1.program
260
+ program
296
261
  .command("increase-validator-stake")
297
262
  .description("increase validator stake")
298
263
  .option("--validator-address <VALIDATOR>", "Validator address")
299
264
  .option("--amount <SUI>", "Amount of SUI to delegate to validator")
300
265
  .action(increaseValidatorStake);
301
- commander_1.program
266
+ program
302
267
  .command("decrease-validator-stake")
303
268
  .description("decrease validator stake")
304
269
  .option("--validator-index <VALIDATOR_INDEX>", "Validator index")
305
270
  .option("--amount <SUI>", "Amount of SUI to undelegate from validator")
306
271
  .action(decreaseValidatorStake);
307
- commander_1.program
272
+ program
308
273
  .command("update-fees")
309
274
  .description("update fees")
310
275
  .option("--mint-fee-bps <MINT_FEE_BPS>", "Mint fee bps")
311
276
  .option("--redeem-fee-bps <REDEEM_FEE_BPS>", "Redeem fee bps")
312
277
  .option("--spread-fee <SPREAD_FEE>", "Spread fee")
313
278
  .action(updateFees);
314
- commander_1.program
279
+ program
315
280
  .command("fetch-state")
316
281
  .description("fetch the current state of the liquid staking pool")
317
282
  .action(() => __awaiter(void 0, void 0, void 0, function* () {
318
- const client = new client_1.SuiClient({ url: RPC_URL });
283
+ const client = new SuiJsonRpcClient({ url: RPC_URL, network: "mainnet" });
319
284
  try {
320
285
  const state = yield sdk.fetchLiquidStakingInfo(LIQUID_STAKING_INFO, client);
321
286
  console.log("Current Liquid Staking State:");
@@ -325,7 +290,7 @@ commander_1.program
325
290
  console.error("Error fetching state:", error);
326
291
  }
327
292
  }));
328
- commander_1.program
293
+ program
329
294
  .command("initialize-weight-hook")
330
295
  .description("initialize weight hook")
331
296
  .action(initializeWeightHook);
@@ -336,19 +301,19 @@ function collect(pair, previous) {
336
301
  }
337
302
  return Object.assign(Object.assign({}, previous), { [key]: value });
338
303
  }
339
- commander_1.program
304
+ program
340
305
  .command("set-validator-addresses-and-weights")
341
306
  .description("set validator addresses and weights")
342
307
  .option("-v, --validators <VALIDATOR_ADDRESSES...>", "Validator addresses")
343
308
  .option("-w, --weights <WEIGHTS...>", "Weights")
344
309
  .action(setValidatorAddressesAndWeights);
345
- commander_1.program
310
+ program
346
311
  .command("rebalance")
347
312
  .description("rebalance the validator set")
348
313
  .action(rebalance);
349
- commander_1.program
314
+ program
350
315
  .command("create-new-lst")
351
316
  .description("create a new liquid staking pool")
352
317
  .option("--treasury-cap <TREASURY_CAP>", "Treasury cap")
353
318
  .action(createNewLst);
354
- commander_1.program.parse(process.argv);
319
+ 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":"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/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/bcs").BcsStruct<{
28
- byte: import("@mysten/sui/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/bcs").BcsStruct<{
68
- bytes: import("@mysten/sui/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
  }