@gmsol-labs/gmsol-sdk 0.7.2-beta.1 → 0.8.0-beta.1
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 +653 -1
- package/index_bg.js +184 -1
- package/index_bg.wasm +0 -0
- package/package.json +1 -1
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
|
*/
|
|
@@ -52,6 +56,40 @@ export interface MarketStatusParams {
|
|
|
52
56
|
prices: Prices;
|
|
53
57
|
}
|
|
54
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Parameters for creating empty position model.
|
|
61
|
+
*/
|
|
62
|
+
export interface CreateEmptyPositionArgs {
|
|
63
|
+
/**
|
|
64
|
+
* Is long side.
|
|
65
|
+
*/
|
|
66
|
+
is_long: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Collateral token.
|
|
69
|
+
*/
|
|
70
|
+
collateral_token: StringPubkey;
|
|
71
|
+
/**
|
|
72
|
+
* The owner of the position.
|
|
73
|
+
*
|
|
74
|
+
* If set to `None`, the `owner` will use the default pubkey.
|
|
75
|
+
*/
|
|
76
|
+
owner?: StringPubkey | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* The timestamp of the position creation.
|
|
79
|
+
*/
|
|
80
|
+
created_at?: number | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Whether to generate a bump seed.
|
|
83
|
+
*
|
|
84
|
+
* If set `false`, the `bump` will be fixed to `0`.
|
|
85
|
+
*/
|
|
86
|
+
generate_bump?: boolean | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* The store program ID used to generate the bump seed.
|
|
89
|
+
*/
|
|
90
|
+
store_program_id?: StringPubkey | undefined;
|
|
91
|
+
}
|
|
92
|
+
|
|
55
93
|
/**
|
|
56
94
|
* Best swap path.
|
|
57
95
|
*/
|
|
@@ -133,6 +171,8 @@ export interface CreateOrderOptions {
|
|
|
133
171
|
skip_unwrap_native_on_receive?: boolean | undefined;
|
|
134
172
|
callback?: Callback | undefined;
|
|
135
173
|
transaction_group?: TransactionGroupOptions;
|
|
174
|
+
force_create_positions_in_parallel?: boolean | undefined;
|
|
175
|
+
force_create_positions?: boolean | undefined;
|
|
136
176
|
}
|
|
137
177
|
|
|
138
178
|
/**
|
|
@@ -181,6 +221,15 @@ export interface TransactionGroupOptions {
|
|
|
181
221
|
*/
|
|
182
222
|
export type SerializedTransactionGroup = number[][][];
|
|
183
223
|
|
|
224
|
+
/**
|
|
225
|
+
* Build transaction options.
|
|
226
|
+
*/
|
|
227
|
+
export interface BuildTransactionOptions {
|
|
228
|
+
recent_blockhash: string;
|
|
229
|
+
compute_unit_price_micro_lamports?: number | undefined;
|
|
230
|
+
compute_unit_min_priority_lamports?: number | undefined;
|
|
231
|
+
}
|
|
232
|
+
|
|
184
233
|
|
|
185
234
|
/**
|
|
186
235
|
* A Base58-encoded string representing a public key.
|
|
@@ -428,6 +477,552 @@ export interface Callback {
|
|
|
428
477
|
partitioned_data: StringPubkey;
|
|
429
478
|
}
|
|
430
479
|
|
|
480
|
+
/**
|
|
481
|
+
* Hint for pool tokens.
|
|
482
|
+
*/
|
|
483
|
+
export interface PoolTokenHint {
|
|
484
|
+
/**
|
|
485
|
+
* Long token.
|
|
486
|
+
*/
|
|
487
|
+
long_token: StringPubkey;
|
|
488
|
+
/**
|
|
489
|
+
* Short token.
|
|
490
|
+
*/
|
|
491
|
+
short_token: StringPubkey;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Hint for [`CreateGlvWithdrawal`].
|
|
496
|
+
*/
|
|
497
|
+
export interface CreateGlvWithdrawalHint {
|
|
498
|
+
/**
|
|
499
|
+
* Pool tokens.
|
|
500
|
+
*/
|
|
501
|
+
pool_tokens: PoolTokenHint;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Builder for the `create_glv_withdrawal` instruction.
|
|
506
|
+
*/
|
|
507
|
+
export interface CreateGlvWithdrawal {
|
|
508
|
+
/**
|
|
509
|
+
* Program.
|
|
510
|
+
*/
|
|
511
|
+
program?: StoreProgram;
|
|
512
|
+
/**
|
|
513
|
+
* Payer (a.k.a. owner).
|
|
514
|
+
*/
|
|
515
|
+
payer: StringPubkey;
|
|
516
|
+
/**
|
|
517
|
+
* Reciever.
|
|
518
|
+
*/
|
|
519
|
+
receiver?: StringPubkey | undefined;
|
|
520
|
+
/**
|
|
521
|
+
* Nonce for the GLV withdrawal.
|
|
522
|
+
*/
|
|
523
|
+
nonce?: NonceBytes | undefined;
|
|
524
|
+
/**
|
|
525
|
+
* Execution fee paid to the keeper in lamports.
|
|
526
|
+
*/
|
|
527
|
+
execution_lamports?: number;
|
|
528
|
+
/**
|
|
529
|
+
* The GLV token.
|
|
530
|
+
*/
|
|
531
|
+
glv_token: StringPubkey;
|
|
532
|
+
/**
|
|
533
|
+
* The market token of the market in which the GLV withdrawal will be created.
|
|
534
|
+
*/
|
|
535
|
+
market_token: StringPubkey;
|
|
536
|
+
/**
|
|
537
|
+
* GLV token account.
|
|
538
|
+
*/
|
|
539
|
+
glv_token_account?: StringPubkey | undefined;
|
|
540
|
+
/**
|
|
541
|
+
* Long receive token.
|
|
542
|
+
*/
|
|
543
|
+
long_receive_token?: StringPubkey | undefined;
|
|
544
|
+
/**
|
|
545
|
+
* Swap path for long receive token.
|
|
546
|
+
*/
|
|
547
|
+
long_swap_path?: StringPubkey[];
|
|
548
|
+
/**
|
|
549
|
+
* Short receive token.
|
|
550
|
+
*/
|
|
551
|
+
short_receive_token?: StringPubkey | undefined;
|
|
552
|
+
/**
|
|
553
|
+
* Swap path for short receive token.
|
|
554
|
+
*/
|
|
555
|
+
short_swap_path?: StringPubkey[];
|
|
556
|
+
/**
|
|
557
|
+
* GLV token amount.
|
|
558
|
+
*/
|
|
559
|
+
glv_token_amount?: number;
|
|
560
|
+
/**
|
|
561
|
+
* Minimum amount of long receive tokens.
|
|
562
|
+
*/
|
|
563
|
+
min_long_receive_amount?: number;
|
|
564
|
+
/**
|
|
565
|
+
* Minimum amount of short receive tokens.
|
|
566
|
+
*/
|
|
567
|
+
min_short_receive_amount?: number;
|
|
568
|
+
/**
|
|
569
|
+
* Whether to unwrap the native token when receiving (e.g., convert WSOL to SOL).
|
|
570
|
+
*/
|
|
571
|
+
unwrap_native_on_receive?: boolean;
|
|
572
|
+
/**
|
|
573
|
+
* Whether to skip the creation of long receive token ATA.
|
|
574
|
+
*/
|
|
575
|
+
skip_long_receive_token_ata_creation?: boolean;
|
|
576
|
+
/**
|
|
577
|
+
* Whether to skip the creation of short receive token ATA.
|
|
578
|
+
*/
|
|
579
|
+
skip_short_receive_token_ata_creation?: boolean;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* Hint for [`CreateGlvDeposit`].
|
|
584
|
+
*/
|
|
585
|
+
export interface CreateGlvDepositHint {
|
|
586
|
+
/**
|
|
587
|
+
* Pool tokens.
|
|
588
|
+
*/
|
|
589
|
+
pool_tokens: PoolTokenHint;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* Builder for the `create_glv_deposit` instruction.
|
|
594
|
+
*/
|
|
595
|
+
export interface CreateGlvDeposit {
|
|
596
|
+
/**
|
|
597
|
+
* Program.
|
|
598
|
+
*/
|
|
599
|
+
program?: StoreProgram;
|
|
600
|
+
/**
|
|
601
|
+
* Payer (a.k.a. owner).
|
|
602
|
+
*/
|
|
603
|
+
payer: StringPubkey;
|
|
604
|
+
/**
|
|
605
|
+
* Reciever.
|
|
606
|
+
*/
|
|
607
|
+
receiver?: StringPubkey | undefined;
|
|
608
|
+
/**
|
|
609
|
+
* Nonce for the deposit.
|
|
610
|
+
*/
|
|
611
|
+
nonce?: NonceBytes | undefined;
|
|
612
|
+
/**
|
|
613
|
+
* The GLV token.
|
|
614
|
+
*/
|
|
615
|
+
glv_token: StringPubkey;
|
|
616
|
+
/**
|
|
617
|
+
* The market token of the market in which the deposit will be created.
|
|
618
|
+
*/
|
|
619
|
+
market_token: StringPubkey;
|
|
620
|
+
/**
|
|
621
|
+
* Execution fee paid to the keeper in lamports.
|
|
622
|
+
*/
|
|
623
|
+
execution_lamports?: number;
|
|
624
|
+
/**
|
|
625
|
+
* Long pay token.
|
|
626
|
+
*/
|
|
627
|
+
long_pay_token?: StringPubkey | undefined;
|
|
628
|
+
/**
|
|
629
|
+
* Long pay token account.
|
|
630
|
+
*/
|
|
631
|
+
long_pay_token_account?: StringPubkey | undefined;
|
|
632
|
+
/**
|
|
633
|
+
* Swap path for long pay token.
|
|
634
|
+
*/
|
|
635
|
+
long_swap_path?: StringPubkey[];
|
|
636
|
+
/**
|
|
637
|
+
* Short pay token.
|
|
638
|
+
*/
|
|
639
|
+
short_pay_token?: StringPubkey | undefined;
|
|
640
|
+
/**
|
|
641
|
+
* Short pay token account.
|
|
642
|
+
*/
|
|
643
|
+
short_pay_token_account?: StringPubkey | undefined;
|
|
644
|
+
/**
|
|
645
|
+
* Swap path for short pay token.
|
|
646
|
+
*/
|
|
647
|
+
short_swap_path?: StringPubkey[];
|
|
648
|
+
/**
|
|
649
|
+
* Market token account.
|
|
650
|
+
*/
|
|
651
|
+
market_token_account?: StringPubkey | undefined;
|
|
652
|
+
/**
|
|
653
|
+
* Long pay token amount.
|
|
654
|
+
*/
|
|
655
|
+
long_pay_amount?: number;
|
|
656
|
+
/**
|
|
657
|
+
* Short pay token amount.
|
|
658
|
+
*/
|
|
659
|
+
short_pay_amount?: number;
|
|
660
|
+
/**
|
|
661
|
+
* Market token amount to pay.
|
|
662
|
+
*/
|
|
663
|
+
market_token_amount?: number;
|
|
664
|
+
/**
|
|
665
|
+
* Minimum amount of output market tokens.
|
|
666
|
+
*/
|
|
667
|
+
min_market_token_amount?: number;
|
|
668
|
+
/**
|
|
669
|
+
* Minimum amount of output GLV tokens.
|
|
670
|
+
*/
|
|
671
|
+
min_receive_amount?: number;
|
|
672
|
+
/**
|
|
673
|
+
* Whether to unwrap the native token when receiving (e.g., convert WSOL to SOL).
|
|
674
|
+
*/
|
|
675
|
+
unwrap_native_on_receive?: boolean;
|
|
676
|
+
/**
|
|
677
|
+
* Whether to skip the creation of GLV token ATA.
|
|
678
|
+
*/
|
|
679
|
+
skip_glv_token_ata_creation?: boolean;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* Hint for [`CreateWithdrawal`].
|
|
684
|
+
*/
|
|
685
|
+
export interface CreateWithdrawalHint {
|
|
686
|
+
/**
|
|
687
|
+
* Pool tokens.
|
|
688
|
+
*/
|
|
689
|
+
pool_tokens: PoolTokenHint;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* Builder for the `create_withdrawal` instruction.
|
|
694
|
+
*/
|
|
695
|
+
export interface CreateWithdrawal {
|
|
696
|
+
/**
|
|
697
|
+
* Program.
|
|
698
|
+
*/
|
|
699
|
+
program?: StoreProgram;
|
|
700
|
+
/**
|
|
701
|
+
* Payer (a.k.a. owner).
|
|
702
|
+
*/
|
|
703
|
+
payer: StringPubkey;
|
|
704
|
+
/**
|
|
705
|
+
* Reciever.
|
|
706
|
+
*/
|
|
707
|
+
receiver?: StringPubkey | undefined;
|
|
708
|
+
/**
|
|
709
|
+
* Nonce for the withdrawal.
|
|
710
|
+
*/
|
|
711
|
+
nonce?: NonceBytes | undefined;
|
|
712
|
+
/**
|
|
713
|
+
* Execution fee paid to the keeper in lamports.
|
|
714
|
+
*/
|
|
715
|
+
execution_lamports?: number;
|
|
716
|
+
/**
|
|
717
|
+
* The market token of the market in which the withdrawal will be created.
|
|
718
|
+
*/
|
|
719
|
+
market_token: StringPubkey;
|
|
720
|
+
/**
|
|
721
|
+
* Market token account.
|
|
722
|
+
*/
|
|
723
|
+
market_token_account?: StringPubkey | undefined;
|
|
724
|
+
/**
|
|
725
|
+
* Long receive token.
|
|
726
|
+
*/
|
|
727
|
+
long_receive_token?: StringPubkey | undefined;
|
|
728
|
+
/**
|
|
729
|
+
* Swap path for long receive token.
|
|
730
|
+
*/
|
|
731
|
+
long_swap_path?: StringPubkey[];
|
|
732
|
+
/**
|
|
733
|
+
* Short receive token.
|
|
734
|
+
*/
|
|
735
|
+
short_receive_token?: StringPubkey | undefined;
|
|
736
|
+
/**
|
|
737
|
+
* Swap path for short receive token.
|
|
738
|
+
*/
|
|
739
|
+
short_swap_path?: StringPubkey[];
|
|
740
|
+
/**
|
|
741
|
+
* Market token amount.
|
|
742
|
+
*/
|
|
743
|
+
market_token_amount?: number;
|
|
744
|
+
/**
|
|
745
|
+
* Minimum amount of long receive tokens.
|
|
746
|
+
*/
|
|
747
|
+
min_long_receive_amount?: number;
|
|
748
|
+
/**
|
|
749
|
+
* Minimum amount of short receive tokens.
|
|
750
|
+
*/
|
|
751
|
+
min_short_receive_amount?: number;
|
|
752
|
+
/**
|
|
753
|
+
* Whether to unwrap the native token when receiving (e.g., convert WSOL to SOL).
|
|
754
|
+
*/
|
|
755
|
+
unwrap_native_on_receive?: boolean;
|
|
756
|
+
/**
|
|
757
|
+
* Whether to skip the creation of long receive token ATA.
|
|
758
|
+
*/
|
|
759
|
+
skip_long_receive_token_ata_creation?: boolean;
|
|
760
|
+
/**
|
|
761
|
+
* Whether to skip the creation of short receive token ATA.
|
|
762
|
+
*/
|
|
763
|
+
skip_short_receive_token_ata_creation?: boolean;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
/**
|
|
767
|
+
* Hint for [`CreateDeposit`].
|
|
768
|
+
*/
|
|
769
|
+
export interface CreateDepositHint {
|
|
770
|
+
/**
|
|
771
|
+
* Pool tokens.
|
|
772
|
+
*/
|
|
773
|
+
pool_tokens: PoolTokenHint;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* Builder for the `create_deposit` instruction.
|
|
778
|
+
*/
|
|
779
|
+
export interface CreateDeposit {
|
|
780
|
+
/**
|
|
781
|
+
* Program.
|
|
782
|
+
*/
|
|
783
|
+
program?: StoreProgram;
|
|
784
|
+
/**
|
|
785
|
+
* Payer (a.k.a. owner).
|
|
786
|
+
*/
|
|
787
|
+
payer: StringPubkey;
|
|
788
|
+
/**
|
|
789
|
+
* Reciever.
|
|
790
|
+
*/
|
|
791
|
+
receiver?: StringPubkey | undefined;
|
|
792
|
+
/**
|
|
793
|
+
* Nonce for the deposit.
|
|
794
|
+
*/
|
|
795
|
+
nonce?: NonceBytes | undefined;
|
|
796
|
+
/**
|
|
797
|
+
* The market token of the market in which the deposit will be created.
|
|
798
|
+
*/
|
|
799
|
+
market_token: StringPubkey;
|
|
800
|
+
/**
|
|
801
|
+
* Execution fee paid to the keeper in lamports.
|
|
802
|
+
*/
|
|
803
|
+
execution_lamports?: number;
|
|
804
|
+
/**
|
|
805
|
+
* Long pay token.
|
|
806
|
+
*/
|
|
807
|
+
long_pay_token?: StringPubkey | undefined;
|
|
808
|
+
/**
|
|
809
|
+
* Long pay token account.
|
|
810
|
+
*/
|
|
811
|
+
long_pay_token_account?: StringPubkey | undefined;
|
|
812
|
+
/**
|
|
813
|
+
* Swap path for long pay token.
|
|
814
|
+
*/
|
|
815
|
+
long_swap_path?: StringPubkey[];
|
|
816
|
+
/**
|
|
817
|
+
* Short pay token.
|
|
818
|
+
*/
|
|
819
|
+
short_pay_token?: StringPubkey | undefined;
|
|
820
|
+
/**
|
|
821
|
+
* Short pay token account.
|
|
822
|
+
*/
|
|
823
|
+
short_pay_token_account?: StringPubkey | undefined;
|
|
824
|
+
/**
|
|
825
|
+
* Swap path for short pay token.
|
|
826
|
+
*/
|
|
827
|
+
short_swap_path?: StringPubkey[];
|
|
828
|
+
/**
|
|
829
|
+
* Long pay token amount.
|
|
830
|
+
*/
|
|
831
|
+
long_pay_amount?: number;
|
|
832
|
+
/**
|
|
833
|
+
* Short pay token amount.
|
|
834
|
+
*/
|
|
835
|
+
short_pay_amount?: number;
|
|
836
|
+
/**
|
|
837
|
+
* Minimum amount of output market tokens.
|
|
838
|
+
*/
|
|
839
|
+
min_receive_amount?: number;
|
|
840
|
+
/**
|
|
841
|
+
* Whether to unwrap the native token when receiving (e.g., convert WSOL to SOL).
|
|
842
|
+
*/
|
|
843
|
+
unwrap_native_on_receive?: boolean;
|
|
844
|
+
/**
|
|
845
|
+
* Whether to skip the creation of market token ATA.
|
|
846
|
+
*/
|
|
847
|
+
skip_market_token_ata_creation?: boolean;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* Hint for [`UpdateFeesState`].
|
|
852
|
+
*/
|
|
853
|
+
export interface UpdateFeesStateHint {
|
|
854
|
+
/**
|
|
855
|
+
* Token map.
|
|
856
|
+
*/
|
|
857
|
+
token_map: StringPubkey;
|
|
858
|
+
/**
|
|
859
|
+
* Virtual inventories.
|
|
860
|
+
*/
|
|
861
|
+
virtual_inventories: StringPubkey[];
|
|
862
|
+
/**
|
|
863
|
+
* Feeds.
|
|
864
|
+
*/
|
|
865
|
+
feeds: SerdeTokenRecord[];
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
/**
|
|
869
|
+
* Builder for `update_fees_state` instruction.
|
|
870
|
+
*/
|
|
871
|
+
export interface UpdateFeesState {
|
|
872
|
+
/**
|
|
873
|
+
* Payer (a.k.a. authority).
|
|
874
|
+
*/
|
|
875
|
+
payer: StringPubkey;
|
|
876
|
+
/**
|
|
877
|
+
* Store program.
|
|
878
|
+
*/
|
|
879
|
+
store_program?: StoreProgram;
|
|
880
|
+
/**
|
|
881
|
+
* Oracle buffer account.
|
|
882
|
+
*/
|
|
883
|
+
oracle: StringPubkey;
|
|
884
|
+
/**
|
|
885
|
+
* Market token mint address.
|
|
886
|
+
*/
|
|
887
|
+
market_token: StringPubkey;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
/**
|
|
891
|
+
* Hint for [`UpdateClosedState`].
|
|
892
|
+
*/
|
|
893
|
+
export interface UpdateClosedStateHint {
|
|
894
|
+
/**
|
|
895
|
+
* Token map.
|
|
896
|
+
*/
|
|
897
|
+
token_map: StringPubkey;
|
|
898
|
+
/**
|
|
899
|
+
* Feeds.
|
|
900
|
+
*/
|
|
901
|
+
feeds: SerdeTokenRecord[];
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* Builder for `update_closed_state` instruction.
|
|
906
|
+
*/
|
|
907
|
+
export interface UpdateClosedState {
|
|
908
|
+
/**
|
|
909
|
+
* Payer (a.k.a. authority).
|
|
910
|
+
*/
|
|
911
|
+
payer: StringPubkey;
|
|
912
|
+
/**
|
|
913
|
+
* Store program.
|
|
914
|
+
*/
|
|
915
|
+
store_program?: StoreProgram;
|
|
916
|
+
/**
|
|
917
|
+
* Oracle buffer account.
|
|
918
|
+
*/
|
|
919
|
+
oracle: StringPubkey;
|
|
920
|
+
/**
|
|
921
|
+
* Market token mint address.
|
|
922
|
+
*/
|
|
923
|
+
market_token: StringPubkey;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* Builder for `udpate_closed_state` instruction.
|
|
928
|
+
*/
|
|
929
|
+
export interface SetMarketConfigUpdatable {
|
|
930
|
+
/**
|
|
931
|
+
* Payer (a.k.a. authority).
|
|
932
|
+
*/
|
|
933
|
+
payer: StringPubkey;
|
|
934
|
+
/**
|
|
935
|
+
* Store program.
|
|
936
|
+
*/
|
|
937
|
+
store_program?: StoreProgram;
|
|
938
|
+
/**
|
|
939
|
+
* Flags.
|
|
940
|
+
*/
|
|
941
|
+
flags?: IndexMap<MarketConfigFlag, boolean>;
|
|
942
|
+
/**
|
|
943
|
+
* Factors.
|
|
944
|
+
*/
|
|
945
|
+
factors?: IndexMap<MarketConfigFactor, boolean>;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
/**
|
|
949
|
+
* Builder for the `close_empty_position` instruction.
|
|
950
|
+
*/
|
|
951
|
+
export interface CloseEmptyPosition {
|
|
952
|
+
/**
|
|
953
|
+
* Program.
|
|
954
|
+
*/
|
|
955
|
+
program?: StoreProgram;
|
|
956
|
+
/**
|
|
957
|
+
* Payer (a.k.a. owner).
|
|
958
|
+
*/
|
|
959
|
+
payer: StringPubkey;
|
|
960
|
+
/**
|
|
961
|
+
* Position to close.
|
|
962
|
+
*/
|
|
963
|
+
position: StringPubkey;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* Builder for the `prepare_position` instruction.
|
|
968
|
+
*/
|
|
969
|
+
export interface PreparePosition {
|
|
970
|
+
/**
|
|
971
|
+
* Program.
|
|
972
|
+
*/
|
|
973
|
+
program?: StoreProgram;
|
|
974
|
+
/**
|
|
975
|
+
* Payer (a.k.a. owner).
|
|
976
|
+
*/
|
|
977
|
+
payer: StringPubkey;
|
|
978
|
+
/**
|
|
979
|
+
* Order Kind.
|
|
980
|
+
*/
|
|
981
|
+
kind: CreateOrderKind;
|
|
982
|
+
/**
|
|
983
|
+
* Collateral token.
|
|
984
|
+
*/
|
|
985
|
+
collateral_token: StringPubkey;
|
|
986
|
+
/**
|
|
987
|
+
* Order Parameters.
|
|
988
|
+
*/
|
|
989
|
+
params: CreateOrderParams;
|
|
990
|
+
/**
|
|
991
|
+
* Execution lamports.
|
|
992
|
+
*/
|
|
993
|
+
execution_lamports?: number;
|
|
994
|
+
/**
|
|
995
|
+
* Swap path length.
|
|
996
|
+
*/
|
|
997
|
+
swap_path_length?: number;
|
|
998
|
+
/**
|
|
999
|
+
* Whether to unwrap the native token.
|
|
1000
|
+
*/
|
|
1001
|
+
should_unwrap_native_token?: boolean;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
/**
|
|
1005
|
+
* Builder for the `set_should_keep_position_account` instruction.
|
|
1006
|
+
*/
|
|
1007
|
+
export interface SetShouldKeepPositionAccount {
|
|
1008
|
+
/**
|
|
1009
|
+
* Program.
|
|
1010
|
+
*/
|
|
1011
|
+
program?: StoreProgram;
|
|
1012
|
+
/**
|
|
1013
|
+
* Payer (a.k.a. owner).
|
|
1014
|
+
*/
|
|
1015
|
+
payer: StringPubkey;
|
|
1016
|
+
/**
|
|
1017
|
+
* Order.
|
|
1018
|
+
*/
|
|
1019
|
+
order: StringPubkey;
|
|
1020
|
+
/**
|
|
1021
|
+
* Whether to keep position account.
|
|
1022
|
+
*/
|
|
1023
|
+
keep: boolean;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
431
1026
|
/**
|
|
432
1027
|
* Hint for [`UpdateOrder`].
|
|
433
1028
|
*/
|
|
@@ -628,7 +1223,18 @@ export interface CreateOrder {
|
|
|
628
1223
|
* Whether to unwrap the native token when receiving (e.g., convert WSOL to SOL).
|
|
629
1224
|
*/
|
|
630
1225
|
unwrap_native_on_receive?: boolean;
|
|
1226
|
+
/**
|
|
1227
|
+
* Callback.
|
|
1228
|
+
*/
|
|
631
1229
|
callback?: Callback | undefined;
|
|
1230
|
+
/**
|
|
1231
|
+
* Whether to skip position account creation.
|
|
1232
|
+
*/
|
|
1233
|
+
skip_position_creation?: boolean;
|
|
1234
|
+
/**
|
|
1235
|
+
* Whether to force position account creation.
|
|
1236
|
+
*/
|
|
1237
|
+
force_position_creation?: boolean;
|
|
632
1238
|
}
|
|
633
1239
|
|
|
634
1240
|
/**
|
|
@@ -708,6 +1314,21 @@ export interface StoreProgram {
|
|
|
708
1314
|
*/
|
|
709
1315
|
export type PnlFactorKind = "max_after_deposit" | "max_after_withdrawal" | "max_for_trader" | "for_adl" | "min_after_adl";
|
|
710
1316
|
|
|
1317
|
+
/**
|
|
1318
|
+
* Builder for create-order ixs.
|
|
1319
|
+
*/
|
|
1320
|
+
export class CreateOrdersBuilder {
|
|
1321
|
+
private constructor();
|
|
1322
|
+
free(): void;
|
|
1323
|
+
/**
|
|
1324
|
+
* Build transactions.
|
|
1325
|
+
*/
|
|
1326
|
+
build_with_options(transaction_group?: TransactionGroupOptions | null, build?: BuildTransactionOptions | null): TransactionGroup;
|
|
1327
|
+
/**
|
|
1328
|
+
* Merge with the other [`CreateOrderBuilder`].
|
|
1329
|
+
*/
|
|
1330
|
+
merge(other: CreateOrdersBuilder): void;
|
|
1331
|
+
}
|
|
711
1332
|
/**
|
|
712
1333
|
* A (twisted) ElGamal encryption keypair.
|
|
713
1334
|
*
|
|
@@ -900,6 +1521,10 @@ export class MarketModel {
|
|
|
900
1521
|
* Get market status.
|
|
901
1522
|
*/
|
|
902
1523
|
status(params: MarketStatusParams): MarketStatus;
|
|
1524
|
+
/**
|
|
1525
|
+
* Create an empty position model.
|
|
1526
|
+
*/
|
|
1527
|
+
create_empty_position(args: CreateEmptyPositionArgs): PositionModel;
|
|
903
1528
|
}
|
|
904
1529
|
/**
|
|
905
1530
|
* wasm-bindgen version of the Message struct.
|
|
@@ -1008,6 +1633,10 @@ export class PositionModel {
|
|
|
1008
1633
|
* Returns the inner [`JsPosition`].
|
|
1009
1634
|
*/
|
|
1010
1635
|
position(): Position;
|
|
1636
|
+
/**
|
|
1637
|
+
* Update with trade event.
|
|
1638
|
+
*/
|
|
1639
|
+
update_with_trade_event(event: TradeEvent, force_update?: boolean | null): boolean;
|
|
1011
1640
|
}
|
|
1012
1641
|
/**
|
|
1013
1642
|
* The address of a [Solana account][acc].
|
|
@@ -1065,6 +1694,29 @@ export class Pubkey {
|
|
|
1065
1694
|
*/
|
|
1066
1695
|
static findProgramAddress(seeds: any[], program_id: Pubkey): any;
|
|
1067
1696
|
}
|
|
1697
|
+
/**
|
|
1698
|
+
* JS version of [`TradeEvent`].
|
|
1699
|
+
*/
|
|
1700
|
+
export class TradeEvent {
|
|
1701
|
+
private constructor();
|
|
1702
|
+
free(): void;
|
|
1703
|
+
/**
|
|
1704
|
+
* Create from base64 encoded event data with options.
|
|
1705
|
+
*/
|
|
1706
|
+
static decode_from_base64_with_options(data: string, no_discriminator?: boolean | null): TradeEvent;
|
|
1707
|
+
/**
|
|
1708
|
+
* Create from base64 encoded event data.
|
|
1709
|
+
*/
|
|
1710
|
+
static decode_from_base64(data: string): TradeEvent;
|
|
1711
|
+
/**
|
|
1712
|
+
* Create from event data.
|
|
1713
|
+
*/
|
|
1714
|
+
static decode_with_options(data: Uint8Array, no_discriminator?: boolean | null): TradeEvent;
|
|
1715
|
+
/**
|
|
1716
|
+
* Convert into a position model.
|
|
1717
|
+
*/
|
|
1718
|
+
to_position_model(market: MarketModel): PositionModel;
|
|
1719
|
+
}
|
|
1068
1720
|
/**
|
|
1069
1721
|
* wasm-bindgen version of the Transaction struct.
|
|
1070
1722
|
* This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671
|
|
@@ -1094,7 +1746,7 @@ export class Transaction {
|
|
|
1094
1746
|
static fromBytes(bytes: Uint8Array): Transaction;
|
|
1095
1747
|
}
|
|
1096
1748
|
/**
|
|
1097
|
-
* A JS binding for transaction group.
|
|
1749
|
+
* A JS binding for compiled transaction group.
|
|
1098
1750
|
*/
|
|
1099
1751
|
export class TransactionGroup {
|
|
1100
1752
|
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));
|
|
@@ -931,6 +1002,18 @@ export class MarketModel {
|
|
|
931
1002
|
}
|
|
932
1003
|
return takeFromExternrefTable0(ret[0]);
|
|
933
1004
|
}
|
|
1005
|
+
/**
|
|
1006
|
+
* Create an empty position model.
|
|
1007
|
+
* @param {CreateEmptyPositionArgs} args
|
|
1008
|
+
* @returns {PositionModel}
|
|
1009
|
+
*/
|
|
1010
|
+
create_empty_position(args) {
|
|
1011
|
+
const ret = wasm.marketmodel_create_empty_position(this.__wbg_ptr, args);
|
|
1012
|
+
if (ret[2]) {
|
|
1013
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1014
|
+
}
|
|
1015
|
+
return PositionModel.__wrap(ret[0]);
|
|
1016
|
+
}
|
|
934
1017
|
}
|
|
935
1018
|
|
|
936
1019
|
const MessageFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -1298,6 +1381,20 @@ export class PositionModel {
|
|
|
1298
1381
|
const ret = wasm.positionmodel_position(this.__wbg_ptr);
|
|
1299
1382
|
return Position.__wrap(ret);
|
|
1300
1383
|
}
|
|
1384
|
+
/**
|
|
1385
|
+
* Update with trade event.
|
|
1386
|
+
* @param {TradeEvent} event
|
|
1387
|
+
* @param {boolean | null} [force_update]
|
|
1388
|
+
* @returns {boolean}
|
|
1389
|
+
*/
|
|
1390
|
+
update_with_trade_event(event, force_update) {
|
|
1391
|
+
_assertClass(event, TradeEvent);
|
|
1392
|
+
const ret = wasm.positionmodel_update_with_trade_event(this.__wbg_ptr, event.__wbg_ptr, isLikeNone(force_update) ? 0xFFFFFF : force_update ? 1 : 0);
|
|
1393
|
+
if (ret[2]) {
|
|
1394
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1395
|
+
}
|
|
1396
|
+
return ret[0] !== 0;
|
|
1397
|
+
}
|
|
1301
1398
|
}
|
|
1302
1399
|
|
|
1303
1400
|
const PubkeyFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -1645,6 +1742,92 @@ export class SystemInstruction {
|
|
|
1645
1742
|
}
|
|
1646
1743
|
}
|
|
1647
1744
|
|
|
1745
|
+
const TradeEventFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1746
|
+
? { register: () => {}, unregister: () => {} }
|
|
1747
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_tradeevent_free(ptr >>> 0, 1));
|
|
1748
|
+
/**
|
|
1749
|
+
* JS version of [`TradeEvent`].
|
|
1750
|
+
*/
|
|
1751
|
+
export class TradeEvent {
|
|
1752
|
+
|
|
1753
|
+
static __wrap(ptr) {
|
|
1754
|
+
ptr = ptr >>> 0;
|
|
1755
|
+
const obj = Object.create(TradeEvent.prototype);
|
|
1756
|
+
obj.__wbg_ptr = ptr;
|
|
1757
|
+
TradeEventFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1758
|
+
return obj;
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
__destroy_into_raw() {
|
|
1762
|
+
const ptr = this.__wbg_ptr;
|
|
1763
|
+
this.__wbg_ptr = 0;
|
|
1764
|
+
TradeEventFinalization.unregister(this);
|
|
1765
|
+
return ptr;
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
free() {
|
|
1769
|
+
const ptr = this.__destroy_into_raw();
|
|
1770
|
+
wasm.__wbg_tradeevent_free(ptr, 0);
|
|
1771
|
+
}
|
|
1772
|
+
/**
|
|
1773
|
+
* Create from base64 encoded event data with options.
|
|
1774
|
+
* @param {string} data
|
|
1775
|
+
* @param {boolean | null} [no_discriminator]
|
|
1776
|
+
* @returns {TradeEvent}
|
|
1777
|
+
*/
|
|
1778
|
+
static decode_from_base64_with_options(data, no_discriminator) {
|
|
1779
|
+
const ptr0 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1780
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1781
|
+
const ret = wasm.tradeevent_decode_from_base64_with_options(ptr0, len0, isLikeNone(no_discriminator) ? 0xFFFFFF : no_discriminator ? 1 : 0);
|
|
1782
|
+
if (ret[2]) {
|
|
1783
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1784
|
+
}
|
|
1785
|
+
return TradeEvent.__wrap(ret[0]);
|
|
1786
|
+
}
|
|
1787
|
+
/**
|
|
1788
|
+
* Create from base64 encoded event data.
|
|
1789
|
+
* @param {string} data
|
|
1790
|
+
* @returns {TradeEvent}
|
|
1791
|
+
*/
|
|
1792
|
+
static decode_from_base64(data) {
|
|
1793
|
+
const ptr0 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1794
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1795
|
+
const ret = wasm.tradeevent_decode_from_base64(ptr0, len0);
|
|
1796
|
+
if (ret[2]) {
|
|
1797
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1798
|
+
}
|
|
1799
|
+
return TradeEvent.__wrap(ret[0]);
|
|
1800
|
+
}
|
|
1801
|
+
/**
|
|
1802
|
+
* Create from event data.
|
|
1803
|
+
* @param {Uint8Array} data
|
|
1804
|
+
* @param {boolean | null} [no_discriminator]
|
|
1805
|
+
* @returns {TradeEvent}
|
|
1806
|
+
*/
|
|
1807
|
+
static decode_with_options(data, no_discriminator) {
|
|
1808
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
1809
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1810
|
+
const ret = wasm.tradeevent_decode_with_options(ptr0, len0, isLikeNone(no_discriminator) ? 0xFFFFFF : no_discriminator ? 1 : 0);
|
|
1811
|
+
if (ret[2]) {
|
|
1812
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1813
|
+
}
|
|
1814
|
+
return TradeEvent.__wrap(ret[0]);
|
|
1815
|
+
}
|
|
1816
|
+
/**
|
|
1817
|
+
* Convert into a position model.
|
|
1818
|
+
* @param {MarketModel} market
|
|
1819
|
+
* @returns {PositionModel}
|
|
1820
|
+
*/
|
|
1821
|
+
to_position_model(market) {
|
|
1822
|
+
_assertClass(market, MarketModel);
|
|
1823
|
+
const ret = wasm.tradeevent_to_position_model(this.__wbg_ptr, market.__wbg_ptr);
|
|
1824
|
+
if (ret[2]) {
|
|
1825
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1826
|
+
}
|
|
1827
|
+
return PositionModel.__wrap(ret[0]);
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1648
1831
|
const TransactionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1649
1832
|
? { register: () => {}, unregister: () => {} }
|
|
1650
1833
|
: new FinalizationRegistry(ptr => wasm.__wbg_transaction_free(ptr >>> 0, 1));
|
|
@@ -1763,7 +1946,7 @@ const TransactionGroupFinalization = (typeof FinalizationRegistry === 'undefined
|
|
|
1763
1946
|
? { register: () => {}, unregister: () => {} }
|
|
1764
1947
|
: new FinalizationRegistry(ptr => wasm.__wbg_transactiongroup_free(ptr >>> 0, 1));
|
|
1765
1948
|
/**
|
|
1766
|
-
* A JS binding for transaction group.
|
|
1949
|
+
* A JS binding for compiled transaction group.
|
|
1767
1950
|
*/
|
|
1768
1951
|
export class TransactionGroup {
|
|
1769
1952
|
|
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
|
+
"version": "0.8.0-beta.1",
|
|
6
6
|
"license": "SEE LICENSE IN ../../LICENSE",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|