From fbbd7da811bb4adf142bb7d88590537e7ba0a8dc Mon Sep 17 00:00:00 2001 From: Uladzislau Hubar Date: Fri, 15 Mar 2024 13:29:25 +0100 Subject: [PATCH] Removed manual nonce setting, converted tx receipts in returns to dicts instead of AttributeDicts --- dkg/asset.py | 15 ++++++++------- dkg/providers/blockchain.py | 2 -- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/dkg/asset.py b/dkg/asset.py index e913822..ad002ec 100644 --- a/dkg/asset.py +++ b/dkg/asset.py @@ -15,6 +15,7 @@ # specific language governing permissions and limitations # under the License. +import json import math import re from typing import Literal, Type @@ -268,7 +269,7 @@ def create( result["UAL"] = format_ual( blockchain_id, content_asset_storage_address, token_id ) - result["operation"]["mintKnowledgeAsset"] = receipt + result["operation"]["mintKnowledgeAsset"] = json.loads(Web3.to_json(receipt)) assertions_list = [ { @@ -340,7 +341,7 @@ def transfer( return { "UAL": ual, "owner": new_owner, - "operation": receipt, + "operation": json.loads(Web3.to_json(receipt)), } _update = Method(NodeRequest.update) @@ -476,7 +477,7 @@ def cancel_update(self, ual: UAL) -> dict[str, UAL | TxReceipt]: return { "UAL": ual, - "operation": receipt, + "operation": json.loads(Web3.to_json(receipt)), } _burn_asset = Method(BlockchainRequest.burn_asset) @@ -486,7 +487,7 @@ def burn(self, ual: UAL) -> dict[str, UAL | TxReceipt]: receipt: TxReceipt = self._burn_asset(token_id) - return {"UAL": ual, "operation": receipt} + return {"UAL": ual, "operation": json.loads(Web3.to_json(receipt))} _get_assertion_ids = Method(BlockchainRequest.get_assertion_ids) _get_latest_assertion_id = Method(BlockchainRequest.get_latest_assertion_id) @@ -759,7 +760,7 @@ def extend_storing_period( return { "UAL": ual, - "operation": receipt, + "operation": json.loads(Web3.to_json(receipt)), } _get_assertion_size = Method(BlockchainRequest.get_assertion_size) @@ -819,7 +820,7 @@ def add_tokens( return { "UAL": ual, - "operation": receipt, + "operation": json.loads(Web3.to_json(receipt)), } _add_update_tokens = Method(BlockchainRequest.increase_asset_update_token_amount) @@ -876,7 +877,7 @@ def add_update_tokens( return { "UAL": ual, - "operation": receipt, + "operation": json.loads(Web3.to_json(receipt)), } def get_owner(self, ual: UAL) -> Address: diff --git a/dkg/providers/blockchain.py b/dkg/providers/blockchain.py index c1ca0d5..8bcc683 100644 --- a/dkg/providers/blockchain.py +++ b/dkg/providers/blockchain.py @@ -161,11 +161,9 @@ def call_function( "account." ) - nonce = self.w3.eth.get_transaction_count(self.w3.eth.default_account) gas_price = self.gas_price or gas_price or self._get_network_gas_price() options = { - "nonce": nonce, "gasPrice": gas_price, "gas": gas_limit or contract_function(**args).estimate_gas(), }