@suilend/sdk 3.0.8 → 5.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 (73) hide show
  1. package/_generated/_dependencies/source/0x1/ascii/structs.d.ts +4 -4
  2. package/_generated/_dependencies/source/0x1/ascii/structs.js +42 -41
  3. package/_generated/_dependencies/source/0x1/option/structs.js +22 -26
  4. package/_generated/_dependencies/source/0x1/type-name/structs.d.ts +3 -3
  5. package/_generated/_dependencies/source/0x1/type-name/structs.js +21 -25
  6. package/_generated/_dependencies/source/0x2/bag/structs.d.ts +5 -5
  7. package/_generated/_dependencies/source/0x2/bag/structs.js +22 -25
  8. package/_generated/_dependencies/source/0x2/balance/structs.d.ts +4 -4
  9. package/_generated/_dependencies/source/0x2/balance/structs.js +42 -41
  10. package/_generated/_dependencies/source/0x2/object/structs.d.ts +5 -5
  11. package/_generated/_dependencies/source/0x2/object/structs.js +42 -41
  12. package/_generated/_dependencies/source/0x2/object-table/structs.d.ts +5 -5
  13. package/_generated/_dependencies/source/0x2/object-table/structs.js +22 -25
  14. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.d.ts +3 -3
  15. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.js +22 -25
  16. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.d.ts +9 -9
  17. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.js +24 -25
  18. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.d.ts +21 -21
  19. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.js +23 -25
  20. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.d.ts +2 -2
  21. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js +21 -25
  22. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.d.ts +52 -52
  23. package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.js +45 -41
  24. package/_generated/_framework/vector.js +9 -6
  25. package/_generated/suilend/cell/structs.d.ts +1 -1
  26. package/_generated/suilend/cell/structs.js +21 -25
  27. package/_generated/suilend/decimal/structs.d.ts +2 -2
  28. package/_generated/suilend/decimal/structs.js +21 -25
  29. package/_generated/suilend/lending-market/structs.d.ts +129 -129
  30. package/_generated/suilend/lending-market/structs.js +391 -265
  31. package/_generated/suilend/liquidity-mining/structs.d.ts +44 -44
  32. package/_generated/suilend/liquidity-mining/structs.js +122 -89
  33. package/_generated/suilend/obligation/structs.d.ts +98 -98
  34. package/_generated/suilend/obligation/structs.js +194 -121
  35. package/_generated/suilend/rate-limiter/structs.d.ts +12 -12
  36. package/_generated/suilend/rate-limiter/structs.js +46 -41
  37. package/_generated/suilend/reserve/structs.d.ts +128 -128
  38. package/_generated/suilend/reserve/structs.js +243 -153
  39. package/_generated/suilend/reserve-config/structs.d.ts +30 -30
  40. package/_generated/suilend/reserve-config/structs.js +60 -41
  41. package/api/events.js +5 -14
  42. package/client.js +267 -319
  43. package/lib/initialize.d.ts +85 -3
  44. package/lib/initialize.js +119 -52
  45. package/lib/liquidityMining.js +15 -19
  46. package/lib/pyth.d.ts +16 -0
  47. package/lib/pyth.js +30 -15
  48. package/lib/pythAdapter.js +96 -112
  49. package/lib/strategyOwnerCap.js +8 -17
  50. package/margin/margin/admin_cap.d.ts +2 -2
  51. package/margin/margin/deps/std/type_name.d.ts +1 -1
  52. package/margin/margin/deps/suilend/lending_market.d.ts +2 -2
  53. package/margin/margin/market.d.ts +11 -11
  54. package/margin/margin/market.js +22 -22
  55. package/margin/margin/permissions.js +14 -14
  56. package/margin/margin/position.d.ts +47 -47
  57. package/margin/margin/position.js +10 -10
  58. package/margin/margin/router.d.ts +5 -5
  59. package/margin/margin/router.js +16 -16
  60. package/margin/margin/version.d.ts +1 -1
  61. package/margin/utils/index.js +22 -36
  62. package/package.json +1 -1
  63. package/parsers/apiReserveAssetDataEvent.js +4 -1
  64. package/parsers/lendingMarket.js +3 -4
  65. package/parsers/reserve.js +4 -1
  66. package/strategies.js +188 -204
  67. package/swap/quote.d.ts +1 -1
  68. package/swap/quote.js +28 -39
  69. package/swap/transaction.js +17 -26
  70. package/utils/events.js +20 -32
  71. package/utils/obligation.js +111 -135
  72. package/utils/simulate.d.ts +68 -1
  73. package/utils/simulate.js +149 -31
@@ -1,12 +1,3 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  import { bcs } from "@mysten/sui/bcs";
11
2
  const PYTH_STATE_ID = "0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8";
12
3
  const PYTH_PRICE_TABLE_ID = "0x234c9ffca44613ab87a2711325b6e17bad9ece0449b917c8bd9c0ad7a0506cc2";
@@ -19,132 +10,125 @@ const PYTH_PACKAGE = "0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a
19
10
  */
20
11
  export function createJsonRpcAdapter(suiGrpcClient) {
21
12
  return {
22
- getObject(_a) {
23
- return __awaiter(this, arguments, void 0, function* ({ id }) {
24
- const { object } = yield suiGrpcClient.getObject({
25
- objectId: id,
26
- include: { json: true },
27
- });
13
+ async getObject({ id }) {
14
+ const { object } = await suiGrpcClient.getObject({
15
+ objectId: id,
16
+ include: { json: true },
17
+ });
18
+ return {
19
+ data: {
20
+ objectId: object.objectId,
21
+ type: object.type,
22
+ content: {
23
+ dataType: "moveObject",
24
+ fields: wrapNestedObjects(object.json),
25
+ type: object.type,
26
+ },
27
+ },
28
+ };
29
+ },
30
+ async getCoins({ owner, coinType, cursor, }) {
31
+ const result = await suiGrpcClient.listCoins({
32
+ owner,
33
+ coinType,
34
+ cursor,
35
+ });
36
+ return {
37
+ data: result.objects.map((coin) => ({
38
+ coinObjectId: coin.objectId,
39
+ version: coin.version,
40
+ digest: coin.digest,
41
+ balance: coin.balance,
42
+ coinType: coin.type,
43
+ })),
44
+ nextCursor: result.cursor,
45
+ hasNextPage: result.hasNextPage,
46
+ };
47
+ },
48
+ async getDynamicFieldObject({ parentId, name, }) {
49
+ // The gRPC node may not have dynamic field wrapper objects indexed.
50
+ // For known lookups (Pyth price table), use hardcoded values.
51
+ if (parentId === PYTH_STATE_ID &&
52
+ name.type === "vector<u8>" &&
53
+ name.value === "price_info") {
28
54
  return {
29
55
  data: {
30
- objectId: object.objectId,
31
- type: object.type,
56
+ objectId: PYTH_PRICE_TABLE_ID,
57
+ type: `0x2::table::Table<${PYTH_PACKAGE}::price_identifier::PriceIdentifier, 0x2::object::ID>`,
32
58
  content: {
33
59
  dataType: "moveObject",
34
- fields: wrapNestedObjects(object.json),
35
- type: object.type,
60
+ fields: null,
61
+ type: `0x2::table::Table<${PYTH_PACKAGE}::price_identifier::PriceIdentifier, 0x2::object::ID>`,
36
62
  },
37
63
  },
38
64
  };
65
+ }
66
+ const { dynamicField } = await suiGrpcClient.getDynamicField({
67
+ parentId,
68
+ name: {
69
+ type: name.type,
70
+ bcs: dynamicField_encodeName(name),
71
+ },
39
72
  });
40
- },
41
- getCoins(_a) {
42
- return __awaiter(this, arguments, void 0, function* ({ owner, coinType, cursor, }) {
43
- const result = yield suiGrpcClient.listCoins({
44
- owner,
45
- coinType,
46
- cursor,
47
- });
48
- return {
49
- data: result.objects.map((coin) => ({
50
- coinObjectId: coin.objectId,
51
- version: coin.version,
52
- digest: coin.digest,
53
- balance: coin.balance,
54
- coinType: coin.type,
55
- })),
56
- nextCursor: result.cursor,
57
- hasNextPage: result.hasNextPage,
58
- };
59
- });
60
- },
61
- getDynamicFieldObject(_a) {
62
- return __awaiter(this, arguments, void 0, function* ({ parentId, name, }) {
63
- var _b, _c;
64
- // The gRPC node may not have dynamic field wrapper objects indexed.
65
- // For known lookups (Pyth price table), use hardcoded values.
66
- if (parentId === PYTH_STATE_ID &&
67
- name.type === "vector<u8>" &&
68
- name.value === "price_info") {
73
+ if (dynamicField.$kind === "DynamicObject" && dynamicField.childId) {
74
+ try {
75
+ const childObject = await suiGrpcClient
76
+ .getObject({
77
+ objectId: dynamicField.childId,
78
+ include: { json: true },
79
+ })
80
+ .then((r) => r.object);
69
81
  return {
70
82
  data: {
71
- objectId: PYTH_PRICE_TABLE_ID,
72
- type: `0x2::table::Table<${PYTH_PACKAGE}::price_identifier::PriceIdentifier, 0x2::object::ID>`,
83
+ objectId: childObject.objectId,
84
+ type: childObject.type,
73
85
  content: {
74
86
  dataType: "moveObject",
75
- fields: null,
76
- type: `0x2::table::Table<${PYTH_PACKAGE}::price_identifier::PriceIdentifier, 0x2::object::ID>`,
87
+ fields: childObject.json,
88
+ type: childObject.type,
77
89
  },
78
90
  },
79
91
  };
80
92
  }
81
- const { dynamicField } = yield suiGrpcClient.getDynamicField({
82
- parentId,
83
- name: {
84
- type: name.type,
85
- bcs: dynamicField_encodeName(name),
86
- },
87
- });
88
- if (dynamicField.$kind === "DynamicObject" && dynamicField.childId) {
89
- try {
90
- const childObject = yield suiGrpcClient
91
- .getObject({
93
+ catch {
94
+ return {
95
+ data: {
92
96
  objectId: dynamicField.childId,
93
- include: { json: true },
94
- })
95
- .then((r) => r.object);
96
- return {
97
- data: {
98
- objectId: childObject.objectId,
99
- type: childObject.type,
100
- content: {
101
- dataType: "moveObject",
102
- fields: childObject.json,
103
- type: childObject.type,
104
- },
105
- },
106
- };
107
- }
108
- catch (_d) {
109
- return {
110
- data: {
111
- objectId: dynamicField.childId,
97
+ type: dynamicField.valueType,
98
+ content: {
99
+ dataType: "moveObject",
100
+ fields: null,
112
101
  type: dynamicField.valueType,
113
- content: {
114
- dataType: "moveObject",
115
- fields: null,
116
- type: dynamicField.valueType,
117
- },
118
102
  },
119
- };
120
- }
103
+ },
104
+ };
121
105
  }
122
- const valueBcs = (_b = dynamicField.value) === null || _b === void 0 ? void 0 : _b.bcs;
123
- const type = (_c = dynamicField.valueType) !== null && _c !== void 0 ? _c : dynamicField.type;
124
- let fields = null;
125
- if (valueBcs && valueBcs.length > 0) {
126
- if (type === "0x2::object::ID" ||
127
- type.endsWith("::object::ID") ||
128
- valueBcs.length === 32) {
129
- const id = "0x" +
130
- Array.from(valueBcs)
131
- .map((b) => b.toString(16).padStart(2, "0"))
132
- .join("");
133
- fields = { value: id };
134
- }
106
+ }
107
+ const valueBcs = dynamicField.value?.bcs;
108
+ const type = dynamicField.valueType ?? dynamicField.type;
109
+ let fields = null;
110
+ if (valueBcs && valueBcs.length > 0) {
111
+ if (type === "0x2::object::ID" ||
112
+ type.endsWith("::object::ID") ||
113
+ valueBcs.length === 32) {
114
+ const id = "0x" +
115
+ Array.from(valueBcs)
116
+ .map((b) => b.toString(16).padStart(2, "0"))
117
+ .join("");
118
+ fields = { value: id };
135
119
  }
136
- return {
137
- data: {
138
- objectId: dynamicField.fieldId,
120
+ }
121
+ return {
122
+ data: {
123
+ objectId: dynamicField.fieldId,
124
+ type,
125
+ content: {
126
+ dataType: "moveObject",
127
+ fields,
139
128
  type,
140
- content: {
141
- dataType: "moveObject",
142
- fields,
143
- type,
144
- },
145
129
  },
146
- };
147
- });
130
+ },
131
+ };
148
132
  },
149
133
  };
150
134
  }
@@ -1,16 +1,7 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  import { SUI_CLOCK_OBJECT_ID, SUI_SYSTEM_STATE_OBJECT_ID, } from "@mysten/sui/utils";
11
2
  import BigNumber from "bignumber.js";
12
3
  import BN from "bn.js";
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";
4
+ 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-core";
14
5
  import { LENDING_MARKET_ID, LENDING_MARKET_TYPE, } from "../client.js";
15
6
  import { Side } from "./types.js";
16
7
  export const STRATEGY_WRAPPER_PACKAGE_ID_V1 = "0xba97dc73a07638d03d77ad2161484eb21db577edc9cadcd7035fef4b4f2f6fa1";
@@ -345,9 +336,9 @@ export const strategyClaimRewardsAndMergeCoins = (strategyType, rewardsMap, stra
345
336
  }
346
337
  return mergedCoinsMap;
347
338
  };
348
- export const strategySwapSomeDepositsForCoinType = (strategyType, cetusSdk, cetusPartnerId, obligation, noSwapCoinTypes, // coinTypes to not swap for depositReserve.coinType
339
+ export const strategySwapSomeDepositsForCoinType = async (strategyType, cetusSdk, cetusPartnerId, obligation, noSwapCoinTypes, // coinTypes to not swap for depositReserve.coinType
349
340
  swapPercent, // percent of deposit to swap for depositReserve.coinType (0-100)
350
- depositReserve, strategyOwnerCap, transaction) => __awaiter(void 0, void 0, void 0, function* () {
341
+ depositReserve, strategyOwnerCap, transaction) => {
351
342
  // 1) MAX withdraw non-swapCoinTypes deposits
352
343
  const swapCoinTypeDeposits = obligation.deposits.filter((deposit) => !noSwapCoinTypes.includes(deposit.coinType));
353
344
  if (swapCoinTypeDeposits.length === 0)
@@ -371,14 +362,14 @@ depositReserve, strategyOwnerCap, transaction) => __awaiter(void 0, void 0, void
371
362
  // 2) Swap
372
363
  let resultCoin = undefined;
373
364
  // 2.1) Get routers
374
- const amountsAndSortedQuotesMap = Object.fromEntries(yield Promise.all(Object.entries(withdrawnCoinsMap).map(([coinType, { deposit, coin }]) => (() => __awaiter(void 0, void 0, void 0, function* () {
365
+ const amountsAndSortedQuotesMap = Object.fromEntries(await Promise.all(Object.entries(withdrawnCoinsMap).map(([coinType, { deposit, coin }]) => (async () => {
375
366
  try {
376
367
  // Get amount
377
368
  const amount = new BigNumber(deposit.depositedAmount.times(swapPercent.div(100)))
378
369
  .times(10 ** deposit.reserve.token.decimals)
379
370
  .integerValue(BigNumber.ROUND_DOWN); // Use underestimate (deposits keep accruing if deposit APR >0)
380
371
  // Get routes
381
- const routers = yield cetusSdk.findRouters({
372
+ const routers = await cetusSdk.findRouters({
382
373
  from: deposit.coinType,
383
374
  target: depositReserve.coinType,
384
375
  amount: new BN(amount.toString()), // Underestimate (deposits keep accruing if deposit APR >0)
@@ -396,7 +387,7 @@ depositReserve, strategyOwnerCap, transaction) => __awaiter(void 0, void 0, void
396
387
  console.error(err);
397
388
  return [coinType, { coin, routers: undefined }];
398
389
  }
399
- }))())));
390
+ })())));
400
391
  console.log("[strategySwapSomeDepositsForCoinType] amountsAndSortedQuotesMap", { amountsAndSortedQuotesMap });
401
392
  // 2.2) Swap
402
393
  for (const [coinType, { coin: coinIn, routers }] of Object.entries(amountsAndSortedQuotesMap)) {
@@ -406,7 +397,7 @@ depositReserve, strategyOwnerCap, transaction) => __awaiter(void 0, void 0, void
406
397
  try {
407
398
  let coinOut;
408
399
  try {
409
- coinOut = (yield cetusSdk.fixableRouterSwapV3({
400
+ coinOut = (await cetusSdk.fixableRouterSwapV3({
410
401
  router: routers,
411
402
  inputCoin: coinIn,
412
403
  slippage: 3 / 100,
@@ -432,7 +423,7 @@ depositReserve, strategyOwnerCap, transaction) => __awaiter(void 0, void 0, void
432
423
  throw new Error("No coin to deposit or transfer");
433
424
  console.log("[strategySwapSomeDepositsForCoinType] depositing resultCoin");
434
425
  strategyDeposit(strategyType, resultCoin, depositReserve.coinType, strategyOwnerCap, depositReserve.arrayIndex, transaction);
435
- });
426
+ };
436
427
  export const createStrategyOwnerCapIfNoneExists = (strategyType, strategyOwnerCap, transaction) => {
437
428
  const { lendingMarketId, lendingMarketType } = getStrategyLendingMarket(strategyType);
438
429
  let strategyOwnerCapId;
@@ -1,7 +1,7 @@
1
1
  import { MoveStruct } from "../utils/index.js";
2
2
  export declare const AdminCap: MoveStruct<{
3
- id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
3
+ id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
4
4
  }, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::admin_cap::AdminCap">;
5
5
  export declare const InitEvent: MoveStruct<{
6
- admin_cap_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
6
+ admin_cap_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
7
7
  }, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::admin_cap::InitEvent">;
@@ -12,5 +12,5 @@ export declare const TypeName: MoveStruct<{
12
12
  * Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or
13
13
  * 32 depending on the Move platform)
14
14
  */
15
- name: import("@mysten/sui/bcs").BcsType<string, string, "string">;
15
+ name: import("@mysten/bcs").BcsType<string, string, "string">;
16
16
  }, "std::type_name::TypeName">;
@@ -1,5 +1,5 @@
1
1
  import { MoveStruct } from "../../../utils/index.js";
2
2
  export declare const ObligationOwnerCap: MoveStruct<{
3
- id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
4
- obligation_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
3
+ id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
4
+ obligation_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
5
5
  }, "suilend::lending_market::ObligationOwnerCap<phantom P>">;
@@ -15,23 +15,23 @@ export declare const Market: MoveStruct<{
15
15
  permissions: ReturnType<typeof vec_set.VecSet>;
16
16
  }>;
17
17
  export declare const CreateMarketEvent: MoveStruct<{
18
- market_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
18
+ market_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
19
19
  base_token: MoveStruct<{
20
- name: import("@mysten/sui/bcs").BcsType<string, string, "string">;
20
+ name: import("@mysten/bcs").BcsType<string, string, "string">;
21
21
  }, "std::type_name::TypeName">;
22
22
  quote_token: MoveStruct<{
23
- name: import("@mysten/sui/bcs").BcsType<string, string, "string">;
23
+ name: import("@mysten/bcs").BcsType<string, string, "string">;
24
24
  }, "std::type_name::TypeName">;
25
- open_fee_rate: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
26
- close_fee_rate: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
25
+ open_fee_rate: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
26
+ close_fee_rate: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
27
27
  }, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::market::CreateMarketEvent">;
28
28
  export declare const MarketUpdatedEvent: MoveStruct<{
29
- market_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
30
- open_fee_rate: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
31
- close_fee_rate: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
29
+ market_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
30
+ open_fee_rate: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
31
+ close_fee_rate: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
32
32
  }, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::market::MarketUpdatedEvent">;
33
33
  export declare const UpdateMarketPermissionEvent: MoveStruct<{
34
- market_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
34
+ market_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
35
35
  permission: import("../utils/index.js").MoveEnum<{
36
36
  OpenPosition: null;
37
37
  ClosePosition: null;
@@ -41,8 +41,8 @@ export declare const UpdateMarketPermissionEvent: MoveStruct<{
41
41
  Repay: null;
42
42
  ClaimReward: null;
43
43
  }, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::permissions::Permission">;
44
- is_pause: import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">;
45
- sender: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
44
+ is_pause: import("@mysten/bcs").BcsType<boolean, boolean, "bool">;
45
+ sender: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
46
46
  }, "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53::market::UpdateMarketPermissionEvent">;
47
47
  export interface CheckVersionArguments {
48
48
  market: RawTransactionArgument<string>;
@@ -47,8 +47,8 @@ export const UpdateMarketPermissionEvent = new MoveStruct({
47
47
  },
48
48
  });
49
49
  export function checkVersion(options) {
50
- var _a;
51
- const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
50
+ const packageAddress = options.package ??
51
+ "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
52
52
  const argumentsTypes = [null];
53
53
  const parameterNames = ["market"];
54
54
  return (tx) => tx.moveCall({
@@ -60,8 +60,8 @@ export function checkVersion(options) {
60
60
  });
61
61
  }
62
62
  export function upgradeVersion(options) {
63
- var _a;
64
- const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
63
+ const packageAddress = options.package ??
64
+ "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
65
65
  const argumentsTypes = [null, null];
66
66
  const parameterNames = ["_", "market"];
67
67
  return (tx) => tx.moveCall({
@@ -73,8 +73,8 @@ export function upgradeVersion(options) {
73
73
  });
74
74
  }
75
75
  export function createMarket(options) {
76
- var _a;
77
- const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
76
+ const packageAddress = options.package ??
77
+ "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
78
78
  const argumentsTypes = [null, "address", "u64", "u64"];
79
79
  const parameterNames = ["_", "feeRecipient", "openFeeRate", "closeFeeRate"];
80
80
  return (tx) => tx.moveCall({
@@ -87,8 +87,8 @@ export function createMarket(options) {
87
87
  }
88
88
  /** Update a market permission */
89
89
  export function updateMarketPermission(options) {
90
- var _a;
91
- const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
90
+ const packageAddress = options.package ??
91
+ "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
92
92
  const argumentsTypes = [null, null, null, "bool"];
93
93
  const parameterNames = ["_", "market", "permission", "pause"];
94
94
  return (tx) => tx.moveCall({
@@ -101,8 +101,8 @@ export function updateMarketPermission(options) {
101
101
  }
102
102
  /** Set fee rates */
103
103
  export function setFeeRate(options) {
104
- var _a;
105
- const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
104
+ const packageAddress = options.package ??
105
+ "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
106
106
  const argumentsTypes = [null, null, "u64", "u64"];
107
107
  const parameterNames = ["_", "market", "openFee", "closeFee"];
108
108
  return (tx) => tx.moveCall({
@@ -115,8 +115,8 @@ export function setFeeRate(options) {
115
115
  }
116
116
  /** Set fee recipient address */
117
117
  export function setFeeRecipient(options) {
118
- var _a;
119
- const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
118
+ const packageAddress = options.package ??
119
+ "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
120
120
  const argumentsTypes = [null, null, "address"];
121
121
  const parameterNames = ["_", "market", "feeRecipient"];
122
122
  return (tx) => tx.moveCall({
@@ -129,8 +129,8 @@ export function setFeeRecipient(options) {
129
129
  }
130
130
  /** Get market ID */
131
131
  export function marketId(options) {
132
- var _a;
133
- const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
132
+ const packageAddress = options.package ??
133
+ "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
134
134
  const argumentsTypes = [null];
135
135
  const parameterNames = ["market"];
136
136
  return (tx) => tx.moveCall({
@@ -143,8 +143,8 @@ export function marketId(options) {
143
143
  }
144
144
  /** Get open fee rate */
145
145
  export function openFeeRate(options) {
146
- var _a;
147
- const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
146
+ const packageAddress = options.package ??
147
+ "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
148
148
  const argumentsTypes = [null];
149
149
  const parameterNames = ["market"];
150
150
  return (tx) => tx.moveCall({
@@ -157,8 +157,8 @@ export function openFeeRate(options) {
157
157
  }
158
158
  /** Get close fee rate */
159
159
  export function closeFeeRate(options) {
160
- var _a;
161
- const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
160
+ const packageAddress = options.package ??
161
+ "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
162
162
  const argumentsTypes = [null];
163
163
  const parameterNames = ["market"];
164
164
  return (tx) => tx.moveCall({
@@ -171,8 +171,8 @@ export function closeFeeRate(options) {
171
171
  }
172
172
  /** Get fee recipient address */
173
173
  export function feeRecipient(options) {
174
- var _a;
175
- const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
174
+ const packageAddress = options.package ??
175
+ "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
176
176
  const argumentsTypes = [null];
177
177
  const parameterNames = ["market"];
178
178
  return (tx) => tx.moveCall({
@@ -184,8 +184,8 @@ export function feeRecipient(options) {
184
184
  });
185
185
  }
186
186
  export function permissions(options) {
187
- var _a;
188
- const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
187
+ const packageAddress = options.package ??
188
+ "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
189
189
  const argumentsTypes = [null];
190
190
  const parameterNames = ["market"];
191
191
  return (tx) => tx.moveCall({
@@ -13,8 +13,8 @@ export const Permission = new MoveEnum({
13
13
  },
14
14
  });
15
15
  export function openPosition(options = {}) {
16
- var _a;
17
- const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
16
+ const packageAddress = options.package ??
17
+ "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
18
18
  return (tx) => tx.moveCall({
19
19
  package: packageAddress,
20
20
  module: "permissions",
@@ -22,8 +22,8 @@ export function openPosition(options = {}) {
22
22
  });
23
23
  }
24
24
  export function closePosition(options = {}) {
25
- var _a;
26
- const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
25
+ const packageAddress = options.package ??
26
+ "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
27
27
  return (tx) => tx.moveCall({
28
28
  package: packageAddress,
29
29
  module: "permissions",
@@ -31,8 +31,8 @@ export function closePosition(options = {}) {
31
31
  });
32
32
  }
33
33
  export function deposit(options = {}) {
34
- var _a;
35
- const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
34
+ const packageAddress = options.package ??
35
+ "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
36
36
  return (tx) => tx.moveCall({
37
37
  package: packageAddress,
38
38
  module: "permissions",
@@ -40,8 +40,8 @@ export function deposit(options = {}) {
40
40
  });
41
41
  }
42
42
  export function borrow(options = {}) {
43
- var _a;
44
- const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
43
+ const packageAddress = options.package ??
44
+ "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
45
45
  return (tx) => tx.moveCall({
46
46
  package: packageAddress,
47
47
  module: "permissions",
@@ -49,8 +49,8 @@ export function borrow(options = {}) {
49
49
  });
50
50
  }
51
51
  export function withdraw(options = {}) {
52
- var _a;
53
- const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
52
+ const packageAddress = options.package ??
53
+ "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
54
54
  return (tx) => tx.moveCall({
55
55
  package: packageAddress,
56
56
  module: "permissions",
@@ -58,8 +58,8 @@ export function withdraw(options = {}) {
58
58
  });
59
59
  }
60
60
  export function repay(options = {}) {
61
- var _a;
62
- const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
61
+ const packageAddress = options.package ??
62
+ "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
63
63
  return (tx) => tx.moveCall({
64
64
  package: packageAddress,
65
65
  module: "permissions",
@@ -67,8 +67,8 @@ export function repay(options = {}) {
67
67
  });
68
68
  }
69
69
  export function claimReward(options = {}) {
70
- var _a;
71
- const packageAddress = (_a = options.package) !== null && _a !== void 0 ? _a : "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
70
+ const packageAddress = options.package ??
71
+ "0xd5f3054404ec9275b50985851a5b515728f131a3bdd9c9a5f738a9326b738d53";
72
72
  return (tx) => tx.moveCall({
73
73
  package: packageAddress,
74
74
  module: "permissions",