Skip to content
This repository was archived by the owner on Jan 13, 2023. It is now read-only.

Commit f596c1a

Browse files
authored
Merge pull request #335 from lzpap/release/3.1.0
Release 3.1.0b1
2 parents e0cdacb + 84a4dca commit f596c1a

21 files changed

+90
-925
lines changed

docs/core_api.rst

-5
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,6 @@ iri/references/api-reference>`__.
8484
.. automethod:: Iota.get_node_info
8585
.. automethod:: AsyncIota.get_node_info
8686

87-
``get_tips``
88-
------------
89-
.. automethod:: Iota.get_tips
90-
.. automethod:: AsyncIota.get_tips
91-
9287
``get_transactions_to_approve``
9388
-------------------------------
9489
.. automethod:: Iota.get_transactions_to_approve

docs/extended_api.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ tasks such as sending and receiving transfers.
5252
.. automethod:: Iota.get_inputs
5353
.. automethod:: AsyncIota.get_inputs
5454

55-
``get_latest_inclusion``
56-
------------------------
57-
.. automethod:: Iota.get_latest_inclusion
58-
.. automethod:: AsyncIota.get_latest_inclusion
59-
6055
``get_new_addresses``
6156
---------------------
6257
.. automethod:: Iota.get_new_addresses
@@ -72,6 +67,11 @@ tasks such as sending and receiving transfers.
7267
.. automethod:: Iota.get_transfers
7368
.. automethod:: AsyncIota.get_transfers
7469

70+
``is_confirmed``
71+
-----------------
72+
.. automethod:: Iota.is_confirmed
73+
.. automethod:: AsyncIota.is_confirmed
74+
7575
``is_promotable``
7676
-----------------
7777
.. automethod:: Iota.is_promotable

iota/api.py

+6-73
Original file line numberDiff line numberDiff line change
@@ -314,13 +314,11 @@ def find_transactions(
314314
def get_balances(
315315
self,
316316
addresses: Iterable[Address],
317-
threshold: int = 100,
318317
tips: Optional[Iterable[TransactionHash]] = None,
319318
) -> dict:
320319
"""
321-
Similar to :py:meth:`get_inclusion_states`. Returns the
322-
confirmed balance which a list of addresses have at the latest
323-
confirmed milestone.
320+
Returns the confirmed balance which a list of addresses have at the
321+
latest confirmed milestone.
324322
325323
In addition to the balances, it also returns the milestone as
326324
well as the index with which the confirmed balance was
@@ -330,9 +328,6 @@ def get_balances(
330328
:param Iterable[Address] addresses:
331329
List of addresses to get the confirmed balance for.
332330
333-
:param int threshold:
334-
Confirmation threshold between 0 and 100.
335-
336331
:param Optional[Iterable[TransactionHash]] tips:
337332
Tips whose history of transactions to traverse to find the balance.
338333
@@ -364,30 +359,23 @@ def get_balances(
364359
return asyncio.get_event_loop().run_until_complete(
365360
super().get_balances(
366361
addresses,
367-
threshold,
368362
tips,
369363
)
370364
)
371365

372366
def get_inclusion_states(
373367
self,
374368
transactions: Iterable[TransactionHash],
375-
tips: Iterable[TransactionHash]
376369
) -> dict:
377370
"""
378371
Get the inclusion states of a set of transactions. This is for
379372
determining if a transaction was accepted and confirmed by the
380-
network or not. You can search for multiple tips (and thus,
381-
milestones) to get past inclusion states of transactions.
373+
network or not.
382374
383375
:param Iterable[TransactionHash] transactions:
384376
List of transactions you want to get the inclusion state
385377
for.
386378
387-
:param Iterable[TransactionHash] tips:
388-
List of tips (including milestones) you want to search for
389-
the inclusion state.
390-
391379
:return:
392380
``dict`` with the following structure::
393381
@@ -410,10 +398,12 @@ def get_inclusion_states(
410398
return asyncio.get_event_loop().run_until_complete(
411399
super().get_inclusion_states(
412400
transactions,
413-
tips,
414401
)
415402
)
416403

404+
# Add an alias for this call, more descriptive
405+
is_confirmed = get_inclusion_states
406+
417407
def get_missing_transactions(self) -> dict:
418408
"""
419409
Returns all transaction hashes that a node is currently requesting
@@ -568,33 +558,6 @@ def get_node_info(self) -> dict:
568558
super().get_node_info()
569559
)
570560

571-
def get_tips(self) -> dict:
572-
"""
573-
Returns the list of tips (transactions which have no other
574-
transactions referencing them).
575-
576-
:return:
577-
``dict`` with the following structure::
578-
579-
{
580-
'hashes': List[TransactionHash],
581-
List of tip transaction hashes.
582-
'duration': int,
583-
Number of milliseconds it took to complete the request.
584-
}
585-
586-
References:
587-
588-
- https://docs.iota.org/docs/node-software/0.1/iri/references/api-reference#gettips
589-
- https://docs.iota.org/docs/dev-essentials/0.1/references/glossary
590-
"""
591-
592-
# Execute original coroutine inside an event loop to make this method
593-
# synchronous
594-
return asyncio.get_event_loop().run_until_complete(
595-
super().get_tips()
596-
)
597-
598561
def get_transactions_to_approve(
599562
self,
600563
depth: int,
@@ -1201,36 +1164,6 @@ def get_inputs(
12011164
)
12021165
)
12031166

1204-
def get_latest_inclusion(
1205-
self,
1206-
hashes: Iterable[TransactionHash]
1207-
) -> Dict[str, Dict[TransactionHash, bool]]:
1208-
"""
1209-
Fetches the inclusion state for the specified transaction
1210-
hashes, as of the latest milestone that the node has processed.
1211-
1212-
Effectively, this is :py:meth:`get_node_info` +
1213-
:py:meth:`get_inclusion_states`.
1214-
1215-
:param Iterable[TransactionHash] hashes:
1216-
List of transaction hashes.
1217-
1218-
:return:
1219-
``dict`` with the following structure::
1220-
1221-
{
1222-
"states": Dict[TransactionHash, bool]
1223-
``dict`` with one boolean per transaction hash in
1224-
``hashes``.
1225-
}
1226-
1227-
"""
1228-
# Execute original coroutine inside an event loop to make this method
1229-
# synchronous
1230-
return asyncio.get_event_loop().run_until_complete(
1231-
super().get_latest_inclusion(hashes)
1232-
)
1233-
12341167
def get_new_addresses(
12351168
self,
12361169
index: int = 0,

iota/api_async.py

+6-64
Original file line numberDiff line numberDiff line change
@@ -316,13 +316,11 @@ async def find_transactions(
316316
async def get_balances(
317317
self,
318318
addresses: Iterable[Address],
319-
threshold: int = 100,
320319
tips: Optional[Iterable[TransactionHash]] = None,
321320
) -> dict:
322321
"""
323-
Similar to :py:meth:`get_inclusion_states`. Returns the
324-
confirmed balance which a list of addresses have at the latest
325-
confirmed milestone.
322+
Returns the confirmed balance which a list of addresses have at the
323+
latest confirmed milestone.
326324
327325
In addition to the balances, it also returns the milestone as
328326
well as the index with which the confirmed balance was
@@ -332,9 +330,6 @@ async def get_balances(
332330
:param Iterable[Address] addresses:
333331
List of addresses to get the confirmed balance for.
334332
335-
:param int threshold:
336-
Confirmation threshold between 0 and 100.
337-
338333
:param Optional[Iterable[TransactionHash]] tips:
339334
Tips whose history of transactions to traverse to find the balance.
340335
@@ -362,29 +357,22 @@ async def get_balances(
362357
"""
363358
return await core.GetBalancesCommand(self.adapter)(
364359
addresses=addresses,
365-
threshold=threshold,
366360
tips=tips,
367361
)
368362

369363
async def get_inclusion_states(
370364
self,
371365
transactions: Iterable[TransactionHash],
372-
tips: Iterable[TransactionHash]
373366
) -> dict:
374367
"""
375368
Get the inclusion states of a set of transactions. This is for
376369
determining if a transaction was accepted and confirmed by the
377-
network or not. You can search for multiple tips (and thus,
378-
milestones) to get past inclusion states of transactions.
370+
network or not.
379371
380372
:param Iterable[TransactionHash] transactions:
381373
List of transactions you want to get the inclusion state
382374
for.
383375
384-
:param Iterable[TransactionHash] tips:
385-
List of tips (including milestones) you want to search for
386-
the inclusion state.
387-
388376
:return:
389377
``dict`` with the following structure::
390378
@@ -403,9 +391,11 @@ async def get_inclusion_states(
403391
"""
404392
return await core.GetInclusionStatesCommand(self.adapter)(
405393
transactions=transactions,
406-
tips=tips,
407394
)
408395

396+
# Add an alias, more descriptive
397+
is_confirmed = get_inclusion_states
398+
409399
async def get_missing_transactions(self) -> dict:
410400
"""
411401
Returns all transaction hashes that a node is currently requesting
@@ -540,28 +530,6 @@ async def get_node_info(self) -> dict:
540530
"""
541531
return await core.GetNodeInfoCommand(self.adapter)()
542532

543-
async def get_tips(self) -> dict:
544-
"""
545-
Returns the list of tips (transactions which have no other
546-
transactions referencing them).
547-
548-
:return:
549-
``dict`` with the following structure::
550-
551-
{
552-
'hashes': List[TransactionHash],
553-
List of tip transaction hashes.
554-
'duration': int,
555-
Number of milliseconds it took to complete the request.
556-
}
557-
558-
References:
559-
560-
- https://docs.iota.org/docs/node-software/0.1/iri/references/api-reference#gettips
561-
- https://docs.iota.org/docs/dev-essentials/0.1/references/glossary
562-
"""
563-
return await core.GetTipsCommand(self.adapter)()
564-
565533
async def get_transactions_to_approve(
566534
self,
567535
depth: int,
@@ -1123,32 +1091,6 @@ async def get_inputs(
11231091
securityLevel=security_level
11241092
)
11251093

1126-
async def get_latest_inclusion(
1127-
self,
1128-
hashes: Iterable[TransactionHash]
1129-
) -> Dict[str, Dict[TransactionHash, bool]]:
1130-
"""
1131-
Fetches the inclusion state for the specified transaction
1132-
hashes, as of the latest milestone that the node has processed.
1133-
1134-
Effectively, this is :py:meth:`get_node_info` +
1135-
:py:meth:`get_inclusion_states`.
1136-
1137-
:param Iterable[TransactionHash] hashes:
1138-
List of transaction hashes.
1139-
1140-
:return:
1141-
``dict`` with the following structure::
1142-
1143-
{
1144-
"states": Dict[TransactionHash, bool]
1145-
``dict`` with one boolean per transaction hash in
1146-
``hashes``.
1147-
}
1148-
1149-
"""
1150-
return await extended.GetLatestInclusionCommand(self.adapter)(hashes=hashes)
1151-
11521094
async def get_new_addresses(
11531095
self,
11541096
index: int = 0,

iota/commands/core/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from .get_neighbors import *
1818
from .get_node_api_configuration import *
1919
from .get_node_info import *
20-
from .get_tips import *
2120
from .get_transactions_to_approve import *
2221
from .get_trytes import *
2322
from .interrupt_attaching_to_tangle import *

iota/commands/core/get_balances.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,11 @@ def __init__(self) -> None:
3535
f.Unicode(encoding='ascii', normalize=False),
3636
),
3737

38-
'threshold':
39-
f.Type(int) |
40-
f.Min(0) |
41-
f.Max(100) |
42-
f.Optional(default=100),
43-
4438
'tips': StringifiedTrytesArray(TransactionHash),
4539
},
4640

4741
allow_missing_keys={
48-
'threshold', 'tips',
42+
'tips',
4943
},
5044
)
5145

iota/commands/core/get_inclusion_states.py

-9
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,5 @@ def __init__(self) -> None:
3131
# Required parameters.
3232
'transactions':
3333
StringifiedTrytesArray(TransactionHash) | f.Required,
34-
35-
# Optional parameters.
36-
'tips':
37-
StringifiedTrytesArray(TransactionHash) |
38-
f.Optional(default=[]),
39-
},
40-
41-
allow_missing_keys={
42-
'tips',
4334
},
4435
)

iota/commands/core/get_node_info.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import filters as f
22

3-
from iota import TransactionHash
3+
from iota import TransactionHash, Address
44
from iota.commands import FilterCommand, RequestFilter, ResponseFilter
55
from iota.filters import Trytes
66

@@ -34,6 +34,8 @@ def __init__(self) -> None:
3434
class GetNodeInfoResponseFilter(ResponseFilter):
3535
def __init__(self) -> None:
3636
super(GetNodeInfoResponseFilter, self).__init__({
37+
'coordinatorAddress':
38+
f.ByteString(encoding='ascii') | Trytes(Address),
3739
'latestMilestone':
3840
f.ByteString(encoding='ascii') | Trytes(TransactionHash),
3941

0 commit comments

Comments
 (0)