sendBtcTransaction

import { sendBtcTransaction } from 'sats-connect'

You can request to send an amount of Bitcoin to one or more recipients using the sendBtcTransaction method

payloadDescription

recipients

an array containing the recipients addresses and the amount sent to each recipient in sats

senderAddress

the address where the funds are to be sent from

network

an object specifying the target Bitcoin chain (Mainnet / Testnet)

const sendBtcOptions = {
  payload: {
    network: {
      type: "Testnet",
    },
    recipients: [
      {
        address: '2NBC9AJ9ttmn1anzL2HvvVML8NWzCfeXFq4',
        amountSats: 1500,
      },
      {
        address: '2NFhRJfbBW8dhswyupAJWSehMz6hN5LjHzR',
        amountSats: 1500,
      },
    ],
    senderAddress: 'paymentAddress',
  },
  onFinish: (response) => {
    alert(response);
  },
  onCancel: () => alert("Canceled"),
};

await sendBtcTransaction(sendBtcOptions);

The user will be prompted to review and sign the transaction in the wallet, with the various recipients and amounts sent.

Last updated