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)
});