Added support for coins with 2 address prefix bytes. Address derivation still needs more work for Pirate Chain (Zcash address format)

This commit is contained in:
CalDescent 2022-05-06 11:43:17 +01:00
parent cc0cfcc7d1
commit ffa19210e0

View File

@ -688,7 +688,13 @@ export default class AltcoinHDWallet {
*/ */
// Append Address Prefix // Append Address Prefix
const k = [this.versionBytes.mainnet.prefix].concat(...this.grandChildPublicKeyHash) let prefix = [this.versionBytes.mainnet.prefix]
if (2 == this.versionBytes.mainnet.prefix.length) {
prefix = [this.versionBytes.mainnet.prefix[0]]
prefix.push([this.versionBytes.mainnet.prefix[1]])
}
const k = prefix.concat(...this.grandChildPublicKeyHash)
// Derive Checksum // Derive Checksum
const _addressCheckSum = new Sha256().process(new Sha256().process(new Uint8Array(k)).finish().result).finish().result const _addressCheckSum = new Sha256().process(new Sha256().process(new Uint8Array(k)).finish().result).finish().result