Newcoin-Foundation / newcoin.socializer-js

js module to fetch data from the newcoin.socializer smart contract

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

newcoin.socializer-js

JS Library to read data from newcoin.socializer smart contract.

Usage

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

Initialize

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"

Documentation

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));

RpcAapi

Uses only native nodeos calls to chain api plugin.

ActionGenerator

Helper class to construct contract actions which can be pushed on chain with eosjs.

About

js module to fetch data from the newcoin.socializer smart contract


Languages

Language:TypeScript 88.6%Language:JavaScript 11.4%