API to disassemble TEAL program

I used the algod API /v2/applications/{application-id} to get the approval program base64 encoded. How would I disassemble it? I have tried using a simple base64 decoder but that doesn’t seem to work.

See API endpoint for disassembling TEAL scripts · Issue #1654 · algorand/go-algorand · GitHub

Let us know if this does not work.

In the issue it talks about bytecode. However I thought v2/applications/{application-id} returns base64 encoded. Anyway I tried using the dryrun hack and it doesn’t seem to work.

@fabrice What would be the minimum code needed to do this? This is what I have at the moment and I am getting the following error:
message: "failed to decode object: msgpack decode error [pos 1]: only encoded map or array can be decoded into a struct"

My code is as follows:

const app = await AlgoSigner.indexer({
      ledger: 'TestNet',
      path: '/v2/applications/15388224',
});

const dryrun = await AlgoSigner.algod({
      ledger: 'TestNet',
      path: '/v2/teal/dryrun',
      body: {
        sources: [{
          appIndex: 15388224,
          fieldName: 'approv',
          source: "string",
          txnIndex: 0
        }],
        round: 0,
        accounts: [],
        protocolVersion: 'future',
        latestTimestamp: 0,
        txns: [],
        apps: [{
          id: 15388224,
          params: app.application.params
        }],
      },
      method: 'POST',
      contentType: 'application/json',
});

I have no clue what sources should be - the documentation both in the code and on the docs is missing parts.

I don’t know what protocolVersion should be. On my local node it says future, not sure what this means.