EOSIO / eosjs

General purpose library for the EOSIO blockchain.
http://eosio.github.io/eosjs
MIT License
1.43k stars 462 forks source link

Errors with eos.newaccount #1

Closed liamcurry closed 6 years ago

liamcurry commented 6 years ago

I'm trying to create a new account with eosjs using eos.newaccount, but I keep getting errors like this:

screenshot

This screenshot is from a Browserified bundle in Chrome, but I see the same errors in a Node REPL.

Here's the code snippet I'm trying to run (from the README):

Eos = require('eosjs') // Or Eos = require('./src')

initaPrivate = '5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3'
initaPublic = 'EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV'
keyProvider = initaPrivate

eos = Eos.Testnet({keyProvider})

eos.newaccount({
  creator: 'inita',
  name: 'mynewacct',
  owner: initaPublic,
  active: initaPublic,
  recovery: 'inita',
  deposit: '1 EOS'
})

My local eos repo is at commit ec638a089f1e195fa83bfe5b0c8f677d04fae9a8 (latest from master as of last night) and I'm running it from the Docker image.

I'm using eosjs v4.0.1 (latest from NPM).

Please let me know if you need any more information. Thanks!

jcalfee commented 6 years ago

This error was originally caused by the name encoding changing causing confusion so the eosd can't find the "eos" code (native contract) where the newaccount method is..

That changed maybe a month ago. If by chance you have an old eosd by accident that would cause this. It could however be something different. I'm getting an update on the build process now.

liamcurry commented 6 years ago

Thanks @jcalfee. I did have eosd running around a month ago so that could very well be the issue. I updated my local repo and all submodules last night, but maybe I missed something. I'll try starting from a fresh clone and see if that changes anything.

liamcurry commented 6 years ago

Okay, I got a fresh copy of eosd running on a new machine (never had any EOS stuff on it before), and unfortunately I'm seeing the same error.

liamcurry commented 6 years ago

If it's of any use, here are the logs from a little further up:

screenshot

jcalfee commented 6 years ago

O boy, that is a nice new docker script in eos..

Confirmed. it is something related to the es2015 transpile. So it will work locally from ./srcbut not in the version I deploy to npm (everyone else) .. I'll have to start running my unit test on the ./lib folder. I'll get it fixed soon. Thanks..

jcalfee commented 6 years ago

I pushed an initial patch to npm .. that fixes all the unit test .. newaccount is covered.

I still need to trap undefined variables. It is allowing me to deploy in non-strict mode.. undefined variables were breaking it.

jcalfee commented 6 years ago

v4.0.2

jcalfee commented 6 years ago

fixed

https://github.com/EOSIO/eosjs/commit/8d21ca6301c0172c39dd75baac9d50d66fb9732a https://github.com/EOSIO/eosjs/commit/1a83c8494990d044132edb3729fb8a4fa879d0b4

liamcurry commented 6 years ago

Oh wow that was fast! It's working now, thanks @jcalfee!