Skip to content

Commit

Permalink
Add missing Algod endpoints (algorand#189)
Browse files Browse the repository at this point in the history
* Add missing asset and application endpoints

* Remove string modifier
  • Loading branch information
jasonpaulos authored Apr 9, 2021
1 parent 9818320 commit d41a7df
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
unit:
behave --tags="@unit.offline or @unit.algod or @unit.indexer or @unit.rekey or @unit.tealsign or @unit.dryrun or @unit.responses or @unit.responses.231" test -f progress2
behave --tags="@unit.offline or @unit.algod or @unit.indexer or @unit.rekey or @unit.tealsign or @unit.dryrun or @unit.applications or @unit.responses or @unit.transactions or @unit.responses.231" test -f progress2

integration:
behave --tags="@algod or @assets or @auction or @kmd or @send or @template or @indexer or @indexer.applications or @rekey or @compile or @dryrun or @dryrun.testing or @applications or @applications.verified or @indexer.231" test -f progress2
Expand Down
20 changes: 20 additions & 0 deletions algosdk/v2client/algod.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,26 @@ def account_info(self, address, **kwargs):
"""
req = "/accounts/" + address
return self.algod_request("GET", req, **kwargs)

def asset_info(self, asset_id, **kwargs):
"""
Return information about a specific asset.
Args:
asset_id (int): The ID of the asset to look up.
"""
req = "/assets/" + str(asset_id)
return self.algod_request("GET", req, **kwargs)

def application_info(self, application_id, **kwargs):
"""
Return information about a specific application.
Args:
application_id (int): The ID of the application to look up.
"""
req = "/applications/" + str(application_id)
return self.algod_request("GET", req, **kwargs)

def pending_transactions_by_address(self, address, limit=0, response_format="json",
**kwargs):
Expand Down
14 changes: 14 additions & 0 deletions test/steps/v2_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,13 @@ def acc_info_any(context):
def parse_acc_info(context, address):
assert context.response["address"] == address

@when('we make a GetAssetByID call for assetID {asset_id}')
def asset_info(context, asset_id):
context.response = context.acl.asset_info(int(asset_id))

@when('we make a GetApplicationByID call for applicationID {app_id}')
def application_info(context, app_id):
context.response = context.acl.application_info(int(app_id))

@when('we make a Get Block call against block number {block} with format "{response_format}"')
def block(context, block, response_format):
Expand Down Expand Up @@ -586,6 +593,13 @@ def lookup_asset_any(context):
def parse_asset(context, index):
assert context.response["asset"]["index"] == int(index)

@when('we make a LookupApplications call with applicationID {app_id}')
def lookup_application(context, app_id):
context.response = context.icl.applications(int(app_id))

@when('we make a SearchForApplications call with applicationID {app_id}')
def search_application(context, app_id):
context.response = context.icl.search_applications(int(app_id))

@when(
'we make a Search Accounts call with assetID {index} limit {limit} currencyGreaterThan {currencyGreaterThan} currencyLessThan {currencyLessThan} and round {block}')
Expand Down

0 comments on commit d41a7df

Please sign in to comment.