Expand description
Builder module for the Hopr object.
Type-state builder for constructing a Hopr node.
The builder guides construction through a series of mandatory phases:
- Identity —
HoprBuilder→HoprBuilder::with_identity - Configuration —
HoprBuilderWithIdentity::with_config - Component factories — chain API, graph, network, and cover-traffic
- Session server (when the
session-serverfeature is enabled) —HoprBuilderConfigured::with_session_server - Build —
build_edgefor an entry/exit node orbuild_fullfor a relay node with ticket management.
§Example
ⓘ
use hopr_lib::{config::HoprLibConfig, builder::{HoprBuilder, ChainKeypair, OffchainKeypair, Keypair}};
let chain_key = ChainKeypair::random();
let offchain_key = OffchainKeypair::random();
let config = HoprLibConfig::default();
let builder = HoprBuilder
.with_identity(&chain_key, &offchain_key)
.with_config(config)
.with_chain_api(|_ctx| { /* ... */ todo!() })
.with_graph(|_ctx| { /* ... */ todo!() })
.with_network(|_ctx| Box::pin(async { /* ... */ todo!() }))
.with_cover_traffic(|_ctx| { /* ... */ todo!() });Macros§
Structs§
- Build
Ctx - Context available to factory closures during the build step.
- Chain
Keypair - Represents a keypair consisting of a secp256k1 private and public key
- Hopr
Builder - Initial builder — forces
with_identityfirst. - Hopr
Builder Configured - Configured builder accepting factory closures for components.
- Hopr
Builder With Identity - Builder with identity set — forces
with_confignext. - Hopr
Builder With Session - Builder with a session server attached. Has
build_edge/build_full. - METRIC_
HOPR_ 🔒LIB_ VERSION - METRIC_
HOPR_ 🔒NODE_ INFO - METRIC_
PROCESS_ 🔒START_ TIME - Offchain
Keypair - Represents a keypair consisting of an Ed25519 private and public key
- PreHopr 🔒
Traits§
- Keypair
- Represents a generic key pair The keypair contains a private key and public key. Must be comparable in constant time and zeroized on drop.
Functions§
Type Aliases§
- Async
Factory 🔒 - Factory 🔒
- Type-erased factory closure producing
Tfrom aBuildCtxreference.