@klayfee/js

Provides JS client for Klayfee.com, a fee delegation service for Klaytn blockchain.

Usage no npm install needed!

<script type="module">
  import klayfeeJs from 'https://cdn.skypack.dev/@klayfee/js';
</script>

README

@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