BluxBlux

Send Transaction

Submit Stellar transactions from your React app using the Blux SDK.

Use the sendTransaction function from useBlux to submit transactions. When called, Blux shows a confirmation modal displaying the transaction details, estimated fee, and submitting account before the user approves.

Import

import { useBlux } from "@bluxcc/react";

Type

type IOptions = {
  network?: string;
  isSoroban?: boolean;
};

const sendTransaction: (xdr: string, options?: IOptions) => Promise<...>;
ParameterTypeDescription
xdrstringBase64-encoded XDR string of the transaction
options.isSorobanbooleanSet to true for Soroban smart contract transactions
options.networkstringNetwork to use; omit to use the active network

When isSoroban is true, sendTransaction returns Promise<rpc.Api.GetSuccessfulTransactionResponse>. Otherwise it returns Promise<Horizon.HorizonApi.SubmitTransactionResponse>.

Usage

const { sendTransaction } = useBlux();

const sendTx = async () => {
  try {
    const result = await sendTransaction(xdr, { isSoroban: true });
    console.log('Transaction submitted', result);
  } catch (error) {
    console.error('Something went wrong!', error);
  }
};

To skip the confirmation modal and build your own flow, set showWalletUIs: false in your BluxProvider configuration.

Screenshots

Send Transaction modal

On this page