2

I know that Stellar.xdr.TransactionEnvelope.fromXDR can decode data of a record called envelope_xdr. But what I do not understand is how I can get all data I need like memo, sourceAccount etc. Because those 2 for example are displayed on response as

function () {  this.get(name); }

Do I need to install another package of stellar? Currently I'm using only stellar-sdk for JS.

3

const transaction = new StellarSdk.Transaction(txenv);

This will decode an transaction envelope XDR object to a Transaction object (https://github.com/stellar/js-stellar-base/blob/master/src/transaction.js), which has all of the properties you need.

  • hmm this is the same as using : Stellar.xdr.TransactionEnvelope.fromXDR(historyPage.records[1].envelope_xdr, 'base64') problem is that i cannot get the property of memo or sourceAccount as i said on my question – Tzion buchris Dec 24 '18 at 12:01
  • Source account would be transaction.source, and memo transaction.memo. If not, maybe something is wrong with your XDR? – Johan Stén Dec 24 '18 at 12:47
  • ok, source i can get .but memo gives me a buffer result. how do i decrypt it ? on stellar tool i gave the envelop and they could print my memo. i do not know how they decrypt the buffer – Tzion buchris Dec 24 '18 at 13:33
  • Depends on the memo type. For a hash you'd probably want to convert the bytes to a string of hex characters (buf.toString('hex');); – Johan Stén Dec 24 '18 at 15:32
  • its a text type this i why i do not know how to convert the buffer to a string. – Tzion buchris Dec 24 '18 at 15:46

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.