├── .cargo
└── config.toml
├── .ci
├── pushdocs.yml
├── release.yml
├── test.yml
├── win32_cargo.bat
├── win64_cargo.bat
└── windows-release.yml
├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
└── workflows
│ ├── cd.yaml
│ └── ci.yaml
├── .gitignore
├── .hooks
└── pre-commit
├── Cargo.lock
├── Cargo.toml
├── LICENSE
├── README.md
├── api
├── Cargo.toml
└── src
│ ├── foreign.rs
│ ├── foreign_rpc.rs
│ ├── lib.rs
│ ├── owner.rs
│ ├── owner_rpc_v2.rs
│ ├── owner_rpc_v3.rs
│ └── types.rs
├── azure-pipelines.yml
├── build_static.sh
├── build_static32.bat
├── build_static64.bat
├── build_static_linux.sh
├── config
├── Cargo.toml
└── src
│ ├── comments.rs
│ ├── config.rs
│ ├── lib.rs
│ └── types.rs
├── controller
├── Cargo.toml
├── src
│ ├── command.rs
│ ├── controller.rs
│ ├── display.rs
│ ├── error.rs
│ ├── executor.rs
│ └── lib.rs
└── tests
│ ├── accounts.rs
│ ├── broken_change.rs
│ ├── build_chain.rs
│ ├── build_output.rs
│ ├── check.rs
│ ├── common
│ └── mod.rs
│ ├── file.rs
│ ├── integrity_kernel.rs
│ ├── invoice.rs
│ ├── late_lock.rs
│ ├── no_change.rs
│ ├── ownership_proofs.rs
│ ├── payment_proofs.rs
│ ├── repost.rs
│ ├── revert.rs
│ ├── self_send.rs
│ ├── self_spend.rs
│ ├── slatepack.rs
│ ├── transaction.rs
│ ├── ttl_cutoff.rs
│ ├── tx_list_filter.rs
│ └── updater_thread.rs
├── doc
├── atomic_swaps.md
├── change_outputs.md
├── design
│ ├── design.md
│ ├── goals.md
│ ├── wallet-arch.png
│ └── wallet-arch.puml
├── floonet_faucet.md
├── installing_openssl.md
├── samples
│ └── v3_api_node
│ │ ├── package-lock.json
│ │ ├── package.json
│ │ ├── readme.md
│ │ └── src
│ │ └── index.js
├── setup.md
├── setup_other_currency_nodes.md
├── slatepack_data_format.md
├── swap
│ └── electrumx_install.md
├── tls-setup.md
├── tor_for_exchanges_pools.md
└── transaction
│ ├── basic-transaction-wf.puml
│ └── mwc-transaction-wf.png
├── file
├── impls
├── Cargo.toml
└── src
│ ├── adapters
│ ├── file.rs
│ ├── http.rs
│ ├── libp2p_messaging.rs
│ ├── mod.rs
│ ├── mwcmq.rs
│ └── types.rs
│ ├── backends
│ ├── lmdb.rs
│ └── mod.rs
│ ├── client_utils
│ ├── client.rs
│ ├── json_rpc.rs
│ ├── mod.rs
│ └── socksv5.rs
│ ├── error.rs
│ ├── lib.rs
│ ├── lifecycle
│ ├── default.rs
│ ├── mod.rs
│ └── seed.rs
│ ├── node_clients
│ ├── http.rs
│ ├── mod.rs
│ └── resp_types.rs
│ ├── test_framework
│ ├── mod.rs
│ └── testclient.rs
│ └── tor
│ ├── bridge.rs
│ ├── config.rs
│ ├── mod.rs
│ ├── process.rs
│ ├── proxy.rs
│ └── status.rs
├── integration
├── Cargo.toml
├── src
│ └── lib.rs
└── tests
│ ├── api.rs
│ ├── dandelion.rs
│ ├── framework.rs
│ ├── simulnet.rs
│ └── stratum.rs
├── libwallet
├── Cargo.toml
├── src
│ ├── address.rs
│ ├── api_impl.rs
│ ├── api_impl
│ │ ├── foreign.rs
│ │ ├── owner.rs
│ │ ├── owner_eth.rs
│ │ ├── owner_libp2p.rs
│ │ ├── owner_swap.rs
│ │ ├── owner_updater.rs
│ │ └── types.rs
│ ├── error.rs
│ ├── internal.rs
│ ├── internal
│ │ ├── keys.rs
│ │ ├── scan.rs
│ │ ├── selection.rs
│ │ ├── tx.rs
│ │ └── updater.rs
│ ├── lib.rs
│ ├── proof
│ │ ├── base58.rs
│ │ ├── crypto.rs
│ │ ├── hasher.rs
│ │ ├── message.rs
│ │ ├── mod.rs
│ │ ├── proofaddress.rs
│ │ └── tx_proof.rs
│ ├── slate.rs
│ ├── slate_versions
│ │ ├── mod.rs
│ │ ├── ser.rs
│ │ ├── v2.rs
│ │ └── v3.rs
│ ├── slatepack
│ │ ├── armor.rs
│ │ ├── mod.rs
│ │ ├── packer.rs
│ │ └── slatepack.rs
│ ├── swap
│ │ ├── api.rs
│ │ ├── bitcoin
│ │ │ ├── api.rs
│ │ │ ├── client.rs
│ │ │ ├── electrum.rs
│ │ │ ├── mod.rs
│ │ │ ├── rpc.rs
│ │ │ └── types.rs
│ │ ├── buyer.rs
│ │ ├── error.rs
│ │ ├── ethereum
│ │ │ ├── api.rs
│ │ │ ├── client.rs
│ │ │ ├── decimal_convert.rs
│ │ │ ├── erc20_contract.rs
│ │ │ ├── erc20_swap_contract.rs
│ │ │ ├── ethereum.rs
│ │ │ ├── infura.rs
│ │ │ ├── mod.rs
│ │ │ ├── swap_contract.rs
│ │ │ └── types.rs
│ │ ├── fsm
│ │ │ ├── buyer_swap.rs
│ │ │ ├── machine.rs
│ │ │ ├── mod.rs
│ │ │ ├── seller_swap.rs
│ │ │ └── state.rs
│ │ ├── message.rs
│ │ ├── mod.rs
│ │ ├── multisig
│ │ │ ├── error.rs
│ │ │ ├── mod.rs
│ │ │ └── types.rs
│ │ ├── seller.rs
│ │ ├── ser.rs
│ │ ├── swap.rs
│ │ ├── trades.rs
│ │ └── types.rs
│ └── types.rs
├── swap_test
│ ├── context_buy.json
│ ├── context_sell.json
│ ├── message_1.json
│ ├── message_2.json
│ ├── message_3.json
│ ├── message_4.json
│ ├── swap_buy_1.json
│ ├── swap_buy_2.json
│ ├── swap_buy_3.json
│ ├── swap_sell_1.json
│ ├── swap_sell_2.json
│ ├── swap_sell_3.json
│ ├── swap_sell_4.json
│ ├── swap_sell_5.json
│ └── swap_sell_6.json
└── tests
│ ├── libwallet.rs
│ ├── slate_versioning.rs
│ └── slates
│ └── v2.slate
├── mypatch.patch
├── rustfmt.toml
├── src
├── bin
│ ├── mwc-wallet.rs
│ └── mwc-wallet.yml
├── build
│ └── build.rs
├── cli
│ ├── cli.rs
│ └── mod.rs
├── cmd
│ ├── mod.rs
│ ├── wallet.rs
│ └── wallet_args.rs
└── lib.rs
├── tests
├── cmd_line_basic.rs
├── common
│ └── mod.rs
├── data
│ ├── v2_reqs
│ │ ├── init_send_tx.req.json
│ │ └── retrieve_info.req.json
│ └── v3_reqs
│ │ ├── change_password.req.json
│ │ ├── close_wallet.req.json
│ │ ├── create_config.req.json
│ │ ├── create_wallet.req.json
│ │ ├── create_wallet_invalid_mn.req.json
│ │ ├── create_wallet_valid_mn.req.json
│ │ ├── delete_wallet.req.json
│ │ ├── get_top_level.req.json
│ │ ├── init_secure_api.req.json
│ │ ├── init_send_tx.req.json
│ │ ├── open_wallet.req.json
│ │ └── retrieve_info.req.json
├── owner_v2_sanity.rs
├── owner_v3_init_secure.rs
├── owner_v3_lifecycle.rs
└── tor_dev_helper.rs
└── util
├── Cargo.toml
└── src
├── lib.rs
├── ov3.rs
└── tokio_runtime.rs
/.cargo/config.toml:
--------------------------------------------------------------------------------
1 | [target.x86_64-pc-windows-msvc]
2 | rustflags = ["-Ctarget-feature=+crt-static"]
3 | [target.i686-pc-windows-msvc]
4 | rustflags = ["-Ctarget-feature=+crt-static"]
5 |
--------------------------------------------------------------------------------
/.ci/pushdocs.yml:
--------------------------------------------------------------------------------
1 | steps:
2 | - script: |
3 | cd /home/vsts/work/1/s/api && cargo fetch && cargo doc --offline --no-deps
4 | mkdir /home/vsts/work/1/gitpages && cd /home/vsts/work/1/gitpages && git clone https://anything:$(github_pat)@github.com/$(ghpages_user)/$(ghpages_repo).git .
5 |
6 | cd /home/vsts/work/1/gitpages
7 | git config user.name $(ghpages_user)
8 | git checkout master
9 | cp -a /home/vsts/work/1/s/target/doc/* /home/vsts/work/1/gitpages/
10 | echo '' > /home/vsts/work/1/gitpages/index.html && \
11 | git add --all
12 | git commit -m"Pipelines-Bot: Updated site via $(Build.SourceVersion)";
13 | git push https://$(github_pat)@github.com/mwcproject/mwcproject.github.io.git
14 |
15 | curl https://api.github.com/repos/$(ghpages_user)/$(ghpages_repo)/pages/builds/latest -i -v \
16 | -X GET \
17 | -H "Accept: application/vnd.github.mister-fantastic-preview+json" \
18 | -H "Authorization: Basic $(ghpages_auth_header)"
19 | displayName: 'Create and Push Docs'
20 | condition: succeeded()
21 |
--------------------------------------------------------------------------------
/.ci/release.yml:
--------------------------------------------------------------------------------
1 | steps:
2 | - script: 'cargo test --all'
3 | displayName: Cargo Test All
4 | condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
5 | - script: './build_static_linux.sh'
6 | displayName: Build Linux Release
7 | condition: and(succeeded(), eq( variables['Agent.OS'], 'Linux' ))
8 | - script: './build_static.sh'
9 | displayName: Build MacOS Release
10 | condition: and(succeeded(), eq( variables['Agent.OS'], 'Darwin' ))
11 | - script: |
12 | MY_TAG="$(Build.SourceBranch)"
13 | MY_TAG=${MY_TAG#refs/tags/}
14 | echo $MY_TAG
15 | echo "##vso[task.setvariable variable=build.my_tag]$MY_TAG"
16 | echo "##vso[task.setvariable variable=build.platform]$PLATFORM"
17 | displayName: "Create my tag variable"
18 | condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
19 | - task: CopyFiles@2
20 | displayName: Copy assets
21 | condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
22 | inputs:
23 | sourceFolder: '$(Build.SourcesDirectory)/target/release'
24 | contents: 'mwc-wallet'
25 | targetFolder: '$(Build.BinariesDirectory)/mwc-wallet'
26 | - task: ArchiveFiles@2
27 | displayName: Gather assets
28 | condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
29 | inputs:
30 | rootFolderOrFile: '$(Build.BinariesDirectory)/mwc-wallet'
31 | archiveType: 'tar'
32 | tarCompression: 'gz'
33 | archiveFile: '$(Build.ArtifactStagingDirectory)/mwc-wallet-$(build.my_tag)-$(build.platform).tar.gz'
34 | - script: |
35 | cd $(Build.ArtifactStagingDirectory) && openssl sha256 mwc-wallet-$(build.my_tag)-$(build.platform).tar.gz > mwc-wallet-$(build.my_tag)-$(build.platform)-sha256sum.txt
36 | displayName: Create Checksum
37 | condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
38 | - task: GithubRelease@0
39 | displayName: Github release
40 | condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
41 | inputs:
42 | gitHubConnection: 'github.com_vekamo'
43 | repositoryName: 'mwcproject/mwc-wallet'
44 | action: 'edit'
45 | tagSource: "Git tag"
46 | tag: '$(build.my_tag)'
47 | assets: |
48 | $(Build.ArtifactStagingDirectory)/mwc-wallet-$(build.my_tag)-$(build.platform).tar.gz
49 | $(Build.ArtifactStagingDirectory)/mwc-wallet-$(build.my_tag)-$(build.platform)-sha256sum.txt
50 | title: '$(build.my_tag)'
51 | assetUploadMode: 'replace'
52 | addChangeLog: true
--------------------------------------------------------------------------------
/.ci/test.yml:
--------------------------------------------------------------------------------
1 | steps:
2 | - script: '.ci\win64_cargo.bat test --all'
3 | env:
4 | LIBCLANG_PATH: C:\Program Files\LLVM\lib
5 | LLVM_CONFIG_PATH: C:\Program Files\LLVM\bin\llvm-config
6 | ROARING_ARCH: x86-64-v2
7 | displayName: Windows Cargo Test
8 | condition: and(eq( variables['Agent.OS'], 'Windows_NT' ), eq( variables['CI_JOB'], 'test-all' ))
9 | - script: 'ROARING_ARCH=x86-64-v2 cargo test --all'
10 | displayName: macOS Cargo Test
11 | condition: and(eq( variables['Agent.OS'], 'Darwin' ), eq( variables['CI_JOB'], 'test-all' ))
12 | - script: 'ROARING_ARCH=x86-64-v2 cargo test --all'
13 | displayName: Linux Cargo Test
14 | condition: and(eq( variables['Agent.OS'], 'Linux' ), eq( variables['CI_JOB'], 'test-all' ))
15 |
--------------------------------------------------------------------------------
/.ci/win32_cargo.bat:
--------------------------------------------------------------------------------
1 | call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars32.bat"
2 | call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat"
3 |
4 | cargo %1 %2 %3 %4 %5 %6 %7
5 |
--------------------------------------------------------------------------------
/.ci/win64_cargo.bat:
--------------------------------------------------------------------------------
1 | call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
2 | call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
3 |
4 | cargo %1 %2 %3 %4 %5 %6 %7
5 |
--------------------------------------------------------------------------------
/.ci/windows-release.yml:
--------------------------------------------------------------------------------
1 | steps:
2 | - script: '.ci\win64_cargo.bat test --all'
3 | env:
4 | LIBCLANG_PATH: C:\Program Files\LLVM\lib
5 | LLVM_CONFIG_PATH: C:\Program Files\LLVM\bin\llvm-config
6 | ROARING_ARCH: x86-64-v2
7 | displayName: Cargo Test All
8 | condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
9 | - script: 'build_static64.bat'
10 | env:
11 | LIBCLANG_PATH: C:\Program Files\LLVM\lib
12 | LLVM_CONFIG_PATH: C:\Program Files\LLVM\bin\llvm-config
13 | ROARING_ARCH: x86-64-v2
14 | displayName: Build Release
15 | - script: |
16 | SET MY_TAG=$(Build.SourceBranch)
17 | SET MY_TAG=%MY_TAG:~10%
18 | echo %MY_TAG%
19 | echo %PLATFORM%
20 | echo ##vso[task.setvariable variable=build.my_tag]%MY_TAG%
21 | echo ##vso[task.setvariable variable=build.platform]%PLATFORM%
22 | displayName: "Create my tag variable"
23 | condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
24 | - task: CopyFiles@2
25 | displayName: Copy assets
26 | condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
27 | inputs:
28 | sourceFolder: '$(Build.SourcesDirectory)\target\release'
29 | contents: 'mwc-wallet.exe'
30 | targetFolder: '$(Build.BinariesDirectory)\mwc-wallet'
31 | - task: ArchiveFiles@2
32 | displayName: Gather assets
33 | condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
34 | inputs:
35 | rootFolderOrFile: '$(Build.BinariesDirectory)\mwc-wallet'
36 | archiveType: 'zip'
37 | archiveFile: '$(Build.ArtifactStagingDirectory)\mwc-wallet-$(build.my_tag)-$(build.platform).zip'
38 | - script: |
39 | powershell -Command "cd $(Build.ArtifactStagingDirectory); get-filehash -algorithm sha256 mwc-wallet-$(build.my_tag)-$(build.platform).zip | Format-List | Out-String | ForEach-Object { $_.Trim() } > mwc-wallet-$(build.my_tag)-$(build.platform)-sha256sum.txt"
40 | displayName: Create Checksum
41 | condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
42 | - task: GithubRelease@0
43 | displayName: Github release
44 | condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
45 | inputs:
46 | gitHubConnection: 'github.com_vekamo'
47 | repositoryName: 'mwcproject/mwc-wallet'
48 | action: 'edit'
49 | tagSource: "Git tag"
50 | tag: '$(build.my_tag)'
51 | assets: |
52 | $(Build.ArtifactStagingDirectory)\mwc-wallet-$(build.my_tag)-$(build.platform).zip
53 | $(Build.ArtifactStagingDirectory)\mwc-wallet-$(build.my_tag)-$(build.platform)-sha256sum.txt
54 | title: '$(build.my_tag)'
55 | assetUploadMode: 'replace'
56 | addChangeLog: true
57 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [e.g. iOS]
28 | - Version [e.g. 22]
29 |
30 | **Additional context**
31 | Add any other context about the problem here.
32 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/.github/workflows/cd.yaml:
--------------------------------------------------------------------------------
1 | name: Continuous Deployment
2 |
3 | on:
4 | push:
5 | tags:
6 | - "v*.*.*"
7 |
8 | jobs:
9 | linux-release:
10 | name: Linux Release
11 | runs-on: ubuntu-latest
12 | steps:
13 | - uses: actions/checkout@v3
14 | - name: Build
15 | run: cargo build --release
16 | - name: Archive
17 | working-directory: target/release
18 | run: tar -czvf grin-wallet-${{ github.ref_name }}-linux-x86_64.tar.gz grin-wallet
19 | - name: Create Checksum
20 | working-directory: target/release
21 | run: openssl sha256 grin-wallet-${{ github.ref_name }}-linux-x86_64.tar.gz > grin-wallet-${{ github.ref_name }}-linux-x86_64-sha256sum.txt
22 | - name: Release
23 | uses: softprops/action-gh-release@v1
24 | with:
25 | generate_release_notes: true
26 | files: |
27 | target/release/grin-wallet-${{ github.ref_name }}-linux-x86_64.tar.gz
28 | target/release/grin-wallet-${{ github.ref_name }}-linux-x86_64-sha256sum.txt
29 |
30 | macos-release:
31 | name: macOS Release
32 | runs-on: macos-latest
33 | steps:
34 | - name: Checkout
35 | uses: actions/checkout@v3
36 | - name: Build
37 | run: cargo build --release
38 | - name: Archive
39 | working-directory: target/release
40 | run: tar -czvf grin-wallet-${{ github.ref_name }}-macos-x86_64.tar.gz grin-wallet
41 | - name: Create Checksum
42 | working-directory: target/release
43 | run: openssl sha256 grin-wallet-${{ github.ref_name }}-macos-x86_64.tar.gz > grin-wallet-${{ github.ref_name }}-macos-x86_64-sha256sum.txt
44 | - name: Release
45 | uses: softprops/action-gh-release@v1
46 | with:
47 | files: |
48 | target/release/grin-wallet-${{ github.ref_name }}-macos-x86_64.tar.gz
49 | target/release/grin-wallet-${{ github.ref_name }}-macos-x86_64-sha256sum.txt
50 |
51 | windows-release:
52 | name: Windows Release
53 | runs-on: windows-latest
54 | steps:
55 | - name: Checkout
56 | uses: actions/checkout@v3
57 | - name: Build
58 | run: cargo build --release
59 | - name: Archive
60 | uses: vimtor/action-zip@v1
61 | with:
62 | files: target/release/grin-wallet.exe
63 | dest: target/release/grin-wallet-${{ github.ref_name }}-win-x86_64.zip
64 | - name: Create Checksum
65 | working-directory: target/release
66 | shell: pwsh
67 | run: get-filehash -algorithm sha256 grin-wallet-${{ github.ref_name }}-win-x86_64.zip | Format-List | Out-String | ForEach-Object { $_.Trim() } > grin-wallet-${{ github.ref_name }}-win-x86_64-sha256sum.txt
68 | - name: Release
69 | uses: softprops/action-gh-release@v1
70 | with:
71 | files: |
72 | target/release/grin-wallet-${{ github.ref_name }}-win-x86_64.zip
73 | target/release/grin-wallet-${{ github.ref_name }}-win-x86_64-sha256sum.txt
--------------------------------------------------------------------------------
/.github/workflows/ci.yaml:
--------------------------------------------------------------------------------
1 | name: Continuous Integration
2 | on: [push, pull_request]
3 |
4 | jobs:
5 | linux-tests:
6 | name: Linux Tests
7 | runs-on: ubuntu-latest
8 | strategy:
9 | matrix:
10 | job_args: [api, config, controller, impls, libwallet, .]
11 | steps:
12 | - uses: actions/checkout@v3
13 | - name: Test ${{ matrix.job_args }}
14 | working-directory: ${{ matrix.job_args }}
15 | run: cargo test --release
16 |
17 | macos-tests:
18 | name: macOS Tests
19 | runs-on: macos-latest
20 | steps:
21 | - name: Checkout
22 | uses: actions/checkout@v3
23 | - name: Tests
24 | run: cargo test --release --all
25 |
26 | windows-tests:
27 | name: Windows Tests
28 | runs-on: windows-latest
29 | steps:
30 | - name: Checkout
31 | uses: actions/checkout@v3
32 | - name: Tests
33 | run: cargo test --release --all
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.swp
2 | .DS_Store
3 | .grin*
4 | .mwc*
5 | node*
6 | !node_clients
7 | !node_clients.rs
8 | target
9 | */Cargo.lock
10 | *.iml
11 | grin.log
12 | wallet.seed
13 | test_output
14 | .idea/
15 |
--------------------------------------------------------------------------------
/.hooks/pre-commit:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # Copyright 2018 The Grin Developers
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | rustfmt --version &>/dev/null
18 | if [ $? != 0 ]; then
19 | printf "[pre_commit] \033[0;31merror\033[0m: \"rustfmt\" not available. \n"
20 | printf "[pre_commit] \033[0;31merror\033[0m: rustfmt can be installed via - \n"
21 | printf "[pre_commit] $ rustup component add rustfmt-preview \n"
22 | exit 1
23 | fi
24 |
25 | result=0
26 | problem_files=()
27 |
28 | printf "[pre_commit] rustfmt "
29 |
30 | for file in $(git diff --name-only --cached); do
31 | if [ ${file: -3} == ".rs" ]; then
32 | # first collect all the files that need reformatting
33 | rustfmt --check $file &>/dev/null
34 | if [ $? != 0 ]; then
35 | problem_files+=($file)
36 | result=1
37 | fi
38 | fi
39 | done
40 |
41 | # now reformat all the files that need reformatting
42 | for file in ${problem_files[@]}; do
43 | rustfmt $file
44 | done
45 |
46 | # and let the user know what just happened (and which files were affected)
47 | printf "\033[0;32mok\033[0m \n"
48 | if [ $result != 0 ]; then
49 | # printf "\033[0;31mrustfmt\033[0m \n"
50 | printf "[pre_commit] the following files were rustfmt'd (not yet committed): \n"
51 |
52 | for file in ${problem_files[@]}; do
53 | printf "\033[0;31m $file\033[0m \n"
54 | done
55 | fi
56 |
57 | exit 0
58 | # to actually fail the build on rustfmt failure -
59 | # exit $result
60 |
--------------------------------------------------------------------------------
/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "mwc_wallet"
3 | version = "5.3.6"
4 | authors = ["Mwc Developers "]
5 | description = "Simple, private and scalable cryptocurrency implementation based on the MimbleWimble chain format."
6 | license = "Apache-2.0"
7 | repository = "https://github.com/mwc-project/mwc-wallet"
8 | keywords = [ "crypto", "mwc", "mimblewimble" ]
9 | readme = "README.md"
10 | exclude = ["**/*.mwc", "**/*.mwc2"]
11 | build = "src/build/build.rs"
12 | edition = "2018"
13 |
14 | [[bin]]
15 | name = "mwc-wallet"
16 | path = "src/bin/mwc-wallet.rs"
17 |
18 | [workspace]
19 | members = ["api", "config", "controller", "impls", "libwallet", "util"]
20 | exclude = ["integration"]
21 |
22 | [dependencies]
23 | clap = { version = "2.33", features = ["yaml"] }
24 | rpassword = "4.0"
25 | thiserror = "1"
26 | prettytable-rs = "0.10"
27 | log = "0.4"
28 | linefeed = "0.6"
29 | semver = "0.10"
30 | rustyline = "6"
31 | lazy_static = "1.4"
32 | ed25519-dalek = "1.0.0-pre.4"
33 | x25519-dalek = "0.6"
34 | # Fixing issue with bitvec
35 | funty = "=1.1.0"
36 | uuid = { version = "0.8", features = ["serde", "v4"] }
37 | shlex = "1.3.0"
38 |
39 | mwc_wallet_api = { path = "./api", version = "5.3.6" }
40 | mwc_wallet_impls = { path = "./impls", version = "5.3.6" }
41 | mwc_wallet_libwallet = { path = "./libwallet", version = "5.3.6" }
42 | mwc_wallet_controller = { path = "./controller", version = "5.3.6" }
43 | mwc_wallet_config = { path = "./config", version = "5.3.6" }
44 | mwc_wallet_util = { path = "./util", version = "5.3.6" }
45 |
46 | [build-dependencies]
47 | built = { version = "0.4", features = ["git2"]}
48 |
49 | [dev-dependencies]
50 | url = "2.1"
51 | serde = "1"
52 | serde_derive = "1"
53 | serde_json = "1"
54 | remove_dir_all = "0.7"
55 | easy-jsonrpc-mwc = { git = "https://github.com/mwcproject/easy-jsonrpc-mwc", version = "0.5.5", branch = "master" }
56 |
57 | [patch.crates-io]
58 | mwc_secp256k1zkp = { git = "https://github.com/mwcproject/rust-secp256k1-zkp", tag = "0.7.16" }
59 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # MWC Wallet
3 |
4 | This is the reference implementation of MWC's wallet. It consists of 2 major pieces:
5 |
6 | * The MWC Wallet APIs, which are intended for use by MWC community wallet developers. The wallet APIs can be directly linked into other projects or invoked via a JSON-RPC interface.
7 |
8 | * A reference command-line wallet, which provides a baseline wallet for MWC and demonstrates how the wallet APIs should be called.
9 |
10 | # Usage
11 |
12 | To use the command-line wallet, we recommend using the latest release from the Releases page. There are distributions for Linux, MacOS and Windows.
13 |
14 | Full documentation outlining how to use the command line wallet can be found on [MWC's Wiki](https://github.com/mwcproject/docs/wiki/Wallet-User-Guide)
15 |
16 | # License
17 |
18 | Apache License v2.0
19 |
20 |
--------------------------------------------------------------------------------
/api/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "mwc_wallet_api"
3 | version = "5.3.6"
4 | authors = ["Mwc Developers "]
5 | description = "Mwc Wallet API"
6 | license = "Apache-2.0"
7 | repository = "https://github.com/mwcproject/mwc-wallet"
8 | keywords = [ "crypto", "mwc", "mimblewimble" ]
9 | exclude = ["**/*.mwc", "**/*.mwc2"]
10 | edition = "2018"
11 |
12 | [dependencies]
13 | log = "0.4"
14 | uuid = { version = "0.8", features = ["serde", "v4"] }
15 | serde = "1"
16 | rand = "0.6"
17 | serde_derive = "1"
18 | serde_json = "1"
19 | chrono = { version = "0.4.11", features = ["serde"] }
20 | ring = "0.16"
21 | base64 = "0.12"
22 | ed25519-dalek = "1.0.0-pre.4"
23 | easy-jsonrpc-mwc = { git = "https://github.com/mwcproject/easy-jsonrpc-mwc", version = "0.5.5", branch = "master" }
24 | lazy_static = "1.4"
25 |
26 | mwc_wallet_libwallet = { path = "../libwallet", version = "5.3.6" }
27 | mwc_wallet_config = { path = "../config", version = "5.3.6" }
28 | mwc_wallet_impls = { path = "../impls", version = "5.3.6" }
29 | mwc_wallet_util = { path = "../util", version = "5.3.6" }
30 |
31 | [dev-dependencies]
32 | serde_json = "1"
33 | tempfile = "3.1"
34 |
--------------------------------------------------------------------------------
/api/src/lib.rs:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Grin Developers
2 | // Copyright 2024 The Mwc Developers
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 |
16 | //! Higher level wallet functions which can be used by callers to operate
17 | //! on the wallet, as well as helpers to invoke and instantiate wallets
18 | //! and listeners
19 |
20 | #![deny(non_upper_case_globals)]
21 | #![deny(non_camel_case_types)]
22 | #![deny(non_snake_case)]
23 | #![deny(unused_mut)]
24 |
25 | use mwc_wallet_config as config;
26 | use mwc_wallet_util::mwc_core as core;
27 | use mwc_wallet_util::mwc_keychain as keychain;
28 | use mwc_wallet_util::mwc_util as util;
29 | extern crate mwc_wallet_impls as impls;
30 | extern crate mwc_wallet_libwallet as libwallet;
31 |
32 | #[macro_use]
33 | extern crate serde_derive;
34 | extern crate serde_json;
35 |
36 | #[macro_use]
37 | extern crate log;
38 | #[macro_use]
39 | extern crate lazy_static;
40 |
41 | mod foreign;
42 | mod foreign_rpc;
43 |
44 | mod owner;
45 | mod owner_rpc_v2;
46 | mod owner_rpc_v3;
47 |
48 | mod types;
49 |
50 | pub use crate::foreign::{Foreign, ForeignCheckMiddleware, ForeignCheckMiddlewareFn};
51 | pub use crate::foreign_rpc::ForeignRpc;
52 | pub use crate::owner::Owner;
53 | pub use crate::owner_rpc_v2::OwnerRpcV2;
54 | pub use crate::owner_rpc_v3::OwnerRpcV3;
55 |
56 | pub use crate::foreign_rpc::foreign_rpc as foreign_rpc_client;
57 | pub use crate::foreign_rpc::run_doctest_foreign;
58 | pub use crate::owner_rpc_v2::run_doctest_owner;
59 |
60 | pub use types::{
61 | ECDHPubkey, EncryptedRequest, EncryptedResponse, EncryptionErrorResponse, JsonId, PubAddress,
62 | Token,
63 | };
64 |
--------------------------------------------------------------------------------
/azure-pipelines.yml:
--------------------------------------------------------------------------------
1 | # Copyright 2024 The Mwc Developers
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | trigger:
16 | branches:
17 | include:
18 | - master
19 | tags:
20 | include: ['*']
21 |
22 | pr:
23 | branches:
24 | include: ['*']
25 |
26 | variables:
27 | RUST_BACKTRACE: '1'
28 | RUSTFLAGS: '-C debug-assertions'
29 | ghpages_user: 'mwcproject'
30 | ghpages_repo: 'mwcproject.github.io'
31 | ghpages_auth_header: '$(echo -n "${ghpages_user}:$(github_pat)" | base64);'
32 |
33 | jobs:
34 | - job: linux
35 | timeoutInMinutes: 120
36 | pool:
37 | vmImage: ubuntu-latest
38 | strategy:
39 | matrix:
40 | test:
41 | CI_JOB: test-all
42 | release:
43 | CI_JOB: release
44 | PLATFORM: linux-x64
45 | steps:
46 | - script: |
47 | sudo apt-get update -yqq
48 | sudo apt-get purge --auto-remove clang-12 clang-format-12 llvm-12 llvm-12-dev llvm-12-tools llvm-12-runtime clang-11 clang-format-11 llvm-11 llvm-11-dev llvm-11-tools llvm-11-runtime clang-10 clang-format-10 llvm-10 llvm-10-dev llvm-10-tools llvm-10-runtime clang-9 clang-format-9 llvm-9 llvm-9-dev llvm-9-tools llvm-9-runtime
49 | sudo apt install clang-8 git curl make build-essential mesa-utils libgl1-mesa-dev openssl libssl-dev -y
50 | sudo apt-get install -yqq --no-install-recommends libncursesw5-dev
51 | - template: '.ci/test.yml'
52 | - template: '.ci/release.yml'
53 | - job: macos
54 | timeoutInMinutes: 120
55 | pool:
56 | vmImage: macos-latest
57 | strategy:
58 | matrix:
59 | test:
60 | CI_JOB: test-all
61 | release:
62 | CI_JOB: release
63 | PLATFORM: macos-x64
64 | steps:
65 | - template: '.ci/test.yml'
66 | - template: '.ci/release.yml'
67 | - job: windows
68 | pool:
69 | vmImage: windows-latest
70 | strategy:
71 | matrix:
72 | test:
73 | CI_JOB: test-all
74 | release:
75 | CI_JOB: release
76 | PLATFORM: win-x64
77 | steps:
78 | - script: |
79 | choco install -y llvm
80 | choco install -y openssl
81 | displayName: Windows Install LLVM
82 | - template: '.ci/test.yml'
83 | - template: '.ci/windows-release.yml'
84 | - job: Docs
85 | timeoutInMinutes: 60
86 | pool:
87 | vmImage: ubuntu-latest
88 | strategy:
89 | matrix:
90 | release:
91 | CI_JOB: release
92 | PLATFORM: linux-x64
93 | steps:
94 | - template: '.ci/pushdocs.yml'
95 |
--------------------------------------------------------------------------------
/build_static.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | cargo clean
4 | export OPENSSL_LIB_DIR=/usr/local/opt/openssl@1.1/lib/;
5 | export OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl@1.1/include;
6 | export OPENSSL_STATIC=yes
7 |
8 | ROARING_ARCH=x86-64-v2
9 |
10 | cargo build --release
11 |
--------------------------------------------------------------------------------
/build_static32.bat:
--------------------------------------------------------------------------------
1 | cargo clean
2 |
3 | set OPENSSL_LIB_DIR=C:\Program Files (x86)\OpenSSL-Win32/lib/
4 | set OPENSSL_INCLUDE_DIR=C:\Program Files (x86)\OpenSSL-Win32/include
5 | set OPENSSL_STATIC=yes
6 | set LIBCLANG_PATH=C:\Program Files (x86)\LLVM\bin\
7 |
8 | call .ci\win32_cargo.bat +stable-i686-pc-windows-msvc build --release
9 |
--------------------------------------------------------------------------------
/build_static64.bat:
--------------------------------------------------------------------------------
1 | cargo clean
2 |
3 | set OPENSSL_LIB_DIR=C:\Program Files\OpenSSL-Win64\lib\
4 | set OPENSSL_INCLUDE_DIR=C:\Program Files\OpenSSL-Win64\include
5 | set OPENSSL_STATIC=yes
6 | set LIBCLANG_PATH=C:\Program Files\LLVM\bin\libclang.dll
7 |
8 | call .ci\win64_cargo.bat build --release
9 |
--------------------------------------------------------------------------------
/build_static_linux.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | cargo clean
4 | export OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu/
5 | export OPENSSL_INCLUDE_DIR=/usr/include/openssl/
6 | export OPENSSL_STATIC=yes
7 |
8 | ROARING_ARCH=x86-64-v2
9 |
10 | cargo build --release
11 |
12 |
--------------------------------------------------------------------------------
/config/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "mwc_wallet_config"
3 | version = "5.3.6"
4 | authors = ["Mwc Developers "]
5 | description = "Configuration for mwc wallet , a simple, private and scalable cryptocurrency implementation based on the MimbleWimble chain format."
6 | license = "Apache-2.0"
7 | repository = "https://github.com/mwcproject/mwc-wallet"
8 | keywords = [ "crypto", "mwc", "mimblewimble" ]
9 | workspace = ".."
10 | edition = "2018"
11 |
12 | [dependencies]
13 | rand = "0.6"
14 | serde = "1"
15 | dirs = "2.0"
16 | toml = "0.5"
17 | serde_derive = "1"
18 | thiserror = "1"
19 |
20 | mwc_wallet_util = { path = "../util", version = "5.3.6" }
21 |
22 | [dev-dependencies]
23 | pretty_assertions = "0.6"
24 |
--------------------------------------------------------------------------------
/config/src/lib.rs:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Grin Developers
2 | // Copyright 2024 The Mwc Developers
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 |
16 | //! Crate wrapping up the Mwc binary and configuration file
17 |
18 | #![deny(non_upper_case_globals)]
19 | #![deny(non_camel_case_types)]
20 | #![deny(non_snake_case)]
21 | #![deny(unused_mut)]
22 | #![warn(missing_docs)]
23 |
24 | #[macro_use]
25 | extern crate serde_derive;
26 |
27 | use mwc_wallet_util::mwc_core as core;
28 | use mwc_wallet_util::mwc_util as util;
29 |
30 | mod comments;
31 | pub mod config;
32 | #[allow(missing_docs)]
33 | pub mod types;
34 |
35 | pub use crate::config::{
36 | config_file_exists, initial_setup_wallet, MWC_WALLET_DIR, WALLET_CONFIG_FILE_NAME,
37 | };
38 | pub use crate::types::{
39 | parse_node_address_string, ConfigError, GlobalWalletConfig, GlobalWalletConfigMembers,
40 | MQSConfig, TorConfig, WalletConfig,
41 | };
42 |
--------------------------------------------------------------------------------
/controller/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "mwc_wallet_controller"
3 | version = "5.3.6"
4 | authors = ["Mwc Developers "]
5 | description = "Controllers for mwc wallet instantiation"
6 | license = "Apache-2.0"
7 | repository = "https://github.com/mwcproject/mwc-wallet"
8 | keywords = [ "crypto", "mwc", "mimblewimble" ]
9 | exclude = ["**/*.mwc", "**/*.mwc2"]
10 | #build = "src/build/build.rs"
11 | edition = "2018"
12 |
13 | [dependencies]
14 | futures = "0.3"
15 | hyper = "0.13"
16 | rand = "0.7"
17 | serde = "1"
18 | serde_derive = "1"
19 | serde_json = "1"
20 | log = "0.4"
21 | prettytable-rs = "0.10"
22 | ring = "0.16"
23 | term = "0.6"
24 | tokio = { version = "0.2", features = ["full"] }
25 | uuid = { version = "0.8", features = ["serde", "v4"] }
26 | url = "2.1"
27 | chrono = { version = "0.4.11", features = ["serde"] }
28 | lazy_static = "1.4"
29 | thiserror = "1"
30 | qr_code = "1.1.0"
31 | colored = "1.6"
32 | x25519-dalek = "0.6"
33 | ed25519-dalek = "1.0.0-pre.4"
34 | mwc-wagyu-ethereum = { git = "https://github.com/mwcproject/wagyu-ethereum", version = "0.6.3", branch = "master" }
35 | mwc-libp2p = { git = "https://github.com/mwcproject/rust-libp2p", version="0.35.3", branch = "master", default-features = false, features = [ "noise", "yamux", "mplex", "dns", "tcp-tokio", "ping", "gossipsub"] }
36 | #libp2p = { path = "../../rust-libp2p", default-features = false, features = [ "noise", "yamux", "mplex", "dns", "tcp-tokio", "ping", "gossipsub"] }
37 | easy-jsonrpc-mwc = { git = "https://github.com/mwcproject/easy-jsonrpc-mwc", version = "0.5.5", branch = "master" }
38 |
39 | mwc_wallet_util = { path = "../util", version = "5.3.6" }
40 | mwc_wallet_api = { path = "../api", version = "5.3.6" }
41 | mwc_wallet_impls = { path = "../impls", version = "5.3.6" }
42 | mwc_wallet_libwallet = { path = "../libwallet", version = "5.3.6" }
43 | mwc_wallet_config = { path = "../config", version = "5.3.6" }
44 |
45 | [dev-dependencies]
46 | remove_dir_all = "0.7"
47 |
--------------------------------------------------------------------------------
/controller/src/error.rs:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The Grin Developers
2 | // Copyright 2024 The Mwc Developers
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 |
16 | //! Implementation specific error types
17 | use crate::api;
18 | use crate::core::core::transaction;
19 | use crate::core::libtx;
20 | use crate::impls;
21 | use crate::keychain;
22 |
23 | /// Wallet errors, mostly wrappers around underlying crypto or I/O errors.
24 | #[derive(Clone, Eq, PartialEq, Debug, thiserror::Error)]
25 | pub enum Error {
26 | /// LibTX Error
27 | #[error("LibTx Error, {0}")]
28 | LibTX(#[from] libtx::Error),
29 |
30 | /// Impls error
31 | #[error("Impls Error, {0}")]
32 | Impls(#[from] impls::Error),
33 |
34 | /// LibWallet Error
35 | #[error("LibWallet Error, {0}")]
36 | LibWallet(String),
37 |
38 | /// Swap Error
39 | #[error("Swap error, {0}")]
40 | SwapError(String),
41 |
42 | /// Keychain error
43 | #[error("Keychain error, {0}")]
44 | Keychain(#[from] keychain::Error),
45 |
46 | /// Transaction Error
47 | #[error("Transaction error, {0}")]
48 | Transaction(#[from] transaction::Error),
49 |
50 | /// Secp Error
51 | #[error("Secp error, {0}")]
52 | Secp(String),
53 |
54 | /// Filewallet error
55 | #[error("Wallet data error: {0}")]
56 | FileWallet(&'static str),
57 |
58 | /// Error when formatting json
59 | #[error("Controller IO error, {0}")]
60 | IO(String),
61 |
62 | /// Error when formatting json
63 | #[error("Serde JSON error, {0}")]
64 | Format(String),
65 |
66 | /// Error when contacting a node through its API
67 | #[error("Node API error, {0}")]
68 | Node(#[from] api::Error),
69 |
70 | /// Error originating from hyper.
71 | #[error("Hyper error, {0}")]
72 | Hyper(String),
73 |
74 | /// Error originating from hyper uri parsing.
75 | #[error("Uri parsing error")]
76 | Uri,
77 |
78 | /// Attempt to use duplicate transaction id in separate transactions
79 | #[error("Duplicate transaction ID error, {0}")]
80 | DuplicateTransactionId(String),
81 |
82 | /// Wallet seed already exists
83 | #[error("Wallet seed file exists: {0}")]
84 | WalletSeedExists(String),
85 |
86 | /// Wallet seed doesn't exist
87 | #[error("Wallet seed doesn't exist error")]
88 | WalletSeedDoesntExist,
89 |
90 | /// Enc/Decryption Error
91 | #[error("Enc/Decryption error (check password?)")]
92 | Encryption,
93 |
94 | /// BIP 39 word list
95 | #[error("BIP39 Mnemonic (word list) Error")]
96 | Mnemonic,
97 |
98 | /// Command line argument error
99 | #[error("Invalid argument: {0}")]
100 | ArgumentError(String),
101 |
102 | /// Other
103 | #[error("Generic error: {0}")]
104 | GenericError(String),
105 |
106 | /// Listener error
107 | #[error("Listener Startup Error")]
108 | ListenerError,
109 |
110 | /// Tor Configuration Error
111 | #[error("Tor Config Error: {0}")]
112 | TorConfig(String),
113 |
114 | /// Tor Process error
115 | #[error("Tor Process Error: {0}")]
116 | TorProcess(String),
117 |
118 | /// MQS Configuration Error
119 | #[error("MQS Config Error: {0}")]
120 | MQSConfig(String),
121 |
122 | ///rejecting invoice as auto invoice acceptance is turned off
123 | #[error("Rejecting invoice as auto invoice acceptance is turned off!")]
124 | DoesNotAcceptInvoices,
125 |
126 | ///when invoice amount is too big(added with mqs feature)
127 | #[error("Rejecting invoice as amount '{0}' is too big!")]
128 | InvoiceAmountTooBig(u64),
129 |
130 | /// Verify slate messages call failure
131 | #[error("Failed verifying slate messages, {0}")]
132 | VerifySlateMessagesError(String),
133 |
134 | /// Processing swap message failure
135 | #[error("Failed processing swap messages, {0}")]
136 | ProcessSwapMessageError(String),
137 | }
138 |
139 | impl From for Error {
140 | fn from(error: mwc_wallet_libwallet::Error) -> Error {
141 | Error::LibWallet(format!("{}", error))
142 | }
143 | }
144 |
145 | impl From for Error {
146 | fn from(error: mwc_wallet_libwallet::swap::Error) -> Error {
147 | Error::SwapError(format!("{}", error))
148 | }
149 | }
150 |
--------------------------------------------------------------------------------
/controller/src/executor.rs:
--------------------------------------------------------------------------------
1 | use crate::error::Error;
2 | use futures::task::{waker_ref, ArcWake, Context, Poll};
3 | use futures::Future;
4 | use std::pin::Pin;
5 | use std::sync::atomic::{AtomicBool, Ordering};
6 | use std::sync::{Arc, RwLock};
7 | use std::thread;
8 | use std::time::Duration;
9 |
10 | // Custom executor example. It is not much related to this implementation because
11 | // rust future model was changed a lot.
12 | // https://rust-lang.github.io/async-book/02_execution/04_executor.html
13 |
14 | pub struct RunHandlerInThread {
15 | // running flag is modifiable from worker thread and Poll.
16 | running: Arc,
17 | waker: Arc>>,
18 | // Need option because join require ownership transfer. That is why can't belong to 'self' dicertly
19 | // (State, Result>) - resulting from API call as required by gotham
20 | worker_thread: RwLock