577 releases (62 breaking)

new 0.106.3 May 24, 2024
0.106.0-alpha.5 Apr 25, 2024
0.105.2 Mar 28, 2024
0.99.33 Dec 29, 2023
0.44.11 Dec 30, 2020

#361 in Cryptography

Download history 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 3722/week @ 2024-03-21 549/week @ 2024-03-28 565/week @ 2024-04-04 240/week @ 2024-04-11 238/week @ 2024-04-18 282/week @ 2024-04-25 259/week @ 2024-05-02 266/week @ 2024-05-09 20/week @ 2024-05-16

1,009 downloads per month
Used in 6 crates

GPL-3.0 license

1MB
19K 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

~43–85MB
~1.5M SLoC