diff --git a/src/API/EVM.php b/src/API/EVM.php index 2195b6a..950a417 100644 --- a/src/API/EVM.php +++ b/src/API/EVM.php @@ -13,19 +13,18 @@ class EVM extends AbstractAPI * * @return array|null */ - public function ethCall(array $payload): ?array + public function call(array $payload): ?array { $body = [ 'jsonrpc' => '2.0', - 'method' => 'eth_call', - 'params' => [$payload, 'latest'], - 'id' => null, + ...$payload, ]; $headers = [ 'Content-Type' => 'application/json', ]; - return $this->withApi('evm')->requestPost('api/', $body, $headers); + return $this->withApi('evm') + ->requestPost('api/', $body, $headers); } } diff --git a/tests/API/EVMTest.php b/tests/API/EVMTest.php index 9f79086..a20cfda 100644 --- a/tests/API/EVMTest.php +++ b/tests/API/EVMTest.php @@ -13,16 +13,20 @@ class EVMTest extends TestCase { /** @test */ - public function eth_call_calls_correct_url() + public function evm_call_calls_correct_url() { $this->assertResponse( method: 'POST', path: 'api/', callback: function (ArkClient $client) { - return $client->evm()->ethCall([ - 'from' => '0x1234567890abcdef', - 'to' => '0xfedcba0987654321', - 'data' => '0xabcdef', + return $client->evm()->call([ + 'method' => 'eth_call', + 'params' => [[ + 'from' => '0x1234567890abcdef', + 'to' => '0xfedcba0987654321', + 'data' => '0xabcdef', + ], 'latest'], + 'id' => null, ]); }, expectedApi: 'evm'