Skip to main content

useMutation

Callable

  • useMutation<TAction, TChainId>(action: TAction, options?: ChainComposableOptions<TChainId> & { signer?: MaybeRefOrGetter<PolkadotSigner>; txOptions?: MaybeRefOrGetter<Partial<void extends ReturnType<TAction> extends Transaction<_Args, _Pallet, _Tx, Asset> ? Asset : void ? {} : {}>> }): { data: Ref<TxEvent, TxEvent>; error: Ref<unknown, unknown>; execute: (...args: [submitOptions?: Partial<void extends ReturnType<TAction> extends Transaction<_Args, _Pallet, _Tx, Asset> ? Asset : void ? {} : {}> & { signer: PolkadotSigner }]) => Subscription | Promise<void>; status: Ref<error | success | idle | pending, error | success | idle | pending> }

  • Composable for sending transactions to chains.


    Type parameters

    • TAction: (builder: any) => Transaction<any, any, any, any>
    • TChainId: any

    Parameters

    • action: TAction

      The function to create the transaction

    • optionaloptions: ChainComposableOptions<TChainId> & { signer?: MaybeRefOrGetter<PolkadotSigner>; txOptions?: MaybeRefOrGetter<Partial<void extends ReturnType<TAction> extends Transaction<_Args, _Pallet, _Tx, Asset> ? Asset : void ? {} : {}>> }

      Additional options

    Returns { data: Ref<TxEvent, TxEvent>; error: Ref<unknown, unknown>; execute: (...args: [submitOptions?: Partial<void extends ReturnType<TAction> extends Transaction<_Args, _Pallet, _Tx, Asset> ? Asset : void ? {} : {}> & { signer: PolkadotSigner }]) => Subscription | Promise<void>; status: Ref<error | success | idle | pending, error | success | idle | pending> }

    The current transaction state & submit function

    • data: Ref<TxEvent, TxEvent>
    • error: Ref<unknown, unknown>
    • execute: (...args: [submitOptions?: Partial<void extends ReturnType<TAction> extends Transaction<_Args, _Pallet, _Tx, Asset> ? Asset : void ? {} : {}> & { signer: PolkadotSigner }]) => Subscription | Promise<void>
        • (...args: [submitOptions?: Partial<void extends ReturnType<TAction> extends Transaction<_Args, _Pallet, _Tx, Asset> ? Asset : void ? {} : {}> & { signer: PolkadotSigner }]): Subscription | Promise<void>
        • Parameters

          • rest...args: [submitOptions?: Partial<void extends ReturnType<TAction> extends Transaction<_Args, _Pallet, _Tx, Asset> ? Asset : void ? {} : {}> & { signer: PolkadotSigner }]

          Returns Subscription | Promise<void>

    • status: Ref<error | success | idle | pending, error | success | idle | pending>