2

The Transaction class has a .toXDR() method, but I don't see a fromXDR method.

I want to persist transactions in XDR base64, then load them, sign them, and send them.

There is a mention of a fromXDR method in the Transaction class here:

get Transaction object from xdr base64 string

but it's not in the doc: https://stellar.github.io/js-stellar-sdk/Transaction.html or even in the code...

3

You pass it directly in the constructor. This is described in the doc you linked to:

Parameters: envelope string | xdr.TransactionEnvelope

So do this:

// `transactionXDR` is a string from the person generating the transaction
const transaction = new Transaction(transactionXDR, networkPassphrase);

See also the docs for adding a signature to a transaction sent to you from someone else.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.