Provider API
Z3US wallet extension injects a global API into websites visited by its users at window.z3us
. This API allows users to interact with wallet and Radix DLT.
Versioning
API is versioned using Semantic Versioning. We will support up to 2 most recent versions to ensure users have time to update when breaking changes are introduced.
declare global {
interface Window {
z3us: {
v1: { ... }
}
}
}
declare global {
interface Window {
z3us: {
v1: { ... }
}
}
}
Events
You can listen to following events:
- init event - dispatched when
z3us
Provider API is added towindow
object
window.addEventListener('z3us.init', console.log, false)
CustomEvent {detail: { v1: { ... } }, type: 'z3us.init', …}
window.addEventListener('z3us.init', console.log, false)
CustomEvent {detail: { v1: { ... } }, type: 'z3us.init', …}
- keystore change - this event will be dispatched if user has multiple wallets when switched between them
window.addEventListener('z3us.keysotre.change', console.log, false)
CustomEvent {detail: {keystoreId: 'id-111111111111'}, type: 'z3us.keysotre.change', …}
window.addEventListener('z3us.keysotre.change', console.log, false)
CustomEvent {detail: {keystoreId: 'id-111111111111'}, type: 'z3us.keysotre.change', …}
- account change - when currently selected account changes
window.addEventListener('z3us.account.change', console.log, false)
CustomEvent {detail: {address: 'rdx...'}, type: 'z3us.account.change', …}
window.addEventListener('z3us.account.change', console.log, false)
CustomEvent {detail: {address: 'rdx...'}, type: 'z3us.account.change', …}
- network change - when selected network (Gateway API) changes
window.addEventListener('z3us.network.change', console.log, false)
CustomEvent {detail: {network: {id: 'mainnet', url: 'https://....'}}, type: 'z3us.network.change', …}
window.addEventListener('z3us.network.change', console.log, false)
CustomEvent {detail: {network: {id: 'mainnet', url: 'https://....'}}, type: 'z3us.network.change', …}