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
| Name | Type | Default |
|---|---|---|
network | NetworkInfoThe network to use for the request. If not set, the network of the |
Return Type
Last updated on