当前位置: 首页>>代码示例>>Java>>正文


Java EthBlock.Block方法代码示例

本文整理汇总了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();
}
 
开发者ID:codingchili,项目名称:ethereum-ingest,代码行数:11,代码来源:StorableBlock.java

示例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()));
}
 
开发者ID:web3j,项目名称:web3j,代码行数:12,代码来源:CoreIT.java

示例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()));
}
 
开发者ID:web3j,项目名称:web3j,代码行数:12,代码来源:CoreIT.java

示例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()));
}
 
开发者ID:web3j,项目名称:web3j,代码行数:12,代码来源:CoreIT.java

示例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()));
}
 
开发者ID:web3j,项目名称:web3j,代码行数:12,代码来源:CoreIT.java

示例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);
}
 
开发者ID:web3j,项目名称:web3j,代码行数:10,代码来源:EnsResolverTest.java

示例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;
}
 
开发者ID:web3j,项目名称:web3j,代码行数:9,代码来源:JsonRpc2_0RxTest.java


注:本文中的org.web3j.protocol.core.methods.response.EthBlock.Block方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。