Walkthrough
Start Here
After a web app connects to UKey Wallet BTC Provider, it can request authorization for the user's BTC account and then use account reading, transfer, and message-signing capabilities.
Setup
1. Install UKey Wallet
Install the UKey Wallet browser extension and confirm that the wallet has been initialized.
2. API injection instructions
- The UKey Wallet browser extension injects the BTC Provider into the page.
- Available portals include
window.$ukey.btcand compatible portalwindow.unisat. - New projects should prioritize
window.$ukey.btc.
The capabilities of the two entrances are the same, and the differences are mainly in naming and compatibility purposes.
Detect Provider API support
Before calling the account or signature method, first check whether the Provider exists in the current browser environment:
const provider = (window.$ukey && window.$ukey.btc) || window.unisat;
if (!provider) {
alert("UKey Wallet is not installed.");
}
Connect to UKey Wallet
Before using other BTC APIs, please call provider.requestAccounts to request user authorization for account access.
provider.requestAccounts()
After the user confirms, the application can continue to read the account or initiate a signature or payment request.
API
Select the corresponding interface according to business goals:
Events
- Key events: account switching, network changes.
- More information: View more