JSPM

  • Created
  • Published
  • Downloads 519
  • Score
    100M100P100Q116871F
  • License GPL-3.0

Main entry point to the Zilliqa JS client.

Package Exports

  • @zilliqa-js/zilliqa
  • @zilliqa-js/zilliqa/dist/cjs/src/index.js
  • @zilliqa-js/zilliqa/dist/esm/bundle.js
  • @zilliqa-js/zilliqa/dist/umd/bundle.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@zilliqa-js/zilliqa) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@zilliqa-js/zilliqa

JavaScript library for interacting with the Zilliqa blockchain.

Table of Contents

Installation

npm install @zilliqa-js/zilliqa --save

or

yarn add @zilliqa-js/zilliqa

Usage

First, you need to import the library:

const { Zilliqa } = require("@zilliqa-js/zilliqa");

or using ES6 imports:

import { Zilliqa } from "@zilliqa-js/zilliqa";

Then, create an instance:

const zilliqa = new Zilliqa("https://api.zilliqa.com");

Examples

Sending a Transaction

const myAddress = "Your Zilliqa Address";
const recipient = "Recipient Zilliqa Address";
const amount = Zilliqa.utils.units.toQa("1", Zilliqa.utils.units.Units.Zil);

const tx = await zilliqa.blockchain.createTransaction({
  toAddr: recipient,
  amount: amount,
  gasPrice: "2000",
  gasLimit: "1",
});

console.log(`Transaction ID: ${tx.id}`);
console.log(
  `After sending, your new balance is: ${await zilliqa.blockchain.getBalance(
    myAddress
  )}`
);

Fetching Account Balance

const myAddress = "Your Zilliqa Address";
const balance = await zilliqa.blockchain.getBalance(myAddress);
console.log(`Your balance is: ${balance}`);

Documentation

For in-depth documentation, please refer to Zilliqa Official Documentation.

License

This project is licensed under the GPL License. See LICENSE for details.