chore: upgrade waku sdk (#48)

This commit is contained in:
Sasha 2024-09-19 01:47:57 +02:00 committed by GitHub
parent 602a02cf9e
commit 35b3583dc9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 561 additions and 913 deletions

1455
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@waku/react",
"version": "0.0.6",
"version": "0.0.7",
"description": "React hooks and components to use js-waku",
"type": "module",
"main": "dist/index.cjs.js",
@ -87,8 +87,8 @@
"typescript": "^4.9.5"
},
"peerDependencies": {
"@waku/interfaces": "^0.0.26-ce62600.0",
"@waku/sdk": "^0.0.27-ce62600.0",
"@waku/interfaces": "^0.0.27",
"@waku/sdk": "^0.0.28",
"react": "^16.8.0 || ^17 || ^18"
},
"peerDependenciesMeta": {

View File

@ -58,7 +58,12 @@ export const useFilterMessages = (
let unsubscribe: null | Unsubscribe = null;
setLoading(true);
(node.filter.subscribe([decoder], pushMessage) as Promise<Unsubscribe>)
(
node.filter.subscribeWithUnsubscribe(
[decoder],
pushMessage,
) as Promise<Unsubscribe>
)
.then((unsubscribeFn) => {
setLoading(false);
unsubscribe = unsubscribeFn;

View File

@ -3,7 +3,7 @@ import type {
IDecodedMessage,
IDecoder,
IStoreSDK,
StoreQueryOptions,
QueryRequestParams,
Waku,
} from "@waku/interfaces";
@ -16,7 +16,7 @@ type AbstractStoreNode = Waku & {
type UseStoreMessagesParams = {
node: undefined | AbstractStoreNode;
decoder: undefined | IDecoder<IDecodedMessage>;
options: StoreQueryOptions;
options: QueryRequestParams;
};
type UseStoreMessagesResult = HookState & {
@ -29,7 +29,7 @@ type UseStoreMessagesResult = HookState & {
* const { isLoading, error, messages } = useStoreMessages({node, decoder, options});
* @param {Object} node - node that implement Store, hook does nothing if undefined
* @param {Object} decoder - decoder to use for getting messages, hook does nothing if undefined
* @param {StoreQueryOptions} options - options to initiate query to get messages
* @param {QueryRequestParams} options - options to initiate query to get messages
* @returns {Object} hook state (isLoading, error) and messages array
*/
export const useStoreMessages = (