Getting Started

Connect to Cosmos chains using OneKey's Keplr-compatible provider

Learn how to detect, connect, and interact with Cosmos chains using OneKey's provider.


Provider Detection

// Detect OneKey Cosmos provider
const provider = window.$onekey?.cosmos

if (!provider) {
  throw new Error('OneKey Cosmos provider not detected')
}

// Check if it's OneKey
console.log('Provider:', provider.isOneKey ? 'OneKey' : 'Unknown')

Connect to Chain

const chainId = 'cosmoshub-4'

// Enable the chain - returns key info
const key = await provider.enable(chainId)

// Or enable multiple chains at once
await provider.enable(['cosmoshub-4', 'osmosis-1', 'juno-1'])

Get Account Info


Add Custom Chain

Use experimentalSuggestChain to add chains not natively supported:


Disconnect


Using with CosmJS

Get offline signers for use with CosmJS:


Migration from Keplr

OneKey's Cosmos provider is Keplr-compatible. Simply change your provider detection:

Last updated

Was this helpful?