From f504891718b341dcb74e057c05876bcdb37f4b1e Mon Sep 17 00:00:00 2001 From: Alex Barnsley <8069294+alexbarnsley@users.noreply.github.com> Date: Thu, 22 May 2025 14:41:32 +0100 Subject: [PATCH 1/3] refactor: update eth call payload handling --- src/API/EVM.php | 9 ++++----- tests/API/EVMTest.php | 14 +++++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/API/EVM.php b/src/API/EVM.php index 2195b6a..83d9f96 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 evmCall(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..7c8550b 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()->evmCall([ + 'method' => 'eth_call', + 'params' => [[ + 'from' => '0x1234567890abcdef', + 'to' => '0xfedcba0987654321', + 'data' => '0xabcdef', + ], 'latest'], + 'id' => null, ]); }, expectedApi: 'evm' From f6fe39d4b9b143d85ed07db598efe71c38a89980 Mon Sep 17 00:00:00 2001 From: Alex Barnsley <8069294+alexbarnsley@users.noreply.github.com> Date: Thu, 22 May 2025 14:45:39 +0100 Subject: [PATCH 2/3] rename method to call --- src/API/EVM.php | 2 +- tests/API/EVMTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/API/EVM.php b/src/API/EVM.php index 83d9f96..950a417 100644 --- a/src/API/EVM.php +++ b/src/API/EVM.php @@ -13,7 +13,7 @@ class EVM extends AbstractAPI * * @return array|null */ - public function evmCall(array $payload): ?array + public function call(array $payload): ?array { $body = [ 'jsonrpc' => '2.0', diff --git a/tests/API/EVMTest.php b/tests/API/EVMTest.php index 7c8550b..a20cfda 100644 --- a/tests/API/EVMTest.php +++ b/tests/API/EVMTest.php @@ -19,7 +19,7 @@ public function evm_call_calls_correct_url() method: 'POST', path: 'api/', callback: function (ArkClient $client) { - return $client->evm()->evmCall([ + return $client->evm()->call([ 'method' => 'eth_call', 'params' => [[ 'from' => '0x1234567890abcdef', From 8585b65b25461f4a8b70583a5ec4f0db35568db0 Mon Sep 17 00:00:00 2001 From: ItsANameToo Date: Tue, 16 Dec 2025 12:53:19 +0000 Subject: [PATCH 3/3] style: resolve style guide violations --- tests/API/EVMTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/API/EVMTest.php b/tests/API/EVMTest.php index 705da79..ee91940 100644 --- a/tests/API/EVMTest.php +++ b/tests/API/EVMTest.php @@ -12,7 +12,7 @@ path: 'api/', callback: function (ArkClient $client) { return $client->evm()->call([ - 'method' => 'eth_call', + 'method' => 'eth_call', 'params' => [[ 'from' => '0x1234567890abcdef', 'to' => '0xfedcba0987654321',