0
使用encodeABI()来生成data的时候,出错:because web3 is not connected to mainnet...
source link: https://learnblockchain.cn/question/2885
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
使用encodeABI()来生成data的时候,出错:because web3 is not connected to mainnet
5 使用encodeABI()来生成data的时候,出错:because web3 is not connected to mainnet
是想调用合约里的一个方法,之前试过调用另外一个方法可以,但这次调用就出错了,提示:
Could not look up name 'XXXXXXX' because web3 is not connected to mainnet
我搜了下是跟w3.eth.default_account
有些关系?但还是搞不明白
附上这个函数的abi:
{
"inputs": [
{
"internalType": "address",
"name": "user",
"type": "address"
},
{
"internalType": "address",
"name": "career",
"type": "address"
},
{
"internalType": "address",
"name": "payAddr",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "price",
"type": "uint256"
},
{
"internalType": "string",
"name": "name",
"type": "string"
}
],
"name": "sellPlayer",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
有大佬知道是怎么回事吗?谢谢!
Update:
我看了下报错的函数,最终发现是在这里报错的:
我打印了w3.net.version
看了下,发现就是chain id,代码这里要是1才可以,但chain id怎么改啊??
麻烦懂的大佬给下解答,谢谢!
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK