Understanding Aptos AIP-62 Standard
The AIP-62 protocol establishes Aptos' framework for secure wallet interactions. Major wallets like OKX now support this standard for seamless DApp connectivity.
Injected Provider API Explained
The OKX injected provider API enables direct communication between decentralized applications and users' wallets through a JavaScript interface. This powerful tool allows DApps to:
- Request account access
- Read blockchain data
- Facilitate transaction signing
- Verify message signatures
Establishing Wallet Connections
window.okxwallet.aptos.connect()
Implementation Guide
- Call the connect method to initiate wallet linking
- Users will see a connection prompt in their OKX Wallet interface
Upon approval, the system returns:
- Wallet address
- Public key
๐ See live wallet connection demo
Account Information Retrieval
window.okxwallet.aptos.account()
Key Features
- Returns current DApp session details
- Provides wallet address and public key
- Essential for personalized user experiences
Network Status Monitoring
window.okxwallet.aptos.network()
Functionality
- Identifies connected blockchain network
- Returns network name string
- Critical for cross-chain compatibility
Transaction Processing Methods
Sign & Submit Transactions
window.okxwallet.aptos.signAndSubmitTransaction(transaction)
Process Flow
- Construct transaction object
- User approves via wallet interface
- Returns transaction hash
Signature-Only Option
window.okxwallet.aptos.signTransaction(transaction)
Security Note: Use sparingly - this offline method doesn't broadcast transactions.
๐ Complete transaction signing tutorial
Message Signing Protocol
window.okxwallet.aptos.signMessage(message)
Returns Structured Data
- Original message
- Digital signature
- Full verification details
Event Handling System
Account Change Detection
onAccountChange(callback)
Trigger Conditions
- User switches wallet accounts
- New account contains Aptos address
Network Change Monitoring
onNetworkChange(callback)
Best Practices
- Always verify target network
- Update UI accordingly
- Handle errors gracefully
FAQ Section
What makes AIP-62 different from other standards?
AIP-62 specifically optimizes for Aptos blockchain features while maintaining compatibility with existing wallet infrastructure.
How often should I check network status?
We recommend verifying network status:
- On initial connection
- After long idle periods
- Following wallet events
Are message signatures reversible?
No, signed messages provide cryptographic proof but don't expose private keys.
What happens if a user rejects a transaction?
The promise rejects with a user-denied error that your DApp should handle gracefully.
Can I use these methods with other Aptos wallets?
While standardized, implementation details may vary slightly between wallet providers.
How do I handle network switches?
Always:
- Notify users of required network
- Provide easy switching options
- Reload DApp state after changes