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 useExportSolanaAccount(): {
exportSolanaAccount: (options: ExportSolanaAccountOptions) => Promise<ExportSolanaAccountResult>;
};
Hook that provides a wrapped function to export Solana account private keys with authentication checks.
This hook uses useEnforceAuthenticated to ensure the user is signed in before attempting to export.
Returns
{
exportSolanaAccount: (options: ExportSolanaAccountOptions) => Promise<ExportSolanaAccountResult>;
}
| Name | Type |
|---|
exportSolanaAccount() | (options: ExportSolanaAccountOptions) => Promise<ExportSolanaAccountResult> |
Example
function ExportSolanaPrivateKey() {
const { exportSolanaAccount } = useExportSolanaAccount();
const { solanaAddress } = useSolanaAddress();
const handleExport = async () => {
if (!solanaAddress) return;
try {
const { privateKey } = await exportSolanaAccount({
solanaAccount: solanaAddress
});
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 useSolanaKeyExportIframe instead for a more secure key export experience
that never exposes the private key to your application’s JavaScript context.
See
useSolanaKeyExportIframe