Function Signature

createWalletAccount(params: {
  thresholdSignatureScheme: ThresholdSignatureScheme;
  password?: string;
  onError?: (error: Error) => void;
  backUpToClientShareService?: boolean;
}): Promise<{
  accountAddress: string;
  rawPublicKey: string;
  externalServerKeyShares: ServerKeyShare[];
  walletId: string;
}>

Description

Creates a new SVM wallet account with the specified threshold signature scheme. Returns wallet information including the account address, public keys, and external server key shares.

Parameters

Required Parameters

  • thresholdSignatureScheme (ThresholdSignatureScheme) - The threshold signature scheme for the wallet

Optional Parameters

  • password (string) - Wallet password for additional security
  • onError ((error: Error) => void) - Error callback function for handling creation errors
  • backUpToClientShareService (boolean) - Whether to backup key shares to the client share service

Returns

  • Promise<object> - Object containing wallet information:
    • accountAddress - The wallet’s account address
    • rawPublicKey - Raw public key
    • externalServerKeyShares - Array of external server key shares (ServerKeyShare[])
    • walletId - Unique wallet identifier

Example

import { authenticatedSvmClient } from './client';
import { ThresholdSignatureScheme } from '@dynamic-labs-wallet/node';

const svmClient = await authenticatedSvmClient();

const wallet = await svmClient.createWalletAccount({
  thresholdSignatureScheme: ThresholdSignatureScheme.TWO_OF_TWO,
  password: 'optional-password',
  onError: (error: Error) => {
    console.error('SVM wallet creation error:', error);
  },
  backUpToClientShareService: true,
});

console.log('Solana wallet created:', wallet.accountAddress);
console.log('External server key shares:', wallet.externalServerKeyShares);

Error Handling

try {
  const wallet = await svmClient.createWalletAccount({
    thresholdSignatureScheme: ThresholdSignatureScheme.TWO_OF_TWO,
    onError: (error: Error) => {
      console.error('Wallet creation error:', error);
    },
    backUpToClientShareService: true,
  });
  console.log('Wallet created successfully');
} catch (error) {
  console.error('Failed to create wallet:', error);
}