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

Commit

Permalink
Merge pull request #189 from oskyk/186-find-tx-bundle-hash
Browse files Browse the repository at this point in the history
usage of bundle hash by find_transactions
  • Loading branch information
todofixthis committed Jun 28, 2018
2 parents 3f0f132 + f17d6e3 commit b3bc935
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions iota/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from six import with_metaclass

from iota import AdapterSpec, Address, ProposedTransaction, Tag, \
TransactionHash, TransactionTrytes, TryteString, TrytesCompatible
BundleHash, TransactionHash, TransactionTrytes, TryteString, TrytesCompatible
from iota.adapter import BaseAdapter, resolve_adapter
from iota.commands import BaseCommand, CustomCommand, core, \
discover_commands, extended
Expand Down Expand Up @@ -242,7 +242,7 @@ def check_consistency(self, tails):

def find_transactions(
self,
bundles=None, # type: Optional[Iterable[TransactionHash]]
bundles=None, # type: Optional[Iterable[BundleHash]]
addresses=None, # type: Optional[Iterable[Address]]
tags=None, # type: Optional[Iterable[Tag]]
approvees=None, # type: Optional[Iterable[TransactionHash]]
Expand All @@ -260,7 +260,7 @@ def find_transactions(
the values.
:param bundles:
List of transaction IDs.
List of bundle IDs.
:param addresses:
List of addresses.
Expand Down
4 changes: 2 additions & 2 deletions iota/commands/core/find_transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import filters as f
from six import iteritems

from iota import Tag, TransactionHash
from iota import Tag, TransactionHash, BundleHash
from iota.commands import FilterCommand, RequestFilter, ResponseFilter
from iota.filters import AddressNoChecksum, Trytes

Expand Down Expand Up @@ -56,7 +56,7 @@ def __init__(self):
'bundles':
f.Array | f.FilterRepeater(
f.Required |
Trytes(TransactionHash) |
Trytes(BundleHash) |
f.Unicode(encoding='ascii', normalize=False),
),

Expand Down
24 changes: 12 additions & 12 deletions test/commands/core/find_transactions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from filters.test import BaseFilterTestCase
from six import text_type

from iota import Address, Iota, Tag, TransactionHash, TryteString
from iota import Address, Iota, Tag, BundleHash, TransactionHash, TryteString
from iota.adapter import MockAdapter
from iota.commands.core.find_transactions import FindTransactionsCommand, \
FindTransactionsRequestFilter
Expand Down Expand Up @@ -36,8 +36,8 @@ def test_pass_all_parameters(self):
# Raw trytes are extracted to match the IRI's JSON protocol.
request = {
'bundles': [
text_type(TransactionHash(self.trytes1)),
text_type(TransactionHash(self.trytes2)),
text_type(BundleHash(self.trytes1)),
text_type(BundleHash(self.trytes2)),
],

'addresses': [
Expand Down Expand Up @@ -69,7 +69,7 @@ def test_pass_compatible_types(self):
filter_ = self._filter({
'bundles': [
self.trytes1.encode('ascii'),
TransactionHash(self.trytes2),
BundleHash(self.trytes2),
],

'addresses': [
Expand All @@ -95,8 +95,8 @@ def test_pass_compatible_types(self):
{
# Raw trytes are extracted to match the IRI's JSON protocol.
'bundles': [
text_type(TransactionHash(self.trytes1)),
text_type(TransactionHash(self.trytes2)),
text_type(BundleHash(self.trytes1)),
text_type(BundleHash(self.trytes2)),
],

'addresses': [
Expand All @@ -122,8 +122,8 @@ def test_pass_bundles_only(self):
"""
request = {
'bundles': [
TransactionHash(self.trytes1),
TransactionHash(self.trytes2),
BundleHash(self.trytes1),
BundleHash(self.trytes2),
],
}

Expand All @@ -135,8 +135,8 @@ def test_pass_bundles_only(self):

{
'bundles': [
text_type(TransactionHash(self.trytes1)),
text_type(TransactionHash(self.trytes2)),
text_type(BundleHash(self.trytes1)),
text_type(BundleHash(self.trytes2)),
],

# Null criteria are not included in the request.
Expand Down Expand Up @@ -292,7 +292,7 @@ def test_fail_unexpected_parameters(self):
{
'addresses': [Address(self.trytes1)],
'approvees': [TransactionHash(self.trytes1)],
'bundles': [TransactionHash(self.trytes1)],
'bundles': [BundleHash(self.trytes1)],
'tags': [Tag(self.trytes1)],

# Hey, you're not allowed in he-argh!
Expand All @@ -310,7 +310,7 @@ def test_fail_bundles_wrong_type(self):
"""
self.assertFilterErrors(
{
'bundles': TransactionHash(self.trytes1),
'bundles': BundleHash(self.trytes1),
},

{
Expand Down

0 comments on commit b3bc935

Please sign in to comment.