Function Signature

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

Description

Creates a new EVM 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
  • backUpToClientShareService (boolean) - Whether to back up to client share service (defaults to false)

Returns

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

Example

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

const evmClient = await authenticatedEvmClient();

const wallet = await evmClient.createWalletAccount({
  thresholdSignatureScheme: ThresholdSignatureScheme.TWO_OF_TWO,
  password: 'optional-password',
  backUpToClientShareService: false,
});

console.log('Wallet created:', wallet.accountAddress);

Error Handling

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