Want to contribute to an open source Stellar project but don't know where to start?

I've just released https://github.com/stellarguard/txrep, a TypeScript/JavaScript implementation of https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0011.md. Txrep aims to be a human readable (and editable) representation of a Stellar transaction.

So how can you help? We need more transaction XDRs to test with! You can create test XDRs using the official Stellar Laboratory: https://www.stellar.org/laboratory/

You can then contribute those XDRs in one of two ways:

  1. Open a PR by adding to the file https://github.com/stellarguard/txrep/blob/master/tests.yaml. Add additional test cases with a brief description of the XDR that is being tested, and optionally the txrep representation of that case. To generate the txrep, use https://github.com/xdrpp/stc which includes the reference implementation of Txrep in Golang. Follow the instructions in "Installing tsc for non developers" to install the command line tool and then run `stc <path-to-your-saved-xdr-file> to get the txrep output. Then copy/paste your txrep into the tests.yaml file as a new entry.

  2. Paste your XDR to https://stellarguard.github.io/txrep/demo/, and see if there's an error. If there is an error, open a github issue and paste your XDR into it, or just share it here and I'll take it from there.

Thanks in advance for anyone who contributes!

It is described in SEP 11:

string values are represented as double-quoted interpreted string literals, in which non-ASCII bytes are represented with hex escapes ("\xff"), the " and \ characters can be escaped with another \ (e.g., "\\"), and \n designates a newline.

The feature does not seem to be fully implemented.

    overcat Yes that’s correct. The “ and \ escaping work but not the escaping of non ascii characters. I’ll work on that and also produce a known issues section.

    Edit: Fixed the \n but still trying to figure out the non-ASCII characters...

    6 days later

    overcat Do you happen to have a transaction XDR that fails this conversion? I'm trying to find transactions where the JS implementation differs from the Go reference implementation but cannot.

      StellarGuard Please see if this XDR meets your requirements?

      AAAAAFVfweSWPl13mbB9OImqYMldc/S3X3V64/sNuDGTGDyBAAAAZAANP9YAAAABAAAAAAAAAAEAAAAMs2XCqtBevdw8Ee+ZAAAAAQAAAAAAAAAKAAAABWhlbGxvAAAAAAAAAQAAAAdwc2VsZGVuAAAAAAAAAAABkxg8gQAAAEAPdK3vJ713Q8MJHEZ8eTMH+fe0a+bH1uXElSvFJY0OK/w1J9HIkmXk4l9W30B4/jfmMGox0jfqTWwhncVdEQIN

      https://horizon-testnet.stellar.org/transactions/bc64bb9b3923b8e2d752e097fac04884c6894d109ac7c69fbb2a965afd9a3233

      Yes that's helpful.

      Unfortunately I'm not able to find a good solution right now... I'm trying to figure out the rules that the reference implementation is using to escape/unescape things.

      The reference implementation produces: \xb3eª\xd0^\xbd\xdc<\x11\xef\x99, which in JS-land represents this string: ³eªÐ^½Ü<\u0011ï

      Unfortunately when I send that same XDR into the stellar js sdk, I get different values for the memo:

      > new Transaction('AAAAAFVfweSWPl13mbB9OImqYMldc/S3X3V64/sNuDGTGDyBAAAAZAANP9YAAAABAAAAAAAAAAEAAAAMs2XCqtBe
      vdw8Ee+ZAAAAAQAAAAAAAAAKAAAABWhlbGxvAAAAAAAAAQAAAAdwc2VsZGVuAAAAAAAAAAABkxg8gQAAAEAPdK3vJ713Q8MJHEZ8eTMH+fe
      0a+bH1uXElSvFJY0OK/w1J9HIkmXk4l9W30B4/jfmMGox0jfqTWwhncVdEQIN').memo.value.toString('ascii')
      '3eB*P^=\\<\u0011o\u0019'
      
      > Memo.text('\xb3eª\xd0^\xbd\xdc<\x11\xef\x99').value.toString('ascii')
      '³eªÐ^½Ü<\u0011ï'

      I'm not sure how to proceed from there.

      I have this code to do the unescape -- but I'm not actually sure how I'd go the reverse direction... maybe look at the charCodeAt for each character and if it's outside of some range, do the hex encoding (I'm not sure what that range is supposed to be though).

      function unescapeHexCodes(line: string): string {
      return line.replace(/\\x([0-9A-Fa-f]{2})/g, (_, match) => {
      return String.fromCharCode(parseInt(match, 16));
      });
      }

      So for right now I'm stuck. Unless anyone else has any ideas.