Skip to content

Commit

Permalink
fixed key derivation logic using coinType
Browse files Browse the repository at this point in the history
  • Loading branch information
aruokhai committed Dec 31, 2024
1 parent dc73a6c commit 1651a15
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/wallet/src/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ export class Wallet {
).privateKey;

this.masterKey = bip32.fromPrivateKey(decryptedPrivateKey, decryptedChainCode);
this.scanKey = this.masterKey.derivePath(`m/352'/${this.network.network.bech32}'/0'/1'/0`);
this.spendKey = this.masterKey.derivePath(`m/352'/${this.network.network.bech32}'/0'/0'/0`);
const coinType = this.network.network.bech32 === 'bc' ? 0 : 1;
this.scanKey = this.masterKey.derivePath(`m/352'/${coinType}'/0'/1'/0`);
this.spendKey = this.masterKey.derivePath(`m/352'/${coinType}'/0'/0'/0`);
}


Expand Down

0 comments on commit 1651a15

Please sign in to comment.