@@ -121,7 +121,7 @@ public function callRaw(string $method, array $params = []): array
121121 }
122122 }
123123
124- throw new RpcException ('All RPC endpoints failed ' .$ lastError );
124+ throw new RpcException ('All RPC endpoints failed. Error: ' .$ lastError );
125125 }
126126
127127 /**
@@ -142,10 +142,7 @@ public function call(string $method, array $params = []): mixed // align with in
142142 return $ json ;
143143 }
144144
145- $ result = $ json ['result ' ];
146-
147- // Return arrays directly (e.g. receipts) and scalars/hex as-is.
148- return $ result ;
145+ return $ json ['result ' ];
149146 }
150147
151148 /**
@@ -157,6 +154,7 @@ public function health(): array
157154 $ bnHex = $ this ->call ('eth_blockNumber ' );
158155
159156 return [
157+ 'rpc_urls ' => implode (', ' , $ this ->urls ),
160158 'chainId ' => is_string ($ idHex ) ? hexdec ($ idHex ) : (int ) $ idHex ,
161159 'block ' => is_string ($ bnHex ) ? hexdec ($ bnHex ) : (int ) $ bnHex ,
162160 ];
@@ -168,10 +166,11 @@ public function health(): array
168166 public function getLogs (array $ filter ): array
169167 {
170168 // Basic validation: require either blockHash or fromBlock/toBlock pair.
171- if (!isset ($ filter ['blockHash ' ]) && !isset ($ filter ['fromBlock ' ]) && !isset ($ filter ['toBlock ' ])) {
169+ if (! isset ($ filter ['blockHash ' ]) && ! isset ($ filter ['fromBlock ' ]) && ! isset ($ filter ['toBlock ' ])) {
172170 throw new \InvalidArgumentException ('getLogs filter requires blockHash or fromBlock/toBlock ' );
173171 }
174172 $ res = $ this ->call ('eth_getLogs ' , [$ filter ]);
173+
175174 return is_array ($ res ) ? $ res : [];
176175 }
177176}
0 commit comments