@typus/typus-perp-sdk 1.2.1 → 1.3.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 (71) hide show
  1. package/dist/src/client.d.ts +22 -3
  2. package/dist/src/client.js +66 -8
  3. package/dist/src/fetch.d.ts +61 -20
  4. package/dist/src/fetch.js +20 -14
  5. package/dist/src/generated/typus_perp/admin.d.ts +65 -21
  6. package/dist/src/generated/typus_perp/admin.js +139 -123
  7. package/dist/src/generated/typus_perp/competition.d.ts +5 -17
  8. package/dist/src/generated/typus_perp/competition.js +63 -39
  9. package/dist/src/generated/typus_perp/deps/std/type_name.d.ts +9 -9
  10. package/dist/src/generated/typus_perp/deps/std/type_name.js +13 -16
  11. package/dist/src/generated/typus_perp/deps/sui/balance.d.ts +2 -2
  12. package/dist/src/generated/typus_perp/deps/sui/balance.js +5 -8
  13. package/dist/src/generated/typus_perp/deps/sui/object.d.ts +8 -0
  14. package/dist/src/generated/typus_perp/deps/sui/object.js +13 -0
  15. package/dist/src/generated/typus_perp/deps/sui/object_table.d.ts +5 -3
  16. package/dist/src/generated/typus_perp/deps/sui/object_table.js +40 -9
  17. package/dist/src/generated/typus_perp/deps/sui/table.d.ts +5 -3
  18. package/dist/src/generated/typus_perp/deps/sui/table.js +40 -9
  19. package/dist/src/generated/typus_perp/deps/sui/vec_set.d.ts +5 -3
  20. package/dist/src/generated/typus_perp/deps/sui/vec_set.js +5 -8
  21. package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.d.ts +4 -2
  22. package/dist/src/generated/typus_perp/deps/typus/keyed_big_vector.js +9 -12
  23. package/dist/src/generated/typus_perp/deps/typus/linked_object_table.d.ts +12 -6
  24. package/dist/src/generated/typus_perp/deps/typus/linked_object_table.js +41 -10
  25. package/dist/src/generated/typus_perp/deps/typus_framework/vault.d.ts +4 -2
  26. package/dist/src/generated/typus_perp/deps/typus_framework/vault.js +40 -9
  27. package/dist/src/generated/typus_perp/error.d.ts +201 -94
  28. package/dist/src/generated/typus_perp/error.js +300 -273
  29. package/dist/src/generated/typus_perp/escrow.d.ts +14 -6
  30. package/dist/src/generated/typus_perp/escrow.js +38 -37
  31. package/dist/src/generated/typus_perp/lending.d.ts +1 -1
  32. package/dist/src/generated/typus_perp/lending.js +3 -3
  33. package/dist/src/generated/typus_perp/lp_pool.d.ts +438 -392
  34. package/dist/src/generated/typus_perp/lp_pool.js +987 -934
  35. package/dist/src/generated/typus_perp/math.d.ts +13 -16
  36. package/dist/src/generated/typus_perp/math.js +51 -50
  37. package/dist/src/generated/typus_perp/position.d.ts +194 -106
  38. package/dist/src/generated/typus_perp/position.js +714 -733
  39. package/dist/src/generated/typus_perp/profit_vault.d.ts +62 -20
  40. package/dist/src/generated/typus_perp/profit_vault.js +162 -148
  41. package/dist/src/generated/typus_perp/symbol.d.ts +12 -5
  42. package/dist/src/generated/typus_perp/symbol.js +28 -25
  43. package/dist/src/generated/typus_perp/trading.d.ts +956 -139
  44. package/dist/src/generated/typus_perp/trading.js +1577 -1151
  45. package/dist/src/generated/typus_perp/treasury_caps.d.ts +16 -7
  46. package/dist/src/generated/typus_perp/treasury_caps.js +60 -24
  47. package/dist/src/generated/typus_perp/user_account.d.ts +40 -0
  48. package/dist/src/generated/typus_perp/user_account.js +66 -0
  49. package/dist/src/generated/typus_stake_pool/admin.d.ts +144 -10
  50. package/dist/src/generated/typus_stake_pool/admin.js +132 -49
  51. package/dist/src/generated/typus_stake_pool/deps/std/type_name.d.ts +9 -9
  52. package/dist/src/generated/typus_stake_pool/deps/std/type_name.js +13 -16
  53. package/dist/src/generated/typus_stake_pool/deps/sui/object.d.ts +8 -0
  54. package/dist/src/generated/typus_stake_pool/deps/sui/object.js +13 -0
  55. package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.d.ts +36 -0
  56. package/dist/src/generated/typus_stake_pool/deps/sui/vec_map.js +31 -0
  57. package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.d.ts +5 -3
  58. package/dist/src/generated/typus_stake_pool/deps/sui/vec_set.js +5 -8
  59. package/dist/src/generated/typus_stake_pool/stake_pool.d.ts +180 -79
  60. package/dist/src/generated/typus_stake_pool/stake_pool.js +446 -414
  61. package/dist/src/generated/utils/index.d.ts +4 -23
  62. package/dist/src/generated/utils/index.js +34 -54
  63. package/dist/src/index.d.ts +5 -0
  64. package/dist/src/index.js +35 -13
  65. package/dist/src/user/order.d.ts +0 -4
  66. package/dist/src/user/order.js +31 -74
  67. package/dist/src/user/orderWithBidReceipt.d.ts +0 -3
  68. package/dist/src/user/orderWithBidReceipt.js +24 -45
  69. package/dist/src/user/tlp.d.ts +0 -5
  70. package/dist/src/user/tlp.js +28 -73
  71. package/package.json +42 -40
@@ -6,18 +6,22 @@
6
6
  * creating and destructing it. This is used to handle unsettled bids from
7
7
  * liquidations.
8
8
  */
9
- import { MoveStruct, type RawTransactionArgument } from "../utils/index.js";
10
- import { type Transaction } from "@mysten/sui/transactions";
9
+ import { MoveStruct, type RawTransactionArgument } from '../utils/index';
10
+ import { type Transaction } from '@mysten/sui/transactions';
11
11
  export declare const UnsettledBidReceipt: MoveStruct<{
12
12
  /** A vector of `TypusBidReceipt` structs. */
13
13
  receipt: import("@mysten/sui/bcs", { with: { "resolution-mode": "import" } }).BcsType<{
14
- id: string;
14
+ id: {
15
+ id: string;
16
+ };
15
17
  vid: string;
16
18
  index: string;
17
19
  metadata: string;
18
20
  u64_padding: string[];
19
21
  }[], Iterable<{
20
- id: string | Uint8Array<ArrayBufferLike>;
22
+ id: {
23
+ id: string | Uint8Array<ArrayBufferLike>;
24
+ };
21
25
  vid: string | Uint8Array<ArrayBufferLike>;
22
26
  index: string | number | bigint;
23
27
  metadata: string;
@@ -90,7 +94,9 @@ export interface DestructUnsettledBidReceiptArguments {
90
94
  }
91
95
  export interface DestructUnsettledBidReceiptOptions {
92
96
  package?: string;
93
- arguments: DestructUnsettledBidReceiptArguments | [unsettledBidReceipt: RawTransactionArgument<string>];
97
+ arguments: DestructUnsettledBidReceiptArguments | [
98
+ unsettledBidReceipt: RawTransactionArgument<string>
99
+ ];
94
100
  }
95
101
  /** Destructs an `UnsettledBidReceipt` and returns its fields. */
96
102
  export declare function destructUnsettledBidReceipt(options: DestructUnsettledBidReceiptOptions): (tx: Transaction) => import("@mysten/sui/transactions", { with: { "resolution-mode": "import" } }).TransactionResult;
@@ -99,7 +105,9 @@ export interface GetBidReceiptsArguments {
99
105
  }
100
106
  export interface GetBidReceiptsOptions {
101
107
  package?: string;
102
- arguments: GetBidReceiptsArguments | [unsettledBidReceipt: RawTransactionArgument<string>];
108
+ arguments: GetBidReceiptsArguments | [
109
+ unsettledBidReceipt: RawTransactionArgument<string>
110
+ ];
103
111
  }
104
112
  /** Gets a reference to the bid receipts in an `UnsettledBidReceipt`. */
105
113
  export declare function getBidReceipts(options: GetBidReceiptsOptions): (tx: Transaction) => import("@mysten/sui/transactions", { with: { "resolution-mode": "import" } }).TransactionResult;
@@ -45,14 +45,12 @@ exports.getBidReceipts = getBidReceipts;
45
45
  * creating and destructing it. This is used to handle unsettled bids from
46
46
  * liquidations.
47
47
  */
48
- const index_js_1 = require("../utils/index.js");
48
+ const index_1 = require("../utils/index");
49
49
  const bcs_1 = require("@mysten/sui/bcs");
50
- const vault = __importStar(require("./deps/typus_framework/vault.js"));
51
- const type_name = __importStar(require("./deps/std/type_name.js"));
52
- const $moduleName = "@typus/perp::escrow";
53
- exports.UnsettledBidReceipt = new index_js_1.MoveStruct({
54
- name: `${$moduleName}::UnsettledBidReceipt`,
55
- fields: {
50
+ const vault = __importStar(require("./deps/typus_framework/vault"));
51
+ const type_name = __importStar(require("./deps/std/type_name"));
52
+ const $moduleName = '@typus/perp::escrow';
53
+ exports.UnsettledBidReceipt = new index_1.MoveStruct({ name: `${$moduleName}::UnsettledBidReceipt`, fields: {
56
54
  /** A vector of `TypusBidReceipt` structs. */
57
55
  receipt: bcs_1.bcs.vector(vault.TypusBidReceipt),
58
56
  /** The ID of the position. */
@@ -74,54 +72,57 @@ exports.UnsettledBidReceipt = new index_js_1.MoveStruct({
74
72
  /** The unrealized funding fee. */
75
73
  unrealized_funding_fee: bcs_1.bcs.u64(),
76
74
  /** The unrealized liquidator fee. */
77
- unrealized_liquidator_fee: bcs_1.bcs.u64(),
78
- },
79
- });
75
+ unrealized_liquidator_fee: bcs_1.bcs.u64()
76
+ } });
80
77
  /** Creates a new `UnsettledBidReceipt`. */
81
78
  function createUnsettledBidReceipt(options) {
82
- const packageAddress = options.package ?? "@typus/perp";
83
- const argumentsTypes = ["vector<null>", "u64", "address", "vector<null>", "bool", "u64", "u64", "u64", "bool", "u64", "u64"];
84
- const parameterNames = [
85
- "receipt",
86
- "positionId",
87
- "user",
88
- "tokenTypes",
89
- "unrealizedPnlSign",
90
- "unrealizedPnl",
91
- "unrealizedTradingFee",
92
- "unrealizedBorrowFee",
93
- "unrealizedFundingFeeSign",
94
- "unrealizedFundingFee",
95
- "unrealizedLiquidatorFee",
79
+ const packageAddress = options.package ?? '@typus/perp';
80
+ const argumentsTypes = [
81
+ 'vector<0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded::vault::TypusBidReceipt>',
82
+ 'u64',
83
+ 'address',
84
+ 'vector<0x0000000000000000000000000000000000000000000000000000000000000001::type_name::TypeName>',
85
+ 'bool',
86
+ 'u64',
87
+ 'u64',
88
+ 'u64',
89
+ 'bool',
90
+ 'u64',
91
+ 'u64'
96
92
  ];
93
+ const parameterNames = ["receipt", "positionId", "user", "tokenTypes", "unrealizedPnlSign", "unrealizedPnl", "unrealizedTradingFee", "unrealizedBorrowFee", "unrealizedFundingFeeSign", "unrealizedFundingFee", "unrealizedLiquidatorFee"];
97
94
  return (tx) => tx.moveCall({
98
95
  package: packageAddress,
99
- module: "escrow",
100
- function: "create_unsettled_bid_receipt",
101
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
96
+ module: 'escrow',
97
+ function: 'create_unsettled_bid_receipt',
98
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
102
99
  });
103
100
  }
104
101
  /** Destructs an `UnsettledBidReceipt` and returns its fields. */
105
102
  function destructUnsettledBidReceipt(options) {
106
- const packageAddress = options.package ?? "@typus/perp";
107
- const argumentsTypes = [null];
103
+ const packageAddress = options.package ?? '@typus/perp';
104
+ const argumentsTypes = [
105
+ `${packageAddress}::escrow::UnsettledBidReceipt`
106
+ ];
108
107
  const parameterNames = ["unsettledBidReceipt"];
109
108
  return (tx) => tx.moveCall({
110
109
  package: packageAddress,
111
- module: "escrow",
112
- function: "destruct_unsettled_bid_receipt",
113
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
110
+ module: 'escrow',
111
+ function: 'destruct_unsettled_bid_receipt',
112
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
114
113
  });
115
114
  }
116
115
  /** Gets a reference to the bid receipts in an `UnsettledBidReceipt`. */
117
116
  function getBidReceipts(options) {
118
- const packageAddress = options.package ?? "@typus/perp";
119
- const argumentsTypes = [null];
117
+ const packageAddress = options.package ?? '@typus/perp';
118
+ const argumentsTypes = [
119
+ `${packageAddress}::escrow::UnsettledBidReceipt`
120
+ ];
120
121
  const parameterNames = ["unsettledBidReceipt"];
121
122
  return (tx) => tx.moveCall({
122
123
  package: packageAddress,
123
- module: "escrow",
124
- function: "get_bid_receipts",
125
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
124
+ module: 'escrow',
125
+ function: 'get_bid_receipts',
126
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
126
127
  });
127
128
  }
@@ -6,7 +6,7 @@
6
6
  * protocol.
7
7
  */
8
8
  import { type Transaction } from "@mysten/sui/transactions";
9
- import { type RawTransactionArgument } from "../utils/index.js";
9
+ import { type RawTransactionArgument } from "../utils/index";
10
10
  export interface DepositScallopBasicArguments {
11
11
  balance: RawTransactionArgument<string>;
12
12
  scallopVersion: RawTransactionArgument<string>;
@@ -5,7 +5,7 @@
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.depositScallopBasic = depositScallopBasic;
7
7
  exports.withdrawScallopBasic = withdrawScallopBasic;
8
- const index_js_1 = require("../utils/index.js");
8
+ const index_1 = require("../utils/index");
9
9
  /**
10
10
  * Deposits a token into the Scallop lending protocol. WARNING: no authority check
11
11
  * inside
@@ -18,7 +18,7 @@ function depositScallopBasic(options) {
18
18
  package: packageAddress,
19
19
  module: "lending",
20
20
  function: "deposit_scallop_basic",
21
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
21
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
22
22
  typeArguments: options.typeArguments,
23
23
  });
24
24
  }
@@ -34,7 +34,7 @@ function withdrawScallopBasic(options) {
34
34
  package: packageAddress,
35
35
  module: "lending",
36
36
  function: "withdraw_scallop_basic",
37
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
37
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
38
38
  typeArguments: options.typeArguments,
39
39
  });
40
40
  }