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

[Bug]: Can't parse block by id, iota-sdk lib error #2242

Closed
1 task done
abcen7 opened this issue Apr 30, 2024 · 6 comments
Closed
1 task done

[Bug]: Can't parse block by id, iota-sdk lib error #2242

abcen7 opened this issue Apr 30, 2024 · 6 comments
Labels
bug Bug

Comments

@abcen7
Copy link

abcen7 commented Apr 30, 2024

Issue description

Can't parse a block

`
from iota_sdk import Client

node_url = "https://api.testnet.shimmer.network"

client = Client(nodes=[node_url])

block = client.get_block_data(
"0xe297baed348de994911ae0d5938d54301c8ce363d5d276604d257493d78d8e50")
`

dacite.exceptions.UnionMatchError: can not match type "dict" to any type of "payload" union: typing.Union[iota_sdk.types.payload.TaggedDataPayload, iota_sdk.types.payload.TransactionPayload, iota_sdk.types.payload.MilestonePayload, NoneType]

Version

iota-sdk 1.1.3
shimmer testnet

Founded 3.10.11 & 3.10.0

Expected behaviour

{'protocolVersion': 2, 'parents': ['0x2f5760d1010bf005094b77e1b8d5811cf7455a9093b9408cf2af0b95a1f2a805', '0x3ccae3cee2c09d1bd0e4d8fb8a23ab6e523eef98394c1ac4b781cc5149ea8aec', '0x90857ad10dbc5aaf0d78e5f6d9c307c8541d1e00cff61862383d69cec98dce83', '0xd38901542636b79282f99a793ae148ec8018cf22943073e46bcc4c58fb5318a5'], 'payload': {'type': 6, 'essence': {'type': 1, 'networkId': '7784367046153662236', 'inputs': [{'type':
0, 'transactionId': '0x1f990711d520528df4d2706be0ff01a6416461be8b958a9f54f15478c65fab77', 'transactionOutputIndex': 1}], 'inputsCommitment': '0xaa023fca4392050738312265c8ee0588ad779b0aaf7082dd0021afce93552660', 'outputs': [{'type': 3, 'amount': '1000000', 'unlockConditions': [{'type': 0, 'address': {'type': 0, 'pubKeyHash': '0xf2b586f6fdfc30dfc20303ea114bec934521649ad0c80a21d97cea84b0369728'}}]}, {'type': 3, 'amount': '535315792443', 'unlockConditions': [{'type': 0, 'address': {'type': 0, 'pubKeyHash': '0x53bb2ddca4a63179b77655af7dcb67a3f10816dfc7c2809f5eaa313e5d2223ad'}}]}], 'payload': {'type': 5, 'tag': '0x4255494c442e35'}}, 'unlocks': [{'type': 0, 'signature': {'type': 0, 'publicKey': '0xc8f83ca19656ae2dc39ded1aa9fcd2768823b0544a233f2eb5e547abf22f13b3', 'signature': '0x73dcff917b39710c9a8c5a2e15358ef19e677cad59f536b2fbad40d1a9512faddbde37c0052e5ef3f6a4c1820e4c9e0b2df1b80fbdc3832a8fc9ec019168910e'}}]}, 'nonce': '9223372036855597748'}

Actual behaviour

dacite.exceptions.UnionMatchError: can not match type "dict" to any type of "payload" union: typing.Union[iota_sdk.types.payload.TaggedDataPayload, iota_sdk.types.payload.TransactionPayload, iota_sdk.types.payload.MilestonePayload, NoneType]

Can the issue reliably be reproduced?

Yes

Steps to reproduce the issue

pip install iota-sdk
python3 test.py

test.py >>
`
from iota_sdk import Client

node_url = "https://api.testnet.shimmer.network"

client = Client(nodes=[node_url])

block = client.get_block_data(
"0xe297baed348de994911ae0d5938d54301c8ce363d5d276604d257493d78d8e50")
`

Errors

No response

Duplicate declaration

  • I have searched the issues tracker this issue and there is none
@github-project-automation github-project-automation bot moved this to Product Backlog in iota-sdk Apr 30, 2024
@abcen7
Copy link
Author

abcen7 commented Apr 30, 2024

Using a lib https://github.com/konradhalas/dacite with last contibute 1 years ago is bad idea, guys

@abcen7
Copy link
Author

abcen7 commented Apr 30, 2024

Depends for task, which need a solve from outsource konradhalas/dacite#58

@Thoralf-M
Copy link
Member

Using a lib konradhalas/dacite with last contibute 1 years ago is bad idea, guys

This was not the case when we added the dependency, but yes that is unfortunate
But regarding your issue, the typing is actually wrong in the sdk as the tagged data fields aren't optional, but the only way I found to get this working with dacite is to require the type field in the init
What do you think about this change? #1983

@Thoralf-M Thoralf-M added the bug Bug label May 2, 2024
@abcen7
Copy link
Author

abcen7 commented May 2, 2024

@Thoralf-M I think that's it what we need, how much time we need to wait for release fix? To be honest, we need it as fast as possible

@Thoralf-M
Copy link
Member

@abcen7 we released https://pypi.org/project/iota-sdk/1.1.4 where this should be fixed, please try that

@abcen7
Copy link
Author

abcen7 commented Jun 23, 2024

Tried, thanks for solving, finally we created mqtt-worker for outsource IOTA transactions! <3

@abcen7 abcen7 closed this as completed Jun 23, 2024
@github-project-automation github-project-automation bot moved this from Product Backlog to Done in iota-sdk Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug
Projects
Status: Done
Development

No branches or pull requests

2 participants