Getting Started
Connect to Aptos using OneKey's Petra-compatible provider
Learn how to detect, connect, and interact with Aptos using OneKey's provider.
OneKey's Aptos provider is fully compatible with the Petra wallet interface and Aptos Wallet Standard.
Provider Detection
// Detect OneKey Aptos provider
const provider = window.$onekey?.aptos
if (!provider) {
throw new Error('OneKey Aptos provider not detected')
}
// Check provider info
console.log('Provider:', provider.isOneKey ? 'OneKey' : 'Unknown')Connect Wallet
// Connect and get account info
const response = await provider.connect()
console.log({
address: response.address, // Account address
publicKey: response.publicKey, // Public key
})Check Connection Status
Get Current Account
Get Network Info
Disconnect
Event Listeners
Listen for Account Changes
Listen for Network Changes
Migration from Petra
OneKey's Aptos provider is Petra-compatible. Update your provider detection:
Using with Aptos Wallet Adapter
For React applications, use the official Aptos Wallet Adapter:
OneKey is automatically detected by the Aptos Wallet Adapter.
Last updated
Was this helpful?