-
Notifications
You must be signed in to change notification settings - Fork 24
Rust bindings #67
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
Closed
Closed
Rust bindings #67
Changes from 8 commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
d780ed9
add example monero_c static lib build script
sneurlax 2a31615
add example rust binding
sneurlax eb7cc58
support building other archs, copy file to correct path
sneurlax 440f6c3
Merge branch 'master' into rust
sneurlax a42cbbe
prove integration
sneurlax 4694bb9
convert to lib
sneurlax c2c2f2c
allow lib to be loaded by consumer crates
sneurlax 3ceeecc
/monero_rust -> /monero.rs
sneurlax d3059b8
remove LICENSE
sneurlax 85590d6
refer to correct repository
sneurlax 1e85aff
remove system exports from bindings.rs
sneurlax 2bdb7f9
support loading lib from /lib or same dir as bin
sneurlax a81f173
add ../../release as first lib location candidate
sneurlax aff9176
remove impls/monero.rs/scripts/build_monero_c.sh
sneurlax 4f52286
update docs re: supported library paths
sneurlax aab9ea7
fix android lib
sneurlax 44c1676
deduplicate wallet manager pointer and library reference
sneurlax dc103c8
refactor library loading
sneurlax a046d90
replace main.rs demo with integration tests
sneurlax 774091b
do not use libloading
sneurlax 0d9b372
silence naming-related warnings
sneurlax c7d7cf6
add unit tests
sneurlax 9df600a
add Doc-tests
sneurlax 78b1aef
NetworkType enum
sneurlax b556f50
Merge branch 'master' into rust
sneurlax 6260fed
Merge branch 'master' into rust
sneurlax edfe554
make seed_offset an Option
sneurlax 0a57eb4
add get_status fn for error-handling
sneurlax 824a829
handle null wallet ptr case
sneurlax ff39a28
add open_wallet
sneurlax 7a90b8f
add get_balance
sneurlax 73c486e
make error handling in line with monero.ts example
sneurlax fa7fa68
add test cases for open_wallet
sneurlax 0c0c413
add create_account
sneurlax 6f04d70
add get_accounts
sneurlax 39ff302
add close_wallet
sneurlax 0bd5ae9
add get_height
sneurlax dce42cf
add init
sneurlax 0114449
add refresh
sneurlax 3b09a94
add untested transfer
sneurlax 3d51547
add untested sweep_all
sneurlax e112ca4
WIP generate_from_keys
sneurlax be9cc33
add TODO
sneurlax 57dce1e
clean up gitignore
sneurlax 230d29a
add set_seed_language and use it to fix the generate_from_keys tests
sneurlax 8f830af
add MONERO_Wallet_checkTxKey to wallet2_api_c.cpp
sneurlax 5e9a878
add throw_if_error test, standardize docs comments
sneurlax 4d339e8
add WIP check_tx_key
sneurlax 8c25f0d
Update impls/monero.rs/example/Cargo.toml
sneurlax 755749e
add restore_mnemonic
sneurlax 1c1e0f2
add restore_polyseed
sneurlax 06beb39
update example
sneurlax 1d6dc08
WIP scanning example
sneurlax c166316
WIP example docs
sneurlax 039ea32
update MONERO_Wallet_checkTxKey IAW feedback
sneurlax 779ac9a
update header to match impl
sneurlax a66f82b
WIP check_tx_key with failing tests
sneurlax 510cb14
add watch only (viewkey only) generate_from_keys integration test
sneurlax 8e7bc59
update docs re: lib placement
sneurlax 8121647
Merge branch 'develop' into rust
MrCyjaneK File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| release/ | ||
| build/ | ||
| build/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| target/ | ||
| scripts/monero_c | ||
| lib/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| [package] | ||
| name = "monero_rust" | ||
| version = "0.0.1" | ||
| edition = "2021" | ||
| description = "monero_c Rust bindings." | ||
| repository = "https://github.com/ManyMath/monero_rust" | ||
| license = "MIT" | ||
| build = "build.rs" | ||
|
|
||
| [lib] | ||
| name = "monero_rust" | ||
| path = "src/lib.rs" | ||
| crate-type = ["lib", "cdylib"] | ||
|
|
||
| [dependencies] | ||
| libc = "0.2" | ||
| libloading = "0.8.5" | ||
|
|
||
| [build-dependencies] | ||
| bindgen = "0.70.1" | ||
|
|
||
sneurlax marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2024 Joshua Babb | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # `monero_rust` | ||
| Proof of concept `monero_c` bindings for Rust. | ||
|
|
||
| ## Getting started | ||
| <!-- | ||
| ### Prerequisites | ||
| You may need | ||
| ``` | ||
| sudo apt-get install libhidapi-dev | ||
| ``` | ||
| --> | ||
| ### Build `monero_c` | ||
| Build the monero_c library for your architecture. Follow the upstream docs at | ||
| https://github.com/MrCyjaneK/monero_c <!-- TODO: use example CMakeLists --> and | ||
| place the library at `monero_c/impls/monero_rust/lib/libwallet2_api_c.so` or use | ||
| the provided script: | ||
| ``` | ||
| cd scripts | ||
| ./build_monero_c.sh | ||
| ``` | ||
|
|
||
| or build it manually as in: | ||
| ``` | ||
| git clone https://git.mrcyjanek.net/MrCyjaneK/monero_c --branch rust | ||
| cd monero_c | ||
| git submodule update --init --recursive | ||
| rm -rf monero wownero release # Clean any previous builds. | ||
| git submodule update --init --recursive --force | ||
| ./apply_patches.sh monero | ||
| ./build_single.sh monero x86_64-linux-gnu -j$(nproc) | ||
|
|
||
| # Adjust the commands below for your arch. | ||
| unxz -f release/monero/x86_64-linux-gnu_libwallet2_api_c.so.xz | ||
| mv release/monero/x86_64-linux-gnu_libwallet2_api_c.so ../lib/libwallet2_api_c.so | ||
| # The library should be at monero_c/impls/monero_rust/lib/libwallet2_api_c.so. | ||
| ``` | ||
|
|
||
| ### Run `monero_rust` demo | ||
| From `monero_c/impls/monero_rust`: | ||
| ``` | ||
| cargo run | ||
| ``` | ||
|
|
||
| ## Using `monero_rust` in your own crate | ||
| Refer to the `example` folder. `libwallet2_api_c.so` must be in the same | ||
| directory as the binary (*eg.* at `example/target/debug/libwallet2_api_c.so`). |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.