graz 0.0.45-alpha.2 → 0.1.0-alpha.2

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.ts CHANGED
@@ -1,8 +1,9 @@
1
+ import * as _keplr_wallet_types from '@keplr-wallet/types';
1
2
  import { ChainInfo, AppCurrency, Bech32Config, Keplr, Key, OfflineAminoSigner, OfflineDirectSigner as OfflineDirectSigner$1 } from '@keplr-wallet/types';
2
3
  import { SignClientTypes } from '@walletconnect/types';
3
4
  import { Web3ModalConfig } from '@web3modal/standalone';
4
5
  import * as _cosmjs_cosmwasm_stargate from '@cosmjs/cosmwasm-stargate';
5
- import { CosmWasmClient, SigningCosmWasmClientOptions, SigningCosmWasmClient, InstantiateOptions } from '@cosmjs/cosmwasm-stargate';
6
+ import { CosmWasmClient, SigningCosmWasmClientOptions, SigningCosmWasmClient, InstantiateOptions, InstantiateResult, ExecuteResult } from '@cosmjs/cosmwasm-stargate';
6
7
  import { OfflineSigner, OfflineDirectSigner, Coin } from '@cosmjs/proto-signing';
7
8
  import * as _cosmjs_stargate from '@cosmjs/stargate';
8
9
  import { StargateClient, StargateClientOptions, SigningStargateClient, StdFee, DeliverTxResponse, QueryClient, StakingExtension, Coin as Coin$1 } from '@cosmjs/stargate';
@@ -263,11 +264,15 @@ interface ConfigureGrazArgs {
263
264
  }
264
265
  declare const configureGraz: (args: ConfigureGrazArgs) => ConfigureGrazArgs;
265
266
 
266
- declare const getBalances: <T extends "cosmWasm" | "stargate">({ bech32Address, client, currencies, }: {
267
- currencies: AppCurrency[];
267
+ declare const getAllBalance: <T extends "stargate">({ bech32Address, client, }: {
268
268
  bech32Address: string;
269
269
  client: ConnectClient<T>;
270
270
  }) => Promise<Coin[]>;
271
+ declare const getBalance: <T extends "cosmWasm" | "stargate">({ bech32Address, client, searchDenom, }: {
272
+ searchDenom: string;
273
+ bech32Address: string;
274
+ client: ConnectClient<T>;
275
+ }) => Promise<Coin>;
271
276
  declare const getBalanceStaked: ({ bech32Address, client, }: {
272
277
  bech32Address: string;
273
278
  client: ConnectClient<"stargate">;
@@ -303,7 +308,7 @@ interface InstantiateContractArgs<Message extends Record<string, unknown>> {
303
308
  senderAddress: string;
304
309
  codeId: number;
305
310
  }
306
- type InstantiateContractMutationArgs<Message extends Record<string, unknown>> = Omit<InstantiateContractArgs<Message>, "codeId" | "senderAddress" | "fee"> & {
311
+ type InstantiateContractMutationArgs<Message extends Record<string, unknown>> = Omit<InstantiateContractArgs<Message>, "codeId" | "senderAddress" | "fee" | "signingClient"> & {
307
312
  fee?: StdFee | "auto" | number;
308
313
  };
309
314
  declare const instantiateContract: <Message extends Record<string, unknown>>({ signingClient, senderAddress, msg, fee, options, label, codeId, }: InstantiateContractArgs<Message>) => Promise<_cosmjs_cosmwasm_stargate.InstantiateResult>;
@@ -316,7 +321,7 @@ interface ExecuteContractArgs<Message extends Record<string, unknown>> {
316
321
  funds: Coin[];
317
322
  memo: string;
318
323
  }
319
- type ExecuteContractMutationArgs<Message extends Record<string, unknown>> = Omit<ExecuteContractArgs<Message>, "contractAddress" | "senderAddress" | "fee" | "funds" | "memo"> & {
324
+ type ExecuteContractMutationArgs<Message extends Record<string, unknown>> = Omit<ExecuteContractArgs<Message>, "contractAddress" | "senderAddress" | "fee" | "funds" | "memo" | "signingClient"> & {
320
325
  fee?: StdFee | "auto" | number;
321
326
  funds?: Coin[];
322
327
  memo?: string;
@@ -474,8 +479,11 @@ interface UseAccountArgs {
474
479
  onDisconnect?: () => void;
475
480
  }
476
481
  /**
477
- * graz query hook to retrieve account data with optional arguments to invoke
478
- * given function on connect/disconnect.
482
+ * graz query hook to retrieve account data
483
+ *
484
+ * @param chainId - if provided, it will only return the data of the given chainId
485
+ * @param onConnect - callback function when the account is connected
486
+ * @param onDisconnect - callback function when the account is disconnected
479
487
  *
480
488
  * @example
481
489
  * ```tsx
@@ -497,6 +505,10 @@ type UseConnectChainArgs = MutationEventArgs<ConnectArgs, ConnectResult>;
497
505
  * graz mutation hook to execute wallet connection with optional arguments to
498
506
  * invoke given functions on error, loading, or success event.
499
507
  *
508
+ * @param onError - callback function when the connection is failed
509
+ * @param onLoading - callback function when the connection is loading
510
+ * @param onSuccess - callback function when the connection is successful
511
+ *
500
512
  * @example
501
513
  * ```ts
502
514
  * import { useConnect, mainnetChains } from "graz";
@@ -540,6 +552,10 @@ declare const useConnect: ({ onError, onLoading, onSuccess }?: UseConnectChainAr
540
552
  * graz mutation hook to execute wallet disconnection with optional arguments to
541
553
  * invoke given functions on error, loading, or success event.
542
554
  *
555
+ * @param onError - callback function when the disconnection is failed
556
+ * @param onLoading - callback function when the disconnection is loading
557
+ * @param onSuccess - callback function when the disconnection is successful
558
+ *
543
559
  * @example
544
560
  * ```ts
545
561
  * import { useDisconnect } from "graz";
@@ -554,8 +570,11 @@ declare const useConnect: ({ onError, onLoading, onSuccess }?: UseConnectChainAr
554
570
  * onSuccess: () => { ... },
555
571
  * });
556
572
  *
557
- * // pass `true` on disconnect to clear recent connected chain
558
- * disconnect(true);
573
+ * //disconnect all chains
574
+ * disconnect();
575
+ *
576
+ * //disconnect specific chains
577
+ * disconnect({ chainid: ["cosmoshub-4", "juno-1"] });
559
578
  * ```
560
579
  *
561
580
  * @see {@link disconnect}
@@ -575,12 +594,21 @@ declare const useDisconnect: ({ onError, onLoading, onSuccess }?: MutationEventA
575
594
  /**
576
595
  * graz hook to retrieve offline signer objects (default, amino enabled, and auto).
577
596
  *
578
- * Note: signer objects is initialized after connecting an account.
597
+ * @param chainId - chain id arguments
598
+ *
599
+ * @returns if chainId is string it will return an object, otherwise it will return a record of objects
579
600
  *
580
601
  * @example
581
602
  * ```ts
582
603
  * import { useOfflineSigners } from "graz";
583
- * const { signer, signerAmino, signerAuto } = useOfflineSigners();
604
+ *
605
+ * // single chain
606
+ * const { offlineSigner, offlineSignerAmino, offlineSignerAuto } = useOfflineSigners({ chainId: "cosmoshub-4" });
607
+ *
608
+ * // multi chain
609
+ * const offlineSigners = useOfflineSigners();
610
+ * offlineSigners["cosmoshub-4"].offlineSignerAuto;
611
+ *
584
612
  * ```
585
613
  */
586
614
  declare const useOfflineSigners: <T extends ChainIdArgs>(args?: T | undefined) => UseQueryResult<HookResultDataWithChainId<OfflineSigners, T> | undefined>;
@@ -614,8 +642,6 @@ declare const useActiveChainValidators: <T extends QueryClient & StakingExtensio
614
642
  * connect(recentChain);
615
643
  * }
616
644
  * ```
617
- *
618
- * @see {@link useActiveChain}
619
645
  */
620
646
  declare const useRecentChain: () => {
621
647
  data: string[] | null;
@@ -686,19 +712,47 @@ declare const useSuggestChainAndConnect: ({ onError, onLoading, onSuccess }?: Us
686
712
  suggestAndConnect: _tanstack_react_query.UseMutateFunction<ConnectResult, unknown, SuggestChainAndConnectArgs, unknown>;
687
713
  suggestAndConnectAsync: _tanstack_react_query.UseMutateAsyncFunction<ConnectResult, unknown, SuggestChainAndConnectArgs, unknown>;
688
714
  };
715
+ /**
716
+ * graz hook to retrieve chain data and usefull functions with given chainId
717
+ * @param chainId - Chain ID string
718
+ *
719
+ * @example
720
+ * ```ts
721
+ * import { useChain } from "graz";
722
+ * const { data: chain } = useChain("cosmoshub-4");
723
+ * ```
724
+ */
725
+ declare const useChain: ({ chainId }: {
726
+ chainId: string;
727
+ }) => {
728
+ convertMinimalDenomToDenom: (searchMinimalDenom: string, value: string) => {
729
+ denom: string;
730
+ value: number;
731
+ } | undefined;
732
+ currencies: _keplr_wallet_types.AppCurrency[];
733
+ data: GrazChain;
734
+ } | undefined;
689
735
 
690
736
  /**
691
- * graz query hook to retrieve a CosmWasmClient, StargateClient and Tendermint34Client. If there's no given arguments it will be using the current connected client
737
+ * graz query hook to retrieve a CosmWasmClient or StargateClient or Tendermint34Client.
738
+ *
739
+ * @param client - if provided, it will use the given client instead of the default client
740
+ * @param chainId - if provided, it will only return the data of the given chainId
741
+ * @param onlyConnectedChains - if true, it will only return the client of the current connected chains
742
+ * @param enabled - if false, it will not fetch the data
743
+ *
744
+ * @returns if chainId is string it will return an object, otherwise it will return a record of objects
692
745
  *
693
746
  * @example
694
747
  * ```ts
695
748
  * import { useClient } from "graz";
696
749
  *
697
- * // use connected client's cosmwasm client
698
- * const { data, isFetching, refetch, ... } = useClient();
750
+ * // single chain
751
+ * const { data, isLoading, ... } = useClient({ client: "stargate" chainId: "cosmoshub-4" });
752
+ *
753
+ * // all chains from GrazProvider example
754
+ * const { data, isLoading, ... } = useClient({ client: "stargate" });
699
755
  *
700
- * // initialize new custom client from given arguments
701
- * useClient({ rpc: "https://rpc.cosmoshub.strange.love", });
702
756
  * ```
703
757
  */
704
758
  declare const useConnectClient: <T extends Clients, U extends ChainIdArgs>(args?: ({
@@ -711,21 +765,24 @@ declare const useConnectClient: <T extends Clients, U extends ChainIdArgs>(args?
711
765
  enabled?: boolean | undefined;
712
766
  } & U) | undefined) => UseQueryResult<HookResultDataWithChainId<ConnectClient<T>, U> | undefined>;
713
767
  /**
714
- * graz query hook to retrieve a SigningCosmWasmClient. If there's no given args it will be using the current connected signer
768
+ * graz query hook to retrieve a SigningCosmWasmClient or SigningStargateClient.
769
+ *
770
+ * @param client - if provided, it will use the given client instead of the default client
771
+ * @param chainId - if provided, it will only return the data of the given chainId
772
+ * @param options - signing client options of given client
773
+ *
774
+ * @returns if chainId is string it will return an object, otherwise it will return a record of objects
715
775
  *
716
776
  * @example
717
777
  * ```ts
718
778
  * import { useSigningClient } from "graz";
719
779
  *
720
- * // get connected client's cosmwasm client
721
- * const { data, isFetching, refetch, ... } = useSigningClient();
780
+ * // single chain
781
+ * const { data, isLoading, ... } = useSigningClient({ client: "stargate" chainId: "cosmoshub-4" });
782
+ *
783
+ * // all chains from GrazProvider example
784
+ * const { data, isLoading, ... } = useSigningClient({ client: "stargate" });
722
785
  *
723
- * // initialize new custom client with given args
724
- * useSigningClient({
725
- * rpc: "https://rpc.cosmoshub.strange.love",
726
- * offlineSigner: customOfflineSigner,
727
- * ...
728
- * });
729
786
  * ```
730
787
  */
731
788
  declare const useConnectSigningClient: <T extends SigningClients, U extends ChainIdArgs>(args?: ({
@@ -734,50 +791,151 @@ declare const useConnectSigningClient: <T extends SigningClients, U extends Chai
734
791
  } & U) | undefined) => UseQueryResult<HookResultDataWithChainId<ConnectSigningClient<T>, U> | undefined>;
735
792
 
736
793
  /**
737
- * graz query hook to retrieve list of balances from current account or given address.
794
+ * graz query hook to retrieve balance from given address, denom and chainId
738
795
  *
739
- * @param bech32Address - Optional bech32 account address, defaults to connected account address
796
+ * @param bech32Address - Optional bech32 address, if not provided will return undefined
797
+ * @param searchDenom - Optional search denom, if not provided will return undefined
798
+ * @param chainId - Required chainId to retrieve the balances from given address
799
+ * @param client - Optional client, if not provided will use the default client
740
800
  *
741
801
  * @example
742
802
  * ```ts
743
- * import { useBalances } from "graz";
803
+ * import { useBalance } from "graz";
744
804
  *
745
- * // basic example
746
- * const { data, isFetching, refetch, ... } = useBalances();
805
+ * const { data, isFetching, refetch, ... } = useBalance({
806
+ * client: "stargate",
807
+ * chainId: "cosmoshub-4",
808
+ * bech32Address: "cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu",
809
+ * })
810
+ *
811
+ * ```
812
+ */
813
+ declare const useBalance: <T extends "cosmWasm" | "stargate">(args: {
814
+ bech32Address?: string | undefined;
815
+ client?: T | undefined;
816
+ chainId: string;
817
+ searchDenom?: string | undefined;
818
+ }) => UseQueryResult<Coin$1 | undefined>;
819
+ /**
820
+ * graz query hook to retrieve list of balances from given address.
821
+ *
822
+ * @param bech32Address - Optional bech32 address, if not provided will return undefined
823
+ * @param chainId - Optional chainId to retrieve the balances from given address and chainId, if not provided will return all balances currencies from all chains provided from GrazProvider
824
+ * @param client - Optional client, if not provided will use the default client
825
+ *
826
+ * @returns if chainId is string it will return an object, otherwise it will return a record of objects
747
827
  *
748
- * // with custom bech32 address
749
- * useBalances("cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu");
828
+ * @example
829
+ * ```ts
830
+ * import { useAllBalances } from "graz";
831
+ *
832
+ * // single chain example
833
+ * const { data, isFetching, refetch, ... } = useAllBalances({
834
+ * client: "stargate",
835
+ * chainId: "cosmoshub-4",
836
+ * bech32Address: "cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu",
837
+ * })
838
+ *
839
+ * // all chains from GrazProvider example
840
+ * const { data, isFetching, refetch, ... } = useAllBalances({
841
+ * client: "stargate",
842
+ * bech32Address: "cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu",
843
+ * })
750
844
  * ```
751
845
  */
752
- declare const useBalances: <T extends "cosmWasm" | "stargate", U extends ChainIdArgs>(args: {
846
+ declare const useAllBalances: <U extends ChainIdArgs>(args: {
847
+ bech32Address?: string | undefined;
848
+ } & U) => UseQueryResult<HookResultDataWithChainId<Coin$1[] | undefined, U>>;
849
+ /**
850
+ * graz query hook to retrieve list of currencies from defined chains in GrazProvider and given address.
851
+ *
852
+ * @param bech32Address - Optional bech32 address, if not provided will return undefined
853
+ * @param client - Optional client, if not provided will use the default client
854
+ * @param chainId - Optional chainId to retrieve the balances from given address and chainId, if not provided will return all balances currencies from all chains provided from GrazProvider
855
+ *
856
+ * @returns if chainId is string it will return an object, otherwise it will return a record of objects
857
+ *
858
+ * @example
859
+ * ```ts
860
+ * import { useChainBalances } from "graz";
861
+ *
862
+ * // single chain example
863
+ * const { data, isFetching, refetch, ... } = useChainBalances({
864
+ * client: "stargate",
865
+ * chainId: "cosmoshub-4",
866
+ * bech32Address: "cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu",
867
+ * })
868
+ *
869
+ * // all chains from GrazProvider example
870
+ * const { data, isFetching, refetch, ... } = useChainBalances({
871
+ * client: "stargate",
872
+ * bech32Address: "cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu",
873
+ * })
874
+ * ```
875
+ */
876
+ declare const useChainBalances: <T extends "cosmWasm" | "stargate", U extends ChainIdArgs>(args: {
753
877
  bech32Address?: string | undefined;
754
878
  client?: T | undefined;
755
879
  } & U) => UseQueryResult<HookResultDataWithChainId<Coin$1[], U>>;
756
880
  /**
757
881
  * graz query hook to retrieve list of staked balances from current account or given address.
758
882
  *
759
- * @param bech32Address - Optional bech32 account address, defaults to connected account address
883
+ * @param bech32Address - Optional bech32 account address, if not provided will return undefined
884
+ * @param chainId - Optional chainId to retrieve the balances from given address and chainId, if not provided will return all balances currencies from all chains provided from GrazProvider
885
+ *
886
+ * @returns if chainId is string it will return an object, otherwise it will return a record of objects
760
887
  *
761
888
  * @example
762
889
  * ```ts
763
890
  * import { useBalanceStaked } from "graz";
764
891
  *
765
- * // basic example
766
- * const { data, isFetching, refetch, ... } = useBalanceStaked();
892
+ * // single chain example
893
+ * const { data, isFetching, refetch, ... } = useBalanceStaked({
894
+ * chainId: "cosmoshub-4",
895
+ * bech32Address: "cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu",
896
+ * });
767
897
  *
768
- * // with custom bech32 address
769
- * useBalanceStaked("cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu");
898
+ * // all chains from GrazProvider example
899
+ * const { data, isFetching, refetch, ... } = useBalanceStaked({
900
+ * bech32Address: "cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu",
901
+ * });
770
902
  * ```
771
903
  */
772
- declare const useBalanceStaked: <T extends "stargate", U extends ChainIdArgs>(args: {
904
+ declare const useBalanceStaked: <U extends ChainIdArgs>(args: {
773
905
  bech32Address?: string | undefined;
774
- client?: T | undefined;
775
906
  } & U) => UseQueryResult<HookResultDataWithChainId<Coin$1 | null, U>>;
776
- declare const useSendTokens: <T extends SigningClients>({ signingClient, signingClientOptions, chainId, onError, onLoading, onSuccess, }: MutationEventArgs<SendTokensArgs<T>, DeliverTxResponse> & {
777
- signingClient?: T | undefined;
778
- signingClientOptions?: (T extends "cosmWasm" ? _cosmjs_cosmwasm_stargate.SigningCosmWasmClientOptions : T extends "stargate" ? _cosmjs_stargate.StargateClientOptions : never) | undefined;
907
+ interface UseSendTokens<T extends SigningClients> {
908
+ signingClient?: T;
909
+ signingClientOptions?: ConnectSigningClientArgs<T>["options"];
779
910
  chainId: string;
780
- }) => {
911
+ }
912
+ /**
913
+ * graz mutation hook to send tokens.
914
+ *
915
+ * @param signingClient - Optional ("stargate" | "cosmWasm") signing client to use, if not provided will use default signing client from GrazProvider
916
+ * @param signingClientOptions - Optional signing client options to use.
917
+ * @param chainId - Required chainId to send tokens to.
918
+ * @param onError - Optional error callback function.
919
+ * @param onLoading - Optional loading callback function.
920
+ * @param onSuccess - Optional success callback function.
921
+ *
922
+ * @example
923
+ * ```ts
924
+ * import { useSendTokens } from "graz";
925
+ *
926
+ * // basic example
927
+ * const { sendTokens } = useSendTokens();
928
+ *
929
+ * sendTokens({
930
+ * recipientAddress: "cosmos1g3jjhgkyf36pjhe7u5cw8j9u6cgl8x929ej430";
931
+ * amount: [coin];
932
+ * ...
933
+ * })
934
+ * ```
935
+ *
936
+ * @see {@link sendTokens}
937
+ */
938
+ declare const useSendTokens: <T extends SigningClients>({ signingClient, signingClientOptions, chainId, onError, onLoading, onSuccess, }: MutationEventArgs<SendTokensArgs<T>, DeliverTxResponse> & UseSendTokens<T>) => {
781
939
  error: unknown;
782
940
  isLoading: boolean;
783
941
  isSuccess: boolean;
@@ -785,6 +943,154 @@ declare const useSendTokens: <T extends SigningClients>({ signingClient, signing
785
943
  sendTokensAsync: _tanstack_react_query.UseMutateAsyncFunction<DeliverTxResponse, unknown, SendTokensArgs<T>, unknown>;
786
944
  status: "error" | "idle" | "loading" | "success";
787
945
  };
946
+ interface UseSendIbcTokens {
947
+ signingClientOptions?: ConnectSigningClientArgs<"stargate">["options"];
948
+ chainId: string;
949
+ }
950
+ /**
951
+ * graz mutation hook to send IBC tokens.
952
+ *
953
+ * @param chainId - Required chainId to send tokens to.
954
+ * @param signingClientOptions - Optional signing client options to use.
955
+ * @param onError - Optional error callback function.
956
+ * @param onLoading - Optional loading callback function.
957
+ * @param onSuccess - Optional success callback function.
958
+ *
959
+ * @example
960
+ * ```ts
961
+ * import { useSendIbcTokens } from "graz";
962
+ *
963
+ * // basic example
964
+ * const { sendIbcTokens } = useSendIbcTokens();
965
+ *
966
+ * sendIbcTokens({
967
+ * recipientAddress: "cosmos1g3jjhgkyf36pjhe7u5cw8j9u6cgl8x929ej430",
968
+ * transferAmount: coin,
969
+ * ...
970
+ * })
971
+ * ```
972
+ */
973
+ declare const useSendIbcTokens: ({ chainId, signingClientOptions, onError, onLoading, onSuccess, }: MutationEventArgs<SendIbcTokensArgs, DeliverTxResponse> & UseSendIbcTokens) => {
974
+ error: unknown;
975
+ isLoading: boolean;
976
+ isSuccess: boolean;
977
+ sendIbcTokens: _tanstack_react_query.UseMutateFunction<DeliverTxResponse, unknown, SendIbcTokensArgs, unknown>;
978
+ sendIbcTokensAsync: _tanstack_react_query.UseMutateAsyncFunction<DeliverTxResponse, unknown, SendIbcTokensArgs, unknown>;
979
+ status: "error" | "idle" | "loading" | "success";
980
+ };
981
+ type UseInstantiateContractArgs<Message extends Record<string, unknown>> = {
982
+ codeId: number;
983
+ chainId: string;
984
+ signingClientOptions?: ConnectSigningClientArgs<"cosmWasm">["options"];
985
+ } & MutationEventArgs<InstantiateContractMutationArgs<Message>, InstantiateResult>;
986
+ /**
987
+ * graz mutation hook to instantiate a CosmWasm smart contract when supported.
988
+ *
989
+ * @param codeId - Required codeId to instantiate.
990
+ * @param chainId - Required chainId to instantiate contract on.
991
+ * @param signingClientOptions - Optional signing client options to use.
992
+ * @param onError - Optional error callback function.
993
+ * @param onLoading - Optional loading callback function.
994
+ * @param onSuccess - Optional success callback function.
995
+ *
996
+ * @example
997
+ * ```ts
998
+ * import { useInstantiateContract } from "graz"
999
+ *
1000
+ * const { instantiateContract: instantiateMyContract } = useInstantiateContract({
1001
+ * codeId: 4,
1002
+ * onSuccess: ({ contractAddress }) => console.log('Address:', contractAddress)
1003
+ * })
1004
+ *
1005
+ * const instantiateMessage = { foo: 'bar' };
1006
+ * instantiateMyContract({
1007
+ * msg: instatiateMessage,
1008
+ * label: "test"
1009
+ * });
1010
+ * ```
1011
+ */
1012
+ declare const useInstantiateContract: <Message extends Record<string, unknown>>({ chainId, codeId, signingClientOptions, onError, onLoading, onSuccess, }: UseInstantiateContractArgs<Message>) => {
1013
+ error: unknown;
1014
+ isLoading: boolean;
1015
+ isSuccess: boolean;
1016
+ instantiateContract: _tanstack_react_query.UseMutateFunction<InstantiateResult, unknown, InstantiateContractMutationArgs<Message>, unknown>;
1017
+ instantiateContractAsync: _tanstack_react_query.UseMutateAsyncFunction<InstantiateResult, unknown, InstantiateContractMutationArgs<Message>, unknown>;
1018
+ status: "error" | "idle" | "loading" | "success";
1019
+ };
1020
+ type UseExecuteContractArgs<Message extends Record<string, unknown>> = {
1021
+ contractAddress: string;
1022
+ chainId: string;
1023
+ signingClientOptions?: ConnectSigningClientArgs<"cosmWasm">["options"];
1024
+ } & MutationEventArgs<ExecuteContractMutationArgs<Message>, ExecuteResult>;
1025
+ /**
1026
+ * graz mutation hook for executing transactions against a CosmWasm smart
1027
+ * contract.
1028
+ *
1029
+ * @param contractAddress - Required contractAddress to execute against.
1030
+ * @param chainId - Required chainId to execute contract on.
1031
+ * @param signingClientOptions - Optional signing client options to use.
1032
+ * @param onError - Optional error callback function.
1033
+ * @param onLoading - Optional loading callback function.
1034
+ * @param onSuccess - Optional success callback function.
1035
+ *
1036
+ * @example
1037
+ * ```ts
1038
+ * import { useExecuteContract } from "graz"
1039
+ *
1040
+ * interface GreetMessage {
1041
+ * name: string;
1042
+ * }
1043
+ *
1044
+ * interface GreetResponse {
1045
+ * message: string;
1046
+ * }
1047
+ *
1048
+ * const contractAddress = "cosmosfoobarbaz";
1049
+ * const { executeContract } = useExecuteContract<ExecuteMessage>({ contractAddress });
1050
+ * executeContract({ msg: {
1051
+ * foo: "bar"
1052
+ * }}, {
1053
+ * onSuccess: (data: GreetResponse) => console.log('Got message:', data.message);
1054
+ * });
1055
+ * ```
1056
+ */
1057
+ declare const useExecuteContract: <Message extends Record<string, unknown>>({ chainId, contractAddress, signingClientOptions, onError, onLoading, onSuccess, }: UseExecuteContractArgs<Message>) => {
1058
+ error: unknown;
1059
+ isLoading: boolean;
1060
+ isSuccess: boolean;
1061
+ executeContract: _tanstack_react_query.UseMutateFunction<ExecuteResult, unknown, ExecuteContractMutationArgs<Message>, unknown>;
1062
+ executeContractAsync: _tanstack_react_query.UseMutateAsyncFunction<ExecuteResult, unknown, ExecuteContractMutationArgs<Message>, unknown>;
1063
+ status: "error" | "idle" | "loading" | "success";
1064
+ };
1065
+ /**
1066
+ * graz query hook for dispatching a "smart" query to a CosmWasm smart
1067
+ * contract.
1068
+ *
1069
+ * @param address - The address of the contract to query
1070
+ * @param queryMsg - The query message to send to the contract
1071
+ * @param chainId - The chainId to query on
1072
+ *
1073
+ * @returns A query result with the result returned by the smart contract.
1074
+ */
1075
+ declare const useQuerySmart: <TData, TError>({ address, queryMsg, chainId, }: {
1076
+ address?: string | undefined;
1077
+ queryMsg?: Record<string, unknown> | undefined;
1078
+ chainId: string;
1079
+ }) => UseQueryResult<TData, TError>;
1080
+ /**
1081
+ * graz query hook for dispatching a "raw" query to a CosmWasm smart contract.
1082
+ *
1083
+ * @param address - The address of the contract to query
1084
+ * @param key - The key to lookup in the contract storage
1085
+ * @param chainId - The chainId to query on
1086
+ *
1087
+ * @returns A query result with raw byte array stored at the key queried.
1088
+ */
1089
+ declare const useQueryRaw: <TError>({ address, key, chainId, }: {
1090
+ address?: string | undefined;
1091
+ key?: string | undefined;
1092
+ chainId: string;
1093
+ }) => UseQueryResult<Uint8Array | null, TError>;
788
1094
 
789
1095
  /**
790
1096
  * graz hook to retrieve current active {@link WalletType}
@@ -858,4 +1164,12 @@ type GrazProviderProps = Partial<QueryClientProviderProps> & {
858
1164
  */
859
1165
  declare const GrazProvider: FC<GrazProviderProps>;
860
1166
 
861
- export { AccountData, ChainInfoWithPath, Clients, ConfigureGrazArgs, ConnectArgs, ConnectClient, ConnectClientArgs, ConnectResult, ConnectSigningClient, ConnectSigningClientArgs, Connector, Dictionary, ExecuteContractArgs, ExecuteContractMutationArgs, GetWalletConnectParams, GrazAdapter, GrazChain, GrazConfig, GrazEvents, GrazProvider, GrazProviderProps, InstantiateContractArgs, InstantiateContractMutationArgs, Maybe, OfflineSigners, ReconnectArgs, SendIbcTokensArgs, SendTokensArgs, SigningClients, SuggestChainAndConnectArgs, UseAccountArgs, UseConnectChainArgs, UseSuggestChainAndConnectArgs, UseSuggestChainArgs, WALLET_TYPES, Wallet, WalletType, checkWallet, clearRecentChain, configureGraz, connect, connectClient, connectSigningClient, defineChain, defineChainInfo, defineChains, disconnect, executeContract, getAvailableWallets, getBalanceStaked, getBalances, getCosmostation, getKeplr, getLeap, getOfflineSigners, getQueryRaw, getQuerySmart, getRecentChains, getVectis, getWCCosmostation, getWCKeplr, getWCLeap, getWallet, getWalletConnect, instantiateContract, mainnetChains, mainnetChainsArray, reconnect, sendIbcTokens, sendTokens, suggestChain, suggestChainAndConnect, testnetChains, testnetChainsArray, useAccount, useActiveChainValidators, useActiveWalletType, useBalanceStaked, useBalances, useCheckWallet, useConnect, useConnectClient, useConnectSigningClient, useDisconnect, useGrazEvents, useOfflineSigners, useRecentChain, useSendTokens, useSuggestChain, useSuggestChainAndConnect };
1167
+ declare const convertMicroDenomToDenom: (value: number | string, decimals: number) => number;
1168
+ declare const convertDenomToMicroDenom: (value: number | string, decimals: number) => number;
1169
+ declare const convertFromMicroDenom: (denom: string) => string;
1170
+ declare const convertToFixedDecimals: (value: number | string, fractionDigits?: number) => string;
1171
+ declare const formatTokenName: (name: string) => string;
1172
+ declare const handleNaN: (value: number) => number;
1173
+ declare const truncate: (string?: string, slice?: number) => string;
1174
+
1175
+ export { AccountData, ChainInfoWithPath, Clients, ConfigureGrazArgs, ConnectArgs, ConnectClient, ConnectClientArgs, ConnectResult, ConnectSigningClient, ConnectSigningClientArgs, Connector, Dictionary, ExecuteContractArgs, ExecuteContractMutationArgs, GetWalletConnectParams, GrazAdapter, GrazChain, GrazConfig, GrazEvents, GrazProvider, GrazProviderProps, InstantiateContractArgs, InstantiateContractMutationArgs, Maybe, OfflineSigners, ReconnectArgs, SendIbcTokensArgs, SendTokensArgs, SigningClients, SuggestChainAndConnectArgs, UseAccountArgs, UseConnectChainArgs, UseExecuteContractArgs, UseInstantiateContractArgs, UseSendIbcTokens, UseSuggestChainAndConnectArgs, UseSuggestChainArgs, WALLET_TYPES, Wallet, WalletType, checkWallet, clearRecentChain, configureGraz, connect, connectClient, connectSigningClient, convertDenomToMicroDenom, convertFromMicroDenom, convertMicroDenomToDenom, convertToFixedDecimals, defineChain, defineChainInfo, defineChains, disconnect, executeContract, formatTokenName, getAllBalance, getAvailableWallets, getBalance, getBalanceStaked, getCosmostation, getKeplr, getLeap, getOfflineSigners, getQueryRaw, getQuerySmart, getRecentChains, getVectis, getWCCosmostation, getWCKeplr, getWCLeap, getWallet, getWalletConnect, handleNaN, instantiateContract, mainnetChains, mainnetChainsArray, reconnect, sendIbcTokens, sendTokens, suggestChain, suggestChainAndConnect, testnetChains, testnetChainsArray, truncate, useAccount, useActiveChainValidators, useActiveWalletType, useAllBalances, useBalance, useBalanceStaked, useChain, useChainBalances, useCheckWallet, useConnect, useConnectClient, useConnectSigningClient, useDisconnect, useExecuteContract, useGrazEvents, useInstantiateContract, useOfflineSigners, useQueryRaw, useQuerySmart, useRecentChain, useSendIbcTokens, useSendTokens, useSuggestChain, useSuggestChainAndConnect };