Java Code Examples for org.web3j.protocol.core.methods.response.TransactionReceipt#setStatus()
The following examples show how to use
org.web3j.protocol.core.methods.response.TransactionReceipt#setStatus() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ManagedTransactionTester.java From client-sdk-java with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") protected TransactionReceipt prepareTransfer() throws IOException { TransactionReceipt transactionReceipt = new TransactionReceipt(); transactionReceipt.setTransactionHash(TRANSACTION_HASH); transactionReceipt.setStatus("0x1"); prepareTransaction(transactionReceipt); PlatonGasPrice ethGasPrice = new PlatonGasPrice(); ethGasPrice.setResult("0x1"); Request<?, PlatonGasPrice> gasPriceRequest = mock(Request.class); when(gasPriceRequest.send()).thenReturn(ethGasPrice); when(web3j.platonGasPrice()).thenReturn((Request) gasPriceRequest); return transactionReceipt; }
Example 2
Source File: TransferTest.java From etherscan-explorer with GNU General Public License v3.0 | 6 votes |
@SuppressWarnings("unchecked") private TransactionReceipt prepareTransfer() throws IOException { TransactionReceipt transactionReceipt = new TransactionReceipt(); transactionReceipt.setTransactionHash(TRANSACTION_HASH); transactionReceipt.setStatus("0x1"); prepareTransaction(transactionReceipt); EthGasPrice ethGasPrice = new EthGasPrice(); ethGasPrice.setResult("0x1"); Request<?, EthGasPrice> gasPriceRequest = mock(Request.class); when(gasPriceRequest.send()).thenReturn(ethGasPrice); when(web3j.ethGasPrice()).thenReturn((Request) gasPriceRequest); return transactionReceipt; }
Example 3
Source File: ManagedTransactionTester.java From web3j with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") protected TransactionReceipt prepareTransfer() throws IOException { TransactionReceipt transactionReceipt = new TransactionReceipt(); transactionReceipt.setTransactionHash(TRANSACTION_HASH); transactionReceipt.setStatus("0x1"); prepareTransaction(transactionReceipt); EthGasPrice ethGasPrice = new EthGasPrice(); ethGasPrice.setResult("0x1"); Request<?, EthGasPrice> gasPriceRequest = mock(Request.class); when(gasPriceRequest.send()).thenReturn(ethGasPrice); when(web3j.ethGasPrice()).thenReturn((Request) gasPriceRequest); return transactionReceipt; }
Example 4
Source File: ContractTest.java From client-sdk-java with Apache License 2.0 | 5 votes |
@Test public void testTransaction() throws Exception { TransactionReceipt transactionReceipt = new TransactionReceipt(); transactionReceipt.setTransactionHash(TRANSACTION_HASH); transactionReceipt.setStatus("0x1"); prepareTransaction(transactionReceipt); assertThat(contract.performTransaction( new Address(BigInteger.TEN), new Uint256(BigInteger.ONE)).send(), is(transactionReceipt)); }
Example 5
Source File: ContractTest.java From client-sdk-java with Apache License 2.0 | 5 votes |
@Test public void testTransactionFailed() throws Exception { thrown.expect(TransactionException.class); thrown.expectMessage( "Transaction has failed with status: 0x0. Gas used: 1. (not-enough gas?)"); TransactionReceipt transactionReceipt = new TransactionReceipt(); transactionReceipt.setTransactionHash(TRANSACTION_HASH); transactionReceipt.setStatus("0x0"); transactionReceipt.setGasUsed("0x1"); prepareTransaction(transactionReceipt); contract.performTransaction( new Address(BigInteger.TEN), new Uint256(BigInteger.ONE)).send(); }
Example 6
Source File: ContractTest.java From client-sdk-java with Apache License 2.0 | 5 votes |
private TransactionReceipt createTransactionReceiptWithStatus(String status) { TransactionReceipt transactionReceipt = new TransactionReceipt(); transactionReceipt.setTransactionHash(TRANSACTION_HASH); transactionReceipt.setContractAddress(ADDRESS); transactionReceipt.setStatus(status); transactionReceipt.setGasUsed("0x1"); return transactionReceipt; }
Example 7
Source File: ContractTest.java From etherscan-explorer with GNU General Public License v3.0 | 5 votes |
@Test public void testTransaction() throws Exception { TransactionReceipt transactionReceipt = new TransactionReceipt(); transactionReceipt.setTransactionHash(TRANSACTION_HASH); transactionReceipt.setStatus("0x1"); prepareTransaction(transactionReceipt); assertThat(contract.performTransaction( new Address(BigInteger.TEN), new Uint256(BigInteger.ONE)).send(), is(transactionReceipt)); }
Example 8
Source File: ContractTest.java From etherscan-explorer with GNU General Public License v3.0 | 5 votes |
@Test public void testTransactionFailed() throws Exception { thrown.expect(TransactionException.class); thrown.expectMessage( "Transaction has failed with status: 0x0. Gas used: 1. (not-enough gas?)"); TransactionReceipt transactionReceipt = new TransactionReceipt(); transactionReceipt.setTransactionHash(TRANSACTION_HASH); transactionReceipt.setStatus("0x0"); transactionReceipt.setGasUsed("0x1"); prepareTransaction(transactionReceipt); contract.performTransaction( new Address(BigInteger.TEN), new Uint256(BigInteger.ONE)).send(); }
Example 9
Source File: ContractTest.java From etherscan-explorer with GNU General Public License v3.0 | 5 votes |
private TransactionReceipt createTransactionReceiptWithStatus(String status) { TransactionReceipt transactionReceipt = new TransactionReceipt(); transactionReceipt.setTransactionHash(TRANSACTION_HASH); transactionReceipt.setContractAddress(ADDRESS); transactionReceipt.setStatus(status); transactionReceipt.setGasUsed("0x1"); return transactionReceipt; }
Example 10
Source File: ResponseTest.java From etherscan-explorer with GNU General Public License v3.0 | 5 votes |
@Test public void testTransactionReceiptIsStatusOK() { TransactionReceipt transactionReceipt = new TransactionReceipt(); transactionReceipt.setStatus("0x1"); assertThat(transactionReceipt.isStatusOK(), equalTo(true)); TransactionReceipt transactionReceiptNoStatus = new TransactionReceipt(); assertThat(transactionReceiptNoStatus.isStatusOK(), equalTo(true)); TransactionReceipt transactionReceiptZeroStatus = new TransactionReceipt(); transactionReceiptZeroStatus.setStatus("0x0"); assertThat(transactionReceiptZeroStatus.isStatusOK(), equalTo(false)); }
Example 11
Source File: ContractTest.java From web3j with Apache License 2.0 | 5 votes |
@Test public void testTransaction() throws Exception { TransactionReceipt transactionReceipt = new TransactionReceipt(); transactionReceipt.setTransactionHash(TRANSACTION_HASH); transactionReceipt.setStatus(TXN_SUCCESS_STATUS); prepareTransaction(transactionReceipt); assertEquals( transactionReceipt, contract.performTransaction( new Address(BigInteger.TEN), new Uint256(BigInteger.ONE)) .send()); }
Example 12
Source File: ContractTest.java From web3j with Apache License 2.0 | 5 votes |
private TransactionReceipt createTransactionReceiptWithStatus(String status) { TransactionReceipt transactionReceipt = new TransactionReceipt(); transactionReceipt.setTransactionHash(TRANSACTION_HASH); transactionReceipt.setContractAddress(ADDRESS); transactionReceipt.setStatus(status); transactionReceipt.setGasUsed(TXN_GAS_USED); transactionReceipt.setBlockNumber(TXN_BLOCK_NUM); return transactionReceipt; }
Example 13
Source File: ResponseTest.java From web3j with Apache License 2.0 | 5 votes |
@Test public void testTransactionReceiptIsStatusOK() { TransactionReceipt transactionReceipt = new TransactionReceipt(); transactionReceipt.setStatus("0x1"); assertEquals(transactionReceipt.isStatusOK(), (true)); TransactionReceipt transactionReceiptNoStatus = new TransactionReceipt(); assertEquals(transactionReceiptNoStatus.isStatusOK(), (true)); TransactionReceipt transactionReceiptZeroStatus = new TransactionReceipt(); transactionReceiptZeroStatus.setStatus("0x0"); assertEquals(transactionReceiptZeroStatus.isStatusOK(), (false)); }