-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: remove relay from sdk package (#2040)
* remove full node * remove relay from sdk * comment node counter check * try using logline * up comment
- Loading branch information
Showing
27 changed files
with
446 additions
and
483 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import type { RelayNode } from "@waku/interfaces"; | ||
import { | ||
createLibp2pAndUpdateOptions, | ||
CreateWakuNodeOptions, | ||
WakuNode, | ||
WakuOptions | ||
} from "@waku/sdk"; | ||
|
||
import { RelayCreateOptions, wakuGossipSub, wakuRelay } from "./relay.js"; | ||
|
||
/** | ||
* Create a Waku node that uses Waku Relay to send and receive messages, | ||
* enabling some privacy preserving properties. | ||
* * @remarks | ||
* This function creates a Relay Node using the Waku Relay protocol. | ||
* While it is technically possible to use this function in a browser environment, | ||
* it is not recommended due to potential performance issues and limited browser capabilities. | ||
* If you are developing a browser-based application, consider alternative approaches like creating a Light Node | ||
* or use this function with caution. | ||
*/ | ||
export async function createRelayNode( | ||
options: CreateWakuNodeOptions & Partial<RelayCreateOptions> | ||
): Promise<RelayNode> { | ||
options = { | ||
...options, | ||
libp2p: { | ||
...options.libp2p, | ||
services: { | ||
pubsub: wakuGossipSub(options) | ||
} | ||
} | ||
}; | ||
|
||
const { libp2p, pubsubTopics } = await createLibp2pAndUpdateOptions(options); | ||
const relay = wakuRelay(pubsubTopics || [])(libp2p); | ||
|
||
return new WakuNode( | ||
pubsubTopics, | ||
options as WakuOptions, | ||
libp2p, | ||
{}, | ||
relay | ||
) as RelayNode; | ||
} |
Oops, something went wrong.