295 Commits

Author SHA1 Message Date
Steve Myers
a25fb1348d
Merge bitcoindevkit/bdk-ffi#208: Add FeeRate struct and PSBT fee_amount and fee_rate functions
ae1ea99ed3f26f33ead92d4a91588ae32d9e110b Add FeeRate struct and fee_amount() and fee_rate() functions on PartiallySignedTransaction (Steve Myers)
9a381f6d32321f2a726092bd2b54ab10d105e9c6 Rename PartiallySignedBitcoinTransaction to PartiallySignedTransaction (Steve Myers)

Pull request description:

  <!-- You can erase any parts of this template not applicable to your Pull Request. -->

  ### Description

  Add FeeRate struct and fee_amount() and fee_rate() functions on PartiallySignedTransaction.

  ### Notes to the reviewers

  This PR is dependent on https://github.com/bitcoindevkit/bdk/pull/782.

  ### Changelog notice

  - Breaking Changes
    - Renamed PartiallySignedBitcoinTransaction to PartiallySignedTransaction to be consistent with `rust-bitcoin`
  - APIs Added
    - Add FeeRate struct
    - Add fee_amount() and fee_rate() functions on PartiallySignedTransaction

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

  #### New Features:

  * [x] I've added tests for the new feature
  * [x] I've added docs for the new feature

ACKs for top commit:
  thunderbiscuit:
    Re-ACK [ae1ea99](ae1ea99ed3).

Tree-SHA512: 2c3f792e9ef092cd3ba233601122f4960c496d132caad54ef2f7f41d7113dd16600a863bb8fd78d2e5b978adebdb7ddd9529c21b3d46cd0b16e0db4eb90de01d
2022-11-07 14:15:35 -06:00
Steve Myers
ae1ea99ed3
Add FeeRate struct and fee_amount() and fee_rate() functions on PartiallySignedTransaction 2022-11-07 11:55:36 -06:00
Steve Myers
9a381f6d32
Rename PartiallySignedBitcoinTransaction to PartiallySignedTransaction 2022-11-07 11:55:36 -06:00
Steve Myers
3a07b4838a
Merge bitcoindevkit/bdk-ffi#221: Bump bdk version to 0.24.0
29de6f2d060461da34333ea8b52aeaf531434ca2 Bump bdk version to 0.24.0 (thunderbiscuit)

Pull request description:

  ## Description
  This PR updates BDK to the latest version, `0.24.0`.

  ### Notes to the reviewers
  This PR is currently open only for CI testing and review. Only merge once bdk 0.24.0 is out and the PR has been updated.

  ### Changelog notice
  ```txt
  - Update BDK to latest version 0.24.0 [#221]

  [#221](https://github.com/bitcoindevkit/bdk-ffi/pull/221)
  ```

  #### All Submissions:
  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

ACKs for top commit:
  notmandatory:
    ACK 29de6f2d060461da34333ea8b52aeaf531434ca2

Tree-SHA512: 256eb4387728467704f732ce1151de9569b6121916bb1d814bb48c75faf20026846e6170a384ca7e5e9ac3652bd9dfe5511e019f13c972ae755f0b37f9db8b83
2022-11-07 11:47:45 -06:00
thunderbiscuit
29de6f2d06
Bump bdk version to 0.24.0 2022-11-07 12:33:00 -05:00
Steve Myers
73ba73fd03
Merge bitcoindevkit/bdk-ffi#219: Added Mnemonic Interface
9866649fdc5ffe0203f5a76082d789a22e5214bf Added Mnemonic Interface (dhruvbaliyan)

Pull request description:

  ### Description
  This PR adds `interface Mnemonic` which will make the API to generate new DescriptorSecretKey have type-safe arguments.

  <!-- Describe the purpose of this PR, what's being adding and/or fixed -->

  ### Notes to the reviewers

  This PR doesn't have any issue linked to it, as it was discusses on a call during the implementation of `DescriptorSecretKey` (PR #154). It was discussed to make `Mnemonic` an interface and use that instead of string `Mnemonic` so that the API to generate `DescriptorSecretKey` doesn't have any potential failure (like in case it's provided with incorrect Mnemonic words).

  APIs added
  ```
  // generates and returns Mnemonic with random entropy
  Mnemonic::new(word_count: WordCount) -> Self { ... }
  // converts string Mnemonic to Mnemonic type with error (in case of incorrect string Mnemonic)
  Mnemonic::from_str(mnemonic: String) -> Result<Self, BdkError> { ... }
  // generates and returns Mnemonic with given entropy
  Mnemonic::from_entropy(entropy: Vec<u8>) -> Result<Self, BdkError> {...}
  // view mnemonic as string
  Mnemonic::as_string(&self) -> String { ... }
  ```
  Along with some changes to `DescriptorSecretKey::new()` to fit these new APIs

  ### Changelog notice
  ```
  - Added Struct Mnemonic with following methods [#219]
    - new(word_count: WordCount) generates and returns Mnemonic with random entropy
    - from_str(mnemonic: String) converts string Mnemonic to Mnemonic type with error
    - from_entropy(entropy: Vec<u8>) generates and returns Mnemonic with given entropy
    - as_string() view Mnemonic as string
  - API removed [#219]
    - generate_mnemonic(word_count: WordCount)

  [#219](https://github.com/bitcoindevkit/bdk-ffi/pull/219)
  ```
  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

  #### New Features:

  * [x] I've added docs for the new feature

  #### Bugfixes:

  * [x] This pull request breaks the existing API
      * Top level function `generate_mnemonic(...)` was removed

ACKs for top commit:
  thunderbiscuit:
    ACK 9866649fdc5ffe0203f5a76082d789a22e5214bf.
  notmandatory:
    ACK 9866649fdc5ffe0203f5a76082d789a22e5214bf

Tree-SHA512: 45f9158beb6fe7bfe2a901c3f17126db855fe0b4b479ecb2a16381e06a415eed295fe6be3c840bd1d1fc8cffaf58bd97dc27bdc1e82699367a827d700e8fd09b
2022-11-07 11:27:41 -06:00
dhruvbaliyan
9866649fdc
Added Mnemonic Interface 2022-11-03 22:33:38 +05:30
Steve Myers
c2aecb0597
Merge bitcoindevkit/bdk-ffi#220: Add build profile 'release-smaller'
ba71a7a27c06c4db094b1ce01d0e2f846b0f8def Add build profile 'release-smaller' (Steve Myers)

Pull request description:

  ### Description

  New profile turns on all the non-experimental rust build size optimizations.

  ### Notes to the reviewers

  This PR is the first step to fixing bitcoindevkit/bdk-swift#25.

  ### Changelog notice

  None.

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

ACKs for top commit:
  thunderbiscuit:
    ACK [ba71a7a](ba71a7a27c).

Tree-SHA512: b12cf3a3ad3683dccbb89f611e98246db4a604b674077a45b78e30e9e20021f443dfec68e8ab511e0bb64d84c5c7064b4078b578fc3b4c1fb2e1119680a656a6
2022-11-01 18:57:52 -05:00
Steve Myers
ba71a7a27c
Add build profile 'release-smaller' 2022-10-29 22:02:59 -05:00
Steve Myers
036e790a75
Merge bitcoindevkit/bdk-ffi#215: Add simple kotlin, swift and python integration tests
ee6ee8139afd74c858216ed99ffdec92dc101787 Add simple kotlin,swift, and python integration tests (Steve Myers)

Pull request description:

  ### Description

  Add simple kotlin, swift and python integration tests. These tests confirm fixes in #216 and #214.

  ### Notes to the reviewers

  To skip integration tests use:

  `cargo test --lib`.

  Otherwise java, kotlin, swift, and python need to be installed, and you must run tests with:

  `CLASSPATH=./tests/jna/jna-5.8.0.jar cargo test`

  ### Changelog notice

  - Integration tests added, see tests/README.md for updated instructions for running tests. #215

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

  #### New Features:

  * [x] I've added tests for the new feature
  * [x] I've added docs for the new feature

  #### Bugfixes:

  * [x] I've added tests to reproduce the issue which are now passing

ACKs for top commit:
  thunderbiscuit:
    ACK [ee6ee81](ee6ee8139a).
  waterst0ne:
    > ACK [ee6ee81](ee6ee8139a).

Tree-SHA512: 06ab14da1185de431c16b767f187bc8e7792106df54314242b26f225e3a8ddada28317b7cb8bec47b8b248d3088d0305ab777770525540c72d2815349a73728b
2022-10-27 13:38:29 -05:00
Steve Myers
ee6ee8139a
Add simple kotlin,swift, and python integration tests 2022-10-21 15:14:15 -05:00
Steve Myers
3bec5d2cab
Merge bitcoindevkit/bdk-ffi#216: Update uniffi dependencies to 0.21.0
b9aa0a2cf16c3f8fb037d01015d9eccfee82e9e3 Update uniffi dependencies to 0.21.0 (Steve Myers)

Pull request description:

  ### Description

  Update uniffi dependencies to 0.21.0

  ### Notes to the reviewers

  This is required to pickup my PR to handle swift keywords. https://github.com/mozilla/uniffi-rs/compare/v0.20.0...v0.21.0

  ### Changelog notice

  Update uniffi-rs to latest version 0.20.0 #216

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

ACKs for top commit:
  thunderbiscuit:
    ACK [b9aa0a2](b9aa0a2cf1).

Tree-SHA512: 8bd585a22e6df2186d3985cc4d41a86dc35644b1e8dc06c1153de04a85df2cb6b345e15c0eb26e1b87c41cb00f15acf29f1b6a5b23736ead397fa6ee0fe0af0e
2022-10-21 13:26:36 -05:00
Steve Myers
b9aa0a2cf1
Update uniffi dependencies to 0.21.0 2022-10-21 13:18:38 -05:00
thunderbiscuit
c7d0803000
Fix use of Error as name for error enum in UDL 2022-10-21 09:30:28 -04:00
Steve Myers
1a4b9b440d
Bump version to 0.10.0 2022-10-19 12:47:16 -05:00
Steve Myers
1f914c2b4d
Merge bitcoindevkit/bdk-ffi#209: Change TxBuilder.finish() to return new TxBuilderResult
fadb316451af080bf22774a164278cef04acd9cc Change TxBuilder.finish() to return new TxBuilderResult (Steve Myers)

Pull request description:

  ### Description

  Change TxBuilder.finish() to return new TxBuilderResult.

  ### Notes to the reviewers

  This fixes #179 in that it return both PartiallySignedBitcoinTransaction and TransactionDetails encapsulated in a new TxBuilderResult structure. It does not calculate the fee rate which requires #208.

  ### Changelog notice

  - Breaking Changes
    - Changed `TxBuilder.finish()` to return new `TxBuilderResult`.
  - APIs Added
    - Added `TxBuilderResult` with PSBT and TransactionDetails.

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

  #### New Features:

  * [x] I've added tests for the new feature
  * [x] I've added docs for the new feature

ACKs for top commit:
  thunderbiscuit:
    ACK [fadb316](fadb316451).

Tree-SHA512: b8aafc53ba86bf7ab12ae3d5bb251d1ec5cb54e4b7d6bfc342155d5cd3726d9a6d114591dc740a7467afb8ef402f3d77ad51e273a27865d6e47192291b570af9
2022-10-19 12:30:06 -05:00
Steve Myers
fadb316451
Change TxBuilder.finish() to return new TxBuilderResult 2022-10-19 12:27:00 -05:00
thunderbiscuit
3fefd3c1fb
Allow TxBuilder.add_recipient() to take Script 2022-10-17 17:42:36 -04:00
thunderbiscuit
2cbb314d0b
Remove BdkError type alias 2022-10-17 16:43:37 -04:00
thunderbiscuit
535fc70433
Upgrade bdk dependency to v0.23 2022-10-17 16:19:35 -04:00
thunderbiscuit
10fa276bec
Update uniffi-rs to 0.20.0 2022-10-17 16:03:27 -04:00
thunderbiscuit
1cc9afaeb3
Rename DescriptorSecretKey.secret_bytes() to mirror upstream API 2022-10-03 14:54:01 -04:00
thunderbiscuit
6f5e621561
Remove changelog entry to follow workflow defined in #202 2022-10-03 14:54:00 -04:00
thunderbiscuit
1dd6f2d9f8
Add test for DescriptorSecretKey.secret_key_bytes() 2022-10-03 14:53:58 -04:00
thunderbiscuit
f92b45db6a
Add ability to retrieve private keys as bytes
This feature is needed for compatibility with LDKLite, where the
initial entropy given to LDK is the private key of the root of
the BIP32 derivation tree.

Closes #188
2022-10-03 14:53:25 -04:00
thunderbiscuit
c971d54aea
Fix warnings 2022-09-30 19:37:19 -04:00
thunderbiscuit
2abccafb8f
Add combine() method on PSBT
Closes #198
2022-09-30 19:37:12 -04:00
Steve Myers
75d0415bec
Add release templates and dev cycle docs, update changelog process 2022-09-29 11:18:27 -05:00
thunderbiscuit
485f4f72ce
Bump version to 0.9.0 v0.9.0 2022-09-08 15:18:48 -04:00
thunderbiscuit
37dddd05f6
Update changelog for 0.9.0 release 2022-09-08 15:17:35 -04:00
Steve Myers
dfb350e206
Merge bitcoindevkit/bdk-ffi#193: Update bdk dependency to 0.22
3c6075ad96afa238dc3ceca71ba82cb10088bb90 Add Balance struct and conversion from BdkBalance (thunderbiscuit)
4e15badb14d34db4911641f345e99987d132a81c Update BDK to version 0.22 (thunderbiscuit)

Pull request description:

  The bindings do not build when attempting this upgrade because `get_balance()` now returns a `Balance` struct (this was merged in bitcoindevkit/bdk#640)

  ```sh
  error[E0308]: mismatched types
     --> src/lib.rs:433:9
      |
  432 |     fn get_balance(&self) -> Result<u64, Error> {
      |                              ------------------ expected `Result<u64, bdk::Error>` because of return type
  433 |         self.get_wallet().get_balance()
      |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u64`, found struct `Balance`
      |
      = note: expected enum `Result<u64, _>`
                 found enum `Result<Balance, _>`

  For more information about this error, try `rustc --explain E0308`.
  error: could not compile `bdk-ffi` due to previous error
  ```

  When we upgrade to `0.22.0` we could decide to add the `Balance` struct to the bindings, or simply return the total by calling `get_total()`, which returns a `u64` (same as we have now).

ACKs for top commit:
  notmandatory:
    ACK 3c6075ad96afa238dc3ceca71ba82cb10088bb90

Tree-SHA512: 13d2f83f992735f4f9619ae339d7834df08385129edf06bac830c298b433571af3f211e92a6da1f4f9646dec27dbd2c6133a035f26eac8757b7a1c94b54b463d
2022-09-08 13:58:27 -05:00
thunderbiscuit
3c6075ad96
Add Balance struct and conversion from BdkBalance 2022-09-08 08:35:10 -05:00
thunderbiscuit
4e15badb14
Update BDK to version 0.22 2022-09-08 08:34:56 -05:00
Steve Myers
f05a6648a7
Refactor TransactionDetails to include confirmation_time (#190) 2022-09-05 14:02:29 -04:00
thunderbiscuit
297680b7c2
Merge pull request #194 from thunderbiscuit/update/uniffi-bindgen
Update uniffi-bindgen to 0.19.5
2022-09-05 13:36:07 -04:00
Steve Myers
8166f820b4
Add README info badges for MSRV and other links 2022-09-05 12:04:08 -05:00
Steve Myers
4f20966ddd
Update CI test rust versions to 1.61 and 1.63 2022-09-05 11:46:26 -05:00
thunderbiscuit
d447aac9ae
Update uniffi-bindgen to 0.19.5 2022-09-02 13:11:31 -04:00
thunderbiscuit
159e7ab4af
Pin version of uniffi-bindgen in bdk-ffi-bindgen tool (#189) 2022-08-29 22:08:38 -04:00
thunderbiscuit
bfe03b91b2
Add inline documentation (#171)
* Add docs for AddressInfo and AddressIndex structs

* Add docs for DatabaseConfig and ElectrumConfig

* Add docs for EsploraConfig struct

* Add docs for TransactionDetails struct

* Add docs for OutPoint struct

* Add docs for TxOut struct

* Add docs for TxBuilder
2022-08-29 15:47:37 -04:00
Pedro
3b028ecab1
Expose set_recipients API from TxBuiler (#186) 2022-08-29 09:58:46 -04:00
thunderbiscuit
aa004201b2
Fix method names to mirror Rust bdk API (#185)
* Fix method names to mirror Rust bdk API

* Fix method names to mirror Rust bdk API
2022-08-18 14:35:17 -04:00
thunderbiscuit
eed5554551
Merge pull request #184 from thunderbiscuit/block-height-hash
Add `get_height` and `get_block_hash` methods on blockchain
2022-08-18 14:14:03 -04:00
thunderbiscuit
88427e4a05
Update CHANGELOG.md
Co-authored-by: Steve Myers <github@notmandatory.org>
2022-08-18 14:04:31 -04:00
thunderbiscuit
8248660c52
Merge branch 'master' into block-height-hash 2022-08-18 13:43:18 -04:00
thunderbiscuit
25963ec982
Add get_height and get_block_hash methods on blockchain 2022-08-18 13:39:00 -04:00
Steve Myers
7da28658a5
Merge bitcoindevkit/bdk-ffi#154: Add child key pair generation api
5944756b780968588e97886d888bb854aa2053ad Added tests for DescriptorSecretKey and DescriptorPublicKey (dhruvbaliyan)
58fea6b2050d9f10b1c5429cce4f4969c155e9e3 Added interfaces DescriptorSecretKey and DescriptorPublicKey (dhruvbaliyan)
4977cb6d68830accf036b192dba3c524253e53f2 Added interface DerivationPath (dhruvbaliyan)
930a1f1eb4a64bf447dec2493edd9948be67f119 Added generate_mnemonic method (dhruvbaliyan)
973013cbdfb0093c9d0bc8d2f5176c981160e060 Removed ExtendedKeyInfo & related methods (dhruvbaliyan)

Pull request description:

  Would like to know if anything can be improved. Completes #87

Top commit has no ACKs.

Tree-SHA512: a480535c8965015d860336c717ec3c394778ac08194b0336eeba4209f3e3eff2072873a190dd8c9e4fac1e2f712c7040c838dc1c1a757d53c28866f118c99c17
2022-08-18 12:14:35 -05:00
dhruvbaliyan
5944756b78
Added tests for DescriptorSecretKey and DescriptorPublicKey 2022-08-18 04:24:03 +05:30
dhruvbaliyan
58fea6b205
Added interfaces DescriptorSecretKey and DescriptorPublicKey 2022-08-18 04:24:02 +05:30
dhruvbaliyan
4977cb6d68
Added interface DerivationPath 2022-08-18 04:24:02 +05:30