@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
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.Version = void 0;
39
+ exports.ProtocolFeeEvent = exports.SendFeeEvent = exports.Version = exports.FeePool = exports.FeeInfo = void 0;
40
40
  exports.versionCheck = versionCheck;
41
41
  exports.upgrade = upgrade;
42
42
  exports.init = init;
@@ -45,93 +45,133 @@ exports.addAuthorizedUser = addAuthorizedUser;
45
45
  exports.removeAuthorizedUser = removeAuthorizedUser;
46
46
  exports.installEcosystemManagerCapEntry = installEcosystemManagerCapEntry;
47
47
  exports.addTailsExpAmount = addTailsExpAmount;
48
+ exports.sendFee = sendFee;
49
+ exports.chargeFee = chargeFee;
48
50
  /**
49
51
  * The `admin` module provides administrative functionalities for the Typus Stake
50
52
  * Pool. It includes version management, authority control, and fee handling.
51
53
  */
52
- const index_js_1 = require("../utils/index.js");
54
+ const index_1 = require("../utils/index");
53
55
  const bcs_1 = require("@mysten/sui/bcs");
54
- const vec_set = __importStar(require("./deps/sui/vec_set.js"));
55
- const $moduleName = "@typus/stake-pool::admin";
56
- exports.Version = new index_js_1.MoveStruct({
57
- name: `${$moduleName}::Version`,
58
- fields: {
59
- id: bcs_1.bcs.Address,
56
+ const type_name = __importStar(require("./deps/std/type_name"));
57
+ const object = __importStar(require("./deps/sui/object"));
58
+ const vec_set = __importStar(require("./deps/sui/vec_set"));
59
+ const $moduleName = '@typus/stake-pool::admin';
60
+ exports.FeeInfo = new index_1.MoveStruct({ name: `${$moduleName}::FeeInfo`, fields: {
61
+ /** The type name of the token. */
62
+ token: type_name.TypeName,
63
+ /** The amount of fees collected. */
64
+ value: bcs_1.bcs.u64()
65
+ } });
66
+ exports.FeePool = new index_1.MoveStruct({ name: `${$moduleName}::FeePool`, fields: {
67
+ id: object.UID,
68
+ /** A vector of `FeeInfo` structs. */
69
+ fee_infos: bcs_1.bcs.vector(exports.FeeInfo)
70
+ } });
71
+ exports.Version = new index_1.MoveStruct({ name: `${$moduleName}::Version`, fields: {
72
+ id: object.UID,
60
73
  /** The version number. */
61
74
  value: bcs_1.bcs.u64(),
75
+ /** The fee pool for protocol fees. */
76
+ fee_pool: exports.FeePool,
77
+ /** The fee pool for liquidator fees. */
78
+ liquidator_fee_pool: exports.FeePool,
62
79
  /** The list of authorized addresses. */
63
80
  authority: vec_set.VecSet(bcs_1.bcs.Address),
64
81
  /** Padding for future use. */
65
- u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64()),
66
- },
67
- });
82
+ u64_padding: bcs_1.bcs.vector(bcs_1.bcs.u64())
83
+ } });
84
+ exports.SendFeeEvent = new index_1.MoveStruct({ name: `${$moduleName}::SendFeeEvent`, fields: {
85
+ /** The type name of the token. */
86
+ token: type_name.TypeName,
87
+ /** The amount of fees sent. */
88
+ amount: bcs_1.bcs.u64()
89
+ } });
90
+ exports.ProtocolFeeEvent = new index_1.MoveStruct({ name: `${$moduleName}::ProtocolFeeEvent`, fields: {
91
+ /** The type name of the token. */
92
+ token: type_name.TypeName,
93
+ /** The amount of fees charged. */
94
+ amount: bcs_1.bcs.u64()
95
+ } });
68
96
  /** Checks if the contract version is valid. */
69
97
  function versionCheck(options) {
70
- const packageAddress = options.package ?? "@typus/stake-pool";
71
- const argumentsTypes = [null];
98
+ const packageAddress = options.package ?? '@typus/stake-pool';
99
+ const argumentsTypes = [
100
+ `${packageAddress}::admin::Version`
101
+ ];
72
102
  const parameterNames = ["version"];
73
103
  return (tx) => tx.moveCall({
74
104
  package: packageAddress,
75
- module: "admin",
76
- function: "version_check",
77
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
105
+ module: 'admin',
106
+ function: 'version_check',
107
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
78
108
  });
79
109
  }
80
110
  /** Upgrades the contract version. WARNING: no authority check inside */
81
111
  function upgrade(options) {
82
- const packageAddress = options.package ?? "@typus/stake-pool";
83
- const argumentsTypes = [null];
112
+ const packageAddress = options.package ?? '@typus/stake-pool';
113
+ const argumentsTypes = [
114
+ `${packageAddress}::admin::Version`
115
+ ];
84
116
  const parameterNames = ["version"];
85
117
  return (tx) => tx.moveCall({
86
118
  package: packageAddress,
87
- module: "admin",
88
- function: "upgrade",
89
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
119
+ module: 'admin',
120
+ function: 'upgrade',
121
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
90
122
  });
91
123
  }
92
124
  /** Initializes the contract. */
93
125
  function init(options = {}) {
94
- const packageAddress = options.package ?? "@typus/stake-pool";
126
+ const packageAddress = options.package ?? '@typus/stake-pool';
95
127
  return (tx) => tx.moveCall({
96
128
  package: packageAddress,
97
- module: "admin",
98
- function: "init",
129
+ module: 'admin',
130
+ function: 'init',
99
131
  });
100
132
  }
101
133
  /** [Authorized Function] Verifies if the sender is an authorized user. */
102
134
  function verify(options) {
103
- const packageAddress = options.package ?? "@typus/stake-pool";
104
- const argumentsTypes = [null];
135
+ const packageAddress = options.package ?? '@typus/stake-pool';
136
+ const argumentsTypes = [
137
+ `${packageAddress}::admin::Version`
138
+ ];
105
139
  const parameterNames = ["version"];
106
140
  return (tx) => tx.moveCall({
107
141
  package: packageAddress,
108
- module: "admin",
109
- function: "verify",
110
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
142
+ module: 'admin',
143
+ function: 'verify',
144
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
111
145
  });
112
146
  }
113
147
  /** [Authorized Function] Adds an authorized user. */
114
148
  function addAuthorizedUser(options) {
115
- const packageAddress = options.package ?? "@typus/stake-pool";
116
- const argumentsTypes = [null, "address"];
149
+ const packageAddress = options.package ?? '@typus/stake-pool';
150
+ const argumentsTypes = [
151
+ `${packageAddress}::admin::Version`,
152
+ 'address'
153
+ ];
117
154
  const parameterNames = ["version", "userAddress"];
118
155
  return (tx) => tx.moveCall({
119
156
  package: packageAddress,
120
- module: "admin",
121
- function: "add_authorized_user",
122
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
157
+ module: 'admin',
158
+ function: 'add_authorized_user',
159
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
123
160
  });
124
161
  }
125
162
  /** [Authorized Function] Removes an authorized user. */
126
163
  function removeAuthorizedUser(options) {
127
- const packageAddress = options.package ?? "@typus/stake-pool";
128
- const argumentsTypes = [null, "address"];
164
+ const packageAddress = options.package ?? '@typus/stake-pool';
165
+ const argumentsTypes = [
166
+ `${packageAddress}::admin::Version`,
167
+ 'address'
168
+ ];
129
169
  const parameterNames = ["version", "userAddress"];
130
170
  return (tx) => tx.moveCall({
131
171
  package: packageAddress,
132
- module: "admin",
133
- function: "remove_authorized_user",
134
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
172
+ module: 'admin',
173
+ function: 'remove_authorized_user',
174
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
135
175
  });
136
176
  }
137
177
  /**
@@ -139,25 +179,68 @@ function removeAuthorizedUser(options) {
139
179
  * after install
140
180
  */
141
181
  function installEcosystemManagerCapEntry(options) {
142
- const packageAddress = options.package ?? "@typus/stake-pool";
143
- const argumentsTypes = [null, null];
182
+ const packageAddress = options.package ?? '@typus/stake-pool';
183
+ const argumentsTypes = [
184
+ `${packageAddress}::admin::Version`,
185
+ '0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277::ecosystem::Version'
186
+ ];
144
187
  const parameterNames = ["version", "typusEcosystemVersion"];
145
188
  return (tx) => tx.moveCall({
146
189
  package: packageAddress,
147
- module: "admin",
148
- function: "install_ecosystem_manager_cap_entry",
149
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
190
+ module: 'admin',
191
+ function: 'install_ecosystem_manager_cap_entry',
192
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
150
193
  });
151
194
  }
152
195
  /** Adds tails experience points to a user. */
153
196
  function addTailsExpAmount(options) {
154
- const packageAddress = options.package ?? "@typus/stake-pool";
155
- const argumentsTypes = [null, null, null, "address", "u64"];
197
+ const packageAddress = options.package ?? '@typus/stake-pool';
198
+ const argumentsTypes = [
199
+ `${packageAddress}::admin::Version`,
200
+ '0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277::ecosystem::Version',
201
+ '0x4213e12a2220f15f1837a76897110d2260786558169bd8d0847f21e9b551f277::user::TypusUserRegistry',
202
+ 'address',
203
+ 'u64'
204
+ ];
156
205
  const parameterNames = ["version", "typusEcosystemVersion", "typusUserRegistry", "user", "amount"];
157
206
  return (tx) => tx.moveCall({
158
207
  package: packageAddress,
159
- module: "admin",
160
- function: "add_tails_exp_amount",
161
- arguments: (0, index_js_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
208
+ module: 'admin',
209
+ function: 'add_tails_exp_amount',
210
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
211
+ });
212
+ }
213
+ /**
214
+ * Sends the collected fees to the fee address. Safe with constant address as
215
+ * receiver
216
+ */
217
+ function sendFee(options) {
218
+ const packageAddress = options.package ?? '@typus/stake-pool';
219
+ const argumentsTypes = [
220
+ `${packageAddress}::admin::Version`
221
+ ];
222
+ const parameterNames = ["version"];
223
+ return (tx) => tx.moveCall({
224
+ package: packageAddress,
225
+ module: 'admin',
226
+ function: 'send_fee',
227
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
228
+ typeArguments: options.typeArguments
229
+ });
230
+ }
231
+ /** Charges a protocol fee. */
232
+ function chargeFee(options) {
233
+ const packageAddress = options.package ?? '@typus/stake-pool';
234
+ const argumentsTypes = [
235
+ `${packageAddress}::admin::Version`,
236
+ `0x0000000000000000000000000000000000000000000000000000000000000002::balance::Balance<${options.typeArguments[0]}>`
237
+ ];
238
+ const parameterNames = ["version", "balance"];
239
+ return (tx) => tx.moveCall({
240
+ package: packageAddress,
241
+ module: 'admin',
242
+ function: 'charge_fee',
243
+ arguments: (0, index_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
244
+ typeArguments: options.typeArguments
162
245
  });
163
246
  }
@@ -2,16 +2,16 @@
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";
5
+ import { MoveStruct } from '../../../utils/index';
6
6
  export declare const TypeName: MoveStruct<{
7
7
  /**
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
- */
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
+ */
16
16
  name: import("@mysten/sui/bcs", { with: { "resolution-mode": "import" } }).BcsType<string, string, "string">;
17
17
  }, "std::type_name::TypeName">;
@@ -5,21 +5,18 @@
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.TypeName = void 0;
7
7
  /** Functionality for converting Move types into values. Use with care! */
8
- const index_js_1 = require("../../../utils/index.js");
8
+ const index_1 = require("../../../utils/index");
9
9
  const bcs_1 = require("@mysten/sui/bcs");
10
- const $moduleName = "std::type_name";
11
- exports.TypeName = new index_js_1.MoveStruct({
12
- name: `${$moduleName}::TypeName`,
13
- fields: {
10
+ const $moduleName = 'std::type_name';
11
+ exports.TypeName = new index_1.MoveStruct({ name: `${$moduleName}::TypeName`, fields: {
14
12
  /**
15
- * String representation of the type. All types are represented using their source
16
- * syntax: "u8", "u64", "bool", "address", "vector", and so on for primitive types.
17
- * Struct types are represented as fully qualified type names; e.g.
18
- * `00000000000000000000000000000001::string::String` or
19
- * `0000000000000000000000000000000a::module_name1::type_name1<0000000000000000000000000000000a::module_name2::type_name2<u64>>`
20
- * Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or
21
- * 32 depending on the Move platform)
22
- */
23
- name: bcs_1.bcs.string(),
24
- },
25
- });
13
+ * String representation of the type. All types are represented using their source
14
+ * syntax: "u8", "u64", "bool", "address", "vector", and so on for primitive types.
15
+ * Struct types are represented as fully qualified type names; e.g.
16
+ * `00000000000000000000000000000001::string::String` or
17
+ * `0000000000000000000000000000000a::module_name1::type_name1<0000000000000000000000000000000a::module_name2::type_name2<u64>>`
18
+ * Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or
19
+ * 32 depending on the Move platform)
20
+ */
21
+ name: bcs_1.bcs.string()
22
+ } });
@@ -0,0 +1,8 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ /** Sui object identifiers */
5
+ import { MoveStruct } from '../../../utils/index';
6
+ export declare const UID: MoveStruct<{
7
+ id: import("@mysten/sui/bcs", { with: { "resolution-mode": "import" } }).BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
8
+ }, "0x2::object::UID">;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /**************************************************************
3
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
4
+ **************************************************************/
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.UID = void 0;
7
+ /** Sui object identifiers */
8
+ const index_1 = require("../../../utils/index");
9
+ const bcs_1 = require("@mysten/sui/bcs");
10
+ const $moduleName = '0x2::object';
11
+ exports.UID = new index_1.MoveStruct({ name: `${$moduleName}::UID`, fields: {
12
+ id: bcs_1.bcs.Address
13
+ } });
@@ -0,0 +1,36 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ import { type BcsType } from '@mysten/sui/bcs';
5
+ import { MoveStruct } from '../../../utils/index';
6
+ /** An entry in the map */
7
+ export declare function Entry<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [
8
+ K,
9
+ V
10
+ ]): MoveStruct<{
11
+ key: K;
12
+ value: V;
13
+ }, `0x2::vec_map::Entry<${K["name"]}, ${V["name"]}>`>;
14
+ /**
15
+ * A map data structure backed by a vector. The map is guaranteed not to contain
16
+ * duplicate keys, but entries are _not_ sorted by key--entries are included in
17
+ * insertion order. All operations are O(N) in the size of the map--the intention
18
+ * of this data structure is only to provide the convenience of programming against
19
+ * a map API. Large maps should use handwritten parent/child relationships instead.
20
+ * Maps that need sorted iteration rather than insertion order iteration should
21
+ * also be handwritten.
22
+ */
23
+ export declare function VecMap<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [
24
+ K,
25
+ V
26
+ ]): MoveStruct<{
27
+ contents: BcsType<{
28
+ key: K extends BcsType<infer U, any, string> ? U : never;
29
+ value: V extends BcsType<infer U, any, string> ? U : never;
30
+ }[], Iterable<{
31
+ key: K extends BcsType<any, infer U_1, string> ? U_1 : never;
32
+ value: V extends BcsType<any, infer U_1, string> ? U_1 : never;
33
+ }> & {
34
+ length: number;
35
+ }, string>;
36
+ }, `0x2::vec_map::VecMap<${K["name"]}, ${V["name"]}>`>;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Entry = Entry;
4
+ exports.VecMap = VecMap;
5
+ /**************************************************************
6
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
7
+ **************************************************************/
8
+ const bcs_1 = require("@mysten/sui/bcs");
9
+ const index_1 = require("../../../utils/index");
10
+ const $moduleName = '0x2::vec_map';
11
+ /** An entry in the map */
12
+ function Entry(...typeParameters) {
13
+ return new index_1.MoveStruct({ name: `${$moduleName}::Entry<${typeParameters[0].name}, ${typeParameters[1].name}>`, fields: {
14
+ key: typeParameters[0],
15
+ value: typeParameters[1]
16
+ } });
17
+ }
18
+ /**
19
+ * A map data structure backed by a vector. The map is guaranteed not to contain
20
+ * duplicate keys, but entries are _not_ sorted by key--entries are included in
21
+ * insertion order. All operations are O(N) in the size of the map--the intention
22
+ * of this data structure is only to provide the convenience of programming against
23
+ * a map API. Large maps should use handwritten parent/child relationships instead.
24
+ * Maps that need sorted iteration rather than insertion order iteration should
25
+ * also be handwritten.
26
+ */
27
+ function VecMap(...typeParameters) {
28
+ return new index_1.MoveStruct({ name: `${$moduleName}::VecMap<${typeParameters[0].name}, ${typeParameters[1].name}>`, fields: {
29
+ contents: bcs_1.bcs.vector(Entry(typeParameters[0], typeParameters[1]))
30
+ } });
31
+ }
@@ -1,8 +1,8 @@
1
1
  /**************************************************************
2
2
  * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
3
  **************************************************************/
4
- import { type BcsType } from "@mysten/sui/bcs";
5
- import { MoveStruct } from "../../../utils/index.js";
4
+ import { type BcsType } from '@mysten/sui/bcs';
5
+ import { MoveStruct } from '../../../utils/index';
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,7 +11,9 @@ 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: [K]): MoveStruct<{
14
+ export declare function VecSet<K extends BcsType<any>>(...typeParameters: [
15
+ K
16
+ ]): MoveStruct<{
15
17
  contents: BcsType<import("@mysten/bcs", { with: { "resolution-mode": "import" } }).InferBcsType<K>[], Iterable<import("@mysten/bcs", { with: { "resolution-mode": "import" } }).InferBcsInput<K>> & {
16
18
  length: number;
17
19
  }, string>;
@@ -5,8 +5,8 @@ exports.VecSet = VecSet;
5
5
  * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
6
6
  **************************************************************/
7
7
  const bcs_1 = require("@mysten/sui/bcs");
8
- const index_js_1 = require("../../../utils/index.js");
9
- const $moduleName = "0x2::vec_set";
8
+ const index_1 = require("../../../utils/index");
9
+ const $moduleName = '0x2::vec_set';
10
10
  /**
11
11
  * A set data structure backed by a vector. The set is guaranteed not to contain
12
12
  * duplicate keys. All operations are O(N) in the size of the set
@@ -16,10 +16,7 @@ const $moduleName = "0x2::vec_set";
16
16
  * insertion order iteration should be handwritten.
17
17
  */
18
18
  function VecSet(...typeParameters) {
19
- return new index_js_1.MoveStruct({
20
- name: `${$moduleName}::VecSet<${typeParameters[0].name}>`,
21
- fields: {
22
- contents: bcs_1.bcs.vector(typeParameters[0]),
23
- },
24
- });
19
+ return new index_1.MoveStruct({ name: `${$moduleName}::VecSet<${typeParameters[0].name}>`, fields: {
20
+ contents: bcs_1.bcs.vector(typeParameters[0])
21
+ } });
25
22
  }