@gmsol-labs/gmsol-sdk 0.8.0-beta.0 → 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 +435 -0
- package/index_bg.js +112 -0
- package/index_bg.wasm +0 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -56,6 +56,40 @@ export interface MarketStatusParams {
|
|
|
56
56
|
prices: Prices;
|
|
57
57
|
}
|
|
58
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
|
+
|
|
59
93
|
/**
|
|
60
94
|
* Best swap path.
|
|
61
95
|
*/
|
|
@@ -443,6 +477,376 @@ export interface Callback {
|
|
|
443
477
|
partitioned_data: StringPubkey;
|
|
444
478
|
}
|
|
445
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
|
+
|
|
446
850
|
/**
|
|
447
851
|
* Hint for [`UpdateFeesState`].
|
|
448
852
|
*/
|
|
@@ -1117,6 +1521,10 @@ export class MarketModel {
|
|
|
1117
1521
|
* Get market status.
|
|
1118
1522
|
*/
|
|
1119
1523
|
status(params: MarketStatusParams): MarketStatus;
|
|
1524
|
+
/**
|
|
1525
|
+
* Create an empty position model.
|
|
1526
|
+
*/
|
|
1527
|
+
create_empty_position(args: CreateEmptyPositionArgs): PositionModel;
|
|
1120
1528
|
}
|
|
1121
1529
|
/**
|
|
1122
1530
|
* wasm-bindgen version of the Message struct.
|
|
@@ -1225,6 +1633,10 @@ export class PositionModel {
|
|
|
1225
1633
|
* Returns the inner [`JsPosition`].
|
|
1226
1634
|
*/
|
|
1227
1635
|
position(): Position;
|
|
1636
|
+
/**
|
|
1637
|
+
* Update with trade event.
|
|
1638
|
+
*/
|
|
1639
|
+
update_with_trade_event(event: TradeEvent, force_update?: boolean | null): boolean;
|
|
1228
1640
|
}
|
|
1229
1641
|
/**
|
|
1230
1642
|
* The address of a [Solana account][acc].
|
|
@@ -1282,6 +1694,29 @@ export class Pubkey {
|
|
|
1282
1694
|
*/
|
|
1283
1695
|
static findProgramAddress(seeds: any[], program_id: Pubkey): any;
|
|
1284
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
|
+
}
|
|
1285
1720
|
/**
|
|
1286
1721
|
* wasm-bindgen version of the Transaction struct.
|
|
1287
1722
|
* This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671
|
package/index_bg.js
CHANGED
|
@@ -1002,6 +1002,18 @@ export class MarketModel {
|
|
|
1002
1002
|
}
|
|
1003
1003
|
return takeFromExternrefTable0(ret[0]);
|
|
1004
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
|
+
}
|
|
1005
1017
|
}
|
|
1006
1018
|
|
|
1007
1019
|
const MessageFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -1369,6 +1381,20 @@ export class PositionModel {
|
|
|
1369
1381
|
const ret = wasm.positionmodel_position(this.__wbg_ptr);
|
|
1370
1382
|
return Position.__wrap(ret);
|
|
1371
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
|
+
}
|
|
1372
1398
|
}
|
|
1373
1399
|
|
|
1374
1400
|
const PubkeyFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -1716,6 +1742,92 @@ export class SystemInstruction {
|
|
|
1716
1742
|
}
|
|
1717
1743
|
}
|
|
1718
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
|
+
|
|
1719
1831
|
const TransactionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1720
1832
|
? { register: () => {}, unregister: () => {} }
|
|
1721
1833
|
: new FinalizationRegistry(ptr => wasm.__wbg_transaction_free(ptr >>> 0, 1));
|
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.8.0-beta.
|
|
5
|
+
"version": "0.8.0-beta.1",
|
|
6
6
|
"license": "SEE LICENSE IN ../../LICENSE",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|