Skip to main content

useAptosClient

Use this hook to get an Aptos client connected to a chain from defaultChains. The client is reused for the same chainId.

Usage​

const aptos = useAptosClient(chainId);

This example uses the useAptosClient hook to retrieve the Aptos client for chainId.

Parameters​

ParameterTypeDescription
chainIdnumberThe id for the chain as defined in defaultChains. The hook throws if no chain has this id.

Return Value​

  • aptos: An Aptos client from the Aptos TypeScript SDK.