Class TransactionExtensions
Namespace: Algorand.Unity
Assembly: cs.temp.dll.dll
Syntax
public static class TransactionExtensions
Methods
EstimateBlockSizeBytes<T>(T)
Estimate the size this transaction will take up in a block in bytes.
Declaration
public static int EstimateBlockSizeBytes<T>(this T txn)
where T : ITransaction, IEquatable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| T | txn |
Returns
| Type | Description |
|---|---|
| Int32 | Size in bytes. |
Type Parameters
| Name | Description |
|---|---|
| T |
GetId<T>(T)
Calculate the ID for this transaction.
Declaration
public static TransactionId GetId<T>(this T txn)
where T : ITransaction
Parameters
| Type | Name | Description |
|---|---|---|
| T | txn |
Returns
| Type | Description |
|---|---|
| TransactionId | A TransactionId calculated from its current parameters. |
Type Parameters
| Name | Description |
|---|---|
| T |
GetSuggestedFee<T>(T, TransactionParams)
Suggest a fee given the estimated block size in bytes of this transaction.
Declaration
public static MicroAlgos GetSuggestedFee<T>(this T txn, TransactionParams txnParams)
where T : ITransaction, IEquatable<T>
Parameters
| Type | Name | Description |
|---|---|---|
| T | txn | the transaction for which to estimate a fee. |
| TransactionParams | txnParams | The current suggested transaction params from the blockchain. |
Returns
| Type | Description |
|---|---|
| MicroAlgos | A suggested fee in MicroAlgos. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the transaction. |
SignWith<TTxn, TSigner>(TTxn, TSigner)
Sign a transaction with the given signer into raw, signed bytes.
Declaration
public static byte[] SignWith<TTxn, TSigner>(this TTxn txn, TSigner signer)
where TTxn : ITransaction, IEquatable<TTxn> where TSigner : ISigner
Parameters
| Type | Name | Description |
|---|---|---|
| TTxn | txn | The transaction to sign. |
| TSigner | signer | The signer that will sign the transaction. |
Returns
| Type | Description |
|---|---|
| Byte[] | Raw message pack bytes, ready to push to the algod service. |
Type Parameters
| Name | Description |
|---|---|
| TTxn | The type of the transaction to sign. |
| TSigner | The type of the transaction signer. |
SignWithAsync<TTxn, TSigner>(TTxn, TSigner)
Sign a transaction with the given signer into raw, signed bytes.
Declaration
public static UniTask<byte[]> SignWithAsync<TTxn, TSigner>(this TTxn txn, TSigner signer)
where TTxn : ITransaction, IEquatable<TTxn> where TSigner : IAsyncSigner
Parameters
| Type | Name | Description |
|---|---|---|
| TTxn | txn | The transaction to sign. |
| TSigner | signer | The signer that will sign the transaction. |
Returns
| Type | Description |
|---|---|
| UniTask<Byte[]> | Raw message pack bytes, ready to push to the algod service. |
Type Parameters
| Name | Description |
|---|---|
| TTxn | The type of the transaction to sign. |
| TSigner | The type of the transaction signer. |
ToSignatureMessage<T>(T)
Converts a transaction to bytes to prepare it for signing.
Declaration
public static byte[] ToSignatureMessage<T>(this T txn)
where T : ITransaction
Parameters
| Type | Name | Description |
|---|---|---|
| T | txn | The transaction to convert. |
Returns
| Type | Description |
|---|---|
| Byte[] | Bytes in the transaction that are used for signing. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the transaction. |
ToSignatureMessage<T>(T, Allocator)
Serializes this transaction to a message to use for signing.
Declaration
public static NativeByteArray ToSignatureMessage<T>(this T txn, Allocator allocator)
where T : ITransaction
Parameters
| Type | Name | Description |
|---|---|---|
| T | txn | |
| Allocator | allocator | How memory should be allocated for the returned byte array. |
Returns
| Type | Description |
|---|---|
| NativeByteArray | A |
Type Parameters
| Name | Description |
|---|---|
| T |