Skip to content

Commit

Permalink
some more missed
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex6323 committed Dec 12, 2023
1 parent 8a45b7f commit 7487649
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 16 deletions.
4 changes: 2 additions & 2 deletions bindings/python/examples/client/08_data_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
TaggedDataPayload(
utf8_to_hex("tag"),
utf8_to_hex("data")))[0]
signed_block = secret_manager.sign_block(unsigned_block, chain)
block_id = client.post_block(signed_block)
block = secret_manager.sign_block(unsigned_block, chain)
block_id = client.post_block(block)

print(f'Data block sent: {os.environ["EXPLORER_URL"]}/block/{block_id}')

Expand Down
4 changes: 2 additions & 2 deletions bindings/python/examples/client/post_raw_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
TaggedDataPayload(
utf8_to_hex("tag"),
utf8_to_hex("data")))[0]
signed_block = secret_manager.sign_block(unsigned_block, chain)
block_id = client.post_block(signed_block)
block = secret_manager.sign_block(unsigned_block, chain)
block_id = client.post_block(block)
blockBytes = client.get_block_raw(block_id)

# Post raw block
Expand Down
6 changes: 3 additions & 3 deletions bindings/python/examples/client/submit_and_read_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@
TaggedDataPayload(
utf8_to_hex("tag"),
utf8_to_hex("data")))
signed_block = secret_manager.sign_block(unsigned_block, chain)
block_id = client.post_block(signed_block)
block = secret_manager.sign_block(unsigned_block, chain)
block_id = client.post_block(block)

print('\nThe block ID for your submitted block is:')
print(f' {block_id}')

print('\nMetadata for your submitted block is:')
print(f' {signed_block}')
print(f' {block}')

########################################################
# Step 3: Use the block ID to read the payload back
Expand Down
1 change: 0 additions & 1 deletion bindings/python/iota_sdk/types/block/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from dataclasses import dataclass
from typing import Optional
from iota_sdk.types.common import HexStr, json
# TODO rename change to Block
from iota_sdk.types.block.block import Block


Expand Down
2 changes: 1 addition & 1 deletion bindings/python/iota_sdk/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# Required to prevent circular import
if TYPE_CHECKING:
from iota_sdk.types.block.signed_block import Block
from iota_sdk.types.block.block import Block

# pylint: disable=too-many-public-methods

Expand Down
14 changes: 7 additions & 7 deletions bindings/python/tests/test_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ def test_signed_block_with_tagged_data_payload():
"signature": "0x7c274e5e771d5d60202d334f06773d3672484b1e4e6f03231b4e69305329267a4834374b0f2e0d5c6c2f7779620f4f534c773b1679400c52303d1f23121a4049"
}
}
signed_block = Block.from_dict(block_dict)
assert signed_block.to_dict() == block_dict
assert isinstance(signed_block.block, BasicBlockBody)
assert signed_block.block.type == BlockBodyType.Basic
assert isinstance(signed_block.block.payload, get_args(Payload))
assert signed_block.block.payload.type == PayloadType.TaggedData
block = Block.from_dict(block_dict)
assert block.to_dict() == block_dict
assert isinstance(block.body, BasicBlockBody)
assert block.body.type == BlockBodyType.Basic
assert isinstance(block.body.payload, get_args(Payload))
assert block.body.payload.type == PayloadType.TaggedData
# TODO: determine the actual hash of the block
# assert signed_block.id() == "0x7ce5ad074d4162e57f83cfa01cd2303ef5356567027ce0bcee0c9f57bc11656e"
# assert block.id() == "0x7ce5ad074d4162e57f83cfa01cd2303ef5356567027ce0bcee0c9f57bc11656e"


@pytest.mark.skip(reason="https://github.com/iotaledger/iota-sdk/issues/1387")
Expand Down

0 comments on commit 7487649

Please sign in to comment.