Struct Account
A insecure, local, in-memory account. This is useful for creating quick accounts for developer testing, and it should not be used in production.
Implements
Namespace: Algorand.Unity
Assembly: cs.temp.dll.dll
Syntax
public struct Account : IAccountSigner, ISigner, IAsyncAccountSigner, IAsyncAccountSignerWithProgress, IAccount, IAsyncSignerWithProgress, IAsyncSigner
Constructors
Account(Mnemonic)
Instantiate an in-memory account from a mnemonic.
Declaration
public Account(Mnemonic mnemonic)
Parameters
Type | Name | Description |
---|---|---|
Mnemonic | mnemonic | The 25 word mnemonic to instantiate the account with. |
Account(Mnemonic, Address)
Instantiate a rekeyed, in-memory account from a mnemonic.
Declaration
public Account(Mnemonic mnemonic, Address address)
Parameters
Type | Name | Description |
---|---|---|
Mnemonic | mnemonic | The mnemonic representing this account's private key. |
Address | address | The address this account is rekeyed to. |
Account(PrivateKey)
Instantiate an in-memory account.
Declaration
public Account(PrivateKey privateKey)
Parameters
Type | Name | Description |
---|---|---|
PrivateKey | privateKey | The private key of the account. |
Account(PrivateKey, Address)
Instantiate an in-memory account that is rekeyed.
Declaration
public Account(PrivateKey privateKey, Address address)
Parameters
Type | Name | Description |
---|---|---|
PrivateKey | privateKey | The private key of the account. |
Address | address | The address of this account. |
Account(String)
Instantiate an in-memory account from a string that can be either a private key or mnemonic.
Declaration
public Account(string privateKeyOrMnemonic)
Parameters
Type | Name | Description |
---|---|---|
String | privateKeyOrMnemonic | A string that is either an mnemonic or a private key. |
Exceptions
Type | Condition |
---|---|
ArgumentException | The given string is not a mnemonic or a private key. |
Account(String, Address)
Instantiate a rekeyed, in-memory account from a string that can be either a private key or mnemonic.
Declaration
public Account(string privateKeyOrMnemonic, Address address)
Parameters
Type | Name | Description |
---|---|---|
String | privateKeyOrMnemonic | A string that is either an mnemonic or a private key. |
Address | address | The address this account is rekeyed to. |
Exceptions
Type | Condition |
---|---|
ArgumentException | The given string is not a mnemonic or a private key. |
Properties
Address
Address of this account
Declaration
public Address Address { get; }
Property Value
Type | Description |
---|---|
Address |
IsRekeyed
Declaration
public bool IsRekeyed { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
Deconstruct(out PrivateKey, out Address)
Represent this account as its private key and public key.
Declaration
public void Deconstruct(out PrivateKey privateKey, out Address address)
Parameters
Type | Name | Description |
---|---|---|
PrivateKey | privateKey | The private key this account uses to sign transactions. |
Address | address | The public key or address of this account. |
GenerateAccount()
Generate a random, fresh account
Declaration
public static Account GenerateAccount()
Returns
Type | Description |
---|---|
Account |
SignTxn<T>(T)
Sign a single transaction.
Declaration
public SignedTxn<T> SignTxn<T>(T txn)
where T : ITransaction, IEquatable<T>
Parameters
Type | Name | Description |
---|---|---|
T | txn | The transaction to sign. |
Returns
Type | Description |
---|---|
SignedTxn<T> | A signed transaction, signed with this account's PrivateKey. |
Type Parameters
Name | Description |
---|---|
T | The type of the transaction. |
SignTxns<T>(T[], TxnIndices)
Sign a group of transactions.
Declaration
public SignedTxn<T>[] SignTxns<T>(T[] txns, TxnIndices txnsToSign)
where T : ITransaction, IEquatable<T>
Parameters
Type | Name | Description |
---|---|---|
T[] | txns | The transactions to sign. |
TxnIndices | txnsToSign | Indexes of the transactions this signer should sign. |
Returns
Type | Description |
---|---|
SignedTxn<T>[] | An array of transactions with signatures. If the transaction at a given index was not signed, that signed transaction will have no signature. |
Type Parameters
Name | Description |
---|---|
T | The type of the transactions. |
Remarks
Each transaction is expected to have a valid group id already set.
SignTxnsAsync<T>(T[], TxnIndices, CancellationToken)
Sign a group of transactions.
Declaration
public UniTask<SignedTxn<T>[]> SignTxnsAsync<T>(T[] txns, TxnIndices txnsToSign, CancellationToken cancellationToken = null)
where T : ITransaction, IEquatable<T>
Parameters
Type | Name | Description |
---|---|---|
T[] | txns | The transactions to sign. |
TxnIndices | txnsToSign | Indexes of the transactions this signer should sign. |
CancellationToken | cancellationToken | Provide an optional cancellation token to interrupt signing. |
Returns
Type | Description |
---|---|
UniTask<SignedTxn<T>[]> | An array of transactions with signatures. If the transaction at a given index was not signed, that signed transaction will have no signature. |
Type Parameters
Name | Description |
---|---|
T | The type of the transactions. |
Remarks
Each transaction is expected to have a valid group id already set.
SignTxnsAsync<T, TProgress>(T[], TxnIndices, TProgress, CancellationToken)
Sign a group of transactions.
Declaration
public UniTask<SignedTxn<T>[]> SignTxnsAsync<T, TProgress>(T[] txns, TxnIndices txnsToSign, TProgress progress, CancellationToken cancellationToken = null)
where T : ITransaction, IEquatable<T> where TProgress : IProgress<float>
Parameters
Type | Name | Description |
---|---|---|
T[] | txns | The transactions to sign. |
TxnIndices | txnsToSign | Indexes of the transactions this signer should sign. |
TProgress | progress | A progress token that can be used to periodically check the progress. |
CancellationToken | cancellationToken | Provide an optional cancellation token to interrupt signing. |
Returns
Type | Description |
---|---|
UniTask<SignedTxn<T>[]> | An array of transactions with signatures. If the transaction at a given index was not signed, that signed transaction will have no signature. |
Type Parameters
Name | Description |
---|---|
T | The type of the transactions. |
TProgress |
Remarks
Each transaction is expected to have a valid group id already set.