useSendTransaction
Most Trustless Work endpoints return an unsigned transaction in XDR format. This endpoint is used to sign such unsigned transactions and send them to the Stellar network.
Usage
This custom hook exposes a mutation function to send a signed transaction to the network.
Description of Return Values
isPending
A boolean status flag indicating whether the mutation is currently in progress. Useful for showing loaders or disabling UI elements during the process.isError
A boolean status flag that becomestrue
if the mutation fails.isSuccess
A boolean status flag that becomestrue
once the mutation completes successfully.
Mutation Function
sendTransaction
This is the main mutation function. Internally, it wrapsmutate
ormutateAsync
and is responsible for building and returning data based on the provided payload.
Argument:
SendTransactionPayload
: An object containing the required fields to send a transaction to the network.
Return Value:
For: Fund Escrow, Resolve Dispute, Change Milestone Status, Change Milestone Approved Flag, Start Dispute, Release Funds:
This object will be a type of sendTransactionResponse.
For: Initialize Escrow:
This object will be a type of sendTransactionResponse. But you can set it as InitializeEscrowResponse.
For: Update Escrow:
This object will be a type of sendTransactionResponse. But you can set it as UpdateEscrowResponse.
Usage Example
Last updated
Was this helpful?