1.0.28 • Published 1 month ago
dotswap-wallet v1.0.28
web3 钱包聚合库
主要的 api 与变量
- walletApi 用于调用钱包 api 的。
- walletDict 支持的钱包的字典对应
- hasWallet 获取浏览器中是否存在对应的钱包
walletApi 提供的 api 与方法
- connect 用于连接钱包
- disconnect 用于断开钱包
- getInfo 获取用户信息
- sign 用于签名
- signPsbt 用于签名 psbt
- sendBitcoin 用于发送 btc
- getNetwork 用于获取钱包当前网络
- changeWallet 切换不同钱包或网络
- on 监听内容变化事件
import { walletApi } from "dotswap-wallet";
const {connect, disconnect...} = walletApi;
const connectFn = async () {
const data = await connect();
console.log("data", data)
// 输出的data内容
// {
// name: WalletName | null; // 钱包名称
// network: Network; // 当前网络
// publicKey: string; // 公钥
// accounts: string[]; // 账户
// address: string; // 钱包地址
// btcAddress: string; // BTC钱包地址
// btcPublicKey: string; // BTC钱包公钥
// balance?: {
// confirmed?: number; // 确认的余额
// total?: number; // 总余额
// unconfirmed?: number; // 未确认的余额
// };
// }
}
Api 部分
- getBase64Str 获取 base64 字符串
- getHexStr 获取 hex 字符串
- btcToSatoshis 用于 btc 转成 satoshis
- satoshisToBtc 用于 btc 转成 satoshis
- getNeedFinalList 互殴去 finalze 的列表
1.0.28
1 month ago
1.0.27
1 month ago
1.0.26
1 month ago
1.0.25
2 months ago
1.0.24
2 months ago
1.0.22
2 months ago
1.0.21
2 months ago
1.0.20
2 months ago
1.0.23
2 months ago
1.0.19
2 months ago
1.0.18
2 months ago
1.0.17
2 months ago
1.0.16
2 months ago
1.0.15
2 months ago
1.0.14
2 months ago
1.0.13
2 months ago
1.0.12
2 months ago
1.0.11
2 months ago
1.0.10
2 months ago
1.0.9
2 months ago
1.0.8
2 months ago
1.0.0
3 months ago