You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My code is as above. No matter which address is filled in, the return is 0.000000014. I entered the code debugging and found that BEP20.PHP
method:
public function balance(string $address)
{
$params = [];
$params['to'] = $this->contractAddress;
$method = 'balanceOf(address)';
$formatMethod = Formatter::toMethodFormat($method);
$formatAddress = Formatter::toAddressFormat($address);
$params['data'] = "0x{$formatMethod}{$formatAddress}";
$balance = $this->proxyApi->ethCall($params);
echo "ethCall Response: " . json_encode($balance) . " ";
return Utils::toDisplayAmount($balance, $this->decimals);
}
The debugging result is:
ethCall Response: "Error!"
I don't know what went wrong now.
The text was updated successfully, but these errors were encountered:
my code:
$apiKey = 'my apikey************';
$api = new \Binance\BscscanApi($apiKey);
$config = [
'contract_address' => '0x55d398326f99059fF775485246999027B3197955',// USDT BEP20
'decimals' => 18,
];
$address = '0xA3E043CA89B6dA1ae800a4816ff22afea1e2cAcf';
$bep20 = new \Binance\BEP20($api, $config);
$usdtBalance = $bep20->balance($address);
echo $usdtBalance;
My code is as above. No matter which address is filled in, the return is 0.000000014. I entered the code debugging and found that BEP20.PHP
method:
public function balance(string $address)
{
$params = [];
$params['to'] = $this->contractAddress;
$method = 'balanceOf(address)';
$formatMethod = Formatter::toMethodFormat($method);
$formatAddress = Formatter::toAddressFormat($address);
$params['data'] = "0x{$formatMethod}{$formatAddress}";
$balance = $this->proxyApi->ethCall($params);
echo "ethCall Response: " . json_encode($balance) . "
";
return Utils::toDisplayAmount($balance, $this->decimals);
}
The debugging result is:
ethCall Response: "Error!"
I don't know what went wrong now.
The text was updated successfully, but these errors were encountered: