Skip to content

Commit f504891

Browse files
committed
refactor: update eth call payload handling
1 parent f0a9e02 commit f504891

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

src/API/EVM.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,18 @@ class EVM extends AbstractAPI
1313
*
1414
* @return array|null
1515
*/
16-
public function ethCall(array $payload): ?array
16+
public function evmCall(array $payload): ?array
1717
{
1818
$body = [
1919
'jsonrpc' => '2.0',
20-
'method' => 'eth_call',
21-
'params' => [$payload, 'latest'],
22-
'id' => null,
20+
...$payload,
2321
];
2422

2523
$headers = [
2624
'Content-Type' => 'application/json',
2725
];
2826

29-
return $this->withApi('evm')->requestPost('api/', $body, $headers);
27+
return $this->withApi('evm')
28+
->requestPost('api/', $body, $headers);
3029
}
3130
}

tests/API/EVMTest.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,20 @@
1313
class EVMTest extends TestCase
1414
{
1515
/** @test */
16-
public function eth_call_calls_correct_url()
16+
public function evm_call_calls_correct_url()
1717
{
1818
$this->assertResponse(
1919
method: 'POST',
2020
path: 'api/',
2121
callback: function (ArkClient $client) {
22-
return $client->evm()->ethCall([
23-
'from' => '0x1234567890abcdef',
24-
'to' => '0xfedcba0987654321',
25-
'data' => '0xabcdef',
22+
return $client->evm()->evmCall([
23+
'method' => 'eth_call',
24+
'params' => [[
25+
'from' => '0x1234567890abcdef',
26+
'to' => '0xfedcba0987654321',
27+
'data' => '0xabcdef',
28+
], 'latest'],
29+
'id' => null,
2630
]);
2731
},
2832
expectedApi: 'evm'

0 commit comments

Comments
 (0)