Closed mgx888 closed 3 years ago
看上去抱错应该不是这块代码报出来
你可以试着参照测试用例调用 new TRC20
[2021-08-19 00:39:04] local.ERROR: During class fetch: Uncaught ErrorException: Required parameter $from follows optional parameter $private_key in /www/wwwroot/test/vendor/iexbase/tron-api/src/Concerns/ManagesUniversal.php:62 Stack trace:
Stack trace:
[stacktrace]
"} 以上是详细的报错,也确实是按照示例写的,
具体写法: $uri = 'https://api.trongrid.io';// mainnet // $uri = 'https://api.shasta.trongrid.io';// shasta testnet $api = new \Tron\Api(new Client(['base_uri' => $uri])); $config = [ 'contract_address' => 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',// USDT TRC20 'decimals' => 6, ]; $trxWallet = new \Tron\TRX($api); $addressData = $trxWallet->generateAddress(); //$trc20Wallet = new \Tron\TRC20($api, $config); //$addressData = $trc20Wallet->generateAddress();
new \Tron\TRX 和 new \Tron\TRC20 报错是同样的;
扩展包也卸载过,重新安装过,同样的报错;使用的是laravel框架 请指示一下,谢谢;
不好意思,是PHP环境的问题,我按照扩展包和运行PHP不是同一个环境;现在正常了
//const URI = 'https://api.shasta.trongrid.io'; // shasta testnet const URI = 'https://api.trongrid.io';//测试地址? const ADDRESS = 'TGytofNKuSReFmFxsgnNx19em3BAVBTpVB'; const PRIVATE_KEY = '0xf1b4b7d86a3eff98f1bace9cb2665d0cad3a3f949bc74a7ffb2aaa968c07f521'; const BLOCK_ID = 13402554; const TX_HASH = '539e6c2429f19a8626fadc1211985728e310f5bd5d2749c88db2e3f22a8fdf69'; const CONTRACT = [ 'contract_address' => 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t', // USDT TRC20 'decimals' => 6, ];
报错如下 During class fetch: Uncaught ErrorException: Required parameter $from follows optional parameter $private_key