Skip to content

Commit

Permalink
Fix loop termination by checking for empty list.
Browse files Browse the repository at this point in the history
  • Loading branch information
nessshon committed Sep 12, 2024
1 parent e7cf13e commit 68096aa
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pytonapi/async_tonapi/methods/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ async def get_all_nfts(
nft_items += result.nft_items
offset += limit

if len(result.nft_items) != limit:
if len(result.nft_items) == 0:
break

return NftItems(nft_items=nft_items)
Expand Down
2 changes: 1 addition & 1 deletion pytonapi/async_tonapi/methods/jettons.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async def get_all_holders(self, account_id: str) -> JettonHolders:
jetton_holders += result.addresses
offset += limit

if len(result.addresses) != limit:
if len(result.addresses) == 0:
break

return JettonHolders(addresses=jetton_holders, total=result.total)
Expand Down
2 changes: 1 addition & 1 deletion pytonapi/async_tonapi/methods/nft.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async def get_all_items_by_collection_address(self, account_id: str) -> NftItems
nft_items += result.nft_items
offset += limit

if len(result.nft_items) != limit:
if len(result.nft_items) == 0:
break

return NftItems(nft_items=nft_items)
Expand Down
2 changes: 1 addition & 1 deletion pytonapi/tonapi/methods/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def get_all_nfts(
nft_items += result.nft_items
offset += limit

if len(result.nft_items) != limit:
if len(result.nft_items) == 0:
break

return NftItems(nft_items=nft_items)
Expand Down
2 changes: 1 addition & 1 deletion pytonapi/tonapi/methods/jettons.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def get_all_holders(self, account_id: str) -> JettonHolders:
jetton_holders += result.addresses
offset += limit

if len(result.addresses) != limit:
if len(result.addresses) == 0:
break

return JettonHolders(addresses=jetton_holders, total=result.total)
Expand Down
2 changes: 1 addition & 1 deletion pytonapi/tonapi/methods/nft.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def get_all_items_by_collection_address(self, account_id: str) -> NftItems:
nft_items += result.nft_items
offset += limit

if len(result.nft_items) != limit:
if len(result.nft_items) == 0:
break

return NftItems(nft_items=nft_items)
Expand Down

0 comments on commit 68096aa

Please sign in to comment.