What is Injected Provider API?
The Injected Providers API is a JavaScript interface injected by wallets like OKX into websites users visit. This API enables decentralized applications (DApps) to:
- Request user accounts
- Read blockchain data
- Facilitate message and transaction signing
👉 Learn more about Web3 wallet integration
Key Compatibility Notes
OKX Wallet's WAX API maintains full compatibility with the Scatter Protocol. Developers should reference Scatter's official documentation for implementation details.
Establishing Wallet Connections
Connecting and Retrieving Account Information
import ScatterJS from '@scatterjs/core';
import ScatterEOS from '@scatterjs/eosjs2';
ScatterJS.plugins(new ScatterEOS());
ScatterJS.login().then(identity => {
const account = identity.accounts[0]
console.log(account)
})Verifying Connection Status
const isConnected = ScatterJS.isConnected()
console.log(isConnected)Retrieving Wallet Information
Returns null if no wallet connection exists:
if (isConnected) {
const identity = ScatterJS.account()
const account = identity.accounts[0]
console.log(account)
}Transaction Processing
Signing Transactions
Requires the eosjs library:
import {JsonRpc, Api} from 'eosjs';
const network = ScatterJS.Network.fromJson({
blockchain:'wax',
chainId:'1064487b3cd1a897ce03ae5b6a865651747e2e152090f99c1d19d44e01aea5a4',
host:'nodes.get-scatter.com',
port:443,
protocol:'https'
});
const rpc = new JsonRpc(network.fullhost());
const eos = ScatterJS.eos(network, Api, {rpc});
eos.transact({
actions: []
}).then(res => {
console.log('sent: ', res);
}).catch(err => {
console.error('error: ', err);
});👉 Explore advanced transaction methods
Event Management
Supported Events
| Event Type | Description |
|---|---|
connect | Wallet connection established |
accountChanged | User switched accounts |
disconnect | User terminated connection |
Event Listener Examples
const connectHandler = () => {}
ScatterJS.on('connect', connectHandler)
ScatterJS.off('connect', connectHandler)Core Features Summary
- Seamless wallet integration
- Secure transaction signing
- Real-time event monitoring
- Full Scatter protocol compatibility
Frequently Asked Questions
What browsers support this API?
The API works with all major browsers that support wallet extensions, including Chrome, Firefox, and Edge.
How secure is transaction signing?
All signing occurs within the wallet's secure environment, never exposing private keys to web applications.
Can I use this with mobile wallets?
Yes, when users access your DApp through their mobile browser with the wallet extension installed.
What happens if the user disconnects?
Your application will receive a disconnect event and should handle this state appropriately in your UI.
Is there rate limiting?
No artificial limits exist, but normal blockchain network constraints apply.
How do I handle network changes?
Subscribe to network change events and update your interface accordingly when users switch chains.