mirror of
https://github.com/logos-messaging/waku-react.git
synced 2026-01-04 07:03:07 +00:00
Merge pull request #49 from waku-org/feat/upgrade-js-waku
chore(js-waku): upgrade to 0.29
This commit is contained in:
commit
559159a04e
9434
package-lock.json
generated
9434
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -87,8 +87,7 @@
|
|||||||
"typescript": "^4.9.5"
|
"typescript": "^4.9.5"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@waku/interfaces": "^0.0.27",
|
"@waku/sdk": "^0.0.29",
|
||||||
"@waku/sdk": "^0.0.28",
|
|
||||||
"react": "^16.8.0 || ^17 || ^18"
|
"react": "^16.8.0 || ^17 || ^18"
|
||||||
},
|
},
|
||||||
"peerDependenciesMeta": {
|
"peerDependenciesMeta": {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import type { Waku } from "@waku/interfaces";
|
import type { IWaku } from "@waku/interfaces";
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
BootstrapNodeOptions,
|
BootstrapNodeOptions,
|
||||||
@ -9,9 +9,9 @@ import type {
|
|||||||
} from "./types";
|
} from "./types";
|
||||||
import { useCreateLightNode } from "./useCreateWaku";
|
import { useCreateLightNode } from "./useCreateWaku";
|
||||||
|
|
||||||
type WakuContextType<T extends Waku> = CreateNodeResult<T>;
|
type WakuContextType<T extends IWaku> = CreateNodeResult<T>;
|
||||||
|
|
||||||
const WakuContext = React.createContext<WakuContextType<Waku>>({
|
const WakuContext = React.createContext<WakuContextType<IWaku>>({
|
||||||
node: undefined,
|
node: undefined,
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
error: undefined,
|
error: undefined,
|
||||||
@ -29,7 +29,7 @@ const WakuContext = React.createContext<WakuContextType<Waku>>({
|
|||||||
* const { node, isLoading, error } = useWaku();
|
* const { node, isLoading, error } = useWaku();
|
||||||
* @returns WakuContext
|
* @returns WakuContext
|
||||||
*/
|
*/
|
||||||
export const useWaku = <T extends Waku>(): WakuContextType<T> =>
|
export const useWaku = <T extends IWaku>(): WakuContextType<T> =>
|
||||||
React.useContext(WakuContext) as WakuContextType<T>;
|
React.useContext(WakuContext) as WakuContextType<T>;
|
||||||
|
|
||||||
type ProviderProps<T> = ReactChildrenProps & BootstrapNodeOptions<T>;
|
type ProviderProps<T> = ReactChildrenProps & BootstrapNodeOptions<T>;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { Protocols, Waku } from "@waku/interfaces";
|
import type { IWaku, Protocols } from "@waku/interfaces";
|
||||||
import type { waku } from "@waku/sdk";
|
import type { waku } from "@waku/sdk";
|
||||||
export type { CreateWakuNodeOptions } from "@waku/sdk";
|
export type { CreateWakuNodeOptions } from "@waku/sdk";
|
||||||
|
|
||||||
@ -7,7 +7,7 @@ export type HookState = {
|
|||||||
error: undefined | string;
|
error: undefined | string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CreateNodeResult<T extends Waku> = HookState & {
|
export type CreateNodeResult<T extends IWaku> = HookState & {
|
||||||
node: undefined | T;
|
node: undefined | T;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import type { LightNode, Waku } from "@waku/interfaces";
|
import type { IWaku, LightNode } from "@waku/interfaces";
|
||||||
import { createLightNode, waitForRemotePeer } from "@waku/sdk";
|
import { createLightNode, waitForRemotePeer } from "@waku/sdk";
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
@ -10,11 +10,11 @@ import type {
|
|||||||
|
|
||||||
type NodeFactory<N, T = {}> = (options?: T) => Promise<N>;
|
type NodeFactory<N, T = {}> = (options?: T) => Promise<N>;
|
||||||
|
|
||||||
type CreateNodeParams<N extends Waku, T = {}> = BootstrapNodeOptions<T> & {
|
type CreateNodeParams<N extends IWaku, T = {}> = BootstrapNodeOptions<T> & {
|
||||||
factory: NodeFactory<N, T>;
|
factory: NodeFactory<N, T>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const useCreateNode = <N extends Waku, T = {}>(
|
const useCreateNode = <N extends IWaku, T = {}>(
|
||||||
params: CreateNodeParams<N, T>,
|
params: CreateNodeParams<N, T>,
|
||||||
): CreateNodeResult<N> => {
|
): CreateNodeResult<N> => {
|
||||||
const { factory, options, protocols = [] } = params;
|
const { factory, options, protocols = [] } = params;
|
||||||
|
|||||||
@ -3,13 +3,13 @@ import type {
|
|||||||
IDecodedMessage,
|
IDecodedMessage,
|
||||||
IDecoder,
|
IDecoder,
|
||||||
IFilter,
|
IFilter,
|
||||||
|
IWaku,
|
||||||
Unsubscribe,
|
Unsubscribe,
|
||||||
Waku,
|
|
||||||
} from "@waku/interfaces";
|
} from "@waku/interfaces";
|
||||||
|
|
||||||
import type { HookState } from "./types";
|
import type { HookState } from "./types";
|
||||||
|
|
||||||
type AbstractFilterNode = Waku & {
|
type AbstractFilterNode = IWaku & {
|
||||||
filter: IFilter;
|
filter: IFilter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import type {
|
import type {
|
||||||
IEncoder,
|
IEncoder,
|
||||||
ILightPushSDK,
|
ILightPush,
|
||||||
IMessage,
|
IMessage,
|
||||||
|
IWaku,
|
||||||
SDKProtocolResult,
|
SDKProtocolResult,
|
||||||
Waku,
|
|
||||||
} from "@waku/interfaces";
|
} from "@waku/interfaces";
|
||||||
|
|
||||||
type AbstractLightPushNode = Waku & {
|
type AbstractLightPushNode = IWaku & {
|
||||||
lightPush: ILightPushSDK;
|
lightPush: ILightPush;
|
||||||
};
|
};
|
||||||
|
|
||||||
type UseLightPushParams = {
|
type UseLightPushParams = {
|
||||||
|
|||||||
@ -2,15 +2,15 @@ import React from "react";
|
|||||||
import type {
|
import type {
|
||||||
IDecodedMessage,
|
IDecodedMessage,
|
||||||
IDecoder,
|
IDecoder,
|
||||||
IStoreSDK,
|
IStore,
|
||||||
|
IWaku,
|
||||||
QueryRequestParams,
|
QueryRequestParams,
|
||||||
Waku,
|
|
||||||
} from "@waku/interfaces";
|
} from "@waku/interfaces";
|
||||||
|
|
||||||
import type { HookState } from "./types";
|
import type { HookState } from "./types";
|
||||||
|
|
||||||
type AbstractStoreNode = Waku & {
|
type AbstractStoreNode = IWaku & {
|
||||||
store: IStoreSDK;
|
store: IStore;
|
||||||
};
|
};
|
||||||
|
|
||||||
type UseStoreMessagesParams = {
|
type UseStoreMessagesParams = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user