Skip to Content

🚧 These packages are still in development and may change rapidly as they are developed.

ReactuseClients

useClients

Hook for accessing the underlying Aptos clients (aptos, indexer, signer) and the main client instance from the AptosJSCoreProvider. Allows specifying a different network.

Usage

Default Network

import { useClients } from "@aptos-labs/react"; export default function App() { const { aptos, indexer, signer, network, client } = useClients(); return <>{/* ... */}</>; }

Specific Network (Testnet)

import { useClients } from "@aptos-labs/react"; import { Network } from "@aptos-labs/ts-sdk"; export default function App() { const { aptos, indexer, signer, network, client } = useClients({ network: { network: Network.TESTNET }, }); return <>{/* ... */}</>; }

Parameters

NameTypeDefault
networkNetworkInfo

The network to use for the request. If not set, the network of the AptosJSProClient instance will be used.

Return Type

NameTypeDefault
clientAptosJSProClient
accountAccountInfo
aptosAptos
indexer{ getAccountTokensTotal(variables: Exact<{ address: string; where: Current_Token_Ownerships_V2_Bool_Exp | Current_Token_Ownerships_V2_Bool_Exp[]; }>, requestHeaders?: HeadersInit | undefined, signal?: AbortSignal | ... 1 more ... | undefined): Promise<...>; ... 14 more ...; getNumberOfDelegators(variables?: Exact<.....
networkNetworkInfo
signerSignerClient
Last updated on