0

I am trying to make a transfer using the function sendFundsEIP1559() from the org.web3j.tx.Transfer package like this:

    org.web3j.tx.Transfer testTansfer = new org.web3j.tx.Transfer(web3j, transactionManager);
     
     RemoteCall<TransactionReceipt> remoteCall = testTansfer.sendFundsEIP1559(
                web3j, 
                objCredentials, 
                "0xc60e4Ae2EfE9B8f991E6967cF317Cc39c634ggb9", 
                BigDecimal.valueOf(objTransfer.getTokens()), 
                Convert.Unit.WEI, 
                contractGasProvider.getGasLimit(FUNC_TRANSFER), 
                contractGasProvider.getGasPrice(FUNC_TRANSFER),
                null);

But I got the error:

The static method sendFundsEIP1559(Web3j, Credentials, String, BigDecimal, Convert.Unit, BigInteger, BigInteger, BigInteger) from the type Transfer should be accessed in a static way

I need to set the Transfer constructor previously because it´s necesary to set the provider, chainId, etc.

The versions of web3j and java that I use are:

web3j: 4.8.4

Java: 8

Has anyone had this happen before?

TylerH
  • 20,799
  • 66
  • 75
  • 101
dariusjvc
  • 1
  • 4
  • The error message is pretty descriptive, see here: https://stackoverflow.com/questions/5642834/why-should-the-static-field-be-accessed-in-a-static-way – STerliakov Jul 06 '23 at 09:40
  • Yes, the solution would be to use "org.web3j.tx.Transfer.sendFundsEIP1559()" directly, but in this way I can´t set the constructor of Transfer. Do you know how to set the Transfer constructor and then be able to use sendFundsEIP1559? – dariusjvc Jul 06 '23 at 09:50
  • What you're saying is kinda controversial: it's a static method intended to be called on class, not on an instance. It does not rely on anything set in class constructor. Why do you need that? – STerliakov Jul 06 '23 at 09:51

0 Answers0