AschPlatform / asch-js

Asch frontend library
18 stars 15 forks source link

Adjust to ASCH 1.4.2 #17

Closed a1300 closed 6 years ago

a1300 commented 6 years ago

Dear @liangpeili,

this pull request makes the asch-js package compatible with the ASCH 1.4.2 release. The tests still break, but I will fix them with the next pull request.

What I've done

Packages where asch-js is used

Here I list all packages that are using asch-js today. This pull request shouldn't break them.




Please review my pull request. Is something missing for you?

All the best! a1300

bassjobsen commented 6 years ago

Hi @a1300 thanks, you did a great job! The the username parameter is remove from the createDelegate function at https://github.com/AschPlatform/asch-js/blob/6c1f7d0569484c18f48742ce27fd69b018d1e8e0/lib/transactions/delegate.js#L7.

On the other hand registerDelegate() in asch-core requires that the sender account has set a name already: https://github.com/AschPlatform/asch/blob/master/src/contract/basic.js#L330

As mention already at https://github.com/AschPlatform/asch/issues/246 is is not clear what is expected? Should the sender register / set a name first?

a1300 commented 6 years ago

On the other hand registerDelegate() in asch-core requires that the sender account has set a name already

@bassjobsen yes, exactly The ASCH 1.4.x transaction API doesn't need the username to register as a delegate (because the username must be already set).
The older API (ASCH 1.3.6) needed the username to register as a delegate

bassjobsen commented 6 years ago

@a1300 thanks for your quick reply:

The ASCH 1.4.x transaction API doesn't need the username to register as a delegate (because the username must be already set).

Okay thanks, that's clear. Now i wonder shouldn't asch-js throw a error when the user name is not set? Or do you expect asch-core should handle this?

a1300 commented 6 years ago

@bassjobsen NP 😃
I think that the asch-js package isn't allowed to know if the username is set for an account (because it hasn't access to the database). asch-js is a simple reusable library package with no access to the blockchain database.

asch-core returns an error if the username is not set. I think that is good so 😃

sqfasd commented 6 years ago

Great job!