Fenguoz / bsc-php

Support Binance Smart Chain BNB/BEP20 digital assets, including address creation, balance query, transaction transfer, query the latest blockchain, query information based on blockchain, query information based on transaction hash, etc.
MIT License
32 stars 33 forks source link

NULL Response BSC #6

Open idevlinkcom opened 1 year ago

idevlinkcom commented 1 year ago

I face error with no response while transfer BSC to other address

My request

$uri = 'https://data-seed-prebsc-1-s1.binance.org:8545/';// Testnet
$api = new \Binance\NodeApi($uri);
$address = '0x5454c66eaa964d13b7d858d79e85c877ccbf33ab';
$bnb = new \Binance\Bnb($api);
$bnbBalance = $bnb->bnbBalance($address);

$from = '3e2f3d8c699332a08c1c1158b7ff34548aca162580f91070cba930dfc9a7406b'; // private
$to = '0x43671E7c181e4908DEeBd84bd2d71ceAD4e2E84c';
$amount = 0.01;
$bnbtransfer = $bnb->transfer($from, $to, $amount);

Just log the function like this

$raw = $transaction->sign($privateKey);
logDebug("raw");
logDebug($raw);
$res = $this->proxyApi->sendRawTransaction('0x' . $raw);
logDebug($res);
return $res;

the response is NULL or EMPTY

response: raw
-------------------------
response: f86c8085012a05f2008276c09443671E7c181e4908DEeBd84bd2d71ceAD4e2E84c872386f26fc10000808193a002c05cfc47a5e64801b88f202131f216559ec189c2ce3eb9afcd42d61956c016a02eaa65e8f346efedb917b5b3ef32d71551cd9353883071447a31fcd2e03cbddc
-------------------------
response: 

any fix?

SuprimeKebab commented 10 months ago

If you want to see the response that received from API, try to print it on send() function. In your case it is in NodeApi.php file right after the line:

$res = Utils::httpRequest('POST', $url, $data);