851f61296a16fb9dfbcad00e3e3f11331a56eb12 Fix Wallet.broadcast function, now returns a tx id as a hex string (Steve Myers)
Pull request description:
ACKs for top commit:
thunderbiscuit:
Tested ACK 851f612.
Tree-SHA512: 86e1d39029924e4fa3a0c21e9f45c1ba0694f4db9d1cfd8dee25a5675d5a8b7851a7c712ce57fb74382a7428fcecbe8ecee4b7b87b9245672bbd6ccea63dfc13
cc3736809a2910d3a739b37a61f1613404fba572 Fix memory database configuration enum (thunderbiscuit)
Pull request description:
The `DatabaseConfig.Memory` enum currently requires a "junk" string argument which is not used when creating the wallet:
```rust
// lib.rs line 24
pub enum DatabaseConfig {
Memory { junk: String },
Sled { config: SledDbConfiguration },
}
// lib.rs line 209
impl Wallet {
fn new(
descriptor: String,
change_descriptor: Option<String>,
network: Network,
database_config: DatabaseConfig,
blockchain_config: BlockchainConfig,
) -> Result<Self, BdkError> {
let any_database_config = match database_config {
DatabaseConfig::Memory { .. } => AnyDatabaseConfig::Memory(()),
DatabaseConfig::Sled { config } => AnyDatabaseConfig::Sled(config),
};
```
Which translates to the udl file like this:
```txt
[Enum]
interface DatabaseConfig {
Memory(string junk);
Sled(SledDbConfiguration config);
};
```
According to the [docs from uniffi-rs](https://mozilla.github.io/uniffi-rs/udl/enumerations.html) the `interface` here is required because the enums have named fields. But after testing I found that we can declare the udl file like so, and remove the requirement for the `junk` argument:
```txt
[Enum]
interface DatabaseConfig {
Memory();
Sled(SledDbConfiguration config);
};
```
On the Rust side we then have
```rust
pub enum DatabaseConfig {
Memory,
Sled { config: SledDbConfiguration },
}
```
And the resulting bindings go from (note that the bindings transform the enum into a sealed class rather than a Kotlin enum)
```kotlin
sealed class DatabaseConfig {
data class Memory(
val junk: String
) : DatabaseConfig()
data class Sled(
val config: SledDbConfiguration
) : DatabaseConfig()
```
to
```kotlin
sealed class DatabaseConfig {
object Memory : DatabaseConfig()
data class Sled(
val config: SledDbConfiguration
) : DatabaseConfig()
```
Which makes the API simpler to use, and removes the confusion created by having to provide an empty string (or not know what we're supposed to provide) to the `Memory()` enum.
The final call-site looks like this:
```kotlin
fun onlineWalletSyncGetBalance() {
// val db = DatabaseConfig.Memory("")
val db = DatabaseConfig.Memory
val client = BlockchainConfig.Electrum(
ElectrumConfig(
"ssl://electrum.blockstream.info:60002",
null,
5u,
null,
100u
)
)
val wallet = Wallet(descriptor, null, Network.REGTEST, databaseConfig, blockchainConfig)
wallet.sync(LogProgress(), null)
val balance = wallet.getBalance()
assertTrue(balance > 0u)
}
```
All tests run well on my side of things, but I'm opening this more as a discussion piece because I wasn't sure if there were other reasons for the choice of providing the argument to the `Memory` enum, or other design choices I'm not aware of. Any thoughts on this @artfuldev? I think you were the one who wrote the initial enum.
Top commit has no ACKs.
Tree-SHA512: 135e5943039a08522773f721a7cf6bbb93bd5bb9394bf42a30bab5f3e16fd35ce078056756e020a666d4f574d74080bc3404cc81809c0d7e0afe5c9471878425
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
f3c6d97d818788abf562d116745effca3c734c9b Add license files (Steve Myers)
d17ea4b90c015c9a6cf5d2cf2f77e901d93fd089 Bump version to 0.3.0 (Steve Myers)
76fa9b95219945c8b92186c860e83270d0e95842 Add CHANGELOG.md (Steve Myers)
Pull request description:
This issue is based on https://github.com/bitcoindevkit/bdk/issues/301, to be clear we should add license files to all our repositories.
If you're on the below list and agree with this change please add a comment with "I hereby license my previous contributions to BDK under [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) and [MIT](https://choosealicense.com/licenses/mit/) licenses."
- [x] @artfuldev
- [x] @notmandatory
- [x] @afilini
- [x] @thunderbiscuit
Top commit has no ACKs.
Tree-SHA512: 7e0f2c7bf93d1cdb28cec979330790e00c1efd3ce80986e9084bc371fa73eda6413014e3ad8e598ca6ce1f797622dbfbe8339453de8d7ebefbb27fd5204bc4c6
c039281ffcbaab8048ff87426a413c953a1e5ece Add PSBT deserialize and serialize functions, remove details (Steve Myers)
1f0b053872889f5dff340035a9e3cd3488688152 Fix bin/generate with no features (Steve Myers)
Pull request description:
1. Fix bin/generate with no features
2. Add `PartiallySignedBitcoinTransaction::deserialize` function as named constructor to decode from a string per [BIP 0174]
3. Add `PartiallySignedBitcoinTransaction::serialize` function to encode to a string per [BIP 0174]
4. Remove `PartiallySignedBitcoinTransaction.details` struct field
[BIP 0174]:https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki#encodingFixes#103
Top commit has no ACKs.
Tree-SHA512: 0ba34d96625d71434d41573089a150d09fcfb6439648a7eed6e36dcdddd2682c969525b7c6efda898b2f979a7ca6ce51dc2158acf65da7f1f4c554d98b60f4ff