> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arksat.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# 发送交易

> 发送 BTC 与代币。

先连接钱包，以下函数由用户点击调用，在调用处处理错误。SDK 不自动重复发送。

## BTC

```ts theme={null}
import type { ArksatClient } from '@arksat/wallet-sdk'

export async function sendBtc(client: ArksatClient, address: string) {
  return client.sendToAddress({ address, amount: 1000 }) // 1000 sats
}
```

数量必须是正整数 sats。插件进一步校验地址、网络和可用资金，用户确认交易后返回 `{ txid }`。

## 代币

```ts theme={null}
import { decimalAmountToRaw, type ArksatClient } from '@arksat/wallet-sdk'

export async function sendToken(
  client: ArksatClient, address: string, assetId: string,
  decimalAmount: string, verifiedDecimals: number,
) {
  const amount = decimalAmountToRaw(decimalAmount, verifiedDecimals)
  return client.sendAsset({ address, assets: [{ assetId, amount }] })
}
```

`verifiedDecimals` 必须来自该资产可信元数据。`assetId` 为 68 位十六进制字符串，`amount` 为正 uint64 最小单位字符串。可选 `bitcoinAmount` 是随交易发送的 BTC 数量（sats），不是手续费参数。

`{ txid }` 代表提交结果，不代表最终到账，后续查询[交易状态](https://docs.arksat.xyz/events.md)。超时、断连时先核对记录，避免重复付款。

`sendSwapFunding` 用于协议融资，参数见[API 参考](https://docs.arksat.xyz/api.md)和类型声明，返回交易 ID 不代表整个 swap 已完成。普通代币转账使用 `sendAsset`。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.