JS Library to read data from newcoin.socializer smart contract.
This is a Node.js module available through the
npm registry. Installation is done using the
npm install
command:
npm i @newcoin-foundation/newcoin.socializer-js
Web library can be found in the [dist] folder
// Standard import
const { ActionGenerator, RpcApi } = require("@newcoin-foundation/newcoin.socializer-js");
// ES6 import
import { ActionGenerator, RpcApi } from "@newcoin-foundation/newcoin.socializer-js"
const api = new RpcApi("https://nodeos.newcoin.org", "social.nco", fetch);
const response = await api.getPayouts();
const json = await response.json();
console.log(JSON.stringify(json));
const generator = new ActionGenerator("social.nco");
const authorization = { "account":"socialowner1", "permission":"active" };
const creator = "socialowner1";
const payouts = [
{
"account": "socialowner1",
"percentage": 0.5
},
{
"account": "socialowner2",
"percentage": 0.5
}
];
const supported_symbols = [
{
"sym": "4,NCO",
"contract": "eosio.token"
}
];
const action = generator.create(
authorization,
creator,
payouts,
supported_symbols
);
console.log(JSON.stringify(action));
Uses only native nodeos calls to chain api plugin.
Helper class to construct contract actions which can be pushed on chain with eosjs.