Coinbase Pro Node.js API: How to get response using promises?

734 views Asked by At

I'm using the Coinbase Pro official Node.js client library.

How do I access the response object after making a request using promises?

My use case: I'm calling authedClient.getFills() and want to use response.headers['cb-after'] in my next request to get the next page of data. Ultimately, I'm trying to make a function called getAllFills that would get all the pages of fills (one after the other) for a specific product ID.

1

There are 1 answers

0
ma11hew28 On

You can't. To access the response object, you must use the callback API.

Their promise API doesn't expose the response object. You can see this if you look at the PublicClient.makeRequestCallback() method in /lib/clients/public.js of the Coinbase Pro Node.js API source code on GitHub.