# BitcoinKit

The easiest way to connect a bitcoin wallet BitcoinKit is a React library that
makes it fast and easy to connect your dapp with bitcoin network

# Installation

```
npm install test-bitcoinkit-test
# or
pnpm install test-bitcoinkit-test
# or
yarn add test-bitcoinkit-test
#or
bun install test-bitcoinkit-test
```

# Import

### App

```
// "use client" if you are using next.js
import React from "react"
import { BitcoinKitProvider } from "test-bitcoinkit-test"
import "test-bitcoinkit-test/dist/index.css"

export default function App() {
return (
	<BitcoinKitProvider>
		<YourApp />
	</BitcoinKitProvider>
	)
}
```

#### Wallet Options
Available wallets: {ordinalSafe, unisat, xverse, other} from "test-bitcoinkit-test"
```
BitcoinKitProvider({ children, options }: {
    children: React.ReactNode;
    options?: {
        wallets?: Wallet[];
    };
}):
```



### ConnectButton

```
// "use client" if you are using next.js
import { ConnectButton } from "test-bitcoinkit-test"

export default function YourApp() {
	return <ConnectButton />
}
```

### useBitcoinKit Hook

```
useBitcoinKit(): {
	account: Account;
	signBip322: (message: string) =>  Promise<string>;
	verifyBip322: (message: string, signature: string, address: string) => Promise<boolean>;
	authenticateWithBip322: (message: string) => Promise<boolean>;
	authenticateWithGivenSignature: (message: string, signature: string, address: string) => Promise<boolean>;
};
```

#### Account type
```
type  Account = {
	connected: boolean;
	address: string | null;
	balance: number;
	network: "livenet" | "testnet" | null;
	authenticated: boolean;
};
```
