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

WitnessRules from JSON not implemented #239

Closed
Devel484 opened this issue Dec 11, 2022 · 0 comments · Fixed by #240
Closed

WitnessRules from JSON not implemented #239

Devel484 opened this issue Dec 11, 2022 · 0 comments · Fixed by #240

Comments

@Devel484
Copy link

Recently Ghostmarktet started to use Witness Rules, due to that the python SDK has issues to parse a TX from JSON. The required code is not implemented and not integrated in the workflow.

Code to replicate:

tx = await rpc.get_transaction("5f0259d536ce6791422fbdbe55ce6231bde02d6b75699c260e45c02dbc4acfc2")
data = tx.to_json()
print(tx.to_array().hex())
# 001b7873027640b500000000006a04020000000000c81728000132ffcbc8c1acfa925bdc9fbe9d84402efae3f6b0400101030228c4b99f174fb822f7baccda9512c89fd9558d63cc20009a10100380b9ef9a850100000380f17000850100001002008c86470c13426c61636b2053776f726473446f67202334310c142a4c9a4d4022678b03ef1bbe0834f966460dc4480c1432ffcbc8c1acfa925bdc9fbe9d84402efae3f6b00c144546495affc96e953f2e6f4fbb85907fafb0d77b1ac01f0c096c697374546f6b656e0c14c4b99f174fb822f7baccda9512c89fd9558d63cc41627d5b5201420c40d4e11f618613e519cf23afc18a6e1e7379cf9bcd4ab57db1ded9629718153126591878c36b9fb2871ac384e80575e829e06998b5f0b59fe3e5c1d4a313de22bd280c21030bd21b48c934db4d1caab50e28d2d1b514ff9b7fc78d53c3d6e05b45b8966f1a4156e7b327
print(tx.signers[0].to_json())
# {'account': '0xb0f6e3fa2e40849dbe9fdc5b92faacc1c8cbff32', 'scopes': '', 'rules': [{'action': 'Allow', 'condition': {'type': 'Or', 'expressions': [{'type': 'CalledByContract', 'hash': '0xcc638d55d99fc81295daccbaf722b84f179fb9c4'}, {'type': 'CalledByEntry'}]}}]}
tx_from_json = Transaction.from_json(data)
print(tx_from_json.to_array().hex())
# 001b7873027640b500000000006a04020000000000c81728000132ffcbc8c1acfa925bdc9fbe9d84402efae3f6b000009a10100380b9ef9a850100000380f17000850100001002008c86470c13426c61636b2053776f726473446f67202334310c142a4c9a4d4022678b03ef1bbe0834f966460dc4480c1432ffcbc8c1acfa925bdc9fbe9d84402efae3f6b00c144546495affc96e953f2e6f4fbb85907fafb0d77b1ac01f0c096c697374546f6b656e0c14c4b99f174fb822f7baccda9512c89fd9558d63cc41627d5b5201420c40d4e11f618613e519cf23afc18a6e1e7379cf9bcd4ab57db1ded9629718153126591878c36b9fb2871ac384e80575e829e06998b5f0b59fe3e5c1d4a313de22bd280c21030bd21b48c934db4d1caab50e28d2d1b514ff9b7fc78d53c3d6e05b45b8966f1a4156e7b327
print(tx_from_json.signers[0].to_json()) 
# {'account': '0xb0f6e3fa2e40849dbe9fdc5b92faacc1c8cbff32', 'scopes': 'None'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant