Cosmos
Cosmos integration via OneKey's Keplr-compatible provider
Integrate Cosmos ecosystem chains using OneKey's Keplr-compatible provider. Access via window.$onekey.cosmos.
OneKey's Cosmos provider is fully compatible with the Keplr wallet interface, making migration seamless.
Quick Links
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')Quick Start
Connect to Chain
Get Account Info
Chain Management
Add Custom Chain
Use experimentalSuggestChain to add chains not natively supported:
Disconnect
Signing Messages
Sign Amino (Legacy)
For legacy Amino-encoded transactions:
Sign Direct (Protobuf)
For modern Protobuf-encoded transactions:
Sign Arbitrary Data
For signing arbitrary messages (useful for authentication):
Sending Transactions
Broadcast Transaction
Offline Signers
Get offline signers for use with CosmJS:
API Reference
Methods
enable(chainIds)
Enable chain(s) and get key info
disable(chainIds)
Disable chain(s)
disconnect()
Disconnect from all chains
getKey(chainId)
Get account key for chain
signAmino(chainId, signer, signDoc)
Sign Amino-encoded transaction
signDirect(chainId, signer, signDoc)
Sign Protobuf-encoded transaction
sendTx(chainId, tx, mode)
Broadcast signed transaction
signArbitrary(chainId, signer, data)
Sign arbitrary message
verifyArbitrary(chainId, signer, data, signature)
Verify signature
experimentalSuggestChain(chainInfo)
Add custom chain
getOfflineSigner(chainId)
Get Direct offline signer
getOfflineSignerOnlyAmino(chainId)
Get Amino-only offline signer
getOfflineSignerAuto(chainId)
Auto-detect best signer type
Key Interface
Supported Chains
Cosmos Hub
cosmoshub-4
Yes
Osmosis
osmosis-1
Yes
Juno
juno-1
Yes
Stargaze
stargaze-1
Yes
Akash
akashnet-2
Yes
Secret Network
secret-4
Yes
Custom
Any
Via experimentalSuggestChain
Error Handling
Migration from Keplr
OneKey's Cosmos provider is Keplr-compatible. Simply change your provider detection:
Last updated
Was this helpful?