Skip to main content

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

Handle Errors

CodeMessageDetails
4001User rejected the requestUser rejected the request
-32602Parameters failed validationAction payload is malformed
-32603Provider internal failureJSON-RPC layer internal failure