public class IotaAPI extends IotaAPICore
IotaApiProxy api = IotaApiProxy.Builder
.protocol("http")
.nodeAddress("localhost")
.port(12345)
.build();
GetNodeInfoResponse response = api.getNodeInfo();
Modifier and Type | Class and Description |
---|---|
static class |
IotaAPI.Builder |
Modifier | Constructor and Description |
---|---|
protected |
IotaAPI(IotaAPI.Builder builder) |
Modifier and Type | Method and Description |
---|---|
List<String> |
addRemainder(String seed,
int security,
List<Input> inputs,
Bundle bundle,
String tag,
long totalValue,
String remainderAddress,
List<String> signatureFragments)
Uses input, and adds to the bundle, untill totalValue is reached.
|
Bundle[] |
bundlesFromAddresses(String[] addresses,
Boolean inclusionStates)
Internal function to get the formatted bundles of a list of addresses.
|
boolean[] |
checkWereAddressSpentFrom(String... addresses)
Check if a list of addresses was ever spent from, in the current epoch, or in previous epochs.
|
Boolean |
checkWereAddressSpentFrom(String address)
Check if an addresses was ever spent from, in the current epoch, or in previous epochs.
|
List<Transaction> |
findTransactionObjectsByAddresses(String[] addresses)
Wrapper function: Finds transactions, gets trytes and turns it into
Transaction objects. |
List<Transaction> |
findTransactionObjectsByApprovees(String[] approvees)
Wrapper function: Finds transactions, gets trytes and turns it into
Transaction objects. |
List<Transaction> |
findTransactionObjectsByBundle(String[] bundles)
Wrapper function: Finds transactions, gets trytes and turns it into
Transaction objects. |
List<Transaction> |
findTransactionObjectsByTag(String[] tags)
Wrapper function: Finds transactions, gets trytes and turns it into
Transaction objects. |
List<Transaction> |
findTransactionsObjectsByHashes(String[] hashes)
Wrapper function: get trytes and turns into
Transaction objects. |
GetNewAddressResponse |
generateNewAddresses(String seed,
int security,
boolean checksum,
int amount)
Generates new addresses, meaning addresses which were not spend from, according to the connected node.
|
GetNewAddressResponse |
generateNewAddresses(String seed,
int security,
boolean checksum,
int index,
int amount)
Generates new addresses, meaning addresses which were not spend from, according to the connected node.
|
GetNewAddressResponse |
generateNewAddresses(String seed,
int security,
boolean checksum,
int index,
int amount,
boolean addSpendAddresses)
Generates new addresses, meaning addresses which were not spend from, according to the connected node.
|
GetAccountDataResponse |
getAccountData(String seed,
int security,
int index,
boolean checksum,
int total,
boolean returnAll,
int start,
int end,
boolean inclusionStates,
long threshold)
Similar to getTransfers, just that it returns additional account data
|
GetNewAddressResponse |
getAddressesUnchecked(String seed,
int security,
boolean checksum,
int index,
int amount)
Generates
amount of addresses, starting from index
This does not mean that these addresses are safe to use (unspent) |
GetBalancesAndFormatResponse |
getBalanceAndFormat(List<String> addresses,
List<String> tips,
long threshold,
int start,
StopWatch stopWatch,
int security)
Gets the balances and formats the output.
|
GetBundleResponse |
getBundle(String transaction)
Gets the associated bundle transactions of a single transaction.
|
GetBalancesAndFormatResponse |
getInputs(String seed,
int security,
int start,
int end,
long threshold,
String... tips)
Gets the inputs of a seed
|
GetInclusionStateResponse |
getLatestInclusion(String[] hashes)
Wrapper function: runs getNodeInfo and getInclusionStates
Uses the latest milestone as tip
|
GetNewAddressResponse |
getNewAddress(String seed,
int security,
int index,
boolean checksum,
int total,
boolean returnAll)
Deprecated.
|
GetNewAddressResponse |
getNextAvailableAddress(String seed,
int security,
boolean checksum)
Checks all addresses until the first unspent address is found.
|
GetNewAddressResponse |
getNextAvailableAddress(String seed,
int security,
boolean checksum,
int index)
Checks all addresses until the first unspent address is found.
|
GetTransferResponse |
getTransfers(String seed,
int security,
Integer start,
Integer end,
Boolean inclusionStates)
Finds all the bundles for all the addresses based on this seed and security.
|
List<Transaction> |
initiateTransfer(int securitySum,
String inputAddress,
String remainderAddress,
List<Transfer> transfers)
Prepares transfer by generating the bundle with the corresponding cosigner transactions.
|
List<Transaction> |
initiateTransfer(int securitySum,
String inputAddress,
String remainderAddress,
List<Transfer> transfers,
boolean testMode)
Prepares transfer by generating the bundle with the corresponding cosigner transactions.
|
List<Transaction> |
initiateTransfer(int securitySum,
String inputAddress,
String remainderAddress,
List<Transfer> transfers,
List<Transaction> tips)
Prepares transfer by generating the bundle with the corresponding cosigner transactions.
|
List<Transaction> |
initiateTransfer(int securitySum,
String inputAddress,
String remainderAddress,
List<Transfer> transfers,
List<Transaction> tips,
boolean testMode)
Prepares transfer by generating the bundle with the corresponding cosigner transactions.
|
boolean |
isPromotable(String tail)
Checks if a transaction hash is promotable
|
boolean |
isPromotable(Transaction tail)
Checks if a transaction hash is promotable
|
List<String> |
prepareTransfers(String seed,
int security,
List<Transfer> transfers,
String remainder,
List<Input> inputs,
List<Transaction> tips,
boolean validateInputs)
Prepares transfer by generating bundle, finding and signing inputs.
|
List<Transaction> |
promoteTransaction(String tail,
int depth,
int minWeightMagnitude,
Bundle bundle)
Attempts to promote a transaction using a provided bundle and, if successful, returns the promoting Transactions.
|
ReplayBundleResponse |
replayBundle(String tailTransactionHash,
int depth,
int minWeightMagnitude,
String reference)
Replays a transfer by doing Proof of Work again.
|
SendTransferResponse |
sendTransfer(String seed,
int security,
int depth,
int minWeightMagnitude,
List<Transfer> transfers,
List<Input> inputs,
String remainderAddress,
boolean validateInputs,
boolean validateInputAddresses,
List<Transaction> tips)
Wrapper function: Runs prepareTransfers, as well as attachToTangle.
|
List<Transaction> |
sendTrytes(String[] trytes,
int depth,
int minWeightMagnitude,
String reference)
Wrapper method: Gets transactions to approve, attaches to Tangle, broadcasts and stores.
|
BroadcastTransactionsResponse |
storeAndBroadcast(String... trytes)
Wrapper method: stores and broadcasts the specified trytes.
|
Bundle |
traverseBundle(String trunkTx,
String bundleHash,
Bundle bundle)
Traverses the Bundle by going down the trunkTransactions until the bundle hash of the transaction changes.
|
void |
validateTransfersAddresses(String seed,
int security,
List<String> trytes)
Validates the supplied transactions with seed and security.
|
addNeighbors, attachToTangle, broadcastTransactions, checkConsistency, findTransactions, findTransactionsByAddresses, findTransactionsByApprovees, findTransactionsByBundles, findTransactionsByDigests, getBalances, getBalances, getHost, getInclusionStates, getNeighbors, getNodeInfo, getPort, getProtocol, getTips, getTransactionsToApprove, getTransactionsToApprove, getTrytes, interruptAttachingToTangle, removeNeighbors, storeTransactions, wereAddressesSpentFrom, wrapCheckedException
protected IotaAPI(IotaAPI.Builder builder)
@Deprecated public GetNewAddressResponse getNewAddress(String seed, int security, int index, boolean checksum, int total, boolean returnAll) throws ArgumentException
Generates a new address from a seed and returns the remainderAddress. This is either done deterministically, or by providing the index of the new remainderAddress.
Deprecated - Use the new functionsgetNextAvailableAddress(java.lang.String, int, boolean)
, getAddressesUnchecked(java.lang.String, int, boolean, int, int)
and generateNewAddresses(java.lang.String, int, boolean, int)
seed
- Tryte-encoded seed. It should be noted that this seed is not transferred.security
- Security level to be used for the private key / address. Can be 1, 2 or 3.index
- Key index to start search from. If the index is provided, the generation of the address is not deterministic.checksum
- Adds 9-tryte address checksum.total
- Total number of addresses to generate.returnAll
- If true
, it returns all addresses which were deterministically generated (until findTransactions returns null).GetNewAddressResponse
ArgumentException
- is thrown when the specified input is not valid.public GetNewAddressResponse getNextAvailableAddress(String seed, int security, boolean checksum) throws ArgumentException
seed
- Tryte-encoded seed. It should be noted that this seed is not transferred.security
- Security level to be used for the private key / address. Can be 1, 2 or 3.checksum
- Adds 9-tryte address checksum.GetNewAddressResponse
ArgumentException
- When the seed is invalidArgumentException
- When the security level is wrong.public GetNewAddressResponse getNextAvailableAddress(String seed, int security, boolean checksum, int index) throws ArgumentException
seed
- Tryte-encoded seed. It should be noted that this seed is not transferred.security
- Security level to be used for the private key / address. Can be 1, 2 or 3.checksum
- Adds 9-tryte address checksum.index
- Key index to start search from.GetNewAddressResponse
ArgumentException
- When the seed is invalidArgumentException
- When the security level is wrong.public GetNewAddressResponse generateNewAddresses(String seed, int security, boolean checksum, int amount) throws ArgumentException
amount
of unspent addresses are found.seed
- Tryte-encoded seed. It should be noted that this seed is not transferred.security
- Security level to be used for the private key / address. Can be 1, 2 or 3.checksum
- Adds 9-tryte address checksum.amount
- Total number of addresses to generate.GetNewAddressResponse
ArgumentException
- When the seed is invalidArgumentException
- When the security level is wrong.ArgumentException
- When the amount is negativepublic GetNewAddressResponse generateNewAddresses(String seed, int security, boolean checksum, int index, int amount) throws ArgumentException
amount
of unspent addresses are found,starting from index
seed
- Tryte-encoded seed. It should be noted that this seed is not transferred.security
- Security level to be used for the private key / address. Can be 1, 2 or 3.checksum
- Adds 9-tryte address checksum.index
- Key index to start search from.amount
- Total number of addresses to generate.GetNewAddressResponse
ArgumentException
- When the seed is invalidArgumentException
- When the security level is wrong.ArgumentException
- When index plus the amount are below 0public GetNewAddressResponse generateNewAddresses(String seed, int security, boolean checksum, int index, int amount, boolean addSpendAddresses) throws ArgumentException
amount
of unspent addresses are found,starting from index
seed
- Tryte-encoded seed. It should be noted that this seed is not transferred.security
- Security level to be used for the private key / address. Can be 1, 2 or 3.checksum
- Adds 9-tryte address checksum.index
- Key index to start search from.amount
- Total number of addresses to generate.
If this is set to 0, we will generate until the first unspent address is found, and stop.
If amount is negative, we count back from index.addSpendAddresses
- If true
, it returns all addresses, even those who were determined to be spent fromGetNewAddressResponse
ArgumentException
- When the seed is invalidArgumentException
- When the security level is wrong.ArgumentException
- When index plus the amount are below 0public GetNewAddressResponse getAddressesUnchecked(String seed, int security, boolean checksum, int index, int amount) throws ArgumentException
amount
of addresses, starting from index
This does not mean that these addresses are safe to use (unspent)seed
- Tryte-encoded seed. It should be noted that this seed is not transferred.security
- Security level to be used for the private key / address. Can be 1, 2 or 3.checksum
- Adds 9-tryte address checksum.index
- Key index to start search from. The generation of the address is not deterministic.amount
- Total number of addresses to generate.GetNewAddressResponse
ArgumentException
- is thrown when the specified input is not valid.public GetTransferResponse getTransfers(String seed, int security, Integer start, Integer end, Boolean inclusionStates) throws ArgumentException
seed
- Tryte-encoded seed. It should be noted that this seed is not transferred.security
- Security level to be used for the private key / address. Can be 1, 2 or 3.start
- Starting key index, must be at least 0.end
- Ending key index, must be bigger then startinclusionStates
- If true
, it also gets the inclusion states of the transfers.GetTransferResponse
ArgumentException
- when start and end are more then 500 apartArgumentException
- Invalid security indexIllegalStateException
- When the seed is invalidpublic Bundle[] bundlesFromAddresses(String[] addresses, Boolean inclusionStates) throws ArgumentException
addresses
- Array of addresses.inclusionStates
- If true
, it also gets the inclusion state of each bundle.ArgumentException
- When the addresses are invalidIllegalStateException
- When inclusion state/confirmed could not be determined (null returned)public BroadcastTransactionsResponse storeAndBroadcast(String... trytes) throws ArgumentException
trytes
- The trytes.BroadcastTransactionsResponse
ArgumentException
- is thrown when the specified trytes is not valid.ArgumentException
- If IotaAPICore.storeTransactions(String...)
failsIotaAPICore.storeTransactions(String...)
,
IotaAPICore.broadcastTransactions(String...)
public List<Transaction> sendTrytes(String[] trytes, int depth, int minWeightMagnitude, String reference) throws ArgumentException
trytes
- The transaction trytesdepth
- The depth for getting transactions to approveminWeightMagnitude
- The minimum weight magnitude for doing proof of workreference
- Hash of transaction to start random-walk from
This is used to make sure the tips returned reference a given transaction in their past.
This can be null, in that case the latest milestone is used as a reference.Transaction
objects.ArgumentException
- is thrown when invalid trytes is provided.IotaAPICore.broadcastTransactions(String...)
,
IotaAPICore.attachToTangle(String, String, Integer, String...)
,
storeAndBroadcast(String...)
public List<Transaction> findTransactionsObjectsByHashes(String[] hashes) throws ArgumentException
Transaction
objects.
Gets the trytes and transaction object from a list of transaction hashes.hashes
- The hashes of the transactions we want to get the transactions fromTransaction
objects.ArgumentException
- if hashes is not a valid array of hashesIotaAPICore.getTrytes(String...)
public List<Transaction> findTransactionObjectsByAddresses(String[] addresses) throws ArgumentException
Transaction
objects.addresses
- The addresses we should get the transactions forTransaction
objects.ArgumentException
- if addresses is not a valid array of hashesIotaAPICore.findTransactionsByAddresses(String...)
,
findTransactionsObjectsByHashes(java.lang.String[])
public List<Transaction> findTransactionObjectsByTag(String[] tags) throws ArgumentException
Transaction
objects.tags
- The tags the transactions we search for haveArgumentException
public List<Transaction> findTransactionObjectsByApprovees(String[] approvees) throws ArgumentException
Transaction
objects.approvees
- The transaction hashes of which we want to approversTransaction
objects.ArgumentException
- if addresses is not a valid array of hashesIotaAPICore.findTransactionsByApprovees(java.lang.String...)
public List<Transaction> findTransactionObjectsByBundle(String[] bundles) throws ArgumentException
Transaction
objects.bundles
- The bundles for which we will get all its transactionsTransaction
objects.ArgumentException
- if addresses is not a valid array of hashesIotaAPICore.findTransactionsByBundles(java.lang.String...)
public List<String> prepareTransfers(String seed, int security, List<Transfer> transfers, String remainder, List<Input> inputs, List<Transaction> tips, boolean validateInputs) throws ArgumentException
seed
- The tryte-encoded seed. It should be noted that this seed is not transferred.security
- Security level to be used for the private key / address. Can be 1, 2 or 3.transfers
- List of transfer objects.
If the total value of the transfers is 0, no signing is performed.remainder
- If defined, this address will be used for sending the remainder value (of the inputs) to.
Otherwise, then next available address is used (if the transfer value is over 0)inputs
- The inputs used for this transfertips
- The starting points we walk back from to find the balance of the addresses, can be nullvalidateInputs
- Whether or not to validate the balances of the provided inputs
If no validation is requiredArgumentException
- If the seed is invalidArgumentException
- If the security level is wrong.IllegalStateException
- If the transfers are not all validIllegalStateException
- If there is not enough balance in the inputspublic GetBalancesAndFormatResponse getInputs(String seed, int security, int start, int end, long threshold, String... tips) throws ArgumentException
seed
- Tryte-encoded seed. It should be noted that this seed is not transferred.security
- Security level to be used for the private key / address. Can be 1, 2 or 3.start
- Starting key index, must be at least 0.end
- Ending key index, must be bigger then startthreshold
- Minimum balance required.tips
- The starting points we walk back from to find the balance of the addresses, can be nullGetBalancesAndFormatResponse
ArgumentException
- If the seed is invalidArgumentException
- If the security level is wrong.ArgumentException
- when start and end are more then 500 apartgetBalanceAndFormat(List, List, long, int, StopWatch, int)
public GetBalancesAndFormatResponse getBalanceAndFormat(List<String> addresses, List<String> tips, long threshold, int start, StopWatch stopWatch, int security) throws ArgumentException, IllegalStateException
addresses
- The addresses.tips
- The starting points we walk back from to find the balance of the addresses, can be nullthreshold
- Min balance required.start
- Starting key index.stopWatch
- the stopwatch. If you pass null, a new one is created.security
- Security level to be used for the private key / address. Can be 1, 2 or 3.GetBalancesAndFormatResponse
ArgumentException
- is thrown when the specified security level is not valid.IllegalStateException
public GetBundleResponse getBundle(String transaction) throws ArgumentException
transaction
- The transaction hashGetBundleResponse
ArgumentException
- if the transaction hash is invalidArgumentException
- if the bundle is invalid or not foundpublic GetAccountDataResponse getAccountData(String seed, int security, int index, boolean checksum, int total, boolean returnAll, int start, int end, boolean inclusionStates, long threshold) throws ArgumentException
seed
- Tryte-encoded seed. It should be noted that this seed is not transferred.security
- Security level to be used for the private key / address. Can be 1, 2 or 3.index
- Key index to start search from. If the index is provided, the generation of the address is not deterministic.checksum
- Adds 9-tryte address checksum.total
- Total number of addresses to generate.returnAll
- If true
, it returns all addresses which were deterministically generated (until findTransactions returns null).start
- Starting key index, must be at least 0.end
- Ending key index, must be bigger then startinclusionStates
- If true
, it gets the inclusion states of the transfers.threshold
- Minimum balance required.GetAccountDataResponse
ArgumentException
- when the specified security level is not valid.ArgumentException
- when start and end are invalidgetTransfers(String, int, Integer, Integer, Boolean)
public boolean[] checkWereAddressSpentFrom(String... addresses) throws ArgumentException
addresses
- the addresses to checkArgumentException
- when an address is invalidpublic Boolean checkWereAddressSpentFrom(String address) throws ArgumentException
address
- the address to checkArgumentException
- when the address is invalidpublic ReplayBundleResponse replayBundle(String tailTransactionHash, int depth, int minWeightMagnitude, String reference) throws ArgumentException
tailTransactionHash
- The hash of tail transaction.depth
- The depth for getting transactions to approveminWeightMagnitude
- The minimum weight magnitude for doing proof of workreference
- Hash of transaction to start random-walk from.
This is used to make sure the tips returned reference a given transaction in their past.
Can be null, in that case the latest milestone is used as a reference.ReplayBundleResponse
ArgumentException
- when the tailTransactionHash is invalidArgumentException
- when the bundle is invalid or not foundsendTrytes(String[], int, int, String)
public GetInclusionStateResponse getLatestInclusion(String[] hashes) throws ArgumentException
hashes
- The hashes.GetInclusionStateResponse
ArgumentException
- when one of the hashes is invalidIotaAPICore.getNodeInfo()
,
IotaAPICore.getInclusionStates(String[], String[])
public SendTransferResponse sendTransfer(String seed, int security, int depth, int minWeightMagnitude, List<Transfer> transfers, List<Input> inputs, String remainderAddress, boolean validateInputs, boolean validateInputAddresses, List<Transaction> tips) throws ArgumentException
seed
- The tryte-encoded seed. It should be noted that this seed is not transferred.security
- Security level to be used for the private key / address. Can be 1, 2 or 3.depth
- The depth for getting transactions to approveminWeightMagnitude
- The minimum weight magnitude for doing proof of worktransfers
- List of Transfer
objects.inputs
- List of Input
used for funding the transfer.remainderAddress
- If defined, this remainderAddress will be used for sending the remainder value (of the inputs) to.
When this is not defined, but a remaining exists, the next free address is used.validateInputs
- Whether or not to validate the balances of the provided inputs.validateInputAddresses
- Whether or not to validate if the destination address is already use.
If a key reuse is detect or it's send to inputs.tips
- The starting points we walk back from to find the balance of the addresses
If multiple tips are supplied, only the first tip is used for IotaAPICore.getTransactionsToApprove(Integer, String)
SendTransferResponse
ArgumentException
- If the seed is invalidArgumentException
- If the security level is wrong.ArgumentException
- When validateInputAddresses is true, if validateTransfersAddresses has an error.IllegalStateException
- If the transfers are not all validIllegalStateException
- If there is not enough balance in the inputs to supply to the transfersprepareTransfers(String, int, List, String, List, List, boolean)
,
sendTrytes(String[], int, int, String)
,
validateTransfersAddresses(String, int, List)
public Bundle traverseBundle(String trunkTx, String bundleHash, Bundle bundle) throws ArgumentException
trunkTx
- Hash of a trunk or a tail transaction of a bundle.bundleHash
- The bundle hash. Should be null, and will use the transactions bundle hashbundle
- Bundle
to be populated by traversing.ArgumentException
- when trunkTx is invalid, or has no transactionsArgumentException
- when a transaction in the bundle has no reference to the bundleArgumentException
- when the first transaction in the bundle is not a tailpublic List<Transaction> initiateTransfer(int securitySum, String inputAddress, String remainderAddress, List<Transfer> transfers) throws ArgumentException
securitySum
- The sum of security levels used by all co-signers.inputAddress
- Array of input addresses as well as the securitySum.remainderAddress
- Has to be generated by the cosigners before initiating the transfer, can be null if fully spent.transfers
- List of Transfer
we want to make using the unputAddressesTransaction
objects in this newly created transferArgumentException
- when an address is invalid.ArgumentException
- when the security level is wrong.IllegalStateException
- when a transfer fails because their is not enough balance to perform the transfer.IllegalStateException
- When a remainderAddress is required, but not suppliedRuntimeException
- When the total value from the transfers is not 0public List<Transaction> initiateTransfer(int securitySum, String inputAddress, String remainderAddress, List<Transfer> transfers, List<Transaction> tips) throws ArgumentException
securitySum
- The sum of security levels used by all co-signers.inputAddress
- Array of input addresses as well as the securitySum.remainderAddress
- Has to be generated by the cosigners before initiating the transfer, can be null if fully spent.transfers
- List of Transfer
we want to make using the unputAddressestips
- The starting points for checking if the balances of the input addresses contain enough to make this transfer
This can be nullTransaction
objects in this newly created transferArgumentException
- when an address is invalid.ArgumentException
- when the security level is wrong.IllegalStateException
- when a transfer fails because their is not enough balance to perform the transfer.IllegalStateException
- When a remainderAddress is required, but not suppliedRuntimeException
- When the total value from the transfers is not 0public List<Transaction> initiateTransfer(int securitySum, String inputAddress, String remainderAddress, List<Transfer> transfers, boolean testMode) throws ArgumentException
securitySum
- The sum of security levels used by all co-signers.inputAddress
- Array of input addresses as well as the securitySum.remainderAddress
- Has to be generated by the cosigners before initiating the transfer, can be null if fully spent.transfers
- List of Transfer
we want to make using the unputAddressestestMode
- If were running unit tests, set to true to bypass total value checkTransaction
objects in this newly created transferArgumentException
- when an address is invalid.ArgumentException
- when the security level is wrong.IllegalStateException
- when a transfer fails because their is not enough balance to perform the transfer.IllegalStateException
- When a remainderAddress is required, but not suppliedRuntimeException
- When the total value from the transfers is not 0public List<Transaction> initiateTransfer(int securitySum, String inputAddress, String remainderAddress, List<Transfer> transfers, List<Transaction> tips, boolean testMode) throws ArgumentException
securitySum
- The sum of security levels used by all co-signers.inputAddress
- Array of input addresses as well as the securitySum.remainderAddress
- Has to be generated by the cosigners before initiating the transfer, can be null if fully spent.transfers
- List of Transfer
we want to make using the unputAddressestips
- The starting points for checking if the balances of the input addresses contain enough to make this transfer.
This can be nulltestMode
- If were running unit tests, set to true to bypass total value checkTransaction
objects in this newly created transferArgumentException
- when an address is invalid.ArgumentException
- when the security level is wrong.IllegalStateException
- when a transfer fails because their is not enough balance to perform the transfer.IllegalStateException
- When a remainderAddress is required, but not suppliedRuntimeException
- When the total value from the transfers is not 0public void validateTransfersAddresses(String seed, int security, List<String> trytes) throws ArgumentException
Validates the supplied transactions with seed and security. This will check for correct input/output and key reuse
In order to do this we will generate all addresses for this seed which are currently in use. Transactions for these addresses will be looked up, making this an expensive method call.
If no error is thrown, the transaction trytes are using correct addresses. This will not validate transaction fields.seed
- The tryte-encoded seed. It should be noted that this seed is not transferred.security
- Security level to be used for the private key / address. Can be 1, 2 or 3.trytes
- List of transaction trytes.ArgumentException
- when we are sending to our own input addressesArgumentException
- when we try to remove funds from an address that is not an inputArgumentException
- when we are sending from an address we have already used for sendingpublic List<String> addRemainder(String seed, int security, List<Input> inputs, Bundle bundle, String tag, long totalValue, String remainderAddress, List<String> signatureFragments) throws ArgumentException
seed
- The tryte-encoded seed. It should be noted that this seed is not transferred.security
- Security level to be used for the private key / address. Can be 1, 2 or 3.inputs
- List of inputs used for funding the transfer.bundle
- The Bundle
to be populated.tag
- The tag to add to each bundle entry (input and remainder)totalValue
- The total value of the desired transactionremainderAddress
- The address used for sending the remainder value (of the last input).
If this is null, getNextAvailableAddress(String, int, boolean)
is used.signatureFragments
- The signature fragments (message), used for signing.
Should be 2187 characters long, can be padded with 9s.ArgumentException
- When the seed is invalidArgumentException
- When the security level is wrong.IllegalStateException
- When the inputs do not contain enough balance to reach totalValue.IotaAPIUtils.signInputsAndReturn(java.lang.String, java.util.List<jota.model.Input>, jota.model.Bundle, java.util.List<java.lang.String>, jota.pow.ICurl)
,
getNextAvailableAddress(String, int, boolean)
public boolean isPromotable(Transaction tail) throws ArgumentException
tail
- the Transaction
we want to promoteArgumentException
- when we can't get the consistency of this transactionIotaAPICore.checkConsistency(String...)
public boolean isPromotable(String tail) throws ArgumentException
tail
- the Transaction
hash we want to checkArgumentException
- when we can't get the consistency of this transaction
or when the transaction is not foundIotaAPICore.checkConsistency(String...)
public List<Transaction> promoteTransaction(String tail, int depth, int minWeightMagnitude, Bundle bundle) throws BaseException
tail
- bundle tail to promote, cannot be nulldepth
- depth for getTransactionsToApproveminWeightMagnitude
- minWeightMagnitude to use for Proof-of-Workbundle
- the Bundle
to attach for promotionTransaction
s made with the attached transaction trytesArgumentException
- When the bundle has no transactionArgumentException
- When depth or minWeightMagnitude is lower than 0ArgumentException
- When the tail hash is invalidNotPromotableException
- When the transaction is not promotableBaseException
IotaAPICore.checkConsistency(String...)
,
IotaAPICore.getTransactionsToApprove(Integer, String)
,
IotaAPICore.attachToTangle(String, String, Integer, String...)
,
storeAndBroadcast(String...)
Copyright © 2018. All rights reserved.