1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//! A library to manage wallets for RGB assets.
//!
//! ## Wallet
//! The main component of the library is the [`Wallet`].
//!
//! It allows to create and operate an RGB wallet that can issue, send and receive RGB20 and RGB121
//! assets. The library also manages UTXOs and asset allocations.
//!
//! ## Backend
//! The library uses BDK for walleting operations and several components from the RGB ecosystem for
//! RGB asset operations.
//!
//! ## Database
//! A SQLite database is used to persist data to disk.
//!
//! Database support is designed in order to support multiple database backends. At the moment only
//! SQLite is supported but adding more should be relatively easy.
//!
//! ## Api
//! RGB asset transfers require the exchange of off-chain data in the form of consignment or media
//! files.
//!
//! The library currently implements the API for a proxy server to support these data exchanges
//! between sender and receiver.
//!
//! ## Errors
//! Errors are handled with the crate `thiserror`.
//!
//! ## FFI
//! Library functionality is exposed for other languages via the sub-crate `rgb-lib-ffi`.
//!
//! It uses `uniffi` and the exposed functionality is defined in the `rgb-lib-ffi/src/rgb-lib.udl`
//! file.
//!
//! ## Examples
//! ### Create an RGB wallet
//! ```
//! use rgb_lib::wallet::{DatabaseType, Wallet, WalletData};
//! use rgb_lib::{generate_keys, BitcoinNetwork};
//!
//! fn main() -> Result<(), rgb_lib::Error> {
//! let data_dir = tempdir::TempDir::new("rgb_wallet")?;
//! let keys = generate_keys(BitcoinNetwork::Regtest);
//! let wallet_data = WalletData {
//! data_dir: data_dir.path().to_str().unwrap().to_string(),
//! bitcoin_network: BitcoinNetwork::Regtest,
//! database_type: DatabaseType::Sqlite,
//! pubkey: keys.xpub,
//! mnemonic: Some(keys.mnemonic),
//! };
//! let wallet = Wallet::new(wallet_data)?;
//!
//! Ok(())
//! }
//! ```
extern crate slog;
pub
pub
pub
pub
pub use crate TransferStatus;
pub use crate Error;
pub use crate generate_keys;
pub use crate restore_keys;
pub use crate BitcoinNetwork;
pub use crate Wallet;