本文整理了Java中org.web3j.protocol.core.Request.send
方法的一些代码示例,展示了Request.send
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.send
方法的具体详情如下:
包路径:org.web3j.protocol.core.Request
类名称:Request
方法名:send
暂无
代码示例来源:origin: web3j/web3j
private BigInteger getBlockNumber(
DefaultBlockParameter defaultBlockParameter) throws IOException {
if (defaultBlockParameter instanceof DefaultBlockParameterNumber) {
return ((DefaultBlockParameterNumber) defaultBlockParameter).getBlockNumber();
} else {
EthBlock latestEthBlock = web3j.ethGetBlockByNumber(
defaultBlockParameter, false).send();
return latestEthBlock.getBlock().getNumber();
}
}
代码示例来源:origin: web3j/web3j
@Test
public void testEthCall() throws Exception {
EthCall ethCall = web3j.ethCall(config.buildTransaction(),
DefaultBlockParameter.valueOf("latest")).send();
assertThat(DefaultBlockParameterName.LATEST.getValue(), is("latest"));
assertThat(ethCall.getValue(), is("0x"));
}
代码示例来源:origin: web3j/web3j
@Test
public void testNetVersion() throws Exception {
web3j.netVersion().send();
verifyResult("{\"jsonrpc\":\"2.0\",\"method\":\"net_version\",\"params\":[],\"id\":1}");
}
代码示例来源:origin: web3j/web3j
@Test
public void testEthCoinbase() throws Exception {
web3j.ethCoinbase().send();
verifyResult("{\"jsonrpc\":\"2.0\",\"method\":\"eth_coinbase\",\"params\":[],\"id\":1}");
}
代码示例来源:origin: web3j/web3j
@Test
public void testEthGetTransactionCount() throws Exception {
web3j.ethGetTransactionCount("0x407d73d8a49eeb85d32cf465507dd71d507100c1",
DefaultBlockParameterName.LATEST).send();
verifyResult("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionCount\","
+ "\"params\":[\"0x407d73d8a49eeb85d32cf465507dd71d507100c1\",\"latest\"],"
+ "\"id\":1}");
}
代码示例来源:origin: web3j/web3j
@Test
public void testEthGetBlockTransactionCountByHash() throws Exception {
web3j.ethGetBlockTransactionCountByHash(
"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238").send();
//CHECKSTYLE:OFF
verifyResult("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockTransactionCountByHash\",\"params\":[\"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238\"],\"id\":1}");
//CHECKSTYLE:ON
}
代码示例来源:origin: web3j/web3j
@Test
public void testEthGetUncleCountByBlockHash() throws Exception {
web3j.ethGetUncleCountByBlockHash(
"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238").send();
//CHECKSTYLE:OFF
verifyResult("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getUncleCountByBlockHash\",\"params\":[\"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238\"],\"id\":1}");
//CHECKSTYLE:ON
}
代码示例来源:origin: web3j/web3j
@Test
public void testEthNewPendingTransactionFilter() throws Exception {
web3j.ethNewPendingTransactionFilter().send();
verifyResult("{\"jsonrpc\":\"2.0\",\"method\":\"eth_newPendingTransactionFilter\","
+ "\"params\":[],\"id\":1}");
}
代码示例来源:origin: web3j/web3j
@Test
public void testShhAddToGroup() throws Exception {
//CHECKSTYLE:OFF
web3j.shhAddToGroup("0x04f96a5e25610293e42a73908e93ccc8c4d4dc0edcfa9fa872f50cb214e08ebf61a03e245533f97284d442460f2998cd41858798ddfd4d661997d3940272b717b1").send();
verifyResult("{\"jsonrpc\":\"2.0\",\"method\":\"shh_addToGroup\",\"params\":[\"0x04f96a5e25610293e42a73908e93ccc8c4d4dc0edcfa9fa872f50cb214e08ebf61a03e245533f97284d442460f2998cd41858798ddfd4d661997d3940272b717b1\"],\"id\":1}");
//CHECKSTYLE:ON
}
代码示例来源:origin: web3j/web3j
@Test
public void testEthGetUncleCountByBlockHash() throws Exception {
EthGetUncleCountByBlockHash ethGetUncleCountByBlockHash =
web3j.ethGetUncleCountByBlockHash(config.validBlockHash()).send();
assertThat(ethGetUncleCountByBlockHash.getUncleCount(),
equalTo(config.validBlockUncleCount()));
}
代码示例来源:origin: web3j/web3j
@Test
public void testEthGetUncleCountByBlockNumber() throws Exception {
EthGetUncleCountByBlockNumber ethGetUncleCountByBlockNumber =
web3j.ethGetUncleCountByBlockNumber(
DefaultBlockParameter.valueOf("latest")).send();
assertThat(ethGetUncleCountByBlockNumber.getUncleCount(),
equalTo(config.validBlockUncleCount()));
}
代码示例来源:origin: web3j/web3j
@Test
public void testEthGetTransactionByBlockHashAndIndex() throws Exception {
BigInteger index = BigInteger.ONE;
EthTransaction ethTransaction = web3j.ethGetTransactionByBlockHashAndIndex(
config.validBlockHash(), index).send();
assertTrue(ethTransaction.getTransaction().isPresent());
Transaction transaction = ethTransaction.getTransaction().get();
assertThat(transaction.getBlockHash(), is(config.validBlockHash()));
assertThat(transaction.getTransactionIndex(), equalTo(index));
}
代码示例来源:origin: web3j/web3j
@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()));
}
代码示例来源:origin: web3j/web3j
@Test
public void testEthGetBlockTransactionCountByNumber() throws Exception {
EthGetBlockTransactionCountByNumber ethGetBlockTransactionCountByNumber =
web3j.ethGetBlockTransactionCountByNumber(
DefaultBlockParameter.valueOf(config.validBlock())).send();
assertThat(ethGetBlockTransactionCountByNumber.getTransactionCount(),
equalTo(config.validBlockTransactionCount()));
}
代码示例来源:origin: web3j/web3j
private List<EthLog.LogResult> createFilterForEvent(
String encodedEventSignature, String contractAddress) throws Exception {
EthFilter ethFilter = new EthFilter(
DefaultBlockParameterName.EARLIEST,
DefaultBlockParameterName.LATEST,
contractAddress
);
ethFilter.addSingleTopic(encodedEventSignature);
EthLog ethLog = web3j.ethGetLogs(ethFilter).send();
return ethLog.getLogs();
}
}
代码示例来源:origin: web3j/web3j
@Test
public void testPersonalListAccounts() throws Exception {
PersonalListAccounts personalListAccounts = parity.personalListAccounts().send();
assertNotNull(personalListAccounts.getAccountIds());
}
代码示例来源:origin: web3j/web3j
@Test
public void testEthSyncing() throws Exception {
EthSyncing ethSyncing = web3j.ethSyncing().send();
assertNotNull(ethSyncing.getResult());
}
代码示例来源:origin: web3j/web3j
@Test
public void testEthGetUncleByBlockHashAndIndex() throws Exception {
EthBlock ethBlock = web3j.ethGetUncleByBlockHashAndIndex(
config.validUncleBlockHash(), BigInteger.ZERO).send();
assertNotNull(ethBlock.getBlock());
}
代码示例来源:origin: web3j/web3j
@Ignore // The method shh_version does not exist/is not available
@Test
public void testShhVersion() throws Exception {
ShhVersion shhVersion = web3j.shhVersion().send();
assertNotNull(shhVersion.getVersion());
}
代码示例来源:origin: web3j/web3j
@Test
public void testEthGetUncleByBlockNumberAndIndex() throws Exception {
EthBlock ethBlock = web3j.ethGetUncleByBlockNumberAndIndex(
DefaultBlockParameter.valueOf(config.validUncleBlock()), BigInteger.ZERO)
.send();
assertNotNull(ethBlock.getBlock());
}
内容来源于网络,如有侵权,请联系作者删除!