axis-pp

1.0.8 • Public • Published

axis-pp

AXIS js-sdk for popup and pullup DApp market .

Whate is axis-pp?

axis-pp provided to developers who need to develop DApps in the popup and pullup DApp market. It provides interface for querying accounts and executing smart contract methods.

How to use axis-pp

Installation

 npm install axis-pp

Usage

import axispp from 'axis-pp'

Document

  • axispp.init
  • axispp.getAccountList
  • axispp.getAccountDetail
  • axispp.call
  • axispp.executeContract
  • axispp.estimateGas

axispp.init

It must be inited before invoke other interface.

const dapp = {
          name: "Hello DApp",
          contractAddress: contractAddress,
          github: "https://github.com/axis-cash/axis-pp/example",
          author: "tom",
          url: "http://127.0.0.1:3000",
          logo: "http://127.0.0.1:3000/logo192.png",
      }

      axispp.init(dapp,function (rest) {
          console.log("init result >>> " , rest);
      })

Account structure

  • Name wallet name
  • PK is the address of the account, can be used as a tag for the account, not as a transfer from address.
  • MainPKr can be used as a common address, call and execute smart contract.
  • Balance is a map. key = currency ,value = Minimum unit amount.

Transaction structure

  • from Use PK
  • to Use Contract Address
  • data It is the data that return from axisjs packMethod
  • value It is amount of transfer to the contract. It need contract support payable method.
  • cy It is short word of currency ,default AXIS
  • gas It is pay to miner
  • gasPrice Price of gas

Usage

  • axispp.getAccountList

Return all wallet account

axispp.getAccountList(function(accounts){
    console.log(accounts);
});

Result:

[{
        "Name":"Tom",
        "PK": "kvaztfuz3ZS6sNcksQYZpdGC1rUwcuv1aPkuzkLdgeNSvq5FQiURuBsqghLCY3MkxZLNm7WQ9yV2ib2UWoRpJys",
        "MainPKr": "fHBQfR5t9j3D4CsKQG78sQ3Qzdz9SS6m3XsgvgkNcpKjD1TMBEVmcJ4vhDUpkZrvPtE47DnzxRjz4Gk7xMaGZfxstnMeBjZF1dWeQaC3dxLrPPa4wQoGdXeJuihdTKwxf5K",
	"Balance": {
		"AXIS": 88999438296000000000
	}
}]
  • axispp.getAccountDetail

Return the PK wallet account

  axispp.getAccountDetail(PK,function(account){
      console.log(account);
  });

Result:

  {
          "Name":"Tom",
          "PK": "kvaztfuz3ZS6sNcksQYZpdGC1rUwcuv1aPkuzkLdgeNSvq5FQiURuBsqghLCY3MkxZLNm7WQ9yV2ib2UWoRpJys",
          "MainPKr": "fHBQfR5t9j3D4CsKQG78sQ3Qzdz9SS6m3XsgvgkNcpKjD1TMBEVmcJ4vhDUpkZrvPtE47DnzxRjz4Gk7xMaGZfxstnMeBjZF1dWeQaC3dxLrPPa4wQoGdXeJuihdTKwxf5K",
  	"Balance": {
  		"AXIS": 88999438296000000000
  	}
  }
  • axispp.executeContract

Send a transaction to update smart contract state. It is asynchronous on the block chain. and return transaction hash.

axispp.executeContract(tx,function(txHash){
    console.log(txHash);
});
  • axispp.call

It use to get data from gero node . and it will be convert to basic data structure.

axispp.call(data,function(rest){
    console.log(rest);
});
  • axispp.estimateGas

It use to estimate gas begin send transaction .

axispp.estimateGas(data,function(gas){
    console.log(gas);
});

Package Sidebar

Install

npm i axis-pp

Homepage

.

Weekly Downloads

35

Version

1.0.8

License

LGPL-3.0

Unpacked Size

126 kB

Total Files

29

Last publish

Collaborators

  • lqhlqy