Skip to main content

useCosmWasmTmSigningClient

Hook to retrieve a SigningCosmWasmClient with tendermint client.

Usage

Single Chain
import { useCosmWasmTmSigningClient } from "graz";

function App() {
const { data: signingClient, isFetching, refetch, ... } = useCosmWasmTmSigningClient({ type: "tm34" });

async function getAccountFromClient() {
return await client.getAccount("address")
}
}
Multi Chain
import { useCosmWasmTmSigningClient } from "graz";

function App() {
const { data: signingClient, isFetching, refetch, ... } = useCosmWasmTmSigningClient({
type: "tm34",
chainId: ["cosmoshub-4", "sommelier-1"],
multiChain: true
});

async function getAccountFromClient() {
return await client["cosmoshub-4"].getAccount("address")
}
}

Hook Params

<TMultiChain extends boolean>{
type: "tm34" | "tm37";
opts?: TMultiChain extends true ? <Record, SigningCosmWasmClientOptions> : SigningCosmWasmClientOptions;
offlineSigner?: "offlineSigner" | "offlineSignerAuto" | "offlineSignerOnlyAmino";
chainId?: string | string[];
multiChain?: TMultiChain; // boolean
}

Return Value

{
data?: TMultiChain extends true ? Record<string, SigningCosmWasmClient> : SigningCosmWasmClient
dataUpdatedAt: number;
error: TError | null;
errorUpdatedAt: number;
failureCount: number;
errorUpdateCount: number;
isError: boolean;
isFetched: boolean;
isFetchedAfterMount: boolean;
isFetching: boolean;
isLoading: boolean;
isLoadingError: boolean;
isPaused: boolean;
isPlaceholderData: boolean;
isPreviousData: boolean;
isRefetchError: boolean;
isRefetching: boolean;
isStale: boolean;
isSuccess: boolean;
refetch:(options?: RefetchOptions & RefetchQueryFilters) => Promise<QueryObserverResult<TMultiChain extends true ? Record<string, SigningCosmWasmClient> : SigningCosmWasmClient, unknown>>;
remove: () => void;
status: 'loading' | 'error' | 'success';
fetchStatus: 'fetching' | 'paused' | 'idle';
}