fedimint_api_client::api

Trait IGlobalFederationApi

source
pub trait IGlobalFederationApi: IRawFederationApi {
Show 29 methods // Required methods fn submit_transaction<'life0, 'async_trait>( &'life0 self, tx: Transaction, ) -> Pin<Box<dyn Future<Output = FederationResult<SerdeModuleEncoding<TransactionSubmissionOutcome>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn await_block<'life0, 'life1, 'async_trait>( &'life0 self, block_index: u64, decoders: &'life1 ModuleDecoderRegistry, ) -> Pin<Box<dyn Future<Output = Result<SessionOutcome>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_session_status<'life0, 'life1, 'async_trait>( &'life0 self, block_index: u64, decoders: &'life1 ModuleDecoderRegistry, ) -> Pin<Box<dyn Future<Output = Result<SessionStatus>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn session_count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = FederationResult<u64>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn await_transaction<'life0, 'async_trait>( &'life0 self, txid: TransactionId, ) -> Pin<Box<dyn Future<Output = FederationResult<TransactionId>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn server_config_consensus_hash<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = FederationResult<Hash>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn upload_backup<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 SignedBackupRequest, ) -> Pin<Box<dyn Future<Output = FederationResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn download_backup<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 PublicKey, ) -> Pin<Box<dyn Future<Output = FederationResult<BTreeMap<PeerId, Option<ClientBackupSnapshot>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn set_password<'life0, 'async_trait>( &'life0 self, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn set_config_gen_connections<'life0, 'async_trait>( &'life0 self, info: ConfigGenConnectionsRequest, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn add_config_gen_peer<'life0, 'async_trait>( &'life0 self, peer: PeerServerParams, ) -> Pin<Box<dyn Future<Output = FederationResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_config_gen_peers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = FederationResult<Vec<PeerServerParams>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_default_config_gen_params<'life0, 'async_trait>( &'life0 self, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<ConfigGenParamsRequest>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn set_config_gen_params<'life0, 'async_trait>( &'life0 self, requested: ConfigGenParamsRequest, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn consensus_config_gen_params<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = FederationResult<ConfigGenParamsResponse>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn run_dkg<'life0, 'async_trait>( &'life0 self, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_verify_config_hash<'life0, 'async_trait>( &'life0 self, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<BTreeMap<PeerId, Hash>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn verified_configs<'life0, 'async_trait>( &'life0 self, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<BTreeMap<PeerId, Hash>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn start_consensus<'life0, 'async_trait>( &'life0 self, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn status<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = FederationResult<StatusResponse>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn audit<'life0, 'async_trait>( &'life0 self, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<AuditSummary>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn guardian_config_backup<'life0, 'async_trait>( &'life0 self, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<GuardianConfigBackup>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn auth<'life0, 'async_trait>( &'life0 self, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn restart_federation_setup<'life0, 'async_trait>( &'life0 self, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn submit_api_announcement<'life0, 'async_trait>( &'life0 self, peer_id: PeerId, announcement: SignedApiAnnouncement, ) -> Pin<Box<dyn Future<Output = FederationResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn api_announcements<'life0, 'async_trait>( &'life0 self, guardian: PeerId, ) -> Pin<Box<dyn Future<Output = PeerResult<BTreeMap<PeerId, SignedApiAnnouncement>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn sign_api_announcement<'life0, 'async_trait>( &'life0 self, api_url: SafeUrl, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<SignedApiAnnouncement>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn shutdown<'life0, 'async_trait>( &'life0 self, session: Option<u64>, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn fedimintd_version<'life0, 'async_trait>( &'life0 self, peer_id: PeerId, ) -> Pin<Box<dyn Future<Output = PeerResult<String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait;
}
Expand description

The API for the global (non-module) endpoints

Required Methods§

source

fn submit_transaction<'life0, 'async_trait>( &'life0 self, tx: Transaction, ) -> Pin<Box<dyn Future<Output = FederationResult<SerdeModuleEncoding<TransactionSubmissionOutcome>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn await_block<'life0, 'life1, 'async_trait>( &'life0 self, block_index: u64, decoders: &'life1 ModuleDecoderRegistry, ) -> Pin<Box<dyn Future<Output = Result<SessionOutcome>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn get_session_status<'life0, 'life1, 'async_trait>( &'life0 self, block_index: u64, decoders: &'life1 ModuleDecoderRegistry, ) -> Pin<Box<dyn Future<Output = Result<SessionStatus>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn session_count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = FederationResult<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn await_transaction<'life0, 'async_trait>( &'life0 self, txid: TransactionId, ) -> Pin<Box<dyn Future<Output = FederationResult<TransactionId>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn server_config_consensus_hash<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = FederationResult<Hash>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fetches the server consensus hash if enough peers agree on it

source

fn upload_backup<'life0, 'life1, 'async_trait>( &'life0 self, request: &'life1 SignedBackupRequest, ) -> Pin<Box<dyn Future<Output = FederationResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn download_backup<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 PublicKey, ) -> Pin<Box<dyn Future<Output = FederationResult<BTreeMap<PeerId, Option<ClientBackupSnapshot>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source

fn set_password<'life0, 'async_trait>( &'life0 self, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sets the password used to decrypt the configs and authenticate

Must be called first before any other calls to the API

source

fn set_config_gen_connections<'life0, 'async_trait>( &'life0 self, info: ConfigGenConnectionsRequest, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

During config gen, sets the server connection containing our endpoints

Optionally sends our server info to the config gen leader using add_config_gen_peer

source

fn add_config_gen_peer<'life0, 'async_trait>( &'life0 self, peer: PeerServerParams, ) -> Pin<Box<dyn Future<Output = FederationResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

During config gen, used for an API-to-API call that adds a peer’s server connection info to the leader.

Note this call will fail until the leader has their API running and has set_server_connections so clients should retry.

This call is not authenticated because it’s guardian-to-guardian

source

fn get_config_gen_peers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = FederationResult<Vec<PeerServerParams>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

During config gen, gets all the server connections we’ve received from peers using add_config_gen_peer

Could be called on the leader, so it’s not authenticated

source

fn get_default_config_gen_params<'life0, 'async_trait>( &'life0 self, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<ConfigGenParamsRequest>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the default config gen params which can be configured by the leader, gives them a template to modify

source

fn set_config_gen_params<'life0, 'async_trait>( &'life0 self, requested: ConfigGenParamsRequest, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Leader sets the consensus params, everyone sets the local params

After calling this ConfigGenParams can be created for DKG

source

fn consensus_config_gen_params<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = FederationResult<ConfigGenParamsResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the consensus config gen params, followers will delegate this call to the leader. Once this endpoint returns successfully we can run DKG.

source

fn run_dkg<'life0, 'async_trait>( &'life0 self, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Runs DKG, can only be called once after configs have been generated in get_consensus_config_gen_params. If DKG fails this returns a 500 error and config gen must be restarted.

source

fn get_verify_config_hash<'life0, 'async_trait>( &'life0 self, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<BTreeMap<PeerId, Hash>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

After DKG, returns the hash of the consensus config tweaked with our id. We need to share this with all other peers to complete verification.

source

fn verified_configs<'life0, 'async_trait>( &'life0 self, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<BTreeMap<PeerId, Hash>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Updates local state and notify leader that we have verified configs. This allows for a synchronization point, before we start consensus.

source

fn start_consensus<'life0, 'async_trait>( &'life0 self, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Reads the configs from the disk, starts the consensus server, and shuts down the config gen API to start the Fedimint API

Clients may receive an error due to forced shutdown, should call the server_status to see if consensus has started.

source

fn status<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = FederationResult<StatusResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the status of the server

source

fn audit<'life0, 'async_trait>( &'life0 self, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<AuditSummary>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Show an audit across all modules

source

fn guardian_config_backup<'life0, 'async_trait>( &'life0 self, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<GuardianConfigBackup>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Download the guardian config to back it up

source

fn auth<'life0, 'async_trait>( &'life0 self, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check auth credentials

source

fn restart_federation_setup<'life0, 'async_trait>( &'life0 self, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn submit_api_announcement<'life0, 'async_trait>( &'life0 self, peer_id: PeerId, announcement: SignedApiAnnouncement, ) -> Pin<Box<dyn Future<Output = FederationResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Publish our signed API announcement to other guardians

source

fn api_announcements<'life0, 'async_trait>( &'life0 self, guardian: PeerId, ) -> Pin<Box<dyn Future<Output = PeerResult<BTreeMap<PeerId, SignedApiAnnouncement>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn sign_api_announcement<'life0, 'async_trait>( &'life0 self, api_url: SafeUrl, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<SignedApiAnnouncement>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn shutdown<'life0, 'async_trait>( &'life0 self, session: Option<u64>, auth: ApiAuth, ) -> Pin<Box<dyn Future<Output = FederationResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source

fn fedimintd_version<'life0, 'async_trait>( &'life0 self, peer_id: PeerId, ) -> Pin<Box<dyn Future<Output = PeerResult<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the fedimintd version a peer is running

Trait Implementations§

source§

impl AsRef<dyn IGlobalFederationApi> for DynGlobalApi

source§

fn as_ref(&self) -> &(dyn IGlobalFederationApi + 'static)

Converts this type into a shared reference of the (usually inferred) input type.

Implementors§