Skip to content

Commit 18dddb1

Browse files
committed
Add new API endpoints for Blockfrost API v0.1.85
Update the SDK to match all API changes since v0.1.37, including: - Accounts: account_utxos (v0.1.69), account_transactions (v0.1.82) - Blocks: block_latest_transactions_cbor (v0.1.74), block_transactions_cbor (v0.1.75) - Transactions: transaction_required_signers (v0.1.61), transaction_cbor (v0.1.64) - Network: network_eras (v0.1.46) - Governance (new): Full Conway-era governance support with DRep and proposal endpoints including dreps listing, drep details, delegators, metadata, updates, votes, proposals listing, proposal details, parameters, withdrawals, votes, and metadata Bump version to 0.7.0 (API v0.1.85). All 211 tests pass. https://claude.ai/code/session_01FSq7HNQWih59Y5NX349Diq
1 parent cb7418e commit 18dddb1

12 files changed

Lines changed: 990 additions & 5 deletions

blockfrost/api/__init__.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ def root(self, **kwargs):
5757
account_mirs, \
5858
account_addresses, \
5959
account_addresses_assets, \
60-
account_addresses_total
60+
account_addresses_total, \
61+
account_utxos, \
62+
account_transactions
6163
from .cardano.addresses import \
6264
address, \
6365
address_extended, \
@@ -75,12 +77,14 @@ def root(self, **kwargs):
7577
from .cardano.blocks import \
7678
block_latest, \
7779
block_latest_transactions, \
80+
block_latest_transactions_cbor, \
7881
block, \
7982
block_slot, \
8083
block_epoch_slot, \
8184
blocks_next, \
8285
blocks_previous, \
8386
block_transactions, \
87+
block_transactions_cbor, \
8488
blocks_addresses
8589
from .cardano.epochs import \
8690
epoch_latest, \
@@ -104,7 +108,8 @@ def root(self, **kwargs):
104108
metadata_label_json, \
105109
metadata_label_cbor
106110
from .cardano.network import \
107-
network
111+
network, \
112+
network_eras
108113
from .cardano.pools import \
109114
pools, \
110115
pools_extended, \
@@ -131,6 +136,8 @@ def root(self, **kwargs):
131136
transaction_submit, \
132137
transaction_submit_cbor, \
133138
transaction_redeemers, \
139+
transaction_required_signers, \
140+
transaction_cbor, \
134141
transaction_evaluate, \
135142
transaction_evaluate_cbor, \
136143
transaction_evaluate_utxos
@@ -142,5 +149,18 @@ def root(self, **kwargs):
142149
script_redeemers, \
143150
script_datum, \
144151
script_datum_cbor
152+
from .cardano.governance import \
153+
governance_dreps, \
154+
governance_drep, \
155+
governance_drep_delegators, \
156+
governance_drep_metadata, \
157+
governance_drep_updates, \
158+
governance_drep_votes, \
159+
governance_proposals, \
160+
governance_proposal, \
161+
governance_proposal_parameters, \
162+
governance_proposal_withdrawals, \
163+
governance_proposal_votes, \
164+
governance_proposal_metadata
145165
from .cardano.utils import \
146166
utils_addresses_xpub

blockfrost/api/cardano/accounts.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,68 @@ def account_addresses_assets(self, stake_address: str, **kwargs):
274274
)
275275

276276

277+
@list_request_wrapper
278+
def account_utxos(self, stake_address: str, **kwargs):
279+
"""
280+
Obtain information about UTXOs of a specific account.
281+
282+
https://docs.blockfrost.io/#tag/Cardano-Accounts/paths/~1accounts~1{stake_address}~1utxos/get
283+
284+
:param stake_address: Bech32 stake address.
285+
:type stake_address: str
286+
:param return_type: Optional. "object", "json" or "pandas". Default: "object".
287+
:type return_type: str
288+
:param gather_pages: Optional. Default: false. Will collect all pages into one return
289+
:type gather_pages: bool
290+
:param count: Optional. Default: 100. The number of results displayed on one page.
291+
:type count: int
292+
:param page: Optional. The page number for listing the results.
293+
:type page: int
294+
:param order: Optional. "asc" or "desc". Default: "asc".
295+
:type order: str
296+
:returns A list of objects.
297+
:rtype [Namespace]
298+
:raises ApiError: If API fails
299+
:raises Exception: If the API response is somehow malformed.
300+
"""
301+
return requests.get(
302+
url=f"{self.url}/accounts/{stake_address}/utxos",
303+
params=self.query_parameters(kwargs),
304+
headers=self.default_headers
305+
)
306+
307+
308+
@list_request_wrapper
309+
def account_transactions(self, stake_address: str, **kwargs):
310+
"""
311+
Obtain information about transactions associated with a specific account.
312+
313+
https://docs.blockfrost.io/#tag/Cardano-Accounts/paths/~1accounts~1{stake_address}~1transactions/get
314+
315+
:param stake_address: Bech32 stake address.
316+
:type stake_address: str
317+
:param return_type: Optional. "object", "json" or "pandas". Default: "object".
318+
:type return_type: str
319+
:param gather_pages: Optional. Default: false. Will collect all pages into one return
320+
:type gather_pages: bool
321+
:param count: Optional. Default: 100. The number of results displayed on one page.
322+
:type count: int
323+
:param page: Optional. The page number for listing the results.
324+
:type page: int
325+
:param order: Optional. "asc" or "desc". Default: "asc".
326+
:type order: str
327+
:returns A list of objects.
328+
:rtype [Namespace]
329+
:raises ApiError: If API fails
330+
:raises Exception: If the API response is somehow malformed.
331+
"""
332+
return requests.get(
333+
url=f"{self.url}/accounts/{stake_address}/transactions",
334+
params=self.query_parameters(kwargs),
335+
headers=self.default_headers
336+
)
337+
338+
277339
@request_wrapper
278340
def account_addresses_total(self, stake_address: str, **kwargs):
279341
"""

blockfrost/api/cardano/blocks.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,62 @@ def block_transactions(self, hash_or_number: str, **kwargs):
204204
)
205205

206206

207+
@list_request_wrapper
208+
def block_latest_transactions_cbor(self, **kwargs):
209+
"""
210+
Return the transactions within the latest block in CBOR format.
211+
212+
https://docs.blockfrost.io/#tag/Cardano-Blocks/paths/~1blocks~1latest~1txs~1cbor/get
213+
214+
:param gather_pages: Optional. Default: false. Will collect all pages into one return
215+
:type gather_pages: bool
216+
:param count: Optional. Default: 100. The number of results displayed on one page.
217+
:type count: int
218+
:param page: Optional. The page number for listing the results.
219+
:type page: int
220+
:param order: Optional. "asc" or "desc". Default: "asc".
221+
:type order: str
222+
:returns A list of objects.
223+
:rtype [Namespace]
224+
:raises ApiError: If API fails
225+
:raises Exception: If the API response is somehow malformed.
226+
"""
227+
return requests.get(
228+
url=f"{self.url}/blocks/latest/txs/cbor",
229+
params=self.query_parameters(kwargs),
230+
headers=self.default_headers
231+
)
232+
233+
234+
@list_request_wrapper
235+
def block_transactions_cbor(self, hash_or_number: str, **kwargs):
236+
"""
237+
Return the transactions within the block in CBOR format.
238+
239+
https://docs.blockfrost.io/#tag/Cardano-Blocks/paths/~1blocks~1{hash_or_number}~1txs~1cbor/get
240+
241+
:param hash_or_number: Hash or number of the requested block.
242+
:type hash_or_number: str
243+
:param gather_pages: Optional. Default: false. Will collect all pages into one return
244+
:type gather_pages: bool
245+
:param count: Optional. Default: 100. The number of results displayed on one page.
246+
:type count: int
247+
:param page: Optional. The page number for listing the results.
248+
:type page: int
249+
:param order: Optional. "asc" or "desc". Default: "asc".
250+
:type order: str
251+
:returns A list of objects.
252+
:rtype [Namespace]
253+
:raises ApiError: If API fails
254+
:raises Exception: If the API response is somehow malformed.
255+
"""
256+
return requests.get(
257+
url=f"{self.url}/blocks/{hash_or_number}/txs/cbor",
258+
params=self.query_parameters(kwargs),
259+
headers=self.default_headers
260+
)
261+
262+
207263
@list_request_wrapper
208264
def blocks_addresses(self, hash_or_number: str, **kwargs):
209265
"""

0 commit comments

Comments
 (0)