public async Task eth_getBlockByHash_should_invoke_client_method() { var hash = TestItem.KeccakA; const bool returnFullTransactionObjects = true; await _proxy.eth_getBlockByHash(hash, returnFullTransactionObjects); await _client.Received().SendAsync <BlockModel>(nameof(_proxy.eth_getBlockByHash), hash, returnFullTransactionObjects); }
public async Task find_block_by_hash_should_invoke_proxy_eth_getBlockByHash() { var blockModel = GetBlockModel(); _proxy.eth_getBlockByHash(blockModel.Hash).Returns(RpcResult <BlockModel> .Ok(blockModel)); var block = await _ndmBridge.FindBlockAsync(blockModel.Hash); await _proxy.Received().eth_getBlockByHash(blockModel.Hash); block.Should().NotBeNull(); ValidateBlock(block, blockModel); }
public async Task <Block?> FindBlockAsync(Keccak blockHash) { var result = await _proxy.eth_getBlockByHash(blockHash); return(result?.IsValid == true?result.Result?.ToBlock() : null); }