simplify and rename ILightPush interface

This commit is contained in:
Sasha 2024-10-02 00:12:33 +02:00
parent 7580eeb110
commit 800eae20ff
No known key found for this signature in database
4 changed files with 10 additions and 11 deletions

View File

@ -1,5 +1,4 @@
import { IBaseProtocolCore, IBaseProtocolSDK } from "./protocols.js";
import { IBaseProtocolCore } from "./protocols.js";
import type { ISender } from "./sender.js";
export type ILightPushSDK = ISender &
IBaseProtocolSDK & { protocol: IBaseProtocolCore };
export type ILightPush = ISender & { protocol: IBaseProtocolCore };

View File

@ -5,7 +5,7 @@ import { IConnectionManager } from "./connection_manager.js";
import type { IFilterSDK } from "./filter.js";
import { IHealthManager } from "./health_manager.js";
import type { Libp2p } from "./libp2p.js";
import type { ILightPushSDK } from "./light_push.js";
import type { ILightPush } from "./light_push.js";
import { Protocols } from "./protocols.js";
import type { IRelay } from "./relay.js";
import type { IStoreSDK } from "./store.js";
@ -15,7 +15,7 @@ export interface Waku {
relay?: IRelay;
store?: IStoreSDK;
filter?: IFilterSDK;
lightPush?: ILightPushSDK;
lightPush?: ILightPush;
connectionManager: IConnectionManager;
@ -36,7 +36,7 @@ export interface LightNode extends Waku {
relay: undefined;
store: IStoreSDK;
filter: IFilterSDK;
lightPush: ILightPushSDK;
lightPush: ILightPush;
}
export interface RelayNode extends Waku {

View File

@ -3,7 +3,7 @@ import { ConnectionManager, LightPushCore } from "@waku/core";
import {
Failure,
type IEncoder,
ILightPushSDK,
ILightPush,
type IMessage,
type Libp2p,
type ProtocolCreateOptions,
@ -19,7 +19,7 @@ import { BaseProtocolSDK } from "../base_protocol.js";
const log = new Logger("sdk:light-push");
class LightPushSDK extends BaseProtocolSDK implements ILightPushSDK {
class LightPushSDK extends BaseProtocolSDK implements ILightPush {
public readonly protocol: LightPushCore;
private readonly reliabilityMonitor: SenderReliabilityMonitor;
@ -131,6 +131,6 @@ class LightPushSDK extends BaseProtocolSDK implements ILightPushSDK {
export function wakuLightPush(
connectionManager: ConnectionManager,
init: Partial<ProtocolCreateOptions> = {}
): (libp2p: Libp2p) => ILightPushSDK {
): (libp2p: Libp2p) => ILightPush {
return (libp2p: Libp2p) => new LightPushSDK(connectionManager, libp2p, init);
}

View File

@ -5,7 +5,7 @@ import { ConnectionManager, getHealthManager } from "@waku/core";
import type {
IFilterSDK,
IHealthManager,
ILightPushSDK,
ILightPush,
IRelay,
IStoreSDK,
Libp2p,
@ -64,7 +64,7 @@ export class WakuNode implements Waku {
public relay?: IRelay;
public store?: IStoreSDK;
public filter?: IFilterSDK;
public lightPush?: ILightPushSDK;
public lightPush?: ILightPush;
public connectionManager: ConnectionManager;
public readonly health: IHealthManager;