Skip to main content

Getting Started


Install library as npm module:

npm install @onekeyhq/connect


yarn add @onekeyhq/connect



import OneKeyConnect from '@onekeyhq/connect';


var OneKeyConnect = require('@onekeyhq/connect').default;

API methods#

Handling events#

Running local version (develop/stable)#

  • clone repository: git clone
  • install node_modules: yarn
  • run localhost server: yarn dev

Initialize in project

OneKeyConnect.init({    connectSrc: 'https://localhost:8088/',    lazyLoad: true, // this param will prevent iframe injection until OneKeyConnect.method will be called    manifest: {        email: '',        appUrl: '',    }})

Running local version (custom branch)#

In order to run a branch which isn't published to npm registry and this branch requires changes (mostly happened when new a method is added to OneKeyConnect interface)

  • git checkout custom-feature-branch
  • yarn build:npm

Install builded lib in your project:

Using yarn link#

  • cd ./npm && yarn link
  • Inside your project: yarn install @onekeyhq/connect

Using local files#

  • Inside your project: yarn install @onekeyhq/connect@file:/[local-path-to-repository]/npm