Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/hooks/useWallet.js
Show First 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | const normalizeBalance = slpBalancesAndUtxos => { | ||||
totalBalance: fromSmallestDenomination(totalBalanceInSatoshis), | totalBalance: fromSmallestDenomination(totalBalanceInSatoshis), | ||||
}; | }; | ||||
}; | }; | ||||
const deriveAccount = async (BCH, { masterHDNode, path }) => { | const deriveAccount = async (BCH, { masterHDNode, path }) => { | ||||
const node = BCH.HDNode.derivePath(masterHDNode, path); | const node = BCH.HDNode.derivePath(masterHDNode, path); | ||||
const publicKey = BCH.HDNode.toPublicKey(node).toString('hex'); | const publicKey = BCH.HDNode.toPublicKey(node).toString('hex'); | ||||
const cashAddress = BCH.HDNode.toCashAddress(node); | const cashAddress = BCH.HDNode.toCashAddress(node); | ||||
const hash160 = BCH.Address.toHash160(cashAddress); | |||||
const slpAddress = BCH.SLP.Address.toSLPAddress(cashAddress); | const slpAddress = BCH.SLP.Address.toSLPAddress(cashAddress); | ||||
return { | return { | ||||
publicKey, | publicKey, | ||||
hash160, | |||||
cashAddress, | cashAddress, | ||||
slpAddress, | slpAddress, | ||||
fundingWif: BCH.HDNode.toWIF(node), | fundingWif: BCH.HDNode.toWIF(node), | ||||
fundingAddress: BCH.SLP.Address.toSLPAddress(cashAddress), | fundingAddress: BCH.SLP.Address.toSLPAddress(cashAddress), | ||||
legacyAddress: BCH.SLP.Address.toLegacyAddress(cashAddress), | legacyAddress: BCH.SLP.Address.toLegacyAddress(cashAddress), | ||||
}; | }; | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 1,134 Lines • Show Last 20 Lines |