diff --git a/lib/services/litescribe_api.dart b/lib/services/litescribe_api.dart index ab713e0f9..1acc047b8 100644 --- a/lib/services/litescribe_api.dart +++ b/lib/services/litescribe_api.dart @@ -46,13 +46,16 @@ class LitescribeAPI { '/address/inscriptions?address=$address&cursor=$cursor&size=$size'); // Check if the number of returned inscriptions equals the limit - final list = response.data['result']['list']; final int total = response.data['result']['total'] as int; + int currentSize = 0; - if (list != null) { - currentSize = list.length as int; + if (total == 0) { + return []; } + final list = response.data['result']!['list']; + currentSize = list.length as int; + if (currentSize == size && currentSize < total) { // If the number of returned inscriptions equals the limit and there are more inscriptions available, // increment the cursor and make the next API call to fetch the remaining inscriptions.