circle-check
Our docs are AI-ready. Use them as context for any AI, or ask questions via the search bar.

comment-arrow-up-rightuseSendTransaction

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.

circle-info

This endpoint must be used for all the endpoints after we execute it. Except getEscrowBalances, getEscrowsByContractId, getEscrowsByRole and getEscrowsBySigner .

Usage

This custom hook exposes a function to send a signed transaction to the network.

import { useSendTransaction} from "@trustless-work/escrow/hooks";

/*
 *  useSendTransaction
*/
const { sendTransaction } = useSendTransaction();

/* 
 * It returns a SendTransactionResponse
 * payload should be of type string
*/
const data = await sendTransaction(signedXdr);

Function

  • sendTransaction Responsible for building and returning data based on the provided payload.

Argument:

payload: An string containing the required fields to send a transaction to the network.

box-tapedTypeschevron-right

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?