useZky Hook
The useZky hook is a utility provided by the Zky Toolkit that allows you to easily access information about the connected wallet, including addresses, connection status, and balances (both Bitcoin and
1. Overview
The useZky
hook provides the following details:
Addresses: Includes Bitcoin, Ordinals and EVM addresses.
Connection: Indicates whether a wallet is connected and provides details about the current blockchain network.
Balance: Includes the Bitcoin balance and EVM balance on the connected network.
Public Keys: Includes Bitcoin, Ordinals and EVM public keys.
2. Installation
Ensure that you have Zky Toolkit installed as outlined in the Quickstart section above.
3. Example Usage
Here's an example of how to use the useZky
hook in your components:
4. useZky
Hook API
The useZky
hook returns an object containing:
addresses:
WalletAddresses
btcAddress
: Bitcoin address asstring
ornull
.ordinalsAddress
: Bitcoin Ordinals address asstring
ornull
.evmAddress
: EVM address asstring
ornull
.
connection:
WalletConnection
isConnected
:boolean
indicating if a wallet is connected.chain
: Containsid
,name
, andnativeCurrency
.
balance:
WalletBalance
btcBalance
:number
representing the Bitcoin balance in satoshis.evmBalance
: Object withchainName
andbalance
as abigint
.
publicKeys:
PublicKeys
btcPublicKey
: Bitcoin public key asstring
ornull
.ordinalsPublicKey
: Bitcoin Ordinals public key asstring
ornull
.evmPublicKey
: EVM public key asstring
ornull
.
With this setup, you can quickly access and display wallet information within your application using the useZky
hook.
Last updated