Merge bitcoindevkit/bdk-ffi#116: Add sqlite database support
12f4784b85fa2a263d9648dcccd8bac2da44644d Add sqlite database option (Steve Myers)
Pull request description:
### Description
Add sqlite db database option.
### Notes to the reviewers
When https://github.com/bitcoindevkit/bdk/pull/566 is released we need to updated this project to use the `sqlite-packaged` feature, see TODO in Cargo.toml.
ACKs for top commit:
thunderbiscuit:
Tested ACK [12f4784](12f4784b85
).
Tree-SHA512: c39472507596e036dd81c22a05d424c6d363545b1a8bd622bf9647967b1b86ab44764da1a15169ac542c80a62a79331b5abcda7b657cc28d93ffdda51a62bd6e
This commit is contained in:
commit
4fc9fb916b
@ -10,7 +10,11 @@ crate-type = ["staticlib", "cdylib"]
|
||||
name = "bdkffi"
|
||||
|
||||
[dependencies]
|
||||
bdk = { version = "0.14", features = ["all-keys", "use-esplora-ureq"] }
|
||||
bdk = { version = "0.14", features = ["all-keys", "use-esplora-ureq", "sqlite"] }
|
||||
|
||||
# TODO remove when bdk "sqlite-bundled" feature added
|
||||
rusqlite = { version = "0.25.3", features = ["bundled"] }
|
||||
|
||||
uniffi_macros = { version = "0.16.0", features = ["builtin-bindgen"] }
|
||||
uniffi = { version = "0.16.0", features = ["builtin-bindgen"] }
|
||||
thiserror = "1.0"
|
||||
|
@ -46,6 +46,7 @@ enum BdkError {
|
||||
"Electrum",
|
||||
"Esplora",
|
||||
"Sled",
|
||||
"Rusqlite",
|
||||
};
|
||||
|
||||
enum Network {
|
||||
@ -60,10 +61,15 @@ dictionary SledDbConfiguration {
|
||||
string tree_name;
|
||||
};
|
||||
|
||||
dictionary SqliteDbConfiguration {
|
||||
string path;
|
||||
};
|
||||
|
||||
[Enum]
|
||||
interface DatabaseConfig {
|
||||
Memory(string junk);
|
||||
Sled(SledDbConfiguration config);
|
||||
Sqlite(SqliteDbConfiguration config);
|
||||
};
|
||||
|
||||
dictionary TransactionDetails {
|
||||
|
@ -6,7 +6,7 @@ use bdk::blockchain::Progress;
|
||||
use bdk::blockchain::{
|
||||
electrum::ElectrumBlockchainConfig, esplora::EsploraBlockchainConfig, ConfigurableBlockchain,
|
||||
};
|
||||
use bdk::database::any::{AnyDatabase, SledDbConfiguration};
|
||||
use bdk::database::any::{AnyDatabase, SledDbConfiguration, SqliteDbConfiguration};
|
||||
use bdk::database::{AnyDatabaseConfig, ConfigurableDatabase};
|
||||
use bdk::keys::bip39::{Language, Mnemonic, WordCount};
|
||||
use bdk::keys::{DerivableKey, ExtendedKey, GeneratableKey, GeneratedKey};
|
||||
@ -24,6 +24,7 @@ type BdkError = Error;
|
||||
pub enum DatabaseConfig {
|
||||
Memory { junk: String },
|
||||
Sled { config: SledDbConfiguration },
|
||||
Sqlite { config: SqliteDbConfiguration },
|
||||
}
|
||||
|
||||
pub struct ElectrumConfig {
|
||||
@ -217,6 +218,7 @@ impl Wallet {
|
||||
let any_database_config = match database_config {
|
||||
DatabaseConfig::Memory { .. } => AnyDatabaseConfig::Memory(()),
|
||||
DatabaseConfig::Sled { config } => AnyDatabaseConfig::Sled(config),
|
||||
DatabaseConfig::Sqlite { config } => AnyDatabaseConfig::Sqlite(config),
|
||||
};
|
||||
let any_blockchain_config = match blockchain_config {
|
||||
BlockchainConfig::Electrum { config } => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user