npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gxclient

v3.0.2

Published

A client to interact with gxchain via http

Downloads

119

Readme

GXClient

GXClient is a wrapped toolkit of gxbjs, a client to interact with gxchain apis.

You can get more info on docs.

Install

npm install gxclient --save

For react-native, the following extra command should be executed before using gxclient:

npm i --save react-native-randombytes
npm i --save-dev rn-nodeify@latest
./node_modules/.bin/rn-nodeify --hack --install

Usage(CLI)

$ npm install gxclient -g
$ gxclient -h
Usage: gxclient [cmd]

Options:
  -V, --version                                                                              output the version number
  -v --version                                                                               print gxclient version
  -h, --help                                                                                 output usage information

Commands:
  list|ls                                                                                    List all apis
  generate_key                                                                               Generate gxchain key pairs
  private_to_public <private_key>                                                            Export public key from private key
  is_valid_private <private_key>                                                             Check if private key is valid
  is_valid_public <public_key>                                                               Check if public key is valid
  register [options] <account_name> <public_key>                                             Register gxchain account
  get_account [options] <account_name>                                                       Get account information by account_name
  get_account_by_public_key [options] <public_key>                                           Get account information by account_name
  get_object [options] <object_id>                                                           Get object by object_id
  get_account_balances|get_account_balance [options] <account_name>                          Get account balances by account_name
  get_asset [options] <symbol>                                                               Get asset info by asset symbol
  get_block [options] <block_height>                                                         Get block by block height
  transfer [options] <to> <memo> <amount_asset> [boradcast]                                  Send a transfer transaction
  vote [options] <account_ids> [overwrite] [fee_asset_id] [boradcast]                        Vote for TrustNodes
  call_contract [options] <contract_name> <method_name> <params> [amount_asset] [boradcast]  Call smart contract method
  get_contract_tables [options] <contract_name>                                              Get contract table by contract_name
  get_contract_abi [options] <contract_name>                                                 Get contract abi by contract_name
  get_table_objects [options] <contract_name> <table_name> [start] [limit]                   Get table records by contract_name and table_name
  broadcast [options] <tx>                                                                   broadcast transaction
  get_chain_id [options]                                                                     get_chain_id

Usage(Client)

import GXClientFactory from "gxclient";

const private_key = "5Ka9YjFQtfUUX2Ddnqka...";
const account_name = "gxcaccount";
const asset_precicion = 5;

let client = GXClientFactory.instance({keyProvider:private_key, account:account_name,network:"wss://testnet.gxchain.org"});

// set broadcast to false so we could calculate the fee before broadcasting
let broadcast = true;

//Sending 15GXS to gxb456 with memo "GXChain NB"
client.transfer("gxb456", "GXChain NB", "15 GXC", broadcast).then(resp => {
    let transaction = broadcast ? resp[0].trx : resp;
    let txid = broadcast ? resp[0].id : "";
    console.log(JSON.stringify(transaction));
    console.log("txid:", txid, "fee:", transaction.operations[0].fee.amount / Math.pow(10, asset_precicion));
    // > txid: f28d27ac74649a76f58c9b84fb7ea700163e31c4 fee: 0.0118
    // Since gxchain implemented dpos consensus, the transaction will be confirmed until the block becomes irreversible
    // You can find the logic when a transfer operation was confirmed in the example of detectTransaction
}).catch(ex => {
    console.error(ex);
});

APIs

API documents

Other

  • It's very welcome for developers to translate this project into different programing languages
  • We are looking forward to your pull requests