From f1a286b90d162f21861cb08ada7bd2d780ad026b Mon Sep 17 00:00:00 2001 From: Stephen Hawking Date: Sun, 10 Mar 2024 16:02:57 +0330 Subject: [PATCH] debug: fix struct order for mint funciton --- commands/mint.py | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/commands/mint.py b/commands/mint.py index 1b69cad..fdf6f83 100644 --- a/commands/mint.py +++ b/commands/mint.py @@ -7,13 +7,16 @@ import json + class MintContext: src_burn_addr: str dst_addr: str encrypted: bool priv_fee_payer: str - def __init__(self, src_burn_addr: str, dst_addr: str, encrypted: bool, priv_fee_payer: str): + def __init__( + self, src_burn_addr: str, dst_addr: str, encrypted: bool, priv_fee_payer: str + ): self.src_burn_addr = src_burn_addr self.dst_addr = dst_addr self.encrypted = encrypted @@ -43,7 +46,9 @@ def mint_cmd(network: Network, context: MintContext): proof = w3.eth.get_proof(burn_addr.address, [], block_number) (prefix, state_root, postfix) = get_block_splited_information(block) - (layers, root_proof, mid_proofs, last_proof) = get_proof_of_burn(burn_addr, coin.salt.val, context.encrypted, block, proof) + (layers, root_proof, mid_proofs, last_proof) = get_proof_of_burn( + burn_addr, coin.salt.val, context.encrypted, block, proof + ) target = context.dst_addr @@ -51,29 +56,33 @@ def mint_cmd(network: Network, context: MintContext): block_number, coin.get_value(), nullifier, - layers, root_proof, - mid_proofs, last_proof, context.encrypted, target, - prefix, state_root, + layers, + mid_proofs, + prefix, postfix, ] - contract = w3.eth.contract(address=network.burnth_contract_addr, abi=json.load(open("abis/Burnth.abi"))) + contract = w3.eth.contract( + address=network.burnth_contract_addr, abi=json.load(open("abis/Burnth.abi")) + ) address = w3.eth.account.from_key(context.priv_fee_payer).address nonce = w3.eth.get_transaction_count(address) gas_price = w3.eth.gas_price - txn = contract.functions.mint(contract_feed).build_transaction({ - 'chainId': network.chain_id, - 'gas': 7000000, - "maxFeePerGas": gas_price, - "maxPriorityFeePerGas": gas_price // 2, - 'nonce': nonce, - }) + txn = contract.functions.mint(contract_feed).build_transaction( + { + "chainId": network.chain_id, + "gas": 7000000, + "maxFeePerGas": gas_price, + "maxPriorityFeePerGas": gas_price // 2, + "nonce": nonce, + } + ) signed = w3.eth.account.sign_transaction(txn, context.priv_fee_payer) tx_hash = w3.eth.send_raw_transaction(signed.rawTransaction)