@gmsol-labs/gmsol-sdk 0.5.0-alpha.14 → 0.5.0-alpha.15

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.
package/index.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Get default [`StoreProgram`].
5
+ */
6
+ export function default_store_program(): StoreProgram;
3
7
  /**
4
8
  * Build transactions for creating orders.
5
9
  */
@@ -7,7 +11,11 @@ export function create_orders(kind: CreateOrderKind, orders: CreateOrderParams[]
7
11
  /**
8
12
  * Build transactions for closing orders.
9
13
  */
10
- export function close_orders(params: CloseOrderParams): TransactionGroup;
14
+ export function close_orders(args: CloseOrderArgs): TransactionGroup;
15
+ /**
16
+ * Build transactions for updating orders.
17
+ */
18
+ export function update_orders(args: UpdateOrderArgs): TransactionGroup;
11
19
  /**
12
20
  * Apply `factor` to the `value`.
13
21
  */
@@ -86,7 +94,7 @@ export interface CreateOrderOptions {
86
94
  /**
87
95
  * Parameters for closing orders.
88
96
  */
89
- export interface CloseOrderParams {
97
+ export interface CloseOrderArgs {
90
98
  recent_blockhash: string;
91
99
  payer: StringPubkey;
92
100
  orders: Map<StringPubkey, CloseOrderHint>;
@@ -94,6 +102,22 @@ export interface CloseOrderParams {
94
102
  transaction_group?: TransactionGroupOptions;
95
103
  }
96
104
 
105
+ export interface UpdateParams {
106
+ params: UpdateOrderParams;
107
+ hint: UpdateOrderHint;
108
+ }
109
+
110
+ /**
111
+ * Parameters for updating orders.
112
+ */
113
+ export interface UpdateOrderArgs {
114
+ recent_blockhash: string;
115
+ payer: StringPubkey;
116
+ orders: Map<StringPubkey, UpdateParams>;
117
+ program?: StoreProgram | undefined;
118
+ transaction_group?: TransactionGroupOptions;
119
+ }
120
+
97
121
  /**
98
122
  * A JS version transaction group options.
99
123
  */
@@ -334,6 +358,64 @@ export interface Value {
334
358
  max: bigint;
335
359
  }
336
360
 
361
+ /**
362
+ * Hint for [`UpdateOrder`].
363
+ */
364
+ export interface UpdateOrderHint {
365
+ /**
366
+ * Market token.
367
+ */
368
+ market_token: StringPubkey;
369
+ }
370
+
371
+ /**
372
+ * Parameters for creating an order.
373
+ */
374
+ export interface UpdateOrderParams {
375
+ /**
376
+ * Size delta value.
377
+ */
378
+ size_delta_value?: bigint | undefined;
379
+ /**
380
+ * Acceptable price.
381
+ */
382
+ acceptable_price?: bigint | undefined;
383
+ /**
384
+ * Trigger price.
385
+ */
386
+ trigger_price?: bigint | undefined;
387
+ /**
388
+ * Min output.
389
+ */
390
+ min_output?: bigint | undefined;
391
+ /**
392
+ * Valid from this timestamp.
393
+ */
394
+ valid_from_ts?: number | undefined;
395
+ }
396
+
397
+ /**
398
+ * Builder for the `update_order` instruction.
399
+ */
400
+ export interface UpdateOrder {
401
+ /**
402
+ * Program.
403
+ */
404
+ program?: StoreProgram;
405
+ /**
406
+ * Payer (a.k.a. owner).
407
+ */
408
+ payer: StringPubkey;
409
+ /**
410
+ * Order.
411
+ */
412
+ order: StringPubkey;
413
+ /**
414
+ * Parameters.
415
+ */
416
+ params: UpdateOrderParams;
417
+ }
418
+
337
419
  /**
338
420
  * Hint for [`CloseOrder`].
339
421
  */
@@ -690,6 +772,22 @@ export class Market {
690
772
  * Convert into [`JsMarketModel`]
691
773
  */
692
774
  to_model(supply: bigint): MarketModel;
775
+ /**
776
+ * Get market token address.
777
+ */
778
+ market_token_address(): string;
779
+ /**
780
+ * Get index token address.
781
+ */
782
+ index_token_address(): string;
783
+ /**
784
+ * Get long token address.
785
+ */
786
+ long_token_address(): string;
787
+ /**
788
+ * Get short token address.
789
+ */
790
+ short_token_address(): string;
693
791
  }
694
792
  /**
695
793
  * A JS binding for [`MarkegGraph`].
package/index_bg.js CHANGED
@@ -179,6 +179,14 @@ function debugString(val) {
179
179
  // TODO we could test for more things here, like `Set`s and `Map`s.
180
180
  return className;
181
181
  }
182
+ /**
183
+ * Get default [`StoreProgram`].
184
+ * @returns {StoreProgram}
185
+ */
186
+ export function default_store_program() {
187
+ const ret = wasm.default_store_program();
188
+ return ret;
189
+ }
182
190
 
183
191
  function takeFromExternrefTable0(idx) {
184
192
  const value = wasm.__wbindgen_export_4.get(idx);
@@ -232,11 +240,24 @@ export function create_orders(kind, orders, options) {
232
240
 
233
241
  /**
234
242
  * Build transactions for closing orders.
235
- * @param {CloseOrderParams} params
243
+ * @param {CloseOrderArgs} args
236
244
  * @returns {TransactionGroup}
237
245
  */
238
- export function close_orders(params) {
239
- const ret = wasm.close_orders(params);
246
+ export function close_orders(args) {
247
+ const ret = wasm.close_orders(args);
248
+ if (ret[2]) {
249
+ throw takeFromExternrefTable0(ret[1]);
250
+ }
251
+ return TransactionGroup.__wrap(ret[0]);
252
+ }
253
+
254
+ /**
255
+ * Build transactions for updating orders.
256
+ * @param {UpdateOrderArgs} args
257
+ * @returns {TransactionGroup}
258
+ */
259
+ export function update_orders(args) {
260
+ const ret = wasm.update_orders(args);
240
261
  if (ret[2]) {
241
262
  throw takeFromExternrefTable0(ret[1]);
242
263
  }
@@ -609,6 +630,70 @@ export class Market {
609
630
  const ret = wasm.market_to_model(this.__wbg_ptr, supply);
610
631
  return MarketModel.__wrap(ret);
611
632
  }
633
+ /**
634
+ * Get market token address.
635
+ * @returns {string}
636
+ */
637
+ market_token_address() {
638
+ let deferred1_0;
639
+ let deferred1_1;
640
+ try {
641
+ const ret = wasm.market_market_token_address(this.__wbg_ptr);
642
+ deferred1_0 = ret[0];
643
+ deferred1_1 = ret[1];
644
+ return getStringFromWasm0(ret[0], ret[1]);
645
+ } finally {
646
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
647
+ }
648
+ }
649
+ /**
650
+ * Get index token address.
651
+ * @returns {string}
652
+ */
653
+ index_token_address() {
654
+ let deferred1_0;
655
+ let deferred1_1;
656
+ try {
657
+ const ret = wasm.market_index_token_address(this.__wbg_ptr);
658
+ deferred1_0 = ret[0];
659
+ deferred1_1 = ret[1];
660
+ return getStringFromWasm0(ret[0], ret[1]);
661
+ } finally {
662
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
663
+ }
664
+ }
665
+ /**
666
+ * Get long token address.
667
+ * @returns {string}
668
+ */
669
+ long_token_address() {
670
+ let deferred1_0;
671
+ let deferred1_1;
672
+ try {
673
+ const ret = wasm.market_long_token_address(this.__wbg_ptr);
674
+ deferred1_0 = ret[0];
675
+ deferred1_1 = ret[1];
676
+ return getStringFromWasm0(ret[0], ret[1]);
677
+ } finally {
678
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
679
+ }
680
+ }
681
+ /**
682
+ * Get short token address.
683
+ * @returns {string}
684
+ */
685
+ short_token_address() {
686
+ let deferred1_0;
687
+ let deferred1_1;
688
+ try {
689
+ const ret = wasm.market_short_token_address(this.__wbg_ptr);
690
+ deferred1_0 = ret[0];
691
+ deferred1_1 = ret[1];
692
+ return getStringFromWasm0(ret[0], ret[1]);
693
+ } finally {
694
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
695
+ }
696
+ }
612
697
  }
613
698
 
614
699
  const MarketGraphFinalization = (typeof FinalizationRegistry === 'undefined')
package/index_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@gmsol-labs/gmsol-sdk",
3
3
  "type": "module",
4
4
  "description": "GMX-Solana is an extension of GMX on the Solana blockchain.",
5
- "version": "0.5.0-alpha.14",
5
+ "version": "0.5.0-alpha.15",
6
6
  "license": "SEE LICENSE IN ../../LICENSE",
7
7
  "repository": {
8
8
  "type": "git",