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()