1

Version of EOSJS eos@fffff and eos@beta3

Describe the bug

const JsSignatureProvider = require('eosjs/dist/eosjs-jssig');
const signature = new JsSignatureProvider([privKey]);

TypeError: JsSignatureProvider is not a constructor

Steps to reproduce the behavior: try and follow the first 6 lines of the documentation for getting started

Expected behavior: works

Desktop (please complete the following information): Ubuntu 16.04. node 8.14.0

Smartphone (please complete the following information): no

0

try .default at the end of the sig providor module

const JsSignatureProvider = require('eosjs/dist/eosjs-jssig').default;  // development only


const { Api, JsonRpc, RpcError } = require('eosjs');
const JsSignatureProvider = require('eosjs/dist/eosjs-jssig').default;  // development only
const { TextEncoder, TextDecoder } = require('util');

Example use

exports.transferToken = function(paramss, context) {
  console.log((paramss.amount).toPrecision(5))
  const signatureProvider = new JsSignatureProvider([context.privKey]);
  let rpc = new JsonRpc("http://jungle2.cryptolions.io:80", { fetch });
  const api = new Api({ rpc, signatureProvider, textDecoder: new TextDecoder(), textEncoder: new TextEncoder() });
  async function tx() {
    try {
      let resp = await api.transact({ actions: [{
          account: paramss.contract,
          name: 'transfer',
          authorization: [{
            actor: paramss.sender,
            permission: 'active',
          }],
          data: {
            from: paramss.sender,
            to: paramss.receiver,
            quantity: `${(paramss.amount).toFixed(4)} ${paramss.symbol}`,
            memo: paramss.memo,
          },
        }]
      }, {
        blocksBehind: 3,
        expireSeconds: 30,
      });
      resp = {...resp, paramss}
      console.log(resp);
        return resp
      } catch(err) {
        console.log(err)
        return err
    }
  }
  tx()
}
  • nodude that didn't work.... what version – nick carraway Mar 19 at 16:28
  • eosjs@20.0.0-beta3 – DUDE139 Mar 22 at 2:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.