560 releases (61 breaking)

new 0.105.2 Mar 28, 2024
0.104.31 Mar 21, 2024
0.99.33 Dec 29, 2023
0.98.23 Nov 29, 2023
0.44.11 Dec 30, 2020

#79 in Cryptography

Download history 359/week @ 2023-12-07 258/week @ 2023-12-14 108/week @ 2023-12-21 210/week @ 2023-12-28 431/week @ 2024-01-04 589/week @ 2024-01-11 512/week @ 2024-01-18 280/week @ 2024-01-25 264/week @ 2024-02-01 485/week @ 2024-02-08 1567/week @ 2024-02-15 578/week @ 2024-02-22 296/week @ 2024-02-29 254/week @ 2024-03-07 2865/week @ 2024-03-14 3675/week @ 2024-03-21

7,218 downloads per month
Used in 6 crates

GPL-3.0 license

1MB
17K SLoC

sn_client - SAFE Network Client Library

Overview

The sn_client library provides the core functionalities for interacting with the SAFE Network. It handles tasks such as connecting to the network, managing concurrency, and performing various network operations like data storage and retrieval.

Table of Contents

Installation

To include sn_client in your Rust project, add the following to your Cargo.toml:

[dependencies]
sn_client = "latest_version_here"

Usage

To use sn_client, you first need to instantiate a client. Here's a simple example:

use sn_client::Client;
let client = Client::new(signer, peers, req_response_timeout, custom_concurrency_limit).await?;

API Calls

new

  • Description: Instantiate a new client.
  • Parameters:
    • signer: SecretKey
    • peers: Option<Vec<Multiaddr>>
    • req_response_timeout: Option<Duration>
    • custom_concurrency_limit: Option<usize>
  • Returns: Result<Self>

get_signed_register_from_network

  • Description: Get a register from the network.
  • Parameters: address: RegisterAddress
  • Returns: Result<SignedRegister>

get_register

  • Description: Retrieve a Register from the network.
  • Parameters: address: RegisterAddress
  • Returns: Result<ClientRegister>

create_register

  • Description: Create a new Register on the Network.
  • Parameters:
    • meta: XorName
    • verify_store: bool
  • Returns: Result<ClientRegister>

store_chunk

  • Description: Store Chunk as a record.
  • Parameters:
    • chunk: Chunk
    • payment: Vec<CashNote>
    • verify_store: bool
  • Returns: Result<()>

get_chunk

  • Description: Retrieve a Chunk from the kad network.
  • Parameters: address: ChunkAddress
  • Returns: Result<Chunk>

network_store_spend

  • Description: Send a SpendCashNote request to the network.
  • Parameters:
    • spend: SpendRequest
    • verify_store: bool
  • Returns: Result<()>

get_spend_from_network

  • Description: Get a cash_note spend from the network.
  • Parameters: cash_note_id: &CashNoteId
  • Returns: Result<SignedSpend>

get_store_cost_at_address

  • Description: Get the store cost at a given address.
  • Parameters: address: &NetworkAddress
  • Returns: Result<(PublicAddress, Token)>

Contributing

Please refer to the Contributing Guidelines from the main directory for details on how to contribute to this project.

Conventional Commits

We follow the Conventional Commits specification for commit messages. Please adhere to this standard when contributing.

License

This Safe Network repository is licensed under the General Public License (GPL), version 3 (LICENSE http://www.gnu.org/licenses/gpl-3.0.en.html).

Dependencies

~32–76MB
~1.5M SLoC