eosjs icon indicating copy to clipboard operation
eosjs copied to clipboard

TypeError: eosjs__WEBPACK_IMPORTED_MODULE_11___default.a.SignatureProvider is not a constructor

Open kstvigilante opened this issue 8 years ago • 6 comments

Getting this error after following the steps from documentation

kstvigilante avatar Oct 16 '18 11:10 kstvigilante

You have to install eosjs@beta.

Remove old eosjs package yarn remove eosjs

Install new package yarn add eosjs@beta

IhorPeresunko avatar Oct 19 '18 10:10 IhorPeresunko

I get this same problem when I am running 20.0.0-beta2. I have to explicitly instruct npm to install to use 20.0.0-beta1.

mgravitt avatar Oct 22 '18 13:10 mgravitt

@gravitt8460 please reference the updated README for beta2, the syntax is now import { JsSignatureProvider } from 'eosjs' if you want to use the default Js Signature Provider during development. We wanted to clarify that this is a practice that should be avoided when releasing production builds, as keeping private keys within the context of the webpage is insecure.

c0d3ster avatar Oct 22 '18 15:10 c0d3ster

Browser
Importing using ES6 module syntax in the browser is supported if you have a transpiler, such as Babel.

import { Api, JsonRpc, RpcError, JsSignatureProvider } from 'eosjs';
NodeJS
Importing using commonJS syntax is supported by node out of the box.

const { Api, JsonRpc, RpcError, JsSignatureProvider } = require('eosjs');
const fetch = require('node-fetch');                            // node only; not needed in browsers
const { TextDecoder, TextEncoder } = require('text-encoding');  // node, IE11 and IE Edge Browsers

bing-deng avatar Oct 24 '18 06:10 bing-deng

@c0d3ster do you have any docs on how to create a signature provider or somewhere you could point people looking to create their own? i can’t seem to get jssignatureprovider to work and from what i’ve read, don’t want to use that in production. any help is appreciated, thanks!

crizzwald avatar Nov 02 '18 22:11 crizzwald

@crizzwald could you provide more details about your issues with using the default JsSignatureProvider? The default signature provider is a great starting point to get your application up and running with either hardcoded keys or keys based on user input. Getting the default signature provider working will allow you to focus on getting the other user/blockchain interactions production-ready then you can circle back around to a more secure signature provider solution

c0d3ster avatar Nov 05 '18 16:11 c0d3ster