Struct AlgodClient
A client for accessing the algod service
Namespace: Algorand.Unity
Assembly: cs.temp.dll.dll
Syntax
[Serializable]
public struct AlgodClient : IAlgodClient, IAlgoApiClient
Remarks
The algod service is responsible for handling information required to create and send transactions.
Constructors
AlgodClient(String, Header[])
Create a new algod client without using a token.
Declaration
public AlgodClient(string address, params Header[] headers)
Parameters
Type | Name | Description |
---|---|---|
String | address | url of the algod service, including the port, e.g. |
Header[] | headers | extra headers to add to the requests. e.g. |
AlgodClient(String, String, Header[])
Create a new algod client with a token set to TokenHeader.
Declaration
public AlgodClient(string address, string token, params Header[] headers)
Parameters
Type | Name | Description |
---|---|---|
String | address | url of the algod service, including the port, e.g. |
String | token | token used in authenticating to the algod service |
Header[] | headers | extra headers to add to the requests. e.g. |
Properties
Address
Address of the service, including the port
Declaration
public string Address { get; }
Property Value
Type | Description |
---|---|
String |
Remarks
e.g. "http://localhost:4001"
Headers
Additional headers to add to requests
Declaration
public Header[] Headers { get; }
Property Value
Type | Description |
---|---|
Header[] |
Token
Token used in authenticating to the service
Declaration
public string Token { get; }
Property Value
Type | Description |
---|---|
String |
TokenHeader
Request header to use for the authenticating Token
Declaration
public string TokenHeader { get; }
Property Value
Type | Description |
---|---|
String |
Methods
AbortCatchup(String)
Aborts a catchpoint catchup.
Declaration
public AlgoApiRequest.Sent<CatchpointAbortResponse> AbortCatchup(string catchpoint)
Parameters
Type | Name | Description |
---|---|---|
String | catchpoint | A catch point |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<CatchpointAbortResponse> |
Remarks
Given a catchpoint, it aborts catching up to this catchpoint
AccountApplicationInformation(String, UInt64, ResponseFormat)
Get account information about a given app.
Declaration
public AlgoApiRequest.Sent<AccountApplicationResponse> AccountApplicationInformation(string address, ulong applicationId, ResponseFormat format = ResponseFormat.None)
Parameters
Type | Name | Description |
---|---|---|
String | address | An account public key |
UInt64 | applicationId | An application identifier |
ResponseFormat | format | Configures whether the response object is JSON or MessagePack encoded. |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<AccountApplicationResponse> |
Remarks
Given a specific account public key and application ID, this call returns the account's application local state and global state (AppLocalState and AppParams, if either exists). Global state will only be returned if the provided address is the application's creator.
AccountAssetInformation(String, UInt64, ResponseFormat)
Get account information about a given asset.
Declaration
public AlgoApiRequest.Sent<AccountAssetResponse> AccountAssetInformation(string address, ulong assetId, ResponseFormat format = ResponseFormat.None)
Parameters
Type | Name | Description |
---|---|---|
String | address | An account public key |
UInt64 | assetId | An asset identifier |
ResponseFormat | format | Configures whether the response object is JSON or MessagePack encoded. |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<AccountAssetResponse> |
Remarks
Given a specific account public key and asset ID, this call returns the account's asset holding and asset parameters (if either exist). Asset parameters will only be returned if the provided address is the asset's creator.
AccountInformation(String, ExcludeFields, ResponseFormat)
Get account information.
Declaration
public AlgoApiRequest.Sent<AccountResponse> AccountInformation(string address, ExcludeFields exclude = ExcludeFields.Unknown, ResponseFormat format = ResponseFormat.None)
Parameters
Type | Name | Description |
---|---|---|
String | address | An account public key |
ExcludeFields | exclude | When set to |
ResponseFormat | format | Configures whether the response object is JSON or MessagePack encoded. |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<AccountResponse> |
Remarks
Given a specific account public key, this call returns the accounts status, balance and spendable amounts
AddParticipationKey(Byte[])
Add a participation key to the node
Declaration
public AlgoApiRequest.Sent<PostParticipationResponse> AddParticipationKey(byte[] participationkey)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | participationkey | The participation key to add to the node |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<PostParticipationResponse> |
AppendKeys(Byte[], String)
Append state proof keys to a participation key
Declaration
public AlgoApiRequest.Sent<ParticipationKeyResponse> AppendKeys(byte[] keymap, string participationId)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | keymap | The state proof keys to add to an existing participation ID |
String | participationId |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<ParticipationKeyResponse> |
Remarks
Given a participation ID, append state proof keys to a particular set of participation keys
DeleteParticipationKeyByID(String)
Delete a given participation key by ID
Declaration
public AlgoApiRequest.Sent DeleteParticipationKeyByID(string participationId)
Parameters
Type | Name | Description |
---|---|---|
String | participationId |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent |
Remarks
Delete a given participation key by ID
GetApplicationBoxByName(UInt64, String)
Get box information for a given application.
Declaration
public AlgoApiRequest.Sent<BoxResponse> GetApplicationBoxByName(ulong applicationId, string name)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | applicationId | An application identifier |
String | name | A box name, in the goal app call arg form 'encoding:value'. For ints, use the form 'int:1234'. For raw bytes, use the form 'b64:A=='. For printable strings, use the form 'str:hello'. For addresses, use the form 'addr:XYZ...'. |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<BoxResponse> |
Remarks
Given an application ID and box name, it returns the box name and value (each base64 encoded). Box names must be in the goal app call arg encoding form 'encoding:value'. For ints, use the form 'int:1234'. For raw bytes, use the form 'b64:A=='. For printable strings, use the form 'str:hello'. For addresses, use the form 'addr:XYZ...'.
GetApplicationBoxes(UInt64, Optional<UInt64>)
Get all box names for a given application.
Declaration
public AlgoApiRequest.Sent<BoxesResponse> GetApplicationBoxes(ulong applicationId, Optional<ulong> max = default(Optional<ulong>))
Parameters
Type | Name | Description |
---|---|---|
UInt64 | applicationId | An application identifier |
Optional<UInt64> | max | Max number of box names to return. If max is not set, or max == 0, returns all box-names. |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<BoxesResponse> |
Remarks
Given an application ID, return all Box names. No particular ordering is guaranteed. Request fails when client or server-side configured limits prevent returning all Box names.
GetApplicationByID(UInt64)
Get application information.
Declaration
public AlgoApiRequest.Sent<ApplicationResponse> GetApplicationByID(ulong applicationId)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | applicationId | An application identifier |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<ApplicationResponse> |
Remarks
Given a application ID, it returns application information including creator, approval and clear programs, global and local schemas, and global state.
GetAssetByID(UInt64)
Get asset information.
Declaration
public AlgoApiRequest.Sent<AssetResponse> GetAssetByID(ulong assetId)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | assetId | An asset identifier |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<AssetResponse> |
Remarks
Given a asset ID, it returns asset information including creator, name, total supply and special addresses.
GetBlock(UInt64, ResponseFormat)
Get the block for the given round.
Declaration
public AlgoApiRequest.Sent<BlockResponse> GetBlock(ulong round, ResponseFormat format = ResponseFormat.None)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | round | The round from which to fetch block information. |
ResponseFormat | format | Configures whether the response object is JSON or MessagePack encoded. |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<BlockResponse> |
GetBlockHash(UInt64)
Get the block hash for the block on the given round.
Declaration
public AlgoApiRequest.Sent<BlockHashResponse> GetBlockHash(ulong round)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | round | The round from which to fetch block hash information. |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<BlockHashResponse> |
GetGenesis()
Gets the genesis information.
Declaration
public AlgoApiRequest.Sent<AlgoApiObject> GetGenesis()
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<AlgoApiObject> | The genesis file in json. |
Remarks
Returns the entire genesis file in json.
GetLedgerStateDelta(UInt64)
Get a LedgerStateDelta object for a given round
Declaration
public AlgoApiRequest.Sent<LedgerStateDeltaResponse> GetLedgerStateDelta(ulong round)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | round | The round for which the deltas are desired. |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<LedgerStateDeltaResponse> |
Remarks
Get ledger deltas for a round.
GetLightBlockHeaderProof(UInt64)
Gets a proof for a given light block header inside a state proof commitment
Declaration
public AlgoApiRequest.Sent<LightBlockHeaderProofResponse> GetLightBlockHeaderProof(ulong round)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | round | The round to which the light block header belongs. |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<LightBlockHeaderProofResponse> |
GetParticipationKeyByID(String)
Get participation key info given a participation ID
Declaration
public AlgoApiRequest.Sent<ParticipationKeyResponse> GetParticipationKeyByID(string participationId)
Parameters
Type | Name | Description |
---|---|---|
String | participationId |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<ParticipationKeyResponse> |
Remarks
Given a participation ID, return information about that participation key
GetParticipationKeys()
Return a list of participation keys
Declaration
public AlgoApiRequest.Sent<ParticipationKeysResponse> GetParticipationKeys()
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<ParticipationKeysResponse> |
Remarks
Return a list of participation keys
GetPendingTransactions(Optional<UInt64>, ResponseFormat)
Get a list of unconfirmed transactions currently in the transaction pool.
Declaration
public AlgoApiRequest.Sent<PendingTransactionsResponse> GetPendingTransactions(Optional<ulong> max = default(Optional<ulong>), ResponseFormat format = ResponseFormat.None)
Parameters
Type | Name | Description |
---|---|---|
Optional<UInt64> | max | Truncated number of transactions to display. If max=0, returns all pending txns. |
ResponseFormat | format | Configures whether the response object is JSON or MessagePack encoded. |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<PendingTransactionsResponse> |
Remarks
Get the list of pending transactions, sorted by priority, in decreasing order, truncated at the end at MAX. If MAX = 0, returns all pending transactions.
GetPendingTransactionsByAddress(String, Optional<UInt64>, ResponseFormat)
Get a list of unconfirmed transactions currently in the transaction pool by address.
Declaration
public AlgoApiRequest.Sent<PendingTransactionsResponse> GetPendingTransactionsByAddress(string address, Optional<ulong> max = default(Optional<ulong>), ResponseFormat format = ResponseFormat.None)
Parameters
Type | Name | Description |
---|---|---|
String | address | An account public key |
Optional<UInt64> | max | Truncated number of transactions to display. If max=0, returns all pending txns. |
ResponseFormat | format | Configures whether the response object is JSON or MessagePack encoded. |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<PendingTransactionsResponse> |
Remarks
Get the list of pending transactions by address, sorted by priority, in decreasing order, truncated at the end at MAX. If MAX = 0, returns all pending transactions.
GetStateProof(UInt64)
Get a state proof that covers a given round
Declaration
public AlgoApiRequest.Sent<StateProofResponse> GetStateProof(ulong round)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | round | The round for which a state proof is desired. |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<StateProofResponse> |
GetStatus()
Gets the current node status.
Declaration
public AlgoApiRequest.Sent<NodeStatusResponse> GetStatus()
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<NodeStatusResponse> |
GetSupply()
Get the current supply reported by the ledger.
Declaration
public AlgoApiRequest.Sent<SupplyResponse> GetSupply()
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<SupplyResponse> |
GetSyncRound()
Returns the minimum sync round the ledger is keeping in cache.
Declaration
public AlgoApiRequest.Sent<GetSyncRoundResponse> GetSyncRound()
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<GetSyncRoundResponse> |
Remarks
Gets the minimum sync round for the ledger.
GetTransactionProof(UInt64, String, String, ResponseFormat)
Get a proof for a transaction in a block.
Declaration
public AlgoApiRequest.Sent<TransactionProofResponse> GetTransactionProof(ulong round, string txid, string hashtype = null, ResponseFormat format = ResponseFormat.None)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | round | The round in which the transaction appears. |
String | txid | The transaction ID for which to generate a proof. |
String | hashtype | The type of hash function used to create the proof, must be one of:
|
ResponseFormat | format | Configures whether the response object is JSON or MessagePack encoded. |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<TransactionProofResponse> |
GetVersion()
Declaration
public AlgoApiRequest.Sent<VersionsResponse> GetVersion()
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<VersionsResponse> |
Remarks
Retrieves the supported API versions, binary build versions, and genesis information.
HealthCheck()
Returns OK if healthy.
Declaration
public AlgoApiRequest.Sent HealthCheck()
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent |
Metrics()
Return metrics about algod functioning.
Declaration
public AlgoApiRequest.Sent Metrics()
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent |
PendingTransactionInformation(String, ResponseFormat)
Get a specific pending transaction.
Declaration
public AlgoApiRequest.Sent<PendingTransactionResponse> PendingTransactionInformation(string txid, ResponseFormat format = ResponseFormat.None)
Parameters
Type | Name | Description |
---|---|---|
String | txid | A transaction ID |
ResponseFormat | format | Configures whether the response object is JSON or MessagePack encoded. |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<PendingTransactionResponse> | Given a transaction ID of a recently submitted transaction, it returns information about it. There are several cases when this might succeed:
Or the transaction may have happened sufficiently long ago that the node no longer remembers it, and this will return an error. |
Remarks
Given a transaction ID of a recently submitted transaction, it returns information about it. There are several cases when this might succeed:
- transaction committed (committed round > 0)
- transaction still in the pool (committed round = 0, pool error = "")
- transaction removed from pool due to error (committed round = 0, pool error != "") Or the transaction may have happened sufficiently long ago that the node no longer remembers it, and this will return an error.
RawTransaction(Byte[])
Broadcasts a raw transaction to the network.
Declaration
public AlgoApiRequest.Sent<PostTransactionsResponse> RawTransaction(byte[] rawtxn)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | rawtxn | The byte encoded signed transaction to broadcast to network |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<PostTransactionsResponse> |
SendTransaction<T>(SignedTxn<T>)
Send a signed transaction struct
Declaration
public AlgoApiRequest.Sent<PostTransactionsResponse> SendTransaction<T>(SignedTxn<T> txn)
where T : struct, ITransaction, IEquatable<T>
Parameters
Type | Name | Description |
---|---|---|
SignedTxn<T> | txn | The signed transaction struct to send |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<PostTransactionsResponse> | A response from the algod service. |
Type Parameters
Name | Description |
---|---|
T | The type of the signed transaction. |
SetSyncRound(UInt64)
Given a round, tells the ledger to keep that round in its cache.
Declaration
public AlgoApiRequest.Sent SetSyncRound(ulong round)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | round | The round for which the deltas are desired. |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent |
Remarks
Sets the minimum sync round on the ledger.
ShutdownNode(Optional<UInt64>)
Declaration
public AlgoApiRequest.Sent<AlgoApiObject> ShutdownNode(Optional<ulong> timeout = default(Optional<ulong>))
Parameters
Type | Name | Description |
---|---|---|
Optional<UInt64> | timeout |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<AlgoApiObject> |
Remarks
Special management endpoint to shutdown the node. Optionally provide a timeout parameter to indicate that the node should begin shutting down after a number of seconds.
StartCatchup(String)
Starts a catchpoint catchup.
Declaration
public AlgoApiRequest.Sent<CatchpointStartResponse> StartCatchup(string catchpoint)
Parameters
Type | Name | Description |
---|---|---|
String | catchpoint | A catch point |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<CatchpointStartResponse> |
Remarks
Given a catchpoint, it starts catching up to this catchpoint
SwaggerJSON()
Gets the current swagger spec.
Declaration
public AlgoApiRequest.Sent<AlgoApiObject> SwaggerJSON()
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<AlgoApiObject> | The current swagger spec |
Remarks
Returns the entire swagger spec in json.
TealCompile(Byte[], Optional<Boolean>)
Compile TEAL source code to binary, produce its hash
Declaration
public AlgoApiRequest.Sent<CompileResponse> TealCompile(byte[] source, Optional<bool> sourcemap = default(Optional<bool>))
Parameters
Type | Name | Description |
---|---|---|
Byte[] | source | TEAL source code to be compiled |
Optional<Boolean> | sourcemap | When set to |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<CompileResponse> |
Remarks
Given TEAL source code in plain text, return base64 encoded program bytes and base32 SHA512_256 hash of program bytes (Address style). This endpoint is only enabled when a node's configuration file sets EnableDeveloperAPI to true.
TealDisassemble(Byte[])
Disassemble program bytes into the TEAL source code.
Declaration
public AlgoApiRequest.Sent<DisassembleResponse> TealDisassemble(byte[] source)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | source | TEAL program binary to be disassembled |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<DisassembleResponse> |
Remarks
Given the program bytes, return the TEAL source code in plain text. This endpoint is only enabled when a node's configuration file sets EnableDeveloperAPI to true.
TealDryrun(DryrunRequest)
Provide debugging information for a transaction (or group).
Declaration
public AlgoApiRequest.Sent<DryrunResponse> TealDryrun(DryrunRequest request = null)
Parameters
Type | Name | Description |
---|---|---|
DryrunRequest | request | Transaction (or group) and any accompanying state-simulation data. |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<DryrunResponse> |
Remarks
Executes TEAL program(s) in context and returns debugging information about the execution. This endpoint is only enabled when a node's configuration file sets EnableDeveloperAPI to true.
TransactionParams()
Get parameters for constructing a new transaction
Declaration
public AlgoApiRequest.Sent<TransactionParametersResponse> TransactionParams()
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<TransactionParametersResponse> |
UnsetSyncRound()
Removes minimum sync round restriction from the ledger.
Declaration
public AlgoApiRequest.Sent UnsetSyncRound()
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent |
Remarks
Unset the ledger sync round.
WaitForBlock(UInt64)
Gets the node status after waiting for the given round.
Declaration
public AlgoApiRequest.Sent<NodeStatusResponse> WaitForBlock(ulong round)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | round | The round to wait until returning status |
Returns
Type | Description |
---|---|
AlgoApiRequest.Sent<NodeStatusResponse> |
Remarks
Waits for a block to appear after round {round} and returns the node's status at the time.
WaitForConfirmation(String, UInt32, CancellationToken)
Utility method to wait for a transaction to be confirmed given a transaction id.
Declaration
public UniTask<AlgoApiResponse<PendingTransactionResponse>> WaitForConfirmation(string txid, uint maxWaitRounds = 0U, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
String | txid | The transaction id to wait for. |
UInt32 | maxWaitRounds | How many rounds should this method wait for confirmation before cancelling early? |
CancellationToken | cancellationToken | An optional token for cancelling this task early. |
Returns
Type | Description |
---|---|
UniTask<AlgoApiResponse<PendingTransactionResponse>> | The algod response that either caused an error or showed a confirmed round. |