Skip to content

Commit

Permalink
Get address attributes from cardano-crypto
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterBenc committed Nov 9, 2020
1 parent 0c8b536 commit 5774846
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions app/frontend/wallet/shelley/shelley-js-crypto-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
sign as signMsg,
derivePrivate,
xpubToHdPassphrase,
getBootstrapAddressAttributes,
base58,
unpackBootstrapAddress,
} from 'cardano-crypto.js'
import {encode} from 'borc'

Expand Down Expand Up @@ -79,8 +79,7 @@ const ShelleyJsCryptoProvider = ({
const build_byron_witness = async (tx_body_hash, sign, path, address) => {
const signature = await sign(tx_body_hash, path)
const xpub = await deriveXpub(path)
const hdPassphrase = await getHdPassphrase()
const addressAttributes = unpackBootstrapAddress(address, hdPassphrase)
const addressAttributes = getBootstrapAddressAttributes(base58.decode(address))
return ShelleyTxWitnessByron(
xpub.slice(0, 32),
signature,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ const ShelleyLedgerCryptoProvider = async ({network, config, isWebUSB}) => {
const xpub = await deriveXpub(witness.path)
const publicKey = xpub2pub(xpub)
const chainCode = xpub.slice(32, 64) // TODO: move this somewhere
// we dont need to unpack address here since ledger addresses are not v1
// TODO: unless we create pathToAddressMapper we cant get this from cardano-crypto
const addressAttributes = encode({})
const signature = Buffer.from(witness.witnessSignatureHex, 'hex')
return ShelleyTxWitnessByron(publicKey, signature, chainCode, addressAttributes)
Expand Down

0 comments on commit 5774846

Please sign in to comment.