Class TransactionParametersBuilder<T extends TransactionParametersBuilder<T>>
- java.lang.Object
-
- com.algorand.algosdk.builder.transaction.TransactionParametersBuilder<T>
-
- Direct Known Subclasses:
MethodCallTransactionBuilder
,TransactionBuilder
public abstract class TransactionParametersBuilder<T extends TransactionParametersBuilder<T>> extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected BigInteger
fee
protected BigInteger
firstValid
protected BigInteger
flatFee
protected Digest
genesisHash
protected String
genesisID
protected BigInteger
lastValid
protected byte[]
lease
protected byte[]
note
protected Address
rekeyTo
protected Address
sender
-
Constructor Summary
Constructors Constructor Description TransactionParametersBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
fee(Integer fee)
Set the fee per bytes value.T
fee(Long fee)
Set the fee per bytes value.T
fee(BigInteger fee)
Set the fee per bytes value.T
firstValid(Integer firstValid)
Set the firstValid value, which is the first round that this transaction is valid for.T
firstValid(Long firstValid)
Set the firstValid value, which is the first round that this transaction is valid for.T
firstValid(BigInteger firstValid)
Set the firstValid value, which is the first round that this transaction is valid for.T
flatFee(Integer flatFee)
Set the flatFee.T
flatFee(Long flatFee)
Set the flatFee.T
flatFee(BigInteger flatFee)
Set the flatFee.T
genesisHash(byte[] genesisHash)
Set the genesisHash field in its raw byte array format.T
genesisHash(Digest genesisHash)
Set the genesisHash field.T
genesisHashB64(String genesisHash)
Set the genesisHash field in a base64 encoded format.T
genesisHashUTF8(String genesisHash)
Set the genesisHash field in a UTF8 encoded format.T
genesisID(String genesisID)
Set the optional genesisID.T
lastValid(Integer lastValid)
Set the lastValid value, which is the last round that this transaction is valid for.T
lastValid(Long lastValid)
Set the lastValid value, which is the last round that this transaction is valid for.T
lastValid(BigInteger lastValid)
Set the lastValid value, which is the last round that this transaction is valid for.T
lease(byte[] lease)
Set the optional lease field in its raw 32 byte form.T
lease(Lease lease)
Set the optional lease field.T
leaseB64(String lease)
Set the optional lease field using a base 64 encoded string.T
leaseUTF8(String lease)
Set the optional lease field using a UTF-8 encoded string.T
lookupParams(AlgodClient client)
Query the V2 REST API withAlgodClient
for Transaction Parameters: Initialize fee, genesisID, genesisHash, firstValid, lastValid usingTransactionParametersResponse
if not already set.T
note(byte[] note)
Set the note field.T
noteB64(String note)
Set the note field using a Base64 encoded string.T
noteUTF8(String note)
Set the note field using a UTF-8 encoded string.T
rekey(byte[] rekeyTo)
Rekey to the account in the raw 32 byte format.T
rekey(Address rekeyTo)
Rekey to the sender account.T
rekey(String rekeyTo)
Rekey to the account in the human-readable address format.T
sender(byte[] sender)
Set the transaction sender account in the raw 32 byte format.T
sender(Address sender)
Set the transaction sender account.T
sender(String sender)
Set the transaction sender account in the human-readable address format.T
suggestedParams(TransactionParametersResponse params)
Initialize fee, genesisID, genesisHash, firstValid and lastValid usingTransactionParametersResponse
.
-
-
-
Field Detail
-
sender
protected Address sender
-
fee
protected BigInteger fee
-
flatFee
protected BigInteger flatFee
-
firstValid
protected BigInteger firstValid
-
lastValid
protected BigInteger lastValid
-
note
protected byte[] note
-
lease
protected byte[] lease
-
rekeyTo
protected Address rekeyTo
-
genesisID
protected String genesisID
-
genesisHash
protected Digest genesisHash
-
-
Method Detail
-
lookupParams
public T lookupParams(AlgodClient client) throws Exception
Query the V2 REST API withAlgodClient
for Transaction Parameters: Initialize fee, genesisID, genesisHash, firstValid, lastValid usingTransactionParametersResponse
if not already set.- Parameters:
client
- The backend client connection.- Returns:
- This builder.
- Throws:
Exception
- When the client fails to retrieveTransactionParametersResponse
from the backend.
-
suggestedParams
public T suggestedParams(TransactionParametersResponse params)
Initialize fee, genesisID, genesisHash, firstValid and lastValid usingTransactionParametersResponse
.- Parameters:
params
- The suggested transaction parameters.- Returns:
- This builder.
-
sender
public T sender(Address sender)
Set the transaction sender account.- Parameters:
sender
- The sender account.- Returns:
- This builder.
-
sender
public T sender(String sender)
Set the transaction sender account in the human-readable address format.- Parameters:
sender
- The sender account.- Returns:
- This builder.
-
sender
public T sender(byte[] sender)
Set the transaction sender account in the raw 32 byte format.- Parameters:
sender
- The sender account.- Returns:
- This builder.
-
fee
public T fee(BigInteger fee)
Set the fee per bytes value. This value is multiplied by the estimated size of the transaction to reach a final transaction fee, or 1000, whichever is higher. This field cannot be combined with flatFee.- Parameters:
fee
- The fee per byte.- Returns:
- This builder.
-
fee
public T fee(Integer fee)
Set the fee per bytes value. This value is multiplied by the estimated size of the transaction to reach a final transaction fee, or 1000, whichever is higher. This field cannot be combined with flatFee.- Parameters:
fee
- The fee per byte.- Returns:
- This builder.
-
fee
public T fee(Long fee)
Set the fee per bytes value. This value is multiplied by the estimated size of the transaction to reach a final transaction fee, or 1000, whichever is higher. This field cannot be combined with flatFee.- Parameters:
fee
- The fee per byte.- Returns:
- This builder.
-
flatFee
public T flatFee(BigInteger flatFee)
Set the flatFee. This value will be used for the transaction fee. This fee may fall to zero but a group of N atomic transactions must still have a fee of at least N*MinTxnFee. This field cannot be combined with fee.- Parameters:
flatFee
- The flatFee to use for the transaction.- Returns:
- This builder.
-
flatFee
public T flatFee(Integer flatFee)
Set the flatFee. This value will be used for the transaction fee. This fee may fall to zero but a group of N atomic transactions must still have a fee of at least N*MinTxnFee. This field cannot be combined with fee.- Parameters:
flatFee
- The flatFee to use for the transaction.- Returns:
- This builder.
-
flatFee
public T flatFee(Long flatFee)
Set the flatFee. This value will be used for the transaction fee. This fee may fall to zero but a group of N atomic transactions must still have a fee of at least N*MinTxnFee. This field cannot be combined with fee.- Parameters:
flatFee
- The flatFee to use for the transaction.- Returns:
- This builder.
-
firstValid
public T firstValid(BigInteger firstValid)
Set the firstValid value, which is the first round that this transaction is valid for.- Parameters:
firstValid
- The firstValid round.- Returns:
- This builder.
-
firstValid
public T firstValid(Integer firstValid)
Set the firstValid value, which is the first round that this transaction is valid for.- Parameters:
firstValid
- The firstValid round.- Returns:
- This builder.
-
firstValid
public T firstValid(Long firstValid)
Set the firstValid value, which is the first round that this transaction is valid for.- Parameters:
firstValid
- The firstValid round.- Returns:
- This builder.
-
lastValid
public T lastValid(BigInteger lastValid)
Set the lastValid value, which is the last round that this transaction is valid for.- Parameters:
lastValid
- The lastValid round.- Returns:
- This builder.
-
lastValid
public T lastValid(Integer lastValid)
Set the lastValid value, which is the last round that this transaction is valid for.- Parameters:
lastValid
- The lastValid round.- Returns:
- This builder.
-
lastValid
public T lastValid(Long lastValid)
Set the lastValid value, which is the last round that this transaction is valid for.- Parameters:
lastValid
- The lastValid round.- Returns:
- This builder.
-
note
public T note(byte[] note)
Set the note field. It may containe 1024 bytes of free form data.- Parameters:
note
- The note field.- Returns:
- This builder.
-
noteUTF8
public T noteUTF8(String note)
Set the note field using a UTF-8 encoded string. It may containe 1024 bytes of free form data.- Parameters:
note
- The note field.- Returns:
- This builder.
-
noteB64
public T noteB64(String note)
Set the note field using a Base64 encoded string. It may containe 1024 bytes of free form data.- Parameters:
note
- The note field.- Returns:
- This builder.
-
lease
public T lease(Lease lease)
Set the optional lease field. Lease enforces mutual exclusion of transactions. If this field is nonzero, then once the transaction is confirmed, it acquires the lease identified by the (Sender, Lease) pair of the transaction until the LastValid round passes. While this transaction possesses the lease, no other transaction specifying this lease can be confirmed.- Parameters:
lease
- The lease.- Returns:
- This builder.
-
lease
public T lease(byte[] lease)
Set the optional lease field in its raw 32 byte form. Lease enforces mutual exclusion of transactions. If this field is nonzero, then once the transaction is confirmed, it acquires the lease identified by the (Sender, Lease) pair of the transaction until the LastValid round passes. While this transaction possesses the lease, no other transaction specifying this lease can be confirmed.- Parameters:
lease
- The lease.- Returns:
- This builder.
-
leaseUTF8
public T leaseUTF8(String lease)
Set the optional lease field using a UTF-8 encoded string. Lease enforces mutual exclusion of transactions. If this field is nonzero, then once the transaction is confirmed, it acquires the lease identified by the (Sender, Lease) pair of the transaction until the LastValid round passes. While this transaction possesses the lease, no other transaction specifying this lease can be confirmed.- Parameters:
lease
- The lease.- Returns:
- This builder.
-
leaseB64
public T leaseB64(String lease)
Set the optional lease field using a base 64 encoded string. Lease enforces mutual exclusion of transactions. If this field is nonzero, then once the transaction is confirmed, it acquires the lease identified by the (Sender, Lease) pair of the transaction until the LastValid round passes. While this transaction possesses the lease, no other transaction specifying this lease can be confirmed.- Parameters:
lease
- The lease.- Returns:
- This builder.
-
rekey
public T rekey(String rekeyTo)
Rekey to the account in the human-readable address format.- Returns:
- This builder.
-
rekey
public T rekey(byte[] rekeyTo)
Rekey to the account in the raw 32 byte format.- Returns:
- This builder.
-
genesisID
public T genesisID(String genesisID)
Set the optional genesisID. If set it is used to verify that the transaction is being submitted to the correct blockchain.- Parameters:
genesisID
- The genesisID.- Returns:
- This builder.
-
genesisHash
public T genesisHash(Digest genesisHash)
Set the genesisHash field. It must match the hash of the genesis block and is used to verify that that the transaction is being submitted to the correct blockchain.- Parameters:
genesisHash
- The genesisHash.- Returns:
- This builder.
-
genesisHash
public T genesisHash(byte[] genesisHash)
Set the genesisHash field in its raw byte array format. It must match the hash of the genesis block and is used to verify that that the transaction is being submitted to the correct blockchain.- Parameters:
genesisHash
- The genesisHash.- Returns:
- This builder.
-
genesisHashUTF8
public T genesisHashUTF8(String genesisHash)
Set the genesisHash field in a UTF8 encoded format. It must match the hash of the genesis block and is used to verify that that the transaction is being submitted to the correct blockchain.- Parameters:
genesisHash
- The genesisHash.- Returns:
- This builder.
-
genesisHashB64
public T genesisHashB64(String genesisHash)
Set the genesisHash field in a base64 encoded format. It must match the hash of the genesis block and is used to verify that that the transaction is being submitted to the correct blockchain.- Parameters:
genesisHash
- The genesisHash.- Returns:
- This builder.
-
-