@bestinslot/wallet-kit 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -0
- package/dist/balances-BQiaAIaq.js +9627 -0
- package/dist/browser.js +205 -0
- package/dist/core.js +39 -0
- package/dist/mint-BXVHw4CQ.js +70722 -0
- package/dist/node.js +1787 -0
- package/dist/react.js +14 -0
- package/dist/register-browser-providers-CLLT6W6P.js +499 -0
- package/dist/types/adapters/react/use-network.d.ts +8 -0
- package/dist/types/adapters/react/use-wallet.d.ts +15 -0
- package/dist/types/adapters/vue/use-network.d.ts +12 -0
- package/dist/types/api/balances.d.ts +52 -0
- package/dist/types/api/brc20.d.ts +110 -0
- package/dist/types/api/helpers.d.ts +3 -0
- package/dist/types/api/mint.d.ts +57 -0
- package/dist/types/api/modal.d.ts +3 -0
- package/dist/types/api/swap.d.ts +122 -0
- package/dist/types/api/wallet.browser.d.ts +2 -0
- package/dist/types/api/wallet.d.ts +6 -0
- package/dist/types/api/wallet.node.d.ts +4 -0
- package/dist/types/browser.d.ts +10 -0
- package/dist/types/components/Dev.vue.d.ts +11 -0
- package/dist/types/components/connect-modal-view.d.ts +28 -0
- package/dist/types/components/dev/BRC20.vue.d.ts +2 -0
- package/dist/types/components/dev/Button.vue.d.ts +17 -0
- package/dist/types/components/dev/Input.vue.d.ts +12 -0
- package/dist/types/components/dev/Label.vue.d.ts +17 -0
- package/dist/types/components/dev/Select.vue.d.ts +17 -0
- package/dist/types/components/dev/SessionInfo.vue.d.ts +6 -0
- package/dist/types/core/bis.d.ts +21 -0
- package/dist/types/core/bis_swap.d.ts +622 -0
- package/dist/types/core/brc20.d.ts +229 -0
- package/dist/types/core/connect-modal.d.ts +15 -0
- package/dist/types/core/helpers.d.ts +212 -0
- package/dist/types/core/mint.d.ts +364 -0
- package/dist/types/core/modal.d.ts +21 -0
- package/dist/types/core/providers.d.ts +90 -0
- package/dist/types/core/register-browser-providers.d.ts +1 -0
- package/dist/types/core/register-local-provider.d.ts +1 -0
- package/dist/types/core/storage.d.ts +19 -0
- package/dist/types/core/store-network.d.ts +20 -0
- package/dist/types/core/store.d.ts +39 -0
- package/dist/types/core.d.ts +10 -0
- package/dist/types/lib/bitcoin.d.ts +8 -0
- package/dist/types/lib/dev-worker.d.ts +1 -0
- package/dist/types/lib/dev.d.ts +9 -0
- package/dist/types/lib/swap-constants.d.ts +7 -0
- package/dist/types/lib/swap-reporting.d.ts +80 -0
- package/dist/types/lib/uniswap_ops.d.ts +238 -0
- package/dist/types/lib/web3.d.ts +7 -0
- package/dist/types/node.d.ts +9 -0
- package/dist/types/provider/api.d.ts +97 -0
- package/dist/types/provider/leather.d.ts +2 -0
- package/dist/types/provider/local.d.ts +39 -0
- package/dist/types/provider/okx.d.ts +2 -0
- package/dist/types/provider/unisat.d.ts +2 -0
- package/dist/types/provider/xverse.d.ts +2 -0
- package/dist/types/react.d.ts +3 -0
- package/dist/types/types/common.d.ts +33 -0
- package/dist/types/types/global.d.ts +26 -0
- package/dist/types/types/inscription.d.ts +147 -0
- package/dist/types/types/vite-env.d.ts +7 -0
- package/dist/types/types/wallet.d.ts +50 -0
- package/dist/types/vue.d.ts +2 -0
- package/dist/vue.js +13 -0
- package/package.json +133 -0
package/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# ๐ Best in Slot โ Bitcoin Wallet Kit
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
A lightweight JavaScript library for connecting Bitcoin wallets with a unified API. Perfect for
|
|
6
|
+
Bitcoin-native dApps and web apps needing simple, multi-wallet support.
|
|
7
|
+
|
|
8
|
+
## ๐ Supported Wallets
|
|
9
|
+
|
|
10
|
+
- โ
OKX
|
|
11
|
+
- โ
Unisat
|
|
12
|
+
- โ
Xverse
|
|
13
|
+
- โ
Leather
|
|
14
|
+
|
|
15
|
+
## ๐ Documentation
|
|
16
|
+
|
|
17
|
+
Full guides and an API reference live in [`docs/`](./docs/README.md):
|
|
18
|
+
|
|
19
|
+
- [Getting started](./docs/getting-started.md)
|
|
20
|
+
- [Wallet connection](./docs/wallet-connection.md)
|
|
21
|
+
- [Inscriptions](./docs/inscriptions.md) ยท [BRC-2.0](./docs/brc20.md) ยท [Swap](./docs/swap.md) ยท
|
|
22
|
+
[Balances](./docs/balances.md)
|
|
23
|
+
- [Testing](./docs/testing.md)
|
|
24
|
+
|
|
25
|
+
The full **API reference** is published at
|
|
26
|
+
<https://bestinslot-xyz.github.io/bis-wallet-kit/> (regenerated from source on
|
|
27
|
+
every push to `main`). To build it locally, run `pnpm docs:api` (output in
|
|
28
|
+
`docs/api/`).
|
|
29
|
+
|
|
30
|
+
## ๐ฆ Entry points
|
|
31
|
+
|
|
32
|
+
| Import | Use it for |
|
|
33
|
+
| -------------------------------- | ---------------------------------------------------------------------- |
|
|
34
|
+
| `@bestinslot/wallet-kit` | Full browser build: extension wallets + connect modal (framework-free) |
|
|
35
|
+
| `@bestinslot/wallet-kit/browser` | Explicit alias of the default entry โ the full browser build |
|
|
36
|
+
| `@bestinslot/wallet-kit/core` | Browser features without the modal โ bring your own connect UI |
|
|
37
|
+
| `@bestinslot/wallet-kit/node` | Server build: local (WIF) wallet, no modal, no Vue |
|
|
38
|
+
| `@bestinslot/wallet-kit/react` | React hooks: `useNetwork`, `useWallet` |
|
|
39
|
+
| `@bestinslot/wallet-kit/vue` | Vue composable: `useNetwork` |
|
|
40
|
+
|
|
41
|
+
The connect modal no longer depends on Vue, so React and vanilla apps can call `modal.connect()`
|
|
42
|
+
without installing Vue.
|
|
43
|
+
|
|
44
|
+
## ๐ Development & Build
|
|
45
|
+
|
|
46
|
+
Built with Vite, Vue 3, TypeScript and Tailwind CSS 4.
|
|
47
|
+
|
|
48
|
+
- [Vite](https://vite.dev/)
|
|
49
|
+
- [Vue 3](https://vuejs.org/)
|
|
50
|
+
- [Tailwind CSS](https://tailwindcss.com/)
|
|
51
|
+
|
|
52
|
+
The template uses Vue 3 `<script setup>` SFCs, check out the
|
|
53
|
+
[script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Install dependencies
|
|
57
|
+
pnpm install
|
|
58
|
+
|
|
59
|
+
# Start development server
|
|
60
|
+
pnpm dev
|
|
61
|
+
|
|
62
|
+
# Build for production
|
|
63
|
+
pnpm build
|
|
64
|
+
|
|
65
|
+
# Preview production build
|
|
66
|
+
pnpm preview
|
|
67
|
+
|
|
68
|
+
# Publish
|
|
69
|
+
npm pack --dry-run
|
|
70
|
+
|
|
71
|
+
pnpm build
|
|
72
|
+
pnpm publish
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## ๐ Examples
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
import { modal, wallet } from '@bestinslot/wallet-kit'
|
|
79
|
+
|
|
80
|
+
// Connect wallet
|
|
81
|
+
try {
|
|
82
|
+
const data = await modal.connect()
|
|
83
|
+
|
|
84
|
+
console.warn('Connected to wallet: ', data)
|
|
85
|
+
}
|
|
86
|
+
catch (e) {
|
|
87
|
+
console.error('Connection failed: ', e)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Disconnect from the wallet and clear session
|
|
91
|
+
modal.disconnect()
|
|
92
|
+
|
|
93
|
+
// Get stored wallet data
|
|
94
|
+
const data = wallet.getSession()
|
|
95
|
+
|
|
96
|
+
// Get Payment wallet
|
|
97
|
+
const paymentWallet = wallet.getPaymentWallet()
|
|
98
|
+
console.warn(paymentWallet?.address)
|
|
99
|
+
|
|
100
|
+
// Get BTC network
|
|
101
|
+
const network = wallet.getNetwork()
|
|
102
|
+
|
|
103
|
+
// Set BTC network
|
|
104
|
+
wallet.setNetwork('testnet') // defaults to mainnet
|
|
105
|
+
|
|
106
|
+
// Theme - defaults to 'system'
|
|
107
|
+
modal.setTheme('dark') // system, dark, light
|
|
108
|
+
```
|