1

I'm trying to call a smart contract function using web3py; the idea is to mint a token using a wallets private key. I've done it before in web3.js but I'm not sure how to move forward with web3py.

I'm not sure about the txdict variable; what will be the value of data?

{
  to: ''
  data: ''
  gas: ''
  gasPrice: ''
}

Suggestions will be appreciated!

from web3 import Web3
infura_url = '...'
w3 = Web3(Web3.HTTPProvider(infura_url))
abi = '...'
address = '...'
privateKey = '...'
contract_instance = w3.eth.contract(address=address, abi=abi)

payload = [
    [
        5,  # Add editions count
        '0x0000000000000000000000000000000000000000',  # Add creators address
        '0x0000000000000000000000000000000000000000',
        0,
        '',  # Add metadata url
        5,  # Add editions count
    ],
]

tx_hash = contract_instance.functions.oboCreateManyMediasAndReleases(
    payload).transact()

tx_dict = '??'
signed = w3.eth.account.sign_transaction(tx_dict, privateKey)
txid = w3.eth.send_raw_transaction(signed.rawTransaction).hex()

1 Answer 1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.