Keycat.js
1.0.0
1.0.0
  • Introduction
  • Getting Started
  • Configuration
  • Keycat
    • What is Keycat
    • How-To-Use
    • Playground
Powered by GitBook
On this page
  • installation
  • Basic Usage
  • Initialization
  • Request Sign-in
  • Sign and push transaction
  • Sign Arbitrary Data

Was this helpful?

Getting Started

installation

npm install keycatjs
yarn add keycatjs

Basic Usage

Initialization

import { Keycat } from 'keycatjs'

// Connect to eos main net
const keycat = new Keycat({
    blockchain: {
        name: 'eos',
        nodes: eosNodes,
    }
})

Request Sign-in

// e.g) This function is called when user clicks keycat signin button.
async function handleSignin() {
  try {
    const { accountName, permission, publicKey } = await keycat.signin()
  } catch (err) {
    ...
  }
}

Sign and push transaction

async function handleRequest() {
  // Use account info saved in cookie, localStorage or variable.
  try {
    await keycat
      .account('testaccount1')
      .transact({
        actions: [...]
      }, {
        blocksBehind: 3,
        expireSeconds: 30,
      })
  } catch (err) {

  }
}

Sign Arbitrary Data

async function sign() {
    try {
        await keycat
            .account('testaccount2')
            .signArbitraryData(['sign this', 'this too'])
    catch (err) {}
}
PreviousIntroductionNextConfiguration

Last updated 5 years ago

Was this helpful?