Skip to main content

useSmartAccounts

Hook for retrieving smart account data of a given EOA and chain.

import { useSmartAccounts } from 'moonchute';

Usage

import { useSmartAccounts } from 'moonchute';

export default function SmartAccounts() {
const { data, isLoading, isError } = useSmartAccounts({
address: '0x6136b647C9971f1EDc7641e14a9E0Ca7b2626080',
chainId: 137,
});

if (data) {
return (
<div>
{data.smartAccount?.map((sa, key) => (
<div
key={key}
>{`Address: ${sa.address} / Provider: ${sa.provider}`}</div>
))}
</div>
);
}
}

Return Value

{
data?: smartAccount[],
isLoading: true/false,
isError: true/false
}

Parameters

address (required)

The address or ENS of the desired account for data retrieval.

chainId (required)

Specifies the ID of the chain from which data needs to be fetched.

Currently Supported Chains:

Chain NameChain ID
Polygon137
Arbitrum42161
Optimism10
Base8453
Mumbai80001