Skip to main content

Crate hopr_api

Crate hopr_api 

Source
Expand description

§hopr-api

Crates.io docs.rs Security License MSRV Crates.io Downloads

Common high-level API traits for the HOPR protocol.

This crate defines the public API surface as traits only — no concrete implementations. Implementations live in the main hoprnet repository.

§Getting started

Choose the smallest feature set you need:

[dependencies]
hopr-api = { version = "1.7.0", features = ["chain", "network"] }

or enable the complete API surface:

[dependencies]
hopr-api = { version = "1.7.0", features = ["full"] }

Then import the traits your component implements:

use hopr_api::chain::{ChainReadAccountOperations, ChainValues};
use hopr_api::network::NetworkView;

§Modules

All modules are feature-gated:

FeatureModuleDescription
chainchainOn-chain operation APIs (accounts, channels, tickets…)
ctctCover traffic and probing API traits
graphgraphNetwork graph topology, QoS, routing costs
networknetworkNetwork state, peer observations, connectivity
nodenodeHigh-level HOPR node API traits and state machine
node-session-clientnode::sessionSession client for establishing HOPR sessions
node-session-servernode::sessionSession server for processing incoming sessions
ticketsticketsWinning ticket management and redemption
fullallEnables all of the above + serde

§Usage

[dependencies]
hopr-api = { version = "1.7.0", features = ["full"] }

§Development

Requires Nix with flakes enabled.

# Enter development shell
nix develop

# Build
cargo build

# Test
cargo test --lib

# Lint
cargo clippy

# Format
nix fmt

§License

GPL-3.0-only

Re-exports§

pub use hopr_types as types;

Structs§

Address
Represents an Ethereum address
ChainKeypair
Represents a keypair consisting of a secp256k1 private and public key
Multiaddr
Representation of a Multiaddr.
OffchainKeypair
Represents a keypair consisting of an Ed25519 private and public key
OffchainPublicKey
Represents an Ed25519 public key.
PeerId
Identifier of a peer of the network.
WxHOPR
Represents wxHOPR token Currency.
XDai
Represents xDai coin Currency.

Type Aliases§

HoprBalance
Balance denominated in wxHOPR (wrapped xHOPR) tokens.
XDaiBalance
Balance denominated in xDai (native gas token).