WEB3.PHP Contract Call

I am using this PHP library https://github.com/web3p/web3.php to make the requests to smart contracts on BSC.

$web3 = new Web3('https://bsc-dataseed.binance.org');
$contract = new Contract($web3->provider, $abi);

$contract->at('0x10ED43C718714eb63d5aA57B78B54704E256024E')->call('WETH', function($err, $result) {
    print_r($result);
});

Works perfectly but the problem is when I try to call a function that has parameters both uint256 and address[] . For example

enter image description here

And here's the code:

$contract->at('0x10ED43C718714eb63d5aA57B78B54704E256024E')->call('quote', [
    '25000000000000000000',
    '[0x8C851d1a123Ff703BD1f9dabe631b69902Df5f97, 0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56]',
], function($err, $result) {
    print_r($result);
});

I get the following error. Tried to send the parameters as dictionary with param name. Couldn't figure out how should be done.

InvalidArgumentException
Please make sure you have put all function params and callback.



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation