@waterx/predict-sdk 0.1.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 (105) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +67 -0
  3. package/dist/src/account.d.ts +64 -0
  4. package/dist/src/account.js +134 -0
  5. package/dist/src/admin.d.ts +47 -0
  6. package/dist/src/admin.js +104 -0
  7. package/dist/src/bcs.d.ts +20 -0
  8. package/dist/src/bcs.js +209 -0
  9. package/dist/src/client.d.ts +60 -0
  10. package/dist/src/client.js +59 -0
  11. package/dist/src/constants.d.ts +61 -0
  12. package/dist/src/constants.js +62 -0
  13. package/dist/src/fetch.d.ts +53 -0
  14. package/dist/src/fetch.js +187 -0
  15. package/dist/src/generated/bucket_v2_framework/account.d.ts +100 -0
  16. package/dist/src/generated/bucket_v2_framework/account.js +129 -0
  17. package/dist/src/generated/bucket_v2_framework/deps/std/type_name.d.ts +6 -0
  18. package/dist/src/generated/bucket_v2_framework/deps/std/type_name.js +19 -0
  19. package/dist/src/generated/bucket_v2_framework/deps/sui/balance.d.ts +10 -0
  20. package/dist/src/generated/bucket_v2_framework/deps/sui/balance.js +14 -0
  21. package/dist/src/generated/bucket_v2_framework/deps/sui/vec_map.d.ts +36 -0
  22. package/dist/src/generated/bucket_v2_framework/deps/sui/vec_map.js +27 -0
  23. package/dist/src/generated/bucket_v2_framework/deps/sui/vec_set.d.ts +16 -0
  24. package/dist/src/generated/bucket_v2_framework/deps/sui/vec_set.js +19 -0
  25. package/dist/src/generated/bucket_v2_framework/double.d.ts +382 -0
  26. package/dist/src/generated/bucket_v2_framework/double.js +466 -0
  27. package/dist/src/generated/bucket_v2_framework/float.d.ts +362 -0
  28. package/dist/src/generated/bucket_v2_framework/float.js +440 -0
  29. package/dist/src/generated/bucket_v2_framework/liability.d.ts +193 -0
  30. package/dist/src/generated/bucket_v2_framework/liability.js +205 -0
  31. package/dist/src/generated/bucket_v2_framework/linked_table.d.ts +384 -0
  32. package/dist/src/generated/bucket_v2_framework/linked_table.js +382 -0
  33. package/dist/src/generated/bucket_v2_framework/sheet.d.ts +344 -0
  34. package/dist/src/generated/bucket_v2_framework/sheet.js +344 -0
  35. package/dist/src/generated/utils/index.d.ts +30 -0
  36. package/dist/src/generated/utils/index.js +157 -0
  37. package/dist/src/generated/waterx_account/account.d.ts +1326 -0
  38. package/dist/src/generated/waterx_account/account.js +1487 -0
  39. package/dist/src/generated/waterx_account/deps/std/type_name.d.ts +6 -0
  40. package/dist/src/generated/waterx_account/deps/std/type_name.js +19 -0
  41. package/dist/src/generated/waterx_account/deps/sui/balance.d.ts +10 -0
  42. package/dist/src/generated/waterx_account/deps/sui/balance.js +14 -0
  43. package/dist/src/generated/waterx_account/deps/sui/table.d.ts +24 -0
  44. package/dist/src/generated/waterx_account/deps/sui/table.js +31 -0
  45. package/dist/src/generated/waterx_account/deps/sui/vec_map.d.ts +36 -0
  46. package/dist/src/generated/waterx_account/deps/sui/vec_map.js +27 -0
  47. package/dist/src/generated/waterx_account/deps/sui/vec_set.d.ts +16 -0
  48. package/dist/src/generated/waterx_account/deps/sui/vec_set.js +19 -0
  49. package/dist/src/generated/waterx_account/direct_rule.d.ts +72 -0
  50. package/dist/src/generated/waterx_account/direct_rule.js +75 -0
  51. package/dist/src/generated/waterx_account/events.d.ts +30 -0
  52. package/dist/src/generated/waterx_account/events.js +145 -0
  53. package/dist/src/generated/waterx_account/version.d.ts +10 -0
  54. package/dist/src/generated/waterx_account/version.js +8 -0
  55. package/dist/src/generated/waterx_prediction/account_data.d.ts +321 -0
  56. package/dist/src/generated/waterx_prediction/account_data.js +399 -0
  57. package/dist/src/generated/waterx_prediction/admin.d.ts +5 -0
  58. package/dist/src/generated/waterx_prediction/admin.js +9 -0
  59. package/dist/src/generated/waterx_prediction/deps/bucket_v2_framework/linked_table.d.ts +8 -0
  60. package/dist/src/generated/waterx_prediction/deps/bucket_v2_framework/linked_table.js +18 -0
  61. package/dist/src/generated/waterx_prediction/deps/sui/balance.d.ts +10 -0
  62. package/dist/src/generated/waterx_prediction/deps/sui/balance.js +14 -0
  63. package/dist/src/generated/waterx_prediction/deps/sui/table.d.ts +24 -0
  64. package/dist/src/generated/waterx_prediction/deps/sui/table.js +31 -0
  65. package/dist/src/generated/waterx_prediction/deps/sui/vec_set.d.ts +16 -0
  66. package/dist/src/generated/waterx_prediction/deps/sui/vec_set.js +19 -0
  67. package/dist/src/generated/waterx_prediction/events.d.ts +19 -0
  68. package/dist/src/generated/waterx_prediction/events.js +99 -0
  69. package/dist/src/generated/waterx_prediction/global_config.d.ts +68 -0
  70. package/dist/src/generated/waterx_prediction/global_config.js +83 -0
  71. package/dist/src/generated/waterx_prediction/order.d.ts +170 -0
  72. package/dist/src/generated/waterx_prediction/order.js +237 -0
  73. package/dist/src/generated/waterx_prediction/outcome.d.ts +58 -0
  74. package/dist/src/generated/waterx_prediction/outcome.js +73 -0
  75. package/dist/src/generated/waterx_prediction/position.d.ts +150 -0
  76. package/dist/src/generated/waterx_prediction/position.js +200 -0
  77. package/dist/src/generated/waterx_prediction/view.d.ts +353 -0
  78. package/dist/src/generated/waterx_prediction/view.js +426 -0
  79. package/dist/src/generated/waterx_prediction/waterx_prediction.d.ts +1520 -0
  80. package/dist/src/generated/waterx_prediction/waterx_prediction.js +1550 -0
  81. package/dist/src/index.d.ts +22 -0
  82. package/dist/src/index.js +17 -0
  83. package/dist/src/prediction.d.ts +81 -0
  84. package/dist/src/prediction.js +220 -0
  85. package/dist/src/types.d.ts +81 -0
  86. package/dist/src/types.js +1 -0
  87. package/dist/src/user/account.d.ts +2 -0
  88. package/dist/src/user/account.js +1 -0
  89. package/dist/src/user/admin.d.ts +4 -0
  90. package/dist/src/user/admin.js +2 -0
  91. package/dist/src/user/index.d.ts +4 -0
  92. package/dist/src/user/index.js +2 -0
  93. package/dist/src/user/keeper.d.ts +2 -0
  94. package/dist/src/user/keeper.js +1 -0
  95. package/dist/src/user/order.d.ts +2 -0
  96. package/dist/src/user/order.js +1 -0
  97. package/dist/src/user/position.d.ts +2 -0
  98. package/dist/src/user/position.js +1 -0
  99. package/dist/src/utils/bcs.d.ts +1 -0
  100. package/dist/src/utils/bcs.js +1 -0
  101. package/dist/src/utils/index.d.ts +1 -0
  102. package/dist/src/utils/index.js +1 -0
  103. package/dist/src/utils.d.ts +29 -0
  104. package/dist/src/utils.js +170 -0
  105. package/package.json +62 -0
@@ -0,0 +1,382 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ import { bcs } from '@mysten/sui/bcs';
5
+ import { MoveStruct, normalizeMoveArguments } from "../utils/index.js";
6
+ const $moduleName = '@bucket/framework::linked_table';
7
+ export function LinkedTable(...typeParameters) {
8
+ return new MoveStruct({ name: `${$moduleName}::LinkedTable<${typeParameters[0].name}, phantom V>`, fields: {
9
+ /** the ID of this table */
10
+ id: bcs.Address,
11
+ /** the number of key-value pairs in the table */
12
+ size: bcs.u64(),
13
+ /** the front of the table, i.e. the key of the first entry */
14
+ head: bcs.option(typeParameters[0]),
15
+ /** the back of the table, i.e. the key of the last entry */
16
+ tail: bcs.option(typeParameters[0])
17
+ } });
18
+ }
19
+ export function Node(...typeParameters) {
20
+ return new MoveStruct({ name: `${$moduleName}::Node<${typeParameters[0].name}, ${typeParameters[1].name}>`, fields: {
21
+ /** the previous key */
22
+ prev: bcs.option(typeParameters[0]),
23
+ /** the next key */
24
+ next: bcs.option(typeParameters[0]),
25
+ /** the value being stored */
26
+ value: typeParameters[1]
27
+ } });
28
+ }
29
+ /** Creates a new, empty table */
30
+ export function _new(options) {
31
+ const packageAddress = options.package ?? '@bucket/framework';
32
+ return (tx) => tx.moveCall({
33
+ package: packageAddress,
34
+ module: 'linked_table',
35
+ function: 'new',
36
+ typeArguments: options.typeArguments
37
+ });
38
+ }
39
+ /**
40
+ * Returns the key for the first element in the table, or None if the table is
41
+ * empty
42
+ */
43
+ export function front(options) {
44
+ const packageAddress = options.package ?? '@bucket/framework';
45
+ const argumentsTypes = [
46
+ null
47
+ ];
48
+ const parameterNames = ["table"];
49
+ return (tx) => tx.moveCall({
50
+ package: packageAddress,
51
+ module: 'linked_table',
52
+ function: 'front',
53
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
54
+ typeArguments: options.typeArguments
55
+ });
56
+ }
57
+ /** Returns the key for the last element in the table, or None if the table is empty */
58
+ export function back(options) {
59
+ const packageAddress = options.package ?? '@bucket/framework';
60
+ const argumentsTypes = [
61
+ null
62
+ ];
63
+ const parameterNames = ["table"];
64
+ return (tx) => tx.moveCall({
65
+ package: packageAddress,
66
+ module: 'linked_table',
67
+ function: 'back',
68
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
69
+ typeArguments: options.typeArguments
70
+ });
71
+ }
72
+ /**
73
+ * Inserts a key-value pair at the front of the table, i.e. the newly inserted pair
74
+ * will be the first element in the table Aborts with
75
+ * `sui::dynamic_df::EFieldAlreadyExists` if the table already has an entry with
76
+ * that key `k: K`.
77
+ */
78
+ export function pushFront(options) {
79
+ const packageAddress = options.package ?? '@bucket/framework';
80
+ const argumentsTypes = [
81
+ null,
82
+ `${options.typeArguments[0]}`,
83
+ `${options.typeArguments[1]}`
84
+ ];
85
+ const parameterNames = ["table", "k", "value"];
86
+ return (tx) => tx.moveCall({
87
+ package: packageAddress,
88
+ module: 'linked_table',
89
+ function: 'push_front',
90
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
91
+ typeArguments: options.typeArguments
92
+ });
93
+ }
94
+ /**
95
+ * Inserts a key-value pair at the back of the table, i.e. the newly inserted pair
96
+ * will be the last element in the table Aborts with
97
+ * `sui::dynamic_df::EFieldAlreadyExists` if the table already has an entry with
98
+ * that key `k: K`.
99
+ */
100
+ export function pushBack(options) {
101
+ const packageAddress = options.package ?? '@bucket/framework';
102
+ const argumentsTypes = [
103
+ null,
104
+ `${options.typeArguments[0]}`,
105
+ `${options.typeArguments[1]}`
106
+ ];
107
+ const parameterNames = ["table", "k", "value"];
108
+ return (tx) => tx.moveCall({
109
+ package: packageAddress,
110
+ module: 'linked_table',
111
+ function: 'push_back',
112
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
113
+ typeArguments: options.typeArguments
114
+ });
115
+ }
116
+ /**
117
+ * Immutable borrows the value associated with the key in the table
118
+ * `table: &LinkedTable<K, V>`. Aborts with `sui::dynamic_df::EFieldDoesNotExist`
119
+ * if the table does not have an entry with that key `k: K`.
120
+ */
121
+ export function borrow(options) {
122
+ const packageAddress = options.package ?? '@bucket/framework';
123
+ const argumentsTypes = [
124
+ null,
125
+ `${options.typeArguments[0]}`
126
+ ];
127
+ const parameterNames = ["table", "k"];
128
+ return (tx) => tx.moveCall({
129
+ package: packageAddress,
130
+ module: 'linked_table',
131
+ function: 'borrow',
132
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
133
+ typeArguments: options.typeArguments
134
+ });
135
+ }
136
+ /**
137
+ * Mutably borrows the value associated with the key in the table
138
+ * `table: &mut LinkedTable<K, V>`. Aborts with
139
+ * `sui::dynamic_df::EFieldDoesNotExist` if the table does not have an entry with
140
+ * that key `k: K`.
141
+ */
142
+ export function borrowMut(options) {
143
+ const packageAddress = options.package ?? '@bucket/framework';
144
+ const argumentsTypes = [
145
+ null,
146
+ `${options.typeArguments[0]}`
147
+ ];
148
+ const parameterNames = ["table", "k"];
149
+ return (tx) => tx.moveCall({
150
+ package: packageAddress,
151
+ module: 'linked_table',
152
+ function: 'borrow_mut',
153
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
154
+ typeArguments: options.typeArguments
155
+ });
156
+ }
157
+ /**
158
+ * Borrows the key for the previous entry of the specified key `k: K` in the table
159
+ * `table: &LinkedTable<K, V>`. Returns None if the entry does not have a
160
+ * predecessor. Aborts with `sui::dynamic_df::EFieldDoesNotExist` if the table does
161
+ * not have an entry with that key `k: K`
162
+ */
163
+ export function prev(options) {
164
+ const packageAddress = options.package ?? '@bucket/framework';
165
+ const argumentsTypes = [
166
+ null,
167
+ `${options.typeArguments[0]}`
168
+ ];
169
+ const parameterNames = ["table", "k"];
170
+ return (tx) => tx.moveCall({
171
+ package: packageAddress,
172
+ module: 'linked_table',
173
+ function: 'prev',
174
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
175
+ typeArguments: options.typeArguments
176
+ });
177
+ }
178
+ /**
179
+ * Borrows the key for the next entry of the specified key `k: K` in the table
180
+ * `table: &LinkedTable<K, V>`. Returns None if the entry does not have a
181
+ * predecessor. Aborts with `sui::dynamic_df::EFieldDoesNotExist` if the table does
182
+ * not have an entry with that key `k: K`
183
+ */
184
+ export function next(options) {
185
+ const packageAddress = options.package ?? '@bucket/framework';
186
+ const argumentsTypes = [
187
+ null,
188
+ `${options.typeArguments[0]}`
189
+ ];
190
+ const parameterNames = ["table", "k"];
191
+ return (tx) => tx.moveCall({
192
+ package: packageAddress,
193
+ module: 'linked_table',
194
+ function: 'next',
195
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
196
+ typeArguments: options.typeArguments
197
+ });
198
+ }
199
+ /**
200
+ * Removes the key-value pair in the table `table: &mut LinkedTable<K, V>` and
201
+ * returns the value. This splices the element out of the ordering. Aborts with
202
+ * `sui::dynamic_df::EFieldDoesNotExist` if the table does not have an entry with
203
+ * that key `k: K`. Note: this is also what happens when the table is empty.
204
+ */
205
+ export function remove(options) {
206
+ const packageAddress = options.package ?? '@bucket/framework';
207
+ const argumentsTypes = [
208
+ null,
209
+ `${options.typeArguments[0]}`
210
+ ];
211
+ const parameterNames = ["table", "k"];
212
+ return (tx) => tx.moveCall({
213
+ package: packageAddress,
214
+ module: 'linked_table',
215
+ function: 'remove',
216
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
217
+ typeArguments: options.typeArguments
218
+ });
219
+ }
220
+ /**
221
+ * Removes the front of the table `table: &mut LinkedTable<K, V>` and returns the
222
+ * value. Aborts with `ETableIsEmpty` if the table is empty
223
+ */
224
+ export function popFront(options) {
225
+ const packageAddress = options.package ?? '@bucket/framework';
226
+ const argumentsTypes = [
227
+ null
228
+ ];
229
+ const parameterNames = ["table"];
230
+ return (tx) => tx.moveCall({
231
+ package: packageAddress,
232
+ module: 'linked_table',
233
+ function: 'pop_front',
234
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
235
+ typeArguments: options.typeArguments
236
+ });
237
+ }
238
+ /**
239
+ * Removes the back of the table `table: &mut LinkedTable<K, V>` and returns the
240
+ * value. Aborts with `ETableIsEmpty` if the table is empty
241
+ */
242
+ export function popBack(options) {
243
+ const packageAddress = options.package ?? '@bucket/framework';
244
+ const argumentsTypes = [
245
+ null
246
+ ];
247
+ const parameterNames = ["table"];
248
+ return (tx) => tx.moveCall({
249
+ package: packageAddress,
250
+ module: 'linked_table',
251
+ function: 'pop_back',
252
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
253
+ typeArguments: options.typeArguments
254
+ });
255
+ }
256
+ /**
257
+ * Returns true iff there is a value associated with the key `k: K` in table
258
+ * `table: &LinkedTable<K, V>`
259
+ */
260
+ export function contains(options) {
261
+ const packageAddress = options.package ?? '@bucket/framework';
262
+ const argumentsTypes = [
263
+ null,
264
+ `${options.typeArguments[0]}`
265
+ ];
266
+ const parameterNames = ["table", "k"];
267
+ return (tx) => tx.moveCall({
268
+ package: packageAddress,
269
+ module: 'linked_table',
270
+ function: 'contains',
271
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
272
+ typeArguments: options.typeArguments
273
+ });
274
+ }
275
+ /** Returns the size of the table, the number of key-value pairs */
276
+ export function length(options) {
277
+ const packageAddress = options.package ?? '@bucket/framework';
278
+ const argumentsTypes = [
279
+ null
280
+ ];
281
+ const parameterNames = ["table"];
282
+ return (tx) => tx.moveCall({
283
+ package: packageAddress,
284
+ module: 'linked_table',
285
+ function: 'length',
286
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
287
+ typeArguments: options.typeArguments
288
+ });
289
+ }
290
+ /** Returns true iff the table is empty (if `length` returns `0`) */
291
+ export function isEmpty(options) {
292
+ const packageAddress = options.package ?? '@bucket/framework';
293
+ const argumentsTypes = [
294
+ null
295
+ ];
296
+ const parameterNames = ["table"];
297
+ return (tx) => tx.moveCall({
298
+ package: packageAddress,
299
+ module: 'linked_table',
300
+ function: 'is_empty',
301
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
302
+ typeArguments: options.typeArguments
303
+ });
304
+ }
305
+ /**
306
+ * Destroys an empty table Aborts with `ETableNotEmpty` if the table still contains
307
+ * values
308
+ */
309
+ export function destroyEmpty(options) {
310
+ const packageAddress = options.package ?? '@bucket/framework';
311
+ const argumentsTypes = [
312
+ null
313
+ ];
314
+ const parameterNames = ["table"];
315
+ return (tx) => tx.moveCall({
316
+ package: packageAddress,
317
+ module: 'linked_table',
318
+ function: 'destroy_empty',
319
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
320
+ typeArguments: options.typeArguments
321
+ });
322
+ }
323
+ /**
324
+ * Drop a possibly non-empty table. Usable only if the value type `V` has the
325
+ * `drop` ability
326
+ */
327
+ export function drop(options) {
328
+ const packageAddress = options.package ?? '@bucket/framework';
329
+ const argumentsTypes = [
330
+ null
331
+ ];
332
+ const parameterNames = ["table"];
333
+ return (tx) => tx.moveCall({
334
+ package: packageAddress,
335
+ module: 'linked_table',
336
+ function: 'drop',
337
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
338
+ typeArguments: options.typeArguments
339
+ });
340
+ }
341
+ /**
342
+ * Insert a key-value pair in front of the given key If the given key is none, then
343
+ * set the key-value pair as back
344
+ */
345
+ export function insertFront(options) {
346
+ const packageAddress = options.package ?? '@bucket/framework';
347
+ const argumentsTypes = [
348
+ null,
349
+ `0x1::option::Option<${options.typeArguments[0]}>`,
350
+ `${options.typeArguments[0]}`,
351
+ `${options.typeArguments[1]}`
352
+ ];
353
+ const parameterNames = ["table", "nextK", "k", "value"];
354
+ return (tx) => tx.moveCall({
355
+ package: packageAddress,
356
+ module: 'linked_table',
357
+ function: 'insert_front',
358
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
359
+ typeArguments: options.typeArguments
360
+ });
361
+ }
362
+ /**
363
+ * Insert a key-value pair behind the given key If the given key is none, then set
364
+ * the key-value pair as front
365
+ */
366
+ export function insertBack(options) {
367
+ const packageAddress = options.package ?? '@bucket/framework';
368
+ const argumentsTypes = [
369
+ null,
370
+ `0x1::option::Option<${options.typeArguments[0]}>`,
371
+ `${options.typeArguments[0]}`,
372
+ `${options.typeArguments[1]}`
373
+ ];
374
+ const parameterNames = ["table", "prevK", "k", "value"];
375
+ return (tx) => tx.moveCall({
376
+ package: packageAddress,
377
+ module: 'linked_table',
378
+ function: 'insert_back',
379
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
380
+ typeArguments: options.typeArguments
381
+ });
382
+ }