Skip to content

Commit

Permalink
chore: display peer ID in dogfooding app (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
weboko authored Oct 1, 2024
1 parent eb13f3e commit 5f4b912
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions examples/dogfooding/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<div>
<h3>Waku Dogfooding App</h3>
<div id="runningScreen" style="display: none">
<label for="wallet">Wallet Address:</label>
<span id="wallet"></span>
<label for="peerID">Your peer ID:</label>
<span id="peerID"></span>
<br />
<label for="numSent">Messages Sent:</label>
<span id="numSent">0</span>
Expand Down
7 changes: 6 additions & 1 deletion examples/dogfooding/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ const wakuNode = async (): Promise<LightNode> => {
export async function app(telemetryClient: TelemetryClient) {
const node = await wakuNode();
(window as any).waku = node;

console.log("DEBUG: your peer ID is:", node.libp2p.peerId.toString());

await node.start();
await waitForRemotePeer(node);
Expand Down Expand Up @@ -324,10 +326,13 @@ export async function app(telemetryClient: TelemetryClient) {

(async () => {
const telemetryClient = new TelemetryClient(TELEMETRY_URL, 5000);
const { startLightPushSequence, startFilterSubscription } = await app(
const { node, startLightPushSequence, startFilterSubscription } = await app(
telemetryClient
);

const peerIDBlock = document.getElementById("peerID");
peerIDBlock.innerText = node.libp2p.peerId.toString();

const runningScreen = document.getElementById("runningScreen");
runningScreen.style.display = "block";

Expand Down

0 comments on commit 5f4b912

Please sign in to comment.