Class ApplicationBaseTransactionBuilder<T extends ApplicationBaseTransactionBuilder<T>>
- java.lang.Object
-
- com.algorand.algosdk.builder.transaction.TransactionParametersBuilder<T>
-
- com.algorand.algosdk.builder.transaction.TransactionBuilder<T>
-
- com.algorand.algosdk.builder.transaction.ApplicationBaseTransactionBuilder<T>
-
- All Implemented Interfaces:
ApplicationCallReferencesSetter<T>
- Direct Known Subclasses:
ApplicationCallTransactionBuilder
,ApplicationClearTransactionBuilder
,ApplicationCloseTransactionBuilder
,ApplicationDeleteTransactionBuilder
,ApplicationOptInTransactionBuilder
,ApplicationUpdateTransactionBuilder
public abstract class ApplicationBaseTransactionBuilder<T extends ApplicationBaseTransactionBuilder<T>> extends TransactionBuilder<T> implements ApplicationCallReferencesSetter<T>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ApplicationBaseTransactionBuilder.HoldingReference
Represents a holding reference for asset holdings of an account.static class
ApplicationBaseTransactionBuilder.LocalsReference
Represents a locals reference for local state of an account in an app.
-
Field Summary
-
Fields inherited from class com.algorand.algosdk.builder.transaction.TransactionBuilder
group, type
-
Fields inherited from class com.algorand.algosdk.builder.transaction.TransactionParametersBuilder
fee, firstValid, flatFee, genesisHash, genesisID, lastValid, lease, note, rekeyTo, sender
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ApplicationBaseTransactionBuilder()
All application calls use this type, so no need to make this private.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
accounts(List<Address> accounts)
Accounts lists the accounts (in addition to the sender) that may be accessed from the application logic.T
applicationId(Long applicationId)
ApplicationID is the application being interacted with, or 0 if creating a new application.protected void
applyTo(Transaction txn)
T
args(List<byte[]> args)
ApplicationArgs lists some transaction-specific arguments accessible from application logic.T
argsBase64Encoded(List<String> args)
ApplicationArgs lists some transaction-specific arguments accessible from application logic.T
boxReferences(List<AppBoxReference> boxReferences)
BoxReferences lists the boxes whose state may be accessed during evaluation of this application call.T
foreignApps(List<Long> foreignApps)
ForeignApps lists the applications (in addition to txn.ApplicationID) whose global states may be accessed by this application.T
foreignAssets(List<Long> foreignAssets)
ForeignAssets lists the assets whose global states may be accessed by this application.T
holdings(List<ApplicationBaseTransactionBuilder.HoldingReference> holdings)
Set asset holding references that need to be accessible in this transaction.T
locals(List<ApplicationBaseTransactionBuilder.LocalsReference> locals)
Set local state references that need to be accessible in this transaction.protected T
onCompletion(Transaction.OnCompletion onCompletion)
This is the faux application type used to distinguish different application actions.T
rejectVersion(Long rejectVersion)
Set the reject version for the application call.T
useAccess(boolean useAccess)
Enable or disable translation of foreign references into the access field.-
Methods inherited from class com.algorand.algosdk.builder.transaction.TransactionBuilder
build, group, group, groupB64, groupUTF8
-
Methods inherited from class com.algorand.algosdk.builder.transaction.TransactionParametersBuilder
fee, fee, fee, firstValid, firstValid, firstValid, flatFee, flatFee, flatFee, genesisHash, genesisHash, genesisHashB64, genesisHashUTF8, genesisID, lastValid, lastValid, lastValid, lease, lease, leaseB64, leaseUTF8, lookupParams, note, noteB64, noteUTF8, rekey, rekey, rekey, sender, sender, sender, suggestedParams
-
-
-
-
Method Detail
-
applyTo
protected void applyTo(Transaction txn)
- Specified by:
applyTo
in classTransactionBuilder<T extends ApplicationBaseTransactionBuilder<T>>
-
applicationId
public T applicationId(Long applicationId)
Description copied from interface:ApplicationCallReferencesSetter
ApplicationID is the application being interacted with, or 0 if creating a new application.- Specified by:
applicationId
in interfaceApplicationCallReferencesSetter<T extends ApplicationBaseTransactionBuilder<T>>
-
onCompletion
protected T onCompletion(Transaction.OnCompletion onCompletion)
This is the faux application type used to distinguish different application actions. Specifically, OnCompletion specifies what side effects this transaction will have if it successfully makes it into a block.
-
args
public T args(List<byte[]> args)
ApplicationArgs lists some transaction-specific arguments accessible from application logic.
-
argsBase64Encoded
public T argsBase64Encoded(List<String> args)
ApplicationArgs lists some transaction-specific arguments accessible from application logic.- Parameters:
args
- List of Base64 encoded strings.
-
accounts
public T accounts(List<Address> accounts)
Description copied from interface:ApplicationCallReferencesSetter
Accounts lists the accounts (in addition to the sender) that may be accessed from the application logic.- Specified by:
accounts
in interfaceApplicationCallReferencesSetter<T extends ApplicationBaseTransactionBuilder<T>>
-
foreignApps
public T foreignApps(List<Long> foreignApps)
Description copied from interface:ApplicationCallReferencesSetter
ForeignApps lists the applications (in addition to txn.ApplicationID) whose global states may be accessed by this application. The access is read-only.- Specified by:
foreignApps
in interfaceApplicationCallReferencesSetter<T extends ApplicationBaseTransactionBuilder<T>>
-
foreignAssets
public T foreignAssets(List<Long> foreignAssets)
Description copied from interface:ApplicationCallReferencesSetter
ForeignAssets lists the assets whose global states may be accessed by this application. The access is read-only.- Specified by:
foreignAssets
in interfaceApplicationCallReferencesSetter<T extends ApplicationBaseTransactionBuilder<T>>
-
boxReferences
public T boxReferences(List<AppBoxReference> boxReferences)
Description copied from interface:ApplicationCallReferencesSetter
BoxReferences lists the boxes whose state may be accessed during evaluation of this application call. The apps the boxes belong to must be present in ForeignApps.- Specified by:
boxReferences
in interfaceApplicationCallReferencesSetter<T extends ApplicationBaseTransactionBuilder<T>>
-
holdings
public T holdings(List<ApplicationBaseTransactionBuilder.HoldingReference> holdings)
Set asset holding references that need to be accessible in this transaction. Holdings references allow the transaction to access asset balances of specific accounts. Note: Holdings references are only available when useAccess=true as they cannot be represented in legacy transaction format.
-
locals
public T locals(List<ApplicationBaseTransactionBuilder.LocalsReference> locals)
Set local state references that need to be accessible in this transaction. Locals references allow the transaction to access local state of specific accounts in specific apps. Note: Locals references are only available when useAccess=true as they cannot be represented in legacy transaction format.
-
useAccess
public T useAccess(boolean useAccess)
Enable or disable translation of foreign references into the access field. When useAccess=true: - All foreign references (accounts, foreignApps, foreignAssets, boxReferences) are translated into a unified access field instead of using separate legacy fields - You can still use the same methods (accounts(), foreignApps(), etc.) - they will be translated - Advanced features (holdings(), locals()) are also available - Compatible with networks that support the access field consensus upgrade When useAccess=false (default): - Uses legacy separate fields (accounts, foreignApps, foreignAssets, boxReferences) - No translation occurs - references are placed directly in their respective fields - Maintains backward compatibility with pre-consensus upgrade networks - Advanced features (holdings(), locals()) are not allowed This design allows easy migration - just add .useAccess(true) to enable access field mode while keeping your existing foreign reference method calls.- Parameters:
useAccess
- true to translate references to access field, false to use legacy fields- Returns:
- this builder instance
-
rejectVersion
public T rejectVersion(Long rejectVersion)
Set the reject version for the application call. The lowest application version for which this transaction should immediately fail. 0 indicates that no version check should be performed.- Parameters:
rejectVersion
- the minimum application version to reject- Returns:
- this builder instance
-
-