Javascript library to interact with Kardia Chain.
npm install kardia-js-sdk
yarn add kardia-js-sdk
npm install https://github.com/kardiachain/kardia-js-sdk
var KardiaClient = require('kardia-js-sdk').default;
var kardiaClient = new KardiaClient('http://<host>:port');
// transaction module
var transaction = kardiaClient.transaction;
// account module
var account = kardiaClient.account;
// Kardia chain module
var account = kardiaClient.account;
// Kardia SMC module
var contract = kardiaClient.contract;
import KardiaClient from 'kardia-js-sdk';
const kardiaClient = new KardiaClient({ endpoint: 'http://<host>:port' });
// transaction module
const transaction = kardiaClient.transaction;
// account module
const account = kardiaClient.account;
// Kardia chain module
const account = kardiaClient.account;
// Kardia SMC module
const contract = kardiaClient.contract;
import KardiaClient from 'kardia-js-sdk';
const kardiaClient = new KardiaClient({ endpoint: 'http://<host>:port' });
const latestBalance = await kardiaClient.account.getBalance(ADDRESS);
const balanceAtHeight = await kardiaClient.account.getBalance(ADDRESS, {blockHeight: 1});
const balanceAtHash = await kardiaClient.account.getBalance(ADDRESS, {blockHash: BLOCK_HASH});
import KardiaClient from 'kardia-js-sdk';
const kardiaClient = new KardiaClient({ endpoint: 'http://<host>:port' });
const nonce = await kardiaClient.account.getNonce(ADDRESS);
const txData = {
receiver: RECEIVING_ADDRESS,
nonce,
gas: 29000, // Minumum Gas Price = 29000, Max Gas Price Max = 20000000
gasPrice: 1*10**9, // Minimum Gas Price = 1OXY
amount: '1000000000000000000' // Value in HYDRO (1 KAI = 1*10^18 HYDRO = 1*10^9 OXY)
};
const txHash = await kardiaClient.transaction.sendTransaction(
txData,
PRIVATE_KEY,
);
- Source at
src
folder
- This project is using jest framework
- Run test:
npm run test
if you have a local node running ornpm run test-public
to test with public dev node
- Run
npm run build
to build - CJS, ESModules, and UMD module formats are supported.
- Make sure pass all test case
npm run build
to create es5 version to support node and older browser. For more detail check here- Pump version by npm version https://docs.npmjs.com/cli/version
- Create pull request and wait for review and chain ready.
- Syntax: https://docs.npmjs.com/cli/version
- Rule:
Prerelease
: Development versionPatch
: Improvement, bug fixing, P2, P3 featuresMinor
: alpha testnet version (version 1), beta testnet version (version 2)Major
: Launch main net or big refactor.