web3p / web3.php

A php interface for interacting with the Ethereum blockchain and ecosystem. Native ABI parsing and smart contract interactions.
MIT License
1.16k stars 543 forks source link

Passing in a string with padded 0s blows up the Integer Formatter #298

Open rushughes opened 1 year ago

rushughes commented 1 year ago

$contract->at($contractAddress)->call('tokenAddressandID', "00001", function($err, $transaction) use ($name) {

Passing in an string that's an integer prefixed with 0s, e.g "00001" or "00002" blows up with the following error

`[2022-10-15 17:40:14] local.ERROR: Call to a member function toHex() on array {"exception":"[object] (Error(code: 0): Call to a member function toHex() on array at /var/www/html/vendor/web3p/web3.php/src/Formatters/IntegerFormatter.php:36) [stacktrace]

0 /var/www/html/vendor/web3p/web3.php/src/Contracts/Types/Str.php(63): Web3\Formatters\IntegerFormatter::format()

1 /var/www/html/vendor/web3p/web3.php/src/Contracts/SolidityType.php(221): Web3\Contracts\Types\Str->inputFormat()

2 [internal function]: Web3\Contracts\SolidityType->encode()

3 /var/www/html/vendor/web3p/web3.php/src/Contracts/Ethabi.php(162): call_user_func()

4 /var/www/html/vendor/web3p/web3.php/src/Contract.php(618): Web3\Contracts\Ethabi->encodeParameters()

5 /var/www/html/app/Console/Commands/CheckMinted.php(61): Web3\Contract->call()

6 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Console\Commands\CheckMinted->handle()

7 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()

8 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()

9 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()

10 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(651): Illuminate\Container\BoundMethod::call()

11 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(144): Illuminate\Container\Container->call()

12 /var/www/html/vendor/symfony/console/Command/Command.php(308): Illuminate\Console\Command->execute()

13 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(126): Symfony\Component\Console\Command\Command->run()

14 /var/www/html/vendor/symfony/console/Application.php(1002): Illuminate\Console\Command->run()

15 /var/www/html/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand()

16 /var/www/html/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()

17 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Application.php(102): Symfony\Component\Console\Application->run()

18 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(151): Illuminate\Console\Application->run()

19 /var/www/html/artisan(37): Illuminate\Foundation\Console\Kernel->handle()

20 {main}

"} `

srepresarodriguez commented 1 year ago

Have the same issue. Did you solve it?