graz 0.3.6 → 0.4.0-alpha.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.
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;
@@ -131,7 +135,6 @@ interface ChainConfig {
131
135
  }
132
136
  interface ParaGrazConfig extends ParaGrazConfig$1 {
133
137
  connectorClass?: new (config: ParaGrazConfig, chains?: ChainInfo[] | null) => ParaGrazConnector;
134
- connectorImportPath?: string;
135
138
  }
136
139
  interface WalletConnectStore {
137
140
  options: SignClientTypes.Options | null;
@@ -158,7 +161,8 @@ interface GrazInternalStore {
158
161
  chainsConfig: Record<string, ChainConfig> | null;
159
162
  iframeOptions: IframeOptions | null;
160
163
  /**
161
- * 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>).
162
166
  * Defaults to 3.
163
167
  */
164
168
  multiChainFetchConcurrency: number;
@@ -189,7 +193,8 @@ interface ConfigureGrazArgs {
189
193
  */
190
194
  autoReconnect?: boolean;
191
195
  /**
192
- * 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>).
193
198
  * Defaults to 3.
194
199
  */
195
200
  multiChainFetchConcurrency?: number;
@@ -232,7 +237,7 @@ interface InstantiateContractArgs<Message extends Record<string, unknown>> {
232
237
  senderAddress: string;
233
238
  codeId: number;
234
239
  }
235
- 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"> & {
236
241
  fee?: StdFee | "auto" | number;
237
242
  };
238
243
  declare const instantiateContract: <Message extends Record<string, unknown>>({ signingClient, senderAddress, msg, fee, options, label, codeId, }: InstantiateContractArgs<Message>) => Promise<_cosmjs_cosmwasm_stargate.InstantiateResult>;
@@ -245,7 +250,7 @@ interface ExecuteContractArgs<Message extends Record<string, unknown>> {
245
250
  funds: Coin[];
246
251
  memo: string;
247
252
  }
248
- 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"> & {
249
254
  fee?: StdFee | "auto" | number;
250
255
  funds?: Coin[];
251
256
  memo?: string;
@@ -284,6 +289,9 @@ declare const isLeapDappBrowser: () => boolean;
284
289
  declare const isWalletConnect: (type: WalletType) => boolean;
285
290
  declare const isPara: (type: WalletType) => type is WalletType.PARA;
286
291
 
292
+ type CactusCosmosWallet = Pick<Keplr, "enable" | "getOfflineSigner" | "signDirect" | "signAmino" | "signArbitrary" | "getKey">;
293
+ declare const getCactusCosmos: () => Wallet;
294
+
287
295
  /**
288
296
  * Function to return cosmostation object (which is {@link Wallet}) and throws and error if it does not exist on `window`.
289
297
  *
@@ -349,38 +357,38 @@ declare const getLeap: () => Wallet;
349
357
  declare const getMetamaskSnapLeap: () => Wallet;
350
358
 
351
359
  /**
352
- * 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`.
353
361
  *
354
362
  * @example
355
363
  * ```ts
356
364
  * try {
357
- * const vectis = getVectis();
365
+ * const okxWallet = getOkx();
358
366
  * } catch (error: Error) {
359
367
  * console.error(error.message);
360
368
  * }
361
369
  * ```
362
370
  *
363
- *
371
+ * @see https://www.okx.com/web3/build/docs/sdks/chains/cosmos/provider
364
372
  */
365
- declare const getVectis: () => Wallet;
373
+ declare const getOkx: () => Wallet;
374
+
375
+ declare const getPara: () => Wallet;
366
376
 
367
377
  /**
368
- * 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`.
369
379
  *
370
380
  * @example
371
381
  * ```ts
372
382
  * try {
373
- * const okxWallet = getOkx();
383
+ * const vectis = getVectis();
374
384
  * } catch (error: Error) {
375
385
  * console.error(error.message);
376
386
  * }
377
387
  * ```
378
388
  *
379
- * @see https://www.okx.com/web3/build/docs/sdks/chains/cosmos/provider
389
+ *
380
390
  */
381
- declare const getOkx: () => Wallet;
382
-
383
- declare const getPara: () => Wallet;
391
+ declare const getVectis: () => Wallet;
384
392
 
385
393
  interface GetWalletConnectParams {
386
394
  encoding: BufferEncoding;
@@ -452,20 +460,58 @@ interface MutationEventArgs<TInitial = unknown, TSuccess = TInitial> {
452
460
  onLoading?: (data: TInitial) => unknown;
453
461
  onSuccess?: (data: TSuccess) => unknown;
454
462
  }
455
- type ChainId = string;
456
- 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>>;
457
494
  interface QueryConfig {
458
495
  enabled?: boolean;
459
496
  }
460
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
+
461
504
  interface UseAccountArgs {
462
505
  onConnect?: (args: ConnectResult & {
463
506
  isReconnect: boolean;
464
507
  }) => void;
465
508
  onDisconnect?: () => void;
466
509
  }
467
- interface UseAccountResult<TMulti extends MultiChainHookArgs> {
468
- 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>;
469
515
  isConnected: boolean;
470
516
  isConnecting: boolean;
471
517
  isDisconnected: boolean;
@@ -479,68 +525,87 @@ interface UseAccountResult<TMulti extends MultiChainHookArgs> {
479
525
  * graz query hook to retrieve account data with optional arguments to invoke
480
526
  * given function on connect/disconnect.
481
527
  *
528
+ * Note: All hooks now return multi-chain results by default (Record<chainId, T>).
529
+ *
482
530
  * @example
483
531
  * ```tsx
484
532
  * import { useAccount } from "graz";
485
533
  *
486
- * // basic example
487
- * const { data:account, isConnecting, isConnected, ... } = useAccount();
488
- * account.bech32Address
489
- * // multichain example
490
- * const { data: accounts, isConnecting, isConnected, ... } = useAccount({ chainId: ["cosmoshub-4", "sommelier-3"], multiChain: true });
491
- * accounts['cosmoshub-4'].bech32Address
492
- * // 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
493
553
  * useAccount({
494
- * onConnect: ({ account, isReconnect }) => { ... },
554
+ * chainId: ["cosmoshub-4"],
555
+ * onConnect: ({ accounts, isReconnect }) => { ... },
495
556
  * onDisconnect: () => { ... },
496
557
  * });
497
558
  * ```
498
559
  */
499
- 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>;
500
564
  /**
501
- * 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.
502
566
  *
503
- * @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
504
569
  *
505
570
  * @example
506
571
  * ```ts
507
572
  * import { useBalances } from "graz";
508
573
  *
509
- * // basic example
510
- * const { data, isFetching, refetch, ... } = useBalances();
511
- *
512
- * // multichain example
513
- * const { data:balances, isFetching, refetch, ... } = useBalances({chainId: ["cosmoshub-4", "sommelier-3"] multiChain: true});
514
- * const cosmoshubBalances = balances["cosmoshub-4"]
515
- *
574
+ * const { data: balances } = useBalances({
575
+ * chainId: "cosmoshub-4",
576
+ * bech32Address: "cosmos1..."
577
+ * });
578
+ * // Type: { data?: Coin[] }
516
579
  * ```
517
580
  */
518
- declare const useBalances: <TMulti extends MultiChainHookArgs>(args?: {
519
- bech32Address?: string;
520
- } & TMulti & QueryConfig) => UseMultiChainQueryResult<TMulti, Coin[]>;
581
+ declare const useBalances: (args: {
582
+ bech32Address: string;
583
+ chainId: string;
584
+ } & QueryConfig) => UseQueryResult<Coin[], unknown>;
521
585
  /**
522
- * 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.
523
587
  *
588
+ * @param chainId - Chain ID to query balance from
589
+ * @param bech32Address - Required bech32 account address
524
590
  * @param denom - Asset denom to search
525
- * @param bech32Address - Optional bech32 account address, defaults to connected account address
526
591
  *
527
592
  * @example
528
593
  * ```ts
529
594
  * import { useBalance } from "graz";
530
595
  *
531
- * // basic example
532
- * const { data, isFetching, refetch, ... } = useBalance({denom: "atom"});
533
- *
534
- * // with custom bech32 address
535
- * useBalance("atom", "cosmos1kpzxx2lxg05xxn8mfygrerhmkj0ypn8edmu2pu");
596
+ * const { data: balance } = useBalance({
597
+ * chainId: "cosmoshub-4",
598
+ * bech32Address: "cosmos1...",
599
+ * denom: "uatom"
600
+ * });
601
+ * // Type: { data?: Coin | undefined }
536
602
  * ```
537
603
  */
538
- declare const useBalance: <TMulti extends MultiChainHookArgs>(args: {
539
- denom?: string;
540
- bech32Address?: string;
541
- } & {
542
- chainId: ChainId$1;
543
- } & 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>;
544
609
  type UseConnectChainArgs = MutationEventArgs<ConnectArgs, ConnectResult>;
545
610
  /**
546
611
  * graz mutation hook to execute wallet connection with optional arguments to
@@ -611,10 +676,10 @@ declare const useConnect: ({ onError, onLoading, onSuccess }?: UseConnectChainAr
611
676
  */
612
677
  declare const useDisconnect: ({ onError, onLoading, onSuccess }?: MutationEventArgs) => {
613
678
  disconnect: (args?: {
614
- chainId?: ChainId$1;
679
+ chainId?: ChainId;
615
680
  }) => void;
616
681
  disconnectAsync: (args?: {
617
- chainId?: ChainId$1;
682
+ chainId?: ChainId;
618
683
  }) => Promise<void>;
619
684
  error: Error | null;
620
685
  isLoading: boolean;
@@ -624,45 +689,59 @@ declare const useDisconnect: ({ onError, onLoading, onSuccess }?: MutationEventA
624
689
  /**
625
690
  * graz hook to retrieve offline signer objects (default, amino enabled, and auto).
626
691
  *
627
- * 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.
628
694
  *
629
695
  * @example
630
696
  * ```ts
631
- *
632
- * // basic example
633
697
  * import { useOfflineSigners } from "graz";
634
- * const { offlineSigner, offlineSignerAmino, offlineSignerAuto } = useOfflineSigners();
635
698
  *
636
- * // multichain example
637
- * const offlineSigners = useOfflineSigners({chainId: ["cosmoshub-4", "sommelier-3"] multiChain: true});
638
- * 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"] || {};
639
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> }
640
714
  * ```
641
715
  */
642
- 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>;
643
720
  /**
644
- * 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.
645
722
  *
646
- * @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
647
725
  *
648
726
  * @example
649
727
  * ```ts
650
- * import { useBalanceStaked } from "graz";
651
- *
652
- * // basic example
653
- * const { data, isFetching, refetch, ... } = useBalanceStaked();
728
+ * import { useBalanceStaked, useAccount } from "graz";
654
729
  *
655
- * // multichain example
656
- * const { data:balanceStaked, isFetching, refetch, ... } = useBalanceStaked({chainId: ["cosmoshub-4", "sommelier-3"] multiChain: true});
657
- * const cosmoshubBalanceStaked = balances["cosmoshub-4"]
730
+ * const { data: accounts } = useAccount();
731
+ * const account = accounts?.["cosmoshub-4"];
658
732
  *
659
- * // with custom bech32 address
660
- * 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 }
661
739
  * ```
662
740
  */
663
- declare const useBalanceStaked: <TMulti extends MultiChainHookArgs>(args?: {
664
- bech32Address?: string;
665
- } & TMulti) => UseMultiChainQueryResult<TMulti, Coin>;
741
+ declare const useBalanceStaked: (args: {
742
+ bech32Address: string;
743
+ chainId: string;
744
+ } & QueryConfig) => UseQueryResult<Coin, unknown>;
666
745
 
667
746
  /**
668
747
  * graz hook to retrieve connected account's active chainIds
@@ -696,23 +775,28 @@ declare const useActiveChains: () => ChainInfo[] | undefined;
696
775
  * const chainInfo = useChainInfo({chainId: "cosmoshub-4"});
697
776
  * ```
698
777
  */
699
- declare const useChainInfo: ({ chainId }: {
778
+ declare const useChainInfo: ({ chainId }?: {
700
779
  chainId?: string;
701
780
  }) => ChainInfo | undefined;
702
781
  /**
703
782
  * graz hook to retrieve ChainInfo objects from GrazProvider with given chainId
704
783
  *
705
- * @param chainId - chainId to search
784
+ * @param chainId - chainId array to filter. If not provided, returns all chains
706
785
  *
707
786
  * @example
708
787
  * ```ts
709
788
  * import { useChainInfos } from "graz";
789
+ *
790
+ * // Get specific chains
710
791
  * const chainInfos = useChainInfos({chainId: ["cosmoshub-4", "juno-1"]});
792
+ *
793
+ * // Get all chains
794
+ * const allChains = useChainInfos();
711
795
  * ```
712
796
  */
713
- declare const useChainInfos: ({ chainId }: {
797
+ declare const useChainInfos: ({ chainId }?: {
714
798
  chainId?: string[];
715
- }) => ChainInfo[] | undefined;
799
+ }) => ChainInfo[] | null | undefined;
716
800
  /**
717
801
  * graz hook to retrieve specific connected chains currency
718
802
  *
@@ -783,6 +867,64 @@ declare const useRecentChains: () => {
783
867
  data: ChainInfo[] | undefined;
784
868
  clear: () => void;
785
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
+ };
786
928
  type UseSuggestChainArgs = MutationEventArgs<ChainInfo>;
787
929
  /**
788
930
  * graz mutation hook to suggest chain to a Wallet
@@ -852,96 +994,255 @@ declare const useSuggestChainAndConnect: ({ onError, onLoading, onSuccess }?: Us
852
994
  /**
853
995
  * graz query hook to retrieve a StargateClient.
854
996
  *
997
+ * Note: Returns multi-chain results by default (Record<chainId, StargateClient>).
998
+ *
855
999
  * @example
856
1000
  * ```ts
857
1001
  * import { useStargateClient } from "graz";
858
1002
  *
859
- * // single chain
860
- * const { data:client, isFetching, refetch, ... } = useStargateClient();
861
- * 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");
862
1008
  *
863
- * // multi chain
864
- * const { data:clients, isFetching, refetch, ... } = useStargateClient({multiChain: true, chainId: ["cosmoshub-4", "sommelier-3"]});
865
- * 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!
866
1015
  *
1016
+ * // All connected chains
1017
+ * const { data: clients } = useStargateClient();
1018
+ * // Type: { data?: Record<string, StargateClient> }
867
1019
  * ```
868
1020
  */
869
- 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>;
870
1025
  /**
871
1026
  * graz query hook to retrieve a CosmWasmClient.
872
1027
  *
1028
+ * Note: Returns multi-chain results by default (Record<chainId, CosmWasmClient>).
1029
+ *
873
1030
  * @example
874
1031
  * ```ts
875
1032
  * import { useCosmWasmClient } from "graz";
876
1033
  *
877
- * //single chain
878
- * const { data:client, isFetching, refetch, ... } = useCosmWasmClient();
879
- * 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");
880
1039
  *
881
- * // multi chain
882
- * const { data:clients, isFetching, refetch, ... } = useCosmWasmClient({multiChain: true, chainId: ["cosmoshub-4", "sommelier-3"]});
883
- * 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!
884
1046
  *
1047
+ * // All connected chains
1048
+ * const { data: clients } = useCosmWasmClient();
1049
+ * // Type: { data?: Record<string, CosmWasmClient> }
885
1050
  * ```
886
1051
  */
887
- 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>;
888
1056
 
889
1057
  /**
890
- * graz mutation hook to send tokens. Note: if `senderAddress` undefined, it will use current connected account address.
1058
+ * graz mutation hook to send tokens.
891
1059
  *
892
1060
  * @example
893
1061
  * ```ts
894
- * 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"];
895
1070
  *
896
- * // basic example
897
- * const { data: signingClient } = useStargateSigningClient()
898
1071
  * const { sendTokens } = useSendTokens();
899
1072
  *
900
1073
  * sendTokens({
901
1074
  * signingClient,
902
- * recipientAddress: "cosmos1g3jjhgkyf36pjhe7u5cw8j9u6cgl8x929ej430";
903
- * amount: [coin];
904
- * ...
1075
+ * senderAddress: account.bech32Address,
1076
+ * recipientAddress: "cosmos1g3jjhgkyf36pjhe7u5cw8j9u6cgl8x929ej430",
1077
+ * amount: [coin],
1078
+ * fee: "auto"
905
1079
  * })
906
1080
  * ```
907
1081
  *
908
1082
  * @see {@link sendTokens}
909
1083
  */
910
1084
  declare const useSendTokens: ({ onError, onLoading, onSuccess, }?: MutationEventArgs<SendTokensArgs, DeliverTxResponse>) => {
911
- error: Error | null;
912
- isLoading: boolean;
913
- isSuccess: boolean;
914
1085
  sendTokens: _tanstack_react_query.UseMutateFunction<DeliverTxResponse, Error, SendTokensArgs, unknown>;
915
1086
  sendTokensAsync: _tanstack_react_query.UseMutateAsyncFunction<DeliverTxResponse, Error, SendTokensArgs, unknown>;
916
- 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;
917
1152
  };
918
1153
  /**
919
- * graz mutation hook to send IBC tokens. Note: if `senderAddress` undefined, it will use current connected account address.
920
- *
1154
+ * graz mutation hook to send IBC tokens.
921
1155
  *
922
1156
  * @example
923
1157
  * ```ts
924
- * 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"];
925
1166
  *
926
- * // basic example
927
- * const { data: signingClient } = useStargateSigningClient()
928
1167
  * const { sendIbcTokens } = useSendIbcTokens();
929
1168
  *
930
1169
  * sendIbcTokens({
931
1170
  * signingClient,
1171
+ * senderAddress: account.bech32Address,
932
1172
  * recipientAddress: "cosmos1g3jjhgkyf36pjhe7u5cw8j9u6cgl8x929ej430",
933
1173
  * transferAmount: coin,
934
- * ...
1174
+ * fee: "auto"
935
1175
  * })
936
1176
  * ```
937
1177
  */
938
1178
  declare const useSendIbcTokens: ({ onError, onLoading, onSuccess, }?: MutationEventArgs<SendIbcTokensArgs, DeliverTxResponse>) => {
939
- error: Error | null;
940
- isLoading: boolean;
941
- isSuccess: boolean;
942
1179
  sendIbcTokens: _tanstack_react_query.UseMutateFunction<DeliverTxResponse, Error, SendIbcTokensArgs, unknown>;
943
1180
  sendIbcTokensAsync: _tanstack_react_query.UseMutateAsyncFunction<DeliverTxResponse, Error, SendIbcTokensArgs, unknown>;
944
- 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;
945
1246
  };
946
1247
  type UseInstantiateContractArgs<Message extends Record<string, unknown>> = {
947
1248
  codeId: number;
@@ -951,9 +1252,15 @@ type UseInstantiateContractArgs<Message extends Record<string, unknown>> = {
951
1252
  *
952
1253
  * @example
953
1254
  * ```ts
954
- * 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"];
955
1263
  *
956
- * const { data: signingClient } = useCosmwasmSigningClient()
957
1264
  * const { instantiateContract: instantiateMyContract } = useInstantiateContract({
958
1265
  * codeId: 4,
959
1266
  * onSuccess: ({ contractAddress }) => console.log('Address:', contractAddress)
@@ -962,18 +1269,81 @@ type UseInstantiateContractArgs<Message extends Record<string, unknown>> = {
962
1269
  * const instantiateMessage = { foo: 'bar' };
963
1270
  * instantiateMyContract({
964
1271
  * signingClient,
965
- * msg: instatiateMessage,
966
- * label: "test"
1272
+ * senderAddress: account.bech32Address,
1273
+ * msg: instantiateMessage,
1274
+ * label: "test",
1275
+ * fee: "auto"
967
1276
  * });
968
1277
  * ```
969
1278
  */
970
1279
  declare const useInstantiateContract: <Message extends Record<string, unknown>>({ codeId, onError, onLoading, onSuccess, }: UseInstantiateContractArgs<Message>) => {
971
- error: Error | null;
972
- isLoading: boolean;
973
- isSuccess: boolean;
974
1280
  instantiateContract: _tanstack_react_query.UseMutateFunction<InstantiateResult, Error, InstantiateContractMutationArgs<Message>, unknown>;
975
1281
  instantiateContractAsync: _tanstack_react_query.UseMutateAsyncFunction<InstantiateResult, Error, InstantiateContractMutationArgs<Message>, unknown>;
976
- 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;
977
1347
  };
978
1348
  type UseExecuteContractArgs<Message extends Record<string, unknown>> = {
979
1349
  contractAddress: string;
@@ -984,37 +1354,103 @@ type UseExecuteContractArgs<Message extends Record<string, unknown>> = {
984
1354
  *
985
1355
  * @example
986
1356
  * ```ts
987
- * import { useExecuteContract, useCosmWasmSigningClient } from "graz"
1357
+ * import { useExecuteContract, useCosmWasmSigningClient, useAccount } from "graz"
988
1358
  *
989
- * interface GreetMessage {
990
- * name: string;
1359
+ * interface ExecuteMessage {
1360
+ * foo: string;
991
1361
  * }
992
1362
  *
993
- * interface GreetResponse {
994
- * message: string;
995
- * }
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"] });
996
1368
  *
997
- * const contractAddress = "cosmosfoobarbaz";
1369
+ * const account = accounts?.["juno-1"];
1370
+ * const signingClient = signingClients?.["juno-1"];
998
1371
  *
999
- * const { data: signingClient } = useCosmWasmSigningClient()
1000
- * const { executeContract } = useExecuteContract<ExecuteMessage>({ contractAddress });
1372
+ * const { executeContract } = useExecuteContract<ExecuteMessage>({
1373
+ * contractAddress,
1374
+ * onSuccess: (result) => console.log('Tx hash:', result.transactionHash)
1375
+ * });
1001
1376
  *
1002
1377
  * executeContract({
1003
1378
  * signingClient,
1004
- * msg: {
1005
- * foo: "bar"
1006
- * }}, {
1007
- * onSuccess: (data: GreetResponse) => console.log('Got message:', data.message);
1008
- * });
1379
+ * senderAddress: account.bech32Address,
1380
+ * msg: { foo: "bar" },
1381
+ * fee: "auto",
1382
+ * funds: []
1383
+ * });
1009
1384
  * ```
1010
1385
  */
1011
1386
  declare const useExecuteContract: <Message extends Record<string, unknown>>({ contractAddress, onError, onLoading, onSuccess, }: UseExecuteContractArgs<Message>) => {
1012
- error: Error | null;
1013
- isLoading: boolean;
1014
- isSuccess: boolean;
1015
1387
  executeContract: _tanstack_react_query.UseMutateFunction<ExecuteResult, Error, ExecuteContractMutationArgs<Message>, unknown>;
1016
1388
  executeContractAsync: _tanstack_react_query.UseMutateAsyncFunction<ExecuteResult, Error, ExecuteContractMutationArgs<Message>, unknown>;
1017
- 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;
1018
1454
  };
1019
1455
  /**
1020
1456
  * graz query hook for dispatching a "smart" query to a CosmWasm smart
@@ -1040,22 +1476,85 @@ declare const useQueryRaw: <TError>(args?: {
1040
1476
  key?: string;
1041
1477
  }) => UseQueryResult<Uint8Array | null, TError>;
1042
1478
 
1043
- interface SiginingClientSinglechainArgs<T> {
1044
- multiChain?: false;
1045
- opts?: T;
1046
- }
1047
- interface SiginingClientMultichainArgs<T> {
1048
- multiChain?: true;
1049
- opts?: Record<string, T>;
1050
- }
1479
+ /**
1480
+ * Base signing client args - now always uses per-chain opts
1481
+ */
1051
1482
  interface BaseSigningClientArgs extends QueryConfig {
1052
- chainId?: ChainId$1;
1053
1483
  offlineSigner?: "offlineSigner" | "offlineSignerAuto" | "offlineSignerOnlyAmino";
1484
+ opts?: Record<string, SigningStargateClientOptions | SigningCosmWasmClientOptions>;
1054
1485
  }
1055
- declare function useStargateSigningClient(args?: BaseSigningClientArgs & SiginingClientSinglechainArgs<SigningStargateClientOptions>): UseQueryResult<SigningStargateClient | null>;
1056
- declare function useStargateSigningClient(args?: BaseSigningClientArgs & SiginingClientMultichainArgs<SigningStargateClientOptions>): UseQueryResult<Record<string, SigningStargateClient | null>>;
1057
- declare function useCosmWasmSigningClient(args?: BaseSigningClientArgs & SiginingClientSinglechainArgs<SigningCosmWasmClientOptions>): UseQueryResult<SigningCosmWasmClient | null>;
1058
- 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>;
1059
1558
 
1060
1559
  /**
1061
1560
  * graz hook to retrieve current active {@link WalletType}
@@ -1131,4 +1630,4 @@ declare const useGrazEvents: () => null;
1131
1630
  */
1132
1631
  declare const GrazEvents: FC;
1133
1632
 
1134
- 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 };