use new api

This commit is contained in:
danisharora099 2023-02-09 12:57:45 +05:30
parent 22ec6ae33b
commit 52c62fea12
No known key found for this signature in database
GPG Key ID: FBD2BF500037F135
2 changed files with 3 additions and 5 deletions

View File

@ -1,8 +1,7 @@
import * as React from "react"; import * as React from "react";
import protobuf from "protobufjs"; import protobuf from "protobufjs";
import { createRelayNode } from "@waku/create"; import { createRelayNode } from "@waku/create";
import { waitForRemotePeer } from "@waku/core"; import { createDecoder, createEncoder, waitForRemotePeer } from "@waku/core";
import { createDecoder, createEncoder } from "@waku/core";
const ContentTopic = `/js-waku-examples/1/chat/proto`; const ContentTopic = `/js-waku-examples/1/chat/proto`;
const Encoder = createEncoder(ContentTopic); const Encoder = createEncoder(ContentTopic);

View File

@ -1,12 +1,11 @@
import * as React from "react"; import * as React from "react";
import protobuf from "protobufjs"; import protobuf from "protobufjs";
import { createLightNode } from "@waku/create"; import { createLightNode } from "@waku/create";
import { waitForRemotePeer } from "@waku/core"; import { waitForRemotePeer, createDecoder } from "@waku/core";
import { Decoder } from "@waku/core/lib/message/version_0";
import { bytesToUtf8 } from "@waku/byte-utils"; import { bytesToUtf8 } from "@waku/byte-utils";
const ContentTopic = "/toy-chat/2/huilong/proto"; const ContentTopic = "/toy-chat/2/huilong/proto";
const decoder = new Decoder(ContentTopic); const decoder = createDecoder(ContentTopic);
const ProtoChatMessage = new protobuf.Type("ChatMessage") const ProtoChatMessage = new protobuf.Type("ChatMessage")
.add(new protobuf.Field("timestamp", 1, "uint64")) .add(new protobuf.Field("timestamp", 1, "uint64"))