1.0.28 • Published 1 month ago

dotswap-wallet v1.0.28

Weekly downloads
-
License
ISC
Repository
-
Last release
1 month ago

web3 钱包聚合库

主要的 api 与变量

  1. walletApi 用于调用钱包 api 的。
  2. walletDict 支持的钱包的字典对应
  3. hasWallet 获取浏览器中是否存在对应的钱包

walletApi 提供的 api 与方法

  1. connect 用于连接钱包
  2. disconnect 用于断开钱包
  3. getInfo 获取用户信息
  4. sign 用于签名
  5. signPsbt 用于签名 psbt
  6. sendBitcoin 用于发送 btc
  7. getNetwork 用于获取钱包当前网络
  8. changeWallet 切换不同钱包或网络
  9. 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 部分

  1. getBase64Str 获取 base64 字符串
  2. getHexStr 获取 hex 字符串
  3. btcToSatoshis 用于 btc 转成 satoshis
  4. satoshisToBtc 用于 btc 转成 satoshis
  5. 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