graz 0.3.7 → 0.4.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -2,9 +2,9 @@
2
2
  import { DirectSignResponse, OfflineDirectSigner, Coin } from '@cosmjs/proto-signing';
3
3
  import { Key as Key$1, Keplr, ChainInfo, KeplrSignOptions, KeplrIntereactionOptions, OfflineAminoSigner as OfflineAminoSigner$1, AppCurrency } from '@keplr-wallet/types';
4
4
  import { OfflineAminoSigner } from '@cosmjs/amino';
5
- import { SignClientTypes } from '@walletconnect/types';
6
- import { WalletConnectModalConfig } from '@walletconnect/modal';
7
5
  import { ParaGrazConfig as ParaGrazConfig$1, ParaGrazConnector } from '@getpara/graz-connector';
6
+ import { WalletConnectModalConfig } from '@walletconnect/modal';
7
+ import { SignClientTypes } from '@walletconnect/types';
8
8
  import * as _cosmjs_cosmwasm_stargate from '@cosmjs/cosmwasm-stargate';
9
9
  import { SigningCosmWasmClient, InstantiateOptions, CosmWasmClient, InstantiateResult, ExecuteResult, SigningCosmWasmClientOptions } from '@cosmjs/cosmwasm-stargate';
10
10
  import { SigningStargateClient, StdFee, DeliverTxResponse, QueryClient, StakingExtension, StargateClient, SigningStargateClientOptions } from '@cosmjs/stargate';
@@ -36,7 +36,8 @@ declare enum WalletType {
36
36
  COMPASS = "compass",
37
37
  INITIA = "initia",
38
38
  OKX = "okx",
39
- PARA = "para"
39
+ PARA = "para",
40
+ CACTUSCOSMOS = "cactuscosmos"
40
41
  }
41
42
  declare const WALLET_TYPES: WalletType[];
42
43
  type Wallet = Pick<Keplr, "enable" | "getOfflineSignerOnlyAmino" | "signAmino"> & {
@@ -66,14 +67,13 @@ type SignAminoParams = Parameters<Wallet["signAmino"]>;
66
67
  type KnownKeys = Record<string, Key>;
67
68
  type Key = Omit<Key$1, "ethereumHexAddress">;
68
69
 
69
- type ChainId$1 = string | string[];
70
- interface MultiChainHookArgs {
71
- chainId?: ChainId$1;
72
- multiChain?: boolean;
73
- }
74
-
70
+ /**
71
+ * Chain ID type for actions - supports both string and string[] for backward compatibility.
72
+ * Actions normalize this internally to string[].
73
+ */
74
+ type ActionChainId = string | string[];
75
75
  type ConnectArgs = Maybe<{
76
- chainId: ChainId$1;
76
+ chainId: ActionChainId;
77
77
  walletType?: WalletType;
78
78
  autoReconnect?: boolean;
79
79
  }>;
@@ -84,7 +84,7 @@ interface ConnectResult {
84
84
  }
85
85
  declare const connect: (args?: ConnectArgs) => Promise<ConnectResult>;
86
86
  declare const disconnect: (args?: {
87
- chainId?: ChainId$1;
87
+ chainId?: ActionChainId;
88
88
  }) => Promise<void>;
89
89
  type ReconnectArgs = Maybe<{
90
90
  onError?: (error: unknown) => void;
@@ -103,12 +103,16 @@ declare const getOfflineSigners: (args?: {
103
103
  declare const clearRecentChain: () => void;
104
104
  declare const getRecentChainIds: () => string[] | null;
105
105
  declare const getRecentChains: () => ChainInfo[] | null;
106
- declare const getChainInfo: ({ chainId }: {
106
+ declare const getChainInfo: ({ chainId }?: {
107
107
  chainId?: string;
108
108
  }) => ChainInfo | undefined;
109
- declare const getChainInfos: ({ chainId }: {
109
+ declare const getChainInfos: ({ chainId }?: {
110
110
  chainId?: string[];
111
111
  }) => ChainInfo[] | undefined;
112
+ interface AddChainArgs {
113
+ chainInfo: ChainInfo;
114
+ }
115
+ declare const addChain: ({ chainInfo }: AddChainArgs) => Promise<ChainInfo>;
112
116
  interface SuggestChainArgs {
113
117
  chainInfo: ChainInfo;
114
118
  walletType: WalletType;
@@ -157,7 +161,8 @@ interface GrazInternalStore {
157
161
  chainsConfig: Record<string, ChainConfig> | null;
158
162
  iframeOptions: IframeOptions | null;
159
163
  /**
160
- * Graz will use this number to determine how many concurrent requests to make when using `multiChain` args in hooks.
164
+ * Graz will use this number to determine how many concurrent requests to make when querying multiple chains.
165
+ * All hooks now operate on multiple chains by default (returning Record<chainId, T>).
161
166
  * Defaults to 3.
162
167
  */
163
168
  multiChainFetchConcurrency: number;
@@ -188,7 +193,8 @@ interface ConfigureGrazArgs {
188
193
  */
189
194
  autoReconnect?: boolean;
190
195
  /**
191
- * Graz will use this number to determine how many concurrent requests to make when using `multiChain` args in hooks.
196
+ * Graz will use this number to determine how many concurrent requests to make when querying multiple chains.
197
+ * All hooks now operate on multiple chains by default (returning Record<chainId, T>).
192
198
  * Defaults to 3.
193
199
  */
194
200
  multiChainFetchConcurrency?: number;
@@ -231,7 +237,7 @@ interface InstantiateContractArgs<Message extends Record<string, unknown>> {
231
237
  senderAddress: string;
232
238
  codeId: number;
233
239
  }
234
- type InstantiateContractMutationArgs<Message extends Record<string, unknown>> = Omit<InstantiateContractArgs<Message>, "codeId" | "senderAddress" | "fee"> & {
240
+ type InstantiateContractMutationArgs<Message extends Record<string, unknown>> = Omit<InstantiateContractArgs<Message>, "codeId" | "fee"> & {
235
241
  fee?: StdFee | "auto" | number;
236
242
  };
237
243
  declare const instantiateContract: <Message extends Record<string, unknown>>({ signingClient, senderAddress, msg, fee, options, label, codeId, }: InstantiateContractArgs<Message>) => Promise<_cosmjs_cosmwasm_stargate.InstantiateResult>;
@@ -244,7 +250,7 @@ interface ExecuteContractArgs<Message extends Record<string, unknown>> {
244
250
  funds: Coin[];
245
251
  memo: string;
246
252
  }
247
- type ExecuteContractMutationArgs<Message extends Record<string, unknown>> = Omit<ExecuteContractArgs<Message>, "contractAddress" | "senderAddress" | "fee" | "funds" | "memo"> & {
253
+ type ExecuteContractMutationArgs<Message extends Record<string, unknown>> = Omit<ExecuteContractArgs<Message>, "contractAddress" | "fee" | "funds" | "memo"> & {
248
254
  fee?: StdFee | "auto" | number;
249
255
  funds?: Coin[];
250
256
  memo?: string;
@@ -283,6 +289,9 @@ declare const isLeapDappBrowser: () => boolean;
283
289
  declare const isWalletConnect: (type: WalletType) => boolean;
284
290
  declare const isPara: (type: WalletType) => type is WalletType.PARA;
285
291
 
292
+ type CactusCosmosWallet = Pick<Keplr, "enable" | "getOfflineSigner" | "signDirect" | "signAmino" | "signArbitrary" | "getKey">;
293
+ declare const getCactusCosmos: () => Wallet;
294
+
286
295
  /**
287
296
  * Function to return cosmostation object (which is {@link Wallet}) and throws and error if it does not exist on `window`.
288
297
  *
@@ -348,38 +357,38 @@ declare const getLeap: () => Wallet;
348
357
  declare const getMetamaskSnapLeap: () => Wallet;
349
358
 
350
359
  /**
351
- * Function to return {@link Wallet} object and throws and error if it does not exist on `window`.
360
+ * Function to return okxwallet object (which is {@link Wallet}) and throws and error if it does not exist on `window`.
352
361
  *
353
362
  * @example
354
363
  * ```ts
355
364
  * try {
356
- * const vectis = getVectis();
365
+ * const okxWallet = getOkx();
357
366
  * } catch (error: Error) {
358
367
  * console.error(error.message);
359
368
  * }
360
369
  * ```
361
370
  *
362
- *
371
+ * @see https://www.okx.com/web3/build/docs/sdks/chains/cosmos/provider
363
372
  */
364
- declare const getVectis: () => Wallet;
373
+ declare const getOkx: () => Wallet;
374
+
375
+ declare const getPara: () => Wallet;
365
376
 
366
377
  /**
367
- * Function to return okxwallet object (which is {@link Wallet}) and throws and error if it does not exist on `window`.
378
+ * Function to return {@link Wallet} object and throws and error if it does not exist on `window`.
368
379
  *
369
380
  * @example
370
381
  * ```ts
371
382
  * try {
372
- * const okxWallet = getOkx();
383
+ * const vectis = getVectis();
373
384
  * } catch (error: Error) {
374
385
  * console.error(error.message);
375
386
  * }
376
387
  * ```
377
388
  *
378
- * @see https://www.okx.com/web3/build/docs/sdks/chains/cosmos/provider
389
+ *
379
390
  */
380
- declare const getOkx: () => Wallet;
381
-
382
- declare const getPara: () => Wallet;
391
+ declare const getVectis: () => Wallet;
383
392
 
384
393
  interface GetWalletConnectParams {
385
394
  encoding: BufferEncoding;
@@ -451,20 +460,58 @@ interface MutationEventArgs<TInitial = unknown, TSuccess = TInitial> {
451
460
  onLoading?: (data: TInitial) => unknown;
452
461
  onSuccess?: (data: TSuccess) => unknown;
453
462
  }
454
- type ChainId = string;
455
- type UseMultiChainQueryResult<TMulti extends MultiChainHookArgs, TData> = UseQueryResult<TMulti["multiChain"] extends true ? Record<ChainId, TData> : TData>;
463
+ /**
464
+ * Type utility to convert a readonly array of chain IDs to a mapped record type.
465
+ * This enables type inference for chainId arrays.
466
+ *
467
+ * @example
468
+ * ```ts
469
+ * type Result = ChainIdToRecord<readonly ["cosmoshub-4", "osmosis-1"], Key>;
470
+ * // Result: { "cosmoshub-4": Key, "osmosis-1": Key }
471
+ * ```
472
+ */
473
+ type ChainIdToRecord<T extends readonly string[], TData> = {
474
+ [K in T[number]]: TData;
475
+ };
476
+ /**
477
+ * Query result type for multi-chain hooks with type inference.
478
+ *
479
+ * - When `chainId` is provided as a readonly array, returns a Record with exact keys
480
+ * - When `chainId` is undefined, returns a generic Record<string, TData>
481
+ *
482
+ * @example
483
+ * ```ts
484
+ * // Type inference with chainId array
485
+ * const result: UseMultiChainQueryResult<readonly ["cosmoshub-4"], Key>;
486
+ * // result.data?: { "cosmoshub-4": Key }
487
+ *
488
+ * // Generic type when chainId is undefined
489
+ * const result: UseMultiChainQueryResult<undefined, Key>;
490
+ * // result.data?: Record<string, Key>
491
+ * ```
492
+ */
493
+ type UseMultiChainQueryResult<TChainIds extends readonly string[] | undefined, TData> = UseQueryResult<TChainIds extends readonly string[] ? ChainIdToRecord<TChainIds, TData> : Record<string, TData>>;
456
494
  interface QueryConfig {
457
495
  enabled?: boolean;
458
496
  }
459
497
 
498
+ /**
499
+ * ChainId is now always an array of chain IDs.
500
+ * This ensures consistent multi-chain behavior across all hooks.
501
+ */
502
+ type ChainId = string[];
503
+
460
504
  interface UseAccountArgs {
461
505
  onConnect?: (args: ConnectResult & {
462
506
  isReconnect: boolean;
463
507
  }) => void;
464
508
  onDisconnect?: () => void;
465
509
  }
466
- interface UseAccountResult<TMulti extends MultiChainHookArgs> {
467
- data?: TMulti["multiChain"] extends true ? Record<string, Key$1 | undefined> : Key$1 | undefined;
510
+ /**
511
+ * Return type for useAccount hook with type inference based on chainId parameter.
512
+ */
513
+ interface UseAccountResult<TChainIds extends readonly string[] | undefined> {
514
+ data?: TChainIds extends readonly string[] ? ChainIdToRecord<TChainIds, Key$1 | undefined> : Record<string, Key$1 | undefined>;
468
515
  isConnected: boolean;
469
516
  isConnecting: boolean;
470
517
  isDisconnected: boolean;
@@ -478,68 +525,87 @@ interface UseAccountResult<TMulti extends MultiChainHookArgs> {
478
525
  * graz query hook to retrieve account data with optional arguments to invoke
479
526
  * given function on connect/disconnect.
480
527
  *
528
+ * Note: All hooks now return multi-chain results by default (Record<chainId, T>).
529
+ *
481
530
  * @example
482
531
  * ```tsx
483
532
  * import { useAccount } from "graz";
484
533
  *
485
- * // basic example
486
- * const { data:account, isConnecting, isConnected, ... } = useAccount();
487
- * account.bech32Address
488
- * // multichain example
489
- * const { data: accounts, isConnecting, isConnected, ... } = useAccount({ chainId: ["cosmoshub-4", "sommelier-3"], multiChain: true });
490
- * accounts['cosmoshub-4'].bech32Address
491
- * // with event arguments
534
+ * // Single chain with precise type inference
535
+ * const { data: accounts } = useAccount({ chainId: ["cosmoshub-4"] });
536
+ * // Type: { data?: { "cosmoshub-4": Key } }
537
+ * const account = accounts?.["cosmoshub-4"];
538
+ * account?.bech32Address; // TypeScript knows this exists!
539
+ *
540
+ * // Multiple chains with precise type inference
541
+ * const { data: accounts } = useAccount({
542
+ * chainId: ["cosmoshub-4", "osmosis-1"]
543
+ * });
544
+ * // Type: { data?: { "cosmoshub-4": Key, "osmosis-1": Key } }
545
+ * const cosmosAccount = accounts?.["cosmoshub-4"]; // ✅ Autocomplete!
546
+ * const osmosisAccount = accounts?.["osmosis-1"]; // ✅ Autocomplete!
547
+ *
548
+ * // All connected chains (generic Record type)
549
+ * const { data: accounts } = useAccount();
550
+ * // Type: { data?: Record<string, Key> }
551
+ *
552
+ * // With event callbacks
492
553
  * useAccount({
493
- * onConnect: ({ account, isReconnect }) => { ... },
554
+ * chainId: ["cosmoshub-4"],
555
+ * onConnect: ({ accounts, isReconnect }) => { ... },
494
556
  * onDisconnect: () => { ... },
495
557
  * });
496
558
  * ```
497
559
  */
498
- declare const useAccount: <TMulti extends MultiChainHookArgs>(args?: UseAccountArgs & TMulti) => UseAccountResult<TMulti>;
560
+ declare function useAccount<const TChainIds extends readonly string[]>(args: UseAccountArgs & {
561
+ chainId: TChainIds;
562
+ }): UseAccountResult<TChainIds>;
563
+ declare function useAccount(args?: UseAccountArgs): UseAccountResult<undefined>;
499
564
  /**
500
- * graz query hook to retrieve list of balances from current account or given address.
565
+ * graz query hook to retrieve list of balances for a specific chain and address.
501
566
  *
502
- * @param bech32Address - Optional bech32 account address, defaults to connected account address
567
+ * @param chainId - Chain ID to query balances from
568
+ * @param bech32Address - Required bech32 account address
503
569
  *
504
570
  * @example
505
571
  * ```ts
506
572
  * import { useBalances } from "graz";
507
573
  *
508
- * // basic example
509
- * const { data, isFetching, refetch, ... } = useBalances();
510
- *
511
- * // multichain example
512
- * const { data:balances, isFetching, refetch, ... } = useBalances({chainId: ["cosmoshub-4", "sommelier-3"] multiChain: true});
513
- * const cosmoshubBalances = balances["cosmoshub-4"]
514
- *
574
+ * const { data: balances } = useBalances({
575
+ * chainId: "cosmoshub-4",
576
+ * bech32Address: "cosmos1..."
577
+ * });
578
+ * // Type: { data?: Coin[] }
515
579
  * ```
516
580
  */
517
- declare const useBalances: <TMulti extends MultiChainHookArgs>(args?: {
518
- bech32Address?: string;
519
- } & TMulti & QueryConfig) => UseMultiChainQueryResult<TMulti, Coin[]>;
581
+ declare const useBalances: (args: {
582
+ bech32Address: string;
583
+ chainId: string;
584
+ } & QueryConfig) => UseQueryResult<Coin[], unknown>;
520
585
  /**
521
- * graz query hook to retrieve specific asset balance from current account or given address.
586
+ * graz query hook to retrieve specific asset balance for a specific chain and address.
522
587
  *
588
+ * @param chainId - Chain ID to query balance from
589
+ * @param bech32Address - Required bech32 account address
523
590
  * @param denom - Asset denom to search
524
- * @param bech32Address - Optional bech32 account address, defaults to connected account address
525
591
  *
526
592
  * @example
527
593
  * ```ts
528
594
  * import { useBalance } from "graz";
529
595
  *
530
- * // basic example
531
- * const { data, isFetching, refetch, ... } = useBalance({denom: "atom"});
532
- *
533
- * // with custom bech32 address
534
- * useBalance("atom", "cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu");
596
+ * const { data: balance } = useBalance({
597
+ * chainId: "cosmoshub-4",
598
+ * bech32Address: "cosmos1...",
599
+ * denom: "uatom"
600
+ * });
601
+ * // Type: { data?: Coin | undefined }
535
602
  * ```
536
603
  */
537
- declare const useBalance: <TMulti extends MultiChainHookArgs>(args: {
538
- denom?: string;
539
- bech32Address?: string;
540
- } & {
541
- chainId: ChainId$1;
542
- } & QueryConfig) => UseMultiChainQueryResult<TMulti, Coin | undefined>;
604
+ declare const useBalance: (args: {
605
+ bech32Address: string;
606
+ chainId: string;
607
+ denom: string;
608
+ } & QueryConfig) => UseQueryResult<Coin | undefined, unknown>;
543
609
  type UseConnectChainArgs = MutationEventArgs<ConnectArgs, ConnectResult>;
544
610
  /**
545
611
  * graz mutation hook to execute wallet connection with optional arguments to
@@ -610,10 +676,10 @@ declare const useConnect: ({ onError, onLoading, onSuccess }?: UseConnectChainAr
610
676
  */
611
677
  declare const useDisconnect: ({ onError, onLoading, onSuccess }?: MutationEventArgs) => {
612
678
  disconnect: (args?: {
613
- chainId?: ChainId$1;
679
+ chainId?: ChainId;
614
680
  }) => void;
615
681
  disconnectAsync: (args?: {
616
- chainId?: ChainId$1;
682
+ chainId?: ChainId;
617
683
  }) => Promise<void>;
618
684
  error: Error | null;
619
685
  isLoading: boolean;
@@ -623,45 +689,59 @@ declare const useDisconnect: ({ onError, onLoading, onSuccess }?: MutationEventA
623
689
  /**
624
690
  * graz hook to retrieve offline signer objects (default, amino enabled, and auto).
625
691
  *
626
- * Note: signer objects is initialized after connecting an account.
692
+ * Note: Returns multi-chain results by default (Record<chainId, OfflineSigners>).
693
+ * Signer objects are initialized after connecting an account.
627
694
  *
628
695
  * @example
629
696
  * ```ts
630
- *
631
- * // basic example
632
697
  * import { useOfflineSigners } from "graz";
633
- * const { offlineSigner, offlineSignerAmino, offlineSignerAuto } = useOfflineSigners();
634
698
  *
635
- * // multichain example
636
- * const offlineSigners = useOfflineSigners({chainId: ["cosmoshub-4", "sommelier-3"] multiChain: true});
637
- * const cosmoshubOfflineSigners = offlineSigners["cosmoshub-4"]
699
+ * // Single chain with precise type inference
700
+ * const { data: signers } = useOfflineSigners({ chainId: ["cosmoshub-4"] });
701
+ * // Type: { data?: { "cosmoshub-4": OfflineSigners } }
702
+ * const { offlineSigner, offlineSignerAmino, offlineSignerAuto } = signers?.["cosmoshub-4"] || {};
638
703
  *
704
+ * // Multiple chains with precise type inference
705
+ * const { data: signers } = useOfflineSigners({
706
+ * chainId: ["cosmoshub-4", "osmosis-1"]
707
+ * });
708
+ * // Type: { data?: { "cosmoshub-4": OfflineSigners, "osmosis-1": OfflineSigners } }
709
+ * const cosmosSigners = signers?.["cosmoshub-4"]; // ✅ Autocomplete!
710
+ *
711
+ * // All connected chains
712
+ * const { data: signers } = useOfflineSigners();
713
+ * // Type: { data?: Record<string, OfflineSigners> }
639
714
  * ```
640
715
  */
641
- declare const useOfflineSigners: <TMulti extends MultiChainHookArgs>(args?: TMulti) => UseMultiChainQueryResult<TMulti, OfflineSigners>;
716
+ declare function useOfflineSigners<const TChainIds extends readonly string[]>(args: {
717
+ chainId: TChainIds;
718
+ }): UseMultiChainQueryResult<TChainIds, OfflineSigners>;
719
+ declare function useOfflineSigners(args?: {}): UseMultiChainQueryResult<undefined, OfflineSigners>;
642
720
  /**
643
- * graz query hook to retrieve list of staked balances from current account or given address.
721
+ * graz query hook to retrieve staked balance for a specific chain and address.
644
722
  *
645
- * @param bech32Address - Optional bech32 account address, defaults to connected account address
723
+ * @param chainId - Chain ID to query staked balance from
724
+ * @param bech32Address - Required bech32 account address
646
725
  *
647
726
  * @example
648
727
  * ```ts
649
- * import { useBalanceStaked } from "graz";
650
- *
651
- * // basic example
652
- * const { data, isFetching, refetch, ... } = useBalanceStaked();
728
+ * import { useBalanceStaked, useAccount } from "graz";
653
729
  *
654
- * // multichain example
655
- * const { data:balanceStaked, isFetching, refetch, ... } = useBalanceStaked({chainId: ["cosmoshub-4", "sommelier-3"] multiChain: true});
656
- * const cosmoshubBalanceStaked = balances["cosmoshub-4"]
730
+ * const { data: accounts } = useAccount();
731
+ * const account = accounts?.["cosmoshub-4"];
657
732
  *
658
- * // with custom bech32 address
659
- * useBalanceStaked({ bech32Address: "cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu"});
733
+ * const { data: stakedBalance } = useBalanceStaked({
734
+ * chainId: "cosmoshub-4",
735
+ * bech32Address: account?.bech32Address || "",
736
+ * enabled: Boolean(account?.bech32Address),
737
+ * });
738
+ * // Type: { data?: Coin }
660
739
  * ```
661
740
  */
662
- declare const useBalanceStaked: <TMulti extends MultiChainHookArgs>(args?: {
663
- bech32Address?: string;
664
- } & TMulti) => UseMultiChainQueryResult<TMulti, Coin>;
741
+ declare const useBalanceStaked: (args: {
742
+ bech32Address: string;
743
+ chainId: string;
744
+ } & QueryConfig) => UseQueryResult<Coin, unknown>;
665
745
 
666
746
  /**
667
747
  * graz hook to retrieve connected account's active chainIds
@@ -695,23 +775,28 @@ declare const useActiveChains: () => ChainInfo[] | undefined;
695
775
  * const chainInfo = useChainInfo({chainId: "cosmoshub-4"});
696
776
  * ```
697
777
  */
698
- declare const useChainInfo: ({ chainId }: {
778
+ declare const useChainInfo: ({ chainId }?: {
699
779
  chainId?: string;
700
780
  }) => ChainInfo | undefined;
701
781
  /**
702
782
  * graz hook to retrieve ChainInfo objects from GrazProvider with given chainId
703
783
  *
704
- * @param chainId - chainId to search
784
+ * @param chainId - chainId array to filter. If not provided, returns all chains
705
785
  *
706
786
  * @example
707
787
  * ```ts
708
788
  * import { useChainInfos } from "graz";
789
+ *
790
+ * // Get specific chains
709
791
  * const chainInfos = useChainInfos({chainId: ["cosmoshub-4", "juno-1"]});
792
+ *
793
+ * // Get all chains
794
+ * const allChains = useChainInfos();
710
795
  * ```
711
796
  */
712
- declare const useChainInfos: ({ chainId }: {
797
+ declare const useChainInfos: ({ chainId }?: {
713
798
  chainId?: string[];
714
- }) => ChainInfo[] | undefined;
799
+ }) => ChainInfo[] | null | undefined;
715
800
  /**
716
801
  * graz hook to retrieve specific connected chains currency
717
802
  *
@@ -782,6 +867,64 @@ declare const useRecentChains: () => {
782
867
  data: ChainInfo[] | undefined;
783
868
  clear: () => void;
784
869
  };
870
+ type UseAddChainArgs = MutationEventArgs<ChainInfo>;
871
+ /**
872
+ * graz mutation hook to add chain to the internal store
873
+ * without suggesting it to the wallet
874
+ *
875
+ * @example
876
+ * ```ts
877
+ * import { useAddChain } from "graz";
878
+ * const { addChain, isLoading, isSuccess, ... } = useAddChain();
879
+ *
880
+ * addChain({
881
+ * chainInfo: {
882
+ * rpc: "https://rpc.cosmoshub.strange.love",
883
+ * rest: "https://api.cosmoshub.strange.love",
884
+ * chainId: "cosmoshub-4",
885
+ * chainName: "Cosmos Hub",
886
+ * stakeCurrency: {
887
+ * coinDenom: "ATOM",
888
+ * coinMinimalDenom: "uatom",
889
+ * coinDecimals: 6,
890
+ * },
891
+ * bip44: {
892
+ * coinType: 118,
893
+ * },
894
+ * bech32Config: {
895
+ * bech32PrefixAccAddr: "cosmos",
896
+ * bech32PrefixAccPub: "cosmospub",
897
+ * bech32PrefixValAddr: "cosmosvaloper",
898
+ * bech32PrefixValPub: "cosmosvaloperpub",
899
+ * bech32PrefixConsAddr: "cosmosvalcons",
900
+ * bech32PrefixConsPub: "cosmosvalconspub",
901
+ * },
902
+ * currencies: [
903
+ * {
904
+ * coinDenom: "ATOM",
905
+ * coinMinimalDenom: "uatom",
906
+ * coinDecimals: 6,
907
+ * },
908
+ * ],
909
+ * feeCurrencies: [
910
+ * {
911
+ * coinDenom: "ATOM",
912
+ * coinMinimalDenom: "uatom",
913
+ * coinDecimals: 6,
914
+ * },
915
+ * ],
916
+ * }
917
+ * });
918
+ * ```
919
+ */
920
+ declare const useAddChain: ({ onError, onLoading, onSuccess }?: UseAddChainArgs) => {
921
+ addChain: _tanstack_react_query.UseMutateFunction<ChainInfo, Error, AddChainArgs, unknown>;
922
+ addChainAsync: _tanstack_react_query.UseMutateAsyncFunction<ChainInfo, Error, AddChainArgs, unknown>;
923
+ error: Error | null;
924
+ isLoading: boolean;
925
+ isSuccess: boolean;
926
+ status: "error" | "success" | "pending" | "idle";
927
+ };
785
928
  type UseSuggestChainArgs = MutationEventArgs<ChainInfo>;
786
929
  /**
787
930
  * graz mutation hook to suggest chain to a Wallet
@@ -851,96 +994,255 @@ declare const useSuggestChainAndConnect: ({ onError, onLoading, onSuccess }?: Us
851
994
  /**
852
995
  * graz query hook to retrieve a StargateClient.
853
996
  *
997
+ * Note: Returns multi-chain results by default (Record<chainId, StargateClient>).
998
+ *
854
999
  * @example
855
1000
  * ```ts
856
1001
  * import { useStargateClient } from "graz";
857
1002
  *
858
- * // single chain
859
- * const { data:client, isFetching, refetch, ... } = useStargateClient();
860
- * await client.getAccount("address")
1003
+ * // Single chain with precise type inference
1004
+ * const { data: clients } = useStargateClient({ chainId: ["cosmoshub-4"] });
1005
+ * // Type: { data?: { "cosmoshub-4": StargateClient } }
1006
+ * const client = clients?.["cosmoshub-4"];
1007
+ * await client?.getAccount("address");
861
1008
  *
862
- * // multi chain
863
- * const { data:clients, isFetching, refetch, ... } = useStargateClient({multiChain: true, chainId: ["cosmoshub-4", "sommelier-3"]});
864
- * await clients["cosmoshub-4"].getAccount("address")
1009
+ * // Multiple chains with precise type inference
1010
+ * const { data: clients } = useStargateClient({
1011
+ * chainId: ["cosmoshub-4", "osmosis-1"]
1012
+ * });
1013
+ * // Type: { data?: { "cosmoshub-4": StargateClient, "osmosis-1": StargateClient } }
1014
+ * await clients?.["cosmoshub-4"]?.getAccount("address"); // ✅ Autocomplete!
865
1015
  *
1016
+ * // All connected chains
1017
+ * const { data: clients } = useStargateClient();
1018
+ * // Type: { data?: Record<string, StargateClient> }
866
1019
  * ```
867
1020
  */
868
- declare const useStargateClient: <TMulti extends MultiChainHookArgs>(args?: TMulti & QueryConfig) => UseMultiChainQueryResult<TMulti, StargateClient>;
1021
+ declare function useStargateClient<const TChainIds extends readonly string[]>(args: {
1022
+ chainId: TChainIds;
1023
+ } & QueryConfig): UseMultiChainQueryResult<TChainIds, StargateClient>;
1024
+ declare function useStargateClient(args?: QueryConfig): UseMultiChainQueryResult<undefined, StargateClient>;
869
1025
  /**
870
1026
  * graz query hook to retrieve a CosmWasmClient.
871
1027
  *
1028
+ * Note: Returns multi-chain results by default (Record<chainId, CosmWasmClient>).
1029
+ *
872
1030
  * @example
873
1031
  * ```ts
874
1032
  * import { useCosmWasmClient } from "graz";
875
1033
  *
876
- * //single chain
877
- * const { data:client, isFetching, refetch, ... } = useCosmWasmClient();
878
- * await client.getAccount("address")
1034
+ * // Single chain with precise type inference
1035
+ * const { data: clients } = useCosmWasmClient({ chainId: ["cosmoshub-4"] });
1036
+ * // Type: { data?: { "cosmoshub-4": CosmWasmClient } }
1037
+ * const client = clients?.["cosmoshub-4"];
1038
+ * await client?.getAccount("address");
879
1039
  *
880
- * // multi chain
881
- * const { data:clients, isFetching, refetch, ... } = useCosmWasmClient({multiChain: true, chainId: ["cosmoshub-4", "sommelier-3"]});
882
- * await clients["cosmoshub-4"].getAccount("address")
1040
+ * // Multiple chains with precise type inference
1041
+ * const { data: clients } = useCosmWasmClient({
1042
+ * chainId: ["cosmoshub-4", "osmosis-1"]
1043
+ * });
1044
+ * // Type: { data?: { "cosmoshub-4": CosmWasmClient, "osmosis-1": CosmWasmClient } }
1045
+ * await clients?.["cosmoshub-4"]?.getAccount("address"); // ✅ Autocomplete!
883
1046
  *
1047
+ * // All connected chains
1048
+ * const { data: clients } = useCosmWasmClient();
1049
+ * // Type: { data?: Record<string, CosmWasmClient> }
884
1050
  * ```
885
1051
  */
886
- declare const useCosmWasmClient: <TMulti extends MultiChainHookArgs>(args?: TMulti & QueryConfig) => UseMultiChainQueryResult<TMulti, CosmWasmClient>;
1052
+ declare function useCosmWasmClient<const TChainIds extends readonly string[]>(args: {
1053
+ chainId: TChainIds;
1054
+ } & QueryConfig): UseMultiChainQueryResult<TChainIds, CosmWasmClient>;
1055
+ declare function useCosmWasmClient(args?: QueryConfig): UseMultiChainQueryResult<undefined, CosmWasmClient>;
887
1056
 
888
1057
  /**
889
- * graz mutation hook to send tokens. Note: if `senderAddress` undefined, it will use current connected account address.
1058
+ * graz mutation hook to send tokens.
890
1059
  *
891
1060
  * @example
892
1061
  * ```ts
893
- * import { useSendTokens, useStargateSigningClient } from "graz";
1062
+ * import { useSendTokens, useStargateSigningClient, useAccount } from "graz";
1063
+ *
1064
+ * // Get the account and signing client
1065
+ * const { data: accounts } = useAccount({ chainId: ["cosmoshub-4"] });
1066
+ * const { data: signingClients } = useStargateSigningClient({ chainId: ["cosmoshub-4"] });
1067
+ *
1068
+ * const account = accounts?.["cosmoshub-4"];
1069
+ * const signingClient = signingClients?.["cosmoshub-4"];
894
1070
  *
895
- * // basic example
896
- * const { data: signingClient } = useStargateSigningClient()
897
1071
  * const { sendTokens } = useSendTokens();
898
1072
  *
899
1073
  * sendTokens({
900
1074
  * signingClient,
901
- * recipientAddress: "cosmos1g3jjhgkyf36pjhe7u5cw8j9u6cgl8x929ej430";
902
- * amount: [coin];
903
- * ...
1075
+ * senderAddress: account.bech32Address,
1076
+ * recipientAddress: "cosmos1g3jjhgkyf36pjhe7u5cw8j9u6cgl8x929ej430",
1077
+ * amount: [coin],
1078
+ * fee: "auto"
904
1079
  * })
905
1080
  * ```
906
1081
  *
907
1082
  * @see {@link sendTokens}
908
1083
  */
909
1084
  declare const useSendTokens: ({ onError, onLoading, onSuccess, }?: MutationEventArgs<SendTokensArgs, DeliverTxResponse>) => {
910
- error: Error | null;
911
- isLoading: boolean;
912
- isSuccess: boolean;
913
1085
  sendTokens: _tanstack_react_query.UseMutateFunction<DeliverTxResponse, Error, SendTokensArgs, unknown>;
914
1086
  sendTokensAsync: _tanstack_react_query.UseMutateAsyncFunction<DeliverTxResponse, Error, SendTokensArgs, unknown>;
915
- status: "error" | "success" | "pending" | "idle";
1087
+ data: undefined;
1088
+ variables: undefined;
1089
+ error: null;
1090
+ isError: false;
1091
+ isIdle: true;
1092
+ isPending: false;
1093
+ isSuccess: false;
1094
+ status: "idle";
1095
+ reset: () => void;
1096
+ context: unknown;
1097
+ failureCount: number;
1098
+ failureReason: Error | null;
1099
+ isPaused: boolean;
1100
+ submittedAt: number;
1101
+ } | {
1102
+ sendTokens: _tanstack_react_query.UseMutateFunction<DeliverTxResponse, Error, SendTokensArgs, unknown>;
1103
+ sendTokensAsync: _tanstack_react_query.UseMutateAsyncFunction<DeliverTxResponse, Error, SendTokensArgs, unknown>;
1104
+ data: undefined;
1105
+ variables: SendTokensArgs;
1106
+ error: null;
1107
+ isError: false;
1108
+ isIdle: false;
1109
+ isPending: true;
1110
+ isSuccess: false;
1111
+ status: "pending";
1112
+ reset: () => void;
1113
+ context: unknown;
1114
+ failureCount: number;
1115
+ failureReason: Error | null;
1116
+ isPaused: boolean;
1117
+ submittedAt: number;
1118
+ } | {
1119
+ sendTokens: _tanstack_react_query.UseMutateFunction<DeliverTxResponse, Error, SendTokensArgs, unknown>;
1120
+ sendTokensAsync: _tanstack_react_query.UseMutateAsyncFunction<DeliverTxResponse, Error, SendTokensArgs, unknown>;
1121
+ data: undefined;
1122
+ error: Error;
1123
+ variables: SendTokensArgs;
1124
+ isError: true;
1125
+ isIdle: false;
1126
+ isPending: false;
1127
+ isSuccess: false;
1128
+ status: "error";
1129
+ reset: () => void;
1130
+ context: unknown;
1131
+ failureCount: number;
1132
+ failureReason: Error | null;
1133
+ isPaused: boolean;
1134
+ submittedAt: number;
1135
+ } | {
1136
+ sendTokens: _tanstack_react_query.UseMutateFunction<DeliverTxResponse, Error, SendTokensArgs, unknown>;
1137
+ sendTokensAsync: _tanstack_react_query.UseMutateAsyncFunction<DeliverTxResponse, Error, SendTokensArgs, unknown>;
1138
+ data: DeliverTxResponse;
1139
+ error: null;
1140
+ variables: SendTokensArgs;
1141
+ isError: false;
1142
+ isIdle: false;
1143
+ isPending: false;
1144
+ isSuccess: true;
1145
+ status: "success";
1146
+ reset: () => void;
1147
+ context: unknown;
1148
+ failureCount: number;
1149
+ failureReason: Error | null;
1150
+ isPaused: boolean;
1151
+ submittedAt: number;
916
1152
  };
917
1153
  /**
918
- * graz mutation hook to send IBC tokens. Note: if `senderAddress` undefined, it will use current connected account address.
919
- *
1154
+ * graz mutation hook to send IBC tokens.
920
1155
  *
921
1156
  * @example
922
1157
  * ```ts
923
- * import { useSendIbcTokens, useStargateSigningClient } from "graz";
1158
+ * import { useSendIbcTokens, useStargateSigningClient, useAccount } from "graz";
1159
+ *
1160
+ * // Get the account and signing client
1161
+ * const { data: accounts } = useAccount({ chainId: ["cosmoshub-4"] });
1162
+ * const { data: signingClients } = useStargateSigningClient({ chainId: ["cosmoshub-4"] });
1163
+ *
1164
+ * const account = accounts?.["cosmoshub-4"];
1165
+ * const signingClient = signingClients?.["cosmoshub-4"];
924
1166
  *
925
- * // basic example
926
- * const { data: signingClient } = useStargateSigningClient()
927
1167
  * const { sendIbcTokens } = useSendIbcTokens();
928
1168
  *
929
1169
  * sendIbcTokens({
930
1170
  * signingClient,
1171
+ * senderAddress: account.bech32Address,
931
1172
  * recipientAddress: "cosmos1g3jjhgkyf36pjhe7u5cw8j9u6cgl8x929ej430",
932
1173
  * transferAmount: coin,
933
- * ...
1174
+ * fee: "auto"
934
1175
  * })
935
1176
  * ```
936
1177
  */
937
1178
  declare const useSendIbcTokens: ({ onError, onLoading, onSuccess, }?: MutationEventArgs<SendIbcTokensArgs, DeliverTxResponse>) => {
938
- error: Error | null;
939
- isLoading: boolean;
940
- isSuccess: boolean;
941
1179
  sendIbcTokens: _tanstack_react_query.UseMutateFunction<DeliverTxResponse, Error, SendIbcTokensArgs, unknown>;
942
1180
  sendIbcTokensAsync: _tanstack_react_query.UseMutateAsyncFunction<DeliverTxResponse, Error, SendIbcTokensArgs, unknown>;
943
- status: "error" | "success" | "pending" | "idle";
1181
+ data: undefined;
1182
+ variables: undefined;
1183
+ error: null;
1184
+ isError: false;
1185
+ isIdle: true;
1186
+ isPending: false;
1187
+ isSuccess: false;
1188
+ status: "idle";
1189
+ reset: () => void;
1190
+ context: unknown;
1191
+ failureCount: number;
1192
+ failureReason: Error | null;
1193
+ isPaused: boolean;
1194
+ submittedAt: number;
1195
+ } | {
1196
+ sendIbcTokens: _tanstack_react_query.UseMutateFunction<DeliverTxResponse, Error, SendIbcTokensArgs, unknown>;
1197
+ sendIbcTokensAsync: _tanstack_react_query.UseMutateAsyncFunction<DeliverTxResponse, Error, SendIbcTokensArgs, unknown>;
1198
+ data: undefined;
1199
+ variables: SendIbcTokensArgs;
1200
+ error: null;
1201
+ isError: false;
1202
+ isIdle: false;
1203
+ isPending: true;
1204
+ isSuccess: false;
1205
+ status: "pending";
1206
+ reset: () => void;
1207
+ context: unknown;
1208
+ failureCount: number;
1209
+ failureReason: Error | null;
1210
+ isPaused: boolean;
1211
+ submittedAt: number;
1212
+ } | {
1213
+ sendIbcTokens: _tanstack_react_query.UseMutateFunction<DeliverTxResponse, Error, SendIbcTokensArgs, unknown>;
1214
+ sendIbcTokensAsync: _tanstack_react_query.UseMutateAsyncFunction<DeliverTxResponse, Error, SendIbcTokensArgs, unknown>;
1215
+ data: undefined;
1216
+ error: Error;
1217
+ variables: SendIbcTokensArgs;
1218
+ isError: true;
1219
+ isIdle: false;
1220
+ isPending: false;
1221
+ isSuccess: false;
1222
+ status: "error";
1223
+ reset: () => void;
1224
+ context: unknown;
1225
+ failureCount: number;
1226
+ failureReason: Error | null;
1227
+ isPaused: boolean;
1228
+ submittedAt: number;
1229
+ } | {
1230
+ sendIbcTokens: _tanstack_react_query.UseMutateFunction<DeliverTxResponse, Error, SendIbcTokensArgs, unknown>;
1231
+ sendIbcTokensAsync: _tanstack_react_query.UseMutateAsyncFunction<DeliverTxResponse, Error, SendIbcTokensArgs, unknown>;
1232
+ data: DeliverTxResponse;
1233
+ error: null;
1234
+ variables: SendIbcTokensArgs;
1235
+ isError: false;
1236
+ isIdle: false;
1237
+ isPending: false;
1238
+ isSuccess: true;
1239
+ status: "success";
1240
+ reset: () => void;
1241
+ context: unknown;
1242
+ failureCount: number;
1243
+ failureReason: Error | null;
1244
+ isPaused: boolean;
1245
+ submittedAt: number;
944
1246
  };
945
1247
  type UseInstantiateContractArgs<Message extends Record<string, unknown>> = {
946
1248
  codeId: number;
@@ -950,9 +1252,15 @@ type UseInstantiateContractArgs<Message extends Record<string, unknown>> = {
950
1252
  *
951
1253
  * @example
952
1254
  * ```ts
953
- * import { useInstantiateContract, useCosmwasmSigningClient } from "graz"
1255
+ * import { useInstantiateContract, useCosmWasmSigningClient, useAccount } from "graz"
1256
+ *
1257
+ * // Get the account and signing client
1258
+ * const { data: accounts } = useAccount({ chainId: ["juno-1"] });
1259
+ * const { data: signingClients } = useCosmWasmSigningClient({ chainId: ["juno-1"] });
1260
+ *
1261
+ * const account = accounts?.["juno-1"];
1262
+ * const signingClient = signingClients?.["juno-1"];
954
1263
  *
955
- * const { data: signingClient } = useCosmwasmSigningClient()
956
1264
  * const { instantiateContract: instantiateMyContract } = useInstantiateContract({
957
1265
  * codeId: 4,
958
1266
  * onSuccess: ({ contractAddress }) => console.log('Address:', contractAddress)
@@ -961,18 +1269,81 @@ type UseInstantiateContractArgs<Message extends Record<string, unknown>> = {
961
1269
  * const instantiateMessage = { foo: 'bar' };
962
1270
  * instantiateMyContract({
963
1271
  * signingClient,
964
- * msg: instatiateMessage,
965
- * label: "test"
1272
+ * senderAddress: account.bech32Address,
1273
+ * msg: instantiateMessage,
1274
+ * label: "test",
1275
+ * fee: "auto"
966
1276
  * });
967
1277
  * ```
968
1278
  */
969
1279
  declare const useInstantiateContract: <Message extends Record<string, unknown>>({ codeId, onError, onLoading, onSuccess, }: UseInstantiateContractArgs<Message>) => {
970
- error: Error | null;
971
- isLoading: boolean;
972
- isSuccess: boolean;
973
1280
  instantiateContract: _tanstack_react_query.UseMutateFunction<InstantiateResult, Error, InstantiateContractMutationArgs<Message>, unknown>;
974
1281
  instantiateContractAsync: _tanstack_react_query.UseMutateAsyncFunction<InstantiateResult, Error, InstantiateContractMutationArgs<Message>, unknown>;
975
- status: "error" | "success" | "pending" | "idle";
1282
+ data: undefined;
1283
+ variables: undefined;
1284
+ error: null;
1285
+ isError: false;
1286
+ isIdle: true;
1287
+ isPending: false;
1288
+ isSuccess: false;
1289
+ status: "idle";
1290
+ reset: () => void;
1291
+ context: unknown;
1292
+ failureCount: number;
1293
+ failureReason: Error | null;
1294
+ isPaused: boolean;
1295
+ submittedAt: number;
1296
+ } | {
1297
+ instantiateContract: _tanstack_react_query.UseMutateFunction<InstantiateResult, Error, InstantiateContractMutationArgs<Message>, unknown>;
1298
+ instantiateContractAsync: _tanstack_react_query.UseMutateAsyncFunction<InstantiateResult, Error, InstantiateContractMutationArgs<Message>, unknown>;
1299
+ data: undefined;
1300
+ variables: InstantiateContractMutationArgs<Message>;
1301
+ error: null;
1302
+ isError: false;
1303
+ isIdle: false;
1304
+ isPending: true;
1305
+ isSuccess: false;
1306
+ status: "pending";
1307
+ reset: () => void;
1308
+ context: unknown;
1309
+ failureCount: number;
1310
+ failureReason: Error | null;
1311
+ isPaused: boolean;
1312
+ submittedAt: number;
1313
+ } | {
1314
+ instantiateContract: _tanstack_react_query.UseMutateFunction<InstantiateResult, Error, InstantiateContractMutationArgs<Message>, unknown>;
1315
+ instantiateContractAsync: _tanstack_react_query.UseMutateAsyncFunction<InstantiateResult, Error, InstantiateContractMutationArgs<Message>, unknown>;
1316
+ data: undefined;
1317
+ error: Error;
1318
+ variables: InstantiateContractMutationArgs<Message>;
1319
+ isError: true;
1320
+ isIdle: false;
1321
+ isPending: false;
1322
+ isSuccess: false;
1323
+ status: "error";
1324
+ reset: () => void;
1325
+ context: unknown;
1326
+ failureCount: number;
1327
+ failureReason: Error | null;
1328
+ isPaused: boolean;
1329
+ submittedAt: number;
1330
+ } | {
1331
+ instantiateContract: _tanstack_react_query.UseMutateFunction<InstantiateResult, Error, InstantiateContractMutationArgs<Message>, unknown>;
1332
+ instantiateContractAsync: _tanstack_react_query.UseMutateAsyncFunction<InstantiateResult, Error, InstantiateContractMutationArgs<Message>, unknown>;
1333
+ data: InstantiateResult;
1334
+ error: null;
1335
+ variables: InstantiateContractMutationArgs<Message>;
1336
+ isError: false;
1337
+ isIdle: false;
1338
+ isPending: false;
1339
+ isSuccess: true;
1340
+ status: "success";
1341
+ reset: () => void;
1342
+ context: unknown;
1343
+ failureCount: number;
1344
+ failureReason: Error | null;
1345
+ isPaused: boolean;
1346
+ submittedAt: number;
976
1347
  };
977
1348
  type UseExecuteContractArgs<Message extends Record<string, unknown>> = {
978
1349
  contractAddress: string;
@@ -983,37 +1354,103 @@ type UseExecuteContractArgs<Message extends Record<string, unknown>> = {
983
1354
  *
984
1355
  * @example
985
1356
  * ```ts
986
- * import { useExecuteContract, useCosmWasmSigningClient } from "graz"
1357
+ * import { useExecuteContract, useCosmWasmSigningClient, useAccount } from "graz"
987
1358
  *
988
- * interface GreetMessage {
989
- * name: string;
1359
+ * interface ExecuteMessage {
1360
+ * foo: string;
990
1361
  * }
991
1362
  *
992
- * interface GreetResponse {
993
- * message: string;
994
- * }
1363
+ * const contractAddress = "juno1...";
1364
+ *
1365
+ * // Get the account and signing client
1366
+ * const { data: accounts } = useAccount({ chainId: ["juno-1"] });
1367
+ * const { data: signingClients } = useCosmWasmSigningClient({ chainId: ["juno-1"] });
995
1368
  *
996
- * const contractAddress = "cosmosfoobarbaz";
1369
+ * const account = accounts?.["juno-1"];
1370
+ * const signingClient = signingClients?.["juno-1"];
997
1371
  *
998
- * const { data: signingClient } = useCosmWasmSigningClient()
999
- * const { executeContract } = useExecuteContract<ExecuteMessage>({ contractAddress });
1372
+ * const { executeContract } = useExecuteContract<ExecuteMessage>({
1373
+ * contractAddress,
1374
+ * onSuccess: (result) => console.log('Tx hash:', result.transactionHash)
1375
+ * });
1000
1376
  *
1001
1377
  * executeContract({
1002
1378
  * signingClient,
1003
- * msg: {
1004
- * foo: "bar"
1005
- * }}, {
1006
- * onSuccess: (data: GreetResponse) => console.log('Got message:', data.message);
1007
- * });
1379
+ * senderAddress: account.bech32Address,
1380
+ * msg: { foo: "bar" },
1381
+ * fee: "auto",
1382
+ * funds: []
1383
+ * });
1008
1384
  * ```
1009
1385
  */
1010
1386
  declare const useExecuteContract: <Message extends Record<string, unknown>>({ contractAddress, onError, onLoading, onSuccess, }: UseExecuteContractArgs<Message>) => {
1011
- error: Error | null;
1012
- isLoading: boolean;
1013
- isSuccess: boolean;
1014
1387
  executeContract: _tanstack_react_query.UseMutateFunction<ExecuteResult, Error, ExecuteContractMutationArgs<Message>, unknown>;
1015
1388
  executeContractAsync: _tanstack_react_query.UseMutateAsyncFunction<ExecuteResult, Error, ExecuteContractMutationArgs<Message>, unknown>;
1016
- status: "error" | "success" | "pending" | "idle";
1389
+ data: undefined;
1390
+ variables: undefined;
1391
+ error: null;
1392
+ isError: false;
1393
+ isIdle: true;
1394
+ isPending: false;
1395
+ isSuccess: false;
1396
+ status: "idle";
1397
+ reset: () => void;
1398
+ context: unknown;
1399
+ failureCount: number;
1400
+ failureReason: Error | null;
1401
+ isPaused: boolean;
1402
+ submittedAt: number;
1403
+ } | {
1404
+ executeContract: _tanstack_react_query.UseMutateFunction<ExecuteResult, Error, ExecuteContractMutationArgs<Message>, unknown>;
1405
+ executeContractAsync: _tanstack_react_query.UseMutateAsyncFunction<ExecuteResult, Error, ExecuteContractMutationArgs<Message>, unknown>;
1406
+ data: undefined;
1407
+ variables: ExecuteContractMutationArgs<Message>;
1408
+ error: null;
1409
+ isError: false;
1410
+ isIdle: false;
1411
+ isPending: true;
1412
+ isSuccess: false;
1413
+ status: "pending";
1414
+ reset: () => void;
1415
+ context: unknown;
1416
+ failureCount: number;
1417
+ failureReason: Error | null;
1418
+ isPaused: boolean;
1419
+ submittedAt: number;
1420
+ } | {
1421
+ executeContract: _tanstack_react_query.UseMutateFunction<ExecuteResult, Error, ExecuteContractMutationArgs<Message>, unknown>;
1422
+ executeContractAsync: _tanstack_react_query.UseMutateAsyncFunction<ExecuteResult, Error, ExecuteContractMutationArgs<Message>, unknown>;
1423
+ data: undefined;
1424
+ error: Error;
1425
+ variables: ExecuteContractMutationArgs<Message>;
1426
+ isError: true;
1427
+ isIdle: false;
1428
+ isPending: false;
1429
+ isSuccess: false;
1430
+ status: "error";
1431
+ reset: () => void;
1432
+ context: unknown;
1433
+ failureCount: number;
1434
+ failureReason: Error | null;
1435
+ isPaused: boolean;
1436
+ submittedAt: number;
1437
+ } | {
1438
+ executeContract: _tanstack_react_query.UseMutateFunction<ExecuteResult, Error, ExecuteContractMutationArgs<Message>, unknown>;
1439
+ executeContractAsync: _tanstack_react_query.UseMutateAsyncFunction<ExecuteResult, Error, ExecuteContractMutationArgs<Message>, unknown>;
1440
+ data: ExecuteResult;
1441
+ error: null;
1442
+ variables: ExecuteContractMutationArgs<Message>;
1443
+ isError: false;
1444
+ isIdle: false;
1445
+ isPending: false;
1446
+ isSuccess: true;
1447
+ status: "success";
1448
+ reset: () => void;
1449
+ context: unknown;
1450
+ failureCount: number;
1451
+ failureReason: Error | null;
1452
+ isPaused: boolean;
1453
+ submittedAt: number;
1017
1454
  };
1018
1455
  /**
1019
1456
  * graz query hook for dispatching a "smart" query to a CosmWasm smart
@@ -1039,22 +1476,85 @@ declare const useQueryRaw: <TError>(args?: {
1039
1476
  key?: string;
1040
1477
  }) => UseQueryResult<Uint8Array | null, TError>;
1041
1478
 
1042
- interface SiginingClientSinglechainArgs<T> {
1043
- multiChain?: false;
1044
- opts?: T;
1045
- }
1046
- interface SiginingClientMultichainArgs<T> {
1047
- multiChain?: true;
1048
- opts?: Record<string, T>;
1049
- }
1479
+ /**
1480
+ * Base signing client args - now always uses per-chain opts
1481
+ */
1050
1482
  interface BaseSigningClientArgs extends QueryConfig {
1051
- chainId?: ChainId$1;
1052
1483
  offlineSigner?: "offlineSigner" | "offlineSignerAuto" | "offlineSignerOnlyAmino";
1484
+ opts?: Record<string, SigningStargateClientOptions | SigningCosmWasmClientOptions>;
1053
1485
  }
1054
- declare function useStargateSigningClient(args?: BaseSigningClientArgs & SiginingClientSinglechainArgs<SigningStargateClientOptions>): UseQueryResult<SigningStargateClient | null>;
1055
- declare function useStargateSigningClient(args?: BaseSigningClientArgs & SiginingClientMultichainArgs<SigningStargateClientOptions>): UseQueryResult<Record<string, SigningStargateClient | null>>;
1056
- declare function useCosmWasmSigningClient(args?: BaseSigningClientArgs & SiginingClientSinglechainArgs<SigningCosmWasmClientOptions>): UseQueryResult<SigningCosmWasmClient | null>;
1057
- declare function useCosmWasmSigningClient(args?: BaseSigningClientArgs & SiginingClientMultichainArgs<SigningCosmWasmClientOptions>): UseQueryResult<Record<string, SigningCosmWasmClient | null>>;
1486
+ /**
1487
+ * graz query hook to retrieve a SigningStargateClient.
1488
+ *
1489
+ * Note: Returns multi-chain results by default (Record<chainId, SigningStargateClient | null>).
1490
+ * Options are now always per-chain using `opts` Record.
1491
+ *
1492
+ * @example
1493
+ * ```ts
1494
+ * import { useStargateSigningClient } from "graz";
1495
+ *
1496
+ * // Single chain with precise type inference
1497
+ * const { data: clients } = useStargateSigningClient({ chainId: ["cosmoshub-4"] });
1498
+ * // Type: { data?: { "cosmoshub-4": SigningStargateClient | null } }
1499
+ * const client = clients?.["cosmoshub-4"];
1500
+ * await client?.getAccount("address");
1501
+ *
1502
+ * // Multiple chains with per-chain options
1503
+ * const { data: clients } = useStargateSigningClient({
1504
+ * chainId: ["cosmoshub-4", "osmosis-1"],
1505
+ * opts: {
1506
+ * "cosmoshub-4": { gasPrice: GasPrice.fromString("0.025uatom") },
1507
+ * "osmosis-1": { gasPrice: GasPrice.fromString("0.025uosmo") }
1508
+ * }
1509
+ * });
1510
+ * // Type: { data?: { "cosmoshub-4": SigningStargateClient | null, "osmosis-1": SigningStargateClient | null } }
1511
+ * await clients?.["cosmoshub-4"]?.getAccount("address"); // ✅ Autocomplete!
1512
+ *
1513
+ * // All connected chains
1514
+ * const { data: clients } = useStargateSigningClient();
1515
+ * // Type: { data?: Record<string, SigningStargateClient | null> }
1516
+ * ```
1517
+ */
1518
+ declare function useStargateSigningClient<const TChainIds extends readonly string[]>(args: {
1519
+ chainId: TChainIds;
1520
+ } & BaseSigningClientArgs): UseMultiChainQueryResult<TChainIds, SigningStargateClient | null>;
1521
+ declare function useStargateSigningClient(args?: BaseSigningClientArgs): UseMultiChainQueryResult<undefined, SigningStargateClient | null>;
1522
+ /**
1523
+ * graz query hook to retrieve a SigningCosmWasmClient.
1524
+ *
1525
+ * Note: Returns multi-chain results by default (Record<chainId, SigningCosmWasmClient | null>).
1526
+ * Options are now always per-chain using `opts` Record.
1527
+ *
1528
+ * @example
1529
+ * ```ts
1530
+ * import { useCosmWasmSigningClient } from "graz";
1531
+ *
1532
+ * // Single chain with precise type inference
1533
+ * const { data: clients } = useCosmWasmSigningClient({ chainId: ["cosmoshub-4"] });
1534
+ * // Type: { data?: { "cosmoshub-4": SigningCosmWasmClient | null } }
1535
+ * const client = clients?.["cosmoshub-4"];
1536
+ * await client?.getAccount("address");
1537
+ *
1538
+ * // Multiple chains with per-chain options
1539
+ * const { data: clients } = useCosmWasmSigningClient({
1540
+ * chainId: ["cosmoshub-4", "osmosis-1"],
1541
+ * opts: {
1542
+ * "cosmoshub-4": { gasPrice: GasPrice.fromString("0.025uatom") },
1543
+ * "osmosis-1": { gasPrice: GasPrice.fromString("0.025uosmo") }
1544
+ * }
1545
+ * });
1546
+ * // Type: { data?: { "cosmoshub-4": SigningCosmWasmClient | null, "osmosis-1": SigningCosmWasmClient | null } }
1547
+ * await clients?.["cosmoshub-4"]?.getAccount("address"); // ✅ Autocomplete!
1548
+ *
1549
+ * // All connected chains
1550
+ * const { data: clients } = useCosmWasmSigningClient();
1551
+ * // Type: { data?: Record<string, SigningCosmWasmClient | null> }
1552
+ * ```
1553
+ */
1554
+ declare function useCosmWasmSigningClient<const TChainIds extends readonly string[]>(args: {
1555
+ chainId: TChainIds;
1556
+ } & BaseSigningClientArgs): UseMultiChainQueryResult<TChainIds, SigningCosmWasmClient | null>;
1557
+ declare function useCosmWasmSigningClient(args?: BaseSigningClientArgs): UseMultiChainQueryResult<undefined, SigningCosmWasmClient | null>;
1058
1558
 
1059
1559
  /**
1060
1560
  * graz hook to retrieve current active {@link WalletType}
@@ -1130,4 +1630,4 @@ declare const useGrazEvents: () => null;
1130
1630
  */
1131
1631
  declare const GrazEvents: FC;
1132
1632
 
1133
- export { type ConfigureGrazArgs, type ConnectArgs, type ConnectResult, type Dictionary, type ExecuteContractArgs, type ExecuteContractMutationArgs, GrazEvents, GrazProvider, type GrazProviderProps, type InstantiateContractArgs, type InstantiateContractMutationArgs, type Key, type KnownKeys, type Maybe, type OfflineSigners, type ReconnectArgs, type SendIbcTokensArgs, type SendTokensArgs, type SignAminoParams, type SignDirectParams, type SignDoc, type SuggestChainAndConnectArgs, type SuggestChainArgs, type UseAccountArgs, type UseAccountResult, type UseConnectChainArgs, type UseExecuteContractArgs, type UseInstantiateContractArgs, type UseSuggestChainAndConnectArgs, type UseSuggestChainArgs, WALLET_TYPES, type Wallet, WalletType, checkWallet, clearRecentChain, clearSession, configureGraz, connect, defineChainInfo, defineChains, disconnect, executeContract, getAvailableWallets, getChainInfo, getChainInfos, getCosmostation, getKeplr, getLeap, getMetamaskSnapLeap, getOfflineSigners, getOkx, getPara, getQueryRaw, getQuerySmart, getRecentChainIds, getRecentChains, getVectis, getWCCosmostation, getWCKeplr, getWCLeap, getWallet, getWalletConnect, instantiateContract, isLeapDappBrowser, isLeapSnaps, isPara, isWalletConnect, reconnect, sendIbcTokens, sendTokens, suggestChain, suggestChainAndConnect, useAccount, useActiveChainCurrency, useActiveChainIds, useActiveChains, useActiveWalletType, useBalance, useBalanceStaked, useBalances, useChainInfo, useChainInfos, useCheckWallet, useConnect, useCosmWasmClient, useCosmWasmSigningClient, useDisconnect, useExecuteContract, useGrazEvents, useInstantiateContract, useOfflineSigners, useQueryClientValidators, useQueryRaw, useQuerySmart, useRecentChainIds, useRecentChains, useSendIbcTokens, useSendTokens, useStargateClient, useStargateSigningClient, useSuggestChain, useSuggestChainAndConnect };
1633
+ export { type ActionChainId, type AddChainArgs, type CactusCosmosWallet, type ConfigureGrazArgs, type ConnectArgs, type ConnectResult, type Dictionary, type ExecuteContractArgs, type ExecuteContractMutationArgs, GrazEvents, GrazProvider, type GrazProviderProps, type InstantiateContractArgs, type InstantiateContractMutationArgs, type Key, type KnownKeys, type Maybe, type OfflineSigners, type ReconnectArgs, type SendIbcTokensArgs, type SendTokensArgs, type SignAminoParams, type SignDirectParams, type SignDoc, type SuggestChainAndConnectArgs, type SuggestChainArgs, type UseAccountArgs, type UseAccountResult, type UseAddChainArgs, type UseConnectChainArgs, type UseExecuteContractArgs, type UseInstantiateContractArgs, type UseSuggestChainAndConnectArgs, type UseSuggestChainArgs, WALLET_TYPES, type Wallet, WalletType, addChain, checkWallet, clearRecentChain, clearSession, configureGraz, connect, defineChainInfo, defineChains, disconnect, executeContract, getAvailableWallets, getCactusCosmos, getChainInfo, getChainInfos, getCosmostation, getKeplr, getLeap, getMetamaskSnapLeap, getOfflineSigners, getOkx, getPara, getQueryRaw, getQuerySmart, getRecentChainIds, getRecentChains, getVectis, getWCCosmostation, getWCKeplr, getWCLeap, getWallet, getWalletConnect, instantiateContract, isLeapDappBrowser, isLeapSnaps, isPara, isWalletConnect, reconnect, sendIbcTokens, sendTokens, suggestChain, suggestChainAndConnect, useAccount, useActiveChainCurrency, useActiveChainIds, useActiveChains, useActiveWalletType, useAddChain, useBalance, useBalanceStaked, useBalances, useChainInfo, useChainInfos, useCheckWallet, useConnect, useCosmWasmClient, useCosmWasmSigningClient, useDisconnect, useExecuteContract, useGrazEvents, useInstantiateContract, useOfflineSigners, useQueryClientValidators, useQueryRaw, useQuerySmart, useRecentChainIds, useRecentChains, useSendIbcTokens, useSendTokens, useStargateClient, useStargateSigningClient, useSuggestChain, useSuggestChainAndConnect };