| | |
| | | //private static final String ETH_UTL = "http://120.55.86.146:8545";
|
| | | // private static final String ETH_UTL = "http://114.55.250.231:8545";
|
| | | private static final String ETH_UTL = "https://mainnet.infura.io/v3/f54a5887a3894ebb9425920701a97fe0";
|
| | | private static final String OWNER_ADDRESS = "0x391040eE5F241711E763D0AC55E775B9b4bD0024";
|
| | | private static final String OWNER_PRIVATE = "87c38ecbfa5ff8a38c6c428dc609ba7cd230dbf54b55bb2d900f40dd3acd9f37";
|
| | | private static final String OWNER_ADDRESS = "0xD998DA7362360eFC6daDFEd6E9a32E70640d7600";
|
| | | private static final String OWNER_PRIVATE = "06f95d3edf59888708d485d06b8b3e3f9aaa6b40d693018a1d19a7be95fe9419";
|
| | |
|
| | | public EthService() {
|
| | | try {
|
| | |
| | | }
|
| | |
|
| | | public static void main(String[] args) throws IOException {
|
| | | HttpService service = new HttpService(ETH_UTL);
|
| | | Web3j build = Web3j.build(service);
|
| | | //Request<?, EthTransaction> ethTransactionRequest = build.ethGetTransactionByHash("0xa3e6a0ccc3aac30d866a86ca9c0477dd58b7b061787ba40b16c3844803273816");
|
| | | Request<?, EthGetTransactionReceipt> ethGetTransactionReceiptRequest = build.ethGetTransactionReceipt("0xa3e6a0ccc3aac30d866a86ca9c0477dd58b7b061787ba40b16c3844803273816");
|
| | | EthGetTransactionReceipt send = ethGetTransactionReceiptRequest.send();
|
| | | String status = send.getResult().getStatus();
|
| | | System.out.println(status);//0x1
|
| | | // HttpService service = new HttpService(ETH_UTL);
|
| | | // Web3j build = Web3j.build(service);
|
| | | // //Request<?, EthTransaction> ethTransactionRequest = build.ethGetTransactionByHash("0xa3e6a0ccc3aac30d866a86ca9c0477dd58b7b061787ba40b16c3844803273816");
|
| | | // Request<?, EthGetTransactionReceipt> ethGetTransactionReceiptRequest = build.ethGetTransactionReceipt("0xa3e6a0ccc3aac30d866a86ca9c0477dd58b7b061787ba40b16c3844803273816");
|
| | | // EthGetTransactionReceipt send = ethGetTransactionReceiptRequest.send();
|
| | | // String status = send.getResult().getStatus();
|
| | | // System.out.println(status);//0x1
|
| | | // EthTransaction send = ethTransactionRequest.send();
|
| | | // String input = send.getResult().getInput();
|
| | | // System.out.println(input);
|
| | | System.out.println(new EthService().ethAllowance("0x391040ee5f241711e763d0ac55e775b9b4bd0024"));
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | outputParameters.add(typeReference);
|
| | |
|
| | | Function function = new Function(methodName,
|
| | | Arrays.asList(new Address(toAddress), new Address(fromAddress))
|
| | | Arrays.asList(new Address(fromAddress), new Address(toAddress))
|
| | | , outputParameters);
|
| | | String data = FunctionEncoder.encode(function);
|
| | | Transaction transaction = Transaction.createEthCallTransaction(fromAddress, contractAddress, data);
|
| | | Transaction transaction = Transaction.createEthCallTransaction(toAddress, contractAddress, data);
|
| | |
|
| | | EthCall ethCall = null;
|
| | | try {
|
| | |
| | | }
|
| | |
|
| | |
|
| | |
|
| | | }
|