Skip to content

Commit e2445f8

Browse files
authored
Merge pull request #5 from seregazhuk/bug/return-block-number-as-decimal
bugfix: return block number as decimal
2 parents f9a1512 + 0bf457b commit e2445f8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Module/Proxy/Proxy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ public function getTransactionByHash(string $hash): TransactionByHashInfo
6565
/**
6666
* @see https://docs.etherscan.io/api-endpoints/geth-parity-proxy#eth_blocknumber
6767
*/
68-
public function getBlockNumber(): string
68+
public function getBlockNumber(): int
6969
{
7070
$response = $this->client->sendRequest(self::MODULE_NAME, 'eth_blockNumber');
7171
/** @var array{result: string} $json */
7272
$json = json_decode($response->getBody()->getContents(), true);
7373

74-
return $json['result'];
74+
return (int) hexdec($json['result']);
7575
}
7676

7777
/**

tests/Module/ProxyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public function it_retrieves_block_number(): void
196196
)
197197
->willReturn(new Response(200, [], $json));
198198
$result = $this->proxy->getBlockNumber();
199-
$this->assertSame('0xc36b29', $result);
199+
$this->assertSame(12806953, $result);
200200
}
201201

202202
#[Test]

0 commit comments

Comments
 (0)