JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q40629F
  • License ISC

EOS configuration is simplified and specified smart contract registration and invocation is supported for javascript

Package Exports

  • coinxp-eos

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 (coinxp-eos) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

coinxp-eos

EOS configuration is simplified and specified smart contract registration and invocation is supported for javascript

usage

Install

npm install coinxp-eos --save

Test

npm test

API

Configuration
 const CoinXpEos = require('coinxp-eos');
 const config = {
        account: 'bpb',
        keyProvider: "5KAid1JShX7Q8H5BpQ2XeLDzvxEegq4qf7bNBh7DFsiEyveMPg2",
        httpEndpoint: "http://127.0.0.1:8888",
        printMethods: true  //true print contract and contract actions
    };
 coinxpEos = new CoinXpEos(config);
 coinxpEos.register('deposit.tx', ["confirm"]);
 coinxpEos.register('address', ["add", "approve", "reject"]);
GetInfo
 //support promise
 let result = await coinxpEos.info(); 
GetTable
 //support promise
 await coinxpEos.getTable('BTC', 'withdraw', 'withdrawals', 0, -1, 1000)
 or
 coinxpEos.getTable('BTC', 'withdraw', 'withdrawals', 0, -1, 1000).then((result)=>{
 }).catch((error) => {
 });
Use register method
 //Call register contract method,The parameters and eos contract parameters are the same
 //The method name is the combination of the contract name plus action, hump
 coinxpEos.addressAdd('ETH', '0xxxxx', "0xxxx").then((res) => {
        console.log(" Created new address: ", res.args[1]);
 }).catch((error) => {
        console.error("  ---- add address error:", error);
 });
Use contract instance
//The Contract instance name is equal to the Contract life plus the "Contract" keyword at registration
coinxpEos.addressContract.then((contract) => {
    contract.approve(coinxpEos.account, "ETH", "0xxxx", coinxpEos.options).then(result => {
        console.log("Approved address: 0xxxx");
    }).catch(err => {
        console.log(err);
    })
}).catch((error) => {
    console.log(error)
});