Sats Connect - Wallet API for Bitcoin & Stacks
  • Introduction
  • Wallet Providers
    • getInfo
    • getProviders & getProviderById
  • Connecting to the wallet
    • Connect to Xverse Wallet
    • Disconnect from Xverse Wallet
    • Connect to other wallets
      • Manage a user's default wallet
    • [Legacy âš ī¸] getAccounts
  • Wallet Methods
    • request methods
    • wallet_getAccount
    • wallet_getNetwork
    • wallet_changeNetwork
    • Xverse Custom Methods
  • Xverse Wallet Permissions
  • Xverse Wallet events
  • BITCOIN METHODS
    • 🟠getAddresses
    • 🟠signMessage
    • 🟠signPsbt
    • 🟠sendTransfer
    • 🟠signMultipleTransactions
    • 🟠getBalance
    • 🎨createInscription
    • 🎨createRepeatInscriptions
    • 🎨ord_getInscriptions
    • 🎨ord_sendInscriptions
    • 🔲runes_getBalance
    • 🔲runes_transfer
    • 🔲Mint Runes
      • runes_estimateMint
      • runes_mint
    • 🔲Etch Runes
      • runes_estimateEtch
      • runes_etch
    • 🔲runes_getOrder
    • 🔲Speed up a Rune Mint or Etch order
      • 🔲runes_estimateRbfOrder
      • 🔲runes_rbfOrder
  • STACKS METHODS
    • 🔴stx_getAccounts
    • 🔴stx_signMessage
    • 🔴stx_signStructuredMessage
    • 🔴stx_transferStx
    • 🔴stx_signTransaction
    • 🔴stx_callContract
    • 🔴stx_deployContract
  • GUIDES
    • Verify Bitcoin message signatures
    • Creating Bitcoin PSBTs
    • 📱Mobile Integration
    • Next.js support
  • RESOURCES
    • App Template
    • Demo App
    • Changelog
    • Github Issues
    • Developer forum
    • BIP322
Powered by GitBook
On this page
  1. STACKS METHODS

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

  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

Previousstx_signStructuredMessageNextstx_signTransaction

Last updated 5 months ago

Optional a string representing the transaction memo

🔴
â„šī¸