Package foundation.icon.icx
Class IconService
- java.lang.Object
-
- foundation.icon.icx.IconService
-
public class IconService extends java.lang.Object
IconService which provides APIs of ICON network.
-
-
Constructor Summary
Constructors Constructor Description IconService(Provider provider)
Creates an IconService instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addConverterFactory(RpcConverter.RpcConverterFactory factory)
Adds Converter factory.<T> Request<T>
call(Call<T> call)
Calls a SCORE read-only APIRequest<java.math.BigInteger>
estimateStep(Transaction transaction)
Gets an estimated step of how much step is necessary to allow the transaction to completeRequest<java.math.BigInteger>
getBalance(Address address)
Gets the balance of an addressRequest<Block>
getBlock(Bytes hash)
Gets a block matching the block hashRequest<Block>
getBlock(java.math.BigInteger height)
Gets a block matching the block numberRequest<Block>
getLastBlock()
Gets the last blockRequest<java.util.List<ScoreApi>>
getScoreApi(Address scoreAddress)
Gets information about the APIs in SCORERequest<java.math.BigInteger>
getTotalSupply()
Gets the total number of issued coinsRequest<ConfirmedTransaction>
getTransaction(Bytes hash)
Gets a transaction matching the given transaction hashRequest<TransactionResult>
getTransactionResult(Bytes hash)
Gets the result of a transaction by transaction hashRequest<Bytes>
sendTransaction(SignedTransaction signedTransaction)
Sends a transaction that changes the states of the account
-
-
-
Constructor Detail
-
IconService
public IconService(Provider provider)
Creates an IconService instance- Parameters:
provider
- the worker that transports requests
-
-
Method Detail
-
getTotalSupply
public Request<java.math.BigInteger> getTotalSupply()
Gets the total number of issued coins- Returns:
- a BigInteger object of the total number of coins in loop
-
getBalance
public Request<java.math.BigInteger> getBalance(Address address)
Gets the balance of an address- Parameters:
address
- the address to check the balance- Returns:
- a BigInteger object of the current balance for the given address in loop
-
getBlock
public Request<Block> getBlock(java.math.BigInteger height)
Gets a block matching the block number- Parameters:
height
- the block number- Returns:
- a
Block
object
-
getBlock
public Request<Block> getBlock(Bytes hash)
Gets a block matching the block hash- Parameters:
hash
- the block hash- Returns:
- a
Block
object
-
getScoreApi
public Request<java.util.List<ScoreApi>> getScoreApi(Address scoreAddress)
Gets information about the APIs in SCORE- Parameters:
scoreAddress
- the address to get APIs- Returns:
- a
ScoreApi
object
-
getTransaction
public Request<ConfirmedTransaction> getTransaction(Bytes hash)
Gets a transaction matching the given transaction hash- Parameters:
hash
- a transaction hash- Returns:
- a
ConfirmedTransaction
object
-
getTransactionResult
public Request<TransactionResult> getTransactionResult(Bytes hash)
Gets the result of a transaction by transaction hash- Parameters:
hash
- a transaction hash- Returns:
- a
TransactionResult
object
-
call
public <T> Request<T> call(Call<T> call)
Calls a SCORE read-only API- Type Parameters:
T
- the response type- Parameters:
call
- an instance of Call- Returns:
- a
Request
object that can execute the request
-
sendTransaction
public Request<Bytes> sendTransaction(SignedTransaction signedTransaction)
Sends a transaction that changes the states of the account- Parameters:
signedTransaction
- a transaction that was signed with the sender's wallet- Returns:
- a
Request
object that can execute the request (return type is txHash)
-
estimateStep
public Request<java.math.BigInteger> estimateStep(Transaction transaction)
Gets an estimated step of how much step is necessary to allow the transaction to complete- Parameters:
transaction
- a raw transaction without stepLimit and signature information- Returns:
- a
Request
object that can execute the request (return type is BigInteger) - Since:
- 0.9.12
-
addConverterFactory
public void addConverterFactory(RpcConverter.RpcConverterFactory factory)
Adds Converter factory. It has a create function that creates the converter of the specific type.- Parameters:
factory
- a converter factory
-
-