Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for API version 0.1.37 #21

Merged
merged 2 commits into from
Apr 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion blockfrost/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ def root(self, **kwargs):
epoch_stakes, \
epoch_pool_stakes, \
epoch_blocks, \
epoch_pool_blocks
epoch_pool_blocks, \
epoch_protocol_parameters
from .cardano.ledger import \
genesis
from .cardano.metadata import \
Expand Down
2 changes: 1 addition & 1 deletion blockfrost/api/cardano/epochs.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def epoch_pool_blocks(self, number: int, pool_id: str, **kwargs):


@request_wrapper
def epoch_latest_parameters(self, number: int, **kwargs):
def epoch_protocol_parameters(self, number: int, **kwargs):
"""
Return the protocol parameters for the epoch specified.

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

setup(
name='blockfrost-python',
version='0.4.3',
description='The official Python SDK for Blockfrost API v0.1.36',
version='0.4.4',
description='The official Python SDK for Blockfrost API v0.1.37',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/blockfrost/blockfrost-python',
Expand Down
26 changes: 21 additions & 5 deletions tests/test_cardano_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,38 @@ def test_account_rewards(requests_mock):
{
"epoch": 215,
"amount": "12695385",
"pool_id": "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy"
"pool_id": "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy",
"type": "member"
},
{
"epoch": 216,
"amount": "3586329",
"pool_id": "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy"
"pool_id": "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy",
"type": "member"
},
{
"epoch": 217,
"amount": "0",
"pool_id": "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy"
"amount": "1",
"pool_id": "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy",
"type": "member"
},
{
"epoch": 217,
"amount": "1337",
"pool_id": "pool1cytwr0n7eas6du2h2xshl8ypa1yqr18f0erlhhjcuczysiunjcs",
"type": "leader"
},
{
"epoch": 218,
"amount": "1395265",
"pool_id": "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy"
"pool_id": "pool1pu5jlj4q9w9jlxeu370a3c9myx47md5j5m2str0naunn2q3lkdy",
"type": "member"
},
{
"epoch": 218,
"amount": "500000000",
"pool_id": "pool1cytwr0n7eas6du2h2xshl8ypa1yqr18f0erlhhjcuczysiunjcs",
"type": "pool_deposit_refund"
}
]
requests_mock.get(f"{api.url}/accounts/{stake_address}/rewards", json=mock_data)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cardano_epochs.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,10 @@ def test_epoch_latest_parameters(requests_mock):
"coins_per_utxo_word": "34482"
}
requests_mock.get(f"{api.url}/epochs/{epoch}/parameters", json=mock_data)
assert api.epoch_latest_parameters(number=epoch) == convert_json_to_object(mock_data)
assert api.epoch_protocol_parameters(number=epoch) == convert_json_to_object(mock_data)


def test_integration_epoch_latest_parameters():
if os.getenv('BLOCKFROST_PROJECT_ID_MAINNET'):
api = BlockFrostApi(project_id=os.getenv('BLOCKFROST_PROJECT_ID_MAINNET'))
assert api.epoch_latest_parameters(number=epoch)
assert api.epoch_protocol_parameters(number=epoch)
8 changes: 8 additions & 0 deletions tests/test_cardano_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from blockfrost import BlockFrostApi, ApiError
from blockfrost.utils import convert_json_to_object

hash = "8f55e18a94e4c0951e5b8bd8910b2cb20aa4d742b1608fda3a06793d39fb07b1"
xpub = "d507c8f866691bd96e131334c355188b1a1d0b2fa0ab11545075aab332d77d9eb19657ad13ee581b56b0f8d744d66ca356b93d42fe176b3de007d53e9c4c4e7a"
role = 0
index = 0
Expand All @@ -25,3 +26,10 @@ def test_integration_utils_addresses_xpub():
if os.getenv('BLOCKFROST_PROJECT_ID_MAINNET'):
api = BlockFrostApi(project_id=os.getenv('BLOCKFROST_PROJECT_ID_MAINNET'))
assert api.utils_addresses_xpub(xpub, role, index)


def test_utils_transaction_evaluate(requests_mock):
api = BlockFrostApi()
mock_data = hash
requests_mock.post(f"{api.url}/utils/txs/evaluate", json=mock_data)
assert api.transaction_evaluate(file_path="./README.md") == convert_json_to_object(mock_data)