org.web3j.tx.gas.DefaultGasProvider Java Examples
The following examples show how to use
org.web3j.tx.gas.DefaultGasProvider.
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: ContractTest.java From web3j with Apache License 2.0 | 6 votes |
@Test public void testDeployInvalidContractAddress() throws Throwable { TransactionReceipt transactionReceipt = new TransactionReceipt(); transactionReceipt.setTransactionHash(TRANSACTION_HASH); prepareTransaction(transactionReceipt); ContractGasProvider contractGasProvider = new DefaultGasProvider(); String encodedConstructor = FunctionEncoder.encodeConstructor( Collections.<Type>singletonList(new Uint256(BigInteger.TEN))); assertThrows( RuntimeException.class, () -> TestContract.deployRemoteCall( TestContract.class, web3j, SampleKeys.CREDENTIALS, contractGasProvider, "0xcafed00d", encodedConstructor, BigInteger.ZERO) .send()); }
Example #2
Source File: ContractTest.java From web3j with Apache License 2.0 | 6 votes |
private Contract deployContract(TransactionReceipt transactionReceipt) throws Exception { prepareTransaction(transactionReceipt); String encodedConstructor = FunctionEncoder.encodeConstructor( Collections.<Type>singletonList(new Uint256(BigInteger.TEN))); ContractGasProvider contractGasProvider = new DefaultGasProvider(); return TestContract.deployRemoteCall( TestContract.class, web3j, getVerifiedTransactionManager(SampleKeys.CREDENTIALS), contractGasProvider, "0xcafed00d", encodedConstructor, BigInteger.ZERO) .send(); }
Example #3
Source File: ContractTest.java From client-sdk-java with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { super.setUp(); contract = new TestContract( ADDRESS, web3j, getVerifiedTransactionManager(SampleKeys.CREDENTIALS), new DefaultGasProvider()); }
Example #4
Source File: ContractTest.java From client-sdk-java with Apache License 2.0 | 5 votes |
@Test(expected = TransactionException.class) public void testTimeout() throws Throwable { prepareTransaction(null); TransactionManager transactionManager = getVerifiedTransactionManager(SampleKeys.CREDENTIALS, 1, 1); contract = new TestContract( ADDRESS, web3j, transactionManager, new DefaultGasProvider()); testErrorScenario(); }
Example #5
Source File: DepositContractAccessor.java From teku with Apache License 2.0 | 5 votes |
public static DepositContractAccessor create( Eth1Provider eth1Provider, Web3j web3j, String address) { DepositContract contract = DepositContract.load( address, web3j, new ClientTransactionManager(web3j, address), new DefaultGasProvider()); return new DepositContractAccessor(eth1Provider, contract); }
Example #6
Source File: DepositTransactionSender.java From teku with Apache License 2.0 | 5 votes |
public DepositTransactionSender( final Web3j web3j, final Eth1Address depositContractAddress, final Credentials eth1Credentials) { this.depositContract = DepositContract.load( depositContractAddress.toHexString(), web3j, new FastRawTransactionManager( web3j, eth1Credentials, new PollingTransactionReceiptProcessor( web3j, POLL_INTERVAL_MILLIS, MAX_POLL_ATTEMPTS)), new DefaultGasProvider()); }
Example #7
Source File: SimpleStorageContractIT.java From web3j with Apache License 2.0 | 5 votes |
@Test public void testSimpleStorageContract() throws Exception { BigInteger value = BigInteger.valueOf(1000L); ContractGasProvider contractGasProvider = new DefaultGasProvider(); SimpleStorage simpleStorage = SimpleStorage.deploy(web3j, ALICE, contractGasProvider).send(); assertNotNull(simpleStorage.set(value).send()); assertEquals(simpleStorage.get().send(), (value)); }
Example #8
Source File: EnsResolver.java From web3j with Apache License 2.0 | 5 votes |
private PublicResolver lookupResolver(String ensName) throws Exception { NetVersion netVersion = web3j.netVersion().send(); String registryContract = Contracts.resolveRegistryContract(netVersion.getNetVersion()); ENS ensRegistry = ENS.load(registryContract, web3j, transactionManager, new DefaultGasProvider()); byte[] nameHash = NameHash.nameHashAsBytes(ensName); String resolverAddress = ensRegistry.resolver(nameHash).send(); return PublicResolver.load( resolverAddress, web3j, transactionManager, new DefaultGasProvider()); }
Example #9
Source File: ContractTest.java From web3j with Apache License 2.0 | 5 votes |
@BeforeEach public void setUp() throws Exception { super.setUp(); contract = new TestContract( ADDRESS, web3j, getVerifiedTransactionManager(SampleKeys.CREDENTIALS), new DefaultGasProvider()); }
Example #10
Source File: ContractTest.java From web3j with Apache License 2.0 | 5 votes |
@Test public void testIsValidNoBinThrows() { TransactionManager txManager = mock(TransactionManager.class); TestContract contract = new TestContract( Contract.BIN_NOT_PROVIDED, ADDRESS, web3j, txManager, new DefaultGasProvider()); assertThrows(UnsupportedOperationException.class, contract::isValid); }
Example #11
Source File: ContractTest.java From web3j with Apache License 2.0 | 5 votes |
@Test public void testTimeout() throws IOException { prepareTransaction(null); TransactionManager transactionManager = getVerifiedTransactionManager(SampleKeys.CREDENTIALS, 1, 1); contract = new TestContract(ADDRESS, web3j, transactionManager, new DefaultGasProvider()); assertThrows(TransactionException.class, this::testErrorScenario); }
Example #12
Source File: ContractTest.java From web3j with Apache License 2.0 | 5 votes |
@Test public void testSetGetGasPrice() { assertEquals(DefaultGasProvider.GAS_PRICE, contract.getGasPrice()); BigInteger newPrice = ManagedTransaction.GAS_PRICE.multiply(BigInteger.valueOf(2)); contract.setGasPrice(newPrice); assertEquals(newPrice, contract.getGasPrice()); }
Example #13
Source File: ArraysIT.java From web3j with Apache License 2.0 | 4 votes |
@BeforeEach @Override public void setUp() throws Exception { super.setUp(); this.contract = Arrays.deploy(web3j, ALICE, new DefaultGasProvider()).send(); }
Example #14
Source File: EthCallIT.java From web3j with Apache License 2.0 | 4 votes |
@BeforeEach @Override public void setUp() throws Exception { super.setUp(); this.contract = Revert.deploy(web3j, ALICE, new DefaultGasProvider()).send(); }