send

Sends a payment.

Type

;(amount: bigint, address: string) => Promise<string>

Parameters

amount

A number representing the amount of satoshis to be sent.

address

An string encoding the receiver address.

Return Value

If successful, it returns the id of the transaction broadcast.

Example

import { Computer } from '@bitcoin-computer/lib'
import { chain, expect, network, url } from '../../utils/index.js'

describe('send', () => {
  it('Should return the previous revision', async () => {
    // Create and fund wallet
    const computer = new Computer({ chain, network, url })
    await computer.faucet(1e8)

    // Send transaction with payment
    const txId = await computer.send(BigInt(1e6), computer.getAddress())
    expect(txId).to.be.a('string')
  })
})

Source