Closed gatepavel closed 1 year ago
$transaction = $geth->personal()->transaction($payer, $contract) // from $payer to $contract address ->amount("0") // Amount should be ZERO ->data($data); // Our encoded ERC20 token transfer data from previous step
All guides online says you type it like this but the personal function is not in the class anymore and find a older version of this package looks pritty imposible
personal, in "$transaction = $geth->personal()->transaction($payer, $contract)" is exist in EthereumRPC. You may chek this issue (which wasn't actually an issue). So you need to also install EthereumRPC via
composer require furqansiddiqui/ethereum-rpc
It should be replaced by ethereum-php
, the previous method is no longer available.
May I ask how the transfer using ethereum-php
is done now?
Maybe so?
$eth = new \FurqanSiddiqui\Ethereum\Ethereum();
$erc20 = new \FurqanSiddiqui\Ethereum\ERC20\ERC20($eth);
$usdt = $erc20->token($contractAddress);
$payer = '0x...';
$payee = '0x...';
$amount = '0';
$data = $bnb->encodedTransferData($eth->getAccount($payee), $amount);
$tx = new \FurqanSiddiqui\Ethereum\Transactions\TxBuilder($eth);
$transaction = $tx->gas(new \FurqanSiddiqui\Ethereum\Math\WEIValue('1'), 70000)
->to($eth->getAccount($payer))
->value(new \FurqanSiddiqui\Ethereum\Math\WEIValue('0'))
->data($data);
old code from https://www.furqansiddiqui.com/transfer-erc20-token-from-one-account-to-another-using-php/ not worked - method personal() not found