Install the Provider SDK
Install the OneKey browser extension before using the SDK.
We provide an SDK named onekey-near-provider as an npm package, which also requires near-api-js installed.
You can check the sdk source code at GitHub , with full example code here .
# with npm
npm install near-api-js@^0.44.2 @onekeyfe/onekey-near-provider
# with yarn
yarn add near-api-js@^0.44.2 @onekeyfe/onekey-near-provider
The provider source declares near-api-js ^0.44.2 as a peer dependency. These examples use that legacy API; installing an unrelated major version can break the integration. Check the peer dependencies of the provider version you install.
Create the provider in browser code.
import { OneKeyNearProvider } from '@onekeyfe/onekey-near-provider';
const provider = new OneKeyNearProvider();
Caution: The Provider SDK is not compatible with SSR.
If you are using next.js including SSR feature, you can check this document about how to dynamic import with no ssr .
Last updated on