由于没有匹配的参数类型,函数调用失败。web3.py,Python

由于没有匹配的参数类型,函数调用失败。web3.py,Python,python,web3py,Python,Web3py,我正在尝试使用swapExactTokensForTokens()(Pancakeswap路由器函数)交换令牌 这是我的密码 def swapTokens(): amountIn = (w3.toWei(0.00001,'ether')) amount1 = contractR.functions.getAmountsOut(amountIn, [wbnb, tokenToBuy]).call() amountOutMin = amount1[1] * 0.9 minAmountPrint

我正在尝试使用
swapExactTokensForTokens()
Pancakeswap
路由器函数)交换令牌

这是我的密码

def swapTokens():
amountIn = (w3.toWei(0.00001,'ether')) 
amount1  = contractR.functions.getAmountsOut(amountIn, [wbnb, tokenToBuy]).call()
amountOutMin = amount1[1] * 0.9 
minAmountPrint = w3.fromWei(amountOutMin, 'ether')
print('Minimum recieved:',minAmountPrint)
swap_TX = contractR.functions.swapExactTokensForTokens(
amountIn,
amountOutMin,
[wbnb, tokenToBuy],
myAccount,
(int(time.time()) + 1000000)
).buildTransaction({'from': myAccount,
'value': w3.toWei(0.0001,'ether'),
'gas': 250000,
'gasPrice': w3.toWei('5','gwei'),
'nonce': nonce,
})
signed_TX = w3.eth.account.sign_transaction(swap_TX, private_key = privateKey)
tx_token = w3.eth.send_raw_transaction(signed_TX.rawTransaction)
print(w3.toHex(tx_token))
但结果我不断出错:

Could not identify the intended function with name `swapExactTokensForTokens`, positional argument(s) of type `(<class 'int'>, <class 'float'>, <class 'list'>, <class 'str'>, <class 'int'>)` and keyword 
argument(s) of type `{}`.
Found 1 function(s) with the name `swapExactTokensForTokens`: ['swapExactTokensForTokens(uint256,uint256,address[],address,uint256)']
Function invocation failed due to no matching argument types.
无法识别名称为`swapExactTokensForTokens`、类型为`(,)的位置参数和关键字为的目标函数
类型为“{}”的参数。
找到1个名为“swapExactTokensForTokens”的函数:[“swapExactTokensForTokens(uint256,uint256,地址[],地址,uint256)”]
由于没有匹配的参数类型,函数调用失败。

我检查了传递给函数的每个参数的类型和匹配的参数。

传递的第二个参数是“float”类型而不是必需的“int”。

传递的第二个参数是“float”类型而不是“int”。这可能是问题吗?这就是问题所在。谢谢Btw事务失败。你们知道cna帮我弄清楚它在发送的哪一步失败了吗?嘿@richie,既然是这样,也许考虑把你的问题作为答案,所以OP可以接受它的甜+ 10的声誉:BI喜欢我的代表@ JeMand 77 1:DCAN你编辑问题与其他问题的细节或打开一个新的职位吗?