<p>You can use chain of promises like this:</p>

<p><code>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(() =&gt; {
    /* begin custom code ------------------------------------ */
    const myAddress = 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn';
    console.log('getting account info for', myAddress);
    return api.getTransactions(myAddress);
}).then(info =&gt; {
    console.log(info);
    /* end custom code -------------------------------------- */
}).then(() =&gt; {
    return api.disconnect();
}).then(() =&gt; {
    console.log('done and disconnected.');
}).catch(console.error);</code></p>

<p>Good luck)</p>

CC BY-SA 4.0
2018-05-30T13:46:38.767Z
2018-05-30T13:46:38.767Z
Дима Марков
<p>My code is</p>

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

api.connect();

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

<p>But it doesn't actually return anything. It has an empty array <code>[]</code> for transactions.</p>

<p>If you look at the address I'm looking at: <a href="https://xrpcharts.ripple.com/#/graph/rqnfXCcsZRadjoj8tDQWYsP1pVyv3Ro7X" rel="nofollow noreferrer">https://xrpcharts.ripple.com/#/graph/rqnfXCcsZRadjoj8tDQWYsP1pVyv3Ro7X</a></p>

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

<ripple><ripple-api>
ripple-lib is not returning transactions with the getTransactions method
Shamoon
# ripple-lib is not returning transactions with the getTransactions method

(Asked by: username_0 on 2018-05-15)

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?

**Tags:** ripple, ripple-api


---

## 1 answers

### Answer by username_1 on 2018-05-30. Score: 1 | Accepted answer

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)


---

