@quicknode/sdk 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +2 -0
  2. package/cjs/index.js +314 -1
  3. package/esm/package.json +2 -1
  4. package/esm/package.json.js +3 -0
  5. package/esm/src/api/api.js +85 -0
  6. package/esm/src/api/controllers/contracts.js +36 -0
  7. package/esm/src/api/controllers/events.js +121 -0
  8. package/esm/src/api/controllers/nfts.js +244 -0
  9. package/esm/src/api/controllers/tokens.js +98 -0
  10. package/esm/src/api/controllers/transactions.js +125 -0
  11. package/esm/src/api/controllers/utils.js +55 -0
  12. package/esm/src/api/graphql/customUrqlClient.js +23 -0
  13. package/esm/{index.js → src/api/graphql/generatedTypes.js} +1 -1099
  14. package/esm/src/api/graphql/schema.json.js +3 -0
  15. package/esm/src/api/index.d.ts +2687 -0
  16. package/esm/src/api/index.js +2 -0
  17. package/esm/src/api/types/chains.js +7 -0
  18. package/esm/src/api/types/contracts/getContractDetails.js +12 -0
  19. package/esm/src/api/types/events/getAll.js +7 -0
  20. package/esm/src/api/types/events/getByContract.js +12 -0
  21. package/esm/src/api/types/nfts/getByContractAddress.js +10 -0
  22. package/esm/src/api/types/nfts/getByWalletAddress.js +18 -0
  23. package/esm/src/api/types/nfts/getCollectionDetails.js +11 -0
  24. package/esm/src/api/types/nfts/getCollectionEvents.js +12 -0
  25. package/esm/src/api/types/nfts/getNFTDetails.js +9 -0
  26. package/esm/src/api/types/nfts/getNFTEvents.js +13 -0
  27. package/esm/src/api/types/nfts/getTrendingCollections.js +7 -0
  28. package/esm/src/api/types/nfts/verifyOwnershipByAddress.js +12 -0
  29. package/esm/src/api/types/tokens/getBalancesByWalletAddress.js +12 -0
  30. package/esm/src/api/types/transactions/getByHash.js +11 -0
  31. package/esm/src/api/types/transactions/getBySearch.js +7 -0
  32. package/esm/src/api/types/utils/gasPrices.js +12 -0
  33. package/esm/src/api/utils/constants.js +3 -0
  34. package/esm/src/api/utils/helpers.js +11 -0
  35. package/esm/src/api/utils/isValidENSAddress.js +21 -0
  36. package/esm/src/api/utils/postQueryFormatter.js +24 -0
  37. package/esm/src/api/utils/removeNodesAndEdges.js +51 -0
  38. package/esm/src/client/client.js +9 -0
  39. package/esm/src/client/index.js +2 -0
  40. package/esm/src/core/addOns/nftTokenV2/actions.js +107 -0
  41. package/esm/src/core/addOns/nftTokenV2/types/qn_fetchNFTCollectionDetails.js +10 -0
  42. package/esm/src/core/addOns/nftTokenV2/types/qn_fetchNFTs.js +13 -0
  43. package/esm/src/core/addOns/nftTokenV2/types/qn_fetchNFTsByCollection.js +13 -0
  44. package/esm/src/core/addOns/nftTokenV2/types/qn_getTokenMetadataByContractAddress.js +10 -0
  45. package/esm/src/core/addOns/nftTokenV2/types/qn_getTokenMetadataBySymbol.js +11 -0
  46. package/esm/src/core/addOns/nftTokenV2/types/qn_getTransactionsByAddress.js +18 -0
  47. package/esm/src/core/addOns/nftTokenV2/types/qn_getTransfersByNFT.js +12 -0
  48. package/esm/src/core/addOns/nftTokenV2/types/qn_getWalletTokenBalance.js +12 -0
  49. package/esm/src/core/addOns/nftTokenV2/types/qn_getWalletTokenTransactions.js +14 -0
  50. package/esm/src/core/addOns/nftTokenV2/types/qn_verifyNFTsOwner.js +11 -0
  51. package/esm/src/core/addOns/shared/helpers.js +10 -0
  52. package/esm/src/core/chains.js +60 -0
  53. package/esm/src/core/core.js +24 -0
  54. package/esm/src/core/index.d.ts +555 -0
  55. package/esm/src/core/index.js +2 -0
  56. package/esm/src/index.js +10 -0
  57. package/esm/src/lib/errors/QNChainNotSupported.js +7 -0
  58. package/esm/src/lib/errors/QNInputValidationError.js +10 -0
  59. package/esm/src/lib/errors/QNInvalidEnpointUrl.js +7 -0
  60. package/esm/src/lib/helpers/globalFetch.js +13 -0
  61. package/esm/src/lib/validation/ValidateInput.js +35 -0
  62. package/esm/src/lib/validation/codegenDerivedValidators.js +28 -0
  63. package/esm/src/lib/validation/validators.js +105 -0
  64. package/index.d.ts +560 -1
  65. package/package.json +25 -3
package/index.d.ts CHANGED
@@ -2,6 +2,9 @@ import { Client, GraphQLRequestParams } from '@urql/core';
2
2
  export { gql } from '@urql/core';
3
3
  import * as _urql_core_dist_urql_core_chunk from '@urql/core/dist/urql-core-chunk';
4
4
  import { z, ZodError } from 'zod';
5
+ import { Chain, PublicClient } from 'viem';
6
+ import * as viem from 'viem';
7
+ export { viem };
5
8
 
6
9
  type Maybe<T> = T | null;
7
10
  type InputMaybe<T> = Maybe<T>;
@@ -2731,8 +2734,556 @@ declare class API {
2731
2734
  private createUrqlClient;
2732
2735
  }
2733
2736
 
2737
+ type NftTrait = {
2738
+ trait_type: string;
2739
+ value: string;
2740
+ };
2741
+ type RpcNftAsset = {
2742
+ collectionName: string;
2743
+ collectionTokenId: string;
2744
+ collectionAddress: string;
2745
+ name: string;
2746
+ description: string;
2747
+ imageUrl: string;
2748
+ traits: NftTrait[];
2749
+ chain: string;
2750
+ network: string;
2751
+ };
2752
+ type RPCTokenMetadata = {
2753
+ name: string | null;
2754
+ symbol: string | null;
2755
+ contractAddress: string;
2756
+ decimals: string | null;
2757
+ genesisBlock: string | null;
2758
+ genesisTransaction: string | null;
2759
+ };
2760
+
2761
+ declare const qnFetchNFTInputSchema: z.ZodObject<{
2762
+ wallet: z.ZodString;
2763
+ contracts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
2764
+ omitFields: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
2765
+ perPage: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2766
+ page: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2767
+ }, "strict", z.ZodTypeAny, {
2768
+ wallet: string;
2769
+ contracts?: string[] | null | undefined;
2770
+ omitFields?: string[] | null | undefined;
2771
+ perPage?: number | null | undefined;
2772
+ page?: number | null | undefined;
2773
+ }, {
2774
+ wallet: string;
2775
+ contracts?: string[] | null | undefined;
2776
+ omitFields?: string[] | null | undefined;
2777
+ perPage?: number | null | undefined;
2778
+ page?: number | null | undefined;
2779
+ }>;
2780
+ type QNFetchNFTInput = z.infer<typeof qnFetchNFTInputSchema>;
2781
+ type QNFetchNFTResult = {
2782
+ owner: string;
2783
+ assets: RpcNftAsset[];
2784
+ totalPages: number;
2785
+ totalItems: number;
2786
+ pageNumber: number;
2787
+ };
2788
+
2789
+ declare const qnFetchNFTCollectionDetailsInputSchema: z.ZodObject<{
2790
+ contracts: z.ZodArray<z.ZodString, "many">;
2791
+ }, "strict", z.ZodTypeAny, {
2792
+ contracts: string[];
2793
+ }, {
2794
+ contracts: string[];
2795
+ }>;
2796
+ type QNFetchNFTCollectionDetailsInput = z.infer<typeof qnFetchNFTCollectionDetailsInputSchema>;
2797
+ type RPCNftCollectionDetails = {
2798
+ name: string;
2799
+ address: string;
2800
+ description: string;
2801
+ erc1155: boolean;
2802
+ erc721: boolean;
2803
+ totalSupply: number;
2804
+ circulatingSupply: number;
2805
+ genesisBlock: number | null;
2806
+ genesisTransaction: string | null;
2807
+ };
2808
+ type QNFetchNFTCollectionDetailsResult = RPCNftCollectionDetails[];
2809
+
2810
+ declare const qnFetchNFTsByCollectionInputSchema: z.ZodObject<{
2811
+ collection: z.ZodString;
2812
+ omitFields: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
2813
+ tokens: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
2814
+ perPage: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2815
+ page: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2816
+ }, "strict", z.ZodTypeAny, {
2817
+ collection: string;
2818
+ omitFields?: string[] | null | undefined;
2819
+ tokens?: string[] | null | undefined;
2820
+ perPage?: number | null | undefined;
2821
+ page?: number | null | undefined;
2822
+ }, {
2823
+ collection: string;
2824
+ omitFields?: string[] | null | undefined;
2825
+ tokens?: string[] | null | undefined;
2826
+ perPage?: number | null | undefined;
2827
+ page?: number | null | undefined;
2828
+ }>;
2829
+ type QNFetchNFTsByCollectionInput = z.infer<typeof qnFetchNFTsByCollectionInputSchema>;
2830
+ type QNFetchNFTsByCollectionResult = {
2831
+ collection: string;
2832
+ tokens: RpcNftAsset[];
2833
+ };
2834
+
2835
+ declare const qnGetTransfersByNFTInputSchema: z.ZodObject<{
2836
+ collection: z.ZodString;
2837
+ collectionTokenId: z.ZodString;
2838
+ perPage: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2839
+ page: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2840
+ }, "strict", z.ZodTypeAny, {
2841
+ collection: string;
2842
+ collectionTokenId: string;
2843
+ perPage?: number | null | undefined;
2844
+ page?: number | null | undefined;
2845
+ }, {
2846
+ collection: string;
2847
+ collectionTokenId: string;
2848
+ perPage?: number | null | undefined;
2849
+ page?: number | null | undefined;
2850
+ }>;
2851
+ type QNGetTransfersByNFTInput = z.infer<typeof qnGetTransfersByNFTInputSchema>;
2852
+ type TransfersByNFTTransfer = {
2853
+ blockNumber: number;
2854
+ date: string;
2855
+ from: string;
2856
+ to: string;
2857
+ txHash: string;
2858
+ };
2859
+ type QNGetTransfersByNFTResult = {
2860
+ collection: string;
2861
+ transfers: TransfersByNFTTransfer[];
2862
+ totalPages: number;
2863
+ pageNumber: number;
2864
+ totalItems: number;
2865
+ };
2866
+
2867
+ declare const qnVerifyNFTsOwnerInputSchema: z.ZodObject<{
2868
+ wallet: z.ZodString;
2869
+ contracts: z.ZodArray<z.ZodString, "many">;
2870
+ }, "strict", z.ZodTypeAny, {
2871
+ wallet: string;
2872
+ contracts: string[];
2873
+ }, {
2874
+ wallet: string;
2875
+ contracts: string[];
2876
+ }>;
2877
+ type QNVerifyNFTsOwnerInput = z.infer<typeof qnVerifyNFTsOwnerInputSchema>;
2878
+ type QNVerifyNFTsOwnerResult = {
2879
+ owner: string;
2880
+ assets: string[];
2881
+ };
2882
+
2883
+ declare const qnGetTokenMetadataByCAInputSchema: z.ZodObject<{
2884
+ contract: z.ZodString;
2885
+ }, "strict", z.ZodTypeAny, {
2886
+ contract: string;
2887
+ }, {
2888
+ contract: string;
2889
+ }>;
2890
+ type QNGetTokenMetadataByCAInput = z.infer<typeof qnGetTokenMetadataByCAInputSchema>;
2891
+ type QNGetTokenMetadataByCAResult = RPCTokenMetadata;
2892
+
2893
+ declare const qnGetTokenMetadataBySymbolInputSchema: z.ZodObject<{
2894
+ symbol: z.ZodString;
2895
+ perPage: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2896
+ page: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2897
+ }, "strict", z.ZodTypeAny, {
2898
+ symbol: string;
2899
+ perPage?: number | null | undefined;
2900
+ page?: number | null | undefined;
2901
+ }, {
2902
+ symbol: string;
2903
+ perPage?: number | null | undefined;
2904
+ page?: number | null | undefined;
2905
+ }>;
2906
+ type QNGetTokenMetadataBySymbolInput = z.infer<typeof qnGetTokenMetadataBySymbolInputSchema>;
2907
+ type QNGetTokenMetadataBySymbolResult = {
2908
+ tokens: RPCTokenMetadata[];
2909
+ };
2910
+
2911
+ declare const qnGetTransactionsByAddressInputSchema: z.ZodEffects<z.ZodObject<{
2912
+ address: z.ZodString;
2913
+ fromBlock: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2914
+ toBlock: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2915
+ perPage: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2916
+ page: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2917
+ }, "strict", z.ZodTypeAny, {
2918
+ address: string;
2919
+ fromBlock?: number | null | undefined;
2920
+ toBlock?: number | null | undefined;
2921
+ perPage?: number | null | undefined;
2922
+ page?: number | null | undefined;
2923
+ }, {
2924
+ address: string;
2925
+ fromBlock?: number | null | undefined;
2926
+ toBlock?: number | null | undefined;
2927
+ perPage?: number | null | undefined;
2928
+ page?: number | null | undefined;
2929
+ }>, {
2930
+ address: string;
2931
+ fromBlock?: number | null | undefined;
2932
+ toBlock?: number | null | undefined;
2933
+ perPage?: number | null | undefined;
2934
+ page?: number | null | undefined;
2935
+ }, {
2936
+ address: string;
2937
+ fromBlock?: number | null | undefined;
2938
+ toBlock?: number | null | undefined;
2939
+ perPage?: number | null | undefined;
2940
+ page?: number | null | undefined;
2941
+ }>;
2942
+ type QNGetTransactionsByAddressInput = z.infer<typeof qnGetTransactionsByAddressInputSchema>;
2943
+ interface RPCTransactionByAddress {
2944
+ blockTimestamp: string;
2945
+ transactionHash: string;
2946
+ blockNumber: string;
2947
+ transactionIndex: number;
2948
+ fromAddress: string;
2949
+ toAddress: string;
2950
+ contractAddress: string | null;
2951
+ value: string;
2952
+ }
2953
+ type QNGetTransactionsByAddressResult = {
2954
+ paginatedItems: RPCTransactionByAddress[];
2955
+ totalItems: number;
2956
+ totalPages: number;
2957
+ pageNumber: number;
2958
+ };
2959
+
2960
+ declare const qnGetWalletTokenBalanceInputSchema: z.ZodObject<{
2961
+ wallet: z.ZodString;
2962
+ contracts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
2963
+ perPage: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2964
+ page: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2965
+ }, "strict", z.ZodTypeAny, {
2966
+ wallet: string;
2967
+ contracts?: string[] | null | undefined;
2968
+ perPage?: number | null | undefined;
2969
+ page?: number | null | undefined;
2970
+ }, {
2971
+ wallet: string;
2972
+ contracts?: string[] | null | undefined;
2973
+ perPage?: number | null | undefined;
2974
+ page?: number | null | undefined;
2975
+ }>;
2976
+ type QNGetWalletTokenBalanceInput = z.infer<typeof qnGetWalletTokenBalanceInputSchema>;
2977
+ type RPCWalletTokenBalance = {
2978
+ quantityIn: string;
2979
+ quantityOut: string;
2980
+ name: string | null;
2981
+ symbol: string | null;
2982
+ decimals: string | null;
2983
+ address: string;
2984
+ totalBalance: string;
2985
+ };
2986
+ type QNGetWalletTokenBalanceResult = {
2987
+ result: RPCWalletTokenBalance[];
2988
+ totalItems: number;
2989
+ totalPages: number;
2990
+ pageNumber: number;
2991
+ };
2992
+
2993
+ declare const qnGetWalletTokenTransactionsInputSchema: z.ZodObject<{
2994
+ address: z.ZodString;
2995
+ contract: z.ZodString;
2996
+ fromBlock: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2997
+ toBlock: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2998
+ perPage: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
2999
+ page: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
3000
+ }, "strict", z.ZodTypeAny, {
3001
+ address: string;
3002
+ contract: string;
3003
+ fromBlock?: number | null | undefined;
3004
+ toBlock?: number | null | undefined;
3005
+ perPage?: number | null | undefined;
3006
+ page?: number | null | undefined;
3007
+ }, {
3008
+ address: string;
3009
+ contract: string;
3010
+ fromBlock?: number | null | undefined;
3011
+ toBlock?: number | null | undefined;
3012
+ perPage?: number | null | undefined;
3013
+ page?: number | null | undefined;
3014
+ }>;
3015
+ type QNGetWalletTokenTransactionsInput = z.infer<typeof qnGetWalletTokenTransactionsInputSchema>;
3016
+ type RPCFullTokenMetadata = {
3017
+ address: string;
3018
+ genesisBlock: string | null;
3019
+ genesisTransaction: string | null;
3020
+ name: string | null;
3021
+ symbol: string | null;
3022
+ decimals: string | null;
3023
+ contractAddress: string;
3024
+ };
3025
+ type RPCTokenTransaction = {
3026
+ name: string | null;
3027
+ symbol: string | null;
3028
+ decimals: string | null;
3029
+ address: string;
3030
+ quantityIn: string;
3031
+ quantityOut: string;
3032
+ blockNumber: string;
3033
+ transactionHash: string;
3034
+ timestamp: string;
3035
+ totalBalance: string;
3036
+ };
3037
+ type QNGetWalletTokenTransactionsResult = {
3038
+ paginatedItems: RPCTokenTransaction[];
3039
+ totalItems: number;
3040
+ totalPages: number;
3041
+ pageNumber: number;
3042
+ token: RPCFullTokenMetadata;
3043
+ };
3044
+
3045
+ type NFTAndTokenActions = {
3046
+ /**
3047
+ * Returns aggregated data on NFTs for a given wallet.
3048
+ *
3049
+ * - Docs: https://www.quicknode.com/docs/ethereum/qn_fetchNFTs_v2
3050
+ *
3051
+ * @param args - {@link QNFetchNFTInput}
3052
+ * @returns response - {@link QNFetchNFTsResult}
3053
+ *
3054
+ * @example
3055
+ * import QuickNode from '@quicknode/sdk';
3056
+ *
3057
+ * const core = new QuickNode.Core({
3058
+ * endpointUrl: "https://some-cool-name.quiknode.pro/abcd1234",
3059
+ * config: {
3060
+ * addOns: { nftTokenV2: true }
3061
+ * }
3062
+ * }
3063
+ *
3064
+ * const response = await core.client.qn_fetchNFTs({
3065
+ * wallet: "0xD10E24685c7CDD3cd3BaAA86b09C92Be28c834B6",
3066
+ * contracts: ['0x2106C00Ac7dA0A3430aE667879139E832307AeAa'],
3067
+ * });
3068
+ */
3069
+ qn_fetchNFTs: (args: SimplifyType<QNFetchNFTInput>) => Promise<SimplifyType<QNFetchNFTResult>>;
3070
+ /**
3071
+ * Returns aggregated data on NFTs for a given wallet.
3072
+ *
3073
+ * - Docs: https://www.quicknode.com/docs/ethereum/qn_fetchNFTCollectionDetails_v2
3074
+ *
3075
+ * @param args - {@link QNFetchNFTCollectionDetailsInput}
3076
+ * @returns response - {@link QNFetchNFTCollectionDetailsResult}
3077
+ *
3078
+ * @example
3079
+ * import QuickNode from '@quicknode/sdk';
3080
+ *
3081
+ * const core = new QuickNode.Core({
3082
+ * endpointUrl: "https://some-cool-name.quiknode.pro/abcd1234",
3083
+ * config: {
3084
+ * addOns: { nftTokenV2: true }
3085
+ * }
3086
+ * }
3087
+ *
3088
+ * const response = await core.client.qn_fetchNFTCollectionDetails({
3089
+ * contracts: [
3090
+ * "0x60E4d786628Fea6478F785A6d7e704777c86a7c6",
3091
+ * "0x7Bd29408f11D2bFC23c34f18275bBf23bB716Bc7",
3092
+ * ]
3093
+ * });
3094
+ */
3095
+ qn_fetchNFTCollectionDetails: (args: SimplifyType<QNFetchNFTCollectionDetailsInput>) => Promise<SimplifyType<QNFetchNFTCollectionDetailsResult>>;
3096
+ /**
3097
+ * Returns aggregated data on NFTs within a given collection.
3098
+ *
3099
+ * - Docs: https://www.quicknode.com/docs/ethereum/qn_fetchNFTsByCollection_v2
3100
+ *
3101
+ * @param args - {@link QNFetchNFTsByCollectionInput}
3102
+ * @returns response - {@link QNFetchNFTsByCollectionResult}
3103
+ *
3104
+ * @example
3105
+ * import QuickNode from '@quicknode/sdk';
3106
+ *
3107
+ * const core = new QuickNode.Core({
3108
+ * endpointUrl: "https://some-cool-name.quiknode.pro/abcd1234",
3109
+ * config: {
3110
+ * addOns: { nftTokenV2: true }
3111
+ * }
3112
+ * }
3113
+ *
3114
+ * const response = await core.client.qn_fetchNFTsByCollection({
3115
+ * collection: "0x60E4d786628Fea6478F785A6d7e704777c86a7c6",
3116
+ * })
3117
+ */
3118
+ qn_fetchNFTsByCollection: (args: SimplifyType<QNFetchNFTsByCollectionInput>) => Promise<SimplifyType<QNFetchNFTsByCollectionResult>>;
3119
+ /**
3120
+ * Returns transfers by given NFT.
3121
+ *
3122
+ * - Docs: https://www.quicknode.com/docs/ethereum/qn_getTransfersByNFT_v2
3123
+ *
3124
+ * @param args - {@link QNGetTransfersByNFTInput}
3125
+ * @returns response - {@link QNGetTransfersByNFTResult}
3126
+ *
3127
+ * @example
3128
+ * import QuickNode from '@quicknode/sdk';
3129
+ *
3130
+ * const core = new QuickNode.Core({
3131
+ * endpointUrl: "https://some-cool-name.quiknode.pro/abcd1234",
3132
+ * config: {
3133
+ * addOns: { nftTokenV2: true }
3134
+ * }
3135
+ * }
3136
+ *
3137
+ * const response = await core.client.qn_getTransfersByNFT({
3138
+ * collection: "0x60E4d786628Fea6478F785A6d7e704777c86a7c6",
3139
+ 7 * collectionTokenId: "1",
3140
+ * })
3141
+ */
3142
+ qn_getTransfersByNFT: (args: SimplifyType<QNGetTransfersByNFTInput>) => Promise<SimplifyType<QNGetTransfersByNFTResult>>;
3143
+ /**
3144
+ * Confirms ownership of specified NFTs for a given wallet.
3145
+ *
3146
+ * - Docs: https://www.quicknode.com/docs/ethereum/qn_verifyNFTsOwner_v2
3147
+ *
3148
+ * @param args - {@link QNVerifyNFTsOwnerInput}
3149
+ * @returns response - {@link QNVerifyNFTsOwnerResult}
3150
+ *
3151
+ * @example
3152
+ * import QuickNode from '@quicknode/sdk';
3153
+ *
3154
+ * const core = new QuickNode.Core({
3155
+ * endpointUrl: "https://some-cool-name.quiknode.pro/abcd1234",
3156
+ * config: {
3157
+ * addOns: { nftTokenV2: true }
3158
+ * }
3159
+ * }
3160
+ *
3161
+ * const response = await core.client.qn_verifyNFTsOwner({
3162
+ * wallet: "0x91b51c173a4bdaa1a60e234fc3f705a16d228740",
3163
+ * contracts: [
3164
+ * "0x2106c00ac7da0a3430ae667879139e832307aeaa:3643",
3165
+ * "0xd07dc4262bcdbf85190c01c996b4c06a461d2430:133803",
3166
+ * ],
3167
+ * })
3168
+ *
3169
+ */
3170
+ qn_verifyNFTsOwner: (args: SimplifyType<QNVerifyNFTsOwnerInput>) => Promise<SimplifyType<QNVerifyNFTsOwnerResult>>;
3171
+ /**
3172
+ * Returns token details for specified contract.
3173
+ *
3174
+ * - Docs: https://www.quicknode.com/docs/ethereum/qn_getTokenMetadataByContractAddress_v2
3175
+ *
3176
+ * @param args - {@link QNGetTokenMetadataByCAInput}
3177
+ * @returns response - {@link QNGetTokenMetadataByCAResult}
3178
+ *
3179
+ * @example
3180
+ * import QuickNode from '@quicknode/sdk';
3181
+ *
3182
+ * const core = new QuickNode.Core({
3183
+ * endpointUrl: "https://some-cool-name.quiknode.pro/abcd1234",
3184
+ * config: {
3185
+ * addOns: { nftTokenV2: true }
3186
+ * }
3187
+ * }
3188
+ *
3189
+ * const response = await core.client.qn_getTokenMetadataByContractAddress({
3190
+ * contract: "0x2106c00ac7da0a3430ae667879139e832307aeaa",
3191
+ * })
3192
+ */
3193
+ qn_getTokenMetadataByContractAddress: (args: SimplifyType<QNGetTokenMetadataByCAInput>) => Promise<SimplifyType<QNGetTokenMetadataByCAResult | null>>;
3194
+ /**
3195
+ * Returns token details for specified token symbol.
3196
+ *
3197
+ * - Docs: https://www.quicknode.com/docs/ethereum/qn_getTokenMetadataBySymbol_v2
3198
+ *
3199
+ * @param args - {@link QNGetTokenMetadataBySymbolInput}
3200
+ * @returns response - {@link QNGetTokenMetadataBySymbolResult}
3201
+ *
3202
+ * @example
3203
+ * import QuickNode from '@quicknode/sdk';
3204
+ *
3205
+ * const core = new QuickNode.Core({
3206
+ * endpointUrl: "https://some-cool-name.quiknode.pro/abcd1234",
3207
+ * config: {
3208
+ * addOns: { nftTokenV2: true }
3209
+ * }
3210
+ * }
3211
+ *
3212
+ * const response = await core.client.qn_getTokenMetadataBySymbol({
3213
+ * symbol: "DAI",
3214
+ * })
3215
+ */
3216
+ qn_getTokenMetadataBySymbol: (args: SimplifyType<QNGetTokenMetadataBySymbolInput>) => Promise<SimplifyType<QNGetTokenMetadataBySymbolResult>>;
3217
+ /**
3218
+ * Returns transactions within a specified wallet address.
3219
+ *
3220
+ * - Docs: https://www.quicknode.com/docs/ethereum/qn_getTransactionsByAddress_v2
3221
+ *
3222
+ * @param args - {@link QNGetTransactionsByAddressInput}
3223
+ * @returns response - {@link QNGetTransactionsByAddressResult}
3224
+ *
3225
+ * @example
3226
+ * import QuickNode from '@quicknode/sdk';
3227
+ *
3228
+ * const core = new QuickNode.Core({
3229
+ * endpointUrl: "https://some-cool-name.quiknode.pro/abcd1234",
3230
+ * config: {
3231
+ * addOns: { nftTokenV2: true }
3232
+ * }
3233
+ * }
3234
+ *
3235
+ * const response = await core.client.qn_getTransactionsByAddress({
3236
+ * address: "0xD10E24685c7CDD3cd3BaAA86b09C92Be28c834B6"
3237
+ * })
3238
+ */
3239
+ qn_getTransactionsByAddress: (args: SimplifyType<QNGetTransactionsByAddressInput>) => Promise<SimplifyType<QNGetTransactionsByAddressResult>>;
3240
+ /**
3241
+ * Returns ERC-20 tokens and token balances within a wallet.
3242
+ *
3243
+ * - Docs: https://www.quicknode.com/docs/ethereum/qn_getWalletTokenBalance_v2
3244
+ *
3245
+ * @param args - {@link QNGetWalletTokenBalanceInput}
3246
+ * @returns response - {@link QNGetWalletTokenBalanceResult}
3247
+ *
3248
+ * @example
3249
+ * import QuickNode from '@quicknode/sdk';
3250
+ *
3251
+ * const core = new QuickNode.Core({
3252
+ * endpointUrl: "https://some-cool-name.quiknode.pro/abcd1234",
3253
+ * config: {
3254
+ * addOns: { nftTokenV2: true }
3255
+ * }
3256
+ * }
3257
+ *
3258
+ * const response = await core.client.qn_getWalletTokenBalance({
3259
+ * address: "0xD10E24685c7CDD3cd3BaAA86b09C92Be28c834B6"
3260
+ * })
3261
+ */
3262
+ qn_getWalletTokenBalance: (args: SimplifyType<QNGetWalletTokenBalanceInput>) => Promise<SimplifyType<QNGetWalletTokenBalanceResult>>;
3263
+ qn_getWalletTokenTransactions: (args: SimplifyType<QNGetWalletTokenTransactionsInput>) => Promise<SimplifyType<QNGetWalletTokenTransactionsResult>>;
3264
+ };
3265
+
3266
+ interface CoreArguments {
3267
+ endpointUrl: string;
3268
+ chain?: Chain;
3269
+ config?: QNCoreClientConfig;
3270
+ }
3271
+ type QNCoreClientConfig = {
3272
+ addOns?: {
3273
+ nftTokenV2: boolean;
3274
+ };
3275
+ };
3276
+ type QNCoreClient = PublicClient & NFTAndTokenActions;
3277
+
3278
+ declare class Core {
3279
+ readonly endpointUrl: string;
3280
+ readonly client: QNCoreClient;
3281
+ constructor({ endpointUrl, chain, config }: CoreArguments);
3282
+ }
3283
+
2734
3284
  declare const QuickNode: {
2735
3285
  API: typeof API;
3286
+ Core: typeof Core;
2736
3287
  };
2737
3288
 
2738
3289
  type WalletNFTsByEnsQueryVariables = CodegenEthMainnetWalletNFTsByEnsQueryVariables;
@@ -2763,4 +3314,12 @@ declare class QNInputValidationError extends Error {
2763
3314
  });
2764
3315
  }
2765
3316
 
2766
- export { API, AllEventsInput, AllEventsResult, BalancesByWalletAddressInput, BalancesByWalletAddressResult, BalancesByWalletENSInput, BalancesByWalletENSResult, CollectionEventsInput, CollectionEventsResult, ContractDetailsInput, ContractDetailsResult, ContractEventsInput, ContractEventsResult, GasPricesInput, GasPricesResult, NFTDetailsInput, NFTDetailsResult, NFTEventsInput, NFTEventsResult, NFTTrendingCollectionResult, NFTTrendingCollectionsInput, NFTsByContractAddressInput, NFTsByContractAddressResult, NftCollectionDetailsInput, NftCollectionDetailsResult, QNInputValidationError, TransactionsByHashInput, TransactionsByHashResult, TransactionsBySearchInput, TransactionsBySearchResult, TransactionsByWalletAddressInput, TransactionsByWalletAddressResult, TransactionsByWalletENSInput, TransactionsByWalletENSResult, WalletNFTsByAddressInput, WalletNFTsByAddressResult, WalletNFTsByEnsInput, WalletNFTsByEnsResult, QuickNode as default };
3317
+ declare class QNInvalidEndpointUrl extends Error {
3318
+ constructor();
3319
+ }
3320
+
3321
+ declare class QNChainNotSupported extends Error {
3322
+ constructor(endpointUrl: string);
3323
+ }
3324
+
3325
+ export { API, AllEventsInput, AllEventsResult, BalancesByWalletAddressInput, BalancesByWalletAddressResult, BalancesByWalletENSInput, BalancesByWalletENSResult, CollectionEventsInput, CollectionEventsResult, ContractDetailsInput, ContractDetailsResult, ContractEventsInput, ContractEventsResult, Core, CoreArguments, GasPricesInput, GasPricesResult, NFTDetailsInput, NFTDetailsResult, NFTEventsInput, NFTEventsResult, NFTTrendingCollectionResult, NFTTrendingCollectionsInput, NFTsByContractAddressInput, NFTsByContractAddressResult, NftCollectionDetailsInput, NftCollectionDetailsResult, QNChainNotSupported, QNCoreClient, QNCoreClientConfig, QNFetchNFTCollectionDetailsInput, QNFetchNFTCollectionDetailsResult, QNFetchNFTInput, QNFetchNFTResult, QNFetchNFTsByCollectionInput, QNFetchNFTsByCollectionResult, QNGetTokenMetadataByCAInput, QNGetTokenMetadataByCAResult, QNGetTokenMetadataBySymbolInput, QNGetTokenMetadataBySymbolResult, QNGetTransactionsByAddressInput, QNGetTransactionsByAddressResult, QNGetTransfersByNFTInput, QNGetTransfersByNFTResult, QNGetWalletTokenBalanceInput, QNGetWalletTokenBalanceResult, QNGetWalletTokenTransactionsInput, QNGetWalletTokenTransactionsResult, QNInputValidationError, QNInvalidEndpointUrl, QNVerifyNFTsOwnerInput, QNVerifyNFTsOwnerResult, TransactionsByHashInput, TransactionsByHashResult, TransactionsBySearchInput, TransactionsBySearchResult, TransactionsByWalletAddressInput, TransactionsByWalletAddressResult, TransactionsByWalletENSInput, TransactionsByWalletENSResult, WalletNFTsByAddressInput, WalletNFTsByAddressResult, WalletNFTsByEnsInput, WalletNFTsByEnsResult, QuickNode as default };
package/package.json CHANGED
@@ -6,14 +6,16 @@
6
6
  "directory": "packages/libs/sdk"
7
7
  },
8
8
  "license": "MIT",
9
- "version": "1.0.0",
9
+ "version": "1.1.0",
10
10
  "main": "./cjs/index.js",
11
- "module": "./esm/index.js",
11
+ "module": "./esm/src/index.js",
12
12
  "types": "./index.d.ts",
13
+ "sideEffects": false,
13
14
  "dependencies": {
14
15
  "@urql/core": "^4.0.7",
15
16
  "@urql/exchange-graphcache": "^6.0.4",
16
17
  "cross-fetch": "^3.1.6",
18
+ "viem": "^1.2.0",
17
19
  "tslib": "^2.5.3",
18
20
  "zod": "^3.21.4"
19
21
  },
@@ -41,8 +43,28 @@
41
43
  },
42
44
  "exports": {
43
45
  ".": {
44
- "import": "./esm/index.js",
46
+ "import": "./esm/src/index.js",
45
47
  "require": "./cjs/index.js"
48
+ },
49
+ "./api": {
50
+ "import": "./esm/src/api/index.js",
51
+ "default": "./cjs/src/api/index.js",
52
+ "types": "./esm/src/api/index.d.ts"
53
+ },
54
+ "./core": {
55
+ "import": "./esm/src/core/index.js",
56
+ "default": "./cjs/src/core/index.js",
57
+ "types": "./esm/src/core/index.d.ts"
58
+ }
59
+ },
60
+ "typesVersions": {
61
+ "*": {
62
+ "api": [
63
+ "./esm/src/api/index.d.ts"
64
+ ],
65
+ "core": [
66
+ "./esm/src/core/index.d.ts"
67
+ ]
46
68
  }
47
69
  }
48
70
  }