Package com.algorand.algosdk.account
Class LogicSigAccount
- java.lang.Object
-
- com.algorand.algosdk.account.LogicSigAccount
-
public class LogicSigAccount extends Object
-
-
Field Summary
Fields Modifier and Type Field Description LogicsigSignature
lsig
Ed25519PublicKey
sigKey
-
Constructor Summary
Constructors Constructor Description LogicSigAccount(byte[] logic, List<byte[]> args)
Creates a new escrow LogicSig Account The address of the account is the hash of its program (logic)LogicSigAccount(byte[] logic, List<byte[]> args, PrivateKey privateKey)
Creates a new delegated LogicSigAccount.LogicSigAccount(byte[] logic, List<byte[]> args, PrivateKey privateKey, MultisigAddress ma)
Creates a new delegated LogicSigAccount.LogicSigAccount(LogicsigSignature lsig, Ed25519PublicKey signerPublicKey)
Creates a new delegated LogicSigAccount from existing LogicSig
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
appendMultiSig(PrivateKey privateKey)
Adds a signature from the delegating multi-sig accountAddress
getAddress()
getAddress returns the address of the LogicSigAccountTxnSigner
getTransactionSigner()
boolean
isDelegated()
IsDelegated returns true iff.SignedTransaction
signLogicSigTransaction(Transaction tx)
Sign a transaction with this account
-
-
-
Field Detail
-
sigKey
public final Ed25519PublicKey sigKey
-
lsig
public final LogicsigSignature lsig
-
-
Constructor Detail
-
LogicSigAccount
public LogicSigAccount(byte[] logic, List<byte[]> args)
Creates a new escrow LogicSig Account The address of the account is the hash of its program (logic)- Parameters:
logic
- the bytes of programargs
- the arguments of the program
-
LogicSigAccount
public LogicSigAccount(byte[] logic, List<byte[]> args, PrivateKey privateKey) throws NoSuchAlgorithmException, IOException
Creates a new delegated LogicSigAccount. This type of LogicSigAccount has the authority to sign transaction on behalf of another account, or so to say that account delegate the transaction signing to the program. If the delegating account is a multi-sig account, please pass in a multi-address for class construction (do not use this constructor in that case)- Parameters:
logic
- the bytes of programargs
- the arguments of the programprivateKey
- the (only) private key of the delegating account- Throws:
NoSuchAlgorithmException
IOException
-
LogicSigAccount
public LogicSigAccount(byte[] logic, List<byte[]> args, PrivateKey privateKey, MultisigAddress ma) throws IOException, NoSuchAlgorithmException
Creates a new delegated LogicSigAccount. This type of LogicSigAccount has the authority to sign transaction on behalf of another account, or so to say that account delegate the transaction signing to the program. The delegated Account here is a multi-sig account. To add additional signature from other member, use appendMultiSig method.- Parameters:
logic
- the bytes of programargs
- the arguments of the programprivateKey
- is the private key of one of the member of delegating multi-sig accountma
- is the multi-sig-address of the delegating account.- Throws:
IOException
NoSuchAlgorithmException
-
LogicSigAccount
public LogicSigAccount(LogicsigSignature lsig, Ed25519PublicKey signerPublicKey) throws IllegalArgumentException, NoSuchAlgorithmException
Creates a new delegated LogicSigAccount from existing LogicSig- Parameters:
lsig
- is an existing LogicSig.signerPublicKey
- must be present if the LogicSig is delegated and the delegating account is backed by a single private key (i.e. not a multi-sig account). It must be the public key of the delegating account, or an error will be returned if it is present.- Throws:
IllegalArgumentException
NoSuchAlgorithmException
-
-
Method Detail
-
appendMultiSig
public void appendMultiSig(PrivateKey privateKey) throws IllegalArgumentException, IOException, NoSuchAlgorithmException
Adds a signature from the delegating multi-sig account- Parameters:
privateKey
- is the private key of one of the member of delegating multi-sig account- Throws:
IllegalArgumentException
IOException
NoSuchAlgorithmException
-
isDelegated
public boolean isDelegated()
IsDelegated returns true iff. the LogicSig has been delegated to another account with a signature- Returns:
- boolean
-
getAddress
public Address getAddress() throws NoSuchAlgorithmException, IllegalArgumentException
getAddress returns the address of the LogicSigAccount- Returns:
- the address of the LogicSigAccount
- Throws:
NoSuchAlgorithmException
IllegalArgumentException
-
signLogicSigTransaction
public SignedTransaction signLogicSigTransaction(Transaction tx) throws NoSuchAlgorithmException, IOException
Sign a transaction with this account- Parameters:
tx
- transaction- Returns:
- signed transaction from LogicSigAccount
- Throws:
NoSuchAlgorithmException
IOException
-
getTransactionSigner
public TxnSigner getTransactionSigner()
-
-