@arkade-os/sdk Documentation - v0.4.21
    Preparing search index...

    Class OnchainWallet

    Onchain Bitcoin wallet implementation for traditional Bitcoin transactions.

    This wallet handles regular Bitcoin transactions on the blockchain without using the Arkade protocol. It supports P2TR (Pay-to-Taproot) addresses and provides basic Bitcoin wallet functionality.

    const wallet = await OnchainWallet.create(identity, 'mainnet');
    const balance = await wallet.getBalance();
    const txid = await wallet.send({
    address: 'bc1...',
    amount: 50000
    });

    Implements

    Index

    Properties

    network: Network
    onchainP2TR: P2TR
    provider: OnchainProvider
    MIN_FEE_RATE: number = 1

    Accessors

    Methods

    • CPFP-bump a parent transaction that contains a pay-to-anchor output.

      Parameters

      • parent: Transaction

        Parent transaction containing a pay-to-anchor output

      Returns Promise<[string, string]>

      Tuple of parent transaction id and child transaction id

      Error if the parent transaction has no pay-to-anchor output or bumping cannot be funded

      send

    • Return the wallet's total onchain balance in satoshis.

      Returns Promise<number>

      Confirmed plus unconfirmed onchain balance

      getCoins

    • Fetch spendable onchain outputs for the wallet address.

      Returns Promise<Coin[]>

      Spendable onchain outputs for the wallet address

      getBalance

    • Send bitcoin to a single onchain address.

      Parameters

      • params: SendBitcoinParams

        destination address, amount (in satoshis), and optional feeRate override (other fields ignored)

      Returns Promise<string>

      Broadcast transaction id

      Error if the amount is non-positive, below dust, or cannot be funded

      SendBitcoinParams

    • Create an onchain wallet for the given identity and Bitcoin network.

      Parameters

      • identity: Identity

        Identity used to derive the Taproot key and sign transactions

      • networkName: NetworkName

        Bitcoin network name,

      • Optionalprovider: OnchainProvider

        Optional onchain provider override,

      Returns Promise<OnchainWallet>

      Configured onchain wallet

      • NetworkName
      • OnchainProvider

      provider = new EsploraProvider('https://mempool.space/api')

      Error if the configured identity cannot produce a valid x-only public key