Skip to content

useAddTxIntention

Adds a transaction intention. Wraps addTxIntention and stores the resulting intention in the context store.

Import

ts
import { useAddTxIntention } from "@midl/executor-react";

Example

ts
const { addTxIntention } = useAddTxIntention();
addTxIntention({ intention });

Parameters

NameTypeDescription
configConfig(optional) Custom configuration to override the default.
storeMidlContextStore(optional) Custom store to override the default.

Returns

NameTypeDescription
addTxIntention(variables: AddTxIntentionVariables) => voidMutation function to add a transaction intention.
addTxIntentionAsync(variables: AddTxIntentionVariables) => Promise<TransactionIntention>Async mutation function.
txIntentionsTransactionIntention[]The current transaction intentions in the store.
...restobjectAdditional mutation state from React Query.

AddTxIntentionVariables

NameTypeDescription
intentionPartialIntentionThe intention to add.
resetboolean (optional)If true, the array of intentions will be cleared before adding the new one.
fromstring (optional)BTC address of the account to use to sign the transaction.