-
Notifications
You must be signed in to change notification settings - Fork 94
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
feat(channels): wasm, coin balance and socket impl #1978
Conversation
Signed-off-by: ozkanonur <work@onurozkan.dev>
Signed-off-by: ozkanonur <work@onurozkan.dev>
Signed-off-by: ozkanonur <work@onurozkan.dev>
Signed-off-by: ozkanonur <work@onurozkan.dev>
Signed-off-by: ozkanonur <work@onurozkan.dev>
Signed-off-by: ozkanonur <work@onurozkan.dev>
Signed-off-by: ozkanonur <work@onurozkan.dev>
Signed-off-by: ozkanonur <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
…sh-only-streaming-channels
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
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.
Thank you for the fixes! Next review iteration!
Opened an issue for the above #1986 |
Signed-off-by: onur-ozkan <work@onurozkan.dev>
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.
🔥
@KomodoPlatform/qa how to test wasm event streaming and |
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.
New Event: COIN_BALANCE:
It's now implemented for Tendermint Protocol(will cause panics with
todo
for any other coins).The way it works:
1- Subscribe to the account address using websocket
2- On any message(this means our address either sent tx or recieved tx), get the current balance
3- If the balance is changed(different than the previously broadcasted event) then broadcast it to mm2 clients.
Sample configuration:
Native:
Same as #1945, for triggering COIN_BALANCE event, enable any tendermint based coin and send/recieve some funds on that address.
WASM:
Event streaming on WASM can be tested easily with https://github.com/KomodoPlatform/react-komodefi-wasm.
Build:
Build mm2 with
wasm-pack build --release mm2src/mm2_bin_lib --target web --out-dir ../../target/target-wasm-release
soft-linking(or file/dir replacement directly):
atomicDEX-API/target/target-wasm-release/mm2lib.js to react-komodefi-wasm/src/js/mm2.js
atomicDEX-API/target/target-wasm-release/snippets to react-komodefi-wasm/src/js/snippets
atomicDEX-API/target/target-wasm-release/mm2lib_bg.wasm to react-komodefi-wasm/public/mm2_bg.wasm
Add ATOM-TEST coin:
Append the following json value to the coins file:
Worker file:
Create
react-komodefi-wasm/worker.js
file with the following content:Test the network and balance events:
Network events should start being logged on console right away when mm2 is started, for the balance events, you have to enable tendermint based coins, an example ATOM-TEST which we added to coins file. For that, execute the following RPC:
After the activation, when your address gets/sends TX, you should be able to see COIN_BALANCE event on the console logs.
KomodoPlatform/tokio-tungstenite-wasm
There is no socket library that supports Native + WASM platforms with async/await & Send+Sync(without those supports, handling events(specially COIN_BALANCE) will cause i/o blocking and resource-intensive situations on the runtime). I had to fork a few of the existing ones and do some changes. This fork should be super easy to maintain for us, as it's just a wrapper around tokio-tungstenite and web-sys. Most of the effort on this fork will be bumping the dependencies when needed.