@liberfi.io/types 0.1.4 → 0.1.5

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/dist/index.d.mts CHANGED
@@ -1,12 +1,3 @@
1
- declare global {
2
- interface Window {
3
- __LIBERFI_VERSION__?: {
4
- [key: string]: string;
5
- };
6
- }
7
- }
8
- declare const _default: "0.1.0";
9
-
10
1
  declare enum Chain {
11
2
  ETHEREUM = "1",
12
3
  UBIQ = "8",
@@ -411,33 +402,33 @@ interface TokenStats {
411
402
  /**
412
403
  * token stats by 1m timeframe.
413
404
  */
414
- "1m"?: TokenStatsByTimeframe;
405
+ "1m"?: TokenStatsByResolution;
415
406
  /**
416
407
  * token stats by 5m timeframe.
417
408
  */
418
- "5m"?: TokenStatsByTimeframe;
409
+ "5m"?: TokenStatsByResolution;
419
410
  /**
420
411
  * token stats by 15m timeframe.
421
412
  */
422
- "15m"?: TokenStatsByTimeframe;
413
+ "15m"?: TokenStatsByResolution;
423
414
  /**
424
415
  * token stats by 30m timeframe.
425
416
  */
426
- "30m"?: TokenStatsByTimeframe;
417
+ "30m"?: TokenStatsByResolution;
427
418
  /**
428
419
  * token stats by 1h timeframe.
429
420
  */
430
- "1h"?: TokenStatsByTimeframe;
421
+ "1h"?: TokenStatsByResolution;
431
422
  /**
432
423
  * token stats by 4h timeframe.
433
424
  */
434
- "4h"?: TokenStatsByTimeframe;
425
+ "4h"?: TokenStatsByResolution;
435
426
  /**
436
427
  * token stats by 24h timeframe.
437
428
  */
438
- "24h"?: TokenStatsByTimeframe;
429
+ "24h"?: TokenStatsByResolution;
439
430
  }
440
- interface TokenStatsByTimeframe {
431
+ interface TokenStatsByResolution {
441
432
  /**
442
433
  * buy txs count
443
434
  */
@@ -727,411 +718,575 @@ interface WalletPortfolios {
727
718
  portfolios: Array<Portfolio>;
728
719
  }
729
720
 
730
- declare namespace API {
721
+ /**
722
+ * Cursor list result data
723
+ */
724
+ interface CursorList<T> {
725
+ startCursor?: string;
726
+ endCursor?: string;
727
+ hasPrev?: boolean;
728
+ hasNext?: boolean;
729
+ data: Array<T>;
730
+ }
731
+ /**
732
+ * Cursor list query options
733
+ */
734
+ interface CursorListOptions {
735
+ cursor?: string;
736
+ limit?: number;
737
+ direction?: "next" | "prev";
738
+ }
739
+ /**
740
+ * Options for getting token candles
741
+ */
742
+ interface GetTokenCandlesOptions {
743
+ after?: Date;
744
+ before?: Date;
745
+ limit?: number;
746
+ }
747
+ /**
748
+ * Token field for filtering
749
+ */
750
+ type TokenFieldOption = "price" | "priceChange1m" | "priceChange5m" | "priceChange15m" | "priceChange30m" | "priceChange1h" | "priceChange4h" | "priceChange24h" | "marketCap" | "tvl" | "top10Holdings" | "top10Ratio" | "top100Holdings" | "top100Ratio" | "holders" | "creatorsHoldings" | "creatorsRatio" | "buys1m" | "buys5m" | "buys15m" | "buys30m" | "buys1h" | "buys4h" | "buys24h" | "sells1m" | "sells5m" | "sells15m" | "sells30m" | "sells1h" | "sells4h" | "sells24h" | "trades1m" | "trades5m" | "trades15m" | "trades30m" | "trades1h" | "trades4h" | "trades24h" | "traders1m" | "traders5m" | "traders15m" | "traders30m" | "traders1h" | "traders4h" | "traders24h" | "volumes1m" | "volumes5m" | "volumes15m" | "volumes30m" | "volumes1h" | "volumes4h" | "volumes24h" | "launchedFromProtocolFamily" | "migratedToProtocolFamily" | "tag" | "createdAt" | (string & {});
751
+ /**
752
+ * Token filter option
753
+ */
754
+ interface TokenFilterOption {
755
+ field: TokenFieldOption;
756
+ operator: "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "between" | "in" | "nin" | "contains" | "notContains" | "startsWith" | "endsWith" | "isNotNull" | "isNull";
757
+ value?: string | number | boolean | Array<string | number | boolean>;
758
+ }
759
+ /**
760
+ * Options for getting token list
761
+ */
762
+ interface GetTokenListOptions {
763
+ sortBy?: TokenFieldOption;
764
+ sortDirection?: "asc" | "desc";
765
+ filters?: Array<TokenFilterOption>;
766
+ keywords?: Array<string>;
767
+ excludeKeywords?: Array<string>;
768
+ }
769
+ /**
770
+ * Options for searching tokens
771
+ */
772
+ interface SearchTokensOptions extends CursorListOptions {
773
+ chains?: Array<Chain>;
774
+ keyword?: string;
775
+ filters?: Array<TokenFilterOption>;
776
+ sortBy?: TokenFieldOption;
777
+ sortDirection?: "asc" | "desc";
778
+ }
779
+ /**
780
+ * Search token cursor list
781
+ */
782
+ interface SearchTokenCursorList extends CursorList<Token> {
783
+ total?: number;
784
+ extra?: any;
785
+ }
786
+ declare enum SwapMode {
787
+ EXACT_IN = "ExactIn",
788
+ EXACT_OUT = "ExactOut"
789
+ }
790
+ interface SwapParams {
791
+ chain: Chain;
792
+ userAddress: string;
793
+ input: string;
794
+ output: string;
795
+ mode: SwapMode;
796
+ amount: string;
797
+ slippage?: number;
798
+ priorityFee?: string;
799
+ tipFee?: string;
800
+ isAntiMev?: boolean;
801
+ }
802
+ interface SwapRoutePlan {
803
+ name: string;
804
+ input: string;
805
+ inputAmount: string;
806
+ output: string;
807
+ outputAmount: string;
808
+ feeQuote?: string;
809
+ feeAmount?: string;
810
+ extra?: any;
811
+ }
812
+ interface SwapRoute {
813
+ serializedTx: string;
814
+ plans: Array<SwapRoutePlan>;
815
+ extra?: any;
816
+ }
817
+ interface SendTxParams {
818
+ chain: Chain;
819
+ serializedTx: string;
820
+ extra?: any;
821
+ }
822
+ interface SendTxResult {
823
+ txHash: string;
824
+ extra?: any;
825
+ }
826
+ /**
827
+ * Options for getting trade activities
828
+ */
829
+ interface GetTradeActivitiesOptions extends CursorListOptions {
830
+ before?: Date;
831
+ after?: Date;
832
+ beforeBlockHeight?: number;
833
+ afterBlockHeight?: number;
834
+ type?: "buy" | "sell";
835
+ poolAddress?: string;
836
+ }
837
+ /**
838
+ * API client interface
839
+ */
840
+ interface IClient {
731
841
  /**
732
- * Cursor list result data
842
+ * fetch token info
843
+ * @param chain chain id
844
+ * @param address token address
845
+ * @returns token info
733
846
  */
734
- interface CursorList<T> {
735
- startCursor?: string;
736
- endCursor?: string;
737
- hasPrev?: boolean;
738
- hasNext?: boolean;
739
- data: Array<T>;
740
- }
847
+ getToken(chain: Chain, address: string): Promise<Token>;
741
848
  /**
742
- * Cursor list query options
849
+ * fetch token infos in batch
850
+ * @param chain chain id
851
+ * @param addresses token addresses
852
+ * @returns token infos
743
853
  */
744
- interface CursorListOptions {
745
- cursor?: string;
746
- limit?: number;
747
- direction?: "next" | "prev";
748
- }
854
+ getTokens(chain: Chain, addresses: Array<string>): Promise<Array<Token>>;
749
855
  /**
750
- * Options for getting token candles
856
+ * fetch token candles
857
+ * @param chain chain id
858
+ * @param address token address
859
+ * @param resolution token resolution
860
+ * @param options optional query options
861
+ * @returns token candles
751
862
  */
752
- interface GetTokenCandlesOptions {
753
- after?: Date;
754
- before?: Date;
755
- limit?: number;
756
- }
863
+ getTokenCandles(chain: Chain, address: string, resolution: TokenResolution, options?: GetTokenCandlesOptions): Promise<Array<TokenCandle>>;
757
864
  /**
758
- * Token field for filtering
865
+ * fetch token security
866
+ * @param chain chain id
867
+ * @param address token address
868
+ * @returns token security
759
869
  */
760
- type TokenFieldOption = "price" | "priceChange1m" | "priceChange5m" | "priceChange15m" | "priceChange30m" | "priceChange1h" | "priceChange4h" | "priceChange24h" | "marketCap" | "tvl" | "top10Holdings" | "top10Ratio" | "top100Holdings" | "top100Ratio" | "holders" | "creatorsHoldings" | "creatorsRatio" | "buys1m" | "buys5m" | "buys15m" | "buys30m" | "buys1h" | "buys4h" | "buys24h" | "sells1m" | "sells5m" | "sells15m" | "sells30m" | "sells1h" | "sells4h" | "sells24h" | "trades1m" | "trades5m" | "trades15m" | "trades30m" | "trades1h" | "trades4h" | "trades24h" | "traders1m" | "traders5m" | "traders15m" | "traders30m" | "traders1h" | "traders4h" | "traders24h" | "volumes1m" | "volumes5m" | "volumes15m" | "volumes30m" | "volumes1h" | "volumes4h" | "volumes24h" | "launchedFromProtocolFamily" | "migratedToProtocolFamily" | "tag" | "createdAt" | (string & {});
870
+ getTokenSecurity(chain: Chain, address: string): Promise<TokenSecurity>;
761
871
  /**
762
- * Token filter option
872
+ * fetch token stats
873
+ * @param chain chain id
874
+ * @param address token address
875
+ * @returns token stats
763
876
  */
764
- interface TokenFilterOption {
765
- field: TokenFieldOption;
766
- operator: "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "between" | "in" | "nin" | "contains" | "notContains" | "startsWith" | "endsWith" | "isNotNull" | "isNull";
767
- value?: string | number | boolean | Array<string | number | boolean>;
768
- }
877
+ getTokenStats(chain: Chain, address: string): Promise<TokenStats>;
769
878
  /**
770
- * Options for getting token list
879
+ * fetch token holders
880
+ * @param chain chain id
881
+ * @param address token address
882
+ * @param options optional query options
883
+ * @returns token holders
771
884
  */
772
- interface GetTokenListOptions {
773
- sortBy?: TokenFieldOption;
774
- sortDirection?: "asc" | "desc";
775
- filters?: Array<TokenFilterOption>;
776
- keywords?: Array<string>;
777
- excludeKeywords?: Array<string>;
778
- }
885
+ getTokenHolders(chain: Chain, address: string, options?: CursorListOptions): Promise<CursorList<TokenHolder>>;
779
886
  /**
780
- * Options for searching tokens
887
+ * fetch token market data
888
+ * @param chain chain id
889
+ * @param address token address
890
+ * @returns token market data
781
891
  */
782
- interface SearchTokensOptions extends CursorListOptions {
783
- chains?: Array<Chain>;
784
- keyword?: string;
785
- filters?: Array<TokenFilterOption>;
786
- sortBy?: TokenFieldOption;
787
- sortDirection?: "asc" | "desc";
788
- }
892
+ getTokenMarketData(chain: Chain, address: string): Promise<TokenMarketData>;
789
893
  /**
790
- * Search token cursor list
894
+ * fetch `New` token list
895
+ * @param chain chain id
896
+ * @param options optional query options
897
+ * @returns `New` token list
791
898
  */
792
- interface SearchTokenCursorList extends CursorList<Token> {
793
- total?: number;
794
- extra?: any;
795
- }
796
- enum SwapMode {
797
- EXACT_IN = "ExactIn",
798
- EXACT_OUT = "ExactOut"
799
- }
800
- interface SwapParams {
801
- chain: Chain;
802
- userAddress: string;
803
- input: string;
804
- output: string;
805
- mode: SwapMode;
806
- amount: string;
807
- slippage?: number;
808
- priorityFee?: string;
809
- tipFee?: string;
810
- isAntiMev?: boolean;
811
- }
812
- interface SwapRoutePlan {
813
- name: string;
814
- input: string;
815
- inputAmount: string;
816
- output: string;
817
- outputAmount: string;
818
- feeQuote?: string;
819
- feeAmount?: string;
820
- extra?: any;
821
- }
822
- interface SwapRoute {
823
- serializedTx: string;
824
- plans: Array<SwapRoutePlan>;
825
- extra?: any;
826
- }
827
- interface SendTxParams {
828
- chain: Chain;
829
- serializedTx: string;
830
- extra?: any;
831
- }
832
- interface SendTxResult {
833
- txHash: string;
834
- extra?: any;
835
- }
899
+ getNewTokens(chain: Chain, options?: GetTokenListOptions): Promise<Array<Token>>;
836
900
  /**
837
- * Options for getting trade activities
901
+ * fetch `Final Stretch` token list
902
+ * @param chain chain id
903
+ * @param options optional query options
904
+ * @returns `Final Stretch` token list
838
905
  */
839
- interface GetTradeActivitiesOptions extends CursorListOptions {
840
- before?: Date;
841
- after?: Date;
842
- beforeBlockHeight?: number;
843
- afterBlockHeight?: number;
844
- type?: "buy" | "sell";
845
- poolAddress?: string;
846
- }
906
+ getFinalStretchTokens(chain: Chain, options?: GetTokenListOptions): Promise<Array<Token>>;
847
907
  /**
848
- * API client interface
849
- */
850
- interface IClient {
851
- /**
852
- * fetch token info
853
- * @param chain chain id
854
- * @param address token address
855
- * @returns token info
856
- */
857
- getToken(chain: Chain, address: string): Promise<Token>;
858
- /**
859
- * fetch token infos in batch
860
- * @param chain chain id
861
- * @param addresses token addresses
862
- * @returns token infos
863
- */
864
- getTokens(chain: Chain, addresses: Array<string>): Promise<Array<Token>>;
865
- /**
866
- * fetch token candles
867
- * @param chain chain id
868
- * @param address token address
869
- * @param resolution token resolution
870
- * @param options optional query options
871
- * @returns token candles
872
- */
873
- getTokenCandles(chain: Chain, address: string, resolution: TokenResolution, options?: GetTokenCandlesOptions): Promise<Array<TokenCandle>>;
874
- /**
875
- * fetch token security
876
- * @param chain chain id
877
- * @param address token address
878
- * @returns token security
879
- */
880
- getTokenSecurity(chain: Chain, address: string): Promise<TokenSecurity>;
881
- /**
882
- * fetch token stats
883
- * @param chain chain id
884
- * @param address token address
885
- * @returns token stats
886
- */
887
- getTokenStats(chain: Chain, address: string): Promise<TokenStats>;
888
- /**
889
- * fetch token holders
890
- * @param chain chain id
891
- * @param address token address
892
- * @param options optional query options
893
- * @returns token holders
894
- */
895
- getTokenHolders(chain: Chain, address: string, options?: CursorListOptions): Promise<CursorList<TokenHolder>>;
896
- /**
897
- * fetch token market data
898
- * @param chain chain id
899
- * @param address token address
900
- * @returns token market data
901
- */
902
- getTokenMarketData(chain: Chain, address: string): Promise<TokenMarketData>;
903
- /**
904
- * fetch `New` token list
905
- * @param chain chain id
906
- * @param options optional query options
907
- * @returns `New` token list
908
- */
909
- getNewTokens(chain: Chain, options?: GetTokenListOptions): Promise<Array<Token>>;
910
- /**
911
- * fetch `Final Stretch` token list
912
- * @param chain chain id
913
- * @param options optional query options
914
- * @returns `Final Stretch` token list
915
- */
916
- getFinalStretchTokens(chain: Chain, options?: GetTokenListOptions): Promise<Array<Token>>;
917
- /**
918
- * fetch `Migrated` token list
919
- * @param chain chain id
920
- * @param options optional query options
921
- * @returns `Migrated` token list
922
- */
923
- getMigratedTokens(chain: Chain, options?: GetTokenListOptions): Promise<Array<Token>>;
924
- /**
925
- * fetch `Trending` token list
926
- * @param chain chain id
927
- * @param resolution query resolution, e.g. "1m", "5m", "1h", "4h", "24h"
928
- * @param options optional query options
929
- * @returns `Trending` token list
930
- */
931
- getTrendingTokens(chain: Chain, resolution: "1m" | "5m" | "1h" | "4h" | "24h", options?: GetTokenListOptions): Promise<Array<Token>>;
932
- /**
933
- * fetch `Stock` token list
934
- * @param chain chain id
935
- * @param options optional query options
936
- * @returns `Stock` token list
937
- */
938
- getStockTokens(chain: Chain, options?: GetTokenListOptions): Promise<Array<Token>>;
939
- /**
940
- * search tokens
941
- * @param options optional query options
942
- * @returns search token cursor list
943
- */
944
- searchTokens(options?: SearchTokensOptions): Promise<SearchTokenCursorList>;
945
- /**
946
- * fetch swap route plans
947
- * @param params swap params
948
- * @returns swap route plans
949
- */
950
- swapRoute(params: SwapParams): Promise<SwapRoute>;
951
- /**
952
- * send tx
953
- * @param params send tx params
954
- * @returns send tx result
955
- */
956
- sendTx(params: SendTxParams): Promise<SendTxResult>;
957
- /**
958
- * check if tx is successful
959
- * @param chain chain id
960
- * @param txHash tx hash
961
- * @param timeout timeout in milliseconds
962
- * @returns true if tx is successful, false otherwise
963
- */
964
- checkTxSuccess(chain: Chain, txHash: string, timeout?: number): Promise<boolean>;
965
- /**
966
- * fetch wallet portfolios
967
- * @param chain chain id
968
- * @param address wallet address
969
- * @returns wallet portfolios
970
- */
971
- getWalletPortfolios(chain: Chain, address: string): Promise<WalletPortfolios>;
972
- /**
973
- * fetch wallet's trade activities
974
- * @param chain chain id
975
- * @param address wallet address
976
- * @param options optional query options
977
- * @returns wallet's trade activities
978
- */
979
- getWalletTradeActivities(chain: Chain, address: string, options?: GetTradeActivitiesOptions): Promise<CursorList<TradeActivity>>;
980
- /**
981
- * fetch token's trade activities
982
- * @param chain chain id
983
- * @param address token address
984
- * @param options optional query options
985
- * @returns token's trade activities
986
- */
987
- getTokenTradeActivities(chain: Chain, address: string, options?: GetTradeActivitiesOptions): Promise<CursorList<TradeActivity>>;
988
- /**
989
- * get presigned upload url
990
- * @returns presigned upload url
991
- */
992
- getPresignedUploadUrl(): Promise<string>;
993
- }
994
- interface ISubscription {
995
- unsubscribe(): void;
996
- }
997
- interface TokenSubscribed {
998
- chain: Chain;
999
- address: string;
1000
- name?: string;
1001
- symbol?: string;
1002
- decimals?: number;
1003
- image?: string;
1004
- description?: string;
1005
- socialMedias?: TokenSocialMedias;
1006
- launchedFrom?: TokenLaunchedFrom;
1007
- migratedTo?: TokenMigratedTo;
1008
- createdAt: Date;
1009
- }
1010
- interface WalletPnlSubscribed {
1011
- chain: Chain;
1012
- address: string;
1013
- balanceInUsd?: string;
1014
- profitInUsd?: string;
1015
- }
1016
- interface PortfolioSubscribed {
1017
- chain: Chain;
1018
- address: string;
1019
- amount?: string;
1020
- }
1021
- type PortfolioPnlSubscribed = PortfolioPnl & {
1022
- chain: Chain;
1023
- address: string;
1024
- };
1025
- /**
1026
- * Subscribe client interface
1027
- */
1028
- interface ISubscribeClient {
1029
- /**
1030
- * Subscribe token's basic info changes
1031
- * @param chain chain id
1032
- * @param address token address
1033
- * @param callback callback function
1034
- * @returns subscription
1035
- */
1036
- subscribeTokenBasic(chain: Chain, address: string, callback: (tokens: Array<TokenSubscribed>) => void): ISubscription;
1037
- /**
1038
- * Subscribe token's market data changes
1039
- * @param chain chain id
1040
- * @param address token address
1041
- * @param callback callback function
1042
- * @returns subscription
1043
- */
1044
- subscribeTokenMarketData(chain: Chain, address: string, callback: (marketDatas: Array<TokenMarketData>) => void): ISubscription;
1045
- /**
1046
- * Subscribe token's stats changes
1047
- * @param chain chain id
1048
- * @param address token address
1049
- * @param callback callback function
1050
- * @returns subscription
1051
- */
1052
- subscribeTokenStats(chain: Chain, address: string, callback: (stats: Array<TokenStats>) => void): ISubscription;
1053
- /**
1054
- * Subscribe token new candles
1055
- * @param chain chain id
1056
- * @param address token address
1057
- * @param resolution token resolution
1058
- * @param callback callback function
1059
- * @returns subscription
1060
- */
1061
- subscribeTokenCandles(chain: Chain, address: string, resolution: TokenResolution, callback: (candles: Array<TokenCandle>) => void): ISubscription;
1062
- /**
1063
- * Subscribe wallet's pnl changes
1064
- * @param chain chain id
1065
- * @param address wallet address
1066
- * @param callback callback function
1067
- * @returns subscription
1068
- */
1069
- subscribeWalletPnl(chain: Chain, address: string, callback: (pnls: Array<WalletPnlSubscribed>) => void): ISubscription;
1070
- /**
1071
- * Subscribe wallet's portfolio changes
1072
- * @param chain chain id
1073
- * @param address wallet address
1074
- * @param callback callback function
1075
- * @returns subscription
1076
- */
1077
- subscribeWalletPortfolios(chain: Chain, address: string, callback: (portfolios: Array<PortfolioSubscribed>) => void): ISubscription;
1078
- /**
1079
- * Subscribe wallet's portfolio pnl changes
1080
- * @param chain chain id
1081
- * @param address wallet address
1082
- * @param callback callback function
1083
- * @returns subscription
1084
- */
1085
- subscribeWalletPortfolioPnls(chain: Chain, address: string, callback: (portfolioPnls: Array<PortfolioPnlSubscribed>) => void): ISubscription;
1086
- /**
1087
- * Subscribe wallet's new trade activities
1088
- * @param chain chain id
1089
- * @param address wallet address
1090
- * @param callback callback function
1091
- * @returns subscription
1092
- */
1093
- subscribeWalletTradeActivities(chain: Chain, address: string, callback: (trades: Array<TradeActivity>) => void): ISubscription;
1094
- /**
1095
- * Subscribe token's new trade activities
1096
- * @param chain chain id
1097
- * @param address token address
1098
- * @param callback callback function
1099
- * @returns subscription
1100
- */
1101
- subscribeTokenTradeActivities(chain: Chain, address: string, callback: (trades: Array<TradeActivity>) => void): ISubscription;
1102
- /**
1103
- * Subscribe `New` token list changes
1104
- * @param chain chain id
1105
- * @param callback callback function
1106
- * @returns subscription
1107
- */
1108
- subscribeNewTokens(chain: Chain, callback: (tokens: Array<TokenSubscribed>) => void): ISubscription;
1109
- /**
1110
- * Subscribe `New` token list's basic info changes
1111
- * @param chain chain id
1112
- * @param callback callback function
1113
- * @returns subscription
1114
- */
1115
- subscribeNewTokensBasic(chain: Chain, callback: (tokens: Array<TokenSubscribed>) => void): ISubscription;
1116
- /**
1117
- * Subscribe `New` token list's market data changes
1118
- * @param chain chain id
1119
- * @param callback callback function
1120
- * @returns subscription
1121
- */
1122
- subscribeNewTokensMarketData(chain: Chain, callback: (marketDatas: Array<TokenMarketData>) => void): ISubscription;
1123
- /**
1124
- * Subscribe `New` token list's stats changes
1125
- * @param chain chain id
1126
- * @param callback callback function
1127
- * @returns subscription
1128
- */
1129
- subscribeNewTokensStats(chain: Chain, callback: (stats: Array<TokenStats>) => void): ISubscription;
908
+ * fetch `Migrated` token list
909
+ * @param chain chain id
910
+ * @param options optional query options
911
+ * @returns `Migrated` token list
912
+ */
913
+ getMigratedTokens(chain: Chain, options?: GetTokenListOptions): Promise<Array<Token>>;
914
+ /**
915
+ * fetch `Trending` token list
916
+ * @param chain chain id
917
+ * @param resolution query resolution, e.g. "1m", "5m", "1h", "4h", "24h"
918
+ * @param options optional query options
919
+ * @returns `Trending` token list
920
+ */
921
+ getTrendingTokens(chain: Chain, resolution: "1m" | "5m" | "1h" | "4h" | "24h", options?: GetTokenListOptions): Promise<Array<Token>>;
922
+ /**
923
+ * fetch `Stock` token list
924
+ * @param chain chain id
925
+ * @param options optional query options
926
+ * @returns `Stock` token list
927
+ */
928
+ getStockTokens(chain: Chain, options?: GetTokenListOptions): Promise<Array<Token>>;
929
+ /**
930
+ * search tokens
931
+ * @param options optional query options
932
+ * @returns search token cursor list
933
+ */
934
+ searchTokens(options?: SearchTokensOptions): Promise<SearchTokenCursorList>;
935
+ /**
936
+ * fetch swap route plans
937
+ * @param params swap params
938
+ * @returns swap route plans
939
+ */
940
+ swapRoute(params: SwapParams): Promise<SwapRoute>;
941
+ /**
942
+ * send tx
943
+ * @param params send tx params
944
+ * @returns send tx result
945
+ */
946
+ sendTx(params: SendTxParams): Promise<SendTxResult>;
947
+ /**
948
+ * check if tx is successful
949
+ * @param chain chain id
950
+ * @param txHash tx hash
951
+ * @param timeout timeout in milliseconds
952
+ * @returns true if tx is successful, false otherwise
953
+ */
954
+ checkTxSuccess(chain: Chain, txHash: string, timeout?: number): Promise<boolean>;
955
+ /**
956
+ * fetch wallet portfolios
957
+ * @param chain chain id
958
+ * @param address wallet address
959
+ * @returns wallet portfolios
960
+ */
961
+ getWalletPortfolios(chain: Chain, address: string): Promise<WalletPortfolios>;
962
+ /**
963
+ * fetch wallet's trade activities
964
+ * @param chain chain id
965
+ * @param address wallet address
966
+ * @param options optional query options
967
+ * @returns wallet's trade activities
968
+ */
969
+ getWalletTradeActivities(chain: Chain, address: string, options?: GetTradeActivitiesOptions): Promise<CursorList<TradeActivity>>;
970
+ /**
971
+ * fetch token's trade activities
972
+ * @param chain chain id
973
+ * @param address token address
974
+ * @param options optional query options
975
+ * @returns token's trade activities
976
+ */
977
+ getTokenTradeActivities(chain: Chain, address: string, options?: GetTradeActivitiesOptions): Promise<CursorList<TradeActivity>>;
978
+ /**
979
+ * get presigned upload url
980
+ * @returns presigned upload url
981
+ */
982
+ getPresignedUploadUrl(): Promise<string>;
983
+ }
984
+ interface ISubscription {
985
+ unsubscribe(): void;
986
+ }
987
+ interface TokenSubscribed {
988
+ chain: Chain;
989
+ address: string;
990
+ name?: string;
991
+ symbol?: string;
992
+ decimals?: number;
993
+ image?: string;
994
+ description?: string;
995
+ socialMedias?: TokenSocialMedias;
996
+ launchedFrom?: TokenLaunchedFrom;
997
+ migratedTo?: TokenMigratedTo;
998
+ createdAt: Date;
999
+ }
1000
+ interface WalletPnlSubscribed {
1001
+ chain: Chain;
1002
+ address: string;
1003
+ balanceInUsd?: string;
1004
+ profitInUsd?: string;
1005
+ }
1006
+ interface PortfolioSubscribed {
1007
+ chain: Chain;
1008
+ address: string;
1009
+ amount?: string;
1010
+ }
1011
+ type PortfolioPnlSubscribed = PortfolioPnl & {
1012
+ chain: Chain;
1013
+ address: string;
1014
+ };
1015
+ /**
1016
+ * Subscribe client interface
1017
+ */
1018
+ interface ISubscribeClient {
1019
+ /**
1020
+ * Subscribe token's basic info changes
1021
+ * @param chain chain id
1022
+ * @param address token address
1023
+ * @param callback callback function
1024
+ * @returns subscription
1025
+ */
1026
+ subscribeTokenBasic(chain: Chain, address: string, callback: (tokens: Array<TokenSubscribed>) => void): ISubscription;
1027
+ /**
1028
+ * Subscribe token's market data changes
1029
+ * @param chain chain id
1030
+ * @param address token address
1031
+ * @param callback callback function
1032
+ * @returns subscription
1033
+ */
1034
+ subscribeTokenMarketData(chain: Chain, address: string, callback: (marketDatas: Array<TokenMarketData>) => void): ISubscription;
1035
+ /**
1036
+ * Subscribe token's stats changes
1037
+ * @param chain chain id
1038
+ * @param address token address
1039
+ * @param callback callback function
1040
+ * @returns subscription
1041
+ */
1042
+ subscribeTokenStats(chain: Chain, address: string, callback: (stats: Array<TokenStats>) => void): ISubscription;
1043
+ /**
1044
+ * Subscribe token new candles
1045
+ * @param chain chain id
1046
+ * @param address token address
1047
+ * @param resolution token resolution
1048
+ * @param callback callback function
1049
+ * @returns subscription
1050
+ */
1051
+ subscribeTokenCandles(chain: Chain, address: string, resolution: TokenResolution, callback: (candles: Array<TokenCandle>) => void): ISubscription;
1052
+ /**
1053
+ * Subscribe wallet's pnl changes
1054
+ * @param chain chain id
1055
+ * @param address wallet address
1056
+ * @param callback callback function
1057
+ * @returns subscription
1058
+ */
1059
+ subscribeWalletPnl(chain: Chain, address: string, callback: (pnls: Array<WalletPnlSubscribed>) => void): ISubscription;
1060
+ /**
1061
+ * Subscribe wallet's portfolio changes
1062
+ * @param chain chain id
1063
+ * @param address wallet address
1064
+ * @param callback callback function
1065
+ * @returns subscription
1066
+ */
1067
+ subscribeWalletPortfolios(chain: Chain, address: string, callback: (portfolios: Array<PortfolioSubscribed>) => void): ISubscription;
1068
+ /**
1069
+ * Subscribe wallet's portfolio pnl changes
1070
+ * @param chain chain id
1071
+ * @param address wallet address
1072
+ * @param callback callback function
1073
+ * @returns subscription
1074
+ */
1075
+ subscribeWalletPortfolioPnls(chain: Chain, address: string, callback: (portfolioPnls: Array<PortfolioPnlSubscribed>) => void): ISubscription;
1076
+ /**
1077
+ * Subscribe wallet's new trade activities
1078
+ * @param chain chain id
1079
+ * @param address wallet address
1080
+ * @param callback callback function
1081
+ * @returns subscription
1082
+ */
1083
+ subscribeWalletTradeActivities(chain: Chain, address: string, callback: (trades: Array<TradeActivity>) => void): ISubscription;
1084
+ /**
1085
+ * Subscribe token's new trade activities
1086
+ * @param chain chain id
1087
+ * @param address token address
1088
+ * @param callback callback function
1089
+ * @returns subscription
1090
+ */
1091
+ subscribeTokenTradeActivities(chain: Chain, address: string, callback: (trades: Array<TradeActivity>) => void): ISubscription;
1092
+ /**
1093
+ * Subscribe `New` token list changes
1094
+ * @param chain chain id
1095
+ * @param callback callback function
1096
+ * @returns subscription
1097
+ */
1098
+ subscribeNewTokens(chain: Chain, callback: (tokens: Array<TokenSubscribed>) => void): ISubscription;
1099
+ /**
1100
+ * Subscribe `New` token list's basic info changes
1101
+ * @param chain chain id
1102
+ * @param callback callback function
1103
+ * @returns subscription
1104
+ */
1105
+ subscribeNewTokensBasic(chain: Chain, callback: (tokens: Array<TokenSubscribed>) => void): ISubscription;
1106
+ /**
1107
+ * Subscribe `New` token list's market data changes
1108
+ * @param chain chain id
1109
+ * @param callback callback function
1110
+ * @returns subscription
1111
+ */
1112
+ subscribeNewTokensMarketData(chain: Chain, callback: (marketDatas: Array<TokenMarketData>) => void): ISubscription;
1113
+ /**
1114
+ * Subscribe `New` token list's stats changes
1115
+ * @param chain chain id
1116
+ * @param callback callback function
1117
+ * @returns subscription
1118
+ */
1119
+ subscribeNewTokensStats(chain: Chain, callback: (stats: Array<TokenStats>) => void): ISubscription;
1120
+ }
1121
+
1122
+ /**
1123
+ * Media to track
1124
+ */
1125
+ interface IMedia {
1126
+ /** media id */
1127
+ id: string;
1128
+ /** media type */
1129
+ type: "tweet" | (string & {});
1130
+ /** token type */
1131
+ tokenType?: string;
1132
+ /** token mentioned in the media */
1133
+ token?: MediaToken;
1134
+ }
1135
+ /**
1136
+ * Tweet media to track
1137
+ */
1138
+ interface TweetMedia extends IMedia {
1139
+ /** media type */
1140
+ type: "tweet";
1141
+ /** tweet */
1142
+ tweet: Tweet;
1143
+ /** source tweet, quote or retweet or reply */
1144
+ sourceTweet?: SourceTweet;
1145
+ }
1146
+ /**
1147
+ * Token mentioned in the media
1148
+ */
1149
+ interface MediaToken {
1150
+ /** chain */
1151
+ chain: Chain;
1152
+ /** token address */
1153
+ address: string;
1154
+ /** token symbol */
1155
+ symbol: string;
1156
+ /** token image url */
1157
+ image?: string;
1158
+ /** token latest price in usd */
1159
+ latestPrice?: string;
1160
+ /** token previous price in usd */
1161
+ previousPrice?: string;
1162
+ /** price change ratio, range is 0-100 */
1163
+ priceChange?: string;
1164
+ }
1165
+ interface Tweet {
1166
+ /** tweet id */
1167
+ tweetId: string;
1168
+ /** tweet type */
1169
+ type: "tweet" | "reply" | "quote" | (string & {});
1170
+ /** tweet author */
1171
+ user: TweetUser;
1172
+ /** tweet unix timestamp in milliseconds */
1173
+ timestamp: number;
1174
+ /** tweet content */
1175
+ content: TweetContent;
1176
+ }
1177
+ interface SourceTweet {
1178
+ /** tweet id */
1179
+ tweetId: string;
1180
+ /** tweet author */
1181
+ user: TweetUser;
1182
+ /** tweet content */
1183
+ content: TweetContent;
1184
+ }
1185
+ interface TweetUser {
1186
+ /** username */
1187
+ username: string;
1188
+ /** screen name */
1189
+ screenName?: string;
1190
+ /** avatar */
1191
+ avatar?: string;
1192
+ /** tags */
1193
+ tags?: Array<string>;
1194
+ }
1195
+ interface TweetContent {
1196
+ /** tweet text content */
1197
+ text?: string;
1198
+ /** tweet medias, e.g. image, video .etc */
1199
+ medias?: Array<TweetContentMedia>;
1200
+ }
1201
+ interface TweetContentMedia {
1202
+ type: "image" | "video" | (string & {});
1203
+ url: string;
1204
+ }
1205
+
1206
+ interface SubscribeTweetMediasOptions {
1207
+ /**
1208
+ * Callback function to handle new tweet medias
1209
+ * @param tweetMedia new tweet media
1210
+ * @returns
1211
+ */
1212
+ callback: (tweetMedia: TweetMedia) => void;
1213
+ }
1214
+ /**
1215
+ * Interfaces for media track client
1216
+ */
1217
+ interface IMediaTrackClient {
1218
+ /**
1219
+ * Translate media content text
1220
+ * @param media media to translate
1221
+ * @param targetLanguage target language
1222
+ * @param options translate options
1223
+ * @param options.sourceLanguage source language
1224
+ * @param options.sourceTweet if true, the source tweet will be translated
1225
+ * @returns translated text
1226
+ */
1227
+ translate(media: IMedia, targetLanguage: string, options?: {
1228
+ sourceLanguage?: string;
1229
+ sourceTweet?: boolean;
1230
+ }): Promise<string>;
1231
+ /**
1232
+ * Subscribe to new tweet medias
1233
+ * @param options subscribe tweet medias options
1234
+ * @returns subscription
1235
+ */
1236
+ subscribeTweetMedia(options: SubscribeTweetMediasOptions): ISubscription;
1237
+ /**
1238
+ * Subscribe to tweet media tokens changes
1239
+ * @param options subscribe tweet media tokens options
1240
+ * @returns subscription
1241
+ */
1242
+ subscribeTweetMediaToken(options: SubscribeTweetMediasOptions): ISubscription;
1243
+ }
1244
+
1245
+ type index_CursorList<T> = CursorList<T>;
1246
+ type index_CursorListOptions = CursorListOptions;
1247
+ type index_GetTokenCandlesOptions = GetTokenCandlesOptions;
1248
+ type index_GetTokenListOptions = GetTokenListOptions;
1249
+ type index_GetTradeActivitiesOptions = GetTradeActivitiesOptions;
1250
+ type index_IClient = IClient;
1251
+ type index_IMediaTrackClient = IMediaTrackClient;
1252
+ type index_ISubscribeClient = ISubscribeClient;
1253
+ type index_ISubscription = ISubscription;
1254
+ type index_PortfolioPnlSubscribed = PortfolioPnlSubscribed;
1255
+ type index_PortfolioSubscribed = PortfolioSubscribed;
1256
+ type index_SearchTokenCursorList = SearchTokenCursorList;
1257
+ type index_SearchTokensOptions = SearchTokensOptions;
1258
+ type index_SendTxParams = SendTxParams;
1259
+ type index_SendTxResult = SendTxResult;
1260
+ type index_SubscribeTweetMediasOptions = SubscribeTweetMediasOptions;
1261
+ type index_SwapMode = SwapMode;
1262
+ declare const index_SwapMode: typeof SwapMode;
1263
+ type index_SwapParams = SwapParams;
1264
+ type index_SwapRoute = SwapRoute;
1265
+ type index_SwapRoutePlan = SwapRoutePlan;
1266
+ type index_TokenFieldOption = TokenFieldOption;
1267
+ type index_TokenFilterOption = TokenFilterOption;
1268
+ type index_TokenSubscribed = TokenSubscribed;
1269
+ type index_WalletPnlSubscribed = WalletPnlSubscribed;
1270
+ declare namespace index {
1271
+ export { type index_CursorList as CursorList, type index_CursorListOptions as CursorListOptions, type index_GetTokenCandlesOptions as GetTokenCandlesOptions, type index_GetTokenListOptions as GetTokenListOptions, type index_GetTradeActivitiesOptions as GetTradeActivitiesOptions, type index_IClient as IClient, type index_IMediaTrackClient as IMediaTrackClient, type index_ISubscribeClient as ISubscribeClient, type index_ISubscription as ISubscription, type index_PortfolioPnlSubscribed as PortfolioPnlSubscribed, type index_PortfolioSubscribed as PortfolioSubscribed, type index_SearchTokenCursorList as SearchTokenCursorList, type index_SearchTokensOptions as SearchTokensOptions, type index_SendTxParams as SendTxParams, type index_SendTxResult as SendTxResult, type index_SubscribeTweetMediasOptions as SubscribeTweetMediasOptions, index_SwapMode as SwapMode, type index_SwapParams as SwapParams, type index_SwapRoute as SwapRoute, type index_SwapRoutePlan as SwapRoutePlan, type index_TokenFieldOption as TokenFieldOption, type index_TokenFilterOption as TokenFilterOption, type index_TokenSubscribed as TokenSubscribed, type index_WalletPnlSubscribed as WalletPnlSubscribed };
1272
+ }
1273
+
1274
+ declare global {
1275
+ interface Window {
1276
+ __LIBERFI_VERSION__?: {
1277
+ [key: string]: string;
1278
+ };
1130
1279
  }
1131
1280
  }
1281
+ declare const _default: "0.1.4";
1132
1282
 
1133
1283
  type NetworkId = "testnet" | "mainnet";
1134
1284
 
1285
+ declare class ApiError extends Error {
1286
+ readonly code: number;
1287
+ constructor(message: string, code: number);
1288
+ }
1289
+
1135
1290
  declare enum SolanaTokenProtocol {
1136
1291
  BAGS = "bags",
1137
1292
  BELIEVE = "believe",
@@ -1153,4 +1308,4 @@ declare enum SolanaTokenProtocol {
1153
1308
  type TokenProtocol = keyof typeof SolanaTokenProtocol | (string & {});
1154
1309
  declare const SOLANA_TOKEN_PROTOCOLS: SolanaTokenProtocol[];
1155
1310
 
1156
- export { API, Chain, ChainNamespace, type NetworkId, type Portfolio, type PortfolioPnl, SOLANA_TOKEN_PROTOCOLS, SolanaTokenProtocol, type Token, type TokenCandle, type TokenCreator, type TokenHistoryPriceObject, type TokenHolder, type TokenLaunchedFrom, type TokenLiquidity, type TokenMarketData, type TokenMigratedTo, type TokenProtocol, type TokenResolution, type TokenSecurity, type TokenSocialMedias, type TokenStats, type TokenStatsByTimeframe, type TradeActivity, type TradeDex, type TradeToken, type WalletPortfolios, _default as version };
1311
+ export { index as API, ApiError, Chain, ChainNamespace, type CursorList, type CursorListOptions, type GetTokenCandlesOptions, type GetTokenListOptions, type GetTradeActivitiesOptions, type IClient, type IMedia, type IMediaTrackClient, type ISubscribeClient, type ISubscription, type MediaToken, type NetworkId, type Portfolio, type PortfolioPnl, type PortfolioPnlSubscribed, type PortfolioSubscribed, SOLANA_TOKEN_PROTOCOLS, type SearchTokenCursorList, type SearchTokensOptions, type SendTxParams, type SendTxResult, SolanaTokenProtocol, type SourceTweet, type SubscribeTweetMediasOptions, SwapMode, type SwapParams, type SwapRoute, type SwapRoutePlan, type Token, type TokenCandle, type TokenCreator, type TokenFieldOption, type TokenFilterOption, type TokenHistoryPriceObject, type TokenHolder, type TokenLaunchedFrom, type TokenLiquidity, type TokenMarketData, type TokenMigratedTo, type TokenProtocol, type TokenResolution, type TokenSecurity, type TokenSocialMedias, type TokenStats, type TokenStatsByResolution, type TokenSubscribed, type TradeActivity, type TradeDex, type TradeToken, type Tweet, type TweetContent, type TweetContentMedia, type TweetMedia, type TweetUser, type WalletPnlSubscribed, type WalletPortfolios, _default as version };