All files / src/transaction hashTransaction.js

100% Statements 5/5
100% Branches 0/0
100% Functions 1/1
100% Lines 5/5
1 2 3 4 5 6 7 8 9 10 114x 4x       22x 22x   22x    
import serializeTransactionIntoCanonicalString from './serializeTransactionIntoCanonicalString'
import sha256Hash from '../sha256Hash'
 
export default function hashTransaction(transaction) {
    // Safely remove any tx id from the given transaction for hashing
    const tx = { ...transaction }
    delete tx.id
 
    return sha256Hash(serializeTransactionIntoCanonicalString(tx))
}