Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const txnForDecoding = decodedTx.txn || decodedTx;
tx = Multisig.MultiSigTransaction.from_obj_for_encoding(txnForDecoding);
} catch (ex) {
throw new Error('txHex needs to be a valid tx encoded as base64 string');
}
const id = tx.txID();
const fee = { fee: tx.fee };
const outputAmount = tx.amount || 0;
const outputs: { amount: number; address: string }[] = [];
if (tx.to) {
outputs.push({
amount: outputAmount,
address: Address.encode(new Uint8Array(tx.to.publicKey)),
});
}
// TODO(CT-480): add recieving address display here
const memo = tx.note;
return {
displayOrder: ['id', 'outputAmount', 'changeAmount', 'outputs', 'changeOutputs', 'fee', 'memo'],
id,
outputs,
outputAmount,
changeAmount: 0,
fee,
changeOutputs: [],
memo,
};