Class ClaimAirdropExtensions
Extension methods for claiming pending airdrops on the network.
Inherited Members
Namespace: Hiero
Assembly: Hiero.dll
Syntax
public static class ClaimAirdropExtensions
Methods
| Edit this page View SourceClaimAirdropAsync(ConsensusClient, Airdrop, Action<IConsensusContext>?)
Claims a single pending airdrop.
Declaration
public static Task<TransactionReceipt> ClaimAirdropAsync(this ConsensusClient client, Airdrop pendingAirdrop, Action<IConsensusContext>? configure = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusClient | client | The Consensus Node Client orchestrating the claim. |
| Airdrop | pendingAirdrop | The pending airdrop to claim. |
| Action<IConsensusContext> | configure | Optional callback method providing an opportunity to modify the execution configuration for just this method call. It is executed prior to submitting the request to the network. |
Returns
| Type | Description |
|---|---|
| Task<TransactionReceipt> | A transaction receipt indicating a successful operation. |
Examples
// Claim a single pending airdrop. The receiver calls this — their
// payer account must be `receiver`, or their key must be provided
// via the params overload.
var pending = new Airdrop(sender, receiver, token);
var receipt = await client.ClaimAirdropAsync(pending);
Console.WriteLine($"Claim status: {receipt.Status}");
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | If required arguments are missing. |
| InvalidOperationException | If required context configuration is missing. |
| PrecheckException | If the gateway node rejected the request upon submission. |
| ConsensusException | If the network was unable to come to consensus before the duration of the transaction expired. |
| TransactionException | If the network rejected the request as invalid or had missing data. |
ClaimAirdropsAsync(ConsensusClient, ClaimAirdropParams, Action<IConsensusContext>?)
Claims one or more pending airdrops.
Declaration
public static Task<TransactionReceipt> ClaimAirdropsAsync(this ConsensusClient client, ClaimAirdropParams claimParams, Action<IConsensusContext>? configure = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusClient | client | The Consensus Node Client orchestrating the claim. |
| ClaimAirdropParams | claimParams | The claim parameters containing the list of pending airdrops to claim. |
| Action<IConsensusContext> | configure | Optional callback method providing an opportunity to modify the execution configuration for just this method call. It is executed prior to submitting the request to the network. |
Returns
| Type | Description |
|---|---|
| Task<TransactionReceipt> | A transaction receipt indicating a successful operation. |
Examples
// Claim several pending airdrops in a single transaction. Mixing
// fungible and NFT pendings in one call is fine.
var receipt = await client.ClaimAirdropsAsync(new ClaimAirdropParams
{
Airdrops = new[]
{
new Airdrop(sender, receiver, token1),
new Airdrop(sender, receiver, nft1)
}
});
Console.WriteLine($"Claim status: {receipt.Status}");
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | If required arguments are missing. |
| InvalidOperationException | If required context configuration is missing. |
| PrecheckException | If the gateway node rejected the request upon submission. |
| ConsensusException | If the network was unable to come to consensus before the duration of the transaction expired. |
| TransactionException | If the network rejected the request as invalid or had missing data. |