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

@makkii/app-aion

v0.1.2

Published

Aion application client implemented makkii-core.

Downloads

8

Readme

@makkii/app-aion

Aion application client. This library uses some third-party service:

Installation

npm install @makkii/app-aion

Usage

import { AionApiClient, AionKeystoreClient, AionLocalSigner } from '@makkii/app-aion';

const api_client = new AionApiClient({
    network: 'mainnet',
    jsonrpc: '***'
});
api_client.getBalance('0x...')
    .then(console.log)
    .catch(error=>console.log(error));
const keystore_client = new AionKeystoreClient();
api_client.buildTransaction(
    '0x...', // from address
    '0x...', // to address
    0, // amount
    {
        gasPrice: 10,
        gasLimit: 21000,
        isTokenTransfer: false
    }
).then(function(unsignedTx) {
    keystore_client.signTransaction(unsignedTx, new AionLocalSigner(), {
        private_key: '***'
    }).then(function(signedTx) {
        console.log(signedTx);
    });
});

API

Table of Contents

IAionConfig

Aion configuration interface

network

Network name

Type: ("mainnet" | "amity")

jsonrpc

Json RPC endpoint

Type: string

explorer_api

api endpoint that used to query transaction information

Type: string

explorer

transaction page base url

Type: string

remote_api

app server endpoint that provides token, icons, etc.

Type: string

AionKeystoreClient

Aion keystore client that implements IsingleKeystoreClient interface

getAccountFromMnemonic

Get account from mnemonic

Parameters
  • address_index number index in hd wallet
  • mnemonic string mnemonic phrase

Returns any account object: { private_key: '', public_key: '', address: '', index: '' }

recoverKeyPairByPrivateKey

Recover key pair by private key

Parameters
  • priKey string
  • privKey private key

Returns any key pair object: { private_key: '', public_key: '', address: '' }

recoverKeyPairByKeyFile

Recover key pair by key file

Parameters

Returns any key pair object: { private_key: '', public_key: '', address: '' }

validatePrivateKey

Check if private key is valid

Parameters

Returns any if private key is valid

validateAddress

Check if address is valid

Parameters
  • address string address to be validated

AionLocalSigner

Aion's signer using private key, implements IkeystoreSigner.

signTransaction

Sign transaction

Parameters
  • tx AionUnsignedTx AionUnsginedTx transaction object to sign.
  • params {private_key: string} parameters object, example: { private_key: '' }}

Returns Promise<string> transaction hash string

AionUnsignedTx

Aion unsigned transaction interface

  • to: string;
  • from: string;
  • nonce: string;
  • value: BigNumber;
  • gasPrice: number;
  • gasLimit: number;
  • timestamp: number;
  • data?: any;
  • type?: number;
  • tknTo?: string;
  • tknValue?: BigNumber;

AionApiClient

Aion api client that implement IsingleApiFullClient

Parameters

getNetwork

Get network name: mainnet, amity and mastery.

getBlockByNumber

Get block by number, block information doesn't contains transaction details

Parameters
  • blockNumber string block number's hex string

Returns any eth_getBlockNumber response's result

getBlockNumber

Get latest block number

Returns any eth_getBlockNumber response's result

getTransactionStatus

Get transaction status.

Parameters

Returns any if eth_getTransactionReceipt is null, returns null; else return object { status: true/false, blockNumber: intger, gasUsed: integer }

getTransactionsByAddress

Get transactions by the given address

Parameters

Returns any map of object structure which contains: key is hash hash: string, with prefix 0x timestamp: milli-seconds from 1970 from: sender to: receiver value: transfer amount status: 'CONFIRMED' or 'FAILED' blockNumber: hex string fee: integer

sendTransaction

Send transaction

Parameters
  • unsignedTx AionUnsignedTx unsigned transaction build by buildTransaction
  • signer T localSigner or hardware
  • signerParams any localSigner: {private_key} hardware:{derivationIndex}

Returns Promise<AionPendingTx>

getTokenIconUrl

throw not implementated error

Parameters

buildTransaction

TODO: not general enough. Build transaction

options parameters contains: gasLimit, gasPrice, isTokenTransfer, data(optional), contractAddr(optional), tokenDecimal(optional). if isTokenTransfer is true, transaction value is zero and transaction to is token contract creation address, to parameter is encoded in data.

Parameters
  • from string transaction sender
  • to string amount receiver
  • value BigNumber amount value
  • options {gasLimit: number, gasPrice: number, isTokenTransfer: boolean, data: any?, contractAddr: string?, tokenDecimal: number?} extra parameters

Returns Promise<AionUnsignedTx>

AionPendingTx

Aion pending transaction

  • hash: string;
  • status: "PENDING";
  • to: string;
  • from: string;
  • value: BigNumber;
  • tknTo?: string;
  • tknValue?: BigNumber;
  • timestamp: number;
  • gasPrice: number;
  • gasLimit: number;