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
37 stars 35 forks source link

Transfer not working #11

Open mitmelon opened 1 year ago

mitmelon commented 1 year ago

The transfer is not working...

 $uri = 'https://data-seed-prebsc-1-s1.binance.org:8545/';// Testnet
    $api = new \Binance\NodeApi($uri);
    $bnb = new \Binance\Bnb($api);
    $config = [
        'contract_address' => '0xA874AE9a50a1a9A4A21285AB188E324bb4b3fA2A',// USDT BEP20
        'decimals' => 8,
    ];
    $bep20 = new \Binance\BEP20($api, $config);

    $from = 'PRIVATE_KEY';
    $to = '0xebccc7556e93d16a95c6abcee1cd0586949b3c1f';
    $amount = 0.1;
    $f = $bep20->transfer($from, $to, $amount);
    var_dump($f);

returning false;

SuprimeKebab commented 1 year ago

Hi, try to send gasPrice as 4th argument for transfer(). You can get it from like this:

$api = new \Binance\BscscanApi($apiKey);
$fee = $api->gasPrice();
coolwu2014 commented 10 months ago

Hi, try to send gasPrice as 4th argument for transfer(). You can get it from like this:

$api = new \Binance\BscscanApi($apiKey);
$fee = $api->gasPrice();

好像也不行,我转账的是bnb,也是出现燃料不足,不知道楼主的解决没

SuprimeKebab commented 10 months ago

Hi, try to send gasPrice as 4th argument for transfer(). You can get it from like this:

$api = new \Binance\BscscanApi($apiKey);
$fee = $api->gasPrice();

好像也不行,我转账的是bnb,也是出现燃料不足,不知道楼主的解决没

It works

coolwu2014 commented 10 months ago

Hi, try to send gasPrice as 4th argument for transfer(). You can get it from like this:

$api = new \Binance\BscscanApi($apiKey);
$fee = $api->gasPrice();

好像也不行,我转账的是bnb,也是出现燃料不足,不知道楼主的解决没

It works

可以了,谢谢