Class XrplResponseTaskExtensions
Awaiting helpers for the XrplResponse<T> a client method returns.
Inheritance
Namespace: Xrpl.Client
Assembly: Xrpl.dll
Syntax
public static class XrplResponseTaskExtensions
Remarks
Reading the projection off an awaited call otherwise reads
(await client.ServerFeatures()).Result: the call has to be parenthesised so the
member access lands on the awaited value rather than the task. That is unlike ordinary
awaiting, and the member it reaches is spelled the same as System.Threading.Tasks.Task<TResult>.Result
- which blocks - so the line reads as sync-over-async to anyone scanning it, and to analyzers looking for exactly that shape. Neither is true here.
await client.ServerFeatures().Typed() puts the await back where it belongs. The
three forms are equivalent; use whichever fits:
ServerFeatures f = await client.ServerFeatures().Typed(); // projection only
var (f, raw) = await client.ServerFeatures(); // both
XrplResponse<ServerFeatures> r = await client.ServerFeatures(); // the envelope
Methods
| Edit this page View SourceTyped<T>(Task<XrplResponse<T>>)
Awaits the call and hands back the typed projection alone.
Declaration
public static Task<T> Typed<T>(this Task<XrplResponse<T>> response)
Parameters
| Type | Name | Description |
|---|---|---|
| Task<XrplResponse<T>> | response |
Returns
| Type | Description |
|---|---|
| Task<T> |
Type Parameters
| Name | Description |
|---|---|
| T |
Remarks
The projection is lossy in both directions - see XrplResponse<T>. Anything that has to show or verify what the node actually said needs Raw, so await the call itself rather than using this.