ripple-lib is not returning transactions with the getTransactions method

0

My code is

const api = new RippleAPI({
  server: 'wss://s1.ripple.com'
});

api.connect();

    let isConnected = false;
    api.on('connected', () => {
      isConnected = true;
    });
      return api.getTransactions(address)
        .then((transactions) => {
          console.log(transactions);
        })
        .catch((err) => {
          console.log(err);
        })

But it doesn't actually return anything. It has an empty array [] for transactions.

If you look at the address I'm looking at: https://xrpcharts.ripple.com/#/graph/rqnfXCcsZRadjoj8tDQWYsP1pVyv3Ro7X

You'll see there are some transactions. So why doesn't the API return anything?

Shamoon

Posted 2018-05-15T02:48:22.590

Reputation: 2 689

Answers

1

You can use chain of promises like this:

const RippleAPI = require('ripple-lib').RippleAPI; var test_server = 'wss://s2.ripple.com'; const api = new RippleAPI({ server: test_server // Public rippled server }); api.connect().then(() => { /* begin custom code ------------------------------------ */ const myAddress = 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn'; console.log('getting account info for', myAddress); return api.getTransactions(myAddress); }).then(info => { console.log(info); /* end custom code -------------------------------------- */ }).then(() => { return api.disconnect(); }).then(() => { console.log('done and disconnected.'); }).catch(console.error);

Good luck)

Дима Марков

Posted 2018-05-15T02:48:22.590

Reputation: 314