Skip to content

$contract->at($erc20TokenAddress)->call('balanceOf', [$accountAddress], function($err, $result) { } function call with params giving error while function call without params is working #354

@wtmit

Description

@wtmit
provider, $erc20TokenABI); $contract->at($erc20TokenAddress)->call('symbol', function ($err, $result) { if ($err !== null) { return; } echo 'The symbol: ' . $result[0]; }); $contract->at($erc20TokenAddress)->call('balanceOf', [$accountAddress], function($err, $result) { if ($err !== null) { echo 'Error: ' . $err->getMessage() . PHP_EOL; // return; } // Print balance print_r($result); }); The symbol: WTM PHP Warning: Array to string conversion in D:\xampp\htdocs\web3.php-master\src\Contracts\Types\Address.php on line 63 Warning: Array to string conversion in D:\xampp\htdocs\web3.php-master\src\Contracts\Types\Address.php on line 63 PHP Fatal error: Uncaught InvalidArgumentException: Please make sure you have put all function params and callback. in D:\xampp\htdocs\web3. .php-master\src\Contract.php:625

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions