Aptos

Aptos integration via OneKey's Petra-compatible provider

Integrate Aptos blockchain using OneKey's Petra-compatible provider. Access via window.$onekey.aptos.

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')

Quick Start

Connect Wallet

Check Connection Status

Disconnect


Account Management

Get Current Account

Get Network Info

Listen for Account Changes

Listen for Network Changes


Transactions

Sign and Submit Transaction

Sign Transaction (Without Submitting)

Sign Transaction V2 (BCS Serialized)

For advanced use cases with BCS-serialized transactions:

Transaction Options


Message Signing

Sign Message

Sign arbitrary messages for authentication or verification:

Verify Message (Off-chain)


Smart Contract Interaction

Call View Function

Call Entry Function


API Reference

Methods

Method
Description

connect()

Connect wallet and get account

disconnect()

Disconnect wallet

isConnected()

Check connection status

account()

Get current account info

network()

Get current network info

signMessage(request)

Sign arbitrary message

signAndSubmitTransaction(payload, options?)

Sign and submit transaction

signTransaction(payload, options?)

Sign transaction without submitting

signTransactionV2(rawTransaction)

Sign BCS-serialized transaction

onAccountChange(callback)

Listen for account changes

onNetworkChange(callback)

Listen for network changes

Types

Supported Networks

Network
Description

Mainnet

Production network

Testnet

Testing environment

Devnet

Development environment


Error Handling

Common Error Codes

Code
Description

4001

User rejected request

4100

Unauthorized

4200

Unsupported method

4201

Unsupported network

-32603

Internal error


Using with Aptos Wallet Adapter

For React applications, use the official Aptos Wallet Adapter:

OneKey is automatically detected by the Aptos Wallet Adapter.


Migration from Petra

OneKey's Aptos provider is Petra-compatible. Update your provider detection:

Last updated

Was this helpful?