Skip to content

Commit

Permalink
implement custom address validator and harden addAddress method
Browse files Browse the repository at this point in the history
  • Loading branch information
alejoacosta74 authored and rileystephens28 committed Nov 19, 2024
1 parent ffbc1fc commit 1af6437
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/wallet/qi-hdwallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,10 @@ export class QiHDWallet extends AbstractHDWallet<QiAddressInfo> {
if (existingAddresses && existingAddresses.some((addr) => addr.address === addressInfo.address)) {
throw new Error(`Address ${addressInfo.address} already exists in the wallet`);
}
const existingAddresses = wallet._addressesMap.get(key);
if (existingAddresses && existingAddresses.some((addr) => addr.address === addressInfo.address)) {
throw new Error(`Address ${addressInfo.address} already exists in the wallet`);
}
wallet._addressesMap.get(key)!.push(addressInfo);
}

Expand Down

0 comments on commit 1af6437

Please sign in to comment.