Documentation Index
Fetch the complete documentation index at: https://docs.cloud.coinbase.com/llms.txt
Use this file to discover all available pages before exploring further.
function useExportEvmAccount(): {
exportEvmAccount: (options: ExportEvmAccountOptions) => Promise<ExportEvmAccountResult>;
};
Hook that provides a wrapped function to export EVM account private keys with authentication checks.
This hook uses useEnforceAuthenticated to ensure the user is signed in before attempting to export.
Returns
{
exportEvmAccount: (options: ExportEvmAccountOptions) => Promise<ExportEvmAccountResult>;
}
| Name | Type |
|---|
exportEvmAccount() | (options: ExportEvmAccountOptions) => Promise<ExportEvmAccountResult> |
Example
function ExportPrivateKey() {
const { exportEvmAccount } = useExportEvmAccount();
const { evmAddress } = useEvmAddress();
const handleExport = async () => {
if (!evmAddress) return;
try {
const { privateKey } = await exportEvmAccount({
evmAccount: evmAddress
});
console.log("Private Key:", privateKey);
} catch (error) {
console.error("Failed to export private key:", error);
}
};
return (
<button onClick={handleExport}>Export Private Key</button>
);
}
Deprecated
This function will be removed soon. Use useEvmKeyExportIframe instead for a more secure key export experience
that never exposes the private key to your application’s JavaScript context.
See
useEvmKeyExportIframe