From 91f25f361ffe8a381e37e19a1889cd702b49c0a3 Mon Sep 17 00:00:00 2001 From: Martin Chtilianov <55666785+mchtilianov@users.noreply.github.com> Date: Sat, 21 Oct 2023 17:04:57 +0300 Subject: [PATCH 1/6] Fixed error in returned value of create_account method --- src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index c4c1317..90296ba 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1361,10 +1361,10 @@ impl WalletClient { pub async fn create_account(&self, label: Option) -> anyhow::Result{ let params = empty() .chain(once(("label", label.into()))); - Ok(self - .inner - .request::("create_account", RpcParams::map(params)) - .await?) + self + .inner + .request::("create_account", RpcParams::map(params)) + .await } } From e502d76192abed792dd5c919d998a8535cda1776 Mon Sep 17 00:00:00 2001 From: Martin Chtilianov <55666785+mchtilianov@users.noreply.github.com> Date: Sat, 21 Oct 2023 17:13:14 +0300 Subject: [PATCH 2/6] Formatted lib.rs --- src/lib.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 90296ba..bf33897 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1358,13 +1358,11 @@ impl WalletClient { } /// Create a new account - pub async fn create_account(&self, label: Option) -> anyhow::Result{ - let params = empty() - .chain(once(("label", label.into()))); - self - .inner - .request::("create_account", RpcParams::map(params)) - .await + pub async fn create_account(&self, label: Option) -> anyhow::Result { + let params = empty().chain(once(("label", label.into()))); + self.inner + .request::("create_account", RpcParams::map(params)) + .await } } From 8ad40ebca38667867981674d468a13355fafdea3 Mon Sep 17 00:00:00 2001 From: Martin Chtilianov <55666785+mchtilianov@users.noreply.github.com> Date: Sat, 21 Oct 2023 17:14:13 +0300 Subject: [PATCH 3/6] Formatted models.rs --- src/models.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/models.rs b/src/models.rs index 531bde8..c9b0db4 100644 --- a/src/models.rs +++ b/src/models.rs @@ -566,7 +566,6 @@ pub struct CreateWallet { pub account_index: u32, /// Generated wallet address. pub address: Address, - } #[cfg(test)] From 4fa18c8b3da4fdd4bc33032bbbe54fe7c7eb64f1 Mon Sep 17 00:00:00 2001 From: Martin Chtilianov <55666785+mchtilianov@users.noreply.github.com> Date: Sat, 21 Oct 2023 17:15:00 +0300 Subject: [PATCH 4/6] Formatted wallet.rs --- tests/clients_tests/helpers/wallet.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/clients_tests/helpers/wallet.rs b/tests/clients_tests/helpers/wallet.rs index c25193a..95b139e 100644 --- a/tests/clients_tests/helpers/wallet.rs +++ b/tests/clients_tests/helpers/wallet.rs @@ -756,8 +756,8 @@ pub async fn set_attribute_assert_ok(wallet: &WalletClient, key: String, value: wallet.set_attribute(key, value).await.unwrap() } -pub async fn create_account_assert_ok(wallet: &WalletClient, label: Option){ +pub async fn create_account_assert_ok(wallet: &WalletClient, label: Option) { let res = wallet.create_account(label).await; assert!(res.is_ok()); assert!(res.unwrap().account_index >= 1); -} \ No newline at end of file +} From 89232bbac7ccad0be13959bb09cc8b98b1064096 Mon Sep 17 00:00:00 2001 From: Martin Chtilianov <55666785+mchtilianov@users.noreply.github.com> Date: Tue, 24 Oct 2023 19:07:54 +0300 Subject: [PATCH 5/6] Added support for the create_wallet rpc method (#120) * Added support for the create_wallet rpc method * Fixed error in returned value of create_account method * Formatted lib.rs * Formatted models.rs * Formatted wallet.rs --- src/lib.rs | 8 ++++++++ src/models.rs | 9 +++++++++ tests/clients_tests/basic_wallet.rs | 1 + tests/clients_tests/helpers/wallet.rs | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index eb07f84..bf33897 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1356,6 +1356,14 @@ impl WalletClient { Ok(()) } + + /// Create a new account + pub async fn create_account(&self, label: Option) -> anyhow::Result { + let params = empty().chain(once(("label", label.into()))); + self.inner + .request::("create_account", RpcParams::map(params)) + .await + } } #[cfg(test)] diff --git a/src/models.rs b/src/models.rs index 777545a..c9b0db4 100644 --- a/src/models.rs +++ b/src/models.rs @@ -559,6 +559,15 @@ pub struct KeyImageImportResponse { pub unspent: Amount, } +/// Return type of wallet `create_wallet`. +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct CreateWallet { + /// Index of the new account. + pub account_index: u32, + /// Generated wallet address. + pub address: Address, +} + #[cfg(test)] mod tests { use super::*; diff --git a/tests/clients_tests/basic_wallet.rs b/tests/clients_tests/basic_wallet.rs index 50db0f4..ea92fe4 100644 --- a/tests/clients_tests/basic_wallet.rs +++ b/tests/clients_tests/basic_wallet.rs @@ -313,5 +313,6 @@ pub async fn run() { ) .await; + helpers::wallet::create_account_assert_ok(&wallet, Some(String::from("test"))).await; helpers::wallet::close_wallet_assert_ok(&wallet).await; } diff --git a/tests/clients_tests/helpers/wallet.rs b/tests/clients_tests/helpers/wallet.rs index f15ac7b..95b139e 100644 --- a/tests/clients_tests/helpers/wallet.rs +++ b/tests/clients_tests/helpers/wallet.rs @@ -755,3 +755,9 @@ pub async fn get_attribute_assert_ok(wallet: &WalletClient, key: String, expecte pub async fn set_attribute_assert_ok(wallet: &WalletClient, key: String, value: String) { wallet.set_attribute(key, value).await.unwrap() } + +pub async fn create_account_assert_ok(wallet: &WalletClient, label: Option) { + let res = wallet.create_account(label).await; + assert!(res.is_ok()); + assert!(res.unwrap().account_index >= 1); +} From 9fc02ffdf9098f5a31242bb9d26d5ee7849056a9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Oct 2023 18:17:05 +0200 Subject: [PATCH 6/6] chore(deps): bump monero-rs/workflows from 2.0.2 to 2.0.3 (#118) Bumps [monero-rs/workflows](https://github.com/monero-rs/workflows) from 2.0.2 to 2.0.3. - [Release notes](https://github.com/monero-rs/workflows/releases) - [Changelog](https://github.com/monero-rs/workflows/blob/main/CHANGELOG.md) - [Commits](https://github.com/monero-rs/workflows/compare/v2.0.2...v2.0.3) --- updated-dependencies: - dependency-name: monero-rs/workflows dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/create-release.yml | 4 ++-- .github/workflows/draft-new-release.yml | 2 +- .github/workflows/release-to-crates-io.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 3d455df..4a27dab 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -9,11 +9,11 @@ jobs: create_release: name: Create from merged release branch if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/') - uses: monero-rs/workflows/.github/workflows/create-release.yml@v2.0.2 + uses: monero-rs/workflows/.github/workflows/create-release.yml@v2.0.3 release_to_crates: name: Publish the new release to crates.io - uses: monero-rs/workflows/.github/workflows/release-to-crates-io.yml@v2.0.2 + uses: monero-rs/workflows/.github/workflows/release-to-crates-io.yml@v2.0.3 # Do not run before creating the release is done needs: create_release secrets: diff --git a/.github/workflows/draft-new-release.yml b/.github/workflows/draft-new-release.yml index 7f9784d..11b7bab 100644 --- a/.github/workflows/draft-new-release.yml +++ b/.github/workflows/draft-new-release.yml @@ -10,7 +10,7 @@ on: jobs: draft-new-release: name: Draft a new release - uses: monero-rs/workflows/.github/workflows/draft-new-release.yml@v2.0.2 + uses: monero-rs/workflows/.github/workflows/draft-new-release.yml@v2.0.3 with: version: ${{ github.event.inputs.version }} base_branch: 'main' diff --git a/.github/workflows/release-to-crates-io.yml b/.github/workflows/release-to-crates-io.yml index 0be499d..d436814 100644 --- a/.github/workflows/release-to-crates-io.yml +++ b/.github/workflows/release-to-crates-io.yml @@ -8,7 +8,7 @@ on: jobs: release_to_crates: name: Publish the new release to crates.io - uses: monero-rs/workflows/.github/workflows/release-to-crates-io.yml@v2.0.2 + uses: monero-rs/workflows/.github/workflows/release-to-crates-io.yml@v2.0.3 secrets: cratesio_token: ${{ secrets.H4SH3D_CARGO_REGISTRY_TOKEN }}