Im using cardano-wallet package to build transaction manually and get stuck in encode transaction as cbor format. Any one can help?
const Cardano = require(‘cardano-wallet’)
const txFinalizer = new Cardano.TransactionFinalized(unsignedTx)
const setting = Cardano.BlockchainSettings.from_json({
protocol_magic: PROTOCOL_MAGICS.testnet
})
// sign Transaction
utxos.forEach(() => {
const witness = Cardano.Witness.new_extended_key(
setting,
Cardano.PrivateKey.from_hex(privateKey),
txFinalizer.id()
)
txFinalizer.add_witness(witness)
})
const txid = txFinalizer.id().to_hex()
const signedTx = txFinalizer.finalize()
const txEncoded = CBOR.encode(Buffer.from(signedTx.to_hex(), 'hex')
const response = await axios({
headers: {
'Content-Type': 'application/cbor'
},
method: 'post',
url: `${submitUrl}/api/submit/tx`,
'data-binary': txEncoded
})