sendTransfer

Request the signature and broadcast of a Bitcoin transaction

Method name

sendTransfer

Parameters

ParameterDescriptionRequiredType

recipients

Array of amounts to transfer by recipient address

array

network

Network for signing: mainnet, testnet, signet, sbtcDevenv or devnet

string

account

Index of account for signing (defaults to active account)

uint

Example request

try {
  const response = await window.LeatherProvider.request("sendTransfer", {
    recipients: [
      {
        address: "tb1qkzvk9hr7uvas23hspvsgqfvyc8h4nngeqjqtnj",
        amount: "10000",
      },
      {
        address: "tb1q7950cllqywrts5cjgee4yz4dc8c8vnyxuc9z07",
        amount: "20000",
      },
    ],
    network: "testnet",
  });

  console.log("Response:", response);
  console.log("Transaction ID:", response.result.txid);
} catch (error) {
  console.log("Request error:", error.error.code, error.error.message);
}

Example response

{
    "jsonrpc": "2.0",
    "id": "52a8fabf-d9a6-4b46-b042-b8c153a23dfc",
    "result": {
        "txid": "f007551f169722ce74104d6673bd46ce193c624b8550889526d1b93820d725f7"
    }
}

Sandbox

Install the Leather extension then try out this method below:

Preview

Last updated