@suilend/springsui-cli 1.0.14 → 2.0.1

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
@@ -1,9 +1,8 @@
1
- import { SuiGrpcClient } from "@mysten/sui/grpc";
2
1
  import { SuiJsonRpcClient, ValidatorApy } from "@mysten/sui/jsonRpc";
3
2
  import { Transaction, TransactionObjectInput } from "@mysten/sui/transactions";
4
3
  import BigNumber from "bignumber.js";
5
4
  import { LiquidStakingInfo } from "./_generated/liquid_staking/liquid-staking/structs";
6
- export interface LiquidStakingObject {
5
+ export interface LiquidStakingObjectInfo {
7
6
  id: string;
8
7
  type: string;
9
8
  weightHookId: string;
@@ -16,43 +15,54 @@ export interface FeeConfigArgs {
16
15
  export declare const SUILEND_VALIDATOR_ADDRESS = "0xce8e537664ba5d1d5a6a857b17bd142097138706281882be6805e17065ecde89";
17
16
  export declare const SPRING_SUI_UPGRADE_CAP_ID = "0x4dc657b6c0fe896f4b94fee1ceac96312dde0a36b94e799caaec30deb53dcd67";
18
17
  export declare const ADMIN_ADDRESS = "0xb1ffbc2e1915f44b8f271a703becc1bf8aa79bc22431a58900a102892b783c25";
19
- export declare function getLatestPackageId(client: SuiGrpcClient, upgradeCapId: string): Promise<string>;
20
- interface LstClientOptions {
21
- publishedAt?: string;
22
- logPackageId?: boolean;
23
- }
18
+ export declare function getLatestPackageId(client: SuiJsonRpcClient, upgradeCapId: string): Promise<string>;
24
19
  export declare class LstClient {
25
- client: SuiGrpcClient;
26
- jsonRpcClient: SuiJsonRpcClient;
27
- liquidStakingObject: LiquidStakingObject;
28
- private adapter;
29
- static initialize(client: SuiGrpcClient, jsonRpcClient: SuiJsonRpcClient, liquidStakingObject: LiquidStakingObject, options?: LstClientOptions): Promise<LstClient>;
20
+ liquidStakingObject: LiquidStakingObjectInfo;
21
+ client: SuiJsonRpcClient;
22
+ static initialize(client: SuiJsonRpcClient, liquidStakingObjectInfo: LiquidStakingObjectInfo, _publishedAt?: string, logPackageId?: boolean): Promise<LstClient>;
30
23
  static createNewLst(tx: Transaction, treasuryCap: string, coinType: string): TransactionObjectInput;
31
- static getWeightHookAdminCapId(client: SuiGrpcClient, address: string, coinType: string): Promise<string | null | undefined>;
32
- constructor(client: SuiGrpcClient, jsonRpcClient: SuiJsonRpcClient, liquidStakingObject: LiquidStakingObject);
24
+ static getWeightHookAdminCapId(client: SuiJsonRpcClient, address: string, coinType: string): Promise<string | null | undefined>;
25
+ constructor(liquidStakingObject: LiquidStakingObjectInfo, client: SuiJsonRpcClient);
33
26
  getAdminCapId(address: string): Promise<string | null | undefined>;
34
- mint(tx: Transaction, suiCoinId: TransactionObjectInput): any;
35
- mintAmountAndRebalance(tx: Transaction, address: string, amount: string): any;
27
+ mint(tx: Transaction, suiCoinId: TransactionObjectInput): {
28
+ NestedResult: [number, number];
29
+ $kind: "NestedResult";
30
+ };
31
+ mintAmountAndRebalance(tx: Transaction, address: string, amount: string): {
32
+ NestedResult: [number, number];
33
+ $kind: "NestedResult";
34
+ };
36
35
  mintAmountAndRebalanceAndSendToUser(tx: Transaction, address: string, amount: string): void;
37
- redeem(tx: Transaction, lstId: TransactionObjectInput): any;
38
- redeemAmountAndRebalance(tx: Transaction, address: string, amount: string, client: SuiGrpcClient): Promise<any>;
39
- redeemAmountAndRebalanceAndSendToUser(tx: Transaction, address: string, amount: string, client: SuiGrpcClient): Promise<void>;
36
+ redeem(tx: Transaction, lstId: TransactionObjectInput): {
37
+ NestedResult: [number, number];
38
+ $kind: "NestedResult";
39
+ };
40
+ redeemAmountAndRebalance(tx: Transaction, address: string, amount: string, client: SuiJsonRpcClient): Promise<{
41
+ NestedResult: [number, number];
42
+ $kind: "NestedResult";
43
+ }>;
44
+ redeemAmountAndRebalanceAndSendToUser(tx: Transaction, address: string, amount: string, client: SuiJsonRpcClient): Promise<void>;
40
45
  increaseValidatorStake(tx: Transaction, adminCapId: TransactionObjectInput, validatorAddress: string, suiAmount: number): void;
41
46
  decreaseValidatorStake(tx: Transaction, adminCapId: TransactionObjectInput, validatorAddress: string, targetUnstakeSuiAmount: bigint): void;
42
- collectFees(tx: Transaction, weightHookAdminCapId: TransactionObjectInput): any;
47
+ collectFees(tx: Transaction, weightHookAdminCapId: TransactionObjectInput): {
48
+ NestedResult: [number, number];
49
+ $kind: "NestedResult";
50
+ };
43
51
  collectFeesAndSendToUser(tx: Transaction, weightHookAdminCapId: TransactionObjectInput, address: string): void;
44
52
  updateFees(tx: Transaction, weightHookAdminCapId: TransactionObjectInput, feeConfigArgs: FeeConfigArgs): void;
45
- initializeWeightHook(tx: Transaction, adminCapId: TransactionObjectInput): any;
53
+ initializeWeightHook(tx: Transaction, adminCapId: TransactionObjectInput): {
54
+ NestedResult: [number, number];
55
+ $kind: "NestedResult";
56
+ };
46
57
  setValidatorAddressesAndWeights(tx: Transaction, weightHookId: TransactionObjectInput, weightHookAdminCap: TransactionObjectInput, validatorAddressesAndWeights: Record<string, number>): void;
47
58
  rebalance(tx: Transaction, weightHookId: TransactionObjectInput): void;
48
59
  getSpringSuiApy(_validatorApys?: ValidatorApy[]): Promise<BigNumber>;
49
60
  }
50
- export declare const fetchLiquidStakingInfo: (info: LiquidStakingObject, client: SuiGrpcClient) => Promise<LiquidStakingInfo<any>>;
51
- export declare const fetchRegistryLiquidStakingInfoMap: (client: SuiGrpcClient) => Promise<{
52
- [x: string]: LiquidStakingObject | {
61
+ export declare const fetchLiquidStakingInfo: (info: LiquidStakingObjectInfo, client: SuiJsonRpcClient) => Promise<LiquidStakingInfo<any>>;
62
+ export declare const fetchRegistryLiquidStakingInfoMap: (client: SuiJsonRpcClient) => Promise<{
63
+ [x: string]: LiquidStakingObjectInfo | {
53
64
  id: any;
54
65
  type: string;
55
66
  weightHookId: any;
56
67
  };
57
68
  }>;
58
- export {};
package/sdk/src/client.js CHANGED
@@ -11,44 +11,35 @@ import { SUI_DECIMALS, normalizeStructTag } from "@mysten/sui/utils";
11
11
  import BigNumber from "bignumber.js";
12
12
  import { phantom } from "./_generated/_framework/reified";
13
13
  import { PACKAGE_ID, setPublishedAt } from "./_generated/liquid_staking";
14
- import { newBuilder as newBuilder_, setRedeemFeeBps as setRedeemFeeBps_, setSpreadFeeBps as setSpreadFeeBps_, setSuiMintFeeBps as setSuiMintFeeBps_, toFeeConfig as toFeeConfig_, } from "./_generated/liquid_staking/fees/functions";
15
- import * as generated_ from "./_generated/liquid_staking/liquid-staking/functions";
14
+ import { newBuilder, setRedeemFeeBps, setSpreadFeeBps, setSuiMintFeeBps, toFeeConfig, } from "./_generated/liquid_staking/fees/functions";
15
+ import * as generated from "./_generated/liquid_staking/liquid-staking/functions";
16
16
  import { LiquidStakingInfo } from "./_generated/liquid_staking/liquid-staking/structs";
17
- import * as weightHookGenerated_ from "./_generated/liquid_staking/weight/functions";
17
+ import * as weightHookGenerated from "./_generated/liquid_staking/weight/functions";
18
18
  import { WeightHook } from "./_generated/liquid_staking/weight/structs";
19
- import { GrpcAdapter } from "./grpcAdapter";
20
- // Cast generated functions to any to avoid v1/v2 type conflicts
21
- const newBuilder = newBuilder_;
22
- const setRedeemFeeBps = setRedeemFeeBps_;
23
- const setSpreadFeeBps = setSpreadFeeBps_;
24
- const setSuiMintFeeBps = setSuiMintFeeBps_;
25
- const toFeeConfig = toFeeConfig_;
26
- const generated = generated_;
27
- const weightHookGenerated = weightHookGenerated_;
28
19
  const SUI_SYSTEM_STATE_ID = "0x0000000000000000000000000000000000000000000000000000000000000005";
29
20
  export const SUILEND_VALIDATOR_ADDRESS = "0xce8e537664ba5d1d5a6a857b17bd142097138706281882be6805e17065ecde89";
30
21
  export const SPRING_SUI_UPGRADE_CAP_ID = "0x4dc657b6c0fe896f4b94fee1ceac96312dde0a36b94e799caaec30deb53dcd67";
31
22
  export const ADMIN_ADDRESS = "0xb1ffbc2e1915f44b8f271a703becc1bf8aa79bc22431a58900a102892b783c25";
32
23
  export function getLatestPackageId(client, upgradeCapId) {
33
24
  return __awaiter(this, void 0, void 0, function* () {
34
- const result = yield client.getObject({
35
- objectId: upgradeCapId,
36
- include: {
37
- json: true,
25
+ var _a;
26
+ const object = yield client.getObject({
27
+ id: upgradeCapId,
28
+ options: {
29
+ showContent: true,
38
30
  },
39
31
  });
40
- return result.object.json.package;
32
+ return ((_a = object.data) === null || _a === void 0 ? void 0 : _a.content).fields.package;
41
33
  });
42
34
  }
43
35
  export class LstClient {
44
- static initialize(client, jsonRpcClient, liquidStakingObject, options) {
36
+ static initialize(client, liquidStakingObjectInfo, _publishedAt, logPackageId) {
45
37
  return __awaiter(this, void 0, void 0, function* () {
46
- var _a;
47
- const publishedAt = (_a = options === null || options === void 0 ? void 0 : options.publishedAt) !== null && _a !== void 0 ? _a : (yield getLatestPackageId(client, SPRING_SUI_UPGRADE_CAP_ID));
48
- if (options === null || options === void 0 ? void 0 : options.logPackageId)
38
+ const publishedAt = _publishedAt !== null && _publishedAt !== void 0 ? _publishedAt : (yield getLatestPackageId(client, SPRING_SUI_UPGRADE_CAP_ID));
39
+ if (logPackageId)
49
40
  console.log("@suilend/springsui-sdk | publishedAt:", publishedAt);
50
41
  setPublishedAt(publishedAt);
51
- return new LstClient(client, jsonRpcClient, liquidStakingObject);
42
+ return new LstClient(liquidStakingObjectInfo, client);
52
43
  });
53
44
  }
54
45
  static createNewLst(tx, treasuryCap, coinType) {
@@ -78,32 +69,36 @@ export class LstClient {
78
69
  }
79
70
  static getWeightHookAdminCapId(client, address, coinType) {
80
71
  return __awaiter(this, void 0, void 0, function* () {
81
- const result = yield client.listOwnedObjects({
72
+ var _a;
73
+ const res = (yield client.getOwnedObjects({
82
74
  owner: address,
83
- type: `${PACKAGE_ID}::weight::WeightHookAdminCap<${coinType}>`,
84
- });
85
- if (result.objects.length === 0) {
75
+ filter: {
76
+ StructType: `${PACKAGE_ID}::weight::WeightHookAdminCap<${coinType}>`,
77
+ },
78
+ })).data;
79
+ if (res.length == 0) {
86
80
  return null;
87
81
  }
88
- return result.objects[0].objectId;
82
+ return (_a = res[0].data) === null || _a === void 0 ? void 0 : _a.objectId;
89
83
  });
90
84
  }
91
- constructor(client, jsonRpcClient, liquidStakingObject) {
92
- this.client = client;
93
- this.jsonRpcClient = jsonRpcClient;
85
+ constructor(liquidStakingObject, client) {
94
86
  this.liquidStakingObject = liquidStakingObject;
95
- this.adapter = new GrpcAdapter(client);
87
+ this.client = client;
96
88
  }
97
89
  getAdminCapId(address) {
98
90
  return __awaiter(this, void 0, void 0, function* () {
99
- const result = yield this.client.listOwnedObjects({
91
+ var _a;
92
+ const res = (yield this.client.getOwnedObjects({
100
93
  owner: address,
101
- type: `${PACKAGE_ID}::liquid_staking::AdminCap<${this.liquidStakingObject.type}>`,
102
- });
103
- if (result.objects.length === 0) {
94
+ filter: {
95
+ StructType: `${PACKAGE_ID}::liquid_staking::AdminCap<${this.liquidStakingObject.type}>`,
96
+ },
97
+ })).data;
98
+ if (res.length == 0) {
104
99
  return null;
105
100
  }
106
- return result.objects[0].objectId;
101
+ return (_a = res[0].data) === null || _a === void 0 ? void 0 : _a.objectId;
107
102
  });
108
103
  }
109
104
  // returns the lst object
@@ -136,16 +131,15 @@ export class LstClient {
136
131
  }
137
132
  redeemAmountAndRebalance(tx, address, amount, client) {
138
133
  return __awaiter(this, void 0, void 0, function* () {
139
- const result = yield client.listCoins({
134
+ const coins = (yield client.getCoins({
140
135
  owner: address,
141
136
  coinType: this.liquidStakingObject.type,
142
- });
143
- const coins = result.objects;
137
+ })).data;
144
138
  const mergeCoin = coins[0];
145
139
  if (coins.length > 1) {
146
- tx.mergeCoins(tx.object(mergeCoin.objectId), coins.map((c) => tx.object(c.objectId)).slice(1));
140
+ tx.mergeCoins(tx.object(mergeCoin.coinObjectId), coins.map((c) => tx.object(c.coinObjectId)).slice(1));
147
141
  }
148
- const [lstCoin] = tx.splitCoins(tx.object(mergeCoin.objectId), [
142
+ const [lstCoin] = tx.splitCoins(tx.object(mergeCoin.coinObjectId), [
149
143
  BigInt(amount),
150
144
  ]);
151
145
  const suiCoin = this.redeem(tx, lstCoin);
@@ -267,7 +261,7 @@ export class LstClient {
267
261
  getSpringSuiApy(_validatorApys) {
268
262
  return __awaiter(this, void 0, void 0, function* () {
269
263
  var _a, _b;
270
- const validatorApys = _validatorApys !== null && _validatorApys !== void 0 ? _validatorApys : (yield this.jsonRpcClient.getValidatorsApy()).apys;
264
+ const validatorApys = _validatorApys !== null && _validatorApys !== void 0 ? _validatorApys : (yield this.client.getValidatorsApy()).apys;
271
265
  const liquidStakingInfo = yield fetchLiquidStakingInfo(this.liquidStakingObject, this.client);
272
266
  const totalSuiSupply = new BigNumber(liquidStakingInfo.storage.totalSuiSupply.toString()).div(10 ** SUI_DECIMALS);
273
267
  const spreadFeePercent = new BigNumber((_b = (_a = liquidStakingInfo.feeConfig.element) === null || _a === void 0 ? void 0 : _a.spreadFeeBps.toString()) !== null && _b !== void 0 ? _b : 0).div(100);
@@ -285,33 +279,32 @@ export class LstClient {
285
279
  }
286
280
  }
287
281
  // user functions
288
- export const fetchLiquidStakingInfo = (info, client) => LiquidStakingInfo.fetch(new GrpcAdapter(client), phantom(info.type), info.id);
282
+ export const fetchLiquidStakingInfo = (info, client) => LiquidStakingInfo.fetch(client, phantom(info.type), info.id);
289
283
  export const fetchRegistryLiquidStakingInfoMap = (client) => __awaiter(void 0, void 0, void 0, function* () {
290
284
  const REGISTRY_ID = "0x06d6b6881ef14ad1a8cc29d1f97ba3397ecea56af5afa0642093e981b1fda3f4";
291
285
  const registryObjectIds = [];
292
286
  let cursor = null;
293
287
  let hasNextPage = true;
294
288
  while (hasNextPage) {
295
- const page = yield client.listDynamicFields({
289
+ const page = yield client.getDynamicFields({
296
290
  parentId: REGISTRY_ID,
297
291
  cursor,
298
292
  });
299
- registryObjectIds.push(...page.dynamicFields.map((d) => d.fieldId));
300
- cursor = page.cursor;
293
+ registryObjectIds.push(...page.data.map((d) => d.objectId));
294
+ cursor = page.nextCursor;
301
295
  hasNextPage = page.hasNextPage;
302
296
  }
303
- const registryObjects = yield client.getObjects({
304
- objectIds: registryObjectIds,
305
- include: {
306
- json: true,
297
+ const registryObjects = yield Promise.all(registryObjectIds.map((objectId) => client.getObject({
298
+ id: objectId,
299
+ options: {
300
+ showContent: true,
307
301
  },
308
- });
309
- const LIQUID_STAKING_OBJECT_MAP = registryObjects.objects.reduce((acc, obj) => {
310
- if (obj instanceof Error)
311
- return acc;
312
- const json = obj.json;
313
- const id = json.value.liquid_staking_info_id;
314
- const coinType = normalizeStructTag(json.name.name);
302
+ })));
303
+ const LIQUID_STAKING_INFO_MAP = registryObjects.reduce((acc, obj) => {
304
+ var _a;
305
+ const fields = ((_a = obj.data) === null || _a === void 0 ? void 0 : _a.content).fields;
306
+ const id = fields.value.fields.liquid_staking_info_id;
307
+ const coinType = normalizeStructTag(fields.name.fields.name);
315
308
  if ([
316
309
  "0x460c669acd3f294dc4247a6877ec2532340ffde76162ab201e72fe95355830e7::asui::ASUI",
317
310
  "0x752f18582da315f9104bb8b7828188c474e64f23255ed9fd231ed3fa883f27e0::tt_sui::TT_SUI",
@@ -325,8 +318,8 @@ export const fetchRegistryLiquidStakingInfoMap = (client) => __awaiter(void 0, v
325
318
  "0xad421271913607cab135184481d65d25f10b3ef4464004fe6333930503404e3d::mjsui2::MJSUI2",
326
319
  ].includes(coinType))
327
320
  return acc;
328
- const weightHookId = json.value.extra_info.weight_hook_id;
321
+ const weightHookId = fields.value.fields.extra_info.fields.weight_hook_id;
329
322
  return Object.assign(Object.assign({}, acc), { [coinType]: { id, type: coinType, weightHookId } });
330
323
  }, {});
331
- return LIQUID_STAKING_OBJECT_MAP;
324
+ return LIQUID_STAKING_INFO_MAP;
332
325
  });
@@ -1,3 +1,2 @@
1
1
  export * from "./lib";
2
2
  export * from "./client";
3
- export * from "./grpcAdapter";
package/sdk/src/index.js CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from "./lib";
2
2
  export * from "./client";
3
- export * from "./grpcAdapter";
@@ -1,4 +1,7 @@
1
1
  import { Transaction } from "@mysten/sui/transactions";
2
2
  import { LstClient } from "../client";
3
- export declare const convertLstsAndRebalance: (inLstClient: LstClient, outLstClient: LstClient, transaction: Transaction, address: string, amount: string) => Promise<any>;
3
+ export declare const convertLstsAndRebalance: (inLstClient: LstClient, outLstClient: LstClient, transaction: Transaction, address: string, amount: string) => Promise<{
4
+ NestedResult: [number, number];
5
+ $kind: "NestedResult";
6
+ }>;
4
7
  export declare const convertLstsAndRebalanceAndSendToUser: (inLstClient: LstClient, outLstClient: LstClient, transaction: Transaction, address: string, amount: string) => Promise<void>;
@@ -1,50 +0,0 @@
1
- /**
2
- * Adapter that wraps SuiGrpcClient to provide the legacy SuiClient API
3
- * that the generated code expects.
4
- *
5
- * This allows using gRPC while maintaining compatibility with sui-client-gen generated code.
6
- */
7
- import { SuiGrpcClient } from "@mysten/sui/grpc";
8
- export interface LegacyObjectResponse {
9
- data?: {
10
- objectId: string;
11
- version: string;
12
- digest: string;
13
- type?: string;
14
- owner?: unknown;
15
- previousTransaction?: string;
16
- bcs?: {
17
- dataType: "moveObject";
18
- type: string;
19
- hasPublicTransfer: boolean;
20
- version: string;
21
- bcsBytes: string;
22
- };
23
- };
24
- error?: {
25
- code: string;
26
- message?: string;
27
- };
28
- }
29
- /**
30
- * GrpcAdapter wraps a SuiGrpcClient and provides the legacy SuiClient API
31
- * for compatibility with generated code.
32
- */
33
- export declare class GrpcAdapter {
34
- private grpcClient;
35
- constructor(grpcClient: SuiGrpcClient);
36
- /**
37
- * getObject - adapts gRPC getObject to legacy format
38
- * Used by generated code's .fetch() methods
39
- */
40
- getObject(input: {
41
- id: string;
42
- options?: {
43
- showBcs?: boolean;
44
- showContent?: boolean;
45
- showOwner?: boolean;
46
- showPreviousTransaction?: boolean;
47
- showType?: boolean;
48
- };
49
- }): Promise<LegacyObjectResponse>;
50
- }
@@ -1,75 +0,0 @@
1
- /**
2
- * Adapter that wraps SuiGrpcClient to provide the legacy SuiClient API
3
- * that the generated code expects.
4
- *
5
- * This allows using gRPC while maintaining compatibility with sui-client-gen generated code.
6
- */
7
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
8
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9
- return new (P || (P = Promise))(function (resolve, reject) {
10
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
12
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
13
- step((generator = generator.apply(thisArg, _arguments || [])).next());
14
- });
15
- };
16
- import { toBase64 } from "@mysten/sui/utils";
17
- /**
18
- * GrpcAdapter wraps a SuiGrpcClient and provides the legacy SuiClient API
19
- * for compatibility with generated code.
20
- */
21
- export class GrpcAdapter {
22
- constructor(grpcClient) {
23
- this.grpcClient = grpcClient;
24
- }
25
- /**
26
- * getObject - adapts gRPC getObject to legacy format
27
- * Used by generated code's .fetch() methods
28
- */
29
- getObject(input) {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- var _a, _b, _c, _d;
32
- try {
33
- const result = yield this.grpcClient.getObject({
34
- objectId: input.id,
35
- include: {
36
- objectBcs: (_a = input.options) === null || _a === void 0 ? void 0 : _a.showBcs,
37
- previousTransaction: (_b = input.options) === null || _b === void 0 ? void 0 : _b.showPreviousTransaction,
38
- },
39
- });
40
- const obj = result.object;
41
- // Build legacy response format
42
- const response = {
43
- data: {
44
- objectId: obj.objectId,
45
- version: obj.version,
46
- digest: obj.digest,
47
- type: obj.type,
48
- owner: obj.owner,
49
- previousTransaction: (_c = obj.previousTransaction) !== null && _c !== void 0 ? _c : undefined,
50
- },
51
- };
52
- // Handle BCS data (used by generated code)
53
- if (((_d = input.options) === null || _d === void 0 ? void 0 : _d.showBcs) && obj.objectBcs) {
54
- response.data.bcs = {
55
- dataType: "moveObject",
56
- type: obj.type,
57
- hasPublicTransfer: true,
58
- version: obj.version,
59
- bcsBytes: toBase64(obj.objectBcs),
60
- };
61
- }
62
- return response;
63
- }
64
- catch (error) {
65
- // Convert thrown errors to error response format
66
- return {
67
- error: {
68
- code: "objectNotFound",
69
- message: error instanceof Error ? error.message : String(error),
70
- },
71
- };
72
- }
73
- });
74
- }
75
- }