Bitcoin Dapp Integration
Last updated
Last updated
This API is designed for DApps opened within the Tokeo wallet browser. When users navigate to your site from the in-app browser, window.tokeo
is automatically injected to allow seamless interaction.
If youโre building a mobile DApp or want to integrate outside of the Tokeo browser, our wallet also supports deep linking. You can find details .
DApps can use window.tokeo
to:
Request access to user accounts
Sign messages
Sign transactions
All responses are returned directly, and methods are either synchronous or return Promises depending on the implementation.
window.tokeo.requestAccounts(): Promise<string[]>
Returns a list of addresses the DApp is authorized to use.
Example Response:
window.tokeo.getAccounts(): string[]
Returns the same list as requestAccounts()
but without the user prompt (if already enabled).
window.tokeo.signMessage(message: string, type: 'ecdsa' | 'bip322'): Promise<string>
Signs an arbitrary message using the selected Bitcoin key.
Parameters:
message
: string โ the message to sign
type
: 'ecdsa'
or 'bip322'
(default is 'ecdsa'
)
Returns: signature string
window.tokeo.signPsbt(psbt: string, autoFinalize?: boolean): Promise<string>
Signs a PSBT transaction.
Parameters:
psbt
: base64-encoded PSBT string
autoFinalize
: boolean (default: true)
Returns: base64-encoded signed PSBT
Wallet prompts users once per session for requestAccounts()
.
After that, other read methods (like getAccounts
) donโt prompt again unless session is reset.
Errors are thrown as JavaScript exceptions.
You can catch them with:
No base64-encoded data
parameter is required.
If youโre building a mobile DApp or want to integrate outside of the browser context, our wallet also supports deep linking. You can find details .