How to use the eosjs/dist/eosjs-jssig.default function in eosjs

To help you get started, we’ve selected a few eosjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github EOSIO / eosio-explorer / packages / api-eosio-compiler / service-logic.js View on Github external
async function deployContract(blockchainUrl, account_name, private_key, permission, wasm_path, abi_path){
  if(blockchainUrl.indexOf("http://") < 0)
  {
    blockchainUrl = "http://" + blockchainUrl;
  }

  const rpc = new JsonRpc(blockchainUrl, { fetch });
  const signatureProvider = new JsSignatureProvider([private_key]);
  const api = new Api({ rpc, signatureProvider, textDecoder: new TextDecoder(), textEncoder: new TextEncoder() });

  const buffer = new Serialize.SerialBuffer({
    textEncoder: api.textEncoder,
    textDecoder: api.textDecoder,
  });

  const wasm = fs.readFileSync(wasm_path).toString('hex');
  let abi = JSON.parse(fs.readFileSync(abi_path, 'utf8'));

  const abiDefinition = api.abiTypes.get('abi_def');
  // need to make sure abi has every field in abiDefinition.fields
  // otherwise serialize throws error
  abi = abiDefinition.fields.reduce(
      (acc, { name: fieldName }) => Object.assign(acc, { [fieldName]: acc[fieldName] || [] }),
      abi,
github eosdac / eosio.lost / whitelist / populate / populate_whitelist.js View on Github external
const config = require('./config');

const csv = require('csv-parser');
const fs = require('fs');
const {Api, JsonRpc} = require('eosjs');
const JsSignatureProvider = require('eosjs/dist/eosjs-jssig');
const fetch = require('node-fetch');
const {TextEncoder, TextDecoder} = require('util');

const entries = [], tx_actions = [], failed_batches = [];

const signatureProvider = new JsSignatureProvider.default([config.private_key]);
const rpc = new JsonRpc(config.endpoint, {fetch});
const api = new Api({rpc, signatureProvider, textDecoder: new TextDecoder(), textEncoder: new TextEncoder()});

const whitelist_contract = config.contract;

const process_batches = (async (tx_actions) => {
    console.log(`Processing ${tx_actions.length} batches`)

    while (tx_actions.length){
        const actions =  tx_actions.pop();
        try {
            const res = await api.transact({
                actions
            }, {blocksBehind: 3, expireSeconds: 180});

            console.log(res);
github eosdac / eosdac-api / deferred_watcher / eosdac-deferred-handler.js View on Github external
constructor({config, wsclient}) {
        this.config = config
        this.wsclient = wsclient

        const rpc = new JsonRpc(this.config.eos.endpoint, {fetch});

        const privkey = '5KkVnP742xubajqLY89xhQLmm51yFgtnevCabQYRp8upxdqGRHL'

        const signatureProvider = new JsSignatureProvider.default([privkey]);

        this.api = new Api({
            rpc,
            signatureProvider,
            chainId: this.config.chainId,
            textDecoder: new TextDecoder(),
            textEncoder: new TextEncoder(),
        });
    }