-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JS bindings for entropy client #897
Conversation
@@ -103,3 +103,10 @@ pub enum ClientError { | |||
#[error("Verifying key has incorrect length")] | |||
BadVerifyingKeyLength, | |||
} | |||
|
|||
#[cfg(feature = "full-client")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason when compiling for wasm it doesn't like me deriving this trait with thiserror for this particular error type.
* Minor grammatical and spelling updates. * Fixed SDK NPM link.
All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
I have read the CLA Document and I hereby sign the CLA |
Closing this as it seems no-one wants it. Can re-open if that changes. |
This adds JS bindings to entropy-client.
The idea is to make it easier to migrate the SDK to a newer version of
entropy-core
- as this binds to client code which is all tested in CI inentropy-core
. And also to avoid issues with inconsistencies between subxt and polkadot JS - by relying less on polkadot JS.There is a very basic nodejs test CLI for trying this out
For some reason when using docker-compose i have to specify the chain endpoint as
ws://127.0.0.1:9944
- it does not likelocalhost
(gives a connection refused error).Register is a bit complicated because to poll for registration we need to a way to 'sleep' - rusts
std::thread::sleep
doesn't work. Theweb-sys
crate does gives us access towindow.setTimeout()
but i think i prefer to keep this out of our bindings.So i split registration into 2 functions. One which submits the transaction and one which checks for a confirmation with a given account id and returns the verifying key if successful. Running the loop and adding a delay is done externally in JS.
I am occasionally seeing this issue: #542 - which does not effect things working, but means an annoying error message pops up.
Tested manually with nodejs 18.15.0.
I am not planning to add tests for this because of the issues we had with the JS tests for entropy-protocol. If it this gets used in the SDK it should be tested there, and if it does not get used in the SDK then we probably dont need these bindings.