@klayfee/js
v1.0.1
Published
Provides JS client for Klayfee.com, a fee delegation service for Klaytn blockchain.
Downloads
3
Maintainers
Readme
@klayfee/js
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