Closed mika787 closed 3 years ago
Hi @mika787! I just tested your code and it seems to work fine.
I was able to connect an account and list transactions by running the exact same code you posted.
The error you mentioned would be in the line zabo.transactions.getList({
, suggesting that transactions
is undefined. However, I didn't find any problem in your code that would trigger the error.
Could you please test it again?
Thank you for responding. I'm not at my desk right now to retest but I will as soon as I get home. I thought it was strange because the crypto balance button worked and the exchange rates button worked. The metamask account I'm testing with doesn't have a balance so would that cause the error? If so I would rather it say you don't have any transactions. Also is there a dummy account with transactions I could use for testing?
On Mon, Jul 5, 2021, 2:01 PM Davi Reinke @.***> wrote:
Hi @mika787 https://github.com/mika787! I just tested your code and it seems to work fine. I was able to connect an account and list transactions by running the exact same code you posted. The error you mentioned would be in the line zabo.transactions.getList({, suggesting that transactions is undefined. However, I didn't find any problem in your code that would trigger the error. Could you please test it again?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zabo-api/zabo-sdk-js/issues/80#issuecomment-874094353, or unsubscribe https://github.com/notifications/unsubscribe-auth/AT45FAYU4QB7WIJ5KPHICETTWGULBANCNFSM47ZFF3QA .
No, an account with no balance would not cause this error, it would just return an empty list of transactions. In sandbox, you can connect an exchange account (Binance, Kraken, etc.) to get dummy balances and transactions.
Ok thanks I'll try that.
On Mon, Jul 5, 2021, 2:27 PM Davi Reinke @.***> wrote:
No, an account with no balance would not cause this error, it would just return an empty list of transactions. In sandbox, you can connect an exchange account (Binance, Kraken, etc.) to get dummy balances and transactions.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zabo-api/zabo-sdk-js/issues/80#issuecomment-874114503, or unsubscribe https://github.com/notifications/unsubscribe-auth/AT45FA4U4MQLLC5C4K2UH7TTWGXNRANCNFSM47ZFF3QA .
I ran the code again and I didn't get the getList error message. But I did get 'undefined' at line 95 which is console.log(moreHistory.data)
Any ideas?
On Mon, Jul 5, 2021, 2:27 PM Davi Reinke @.***> wrote:
No, an account with no balance would not cause this error, it would just return an empty list of transactions. In sandbox, you can connect an exchange account (Binance, Kraken, etc.) to get dummy balances and transactions.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zabo-api/zabo-sdk-js/issues/80#issuecomment-874114503, or unsubscribe https://github.com/notifications/unsubscribe-auth/AT45FA4U4MQLLC5C4K2UH7TTWGXNRANCNFSM47ZFF3QA .
This means that you don't have more transactions to paginate.
If you need more info about the SDK pagination, here is the docs: https://zabo.com/docs/?javascript--zabo-client#pagination
Also, here is a suggestion on how to implement a complete loop, considering the delay
, last_updated_at
and hasMore
properties...
async function getAllTransactions (params) {
const transactions = []
let page
while (true) {
const resp = await (page ? page.next() : zabo.transactions.getList(params))
const list = resp.data || []
const delay = resp.delay * 1000 // ms
const lastUpdatedAt = resp.last_updated_at
if (delay && !lastUpdatedAt) {
await new Promise(res => setTimeout(res, delay))
} else {
transactions.push(...list)
if (!resp.hasMore) break
page = resp
}
}
return transactions
}
For now, I'll close this issue since this is not a SDK error. Feel free to drop into our Discord if you have any other questions.
Thank you so much!
On Mon, Jul 5, 2021, 10:10 PM Davi Reinke @.***> wrote:
This means that you don't have more transactions to paginate. If you need more info about the SDK pagination, here is the docs: https://zabo.com/docs/?javascript--zabo-client#pagination Also, here is a suggestion on how to implement a complete loop, considering the delay, last_updated_at and hasMore properties...
async function getAllTransactions (params) { const transactions = []
let page while (true) { const resp = await (page ? page.next() : zabo.transactions.getList(params))
const list = resp.data || [] const delay = resp.delay * 1000 // ms const lastUpdatedAt = resp.last_updated_at if (delay && !lastUpdatedAt) { await new Promise(res => setTimeout(res, delay)) } else { transactions.push(...list) if (!resp.hasMore) break page = resp }
}
return transactions}
For now, I'll close this issue since this is not a SDK error. Feel free to drop into our Discord https://zabo.com/discord if you have any other questions.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zabo-api/zabo-sdk-js/issues/80#issuecomment-874330136, or unsubscribe https://github.com/notifications/unsubscribe-auth/AT45FA6VEZG4CHXEVRYK4W3TWINT7ANCNFSM47ZFF3QA .
What SDK version are you using?
1.0
What technology and versions are you using that is causing issues with the SDK?
I'm using the html script for client side
What did you do?
I copied the zabo script into my html file. I can connect to my Metamask wallet just fine. When I click the crypto balances button I get results as expected. When I click on the Account History button I get this error - "Uncaught TypeError: Cannot read property 'getList' of undefined at HTMLButtonElement." Did I leave something out? Not a professional, just trying to learn. Thanks in advance. Here is the script I used -
What did you expect to see?
What did you see instead?