BigBlocks

Send BSV

A trigger button that opens a send dialog for transferring Bitcoin SV to any address, with sats/BSV unit toggle and fee preview

Installation

bunx shadcn@latest add https://registry.bigblocks.dev/r/send-bsv.json

Usage

SendBsv requires an onSend callback that performs the actual transaction. The callback receives the destination address and satoshi amount and must return a SendBsvResult.

import { SendBsv } from "@/components/blocks/send-bsv"
 
export function WalletActions() {
  return (
    <SendBsv
      onSend={async ({ address, satoshis }) => {
        // Call your wallet's send action here.
        // With @1sat/actions:
        // const result = await sendBsv.execute(ctx, {
        //   requests: [{ address, satoshis }],
        // })
        // return result
        return { txid: "abc123..." }
      }}
      onSuccess={(result) => console.log("txid:", result.txid)}
      onError={(err) => console.error(err)}
    />
  )
}

Variants

Compact

An icon-only square button. Useful in dense UIs such as table rows or toolbars.

Quick

An inline input + send button that pre-fills the dialog amount. Users type a satoshi amount directly without opening the dialog first.

Dialog Sizes

The send dialog has two size modes controlled by dialogSize:

ValueMax widthUse case
"full" (default)sm:max-w-mdStandard send flow with description text
"compact"sm:max-w-smTighter layouts, hides the dialog description

Props

SendBsv

PropTypeDefaultDescription
onSend(params: SendBsvParams) => Promise<SendBsvResult>requiredCallback that executes the send transaction
variant"default" | "compact" | "quick""default"Trigger button style
dialogSize"full" | "compact""full"Controls the send dialog width and verbosity
onSuccess(result: SendBsvResult) => voidCalled after a successful send
onError(error: Error) => voidCalled when the send fails
defaultAddressstring""Pre-filled destination address
defaultSatoshisnumberPre-filled amount in satoshis
estimatedFeenumber50Network fee estimate shown in the dialog (satoshis)
triggerLabelstring"Send BSV"Label for the default variant button
disabledbooleanfalseDisables the trigger button
classNamestringAdditional CSS classes for the trigger
dialogClassNamestringAdditional CSS classes for the dialog content

SendBsvParams

The object passed to your onSend callback:

interface SendBsvParams {
  address: string  // Destination BSV address
  satoshis: number // Amount in satoshis
}

SendBsvResult

The object your onSend callback must return:

interface SendBsvResult {
  txid?: string   // Transaction ID on success
  rawtx?: string  // Raw transaction hex
  error?: string  // Error message on failure
}

When error is present in the result, SendBsv surfaces it in the dialog and calls onError. When txid is present, the dialog shows a success state with the transaction ID.

Sub-components

The block exports SendBsvTrigger and SendBsvDialog separately if you need to wire them independently.

SendBsvTrigger

import { SendBsvTrigger } from "@/components/blocks/send-bsv"
 
<SendBsvTrigger
  variant="default"
  label="Send"
  loading={isSending}
  onClick={() => setDialogOpen(true)}
/>

SendBsvTrigger Props

PropTypeDefaultDescription
variant"default" | "compact" | "quick""default"Trigger style
labelstring"Send BSV"Button label (default and quick variants)
disabledbooleanfalseDisables the trigger
loadingbooleanfalseShows a spinner and disables the trigger
onClick() => voidClick handler (opens the dialog)
quickAmountstring""Controlled amount value for the quick variant
onQuickAmountChange(value: string) => voidCalled when the quick variant amount changes
onQuickSend() => voidCalled when the quick variant send button is clicked
classNamestringAdditional CSS classes

SendBsvDialog

import { SendBsvDialog } from "@/components/blocks/send-bsv"
 
<SendBsvDialog
  open={dialogOpen}
  onOpenChange={setDialogOpen}
  onSend={handleSend}
  onSuccess={(result) => console.log(result.txid)}
  estimatedFee={50}
/>

SendBsvDialog Props

PropTypeDefaultDescription
openbooleanrequiredWhether the dialog is open
onOpenChange(open: boolean) => voidrequiredCalled when the open state should change
onSend(params: SendBsvParams) => Promise<SendBsvResult>requiredSend callback
onSuccess(result: SendBsvResult) => voidCalled on successful send
onError(error: Error) => voidCalled on send failure
defaultAddressstring""Pre-filled destination address
defaultSatoshisnumberPre-filled amount in satoshis
estimatedFeenumber50Network fee shown in the summary row
size"full" | "compact""full"Dialog width and description visibility
classNamestringAdditional CSS classes for the dialog content