Skip to content

Commit

Permalink
Removed manual nonce setting, converted tx receipts in returns to dic…
Browse files Browse the repository at this point in the history
…ts instead of AttributeDicts
  • Loading branch information
br-41n committed Mar 15, 2024
1 parent 1c654e6 commit fbbd7da
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 8 additions & 7 deletions dkg/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.

import json
import math
import re
from typing import Literal, Type
Expand Down Expand Up @@ -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 = [
{
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 0 additions & 2 deletions dkg/providers/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
Expand Down

0 comments on commit fbbd7da

Please sign in to comment.