Function Signature

updatePassword(params: {
  accountAddress: string;
  existingPassword: string;
  newPassword: string;
}): Promise<void>

Description

Updates the password for a wallet. This function requires the existing password for verification and sets a new password for the wallet.

Parameters

Required Parameters

  • accountAddress (string) - The wallet address to update password for
  • existingPassword (string) - The current wallet password
  • newPassword (string) - The new wallet password

Returns

  • Promise<void> - Resolves when password is updated successfully

Example

import { authenticatedSvmClient } from './client';

const svmClient = await authenticatedSvmClient();

await svmClient.updatePassword({
  accountAddress: 'YourSolanaWalletAddress',
  existingPassword: 'current-password',
  newPassword: 'new-password'
});

console.log('Password updated successfully');

Error Handling

try {
  await svmClient.updatePassword({
    accountAddress: 'YourSolanaWalletAddress',
    existingPassword: 'current-password',
    newPassword: 'new-password'
  });
  console.log('Password updated successfully');
} catch (error) {
  if (error.message.includes('invalid password')) {
    console.error('Invalid current password');
  } else {
    console.error('Failed to update password:', error);
  }
}