caverkit
v0.1.2
Published
Simple to use klaytn network Caver.js SDK
Downloads
1
Readme
CaverKit
🛠️ Install
npm install caverkit
💡 Usage
import CaverKit from 'CaverKit';
const cav = new CaverKit(chainId, address, privateKey, ABI, ContractAddress);
Keyring
import CaverKit from 'CaverKit';
const ABI = require(`@/ABI/abi.json`);
const cav = new CaverKit(
'chainId', // main: 8217 // test: 1001
'address',
'privateKey',
ABI,
'ContractAddress',
);
console.log(cav.Keyring);
Transaction
Call Transaction
const callMethod = 'balanceOf';
const params2 = ['balanceOf address : 0x12...'];
const callResult2 = await cav.callContract(callMethod, params);
Send Transaction
const to = 'toAddress: 0x12...';
const sendMethod = 'mint';
const toPebAmount = await cav.utils.toPeb(1);
const params = [to, toPebAmount];
const sendResult = await cav.sendContract(sendMethod, params);
Utils
Convert To Peb
const toPebNumTest = await cav.utils.toPeb(1);
Get Wallet Information
const address = '0x....';
const account = await cav.utils.getAccount(address);
Check The Amount Of Klay In Wallet
const address = '0x....';
const balance = await cav.utils.getBalance(address);
Get Current BlockNumber
const blockNumber = await cav.utils.getBlockNumber();
Get TransactionReceipt
const Tx = '0x....';
const receipt = await cav.utils.getTransactionReceipt(Tx);