Crate sn_client

source ·
Expand description

Core functionalities for interacting with the SAFE Network

The sn_client crate is a part of the Safe Network (SN), and plays a crucial role in this ecosystem by serving as the client library that allows applications and users to interact with the Safe Network, and build applications that leverage the Safe Network’s capabilities, providing a high-level API that simplifies the development process.

Here are the key functionalities provided by this crate:

  1. Network Communication: It handles communication with the Safe Network, enabling clients to send and receive messages from the decentralized nodes that make up the network.

  2. Data Storage and Retrieval: to store and retrieve data on the Safe Network. This includes both private and public data, ensuring privacy and security.

  3. Authentication and Access Control: It provides mechanisms for authenticating users and managing access to data, ensuring that only authorized users can access sensitive information.

  4. File Management: The crate supports operations related to file management, such as uploading, downloading, and managing files and directories on the Safe Network.

  5. Token Management: It includes functionality for managing Safe Network tokens, which can be used for various purposes within the network, including paying for storage and services.

Re-exports§

Modules§

Structs§

  • Client API implementation to store and get data.
  • Receiver Channel where users of the public API can listen to events broadcasted by the client.
  • Cached operations made to an offline Register instance are applied locally only, and accumulated until the user explicitly calls ‘sync’. The user can switch back to sync with the network for every op by invoking online API.
  • File APIs.
  • FilesDownload provides functionality for downloading chunks with support for retries and queuing. This struct is not cloneable. To create a new instance with default configuration, use the new function. To modify the configuration, use the provided setter methods (set_... functions).
  • Folders APIs.
  • Metadata to be stored on a Chunk, linked from and belonging to Registers’ entries.
  • A DAG representing the spends from a specific Spend all the way to the UTXOs. Starting from Genesis, this would encompass all the spends that have happened on the network at a certain point in time.
  • The result of the payment made for a set of Content Addresses
  • The set of options to pass into the Uploader
  • The result of a successful upload.
  • A wallet client can be used to send and receive tokens to and from other wallets.

Enums§

  • Type of events broadcasted by the client to the public API.
  • Errors that mean the DAG is invalid
  • Internal error.
  • The events emitted from the download process.
  • Folder Entry representing either a file or subfolder.
  • The result of a get operation on the DAG
  • List of possible faults that can be found in the DAG during verification This indicates a certain spend is invalid and the reason for it but does not mean the DAG is invalid
  • The events emitted from the upload process.

Constants§

  • BATCH_SIZE determines the number of chunks that are processed in parallel during the payment and upload process.

Functions§

  • Use the client to load the faucet wallet from the genesis Wallet. With all balance transferred from the genesis_wallet to the faucet_wallet.
  • Use the client to send a CashNote from a local wallet to an address. This marks the spent CashNote as spent in the Network