Pick Helpers
Utility functions to easily "pick" deeply nested values or undefined
pickDecoded
pickDecoded
picks a decoded value or undefined
from DecodedContractResult
returned by useCall, and similar hooks.
pickError
pickError
picks a DispatchError
(thrown in one of many possible pallets) or undefined from DecodedContractResult
returned by useCall, and similar hooks.
pickDecodedError
pickDecodedError
picks a DispatchError
(thrown in one of many possible pallets) or undefined from DecodedContractResult
and returns a string error message. This is a wrapper around decodeError.
// export function pickDecodedError( // call: CallResult | undefined, // contract: Contract, // moduleMessages?: Record<RegistryErrorMethod, string>, // defaultMessage?: string, // ): string | undefined {
pickResultOk
pickResultOk
picks the decoded Ok value or undefined
if a contract returns a Result<T, E>
. Can be used with useCall and similar hooks.
pickResultErr
pickResultErr
picks the decoded Err value or undefined
if a contract returns a Result<T, E>
. Can be used with useCall and similar hooks.
pickCallInfo
pickCallInfo
picks the CallInfo
or undefined
from a message result. Can be used with useCall and similar hooks.
pickTxInfo
pickTxInfo
picks the TxInfo
or undefined
from a tx or dry run result. Can be used with useTx, useDryRun, and similar hooks.
Last updated
Was this helpful?