xdc-helpers

0.0.7 • Public • Published

XDC-Helpers

XDC-Helpers is a robust Node.js SDK designed to facilitate interactions with the validator、liteCSC and fullCSC contracts on the chain. With a streamlined setup process and easy-to-use functionalities, it simplifies the process of requesting the validator on the chain. Here's a quick guide to get you started:

Installation

Install the package using npm with the following command:

npm install xdc-helpers

Quick Start

Get started swiftly with a few simple steps. First, import the necessary modules and set up your client. Next, begin consuming actions as demonstrated below:

// Step 1: Import the necessary modules.
import { ValidatorClient } from "xdc-helpers";

// Step 2: Set up your client with the default configurations.
const validator = new ValidatorClient();

// Step 3: Begin consuming actions. Here's how to get the candidates:
const candidates = await validator.getCandidates();

The configurations are set to default values initially. To view or modify them, click here.

Customization

Customize your setup by configuring various parameters such as RPC URL, chain ID, ABI, contract address, and your wallet's private key. Here's a template to help you set up a custom configuration:

import { ValidatorClient } from "xdc-helpers";

const config = {
  rpcUrl: "https://....", // Specify the RPC URL of the chain
  chainId: 0, // Indicate the chain ID of the chain
  contractAddress: "0x....", // Provide the contract address of the client
  privateKey: "0x.....", // Enter the private key of your wallet
};

const validator = new ValidatorClient({ ...config });

Feel free to modify the config object with your values to tailor the setup to your needs.

Readme

Keywords

none

Package Sidebar

Install

npm i xdc-helpers

Weekly Downloads

7

Version

0.0.7

License

MIT

Unpacked Size

41.3 kB

Total Files

17

Last publish

Collaborators

  • galaxyscitech