🔴stx_transferStx

You can use the stx_transferStx method to request a transfer of any amount of Stacks to any recipient from the user's wallet.

Request parameters
Description

amount

a string representing the amount of STX tokens to transfer, in microstacks units. (Anything parseable by BigInt is acceptable)

recipient

a string representing the recipient's Crockford base-32 encoded Stacks address

memo

ℹī¸ Optional a string representing the transaction memo

  import { request } from "sats-connect";
  
  try {
      const response = await request("stx_transferStx", {
        recipient,
        amount: Number(amount),
        memo,
      });
      if ("result" in response) {
        alert(response.result.txid);
      } else {
        alert(response.error.message);
      }
    } catch (error) {
      console.error(error);
      alert(error.message);
    }
  };

The user will be prompted to review the Stacks transfer transaction in the wallet, with the recipient, memo and amount to send. Xverse browser extension UI shown as example:

The transaction will be signed and broadcasted upon user approval.

The stx_transferStx method returns a Promise that resolves to the TransferStxResult object:

Property
Description

txid

a hex-encoded string representing the ID of the transfer STX transaction signed

transaction

a hex-encoded string reperesenting the transfer STX transaction signed

Last updated