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

2 Answers 2


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) {
  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}
        return resp
      } catch(err) {
        return err

I got into the same error try using this import statement I hope it'll work

const { JsSignatureProvider } = require('eosjs/dist/eosjs-jssig'); 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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