Crypto Agent

1 variant

A wallet agent chat page that answers with transaction cards users review and approve in place, instead of plain text.

Transaction chat

Ask to swap, send, or approve: the agent's tool steps resolve one by one, the reply streams in, and a live card follows with a re-rolling swap quote, a send preview with the saved contact, or a capped approval, each tracked from signature to confirmation.

Atlas

Wallet agent

$22,237.60

What should we move today?

Ask in plain words. I prepare every transaction as a card, and nothing is signed until you approve it.

Try asking

  • Swap tokens

    Swap 0.5 ETH to USDC

  • Pay a contact

    Send 120 USDC to lena.eth

  • Set an allowance

    Approve 500 USDC for Uniswap

"use client";

import { CryptoAgentChat } from "@/components/premium/crypto-agent/crypto-agent-chat";

export function CryptoAgentChatPreview() {
  return <CryptoAgentChat className="h-[46rem]" />;
}

Install

$ bunx --bun shadcn add @beui-pro/crypto-agent-chat

API Reference

Every prop is optional unless marked required. Data, copy, and colors default to the sample content.

CryptoAgentChat13 props
  • initialMessages

    Messages the thread starts with. Read on mount only.

    CryptoAgentMessage[]

    Default []

  • tokens

    Starting wallet tokens and balances. Read on mount, then updated by trades.

    CryptoTradeToken[]
  • contacts

    Saved contacts used to resolve and name send recipients.

    CryptoTradeContact[]
  • respond

    Turns a prompt into a reply. Defaults to a local demo parser.

    ((prompt: string, context: CryptoAgentContext) => CryptoAgentReply | Promise<CryptoAgentReply>)
  • onSign

    Asks the wallet to sign and broadcast. Resolve with the hash.

    ((action: CryptoAgentAction, approval: CryptoAgentApproval) => Promise<{ hash: string; }>)
  • waitForReceipt

    Resolves once the transaction is confirmed onchain.

    ((hash: string) => Promise<void>)
  • onReject

    Called with the action when the user declines its card.

    ((action: CryptoAgentAction) => void)
  • labels

    Text overrides merged over the default labels.

    Partial<CryptoAgentLabels>
  • suggestions

    Starter cards shown on the empty welcome screen.

    CryptoAgentSuggestion[]
  • walletAddress

    Connected wallet shown in the header.

    string

    Default 0x7a3d9e1fb2c4a5d6e7f8091a2b3c4d5e6f70b41c

  • network

    Network id whose icon shows in the header wallet pill. Defaults to ethereum.

    string

    Default ethereum

  • explorerUrl

    Builds the block explorer link for a transaction hash.

    ((hash: string) => string)

    Default (hash) => `https://etherscan.io/tx/${hash}`

  • className

    Classes merged onto the root element.

    string
Types8 types

The object types these props take, field by field.

CryptoTradeToken9 fields
  • idRequired

    Unique per network, since one symbol can live on several chains.

    string
  • symbolRequired

    Ticker shown next to amounts, such as "ETH".

    string
  • nameRequired

    Full token name shown in the token picker.

    string
  • networkRequired

    Matches a `CryptoTradeNetwork` id.

    string
  • balanceRequired

    Wallet balance in whole token units.

    number
  • usdPriceRequired

    Current price of one token, in USD.

    number
  • precisionRequired

    Maximum fraction digits shown for amounts of this token.

    number
  • change24h

    24h price change in percent.

    number
  • popular

    Shown as a quick pick above the token search.

    boolean
CryptoTradeContact4 fields
  • idRequired

    Unique id for the contact.

    string
  • nameRequired

    Display name shown in the recent recipients list.

    string
  • addressRequired

    Wallet address filled in when the contact is picked.

    string
  • avatar

    Avatar image URL shown beside the name.

    string
CryptoAgentReply3 fields
  • textRequired

    Agent's answer, streamed in word by word after the steps finish.

    string
  • steps

    Tool steps revealed one at a time before the text appears.

    CryptoAgentStep[]
  • action

    Transaction to show as an approval card under the text.

    CryptoAgentAction
CryptoAgentContext2 fields
  • tokensRequired

    Wallet tokens with their current balances, after any earlier trades.

    CryptoTradeToken[]
  • contactsRequired

    Saved contacts the agent can resolve recipients from.

    CryptoTradeContact[]
CryptoAgentLabels34 fields
  • agentNameRequired

    Agent name shown in the header.

    string
  • agentStatusRequired

    Muted line under the agent name in the header.

    string
  • greetingRequired

    Welcome heading shown before the first message.

    string
  • greetingBodyRequired

    Welcome paragraph under the greeting.

    string
  • placeholderRequired

    Placeholder text in the message input.

    string
  • sendRequired

    Send button label. Currently not rendered by the chat.

    string
  • thinkingRequired

    Label shown while the agent works on a reply.

    string
  • suggestionsRequired

    Screen-reader heading for the starter suggestion cards.

    string
  • approveRequired

    Approve button on a transaction card.

    string
  • rejectRequired

    Decline button on a transaction card.

    string
  • signingRequired

    Approve button text while the wallet is signing.

    string
  • confirmedRequired

    Status chip shown once the transaction confirms.

    string
  • rejectedRequired

    Status chip shown after the user declines a card.

    string
  • failedRequired

    Status chip shown when signing or confirmation fails.

    string
  • retryRequired

    Approve button text after a failed transaction.

    string
  • refreshQuoteRequired

    Button that refreshes an expired swap quote.

    string
  • quoteExpiresRequired

    Screen-reader text before the swap quote countdown.

    string
  • viewTxRequired

    Link to the transaction on the block explorer.

    string
  • stepsRequired

    Names of the sign, submitted, and confirmed progress steps.

    [sign: string, submit: string, confirm: string]
  • networkFeeRequired

    Network fee row on every transaction card.

    string
  • payRequired

    Label for the paid leg of a swap.

    string
  • sendingRequired

    Label above the amount on a send card.

    string
  • receiveRequired

    Label for the received leg of a swap.

    string
  • rateRequired

    Exchange rate row on a swap card.

    string
  • minimumReceivedRequired

    Minimum received row on a swap card.

    string
  • priceImpactRequired

    Price impact row on a swap card.

    string
  • balanceAfterRequired

    Balance after row on a send card.

    string
  • allowanceRequired

    Label above the amount on an approval card.

    string
  • exactAmountRequired

    Note on an approval card that the allowance is capped.

    string
  • spenderRequired

    Spender row on an approval card.

    string
  • titlesRequired

    Card title for each action kind.

    Record<CryptoAgentAction["kind"], string>
  • declinedReplyRequired

    Agent message added after the user declines a card.

    string
  • failedReplyRequired

    Agent message shown when `respond` throws.

    string
  • confirmedReplyRequired

    Builds the agent message after a confirmed transaction from its plain receipt.

    (action: CryptoAgentAction, summary: string) => string
CryptoAgentSuggestion3 fields
  • kindRequired

    Action kind that picks the card's icon.

    CryptoAgentAction["kind"]
  • titleRequired

    Card heading.

    string
  • promptRequired

    Message sent to the agent when the card is picked, also shown on the card.

    string
CryptoAgentApproval1 field
  • amountOut

    Swap output quoted on the card when approved, used for the receipt and balances.

    number
CryptoAgentStep3 fields
  • labelRequired

    Step name shown in the list, such as "Checked balance". Also used as its key.

    string
  • detail

    Muted result line shown after the label.

    string
  • state

    Spinner while running, check when done. Set by the chat as steps resolve.

    "running" | "done"