Skip to content

Commit

Permalink
Merge branch 'release/v1.11.0b1'
Browse files Browse the repository at this point in the history
  • Loading branch information
onetechnical committed Mar 18, 2022
2 parents 9d5ec1b + 6666011 commit 23354e9
Show file tree
Hide file tree
Showing 6 changed files with 326 additions and 11 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

# v1.11.0b1

## Added
- Support unlimited assets REST API changes. (#295)

## Changed
- Fix the cucumber test wording around block rounds in indexer asset balance lookup (#301)

# 1.10.0

## Added:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
UNITS = "@unit.abijson or @unit.algod or @unit.applications or @unit.atomic_transaction_composer or @unit.dryrun or @unit.feetest or @unit.indexer or @unit.indexer.logs or @unit.offline or @unit.rekey or @unit.transactions.keyreg or @unit.responses or @unit.responses.231 or @unit.tealsign or @unit.transactions or @unit.transactions.payment"
UNITS = "@unit.abijson or @unit.algod or @unit.applications or @unit.atomic_transaction_composer or @unit.dryrun or @unit.feetest or @unit.indexer or @unit.indexer.logs or @unit.offline or @unit.rekey or @unit.transactions.keyreg or @unit.responses or @unit.responses.231 or @unit.tealsign or @unit.transactions or @unit.transactions.payment or @unit.responses.unlimited_assets or @unit.indexer.ledger_refactoring or @unit.algod.ledger_refactoring"
unit:
behave --tags=$(UNITS) test -f progress2

Expand Down
31 changes: 29 additions & 2 deletions algosdk/v2client/algod.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,18 @@ def algod_request(
else:
return resp.read()

def account_info(self, address, **kwargs):
def account_info(self, address, exclude=None, **kwargs):
"""
Return account information.
Args:
address (str): account public key
"""
query = {}
if exclude:
query["exclude"] = exclude
req = "/accounts/" + address
return self.algod_request("GET", req, **kwargs)
return self.algod_request("GET", req, query, **kwargs)

def asset_info(self, asset_id, **kwargs):
"""
Expand All @@ -123,6 +126,30 @@ def application_info(self, application_id, **kwargs):
req = "/applications/" + str(application_id)
return self.algod_request("GET", req, **kwargs)

def account_asset_info(self, address, asset_id, **kwargs):
"""
Return asset information for a specific account.
Args:
address (str): account public key
asset_id (int): The ID of the asset to look up.
"""
query = {}
req = "/accounts/" + address + "/assets/" + str(asset_id)
return self.algod_request("GET", req, query, **kwargs)

def account_application_info(self, address, application_id, **kwargs):
"""
Return application information for a specific account.
Args:
address (str): account public key
application_id (int): The ID of the application to look up.
"""
query = {}
req = "/accounts/" + address + "/applications/" + str(application_id)
return self.algod_request("GET", req, query, **kwargs)

def pending_transactions_by_address(
self, address, limit=0, response_format="json", **kwargs
):
Expand Down
189 changes: 185 additions & 4 deletions algosdk/v2client/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def accounts(
application_id=None,
round_num=None,
include_all=False,
exclude=None,
**kwargs
):
"""
Expand Down Expand Up @@ -156,6 +157,8 @@ def accounts(
query["application-id"] = application_id
if include_all:
query["include-all"] = include_all
if exclude:
query["exclude"] = exclude
return self.indexer_request("GET", req, query, **kwargs)

def asset_balances(
Expand All @@ -165,8 +168,6 @@ def asset_balances(
next_page=None,
min_balance=None,
max_balance=None,
block=None,
round_num=None,
include_all=False,
**kwargs
):
Expand Down Expand Up @@ -208,7 +209,6 @@ def asset_balances(
query["currency-less-than"] = max_balance
if include_all:
query["include-all"] = include_all
_specify_round(query, block, round_num)
return self.indexer_request("GET", req, query, **kwargs)

def block_info(self, block=None, round_num=None, **kwargs):
Expand All @@ -227,7 +227,13 @@ def block_info(self, block=None, round_num=None, **kwargs):
return self.indexer_request("GET", req, **kwargs)

def account_info(
self, address, block=None, round_num=None, include_all=False, **kwargs
self,
address,
block=None,
round_num=None,
include_all=False,
exclude=None,
**kwargs
):
"""
Return account information.
Expand All @@ -247,6 +253,178 @@ def account_info(
_specify_round(query, block, round_num)
if include_all:
query["include-all"] = include_all
if exclude:
query["exclude"] = exclude

return self.indexer_request("GET", req, query, **kwargs)

def lookup_account_assets(
self,
address,
limit=None,
next_page=None,
asset_id=None,
block=None,
round_num=None,
include_all=False,
**kwargs
):
"""
Return asset information for a specific account.
Args:
address (str): account public key
limit (int, optional): maximum number of results to return
next_page (str, optional): the next page of results; use the next
token provided by the previous results
asset_id (int): include transactions for the specified
asset
block (int, optional): use results from the specified round
round_num (int, optional): alias for block; only specify one of
these
include_all (bool, optional): include all items including closed
accounts, deleted applications, destroyed assets, opted-out
asset holdings, and closed-out application localstates. Defaults
to false.
"""
req = "/accounts/" + address + "/assets"
query = dict()
if asset_id:
query["asset-id"] = asset_id
_specify_round(query, block, round_num)
if include_all:
query["include-all"] = "true"
if limit:
query["limit"] = limit
if next_page:
query["next"] = next_page

return self.indexer_request("GET", req, query, **kwargs)

def lookup_account_asset_by_creator(
self,
address,
limit=None,
next_page=None,
asset_id=None,
block=None,
round_num=None,
include_all=False,
**kwargs
):
"""
Return asset information created by a specific account.
Args:
address (str): account public key
limit (int, optional): maximum number of results to return
next_page (str, optional): the next page of results; use the next
token provided by the previous results
asset_id (int): include transactions for the specified
asset
block (int, optional): use results from the specified round
round_num (int, optional): alias for block; only specify one of
these
include_all (bool, optional): include all items including closed
accounts, deleted applications, destroyed assets, opted-out
asset holdings, and closed-out application localstates. Defaults
to false.
"""
req = "/accounts/" + address + "/created-assets"
query = dict()
if asset_id:
query["asset-id"] = asset_id
_specify_round(query, block, round_num)
if include_all:
query["include-all"] = "true"
if limit:
query["limit"] = limit
if next_page:
query["next"] = next_page

return self.indexer_request("GET", req, query, **kwargs)

def lookup_account_application_local_state(
self,
address,
limit=None,
next_page=None,
application_id=None,
block=None,
round_num=None,
include_all=False,
**kwargs
):
"""
Return application local state for a specific account.
Args:
address (str): account public key
limit (int, optional): maximum number of results to return
next_page (str, optional): the next page of results; use the next
token provided by the previous results
application_id (int, optional): restrict search to application index
block (int, optional): use results from the specified round
round_num (int, optional): alias for block; only specify one of
these
include_all (bool, optional): include all items including closed
accounts, deleted applications, destroyed assets, opted-out
asset holdings, and closed-out application localstates. Defaults
to false.
"""
req = "/accounts/" + address + "/apps-local-state"
query = dict()
if application_id:
query["application-id"] = application_id
_specify_round(query, block, round_num)
if include_all:
query["include-all"] = "true"
if limit:
query["limit"] = limit
if next_page:
query["next"] = next_page

return self.indexer_request("GET", req, query, **kwargs)

def lookup_account_application_by_creator(
self,
address,
limit=None,
next_page=None,
application_id=None,
block=None,
round_num=None,
include_all=False,
**kwargs
):
"""
Return asset information created by a specific account.
Args:
address (str): account public key
limit (int, optional): maximum number of results to return
next_page (str, optional): the next page of results; use the next
token provided by the previous results
application_id (int, optional): restrict search to application index
block (int, optional): use results from the specified round
round_num (int, optional): alias for block; only specify one of
these
include_all (bool, optional): include all items including closed
accounts, deleted applications, destroyed assets, opted-out
asset holdings, and closed-out application localstates. Defaults
to false.
"""
req = "/accounts/" + address + "/created-applications"
query = dict()
if application_id:
query["application-id"] = application_id
_specify_round(query, block, round_num)
if include_all:
query["include-all"] = "true"
if limit:
query["limit"] = limit
if next_page:
query["next"] = next_page

return self.indexer_request("GET", req, query, **kwargs)

Expand Down Expand Up @@ -670,6 +848,7 @@ def applications(
def search_applications(
self,
application_id=None,
creator=None,
round=None,
limit=None,
next_page=None,
Expand All @@ -695,6 +874,8 @@ def search_applications(
query = dict()
if application_id:
query["application-id"] = application_id
if creator:
query["creator"] = creator
_specify_round(query, round, round_num)
if limit:
query["limit"] = limit
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
description="Algorand SDK in Python",
author="Algorand",
author_email="[email protected]",
version="1.10.0",
version="v1.11.0b1",
long_description=long_description,
long_description_content_type="text/markdown",
license="MIT",
Expand Down
Loading

0 comments on commit 23354e9

Please sign in to comment.