mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-02 13:53:12 +00:00
17 lines
377 B
TypeScript
17 lines
377 B
TypeScript
|
|
import { createEncoder, LightNode, SDKProtocolResult } from "@waku/sdk";
|
||
|
|
|
||
|
|
export async function pushMessage(
|
||
|
|
waku: LightNode,
|
||
|
|
contentTopic: string,
|
||
|
|
payload?: Uint8Array
|
||
|
|
): Promise<SDKProtocolResult> {
|
||
|
|
const enc = createEncoder({
|
||
|
|
contentTopic
|
||
|
|
});
|
||
|
|
|
||
|
|
const result = await waku.lightPush.send(enc, {
|
||
|
|
payload: payload ?? new Uint8Array()
|
||
|
|
});
|
||
|
|
return result;
|
||
|
|
}
|