Expand description
Fedimint Core library
fedimint-core
contains commonly used types, utilities and primitives,
shared between both client and server code.
Things that are server-side only typically live in fedimint-server
, and
client-side only in fedimint-client
.
§Wasm support
All code in fedimint-core
needs to compile on Wasm, and fedimint-core
includes helpers and wrappers around non-wasm-safe utitlies.
In particular:
fedimint_core::task
for task spawning and controlfedimint_core::time
for time-related operations
Re-exports§
pub use tiered::Tiered;
pub use anyhow;
pub use bitcoin;
pub use hex;
pub use secp256k1;
pub use tiered_multi::*;
Modules§
- admin_
client - Admin (guardian) client types
- amount 🔒
- Bitcoin amount types
- backup
- Federation-stored client backups Federation-stored client backups
- bls12_
381_ serde - Legacy serde encoding for
bls12_381
- config
- Federation configuration
- core
- Fundamental types Fedimint Core API (common) module interface
- db
- Database handling Core Fedimint database traits and types
- encoding
- Consensus encoding Binary encoding interface suitable for consensus critical encoding.
- endpoint_
constants - envs
- Common environment variables
- epoch
- fmt_
utils - Formatting helpers
- invite_
code - Federation invite code
- macros
- Common macros
- module
- Extendable module sysystem Core module system traits and types.
- net
- Peer networking
- peer_id 🔒
PeerId
type- runtime
- Runtime (wasm32 vs native) differences handling Copyright 2021 The Matrix.org Foundation C.I.C. Abstraction over an executor so we can spawn tasks under WASM the same way we do usually.
- session_
outcome - Atomic BFT unit containing consensus items
- task
- Task handling, including wasm safe logic
- tiered
- Types handling per-denomination values
- tiered_
multi - Types handling multiple per-denomination values
- time
- Time handling, wasm safe functionality
- timing
- Timing helpers
- transaction
- Fedimint transaction (inpus + outputs + signature) types
- txid 🔒
- txoproof
- Peg-in txo proofs
- util
- General purpose utilities
- version
- Version
Macros§
- __
api_ endpoint - Example
- _dyn_
newtype_ define_ inner - _dyn_
newtype_ define_ with_ instance_ id_ inner - _dyn_
newtype_ impl_ deref_ mut - async_
trait_ maybe_ send - async trait that use MaybeSend
- deserialize_
as_ encodable_ hex - dyn_
newtype_ define - Define “dyn newtype” (a newtype over
dyn Trait
) - dyn_
newtype_ display_ passthrough - Implements the
Display
trait for dyn newtypes whose traits implementDisplay
- dyn_
newtype_ impl_ dyn_ clone_ passthrough - Implement
Clone
on a “dyn newtype” - erased_
eq_ no_ instance_ id - extensible_
associated_ module_ type - Macro for defining module associated types.
- fedimint_
build_ code_ version_ env - Get value of
FEDIMINT_BUILD_CODE_VERSION
at compile time - impl_
db_ lookup - impl_
db_ record - This is a helper macro that generates the implementations of
DatabaseRecord
necessary for reading/writing to the database and fetching by prefix. - maybe_
add_ send - MaybeSync can not be used in
dyn $Trait + MaybeSend
- maybe_
add_ send_ sync - See
maybe_add_send
- module_
plugin_ dyn_ newtype_ clone_ passthrough - module_
plugin_ dyn_ newtype_ define - Define a “module plugin dyn-newtype” which is like a standard “dyn newtype”, but with associated “module_instance_id”.
- module_
plugin_ dyn_ newtype_ display_ passthrough - module_
plugin_ dyn_ newtype_ encode_ decode - Implement
Encodable
andDecodable
for a “module dyn newtype” - module_
plugin_ dyn_ newtype_ eq_ passthrough - module_
plugin_ static_ trait_ define - Define a “plugin” trait
- module_
plugin_ static_ trait_ define_ config - A copy of
module_lugin_static_trait_define
but forClientConfig
. - plugin_
types_ trait_ impl_ common - Implements the necessary traits for all associated types of a
FederationServer
module. - plugin_
types_ trait_ impl_ config - Implements the necessary traits for all configuration related types of a
FederationServer
module. - push_
db_ key_ items - push_
db_ pair_ items - serde_
as_ encodable_ hex - serialize_
as_ encodable_ hex
Structs§
- Amount
- Represents an amount of BTC. The base denomination is millisatoshis, which
is why the
Amount
type from rust-bitcoin isn’t used instead. - Feerate
- NumPeers
- The number of guardians in a federation.
- OutPoint
OutPoint
represents a globally unique output in a transaction- PeerId
- Transaction
Id - A transaction id for peg-ins, peg-outs and reissuances
Enums§
- Bitcoin
Amount OrAll - Amount of bitcoin to send, or
All
to send all available funds - Core
Error - Parse
Amount Error
Constants§
Traits§
- Bitcoin
Hash - Trait which applies to hashes of all types.
- NumPeers
Ext - Types that can be easily converted to
NumPeers
Functions§
- encode_
bolt11_ invoice_ features_ without_ length - format_
hex - Outputs hex into an object implementing
fmt::Write
. - get_
network_ for_ address - Gets the (approximate) network from a bitcoin address.
- msats
- Shorthand for
Amount::from_msats
- sats
- Shorthand for
Amount::from_sats
- weight_
to_ vbytes - Converts weight to virtual bytes, defined in BIP-141 as weight / 4 (rounded up to the next integer).