@klayfee/js

1.0.1 • Public • Published

@klayfee/js Build Status npm

This package is an official CommonJS / Node.js module for a fee delegation service for Klaytnnetwork, Klayfee. Please note that this is the first public preview, API might change in future.

Other packages

Installation

First, get the package:

$ npm install --save @klayfee/js

or

$ yarn add @klayfee/js

Usage

var Klayfee = require('@klayfee/js')

// baobabClient initilizes a client for Baobab testnet,
// when using ClientCypress please provide real API key.
var baobabClient = new Klayfee.ClientBaobab({
    apiKey: 'any'
});

// sign a desired transaction with private key of sender, using Caver.js
let { rawTransaction } = await caver.klay.accounts.signTransaction({
    type: 'FEE_DELEGATED_VALUE_TRANSFER',
    from: senderAddress,
    to: toAddress,
    gas: '300000',
    value: caver.utils.toPeb('0.00001', 'KLAY'),
}, senderPrivateKey)

// finally, submit the transaction to fee delegation service using the client
var result = await baobabClient.sendRawTx(rawTransaction)
console.log(result)

License

MIT

Package Sidebar

Install

npm i @klayfee/js

Homepage

klayfee.com

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

9.41 kB

Total Files

6

Last publish

Collaborators

  • xlab_is