@gmsol-labs/gmsol-sdk 0.7.2-beta.1 → 0.8.0-beta.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.
package/index.d.ts CHANGED
@@ -4,6 +4,10 @@
4
4
  * Get default [`StoreProgram`].
5
5
  */
6
6
  export function default_store_program(): StoreProgram;
7
+ /**
8
+ * Create transaction builder for create-order ixs.
9
+ */
10
+ export function create_orders_builder(kind: CreateOrderKind, orders: CreateOrderParams[], options: CreateOrderOptions): CreateOrdersBuilder;
7
11
  /**
8
12
  * Build transactions for creating orders.
9
13
  */
@@ -133,6 +137,8 @@ export interface CreateOrderOptions {
133
137
  skip_unwrap_native_on_receive?: boolean | undefined;
134
138
  callback?: Callback | undefined;
135
139
  transaction_group?: TransactionGroupOptions;
140
+ force_create_positions_in_parallel?: boolean | undefined;
141
+ force_create_positions?: boolean | undefined;
136
142
  }
137
143
 
138
144
  /**
@@ -181,6 +187,15 @@ export interface TransactionGroupOptions {
181
187
  */
182
188
  export type SerializedTransactionGroup = number[][][];
183
189
 
190
+ /**
191
+ * Build transaction options.
192
+ */
193
+ export interface BuildTransactionOptions {
194
+ recent_blockhash: string;
195
+ compute_unit_price_micro_lamports?: number | undefined;
196
+ compute_unit_min_priority_lamports?: number | undefined;
197
+ }
198
+
184
199
 
185
200
  /**
186
201
  * A Base58-encoded string representing a public key.
@@ -428,6 +443,182 @@ export interface Callback {
428
443
  partitioned_data: StringPubkey;
429
444
  }
430
445
 
446
+ /**
447
+ * Hint for [`UpdateFeesState`].
448
+ */
449
+ export interface UpdateFeesStateHint {
450
+ /**
451
+ * Token map.
452
+ */
453
+ token_map: StringPubkey;
454
+ /**
455
+ * Virtual inventories.
456
+ */
457
+ virtual_inventories: StringPubkey[];
458
+ /**
459
+ * Feeds.
460
+ */
461
+ feeds: SerdeTokenRecord[];
462
+ }
463
+
464
+ /**
465
+ * Builder for `update_fees_state` instruction.
466
+ */
467
+ export interface UpdateFeesState {
468
+ /**
469
+ * Payer (a.k.a. authority).
470
+ */
471
+ payer: StringPubkey;
472
+ /**
473
+ * Store program.
474
+ */
475
+ store_program?: StoreProgram;
476
+ /**
477
+ * Oracle buffer account.
478
+ */
479
+ oracle: StringPubkey;
480
+ /**
481
+ * Market token mint address.
482
+ */
483
+ market_token: StringPubkey;
484
+ }
485
+
486
+ /**
487
+ * Hint for [`UpdateClosedState`].
488
+ */
489
+ export interface UpdateClosedStateHint {
490
+ /**
491
+ * Token map.
492
+ */
493
+ token_map: StringPubkey;
494
+ /**
495
+ * Feeds.
496
+ */
497
+ feeds: SerdeTokenRecord[];
498
+ }
499
+
500
+ /**
501
+ * Builder for `update_closed_state` instruction.
502
+ */
503
+ export interface UpdateClosedState {
504
+ /**
505
+ * Payer (a.k.a. authority).
506
+ */
507
+ payer: StringPubkey;
508
+ /**
509
+ * Store program.
510
+ */
511
+ store_program?: StoreProgram;
512
+ /**
513
+ * Oracle buffer account.
514
+ */
515
+ oracle: StringPubkey;
516
+ /**
517
+ * Market token mint address.
518
+ */
519
+ market_token: StringPubkey;
520
+ }
521
+
522
+ /**
523
+ * Builder for `udpate_closed_state` instruction.
524
+ */
525
+ export interface SetMarketConfigUpdatable {
526
+ /**
527
+ * Payer (a.k.a. authority).
528
+ */
529
+ payer: StringPubkey;
530
+ /**
531
+ * Store program.
532
+ */
533
+ store_program?: StoreProgram;
534
+ /**
535
+ * Flags.
536
+ */
537
+ flags?: IndexMap<MarketConfigFlag, boolean>;
538
+ /**
539
+ * Factors.
540
+ */
541
+ factors?: IndexMap<MarketConfigFactor, boolean>;
542
+ }
543
+
544
+ /**
545
+ * Builder for the `close_empty_position` instruction.
546
+ */
547
+ export interface CloseEmptyPosition {
548
+ /**
549
+ * Program.
550
+ */
551
+ program?: StoreProgram;
552
+ /**
553
+ * Payer (a.k.a. owner).
554
+ */
555
+ payer: StringPubkey;
556
+ /**
557
+ * Position to close.
558
+ */
559
+ position: StringPubkey;
560
+ }
561
+
562
+ /**
563
+ * Builder for the `prepare_position` instruction.
564
+ */
565
+ export interface PreparePosition {
566
+ /**
567
+ * Program.
568
+ */
569
+ program?: StoreProgram;
570
+ /**
571
+ * Payer (a.k.a. owner).
572
+ */
573
+ payer: StringPubkey;
574
+ /**
575
+ * Order Kind.
576
+ */
577
+ kind: CreateOrderKind;
578
+ /**
579
+ * Collateral token.
580
+ */
581
+ collateral_token: StringPubkey;
582
+ /**
583
+ * Order Parameters.
584
+ */
585
+ params: CreateOrderParams;
586
+ /**
587
+ * Execution lamports.
588
+ */
589
+ execution_lamports?: number;
590
+ /**
591
+ * Swap path length.
592
+ */
593
+ swap_path_length?: number;
594
+ /**
595
+ * Whether to unwrap the native token.
596
+ */
597
+ should_unwrap_native_token?: boolean;
598
+ }
599
+
600
+ /**
601
+ * Builder for the `set_should_keep_position_account` instruction.
602
+ */
603
+ export interface SetShouldKeepPositionAccount {
604
+ /**
605
+ * Program.
606
+ */
607
+ program?: StoreProgram;
608
+ /**
609
+ * Payer (a.k.a. owner).
610
+ */
611
+ payer: StringPubkey;
612
+ /**
613
+ * Order.
614
+ */
615
+ order: StringPubkey;
616
+ /**
617
+ * Whether to keep position account.
618
+ */
619
+ keep: boolean;
620
+ }
621
+
431
622
  /**
432
623
  * Hint for [`UpdateOrder`].
433
624
  */
@@ -628,7 +819,18 @@ export interface CreateOrder {
628
819
  * Whether to unwrap the native token when receiving (e.g., convert WSOL to SOL).
629
820
  */
630
821
  unwrap_native_on_receive?: boolean;
822
+ /**
823
+ * Callback.
824
+ */
631
825
  callback?: Callback | undefined;
826
+ /**
827
+ * Whether to skip position account creation.
828
+ */
829
+ skip_position_creation?: boolean;
830
+ /**
831
+ * Whether to force position account creation.
832
+ */
833
+ force_position_creation?: boolean;
632
834
  }
633
835
 
634
836
  /**
@@ -708,6 +910,21 @@ export interface StoreProgram {
708
910
  */
709
911
  export type PnlFactorKind = "max_after_deposit" | "max_after_withdrawal" | "max_for_trader" | "for_adl" | "min_after_adl";
710
912
 
913
+ /**
914
+ * Builder for create-order ixs.
915
+ */
916
+ export class CreateOrdersBuilder {
917
+ private constructor();
918
+ free(): void;
919
+ /**
920
+ * Build transactions.
921
+ */
922
+ build_with_options(transaction_group?: TransactionGroupOptions | null, build?: BuildTransactionOptions | null): TransactionGroup;
923
+ /**
924
+ * Merge with the other [`CreateOrderBuilder`].
925
+ */
926
+ merge(other: CreateOrdersBuilder): void;
927
+ }
711
928
  /**
712
929
  * A (twisted) ElGamal encryption keypair.
713
930
  *
@@ -1094,7 +1311,7 @@ export class Transaction {
1094
1311
  static fromBytes(bytes: Uint8Array): Transaction;
1095
1312
  }
1096
1313
  /**
1097
- * A JS binding for transaction group.
1314
+ * A JS binding for compiled transaction group.
1098
1315
  */
1099
1316
  export class TransactionGroup {
1100
1317
  private constructor();
package/index_bg.js CHANGED
@@ -227,6 +227,23 @@ function passArrayJsValueToWasm0(array, malloc) {
227
227
  WASM_VECTOR_LEN = array.length;
228
228
  return ptr;
229
229
  }
230
+ /**
231
+ * Create transaction builder for create-order ixs.
232
+ * @param {CreateOrderKind} kind
233
+ * @param {CreateOrderParams[]} orders
234
+ * @param {CreateOrderOptions} options
235
+ * @returns {CreateOrdersBuilder}
236
+ */
237
+ export function create_orders_builder(kind, orders, options) {
238
+ const ptr0 = passArrayJsValueToWasm0(orders, wasm.__wbindgen_malloc);
239
+ const len0 = WASM_VECTOR_LEN;
240
+ const ret = wasm.create_orders_builder(kind, ptr0, len0, options);
241
+ if (ret[2]) {
242
+ throw takeFromExternrefTable0(ret[1]);
243
+ }
244
+ return CreateOrdersBuilder.__wrap(ret[0]);
245
+ }
246
+
230
247
  /**
231
248
  * Build transactions for creating orders.
232
249
  * @param {CreateOrderKind} kind
@@ -288,6 +305,60 @@ export function solana_program_init() {
288
305
  wasm.solana_program_init();
289
306
  }
290
307
 
308
+ const CreateOrdersBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
309
+ ? { register: () => {}, unregister: () => {} }
310
+ : new FinalizationRegistry(ptr => wasm.__wbg_createordersbuilder_free(ptr >>> 0, 1));
311
+ /**
312
+ * Builder for create-order ixs.
313
+ */
314
+ export class CreateOrdersBuilder {
315
+
316
+ static __wrap(ptr) {
317
+ ptr = ptr >>> 0;
318
+ const obj = Object.create(CreateOrdersBuilder.prototype);
319
+ obj.__wbg_ptr = ptr;
320
+ CreateOrdersBuilderFinalization.register(obj, obj.__wbg_ptr, obj);
321
+ return obj;
322
+ }
323
+
324
+ __destroy_into_raw() {
325
+ const ptr = this.__wbg_ptr;
326
+ this.__wbg_ptr = 0;
327
+ CreateOrdersBuilderFinalization.unregister(this);
328
+ return ptr;
329
+ }
330
+
331
+ free() {
332
+ const ptr = this.__destroy_into_raw();
333
+ wasm.__wbg_createordersbuilder_free(ptr, 0);
334
+ }
335
+ /**
336
+ * Build transactions.
337
+ * @param {TransactionGroupOptions | null} [transaction_group]
338
+ * @param {BuildTransactionOptions | null} [build]
339
+ * @returns {TransactionGroup}
340
+ */
341
+ build_with_options(transaction_group, build) {
342
+ const ptr = this.__destroy_into_raw();
343
+ const ret = wasm.createordersbuilder_build_with_options(ptr, isLikeNone(transaction_group) ? 0 : addToExternrefTable0(transaction_group), isLikeNone(build) ? 0 : addToExternrefTable0(build));
344
+ if (ret[2]) {
345
+ throw takeFromExternrefTable0(ret[1]);
346
+ }
347
+ return TransactionGroup.__wrap(ret[0]);
348
+ }
349
+ /**
350
+ * Merge with the other [`CreateOrderBuilder`].
351
+ * @param {CreateOrdersBuilder} other
352
+ */
353
+ merge(other) {
354
+ _assertClass(other, CreateOrdersBuilder);
355
+ const ret = wasm.createordersbuilder_merge(this.__wbg_ptr, other.__wbg_ptr);
356
+ if (ret[1]) {
357
+ throw takeFromExternrefTable0(ret[0]);
358
+ }
359
+ }
360
+ }
361
+
291
362
  const ElGamalKeypairFinalization = (typeof FinalizationRegistry === 'undefined')
292
363
  ? { register: () => {}, unregister: () => {} }
293
364
  : new FinalizationRegistry(ptr => wasm.__wbg_elgamalkeypair_free(ptr >>> 0, 1));
@@ -1763,7 +1834,7 @@ const TransactionGroupFinalization = (typeof FinalizationRegistry === 'undefined
1763
1834
  ? { register: () => {}, unregister: () => {} }
1764
1835
  : new FinalizationRegistry(ptr => wasm.__wbg_transactiongroup_free(ptr >>> 0, 1));
1765
1836
  /**
1766
- * A JS binding for transaction group.
1837
+ * A JS binding for compiled transaction group.
1767
1838
  */
1768
1839
  export class TransactionGroup {
1769
1840
 
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.7.2-beta.1",
5
+ "version": "0.8.0-beta.0",
6
6
  "license": "SEE LICENSE IN ../../LICENSE",
7
7
  "repository": {
8
8
  "type": "git",