@suilend/sdk 3.0.3 → 3.0.5

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 (68) hide show
  1. package/_generated/_dependencies/source/0x1/ascii/structs.js +4 -4
  2. package/_generated/_dependencies/source/0x1/option/structs.js +4 -4
  3. package/_generated/_dependencies/source/0x1/type-name/structs.js +4 -4
  4. package/_generated/_dependencies/source/0x2/bag/structs.js +4 -4
  5. package/_generated/_dependencies/source/0x2/balance/structs.js +3 -3
  6. package/_generated/_dependencies/source/0x2/object/structs.js +3 -3
  7. package/_generated/_dependencies/source/0x2/object-table/structs.js +4 -4
  8. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.js +3 -3
  9. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.js +4 -4
  10. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.js +5 -5
  11. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js +4 -4
  12. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.js +5 -5
  13. package/_generated/_framework/reified.js +2 -2
  14. package/_generated/_framework/vector.js +2 -2
  15. package/_generated/suilend/cell/structs.js +4 -4
  16. package/_generated/suilend/decimal/structs.js +3 -3
  17. package/_generated/suilend/lending-market/functions.js +4 -4
  18. package/_generated/suilend/lending-market/structs.js +11 -11
  19. package/_generated/suilend/lending-market-registry/functions.js +2 -2
  20. package/_generated/suilend/liquidity-mining/structs.js +9 -9
  21. package/_generated/suilend/obligation/structs.js +8 -8
  22. package/_generated/suilend/rate-limiter/functions.js +2 -2
  23. package/_generated/suilend/rate-limiter/structs.js +4 -4
  24. package/_generated/suilend/reserve/structs.js +12 -12
  25. package/_generated/suilend/reserve-config/functions.js +2 -2
  26. package/_generated/suilend/reserve-config/structs.js +5 -5
  27. package/api/index.js +1 -1
  28. package/client.js +32 -50
  29. package/index.js +7 -7
  30. package/lib/index.js +5 -5
  31. package/lib/initialize.js +8 -8
  32. package/lib/liquidityMining.js +3 -3
  33. package/lib/pythAdapter.d.ts +1 -2
  34. package/lib/pythAdapter.js +96 -17
  35. package/lib/strategyOwnerCap.js +2 -2
  36. package/margin/margin/admin_cap.d.ts +1 -4
  37. package/margin/margin/admin_cap.js +15 -9
  38. package/margin/margin/deps/std/type_name.d.ts +9 -10
  39. package/margin/margin/deps/std/type_name.js +17 -14
  40. package/margin/margin/deps/sui/vec_set.d.ts +3 -5
  41. package/margin/margin/deps/sui/vec_set.js +9 -6
  42. package/margin/margin/deps/suilend/lending_market.d.ts +1 -4
  43. package/margin/margin/deps/suilend/lending_market.js +9 -6
  44. package/margin/margin/market.d.ts +22 -67
  45. package/margin/margin/market.js +86 -108
  46. package/margin/margin/permissions.d.ts +9 -16
  47. package/margin/margin/permissions.js +29 -29
  48. package/margin/margin/position.d.ts +12 -35
  49. package/margin/margin/position.js +84 -67
  50. package/margin/margin/router.d.ts +10 -50
  51. package/margin/margin/router.js +102 -71
  52. package/margin/margin/version.d.ts +1 -4
  53. package/margin/margin/version.js +7 -4
  54. package/margin/utils/index.d.ts +9 -9
  55. package/margin/utils/index.js +32 -29
  56. package/package.json +1 -1
  57. package/parsers/apiReserveAssetDataEvent.js +1 -1
  58. package/parsers/index.js +5 -5
  59. package/parsers/lendingMarket.js +2 -2
  60. package/parsers/obligation.js +1 -1
  61. package/parsers/rateLimiter.js +1 -1
  62. package/parsers/reserve.js +3 -3
  63. package/strategies.js +101 -42
  64. package/swap/index.js +2 -2
  65. package/swap/transaction.js +5 -14
  66. package/utils/index.js +3 -3
  67. package/utils/obligation.js +39 -30
  68. package/utils/simulate.js +4 -4
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
- export * from "./api";
2
- export * from "./lib";
3
- export * from "./parsers";
4
- export * from "./strategies";
5
- export * from "./swap";
6
- export * from "./utils";
7
- export * from "./client";
1
+ export * from "./api/index.js";
2
+ export * from "./lib/index.js";
3
+ export * from "./parsers/index.js";
4
+ export * from "./strategies.js";
5
+ export * from "./swap/index.js";
6
+ export * from "./utils/index.js";
7
+ export * from "./client.js";
package/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
- export * from "./constants";
2
- export * from "./initialize";
3
- export * from "./liquidityMining";
4
- export * from "./transactions";
5
- export * from "./types";
1
+ export * from "./constants.js";
2
+ export * from "./initialize.js";
3
+ export * from "./liquidityMining.js";
4
+ export * from "./transactions.js";
5
+ export * from "./types.js";
package/lib/initialize.js CHANGED
@@ -11,12 +11,12 @@ import { normalizeStructTag } from "@mysten/sui/utils";
11
11
  import { SuiPriceServiceConnection } from "@pythnetwork/pyth-sui-js";
12
12
  import BigNumber from "bignumber.js";
13
13
  import { NORMALIZED_ALKIMI_COINTYPE, NORMALIZED_AUSD_COINTYPE, NORMALIZED_BLUE_COINTYPE, NORMALIZED_BUCK_COINTYPE, NORMALIZED_DEEP_COINTYPE, NORMALIZED_DMC_COINTYPE, NORMALIZED_FUD_COINTYPE, NORMALIZED_HAEDAL_COINTYPE, NORMALIZED_HIPPO_COINTYPE, NORMALIZED_IKA_COINTYPE, NORMALIZED_KOBAN_COINTYPE, NORMALIZED_LBTC_COINTYPE, NORMALIZED_NS_COINTYPE, NORMALIZED_SEND_COINTYPE, NORMALIZED_SEND_POINTS_S1_COINTYPE, NORMALIZED_SEND_POINTS_S2_COINTYPE, NORMALIZED_SOL_COINTYPE, NORMALIZED_SUI_COINTYPE, NORMALIZED_UP_COINTYPE, NORMALIZED_USDB_COINTYPE, NORMALIZED_USDC_COINTYPE, NORMALIZED_USDsui_COINTYPE, NORMALIZED_WAL_COINTYPE, NORMALIZED_WBTC_COINTYPE, NORMALIZED_WETH_COINTYPE, NORMALIZED_XAUm_COINTYPE, NORMALIZED_eEARN_COINTYPE, NORMALIZED_eTHIRD_COINTYPE, NORMALIZED_flSUI_COINTYPE, NORMALIZED_fpSUI_COINTYPE, NORMALIZED_fudSUI_COINTYPE, NORMALIZED_iSUI_COINTYPE, NORMALIZED_jugSUI_COINTYPE, NORMALIZED_kSUI_COINTYPE, NORMALIZED_mSUI_COINTYPE, NORMALIZED_mUSD_COINTYPE, NORMALIZED_oshiSUI_COINTYPE, NORMALIZED_sSUI_COINTYPE, NORMALIZED_sdeUSD_COINTYPE, NORMALIZED_stratSUI_COINTYPE, NORMALIZED_suiETH_COINTYPE, NORMALIZED_suiUSDT_COINTYPE, NORMALIZED_suiUSDe_COINTYPE, NORMALIZED_suiWBTC_COINTYPE, NORMALIZED_trevinSUI_COINTYPE, NORMALIZED_upSUI_COINTYPE, NORMALIZED_wUSDC_COINTYPE, NORMALIZED_wUSDT_COINTYPE, NORMALIZED_xBTC_COINTYPE, NORMALIZED_yapSUI_COINTYPE, TEMPORARY_PYTH_PRICE_FEED_COINTYPES, getAllOwnedObjects, getCoinMetadataMap, getPrice, isSendPoints, isSteammPoints, } from "@suilend/sui-fe";
14
- import { LENDING_MARKET_ID, SuilendClient } from "../client";
15
- import { parseLendingMarket, parseObligation } from "../parsers";
16
- import * as simulate from "../utils/simulate";
17
- import { WAD } from "./constants";
18
- import { getWorkingPythEndpoint } from "./pyth";
19
- import { STRATEGY_TYPE_INFO_MAP, STRATEGY_WRAPPER_PACKAGE_ID_V1, } from "./strategyOwnerCap";
14
+ import { LENDING_MARKET_ID, SuilendClient } from "../client.js";
15
+ import { parseLendingMarket, parseObligation } from "../parsers/index.js";
16
+ import * as simulate from "../utils/simulate.js";
17
+ import { WAD } from "./constants.js";
18
+ import { getWorkingPythEndpoint } from "./pyth.js";
19
+ import { STRATEGY_TYPE_INFO_MAP, STRATEGY_WRAPPER_PACKAGE_ID_V1, } from "./strategyOwnerCap.js";
20
20
  export const RESERVES_CUSTOM_ORDER = {
21
21
  [LENDING_MARKET_ID]: [
22
22
  // MAIN ASSETS
@@ -238,9 +238,9 @@ export const initializeObligations = (suiGrpcClient, suilendClient, refreshedRaw
238
238
  const objects = yield getAllOwnedObjects(suiGrpcClient, address, `${STRATEGY_WRAPPER_PACKAGE_ID_V1}::strategy_wrapper::StrategyOwnerCap<${suilendClient.lendingMarket.$typeArgs[0]}>`);
239
239
  return objects.map((obj) => {
240
240
  const json = obj.json;
241
- const id = json.id.id;
241
+ const id = json.id;
242
242
  const strategyType = json.strategy_type;
243
- const obligationOwnerCapId = json.inner_cap.id.id;
243
+ const obligationOwnerCapId = json.inner_cap.id;
244
244
  const obligationId = json.inner_cap.obligation_id;
245
245
  const result = {
246
246
  id,
@@ -1,8 +1,8 @@
1
1
  import BigNumber from "bignumber.js";
2
- import { cloneDeep } from "lodash";
2
+ import cloneDeep from "lodash/cloneDeep.js";
3
3
  import { MS_PER_YEAR, NORMALIZED_eEARN_COINTYPE, NORMALIZED_eTHIRD_COINTYPE, NORMALIZED_sdeUSD_COINTYPE, isSendPoints, } from "@suilend/sui-fe";
4
- import { WAD } from "./constants";
5
- import { Side } from "./types";
4
+ import { WAD } from "./constants.js";
5
+ import { Side } from "./types.js";
6
6
  export const getDepositShare = (reserve, share) => share.div(10 ** reserve.mintDecimals).times(reserve.cTokenExchangeRate);
7
7
  const getDepositShareUsd = (reserve, share) => getDepositShare(reserve, share).times(reserve.price);
8
8
  export const getBorrowShare = (reserve, share) => share.div(10 ** reserve.mintDecimals).times(reserve.cumulativeBorrowRate);
@@ -1,8 +1,7 @@
1
1
  import { SuiGrpcClient } from "@mysten/sui/grpc";
2
2
  /**
3
3
  * Adapter that wraps SuiGrpcClient to provide the legacy SuiClient (JSON-RPC)
4
- * interface expected by third-party SDKs like @pythnetwork/pyth-sui-js and
5
- * @flowx-finance/sdk.
4
+ * interface expected by third-party SDKs like @pythnetwork/pyth-sui-js.
6
5
  *
7
6
  * Maps old JSON-RPC method signatures to the new gRPC equivalents.
8
7
  */
@@ -7,10 +7,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ const PYTH_STATE_ID = "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";
11
+ const PYTH_PRICE_TABLE_ID = "0x234c9ffca44613ab87a2711325b6e17bad9ece0449b917c8bd9c0ad7a0506cc2";
12
+ const PYTH_PACKAGE = "0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e";
10
13
  /**
11
14
  * Adapter that wraps SuiGrpcClient to provide the legacy SuiClient (JSON-RPC)
12
- * interface expected by third-party SDKs like @pythnetwork/pyth-sui-js and
13
- * @flowx-finance/sdk.
15
+ * interface expected by third-party SDKs like @pythnetwork/pyth-sui-js.
14
16
  *
15
17
  * Maps old JSON-RPC method signatures to the new gRPC equivalents.
16
18
  */
@@ -28,7 +30,7 @@ export function createJsonRpcAdapter(suiGrpcClient) {
28
30
  type: object.type,
29
31
  content: {
30
32
  dataType: "moveObject",
31
- fields: object.json,
33
+ fields: wrapNestedObjects(object.json),
32
34
  type: object.type,
33
35
  },
34
36
  },
@@ -57,7 +59,24 @@ export function createJsonRpcAdapter(suiGrpcClient) {
57
59
  },
58
60
  getDynamicFieldObject(_a) {
59
61
  return __awaiter(this, arguments, void 0, function* ({ parentId, name, }) {
60
- var _b, _c, _d, _e, _f;
62
+ var _b, _c;
63
+ // The gRPC node may not have dynamic field wrapper objects indexed.
64
+ // For known lookups (Pyth price table), use hardcoded values.
65
+ if (parentId === PYTH_STATE_ID &&
66
+ name.type === "vector<u8>" &&
67
+ name.value === "price_info") {
68
+ return {
69
+ data: {
70
+ objectId: PYTH_PRICE_TABLE_ID,
71
+ type: `0x2::table::Table<${PYTH_PACKAGE}::price_identifier::PriceIdentifier, 0x2::object::ID>`,
72
+ content: {
73
+ dataType: "moveObject",
74
+ fields: null,
75
+ type: `0x2::table::Table<${PYTH_PACKAGE}::price_identifier::PriceIdentifier, 0x2::object::ID>`,
76
+ },
77
+ },
78
+ };
79
+ }
61
80
  const { dynamicField } = yield suiGrpcClient.getDynamicField({
62
81
  parentId,
63
82
  name: {
@@ -65,24 +84,61 @@ export function createJsonRpcAdapter(suiGrpcClient) {
65
84
  bcs: dynamicField_encodeName(name),
66
85
  },
67
86
  });
68
- const childObject = dynamicField.$kind === "DynamicObject" && dynamicField.childId
69
- ? yield suiGrpcClient
70
- .getObject({
71
- objectId: dynamicField.childId,
72
- include: { json: true },
73
- })
74
- .then((r) => r.object)
75
- : null;
76
- const obj = childObject !== null && childObject !== void 0 ? childObject : dynamicField;
77
- const type = (_c = (_b = childObject === null || childObject === void 0 ? void 0 : childObject.type) !== null && _b !== void 0 ? _b : dynamicField.valueType) !== null && _c !== void 0 ? _c : dynamicField.type;
78
- const json = (_d = childObject === null || childObject === void 0 ? void 0 : childObject.json) !== null && _d !== void 0 ? _d : (_e = dynamicField.value) === null || _e === void 0 ? void 0 : _e.json;
87
+ if (dynamicField.$kind === "DynamicObject" && dynamicField.childId) {
88
+ try {
89
+ const childObject = yield suiGrpcClient
90
+ .getObject({
91
+ objectId: dynamicField.childId,
92
+ include: { json: true },
93
+ })
94
+ .then((r) => r.object);
95
+ return {
96
+ data: {
97
+ objectId: childObject.objectId,
98
+ type: childObject.type,
99
+ content: {
100
+ dataType: "moveObject",
101
+ fields: childObject.json,
102
+ type: childObject.type,
103
+ },
104
+ },
105
+ };
106
+ }
107
+ catch (_d) {
108
+ return {
109
+ data: {
110
+ objectId: dynamicField.childId,
111
+ type: dynamicField.valueType,
112
+ content: {
113
+ dataType: "moveObject",
114
+ fields: null,
115
+ type: dynamicField.valueType,
116
+ },
117
+ },
118
+ };
119
+ }
120
+ }
121
+ const valueBcs = (_b = dynamicField.value) === null || _b === void 0 ? void 0 : _b.bcs;
122
+ const type = (_c = dynamicField.valueType) !== null && _c !== void 0 ? _c : dynamicField.type;
123
+ let fields = null;
124
+ if (valueBcs && valueBcs.length > 0) {
125
+ if (type === "0x2::object::ID" ||
126
+ type.endsWith("::object::ID") ||
127
+ valueBcs.length === 32) {
128
+ const id = "0x" +
129
+ Array.from(valueBcs)
130
+ .map((b) => b.toString(16).padStart(2, "0"))
131
+ .join("");
132
+ fields = { value: id };
133
+ }
134
+ }
79
135
  return {
80
136
  data: {
81
- objectId: (_f = childObject === null || childObject === void 0 ? void 0 : childObject.objectId) !== null && _f !== void 0 ? _f : dynamicField.fieldId,
137
+ objectId: dynamicField.fieldId,
82
138
  type,
83
139
  content: {
84
140
  dataType: "moveObject",
85
- fields: json,
141
+ fields,
86
142
  type,
87
143
  },
88
144
  },
@@ -118,3 +174,26 @@ function dynamicField_encodeName(name) {
118
174
  }
119
175
  throw new Error(`jsonRpcAdapter: unsupported dynamic field name type "${name.type}"`);
120
176
  }
177
+ /**
178
+ * gRPC Value.toJson() returns flat objects, but the JSON-RPC format wraps
179
+ * nested struct fields in { fields: { ... } }. This recursively wraps any
180
+ * nested plain object values so legacy SDKs (e.g. Pyth) can traverse them.
181
+ */
182
+ function wrapNestedObjects(obj) {
183
+ if (obj === null || obj === undefined)
184
+ return obj;
185
+ if (Array.isArray(obj))
186
+ return obj.map(wrapNestedObjects);
187
+ if (typeof obj !== "object")
188
+ return obj;
189
+ const result = {};
190
+ for (const [key, value] of Object.entries(obj)) {
191
+ if (value !== null && typeof value === "object" && !Array.isArray(value)) {
192
+ result[key] = { fields: wrapNestedObjects(value) };
193
+ }
194
+ else {
195
+ result[key] = value;
196
+ }
197
+ }
198
+ return result;
199
+ }
@@ -11,8 +11,8 @@ import { SUI_CLOCK_OBJECT_ID, SUI_SYSTEM_STATE_OBJECT_ID, } from "@mysten/sui/ut
11
11
  import BigNumber from "bignumber.js";
12
12
  import BN from "bn.js";
13
13
  import { MAX_U64, NORMALIZED_AUSD_COINTYPE, NORMALIZED_SUI_COINTYPE, NORMALIZED_USDC_COINTYPE, NORMALIZED_USDsui_COINTYPE, NORMALIZED_eEARN_COINTYPE, NORMALIZED_sSUI_COINTYPE, NORMALIZED_stratSUI_COINTYPE, NORMALIZED_suiUSDT_COINTYPE, NORMALIZED_suiWBTC_COINTYPE, NORMALIZED_xBTC_COINTYPE, isSui, } from "@suilend/sui-fe";
14
- import { LENDING_MARKET_ID, LENDING_MARKET_TYPE, } from "../client";
15
- import { Side } from "./types";
14
+ import { LENDING_MARKET_ID, LENDING_MARKET_TYPE, } from "../client.js";
15
+ import { Side } from "./types.js";
16
16
  export const STRATEGY_WRAPPER_PACKAGE_ID_V1 = "0xba97dc73a07638d03d77ad2161484eb21db577edc9cadcd7035fef4b4f2f6fa1";
17
17
  const STRATEGY_WRAPPER_PACKAGE_ID_V7 = "0x864b66441e95323c320ee7584592769930a2d236b45d731011ee7a98eb785b35";
18
18
  export var StrategyType;
@@ -1,7 +1,4 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- import { MoveStruct } from '../utils/index.js';
1
+ import { MoveStruct } from "../utils/index.js";
5
2
  export declare const AdminCap: MoveStruct<{
6
3
  id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
7
4
  }, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::admin_cap::AdminCap">;
@@ -1,12 +1,18 @@
1
1
  /**************************************************************
2
2
  * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
3
  **************************************************************/
4
- import { MoveStruct } from '../utils/index.js';
5
- import { bcs } from '@mysten/sui/bcs';
6
- const $moduleName = '0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::admin_cap';
7
- export const AdminCap = new MoveStruct({ name: `${$moduleName}::AdminCap`, fields: {
8
- id: bcs.Address
9
- } });
10
- export const InitEvent = new MoveStruct({ name: `${$moduleName}::InitEvent`, fields: {
11
- admin_cap_id: bcs.Address
12
- } });
4
+ import { bcs } from "@mysten/sui/bcs";
5
+ import { MoveStruct } from "../utils/index.js";
6
+ const $moduleName = "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::admin_cap";
7
+ export const AdminCap = new MoveStruct({
8
+ name: `${$moduleName}::AdminCap`,
9
+ fields: {
10
+ id: bcs.Address,
11
+ },
12
+ });
13
+ export const InitEvent = new MoveStruct({
14
+ name: `${$moduleName}::InitEvent`,
15
+ fields: {
16
+ admin_cap_id: bcs.Address,
17
+ },
18
+ });
@@ -1,17 +1,16 @@
1
1
  /**************************************************************
2
2
  * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
3
  **************************************************************/
4
- /** Functionality for converting Move types into values. Use with care! */
5
- import { MoveStruct } from '../../../utils/index.js';
4
+ import { MoveStruct } from "../../../utils/index.js";
6
5
  export declare const TypeName: MoveStruct<{
7
6
  /**
8
- * String representation of the type. All types are represented using their source
9
- * syntax: "u8", "u64", "bool", "address", "vector", and so on for primitive types.
10
- * Struct types are represented as fully qualified type names; e.g.
11
- * `00000000000000000000000000000001::string::String` or
12
- * `0000000000000000000000000000000a::module_name1::type_name1<0000000000000000000000000000000a::module_name2::type_name2<u64>>`
13
- * Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or
14
- * 32 depending on the Move platform)
15
- */
7
+ * String representation of the type. All types are represented using their source
8
+ * syntax: "u8", "u64", "bool", "address", "vector", and so on for primitive types.
9
+ * Struct types are represented as fully qualified type names; e.g.
10
+ * `00000000000000000000000000000001::string::String` or
11
+ * `0000000000000000000000000000000a::module_name1::type_name1<0000000000000000000000000000000a::module_name2::type_name2<u64>>`
12
+ * Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or
13
+ * 32 depending on the Move platform)
14
+ */
16
15
  name: import("@mysten/sui/bcs").BcsType<string, string, "string">;
17
16
  }, "std::type_name::TypeName">;
@@ -2,18 +2,21 @@
2
2
  * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
3
  **************************************************************/
4
4
  /** Functionality for converting Move types into values. Use with care! */
5
- import { MoveStruct } from '../../../utils/index.js';
6
- import { bcs } from '@mysten/sui/bcs';
7
- const $moduleName = 'std::type_name';
8
- export const TypeName = new MoveStruct({ name: `${$moduleName}::TypeName`, fields: {
5
+ import { bcs } from "@mysten/sui/bcs";
6
+ import { MoveStruct } from "../../../utils/index.js";
7
+ const $moduleName = "std::type_name";
8
+ export const TypeName = new MoveStruct({
9
+ name: `${$moduleName}::TypeName`,
10
+ fields: {
9
11
  /**
10
- * String representation of the type. All types are represented using their source
11
- * syntax: "u8", "u64", "bool", "address", "vector", and so on for primitive types.
12
- * Struct types are represented as fully qualified type names; e.g.
13
- * `00000000000000000000000000000001::string::String` or
14
- * `0000000000000000000000000000000a::module_name1::type_name1<0000000000000000000000000000000a::module_name2::type_name2<u64>>`
15
- * Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or
16
- * 32 depending on the Move platform)
17
- */
18
- name: bcs.string()
19
- } });
12
+ * String representation of the type. All types are represented using their source
13
+ * syntax: "u8", "u64", "bool", "address", "vector", and so on for primitive types.
14
+ * Struct types are represented as fully qualified type names; e.g.
15
+ * `00000000000000000000000000000001::string::String` or
16
+ * `0000000000000000000000000000000a::module_name1::type_name1<0000000000000000000000000000000a::module_name2::type_name2<u64>>`
17
+ * Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or
18
+ * 32 depending on the Move platform)
19
+ */
20
+ name: bcs.string(),
21
+ },
22
+ });
@@ -1,8 +1,8 @@
1
1
  /**************************************************************
2
2
  * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
3
  **************************************************************/
4
- import { type BcsType, bcs } from '@mysten/sui/bcs';
5
- import { MoveStruct } from '../../../utils/index.js';
4
+ import { type BcsType, bcs } from "@mysten/sui/bcs";
5
+ import { MoveStruct } from "../../../utils/index.js";
6
6
  /**
7
7
  * A set data structure backed by a vector. The set is guaranteed not to contain
8
8
  * duplicate keys. All operations are O(N) in the size of the set
@@ -11,8 +11,6 @@ import { MoveStruct } from '../../../utils/index.js';
11
11
  * programming against a set API. Sets that need sorted iteration rather than
12
12
  * insertion order iteration should be handwritten.
13
13
  */
14
- export declare function VecSet<K extends BcsType<any>>(...typeParameters: [
15
- K
16
- ]): MoveStruct<{
14
+ export declare function VecSet<K extends BcsType<any>>(...typeParameters: [K]): MoveStruct<{
17
15
  contents: ReturnType<typeof bcs.vector<K>>;
18
16
  }>;
@@ -1,9 +1,9 @@
1
1
  /**************************************************************
2
2
  * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
3
  **************************************************************/
4
- import { bcs } from '@mysten/sui/bcs';
5
- import { MoveStruct } from '../../../utils/index.js';
6
- const $moduleName = '0x2::vec_set';
4
+ import { bcs } from "@mysten/sui/bcs";
5
+ import { MoveStruct } from "../../../utils/index.js";
6
+ const $moduleName = "0x2::vec_set";
7
7
  /**
8
8
  * A set data structure backed by a vector. The set is guaranteed not to contain
9
9
  * duplicate keys. All operations are O(N) in the size of the set
@@ -13,7 +13,10 @@ const $moduleName = '0x2::vec_set';
13
13
  * insertion order iteration should be handwritten.
14
14
  */
15
15
  export function VecSet(...typeParameters) {
16
- return new MoveStruct({ name: `${$moduleName}::VecSet<${typeParameters[0].name}>`, fields: {
17
- contents: bcs.vector(typeParameters[0])
18
- } });
16
+ return new MoveStruct({
17
+ name: `${$moduleName}::VecSet<${typeParameters[0].name}>`,
18
+ fields: {
19
+ contents: bcs.vector(typeParameters[0]),
20
+ },
21
+ });
19
22
  }
@@ -1,7 +1,4 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- import { MoveStruct } from '../../../utils/index.js';
1
+ import { MoveStruct } from "../../../utils/index.js";
5
2
  export declare const ObligationOwnerCap: MoveStruct<{
6
3
  id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
7
4
  obligation_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
@@ -1,10 +1,13 @@
1
1
  /**************************************************************
2
2
  * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
3
  **************************************************************/
4
- import { MoveStruct } from '../../../utils/index.js';
5
- import { bcs } from '@mysten/sui/bcs';
6
- const $moduleName = 'suilend::lending_market';
7
- export const ObligationOwnerCap = new MoveStruct({ name: `${$moduleName}::ObligationOwnerCap<phantom P>`, fields: {
4
+ import { bcs } from "@mysten/sui/bcs";
5
+ import { MoveStruct } from "../../../utils/index.js";
6
+ const $moduleName = "suilend::lending_market";
7
+ export const ObligationOwnerCap = new MoveStruct({
8
+ name: `${$moduleName}::ObligationOwnerCap<phantom P>`,
9
+ fields: {
8
10
  id: bcs.Address,
9
- obligation_id: bcs.Address
10
- } });
11
+ obligation_id: bcs.Address,
12
+ },
13
+ });
@@ -1,11 +1,11 @@
1
1
  /**************************************************************
2
2
  * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
3
  **************************************************************/
4
- import { MoveStruct, type RawTransactionArgument } from '../utils/index.js';
5
- import { bcs } from '@mysten/sui/bcs';
6
- import { type Transaction } from '@mysten/sui/transactions';
7
- import * as version from './version.js';
8
- import * as vec_set from './deps/sui/vec_set.js';
4
+ import { bcs } from "@mysten/sui/bcs";
5
+ import { type Transaction } from "@mysten/sui/transactions";
6
+ import { MoveStruct, type RawTransactionArgument } from "../utils/index.js";
7
+ import * as vec_set from "./deps/sui/vec_set.js";
8
+ import * as version from "./version.js";
9
9
  export declare const Market: MoveStruct<{
10
10
  id: typeof bcs.Address;
11
11
  version: typeof version.Version;
@@ -49,13 +49,8 @@ export interface CheckVersionArguments {
49
49
  }
50
50
  export interface CheckVersionOptions {
51
51
  package?: string;
52
- arguments: CheckVersionArguments | [
53
- market: RawTransactionArgument<string>
54
- ];
55
- typeArguments: [
56
- string,
57
- string
58
- ];
52
+ arguments: CheckVersionArguments | [market: RawTransactionArgument<string>];
53
+ typeArguments: [string, string];
59
54
  }
60
55
  export declare function checkVersion(options: CheckVersionOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
61
56
  export interface UpgradeVersionArguments {
@@ -68,10 +63,7 @@ export interface UpgradeVersionOptions {
68
63
  _: RawTransactionArgument<string>,
69
64
  market: RawTransactionArgument<string>
70
65
  ];
71
- typeArguments: [
72
- string,
73
- string
74
- ];
66
+ typeArguments: [string, string];
75
67
  }
76
68
  export declare function upgradeVersion(options: UpgradeVersionOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
77
69
  export interface CreateMarketArguments {
@@ -88,10 +80,7 @@ export interface CreateMarketOptions {
88
80
  openFeeRate: RawTransactionArgument<number | bigint>,
89
81
  closeFeeRate: RawTransactionArgument<number | bigint>
90
82
  ];
91
- typeArguments: [
92
- string,
93
- string
94
- ];
83
+ typeArguments: [string, string];
95
84
  }
96
85
  export declare function createMarket(options: CreateMarketOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
97
86
  export interface UpdateMarketPermissionArguments {
@@ -108,10 +97,7 @@ export interface UpdateMarketPermissionOptions {
108
97
  permission: RawTransactionArgument<string>,
109
98
  pause: RawTransactionArgument<boolean>
110
99
  ];
111
- typeArguments: [
112
- string,
113
- string
114
- ];
100
+ typeArguments: [string, string];
115
101
  }
116
102
  /** Update a market permission */
117
103
  export declare function updateMarketPermission(options: UpdateMarketPermissionOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
@@ -129,10 +115,7 @@ export interface SetFeeRateOptions {
129
115
  openFee: RawTransactionArgument<number | bigint>,
130
116
  closeFee: RawTransactionArgument<number | bigint>
131
117
  ];
132
- typeArguments: [
133
- string,
134
- string
135
- ];
118
+ typeArguments: [string, string];
136
119
  }
137
120
  /** Set fee rates */
138
121
  export declare function setFeeRate(options: SetFeeRateOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
@@ -148,10 +131,7 @@ export interface SetFeeRecipientOptions {
148
131
  market: RawTransactionArgument<string>,
149
132
  feeRecipient: RawTransactionArgument<string>
150
133
  ];
151
- typeArguments: [
152
- string,
153
- string
154
- ];
134
+ typeArguments: [string, string];
155
135
  }
156
136
  /** Set fee recipient address */
157
137
  export declare function setFeeRecipient(options: SetFeeRecipientOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
@@ -160,13 +140,8 @@ export interface MarketIdArguments {
160
140
  }
161
141
  export interface MarketIdOptions {
162
142
  package?: string;
163
- arguments: MarketIdArguments | [
164
- market: RawTransactionArgument<string>
165
- ];
166
- typeArguments: [
167
- string,
168
- string
169
- ];
143
+ arguments: MarketIdArguments | [market: RawTransactionArgument<string>];
144
+ typeArguments: [string, string];
170
145
  }
171
146
  /** Get market ID */
172
147
  export declare function marketId(options: MarketIdOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
@@ -175,13 +150,8 @@ export interface OpenFeeRateArguments {
175
150
  }
176
151
  export interface OpenFeeRateOptions {
177
152
  package?: string;
178
- arguments: OpenFeeRateArguments | [
179
- market: RawTransactionArgument<string>
180
- ];
181
- typeArguments: [
182
- string,
183
- string
184
- ];
153
+ arguments: OpenFeeRateArguments | [market: RawTransactionArgument<string>];
154
+ typeArguments: [string, string];
185
155
  }
186
156
  /** Get open fee rate */
187
157
  export declare function openFeeRate(options: OpenFeeRateOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
@@ -190,13 +160,8 @@ export interface CloseFeeRateArguments {
190
160
  }
191
161
  export interface CloseFeeRateOptions {
192
162
  package?: string;
193
- arguments: CloseFeeRateArguments | [
194
- market: RawTransactionArgument<string>
195
- ];
196
- typeArguments: [
197
- string,
198
- string
199
- ];
163
+ arguments: CloseFeeRateArguments | [market: RawTransactionArgument<string>];
164
+ typeArguments: [string, string];
200
165
  }
201
166
  /** Get close fee rate */
202
167
  export declare function closeFeeRate(options: CloseFeeRateOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
@@ -205,13 +170,8 @@ export interface FeeRecipientArguments {
205
170
  }
206
171
  export interface FeeRecipientOptions {
207
172
  package?: string;
208
- arguments: FeeRecipientArguments | [
209
- market: RawTransactionArgument<string>
210
- ];
211
- typeArguments: [
212
- string,
213
- string
214
- ];
173
+ arguments: FeeRecipientArguments | [market: RawTransactionArgument<string>];
174
+ typeArguments: [string, string];
215
175
  }
216
176
  /** Get fee recipient address */
217
177
  export declare function feeRecipient(options: FeeRecipientOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
@@ -220,12 +180,7 @@ export interface PermissionsArguments {
220
180
  }
221
181
  export interface PermissionsOptions {
222
182
  package?: string;
223
- arguments: PermissionsArguments | [
224
- market: RawTransactionArgument<string>
225
- ];
226
- typeArguments: [
227
- string,
228
- string
229
- ];
183
+ arguments: PermissionsArguments | [market: RawTransactionArgument<string>];
184
+ typeArguments: [string, string];
230
185
  }
231
186
  export declare function permissions(options: PermissionsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;