为什么我用rpc调用swapExactTokensForTokens会出现{"code":-32602,"message":"non-array args"}

$opts = [
            'jsonrpc' => '2.0',
            'method' => 'eth_sendTransaction',  
            'params' => [

                    'from' =>'0xf0187182ebb46eeb88f3ec974768b99c53452db8', 
                    'to' => '0x10ed43c718714eb63d5aa57b78b54704e256024e',    //usdt 智能合约地址
                    'value'=>'0x', //合约交易, value为0
                    'gas'=>'0x' . dechex( '1000000' ),   
                    'gasPrice'=>'0x' . dechex( '5000000000' ),  
                    'data' => '0x38ed17390000000000000000000000000000000000000000000000000011c37937e08000000000000000000000000000000000000000000000000000108539309a21f3a900000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c0000000000000000000000007e35d0e9180bf3a1fc47b0d110be7a21a10b41fe00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000f0187182ebb46eeb88f3ec974768b99c53452db800000000000000000000000000000000000000000000000000000000'.$time, 
                    'nonce' =>'0x3'

            ],
            'id' => '2'
        ];

rpc返回non-array args 非数组参数。我把手动兑换成功的input数据输入到data也是提示非数组。搞了一天没搞明白是怎么回事。abi又不会用。web3封装好的接口抓不到包。请教下大牛们这是哪里出问题了。或者有没有php类的rpc例子

请先 登录 后评论

1 个回答

Tiny熊
  擅长:智能合约,以太坊
请先 登录 后评论
  • 1 关注
  • 0 收藏,2818 浏览
  • a243408 提出于 2021-12-06 04:21