Skip to content

Commit

Permalink
feat(autonomi): expose inner MerkleReg type
Browse files Browse the repository at this point in the history
  • Loading branch information
b-zee committed Nov 11, 2024
1 parent 84dd8a4 commit 3f0e48e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions autonomi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ extension-module = ["pyo3/extension-module"]
bip39 = "2.0.0"
bls = { package = "blsttc", version = "8.0.1" }
bytes = { version = "1.0.1", features = ["serde"] }
crdts = { version = "7.3", default-features = false, features = ["merkle"] }
curv = { version = "0.10.1", package = "sn_curv", default-features = false, features = [
"num-bigint",
] }
Expand Down
7 changes: 7 additions & 0 deletions autonomi/src/client/registers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/// Register Secret Key
pub use bls::SecretKey as RegisterSecretKey;
use crdts::merkle_reg::MerkleReg;
use sn_evm::Amount;
use sn_evm::AttoTokens;
use sn_evm::EvmWalletError;
Expand Down Expand Up @@ -78,6 +79,12 @@ impl Register {
.collect()
}

/// Get the low-level CRDT of the register
pub fn inner_merkle_reg(&self) -> &MerkleReg<Vec<u8>> {
// Unstable method according to documentation.
self.crdt_reg.merkle_reg()
}

fn new(
initial_value: Option<Bytes>,
name: XorName,
Expand Down
2 changes: 2 additions & 0 deletions autonomi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ pub use utils::receipt_from_quotes_and_payments;
#[doc(no_inline)] // Place this under 'Re-exports' in the docs.
pub use bytes::Bytes;
#[doc(no_inline)] // Place this under 'Re-exports' in the docs.
pub use crdts::merkle_reg::MerkleReg;
#[doc(no_inline)] // Place this under 'Re-exports' in the docs.
pub use libp2p::Multiaddr;

pub use client::Client;
Expand Down

0 comments on commit 3f0e48e

Please sign in to comment.