Package io.keyko.common.web3
Class KeeperService
- java.lang.Object
-
- io.keyko.common.web3.KeeperService
-
public class KeeperService extends Object
-
-
Field Summary
Fields Modifier and Type Field Description private String
address
private org.web3j.crypto.Credentials
credentials
private String
credentialsFile
private static BigInteger
DEFAULT_GAS_LIMIT
private static BigInteger
DEFAULT_GAS_PRICE
private static int
DEFAULT_TX_ATTEMPS
private static long
DEFAULT_TX_SLEEP_DURATION
private BigInteger
gasLimit
private BigInteger
gasPrice
private org.web3j.tx.gas.ContractGasProvider
gasProvider
private Boolean
isInfuraNode
protected static org.apache.logging.log4j.Logger
log
private String
password
private int
txAttempts
private org.web3j.tx.TransactionManager
txManager
private long
txSleepDuration
private org.web3j.protocol.admin.Admin
web3Admin
private org.web3j.protocol.Web3j
web3j
-
Constructor Summary
Constructors Modifier Constructor Description private
KeeperService(String url, String address, String password, String credentialsFile, int txAttempts, long txSleepDuration)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAddress()
org.web3j.tx.gas.ContractGasProvider
getContractGasProvider()
static org.web3j.tx.gas.ContractGasProvider
getContractGasProviderInstance(BigInteger gasPrice, BigInteger gasLimit)
org.web3j.crypto.Credentials
getCredentials()
BigInteger
getGasLimit()
BigInteger
getGasPrice()
Boolean
getInfuraNode()
static KeeperService
getInstance(String url, String address, String password, String credentialsFile)
Initializes the KeeperService object given a Keeper url, user and passwordstatic KeeperService
getInstance(String url, String address, String password, String credentialsFile, int txAttempts, long txSleepDuration)
Initializes the KeeperService object given a Keeper url, user and passwordorg.web3j.tx.TransactionManager
getTxManager()
org.web3j.protocol.Web3j
getWeb3()
org.web3j.protocol.admin.Admin
getWeb3Admin()
Get the Web3j instanceKeeperService
setCredentials(org.web3j.crypto.Credentials credentials)
KeeperService
setGasLimit(BigInteger gasLimit)
KeeperService
setGasPrice(BigInteger gasPrice)
KeeperService
setTxManager(org.web3j.tx.TransactionManager txManager)
-
-
-
Field Detail
-
log
protected static final org.apache.logging.log4j.Logger log
-
web3Admin
private org.web3j.protocol.admin.Admin web3Admin
-
web3j
private org.web3j.protocol.Web3j web3j
-
isInfuraNode
private Boolean isInfuraNode
-
address
private String address
-
password
private String password
-
credentials
private org.web3j.crypto.Credentials credentials
-
credentialsFile
private String credentialsFile
-
txManager
private org.web3j.tx.TransactionManager txManager
-
gasProvider
private org.web3j.tx.gas.ContractGasProvider gasProvider
-
gasPrice
private BigInteger gasPrice
-
gasLimit
private BigInteger gasLimit
-
txAttempts
private int txAttempts
-
txSleepDuration
private long txSleepDuration
-
DEFAULT_GAS_PRICE
private static final BigInteger DEFAULT_GAS_PRICE
-
DEFAULT_GAS_LIMIT
private static final BigInteger DEFAULT_GAS_LIMIT
-
DEFAULT_TX_ATTEMPS
private static final int DEFAULT_TX_ATTEMPS
- See Also:
- Constant Field Values
-
DEFAULT_TX_SLEEP_DURATION
private static final long DEFAULT_TX_SLEEP_DURATION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
KeeperService
private KeeperService(String url, String address, String password, String credentialsFile, int txAttempts, long txSleepDuration) throws IOException, org.web3j.crypto.CipherException
- Throws:
IOException
org.web3j.crypto.CipherException
-
-
Method Detail
-
getInstance
public static KeeperService getInstance(String url, String address, String password, String credentialsFile, int txAttempts, long txSleepDuration) throws IOException, org.web3j.crypto.CipherException
Initializes the KeeperService object given a Keeper url, user and password- Parameters:
url
- Ethereum node url (ie. http://localhost:8545)address
- User ethereum addresspassword
- User passwordcredentialsFile
- Path to the file with the local credentialstxAttempts
- attempts to get the transaction receipttxSleepDuration
- time in milliseconds between each attempt- Returns:
- KeeperService
- Throws:
IOException
- IOExceptionorg.web3j.crypto.CipherException
- CipherException
-
getInstance
public static KeeperService getInstance(String url, String address, String password, String credentialsFile) throws IOException, org.web3j.crypto.CipherException
Initializes the KeeperService object given a Keeper url, user and password- Parameters:
url
- Ethereum node url (ie. http://localhost:8545)address
- User ethereum addresspassword
- User passwordcredentialsFile
- Path to the file with the local credentials- Returns:
- KeeperService
- Throws:
IOException
- IOExceptionorg.web3j.crypto.CipherException
- CipherException
-
getWeb3Admin
public org.web3j.protocol.admin.Admin getWeb3Admin()
Get the Web3j instance- Returns:
- web3j
-
getWeb3
public org.web3j.protocol.Web3j getWeb3()
-
setCredentials
public KeeperService setCredentials(org.web3j.crypto.Credentials credentials)
-
getInfuraNode
public Boolean getInfuraNode()
-
getCredentials
public org.web3j.crypto.Credentials getCredentials() throws IOException, org.web3j.crypto.CipherException
- Throws:
IOException
org.web3j.crypto.CipherException
-
getContractGasProviderInstance
public static org.web3j.tx.gas.ContractGasProvider getContractGasProviderInstance(BigInteger gasPrice, BigInteger gasLimit)
-
getTxManager
public org.web3j.tx.TransactionManager getTxManager()
-
setTxManager
public KeeperService setTxManager(org.web3j.tx.TransactionManager txManager)
-
getContractGasProvider
public org.web3j.tx.gas.ContractGasProvider getContractGasProvider()
-
getGasPrice
public BigInteger getGasPrice()
-
getGasLimit
public BigInteger getGasLimit()
-
setGasPrice
public KeeperService setGasPrice(BigInteger gasPrice)
-
setGasLimit
public KeeperService setGasLimit(BigInteger gasLimit)
-
getAddress
public String getAddress()
-
-