Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: generate wallet ffi header file automatically #4183

Merged

Conversation

stringhandler
Copy link
Collaborator

Description

Adds a build.rs and cbindgen to generate the header file automatically. I was not sure of the best location for this, so kept it the same as the previous wallet.h file, but renamed the file to match the crate (i.e. tari_wallet_ffi.h)

Motivation and Context

Currently, the wallet.h header file was manually edited. This obviously could lead to user error. Most notably, the *_get_timestamp methods were returning c_longlong but the header file indicated that they were using c_ulonglong. I'm not sure how long it has been like this, or which is correct, so I've changed the method to use c_ulonglong to match the previous header file.

How Has This Been Tested?

Tested locally, but also asked @TruszczynskiA to compile iOs with the new header

@@ -2437,15 +2418,15 @@ pub unsafe extern "C" fn completed_transaction_get_fee(
pub unsafe extern "C" fn completed_transaction_get_timestamp(
transaction: *mut TariCompletedTransaction,
error_out: *mut c_int,
) -> c_longlong {
) -> c_ulonglong {
Copy link
Contributor

@hansieodendaal hansieodendaal Jun 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is the correct choice here and ditto for the rest

hansieodendaal
hansieodendaal previously approved these changes Jun 13, 2022
Copy link
Contributor

@hansieodendaal hansieodendaal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hansieodendaal
Copy link
Contributor

Works really well for the auto header generation!

@stringhandler stringhandler force-pushed the st-generate-ffi-header branch from 4e7b537 to 9d381c1 Compare June 13, 2022 11:32
@aviator-app aviator-app bot removed the mq-failed label Jun 13, 2022
@aviator-app aviator-app bot merged commit 665f1f7 into tari-project:testnet-dibbler Jun 13, 2022
@sdbondi
Copy link
Member

sdbondi commented Jun 13, 2022

This is great!

sdbondi added a commit to sdbondi/tari that referenced this pull request Jun 22, 2022
* testnet-dibbler:
  v0.32.5
  chore: update toolchain and fix clippy (tari-project#4212)
  feat(wallet_ffi): wallet_get_utxos() (tari-project#4209)
  chore: bump lmdb-sys dependency (tari-project#4195)
  chore(deps): upgrade randomx (tari-project#4196)
  Bump croaring to 0.5.2 - improve cross-compile in docker
  bug: remove deprecated tauri config variable (tari-project#4194)
  feat: generate wallet ffi header file automatically (tari-project#4183)
  v0.32.4
  feat(wallet-ffi): adds FFI wallet_get_utxos() and test_wallet_get_utxos() (tari-project#4180)
sdbondi added a commit to sdbondi/tari that referenced this pull request Jun 22, 2022
* testnet-dibbler:
  v0.32.5
  chore: update toolchain and fix clippy (tari-project#4212)
  feat(wallet_ffi): wallet_get_utxos() (tari-project#4209)
  chore: bump lmdb-sys dependency (tari-project#4195)
  chore(deps): upgrade randomx (tari-project#4196)
  Bump croaring to 0.5.2 - improve cross-compile in docker
  bug: remove deprecated tauri config variable (tari-project#4194)
  feat: generate wallet ffi header file automatically (tari-project#4183)
  v0.32.4
  feat(wallet-ffi): adds FFI wallet_get_utxos() and test_wallet_get_utxos() (tari-project#4180)
sdbondi added a commit to sdbondi/tari that referenced this pull request Jun 22, 2022
* development:
  fix clippies
  remove tari_core_from cbindgen build
  feat(miner): friendlier miner output (tari-project#4219)
  v0.32.5
  chore: update toolchain and fix clippy (tari-project#4212)
  feat(wallet_ffi): wallet_get_utxos() (tari-project#4209)
  chore: bump lmdb-sys dependency (tari-project#4195)
  chore(deps): upgrade randomx (tari-project#4196)
  Bump croaring to 0.5.2 - improve cross-compile in docker
  bug: remove deprecated tauri config variable (tari-project#4194)
  feat: generate wallet ffi header file automatically (tari-project#4183)
  v0.32.4
  feat(wallet-ffi): adds FFI wallet_get_utxos() and test_wallet_get_utxos() (tari-project#4180)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants