NEAR
UKey Wallet NEAR Provider is used to connect NEAR accounts, read network status, sign transactions and sign messages in DApps. It is designed for common wallet interfaces of existing NEAR applications, making it easy to access UKey Wallet in a browser environment.
Features
- Connect and manage your NEAR account.
- Initiate transaction signing and sending.
- Request the user to sign off-chain messages.
- Read or switch network status such as mainnet/testnet.
- Access wallet capabilities via RPC style methods.
Setup
npm install @ukeyfe/ukey-near-provider
# alternatively
yarn add @ukeyfe/ukey-near-provider
Get Going
import { UKeyNearProvider } from "@ukeyfe/ukey-near-provider";
// Note: Create provider instance
const provider = new UKeyNearProvider();
// Note: Request account access
const accounts = await provider.request({ method: "near_accounts" });
console.log("Authorized account:", accounts);
// Retrieve current network
const network = await provider.request({ method: "near_network" });
console.log("Current selected network:", network);
document
getting Started
- introduce - Positioning and usage scenarios of NEAR Provider.
Integration Notes
Transactions and signatures
advanced
More Reading
- API reference - Methods, inputs and return values.
Handle Errors
| Code | Message | Details |
|---|---|---|
| 4001 | User rejected the request | User rejected the request |
| -32602 | Parameters failed validation | Action payload is malformed |
| -32603 | Provider internal failure | JSON-RPC layer internal failure |