What format are these Buffers in?

Completed a transaction and received this object back from the algosdk 0.13.0-beta.2 implementation of waitForConfirmation():

{
  'confirmed-round': 18457512,
  'pool-error': '',
  'sender-rewards': 26250,
  txn: {
    sig: <Buffer 6e 7d 32 85 f7 17 a4 22 4d f4 fa 87 9c 19 28 19 86 84 b5 a2 41 97 26 28 3e 83 1b 14 67 b3 09 f6 cf 48 0e 0f 1d 4d 14 6a 4b a5 d8 49 10 ea 5f ed c6 39 ... 14 more bytes>,
    txn: {
      aamt: 1000,
      arcv: <Buffer e6 55 ba 3c b1 4f b9 b2 4e d2 b6 79 84 dc fb 5c 26 bd 16 84 47 84 89 fc e4 75 72 bf 25 c4 15 62>,
      fee: 1000,
      fv: 18457509,
      gen: 'mainnet-v1.0',
      gh: <Buffer c0 61 c4 d8 fc 1d bd de d2 d7 60 4b e4 56 8e 3f 6d 04 19 87 ac 37 bd e4 b6 20 b5 ab 39 24 8a df>,
      lv: 18458509,
      snd: <Buffer 08 d5 00 3a 6c 2e ba 95 57 fe b4 4f 2f c1 52 e6 c7 36 d3 dc ad 6f c3 c7 df a1 c4 4d f8 e4 3e 8f>,
      type: 'axfer',
      xaid: 393155456
    }
  }
}

All the docs just show the return of transaction objects in plain text: Structure - Algorand Developer Portal How do I decode those buffers? I mainly care about the snd and arcv fields so I can verify where it went. Are they base64, utf8, msgpack…

It seems like it would be much more developer friendly if these were already decoded for us! :slight_smile:

Those are the address bytes. You should be able to get the string address using something like:

const rec = algosdk.encodeAddress(confirmation.txn.txn.rcv);

or for an asset

const rec = algosdk.encodeAddress(confirmation.txn.txn.arcv);

2 Likes

That was it, thank you sir!