iam having an XDR i want to know the transaction hash before i submit that to stellar. i did this in GO by unmarshal the XDR and used the builder to retrieve the hash. Is there nay way that i can do it in JS.
If it's a
transaction you have, and not a
transaction envelope, then the transaction hash is formed using the XDR directly.
const envelopeType = StellarSdk.xdr.EnvelopeType.envelopeTypeTx().toXDR(); const signatureBase = Buffer.concat([networkId, envelopeType, txXDR]) const transactionHash = StellarSdk.hash(signatureBase);