0

Given a transaction id, how to get all actions of this transaction?

For example, this transaction 3871d503ec18800861f83851762455491c88e459e0c70d830ed0120134083501 has a inline action that calls another contract, so it has two actions in total.

I tried to use rpc.history_get_transaction():

const fetch = require('node-fetch'); // node only; not needed in browsers
const { JsonRpc } = require('eosjs');

const api_endpoint = 'https://eos.infstones.io';
const rpc = new JsonRpc(api_endpoint, { fetch });

(async ()=> {
  const response = await rpc.history_get_transaction(
    '3871d503ec18800861f83851762455491c88e459e0c70d830ed0120134083501',
    91197571,
  );
  console.info(response);
})();

The traces field in the response is an empty array, while it should be an array with two elements.

I found that rpc.get_table_rows() might be another way, but I don't know how to use it.

1

Calling history/get_transaction will return the transaction with all the data belonging to it.

You can find inline-traces in the "traces"-section of the returned json.

But be aware, the history-plugin has been deprecated so the endpoint is likely to change.

  • Thanks for your reply. Actually I tried this API at beginning, it can return almost all information about a transaction, but sadly traces is not included. – soulmachine Nov 24 '19 at 12:08

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.