Demos Wallet Provider API
Provider Interface
The injected provider exposes a small surface:provider.request({ method, params? }): Generic RPC-style method. Preferred for all interactions.provider.accounts() → Promise<{ code: 404|401|200, data: string|null }>: Returns account status/address, used primarily for discovery gating.
Supported Methods
See all supported methods here: wallet-provider-api-methods.mdUsage Examples
Connect and get xM addresses:TwitterProof):
Error Semantics
Common error codes surfaced inresponse.error.code:
TIMEOUT: popup not resolved before timeoutPOPUP_ERROR: could not open popup...Cancelled: user closed popup (validationCancelled,addTwitterIdentityCancelled, etc.)- Method-specific errors (e.g.,
addGithubIdentityError,sendTransactionError) includedetailswhen available
Notes
- The extension only announces the provider after
provider.accounts()indicates a non-404 status. - Always prefer
provider.requestwith the methods above for forward-compatibility.