Closed bigdllmask1333 closed 1 year ago
非常感谢,不过也可以直接改原文 因为PHP8 所以返回是 ADDRESS类型 调整为
/**生成地址
* @return Address
* @throws TronErrorException
* @throws TronException
*/
public function generateAddress(): Address
{
$attempts = 0;
$validAddress = false;
$tron = new \IEXBase\TronAPI\Tron();
do {
if ($attempts++ === 5) {
throw new TronErrorException('Could not generate valid key');
}
$generateAddress = $tron->generateAddress(); // or createAddress()
$address = (array)($generateAddress)->getRawData();
$retdata['privateKey'] = $address['private_key'];
$retdata['address'] = $address['address_base58'];
$retdata['hexAddress'] = $address['address_hex'];
$address = new Address($address['address_base58'], $address['private_key'], $address['address_hex']);
$validAddress = $this->validateAddress($address);
} while (!$validAddress);
return $address;
}
php8.02无法安装改项目,头疼,老师提示版本出错 !