Read the active account
Read the selected address without opening a connection dialog. Disable signing and transaction actions when no account is connected.wallet.ts
Sign a message
Callpersonal_sign with a hex-encoded message and the selected address:
eth_signTypedData_v4 or viem’s signTypedData action through the same provider.
Send a transaction
Switch to the intended chain before submitting. This example sends ETH on Base; the external account needs enough ETH for both the transfer and gas.waitForTransactionReceipt action.
Batch transactions
For external accounts, the wallet provider implementswallet_sendCalls as sequential transactions, not an atomic batch. Users may see multiple approval prompts, and earlier transactions can succeed even if a later one fails.
A batch must target one chain; calls with different chainIds are rejected before anything is sent. wallet_getCallsStatus returns the batch’s transaction receipts and stays 100 (pending) until every transaction is mined and the wallet is on the batch’s chain. It then reports 200 when all succeeded, 500 when all reverted, or 600 when some reverted.
Switch wallets and reconnect
Callwallet_connect again from your wallet-switching UI:
eth_accounts can report a remembered address, but it does not verify that the external connection is usable. Offer an explicit reconnect action when needed.
If you use createWalletConnection with your own picker, call connection.connect() instead. Host-provided external wallet connections are memory-only; your wallet integration must reconnect them after a reload.
Disconnect
createWalletConnection, use connection.disconnect() and clear any additional connection state owned by your wallet integration.