From 2d11c7e43e6d513c34cb67c0f9711753740f7825 Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Thu, 15 Sep 2022 16:24:01 +1000 Subject: [PATCH 01/14] chore(eth-pm): bump js-waku to 0.28.0 --- eth-pm/package.json | 2 +- eth-pm/pnpm-lock.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eth-pm/package.json b/eth-pm/package.json index c1ccc69..ed8f3b6 100644 --- a/eth-pm/package.json +++ b/eth-pm/package.json @@ -10,7 +10,7 @@ "@material-ui/icons": "^4.11.2", "ethers": "5.7.0", "fontsource-roboto": "^4.0.0", - "js-waku": "0.27.0", + "js-waku": "0.28.0", "protobufjs": "^7.1.0", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/eth-pm/pnpm-lock.yaml b/eth-pm/pnpm-lock.yaml index e432093..f1cabdd 100644 --- a/eth-pm/pnpm-lock.yaml +++ b/eth-pm/pnpm-lock.yaml @@ -14,7 +14,7 @@ specifiers: eslint: ^8.9.0 ethers: 5.7.0 fontsource-roboto: ^4.0.0 - js-waku: 0.27.0 + js-waku: 0.28.0 npm-run-all: ^4.1.5 prettier: ^2.5.1 protobufjs: ^7.1.0 @@ -31,7 +31,7 @@ dependencies: '@material-ui/icons': 4.11.3_upnjamd3tbaukgopcqqdlc7jbm ethers: 5.7.0 fontsource-roboto: 4.0.0 - js-waku: 0.27.0_undici@5.10.0 + js-waku: 0.28.0_undici@5.10.0 protobufjs: 7.1.0 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 @@ -8443,8 +8443,8 @@ packages: /js-tokens/4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} - /js-waku/0.27.0_undici@5.10.0: - resolution: {integrity: sha512-uIh1h2Gu+aEyrGb4qmyk2Sc91in3fMfOil0kdtrps9HnA7ESbC5c6d148LeJaxqH5rfOkrfXXIhw1zwA3hlauw==} + /js-waku/0.28.0_undici@5.10.0: + resolution: {integrity: sha512-MEIFugvio2IaQMQT+g+bn24BvlJ5S4PdSKD0AGVZlR7q1BhECwlpRoytyz0A/hC1+EJWhrZB8cpIAmxwtYWTBw==} engines: {node: '>=16'} dependencies: '@chainsafe/libp2p-gossipsub': 4.1.1_undici@5.10.0 From 930373e7b99c67f5dd5d6882e48097092f0ae083 Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Mon, 19 Sep 2022 22:57:33 +1000 Subject: [PATCH 02/14] chore(eth-pm): bump ethers to 5.7.1 --- eth-pm/package.json | 2 +- eth-pm/pnpm-lock.yaml | 62 ++++++++++++++++++++++++++++++++++++------- 2 files changed, 54 insertions(+), 10 deletions(-) diff --git a/eth-pm/package.json b/eth-pm/package.json index ed8f3b6..c8abefb 100644 --- a/eth-pm/package.json +++ b/eth-pm/package.json @@ -8,7 +8,7 @@ "@ethersproject/providers": "5.7.0", "@material-ui/core": "^4.12.3", "@material-ui/icons": "^4.11.2", - "ethers": "5.7.0", + "ethers": "5.7.1", "fontsource-roboto": "^4.0.0", "js-waku": "0.28.0", "protobufjs": "^7.1.0", diff --git a/eth-pm/pnpm-lock.yaml b/eth-pm/pnpm-lock.yaml index f1cabdd..5d47765 100644 --- a/eth-pm/pnpm-lock.yaml +++ b/eth-pm/pnpm-lock.yaml @@ -12,7 +12,7 @@ specifiers: '@types/react-dom': ^18.0.6 cspell: ^6.0.0 eslint: ^8.9.0 - ethers: 5.7.0 + ethers: 5.7.1 fontsource-roboto: ^4.0.0 js-waku: 0.28.0 npm-run-all: ^4.1.5 @@ -29,7 +29,7 @@ dependencies: '@ethersproject/providers': 5.7.0 '@material-ui/core': 4.12.4_zxljzmqdrxwnuenbkrz77w74uy '@material-ui/icons': 4.11.3_upnjamd3tbaukgopcqqdlc7jbm - ethers: 5.7.0 + ethers: 5.7.1 fontsource-roboto: 4.0.0 js-waku: 0.28.0_undici@5.10.0 protobufjs: 7.1.0 @@ -2099,10 +2099,10 @@ packages: '@ethersproject/bignumber': 5.7.0 '@ethersproject/bytes': 5.7.0 '@ethersproject/logger': 5.7.0 - '@ethersproject/networks': 5.7.0 + '@ethersproject/networks': 5.7.1 '@ethersproject/properties': 5.7.0 '@ethersproject/transactions': 5.7.0 - '@ethersproject/web': 5.7.0 + '@ethersproject/web': 5.7.1 dev: false /@ethersproject/abstract-signer/5.7.0: @@ -2239,6 +2239,12 @@ packages: '@ethersproject/logger': 5.7.0 dev: false + /@ethersproject/networks/5.7.1: + resolution: {integrity: sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==} + dependencies: + '@ethersproject/logger': 5.7.0 + dev: false + /@ethersproject/pbkdf2/5.7.0: resolution: {integrity: sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw==} dependencies: @@ -2280,6 +2286,34 @@ packages: - utf-8-validate dev: false + /@ethersproject/providers/5.7.1: + resolution: {integrity: sha512-vZveG/DLyo+wk4Ga1yx6jSEHrLPgmTt+dFv0dv8URpVCRf0jVhalps1jq/emN/oXnMRsC7cQgAF32DcXLL7BPQ==} + dependencies: + '@ethersproject/abstract-provider': 5.7.0 + '@ethersproject/abstract-signer': 5.7.0 + '@ethersproject/address': 5.7.0 + '@ethersproject/base64': 5.7.0 + '@ethersproject/basex': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/constants': 5.7.0 + '@ethersproject/hash': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/networks': 5.7.1 + '@ethersproject/properties': 5.7.0 + '@ethersproject/random': 5.7.0 + '@ethersproject/rlp': 5.7.0 + '@ethersproject/sha2': 5.7.0 + '@ethersproject/strings': 5.7.0 + '@ethersproject/transactions': 5.7.0 + '@ethersproject/web': 5.7.1 + bech32: 1.1.4 + ws: 7.4.6 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + /@ethersproject/random/5.7.0: resolution: {integrity: sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ==} dependencies: @@ -2388,6 +2422,16 @@ packages: '@ethersproject/strings': 5.7.0 dev: false + /@ethersproject/web/5.7.1: + resolution: {integrity: sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==} + dependencies: + '@ethersproject/base64': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/logger': 5.7.0 + '@ethersproject/properties': 5.7.0 + '@ethersproject/strings': 5.7.0 + dev: false + /@ethersproject/wordlists/5.7.0: resolution: {integrity: sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA==} dependencies: @@ -6559,8 +6603,8 @@ packages: engines: {node: '>= 0.6'} dev: true - /ethers/5.7.0: - resolution: {integrity: sha512-5Xhzp2ZQRi0Em+0OkOcRHxPzCfoBfgtOQA+RUylSkuHbhTEaQklnYi2hsWbRgs3ztJsXVXd9VKBcO1ScWL8YfA==} + /ethers/5.7.1: + resolution: {integrity: sha512-5krze4dRLITX7FpU8J4WscXqADiKmyeNlylmmDLbS95DaZpBhDe2YSwRQwKXWNyXcox7a3gBgm/MkGXV1O1S/Q==} dependencies: '@ethersproject/abi': 5.7.0 '@ethersproject/abstract-provider': 5.7.0 @@ -6577,10 +6621,10 @@ packages: '@ethersproject/json-wallets': 5.7.0 '@ethersproject/keccak256': 5.7.0 '@ethersproject/logger': 5.7.0 - '@ethersproject/networks': 5.7.0 + '@ethersproject/networks': 5.7.1 '@ethersproject/pbkdf2': 5.7.0 '@ethersproject/properties': 5.7.0 - '@ethersproject/providers': 5.7.0 + '@ethersproject/providers': 5.7.1 '@ethersproject/random': 5.7.0 '@ethersproject/rlp': 5.7.0 '@ethersproject/sha2': 5.7.0 @@ -6590,7 +6634,7 @@ packages: '@ethersproject/transactions': 5.7.0 '@ethersproject/units': 5.7.0 '@ethersproject/wallet': 5.7.0 - '@ethersproject/web': 5.7.0 + '@ethersproject/web': 5.7.1 '@ethersproject/wordlists': 5.7.0 transitivePeerDependencies: - bufferutil From 2ea1df193c3655c78178191404c63974f55eac0a Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Thu, 15 Sep 2022 16:29:36 +1000 Subject: [PATCH 03/14] chore(light-js): bump js-waku to 0.28.0 --- light-js/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/light-js/index.html b/light-js/index.html index 56c30db..11a9c2b 100644 --- a/light-js/index.html +++ b/light-js/index.html @@ -35,13 +35,13 @@ import { utils, WakuMessage - } from 'https://unpkg.com/js-waku@0.27.0/bundle/index.js'; + } from 'https://unpkg.com/js-waku@0.28.0/bundle/index.js'; import { createLightNode - } from 'https://unpkg.com/js-waku@0.27.0/bundle/lib/create_waku.js' + } from 'https://unpkg.com/js-waku@0.28.0/bundle/lib/create_waku.js' import { waitForRemotePeer - } from 'https://unpkg.com/js-waku@0.27.0/bundle/lib/wait_for_remote_peer.js' + } from 'https://unpkg.com/js-waku@0.28.0/bundle/lib/wait_for_remote_peer.js' const peerIdDiv = document.getElementById('peer-id'); const remotePeerIdDiv = document.getElementById('remote-peer-id'); From 4196196d0bb7a959a55081d832060d0cd2e68b4d Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Tue, 20 Sep 2022 09:56:00 +1000 Subject: [PATCH 04/14] feat(light-js): add labels --- light-js/index.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/light-js/index.html b/light-js/index.html index 11a9c2b..a13a456 100644 --- a/light-js/index.html +++ b/light-js/index.html @@ -18,16 +18,18 @@

Remote Peer Id

+
- - + +
+ - +
From a5c1eef9f7dfa7868b614cc2a4acea0c5ca0c5f5 Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Thu, 15 Sep 2022 16:28:27 +1000 Subject: [PATCH 05/14] chore(relay-angular-chat): bump js-waku to 0.28.0 --- relay-angular-chat/package.json | 2 +- relay-angular-chat/pnpm-lock.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/relay-angular-chat/package.json b/relay-angular-chat/package.json index 65173b5..c6fe5aa 100644 --- a/relay-angular-chat/package.json +++ b/relay-angular-chat/package.json @@ -21,7 +21,7 @@ "@angular/platform-browser": "~14.2.0", "@angular/platform-browser-dynamic": "~14.2.0", "@angular/router": "~14.2.0", - "js-waku": "0.27.0", + "js-waku": "0.28.0", "protobufjs": "^7.1.0", "rxjs": "~7.5.0", "tslib": "^2.3.0", diff --git a/relay-angular-chat/pnpm-lock.yaml b/relay-angular-chat/pnpm-lock.yaml index d2da80a..1d4eac8 100644 --- a/relay-angular-chat/pnpm-lock.yaml +++ b/relay-angular-chat/pnpm-lock.yaml @@ -16,7 +16,7 @@ specifiers: '@types/node': ^17.0.21 is-ci-cli: ^2.2.0 jasmine-core: ~4.3.0 - js-waku: 0.27.0 + js-waku: 0.28.0 karma: ~6.4.0 karma-chrome-launcher: ~3.1.0 karma-coverage: ~2.2.0 @@ -37,7 +37,7 @@ dependencies: '@angular/platform-browser': 14.2.0_afytwol7hs4qio34buyx2grhfa '@angular/platform-browser-dynamic': 14.2.0_owch6soaoexeadly32xw5vendq '@angular/router': 14.2.0_6lk4yxyxfaqzosenawf2bqx6vy - js-waku: 0.27.0 + js-waku: 0.28.0 protobufjs: 7.1.0 rxjs: 7.5.6 tslib: 2.4.0 @@ -5440,8 +5440,8 @@ packages: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} dev: true - /js-waku/0.27.0: - resolution: {integrity: sha512-uIh1h2Gu+aEyrGb4qmyk2Sc91in3fMfOil0kdtrps9HnA7ESbC5c6d148LeJaxqH5rfOkrfXXIhw1zwA3hlauw==} + /js-waku/0.28.0: + resolution: {integrity: sha512-MEIFugvio2IaQMQT+g+bn24BvlJ5S4PdSKD0AGVZlR7q1BhECwlpRoytyz0A/hC1+EJWhrZB8cpIAmxwtYWTBw==} engines: {node: '>=16'} dependencies: '@chainsafe/libp2p-gossipsub': 4.1.1 From 596ec23a9c4ed6fff44f849a4621b0d522a4924d Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Thu, 15 Sep 2022 16:30:54 +1000 Subject: [PATCH 06/14] feat(relay-js): use createPrivacyNode --- relay-js/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/relay-js/index.html b/relay-js/index.html index cf7e55e..b28c8e4 100644 --- a/relay-js/index.html +++ b/relay-js/index.html @@ -30,7 +30,7 @@ WakuMessage } from 'https://unpkg.com/js-waku@0.27.0/bundle/index.js'; import { - createWaku + createPrivacyNode } from 'https://unpkg.com/js-waku@0.27.0/bundle/lib/create_waku.js' import { waitForRemotePeer @@ -60,7 +60,7 @@ // We are currently working on migrating this method to DNS Discovery. // // https://js-waku.wakuconnect.dev/classes/waku.Waku.html#create - const waku = await createWaku({defaultBootstrap: true}); + const waku = await createPrivacyNode({defaultBootstrap: true}); await waku.start(); // Had a hook to process all incoming messages on a specified content topic. From e6226102ebe80a67b3aa4a63fc291273aa11d177 Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Thu, 15 Sep 2022 16:31:25 +1000 Subject: [PATCH 07/14] feat(relay-js): bump js-waku to 0.28.0 --- relay-js/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/relay-js/index.html b/relay-js/index.html index b28c8e4..a754fd0 100644 --- a/relay-js/index.html +++ b/relay-js/index.html @@ -28,13 +28,13 @@ import { WakuMessage - } from 'https://unpkg.com/js-waku@0.27.0/bundle/index.js'; + } from 'https://unpkg.com/js-waku@0.28.0/bundle/index.js'; import { createPrivacyNode - } from 'https://unpkg.com/js-waku@0.27.0/bundle/lib/create_waku.js' + } from 'https://unpkg.com/js-waku@0.28.0/bundle/lib/create_waku.js' import { waitForRemotePeer - } from 'https://unpkg.com/js-waku@0.27.0/bundle/lib/wait_for_remote_peer.js' + } from 'https://unpkg.com/js-waku@0.28.0/bundle/lib/wait_for_remote_peer.js' const statusDiv = document.getElementById('status'); const messagesDiv = document.getElementById('messages'); From 7cae9875d32544f28e52acdea9ec7f62171d0587 Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Tue, 20 Sep 2022 10:05:31 +1000 Subject: [PATCH 08/14] feat(relay-js): add label --- relay-js/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/relay-js/index.html b/relay-js/index.html index a754fd0..e55d92d 100644 --- a/relay-js/index.html +++ b/relay-js/index.html @@ -12,9 +12,9 @@

Waku Node Status

+ - +

Messages

From f701230ad9b98e99d8c3bcbe6b10d3887ce2c93b Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Thu, 15 Sep 2022 16:33:50 +1000 Subject: [PATCH 09/14] feat(relay-reactjs-chat): use `createPrivacyNode` --- relay-reactjs-chat/src/App.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/relay-reactjs-chat/src/App.js b/relay-reactjs-chat/src/App.js index 4a91f0e..f798af3 100644 --- a/relay-reactjs-chat/src/App.js +++ b/relay-reactjs-chat/src/App.js @@ -1,7 +1,7 @@ import { WakuMessage } from "js-waku"; import * as React from "react"; import protobuf from "protobufjs"; -import { createWaku } from "js-waku/lib/create_waku"; +import { createPrivacyNode } from "js-waku/lib/create_waku"; import { waitForRemotePeer } from "js-waku/lib/wait_for_remote_peer"; const ContentTopic = `/relay-reactjs-chat/1/chat/proto`; @@ -23,7 +23,7 @@ function App() { setWakuStatus("Starting"); (async () => { - const waku = await createWaku({ defaultBootstrap: true }); + const waku = await createPrivacyNode({ defaultBootstrap: true }); setWaku(waku); await waku.start(); From 8e57b8a668ad18e32444d6be93d94ebeb69c9134 Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Thu, 15 Sep 2022 16:35:05 +1000 Subject: [PATCH 10/14] chore(relay-reactjs-chat): bump js-waku to 0.28.0 --- relay-reactjs-chat/package.json | 2 +- relay-reactjs-chat/pnpm-lock.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/relay-reactjs-chat/package.json b/relay-reactjs-chat/package.json index 238c3e2..ad799de 100644 --- a/relay-reactjs-chat/package.json +++ b/relay-reactjs-chat/package.json @@ -7,7 +7,7 @@ "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.3.0", "@testing-library/user-event": "^13.5.0", - "js-waku": "0.27.0", + "js-waku": "0.28.0", "protobufjs": "^7.0.0", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/relay-reactjs-chat/pnpm-lock.yaml b/relay-reactjs-chat/pnpm-lock.yaml index 7909234..d159df5 100644 --- a/relay-reactjs-chat/pnpm-lock.yaml +++ b/relay-reactjs-chat/pnpm-lock.yaml @@ -6,7 +6,7 @@ specifiers: '@testing-library/react': ^13.3.0 '@testing-library/user-event': ^13.5.0 eslint: ^8.22.0 - js-waku: 0.27.0 + js-waku: 0.28.0 protobufjs: ^7.0.0 react: ^18.2.0 react-dom: ^18.2.0 @@ -17,7 +17,7 @@ dependencies: '@testing-library/jest-dom': 5.16.5 '@testing-library/react': 13.3.0_biqbaboplfbrettd7655fr4n2y '@testing-library/user-event': 13.5.0_wl4iynrlixafokvgqnhzlvigei - js-waku: 0.27.0_undici@5.10.0 + js-waku: 0.28.0_undici@5.10.0 protobufjs: 7.0.0 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 @@ -7001,8 +7001,8 @@ packages: /js-tokens/4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} - /js-waku/0.27.0_undici@5.10.0: - resolution: {integrity: sha512-uIh1h2Gu+aEyrGb4qmyk2Sc91in3fMfOil0kdtrps9HnA7ESbC5c6d148LeJaxqH5rfOkrfXXIhw1zwA3hlauw==} + /js-waku/0.28.0_undici@5.10.0: + resolution: {integrity: sha512-MEIFugvio2IaQMQT+g+bn24BvlJ5S4PdSKD0AGVZlR7q1BhECwlpRoytyz0A/hC1+EJWhrZB8cpIAmxwtYWTBw==} engines: {node: '>=16'} dependencies: '@chainsafe/libp2p-gossipsub': 4.1.1_undici@5.10.0 From 2d7989efcadaf302bdda475a016d86e52f6a7f7d Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Thu, 15 Sep 2022 16:39:03 +1000 Subject: [PATCH 11/14] feat(store-js): use `createLightNode` --- store-js/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/store-js/index.html b/store-js/index.html index 169bded..ad29712 100644 --- a/store-js/index.html +++ b/store-js/index.html @@ -17,7 +17,7 @@ Protocols } from 'https://unpkg.com/js-waku@0.27.0/bundle/index.js'; import { - createWaku + createLightNode } from 'https://unpkg.com/js-waku@0.27.0/bundle/lib/create_waku.js' import { waitForRemotePeer @@ -34,7 +34,7 @@ try { timestampDiv.innerHTML = '

Creating waku.

'; - const node = await createWaku({ defaultBootstrap: true }); + const node = await createLightNode({ defaultBootstrap: true }); timestampDiv.innerHTML = '

Starting waku.

'; await node.start(); From 439e6cb708cca083f4355bd084c0097554d31db3 Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Fri, 16 Sep 2022 12:08:53 +1000 Subject: [PATCH 12/14] chore(store-js): bump js-waku to 0.28.0 --- store-js/index.html | 95 +++++++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 51 deletions(-) diff --git a/store-js/index.html b/store-js/index.html index ad29712..28467ee 100644 --- a/store-js/index.html +++ b/store-js/index.html @@ -2,39 +2,38 @@ - - - JS-Waku store script tag example + + + JS-Waku store script tag example -

Timestamp of latest message seen in store

+

Timestamp of the latest message seen in store

From a3fc334f976c2e7e305c0795b02bf17d8d080d46 Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Fri, 16 Sep 2022 12:21:19 +1000 Subject: [PATCH 13/14] chore(store-reactjs-chat): bump js-waku to 0.28.0 --- store-reactjs-chat/package.json | 2 +- store-reactjs-chat/pnpm-lock.yaml | 8 ++--- store-reactjs-chat/src/App.js | 54 ++++++++++++++++++------------- 3 files changed, 36 insertions(+), 28 deletions(-) diff --git a/store-reactjs-chat/package.json b/store-reactjs-chat/package.json index 4396479..21ed09d 100644 --- a/store-reactjs-chat/package.json +++ b/store-reactjs-chat/package.json @@ -7,7 +7,7 @@ "@testing-library/jest-dom": "^5.16.4", "@testing-library/react": "^13.2.0", "@testing-library/user-event": "^14.1.1", - "js-waku": "0.27.0", + "js-waku": "0.28.0", "protobufjs": "^7.1.0", "react": "^18.1.0", "react-dom": "^18.1.0", diff --git a/store-reactjs-chat/pnpm-lock.yaml b/store-reactjs-chat/pnpm-lock.yaml index ba07e88..86e8837 100644 --- a/store-reactjs-chat/pnpm-lock.yaml +++ b/store-reactjs-chat/pnpm-lock.yaml @@ -5,7 +5,7 @@ specifiers: '@testing-library/jest-dom': ^5.16.4 '@testing-library/react': ^13.2.0 '@testing-library/user-event': ^14.1.1 - js-waku: 0.27.0 + js-waku: 0.28.0 protobufjs: ^7.1.0 react: ^18.1.0 react-dom: ^18.1.0 @@ -17,7 +17,7 @@ dependencies: '@testing-library/jest-dom': 5.16.5 '@testing-library/react': 13.3.0_biqbaboplfbrettd7655fr4n2y '@testing-library/user-event': 14.4.2_znfriv3ismgf3ybh2woqwlpfea - js-waku: 0.27.0 + js-waku: 0.28.0 protobufjs: 7.1.0 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 @@ -7375,8 +7375,8 @@ packages: /js-tokens/4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} - /js-waku/0.27.0: - resolution: {integrity: sha512-uIh1h2Gu+aEyrGb4qmyk2Sc91in3fMfOil0kdtrps9HnA7ESbC5c6d148LeJaxqH5rfOkrfXXIhw1zwA3hlauw==} + /js-waku/0.28.0: + resolution: {integrity: sha512-MEIFugvio2IaQMQT+g+bn24BvlJ5S4PdSKD0AGVZlR7q1BhECwlpRoytyz0A/hC1+EJWhrZB8cpIAmxwtYWTBw==} engines: {node: '>=16'} dependencies: '@chainsafe/libp2p-gossipsub': 4.1.1 diff --git a/store-reactjs-chat/src/App.js b/store-reactjs-chat/src/App.js index b96c1bd..7004e87 100644 --- a/store-reactjs-chat/src/App.js +++ b/store-reactjs-chat/src/App.js @@ -55,32 +55,40 @@ function App() { React.useEffect(() => { if (wakuStatus !== "Connected") return; - const processMessages = (retrievedMessages) => { - const messages = retrievedMessages.map(decodeMessage).filter(Boolean); + (async () => { + const startTime = new Date(); + // 7 days/week, 24 hours/day, 60min/hour, 60secs/min, 100ms/sec + startTime.setTime(startTime.getTime() - 7 * 24 * 60 * 60 * 1000); - setMessages((currentMessages) => { - return currentMessages.concat(messages.reverse()); - }); - }; + // TODO: Remove this timeout once https://github.com/status-im/js-waku/issues/913 is done + await new Promise((resolve) => setTimeout(resolve, 200)); - const startTime = new Date(); - // 7 days/week, 24 hours/day, 60min/hour, 60secs/min, 100ms/sec - startTime.setTime(startTime.getTime() - 7 * 24 * 60 * 60 * 1000); - - // TODO: Remove this timeout once https://github.com/status-im/js-waku/issues/913 is done - setTimeout( - () => - waku.store - .queryHistory([ContentTopic], { - callback: processMessages, + try { + for await (const messagesPromises of waku.store.queryGenerator( + [ContentTopic], + { timeFilter: { startTime, endTime: new Date() }, - }) - .catch((e) => { - console.log("Failed to retrieve messages", e); - setWakuStatus("Error Encountered"); - }), - 200 - ); + pageDirection: "forward", + } + )) { + const messages = await Promise.all( + messagesPromises + .map(async (p) => { + const msg = await p; + return decodeMessage(msg); + }) + .filter(Boolean) + ); + + setMessages((currentMessages) => { + return currentMessages.concat(messages.reverse()); + }); + } + } catch (e) { + console.log("Failed to retrieve messages", e); + setWakuStatus("Error Encountered"); + } + })(); }, [waku, wakuStatus]); return ( From e337e2b4f3fe6f7d10582d58e40a256253c74509 Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Fri, 16 Sep 2022 12:28:15 +1000 Subject: [PATCH 14/14] chore(web-chat): bump js-waku to 0.28.0 --- web-chat/package.json | 2 +- web-chat/pnpm-lock.yaml | 8 +++--- web-chat/src/App.tsx | 54 +++++++++++++++++++++++------------------ 3 files changed, 35 insertions(+), 29 deletions(-) diff --git a/web-chat/package.json b/web-chat/package.json index 2cabda2..e7bd707 100644 --- a/web-chat/package.json +++ b/web-chat/package.json @@ -6,7 +6,7 @@ "dependencies": { "@livechat/ui-kit": "^0.5.0-20", "@multiformats/multiaddr": "^10.4.0", - "js-waku": "0.27.0", + "js-waku": "0.28.0", "process": "^0.11.10", "protons-runtime": "^3.1.0", "react": "^17.0.2", diff --git a/web-chat/pnpm-lock.yaml b/web-chat/pnpm-lock.yaml index f3df525..6c8daed 100644 --- a/web-chat/pnpm-lock.yaml +++ b/web-chat/pnpm-lock.yaml @@ -9,7 +9,7 @@ specifiers: '@types/react-dom': ^17.0.11 cspell: ^6.0.0 gh-pages: ^4.0.0 - js-waku: 0.27.0 + js-waku: 0.28.0 npm-run-all: ^4.1.5 prettier: ^2.6.2 process: ^0.11.10 @@ -26,7 +26,7 @@ specifiers: dependencies: '@livechat/ui-kit': 0.5.0-20_ibvs32p3vr2bbtbo3dwziny444 '@multiformats/multiaddr': 10.4.0 - js-waku: 0.27.0 + js-waku: 0.28.0 process: 0.11.10 protons-runtime: 3.1.0_uint8arraylist@2.3.2 react: 17.0.2 @@ -8382,8 +8382,8 @@ packages: /js-tokens/4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} - /js-waku/0.27.0: - resolution: {integrity: sha512-uIh1h2Gu+aEyrGb4qmyk2Sc91in3fMfOil0kdtrps9HnA7ESbC5c6d148LeJaxqH5rfOkrfXXIhw1zwA3hlauw==} + /js-waku/0.28.0: + resolution: {integrity: sha512-MEIFugvio2IaQMQT+g+bn24BvlJ5S4PdSKD0AGVZlR7q1BhECwlpRoytyz0A/hC1+EJWhrZB8cpIAmxwtYWTBw==} engines: {node: '>=16'} dependencies: '@chainsafe/libp2p-gossipsub': 4.1.1 diff --git a/web-chat/src/App.tsx b/web-chat/src/App.tsx index 1bbb34a..cc545e3 100644 --- a/web-chat/src/App.tsx +++ b/web-chat/src/App.tsx @@ -51,19 +51,7 @@ export const ChatContentTopic = "/toy-chat/2/huilong/proto"; async function retrieveStoreMessages( waku: WakuLight, setArchivedMessages: (value: Message[]) => void -): Promise { - const callback = (wakuMessages: WakuMessage[]): void => { - const messages: Message[] = []; - wakuMessages - .map((wakuMsg) => Message.fromWakuMessage(wakuMsg)) - .forEach((message) => { - if (message) { - messages.push(message); - } - }); - setArchivedMessages(messages); - }; - +): Promise { const startTime = new Date(); // Only retrieve a week of history startTime.setTime(Date.now() - 1000 * 60 * 60 * 24 * 7); @@ -71,20 +59,32 @@ async function retrieveStoreMessages( const endTime = new Date(); try { - const res = await waku.store.queryHistory([ChatContentTopic], { - pageSize: 5, - pageDirection: PageDirection.FORWARD, - timeFilter: { - startTime, - endTime, - }, - callback, - }); + for await (const messagesPromises of waku.store.queryGenerator( + [ChatContentTopic], + { + pageSize: 5, + pageDirection: PageDirection.FORWARD, + timeFilter: { + startTime, + endTime, + }, + } + )) { + const messages: Message[] = []; + const wakuMessages = await Promise.all(messagesPromises); - return res.length; + wakuMessages + .filter(isWakuMessageDefined) + .map((wakuMsg) => Message.fromWakuMessage(wakuMsg)) + .forEach((message) => { + if (message) { + messages.push(message); + } + }); + setArchivedMessages(messages); + } } catch (e) { console.log("Failed to retrieve messages", e); - return 0; } } @@ -228,3 +228,9 @@ function selectFleetEnv() { function reduceMessages(state: Message[], newMessages: Message[]) { return state.concat(newMessages); } + +const isWakuMessageDefined = ( + msg: WakuMessage | undefined +): msg is WakuMessage => { + return !!msg; +};