@glamsystems/glam-sdk 1.0.5 → 1.0.6

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.
@@ -1,9 +1,8 @@
1
- import { Keypair, PublicKey, Transaction, TransactionVersion, VersionedTransaction } from "@solana/web3.js";
2
1
  import { BN } from "@coral-xyz/anchor";
2
+ export declare function readUnsignedBigInt64LE(buffer: Buffer, offset: number): BN;
3
+ export declare function readSignedBigInt64LE(buffer: Buffer, offset: number): BN;
4
+ export declare function readI128LE(buffer: Buffer, offset: number): BN;
3
5
  export declare const ZERO: any;
4
- export type MappedRecord<A extends Record<string, any>, B> = {
5
- [K in keyof A]: B;
6
- };
7
6
  export declare enum ExchangeStatus {
8
7
  ACTIVE = 0,
9
8
  DEPOSIT_PAUSED = 1,
@@ -430,702 +429,6 @@ export declare class StakeAction {
430
429
  stakeTransfer: {};
431
430
  };
432
431
  }
433
- export declare class SettlePnlMode {
434
- static readonly TRY_SETTLE: {
435
- trySettle: {};
436
- };
437
- static readonly MUST_SETTLE: {
438
- mustSettle: {};
439
- };
440
- }
441
- export declare function isVariant(object: any, type: string): any;
442
- export declare function isOneOfVariant(object: any, types: string[]): boolean;
443
- export declare function getVariant(object: any): string;
444
- export declare enum TradeSide {
445
- None = 0,
446
- Buy = 1,
447
- Sell = 2
448
- }
449
- export type CandleResolution = "1" | "5" | "15" | "60" | "240" | "D" | "W" | "M";
450
- export type NewUserRecord = {
451
- ts: BN;
452
- userAuthority: PublicKey;
453
- user: PublicKey;
454
- subAccountId: number;
455
- name: number[];
456
- referrer: PublicKey;
457
- };
458
- export type DepositRecord = {
459
- ts: BN;
460
- userAuthority: PublicKey;
461
- user: PublicKey;
462
- direction: {
463
- deposit?: any;
464
- withdraw?: any;
465
- };
466
- marketIndex: number;
467
- amount: BN;
468
- oraclePrice: BN;
469
- marketDepositBalance: BN;
470
- marketWithdrawBalance: BN;
471
- marketCumulativeDepositInterest: BN;
472
- marketCumulativeBorrowInterest: BN;
473
- totalDepositsAfter: BN;
474
- totalWithdrawsAfter: BN;
475
- depositRecordId: BN;
476
- explanation: DepositExplanation;
477
- transferUser?: PublicKey;
478
- };
479
- export type SpotInterestRecord = {
480
- ts: BN;
481
- marketIndex: number;
482
- depositBalance: BN;
483
- cumulativeDepositInterest: BN;
484
- borrowBalance: BN;
485
- cumulativeBorrowInterest: BN;
486
- optimalUtilization: number;
487
- optimalBorrowRate: number;
488
- maxBorrowRate: number;
489
- };
490
- export type CurveRecord = {
491
- ts: BN;
492
- recordId: BN;
493
- marketIndex: number;
494
- pegMultiplierBefore: BN;
495
- baseAssetReserveBefore: BN;
496
- quoteAssetReserveBefore: BN;
497
- sqrtKBefore: BN;
498
- pegMultiplierAfter: BN;
499
- baseAssetReserveAfter: BN;
500
- quoteAssetReserveAfter: BN;
501
- sqrtKAfter: BN;
502
- baseAssetAmountLong: BN;
503
- baseAssetAmountShort: BN;
504
- baseAssetAmountWithAmm: BN;
505
- totalFee: BN;
506
- totalFeeMinusDistributions: BN;
507
- adjustmentCost: BN;
508
- numberOfUsers: BN;
509
- oraclePrice: BN;
510
- fillRecord: BN;
511
- };
512
- export declare type InsuranceFundRecord = {
513
- ts: BN;
514
- spotMarketIndex: number;
515
- perpMarketIndex: number;
516
- userIfFactor: number;
517
- totalIfFactor: number;
518
- vaultAmountBefore: BN;
519
- insuranceVaultAmountBefore: BN;
520
- totalIfSharesBefore: BN;
521
- totalIfSharesAfter: BN;
522
- amount: BN;
523
- };
524
- export declare type InsuranceFundStakeRecord = {
525
- ts: BN;
526
- userAuthority: PublicKey;
527
- action: StakeAction;
528
- amount: BN;
529
- marketIndex: number;
530
- insuranceVaultAmountBefore: BN;
531
- ifSharesBefore: BN;
532
- userIfSharesBefore: BN;
533
- totalIfSharesBefore: BN;
534
- ifSharesAfter: BN;
535
- userIfSharesAfter: BN;
536
- totalIfSharesAfter: BN;
537
- };
538
- export type LPRecord = {
539
- ts: BN;
540
- user: PublicKey;
541
- action: LPAction;
542
- nShares: BN;
543
- marketIndex: number;
544
- deltaBaseAssetAmount: BN;
545
- deltaQuoteAssetAmount: BN;
546
- pnl: BN;
547
- };
548
- export declare class LPAction {
549
- static readonly ADD_LIQUIDITY: {
550
- addLiquidity: {};
551
- };
552
- static readonly REMOVE_LIQUIDITY: {
553
- removeLiquidity: {};
554
- };
555
- static readonly SETTLE_LIQUIDITY: {
556
- settleLiquidity: {};
557
- };
558
- static readonly REMOVE_LIQUIDITY_DERISK: {
559
- removeLiquidityDerisk: {};
560
- };
561
- }
562
- export type FundingRateRecord = {
563
- ts: BN;
564
- recordId: BN;
565
- marketIndex: number;
566
- fundingRate: BN;
567
- fundingRateLong: BN;
568
- fundingRateShort: BN;
569
- cumulativeFundingRateLong: BN;
570
- cumulativeFundingRateShort: BN;
571
- oraclePriceTwap: BN;
572
- markPriceTwap: BN;
573
- periodRevenue: BN;
574
- baseAssetAmountWithAmm: BN;
575
- baseAssetAmountWithUnsettledLp: BN;
576
- };
577
- export type FundingPaymentRecord = {
578
- ts: BN;
579
- userAuthority: PublicKey;
580
- user: PublicKey;
581
- marketIndex: number;
582
- fundingPayment: BN;
583
- baseAssetAmount: BN;
584
- userLastCumulativeFunding: BN;
585
- ammCumulativeFundingLong: BN;
586
- ammCumulativeFundingShort: BN;
587
- };
588
- export type LiquidationRecord = {
589
- ts: BN;
590
- user: PublicKey;
591
- liquidator: PublicKey;
592
- liquidationType: LiquidationType;
593
- marginRequirement: BN;
594
- totalCollateral: BN;
595
- marginFreed: BN;
596
- liquidationId: number;
597
- bankrupt: boolean;
598
- canceledOrderIds: BN[];
599
- liquidatePerp: LiquidatePerpRecord;
600
- liquidateSpot: LiquidateSpotRecord;
601
- liquidateBorrowForPerpPnl: LiquidateBorrowForPerpPnlRecord;
602
- liquidatePerpPnlForDeposit: LiquidatePerpPnlForDepositRecord;
603
- perpBankruptcy: PerpBankruptcyRecord;
604
- spotBankruptcy: SpotBankruptcyRecord;
605
- };
606
- export declare class LiquidationType {
607
- static readonly LIQUIDATE_PERP: {
608
- liquidatePerp: {};
609
- };
610
- static readonly LIQUIDATE_BORROW_FOR_PERP_PNL: {
611
- liquidateBorrowForPerpPnl: {};
612
- };
613
- static readonly LIQUIDATE_PERP_PNL_FOR_DEPOSIT: {
614
- liquidatePerpPnlForDeposit: {};
615
- };
616
- static readonly PERP_BANKRUPTCY: {
617
- perpBankruptcy: {};
618
- };
619
- static readonly SPOT_BANKRUPTCY: {
620
- spotBankruptcy: {};
621
- };
622
- static readonly LIQUIDATE_SPOT: {
623
- liquidateSpot: {};
624
- };
625
- }
626
- export type LiquidatePerpRecord = {
627
- marketIndex: number;
628
- oraclePrice: BN;
629
- baseAssetAmount: BN;
630
- quoteAssetAmount: BN;
631
- lpShares: BN;
632
- userOrderId: BN;
633
- liquidatorOrderId: BN;
634
- fillRecordId: BN;
635
- liquidatorFee: BN;
636
- ifFee: BN;
637
- };
638
- export type LiquidateSpotRecord = {
639
- assetMarketIndex: number;
640
- assetPrice: BN;
641
- assetTransfer: BN;
642
- liabilityMarketIndex: number;
643
- liabilityPrice: BN;
644
- liabilityTransfer: BN;
645
- ifFee: BN;
646
- };
647
- export type LiquidateBorrowForPerpPnlRecord = {
648
- perpMarketIndex: number;
649
- marketOraclePrice: BN;
650
- pnlTransfer: BN;
651
- liabilityMarketIndex: number;
652
- liabilityPrice: BN;
653
- liabilityTransfer: BN;
654
- };
655
- export type LiquidatePerpPnlForDepositRecord = {
656
- perpMarketIndex: number;
657
- marketOraclePrice: BN;
658
- pnlTransfer: BN;
659
- assetMarketIndex: number;
660
- assetPrice: BN;
661
- assetTransfer: BN;
662
- };
663
- export type PerpBankruptcyRecord = {
664
- marketIndex: number;
665
- pnl: BN;
666
- ifPayment: BN;
667
- clawbackUser: PublicKey | null;
668
- clawbackUserPayment: BN | null;
669
- cumulativeFundingRateDelta: BN;
670
- };
671
- export type SpotBankruptcyRecord = {
672
- marketIndex: number;
673
- borrowAmount: BN;
674
- cumulativeDepositInterestDelta: BN;
675
- ifPayment: BN;
676
- };
677
- export type SettlePnlRecord = {
678
- ts: BN;
679
- user: PublicKey;
680
- marketIndex: number;
681
- pnl: BN;
682
- baseAssetAmount: BN;
683
- quoteAssetAmountAfter: BN;
684
- quoteEntryAmount: BN;
685
- settlePrice: BN;
686
- explanation: SettlePnlExplanation;
687
- };
688
- export type SignedMsgOrderRecord = {
689
- ts: BN;
690
- user: PublicKey;
691
- hash: string;
692
- matchingOrderParams: OrderParams;
693
- signedMsgOrderMaxSlot: BN;
694
- signedMsgOrderUuid: Uint8Array;
695
- userOrderId: number;
696
- };
697
- export type OrderRecord = {
698
- ts: BN;
699
- user: PublicKey;
700
- order: Order;
701
- };
702
- export type OrderActionRecord = {
703
- ts: BN;
704
- action: OrderAction;
705
- actionExplanation: OrderActionExplanation;
706
- marketIndex: number;
707
- marketType: MarketType;
708
- filler: PublicKey | null;
709
- fillerReward: BN | null;
710
- fillRecordId: BN | null;
711
- baseAssetAmountFilled: BN | null;
712
- quoteAssetAmountFilled: BN | null;
713
- takerFee: BN | null;
714
- makerFee: BN | null;
715
- referrerReward: number | null;
716
- quoteAssetAmountSurplus: BN | null;
717
- spotFulfillmentMethodFee: BN | null;
718
- taker: PublicKey | null;
719
- takerOrderId: number | null;
720
- takerOrderDirection: PositionDirection | null;
721
- takerOrderBaseAssetAmount: BN | null;
722
- takerOrderCumulativeBaseAssetAmountFilled: BN | null;
723
- takerOrderCumulativeQuoteAssetAmountFilled: BN | null;
724
- maker: PublicKey | null;
725
- makerOrderId: number | null;
726
- makerOrderDirection: PositionDirection | null;
727
- makerOrderBaseAssetAmount: BN | null;
728
- makerOrderCumulativeBaseAssetAmountFilled: BN | null;
729
- makerOrderCumulativeQuoteAssetAmountFilled: BN | null;
730
- oraclePrice: BN;
731
- };
732
- export type SwapRecord = {
733
- ts: BN;
734
- user: PublicKey;
735
- amountOut: BN;
736
- amountIn: BN;
737
- outMarketIndex: number;
738
- inMarketIndex: number;
739
- outOraclePrice: BN;
740
- inOraclePrice: BN;
741
- fee: BN;
742
- };
743
- export type SpotMarketVaultDepositRecord = {
744
- ts: BN;
745
- marketIndex: number;
746
- depositBalance: BN;
747
- cumulativeDepositInterestBefore: BN;
748
- cumulativeDepositInterestAfter: BN;
749
- depositTokenAmountBefore: BN;
750
- amount: BN;
751
- };
752
- export type DeleteUserRecord = {
753
- ts: BN;
754
- userAuthority: PublicKey;
755
- user: PublicKey;
756
- subAccountId: number;
757
- keeper: PublicKey | null;
758
- };
759
- export type FuelSeasonRecord = {
760
- ts: BN;
761
- authority: PublicKey;
762
- fuelInsurance: BN;
763
- fuelDeposits: BN;
764
- fuelBorrows: BN;
765
- fuelPositions: BN;
766
- fuelTaker: BN;
767
- fuelMaker: BN;
768
- fuelTotal: BN;
769
- };
770
- export type FuelSweepRecord = {
771
- ts: BN;
772
- authority: PublicKey;
773
- userStatsFuelInsurance: BN;
774
- userStatsFuelDeposits: BN;
775
- userStatsFuelBorrows: BN;
776
- userStatsFuelPositions: BN;
777
- userStatsFuelTaker: BN;
778
- userStatsFuelMaker: BN;
779
- fuelOverflowFuelInsurance: BN;
780
- fuelOverflowFuelDeposits: BN;
781
- fuelOverflowFuelBorrows: BN;
782
- fuelOverflowFuelPositions: BN;
783
- fuelOverflowFuelTaker: BN;
784
- fuelOverflowFuelMaker: BN;
785
- };
786
- export type DriftStateAccount = {
787
- admin: PublicKey;
788
- exchangeStatus: number;
789
- whitelistMint: PublicKey;
790
- discountMint: PublicKey;
791
- oracleGuardRails: OracleGuardRails;
792
- numberOfAuthorities: BN;
793
- numberOfSubAccounts: BN;
794
- numberOfMarkets: number;
795
- numberOfSpotMarkets: number;
796
- minPerpAuctionDuration: number;
797
- defaultMarketOrderTimeInForce: number;
798
- defaultSpotAuctionDuration: number;
799
- liquidationMarginBufferRatio: number;
800
- settlementDuration: number;
801
- maxNumberOfSubAccounts: number;
802
- signer: PublicKey;
803
- signerNonce: number;
804
- srmVault: PublicKey;
805
- perpFeeStructure: FeeStructure;
806
- spotFeeStructure: FeeStructure;
807
- lpCooldownTime: BN;
808
- initialPctToLiquidate: number;
809
- liquidationDuration: number;
810
- maxInitializeUserFee: number;
811
- };
812
- export type PerpMarketAccount = {
813
- status: MarketStatus;
814
- contractType: ContractType;
815
- contractTier: ContractTier;
816
- expiryTs: BN;
817
- expiryPrice: BN;
818
- marketIndex: number;
819
- pubkey: PublicKey;
820
- name: number[];
821
- amm: AMM;
822
- numberOfUsersWithBase: number;
823
- numberOfUsers: number;
824
- marginRatioInitial: number;
825
- marginRatioMaintenance: number;
826
- nextFillRecordId: BN;
827
- nextFundingRateRecordId: BN;
828
- nextCurveRecordId: BN;
829
- pnlPool: PoolBalance;
830
- liquidatorFee: number;
831
- ifLiquidationFee: number;
832
- imfFactor: number;
833
- unrealizedPnlImfFactor: number;
834
- unrealizedPnlMaxImbalance: BN;
835
- unrealizedPnlInitialAssetWeight: number;
836
- unrealizedPnlMaintenanceAssetWeight: number;
837
- insuranceClaim: {
838
- revenueWithdrawSinceLastSettle: BN;
839
- maxRevenueWithdrawPerPeriod: BN;
840
- lastRevenueWithdrawTs: BN;
841
- quoteSettledInsurance: BN;
842
- quoteMaxInsurance: BN;
843
- };
844
- quoteSpotMarketIndex: number;
845
- feeAdjustment: number;
846
- pausedOperations: number;
847
- fuelBoostTaker: number;
848
- fuelBoostMaker: number;
849
- fuelBoostPosition: number;
850
- highLeverageMarginRatioInitial: number;
851
- highLeverageMarginRatioMaintenance: number;
852
- };
853
- export type HistoricalOracleData = {
854
- lastOraclePrice: BN;
855
- lastOracleDelay: BN;
856
- lastOracleConf: BN;
857
- lastOraclePriceTwap: BN;
858
- lastOraclePriceTwap5Min: BN;
859
- lastOraclePriceTwapTs: BN;
860
- };
861
- export type HistoricalIndexData = {
862
- lastIndexBidPrice: BN;
863
- lastIndexAskPrice: BN;
864
- lastIndexPriceTwap: BN;
865
- lastIndexPriceTwap5Min: BN;
866
- lastIndexPriceTwapTs: BN;
867
- };
868
- export type SpotMarketAccount = {
869
- status: MarketStatus;
870
- assetTier: AssetTier;
871
- name: number[];
872
- marketIndex: number;
873
- pubkey: PublicKey;
874
- mint: PublicKey;
875
- vault: PublicKey;
876
- oracle: PublicKey;
877
- oracleSource: OracleSource;
878
- historicalOracleData: HistoricalOracleData;
879
- historicalIndexData: HistoricalIndexData;
880
- insuranceFund: {
881
- vault: PublicKey;
882
- totalShares: BN;
883
- userShares: BN;
884
- sharesBase: BN;
885
- unstakingPeriod: BN;
886
- lastRevenueSettleTs: BN;
887
- revenueSettlePeriod: BN;
888
- totalFactor: number;
889
- userFactor: number;
890
- };
891
- revenuePool: PoolBalance;
892
- ifLiquidationFee: number;
893
- decimals: number;
894
- optimalUtilization: number;
895
- optimalBorrowRate: number;
896
- maxBorrowRate: number;
897
- cumulativeDepositInterest: BN;
898
- cumulativeBorrowInterest: BN;
899
- totalSocialLoss: BN;
900
- totalQuoteSocialLoss: BN;
901
- depositBalance: BN;
902
- borrowBalance: BN;
903
- maxTokenDeposits: BN;
904
- lastInterestTs: BN;
905
- lastTwapTs: BN;
906
- initialAssetWeight: number;
907
- maintenanceAssetWeight: number;
908
- initialLiabilityWeight: number;
909
- maintenanceLiabilityWeight: number;
910
- liquidatorFee: number;
911
- imfFactor: number;
912
- scaleInitialAssetWeightStart: BN;
913
- withdrawGuardThreshold: BN;
914
- depositTokenTwap: BN;
915
- borrowTokenTwap: BN;
916
- utilizationTwap: BN;
917
- nextDepositRecordId: BN;
918
- orderStepSize: BN;
919
- orderTickSize: BN;
920
- minOrderSize: BN;
921
- maxPositionSize: BN;
922
- nextFillRecordId: BN;
923
- spotFeePool: PoolBalance;
924
- totalSpotFee: BN;
925
- totalSwapFee: BN;
926
- flashLoanAmount: BN;
927
- flashLoanInitialTokenAmount: BN;
928
- ordersEnabled: boolean;
929
- pausedOperations: number;
930
- ifPausedOperations: number;
931
- maxTokenBorrowsFraction: number;
932
- minBorrowRate: number;
933
- fuelBoostDeposits: number;
934
- fuelBoostBorrows: number;
935
- fuelBoostTaker: number;
936
- fuelBoostMaker: number;
937
- fuelBoostInsurance: number;
938
- tokenProgram: number;
939
- poolId: number;
940
- };
941
- export type PoolBalance = {
942
- scaledBalance: BN;
943
- marketIndex: number;
944
- };
945
- export type AMM = {
946
- baseAssetReserve: BN;
947
- sqrtK: BN;
948
- cumulativeFundingRate: BN;
949
- lastFundingRate: BN;
950
- lastFundingRateTs: BN;
951
- lastMarkPriceTwap: BN;
952
- lastMarkPriceTwap5Min: BN;
953
- lastMarkPriceTwapTs: BN;
954
- lastTradeTs: BN;
955
- oracle: PublicKey;
956
- oracleSource: OracleSource;
957
- historicalOracleData: HistoricalOracleData;
958
- lastOracleReservePriceSpreadPct: BN;
959
- lastOracleConfPct: BN;
960
- fundingPeriod: BN;
961
- quoteAssetReserve: BN;
962
- pegMultiplier: BN;
963
- cumulativeFundingRateLong: BN;
964
- cumulativeFundingRateShort: BN;
965
- last24HAvgFundingRate: BN;
966
- lastFundingRateShort: BN;
967
- lastFundingRateLong: BN;
968
- totalLiquidationFee: BN;
969
- totalFeeMinusDistributions: BN;
970
- totalFeeWithdrawn: BN;
971
- totalFee: BN;
972
- totalFeeEarnedPerLp: BN;
973
- userLpShares: BN;
974
- baseAssetAmountWithUnsettledLp: BN;
975
- orderStepSize: BN;
976
- orderTickSize: BN;
977
- maxFillReserveFraction: number;
978
- maxSlippageRatio: number;
979
- baseSpread: number;
980
- curveUpdateIntensity: number;
981
- baseAssetAmountWithAmm: BN;
982
- baseAssetAmountLong: BN;
983
- baseAssetAmountShort: BN;
984
- quoteAssetAmount: BN;
985
- terminalQuoteAssetReserve: BN;
986
- concentrationCoef: BN;
987
- feePool: PoolBalance;
988
- totalExchangeFee: BN;
989
- totalMmFee: BN;
990
- netRevenueSinceLastFunding: BN;
991
- lastUpdateSlot: BN;
992
- lastOracleNormalisedPrice: BN;
993
- lastOracleValid: boolean;
994
- lastBidPriceTwap: BN;
995
- lastAskPriceTwap: BN;
996
- longSpread: number;
997
- shortSpread: number;
998
- maxSpread: number;
999
- baseAssetAmountPerLp: BN;
1000
- quoteAssetAmountPerLp: BN;
1001
- targetBaseAssetAmountPerLp: number;
1002
- ammJitIntensity: number;
1003
- maxOpenInterest: BN;
1004
- maxBaseAssetReserve: BN;
1005
- minBaseAssetReserve: BN;
1006
- totalSocialLoss: BN;
1007
- quoteBreakEvenAmountLong: BN;
1008
- quoteBreakEvenAmountShort: BN;
1009
- quoteEntryAmountLong: BN;
1010
- quoteEntryAmountShort: BN;
1011
- markStd: BN;
1012
- oracleStd: BN;
1013
- longIntensityCount: number;
1014
- longIntensityVolume: BN;
1015
- shortIntensityCount: number;
1016
- shortIntensityVolume: BN;
1017
- volume24H: BN;
1018
- minOrderSize: BN;
1019
- maxPositionSize: BN;
1020
- bidBaseAssetReserve: BN;
1021
- bidQuoteAssetReserve: BN;
1022
- askBaseAssetReserve: BN;
1023
- askQuoteAssetReserve: BN;
1024
- perLpBase: number;
1025
- netUnsettledFundingPnl: BN;
1026
- quoteAssetAmountWithUnsettledLp: BN;
1027
- referencePriceOffset: number;
1028
- };
1029
- export type PerpPosition = {
1030
- baseAssetAmount: BN;
1031
- lastCumulativeFundingRate: BN;
1032
- marketIndex: number;
1033
- quoteAssetAmount: BN;
1034
- quoteEntryAmount: BN;
1035
- quoteBreakEvenAmount: BN;
1036
- openOrders: number;
1037
- openBids: BN;
1038
- openAsks: BN;
1039
- settledPnl: BN;
1040
- lpShares: BN;
1041
- remainderBaseAssetAmount: number;
1042
- lastBaseAssetAmountPerLp: BN;
1043
- lastQuoteAssetAmountPerLp: BN;
1044
- perLpBase: number;
1045
- };
1046
- export type UserStatsAccount = {
1047
- numberOfSubAccounts: number;
1048
- numberOfSubAccountsCreated: number;
1049
- makerVolume30D: BN;
1050
- takerVolume30D: BN;
1051
- fillerVolume30D: BN;
1052
- lastMakerVolume30DTs: BN;
1053
- lastTakerVolume30DTs: BN;
1054
- lastFillerVolume30DTs: BN;
1055
- fees: {
1056
- totalFeePaid: BN;
1057
- totalFeeRebate: BN;
1058
- totalTokenDiscount: BN;
1059
- totalRefereeDiscount: BN;
1060
- totalReferrerReward: BN;
1061
- current_epoch_referrer_reward: BN;
1062
- };
1063
- referrer: PublicKey;
1064
- referrerStatus: number;
1065
- authority: PublicKey;
1066
- ifStakedQuoteAssetAmount: BN;
1067
- lastFuelIfBonusUpdateTs: number;
1068
- fuelOverflowStatus: number;
1069
- fuelInsurance: number;
1070
- fuelDeposits: number;
1071
- fuelBorrows: number;
1072
- fuelPositions: number;
1073
- fuelTaker: number;
1074
- fuelMaker: number;
1075
- ifStakedGovTokenAmount: BN;
1076
- };
1077
- export type FuelOverflowAccount = {
1078
- authority: PublicKey;
1079
- fuelInsurance: BN;
1080
- fuelDeposits: BN;
1081
- fuelBorrows: BN;
1082
- fuelPositions: BN;
1083
- fuelTaker: BN;
1084
- fuelMaker: BN;
1085
- lastFuelSweepTs: number;
1086
- lastResetTs: number;
1087
- padding: number[];
1088
- };
1089
- export type UserAccount = {
1090
- authority: PublicKey;
1091
- delegate: PublicKey;
1092
- name: number[];
1093
- subAccountId: number;
1094
- spotPositions: SpotPosition[];
1095
- perpPositions: PerpPosition[];
1096
- orders: Order[];
1097
- status: number;
1098
- nextLiquidationId: number;
1099
- nextOrderId: number;
1100
- maxMarginRatio: number;
1101
- lastAddPerpLpSharesTs: BN;
1102
- settledPerpPnl: BN;
1103
- totalDeposits: BN;
1104
- totalWithdraws: BN;
1105
- totalSocialLoss: BN;
1106
- cumulativePerpFunding: BN;
1107
- cumulativeSpotFees: BN;
1108
- liquidationMarginFreed: BN;
1109
- lastActiveSlot: BN;
1110
- isMarginTradingEnabled: boolean;
1111
- idle: boolean;
1112
- openOrders: number;
1113
- hasOpenOrder: boolean;
1114
- openAuctions: number;
1115
- hasOpenAuction: boolean;
1116
- lastFuelBonusUpdateTs: number;
1117
- marginMode: MarginMode;
1118
- poolId: number;
1119
- };
1120
- export type SpotPosition = {
1121
- marketIndex: number;
1122
- balanceType: SpotBalanceType;
1123
- scaledBalance: BN;
1124
- openOrders: number;
1125
- openBids: BN;
1126
- openAsks: BN;
1127
- cumulativeDeposits: BN;
1128
- };
1129
432
  export type Order = {
1130
433
  status: OrderStatus;
1131
434
  orderType: OrderType;
@@ -1217,250 +520,3 @@ export declare enum ModifyOrderPolicy {
1217
520
  ExcludePreviousFill = 2
1218
521
  }
1219
522
  export declare const DefaultOrderParams: OrderParams;
1220
- export type SignedMsgOrderParamsMessage = {
1221
- signedMsgOrderParams: OptionalOrderParams;
1222
- subAccountId: number;
1223
- slot: BN;
1224
- uuid: Uint8Array;
1225
- takeProfitOrderParams: SignedMsgTriggerOrderParams | null;
1226
- stopLossOrderParams: SignedMsgTriggerOrderParams | null;
1227
- };
1228
- export type SignedMsgTriggerOrderParams = {
1229
- triggerPrice: BN;
1230
- baseAssetAmount: BN;
1231
- };
1232
- export type MakerInfo = {
1233
- maker: PublicKey;
1234
- makerStats: PublicKey;
1235
- makerUserAccount: UserAccount;
1236
- order?: Order;
1237
- };
1238
- export type TakerInfo = {
1239
- taker: PublicKey;
1240
- takerStats: PublicKey;
1241
- takerUserAccount: UserAccount;
1242
- order: Order;
1243
- };
1244
- export type ReferrerInfo = {
1245
- referrer: PublicKey;
1246
- referrerStats: PublicKey;
1247
- };
1248
- export declare enum ReferrerStatus {
1249
- IsReferrer = 1,
1250
- IsReferred = 2
1251
- }
1252
- export declare enum FuelOverflowStatus {
1253
- Exists = 1
1254
- }
1255
- export declare enum PlaceAndTakeOrderSuccessCondition {
1256
- PartialFill = 1,
1257
- FullFill = 2
1258
- }
1259
- type ExactType<T> = Pick<T, keyof T>;
1260
- export type BaseTxParams = ExactType<{
1261
- computeUnits?: number;
1262
- computeUnitsPrice?: number;
1263
- }>;
1264
- export type ProcessingTxParams = {
1265
- useSimulatedComputeUnits?: boolean;
1266
- computeUnitsBufferMultiplier?: number;
1267
- useSimulatedComputeUnitsForCUPriceCalculation?: boolean;
1268
- getCUPriceFromComputeUnits?: (computeUnits: number) => number;
1269
- lowerBoundCu?: number;
1270
- };
1271
- export type TxParams = BaseTxParams & ProcessingTxParams;
1272
- export declare class SwapReduceOnly {
1273
- static readonly In: {
1274
- in: {};
1275
- };
1276
- static readonly Out: {
1277
- out: {};
1278
- };
1279
- }
1280
- export interface IWallet {
1281
- signTransaction(tx: Transaction): Promise<Transaction>;
1282
- signAllTransactions(txs: Transaction[]): Promise<Transaction[]>;
1283
- publicKey: PublicKey;
1284
- payer?: Keypair;
1285
- supportedTransactionVersions?: ReadonlySet<TransactionVersion> | null | undefined;
1286
- }
1287
- export interface IVersionedWallet {
1288
- signVersionedTransaction(tx: VersionedTransaction): Promise<VersionedTransaction>;
1289
- signAllVersionedTransactions(txs: VersionedTransaction[]): Promise<VersionedTransaction[]>;
1290
- publicKey: PublicKey;
1291
- payer?: Keypair;
1292
- }
1293
- type FeeStructure = {
1294
- feeTiers: FeeTier[];
1295
- fillerRewardStructure: OrderFillerRewardStructure;
1296
- flatFillerFee: BN;
1297
- referrerRewardEpochUpperBound: BN;
1298
- };
1299
- export type FeeTier = {
1300
- feeNumerator: number;
1301
- feeDenominator: number;
1302
- makerRebateNumerator: number;
1303
- makerRebateDenominator: number;
1304
- referrerRewardNumerator: number;
1305
- referrerRewardDenominator: number;
1306
- refereeFeeNumerator: number;
1307
- refereeFeeDenominator: number;
1308
- };
1309
- export type OrderFillerRewardStructure = {
1310
- rewardNumerator: BN;
1311
- rewardDenominator: BN;
1312
- timeBasedRewardLowerBound: BN;
1313
- };
1314
- export type OracleGuardRails = {
1315
- priceDivergence: {
1316
- markOraclePercentDivergence: BN;
1317
- oracleTwap5MinPercentDivergence: BN;
1318
- };
1319
- validity: {
1320
- slotsBeforeStaleForAmm: BN;
1321
- slotsBeforeStaleForMargin: BN;
1322
- confidenceIntervalMaxSize: BN;
1323
- tooVolatileRatio: BN;
1324
- };
1325
- };
1326
- export type PrelaunchOracle = {
1327
- price: BN;
1328
- maxPrice: BN;
1329
- confidence: BN;
1330
- ammLastUpdateSlot: BN;
1331
- lastUpdateSlot: BN;
1332
- perpMarketIndex: number;
1333
- };
1334
- export type MarginCategory = "Initial" | "Maintenance";
1335
- export type InsuranceFundStake = {
1336
- costBasis: BN;
1337
- marketIndex: number;
1338
- authority: PublicKey;
1339
- ifShares: BN;
1340
- ifBase: BN;
1341
- lastWithdrawRequestShares: BN;
1342
- lastWithdrawRequestValue: BN;
1343
- lastWithdrawRequestTs: BN;
1344
- };
1345
- export type SerumV3FulfillmentConfigAccount = {
1346
- fulfillmentType: SpotFulfillmentType;
1347
- status: SpotFulfillmentStatus;
1348
- pubkey: PublicKey;
1349
- marketIndex: number;
1350
- serumProgramId: PublicKey;
1351
- serumMarket: PublicKey;
1352
- serumRequestQueue: PublicKey;
1353
- serumEventQueue: PublicKey;
1354
- serumBids: PublicKey;
1355
- serumAsks: PublicKey;
1356
- serumBaseVault: PublicKey;
1357
- serumQuoteVault: PublicKey;
1358
- serumOpenOrders: PublicKey;
1359
- serumSignerNonce: BN;
1360
- };
1361
- export type PhoenixV1FulfillmentConfigAccount = {
1362
- pubkey: PublicKey;
1363
- phoenixProgramId: PublicKey;
1364
- phoenixLogAuthority: PublicKey;
1365
- phoenixMarket: PublicKey;
1366
- phoenixBaseVault: PublicKey;
1367
- phoenixQuoteVault: PublicKey;
1368
- marketIndex: number;
1369
- fulfillmentType: SpotFulfillmentType;
1370
- status: SpotFulfillmentStatus;
1371
- };
1372
- export type OpenbookV2FulfillmentConfigAccount = {
1373
- pubkey: PublicKey;
1374
- openbookV2ProgramId: PublicKey;
1375
- openbookV2Market: PublicKey;
1376
- openbookV2MarketAuthority: PublicKey;
1377
- openbookV2EventHeap: PublicKey;
1378
- openbookV2Bids: PublicKey;
1379
- openbookV2Asks: PublicKey;
1380
- openbookV2BaseVault: PublicKey;
1381
- openbookV2QuoteVault: PublicKey;
1382
- marketIndex: number;
1383
- fulfillmentType: SpotFulfillmentType;
1384
- status: SpotFulfillmentStatus;
1385
- remainingAccounts?: PublicKey[];
1386
- };
1387
- export type ReferrerNameAccount = {
1388
- name: number[];
1389
- user: PublicKey;
1390
- authority: PublicKey;
1391
- userStats: PublicKey;
1392
- };
1393
- export type PerpMarketExtendedInfo = {
1394
- marketIndex: number;
1395
- /**
1396
- * Min order size measured in base asset, using base precision
1397
- */
1398
- minOrderSize: BN;
1399
- /**
1400
- * Margin maintenance percentage, using margin precision (1e4)
1401
- */
1402
- marginMaintenance: number;
1403
- /**
1404
- * Max insurance available, measured in quote asset, using quote preicision
1405
- */
1406
- availableInsurance: BN;
1407
- /**
1408
- * Pnl pool available, this is measured in quote asset, using quote precision.
1409
- * Should be generated by using getTokenAmount and passing in the scaled balance of the base asset + quote spot account
1410
- */
1411
- pnlPoolValue: BN;
1412
- contractTier: ContractTier;
1413
- };
1414
- export type HealthComponents = {
1415
- deposits: HealthComponent[];
1416
- borrows: HealthComponent[];
1417
- perpPositions: HealthComponent[];
1418
- perpPnl: HealthComponent[];
1419
- };
1420
- export type HealthComponent = {
1421
- marketIndex: number;
1422
- size: BN;
1423
- value: BN;
1424
- weight: BN;
1425
- weightedValue: BN;
1426
- };
1427
- export interface DriftClientMetricsEvents {
1428
- txSigned: SignedTxData[];
1429
- preTxSigned: void;
1430
- }
1431
- export type SignedTxData = {
1432
- txSig: string;
1433
- signedTx: Transaction | VersionedTransaction;
1434
- lastValidBlockHeight?: number;
1435
- blockHash: string;
1436
- };
1437
- export type HighLeverageModeConfig = {
1438
- maxUsers: number;
1439
- currentUsers: number;
1440
- reduceOnly: boolean;
1441
- };
1442
- export type ProtectedMakerModeConfig = {
1443
- maxUsers: number;
1444
- currentUsers: number;
1445
- reduceOnly: boolean;
1446
- };
1447
- export interface SignedMsgOrderParams {
1448
- /**
1449
- * The encoded order params that were signed (borsh encoded then hexified).
1450
- */
1451
- orderParams: Buffer;
1452
- /**
1453
- * The signature generated for the orderParams
1454
- */
1455
- signature: Buffer;
1456
- }
1457
- export type SignedMsgOrderId = {
1458
- maxSlot: BN;
1459
- uuid: Uint8Array;
1460
- orderId: number;
1461
- };
1462
- export type SignedMsgUserOrdersAccount = {
1463
- authorityPubkey: PublicKey;
1464
- signedMsgOrderData: SignedMsgOrderId[];
1465
- };
1466
- export {};