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

Unallowed rpc method: eth_chainId #340

Open phpmac opened 9 months ago

phpmac commented 9 months ago

Please support eth_chainId

> php artisan test tests/Feature/TmpTest.php

   FAIL  Tests\Feature\TmpTest
  ⨯ example                                                                                                                  0.69s  
  ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\Feature\TmpTest > example                                                                       RuntimeException   
  Unallowed rpc method: eth_chainId

  at vendor/web3p/web3.php/src/Eth.php:83
     79▕         if (preg_match('/^[a-zA-Z0-9]+$/', $name) === 1) {
     80▕             $method = strtolower($class[1]) . '_' . $name;
     81▕ 
     82▕             if (!in_array($method, $this->allowedMethods)) {
  ➜  83▕                 throw new \RuntimeException('Unallowed rpc method: ' . $method);
     84▕             }
     85▕             if ($this->provider->isBatch) {
     86▕                 $callback = null;
     87▕             } else {

      +1 vendor frames 
  2   helpers.php:348
  3   helpers.php:391

  Tests:    1 failed (0 assertions)
  Duration: 0.74s