NEAR
Integrate NEAR Protocol into your dApp using OneKey’s NEAR provider. OneKey provides a fully compatible NEAR wallet interface that works seamlessly with existing NEAR dApps.
Features
- Account connection and management
- Transaction signing and sending
- Message signing
- Network switching (mainnet/testnet)
- Full RPC API support
Installation
npm install @onekeyfe/onekey-near-provider
# or
yarn add @onekeyfe/onekey-near-providerQuick Start
import { OneKeyNearProvider } from '@onekeyfe/onekey-near-provider'
// Create provider instance
const provider = new OneKeyNearProvider()
// Request account access
const accounts = await provider.request({ method: 'near_accounts' })
console.log('Connected accounts:', accounts)
// Get current network
const network = await provider.request({ method: 'near_network' })
console.log('Current network:', network)Documentation
Getting Started
- Introduction - Overview of the NEAR provider
- Install the Provider SDK - Setup instructions
Integration Guides
- Detecting the Provider - Check if OneKey is installed
- Establishing a Connection - Connect to user accounts
- Accessing Accounts - Get account information
- Detecting Provider Network - Check current network
- Watch Accounts & Network Status - Subscribe to changes
Transactions & Signing
- Sending Transactions - Create and send transactions
- Signing Messages - Sign arbitrary messages
- RPC API Calling - Direct RPC access
Advanced
- Debug Logging - Enable debug mode
- Migrate from NEAR Web Wallet - Migration guide
Reference
- API Reference - Complete API documentation
- Troubleshooting - Common issues and solutions
- Examples & Demo - Sample code
- FAQ - Frequently asked questions
Error Handling
| Code | Message | Description |
|---|---|---|
| 4001 | User Rejected | User denied the request |
| -32602 | Invalid Params | Method parameters are invalid |
| -32603 | Internal Error | Internal JSON-RPC error |
Related Resources
Last updated on