ckBTC Wallet
A specialized wallet interface for ckBTC (Chain Key Bitcoin). This example demonstrates how to build a finance-ready dApp that interacts with the ckBTC ledger and minter canisters.
Features Demonstrated
Section titled “Features Demonstrated”- ICRC-1 Standard: Interacting with the standard token interface (balance, transfer).
- ckBTC Specifics: Retrieving BTC addresses and updating balances.
- Complex Flows: Managing deposit/withdraw cycles.
- Floating Point Math: Handling token decimals correctly in the UI.
Open in StackBlitz Edit and run in your browser
View on GitHub Browse the source code
Live Preview
Section titled “Live Preview”Key Design Patterns
Section titled “Key Design Patterns”Domain Specific Hooks
Section titled “Domain Specific Hooks”Instead of generic queries, this example wraps them in domain-specific hooks for cleaner code:
export const { useActorQuery: useCkbtcLedgerQuery } = createActorHooks(ckbtcLedger)export const { useActorMutation: useMinterMutation } = createActorHooks(minter)
// App.tsxconst { data: balance } = useCkbtcLedgerQuery({ functionName: "icrc1_balance_of", args: [{ owner: userPrincipal, subaccount: [] }], refetchInterval: 5000, // Poll for balance updates})