Function Signature

exportKey(params: {
  accountAddress: string;
  externalServerKeyShares: any[];
  password: string;
  chainName: string;
}): Promise<any>

Description

Exports wallet key data for a specific chain. This function provides access to wallet key information for backup or migration purposes.

Parameters

Required Parameters

  • accountAddress (string) - The wallet address to export key for
  • externalServerKeyShares (any[]) - Array of external server key shares
  • password (string) - Wallet password for security
  • chainName (string) - The chain name (e.g., ‘solana’)

Returns

  • Promise<any> - The exported key data

Example

import { authenticatedSvmClient } from './client';

const svmClient = await authenticatedSvmClient();

const exportedKey = await svmClient.exportKey({
  accountAddress: 'YourSolanaWalletAddress',
  externalServerKeyShares: [
    {
      chainName: 'solana',
      keyShare: '0xYourKeyShare',
    },
  ],
  password: 'your-password',
  chainName: 'solana',
});

console.log('Exported key:', exportedKey);

Error Handling

try {
  const exportedKey = await svmClient.exportKey({
    accountAddress: 'YourSolanaWalletAddress',
    externalServerKeyShares,
    password: 'your-password',
    chainName: 'solana',
  });
  console.log('Key exported successfully');
} catch (error) {
  console.error('Failed to export key:', error);
}