From bf22fadbc66e7ef9651b3f875626584f3fb834d2 Mon Sep 17 00:00:00 2001 From: Adam Dean <63186174+Crypto2099@users.noreply.github.com> Date: Thu, 11 May 2023 08:08:40 -0700 Subject: [PATCH] Update index.js Update extension/index.js to account for the fact that Blockfrost page limit is set to a maximum of 100. Providing a larger integer value to paginate.limit results in an error to the user. --- src/api/extension/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/api/extension/index.js b/src/api/extension/index.js index e7e761c1..eaaab2b3 100644 --- a/src/api/extension/index.js +++ b/src/api/extension/index.js @@ -288,7 +288,8 @@ export const getUtxos = async (amount = undefined, paginate = undefined) => { const currentAccount = await getCurrentAccount(); let result = []; let page = paginate && paginate.page ? paginate.page + 1 : 1; - const limit = paginate && paginate.limit ? `&count=${paginate.limit}` : ''; + let page_limit = paginate && paginate.limit ? Math.min(paginate.limit, 100) : false; + const limit = page_limit ? `&count=${page_limit}` : ''; while (true) { let pageResult = await blockfrostRequest( `/addresses/${currentAccount.paymentKeyHashBech32}/utxos?page=${page}${limit}`