Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

EOS Dawn3 API support #25

Closed
jcalfee opened this issue Feb 26, 2018 · 12 comments
Closed

EOS Dawn3 API support #25

jcalfee opened this issue Feb 26, 2018 · 12 comments

Comments

@jcalfee
Copy link
Contributor

jcalfee commented Feb 26, 2018

No description provided.

@chris-allnutt
Copy link
Contributor

chris-allnutt commented Feb 28, 2018

I'll be updating the readme to advise users to use 2.x for now till dawn 3 is ready.

jcalfee pushed a commit to EOSIO/eosjs-fcbuffer that referenced this issue Feb 28, 2018
jcalfee pushed a commit to EOSIO/eosjs-json that referenced this issue Feb 28, 2018
@jcalfee
Copy link
Contributor Author

jcalfee commented Mar 1, 2018

Related: EOSIO/eos#1513
get_block ref_block_prefix needs to return uint32 (not a unit64) #1513

@jcalfee
Copy link
Contributor Author

jcalfee commented Mar 1, 2018

Related: EOSIO/eos#1514
push_transaction API call is failing #1514

jcalfee pushed a commit that referenced this issue Mar 2, 2018
@kesar
Copy link

kesar commented Mar 5, 2018

EOSIO/eos#1513 got merged 🎉 :) Is there any tag where I can start testing dawn3-eosjs?

@jcalfee
Copy link
Contributor Author

jcalfee commented Mar 5, 2018

The dawn3 branch in eosio/eosjs is still too buggy to use.. I'm working on it now.

@jcalfee
Copy link
Contributor Author

jcalfee commented Mar 6, 2018

In master, transaction actions print with an empty data attribute #1565
EOSIO/eos#1565

jcalfee pushed a commit to EOSIO/eosjs-json that referenced this issue Mar 6, 2018
jcalfee pushed a commit to EOSIO/eosjs-fcbuffer that referenced this issue Mar 6, 2018
jcalfee pushed a commit that referenced this issue Mar 6, 2018
jcalfee pushed a commit to EOSIO/eosjs-fcbuffer that referenced this issue Mar 8, 2018
jcalfee pushed a commit to EOSIO/eosjs-json that referenced this issue Mar 8, 2018
jcalfee pushed a commit that referenced this issue Mar 8, 2018
jcalfee pushed a commit that referenced this issue Mar 8, 2018
@jcalfee
Copy link
Contributor Author

jcalfee commented Mar 9, 2018

Unit tests and README passing with github/eosio/eos[master] (pre-release of dawn3). Deployed to NPM, use a tag to get this version (7.0.0):

npm i eosjs@dawn3

The default at npm is still to install dawn2 compatible with the public testnet (6.x.x).

@jcalfee jcalfee closed this as completed Mar 9, 2018
jcalfee pushed a commit to EOSIO/eosjs-fcbuffer that referenced this issue Mar 9, 2018
@jcalfee
Copy link
Contributor Author

jcalfee commented Mar 9, 2018

For examples, look at the README on the dawn3 branch: https://github.com/eosio/eosjs/tree/dawn3

@jeremi
Copy link
Contributor

jeremi commented Mar 9, 2018

@jcalfee I have 2 issues with this branch for newaccount function.
I think the expected parameters changed, so the Readme.md and the test is out of date (I'm using eosio master).

This format now work:

eos.newaccount({
        creator: 'eosio',
        name,
        owner: {"threshold": 1, "keys": [], "accounts": [{"permission":{ "actor":"jj.test", "permission":"active" }, "weight": 1}]},
        active: {"threshold": 1, "keys": [], "accounts": [{"permission":{ "actor":"jj.test", "permission":"active" }, "weight": 1}]},
        recovery: {"threshold": 1, "keys": [], "accounts": [{"permission":{ "actor":"jj.test", "permission":"active" }, "weight": 1}]}
      })

But when I try to use keys, I'm getting an error. My test is:

eos.newaccount({
        creator: 'eosio',
        name,
        owner: {"threshold": 1, "keys": [{"key": "EOS6ePVMSdSkGn4wDMqcCSTSN3GnRgEPxDPEioQQXUkfYxT8jrudg", "weight": 1}], "accounts": []},
        active: {"threshold": 1, "keys": [{"key": "EOS6ePVMSdSkGn4wDMqcCSTSN3GnRgEPxDPEioQQXUkfYxT8jrudg", "weight": 1}], "accounts": []},
        recovery: {"threshold": 1, "keys": [{"key": "EOS6ePVMSdSkGn4wDMqcCSTSN3GnRgEPxDPEioQQXUkfYxT8jrudg", "weight": 1}], "accounts": []}
      })

The error I get is:

"AssertionError: Checksum did not match, c9545447 != c9545447
    at Function.PublicKey.fromStringOrThrow (http://localhost:9080/static/eos.js:15168:12)
    at Object.appendByteBuffer (http://localhost:9080/static/eos.js:25811:29)
    at Object.appendByteBuffer (http://localhost:9080/static/eos.js:17505:12)
    at Object.appendByteBuffer (http://localhost:9080/static/eos.js:25781:21)
    at Object.appendByteBuffer (http://localhost:9080/static/eos.js:17105:20)
    at Object.appendByteBuffer (http://localhost:9080/static/eos.js:17565:16)
    at Object.appendByteBuffer (http://localhost:9080/static/eos.js:17105:20)
    at Object.appendByteBuffer (http://localhost:9080/static/eos.js:17105:20)
    at action.data.appendByteBuffer (http://localhost:9080/static/eos.js:26044:11)
    at Object.appendByteBuffer (http://localhost:9080/static/eos.js:17103:15)"

So it seems there is an issue when comparing the keys, even though they are the same. the issue seems to be because of assert.deepEqual as the object are not totally equal:

assert.deepEqual(checksum, new_checksum, 'Checksum did not match, ' + (checksum.toString('hex') + ' != ' + new_checksum.toString('hex')));

Changing it to the follow code fix the issue, but there is probably a more elegant solution:

assert.deepEqual(checksum.toString('hex')), new_checksum.toString('hex')), 'Checksum did not match, ' + (checksum.toString('hex') + ' != ' + new_checksum.toString('hex')));

Let me know if I should open a new ticket.

@jcalfee
Copy link
Contributor Author

jcalfee commented Mar 9, 2018

@jeremi should be fixed now in v7.0.1 and on the dawn3 branch..

@jeremi
Copy link
Contributor

jeremi commented Mar 9, 2018

Yes, it's working now.

I think the tests will need to be fixed as the format of parameters changed: https://github.com/EOSIO/eosjs/blob/dawn3/src/index.test.js#L153

I did not run those tests automatically as I'm not sure how to set up the test environment, but running this test manually, it fail.
It seems that because of line 57 those tests are not run by Travis automatically.

This doc is also outdated:
https://github.com/EOSIO/eosjs/blame/dawn3/README.md#L145

@jcalfee
Copy link
Contributor Author

jcalfee commented Mar 9, 2018

Travis does not have a dawn3 node or a way to test with tokens, package.json forces testing locally before every npm publish.

The test and syntax works for me though, eosjs converts that syntax into the more expanded syntax your using: see 'short-hand' in the README. Both ways should work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants