Package org.iota
Class Client
- java.lang.Object
-
- org.iota.apis.NativeApi
-
- org.iota.Client
-
public class Client extends NativeApi
-
-
Constructor Summary
Constructors Constructor Description Client(ClientConfig config)Creates a new client instance with the given configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringaliasIdToBech32(AliasId aliasId, java.lang.String bech32Hrp)Converts an alias id to a bech32 address.java.lang.Stringbech32ToHex(java.lang.String bech32)Converts a bech32 address to a hex addressOutputbuildAliasOutput(AliasOutputBuilderParams params)Builds an alias outputjava.util.Map.Entry<BlockId,Block>buildAndPostBlock(SecretManager secretManager, BuildBlockOptions options)Builds a block and posts it to the networkOutputbuildBasicOutput(BasicOutputBuilderParams params)Builds a basic outputOutputbuildFoundryOutput(FoundryOutputBuilderParams params)Builds a Foundry output object from the given parametersOutputbuildNftOutput(NftOutputBuilderParams params)Builds an NFT outputAliasIdcomputeAliasId(OutputId aliasOutputId)Computes the alias id for the given alias output idFoundryIdcomputeFoundryId(java.lang.String aliasAddress, int serialNumber, int tokenScheme)Computes the Foundry ID for a given alias address, serial number, and token schemeNftIdcomputeNftId(OutputId nftOutputId)Computes the NFT ID from the NFT output IDjava.lang.StringconsolidateFunds(SecretManager secretManager, GenerateAddressesOptions generateAddressesOptions)This function will consolidate all funds of the walletvoiddestroyHandle()Destroys this client instance and drops its database connection.Block[]findBlocks(BlockId[] blockIds)Finds blocks by their idsUtxoInput[]findInputs(java.lang.String[] addresses, int amount)Finds the inputs that are needed to create a transaction with the given amountjava.util.List<java.util.Map.Entry<Output,OutputMetadata>>findOutputs(OutputId[] outputIds, java.lang.String[] addresses)Finds outputs by their ids and addressesjava.lang.String[]generateAddresses(SecretManager secretManager, GenerateAddressesOptions generateAddressesOptions)Generate addresses for a given secret managerjava.lang.StringgenerateMnemonic()Generate a mnemonicOutputIdgetAliasOutputIdByAliasId(AliasId aliasId)The aliasId of the alias you want to get the outputId for.eturns the output id of an alias by its alias idOutputId[]getAliasOutputIds(NodeIndexerApi.QueryParams params)Returns the alias output ids that match the given query parametersOutputId[]getBasicOutputIds(NodeIndexerApi.QueryParams params)Returns the basic output ids that match the given query parametersjava.lang.StringgetBech32Hrp()Get the Bech32 HRP for the current networkBlockgetBlock(BlockId blockId)Get a block by its block idBlockIdgetBlockId(Block block)This function computes the block id of a blockBlockMetadatagetBlockMetadata(BlockId blockId)Get the metadata of a blockbyte[]getBlockRaw(BlockId blockId)Get the raw bytes of a blockbooleangetFallbackToLocalPow()Returns true if the client is configured to fallback to local proof of work if the remote proof of work service is unavailableOutputIdgetFoundryOutputIdByFoundryId(FoundryId foundryId)The aliasId of the alias you want to get the outputId for.OutputId[]getFoundryOutputIds(NodeIndexerApi.QueryParams params)Returns the Foundry output ids that match the given query parametersbooleangetHealth(java.lang.String nodeUrl)Get the health of a given node.BlockgetIncludedBlock(TransactionId transactionId)Returns the block that contains the transaction that was included in the ledger.LedgerNanoStatusgetLedgerNanoStatus(boolean isSimulator)Get the status of the Ledger Nano devicebooleangetLocalPow()Returns true if the local PoW is enabled, otherwise false.MilestonePayloadgetMilestoneById(MilestoneId milestoneId)Get the milestone payload for the given milestone idbyte[]getMilestoneByIdRaw(MilestoneId milestoneId)Returns the raw bytes of a milestone by its idMilestonePayloadgetMilestoneByIndex(int milestoneIndex)Get the milestone at the specified indexbyte[]getMilestoneByIndexRaw(int milestoneIndex)Returns the raw bytes of the milestone at the given indexfloatgetMinPowScore()Get the minimum PoW score required for a transaction to be acceptedintgetNetworkId()Get the network ID of the current networkcom.google.gson.JsonObjectgetNetworkInfo()Get network informationOutputIdgetNftOutputIdByNftId(NftId nftId)The aliasId of the alias you want to get the outputId for.OutputId[]getNftOutputIds(NodeIndexerApi.QueryParams params)Returns the NFT output ids that match the given query parametersNodegetNode()Get a nodeNodeInfoResponsegetNodeInfo()Get the node information of the given node.java.util.Map.Entry<Output,OutputMetadata>getOutput(OutputId outputId)Get the output with the given idOutputMetadatagetOutputMetadata(OutputId outputId)Get the metadata of an outputjava.util.List<java.util.Map.Entry<Output,OutputMetadata>>getOutputs(OutputId[] outputIds)Get the outputs for the given output IDsPeer[]getPeers()Get the list of peers connected to the nodeProtocolParametersResponsegetProtocolParameters()Returns the protocol parameters.Receipt[]getReceipts()Get all the receipts.Receipt[]getReceiptsMigratedAt(int milestoneIndex)Returns the list of all the receipts that were migrated at the given milestone indexBlockId[]getTips()Get the tips of the Tangle.intgetTipsInterval()Get the tips interval in secondsjava.lang.StringgetTokenSupply()Returns the token supply.TransactionIdgetTransactionId(TransactionPayload payload)This function returns a transaction ID for a given transaction payloadTreasuryResponsegetTreasury()Get the treasury balanceNode[]getUnhealthyNodes()Get the list of nodes that are not healthyUtxoChangesResponsegetUtxoChangesById(MilestoneId milestoneId)Returns the UTXO changes for the given milestone idUtxoChangesResponsegetUtxoChangesByIndex(int milestoneIndex)Returns the UTXO changes for the given milestone indexjava.lang.StringhexPublicKeyToBech32Address(java.lang.String hex, java.lang.String bech32)Converts a hex public key to a bech32 addressjava.lang.StringhexToBech32(java.lang.String hex, java.lang.String bech32)Converts a hex string to a bech32 stringbooleanisAddressValid(java.lang.String address)Checks if the given address is validjava.lang.StringmnemonicToHexSeed(java.lang.String mnemonic)Converts a mnemonic to a hex seedjava.lang.StringparseBech32Address(java.lang.String address)This function is used to parse the Bech32 addressBlockIdpostBlock(Block block)Post a block to the node.java.util.Map.Entry<BlockId,Block>postBlockPayload(BlockPayload payload)Automatically builds a block containing the given block payload and broadcasts it to the network.BlockIdpostBlockRaw(byte[] blockBytes)Post a block to the node.PreparedTransactionDataprepareTransaction(SecretManager secretManager, BuildBlockOptions buildBlockOptions)Prepares a transaction for signingjava.util.Map.Entry<BlockId,Block>promote(BlockId blockId)Promote a blockjava.util.Map.Entry<BlockId,Block>promoteUnchecked(BlockId blockId)Promote a block, without checking if it's necessary to.java.util.Map.Entry<BlockId,Block>reattach(BlockId blockId)Reattaches a block to the blockchainjava.util.Map.Entry<BlockId,Block>reattachUnchecked(BlockId blockId)ReattachUnchecked() reattaches a block to the tangle, without checking if it's necessary to.voidrequestTestFundsFromFaucet(java.lang.String address)Asks the faucet for the testnet funds.java.util.Map.Entry<BlockId,Block>retry(BlockId blockId)Retry a block that has failed to processjava.util.LinkedHashMap<BlockId,Block>retryUntilIncluded(BlockId blockId, int interval, int maxAttempts)Retry until the block is included in the blockchainTransactionPayloadsignTransaction(SecretManager secretManager, PreparedTransactionData preparedTransactionData)Signs the given prepared transaction using the secret managervoidstoreMnemonic(SecretManager secretManager, java.lang.String mnemonic)Stores the mnemonic in the secret managerjava.util.List<java.util.Map.Entry<Output,OutputMetadata>>tryGetOutputs(OutputId[] outputIds)Try get the outputs for the given output IDs-
Methods inherited from class org.iota.apis.NativeApi
sendCommand
-
-
-
-
Constructor Detail
-
Client
public Client(ClientConfig config) throws InitializeClientException
Creates a new client instance with the given configuration.- Parameters:
config- The configuration for the client.- Throws:
InitializeClientException- in case of initialization failure
-
-
Method Detail
-
destroyHandle
public void destroyHandle()
Destroys this client instance and drops its database connection. This client instance can no longer be used after.- Overrides:
destroyHandlein classNativeApi
-
getHealth
public boolean getHealth(java.lang.String nodeUrl) throws ClientExceptionGet the health of a given node.- Parameters:
nodeUrl- The URL of the node to check.- Returns:
- True if the node is healthy, false otherwise.
- Throws:
ClientException- on error.
-
getNodeInfo
public NodeInfoResponse getNodeInfo() throws ClientException
Get the node information of the given node.- Returns:
- The node information of the given node.
- Throws:
ClientException- on error.
-
getTips
public BlockId[] getTips() throws ClientException
Get the tips of the Tangle.- Returns:
- The tips of the Tangle.
- Throws:
ClientException- on error.
-
postBlock
public BlockId postBlock(Block block) throws ClientException
Post a block to the node.- Parameters:
block- The block to be posted.- Returns:
- The block id of the block that was posted.
- Throws:
ClientException- on error.
-
postBlockRaw
public BlockId postBlockRaw(byte[] blockBytes) throws ClientException
Post a block to the node.- Parameters:
blockBytes- The raw bytes of the block to be posted.- Returns:
- The block id of the block that was just posted.
- Throws:
ClientException- on error.
-
getBlock
public Block getBlock(BlockId blockId) throws ClientException
Get a block by its block id- Parameters:
blockId- The block ID of the block you want to retrieve.- Returns:
- A block object.
- Throws:
ClientException- on error.
-
getBlockRaw
public byte[] getBlockRaw(BlockId blockId) throws ClientException
Get the raw bytes of a block- Parameters:
blockId- The block ID of the block you want to get.- Returns:
- The raw bytes of the block.
- Throws:
ClientException- on error.
-
getBlockMetadata
public BlockMetadata getBlockMetadata(BlockId blockId) throws ClientException
Get the metadata of a block- Parameters:
blockId- The id of the block to get metadata for.- Returns:
- BlockMetadata
- Throws:
ClientException- on error.
-
getOutput
public java.util.Map.Entry<Output,OutputMetadata> getOutput(OutputId outputId) throws ClientException
Get the output with the given id- Parameters:
outputId- The id of the output you want to get.- Returns:
- A map entry with the output and its metadata.
- Throws:
ClientException- on error.
-
getOutputMetadata
public OutputMetadata getOutputMetadata(OutputId outputId) throws ClientException
Get the metadata of an output- Parameters:
outputId- The output ID of the output you want to get metadata for.- Returns:
- OutputMetadata
- Throws:
ClientException- on error.
-
getReceiptsMigratedAt
public Receipt[] getReceiptsMigratedAt(int milestoneIndex) throws ClientException
Returns the list of all the receipts that were migrated at the given milestone index- Parameters:
milestoneIndex- The index of the milestone to get the receipts for.- Returns:
- Receipts
- Throws:
ClientException- on error.
-
getReceipts
public Receipt[] getReceipts() throws ClientException
Get all the receipts.- Returns:
- An array of Receipt objects.
- Throws:
ClientException- on error.
-
getTreasury
public TreasuryResponse getTreasury() throws ClientException
Get the treasury balance- Returns:
- TreasuryResponse
- Throws:
ClientException- on error.
-
getIncludedBlock
public Block getIncludedBlock(TransactionId transactionId) throws ClientException
Returns the block that contains the transaction that was included in the ledger.- Parameters:
transactionId- The transaction that was included in the ledger.- Returns:
- A block that contains the transaction.
- Throws:
ClientException- on error.
-
getMilestoneById
public MilestonePayload getMilestoneById(MilestoneId milestoneId) throws ClientException
Get the milestone payload for the given milestone id- Parameters:
milestoneId- The milestone ID of the milestone you want to get.- Returns:
- A MilestonePayload object.
- Throws:
ClientException- on error.
-
getMilestoneByIndex
public MilestonePayload getMilestoneByIndex(int milestoneIndex) throws ClientException
Get the milestone at the specified index- Parameters:
milestoneIndex- The index of the milestone you want to retrieve.- Returns:
- A MilestonePayload object.
- Throws:
ClientException- on error.
-
getMilestoneByIdRaw
public byte[] getMilestoneByIdRaw(MilestoneId milestoneId) throws ClientException
Returns the raw bytes of a milestone by its id- Parameters:
milestoneId- The milestone ID to get the raw data for.- Returns:
- A byte array of the milestone data.
- Throws:
ClientException- on error.
-
getMilestoneByIndexRaw
public byte[] getMilestoneByIndexRaw(int milestoneIndex) throws ClientExceptionReturns the raw bytes of the milestone at the given index- Parameters:
milestoneIndex- The index of the milestone you want to retrieve.- Returns:
- The raw bytes of the milestone at the given index.
- Throws:
ClientException- on error.
-
getUtxoChangesById
public UtxoChangesResponse getUtxoChangesById(MilestoneId milestoneId) throws ClientException
Returns the UTXO changes for the given milestone id- Parameters:
milestoneId- The milestone id of the milestone to get the UTXO changes for.- Returns:
- The UTXO changes for the given milestone index.
- Throws:
ClientException- on error.
-
getUtxoChangesByIndex
public UtxoChangesResponse getUtxoChangesByIndex(int milestoneIndex) throws ClientException
Returns the UTXO changes for the given milestone index- Parameters:
milestoneIndex- The index of the milestone to get the UTXO changes for.- Returns:
- The UTXO changes for the given milestone index.
- Throws:
ClientException- on error.
-
getPeers
public Peer[] getPeers() throws ClientException
Get the list of peers connected to the node- Returns:
- An array of Peer objects.
- Throws:
ClientException- on error.
-
getBasicOutputIds
public OutputId[] getBasicOutputIds(NodeIndexerApi.QueryParams params) throws ClientException
Returns the basic output ids that match the given query parameters- Parameters:
params- a QueryParams object that contains the following fields:- Returns:
- An array of OutputIds.
- Throws:
ClientException- on error.
-
getAliasOutputIds
public OutputId[] getAliasOutputIds(NodeIndexerApi.QueryParams params) throws ClientException
Returns the alias output ids that match the given query parameters- Parameters:
params- a QueryParams object that contains the following fields:- Returns:
- An array of OutputIds.
- Throws:
ClientException- on error.
-
getNftOutputIds
public OutputId[] getNftOutputIds(NodeIndexerApi.QueryParams params) throws ClientException
Returns the NFT output ids that match the given query parameters- Parameters:
params- a QueryParams object that contains the following fields:- Returns:
- An array of OutputIds.
- Throws:
ClientException- on error.
-
getFoundryOutputIds
public OutputId[] getFoundryOutputIds(NodeIndexerApi.QueryParams params) throws ClientException
Returns the Foundry output ids that match the given query parameters- Parameters:
params- a QueryParams object that contains the following fields:- Returns:
- An array of OutputIds.
- Throws:
ClientException- on error.
-
getAliasOutputIdByAliasId
public OutputId getAliasOutputIdByAliasId(AliasId aliasId) throws ClientException
The aliasId of the alias you want to get the outputId for.eturns the output id of an alias by its alias id- Parameters:
aliasId- The aliasId of the alias you want to get the outputId for.- Returns:
- OutputId
- Throws:
ClientException- on error.
-
getNftOutputIdByNftId
public OutputId getNftOutputIdByNftId(NftId nftId) throws ClientException
The aliasId of the alias you want to get the outputId for.- Parameters:
nftId- The NFT Id of the NFT you want to get the outputId for.- Returns:
- OutputId
- Throws:
ClientException- on error.
-
getFoundryOutputIdByFoundryId
public OutputId getFoundryOutputIdByFoundryId(FoundryId foundryId) throws ClientException
The aliasId of the alias you want to get the outputId for.- Parameters:
foundryId- The id of the foundry you want to get the output id for.- Returns:
- The output id of the foundry.
- Throws:
ClientException- on error.
-
getOutputs
public java.util.List<java.util.Map.Entry<Output,OutputMetadata>> getOutputs(OutputId[] outputIds) throws ClientException
Get the outputs for the given output IDs- Parameters:
outputIds- An array of OutputId objects.- Returns:
- A list of entries, where each entry is a pair of an Output and its OutputMetadata.
- Throws:
ClientException- on error.
-
tryGetOutputs
public java.util.List<java.util.Map.Entry<Output,OutputMetadata>> tryGetOutputs(OutputId[] outputIds) throws ClientException
Try get the outputs for the given output IDs- Parameters:
outputIds- An array of OutputId objects.- Returns:
- A list of entries, where each entry is a pair of an output and its metadata.
- Throws:
ClientException- on error.
-
findBlocks
public Block[] findBlocks(BlockId[] blockIds) throws ClientException
Finds blocks by their ids- Parameters:
blockIds- An array of BlockId objects.- Returns:
- An array of blocks.
- Throws:
ClientException- on error.
-
retry
public java.util.Map.Entry<BlockId,Block> retry(BlockId blockId) throws ClientException
Retry a block that has failed to process- Parameters:
blockId- The id of the block to retry.- Returns:
- A map entry with the block id and the block.
- Throws:
ClientException- on error.
-
retryUntilIncluded
public java.util.LinkedHashMap<BlockId,Block> retryUntilIncluded(BlockId blockId, int interval, int maxAttempts) throws ClientException
Retry until the block is included in the blockchain- Parameters:
blockId- The block ID to retry.interval- The interval in seconds between each attempt to retrieve the block.maxAttempts- The maximum number of attempts to make before giving up.- Returns:
- A LinkedHashMap of BlockId and Block.
- Throws:
ClientException- on error.
-
consolidateFunds
public java.lang.String consolidateFunds(SecretManager secretManager, GenerateAddressesOptions generateAddressesOptions) throws ClientException
This function will consolidate all funds of the wallet- Parameters:
secretManager- The secret manager that holds the secret for the account you want to consolidate funds for.generateAddressesOptions- This is an object that contains the following parameters:- Returns:
- A String containing the transaction hash.
- Throws:
ClientException- on error.
-
findInputs
public UtxoInput[] findInputs(java.lang.String[] addresses, int amount) throws ClientException
Finds the inputs that are needed to create a transaction with the given amount- Parameters:
addresses- An array of addresses to search for inputs.amount- The amount you want to spend.- Returns:
- An array of UtxoInput objects.
- Throws:
ClientException- on error.
-
findOutputs
public java.util.List<java.util.Map.Entry<Output,OutputMetadata>> findOutputs(OutputId[] outputIds, java.lang.String[] addresses) throws ClientException
Finds outputs by their ids and addresses- Parameters:
outputIds- An array of OutputId objects.addresses- The addresses to search for outputs.- Returns:
- A list of outputs and their metadata.
- Throws:
ClientException- on error.
-
reattach
public java.util.Map.Entry<BlockId,Block> reattach(BlockId blockId) throws ClientException
Reattaches a block to the blockchain- Parameters:
blockId- The id of the block to reattach.- Returns:
- A map entry with the block id and the block.
- Throws:
ClientException- on error.
-
reattachUnchecked
public java.util.Map.Entry<BlockId,Block> reattachUnchecked(BlockId blockId) throws ClientException
ReattachUnchecked() reattaches a block to the tangle, without checking if it's necessary to.- Parameters:
blockId- The block id of the block to reattach.- Returns:
- A map entry with the block id and the block.
- Throws:
ClientException- on error.
-
promote
public java.util.Map.Entry<BlockId,Block> promote(BlockId blockId) throws ClientException
Promote a block- Parameters:
blockId- The id of the block to promote.- Returns:
- A map entry with the block id and the block.
- Throws:
ClientException- on error.
-
promoteUnchecked
public java.util.Map.Entry<BlockId,Block> promoteUnchecked(BlockId blockId) throws ClientException
Promote a block, without checking if it's necessary to.- Parameters:
blockId- The id of the block to promote.- Returns:
- A map entry with the block id and the block.
- Throws:
ClientException- on error.
-
bech32ToHex
public java.lang.String bech32ToHex(java.lang.String bech32) throws ClientExceptionConverts a bech32 address to a hex address- Parameters:
bech32- bech32 address- Returns:
- A hex string.
- Throws:
ClientException- on error.
-
hexToBech32
public java.lang.String hexToBech32(java.lang.String hex, java.lang.String bech32) throws ClientExceptionConverts a hex string to a bech32 string- Parameters:
hex- The hexadecimal string to be converted.bech32- The bech32 to use.- Returns:
- The bech32 address.
- Throws:
ClientException- on error.
-
aliasIdToBech32
public java.lang.String aliasIdToBech32(AliasId aliasId, java.lang.String bech32Hrp) throws ClientException
Converts an alias id to a bech32 address.- Parameters:
aliasId- The alias id to be converted.bech32Hrp- The bech 32 human readable part to use.- Returns:
- The bech32 address.
- Throws:
ClientException- on error.
-
hexPublicKeyToBech32Address
public java.lang.String hexPublicKeyToBech32Address(java.lang.String hex, java.lang.String bech32) throws ClientExceptionConverts a hex public key to a bech32 address- Parameters:
hex- The public key in hexadecimal format.bech32- The bech32 prefix- Returns:
- The bech32 address.
- Throws:
ClientException- on error.
-
parseBech32Address
public java.lang.String parseBech32Address(java.lang.String address) throws ClientExceptionThis function is used to parse the Bech32 address- Parameters:
address- The address to be parsed.- Returns:
- The address in hex format.
- Throws:
ClientException- on error.
-
isAddressValid
public boolean isAddressValid(java.lang.String address) throws ClientExceptionChecks if the given address is valid- Parameters:
address- The address to validate.- Returns:
- A boolean value.
- Throws:
ClientException- on error.
-
generateMnemonic
public java.lang.String generateMnemonic() throws ClientExceptionGenerate a mnemonic- Returns:
- The mnemonic string.
- Throws:
ClientException- on error.
-
mnemonicToHexSeed
public java.lang.String mnemonicToHexSeed(java.lang.String mnemonic) throws ClientExceptionConverts a mnemonic to a hex seed- Parameters:
mnemonic- The mnemonic to convert to a hex seed.- Returns:
- A hex seed.
- Throws:
ClientException- on error.
-
getBlockId
public BlockId getBlockId(Block block) throws ClientException
This function computes the block id of a block- Parameters:
block- The block to compute the block id from.- Returns:
- The block id of the block.
- Throws:
ClientException- on error.
-
getTransactionId
public TransactionId getTransactionId(TransactionPayload payload) throws ClientException
This function returns a transaction ID for a given transaction payload- Parameters:
payload- The payload of the transaction.- Returns:
- A TransactionId object.
- Throws:
ClientException- on error.
-
computeAliasId
public AliasId computeAliasId(OutputId aliasOutputId) throws ClientException
Computes the alias id for the given alias output id- Parameters:
aliasOutputId- The output ID of the alias.- Returns:
- The alias id of the output id.
- Throws:
ClientException- on error.
-
computeNftId
public NftId computeNftId(OutputId nftOutputId) throws ClientException
Computes the NFT ID from the NFT output ID- Parameters:
nftOutputId- The output id of the NFT.- Returns:
- The NFT ID of the NFT output.
- Throws:
ClientException- on error.
-
computeFoundryId
public FoundryId computeFoundryId(java.lang.String aliasAddress, int serialNumber, int tokenScheme) throws ClientException
Computes the Foundry ID for a given alias address, serial number, and token scheme- Parameters:
aliasAddress- The alias address of the device.serialNumber- The serial number of the token.tokenScheme- The token scheme to use. This is a value from the TokenScheme enum.- Returns:
- A FoundryId object.
- Throws:
ClientException- on error.
-
buildAliasOutput
public Output buildAliasOutput(AliasOutputBuilderParams params) throws ClientException
Builds an alias output- Parameters:
params- AliasOutputBuilderParams- Returns:
- An output object.
- Throws:
ClientException- on error.
-
buildBasicOutput
public Output buildBasicOutput(BasicOutputBuilderParams params) throws ClientException
Builds a basic output- Parameters:
params- The parameters for the request.- Returns:
- An output object.
- Throws:
ClientException- on error.
-
buildFoundryOutput
public Output buildFoundryOutput(FoundryOutputBuilderParams params) throws ClientException
Builds a Foundry output object from the given parameters- Parameters:
params- FoundryOutputBuilderParams- Returns:
- An output object.
- Throws:
ClientException- on error.
-
buildNftOutput
public Output buildNftOutput(NftOutputBuilderParams params) throws ClientException
Builds an NFT output- Parameters:
params- NftOutputBuilderParams- Returns:
- Output
- Throws:
ClientException- on error.
-
generateAddresses
public java.lang.String[] generateAddresses(SecretManager secretManager, GenerateAddressesOptions generateAddressesOptions) throws ClientException
Generate addresses for a given secret manager- Parameters:
secretManager- The secret manager to use for generating the addresses.generateAddressesOptions- The options for generating addresses.- Returns:
- A list of addresses
- Throws:
ClientException- on error.
-
buildAndPostBlock
public java.util.Map.Entry<BlockId,Block> buildAndPostBlock(SecretManager secretManager, BuildBlockOptions options) throws ClientException
Builds a block and posts it to the network- Parameters:
secretManager- The secret manager to use for signing the block.options- The options for building the block.- Returns:
- A map entry with the block id and the block itself.
- Throws:
ClientException- on error.
-
getNode
public Node getNode() throws ClientException
Get a node- Returns:
- The node object.
- Throws:
ClientException- on error.
-
getNetworkInfo
public com.google.gson.JsonObject getNetworkInfo() throws ClientExceptionGet network information- Returns:
- A JsonObject
- Throws:
ClientException- on error.
-
getNetworkId
public int getNetworkId() throws ClientExceptionGet the network ID of the current network- Returns:
- The network ID of the current network.
- Throws:
ClientException- on error.
-
getBech32Hrp
public java.lang.String getBech32Hrp() throws ClientExceptionGet the Bech32 HRP for the current network- Returns:
- The Bech32 Human Readable Part (HRP) for addresses.
- Throws:
ClientException- on error.
-
getMinPowScore
public float getMinPowScore() throws ClientExceptionGet the minimum PoW score required for a transaction to be accepted- Returns:
- The minimum PoW score.
- Throws:
ClientException- on error.
-
getTipsInterval
public int getTipsInterval() throws ClientExceptionGet the tips interval in seconds- Returns:
- The interval in seconds.
- Throws:
ClientException- on error.
-
getLocalPow
public boolean getLocalPow() throws ClientExceptionReturns true if the local PoW is enabled, otherwise false.- Returns:
- true if the local PoW is enabled, otherwise false.
- Throws:
ClientException- on error.
-
getFallbackToLocalPow
public boolean getFallbackToLocalPow() throws ClientExceptionReturns true if the client is configured to fallback to local proof of work if the remote proof of work service is unavailable- Returns:
- true if the client is configured to fallback to local proof of work, else returns false.
- Throws:
ClientException- on error.
-
getUnhealthyNodes
public Node[] getUnhealthyNodes() throws ClientException
Get the list of nodes that are not healthy- Returns:
- The array of nodes that are not healthy.
- Throws:
ClientException- on error.
-
getLedgerNanoStatus
public LedgerNanoStatus getLedgerNanoStatus(boolean isSimulator) throws ClientException
Get the status of the Ledger Nano device- Parameters:
isSimulator- true if you want to use the simulator, false if you want to use the real device.- Returns:
- LedgerNanoStatus
- Throws:
ClientException- on error.
-
prepareTransaction
public PreparedTransactionData prepareTransaction(SecretManager secretManager, BuildBlockOptions buildBlockOptions) throws ClientException
Prepares a transaction for signing- Parameters:
secretManager- The secret manager that holds the secret for the account.buildBlockOptions- This is the object that contains the transaction details.- Returns:
- The prepared transaction.
- Throws:
ClientException- on error.
-
signTransaction
public TransactionPayload signTransaction(SecretManager secretManager, PreparedTransactionData preparedTransactionData) throws ClientException
Signs the given prepared transaction using the secret manager- Parameters:
secretManager- The secret manager that holds the secret key for the account that will sign the transaction.preparedTransactionData- The transaction data that was prepared by the prepareTransaction method.- Returns:
- The signed transaction.
- Throws:
ClientException- on error.
-
storeMnemonic
public void storeMnemonic(SecretManager secretManager, java.lang.String mnemonic) throws ClientException
Stores the mnemonic in the secret manager- Parameters:
secretManager- The secret manager to use.mnemonic- The mnemonic to store.- Throws:
ClientException- on error.
-
postBlockPayload
public java.util.Map.Entry<BlockId,Block> postBlockPayload(BlockPayload payload) throws ClientException
Automatically builds a block containing the given block payload and broadcasts it to the network.- Parameters:
payload- The payload to be posted.- Returns:
- A map entry of the posted block id and the block.
- Throws:
ClientException- on error.
-
getTokenSupply
public java.lang.String getTokenSupply() throws ClientExceptionReturns the token supply.- Returns:
- The token supply.
- Throws:
ClientException- on error.
-
getProtocolParameters
public ProtocolParametersResponse getProtocolParameters() throws ClientException
Returns the protocol parameters.- Returns:
- The protocol parameters.
- Throws:
ClientException- on error.
-
requestTestFundsFromFaucet
public void requestTestFundsFromFaucet(java.lang.String address) throws ClientException, NoFundsReceivedFromFaucetExceptionAsks the faucet for the testnet funds.- Throws:
NoFundsReceivedFromFaucetException- when the faucet didn't fund the address.ClientException
-
-