Crate fedimint_core

Source
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:

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 implement Display
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 and Decodable 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 for ClientConfig.
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
TransactionId
A transaction id for peg-ins, peg-outs and reissuances

Enums§

BitcoinAmountOrAll
Amount of bitcoin to send, or All to send all available funds
CoreError
ParseAmountError

Constants§

SATS_PER_BITCOIN
WITNESS_SCALE_FACTOR 🔒

Traits§

BitcoinHash
Trait which applies to hashes of all types.
NumPeersExt
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).

Attribute Macros§

apply