[wasm-client] keeping ownership over 'ReceivedBufferRequestSender' channel when spawning 'ResponsePusher' (#3945)

* [wasm-client] keeping ownership over 'ReceivedBufferRequestSender' channel when spawning 'ResponsePusher'

* Bump version of Typescript SDK to RC.10

* GitHub Actions workflow to publish SDK to NPM

* Bump package version manually

---------

Co-authored-by: Mark Sinclair <mmsinclair@users.noreply.github.com>
This commit is contained in:
Jędrzej Stuczyński
2023-10-03 09:36:25 +01:00
committed by GitHub
parent c7da8a7594
commit 56a384ea09
22 changed files with 45 additions and 37 deletions
+6 -4
View File
@@ -1,4 +1,4 @@
name: publish-sdk-npm
name: Publish Typescript SDK
on:
workflow_dispatch:
@@ -28,8 +28,10 @@ jobs:
- name: Install dependencies
run: yarn
- name: Build and publish
- name: Build WASM and Typescript SDK
run: yarn sdk:build
- name: Publish to NPM
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
working-directory: ./sdk/typescript/packages/sdk
run: scripts/publish.sh
run: ./sdk/typescript/scripts/publish.sh
Generated
+5 -5
View File
@@ -3020,7 +3020,7 @@ dependencies = [
[[package]]
name = "extension-storage"
version = "1.2.0-rc.9"
version = "1.2.0-rc.10"
dependencies = [
"bip39",
"console_error_panic_hook",
@@ -5613,7 +5613,7 @@ dependencies = [
[[package]]
name = "mix-fetch-wasm"
version = "1.2.0-rc.9"
version = "1.2.0-rc.10"
dependencies = [
"futures",
"js-sys",
@@ -6298,7 +6298,7 @@ dependencies = [
[[package]]
name = "nym-client-wasm"
version = "1.2.0-rc.9"
version = "1.2.0-rc.10"
dependencies = [
"anyhow",
"futures",
@@ -6917,7 +6917,7 @@ dependencies = [
[[package]]
name = "nym-node-tester-wasm"
version = "1.2.0-rc.9"
version = "1.2.0-rc.10"
dependencies = [
"futures",
"js-sys",
@@ -7511,7 +7511,7 @@ dependencies = [
[[package]]
name = "nym-wasm-sdk"
version = "1.2.0-rc.9"
version = "1.2.0-rc.10"
dependencies = [
"mix-fetch-wasm",
"nym-client-wasm",
+1 -1
View File
@@ -434,7 +434,7 @@ impl TaskClient {
.await
{
self.log(Level::Error, "Task stopped without shutdown called");
panic!("{timeout}")
panic!("{:?}: {timeout}", self.name)
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "extension-storage"
version = "1.2.0-rc.9"
version = "1.2.0-rc.10"
edition = "2021"
license = "Apache-2.0"
repository = "https://github.com/nymtech/nym"
@@ -1,6 +1,6 @@
{
"name": "@nymproject/contract-clients",
"version": "1.2.0-rc.9",
"version": "1.2.0-rc.10",
"description": "A client for all Nym smart contracts",
"license": "Apache-2.0",
"author": "Nym Technologies SA",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@nymproject/ts-sdk-docs",
"version": "1.2.0-rc.9",
"version": "1.2.0-rc.10",
"description": "Nym Typescript SDK Docs",
"license": "Apache-2.0",
"author": "Nym Technologies SA",
@@ -51,4 +51,4 @@
"typescript": "^4.9.3"
},
"private": false
}
}
@@ -1,6 +1,6 @@
{
"name": "@nymproject/mix-fetch",
"version": "1.2.0-rc.9",
"version": "1.2.0-rc.10",
"description": "This package is a drop-in replacement for `fetch` to send HTTP requests over the Nym Mixnet.",
"license": "Apache-2.0",
"author": "Nym Technologies SA",
@@ -1,6 +1,6 @@
{
"name": "@nymproject/node-tester",
"version": "1.2.0-rc.9",
"version": "1.2.0-rc.10",
"description": "This package provides a tester that can send test packets to mixnode that is part of the Nym Mixnet.",
"license": "Apache-2.0",
"author": "Nym Technologies SA",
@@ -1,6 +1,6 @@
{
"name": "@nymproject/nodejs-client",
"version": "1.2.0-rc.5",
"version": "1.2.0-rc.10",
"license": "Apache-2.0",
"author": "Nym Technologies SA",
"files": [
@@ -27,7 +27,7 @@
"tsc": "tsc --noEmit true"
},
"dependencies": {
"@nymproject/nym-client-wasm-node": ">=1.2.0-rc.7 || ^1",
"@nymproject/nym-client-wasm-node": ">=1.2.0-rc.10 || ^1",
"comlink": "^4.3.1"
},
"devDependencies": {
@@ -1,6 +1,6 @@
{
"name": "@nymproject/sdk-react",
"version": "1.2.0-rc.9",
"version": "1.2.0-rc.10",
"license": "Apache-2.0",
"author": "Nym Technologies SA",
"files": [
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@nymproject/sdk",
"version": "1.2.0-rc.9",
"version": "1.2.0-rc.10",
"license": "Apache-2.0",
"author": "Nym Technologies SA",
"files": [
@@ -1,6 +1,6 @@
{
"name": "@nymproject/nym-validator-client",
"version": "1.2.0-rc.9",
"version": "1.2.0-rc.10",
"description": "A TypeScript client for interacting with smart contracts in Nym validators",
"license": "Apache-2.0",
"author": "Nym Technologies SA (https://nymtech.net)",
+1 -7
View File
@@ -17,10 +17,4 @@ yarn build:wasm
yarn build:sdk
# build documentation
cd sdk/typescript/docs
npm i
npm run docs:prod:build
cd ../../..
# build examples
pwd
yarn docs:prod:build
+1 -1
View File
@@ -1,7 +1,7 @@
[package]
name = "nym-client-wasm"
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>", "Jedrzej Stuczynski <andrew@nymtech.net>"]
version = "1.2.0-rc.9"
version = "1.2.0-rc.10"
edition = "2021"
keywords = ["nym", "sphinx", "wasm", "webassembly", "privacy", "client"]
license = "Apache-2.0"
+3
View File
@@ -5,6 +5,9 @@ build:
wasm-pack build --scope nymproject --target web --out-dir ../../dist/wasm/client
wasm-opt -Oz -o ../../dist/wasm/client/nym_client_wasm_bg.wasm ../../dist/wasm/client/nym_client_wasm_bg.wasm
build-debug-dev:
wasm-pack build --scope nymproject --target no-modules
build-rust-node:
wasm-pack build --scope nymproject --target nodejs --out-dir ../../dist/node/wasm/client
wasm-opt -Oz -o ../../dist/node/wasm/client/nym_client_wasm_bg.wasm ../../dist/node/wasm/client/nym_client_wasm_bg.wasm
+1 -1
View File
@@ -35,6 +35,6 @@
"webpack-dev-server": "^4.7.4"
},
"dependencies": {
"@nymproject/nym-client-wasm": "file:../../../dist/wasm/client"
"@nymproject/nym-client-wasm": "file:../pkg"
}
}
+1 -1
View File
@@ -22,7 +22,7 @@ module.exports = {
patterns: [
'index.html',
{
from: '../../../dist/wasm/client/*.(js|wasm)',
from: '../pkg/*.(js|wasm)',
to: '[name][ext]',
},
],
+2 -2
View File
@@ -73,8 +73,8 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"
"@nymproject/nym-client-wasm@file:../../../dist/wasm/client":
version "1.2.0-rc.2"
"@nymproject/nym-client-wasm@file:../pkg":
version "1.2.0-rc.9"
"@types/body-parser@*":
version "1.19.2"
+10 -1
View File
@@ -8,12 +8,16 @@ use wasm_bindgen::JsValue;
use wasm_bindgen_futures::spawn_local;
use wasm_client_core::client::base_client::ClientOutput;
use wasm_client_core::client::received_buffer::{
ReceivedBufferMessage, ReconstructedMessagesReceiver,
ReceivedBufferMessage, ReceivedBufferRequestSender, ReconstructedMessagesReceiver,
};
use wasm_utils::console_error;
pub(crate) struct ResponsePusher {
reconstructed_receiver: ReconstructedMessagesReceiver,
// we need to keep that channel alive as not to trigger the shutdown
_received_buffer_request_sender: ReceivedBufferRequestSender,
on_message: js_sys::Function,
}
@@ -36,12 +40,17 @@ impl ResponsePusher {
ResponsePusher {
reconstructed_receiver,
_received_buffer_request_sender: client_output.received_buffer_request_sender,
on_message,
}
}
pub(crate) fn start(mut self) {
spawn_local(async move {
// for some reason if this channel is not explicitly moved into the block,
// it gets dropped when spawning the promise
let _request_sender = self._received_buffer_request_sender;
let this = JsValue::null();
while let Some(reconstructed) = self.reconstructed_receiver.next().await {
+1 -1
View File
@@ -1,7 +1,7 @@
[package]
name = "nym-wasm-sdk"
authors = ["Jedrzej Stuczynski <andrew@nymtech.net>"]
version = "1.2.0-rc.9"
version = "1.2.0-rc.10"
edition = "2021"
keywords = ["nym", "sphinx", "wasm", "webassembly", "privacy"]
license = "Apache-2.0"
+1 -1
View File
@@ -1,7 +1,7 @@
[package]
name = "mix-fetch-wasm"
authors = ["Jedrzej Stuczynski <andrew@nymtech.net>"]
version = "1.2.0-rc.9"
version = "1.2.0-rc.10"
edition = "2021"
keywords = ["nym", "fetch", "wasm", "webassembly", "privacy"]
license = "Apache-2.0"
+1 -1
View File
@@ -1,7 +1,7 @@
[package]
name = "nym-node-tester-wasm"
authors = ["Jedrzej Stuczynski <andrew@nymtech.net>"]
version = "1.2.0-rc.9"
version = "1.2.0-rc.10"
edition = "2021"
keywords = ["nym", "sphinx", "webassembly", "privacy", "tester"]
license = "Apache-2.0"