本文整理汇总了Java中org.web3j.protocol.core.methods.response.EthBlock.Block方法的典型用法代码示例。如果您正苦于以下问题:Java EthBlock.Block方法的具体用法?Java EthBlock.Block怎么用?Java EthBlock.Block使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.web3j.protocol.core.methods.response.EthBlock
的用法示例。
在下文中一共展示了EthBlock.Block方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: StorableBlock
import org.web3j.protocol.core.methods.response.EthBlock; //导入方法依赖的package包/类
public StorableBlock(EthBlock.Block block) {
this.number = block.getNumber().longValue();
this.hash = block.getHash();
this.difficulty = block.getDifficultyRaw();
this.author = block.getAuthor();
this.miner = block.getMiner();
this.timestamp = timestampFrom(block.getTimestamp().longValue());
this.size = block.getSize().longValue();
this.txcount = block.getTransactions().size();
}
示例2: testEthGetBlockByHashReturnHashObjects
import org.web3j.protocol.core.methods.response.EthBlock; //导入方法依赖的package包/类
@Test
public void testEthGetBlockByHashReturnHashObjects() throws Exception {
EthBlock ethBlock = web3j.ethGetBlockByHash(config.validBlockHash(), false)
.send();
EthBlock.Block block = ethBlock.getBlock();
assertNotNull(ethBlock.getBlock());
assertThat(block.getNumber(), equalTo(config.validBlock()));
assertThat(block.getTransactions().size(),
is(config.validBlockTransactionCount().intValue()));
}
示例3: testEthGetBlockByHashReturnFullTransactionObjects
import org.web3j.protocol.core.methods.response.EthBlock; //导入方法依赖的package包/类
@Test
public void testEthGetBlockByHashReturnFullTransactionObjects() throws Exception {
EthBlock ethBlock = web3j.ethGetBlockByHash(config.validBlockHash(), true)
.send();
EthBlock.Block block = ethBlock.getBlock();
assertNotNull(ethBlock.getBlock());
assertThat(block.getNumber(), equalTo(config.validBlock()));
assertThat(block.getTransactions().size(),
equalTo(config.validBlockTransactionCount().intValue()));
}
示例4: testEthGetBlockByNumberReturnHashObjects
import org.web3j.protocol.core.methods.response.EthBlock; //导入方法依赖的package包/类
@Test
public void testEthGetBlockByNumberReturnHashObjects() throws Exception {
EthBlock ethBlock = web3j.ethGetBlockByNumber(
DefaultBlockParameter.valueOf(config.validBlock()), false).send();
EthBlock.Block block = ethBlock.getBlock();
assertNotNull(ethBlock.getBlock());
assertThat(block.getNumber(), equalTo(config.validBlock()));
assertThat(block.getTransactions().size(),
equalTo(config.validBlockTransactionCount().intValue()));
}
示例5: testEthGetBlockByNumberReturnTransactionObjects
import org.web3j.protocol.core.methods.response.EthBlock; //导入方法依赖的package包/类
@Test
public void testEthGetBlockByNumberReturnTransactionObjects() throws Exception {
EthBlock ethBlock = web3j.ethGetBlockByNumber(
DefaultBlockParameter.valueOf(config.validBlock()), true).send();
EthBlock.Block block = ethBlock.getBlock();
assertNotNull(ethBlock.getBlock());
assertThat(block.getNumber(), equalTo(config.validBlock()));
assertThat(block.getTransactions().size(),
equalTo(config.validBlockTransactionCount().intValue()));
}
示例6: configureLatestBlock
import org.web3j.protocol.core.methods.response.EthBlock; //导入方法依赖的package包/类
private void configureLatestBlock(long timestamp) throws IOException {
EthBlock.Block block = new EthBlock.Block();
block.setTimestamp(Numeric.encodeQuantity(BigInteger.valueOf(timestamp)));
EthBlock ethBlock = new EthBlock();
ethBlock.setResult(block);
when(web3jService.send(any(Request.class), eq(EthBlock.class)))
.thenReturn(ethBlock);
}
示例7: createBlock
import org.web3j.protocol.core.methods.response.EthBlock; //导入方法依赖的package包/类
private EthBlock createBlock(int number) {
EthBlock ethBlock = new EthBlock();
EthBlock.Block block = new EthBlock.Block();
block.setNumber(Numeric.encodeQuantity(BigInteger.valueOf(number)));
ethBlock.setResult(block);
return ethBlock;
}