Use the useGlobalWalletSignerAccount
hook to retrieve the account
approved to sign transactions for the connected Abstract Global Wallet. This is helpful if you need to access the underlying EOA
approved to sign transactions for the Abstract Global Wallet smart contract.
It uses the useAccount hook from wagmi under the hood.
Import
import { useGlobalWalletSignerAccount } from "@abstract-foundation/agw-react" ;
Usage
import { useGlobalWalletSignerAccount } from "@abstract-foundation/agw-react" ;
export default function App () {
const { address , status } = useGlobalWalletSignerAccount ();
if ( status === "disconnected" ) return < div > Disconnected </ div > ;
if ( status === "connecting" || status === "reconnecting" ) {
return < div > Connecting... </ div > ;
}
return (
< div >
Connected to EOA: { address }
Status: { status }
</ div >
);
}
Returns
Returns a UseAccountReturnType<Config>
.
The specific address of the approved signer account (selected using useAccount
’s addresses[1]
).
addresses
readonly Hex[] | undefined
An array of all addresses connected to the application.
Information about the currently connected blockchain network.
The ID of the current blockchain network.
The connector instance used to manage the connection.
Indicates if the account is currently connected.
Indicates if the account is attempting to reconnect.
Indicates if the account is in the process of connecting.
Indicates if the account is disconnected.
status
'connected' | 'connecting' | 'reconnecting' | 'disconnected'
A string representing the connection status of the account to the application.
'connecting'
attempting to establish connection.
'reconnecting'
attempting to re-establish connection to one or more connectors.
'connected'
at least one connector is connected.
'disconnected'
no connection to any connector.