1

I'm looking for a way to get the latest transaction recorded on a particular account. For example, I'm trying to get the latest transaction for "newdexpocket", how can I do that using nodejs?

Here's my code so far (-1 for pos isn't working, unfortunately):

const Eos = require('eosjs');

// Connect to a testnet or mainnet
const chain = {
    main: 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906', // main network
    jungle: '038f4b0fc8ff18a4f0842a8f0564611f6e96e8535901dd45e43ac8691a1c4dca', // jungle testnet
    sys: 'cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f' // local developer
};

const config = {
    expireInSeconds: 60,
    broadcast: true,
    verbose: false,
    sign: true,
    debug: false,
    httpEndpoint: 'https://api.eosnewyork.io',
    chainId: chain.main,
    //keyProvider: ['PrivateKeys...'], // WIF string or array of keys.. 
};

//const eos = Eos(config);
const eos = Eos(config);

eos.getActions("newdexpocket", 100000, 100).then(result => {
    console.log(result);
}).catch(error => {
    console.error(error)
});
  • Can you add a link to the documentation or source for this method? If you're referring to the history plugin, I think it is being deprecated and other methods will better suite your needs. – Ami Heines Nov 15 '18 at 10:00
  • Thanks for your answer, I did some research on my side as well and you're right, the plugin is being deprecated so I'll have to follow your advise and seek for alternative elsewhere ;-) Just in case, would you happen to know what's suppose to replace the history_plugin? – Linda Nov 15 '18 at 13:09
0

Demux is not a replacement for the history plugin but the right tool for this use case. Look for the demux example.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.