From 29091aab8e1e7132296255d7506cb39954e0fb47 Mon Sep 17 00:00:00 2001 From: Dave Hrycyszyn Date: Thu, 5 Jan 2023 15:35:47 +0000 Subject: [PATCH] Feature/rename nymd to nyxd (#2696) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Renaming all instances of nymd to nyxd * Might as well get the changelogs too * Making it clearer that an ApiClient is a NymApiClient * Lining up config templates with struct keys on gateway * Changed the last references to validator_urls to nyxd_urls * Fixed up a few type errors after refactoring * Changed the changelog * Fixed typo in changelog * Further instances of renaming 'nymd' + introducing additional clap aliases * updated environmental variables and allowed usage of deprecated variants * missing occurences of coconut-locked environmental variables Co-authored-by: Jędrzej Stuczyński --- .wellknown/wallet/validators.json | 12 +- CHANGELOG.md | 18 +- .../src/client/topology_control.rs | 6 +- clients/client-core/src/config/mod.rs | 14 +- clients/client-core/src/init/helpers.rs | 2 +- clients/credential/Cargo.toml | 2 +- clients/credential/src/client.rs | 22 +- clients/credential/src/commands.rs | 10 +- clients/credential/src/error.rs | 6 +- clients/credential/src/main.rs | 2 +- clients/native/Cargo.toml | 2 +- clients/native/src/client/config/template.rs | 6 +- clients/native/src/client/mod.rs | 6 +- clients/native/src/commands/init.rs | 8 +- clients/native/src/commands/mod.rs | 16 +- clients/native/src/commands/run.rs | 8 +- clients/socks5/Cargo.toml | 2 +- clients/socks5/src/client/config/template.rs | 6 +- clients/socks5/src/client/mod.rs | 6 +- clients/socks5/src/commands/init.rs | 8 +- clients/socks5/src/commands/mod.rs | 14 +- clients/socks5/src/commands/run.rs | 8 +- clients/validator/src/index.ts | 28 +- .../src/{nymd-querier.ts => nyxd-querier.ts} | 4 +- clients/validator/src/query-client.ts | 46 +- clients/validator/src/signing-client.ts | 42 +- clients/webassembly/src/gateway_selector.rs | 2 +- .../client-libs/validator-client/Cargo.toml | 4 +- .../validator-client/src/client.rs | 186 +++---- .../validator-client/src/connection_tester.rs | 86 ++-- .../client-libs/validator-client/src/error.rs | 6 +- .../client-libs/validator-client/src/lib.rs | 12 +- .../src/{nymd => nyxd}/coin.rs | 0 .../{nymd => nyxd}/cosmwasm_client/client.rs | 78 +-- .../{nymd => nyxd}/cosmwasm_client/helpers.rs | 26 +- .../{nymd => nyxd}/cosmwasm_client/logs.rs | 10 +- .../src/{nymd => nyxd}/cosmwasm_client/mod.rs | 10 +- .../cosmwasm_client/signing_client.rs | 112 ++--- .../{nymd => nyxd}/cosmwasm_client/types.rs | 70 +-- .../src/{nymd => nyxd}/error.rs | 14 +- .../src/{nymd => nyxd}/fee/gas_price.rs | 8 +- .../src/{nymd => nyxd}/fee/mod.rs | 4 +- .../src/{nymd => nyxd}/mod.rs | 126 ++--- .../traits/coconut_bandwidth_query_client.rs | 10 +- .../coconut_bandwidth_signing_client.rs | 18 +- .../{nymd => nyxd}/traits/dkg_query_client.rs | 34 +- .../traits/dkg_signing_client.rs | 24 +- .../traits/mixnet_query_client.rs | 90 ++-- .../traits/mixnet_signing_client.rs | 96 ++-- .../src/{nymd => nyxd}/traits/mod.rs | 0 .../traits/multisig_query_client.rs | 14 +- .../traits/multisig_signing_client.rs | 22 +- .../traits/vesting_query_client.rs | 78 +-- .../traits/vesting_signing_client.rs | 72 +-- .../src/{nymd => nyxd}/wallet/mod.rs | 28 +- common/commands/Cargo.toml | 2 +- common/commands/src/context/errors.rs | 6 +- common/commands/src/context/mod.rs | 48 +- common/commands/src/utils.rs | 2 +- .../commands/src/validator/account/balance.rs | 2 +- .../commands/src/validator/account/create.rs | 2 +- .../commands/src/validator/account/pubkey.rs | 4 +- common/commands/src/validator/account/send.rs | 2 +- .../validator/cosmwasm/execute_contract.rs | 2 +- .../src/validator/cosmwasm/init_contract.rs | 4 +- .../validator/cosmwasm/migrate_contract.rs | 2 +- .../mixnet/delegators/delegate_to_mixnode.rs | 2 +- .../delegators/query_for_delegations.rs | 22 +- .../rewards/claim_delegator_reward.rs | 2 +- .../rewards/vesting_claim_delegator_reward.rs | 2 +- .../delegators/undelegate_from_mixnode.rs | 2 +- .../delegators/vesting_delegate_to_mixnode.rs | 4 +- .../vesting_undelegate_from_mixnode.rs | 4 +- .../mixnet/operators/gateway/bond_gateway.rs | 2 +- .../operators/gateway/unbond_gateway.rs | 2 +- .../operators/gateway/vesting_bond_gateway.rs | 2 +- .../gateway/vesting_unbond_gateway.rs | 2 +- .../mixnet/operators/mixnode/bond_mixnode.rs | 4 +- .../mixnode/rewards/claim_operator_reward.rs | 2 +- .../rewards/vesting_claim_operator_reward.rs | 2 +- .../mixnode/settings/update_config.rs | 2 +- .../mixnode/settings/vesting_update_config.rs | 4 +- .../operators/mixnode/unbond_mixnode.rs | 2 +- .../operators/mixnode/vesting_bond_mixnode.rs | 2 +- .../mixnode/vesting_unbond_mixnode.rs | 2 +- .../mixnet/query/query_all_gateways.rs | 4 +- .../mixnet/query/query_all_mixnodes.rs | 4 +- .../commands/src/validator/signature/sign.rs | 2 +- .../src/validator/signature/verify.rs | 2 +- .../commands/src/validator/vesting/balance.rs | 2 +- .../vesting/create_vesting_schedule.rs | 6 +- .../vesting/query_vesting_schedule.rs | 2 +- .../src/validator/vesting/withdraw_vested.rs | 2 +- common/credentials/src/coconut/utils.rs | 2 +- common/execute/src/lib.rs | 4 +- common/mixnode-common/src/verloc/mod.rs | 4 +- common/network-defaults/src/lib.rs | 40 +- common/network-defaults/src/mainnet.rs | 14 +- common/network-defaults/src/var_names.rs | 8 +- common/types/Cargo.toml | 2 +- common/types/src/currency.rs | 2 +- common/types/src/error.rs | 8 +- common/types/src/fees.rs | 4 +- common/types/src/gas.rs | 2 +- common/types/src/transaction.rs | 4 +- contracts/mixnet/v2-changes.md | 2 +- docker-compose.yml | 8 +- docker/validator/init_and_start.sh | 70 +-- docker/validator/setup.sh | 2 +- envs/mainnet.env | 2 +- envs/qa-qwerty.env | 2 +- envs/qa.env | 2 +- explorer-api/Cargo.toml | 2 +- explorer-api/src/client.rs | 18 +- explorer-api/src/mix_node/delegations.rs | 2 +- explorer-api/src/tasks.rs | 12 +- explorer-api/src/validators/models.rs | 2 +- gateway/Cargo.toml | 2 +- gateway/src/commands/init.rs | 17 +- gateway/src/commands/mod.rs | 20 +- gateway/src/commands/run.rs | 15 +- gateway/src/commands/sign.rs | 8 +- gateway/src/config/mod.rs | 28 +- gateway/src/config/template.rs | 6 +- .../connection_handler/authenticated.rs | 4 +- .../websocket/connection_handler/coconut.rs | 32 +- .../connection_handler/eth_events.rs | 4 +- gateway/src/node/mod.rs | 22 +- integrations/bity/Cargo.toml | 2 +- integrations/bity/src/lib.rs | 2 +- integrations/bity/src/sign/mod.rs | 6 +- mixnode/src/commands/init.rs | 4 +- mixnode/src/commands/mod.rs | 8 +- mixnode/src/commands/run.rs | 4 +- mixnode/src/commands/sign.rs | 8 +- mixnode/src/config/mod.rs | 12 +- mixnode/src/node/mod.rs | 4 +- nym-api/Cargo.toml | 2 +- nym-api/src/coconut/client.rs | 4 +- nym-api/src/coconut/comm.rs | 12 +- nym-api/src/coconut/deposit.rs | 6 +- nym-api/src/coconut/dkg/client.rs | 10 +- nym-api/src/coconut/dkg/controller.rs | 8 +- nym-api/src/coconut/dkg/dealing.rs | 2 +- nym-api/src/coconut/dkg/public_key.rs | 2 +- nym-api/src/coconut/dkg/verification_key.rs | 4 +- nym-api/src/coconut/error.rs | 6 +- nym-api/src/coconut/mod.rs | 2 +- nym-api/src/coconut/tests.rs | 28 +- nym-api/src/config/mod.rs | 4 +- nym-api/src/contract_cache/mod.rs | 22 +- nym-api/src/epoch_operations/error.rs | 8 +- nym-api/src/epoch_operations/mod.rs | 22 +- nym-api/src/main.rs | 44 +- nym-api/src/network_monitor/mod.rs | 12 +- .../src/{nymd_client.rs => nyxd_client.rs} | 78 +-- nym-connect/CHANGELOG.md | 2 +- nym-connect/src-tauri/src/config/mod.rs | 2 +- nym-wallet/CHANGELOG.md | 6 +- nym-wallet/nym-wallet-types/Cargo.toml | 2 +- .../src/types/rust/ValidatorUrls.ts | 2 +- .../nym-wallet-types/src/network_config.rs | 8 +- nym-wallet/src-tauri/Cargo.toml | 2 +- nym-wallet/src-tauri/src/coin.rs | 6 +- nym-wallet/src-tauri/src/config/mod.rs | 110 ++--- nym-wallet/src-tauri/src/error.rs | 24 +- nym-wallet/src-tauri/src/main.rs | 6 +- nym-wallet/src-tauri/src/network_config.rs | 21 +- .../src/operations/mixnet/account.rs | 62 +-- .../src-tauri/src/operations/mixnet/admin.rs | 8 +- .../src-tauri/src/operations/mixnet/bond.rs | 30 +- .../src/operations/mixnet/delegate.rs | 26 +- .../src/operations/mixnet/families.rs | 12 +- .../src/operations/mixnet/interval.rs | 10 +- .../src/operations/mixnet/rewards.rs | 14 +- .../src-tauri/src/operations/mixnet/send.rs | 6 +- .../src/operations/signatures/sign.rs | 6 +- .../src/operations/simulate/admin.rs | 6 +- .../src/operations/simulate/cosmos.rs | 6 +- .../src/operations/simulate/mixnet.rs | 6 +- .../src-tauri/src/operations/simulate/mod.rs | 4 +- .../src/operations/simulate/vesting.rs | 6 +- .../src-tauri/src/operations/vesting/bond.rs | 20 +- .../src/operations/vesting/delegate.rs | 6 +- .../src/operations/vesting/queries.rs | 34 +- .../src/operations/vesting/rewards.rs | 6 +- nym-wallet/src-tauri/src/state.rs | 102 ++-- nym-wallet/src-tauri/src/utils.rs | 18 +- .../src/wallet_storage/account_data.rs | 4 +- .../src-tauri/src/wallet_storage/mod.rs | 2 +- tools/nym-cli/Cargo.toml | 2 +- tools/nym-cli/README.md | 4 +- tools/nym-cli/src/main.rs | 8 +- tools/nym-cli/src/validator/account.rs | 2 +- tools/nym-cli/user-docs/fig-spec.ts | 456 +++++++++--------- tools/ts-rs-cli/Cargo.toml | 2 +- 196 files changed, 1750 insertions(+), 1721 deletions(-) rename clients/validator/src/{nymd-querier.ts => nyxd-querier.ts} (97%) rename common/client-libs/validator-client/src/{nymd => nyxd}/coin.rs (100%) rename common/client-libs/validator-client/src/{nymd => nyxd}/cosmwasm_client/client.rs (89%) rename common/client-libs/validator-client/src/{nymd => nyxd}/cosmwasm_client/helpers.rs (78%) rename common/client-libs/validator-client/src/{nymd => nyxd}/cosmwasm_client/logs.rs (94%) rename common/client-libs/validator-client/src/{nymd => nyxd}/cosmwasm_client/mod.rs (77%) rename common/client-libs/validator-client/src/{nymd => nyxd}/cosmwasm_client/signing_client.rs (89%) rename common/client-libs/validator-client/src/{nymd => nyxd}/cosmwasm_client/types.rs (92%) rename common/client-libs/validator-client/src/{nymd => nyxd}/error.rs (96%) rename common/client-libs/validator-client/src/{nymd => nyxd}/fee/gas_price.rs (96%) rename common/client-libs/validator-client/src/{nymd => nyxd}/fee/mod.rs (99%) rename common/client-libs/validator-client/src/{nymd => nyxd}/mod.rs (88%) rename common/client-libs/validator-client/src/{nymd => nyxd}/traits/coconut_bandwidth_query_client.rs (79%) rename common/client-libs/validator-client/src/{nymd => nyxd}/traits/coconut_bandwidth_signing_client.rs (84%) rename common/client-libs/validator-client/src/{nymd => nyxd}/traits/dkg_query_client.rs (81%) rename common/client-libs/validator-client/src/{nymd => nyxd}/traits/dkg_signing_client.rs (84%) rename common/client-libs/validator-client/src/{nymd => nyxd}/traits/mixnet_query_client.rs (84%) rename common/client-libs/validator-client/src/{nymd => nyxd}/traits/mixnet_signing_client.rs (87%) rename common/client-libs/validator-client/src/{nymd => nyxd}/traits/mod.rs (100%) rename common/client-libs/validator-client/src/{nymd => nyxd}/traits/multisig_query_client.rs (81%) rename common/client-libs/validator-client/src/{nymd => nyxd}/traits/multisig_signing_client.rs (86%) rename common/client-libs/validator-client/src/{nymd => nyxd}/traits/vesting_query_client.rs (85%) rename common/client-libs/validator-client/src/{nymd => nyxd}/traits/vesting_signing_client.rs (87%) rename common/client-libs/validator-client/src/{nymd => nyxd}/wallet/mod.rs (92%) rename nym-api/src/{nymd_client.rs => nyxd_client.rs} (88%) diff --git a/.wellknown/wallet/validators.json b/.wellknown/wallet/validators.json index f4987aa3dc..ff849e16d1 100644 --- a/.wellknown/wallet/validators.json +++ b/.wellknown/wallet/validators.json @@ -1,6 +1,8 @@ { - "mainnet":[{ - "nymd_url":"https://rpc.nyx.nodes.guru/", - "api_url":"https://api.nyx.nodes.guru/" - }] -} + "mainnet": [ + { + "nyxd_url": "https://rpc.nyx.nodes.guru/", + "api_url": "https://api.nyx.nodes.guru/" + } + ] +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bab113189..9a372b8376 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ Post 1.0.0 release, the changelog format is based on [Keep a Changelog](https:// ### Changed +- renamed all references to validator_api to nym_api +- renamed all references to nymd to nyxd - all-binaries: improved error logging ([#2686]) - native client: bring shutdown logic up to the same level as socks5-client - nym-api, coconut-dkg contract: automatic, time-based dkg epoch state advancement ([#2670]) @@ -45,7 +47,7 @@ The release also include some additional work for distributed key generation in ### Changed - validator-api: can recover from shutdown during DKG process ([#1872]) -- clients: deduplicate gateway inititialization, part of work towards a rust-sdk +- clients: deduplicate gateway initialization, part of work towards a rust-sdk - clients: keep all transmission lanes going at all times by making priority probabilistic - clients: ability to use multi-reply SURBs to send arbitrarily long messages fully anonymously whilst requesting additional reply blocks whenever they're about to run out ([#1796], [#1801], [#1804], [#1835], [#1858], [#1883])) @@ -120,7 +122,7 @@ The release also include some additional work for distributed key generation in - native-client/socks5-client/wasm-client: `use_extended_packet_size` Debug config option to make the client use 'ExtendedPacketSize' for its traffic (32kB as opposed to 2kB in 1.0.2) ([#1671]) - network-requester: added additional Blockstream Green wallet endpoint to `example.allowed.list` ([#1611]) - validator-api: add `interval_operating_cost` and `profit_margin_percent` to compute reward estimation endpoint -- validator-client: added `query_contract_smart` and `query_contract_raw` on `NymdClient` ([#1558]) +- validator-client: added `query_contract_smart` and `query_contract_raw` on `NyxdClient` ([#1558]) - wasm-client: uses updated wasm-compatible `client-core` so that it's now capable of packet retransmission, cover traffic and poisson delay (among other things!) ([#1673]) ### Fixed @@ -215,7 +217,7 @@ The release also include some additional work for distributed key generation in - All binaries and cosmwasm blobs are configured at runtime now; binaries are configured using environment variables or .env files and contracts keep the configuration parameters in storage ([#1463]) - gateway, network-statistics: include gateway id in the sent statistical data ([#1478]) - network explorer: tweak how active set probability is shown ([#1503]) -- validator-api: rewarder set update fails without panicking on possible nymd queries ([#1520]) +- validator-api: rewarder set update fails without panicking on possible nyxd queries ([#1520]) - network-requester, socks5 client (nym-connect): send and receive respectively a message error to be displayed about filter check failure ([#1576]) [#1249]: https://github.com/nymtech/nym/pull/1249 @@ -588,14 +590,14 @@ The release also include some additional work for distributed key generation in - Feature/update wallet with stake rates [\#739](https://github.com/nymtech/nym/pull/739) ([neacsu](https://github.com/neacsu)) - Add stake reward rates and bump version of client [\#738](https://github.com/nymtech/nym/pull/738) ([neacsu](https://github.com/neacsu)) - Bump next from 10.1.3 to 11.1.0 in /wallet-web [\#737](https://github.com/nymtech/nym/pull/737) ([dependabot[bot]](https://github.com/apps/dependabot)) -- Feature/nymd client integration [\#736](https://github.com/nymtech/nym/pull/736) ([jstuczyn](https://github.com/jstuczyn)) +- Feature/nyxd client integration [\#736](https://github.com/nymtech/nym/pull/736) ([jstuczyn](https://github.com/jstuczyn)) - Bug/fix parking lot on wasm [\#735](https://github.com/nymtech/nym/pull/735) ([neacsu](https://github.com/neacsu)) - Explorer API: add new HTTP resource to decorate mix nodes with geoip locations [\#734](https://github.com/nymtech/nym/pull/734) ([mmsinclair](https://github.com/mmsinclair)) -- Feature/completing nymd client api [\#732](https://github.com/nymtech/nym/pull/732) ([jstuczyn](https://github.com/jstuczyn)) +- Feature/completing nyxd client api [\#732](https://github.com/nymtech/nym/pull/732) ([jstuczyn](https://github.com/jstuczyn)) - Explorer API - add port check and node description/stats proxy [\#731](https://github.com/nymtech/nym/pull/731) ([mmsinclair](https://github.com/mmsinclair)) -- Feature/nymd client fee handling [\#730](https://github.com/nymtech/nym/pull/730) ([jstuczyn](https://github.com/jstuczyn)) +- Feature/nyxd client fee handling [\#730](https://github.com/nymtech/nym/pull/730) ([jstuczyn](https://github.com/jstuczyn)) - Update DelegationCheck.tsx [\#725](https://github.com/nymtech/nym/pull/725) ([jessgess](https://github.com/jessgess)) -- Rust nymd/cosmwasm client [\#724](https://github.com/nymtech/nym/pull/724) ([jstuczyn](https://github.com/jstuczyn)) +- Rust nyxd/cosmwasm client [\#724](https://github.com/nymtech/nym/pull/724) ([jstuczyn](https://github.com/jstuczyn)) - Removed wasm feature bypassing cyclic dependencies [\#723](https://github.com/nymtech/nym/pull/723) ([jstuczyn](https://github.com/jstuczyn)) - Updated used sphinx dependency to the most recent revision [\#722](https://github.com/nymtech/nym/pull/722) ([jstuczyn](https://github.com/jstuczyn)) - update state management and validation [\#721](https://github.com/nymtech/nym/pull/721) ([fmtabbara](https://github.com/fmtabbara)) @@ -614,7 +616,7 @@ The release also include some additional work for distributed key generation in - Bond and delegation alerts [\#698](https://github.com/nymtech/nym/pull/698) ([fmtabbara](https://github.com/fmtabbara)) - Bugfix/network monitor version check [\#697](https://github.com/nymtech/nym/pull/697) ([jstuczyn](https://github.com/jstuczyn)) - Feature/other containers [\#692](https://github.com/nymtech/nym/pull/692) ([neacsu](https://github.com/neacsu)) -- Using validator API instead of nymd [\#690](https://github.com/nymtech/nym/pull/690) ([futurechimp](https://github.com/futurechimp)) +- Using validator API instead of nyxd [\#690](https://github.com/nymtech/nym/pull/690) ([futurechimp](https://github.com/futurechimp)) - Hang coconut issuance off the validator-api [\#679](https://github.com/nymtech/nym/pull/679) ([durch](https://github.com/durch)) - Update hmac and blake3 [\#673](https://github.com/nymtech/nym/pull/673) ([durch](https://github.com/durch)) diff --git a/clients/client-core/src/client/topology_control.rs b/clients/client-core/src/client/topology_control.rs index c51fd350cd..fd5b27860d 100644 --- a/clients/client-core/src/client/topology_control.rs +++ b/clients/client-core/src/client/topology_control.rs @@ -152,7 +152,7 @@ impl TopologyRefresherConfig { } pub struct TopologyRefresher { - validator_client: validator_client::client::ApiClient, + validator_client: validator_client::client::NymApiClient, client_version: String, nym_api_urls: Vec, @@ -168,7 +168,9 @@ impl TopologyRefresher { cfg.nym_api_urls.shuffle(&mut thread_rng()); TopologyRefresher { - validator_client: validator_client::client::ApiClient::new(cfg.nym_api_urls[0].clone()), + validator_client: validator_client::client::NymApiClient::new( + cfg.nym_api_urls[0].clone(), + ), client_version: cfg.client_version, nym_api_urls: cfg.nym_api_urls, topology_accessor, diff --git a/clients/client-core/src/config/mod.rs b/clients/client-core/src/config/mod.rs index 18746545dd..6bb4cee715 100644 --- a/clients/client-core/src/config/mod.rs +++ b/clients/client-core/src/config/mod.rs @@ -172,8 +172,8 @@ impl Config { self.client.gateway_endpoint.gateway_id = id.into(); } - pub fn set_custom_validators(&mut self, validator_urls: Vec) { - self.client.validator_urls = validator_urls; + pub fn set_custom_nyxd(&mut self, nyxd_urls: Vec) { + self.client.nyxd_urls = nyxd_urls; } pub fn set_custom_nym_apis(&mut self, nym_api_urls: Vec) { @@ -234,7 +234,7 @@ impl Config { } pub fn get_validator_endpoints(&self) -> Vec { - self.client.validator_urls.clone() + self.client.nyxd_urls.clone() } pub fn get_nym_api_endpoints(&self) -> Vec { @@ -420,9 +420,9 @@ pub struct Client { #[serde(default)] disabled_credentials_mode: bool, - /// Addresses to nymd validators via which the client can communicate with the chain. - #[serde(default)] - validator_urls: Vec, + /// Addresses to nyxd validators via which the client can communicate with the chain. + #[serde(alias = "validator_urls")] + nyxd_urls: Vec, /// Addresses to APIs running on validator from which the client gets the view of the network. #[serde(alias = "validator_api_urls")] @@ -476,7 +476,7 @@ impl Default for Client { version: env!("CARGO_PKG_VERSION").to_string(), id: "".to_string(), disabled_credentials_mode: true, - validator_urls: vec![], + nyxd_urls: vec![], nym_api_urls: vec![], private_identity_key_file: Default::default(), public_identity_key_file: Default::default(), diff --git a/clients/client-core/src/init/helpers.rs b/clients/client-core/src/init/helpers.rs index b3662149b7..01318e3b3c 100644 --- a/clients/client-core/src/init/helpers.rs +++ b/clients/client-core/src/init/helpers.rs @@ -23,7 +23,7 @@ pub(super) async fn query_gateway_details( let nym_api = validator_servers .choose(&mut thread_rng()) .ok_or(ClientCoreError::ListOfNymApisIsEmpty)?; - let validator_client = validator_client::client::ApiClient::new(nym_api.clone()); + let validator_client = validator_client::client::NymApiClient::new(nym_api.clone()); log::trace!("Fetching list of gateways from: {}", nym_api); let gateways = validator_client.get_cached_gateways().await?; diff --git a/clients/credential/Cargo.toml b/clients/credential/Cargo.toml index ff2326b1b1..1fee702592 100644 --- a/clients/credential/Cargo.toml +++ b/clients/credential/Cargo.toml @@ -23,7 +23,7 @@ credential-storage = { path = "../../common/credential-storage" } crypto = { path = "../../common/crypto", features = ["rand", "asymmetric", "symmetric", "aes", "hashing"] } network-defaults = { path = "../../common/network-defaults" } pemstore = { path = "../../common/pemstore" } -validator-client = { path = "../../common/client-libs/validator-client", features = ["nymd-client"] } +validator-client = { path = "../../common/client-libs/validator-client", features = ["nyxd-client"] } [features] coconut = ["credentials/coconut"] diff --git a/clients/credential/src/client.rs b/clients/credential/src/client.rs index 0eb63bf340..d4ee436698 100644 --- a/clients/credential/src/client.rs +++ b/clients/credential/src/client.rs @@ -6,27 +6,27 @@ use bip39::Mnemonic; use network_defaults::{NymNetworkDetails, VOUCHER_INFO}; use std::str::FromStr; use url::Url; -use validator_client::nymd; -use validator_client::nymd::traits::CoconutBandwidthSigningClient; -use validator_client::nymd::{Coin, Fee, NymdClient, SigningNymdClient}; +use validator_client::nyxd; +use validator_client::nyxd::traits::CoconutBandwidthSigningClient; +use validator_client::nyxd::{Coin, Fee, NyxdClient, SigningNyxdClient}; pub(crate) struct Client { - nymd_client: NymdClient, + nyxd_client: NyxdClient, mix_denom_base: String, } impl Client { - pub fn new(nymd_url: &str, mnemonic: &str) -> Self { - let nymd_url = Url::from_str(nymd_url).unwrap(); + pub fn new(nyxd_url: &str, mnemonic: &str) -> Self { + let nyxd_url = Url::from_str(nyxd_url).unwrap(); let mnemonic = Mnemonic::from_str(mnemonic).unwrap(); let network_details = NymNetworkDetails::new_from_env(); - let config = nymd::Config::try_from_nym_network_details(&network_details) + let config = nyxd::Config::try_from_nym_network_details(&network_details) .expect("failed to construct valid validator client config with the provided network"); - let nymd_client = - NymdClient::connect_with_mnemonic(config, nymd_url.as_ref(), mnemonic, None).unwrap(); + let nyxd_client = + NyxdClient::connect_with_mnemonic(config, nyxd_url.as_ref(), mnemonic, None).unwrap(); Client { - nymd_client, + nyxd_client, mix_denom_base: network_details.chain_details.mix_denom.base, } } @@ -40,7 +40,7 @@ impl Client { ) -> Result { let amount = Coin::new(amount as u128, self.mix_denom_base.clone()); Ok(self - .nymd_client + .nyxd_client .deposit( amount, String::from(VOUCHER_INFO), diff --git a/clients/credential/src/commands.rs b/clients/credential/src/commands.rs index 106b2c318e..f697a98d7d 100644 --- a/clients/credential/src/commands.rs +++ b/clients/credential/src/commands.rs @@ -13,7 +13,7 @@ use credentials::coconut::bandwidth::{BandwidthVoucher, TOTAL_ATTRIBUTES}; use credentials::coconut::utils::obtain_aggregate_signature; use crypto::asymmetric::{encryption, identity}; use network_defaults::{NymNetworkDetails, VOUCHER_INFO}; -use validator_client::nymd::tx::Hash; +use validator_client::nyxd::tx::Hash; use validator_client::{CoconutApiClient, Config}; use crate::client::Client; @@ -38,9 +38,9 @@ pub(crate) struct Run { #[clap(long)] pub(crate) client_home_directory: std::path::PathBuf, - /// The nymd URL that should be used + /// The nyxd URL that should be used #[clap(long)] - pub(crate) nymd_url: String, + pub(crate) nyxd_url: String, /// A mnemonic for the account that buys the credential #[clap(long)] @@ -51,12 +51,12 @@ pub(crate) struct Run { pub(crate) amount: u64, } -pub(crate) async fn deposit(nymd_url: &str, mnemonic: &str, amount: u64) -> Result { +pub(crate) async fn deposit(nyxd_url: &str, mnemonic: &str, amount: u64) -> Result { let mut rng = OsRng; let signing_keypair = KeyPair::from(identity::KeyPair::new(&mut rng)); let encryption_keypair = KeyPair::from(encryption::KeyPair::new(&mut rng)); - let client = Client::new(nymd_url, mnemonic); + let client = Client::new(nyxd_url, mnemonic); let tx_hash = client .deposit( amount, diff --git a/clients/credential/src/error.rs b/clients/credential/src/error.rs index 5cbc636e58..f793957e2f 100644 --- a/clients/credential/src/error.rs +++ b/clients/credential/src/error.rs @@ -7,15 +7,15 @@ use credential_storage::error::StorageError; use credentials::error::Error as CredentialError; use crypto::asymmetric::encryption::KeyRecoveryError; use crypto::asymmetric::identity::Ed25519RecoveryError; -use validator_client::nymd::error::NymdError; +use validator_client::nyxd::error::NyxdError; use validator_client::ValidatorClientError; pub type Result = std::result::Result; #[derive(Error, Debug)] pub enum CredentialClientError { - #[error("Nymd error: {0}")] - Nymd(#[from] NymdError), + #[error("Nyxd error: {0}")] + Nyxd(#[from] NyxdError), #[error("Validator client error: {0}")] ValidatorClientError(#[from] ValidatorClientError), diff --git a/clients/credential/src/main.rs b/clients/credential/src/main.rs index b7524e6c7b..b27571909d 100644 --- a/clients/credential/src/main.rs +++ b/clients/credential/src/main.rs @@ -39,7 +39,7 @@ cfg_if::cfg_if! { let db_path = r.client_home_directory.join(DATA_DIR).join(DB_FILE_NAME); let shared_storage = credential_storage::initialise_storage(db_path).await; - let state = deposit(&r.nymd_url, &r.mnemonic, r.amount).await?; + let state = deposit(&r.nyxd_url, &r.mnemonic, r.amount).await?; get_credential(&state, shared_storage).await?; } Command::Completions(c) => c.generate(&mut crate::Cli::command(), bin_name), diff --git a/clients/native/Cargo.toml b/clients/native/Cargo.toml index a27cedd423..27f13bbbc4 100644 --- a/clients/native/Cargo.toml +++ b/clients/native/Cargo.toml @@ -51,7 +51,7 @@ nymsphinx = { path = "../../common/nymsphinx" } pemstore = { path = "../../common/pemstore" } task = { path = "../../common/task" } topology = { path = "../../common/topology" } -validator-client = { path = "../../common/client-libs/validator-client", features = ["nymd-client"] } +validator-client = { path = "../../common/client-libs/validator-client", features = ["nyxd-client"] } version-checker = { path = "../../common/version-checker" } websocket-requests = { path = "websocket-requests" } diff --git a/clients/native/src/client/config/template.rs b/clients/native/src/client/config/template.rs index 54d4032799..15a0763ed9 100644 --- a/clients/native/src/client/config/template.rs +++ b/clients/native/src/client/config/template.rs @@ -23,9 +23,9 @@ id = '{{ client.id }}' # to claim bandwidth without presenting bandwidth credentials. disabled_credentials_mode = {{ client.disabled_credentials_mode }} -# Addresses to nymd validators via which the client can communicate with the chain. -validator_urls = [ - {{#each client.validator_urls }} +# Addresses to nyxd validators via which the client can communicate with the chain. +nyxd_urls = [ + {{#each client.nyxd_urls }} '{{this}}', {{/each}} ] diff --git a/clients/native/src/client/mod.rs b/clients/native/src/client/mod.rs index ca367018e8..de6aa2748d 100644 --- a/clients/native/src/client/mod.rs +++ b/clients/native/src/client/mod.rs @@ -52,18 +52,18 @@ impl SocketClient { let mut client_config = validator_client::Config::try_from_nym_network_details(&details) .expect("failed to construct validator client config"); - let nymd_url = config + let nyxd_url = config .get_base() .get_validator_endpoints() .pop() - .expect("No nymd validator endpoint provided"); + .expect("No nyxd validator endpoint provided"); let api_url = config .get_base() .get_nym_api_endpoints() .pop() .expect("No validator api endpoint provided"); // overwrite env configuration with config URLs - client_config = client_config.with_urls(nymd_url, api_url); + client_config = client_config.with_urls(nyxd_url, api_url); let client = validator_client::Client::new_query(client_config) .expect("Could not construct query client"); let coconut_api_clients = diff --git a/clients/native/src/commands/init.rs b/clients/native/src/commands/init.rs index d8f9f59f90..8f8380349f 100644 --- a/clients/native/src/commands/init.rs +++ b/clients/native/src/commands/init.rs @@ -29,10 +29,10 @@ pub(crate) struct Init { #[clap(long)] force_register_gateway: bool, - /// Comma separated list of rest endpoints of the nymd validators + /// Comma separated list of rest endpoints of the nyxd validators #[cfg(feature = "coconut")] - #[clap(long, value_delimiter = ',')] - nymd_validators: Option>, + #[clap(long, alias = "nymd_validators", value_delimiter = ',')] + nyxd_urls: Option>, /// Comma separated list of rest endpoints of the API validators #[clap(long, alias = "api_validators", value_delimiter = ',')] @@ -77,7 +77,7 @@ impl From for OverrideConfig { no_cover: init_config.no_cover, #[cfg(feature = "coconut")] - nymd_validators: init_config.nymd_validators, + nyxd_urls: init_config.nyxd_urls, #[cfg(feature = "coconut")] enabled_credentials_mode: init_config.enabled_credentials_mode, } diff --git a/clients/native/src/commands/mod.rs b/clients/native/src/commands/mod.rs index a6fabe615f..1107b18e7c 100644 --- a/clients/native/src/commands/mod.rs +++ b/clients/native/src/commands/mod.rs @@ -59,7 +59,7 @@ pub(crate) struct OverrideConfig { no_cover: bool, #[cfg(feature = "coconut")] - nymd_validators: Option>, + nyxd_urls: Option>, #[cfg(feature = "coconut")] enabled_credentials_mode: bool, } @@ -81,8 +81,8 @@ pub(crate) fn override_config(mut config: Config, args: OverrideConfig) -> Confi if let Some(nym_apis) = args.nym_apis { config.get_base_mut().set_custom_nym_apis(nym_apis); } else if std::env::var(network_defaults::var_names::CONFIGURED).is_ok() { - let raw_validators = std::env::var(network_defaults::var_names::API_VALIDATOR) - .expect("api validator not set"); + let raw_validators = + std::env::var(network_defaults::var_names::NYM_API).expect("api validator not set"); config .get_base_mut() .set_custom_nym_apis(config::parse_urls(&raw_validators)); @@ -98,14 +98,14 @@ pub(crate) fn override_config(mut config: Config, args: OverrideConfig) -> Confi #[cfg(feature = "coconut")] { - if let Some(nymd_validators) = args.nymd_validators { - config.get_base_mut().set_custom_validators(nymd_validators); + if let Some(nyxd_urls) = args.nyxd_urls { + config.get_base_mut().set_custom_nyxd(nyxd_urls); } else if std::env::var(network_defaults::var_names::CONFIGURED).is_ok() { - let raw_validators = std::env::var(network_defaults::var_names::NYMD_VALIDATOR) - .expect("nymd validator not set"); + let raw_validators = + std::env::var(network_defaults::var_names::NYXD).expect("nyxd validator not set"); config .get_base_mut() - .set_custom_validators(config::parse_urls(&raw_validators)); + .set_custom_nyxd(config::parse_urls(&raw_validators)); } if args.enabled_credentials_mode { config.get_base_mut().with_disabled_credentials(false) diff --git a/clients/native/src/commands/run.rs b/clients/native/src/commands/run.rs index 1a3f9ae097..123bb827e4 100644 --- a/clients/native/src/commands/run.rs +++ b/clients/native/src/commands/run.rs @@ -21,10 +21,10 @@ pub(crate) struct Run { #[clap(long)] id: String, - /// Comma separated list of rest endpoints of the nymd validators + /// Comma separated list of rest endpoints of the nyxd validators #[cfg(feature = "coconut")] - #[clap(long, value_delimiter = ',')] - nymd_validators: Option>, + #[clap(long, alias = "nymd_validators", value_delimiter = ',')] + nyxd_urls: Option>, /// Comma separated list of rest endpoints of the API validators #[clap(long, alias = "api_validators", value_delimiter = ',')] @@ -70,7 +70,7 @@ impl From for OverrideConfig { no_cover: run_config.no_cover, #[cfg(feature = "coconut")] - nymd_validators: run_config.nymd_validators, + nyxd_urls: run_config.nyxd_urls, #[cfg(feature = "coconut")] enabled_credentials_mode: run_config.enabled_credentials_mode, } diff --git a/clients/socks5/Cargo.toml b/clients/socks5/Cargo.toml index daaaf3fc0d..c4218c45e4 100644 --- a/clients/socks5/Cargo.toml +++ b/clients/socks5/Cargo.toml @@ -47,7 +47,7 @@ proxy-helpers = { path = "../../common/socks5/proxy-helpers" } socks5-requests = { path = "../../common/socks5/requests" } task = { path = "../../common/task" } topology = { path = "../../common/topology" } -validator-client = { path = "../../common/client-libs/validator-client", features = ["nymd-client"] } +validator-client = { path = "../../common/client-libs/validator-client", features = ["nyxd-client"] } version-checker = { path = "../../common/version-checker" } [features] diff --git a/clients/socks5/src/client/config/template.rs b/clients/socks5/src/client/config/template.rs index 90029fb5fd..f8c274c27c 100644 --- a/clients/socks5/src/client/config/template.rs +++ b/clients/socks5/src/client/config/template.rs @@ -23,9 +23,9 @@ id = '{{ client.id }}' # to claim bandwidth without presenting bandwidth credentials. disabled_credentials_mode = {{ client.disabled_credentials_mode }} -# Addresses to nymd validators via which the client can communicate with the chain. -validator_urls = [ - {{#each client.validator_urls }} +# Addresses to nyxd validators via which the client can communicate with the chain. +nyxd_urls = [ + {{#each client.nyxd_urls }} '{{this}}', {{/each}} ] diff --git a/clients/socks5/src/client/mod.rs b/clients/socks5/src/client/mod.rs index c7710056f8..96bdf00932 100644 --- a/clients/socks5/src/client/mod.rs +++ b/clients/socks5/src/client/mod.rs @@ -60,18 +60,18 @@ impl NymClient { let mut client_config = validator_client::Config::try_from_nym_network_details(&details) .expect("failed to construct validator client config"); - let nymd_url = config + let nyxd_url = config .get_base() .get_validator_endpoints() .pop() - .expect("No nymd validator endpoint provided"); + .expect("No nyxd validator endpoint provided"); let api_url = config .get_base() .get_nym_api_endpoints() .pop() .expect("No validator api endpoint provided"); // overwrite env configuration with config URLs - client_config = client_config.with_urls(nymd_url, api_url); + client_config = client_config.with_urls(nyxd_url, api_url); let client = validator_client::Client::new_query(client_config) .expect("Could not construct query client"); let coconut_api_clients = diff --git a/clients/socks5/src/commands/init.rs b/clients/socks5/src/commands/init.rs index 35fe398685..80087a59e6 100644 --- a/clients/socks5/src/commands/init.rs +++ b/clients/socks5/src/commands/init.rs @@ -42,10 +42,10 @@ pub(crate) struct Init { #[clap(long)] force_register_gateway: bool, - /// Comma separated list of rest endpoints of the nymd validators + /// Comma separated list of rest endpoints of the nyxd validators #[cfg(feature = "coconut")] - #[clap(long, value_delimiter = ',')] - nymd_validators: Option>, + #[clap(long, alias = "nymd_validators", value_delimiter = ',')] + nyxd_urls: Option>, /// Comma separated list of rest endpoints of the API validators #[clap(long, alias = "api_validators", value_delimiter = ',')] @@ -86,7 +86,7 @@ impl From for OverrideConfig { no_cover: init_config.no_cover, #[cfg(feature = "coconut")] - nymd_validators: init_config.nymd_validators, + nyxd_urls: init_config.nyxd_urls, #[cfg(feature = "coconut")] enabled_credentials_mode: init_config.enabled_credentials_mode, } diff --git a/clients/socks5/src/commands/mod.rs b/clients/socks5/src/commands/mod.rs index 2e6f2dd3a7..119cff2e58 100644 --- a/clients/socks5/src/commands/mod.rs +++ b/clients/socks5/src/commands/mod.rs @@ -62,7 +62,7 @@ pub(crate) struct OverrideConfig { no_cover: bool, #[cfg(feature = "coconut")] - nymd_validators: Option>, + nyxd_urls: Option>, #[cfg(feature = "coconut")] enabled_credentials_mode: bool, } @@ -83,7 +83,7 @@ pub(crate) async fn execute(args: &Cli) -> Result<(), Box Config { if let Some(nym_apis) = args.nym_apis { config.get_base_mut().set_custom_nym_apis(nym_apis); - } else if let Ok(raw_validators) = std::env::var(network_defaults::var_names::API_VALIDATOR) { + } else if let Ok(raw_validators) = std::env::var(network_defaults::var_names::NYM_API) { config .get_base_mut() .set_custom_nym_apis(parse_urls(&raw_validators)); @@ -99,14 +99,12 @@ pub(crate) fn override_config(mut config: Config, args: OverrideConfig) -> Confi #[cfg(feature = "coconut")] { - if let Some(nymd_validators) = args.nymd_validators { - config.get_base_mut().set_custom_validators(nymd_validators); - } else if let Ok(raw_validators) = - std::env::var(network_defaults::var_names::NYMD_VALIDATOR) - { + if let Some(nyxd_urls) = args.nyxd_urls { + config.get_base_mut().set_custom_nyxd(nyxd_urls); + } else if let Ok(raw_validators) = std::env::var(network_defaults::var_names::NYXD) { config .get_base_mut() - .set_custom_validators(parse_urls(&raw_validators)); + .set_custom_nyxd(parse_urls(&raw_validators)); } if args.enabled_credentials_mode { config.get_base_mut().with_disabled_credentials(false) diff --git a/clients/socks5/src/commands/run.rs b/clients/socks5/src/commands/run.rs index b85a4f9244..9d60479e71 100644 --- a/clients/socks5/src/commands/run.rs +++ b/clients/socks5/src/commands/run.rs @@ -42,10 +42,10 @@ pub(crate) struct Run { #[clap(long)] gateway: Option, - /// Comma separated list of rest endpoints of the nymd validators + /// Comma separated list of rest endpoints of the nyxd validators #[cfg(feature = "coconut")] - #[clap(long, value_delimiter = ',')] - nymd_validators: Option>, + #[clap(long, alias = "nymd_validators", value_delimiter = ',')] + nyxd_urls: Option>, /// Comma separated list of rest endpoints of the Nym APIs #[clap(long, value_delimiter = ',')] @@ -81,7 +81,7 @@ impl From for OverrideConfig { no_cover: run_config.no_cover, #[cfg(feature = "coconut")] - nymd_validators: run_config.nymd_validators, + nyxd_urls: run_config.nyxd_urls, #[cfg(feature = "coconut")] enabled_credentials_mode: run_config.enabled_credentials_mode, } diff --git a/clients/validator/src/index.ts b/clients/validator/src/index.ts index cfbc862a9e..dac29371c3 100644 --- a/clients/validator/src/index.ts +++ b/clients/validator/src/index.ts @@ -85,7 +85,7 @@ export default class ValidatorClient implements INymClient { static async connect( mnemonic: string, - nymdUrl: string, + nyxdUrl: string, nymApiUrl: string, prefix: string, mixnetContract: string, @@ -94,19 +94,19 @@ export default class ValidatorClient implements INymClient { ): Promise { const wallet = await ValidatorClient.buildWallet(mnemonic, prefix); - const signingClient = await SigningClient.connectWithNymSigner(wallet, nymdUrl, nymApiUrl, prefix, denom); + const signingClient = await SigningClient.connectWithNymSigner(wallet, nyxdUrl, nymApiUrl, prefix, denom); return new ValidatorClient(signingClient, prefix, mixnetContract, vestingContract, denom); } static async connectForQuery( - nymdUrl: string, + nyxdUrl: string, nymApiUrl: string, prefix: string, mixnetContract: string, vestingContract: string, denom: string, ): Promise { - const queryClient = await QueryClient.connectWithNym(nymdUrl, nymApiUrl); + const queryClient = await QueryClient.connectWithNym(nyxdUrl, nymApiUrl); return new ValidatorClient(queryClient, prefix, mixnetContract, vestingContract, denom); } @@ -191,11 +191,11 @@ export default class ValidatorClient implements INymClient { return this.client.getIntervalRewardPercent(this.mixnetContract); } - public async getAllNymdMixnodes(): Promise { + public async getAllNyxdMixnodes(): Promise { let mixNodes: MixNodeBond[] = []; const limit = 50; let startAfter; - for (;;) { + for (; ;) { // eslint-disable-next-line no-await-in-loop const pagedResponse: PagedMixnodeResponse = await this.client.getMixNodesPaged(this.mixnetContract, limit); mixNodes = mixNodes.concat(pagedResponse.nodes); @@ -209,11 +209,11 @@ export default class ValidatorClient implements INymClient { return mixNodes; } - public async getAllNymdGateways(): Promise { + public async getAllNyxdGateways(): Promise { let gateways: GatewayBond[] = []; const limit = 50; let startAfter; - for (;;) { + for (; ;) { // eslint-disable-next-line no-await-in-loop const pagedResponse: PagedGatewayResponse = await this.client.getGatewaysPaged(this.mixnetContract, limit); gateways = gateways.concat(pagedResponse.nodes); @@ -232,11 +232,11 @@ export default class ValidatorClient implements INymClient { * * @param mixIdentity identity of the node to which the delegation was sent */ - public async getAllNymdSingleMixnodeDelegations(mixIdentity: string): Promise { + public async getAllNyxdSingleMixnodeDelegations(mixIdentity: string): Promise { let delegations: Delegation[] = []; const limit = 250; let startAfter; - for (;;) { + for (; ;) { // eslint-disable-next-line no-await-in-loop const pagedResponse: PagedMixDelegationsResponse = await this.client.getMixNodeDelegationsPaged( this.mixnetContract, @@ -255,11 +255,11 @@ export default class ValidatorClient implements INymClient { return delegations; } - public async getAllNymdDelegatorDelegations(delegator: string): Promise { + public async getAllNyxdDelegatorDelegations(delegator: string): Promise { let delegations: Delegation[] = []; const limit = 250; let startAfter; - for (;;) { + for (; ;) { // eslint-disable-next-line no-await-in-loop const pagedResponse: PagedDelegatorDelegationsResponse = await this.client.getDelegatorDelegationsPaged( this.mixnetContract, @@ -278,11 +278,11 @@ export default class ValidatorClient implements INymClient { return delegations; } - public async getAllNymdNetworkDelegations(): Promise { + public async getAllNyxdNetworkDelegations(): Promise { let delegations: Delegation[] = []; const limit = 250; let startAfter; - for (;;) { + for (; ;) { // eslint-disable-next-line no-await-in-loop const pagedResponse: PagedAllDelegationsResponse = await this.client.getAllNetworkDelegationsPaged( this.mixnetContract, diff --git a/clients/validator/src/nymd-querier.ts b/clients/validator/src/nyxd-querier.ts similarity index 97% rename from clients/validator/src/nymd-querier.ts rename to clients/validator/src/nyxd-querier.ts index ee2148d56d..edd791a8fe 100644 --- a/clients/validator/src/nymd-querier.ts +++ b/clients/validator/src/nyxd-querier.ts @@ -5,7 +5,7 @@ import { JsonObject } from '@cosmjs/cosmwasm-stargate'; // eslint-disable-next-line import/no-cycle -import { INymdQuery } from './query-client'; +import { INyxdQuery } from './query-client'; import { ContractStateParams, Delegation, @@ -25,7 +25,7 @@ interface SmartContractQuery { queryContractSmart(address: string, queryMsg: Record): Promise; } -export default class NymdQuerier implements INymdQuery { +export default class NyxdQuerier implements INyxdQuery { client: SmartContractQuery; constructor(client: SmartContractQuery) { diff --git a/clients/validator/src/query-client.ts b/clients/validator/src/query-client.ts index de477f7fd9..c78237cdb4 100644 --- a/clients/validator/src/query-client.ts +++ b/clients/validator/src/query-client.ts @@ -12,7 +12,7 @@ import { } from '@cosmjs/stargate'; import { Code, CodeDetails, Contract, ContractCodeHistoryEntry } from '@cosmjs/cosmwasm-stargate/build/cosmwasmclient'; // eslint-disable-next-line import/no-cycle -import NymdQuerier from './nymd-querier'; +import NyxdQuerier from './nyxd-querier'; import { ContractStateParams, Delegation, @@ -52,7 +52,7 @@ export interface ICosmWasmQuery { queryContractSmart(address: string, queryMsg: Record): Promise; } -export interface INymdQuery { +export interface INyxdQuery { // nym-specific implemented inside NymQuerier getContractVersion(mixnetContractAddress: string): Promise; @@ -93,46 +93,46 @@ export interface INymdQuery { ): Promise; } -export interface IQueryClient extends ICosmWasmQuery, INymdQuery, INymApiQuery { } +export interface IQueryClient extends ICosmWasmQuery, INyxdQuery, INymApiQuery { } export default class QueryClient extends CosmWasmClient implements IQueryClient { - private nymdQuerier: NymdQuerier; + private nyxdQuerier: NyxdQuerier; private nymApiQuerier: NymApiQuerier; private constructor(tmClient: Tendermint34Client, nymApiUrl: string) { super(tmClient); - this.nymdQuerier = new NymdQuerier(this); + this.nyxdQuerier = new NyxdQuerier(this); this.nymApiQuerier = new NymApiQuerier(nymApiUrl); } - public static async connectWithNym(nymdUrl: string, nymApiUrl: string): Promise { - const tmClient = await Tendermint34Client.connect(nymdUrl); + public static async connectWithNym(nyxdUrl: string, nymApiUrl: string): Promise { + const tmClient = await Tendermint34Client.connect(nyxdUrl); return new QueryClient(tmClient, nymApiUrl); } getContractVersion(mixnetContractAddress: string): Promise { - return this.nymdQuerier.getContractVersion(mixnetContractAddress); + return this.nyxdQuerier.getContractVersion(mixnetContractAddress); } getMixNodesPaged(mixnetContractAddress: string, limit?: number, startAfter?: string): Promise { - return this.nymdQuerier.getMixNodesPaged(mixnetContractAddress, limit, startAfter); + return this.nyxdQuerier.getMixNodesPaged(mixnetContractAddress, limit, startAfter); } getGatewaysPaged(mixnetContractAddress: string, limit?: number, startAfter?: string): Promise { - return this.nymdQuerier.getGatewaysPaged(mixnetContractAddress, limit, startAfter); + return this.nyxdQuerier.getGatewaysPaged(mixnetContractAddress, limit, startAfter); } ownsMixNode(mixnetContractAddress: string, address: string): Promise { - return this.nymdQuerier.ownsMixNode(mixnetContractAddress, address); + return this.nyxdQuerier.ownsMixNode(mixnetContractAddress, address); } ownsGateway(mixnetContractAddress: string, address: string): Promise { - return this.nymdQuerier.ownsGateway(mixnetContractAddress, address); + return this.nyxdQuerier.ownsGateway(mixnetContractAddress, address); } getStateParams(mixnetContractAddress: string): Promise { - return this.nymdQuerier.getStateParams(mixnetContractAddress); + return this.nyxdQuerier.getStateParams(mixnetContractAddress); } getAllNetworkDelegationsPaged( @@ -140,7 +140,7 @@ export default class QueryClient extends CosmWasmClient implements IQueryClient limit?: number, startAfter?: [string, string], ): Promise { - return this.nymdQuerier.getAllNetworkDelegationsPaged(mixnetContractAddress, limit, startAfter); + return this.nyxdQuerier.getAllNetworkDelegationsPaged(mixnetContractAddress, limit, startAfter); } getMixNodeDelegationsPaged( @@ -149,7 +149,7 @@ export default class QueryClient extends CosmWasmClient implements IQueryClient limit?: number, startAfter?: string, ): Promise { - return this.nymdQuerier.getMixNodeDelegationsPaged(mixnetContractAddress, mixIdentity, limit, startAfter); + return this.nyxdQuerier.getMixNodeDelegationsPaged(mixnetContractAddress, mixIdentity, limit, startAfter); } getDelegatorDelegationsPaged( @@ -158,31 +158,31 @@ export default class QueryClient extends CosmWasmClient implements IQueryClient limit?: number, startAfter?: string, ): Promise { - return this.nymdQuerier.getDelegatorDelegationsPaged(mixnetContractAddress, delegator, limit, startAfter); + return this.nyxdQuerier.getDelegatorDelegationsPaged(mixnetContractAddress, delegator, limit, startAfter); } getDelegationDetails(mixnetContractAddress: string, mixIdentity: string, delegator: string): Promise { - return this.nymdQuerier.getDelegationDetails(mixnetContractAddress, mixIdentity, delegator); + return this.nyxdQuerier.getDelegationDetails(mixnetContractAddress, mixIdentity, delegator); } getLayerDistribution(mixnetContractAddress: string): Promise { - return this.nymdQuerier.getLayerDistribution(mixnetContractAddress); + return this.nyxdQuerier.getLayerDistribution(mixnetContractAddress); } getRewardPool(mixnetContractAddress: string): Promise { - return this.nymdQuerier.getRewardPool(mixnetContractAddress); + return this.nyxdQuerier.getRewardPool(mixnetContractAddress); } getCirculatingSupply(mixnetContractAddress: string): Promise { - return this.nymdQuerier.getCirculatingSupply(mixnetContractAddress); + return this.nyxdQuerier.getCirculatingSupply(mixnetContractAddress); } getIntervalRewardPercent(mixnetContractAddress: string): Promise { - return this.nymdQuerier.getIntervalRewardPercent(mixnetContractAddress); + return this.nyxdQuerier.getIntervalRewardPercent(mixnetContractAddress); } getSybilResistancePercent(mixnetContractAddress: string): Promise { - return this.nymdQuerier.getSybilResistancePercent(mixnetContractAddress); + return this.nyxdQuerier.getSybilResistancePercent(mixnetContractAddress); } getRewardingStatus( @@ -190,7 +190,7 @@ export default class QueryClient extends CosmWasmClient implements IQueryClient mixIdentity: string, rewardingIntervalNonce: number, ): Promise { - return this.nymdQuerier.getRewardingStatus(mixnetContractAddress, mixIdentity, rewardingIntervalNonce); + return this.nyxdQuerier.getRewardingStatus(mixnetContractAddress, mixIdentity, rewardingIntervalNonce); } getCachedGateways(): Promise { diff --git a/clients/validator/src/signing-client.ts b/clients/validator/src/signing-client.ts index 382077f0a9..8cb589cd0e 100644 --- a/clients/validator/src/signing-client.ts +++ b/clients/validator/src/signing-client.ts @@ -14,7 +14,7 @@ import { ChangeAdminResult } from '@cosmjs/cosmwasm-stargate/build/signingcosmwa import { TxRaw } from 'cosmjs-types/cosmos/tx/v1beta1/tx'; import { nymGasPrice } from './stargate-helper'; import { IQueryClient } from './query-client'; -import NymdQuerier from './nymd-querier'; +import NyxdQuerier from './nyxd-querier'; import { ContractStateParams, Delegation, @@ -197,7 +197,7 @@ export interface ISigningClient extends IQueryClient, ICosmWasmSigning, INymSign } export default class SigningClient extends SigningCosmWasmClient implements ISigningClient { - private nymdQuerier: NymdQuerier; + private nyxdQuerier: NyxdQuerier; private nymApiQuerier: NymApiQuerier; @@ -212,13 +212,13 @@ export default class SigningClient extends SigningCosmWasmClient implements ISig ) { super(tmClient, wallet, signerOptions); this.clientAddress = clientAddress; - this.nymdQuerier = new NymdQuerier(this); + this.nyxdQuerier = new NyxdQuerier(this); this.nymApiQuerier = new NymApiQuerier(nymApiUrl); } public static async connectWithNymSigner( wallet: DirectSecp256k1HdWallet, - nymdUrl: string, + nyxdUrl: string, nymApiUrl: string, prefix: string, denom: string, @@ -228,34 +228,34 @@ export default class SigningClient extends SigningCosmWasmClient implements ISig prefix, gasPrice: nymGasPrice(denom), }; - const tmClient = await Tendermint34Client.connect(nymdUrl); + const tmClient = await Tendermint34Client.connect(nyxdUrl); return new SigningClient(address, nymApiUrl, tmClient, wallet, signerOptions); } // query related: getContractVersion(mixnetContractAddress: string): Promise { - return this.nymdQuerier.getContractVersion(mixnetContractAddress); + return this.nyxdQuerier.getContractVersion(mixnetContractAddress); } getMixNodesPaged(mixnetContractAddress: string, limit?: number, startAfter?: string): Promise { - return this.nymdQuerier.getMixNodesPaged(mixnetContractAddress, limit, startAfter); + return this.nyxdQuerier.getMixNodesPaged(mixnetContractAddress, limit, startAfter); } getGatewaysPaged(mixnetContractAddress: string, limit?: number, startAfter?: string): Promise { - return this.nymdQuerier.getGatewaysPaged(mixnetContractAddress, limit, startAfter); + return this.nyxdQuerier.getGatewaysPaged(mixnetContractAddress, limit, startAfter); } ownsMixNode(mixnetContractAddress: string, address: string): Promise { - return this.nymdQuerier.ownsMixNode(mixnetContractAddress, address); + return this.nyxdQuerier.ownsMixNode(mixnetContractAddress, address); } ownsGateway(mixnetContractAddress: string, address: string): Promise { - return this.nymdQuerier.ownsGateway(mixnetContractAddress, address); + return this.nyxdQuerier.ownsGateway(mixnetContractAddress, address); } getStateParams(mixnetContractAddress: string): Promise { - return this.nymdQuerier.getStateParams(mixnetContractAddress); + return this.nyxdQuerier.getStateParams(mixnetContractAddress); } getAllNetworkDelegationsPaged( @@ -263,7 +263,7 @@ export default class SigningClient extends SigningCosmWasmClient implements ISig limit?: number, startAfter?: [string, string], ): Promise { - return this.nymdQuerier.getAllNetworkDelegationsPaged(mixnetContractAddress, limit, startAfter); + return this.nyxdQuerier.getAllNetworkDelegationsPaged(mixnetContractAddress, limit, startAfter); } getMixNodeDelegationsPaged( @@ -272,7 +272,7 @@ export default class SigningClient extends SigningCosmWasmClient implements ISig limit?: number, startAfter?: string, ): Promise { - return this.nymdQuerier.getMixNodeDelegationsPaged(mixnetContractAddress, mixIdentity, limit, startAfter); + return this.nyxdQuerier.getMixNodeDelegationsPaged(mixnetContractAddress, mixIdentity, limit, startAfter); } getDelegatorDelegationsPaged( @@ -281,31 +281,31 @@ export default class SigningClient extends SigningCosmWasmClient implements ISig limit?: number, startAfter?: string, ): Promise { - return this.nymdQuerier.getDelegatorDelegationsPaged(mixnetContractAddress, delegator, limit, startAfter); + return this.nyxdQuerier.getDelegatorDelegationsPaged(mixnetContractAddress, delegator, limit, startAfter); } getDelegationDetails(mixnetContractAddress: string, mixIdentity: string, delegator: string): Promise { - return this.nymdQuerier.getDelegationDetails(mixnetContractAddress, mixIdentity, delegator); + return this.nyxdQuerier.getDelegationDetails(mixnetContractAddress, mixIdentity, delegator); } getLayerDistribution(mixnetContractAddress: string): Promise { - return this.nymdQuerier.getLayerDistribution(mixnetContractAddress); + return this.nyxdQuerier.getLayerDistribution(mixnetContractAddress); } getRewardPool(mixnetContractAddress: string): Promise { - return this.nymdQuerier.getRewardPool(mixnetContractAddress); + return this.nyxdQuerier.getRewardPool(mixnetContractAddress); } getCirculatingSupply(mixnetContractAddress: string): Promise { - return this.nymdQuerier.getCirculatingSupply(mixnetContractAddress); + return this.nyxdQuerier.getCirculatingSupply(mixnetContractAddress); } getIntervalRewardPercent(mixnetContractAddress: string): Promise { - return this.nymdQuerier.getIntervalRewardPercent(mixnetContractAddress); + return this.nyxdQuerier.getIntervalRewardPercent(mixnetContractAddress); } getSybilResistancePercent(mixnetContractAddress: string): Promise { - return this.nymdQuerier.getSybilResistancePercent(mixnetContractAddress); + return this.nyxdQuerier.getSybilResistancePercent(mixnetContractAddress); } getRewardingStatus( @@ -313,7 +313,7 @@ export default class SigningClient extends SigningCosmWasmClient implements ISig mixIdentity: string, rewardingIntervalNonce: number, ): Promise { - return this.nymdQuerier.getRewardingStatus(mixnetContractAddress, mixIdentity, rewardingIntervalNonce); + return this.nyxdQuerier.getRewardingStatus(mixnetContractAddress, mixIdentity, rewardingIntervalNonce); } getCachedGateways(): Promise { diff --git a/clients/webassembly/src/gateway_selector.rs b/clients/webassembly/src/gateway_selector.rs index 77f5a5c6f7..d92ac987c3 100644 --- a/clients/webassembly/src/gateway_selector.rs +++ b/clients/webassembly/src/gateway_selector.rs @@ -6,7 +6,7 @@ use wasm_bindgen::prelude::*; #[wasm_bindgen] pub async fn get_gateway(api_server: String, preferred: Option) -> GatewayEndpointConfig { - let validator_client = validator_client::client::ApiClient::new(api_server.parse().unwrap()); + let validator_client = validator_client::client::NymApiClient::new(api_server.parse().unwrap()); let gateways = match validator_client.get_cached_gateways().await { Err(err) => panic!("failed to obtain list of all gateways - {err}"), diff --git a/common/client-libs/validator-client/Cargo.toml b/common/client-libs/validator-client/Cargo.toml index 18096c3db0..0527db6954 100644 --- a/common/client-libs/validator-client/Cargo.toml +++ b/common/client-libs/validator-client/Cargo.toml @@ -31,7 +31,7 @@ coconut-interface = { path = "../../coconut-interface" } network-defaults = { path = "../../network-defaults" } nym-api-requests = { path = "../../../nym-api/nym-api-requests", features = ["coconut"] } -# required for nymd-client +# required for nyxd-client # at some point it might be possible to make it wasm-compatible # perhaps after https://github.com/cosmos/cosmos-rust/pull/97 is resolved (and tendermint-rs is updated) async-trait = { version = "0.1.51", optional = true } @@ -50,7 +50,7 @@ execute = { path = "../../execute" } ts-rs = "6.1.2" [features] -nymd-client = [ +nyxd-client = [ "async-trait", "bip39", "config", diff --git a/common/client-libs/validator-client/src/client.rs b/common/client-libs/validator-client/src/client.rs index 396efb4c3c..9ba5e6319b 100644 --- a/common/client-libs/validator-client/src/client.rs +++ b/common/client-libs/validator-client/src/client.rs @@ -15,41 +15,41 @@ use nym_api_requests::models::{ RewardEstimationResponse, StakeSaturationResponse, }; -#[cfg(feature = "nymd-client")] -use crate::nymd::traits::{DkgQueryClient, MixnetQueryClient, MultisigQueryClient}; -#[cfg(feature = "nymd-client")] -use crate::nymd::{self, CosmWasmClient, NymdClient, QueryNymdClient, SigningNymdClient}; -#[cfg(feature = "nymd-client")] +#[cfg(feature = "nyxd-client")] +use crate::nyxd::traits::{DkgQueryClient, MixnetQueryClient, MultisigQueryClient}; +#[cfg(feature = "nyxd-client")] +use crate::nyxd::{self, CosmWasmClient, NyxdClient, QueryNyxdClient, SigningNyxdClient}; +#[cfg(feature = "nyxd-client")] use coconut_dkg_common::{ dealer::ContractDealing, types::DealerDetails, verification_key::ContractVKShare, }; -#[cfg(feature = "nymd-client")] +#[cfg(feature = "nyxd-client")] use coconut_interface::Base58; -#[cfg(feature = "nymd-client")] +#[cfg(feature = "nyxd-client")] use cw3::ProposalResponse; -#[cfg(feature = "nymd-client")] +#[cfg(feature = "nyxd-client")] use mixnet_contract_common::{ families::{Family, FamilyHead}, mixnode::MixNodeBond, pending_events::{PendingEpochEvent, PendingIntervalEvent}, Delegation, IdentityKey, RewardedSetNodeStatus, UnbondedMixnode, }; -#[cfg(feature = "nymd-client")] +#[cfg(feature = "nyxd-client")] use network_defaults::NymNetworkDetails; -#[cfg(feature = "nymd-client")] +#[cfg(feature = "nyxd-client")] use nym_api_requests::models::MixNodeBondAnnotated; -#[cfg(feature = "nymd-client")] +#[cfg(feature = "nyxd-client")] use std::str::FromStr; use url::Url; -#[cfg(feature = "nymd-client")] +#[cfg(feature = "nyxd-client")] #[must_use] #[derive(Debug, Clone)] pub struct Config { api_url: Url, - nymd_url: Url, + nyxd_url: Url, - nymd_config: nymd::Config, + nyxd_config: nyxd::Config, mixnode_page_limit: Option, gateway_page_limit: Option, @@ -60,7 +60,7 @@ pub struct Config { proposals_page_limit: Option, } -#[cfg(feature = "nymd-client")] +#[cfg(feature = "nyxd-client")] impl Config { pub fn try_from_nym_network_details( details: &NymNetworkDetails, @@ -78,11 +78,11 @@ impl Config { Ok(Config { api_url: api_url.pop().unwrap(), - nymd_url: details.endpoints[0] - .nymd_url + nyxd_url: details.endpoints[0] + .nyxd_url .parse() .map_err(ValidatorClientError::MalformedUrlProvided)?, - nymd_config: nymd::Config::try_from_nym_network_details(details)?, + nyxd_config: nyxd::Config::try_from_nym_network_details(details)?, mixnode_page_limit: None, gateway_page_limit: None, mixnode_delegations_page_limit: None, @@ -95,14 +95,14 @@ impl Config { // TODO: this method shouldn't really exist as all information should be included immediately // via `from_nym_network_details`, but it's here for, you guessed it, legacy compatibility - pub fn with_urls(mut self, nymd_url: Url, api_url: Url) -> Self { - self.nymd_url = nymd_url; + pub fn with_urls(mut self, nyxd_url: Url, api_url: Url) -> Self { + self.nyxd_url = nyxd_url; self.api_url = api_url; self } - pub fn with_nymd_url(mut self, nymd_url: Url) -> Self { - self.nymd_url = nymd_url; + pub fn with_nyxd_url(mut self, nyxd_url: Url) -> Self { + self.nyxd_url = nyxd_url; self } @@ -127,7 +127,7 @@ impl Config { } } -#[cfg(feature = "nymd-client")] +#[cfg(feature = "nyxd-client")] pub struct Client { // TODO: we really shouldn't be storing a mnemonic here, but removing it would be // non-trivial amount of work and it's out of scope of the current branch @@ -143,19 +143,19 @@ pub struct Client { // ideally they would have been read-only, but unfortunately rust doesn't have such features pub nym_api: nym_api::Client, - pub nymd: NymdClient, + pub nyxd: NyxdClient, } -#[cfg(feature = "nymd-client")] -impl Client { +#[cfg(feature = "nyxd-client")] +impl Client { pub fn new_signing( config: Config, mnemonic: bip39::Mnemonic, - ) -> Result, ValidatorClientError> { + ) -> Result, ValidatorClientError> { let nym_api_client = nym_api::Client::new(config.api_url.clone()); - let nymd_client = NymdClient::connect_with_mnemonic( - config.nymd_config.clone(), - config.nymd_url.as_str(), + let nyxd_client = NyxdClient::connect_with_mnemonic( + config.nyxd_config.clone(), + config.nyxd_url.as_str(), mnemonic.clone(), None, )?; @@ -170,13 +170,13 @@ impl Client { verification_key_page_limit: config.verification_key_page_limit, proposals_page_limit: config.proposals_page_limit, nym_api: nym_api_client, - nymd: nymd_client, + nyxd: nyxd_client, }) } - pub fn change_nymd(&mut self, new_endpoint: Url) -> Result<(), ValidatorClientError> { - self.nymd = NymdClient::connect_with_mnemonic( - self.nymd.current_config().clone(), + pub fn change_nyxd(&mut self, new_endpoint: Url) -> Result<(), ValidatorClientError> { + self.nyxd = NyxdClient::connect_with_mnemonic( + self.nyxd.current_config().clone(), new_endpoint.as_ref(), self.mnemonic.clone().unwrap(), None, @@ -184,17 +184,17 @@ impl Client { Ok(()) } - pub fn set_nymd_simulated_gas_multiplier(&mut self, multiplier: f32) { - self.nymd.set_simulated_gas_multiplier(multiplier) + pub fn set_nyxd_simulated_gas_multiplier(&mut self, multiplier: f32) { + self.nyxd.set_simulated_gas_multiplier(multiplier) } } -#[cfg(feature = "nymd-client")] -impl Client { - pub fn new_query(config: Config) -> Result, ValidatorClientError> { +#[cfg(feature = "nyxd-client")] +impl Client { + pub fn new_query(config: Config) -> Result, ValidatorClientError> { let nym_api_client = nym_api::Client::new(config.api_url.clone()); - let nymd_client = - NymdClient::connect(config.nymd_config.clone(), config.nymd_url.as_str())?; + let nyxd_client = + NyxdClient::connect(config.nyxd_config.clone(), config.nyxd_url.as_str())?; Ok(Client { mnemonic: None, @@ -206,29 +206,29 @@ impl Client { verification_key_page_limit: config.verification_key_page_limit, proposals_page_limit: config.proposals_page_limit, nym_api: nym_api_client, - nymd: nymd_client, + nyxd: nyxd_client, }) } - pub fn change_nymd(&mut self, new_endpoint: Url) -> Result<(), ValidatorClientError> { - self.nymd = NymdClient::connect(self.nymd.current_config().clone(), new_endpoint.as_ref())?; + pub fn change_nyxd(&mut self, new_endpoint: Url) -> Result<(), ValidatorClientError> { + self.nyxd = NyxdClient::connect(self.nyxd.current_config().clone(), new_endpoint.as_ref())?; Ok(()) } } -// nymd wrappers -#[cfg(feature = "nymd-client")] +// nyxd wrappers +#[cfg(feature = "nyxd-client")] impl Client { // use case: somebody initialised client without a contract in order to upload and initialise one // and now they want to actually use it without making new client pub fn set_mixnet_contract_address(&mut self, mixnet_contract_address: cosmrs::AccountId) { - self.nymd + self.nyxd .set_mixnet_contract_address(mixnet_contract_address) } pub fn get_mixnet_contract_address(&self) -> cosmrs::AccountId { - self.nymd.mixnet_contract_address().clone() + self.nyxd.mixnet_contract_address().clone() } pub async fn get_all_node_families(&self) -> Result, ValidatorClientError> @@ -240,7 +240,7 @@ impl Client { loop { let paged_response = self - .nymd + .nyxd .get_all_node_families_paged(start_after.take(), None) .await?; families.extend(paged_response.families); @@ -266,7 +266,7 @@ impl Client { loop { let paged_response = self - .nymd + .nyxd .get_all_family_members_paged(start_after.take(), None) .await?; members.extend(paged_response.members); @@ -282,7 +282,7 @@ impl Client { } // basically handles paging for us - pub async fn get_all_nymd_rewarded_set_mixnodes( + pub async fn get_all_nyxd_rewarded_set_mixnodes( &self, ) -> Result, ValidatorClientError> where @@ -293,7 +293,7 @@ impl Client { loop { let mut paged_response = self - .nymd + .nyxd .get_rewarded_set_paged(start_after.take(), self.rewarded_set_page_limit) .await?; identities.append(&mut paged_response.nodes); @@ -308,7 +308,7 @@ impl Client { Ok(identities) } - pub async fn get_all_nymd_mixnode_bonds(&self) -> Result, ValidatorClientError> + pub async fn get_all_nyxd_mixnode_bonds(&self) -> Result, ValidatorClientError> where C: CosmWasmClient + Sync + Send, { @@ -316,7 +316,7 @@ impl Client { let mut start_after = None; loop { let mut paged_response = self - .nymd + .nyxd .get_mixnode_bonds_paged(self.mixnode_page_limit, start_after.take()) .await?; mixnodes.append(&mut paged_response.nodes); @@ -331,7 +331,7 @@ impl Client { Ok(mixnodes) } - pub async fn get_all_nymd_mixnodes_detailed( + pub async fn get_all_nyxd_mixnodes_detailed( &self, ) -> Result, ValidatorClientError> where @@ -341,7 +341,7 @@ impl Client { let mut start_after = None; loop { let mut paged_response = self - .nymd + .nyxd .get_mixnodes_detailed_paged(self.mixnode_page_limit, start_after.take()) .await?; mixnodes.append(&mut paged_response.nodes); @@ -356,7 +356,7 @@ impl Client { Ok(mixnodes) } - pub async fn get_all_nymd_unbonded_mixnodes( + pub async fn get_all_nyxd_unbonded_mixnodes( &self, ) -> Result, ValidatorClientError> where @@ -366,7 +366,7 @@ impl Client { let mut start_after = None; loop { let mut paged_response = self - .nymd + .nyxd .get_unbonded_paged(self.mixnode_page_limit, start_after.take()) .await?; mixnodes.append(&mut paged_response.nodes); @@ -381,7 +381,7 @@ impl Client { Ok(mixnodes) } - pub async fn get_all_nymd_unbonded_mixnodes_by_owner( + pub async fn get_all_nyxd_unbonded_mixnodes_by_owner( &self, owner: &cosmrs::AccountId, ) -> Result, ValidatorClientError> @@ -392,7 +392,7 @@ impl Client { let mut start_after = None; loop { let mut paged_response = self - .nymd + .nyxd .get_unbonded_by_owner_paged(owner, self.mixnode_page_limit, start_after.take()) .await?; mixnodes.append(&mut paged_response.nodes); @@ -407,7 +407,7 @@ impl Client { Ok(mixnodes) } - pub async fn get_all_nymd_unbonded_mixnodes_by_identity( + pub async fn get_all_nyxd_unbonded_mixnodes_by_identity( &self, identity_key: String, ) -> Result, ValidatorClientError> @@ -418,7 +418,7 @@ impl Client { let mut start_after = None; loop { let mut paged_response = self - .nymd + .nyxd .get_unbonded_by_identity_paged( identity_key.clone(), self.mixnode_page_limit, @@ -437,7 +437,7 @@ impl Client { Ok(mixnodes) } - pub async fn get_all_nymd_gateways(&self) -> Result, ValidatorClientError> + pub async fn get_all_nyxd_gateways(&self) -> Result, ValidatorClientError> where C: CosmWasmClient + Sync + Send, { @@ -445,7 +445,7 @@ impl Client { let mut start_after = None; loop { let mut paged_response = self - .nymd + .nyxd .get_gateways_paged(start_after.take(), self.gateway_page_limit) .await?; gateways.append(&mut paged_response.nodes); @@ -460,7 +460,7 @@ impl Client { Ok(gateways) } - pub async fn get_all_nymd_single_mixnode_delegations( + pub async fn get_all_nyxd_single_mixnode_delegations( &self, mix_id: MixId, ) -> Result, ValidatorClientError> @@ -471,7 +471,7 @@ impl Client { let mut start_after = None; loop { let mut paged_response = self - .nymd + .nyxd .get_mixnode_delegations_paged( mix_id, start_after.take(), @@ -501,7 +501,7 @@ impl Client { let mut start_after = None; loop { let mut paged_response = self - .nymd + .nyxd .get_delegator_delegations_paged( delegation_owner.to_string(), start_after.take(), @@ -528,7 +528,7 @@ impl Client { let mut start_after = None; loop { let mut paged_response = self - .nymd + .nyxd .get_all_network_delegations_paged( start_after.take(), self.mixnode_delegations_page_limit, @@ -546,7 +546,7 @@ impl Client { Ok(delegations) } - pub async fn get_all_nymd_pending_epoch_events( + pub async fn get_all_nyxd_pending_epoch_events( &self, ) -> Result, ValidatorClientError> where @@ -557,7 +557,7 @@ impl Client { loop { let mut paged_response = self - .nymd + .nyxd .get_pending_epoch_events_paged(start_after.take(), self.rewarded_set_page_limit) .await?; events.append(&mut paged_response.events); @@ -572,7 +572,7 @@ impl Client { Ok(events) } - pub async fn get_all_nymd_pending_interval_events( + pub async fn get_all_nyxd_pending_interval_events( &self, ) -> Result, ValidatorClientError> where @@ -583,7 +583,7 @@ impl Client { loop { let mut paged_response = self - .nymd + .nyxd .get_pending_interval_events_paged(start_after.take(), self.rewarded_set_page_limit) .await?; events.append(&mut paged_response.events); @@ -598,7 +598,7 @@ impl Client { Ok(events) } - pub async fn get_all_nymd_current_dealers( + pub async fn get_all_nyxd_current_dealers( &self, ) -> Result, ValidatorClientError> where @@ -608,7 +608,7 @@ impl Client { let mut start_after = None; loop { let mut paged_response = self - .nymd + .nyxd .get_current_dealers_paged(start_after.take(), self.dealers_page_limit) .await?; dealers.append(&mut paged_response.dealers); @@ -623,7 +623,7 @@ impl Client { Ok(dealers) } - pub async fn get_all_nymd_past_dealers( + pub async fn get_all_nyxd_past_dealers( &self, ) -> Result, ValidatorClientError> where @@ -633,7 +633,7 @@ impl Client { let mut start_after = None; loop { let mut paged_response = self - .nymd + .nyxd .get_past_dealers_paged(start_after.take(), self.dealers_page_limit) .await?; dealers.append(&mut paged_response.dealers); @@ -648,7 +648,7 @@ impl Client { Ok(dealers) } - pub async fn get_all_nymd_epoch_dealings( + pub async fn get_all_nyxd_epoch_dealings( &self, idx: usize, ) -> Result, ValidatorClientError> @@ -659,7 +659,7 @@ impl Client { let mut start_after = None; loop { let mut paged_response = self - .nymd + .nyxd .get_dealings_paged(idx, start_after.take(), self.dealers_page_limit) .await?; dealings.append(&mut paged_response.dealings); @@ -674,7 +674,7 @@ impl Client { Ok(dealings) } - pub async fn get_all_nymd_verification_key_shares( + pub async fn get_all_nyxd_verification_key_shares( &self, ) -> Result, ValidatorClientError> where @@ -684,7 +684,7 @@ impl Client { let mut start_after = None; loop { let mut paged_response = self - .nymd + .nyxd .get_vk_shares_paged(start_after.take(), self.verification_key_page_limit) .await?; shares.append(&mut paged_response.shares); @@ -699,7 +699,7 @@ impl Client { Ok(shares) } - pub async fn get_all_nymd_proposals( + pub async fn get_all_nyxd_proposals( &self, ) -> Result, ValidatorClientError> where @@ -710,7 +710,7 @@ impl Client { loop { let mut paged_response = self - .nymd + .nyxd .list_proposals(start_after.take(), self.proposals_page_limit) .await?; @@ -729,7 +729,7 @@ impl Client { } // validator-api wrappers -#[cfg(feature = "nymd-client")] +#[cfg(feature = "nyxd-client")] impl Client { pub fn change_nym_api(&mut self, new_endpoint: Url) { self.nym_api.change_url(new_endpoint) @@ -783,23 +783,23 @@ impl Client { #[derive(Clone)] pub struct CoconutApiClient { - pub api_client: ApiClient, + pub api_client: NymApiClient, pub verification_key: VerificationKey, pub node_id: NodeIndex, - #[cfg(feature = "nymd-client")] + #[cfg(feature = "nyxd-client")] pub cosmos_address: cosmrs::AccountId, } -#[cfg(feature = "nymd-client")] +#[cfg(feature = "nyxd-client")] impl CoconutApiClient { pub async fn all_coconut_api_clients( - nymd_client: &Client, + nyxd_client: &Client, ) -> Result, ValidatorClientError> where C: CosmWasmClient + Sync + Send, { - Ok(nymd_client - .get_all_nymd_verification_key_shares() + Ok(nyxd_client + .get_all_nyxd_verification_key_shares() .await? .into_iter() .filter_map(Self::try_from) @@ -812,7 +812,7 @@ impl CoconutApiClient { if let Ok(verification_key) = VerificationKey::try_from_bs58(&share.share) { if let Ok(cosmos_address) = cosmrs::AccountId::from_str(share.owner.as_str()) { return Some(CoconutApiClient { - api_client: ApiClient::new(url_address), + api_client: NymApiClient::new(url_address), verification_key, node_id: share.node_index, cosmos_address, @@ -826,17 +826,17 @@ impl CoconutApiClient { } #[derive(Clone)] -pub struct ApiClient { +pub struct NymApiClient { pub nym_api_client: nym_api::Client, // TODO: perhaps if we really need it at some (currently I don't see any reasons for it) // we could re-implement the communication with the REST API on port 1317 } -impl ApiClient { +impl NymApiClient { pub fn new(api_url: Url) -> Self { let nym_api_client = nym_api::Client::new(api_url); - ApiClient { nym_api_client } + NymApiClient { nym_api_client } } pub fn change_nym_api(&mut self, new_endpoint: Url) { diff --git a/common/client-libs/validator-client/src/connection_tester.rs b/common/client-libs/validator-client/src/connection_tester.rs index 30e57ff95e..14f365639a 100644 --- a/common/client-libs/validator-client/src/connection_tester.rs +++ b/common/client-libs/validator-client/src/connection_tester.rs @@ -1,8 +1,8 @@ -use crate::nymd::error::NymdError; -use crate::nymd::{Config as ClientConfig, NymdClient, QueryNymdClient}; -use crate::ApiClient; +use crate::nyxd::error::NyxdError; +use crate::nyxd::{Config as ClientConfig, NyxdClient, QueryNyxdClient}; +use crate::NymApiClient; -use crate::nymd::traits::MixnetQueryClient; +use crate::nyxd::traits::MixnetQueryClient; use colored::Colorize; use core::fmt; use itertools::Itertools; @@ -16,9 +16,9 @@ use url::Url; const MAX_URLS_TESTED: usize = 200; const CONNECTION_TEST_TIMEOUT_SEC: u64 = 2; -// Run connection tests for all specified nymd and api urls. These are all run concurrently. +/// Run connection tests for all specified nyxd and api urls. These are all run concurrently. pub async fn run_validator_connection_test( - nymd_urls: impl Iterator, + nyxd_urls: impl Iterator, api_urls: impl Iterator, mixnet_contract_address: HashMap, ) -> ( @@ -27,7 +27,7 @@ pub async fn run_validator_connection_test( ) { // Setup all the clients for the connection tests let connection_test_clients = - setup_connection_tests(nymd_urls, api_urls, mixnet_contract_address); + setup_connection_tests(nyxd_urls, api_urls, mixnet_contract_address); // Run all tests concurrently let connection_results = futures::future::join_all( @@ -40,28 +40,28 @@ pub async fn run_validator_connection_test( // Seperate and collect results into HashMaps ( - extract_and_collect_results_into_map(&connection_results, &UrlType::Nymd), - extract_and_collect_results_into_map(&connection_results, &UrlType::Api), + extract_and_collect_results_into_map(&connection_results, &UrlType::Nyxd), + extract_and_collect_results_into_map(&connection_results, &UrlType::NymApi), ) } fn setup_connection_tests( - nymd_urls: impl Iterator, + nyxd_urls: impl Iterator, api_urls: impl Iterator, mixnet_contract_address: HashMap, ) -> impl Iterator { - let nymd_connection_test_clients = nymd_urls.filter_map(move |(network, url)| { + let nyxd_connection_test_clients = nyxd_urls.filter_map(move |(network, url)| { let address = mixnet_contract_address .get(&network) .expect("No configured contract address") .clone(); let config = ClientConfig::try_from_nym_network_details(&network) - .expect("failed to create valid nymd client config"); + .expect("failed to create valid nyxd client config"); - if let Ok(mut client) = NymdClient::::connect(config, url.as_str()) { + if let Ok(mut client) = NyxdClient::::connect(config, url.as_str()) { // possibly redundant, but lets just leave it here client.set_mixnet_contract_address(address); - Some(ClientForConnectionTest::Nymd( + Some(ClientForConnectionTest::Nyxd( network, url, Box::new(client), @@ -72,10 +72,10 @@ fn setup_connection_tests( }); let api_connection_test_clients = api_urls.map(|(network, url)| { - ClientForConnectionTest::Api(network, url.clone(), ApiClient::new(url)) + ClientForConnectionTest::Api(network, url.clone(), NymApiClient::new(url)) }); - nymd_connection_test_clients.chain(api_connection_test_clients) + nyxd_connection_test_clients.chain(api_connection_test_clients) } fn extract_and_collect_results_into_map( @@ -92,10 +92,10 @@ fn extract_and_collect_results_into_map( .into_group_map() } -async fn test_nymd_connection( +async fn test_nyxd_connection( network: NymNetworkDetails, url: &Url, - client: &NymdClient, + client: &NyxdClient, ) -> ConnectionResult { let result = match timeout( Duration::from_secs(CONNECTION_TEST_TIMEOUT_SEC), @@ -103,48 +103,48 @@ async fn test_nymd_connection( ) .await { - Ok(Err(NymdError::TendermintError(e))) => { + Ok(Err(NyxdError::TendermintError(e))) => { // If we get a tendermint-rpc error, we classify the node as not contactable - log::debug!("Checking: nymd_url: {url}: {}: {}", "failed".red(), e); + log::debug!("Checking: nyxd url: {url}: {}: {}", "failed".red(), e); false } - Ok(Err(NymdError::AbciError { code, log, .. })) => { + Ok(Err(NyxdError::AbciError { code, log, .. })) => { // We accept the mixnet contract not found as ok from a connection standpoint. This happens // for example on a pre-launch network. log::debug!( - "Checking: nymd_url: {url}: {}, but with abci error: {code}: {log}", + "Checking: nyxd url: {url}: {}, but with abci error: {code}: {log}", "success".green() ); code == 18 } - Ok(Err(error @ NymdError::NoContractAddressAvailable)) => { - log::debug!("Checking: nymd_url: {url}: {}: {error}", "failed".red()); + Ok(Err(error @ NyxdError::NoContractAddressAvailable)) => { + log::debug!("Checking: nyxd url: {url}: {}: {error}", "failed".red()); false } Ok(Err(e)) => { // For any other error, we're optimistic and just try anyway. log::debug!( - "Checking: nymd_url: {url}: {}, but with error: {e}", + "Checking: nyxd_url: {url}: {}, but with error: {e}", "success".green() ); true } Ok(Ok(_)) => { - log::debug!("Checking: nymd_url: {url}: {}", "success".green()); + log::debug!("Checking: nyxd_url: {url}: {}", "success".green()); true } Err(e) => { - log::debug!("Checking: nymd_url: {url}: {}: {e}", "failed".red()); + log::debug!("Checking: nyxd_url: {url}: {}: {e}", "failed".red()); false } }; - ConnectionResult::Nymd(network, url.clone(), result) + ConnectionResult::Nyxd(network, url.clone(), result) } -async fn test_api_connection( +async fn test_nym_api_connection( network: NymNetworkDetails, url: &Url, - client: &ApiClient, + client: &NymApiClient, ) -> ConnectionResult { let result = match timeout( Duration::from_secs(CONNECTION_TEST_TIMEOUT_SEC), @@ -169,18 +169,18 @@ async fn test_api_connection( } enum ClientForConnectionTest { - Nymd(NymNetworkDetails, Url, Box>), - Api(NymNetworkDetails, Url, ApiClient), + Nyxd(NymNetworkDetails, Url, Box>), + Api(NymNetworkDetails, Url, NymApiClient), } impl ClientForConnectionTest { async fn run_connection_check(self) -> ConnectionResult { match self { - ClientForConnectionTest::Nymd(network, ref url, ref client) => { - test_nymd_connection(network, url, client).await + ClientForConnectionTest::Nyxd(network, ref url, ref client) => { + test_nyxd_connection(network, url, client).await } ClientForConnectionTest::Api(network, ref url, ref client) => { - test_api_connection(network, url, client).await + test_nym_api_connection(network, url, client).await } } } @@ -188,37 +188,37 @@ impl ClientForConnectionTest { #[derive(Debug, PartialEq, Eq)] enum UrlType { - Nymd, - Api, + Nyxd, + NymApi, } impl fmt::Display for UrlType { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - UrlType::Nymd => write!(f, "nymd"), - UrlType::Api => write!(f, "api"), + UrlType::Nyxd => write!(f, "nyxd"), + UrlType::NymApi => write!(f, "api"), } } } #[derive(Debug)] enum ConnectionResult { - Nymd(NymNetworkDetails, Url, bool), + Nyxd(NymNetworkDetails, Url, bool), Api(NymNetworkDetails, Url, bool), } impl ConnectionResult { fn result(&self) -> (&NymNetworkDetails, &Url, &bool) { match self { - ConnectionResult::Nymd(network, url, result) + ConnectionResult::Nyxd(network, url, result) | ConnectionResult::Api(network, url, result) => (network, url, result), } } fn url_type(&self) -> UrlType { match self { - ConnectionResult::Nymd(..) => UrlType::Nymd, - ConnectionResult::Api(..) => UrlType::Api, + ConnectionResult::Nyxd(..) => UrlType::Nyxd, + ConnectionResult::Api(..) => UrlType::NymApi, } } } diff --git a/common/client-libs/validator-client/src/error.rs b/common/client-libs/validator-client/src/error.rs index 70ac98b30d..7b37ed6a14 100644 --- a/common/client-libs/validator-client/src/error.rs +++ b/common/client-libs/validator-client/src/error.rs @@ -15,9 +15,9 @@ pub enum ValidatorClientError { #[error("One of the provided URLs was malformed - {0}")] MalformedUrlProvided(#[from] url::ParseError), - #[cfg(feature = "nymd-client")] - #[error("There was an issue with the Nymd client - {0}")] - NymdError(#[from] crate::nymd::error::NymdError), + #[cfg(feature = "nyxd-client")] + #[error("There was an issue with the Nyxd client - {0}")] + NyxdError(#[from] crate::nyxd::error::NyxdError), #[error("No validator API url has been provided")] NoAPIUrlAvailable, diff --git a/common/client-libs/validator-client/src/lib.rs b/common/client-libs/validator-client/src/lib.rs index 5cf81f09d7..1c1c3a344c 100644 --- a/common/client-libs/validator-client/src/lib.rs +++ b/common/client-libs/validator-client/src/lib.rs @@ -2,17 +2,17 @@ // SPDX-License-Identifier: Apache-2.0 pub mod client; -#[cfg(feature = "nymd-client")] +#[cfg(feature = "nyxd-client")] pub mod connection_tester; mod error; pub mod nym_api; -#[cfg(feature = "nymd-client")] -pub mod nymd; +#[cfg(feature = "nyxd-client")] +pub mod nyxd; -#[cfg(feature = "nymd-client")] -pub use crate::client::{ApiClient, CoconutApiClient}; +#[cfg(feature = "nyxd-client")] +pub use crate::client::{CoconutApiClient, NymApiClient}; pub use crate::error::ValidatorClientError; pub use nym_api_requests::*; -#[cfg(feature = "nymd-client")] +#[cfg(feature = "nyxd-client")] pub use client::{Client, Config}; diff --git a/common/client-libs/validator-client/src/nymd/coin.rs b/common/client-libs/validator-client/src/nyxd/coin.rs similarity index 100% rename from common/client-libs/validator-client/src/nymd/coin.rs rename to common/client-libs/validator-client/src/nyxd/coin.rs diff --git a/common/client-libs/validator-client/src/nymd/cosmwasm_client/client.rs b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/client.rs similarity index 89% rename from common/client-libs/validator-client/src/nymd/cosmwasm_client/client.rs rename to common/client-libs/validator-client/src/nyxd/cosmwasm_client/client.rs index 580a8c7c05..9be833c68b 100644 --- a/common/client-libs/validator-client/src/nymd/cosmwasm_client/client.rs +++ b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/client.rs @@ -1,14 +1,14 @@ // Copyright 2021 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::nymd; -use crate::nymd::coin::Coin; -use crate::nymd::cosmwasm_client::helpers::{create_pagination, next_page_key}; -use crate::nymd::cosmwasm_client::types::{ +use crate::nyxd; +use crate::nyxd::coin::Coin; +use crate::nyxd::cosmwasm_client::helpers::{create_pagination, next_page_key}; +use crate::nyxd::cosmwasm_client::types::{ Account, Code, CodeDetails, Contract, ContractCodeHistoryEntry, ContractCodeId, SequenceResponse, SimulateResponse, }; -use crate::nymd::error::NymdError; +use crate::nyxd::error::NyxdError; use async_trait::async_trait; use cosmrs::proto::cosmos::auth::v1beta1::{QueryAccountRequest, QueryAccountResponse}; use cosmrs::proto::cosmos::bank::v1beta1::{ @@ -57,7 +57,7 @@ pub trait CosmWasmClient: rpc::Client { &self, path: Option, req: Req, - ) -> Result + ) -> Result where Req: Message, Res: Message + Default, @@ -66,21 +66,21 @@ pub trait CosmWasmClient: rpc::Client { req.encode(&mut buf)?; let res = self.abci_query(path, buf, None, false).await?; - let res_success = nymd::error::parse_abci_query_result(res)?; + let res_success = nyxd::error::parse_abci_query_result(res)?; Ok(Res::decode(res_success.value.as_ref())?) } - async fn get_chain_id(&self) -> Result { + async fn get_chain_id(&self) -> Result { Ok(self.status().await?.node_info.network) } - async fn get_height(&self) -> Result { + async fn get_height(&self) -> Result { Ok(self.status().await?.sync_info.latest_block_height) } // TODO: the return type should probably be changed to a non-proto, type-safe Account alternative - async fn get_account(&self, address: &AccountId) -> Result, NymdError> { + async fn get_account(&self, address: &AccountId) -> Result, NyxdError> { let path = Some("/cosmos.auth.v1beta1.Query/Account".parse().unwrap()); let req = QueryAccountRequest { @@ -94,11 +94,11 @@ pub trait CosmWasmClient: rpc::Client { res.account.map(TryFrom::try_from).transpose() } - async fn get_sequence(&self, address: &AccountId) -> Result { + async fn get_sequence(&self, address: &AccountId) -> Result { let account = self .get_account(address) .await? - .ok_or_else(|| NymdError::NonExistentAccountError(address.clone()))?; + .ok_or_else(|| NyxdError::NonExistentAccountError(address.clone()))?; let base_account = account.try_get_base_account()?; Ok(SequenceResponse { @@ -107,7 +107,7 @@ pub trait CosmWasmClient: rpc::Client { }) } - async fn get_block(&self, height: Option) -> Result { + async fn get_block(&self, height: Option) -> Result { match height { Some(height) => self.block(height).await.map_err(|err| err.into()), None => self.latest_block().await.map_err(|err| err.into()), @@ -118,7 +118,7 @@ pub trait CosmWasmClient: rpc::Client { &self, address: &AccountId, search_denom: String, - ) -> Result, NymdError> { + ) -> Result, NyxdError> { let path = Some("/cosmos.bank.v1beta1.Query/Balance".parse().unwrap()); let req = QueryBalanceRequest { @@ -133,10 +133,10 @@ pub trait CosmWasmClient: rpc::Client { res.balance .map(|proto| CosmosCoin::try_from(proto).map(Into::into)) .transpose() - .map_err(|_| NymdError::SerializationError("Coin".to_owned())) + .map_err(|_| NyxdError::SerializationError("Coin".to_owned())) } - async fn get_all_balances(&self, address: &AccountId) -> Result, NymdError> { + async fn get_all_balances(&self, address: &AccountId) -> Result, NyxdError> { let path = Some("/cosmos.bank.v1beta1.Query/AllBalances".parse().unwrap()); let mut raw_balances = Vec::new(); @@ -164,10 +164,10 @@ pub trait CosmWasmClient: rpc::Client { .into_iter() .map(|proto| CosmosCoin::try_from(proto).map(Into::into)) .collect::>() - .map_err(|_| NymdError::SerializationError("Coins".to_owned())) + .map_err(|_| NyxdError::SerializationError("Coins".to_owned())) } - async fn get_total_supply(&self) -> Result, NymdError> { + async fn get_total_supply(&self) -> Result, NyxdError> { let path = Some("/cosmos.bank.v1beta1.Query/TotalSupply".parse().unwrap()); let mut supply = Vec::new(); @@ -192,14 +192,14 @@ pub trait CosmWasmClient: rpc::Client { .into_iter() .map(|proto| CosmosCoin::try_from(proto).map(Into::into)) .collect::>() - .map_err(|_| NymdError::SerializationError("Coins".to_owned())) + .map_err(|_| NyxdError::SerializationError("Coins".to_owned())) } - async fn get_tx(&self, id: tx::Hash) -> Result { + async fn get_tx(&self, id: tx::Hash) -> Result { Ok(self.tx(id, false).await?) } - async fn search_tx(&self, query: Query) -> Result, NymdError> { + async fn search_tx(&self, query: Query) -> Result, NyxdError> { // according to https://docs.tendermint.com/master/rpc/#/Info/tx_search // the maximum entries per page is 100 and the default is 30 // so let's attempt to use the maximum @@ -234,7 +234,7 @@ pub trait CosmWasmClient: rpc::Client { async fn broadcast_tx_async( &self, tx: Transaction, - ) -> Result { + ) -> Result { Ok(rpc::Client::broadcast_tx_async(self, tx).await?) } @@ -242,7 +242,7 @@ pub trait CosmWasmClient: rpc::Client { async fn broadcast_tx_sync( &self, tx: Transaction, - ) -> Result { + ) -> Result { Ok(rpc::Client::broadcast_tx_sync(self, tx).await?) } @@ -250,16 +250,16 @@ pub trait CosmWasmClient: rpc::Client { async fn broadcast_tx_commit( &self, tx: Transaction, - ) -> Result { + ) -> Result { Ok(rpc::Client::broadcast_tx_commit(self, tx).await?) } - async fn broadcast_tx(&self, tx: Transaction) -> Result { + async fn broadcast_tx(&self, tx: Transaction) -> Result { let broadcasted = CosmWasmClient::broadcast_tx_sync(self, tx).await?; if broadcasted.code.is_err() { let code_val = broadcasted.code.value(); - return Err(NymdError::BroadcastTxErrorDeliverTx { + return Err(NyxdError::BroadcastTxErrorDeliverTx { hash: broadcasted.hash, height: None, code: code_val, @@ -276,7 +276,7 @@ pub trait CosmWasmClient: rpc::Client { broadcasted.hash ); if tokio::time::Instant::now().duration_since(start) >= self.broadcast_timeout() { - return Err(NymdError::BroadcastTimeout { + return Err(NyxdError::BroadcastTimeout { hash: tx_hash, timeout: self.broadcast_timeout(), }); @@ -290,7 +290,7 @@ pub trait CosmWasmClient: rpc::Client { } } - async fn get_codes(&self) -> Result, NymdError> { + async fn get_codes(&self) -> Result, NyxdError> { let path = Some("/cosmwasm.wasm.v1.Query/Codes".parse().unwrap()); let mut raw_codes = Vec::new(); @@ -317,7 +317,7 @@ pub trait CosmWasmClient: rpc::Client { .collect::>() } - async fn get_code_details(&self, code_id: ContractCodeId) -> Result { + async fn get_code_details(&self, code_id: ContractCodeId) -> Result { let path = Some("/cosmwasm.wasm.v1.Query/Code".parse().unwrap()); let req = QueryCodeRequest { code_id }; @@ -329,10 +329,10 @@ pub trait CosmWasmClient: rpc::Client { if let Some(code_info) = res.code_info { Ok(CodeDetails::new(code_info.try_into()?, res.data)) } else { - Err(NymdError::NoCodeInformation(code_id)) + Err(NyxdError::NoCodeInformation(code_id)) } } - async fn get_contracts(&self, code_id: ContractCodeId) -> Result, NymdError> { + async fn get_contracts(&self, code_id: ContractCodeId) -> Result, NyxdError> { let path = Some("/cosmwasm.wasm.v1.Query/ContractsByCode".parse().unwrap()); let mut raw_contracts = Vec::new(); @@ -360,10 +360,10 @@ pub trait CosmWasmClient: rpc::Client { .iter() .map(|raw| raw.parse()) .collect::>() - .map_err(|_| NymdError::DeserializationError("Contract addresses".to_owned())) + .map_err(|_| NyxdError::DeserializationError("Contract addresses".to_owned())) } - async fn get_contract(&self, address: &AccountId) -> Result { + async fn get_contract(&self, address: &AccountId) -> Result { let path = Some("/cosmwasm.wasm.v1.Query/ContractInfo".parse().unwrap()); let req = QueryContractInfoRequest { @@ -378,17 +378,17 @@ pub trait CosmWasmClient: rpc::Client { if let Some(contract_info) = res.contract_info { let address = response_address .parse() - .map_err(|_| NymdError::MalformedAccountAddress(response_address))?; + .map_err(|_| NyxdError::MalformedAccountAddress(response_address))?; Ok(Contract::new(address, contract_info.try_into()?)) } else { - Err(NymdError::NoContractInformation(address.clone())) + Err(NyxdError::NoContractInformation(address.clone())) } } async fn get_contract_code_history( &self, address: &AccountId, - ) -> Result, NymdError> { + ) -> Result, NyxdError> { let path = Some("/cosmwasm.wasm.v1.Query/ContractHistory".parse().unwrap()); let mut raw_entries = Vec::new(); @@ -422,7 +422,7 @@ pub trait CosmWasmClient: rpc::Client { &self, address: &AccountId, query_data: Vec, - ) -> Result, NymdError> { + ) -> Result, NyxdError> { let path = Some("/cosmwasm.wasm.v1.Query/RawContractState".parse().unwrap()); let req = QueryRawContractStateRequest { @@ -441,7 +441,7 @@ pub trait CosmWasmClient: rpc::Client { &self, address: &AccountId, query_msg: &M, - ) -> Result + ) -> Result where M: ?Sized + Serialize + Sync, for<'a> T: Deserialize<'a>, @@ -478,7 +478,7 @@ pub trait CosmWasmClient: rpc::Client { &self, tx: Option, tx_bytes: Vec, - ) -> Result { + ) -> Result { let path = Some("/cosmos.tx.v1beta1.Service/Simulate".parse().unwrap()); let req = SimulateRequest { diff --git a/common/client-libs/validator-client/src/nymd/cosmwasm_client/helpers.rs b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/helpers.rs similarity index 78% rename from common/client-libs/validator-client/src/nymd/cosmwasm_client/helpers.rs rename to common/client-libs/validator-client/src/nyxd/cosmwasm_client/helpers.rs index ce1e93dcdb..0dd7f98ead 100644 --- a/common/client-libs/validator-client/src/nymd/cosmwasm_client/helpers.rs +++ b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/helpers.rs @@ -1,7 +1,7 @@ // Copyright 2021 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::nymd::error::NymdError; +use crate::nyxd::error::NyxdError; use cosmrs::proto::cosmos::base::query::v1beta1::{PageRequest, PageResponse}; use cosmrs::proto::cosmos::base::v1beta1::Coin as ProtoCoin; use cosmrs::rpc::endpoint::broadcast; @@ -11,13 +11,13 @@ use flate2::Compression; use std::io::Write; pub(crate) trait CheckResponse: Sized { - fn check_response(self) -> Result; + fn check_response(self) -> Result; } impl CheckResponse for broadcast::tx_commit::Response { - fn check_response(self) -> Result { + fn check_response(self) -> Result { if self.check_tx.code.is_err() { - return Err(NymdError::BroadcastTxErrorCheckTx { + return Err(NyxdError::BroadcastTxErrorCheckTx { hash: self.hash, height: Some(self.height), code: self.check_tx.code.value(), @@ -26,7 +26,7 @@ impl CheckResponse for broadcast::tx_commit::Response { } if self.deliver_tx.code.is_err() { - return Err(NymdError::BroadcastTxErrorDeliverTx { + return Err(NyxdError::BroadcastTxErrorDeliverTx { hash: self.hash, height: Some(self.height), code: self.deliver_tx.code.value(), @@ -38,10 +38,10 @@ impl CheckResponse for broadcast::tx_commit::Response { } } -impl CheckResponse for crate::nymd::TxResponse { - fn check_response(self) -> Result { +impl CheckResponse for crate::nyxd::TxResponse { + fn check_response(self) -> Result { if self.tx_result.code.is_err() { - return Err(NymdError::BroadcastTxErrorDeliverTx { + return Err(NyxdError::BroadcastTxErrorDeliverTx { hash: self.hash, height: Some(self.height), code: self.tx_result.code.value(), @@ -53,13 +53,13 @@ impl CheckResponse for crate::nymd::TxResponse { } } -pub(crate) fn compress_wasm_code(code: &[u8]) -> Result, NymdError> { +pub(crate) fn compress_wasm_code(code: &[u8]) -> Result, NyxdError> { // using compression level 9, same as cosmjs, that optimises for size let mut encoder = GzEncoder::new(Vec::new(), Compression::best()); encoder .write_all(code) - .map_err(NymdError::WasmCompressionError)?; - encoder.finish().map_err(NymdError::WasmCompressionError) + .map_err(NyxdError::WasmCompressionError)?; + encoder.finish().map_err(NyxdError::WasmCompressionError) } pub(crate) fn create_pagination(key: Vec) -> PageRequest { @@ -84,11 +84,11 @@ pub(crate) fn next_page_key(pagination_info: Option) -> Option) -> Result, NymdError> { +pub(crate) fn parse_proto_coin_vec(value: Vec) -> Result, NyxdError> { value .into_iter() .map(|proto_coin| { - Coin::try_from(&proto_coin).map_err(|_| NymdError::MalformedCoin { + Coin::try_from(&proto_coin).map_err(|_| NyxdError::MalformedCoin { coin_representation: format!("{:?}", proto_coin), }) }) diff --git a/common/client-libs/validator-client/src/nymd/cosmwasm_client/logs.rs b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/logs.rs similarity index 94% rename from common/client-libs/validator-client/src/nymd/cosmwasm_client/logs.rs rename to common/client-libs/validator-client/src/nyxd/cosmwasm_client/logs.rs index f08903b99c..fd196cf6e7 100644 --- a/common/client-libs/validator-client/src/nymd/cosmwasm_client/logs.rs +++ b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/logs.rs @@ -1,7 +1,7 @@ // Copyright 2021 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::nymd::error::NymdError; +use crate::nyxd::error::NyxdError; use cosmrs::tendermint::abci; use itertools::Itertools; use serde::{Deserialize, Serialize}; @@ -39,17 +39,17 @@ pub fn find_attribute<'a>( } // those two functions were separated so that the internal logic could actually be tested -fn parse_raw_str_logs(raw: &str) -> Result, NymdError> { - let logs: Vec = serde_json::from_str(raw).map_err(|_| NymdError::MalformedLogString)?; +fn parse_raw_str_logs(raw: &str) -> Result, NyxdError> { + let logs: Vec = serde_json::from_str(raw).map_err(|_| NyxdError::MalformedLogString)?; if logs.len() != logs.iter().unique_by(|log| log.msg_index).count() { // this check is only here because I don't yet fully understand raw log string generation and // the fact the first entry does not seem to have `msg_index` defined on it. - return Err(NymdError::MalformedLogString); + return Err(NyxdError::MalformedLogString); } Ok(logs) } -pub fn parse_raw_logs(raw: abci::Log) -> Result, NymdError> { +pub fn parse_raw_logs(raw: abci::Log) -> Result, NyxdError> { parse_raw_str_logs(raw.as_ref()) } diff --git a/common/client-libs/validator-client/src/nymd/cosmwasm_client/mod.rs b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/mod.rs similarity index 77% rename from common/client-libs/validator-client/src/nymd/cosmwasm_client/mod.rs rename to common/client-libs/validator-client/src/nyxd/cosmwasm_client/mod.rs index 2af7b52704..ef8bcdc5d7 100644 --- a/common/client-libs/validator-client/src/nymd/cosmwasm_client/mod.rs +++ b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/mod.rs @@ -1,9 +1,9 @@ // Copyright 2021 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::nymd::error::NymdError; -use crate::nymd::wallet::DirectSecp256k1HdWallet; -use crate::nymd::GasPrice; +use crate::nyxd::error::NyxdError; +use crate::nyxd::wallet::DirectSecp256k1HdWallet; +use crate::nyxd::GasPrice; use cosmrs::rpc::{Error as TendermintRpcError, HttpClient, HttpClientUrl}; use std::convert::TryInto; @@ -13,7 +13,7 @@ pub mod logs; pub mod signing_client; pub mod types; -pub fn connect(endpoint: U) -> Result +pub fn connect(endpoint: U) -> Result where U: TryInto, { @@ -25,7 +25,7 @@ pub fn connect_with_signer( endpoint: U, signer: DirectSecp256k1HdWallet, gas_price: GasPrice, -) -> Result +) -> Result where U: TryInto, { diff --git a/common/client-libs/validator-client/src/nymd/cosmwasm_client/signing_client.rs b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/signing_client.rs similarity index 89% rename from common/client-libs/validator-client/src/nymd/cosmwasm_client/signing_client.rs rename to common/client-libs/validator-client/src/nyxd/cosmwasm_client/signing_client.rs index b1646f663e..6fbe2cec44 100644 --- a/common/client-libs/validator-client/src/nymd/cosmwasm_client/signing_client.rs +++ b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/signing_client.rs @@ -1,14 +1,14 @@ // Copyright 2021 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::nymd::cosmwasm_client::client::CosmWasmClient; -use crate::nymd::cosmwasm_client::helpers::{compress_wasm_code, CheckResponse}; -use crate::nymd::cosmwasm_client::logs::{self, parse_raw_logs}; -use crate::nymd::cosmwasm_client::types::*; -use crate::nymd::error::NymdError; -use crate::nymd::fee::{Fee, DEFAULT_SIMULATED_GAS_MULTIPLIER}; -use crate::nymd::wallet::DirectSecp256k1HdWallet; -use crate::nymd::{Coin, GasAdjustable, GasPrice, TxResponse}; +use crate::nyxd::cosmwasm_client::client::CosmWasmClient; +use crate::nyxd::cosmwasm_client::helpers::{compress_wasm_code, CheckResponse}; +use crate::nyxd::cosmwasm_client::logs::{self, parse_raw_logs}; +use crate::nyxd::cosmwasm_client::types::*; +use crate::nyxd::error::NyxdError; +use crate::nyxd::fee::{Fee, DEFAULT_SIMULATED_GAS_MULTIPLIER}; +use crate::nyxd::wallet::DirectSecp256k1HdWallet; +use crate::nyxd::{Coin, GasAdjustable, GasPrice, TxResponse}; use async_trait::async_trait; use cosmrs::bank::MsgSend; use cosmrs::distribution::MsgWithdrawDelegatorReward; @@ -74,7 +74,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { signer_address: &AccountId, messages: Vec, memo: impl Into + Send + 'static, - ) -> Result { + ) -> Result { let public_key = self.signer_public_key(signer_address); let sequence_response = self.get_sequence(signer_address).await?; @@ -102,7 +102,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { wasm_code: Vec, fee: Fee, memo: impl Into + Send + 'static, - ) -> Result { + ) -> Result { let compressed = compress_wasm_code(&wasm_code)?; let compressed_size = compressed.len(); let compressed_checksum = Sha256::digest(&compressed).to_vec(); @@ -115,7 +115,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { instantiate_permission: Default::default(), } .to_any() - .map_err(|_| NymdError::SerializationError("MsgStoreCode".to_owned()))?; + .map_err(|_| NyxdError::SerializationError("MsgStoreCode".to_owned()))?; let tx_res = self .sign_and_broadcast(sender_address, vec![upload_msg], fee, memo) @@ -161,7 +161,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { fee: Fee, memo: impl Into + Send + 'static, mut options: Option, - ) -> Result + ) -> Result where M: ?Sized + Serialize + Sync, { @@ -176,7 +176,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { funds: options.map(|options| options.funds).unwrap_or_default(), } .to_any() - .map_err(|_| NymdError::SerializationError("MsgInstantiateContract".to_owned()))?; + .map_err(|_| NyxdError::SerializationError("MsgInstantiateContract".to_owned()))?; let tx_res = self .sign_and_broadcast(sender_address, vec![init_msg], fee, memo) @@ -211,14 +211,14 @@ pub trait SigningCosmWasmClient: CosmWasmClient { new_admin: &AccountId, fee: Fee, memo: impl Into + Send + 'static, - ) -> Result { + ) -> Result { let change_admin_msg = cosmwasm::MsgUpdateAdmin { sender: sender_address.clone(), new_admin: new_admin.clone(), contract: contract_address.clone(), } .to_any() - .map_err(|_| NymdError::SerializationError("MsgUpdateAdmin".to_owned()))?; + .map_err(|_| NyxdError::SerializationError("MsgUpdateAdmin".to_owned()))?; let tx_res = self .sign_and_broadcast(sender_address, vec![change_admin_msg], fee, memo) @@ -240,13 +240,13 @@ pub trait SigningCosmWasmClient: CosmWasmClient { contract_address: &AccountId, fee: Fee, memo: impl Into + Send + 'static, - ) -> Result { + ) -> Result { let change_admin_msg = cosmwasm::MsgClearAdmin { sender: sender_address.clone(), contract: contract_address.clone(), } .to_any() - .map_err(|_| NymdError::SerializationError("MsgClearAdmin".to_owned()))?; + .map_err(|_| NyxdError::SerializationError("MsgClearAdmin".to_owned()))?; let tx_res = self .sign_and_broadcast(sender_address, vec![change_admin_msg], fee, memo) @@ -270,7 +270,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { fee: Fee, msg: &M, memo: impl Into + Send + 'static, - ) -> Result + ) -> Result where M: ?Sized + Serialize + Sync, { @@ -281,7 +281,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { msg: serde_json::to_vec(msg)?, } .to_any() - .map_err(|_| NymdError::SerializationError("MsgMigrateContract".to_owned()))?; + .map_err(|_| NyxdError::SerializationError("MsgMigrateContract".to_owned()))?; let tx_res = self .sign_and_broadcast(sender_address, vec![migrate_msg], fee, memo) @@ -305,7 +305,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { fee: Fee, memo: impl Into + Send + 'static, funds: Vec, - ) -> Result + ) -> Result where M: ?Sized + Serialize + Sync, { @@ -316,7 +316,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { funds: funds.into_iter().map(Into::into).collect(), } .to_any() - .map_err(|_| NymdError::SerializationError("MsgExecuteContract".to_owned()))?; + .map_err(|_| NyxdError::SerializationError("MsgExecuteContract".to_owned()))?; let tx_res = self .sign_and_broadcast(sender_address, vec![execute_msg], fee, memo) @@ -340,7 +340,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { msgs: I, fee: Fee, memo: impl Into + Send + 'static, - ) -> Result + ) -> Result where I: IntoIterator)> + Send, M: Serialize, @@ -355,7 +355,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { funds: funds.into_iter().map(Into::into).collect(), } .to_any() - .map_err(|_| NymdError::SerializationError("MsgExecuteContract".to_owned())) + .map_err(|_| NyxdError::SerializationError("MsgExecuteContract".to_owned())) }) .collect::>()?; @@ -381,14 +381,14 @@ pub trait SigningCosmWasmClient: CosmWasmClient { amount: Vec, fee: Fee, memo: impl Into + Send + 'static, - ) -> Result { + ) -> Result { let send_msg = MsgSend { from_address: sender_address.clone(), to_address: recipient_address.clone(), amount: amount.into_iter().map(Into::into).collect(), } .to_any() - .map_err(|_| NymdError::SerializationError("MsgSend".to_owned()))?; + .map_err(|_| NyxdError::SerializationError("MsgSend".to_owned()))?; self.sign_and_broadcast(sender_address, vec![send_msg], fee, memo) .await? @@ -401,7 +401,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { msgs: I, fee: Fee, memo: impl Into + Send + 'static, - ) -> Result + ) -> Result where I: IntoIterator)> + Send, { @@ -414,7 +414,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { amount: amount.into_iter().map(Into::into).collect(), } .to_any() - .map_err(|_| NymdError::SerializationError("MsgExecuteContract".to_owned())) + .map_err(|_| NyxdError::SerializationError("MsgExecuteContract".to_owned())) }) .collect::>()?; @@ -433,20 +433,20 @@ pub trait SigningCosmWasmClient: CosmWasmClient { allowed_messages: Vec, fee: Fee, memo: impl Into + Send + 'static, - ) -> Result { + ) -> Result { let basic_allowance = BasicAllowance { spend_limit: spend_limit.into_iter().map(Into::into).collect(), expiration, } .to_any() - .map_err(|_| NymdError::SerializationError("BasicAllowance".to_owned()))?; + .map_err(|_| NyxdError::SerializationError("BasicAllowance".to_owned()))?; let allowed_msg_allowance = AllowedMsgAllowance { allowance: Some(basic_allowance), allowed_messages, } .to_any() - .map_err(|_| NymdError::SerializationError("AllowedMsgAllowance".to_owned()))?; + .map_err(|_| NyxdError::SerializationError("AllowedMsgAllowance".to_owned()))?; let grant_allowance_msg = MsgGrantAllowance { granter: granter.to_owned(), @@ -454,7 +454,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { allowance: Some(allowed_msg_allowance), } .to_any() - .map_err(|_| NymdError::SerializationError("MsgGrantAllowance".to_owned()))?; + .map_err(|_| NyxdError::SerializationError("MsgGrantAllowance".to_owned()))?; self.sign_and_broadcast(granter, vec![grant_allowance_msg], fee, memo) .await? @@ -467,13 +467,13 @@ pub trait SigningCosmWasmClient: CosmWasmClient { grantee: &AccountId, fee: Fee, memo: impl Into + Send + 'static, - ) -> Result { + ) -> Result { let revoke_allowance_msg = MsgRevokeAllowance { granter: granter.to_owned(), grantee: grantee.to_owned(), } .to_any() - .map_err(|_| NymdError::SerializationError("MsgRevokeAllowance".to_owned()))?; + .map_err(|_| NyxdError::SerializationError("MsgRevokeAllowance".to_owned()))?; self.sign_and_broadcast(granter, vec![revoke_allowance_msg], fee, memo) .await? @@ -487,14 +487,14 @@ pub trait SigningCosmWasmClient: CosmWasmClient { amount: Coin, fee: Fee, memo: impl Into + Send + 'static, - ) -> Result { + ) -> Result { let delegate_msg = MsgDelegate { delegator_address: delegator_address.to_owned(), validator_address: validator_address.to_owned(), amount: amount.into(), } .to_any() - .map_err(|_| NymdError::SerializationError("MsgDelegate".to_owned()))?; + .map_err(|_| NyxdError::SerializationError("MsgDelegate".to_owned()))?; self.sign_and_broadcast(delegator_address, vec![delegate_msg], fee, memo) .await? @@ -508,14 +508,14 @@ pub trait SigningCosmWasmClient: CosmWasmClient { amount: Coin, fee: Fee, memo: impl Into + Send + 'static, - ) -> Result { + ) -> Result { let undelegate_msg = MsgUndelegate { delegator_address: delegator_address.to_owned(), validator_address: validator_address.to_owned(), amount: amount.into(), } .to_any() - .map_err(|_| NymdError::SerializationError("MsgUndelegate".to_owned()))?; + .map_err(|_| NyxdError::SerializationError("MsgUndelegate".to_owned()))?; self.sign_and_broadcast(delegator_address, vec![undelegate_msg], fee, memo) .await? @@ -528,13 +528,13 @@ pub trait SigningCosmWasmClient: CosmWasmClient { validator_address: &AccountId, fee: Fee, memo: impl Into + Send + 'static, - ) -> Result { + ) -> Result { let withdraw_msg = MsgWithdrawDelegatorReward { delegator_address: delegator_address.to_owned(), validator_address: validator_address.to_owned(), } .to_any() - .map_err(|_| NymdError::SerializationError("MsgWithdrawDelegatorReward".to_owned()))?; + .map_err(|_| NyxdError::SerializationError("MsgWithdrawDelegatorReward".to_owned()))?; self.sign_and_broadcast(delegator_address, vec![withdraw_msg], fee, memo) .await? @@ -549,7 +549,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { messages: &[Any], fee: Fee, memo: &String, - ) -> Result { + ) -> Result { let auto_fee = |multiplier: Option| async move { debug!("Trying to simulate gas costs..."); // from what I've seen in manual testing, gas estimation does not exist if transaction @@ -558,7 +558,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { .simulate(signer_address, messages.to_vec(), memo.clone()) .await? .gas_info - .ok_or(NymdError::GasEstimationFailure)? + .ok_or(NyxdError::GasEstimationFailure)? .gas_used; let multiplier = multiplier.unwrap_or(DEFAULT_SIMULATED_GAS_MULTIPLIER); @@ -569,7 +569,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { debug!("Final gas limit used: {}", gas); let fee = self.gas_price() * gas; - Ok::(tx::Fee::from_amount_and_gas(fee, gas)) + Ok::(tx::Fee::from_amount_and_gas(fee, gas)) }; let fee = match fee { Fee::Manual(fee) => fee, @@ -592,7 +592,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { messages: Vec, fee: Fee, memo: impl Into + Send + 'static, - ) -> Result { + ) -> Result { let memo = memo.into(); let fee = self .determine_transaction_fee(signer_address, &messages, fee, &memo) @@ -600,7 +600,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { let tx_raw = self.sign(signer_address, messages, fee, memo).await?; let tx_bytes = tx_raw .to_bytes() - .map_err(|_| NymdError::SerializationError("Tx".to_owned()))?; + .map_err(|_| NyxdError::SerializationError("Tx".to_owned()))?; CosmWasmClient::broadcast_tx_async(self, tx_bytes.into()).await } @@ -612,7 +612,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { messages: Vec, fee: Fee, memo: impl Into + Send + 'static, - ) -> Result { + ) -> Result { let memo = memo.into(); let fee = self .determine_transaction_fee(signer_address, &messages, fee, &memo) @@ -620,7 +620,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { let tx_raw = self.sign(signer_address, messages, fee, memo).await?; let tx_bytes = tx_raw .to_bytes() - .map_err(|_| NymdError::SerializationError("Tx".to_owned()))?; + .map_err(|_| NyxdError::SerializationError("Tx".to_owned()))?; CosmWasmClient::broadcast_tx_sync(self, tx_bytes.into()).await } @@ -632,7 +632,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { messages: Vec, fee: Fee, memo: impl Into + Send + 'static, - ) -> Result { + ) -> Result { let memo = memo.into(); let fee = self .determine_transaction_fee(signer_address, &messages, fee, &memo) @@ -641,7 +641,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { let tx_raw = self.sign(signer_address, messages, fee, memo).await?; let tx_bytes = tx_raw .to_bytes() - .map_err(|_| NymdError::SerializationError("Tx".to_owned()))?; + .map_err(|_| NyxdError::SerializationError("Tx".to_owned()))?; CosmWasmClient::broadcast_tx_commit(self, tx_bytes.into()).await } @@ -653,7 +653,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { messages: Vec, fee: Fee, memo: impl Into + Send + 'static, - ) -> Result { + ) -> Result { let memo = memo.into(); let fee = self .determine_transaction_fee(signer_address, &messages, fee, &memo) @@ -662,7 +662,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { let tx_raw = self.sign(signer_address, messages, fee, memo).await?; let tx_bytes = tx_raw .to_bytes() - .map_err(|_| NymdError::SerializationError("Tx".to_owned()))?; + .map_err(|_| NyxdError::SerializationError("Tx".to_owned()))?; self.broadcast_tx(tx_bytes.into()).await } @@ -674,12 +674,12 @@ pub trait SigningCosmWasmClient: CosmWasmClient { fee: tx::Fee, memo: impl Into + Send + 'static, signer_data: SignerData, - ) -> Result { + ) -> Result { let signer_accounts = self.signer().try_derive_accounts()?; let account_from_signer = signer_accounts .iter() .find(|account| &account.address == signer_address) - .ok_or_else(|| NymdError::SigningAccountNotFound(signer_address.clone()))?; + .ok_or_else(|| NyxdError::SigningAccountNotFound(signer_address.clone()))?; // TODO: WTF HOW IS TIMEOUT_HEIGHT SUPPOSED TO GET DETERMINED? // IT DOESNT EXIST IN COSMJS!! @@ -691,7 +691,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { SignerInfo::single_direct(Some(account_from_signer.public_key), signer_data.sequence); let auth_info = signer_info.auth_info(fee); - // ideally I'd prefer to have the entire error put into the NymdError::SigningFailure + // ideally I'd prefer to have the entire error put into the NyxdError::SigningFailure // but I'm super hesitant to trying to downcast the eyre::Report to cosmrs::error::Error let sign_doc = SignDoc::new( &tx_body, @@ -699,7 +699,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { &signer_data.chain_id, signer_data.account_number, ) - .map_err(|_| NymdError::SigningFailure)?; + .map_err(|_| NyxdError::SigningFailure)?; self.signer() .sign_direct_with_account(account_from_signer, sign_doc) @@ -711,7 +711,7 @@ pub trait SigningCosmWasmClient: CosmWasmClient { messages: Vec, fee: tx::Fee, memo: impl Into + Send + 'static, - ) -> Result { + ) -> Result { // TODO: Future optimisation: rather than grabbing current account_number and sequence // on every sign request -> just keep them cached on the struct and increment as required let sequence_response = self.get_sequence(signer_address).await?; @@ -742,7 +742,7 @@ impl Client { endpoint: U, signer: DirectSecp256k1HdWallet, gas_price: GasPrice, - ) -> Result + ) -> Result where U: TryInto, { diff --git a/common/client-libs/validator-client/src/nymd/cosmwasm_client/types.rs b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/types.rs similarity index 92% rename from common/client-libs/validator-client/src/nymd/cosmwasm_client/types.rs rename to common/client-libs/validator-client/src/nyxd/cosmwasm_client/types.rs index b680a1a8f4..96260c3bd8 100644 --- a/common/client-libs/validator-client/src/nymd/cosmwasm_client/types.rs +++ b/common/client-libs/validator-client/src/nyxd/cosmwasm_client/types.rs @@ -3,9 +3,9 @@ // TODO: There's a significant argument to pull those out of the package and make a PR on https://github.com/cosmos/cosmos-rust/ -use crate::nymd::cosmwasm_client::helpers::parse_proto_coin_vec; -use crate::nymd::cosmwasm_client::logs::Log; -use crate::nymd::error::NymdError; +use crate::nyxd::cosmwasm_client::helpers::parse_proto_coin_vec; +use crate::nyxd::cosmwasm_client::logs::Log; +use crate::nyxd::error::NyxdError; use cosmrs::crypto::PublicKey; use cosmrs::proto::cosmos::auth::v1beta1::{ BaseAccount as ProtoBaseAccount, ModuleAccount as ProtoModuleAccount, @@ -57,19 +57,19 @@ pub struct BaseAccount { } impl TryFrom for BaseAccount { - type Error = NymdError; + type Error = NyxdError; fn try_from(value: ProtoBaseAccount) -> Result { let address: AccountId = value .address .parse() - .map_err(|_| NymdError::MalformedAccountAddress(value.address.clone()))?; + .map_err(|_| NyxdError::MalformedAccountAddress(value.address.clone()))?; let pubkey = value .pub_key .map(PublicKey::try_from) .transpose() - .map_err(|_| NymdError::InvalidPublicKey(address.clone()))?; + .map_err(|_| NyxdError::InvalidPublicKey(address.clone()))?; Ok(BaseAccount { address, @@ -89,7 +89,7 @@ pub struct ModuleAccount { } impl TryFrom for ModuleAccount { - type Error = NymdError; + type Error = NyxdError; fn try_from(value: ProtoModuleAccount) -> Result { let base_account = value.base_account.map(TryFrom::try_from).transpose()?; @@ -114,7 +114,7 @@ pub struct BaseVestingAccount { } impl TryFrom for BaseVestingAccount { - type Error = NymdError; + type Error = NyxdError; fn try_from(value: ProtoBaseVestingAccount) -> Result { let base_account = value.base_account.map(TryFrom::try_from).transpose()?; @@ -142,7 +142,7 @@ pub struct ContinuousVestingAccount { } impl TryFrom for ContinuousVestingAccount { - type Error = NymdError; + type Error = NyxdError; fn try_from(value: ProtoContinuousVestingAccount) -> Result { let base_vesting_account = value @@ -166,7 +166,7 @@ pub struct DelayedVestingAccount { } impl TryFrom for DelayedVestingAccount { - type Error = NymdError; + type Error = NyxdError; fn try_from(value: ProtoDelayedVestingAccount) -> Result { let base_vesting_account = value @@ -188,7 +188,7 @@ pub struct Period { } impl TryFrom for Period { - type Error = NymdError; + type Error = NyxdError; fn try_from(value: ProtoPeriod) -> Result { Ok(Period { @@ -208,7 +208,7 @@ pub struct PeriodicVestingAccount { } impl TryFrom for PeriodicVestingAccount { - type Error = NymdError; + type Error = NyxdError; fn try_from(value: ProtoPeriodicVestingAccount) -> Result { let base_vesting_account = value @@ -239,7 +239,7 @@ pub struct PermanentLockedAccount { } impl TryFrom for PermanentLockedAccount { - type Error = NymdError; + type Error = NyxdError; fn try_from(value: ProtoPermanentLockedAccount) -> Result { let base_vesting_account = value @@ -265,43 +265,43 @@ pub enum Account { } impl Account { - pub fn try_get_base_account(&self) -> Result<&BaseAccount, NymdError> { + pub fn try_get_base_account(&self) -> Result<&BaseAccount, NyxdError> { match self { Account::Base(acc) => Ok(acc), Account::Module(acc) => acc .base_account .as_ref() - .ok_or(NymdError::NoBaseAccountInformationAvailable), + .ok_or(NyxdError::NoBaseAccountInformationAvailable), Account::BaseVesting(acc) => acc .base_account .as_ref() - .ok_or(NymdError::NoBaseAccountInformationAvailable), + .ok_or(NyxdError::NoBaseAccountInformationAvailable), Account::ContinuousVesting(acc) => acc .base_vesting_account .as_ref() .and_then(|vesting_acc| vesting_acc.base_account.as_ref()) - .ok_or(NymdError::NoBaseAccountInformationAvailable), + .ok_or(NyxdError::NoBaseAccountInformationAvailable), Account::DelayedVesting(acc) => acc .base_vesting_account .as_ref() .and_then(|vesting_acc| vesting_acc.base_account.as_ref()) - .ok_or(NymdError::NoBaseAccountInformationAvailable), + .ok_or(NyxdError::NoBaseAccountInformationAvailable), Account::PeriodicVesting(acc) => acc .base_vesting_account .as_ref() .and_then(|vesting_acc| vesting_acc.base_account.as_ref()) - .ok_or(NymdError::NoBaseAccountInformationAvailable), + .ok_or(NyxdError::NoBaseAccountInformationAvailable), Account::PermanentLockedVesting(acc) => acc .base_vesting_account .as_ref() .and_then(|vesting_acc| vesting_acc.base_account.as_ref()) - .ok_or(NymdError::NoBaseAccountInformationAvailable), + .ok_or(NyxdError::NoBaseAccountInformationAvailable), } } } impl TryFrom for Account { - type Error = NymdError; + type Error = NyxdError; fn try_from(raw_account: Any) -> Result { match raw_account.type_url.as_ref() { @@ -328,7 +328,7 @@ impl TryFrom for Account { ProtoPermanentLockedAccount::decode(raw_account.value.as_ref())?.try_into()?, )) } - _ => Err(NymdError::UnsupportedAccountType { + _ => Err(NyxdError::UnsupportedAccountType { type_url: raw_account.type_url, }), } @@ -347,7 +347,7 @@ pub struct Code { } impl TryFrom for Code { - type Error = NymdError; + type Error = NyxdError; fn try_from(value: CodeInfoResponse) -> Result { let CodeInfoResponse { @@ -358,7 +358,7 @@ impl TryFrom for Code { let creator = creator .parse() - .map_err(|_| NymdError::MalformedAccountAddress(creator))?; + .map_err(|_| NyxdError::MalformedAccountAddress(creator))?; Ok(Code { code_id, @@ -391,7 +391,7 @@ pub(crate) struct ContractInfo { } impl TryFrom for ContractInfo { - type Error = NymdError; + type Error = NyxdError; fn try_from(value: ProtoContractInfo) -> Result { let ProtoContractInfo { @@ -408,7 +408,7 @@ impl TryFrom for ContractInfo { Some( admin .parse() - .map_err(|_| NymdError::MalformedAccountAddress(admin))?, + .map_err(|_| NyxdError::MalformedAccountAddress(admin))?, ) }; @@ -416,7 +416,7 @@ impl TryFrom for ContractInfo { code_id, creator: creator .parse() - .map_err(|_| NymdError::MalformedAccountAddress(creator))?, + .map_err(|_| NyxdError::MalformedAccountAddress(creator))?, admin, label, }) @@ -466,14 +466,14 @@ pub struct ContractCodeHistoryEntry { } impl TryFrom for ContractCodeHistoryEntry { - type Error = NymdError; + type Error = NyxdError; fn try_from(value: ProtoContractCodeHistoryEntry) -> Result { let operation = match ContractCodeHistoryOperationType::from_i32(value.operation) - .ok_or(NymdError::InvalidContractHistoryOperation)? + .ok_or(NyxdError::InvalidContractHistoryOperation)? { ContractCodeHistoryOperationType::Unspecified => { - return Err(NymdError::InvalidContractHistoryOperation) + return Err(NyxdError::InvalidContractHistoryOperation) } ContractCodeHistoryOperationType::Init => ContractCodeHistoryEntryOperation::Init, ContractCodeHistoryOperationType::Genesis => ContractCodeHistoryEntryOperation::Genesis, @@ -484,7 +484,7 @@ impl TryFrom for ContractCodeHistoryEntry { operation, code_id: value.code_id, msg_json: String::from_utf8(value.msg) - .map_err(|_| NymdError::DeserializationError("Contract history msg".to_owned()))?, + .map_err(|_| NyxdError::DeserializationError("Contract history msg".to_owned()))?, }) } } @@ -532,7 +532,7 @@ pub struct AbciResult { } impl TryFrom for AbciResult { - type Error = NymdError; + type Error = NyxdError; fn try_from(value: ProtoAbciResult) -> Result { let mut events = Vec::with_capacity(value.events.len()); @@ -543,9 +543,9 @@ impl TryFrom for AbciResult { let mut attributes = Vec::with_capacity(proto_event.attributes.len()); for proto_attribute in proto_event.attributes.into_iter() { let stringified_ked = String::from_utf8(proto_attribute.key) - .map_err(|_| NymdError::DeserializationError("EventAttributeKey".to_owned()))?; + .map_err(|_| NyxdError::DeserializationError("EventAttributeKey".to_owned()))?; let stringified_value = String::from_utf8(proto_attribute.value) - .map_err(|_| NymdError::DeserializationError("EventAttributeKey".to_owned()))?; + .map_err(|_| NyxdError::DeserializationError("EventAttributeKey".to_owned()))?; attributes.push(abci::tag::Tag { key: stringified_ked.parse().unwrap(), @@ -574,7 +574,7 @@ pub struct SimulateResponse { } impl TryFrom for SimulateResponse { - type Error = NymdError; + type Error = NyxdError; fn try_from(value: ProtoSimulateResponse) -> Result { Ok(SimulateResponse { diff --git a/common/client-libs/validator-client/src/nymd/error.rs b/common/client-libs/validator-client/src/nyxd/error.rs similarity index 96% rename from common/client-libs/validator-client/src/nymd/error.rs rename to common/client-libs/validator-client/src/nyxd/error.rs index 1ebaa4e020..846cfd13c4 100644 --- a/common/client-libs/validator-client/src/nymd/error.rs +++ b/common/client-libs/validator-client/src/nyxd/error.rs @@ -1,7 +1,7 @@ // Copyright 2021 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::nymd::cosmwasm_client::types::ContractCodeId; +use crate::nyxd::cosmwasm_client::types::ContractCodeId; use cosmrs::{ bip32, rpc::endpoint::abci_query::AbciQuery, @@ -21,7 +21,7 @@ pub use cosmrs::rpc::{ }; #[derive(Debug, Error)] -pub enum NymdError { +pub enum NyxdError { #[error("No contract address is available to perform the call")] NoContractAddressAvailable, @@ -148,10 +148,10 @@ pub enum NymdError { // The purpose of parsing the abci query result is that we want to generate the `pretty_log` if // possible. -pub fn parse_abci_query_result(query_result: AbciQuery) -> Result { +pub fn parse_abci_query_result(query_result: AbciQuery) -> Result { match query_result.code { AbciCode::Ok => Ok(query_result), - AbciCode::Err(code) => Err(NymdError::AbciError { + AbciCode::Err(code) => Err(NyxdError::AbciError { code, log: query_result.log.clone(), pretty_log: try_parse_abci_log(&query_result.log), @@ -172,10 +172,10 @@ fn try_parse_abci_log(log: &abci::Log) -> Option { } } -impl NymdError { +impl NyxdError { pub fn is_tendermint_response_timeout(&self) -> bool { match &self { - NymdError::TendermintError(TendermintRpcError( + NyxdError::TendermintError(TendermintRpcError( TendermintRpcErrorDetail::Response(err), _, )) => { @@ -202,7 +202,7 @@ impl NymdError { pub fn is_tendermint_response_duplicate(&self) -> bool { match &self { - NymdError::TendermintError(TendermintRpcError( + NyxdError::TendermintError(TendermintRpcError( TendermintRpcErrorDetail::Response(err), _, )) => { diff --git a/common/client-libs/validator-client/src/nymd/fee/gas_price.rs b/common/client-libs/validator-client/src/nyxd/fee/gas_price.rs similarity index 96% rename from common/client-libs/validator-client/src/nymd/fee/gas_price.rs rename to common/client-libs/validator-client/src/nyxd/fee/gas_price.rs index c79015ff22..13cffc92fc 100644 --- a/common/client-libs/validator-client/src/nymd/fee/gas_price.rs +++ b/common/client-libs/validator-client/src/nyxd/fee/gas_price.rs @@ -1,7 +1,7 @@ // Copyright 2021 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::nymd::error::NymdError; +use crate::nyxd::error::NyxdError; use config::defaults; use cosmrs::tx::Gas; use cosmrs::Coin; @@ -55,7 +55,7 @@ impl<'a> Mul for &'a GasPrice { } impl FromStr for GasPrice { - type Err = NymdError; + type Err = NyxdError; fn from_str(s: &str) -> Result { let possible_amount = s @@ -65,7 +65,7 @@ impl FromStr for GasPrice { let amount_len = possible_amount.len(); let amount = possible_amount .parse() - .map_err(|_| NymdError::MalformedGasPrice)?; + .map_err(|_| NyxdError::MalformedGasPrice)?; let possible_denom = s.chars().skip(amount_len).collect::(); let denom = possible_denom.trim().to_string(); @@ -74,7 +74,7 @@ impl FromStr for GasPrice { } impl GasPrice { - pub fn new_with_default_price(denom: &str) -> Result { + pub fn new_with_default_price(denom: &str) -> Result { format!("{}{}", defaults::GAS_PRICE_AMOUNT, denom).parse() } } diff --git a/common/client-libs/validator-client/src/nymd/fee/mod.rs b/common/client-libs/validator-client/src/nyxd/fee/mod.rs similarity index 99% rename from common/client-libs/validator-client/src/nymd/fee/mod.rs rename to common/client-libs/validator-client/src/nyxd/fee/mod.rs index 411cac2365..b887c08128 100644 --- a/common/client-libs/validator-client/src/nymd/fee/mod.rs +++ b/common/client-libs/validator-client/src/nyxd/fee/mod.rs @@ -1,8 +1,8 @@ // Copyright 2021 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::nymd::Coin; -use crate::nymd::Gas; +use crate::nyxd::Coin; +use crate::nyxd::Gas; use cosmrs::{tx, AccountId}; use serde::{Deserialize, Serialize}; use std::fmt::{Display, Formatter}; diff --git a/common/client-libs/validator-client/src/nymd/mod.rs b/common/client-libs/validator-client/src/nyxd/mod.rs similarity index 88% rename from common/client-libs/validator-client/src/nymd/mod.rs rename to common/client-libs/validator-client/src/nyxd/mod.rs index dabe4b0819..f5d775055d 100644 --- a/common/client-libs/validator-client/src/nymd/mod.rs +++ b/common/client-libs/validator-client/src/nyxd/mod.rs @@ -1,14 +1,14 @@ // Copyright 2021 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::nymd::cosmwasm_client::signing_client; -use crate::nymd::cosmwasm_client::types::{ +use crate::nyxd::cosmwasm_client::signing_client; +use crate::nyxd::cosmwasm_client::types::{ Account, ChangeAdminResult, ContractCodeId, ExecuteResult, InstantiateOptions, InstantiateResult, MigrateResult, SequenceResponse, SimulateResponse, UploadResult, }; -use crate::nymd::error::NymdError; -use crate::nymd::fee::DEFAULT_SIMULATED_GAS_MULTIPLIER; -use crate::nymd::wallet::DirectSecp256k1HdWallet; +use crate::nyxd::error::NyxdError; +use crate::nyxd::fee::DEFAULT_SIMULATED_GAS_MULTIPLIER; +use crate::nyxd::wallet::DirectSecp256k1HdWallet; use cosmrs::cosmwasm; use cosmrs::rpc::endpoint::block::Response as BlockResponse; use cosmrs::rpc::query::Query; @@ -22,14 +22,14 @@ use std::convert::TryInto; use std::time::SystemTime; use vesting_contract_common::ExecuteMsg as VestingExecuteMsg; -pub use crate::nymd::cosmwasm_client::client::CosmWasmClient; -pub use crate::nymd::cosmwasm_client::signing_client::SigningCosmWasmClient; -pub use crate::nymd::fee::Fee; +pub use crate::nyxd::cosmwasm_client::client::CosmWasmClient; +pub use crate::nyxd::cosmwasm_client::signing_client::SigningCosmWasmClient; +pub use crate::nyxd::fee::Fee; pub use coin::Coin; pub use cosmrs::bank::MsgSend; pub use cosmrs::rpc::endpoint::tx::Response as TxResponse; pub use cosmrs::rpc::endpoint::validators::Response as ValidatorResponse; -pub use cosmrs::rpc::HttpClient as QueryNymdClient; +pub use cosmrs::rpc::HttpClient as QueryNyxdClient; pub use cosmrs::rpc::Paging; pub use cosmrs::tendermint::abci::responses::{DeliverTx, Event}; pub use cosmrs::tendermint::abci::tag::Tag; @@ -43,7 +43,7 @@ pub use cosmrs::{bip32, AccountId, Decimal, Denom}; pub use cosmwasm_std::Coin as CosmWasmCoin; pub use fee::{gas_price::GasPrice, GasAdjustable, GasAdjustment}; use mixnet_contract_common::MixId; -pub use signing_client::Client as SigningNymdClient; +pub use signing_client::Client as SigningNyxdClient; pub use traits::{VestingQueryClient, VestingSigningClient}; use vesting_contract_common::PledgeCap; @@ -74,13 +74,13 @@ impl Config { fn parse_optional_account( raw: Option<&String>, expected_prefix: &str, - ) -> Result, NymdError> { + ) -> Result, NyxdError> { if let Some(address) = raw { let parsed: AccountId = address .parse() - .map_err(|_| NymdError::MalformedAccountAddress(address.clone()))?; + .map_err(|_| NyxdError::MalformedAccountAddress(address.clone()))?; if parsed.prefix() != expected_prefix { - Err(NymdError::UnexpectedBech32Prefix { + Err(NyxdError::UnexpectedBech32Prefix { got: parsed.prefix().into(), expected: expected_prefix.into(), }) @@ -92,7 +92,7 @@ impl Config { } } - pub fn try_from_nym_network_details(details: &NymNetworkDetails) -> Result { + pub fn try_from_nym_network_details(details: &NymNetworkDetails) -> Result { let prefix = &details.chain_details.bech32_account_prefix; Ok(Config { chain_details: details.chain_details.clone(), @@ -128,20 +128,20 @@ impl Config { } #[derive(Debug)] -pub struct NymdClient { +pub struct NyxdClient { client: C, config: Config, client_address: Option>, simulated_gas_multiplier: f32, } -impl NymdClient { - pub fn connect(config: Config, endpoint: U) -> Result, NymdError> +impl NyxdClient { + pub fn connect(config: Config, endpoint: U) -> Result, NyxdError> where U: TryInto, { - Ok(NymdClient { - client: QueryNymdClient::new(endpoint)?, + Ok(NyxdClient { + client: QueryNyxdClient::new(endpoint)?, config, client_address: None, simulated_gas_multiplier: DEFAULT_SIMULATED_GAS_MULTIPLIER, @@ -149,7 +149,7 @@ impl NymdClient { } } -impl NymdClient { +impl NyxdClient { // maybe the wallet could be made into a generic, but for now, let's just have this one implementation pub fn connect_with_signer( config: Config, @@ -157,7 +157,7 @@ impl NymdClient { endpoint: U, signer: DirectSecp256k1HdWallet, gas_price: Option, - ) -> Result, NymdError> + ) -> Result, NyxdError> where U: TryInto, { @@ -169,8 +169,8 @@ impl NymdClient { .collect(); let gas_price = gas_price.unwrap_or(GasPrice::new_with_default_price(&denom)?); - Ok(NymdClient { - client: SigningNymdClient::connect_with_signer(endpoint, signer, gas_price)?, + Ok(NyxdClient { + client: SigningNyxdClient::connect_with_signer(endpoint, signer, gas_price)?, config, client_address: Some(client_address), simulated_gas_multiplier: DEFAULT_SIMULATED_GAS_MULTIPLIER, @@ -182,7 +182,7 @@ impl NymdClient { endpoint: U, mnemonic: bip39::Mnemonic, gas_price: Option, - ) -> Result, NymdError> + ) -> Result, NyxdError> where U: TryInto, { @@ -196,8 +196,8 @@ impl NymdClient { .collect(); let gas_price = gas_price.unwrap_or(GasPrice::new_with_default_price(denom)?); - Ok(NymdClient { - client: SigningNymdClient::connect_with_signer(endpoint, wallet, gas_price)?, + Ok(NyxdClient { + client: SigningNyxdClient::connect_with_signer(endpoint, wallet, gas_price)?, config, client_address: Some(client_address), simulated_gas_multiplier: DEFAULT_SIMULATED_GAS_MULTIPLIER, @@ -205,7 +205,7 @@ impl NymdClient { } } -impl NymdClient { +impl NyxdClient { pub fn current_config(&self) -> &Config { &self.config } @@ -234,7 +234,7 @@ impl NymdClient { self.config.multisig_contract_address = Some(address); } - // TODO: this should get changed into Result<&AccountId, NymdError> (or Option<&AccountId> in future commits + // TODO: this should get changed into Result<&AccountId, NyxdError> (or Option<&AccountId> in future commits // note: what unwrap is doing here is just moving a failure that would have normally // occurred in `connect` when attempting to parse an empty address, // so it's not introducing new source of failure (just moves it) @@ -242,7 +242,7 @@ impl NymdClient { self.config.mixnet_contract_address.as_ref().unwrap() } - // TODO: this should get changed into Result<&AccountId, NymdError> (or Option<&AccountId> in future commits + // TODO: this should get changed into Result<&AccountId, NyxdError> (or Option<&AccountId> in future commits // note: what unwrap is doing here is just moving a failure that would have normally // occurred in `connect` when attempting to parse an empty address, // so it's not introducing new source of failure (just moves it) @@ -250,7 +250,7 @@ impl NymdClient { self.config.vesting_contract_address.as_ref().unwrap() } - // TODO: this should get changed into Result<&AccountId, NymdError> (or Option<&AccountId> in future commits + // TODO: this should get changed into Result<&AccountId, NyxdError> (or Option<&AccountId> in future commits // note: what unwrap is doing here is just moving a failure that would have normally // occurred in `connect` when attempting to parse an empty address, // so it's not introducing new source of failure (just moves it) @@ -261,7 +261,7 @@ impl NymdClient { .unwrap() } - // TODO: this should get changed into Result<&AccountId, NymdError> (or Option<&AccountId> in future commits + // TODO: this should get changed into Result<&AccountId, NyxdError> (or Option<&AccountId> in future commits // note: what unwrap is doing here is just moving a failure that would have normally // occurred in `connect` when attempting to parse an empty address, // so it's not introducing new source of failure (just moves it) @@ -272,7 +272,7 @@ impl NymdClient { .unwrap() } - // TODO: this should get changed into Result<&AccountId, NymdError> (or Option<&AccountId> in future commits + // TODO: this should get changed into Result<&AccountId, NyxdError> (or Option<&AccountId> in future commits // note: what unwrap is doing here is just moving a failure that would have normally // occurred in `connect` when attempting to parse an empty address, // so it's not introducing new source of failure (just moves it) @@ -280,7 +280,7 @@ impl NymdClient { self.config.multisig_contract_address.as_ref().unwrap() } - // TODO: this should get changed into Result<&AccountId, NymdError> (or Option<&AccountId> in future commits + // TODO: this should get changed into Result<&AccountId, NyxdError> (or Option<&AccountId> in future commits // note: what unwrap is doing here is just moving a failure that would have normally // occurred in `connect` when attempting to parse an empty address, // so it's not introducing new source of failure (just moves it) @@ -296,7 +296,7 @@ impl NymdClient { &self, contract: &AccountId, query_msg: &M, - ) -> Result + ) -> Result where C: CosmWasmClient + Sync, M: ?Sized + Serialize + Sync, @@ -309,7 +309,7 @@ impl NymdClient { &self, contract: &AccountId, query_data: Vec, - ) -> Result, NymdError> + ) -> Result, NyxdError> where C: CosmWasmClient + Sync, { @@ -321,7 +321,7 @@ impl NymdClient { contract_address: &AccountId, msg: &M, funds: Vec, - ) -> Result + ) -> Result where C: SigningCosmWasmClient, M: ?Sized + Serialize, @@ -366,7 +366,7 @@ impl NymdClient { // CHAIN QUERIES - pub async fn account_sequence(&self) -> Result + pub async fn account_sequence(&self) -> Result where C: SigningCosmWasmClient + Sync, { @@ -376,7 +376,7 @@ impl NymdClient { pub async fn get_account_details( &self, address: &AccountId, - ) -> Result, NymdError> + ) -> Result, NyxdError> where C: CosmWasmClient + Sync, { @@ -386,7 +386,7 @@ impl NymdClient { pub async fn get_account_public_key( &self, address: &AccountId, - ) -> Result, NymdError> + ) -> Result, NyxdError> where C: CosmWasmClient + Sync, { @@ -398,7 +398,7 @@ impl NymdClient { Ok(None) } - pub async fn get_current_block_timestamp(&self) -> Result + pub async fn get_current_block_timestamp(&self) -> Result where C: CosmWasmClient + Sync, { @@ -408,21 +408,21 @@ impl NymdClient { pub async fn get_block_timestamp( &self, height: Option, - ) -> Result + ) -> Result where C: CosmWasmClient + Sync, { Ok(self.client.get_block(height).await?.block.header.time) } - pub async fn get_block(&self, height: Option) -> Result + pub async fn get_block(&self, height: Option) -> Result where C: CosmWasmClient + Sync, { self.client.get_block(height).await } - pub async fn get_current_block_height(&self) -> Result + pub async fn get_current_block_height(&self) -> Result where C: CosmWasmClient + Sync, { @@ -434,7 +434,7 @@ impl NymdClient { /// # Arguments /// /// * `height`: height of the block for which we want to obtain the hash. - pub async fn get_block_hash(&self, height: u32) -> Result + pub async fn get_block_hash(&self, height: u32) -> Result where C: CosmWasmClient + Sync, { @@ -448,7 +448,7 @@ impl NymdClient { &self, height: u64, paging: Paging, - ) -> Result + ) -> Result where C: CosmWasmClient + Sync, { @@ -459,42 +459,42 @@ impl NymdClient { &self, address: &AccountId, denom: String, - ) -> Result, NymdError> + ) -> Result, NyxdError> where C: CosmWasmClient + Sync, { self.client.get_balance(address, denom).await } - pub async fn get_all_balances(&self, address: &AccountId) -> Result, NymdError> + pub async fn get_all_balances(&self, address: &AccountId) -> Result, NyxdError> where C: CosmWasmClient + Sync, { self.client.get_all_balances(address).await } - pub async fn get_tx(&self, id: tx::Hash) -> Result + pub async fn get_tx(&self, id: tx::Hash) -> Result where C: CosmWasmClient + Sync, { self.client.get_tx(id).await } - pub async fn search_tx(&self, query: Query) -> Result, NymdError> + pub async fn search_tx(&self, query: Query) -> Result, NyxdError> where C: CosmWasmClient + Sync, { self.client.search_tx(query).await } - pub async fn get_total_supply(&self) -> Result, NymdError> + pub async fn get_total_supply(&self) -> Result, NyxdError> where C: CosmWasmClient + Sync, { self.client.get_total_supply().await } - pub async fn simulate(&self, messages: I) -> Result + pub async fn simulate(&self, messages: I) -> Result where C: SigningCosmWasmClient + Sync, I: IntoIterator + Send, @@ -508,7 +508,7 @@ impl NymdClient { .map(|msg| msg.into_any()) .collect::, _>>() .map_err(|_| { - NymdError::SerializationError("custom simulate messages".to_owned()) + NyxdError::SerializationError("custom simulate messages".to_owned()) })?, "simulating execution of transactions", ) @@ -522,7 +522,7 @@ impl NymdClient { amount: Vec, memo: impl Into + Send + 'static, fee: Option, - ) -> Result + ) -> Result where C: SigningCosmWasmClient + Sync, { @@ -538,7 +538,7 @@ impl NymdClient { msgs: Vec<(AccountId, Vec)>, memo: impl Into + Send + 'static, fee: Option, - ) -> Result + ) -> Result where C: SigningCosmWasmClient + Sync, { @@ -557,7 +557,7 @@ impl NymdClient { allowed_messages: Vec, memo: impl Into + Send + 'static, fee: Option, - ) -> Result + ) -> Result where C: SigningCosmWasmClient + Sync, { @@ -581,7 +581,7 @@ impl NymdClient { grantee: &AccountId, memo: impl Into + Send + 'static, fee: Option, - ) -> Result + ) -> Result where C: SigningCosmWasmClient + Sync, { @@ -598,7 +598,7 @@ impl NymdClient { fee: Option, memo: impl Into + Send + 'static, funds: Vec, - ) -> Result + ) -> Result where C: SigningCosmWasmClient + Sync, M: ?Sized + Serialize + Sync, @@ -615,7 +615,7 @@ impl NymdClient { msgs: I, fee: Option, memo: impl Into + Send + 'static, - ) -> Result + ) -> Result where C: SigningCosmWasmClient + Sync, I: IntoIterator)> + Send, @@ -632,7 +632,7 @@ impl NymdClient { wasm_code: Vec, memo: impl Into + Send + 'static, fee: Option, - ) -> Result + ) -> Result where C: SigningCosmWasmClient + Sync, { @@ -650,7 +650,7 @@ impl NymdClient { memo: impl Into + Send + 'static, options: Option, fee: Option, - ) -> Result + ) -> Result where C: SigningCosmWasmClient + Sync, M: ?Sized + Serialize + Sync, @@ -667,7 +667,7 @@ impl NymdClient { new_admin: &AccountId, memo: impl Into + Send + 'static, fee: Option, - ) -> Result + ) -> Result where C: SigningCosmWasmClient + Sync, { @@ -682,7 +682,7 @@ impl NymdClient { contract_address: &AccountId, memo: impl Into + Send + 'static, fee: Option, - ) -> Result + ) -> Result where C: SigningCosmWasmClient + Sync, { @@ -699,7 +699,7 @@ impl NymdClient { msg: &M, memo: impl Into + Send + 'static, fee: Option, - ) -> Result + ) -> Result where C: SigningCosmWasmClient + Sync, M: ?Sized + Serialize + Sync, diff --git a/common/client-libs/validator-client/src/nymd/traits/coconut_bandwidth_query_client.rs b/common/client-libs/validator-client/src/nyxd/traits/coconut_bandwidth_query_client.rs similarity index 79% rename from common/client-libs/validator-client/src/nymd/traits/coconut_bandwidth_query_client.rs rename to common/client-libs/validator-client/src/nyxd/traits/coconut_bandwidth_query_client.rs index b2e38e12a5..73c13d9d41 100644 --- a/common/client-libs/validator-client/src/nymd/traits/coconut_bandwidth_query_client.rs +++ b/common/client-libs/validator-client/src/nyxd/traits/coconut_bandwidth_query_client.rs @@ -1,8 +1,8 @@ // Copyright 2022 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::nymd::error::NymdError; -use crate::nymd::{CosmWasmClient, NymdClient}; +use crate::nyxd::error::NyxdError; +use crate::nyxd::{CosmWasmClient, NyxdClient}; use coconut_bandwidth_contract_common::msg::QueryMsg; use coconut_bandwidth_contract_common::spend_credential::SpendCredentialResponse; @@ -14,15 +14,15 @@ pub trait CoconutBandwidthQueryClient { async fn get_spent_credential( &self, blinded_serial_number: String, - ) -> Result; + ) -> Result; } #[async_trait] -impl CoconutBandwidthQueryClient for NymdClient { +impl CoconutBandwidthQueryClient for NyxdClient { async fn get_spent_credential( &self, blinded_serial_number: String, - ) -> Result { + ) -> Result { let request = QueryMsg::GetSpentCredential { blinded_serial_number, }; diff --git a/common/client-libs/validator-client/src/nymd/traits/coconut_bandwidth_signing_client.rs b/common/client-libs/validator-client/src/nyxd/traits/coconut_bandwidth_signing_client.rs similarity index 84% rename from common/client-libs/validator-client/src/nymd/traits/coconut_bandwidth_signing_client.rs rename to common/client-libs/validator-client/src/nyxd/traits/coconut_bandwidth_signing_client.rs index 0fc0d0e126..0d0e11e9e8 100644 --- a/common/client-libs/validator-client/src/nymd/traits/coconut_bandwidth_signing_client.rs +++ b/common/client-libs/validator-client/src/nyxd/traits/coconut_bandwidth_signing_client.rs @@ -1,10 +1,10 @@ // Copyright 2022 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -pub use crate::nymd::cosmwasm_client::signing_client::SigningCosmWasmClient; -use crate::nymd::cosmwasm_client::types::ExecuteResult; -use crate::nymd::error::NymdError; -use crate::nymd::{Coin, Fee, NymdClient}; +pub use crate::nyxd::cosmwasm_client::signing_client::SigningCosmWasmClient; +use crate::nyxd::cosmwasm_client::types::ExecuteResult; +use crate::nyxd::error::NyxdError; +use crate::nyxd::{Coin, Fee, NyxdClient}; use coconut_bandwidth_contract_common::spend_credential::SpendCredentialData; use coconut_bandwidth_contract_common::{deposit::DepositData, msg::ExecuteMsg}; @@ -19,18 +19,18 @@ pub trait CoconutBandwidthSigningClient { verification_key: String, encryption_key: String, fee: Option, - ) -> Result; + ) -> Result; async fn spend_credential( &self, funds: Coin, blinded_serial_number: String, gateway_cosmos_address: String, fee: Option, - ) -> Result; + ) -> Result; } #[async_trait] -impl CoconutBandwidthSigningClient for NymdClient { +impl CoconutBandwidthSigningClient for NyxdClient { async fn deposit( &self, amount: Coin, @@ -38,7 +38,7 @@ impl CoconutBandwidthSigningClient for N verification_key: String, encryption_key: String, fee: Option, - ) -> Result { + ) -> Result { let fee = fee.unwrap_or(Fee::Auto(Some(self.simulated_gas_multiplier))); let req = ExecuteMsg::DepositFunds { data: DepositData::new(info.to_string(), verification_key, encryption_key), @@ -60,7 +60,7 @@ impl CoconutBandwidthSigningClient for N blinded_serial_number: String, gateway_cosmos_address: String, fee: Option, - ) -> Result { + ) -> Result { let fee = fee.unwrap_or(Fee::Auto(Some(self.simulated_gas_multiplier))); let req = ExecuteMsg::SpendCredential { data: SpendCredentialData::new( diff --git a/common/client-libs/validator-client/src/nymd/traits/dkg_query_client.rs b/common/client-libs/validator-client/src/nyxd/traits/dkg_query_client.rs similarity index 81% rename from common/client-libs/validator-client/src/nymd/traits/dkg_query_client.rs rename to common/client-libs/validator-client/src/nyxd/traits/dkg_query_client.rs index ce69556137..c9477fedd6 100644 --- a/common/client-libs/validator-client/src/nymd/traits/dkg_query_client.rs +++ b/common/client-libs/validator-client/src/nyxd/traits/dkg_query_client.rs @@ -1,8 +1,8 @@ // Copyright 2022 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::nymd::error::NymdError; -use crate::nymd::{CosmWasmClient, NymdClient}; +use crate::nyxd::error::NyxdError; +use crate::nyxd::{CosmWasmClient, NyxdClient}; use async_trait::async_trait; use coconut_dkg_common::dealer::{ DealerDetailsResponse, PagedDealerResponse, PagedDealingsResponse, @@ -14,48 +14,48 @@ use cosmrs::AccountId; #[async_trait] pub trait DkgQueryClient { - async fn get_current_epoch(&self) -> Result; - async fn get_current_epoch_threshold(&self) -> Result, NymdError>; + async fn get_current_epoch(&self) -> Result; + async fn get_current_epoch_threshold(&self) -> Result, NyxdError>; async fn get_dealer_details( &self, address: &AccountId, - ) -> Result; + ) -> Result; async fn get_current_dealers_paged( &self, start_after: Option, page_limit: Option, - ) -> Result; + ) -> Result; async fn get_past_dealers_paged( &self, start_after: Option, page_limit: Option, - ) -> Result; + ) -> Result; async fn get_dealings_paged( &self, idx: usize, start_after: Option, page_limit: Option, - ) -> Result; + ) -> Result; async fn get_vk_shares_paged( &self, start_after: Option, page_limit: Option, - ) -> Result; + ) -> Result; } #[async_trait] -impl DkgQueryClient for NymdClient +impl DkgQueryClient for NyxdClient where C: CosmWasmClient + Send + Sync, { - async fn get_current_epoch(&self) -> Result { + async fn get_current_epoch(&self) -> Result { let request = DkgQueryMsg::GetCurrentEpochState {}; self.client .query_contract_smart(self.coconut_dkg_contract_address(), &request) .await } - async fn get_current_epoch_threshold(&self) -> Result, NymdError> { + async fn get_current_epoch_threshold(&self) -> Result, NyxdError> { let request = DkgQueryMsg::GetCurrentEpochThreshold {}; self.client .query_contract_smart(self.coconut_dkg_contract_address(), &request) @@ -64,7 +64,7 @@ where async fn get_dealer_details( &self, address: &AccountId, - ) -> Result { + ) -> Result { let request = DkgQueryMsg::GetDealerDetails { dealer_address: address.to_string(), }; @@ -77,7 +77,7 @@ where &self, start_after: Option, page_limit: Option, - ) -> Result { + ) -> Result { let request = DkgQueryMsg::GetCurrentDealers { start_after, limit: page_limit, @@ -91,7 +91,7 @@ where &self, start_after: Option, page_limit: Option, - ) -> Result { + ) -> Result { let request = DkgQueryMsg::GetPastDealers { start_after, limit: page_limit, @@ -106,7 +106,7 @@ where idx: usize, start_after: Option, page_limit: Option, - ) -> Result { + ) -> Result { let request = DkgQueryMsg::GetDealing { idx: idx as u64, limit: page_limit, @@ -121,7 +121,7 @@ where &self, start_after: Option, page_limit: Option, - ) -> Result { + ) -> Result { let request = DkgQueryMsg::GetVerificationKeys { limit: page_limit, start_after, diff --git a/common/client-libs/validator-client/src/nymd/traits/dkg_signing_client.rs b/common/client-libs/validator-client/src/nyxd/traits/dkg_signing_client.rs similarity index 84% rename from common/client-libs/validator-client/src/nymd/traits/dkg_signing_client.rs rename to common/client-libs/validator-client/src/nyxd/traits/dkg_signing_client.rs index 6fee83ac5d..f04730adb1 100644 --- a/common/client-libs/validator-client/src/nymd/traits/dkg_signing_client.rs +++ b/common/client-libs/validator-client/src/nyxd/traits/dkg_signing_client.rs @@ -1,9 +1,9 @@ // Copyright 2022 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::nymd::cosmwasm_client::types::ExecuteResult; -use crate::nymd::error::NymdError; -use crate::nymd::{Fee, NymdClient, SigningCosmWasmClient}; +use crate::nyxd::cosmwasm_client::types::ExecuteResult; +use crate::nyxd::error::NyxdError; +use crate::nyxd::{Fee, NyxdClient, SigningCosmWasmClient}; use async_trait::async_trait; use coconut_dkg_common::msg::ExecuteMsg as DkgExecuteMsg; use coconut_dkg_common::types::EncodedBTEPublicKeyWithProof; @@ -12,33 +12,33 @@ use contracts_common::dealings::ContractSafeBytes; #[async_trait] pub trait DkgSigningClient { - async fn advance_dkg_epoch_state(&self, fee: Option) -> Result; + async fn advance_dkg_epoch_state(&self, fee: Option) -> Result; async fn register_dealer( &self, bte_key: EncodedBTEPublicKeyWithProof, announce_address: String, fee: Option, - ) -> Result; + ) -> Result; async fn submit_dealing_bytes( &self, commitment: ContractSafeBytes, fee: Option, - ) -> Result; + ) -> Result; async fn submit_verification_key_share( &self, share: VerificationKeyShare, fee: Option, - ) -> Result; + ) -> Result; } #[async_trait] -impl DkgSigningClient for NymdClient +impl DkgSigningClient for NyxdClient where C: SigningCosmWasmClient + Send + Sync, { - async fn advance_dkg_epoch_state(&self, fee: Option) -> Result { + async fn advance_dkg_epoch_state(&self, fee: Option) -> Result { let req = DkgExecuteMsg::AdvanceEpochState {}; self.client @@ -58,7 +58,7 @@ where bte_key: EncodedBTEPublicKeyWithProof, announce_address: String, fee: Option, - ) -> Result { + ) -> Result { let req = DkgExecuteMsg::RegisterDealer { bte_key_with_proof: bte_key, announce_address, @@ -80,7 +80,7 @@ where &self, dealing_bytes: ContractSafeBytes, fee: Option, - ) -> Result { + ) -> Result { let req = DkgExecuteMsg::CommitDealing { dealing_bytes }; self.client @@ -99,7 +99,7 @@ where &self, share: VerificationKeyShare, fee: Option, - ) -> Result { + ) -> Result { let req = DkgExecuteMsg::CommitVerificationKeyShare { share }; self.client diff --git a/common/client-libs/validator-client/src/nymd/traits/mixnet_query_client.rs b/common/client-libs/validator-client/src/nyxd/traits/mixnet_query_client.rs similarity index 84% rename from common/client-libs/validator-client/src/nymd/traits/mixnet_query_client.rs rename to common/client-libs/validator-client/src/nyxd/traits/mixnet_query_client.rs index 8c6c2e8d41..e589719fa3 100644 --- a/common/client-libs/validator-client/src/nymd/traits/mixnet_query_client.rs +++ b/common/client-libs/validator-client/src/nyxd/traits/mixnet_query_client.rs @@ -1,9 +1,9 @@ // Copyright 2022 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -pub use crate::nymd::cosmwasm_client::client::CosmWasmClient; -use crate::nymd::error::NymdError; -use crate::nymd::NymdClient; +pub use crate::nyxd::cosmwasm_client::client::CosmWasmClient; +use crate::nyxd::error::NyxdError; +use crate::nyxd::NyxdClient; use async_trait::async_trait; use cosmrs::AccountId; use mixnet_contract_common::delegation::{MixNodeDelegationResponse, OwnerProxySubKey}; @@ -29,38 +29,38 @@ use serde::Deserialize; #[async_trait] pub trait MixnetQueryClient { - async fn query_mixnet_contract(&self, query: MixnetQueryMsg) -> Result + async fn query_mixnet_contract(&self, query: MixnetQueryMsg) -> Result where for<'a> T: Deserialize<'a>; // state/sys-params-related - async fn get_mixnet_contract_version(&self) -> Result { + async fn get_mixnet_contract_version(&self) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetContractVersion {}) .await } - async fn get_rewarding_validator_address(&self) -> Result { + async fn get_rewarding_validator_address(&self) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetRewardingValidatorAddress {}) .await } - async fn get_mixnet_contract_settings(&self) -> Result { + async fn get_mixnet_contract_settings(&self) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetStateParams {}) .await } - async fn get_mixnet_contract_state(&self) -> Result { + async fn get_mixnet_contract_state(&self) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetState {}) .await } - async fn get_rewarding_parameters(&self) -> Result { + async fn get_rewarding_parameters(&self) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetRewardingParams {}) .await } - async fn get_current_interval_details(&self) -> Result { + async fn get_current_interval_details(&self) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetCurrentIntervalDetails {}) .await } @@ -69,7 +69,7 @@ pub trait MixnetQueryClient { &self, start_after: Option, limit: Option, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetRewardedSet { limit, start_after }) .await } @@ -78,7 +78,7 @@ pub trait MixnetQueryClient { &self, start_after: Option, limit: Option, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetAllFamiliesPaged { limit, start_after }) .await } @@ -87,7 +87,7 @@ pub trait MixnetQueryClient { &self, start_after: Option, limit: Option, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetAllMembersPaged { limit, start_after }) .await } @@ -98,7 +98,7 @@ pub trait MixnetQueryClient { &self, limit: Option, start_after: Option, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetMixNodeBonds { limit, start_after }) .await } @@ -107,7 +107,7 @@ pub trait MixnetQueryClient { &self, limit: Option, start_after: Option, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetMixNodesDetailed { limit, start_after }) .await } @@ -116,7 +116,7 @@ pub trait MixnetQueryClient { &self, limit: Option, start_after: Option, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetUnbondedMixNodes { limit, start_after }) .await } @@ -126,7 +126,7 @@ pub trait MixnetQueryClient { owner: &AccountId, limit: Option, start_after: Option, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetUnbondedMixNodesByOwner { owner: owner.to_string(), limit, @@ -140,7 +140,7 @@ pub trait MixnetQueryClient { identity_key: String, limit: Option, start_after: Option, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetUnbondedMixNodesByIdentityKey { identity_key, limit, @@ -152,7 +152,7 @@ pub trait MixnetQueryClient { async fn get_owned_mixnode( &self, address: &AccountId, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetOwnedMixnode { address: address.to_string(), }) @@ -162,7 +162,7 @@ pub trait MixnetQueryClient { async fn get_mixnode_details( &self, mix_id: MixId, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetMixnodeDetails { mix_id }) .await } @@ -170,7 +170,7 @@ pub trait MixnetQueryClient { async fn get_mixnode_rewarding_details( &self, mix_id: MixId, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetMixnodeRewardingDetails { mix_id }) .await } @@ -178,7 +178,7 @@ pub trait MixnetQueryClient { async fn get_mixnode_stake_saturation( &self, mix_id: MixId, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetStakeSaturation { mix_id }) .await } @@ -186,12 +186,12 @@ pub trait MixnetQueryClient { async fn get_unbonded_mixnode_information( &self, mix_id: MixId, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetUnbondedMixNodeInformation { mix_id }) .await } - async fn get_layer_distribution(&self) -> Result { + async fn get_layer_distribution(&self) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetLayerDistribution {}) .await } @@ -202,7 +202,7 @@ pub trait MixnetQueryClient { &self, start_after: Option, limit: Option, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetGateways { start_after, limit }) .await } @@ -211,7 +211,7 @@ pub trait MixnetQueryClient { async fn get_gateway_bond( &self, identity: IdentityKey, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetGatewayBond { identity }) .await } @@ -220,7 +220,7 @@ pub trait MixnetQueryClient { async fn get_owned_gateway( &self, address: &AccountId, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetOwnedGateway { address: address.to_string(), }) @@ -235,7 +235,7 @@ pub trait MixnetQueryClient { mix_id: MixId, start_after: Option, limit: Option, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetMixnodeDelegations { mix_id, start_after, @@ -250,7 +250,7 @@ pub trait MixnetQueryClient { delegator: String, start_after: Option<(MixId, OwnerProxySubKey)>, limit: Option, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetDelegatorDelegations { delegator, start_after, @@ -265,7 +265,7 @@ pub trait MixnetQueryClient { mix_id: MixId, delegator: &AccountId, proxy: Option, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetDelegationDetails { mix_id, delegator: delegator.to_string(), @@ -279,7 +279,7 @@ pub trait MixnetQueryClient { &self, start_after: Option, limit: Option, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetAllDelegations { start_after, limit }) .await } @@ -288,7 +288,7 @@ pub trait MixnetQueryClient { async fn get_pending_operator_reward( &self, operator: &AccountId, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetPendingOperatorReward { address: operator.to_string(), }) @@ -298,7 +298,7 @@ pub trait MixnetQueryClient { async fn get_pending_mixnode_operator_reward( &self, mix_id: MixId, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetPendingMixNodeOperatorReward { mix_id }) .await } @@ -308,7 +308,7 @@ pub trait MixnetQueryClient { delegator: &AccountId, mix_id: MixId, proxy: Option, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetPendingDelegatorReward { address: delegator.to_string(), mix_id, @@ -322,7 +322,7 @@ pub trait MixnetQueryClient { &self, mix_id: MixId, estimated_performance: Performance, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetEstimatedCurrentEpochOperatorReward { mix_id, estimated_performance, @@ -337,7 +337,7 @@ pub trait MixnetQueryClient { mix_id: MixId, proxy: Option, estimated_performance: Performance, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetEstimatedCurrentEpochDelegatorReward { address: delegator.to_string(), mix_id, @@ -353,7 +353,7 @@ pub trait MixnetQueryClient { &self, start_after: Option, limit: Option, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetPendingEpochEvents { start_after, limit }) .await } @@ -362,7 +362,7 @@ pub trait MixnetQueryClient { &self, start_after: Option, limit: Option, - ) -> Result { + ) -> Result { self.query_mixnet_contract(MixnetQueryMsg::GetPendingIntervalEvents { start_after, limit }) .await } @@ -370,21 +370,21 @@ pub trait MixnetQueryClient { async fn get_mixnode_details_by_identity( &self, mix_identity: IdentityKey, - ) -> Result, NymdError> { + ) -> Result, NyxdError> { self.query_mixnet_contract(MixnetQueryMsg::GetBondedMixnodeDetailsByIdentity { mix_identity, }) .await } - async fn get_node_family_by_label(&self, label: &str) -> Result, NymdError> { + async fn get_node_family_by_label(&self, label: &str) -> Result, NyxdError> { self.query_mixnet_contract(MixnetQueryMsg::GetFamilyByLabel { label: label.to_string(), }) .await } - async fn get_node_family_by_head(&self, head: &str) -> Result, NymdError> { + async fn get_node_family_by_head(&self, head: &str) -> Result, NyxdError> { self.query_mixnet_contract(MixnetQueryMsg::GetFamilyByHead { head: head.to_string(), }) @@ -393,11 +393,11 @@ pub trait MixnetQueryClient { } #[async_trait] -impl MixnetQueryClient for NymdClient +impl MixnetQueryClient for NyxdClient where C: CosmWasmClient + Sync + Send, { - async fn query_mixnet_contract(&self, query: MixnetQueryMsg) -> Result + async fn query_mixnet_contract(&self, query: MixnetQueryMsg) -> Result where for<'a> T: Deserialize<'a>, { @@ -412,10 +412,10 @@ impl MixnetQueryClient for crate::Client where C: CosmWasmClient + Sync + Send, { - async fn query_mixnet_contract(&self, query: MixnetQueryMsg) -> Result + async fn query_mixnet_contract(&self, query: MixnetQueryMsg) -> Result where for<'a> T: Deserialize<'a>, { - self.nymd.query_mixnet_contract(query).await + self.nyxd.query_mixnet_contract(query).await } } diff --git a/common/client-libs/validator-client/src/nymd/traits/mixnet_signing_client.rs b/common/client-libs/validator-client/src/nyxd/traits/mixnet_signing_client.rs similarity index 87% rename from common/client-libs/validator-client/src/nymd/traits/mixnet_signing_client.rs rename to common/client-libs/validator-client/src/nyxd/traits/mixnet_signing_client.rs index f2a2057081..f059674683 100644 --- a/common/client-libs/validator-client/src/nymd/traits/mixnet_signing_client.rs +++ b/common/client-libs/validator-client/src/nyxd/traits/mixnet_signing_client.rs @@ -1,11 +1,11 @@ // Copyright 2022 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::nymd::coin::Coin; -pub use crate::nymd::cosmwasm_client::client::CosmWasmClient; -use crate::nymd::cosmwasm_client::types::ExecuteResult; -use crate::nymd::error::NymdError; -use crate::nymd::{Fee, NymdClient, SigningCosmWasmClient}; +use crate::nyxd::coin::Coin; +pub use crate::nyxd::cosmwasm_client::client::CosmWasmClient; +use crate::nyxd::cosmwasm_client::types::ExecuteResult; +use crate::nyxd::error::NyxdError; +use crate::nyxd::{Fee, NyxdClient, SigningCosmWasmClient}; use async_trait::async_trait; use cosmrs::AccountId; use mixnet_contract_common::mixnode::{MixNodeConfigUpdate, MixNodeCostParams}; @@ -21,7 +21,7 @@ pub trait MixnetSigningClient { fee: Option, msg: MixnetExecuteMsg, funds: Vec, - ) -> Result; + ) -> Result; // state/sys-params-related @@ -29,7 +29,7 @@ pub trait MixnetSigningClient { &self, address: AccountId, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::UpdateRewardingValidatorAddress { @@ -44,7 +44,7 @@ pub trait MixnetSigningClient { &self, updated_parameters: ContractStateParams, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::UpdateContractStateParams { updated_parameters }, @@ -58,7 +58,7 @@ pub trait MixnetSigningClient { active_set_size: u32, force_immediately: bool, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::UpdateActiveSetSize { @@ -75,7 +75,7 @@ pub trait MixnetSigningClient { updated_params: IntervalRewardingParamsUpdate, force_immediately: bool, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::UpdateRewardingParams { @@ -93,7 +93,7 @@ pub trait MixnetSigningClient { epoch_duration_secs: u64, force_immediately: bool, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::UpdateIntervalConfig { @@ -111,7 +111,7 @@ pub trait MixnetSigningClient { new_rewarded_set: Vec, expected_active_set_size: u32, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::AdvanceCurrentEpoch { @@ -127,7 +127,7 @@ pub trait MixnetSigningClient { &self, limit: Option, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::ReconcileEpochEvents { limit }, @@ -142,7 +142,7 @@ pub trait MixnetSigningClient { owner_signature: String, label: String, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::CreateFamily { @@ -160,7 +160,7 @@ pub trait MixnetSigningClient { owner_signature: String, label: String, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::CreateFamilyOnBehalf { @@ -178,7 +178,7 @@ pub trait MixnetSigningClient { signature: String, family_head: String, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::JoinFamily { @@ -196,7 +196,7 @@ pub trait MixnetSigningClient { signature: String, family_head: String, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::JoinFamilyOnBehalf { @@ -214,7 +214,7 @@ pub trait MixnetSigningClient { signature: String, family_head: String, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::LeaveFamily { @@ -232,7 +232,7 @@ pub trait MixnetSigningClient { signature: String, family_head: String, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::LeaveFamilyOnBehalf { @@ -250,7 +250,7 @@ pub trait MixnetSigningClient { signature: String, member: String, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::KickFamilyMember { signature, member }, @@ -265,7 +265,7 @@ pub trait MixnetSigningClient { signature: String, member: String, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::KickFamilyMemberOnBehalf { @@ -286,7 +286,7 @@ pub trait MixnetSigningClient { owner_signature: String, pledge: Coin, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::BondMixnode { @@ -307,7 +307,7 @@ pub trait MixnetSigningClient { owner_signature: String, pledge: Coin, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::BondMixnodeOnBehalf { @@ -325,7 +325,7 @@ pub trait MixnetSigningClient { &self, additional_pledge: Coin, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::PledgeMore {}, @@ -339,7 +339,7 @@ pub trait MixnetSigningClient { owner: AccountId, additional_pledge: Coin, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::PledgeMoreOnBehalf { @@ -350,7 +350,7 @@ pub trait MixnetSigningClient { .await } - async fn unbond_mixnode(&self, fee: Option) -> Result { + async fn unbond_mixnode(&self, fee: Option) -> Result { self.execute_mixnet_contract(fee, MixnetExecuteMsg::UnbondMixnode {}, vec![]) .await } @@ -359,7 +359,7 @@ pub trait MixnetSigningClient { &self, owner: AccountId, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::UnbondMixnodeOnBehalf { @@ -374,7 +374,7 @@ pub trait MixnetSigningClient { &self, new_costs: MixNodeCostParams, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::UpdateMixnodeCostParams { new_costs }, @@ -388,7 +388,7 @@ pub trait MixnetSigningClient { owner: AccountId, new_costs: MixNodeCostParams, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::UpdateMixnodeCostParamsOnBehalf { @@ -404,7 +404,7 @@ pub trait MixnetSigningClient { &self, new_config: MixNodeConfigUpdate, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::UpdateMixnodeConfig { new_config }, @@ -418,7 +418,7 @@ pub trait MixnetSigningClient { owner: AccountId, new_config: MixNodeConfigUpdate, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::UpdateMixnodeConfigOnBehalf { @@ -438,7 +438,7 @@ pub trait MixnetSigningClient { owner_signature: String, pledge: Coin, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::BondGateway { @@ -457,7 +457,7 @@ pub trait MixnetSigningClient { owner_signature: String, pledge: Coin, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::BondGatewayOnBehalf { @@ -470,7 +470,7 @@ pub trait MixnetSigningClient { .await } - async fn unbond_gateway(&self, fee: Option) -> Result { + async fn unbond_gateway(&self, fee: Option) -> Result { self.execute_mixnet_contract(fee, MixnetExecuteMsg::UnbondGateway {}, vec![]) .await } @@ -479,7 +479,7 @@ pub trait MixnetSigningClient { &self, owner: AccountId, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::UnbondGatewayOnBehalf { @@ -497,7 +497,7 @@ pub trait MixnetSigningClient { mix_id: MixId, amount: Coin, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::DelegateToMixnode { mix_id }, @@ -512,7 +512,7 @@ pub trait MixnetSigningClient { mix_id: MixId, amount: Coin, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::DelegateToMixnodeOnBehalf { @@ -528,7 +528,7 @@ pub trait MixnetSigningClient { &self, mix_id: MixId, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::UndelegateFromMixnode { mix_id }, @@ -542,7 +542,7 @@ pub trait MixnetSigningClient { delegate: AccountId, mix_id: MixId, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::UndelegateFromMixnodeOnBehalf { @@ -561,7 +561,7 @@ pub trait MixnetSigningClient { mix_id: MixId, performance: Performance, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::RewardMixnode { @@ -573,7 +573,7 @@ pub trait MixnetSigningClient { .await } - async fn withdraw_operator_reward(&self, fee: Option) -> Result { + async fn withdraw_operator_reward(&self, fee: Option) -> Result { self.execute_mixnet_contract(fee, MixnetExecuteMsg::WithdrawOperatorReward {}, vec![]) .await } @@ -582,7 +582,7 @@ pub trait MixnetSigningClient { &self, owner: AccountId, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::WithdrawOperatorRewardOnBehalf { @@ -597,7 +597,7 @@ pub trait MixnetSigningClient { &self, mix_id: MixId, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::WithdrawDelegatorReward { mix_id }, @@ -611,7 +611,7 @@ pub trait MixnetSigningClient { owner: AccountId, mix_id: MixId, fee: Option, - ) -> Result { + ) -> Result { self.execute_mixnet_contract( fee, MixnetExecuteMsg::WithdrawDelegatorRewardOnBehalf { @@ -625,7 +625,7 @@ pub trait MixnetSigningClient { } #[async_trait] -impl MixnetSigningClient for NymdClient +impl MixnetSigningClient for NyxdClient where C: SigningCosmWasmClient + Sync + Send, { @@ -634,7 +634,7 @@ where fee: Option, msg: MixnetExecuteMsg, funds: Vec, - ) -> Result { + ) -> Result { let fee = fee.unwrap_or(Fee::Auto(Some(self.simulated_gas_multiplier))); let memo = msg.default_memo(); self.client @@ -660,7 +660,7 @@ where fee: Option, msg: MixnetExecuteMsg, funds: Vec, - ) -> Result { - self.nymd.execute_mixnet_contract(fee, msg, funds).await + ) -> Result { + self.nyxd.execute_mixnet_contract(fee, msg, funds).await } } diff --git a/common/client-libs/validator-client/src/nymd/traits/mod.rs b/common/client-libs/validator-client/src/nyxd/traits/mod.rs similarity index 100% rename from common/client-libs/validator-client/src/nymd/traits/mod.rs rename to common/client-libs/validator-client/src/nyxd/traits/mod.rs diff --git a/common/client-libs/validator-client/src/nymd/traits/multisig_query_client.rs b/common/client-libs/validator-client/src/nyxd/traits/multisig_query_client.rs similarity index 81% rename from common/client-libs/validator-client/src/nymd/traits/multisig_query_client.rs rename to common/client-libs/validator-client/src/nyxd/traits/multisig_query_client.rs index 89643e8136..51eac0532b 100644 --- a/common/client-libs/validator-client/src/nymd/traits/multisig_query_client.rs +++ b/common/client-libs/validator-client/src/nyxd/traits/multisig_query_client.rs @@ -1,8 +1,8 @@ // Copyright 2022 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::nymd::error::NymdError; -use crate::nymd::{CosmWasmClient, NymdClient}; +use crate::nyxd::error::NyxdError; +use crate::nyxd::{CosmWasmClient, NyxdClient}; use cw3::{ProposalListResponse, ProposalResponse}; use multisig_contract_common::msg::QueryMsg; @@ -11,17 +11,17 @@ use async_trait::async_trait; #[async_trait] pub trait MultisigQueryClient { - async fn get_proposal(&self, proposal_id: u64) -> Result; + async fn get_proposal(&self, proposal_id: u64) -> Result; async fn list_proposals( &self, start_after: Option, limit: Option, - ) -> Result; + ) -> Result; } #[async_trait] -impl MultisigQueryClient for NymdClient { - async fn get_proposal(&self, proposal_id: u64) -> Result { +impl MultisigQueryClient for NyxdClient { + async fn get_proposal(&self, proposal_id: u64) -> Result { let request = QueryMsg::Proposal { proposal_id }; self.client .query_contract_smart(self.multisig_contract_address(), &request) @@ -32,7 +32,7 @@ impl MultisigQueryClient for NymdClient { &self, start_after: Option, limit: Option, - ) -> Result { + ) -> Result { let request = QueryMsg::ListProposals { start_after, limit }; self.client .query_contract_smart(self.multisig_contract_address(), &request) diff --git a/common/client-libs/validator-client/src/nymd/traits/multisig_signing_client.rs b/common/client-libs/validator-client/src/nyxd/traits/multisig_signing_client.rs similarity index 86% rename from common/client-libs/validator-client/src/nymd/traits/multisig_signing_client.rs rename to common/client-libs/validator-client/src/nyxd/traits/multisig_signing_client.rs index a715c85075..9051cfa79d 100644 --- a/common/client-libs/validator-client/src/nymd/traits/multisig_signing_client.rs +++ b/common/client-libs/validator-client/src/nyxd/traits/multisig_signing_client.rs @@ -1,10 +1,10 @@ // Copyright 2022 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -pub use crate::nymd::cosmwasm_client::signing_client::SigningCosmWasmClient; -use crate::nymd::cosmwasm_client::types::ExecuteResult; -use crate::nymd::error::NymdError; -use crate::nymd::{Fee, NymdClient}; +pub use crate::nyxd::cosmwasm_client::signing_client::SigningCosmWasmClient; +use crate::nyxd::cosmwasm_client::types::ExecuteResult; +use crate::nyxd::error::NyxdError; +use crate::nyxd::{Fee, NyxdClient}; use coconut_bandwidth_contract_common::msg::ExecuteMsg as CoconutBandwidthExecuteMsg; use cw3::Vote; @@ -21,31 +21,31 @@ pub trait MultisigSigningClient { blinded_serial_number: String, voucher_value: u128, fee: Option, - ) -> Result; + ) -> Result; async fn vote_proposal( &self, proposal_id: u64, yes: bool, fee: Option, - ) -> Result; + ) -> Result; async fn execute_proposal( &self, proposal_id: u64, fee: Option, - ) -> Result; + ) -> Result; } #[async_trait] -impl MultisigSigningClient for NymdClient { +impl MultisigSigningClient for NyxdClient { async fn propose_release_funds( &self, title: String, blinded_serial_number: String, voucher_value: u128, fee: Option, - ) -> Result { + ) -> Result { let fee = fee.unwrap_or(Fee::Auto(Some(self.simulated_gas_multiplier))); let release_funds_req = CoconutBandwidthExecuteMsg::ReleaseFunds { funds: Coin::new( @@ -81,7 +81,7 @@ impl MultisigSigningClient for NymdClien proposal_id: u64, vote_yes: bool, fee: Option, - ) -> Result { + ) -> Result { let fee = fee.unwrap_or(Fee::Auto(Some(self.simulated_gas_multiplier))); let vote = if vote_yes { Vote::Yes } else { Vote::No }; let req = ExecuteMsg::Vote { proposal_id, vote }; @@ -101,7 +101,7 @@ impl MultisigSigningClient for NymdClien &self, proposal_id: u64, fee: Option, - ) -> Result { + ) -> Result { let fee = fee.unwrap_or(Fee::Auto(Some(self.simulated_gas_multiplier))); let req = ExecuteMsg::Execute { proposal_id }; self.client diff --git a/common/client-libs/validator-client/src/nymd/traits/vesting_query_client.rs b/common/client-libs/validator-client/src/nyxd/traits/vesting_query_client.rs similarity index 85% rename from common/client-libs/validator-client/src/nymd/traits/vesting_query_client.rs rename to common/client-libs/validator-client/src/nyxd/traits/vesting_query_client.rs index 598818197a..5aadd0a608 100644 --- a/common/client-libs/validator-client/src/nymd/traits/vesting_query_client.rs +++ b/common/client-libs/validator-client/src/nyxd/traits/vesting_query_client.rs @@ -1,10 +1,10 @@ // Copyright 2021 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::nymd::coin::Coin; -pub use crate::nymd::cosmwasm_client::client::CosmWasmClient; -use crate::nymd::error::NymdError; -use crate::nymd::NymdClient; +use crate::nyxd::coin::Coin; +pub use crate::nyxd::cosmwasm_client::client::CosmWasmClient; +use crate::nyxd::error::NyxdError; +use crate::nyxd::NyxdClient; use async_trait::async_trait; use contracts_common::ContractBuildInformation; use cosmwasm_std::{Coin as CosmWasmCoin, Timestamp}; @@ -18,11 +18,11 @@ use vesting_contract_common::{ #[async_trait] pub trait VestingQueryClient { - async fn query_vesting_contract(&self, query: VestingQueryMsg) -> Result + async fn query_vesting_contract(&self, query: VestingQueryMsg) -> Result where for<'a> T: Deserialize<'a>; - async fn get_vesting_contract_version(&self) -> Result { + async fn get_vesting_contract_version(&self) -> Result { self.query_vesting_contract(VestingQueryMsg::GetContractVersion {}) .await } @@ -31,72 +31,72 @@ pub trait VestingQueryClient { &self, address: &str, block_time: Option, - ) -> Result; + ) -> Result; async fn spendable_coins( &self, vesting_account_address: &str, block_time: Option, - ) -> Result; + ) -> Result; async fn vested_coins( &self, vesting_account_address: &str, block_time: Option, - ) -> Result; + ) -> Result; async fn vesting_coins( &self, vesting_account_address: &str, block_time: Option, - ) -> Result; + ) -> Result; async fn vesting_start_time( &self, vesting_account_address: &str, - ) -> Result; + ) -> Result; async fn vesting_end_time(&self, vesting_account_address: &str) - -> Result; + -> Result; async fn original_vesting( &self, vesting_account_address: &str, - ) -> Result; + ) -> Result; async fn delegated_free( &self, vesting_account_address: &str, block_time: Option, - ) -> Result; + ) -> Result; async fn delegated_vesting( &self, vesting_account_address: &str, block_time: Option, - ) -> Result; + ) -> Result; - async fn get_account(&self, address: &str) -> Result; - async fn get_mixnode_pledge(&self, address: &str) -> Result, NymdError>; - async fn get_gateway_pledge(&self, address: &str) -> Result, NymdError>; + async fn get_account(&self, address: &str) -> Result; + async fn get_mixnode_pledge(&self, address: &str) -> Result, NyxdError>; + async fn get_gateway_pledge(&self, address: &str) -> Result, NyxdError>; async fn get_current_vesting_period( &self, vesting_account_address: &str, - ) -> Result; + ) -> Result; async fn get_delegation_timestamps( &self, address: &str, mix_id: MixId, - ) -> Result; + ) -> Result; async fn get_all_vesting_delegations_paged( &self, start_after: Option<(u32, MixId, u64)>, limit: Option, - ) -> Result; + ) -> Result; - async fn get_all_vesting_delegations(&self) -> Result, NymdError> { + async fn get_all_vesting_delegations(&self) -> Result, NyxdError> { let mut delegations = Vec::new(); let mut start_after = None; loop { @@ -117,8 +117,8 @@ pub trait VestingQueryClient { } #[async_trait] -impl VestingQueryClient for NymdClient { - async fn query_vesting_contract(&self, query: VestingQueryMsg) -> Result +impl VestingQueryClient for NyxdClient { + async fn query_vesting_contract(&self, query: VestingQueryMsg) -> Result where for<'a> T: Deserialize<'a>, { @@ -131,7 +131,7 @@ impl VestingQueryClient for NymdClient { &self, vesting_account_address: &str, block_time: Option, - ) -> Result { + ) -> Result { let request = VestingQueryMsg::LockedCoins { vesting_account_address: vesting_account_address.to_string(), block_time, @@ -146,7 +146,7 @@ impl VestingQueryClient for NymdClient { &self, vesting_account_address: &str, block_time: Option, - ) -> Result { + ) -> Result { let request = VestingQueryMsg::SpendableCoins { vesting_account_address: vesting_account_address.to_string(), block_time, @@ -160,7 +160,7 @@ impl VestingQueryClient for NymdClient { &self, vesting_account_address: &str, block_time: Option, - ) -> Result { + ) -> Result { let request = VestingQueryMsg::GetVestedCoins { vesting_account_address: vesting_account_address.to_string(), block_time, @@ -174,7 +174,7 @@ impl VestingQueryClient for NymdClient { &self, vesting_account_address: &str, block_time: Option, - ) -> Result { + ) -> Result { let request = VestingQueryMsg::GetVestingCoins { vesting_account_address: vesting_account_address.to_string(), block_time, @@ -188,7 +188,7 @@ impl VestingQueryClient for NymdClient { async fn vesting_start_time( &self, vesting_account_address: &str, - ) -> Result { + ) -> Result { let request = VestingQueryMsg::GetStartTime { vesting_account_address: vesting_account_address.to_string(), }; @@ -200,7 +200,7 @@ impl VestingQueryClient for NymdClient { async fn vesting_end_time( &self, vesting_account_address: &str, - ) -> Result { + ) -> Result { let request = VestingQueryMsg::GetEndTime { vesting_account_address: vesting_account_address.to_string(), }; @@ -212,7 +212,7 @@ impl VestingQueryClient for NymdClient { async fn original_vesting( &self, vesting_account_address: &str, - ) -> Result { + ) -> Result { let request = VestingQueryMsg::GetOriginalVesting { vesting_account_address: vesting_account_address.to_string(), }; @@ -225,7 +225,7 @@ impl VestingQueryClient for NymdClient { &self, vesting_account_address: &str, block_time: Option, - ) -> Result { + ) -> Result { let request = VestingQueryMsg::GetDelegatedFree { vesting_account_address: vesting_account_address.to_string(), block_time, @@ -241,7 +241,7 @@ impl VestingQueryClient for NymdClient { &self, vesting_account_address: &str, block_time: Option, - ) -> Result { + ) -> Result { let request = VestingQueryMsg::GetDelegatedVesting { vesting_account_address: vesting_account_address.to_string(), block_time, @@ -252,7 +252,7 @@ impl VestingQueryClient for NymdClient { .map(Into::into) } - async fn get_account(&self, address: &str) -> Result { + async fn get_account(&self, address: &str) -> Result { let request = VestingQueryMsg::GetAccount { address: address.to_string(), }; @@ -260,7 +260,7 @@ impl VestingQueryClient for NymdClient { .query_contract_smart(self.vesting_contract_address(), &request) .await } - async fn get_mixnode_pledge(&self, address: &str) -> Result, NymdError> { + async fn get_mixnode_pledge(&self, address: &str) -> Result, NyxdError> { let request = VestingQueryMsg::GetMixnode { address: address.to_string(), }; @@ -268,7 +268,7 @@ impl VestingQueryClient for NymdClient { .query_contract_smart(self.vesting_contract_address(), &request) .await } - async fn get_gateway_pledge(&self, address: &str) -> Result, NymdError> { + async fn get_gateway_pledge(&self, address: &str) -> Result, NyxdError> { let request = VestingQueryMsg::GetGateway { address: address.to_string(), }; @@ -277,7 +277,7 @@ impl VestingQueryClient for NymdClient { .await } - async fn get_current_vesting_period(&self, address: &str) -> Result { + async fn get_current_vesting_period(&self, address: &str) -> Result { let request = VestingQueryMsg::GetCurrentVestingPeriod { address: address.to_string(), }; @@ -290,7 +290,7 @@ impl VestingQueryClient for NymdClient { &self, address: &str, mix_id: MixId, - ) -> Result { + ) -> Result { let request = VestingQueryMsg::GetDelegationTimes { address: address.to_string(), mix_id, @@ -304,7 +304,7 @@ impl VestingQueryClient for NymdClient { &self, start_after: Option<(u32, MixId, u64)>, limit: Option, - ) -> Result { + ) -> Result { let request = VestingQueryMsg::GetAllDelegations { start_after, limit }; self.client .query_contract_smart(self.vesting_contract_address(), &request) diff --git a/common/client-libs/validator-client/src/nymd/traits/vesting_signing_client.rs b/common/client-libs/validator-client/src/nyxd/traits/vesting_signing_client.rs similarity index 87% rename from common/client-libs/validator-client/src/nymd/traits/vesting_signing_client.rs rename to common/client-libs/validator-client/src/nyxd/traits/vesting_signing_client.rs index 120e9ca2e0..68b4bcc53a 100644 --- a/common/client-libs/validator-client/src/nymd/traits/vesting_signing_client.rs +++ b/common/client-libs/validator-client/src/nyxd/traits/vesting_signing_client.rs @@ -1,10 +1,10 @@ // Copyright 2021 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -pub use crate::nymd::cosmwasm_client::signing_client::SigningCosmWasmClient; -use crate::nymd::cosmwasm_client::types::ExecuteResult; -use crate::nymd::error::NymdError; -use crate::nymd::{Coin, Fee, NymdClient}; +pub use crate::nyxd::cosmwasm_client::signing_client::SigningCosmWasmClient; +use crate::nyxd::cosmwasm_client::types::ExecuteResult; +use crate::nyxd::error::NyxdError; +use crate::nyxd::{Coin, Fee, NyxdClient}; use async_trait::async_trait; use mixnet_contract_common::mixnode::{MixNodeConfigUpdate, MixNodeCostParams}; use mixnet_contract_common::{Gateway, MixId, MixNode}; @@ -18,25 +18,25 @@ pub trait VestingSigningClient { fee: Option, msg: VestingExecuteMsg, funds: Vec, - ) -> Result; + ) -> Result; async fn vesting_update_mixnode_cost_params( &self, new_costs: MixNodeCostParams, fee: Option, - ) -> Result; + ) -> Result; async fn vesting_update_mixnode_config( &self, new_config: MixNodeConfigUpdate, fee: Option, - ) -> Result; + ) -> Result; async fn update_mixnet_address( &self, address: &str, fee: Option, - ) -> Result; + ) -> Result; async fn vesting_bond_gateway( &self, @@ -44,16 +44,16 @@ pub trait VestingSigningClient { owner_signature: &str, pledge: Coin, fee: Option, - ) -> Result; + ) -> Result; - async fn vesting_unbond_gateway(&self, fee: Option) -> Result; + async fn vesting_unbond_gateway(&self, fee: Option) -> Result; async fn vesting_track_unbond_gateway( &self, owner: &str, amount: Coin, fee: Option, - ) -> Result; + ) -> Result; async fn vesting_bond_mixnode( &self, @@ -62,13 +62,13 @@ pub trait VestingSigningClient { owner_signature: &str, pledge: Coin, fee: Option, - ) -> Result; + ) -> Result; async fn vesting_pledge_more( &self, additional_pledge: Coin, fee: Option, - ) -> Result { + ) -> Result { self.execute_vesting_contract( fee, VestingExecuteMsg::PledgeMore { @@ -79,20 +79,20 @@ pub trait VestingSigningClient { .await } - async fn vesting_unbond_mixnode(&self, fee: Option) -> Result; + async fn vesting_unbond_mixnode(&self, fee: Option) -> Result; async fn vesting_track_unbond_mixnode( &self, owner: &str, amount: Coin, fee: Option, - ) -> Result; + ) -> Result; async fn withdraw_vested_coins( &self, amount: Coin, fee: Option, - ) -> Result; + ) -> Result; async fn vesting_track_undelegation( &self, @@ -100,20 +100,20 @@ pub trait VestingSigningClient { mix_id: MixId, amount: Coin, fee: Option, - ) -> Result; + ) -> Result; async fn vesting_delegate_to_mixnode( &self, mix_id: MixId, amount: Coin, fee: Option, - ) -> Result; + ) -> Result; async fn vesting_undelegate_from_mixnode( &self, mix_id: MixId, fee: Option, - ) -> Result; + ) -> Result; async fn create_periodic_vesting_account( &self, @@ -123,17 +123,17 @@ pub trait VestingSigningClient { amount: Coin, cap: Option, fee: Option, - ) -> Result; + ) -> Result; } #[async_trait] -impl VestingSigningClient for NymdClient { +impl VestingSigningClient for NyxdClient { async fn execute_vesting_contract( &self, fee: Option, msg: VestingExecuteMsg, funds: Vec, - ) -> Result { + ) -> Result { let fee = fee.unwrap_or(Fee::Auto(Some(self.simulated_gas_multiplier))); let memo = msg.name().to_string(); self.client @@ -152,7 +152,7 @@ impl VestingSigningClient for NymdClient &self, new_costs: MixNodeCostParams, fee: Option, - ) -> Result { + ) -> Result { self.execute_vesting_contract( fee, VestingExecuteMsg::UpdateMixnodeCostParams { new_costs }, @@ -165,7 +165,7 @@ impl VestingSigningClient for NymdClient &self, new_config: MixNodeConfigUpdate, fee: Option, - ) -> Result { + ) -> Result { let fee = fee.unwrap_or(Fee::Auto(Some(self.simulated_gas_multiplier))); let req = VestingExecuteMsg::UpdateMixnodeConfig { new_config }; self.client @@ -184,7 +184,7 @@ impl VestingSigningClient for NymdClient &self, address: &str, fee: Option, - ) -> Result { + ) -> Result { let fee = fee.unwrap_or(Fee::Auto(Some(self.simulated_gas_multiplier))); let req = VestingExecuteMsg::UpdateMixnetAddress { address: address.to_string(), @@ -207,7 +207,7 @@ impl VestingSigningClient for NymdClient owner_signature: &str, pledge: Coin, fee: Option, - ) -> Result { + ) -> Result { let fee = fee.unwrap_or(Fee::Auto(Some(self.simulated_gas_multiplier))); let req = VestingExecuteMsg::BondGateway { gateway, @@ -226,7 +226,7 @@ impl VestingSigningClient for NymdClient .await } - async fn vesting_unbond_gateway(&self, fee: Option) -> Result { + async fn vesting_unbond_gateway(&self, fee: Option) -> Result { let fee = fee.unwrap_or(Fee::Auto(Some(self.simulated_gas_multiplier))); let req = VestingExecuteMsg::UnbondGateway {}; self.client @@ -246,7 +246,7 @@ impl VestingSigningClient for NymdClient owner: &str, amount: Coin, fee: Option, - ) -> Result { + ) -> Result { let fee = fee.unwrap_or(Fee::Auto(Some(self.simulated_gas_multiplier))); let req = VestingExecuteMsg::TrackUnbondGateway { owner: owner.to_string(), @@ -271,7 +271,7 @@ impl VestingSigningClient for NymdClient owner_signature: &str, pledge: Coin, fee: Option, - ) -> Result { + ) -> Result { self.execute_vesting_contract( fee, VestingExecuteMsg::BondMixnode { @@ -285,7 +285,7 @@ impl VestingSigningClient for NymdClient .await } - async fn vesting_unbond_mixnode(&self, fee: Option) -> Result { + async fn vesting_unbond_mixnode(&self, fee: Option) -> Result { let fee = fee.unwrap_or(Fee::Auto(Some(self.simulated_gas_multiplier))); let req = VestingExecuteMsg::UnbondMixnode {}; self.client @@ -305,7 +305,7 @@ impl VestingSigningClient for NymdClient owner: &str, amount: Coin, fee: Option, - ) -> Result { + ) -> Result { let fee = fee.unwrap_or(Fee::Auto(Some(self.simulated_gas_multiplier))); let req = VestingExecuteMsg::TrackUnbondMixnode { owner: owner.to_string(), @@ -327,7 +327,7 @@ impl VestingSigningClient for NymdClient &self, amount: Coin, fee: Option, - ) -> Result { + ) -> Result { let fee = fee.unwrap_or(Fee::Auto(Some(self.simulated_gas_multiplier))); let req = VestingExecuteMsg::WithdrawVestedCoins { amount: amount.into(), @@ -350,7 +350,7 @@ impl VestingSigningClient for NymdClient mix_id: MixId, amount: Coin, fee: Option, - ) -> Result { + ) -> Result { self.execute_vesting_contract( fee, VestingExecuteMsg::TrackUndelegation { @@ -368,7 +368,7 @@ impl VestingSigningClient for NymdClient mix_id: MixId, amount: Coin, fee: Option, - ) -> Result { + ) -> Result { self.execute_vesting_contract( fee, VestingExecuteMsg::DelegateToMixnode { @@ -384,7 +384,7 @@ impl VestingSigningClient for NymdClient &self, mix_id: MixId, fee: Option, - ) -> Result { + ) -> Result { self.execute_vesting_contract( fee, VestingExecuteMsg::UndelegateFromMixnode { mix_id }, @@ -401,7 +401,7 @@ impl VestingSigningClient for NymdClient amount: Coin, cap: Option, fee: Option, - ) -> Result { + ) -> Result { let fee = fee.unwrap_or(Fee::Auto(Some(self.simulated_gas_multiplier))); let req = VestingExecuteMsg::CreateAccount { owner_address: owner_address.to_string(), diff --git a/common/client-libs/validator-client/src/nymd/wallet/mod.rs b/common/client-libs/validator-client/src/nyxd/wallet/mod.rs similarity index 92% rename from common/client-libs/validator-client/src/nymd/wallet/mod.rs rename to common/client-libs/validator-client/src/nyxd/wallet/mod.rs index c78aacde70..8983176692 100644 --- a/common/client-libs/validator-client/src/nymd/wallet/mod.rs +++ b/common/client-libs/validator-client/src/nyxd/wallet/mod.rs @@ -1,7 +1,7 @@ // Copyright 2021 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::nymd::error::NymdError; +use crate::nyxd::error::NyxdError; use config::defaults; use cosmrs::bip32::{DerivationPath, XPrv}; use cosmrs::crypto::secp256k1::{Signature, SigningKey}; @@ -62,16 +62,16 @@ impl DirectSecp256k1HdWallet { } /// Restores a wallet from the given BIP39 mnemonic using default options. - pub fn from_mnemonic(prefix: &str, mnemonic: bip39::Mnemonic) -> Result { + pub fn from_mnemonic(prefix: &str, mnemonic: bip39::Mnemonic) -> Result { DirectSecp256k1HdWalletBuilder::new(prefix).build(mnemonic) } - pub fn generate(prefix: &str, word_count: usize) -> Result { + pub fn generate(prefix: &str, word_count: usize) -> Result { let mneomonic = bip39::Mnemonic::generate(word_count)?; Self::from_mnemonic(prefix, mneomonic) } - fn derive_keypair(&self, hd_path: &DerivationPath) -> Result { + fn derive_keypair(&self, hd_path: &DerivationPath) -> Result { let extended_private_key = XPrv::derive_from_path(self.seed, hd_path)?; let private_key: SigningKey = extended_private_key.into(); @@ -80,7 +80,7 @@ impl DirectSecp256k1HdWallet { Ok((private_key, public_key)) } - pub fn try_derive_accounts(&self) -> Result, NymdError> { + pub fn try_derive_accounts(&self) -> Result, NyxdError> { let mut accounts = Vec::with_capacity(self.accounts.len()); for derivation_info in &self.accounts { let keypair = self.derive_keypair(&derivation_info.hd_path)?; @@ -89,7 +89,7 @@ impl DirectSecp256k1HdWallet { let address = keypair .1 .account_id(&derivation_info.prefix) - .map_err(|_| NymdError::AccountDerivationError)?; + .map_err(|_| NyxdError::AccountDerivationError)?; accounts.push(AccountData { address, @@ -109,36 +109,36 @@ impl DirectSecp256k1HdWallet { &self, signer: &AccountData, message: &[u8], - ) -> Result { + ) -> Result { signer .private_key .sign(message) - .map_err(|_| NymdError::SigningFailure) + .map_err(|_| NyxdError::SigningFailure) } pub fn sign_direct_with_account( &self, signer: &AccountData, sign_doc: SignDoc, - ) -> Result { - // ideally I'd prefer to have the entire error put into the NymdError::SigningFailure + ) -> Result { + // ideally I'd prefer to have the entire error put into the NyxdError::SigningFailure // but I'm super hesitant to trying to downcast the eyre::Report to cosmrs::error::Error sign_doc .sign(&signer.private_key) - .map_err(|_| NymdError::SigningFailure) + .map_err(|_| NyxdError::SigningFailure) } pub fn sign_direct( &self, signer_address: &AccountId, sign_doc: SignDoc, - ) -> Result { + ) -> Result { // I hate deriving accounts at every sign here so much : ( let accounts = self.try_derive_accounts()?; let account = accounts .iter() .find(|account| &account.address == signer_address) - .ok_or_else(|| NymdError::SigningAccountNotFound(signer_address.clone()))?; + .ok_or_else(|| NyxdError::SigningAccountNotFound(signer_address.clone()))?; self.sign_direct_with_account(account, sign_doc) } @@ -185,7 +185,7 @@ impl DirectSecp256k1HdWalletBuilder { self } - pub fn build(self, mnemonic: bip39::Mnemonic) -> Result { + pub fn build(self, mnemonic: bip39::Mnemonic) -> Result { let seed = mnemonic.to_seed(&self.bip39_password); let prefix = self.prefix; let accounts = self diff --git a/common/commands/Cargo.toml b/common/commands/Cargo.toml index c54589d078..6829e72631 100644 --- a/common/commands/Cargo.toml +++ b/common/commands/Cargo.toml @@ -27,7 +27,7 @@ tap = "1" cosmrs = { git = "https://github.com/neacsu/cosmos-rust", branch = "neacsu/feegrant_support" } cosmwasm-std = { version = "1.0.0" } -validator-client = { path = "../client-libs/validator-client", features = ["nymd-client"] } +validator-client = { path = "../client-libs/validator-client", features = ["nyxd-client"] } network-defaults = { path = "../network-defaults" } mixnet-contract-common = { path = "../cosmwasm-smart-contracts/mixnet-contract" } vesting-contract-common = { path = "../cosmwasm-smart-contracts/vesting-contract" } diff --git a/common/commands/src/context/errors.rs b/common/commands/src/context/errors.rs index 7be8f6d8ef..c385e96626 100644 --- a/common/commands/src/context/errors.rs +++ b/common/commands/src/context/errors.rs @@ -11,13 +11,13 @@ pub enum ContextError { #[error("failed to parse mnemonic - {0}")] Bip39Error(#[from] bip39::Error), - // there are lots of error that can occur in the nymd client, so just pass through their display details + // there are lots of error that can occur in the nyxd client, so just pass through their display details // TODO: improve this to return known errors #[error("failed to create client - {0}")] - NymdError(String), + NyxdError(String), #[error(transparent)] - NymdErrorPassthrough(#[from] validator_client::nymd::error::NymdError), + NyxdErrorPassthrough(#[from] validator_client::nyxd::error::NyxdError), #[error(transparent)] ValidatorClientError(#[from] validator_client::ValidatorClientError), diff --git a/common/commands/src/context/mod.rs b/common/commands/src/context/mod.rs index ae612af1dd..ff0656e2f4 100644 --- a/common/commands/src/context/mod.rs +++ b/common/commands/src/context/mod.rs @@ -3,26 +3,26 @@ use network_defaults::{ setup_env, - var_names::{API_VALIDATOR, MIXNET_CONTRACT_ADDRESS, NYMD_VALIDATOR, VESTING_CONTRACT_ADDRESS}, + var_names::{MIXNET_CONTRACT_ADDRESS, NYM_API, NYXD, VESTING_CONTRACT_ADDRESS}, NymNetworkDetails, }; use tap::prelude::*; pub use validator_client::nym_api::Client as NymApiClient; -use validator_client::nymd::{self, AccountId, NymdClient, QueryNymdClient, SigningNymdClient}; +use validator_client::nyxd::{self, AccountId, NyxdClient, QueryNyxdClient, SigningNyxdClient}; use crate::context::errors::ContextError; pub mod errors; -pub type SigningClient = validator_client::nymd::NymdClient; -pub type QueryClient = validator_client::nymd::NymdClient; -pub type SigningClientWithNymd = validator_client::Client; -pub type QueryClientWithNymd = validator_client::Client; +pub type SigningClient = validator_client::nyxd::NyxdClient; +pub type QueryClient = validator_client::nyxd::NyxdClient; +pub type SigningClientWithNyxd = validator_client::Client; +pub type QueryClientWithNyxd = validator_client::Client; #[derive(Debug)] pub struct ClientArgs { pub config_env_file: Option, - pub nymd_url: Option, + pub nyxd_url: Option, pub nym_api_url: Option, pub mnemonic: Option, pub mixnet_contract_address: Option, @@ -35,11 +35,11 @@ pub fn get_network_details(args: &ClientArgs) -> Result Result { - let client_config = nymd::Config::try_from_nym_network_details(network_details) + let client_config = nyxd::Config::try_from_nym_network_details(network_details) .tap_err(|err| log::error!("Failed to get client config - {err}"))?; // get mnemonic @@ -71,42 +71,42 @@ pub fn create_signing_client( }, }; - let nymd_url = network_details + let nyxd_url = network_details .endpoints .first() .expect("network details are not defined") - .nymd_url + .nyxd_url .as_str(); - match NymdClient::connect_with_mnemonic(client_config, nymd_url, mnemonic, None) { + match NyxdClient::connect_with_mnemonic(client_config, nyxd_url, mnemonic, None) { Ok(client) => Ok(client), - Err(e) => Err(ContextError::NymdError(format!("{:?}", e))), + Err(e) => Err(ContextError::NyxdError(format!("{:?}", e))), } } pub fn create_query_client( network_details: &NymNetworkDetails, ) -> Result { - let client_config = nymd::Config::try_from_nym_network_details(network_details) + let client_config = nyxd::Config::try_from_nym_network_details(network_details) .tap_err(|err| log::error!("Failed to get client config - {err}"))?; - let nymd_url = network_details + let nyxd_url = network_details .endpoints .first() .expect("network details are not defined") - .nymd_url + .nyxd_url .as_str(); - match NymdClient::connect(client_config, nymd_url) { + match NyxdClient::connect(client_config, nyxd_url) { Ok(client) => Ok(client), - Err(e) => Err(ContextError::NymdError(format!("{:?}", e))), + Err(e) => Err(ContextError::NyxdError(format!("{:?}", e))), } } pub fn create_signing_client_with_nym_api( args: ClientArgs, network_details: &NymNetworkDetails, -) -> Result { +) -> Result { let client_config = validator_client::Config::try_from_nym_network_details(network_details) .tap_err(|err| log::error!("Failed to get client config - {err}"))?; @@ -122,18 +122,18 @@ pub fn create_signing_client_with_nym_api( match validator_client::client::Client::new_signing(client_config, mnemonic) { Ok(client) => Ok(client), - Err(e) => Err(ContextError::NymdError(format!("{:?}", e))), + Err(e) => Err(ContextError::NyxdError(format!("{:?}", e))), } } pub fn create_query_client_with_nym_api( network_details: &NymNetworkDetails, -) -> Result { +) -> Result { let client_config = validator_client::Config::try_from_nym_network_details(network_details) .tap_err(|err| log::error!("Failed to get client config - {err}"))?; match validator_client::client::Client::new_query(client_config) { Ok(client) => Ok(client), - Err(e) => Err(ContextError::NymdError(format!("{:?}", e))), + Err(e) => Err(ContextError::NyxdError(format!("{:?}", e))), } } diff --git a/common/commands/src/utils.rs b/common/commands/src/utils.rs index 2e042da300..59fee99f4e 100644 --- a/common/commands/src/utils.rs +++ b/common/commands/src/utils.rs @@ -6,7 +6,7 @@ use std::fmt::Display; use cosmwasm_std::{Coin as CosmWasmCoin, Decimal}; use log::error; -use validator_client::nymd::Coin; +use validator_client::nyxd::Coin; pub fn pretty_coin(coin: &Coin) -> String { let amount = Decimal::from_ratio(coin.amount, 1_000_000u128); diff --git a/common/commands/src/validator/account/balance.rs b/common/commands/src/validator/account/balance.rs index eb8e2dfa8f..3f926891a5 100644 --- a/common/commands/src/validator/account/balance.rs +++ b/common/commands/src/validator/account/balance.rs @@ -4,7 +4,7 @@ use clap::Parser; use log::{error, info}; -use validator_client::nymd::AccountId; +use validator_client::nyxd::AccountId; use crate::context::QueryClient; use crate::utils::{pretty_coin, show_error}; diff --git a/common/commands/src/validator/account/create.rs b/common/commands/src/validator/account/create.rs index 3003b9a9d5..e321d5b41d 100644 --- a/common/commands/src/validator/account/create.rs +++ b/common/commands/src/validator/account/create.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use clap::Parser; -use validator_client::nymd::wallet::DirectSecp256k1HdWallet; +use validator_client::nyxd::wallet::DirectSecp256k1HdWallet; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/account/pubkey.rs b/common/commands/src/validator/account/pubkey.rs index 83d15f25e3..8ecf98c406 100644 --- a/common/commands/src/validator/account/pubkey.rs +++ b/common/commands/src/validator/account/pubkey.rs @@ -4,8 +4,8 @@ use clap::Parser; use log::{error, info}; -use validator_client::nymd::wallet::DirectSecp256k1HdWallet; -use validator_client::nymd::AccountId; +use validator_client::nyxd::wallet::DirectSecp256k1HdWallet; +use validator_client::nyxd::AccountId; use crate::context::QueryClient; use crate::utils::show_error; diff --git a/common/commands/src/validator/account/send.rs b/common/commands/src/validator/account/send.rs index 90816258bd..ac80de8169 100644 --- a/common/commands/src/validator/account/send.rs +++ b/common/commands/src/validator/account/send.rs @@ -5,7 +5,7 @@ use clap::Parser; use log::info; use serde_json::json; -use validator_client::nymd::{AccountId, Coin}; +use validator_client::nyxd::{AccountId, Coin}; use crate::context::SigningClient; diff --git a/common/commands/src/validator/cosmwasm/execute_contract.rs b/common/commands/src/validator/cosmwasm/execute_contract.rs index f387b83903..d271121a49 100644 --- a/common/commands/src/validator/cosmwasm/execute_contract.rs +++ b/common/commands/src/validator/cosmwasm/execute_contract.rs @@ -6,7 +6,7 @@ use clap::Parser; use cosmrs::AccountId; use log::{error, info}; use serde_json::{json, Value}; -use validator_client::nymd::Coin; +use validator_client::nyxd::Coin; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/cosmwasm/init_contract.rs b/common/commands/src/validator/cosmwasm/init_contract.rs index c624a81a94..6ee55b7791 100644 --- a/common/commands/src/validator/cosmwasm/init_contract.rs +++ b/common/commands/src/validator/cosmwasm/init_contract.rs @@ -6,8 +6,8 @@ use clap::Parser; use cosmrs::{AccountId, Coin as CosmosCoin}; use log::info; use network_defaults::NymNetworkDetails; -use validator_client::nymd::cosmwasm_client::types::{ContractCodeId, InstantiateOptions}; -use validator_client::nymd::Coin; +use validator_client::nyxd::cosmwasm_client::types::{ContractCodeId, InstantiateOptions}; +use validator_client::nyxd::Coin; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/cosmwasm/migrate_contract.rs b/common/commands/src/validator/cosmwasm/migrate_contract.rs index fa21062ee7..4abf101ae8 100644 --- a/common/commands/src/validator/cosmwasm/migrate_contract.rs +++ b/common/commands/src/validator/cosmwasm/migrate_contract.rs @@ -6,7 +6,7 @@ use crate::utils::show_error_passthrough; use clap::Parser; use cosmrs::AccountId; use log::info; -use validator_client::nymd::cosmwasm_client::types::{ContractCodeId, EmptyMsg}; +use validator_client::nyxd::cosmwasm_client::types::{ContractCodeId, EmptyMsg}; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/mixnet/delegators/delegate_to_mixnode.rs b/common/commands/src/validator/mixnet/delegators/delegate_to_mixnode.rs index 50b4880c6e..696a2e977d 100644 --- a/common/commands/src/validator/mixnet/delegators/delegate_to_mixnode.rs +++ b/common/commands/src/validator/mixnet/delegators/delegate_to_mixnode.rs @@ -5,7 +5,7 @@ use crate::context::SigningClient; use clap::Parser; use log::info; use mixnet_contract_common::{Coin, MixId}; -use validator_client::nymd::traits::{MixnetQueryClient, MixnetSigningClient}; +use validator_client::nyxd::traits::{MixnetQueryClient, MixnetSigningClient}; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/mixnet/delegators/query_for_delegations.rs b/common/commands/src/validator/mixnet/delegators/query_for_delegations.rs index 6867f51e81..68a347a1fc 100644 --- a/common/commands/src/validator/mixnet/delegators/query_for_delegations.rs +++ b/common/commands/src/validator/mixnet/delegators/query_for_delegations.rs @@ -4,7 +4,7 @@ use clap::Parser; use log::info; -use crate::context::SigningClientWithNymd; +use crate::context::SigningClientWithNyxd; use crate::utils::{pretty_cosmwasm_coin, show_error_passthrough}; use comfy_table::Table; @@ -14,19 +14,19 @@ use mixnet_contract_common::{Delegation, PendingEpochEvent, PendingEpochEventKin #[derive(Debug, Parser)] pub struct Args {} -pub async fn execute(_args: Args, client: SigningClientWithNymd) { +pub async fn execute(_args: Args, client: SigningClientWithNyxd) { info!( "Getting delegations for account {}...", - client.nymd.address() + client.nyxd.address() ); let delegations = client - .get_all_delegator_delegations(client.nymd.address()) + .get_all_delegator_delegations(client.nyxd.address()) .await .map_err(show_error_passthrough); let mixnet_contract_events = client - .get_all_nymd_pending_epoch_events() + .get_all_nyxd_pending_epoch_events() .await .map_err(show_error_passthrough); @@ -48,14 +48,14 @@ pub async fn execute(_args: Args, client: SigningClientWithNymd) { } } -async fn to_iso_timestamp(block_height: u32, client: &SigningClientWithNymd) -> String { - match client.nymd.get_block_timestamp(Some(block_height)).await { +async fn to_iso_timestamp(block_height: u32, client: &SigningClientWithNyxd) -> String { + match client.nyxd.get_block_timestamp(Some(block_height)).await { Ok(res) => res.to_rfc3339(), Err(_e) => "-".to_string(), } } -async fn print_delegations(delegations: Vec, client: &SigningClientWithNymd) { +async fn print_delegations(delegations: Vec, client: &SigningClientWithNyxd) { let mut table = Table::new(); table.set_header(vec!["Timestamp", "Mix Id", "Delegation", "Proxy"]); @@ -75,7 +75,7 @@ async fn print_delegations(delegations: Vec, client: &SigningClientW println!("{table}"); } -async fn print_delegation_events(events: Vec, client: &SigningClientWithNymd) { +async fn print_delegation_events(events: Vec, client: &SigningClientWithNyxd) { let mut table = Table::new(); table.set_header(vec![ @@ -94,7 +94,7 @@ async fn print_delegation_events(events: Vec, client: &Signin amount, proxy, } => { - if owner.as_str() == client.nymd.address().as_ref() { + if owner.as_str() == client.nyxd.address().as_ref() { table.add_row(vec![ "not-sure-if-applicable".into(), mix_id.to_string(), @@ -109,7 +109,7 @@ async fn print_delegation_events(events: Vec, client: &Signin mix_id, proxy, } => { - if owner.as_str() == client.nymd.address().as_ref() { + if owner.as_str() == client.nyxd.address().as_ref() { table.add_row(vec![ "not-sure-if-applicable".into(), mix_id.to_string(), diff --git a/common/commands/src/validator/mixnet/delegators/rewards/claim_delegator_reward.rs b/common/commands/src/validator/mixnet/delegators/rewards/claim_delegator_reward.rs index 1858b7cebb..474d6d4233 100644 --- a/common/commands/src/validator/mixnet/delegators/rewards/claim_delegator_reward.rs +++ b/common/commands/src/validator/mixnet/delegators/rewards/claim_delegator_reward.rs @@ -5,7 +5,7 @@ use crate::context::SigningClient; use clap::Parser; use log::info; use mixnet_contract_common::MixId; -use validator_client::nymd::traits::{MixnetQueryClient, MixnetSigningClient}; +use validator_client::nyxd::traits::{MixnetQueryClient, MixnetSigningClient}; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/mixnet/delegators/rewards/vesting_claim_delegator_reward.rs b/common/commands/src/validator/mixnet/delegators/rewards/vesting_claim_delegator_reward.rs index 6eca5cbf7a..a3a9fbc385 100644 --- a/common/commands/src/validator/mixnet/delegators/rewards/vesting_claim_delegator_reward.rs +++ b/common/commands/src/validator/mixnet/delegators/rewards/vesting_claim_delegator_reward.rs @@ -5,7 +5,7 @@ use crate::context::SigningClient; use clap::Parser; use log::info; use mixnet_contract_common::MixId; -use validator_client::nymd::traits::{MixnetQueryClient, MixnetSigningClient}; +use validator_client::nyxd::traits::{MixnetQueryClient, MixnetSigningClient}; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/mixnet/delegators/undelegate_from_mixnode.rs b/common/commands/src/validator/mixnet/delegators/undelegate_from_mixnode.rs index 063d4a523f..1bdc5f5305 100644 --- a/common/commands/src/validator/mixnet/delegators/undelegate_from_mixnode.rs +++ b/common/commands/src/validator/mixnet/delegators/undelegate_from_mixnode.rs @@ -5,7 +5,7 @@ use crate::context::SigningClient; use clap::Parser; use log::info; use mixnet_contract_common::MixId; -use validator_client::nymd::traits::{MixnetQueryClient, MixnetSigningClient}; +use validator_client::nyxd::traits::{MixnetQueryClient, MixnetSigningClient}; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/mixnet/delegators/vesting_delegate_to_mixnode.rs b/common/commands/src/validator/mixnet/delegators/vesting_delegate_to_mixnode.rs index ba33a49037..b4cef52bf3 100644 --- a/common/commands/src/validator/mixnet/delegators/vesting_delegate_to_mixnode.rs +++ b/common/commands/src/validator/mixnet/delegators/vesting_delegate_to_mixnode.rs @@ -5,8 +5,8 @@ use clap::Parser; use log::info; use mixnet_contract_common::{Coin, MixId}; -use validator_client::nymd::traits::MixnetQueryClient; -use validator_client::nymd::VestingSigningClient; +use validator_client::nyxd::traits::MixnetQueryClient; +use validator_client::nyxd::VestingSigningClient; use crate::context::SigningClient; diff --git a/common/commands/src/validator/mixnet/delegators/vesting_undelegate_from_mixnode.rs b/common/commands/src/validator/mixnet/delegators/vesting_undelegate_from_mixnode.rs index 59fb6b6c3d..29b77c8a3b 100644 --- a/common/commands/src/validator/mixnet/delegators/vesting_undelegate_from_mixnode.rs +++ b/common/commands/src/validator/mixnet/delegators/vesting_undelegate_from_mixnode.rs @@ -4,8 +4,8 @@ use clap::Parser; use log::info; use mixnet_contract_common::MixId; -use validator_client::nymd::traits::MixnetQueryClient; -use validator_client::nymd::VestingSigningClient; +use validator_client::nyxd::traits::MixnetQueryClient; +use validator_client::nyxd::VestingSigningClient; use crate::context::SigningClient; diff --git a/common/commands/src/validator/mixnet/operators/gateway/bond_gateway.rs b/common/commands/src/validator/mixnet/operators/gateway/bond_gateway.rs index e9482dde34..34b652a567 100644 --- a/common/commands/src/validator/mixnet/operators/gateway/bond_gateway.rs +++ b/common/commands/src/validator/mixnet/operators/gateway/bond_gateway.rs @@ -6,7 +6,7 @@ use clap::Parser; use log::{info, warn}; use mixnet_contract_common::Coin; use network_defaults::{DEFAULT_CLIENT_LISTENING_PORT, DEFAULT_MIX_LISTENING_PORT}; -use validator_client::nymd::traits::MixnetSigningClient; +use validator_client::nyxd::traits::MixnetSigningClient; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/mixnet/operators/gateway/unbond_gateway.rs b/common/commands/src/validator/mixnet/operators/gateway/unbond_gateway.rs index 90cae1623c..e0e7ba68f1 100644 --- a/common/commands/src/validator/mixnet/operators/gateway/unbond_gateway.rs +++ b/common/commands/src/validator/mixnet/operators/gateway/unbond_gateway.rs @@ -4,7 +4,7 @@ use crate::context::SigningClient; use clap::Parser; use log::info; -use validator_client::nymd::traits::MixnetSigningClient; +use validator_client::nyxd::traits::MixnetSigningClient; #[derive(Debug, Parser)] pub struct Args {} diff --git a/common/commands/src/validator/mixnet/operators/gateway/vesting_bond_gateway.rs b/common/commands/src/validator/mixnet/operators/gateway/vesting_bond_gateway.rs index 6c26b09eeb..c4e3854fd4 100644 --- a/common/commands/src/validator/mixnet/operators/gateway/vesting_bond_gateway.rs +++ b/common/commands/src/validator/mixnet/operators/gateway/vesting_bond_gateway.rs @@ -6,7 +6,7 @@ use clap::Parser; use log::{info, warn}; use mixnet_contract_common::{Coin, Gateway}; use network_defaults::{DEFAULT_CLIENT_LISTENING_PORT, DEFAULT_MIX_LISTENING_PORT}; -use validator_client::nymd::VestingSigningClient; +use validator_client::nyxd::VestingSigningClient; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/mixnet/operators/gateway/vesting_unbond_gateway.rs b/common/commands/src/validator/mixnet/operators/gateway/vesting_unbond_gateway.rs index 0c0eae2fe6..c9b95a3169 100644 --- a/common/commands/src/validator/mixnet/operators/gateway/vesting_unbond_gateway.rs +++ b/common/commands/src/validator/mixnet/operators/gateway/vesting_unbond_gateway.rs @@ -4,7 +4,7 @@ use crate::context::SigningClient; use clap::Parser; use log::info; -use validator_client::nymd::traits::MixnetSigningClient; +use validator_client::nyxd::traits::MixnetSigningClient; #[derive(Debug, Parser)] pub struct Args {} diff --git a/common/commands/src/validator/mixnet/operators/mixnode/bond_mixnode.rs b/common/commands/src/validator/mixnet/operators/mixnode/bond_mixnode.rs index 4d672a5322..0c04845a15 100644 --- a/common/commands/src/validator/mixnet/operators/mixnode/bond_mixnode.rs +++ b/common/commands/src/validator/mixnet/operators/mixnode/bond_mixnode.rs @@ -9,8 +9,8 @@ use mixnet_contract_common::{Coin, MixNodeCostParams, Percent}; use network_defaults::{ DEFAULT_HTTP_API_LISTENING_PORT, DEFAULT_MIX_LISTENING_PORT, DEFAULT_VERLOC_LISTENING_PORT, }; -use validator_client::nymd::traits::MixnetSigningClient; -use validator_client::nymd::CosmWasmCoin; +use validator_client::nyxd::traits::MixnetSigningClient; +use validator_client::nyxd::CosmWasmCoin; use crate::context::SigningClient; diff --git a/common/commands/src/validator/mixnet/operators/mixnode/rewards/claim_operator_reward.rs b/common/commands/src/validator/mixnet/operators/mixnode/rewards/claim_operator_reward.rs index 773f4cb3d7..e689f91f73 100644 --- a/common/commands/src/validator/mixnet/operators/mixnode/rewards/claim_operator_reward.rs +++ b/common/commands/src/validator/mixnet/operators/mixnode/rewards/claim_operator_reward.rs @@ -4,7 +4,7 @@ use crate::context::SigningClient; use clap::Parser; use log::info; -use validator_client::nymd::traits::MixnetSigningClient; +use validator_client::nyxd::traits::MixnetSigningClient; #[derive(Debug, Parser)] pub struct Args {} diff --git a/common/commands/src/validator/mixnet/operators/mixnode/rewards/vesting_claim_operator_reward.rs b/common/commands/src/validator/mixnet/operators/mixnode/rewards/vesting_claim_operator_reward.rs index d4895e83f2..f91506ad02 100644 --- a/common/commands/src/validator/mixnet/operators/mixnode/rewards/vesting_claim_operator_reward.rs +++ b/common/commands/src/validator/mixnet/operators/mixnode/rewards/vesting_claim_operator_reward.rs @@ -4,7 +4,7 @@ use crate::context::SigningClient; use clap::Parser; use log::info; -use validator_client::nymd::traits::MixnetSigningClient; +use validator_client::nyxd::traits::MixnetSigningClient; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/mixnet/operators/mixnode/settings/update_config.rs b/common/commands/src/validator/mixnet/operators/mixnode/settings/update_config.rs index 84cf9f2f4e..cb793c61f5 100644 --- a/common/commands/src/validator/mixnet/operators/mixnode/settings/update_config.rs +++ b/common/commands/src/validator/mixnet/operators/mixnode/settings/update_config.rs @@ -5,7 +5,7 @@ use crate::context::SigningClient; use clap::Parser; use log::info; use mixnet_contract_common::MixNodeConfigUpdate; -use validator_client::nymd::traits::{MixnetQueryClient, MixnetSigningClient}; +use validator_client::nyxd::traits::{MixnetQueryClient, MixnetSigningClient}; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/mixnet/operators/mixnode/settings/vesting_update_config.rs b/common/commands/src/validator/mixnet/operators/mixnode/settings/vesting_update_config.rs index bca3642c97..044764c642 100644 --- a/common/commands/src/validator/mixnet/operators/mixnode/settings/vesting_update_config.rs +++ b/common/commands/src/validator/mixnet/operators/mixnode/settings/vesting_update_config.rs @@ -5,8 +5,8 @@ use crate::context::SigningClient; use clap::Parser; use log::info; use mixnet_contract_common::MixNodeConfigUpdate; -use validator_client::nymd::traits::MixnetQueryClient; -use validator_client::nymd::VestingSigningClient; +use validator_client::nyxd::traits::MixnetQueryClient; +use validator_client::nyxd::VestingSigningClient; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/mixnet/operators/mixnode/unbond_mixnode.rs b/common/commands/src/validator/mixnet/operators/mixnode/unbond_mixnode.rs index 04fa9a55cd..8f5e881048 100644 --- a/common/commands/src/validator/mixnet/operators/mixnode/unbond_mixnode.rs +++ b/common/commands/src/validator/mixnet/operators/mixnode/unbond_mixnode.rs @@ -3,7 +3,7 @@ use clap::Parser; use log::info; -use validator_client::nymd::traits::MixnetSigningClient; +use validator_client::nyxd::traits::MixnetSigningClient; use crate::context::SigningClient; diff --git a/common/commands/src/validator/mixnet/operators/mixnode/vesting_bond_mixnode.rs b/common/commands/src/validator/mixnet/operators/mixnode/vesting_bond_mixnode.rs index 6f20996460..3aa8da5969 100644 --- a/common/commands/src/validator/mixnet/operators/mixnode/vesting_bond_mixnode.rs +++ b/common/commands/src/validator/mixnet/operators/mixnode/vesting_bond_mixnode.rs @@ -10,7 +10,7 @@ use mixnet_contract_common::{MixNode, Percent}; use network_defaults::{ DEFAULT_HTTP_API_LISTENING_PORT, DEFAULT_MIX_LISTENING_PORT, DEFAULT_VERLOC_LISTENING_PORT, }; -use validator_client::nymd::{CosmWasmCoin, VestingSigningClient}; +use validator_client::nyxd::{CosmWasmCoin, VestingSigningClient}; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/mixnet/operators/mixnode/vesting_unbond_mixnode.rs b/common/commands/src/validator/mixnet/operators/mixnode/vesting_unbond_mixnode.rs index 0824cc9342..e99c4baf83 100644 --- a/common/commands/src/validator/mixnet/operators/mixnode/vesting_unbond_mixnode.rs +++ b/common/commands/src/validator/mixnet/operators/mixnode/vesting_unbond_mixnode.rs @@ -4,7 +4,7 @@ use crate::context::SigningClient; use clap::Parser; use log::info; -use validator_client::nymd::VestingSigningClient; +use validator_client::nyxd::VestingSigningClient; #[derive(Debug, Parser)] pub struct Args { diff --git a/common/commands/src/validator/mixnet/query/query_all_gateways.rs b/common/commands/src/validator/mixnet/query/query_all_gateways.rs index 7904af2c4d..17f1d4d48d 100644 --- a/common/commands/src/validator/mixnet/query/query_all_gateways.rs +++ b/common/commands/src/validator/mixnet/query/query_all_gateways.rs @@ -4,7 +4,7 @@ use clap::Parser; use comfy_table::Table; -use crate::context::QueryClientWithNymd; +use crate::context::QueryClientWithNyxd; use crate::utils::{pretty_cosmwasm_coin, show_error}; #[derive(Debug, Parser)] @@ -14,7 +14,7 @@ pub struct Args { pub identity_key: Option, } -pub async fn query(args: Args, client: &QueryClientWithNymd) { +pub async fn query(args: Args, client: &QueryClientWithNyxd) { match client.nym_api.get_gateways().await { Ok(res) => match args.identity_key { Some(identity_key) => { diff --git a/common/commands/src/validator/mixnet/query/query_all_mixnodes.rs b/common/commands/src/validator/mixnet/query/query_all_mixnodes.rs index cdcd70672f..3b23f2092e 100644 --- a/common/commands/src/validator/mixnet/query/query_all_mixnodes.rs +++ b/common/commands/src/validator/mixnet/query/query_all_mixnodes.rs @@ -4,7 +4,7 @@ use clap::Parser; use comfy_table::Table; -use crate::context::QueryClientWithNymd; +use crate::context::QueryClientWithNyxd; use crate::utils::{pretty_decimal_with_denom, show_error}; #[derive(Debug, Parser)] @@ -14,7 +14,7 @@ pub struct Args { pub identity_key: Option, } -pub async fn query(args: Args, client: &QueryClientWithNymd) { +pub async fn query(args: Args, client: &QueryClientWithNyxd) { match client.nym_api.get_mixnodes().await { Ok(res) => match args.identity_key { Some(identity_key) => { diff --git a/common/commands/src/validator/signature/sign.rs b/common/commands/src/validator/signature/sign.rs index cd4c169ae1..87dfc0303e 100644 --- a/common/commands/src/validator/signature/sign.rs +++ b/common/commands/src/validator/signature/sign.rs @@ -7,7 +7,7 @@ use cosmrs::crypto::PublicKey; use log::error; use serde::Serialize; use serde_json::json; -use validator_client::nymd::wallet::DirectSecp256k1HdWallet; +use validator_client::nyxd::wallet::DirectSecp256k1HdWallet; #[derive(Debug, Serialize)] pub struct SignatureOutputJson { diff --git a/common/commands/src/validator/signature/verify.rs b/common/commands/src/validator/signature/verify.rs index b29f93ca9a..8f84251a1a 100644 --- a/common/commands/src/validator/signature/verify.rs +++ b/common/commands/src/validator/signature/verify.rs @@ -8,7 +8,7 @@ use cosmrs::crypto::PublicKey; use log::{error, info}; use serde_json::json; -use validator_client::nymd::AccountId; +use validator_client::nyxd::AccountId; use crate::context::QueryClient; use crate::validator::signature::helpers::secp256k1_verify_with_public_key; diff --git a/common/commands/src/validator/vesting/balance.rs b/common/commands/src/validator/vesting/balance.rs index 0dff560b9f..5263d106c3 100644 --- a/common/commands/src/validator/vesting/balance.rs +++ b/common/commands/src/validator/vesting/balance.rs @@ -5,7 +5,7 @@ use clap::Parser; use cosmrs::AccountId; use log::{error, info}; -use validator_client::nymd::{Coin, VestingQueryClient}; +use validator_client::nyxd::{Coin, VestingQueryClient}; use crate::context::QueryClient; use crate::utils::show_error; diff --git a/common/commands/src/validator/vesting/create_vesting_schedule.rs b/common/commands/src/validator/vesting/create_vesting_schedule.rs index c7c133673d..d022f2ce3a 100644 --- a/common/commands/src/validator/vesting/create_vesting_schedule.rs +++ b/common/commands/src/validator/vesting/create_vesting_schedule.rs @@ -8,9 +8,9 @@ use log::info; use mixnet_contract_common::Coin; use network_defaults::NymNetworkDetails; -use validator_client::nymd::AccountId; -use validator_client::nymd::VestingSigningClient; -use validator_client::nymd::{CosmosCoin, Denom}; +use validator_client::nyxd::AccountId; +use validator_client::nyxd::VestingSigningClient; +use validator_client::nyxd::{CosmosCoin, Denom}; use vesting_contract_common::messages::VestingSpecification; use vesting_contract_common::PledgeCap; diff --git a/common/commands/src/validator/vesting/query_vesting_schedule.rs b/common/commands/src/validator/vesting/query_vesting_schedule.rs index 10a4dc41d3..3d486124ef 100644 --- a/common/commands/src/validator/vesting/query_vesting_schedule.rs +++ b/common/commands/src/validator/vesting/query_vesting_schedule.rs @@ -6,7 +6,7 @@ use cosmrs::AccountId; use cosmwasm_std::Coin as CosmWasmCoin; use log::{error, info}; -use validator_client::nymd::{Coin, VestingQueryClient}; +use validator_client::nyxd::{Coin, VestingQueryClient}; use crate::context::QueryClient; use crate::utils::show_error; diff --git a/common/commands/src/validator/vesting/withdraw_vested.rs b/common/commands/src/validator/vesting/withdraw_vested.rs index 972c5290d9..c203bbc63d 100644 --- a/common/commands/src/validator/vesting/withdraw_vested.rs +++ b/common/commands/src/validator/vesting/withdraw_vested.rs @@ -4,7 +4,7 @@ use clap::Parser; use log::info; -use validator_client::nymd::{Coin, VestingQueryClient, VestingSigningClient}; +use validator_client::nyxd::{Coin, VestingQueryClient, VestingSigningClient}; use crate::context::SigningClient; use crate::utils::show_error; diff --git a/common/credentials/src/coconut/utils.rs b/common/credentials/src/coconut/utils.rs index 0305bb845b..53e01437af 100644 --- a/common/credentials/src/coconut/utils.rs +++ b/common/credentials/src/coconut/utils.rs @@ -37,7 +37,7 @@ pub async fn obtain_aggregate_verification_key( async fn obtain_partial_credential( params: &Parameters, attributes: &BandwidthVoucher, - client: &validator_client::client::ApiClient, + client: &validator_client::client::NymApiClient, validator_vk: &VerificationKey, ) -> Result { let public_attributes = attributes.get_public_attributes(); diff --git a/common/execute/src/lib.rs b/common/execute/src/lib.rs index 795a72822d..c05a2e8748 100644 --- a/common/execute/src/lib.rs +++ b/common/execute/src/lib.rs @@ -53,13 +53,13 @@ pub fn execute(attr: TokenStream, item: TokenStream) -> TokenStream { ); let execute_output = quote! { - -> Result + -> Result }; let o_ts = proc_macro::TokenStream::from(execute_output); execute_f.sig.output = parse_macro_input!(o_ts as ReturnType); let simulate_output = quote! { - -> Result + -> Result }; let o_ts = proc_macro::TokenStream::from(simulate_output); simulate_f.sig.output = parse_macro_input!(o_ts as ReturnType); diff --git a/common/mixnode-common/src/verloc/mod.rs b/common/mixnode-common/src/verloc/mod.rs index 21053dd7cc..bf5f5670e4 100644 --- a/common/mixnode-common/src/verloc/mod.rs +++ b/common/mixnode-common/src/verloc/mod.rs @@ -176,7 +176,7 @@ pub struct VerlocMeasurer { // It only does bunch of REST queries. If we update it at some point to a more sophisticated (maybe signing) client, // then it definitely cannot be constructed here and probably will need to be passed from outside, // as mixnodes/gateways would already be using an instance of said client. - validator_client: validator_client::ApiClient, + validator_client: validator_client::NymApiClient, results: AtomicVerlocResult, } @@ -204,7 +204,7 @@ impl VerlocMeasurer { )), shutdown_listener, currently_used_api: 0, - validator_client: validator_client::ApiClient::new(config.nym_api_urls[0].clone()), + validator_client: validator_client::NymApiClient::new(config.nym_api_urls[0].clone()), config, results: AtomicVerlocResult::new(), } diff --git a/common/network-defaults/src/lib.rs b/common/network-defaults/src/lib.rs index 664bfbb117..dd16eb18d7 100644 --- a/common/network-defaults/src/lib.rs +++ b/common/network-defaults/src/lib.rs @@ -1,6 +1,7 @@ // Copyright 2020 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 +use crate::var_names::{DEPRECATED_API_VALIDATOR, DEPRECATED_NYMD_VALIDATOR, NYM_API, NYXD}; use serde::{Deserialize, Serialize}; use std::{env::var, ops::Not, path::PathBuf}; use url::Url; @@ -77,8 +78,8 @@ impl NymNetworkDetails { .expect("denomination exponent is not u32"), }) .with_validator_endpoint(ValidatorDetails::new( - var(var_names::NYMD_VALIDATOR).expect("nymd validator not set"), - Some(var(var_names::API_VALIDATOR).expect("api validator not set")), + var(var_names::NYXD).expect("nyxd validator not set"), + Some(var(var_names::NYM_API).expect("nym api not set")), )) .with_mixnet_contract(Some( var(var_names::MIXNET_CONTRACT_ADDRESS).expect("mixnet contract not set"), @@ -254,7 +255,7 @@ impl DenomDetailsOwned { #[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] pub struct ValidatorDetails { // it is assumed those values are always valid since they're being provided in our defaults file - pub nymd_url: String, + pub nyxd_url: String, // Right now api_url is optional as we are not running the api reliably on all validators // however, later on it should be a mandatory field pub api_url: Option, @@ -262,24 +263,24 @@ pub struct ValidatorDetails { } impl ValidatorDetails { - pub fn new>(nymd_url: S, api_url: Option) -> Self { + pub fn new>(nyxd_url: S, api_url: Option) -> Self { ValidatorDetails { - nymd_url: nymd_url.into(), + nyxd_url: nyxd_url.into(), api_url: api_url.map(Into::into), } } - pub fn new_nymd_only>(nymd_url: S) -> Self { + pub fn new_nyxd_only>(nyxd_url: S) -> Self { ValidatorDetails { - nymd_url: nymd_url.into(), + nyxd_url: nyxd_url.into(), api_url: None, } } - pub fn nymd_url(&self) -> Url { - self.nymd_url + pub fn nyxd_url(&self) -> Url { + self.nyxd_url .parse() - .expect("the provided nymd url is invalid!") + .expect("the provided nyxd url is invalid!") } pub fn api_url(&self) -> Option { @@ -289,6 +290,20 @@ impl ValidatorDetails { } } +fn fix_deprecated_environmental_variables() { + // if we're using the outdated environmental variables, set the updated ones to preserve compatibility + if let Ok(nyxd) = std::env::var(DEPRECATED_NYMD_VALIDATOR) { + if std::env::var(NYXD).is_err() { + std::env::set_var(NYXD, nyxd) + } + } + if let Ok(nym_apis) = std::env::var(DEPRECATED_API_VALIDATOR) { + if std::env::var(NYM_API).is_err() { + std::env::set_var(NYM_API, nym_apis) + } + } +} + pub fn setup_env(config_env_file: Option<&PathBuf>) { match std::env::var(var_names::CONFIGURED) { // if the configuration is not already set in the env vars @@ -296,6 +311,7 @@ pub fn setup_env(config_env_file: Option<&PathBuf>) { if let Some(config_env_file) = config_env_file { dotenv::from_path(config_env_file) .expect("Invalid path to environment configuration file"); + fix_deprecated_environmental_variables(); } else { // if nothing is set, the use mainnet defaults // if the user has not set `CONFIGURED`, then even if they set any of the env variables, @@ -304,7 +320,9 @@ pub fn setup_env(config_env_file: Option<&PathBuf>) { } } Err(_) => crate::mainnet::export_to_env(), - _ => {} + _ => { + fix_deprecated_environmental_variables(); + } } // if we haven't explicitly defined any of the constants, fallback to defaults diff --git a/common/network-defaults/src/mainnet.rs b/common/network-defaults/src/mainnet.rs index ebacd0ff0d..4f8352c1c6 100644 --- a/common/network-defaults/src/mainnet.rs +++ b/common/network-defaults/src/mainnet.rs @@ -26,10 +26,10 @@ pub(crate) const _ETH_ERC20_CONTRACT_ADDRESS: [u8; 20] = pub(crate) const REWARDING_VALIDATOR_ADDRESS: &str = "n10yyd98e2tuwu0f7ypz9dy3hhjw7v772q6287gy"; pub const STATISTICS_SERVICE_DOMAIN_ADDRESS: &str = "https://mainnet-stats.nymte.ch:8090/"; -pub const NYMD_VALIDATOR: &str = "https://rpc.nymtech.net"; -pub const API_VALIDATOR: &str = "https://validator.nymtech.net/api/"; +pub const NYXD_URL: &str = "https://rpc.nymtech.net"; +pub const NYM_API: &str = "https://validator.nymtech.net/api/"; pub(crate) fn validators() -> Vec { - vec![ValidatorDetails::new(NYMD_VALIDATOR, Some(API_VALIDATOR))] + vec![ValidatorDetails::new(NYXD_URL, Some(NYM_API))] } const DEFAULT_SUFFIX: &str = "_MAINNET_DEFAULT"; @@ -97,8 +97,8 @@ pub fn export_to_env() { var_names::STATISTICS_SERVICE_DOMAIN_ADDRESS, STATISTICS_SERVICE_DOMAIN_ADDRESS, ); - set_var_to_default(var_names::NYMD_VALIDATOR, NYMD_VALIDATOR); - set_var_to_default(var_names::API_VALIDATOR, API_VALIDATOR); + set_var_to_default(var_names::NYXD, NYXD_URL); + set_var_to_default(var_names::NYM_API, NYM_API); } pub fn export_to_env_if_not_set() { @@ -141,6 +141,6 @@ pub fn export_to_env_if_not_set() { var_names::STATISTICS_SERVICE_DOMAIN_ADDRESS, STATISTICS_SERVICE_DOMAIN_ADDRESS, ); - set_var_conditionally_to_default(var_names::NYMD_VALIDATOR, NYMD_VALIDATOR); - set_var_conditionally_to_default(var_names::API_VALIDATOR, API_VALIDATOR); + set_var_conditionally_to_default(var_names::NYXD, NYXD_URL); + set_var_conditionally_to_default(var_names::NYM_API, NYM_API); } diff --git a/common/network-defaults/src/var_names.rs b/common/network-defaults/src/var_names.rs index 4e62e444cc..c6e4a450a2 100644 --- a/common/network-defaults/src/var_names.rs +++ b/common/network-defaults/src/var_names.rs @@ -18,5 +18,9 @@ pub const MULTISIG_CONTRACT_ADDRESS: &str = "MULTISIG_CONTRACT_ADDRESS"; pub const COCONUT_DKG_CONTRACT_ADDRESS: &str = "COCONUT_DKG_CONTRACT_ADDRESS"; pub const REWARDING_VALIDATOR_ADDRESS: &str = "REWARDING_VALIDATOR_ADDRESS"; pub const STATISTICS_SERVICE_DOMAIN_ADDRESS: &str = "STATISTICS_SERVICE_DOMAIN_ADDRESS"; -pub const NYMD_VALIDATOR: &str = "NYMD_VALIDATOR"; -pub const API_VALIDATOR: &str = "API_VALIDATOR"; +pub const NYXD: &str = "NYXD"; +pub const NYM_API: &str = "NYM_API"; + +// we don't want to explicitly tag those with `#[deprecated]` because then our CI would be red and sad : ( +pub const DEPRECATED_NYMD_VALIDATOR: &str = "NYMD_VALIDATOR"; +pub const DEPRECATED_API_VALIDATOR: &str = "API_VALIDATOR"; diff --git a/common/types/Cargo.toml b/common/types/Cargo.toml index 54603c02d2..798303d9a8 100644 --- a/common/types/Cargo.toml +++ b/common/types/Cargo.toml @@ -23,7 +23,7 @@ cosmwasm-std = "1.0.0" cosmrs = { git = "https://github.com/neacsu/cosmos-rust", branch = "neacsu/feegrant_support" } validator-client = { path = "../../common/client-libs/validator-client", features = [ - "nymd-client", + "nyxd-client", ] } mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mixnet-contract" } vesting-contract-common = { path = "../../common/cosmwasm-smart-contracts/vesting-contract" } diff --git a/common/types/src/currency.rs b/common/types/src/currency.rs index 38292d11d3..c9ba2e908b 100644 --- a/common/types/src/currency.rs +++ b/common/types/src/currency.rs @@ -9,7 +9,7 @@ use std::collections::HashMap; use std::convert::TryFrom; use std::fmt::{Display, Formatter}; use strum::{Display, EnumString, EnumVariantNames}; -use validator_client::nymd::Coin; +use validator_client::nyxd::Coin; #[cfg(feature = "generate-ts")] use ts_rs::{Dependency, TS}; diff --git a/common/types/src/error.rs b/common/types/src/error.rs index 864a6f6eb2..39248500e2 100644 --- a/common/types/src/error.rs +++ b/common/types/src/error.rs @@ -2,15 +2,15 @@ use serde::{Serialize, Serializer}; use std::io; use thiserror::Error; use validator_client::nym_api::error::NymAPIError; -use validator_client::{nymd::error::NymdError, ValidatorClientError}; +use validator_client::{nyxd::error::NyxdError, ValidatorClientError}; // TODO: ask @MS why this even exists #[derive(Error, Debug)] pub enum TypesError { #[error("{source}")] - NymdError { + NyxdError { #[from] - source: NymdError, + source: NyxdError, }, #[error("{source}")] CosmwasmStd { @@ -90,7 +90,7 @@ impl From for TypesError { match e { ValidatorClientError::NymAPIError { source } => source.into(), ValidatorClientError::MalformedUrlProvided(e) => e.into(), - ValidatorClientError::NymdError(e) => e.into(), + ValidatorClientError::NyxdError(e) => e.into(), ValidatorClientError::NoAPIUrlAvailable => TypesError::NoNymApiUrlConfigured, } } diff --git a/common/types/src/fees.rs b/common/types/src/fees.rs index 747693ce9c..561a1a8e81 100644 --- a/common/types/src/fees.rs +++ b/common/types/src/fees.rs @@ -1,6 +1,6 @@ use crate::currency::DecCoin; use serde::{Deserialize, Serialize}; -use validator_client::nymd::Fee; +use validator_client::nyxd::Fee; #[cfg(feature = "generate-ts")] use ts_rs::{Dependency, TS}; @@ -53,7 +53,7 @@ impl TS for FeeDetails { #[cfg(feature = "generate-ts")] pub mod ts_type_helpers { use serde::{Deserialize, Serialize}; - use validator_client::nymd::GasAdjustment; + use validator_client::nyxd::GasAdjustment; #[derive(Debug, Clone, Serialize, Deserialize, ts_rs::TS)] #[ts(export_to = "ts-packages/types/src/types/rust/Fee.ts")] diff --git a/common/types/src/gas.rs b/common/types/src/gas.rs index 9441008569..23e004293b 100644 --- a/common/types/src/gas.rs +++ b/common/types/src/gas.rs @@ -1,6 +1,6 @@ use cosmrs::tx::Gas as CosmrsGas; use serde::{Deserialize, Serialize}; -use validator_client::nymd::cosmwasm_client::types::GasInfo as ValidatorClientGasInfo; +use validator_client::nyxd::cosmwasm_client::types::GasInfo as ValidatorClientGasInfo; #[cfg_attr(feature = "generate-ts", derive(ts_rs::TS))] #[cfg_attr( diff --git a/common/types/src/transaction.rs b/common/types/src/transaction.rs index b5dd50a4ae..e896f95130 100644 --- a/common/types/src/transaction.rs +++ b/common/types/src/transaction.rs @@ -2,8 +2,8 @@ use crate::currency::DecCoin; use crate::error::TypesError; use crate::gas::{Gas, GasInfo}; use serde::{Deserialize, Serialize}; -use validator_client::nymd::cosmwasm_client::types::ExecuteResult; -use validator_client::nymd::TxResponse; +use validator_client::nyxd::cosmwasm_client::types::ExecuteResult; +use validator_client::nyxd::TxResponse; #[cfg_attr(feature = "generate-ts", derive(ts_rs::TS))] #[cfg_attr( diff --git a/contracts/mixnet/v2-changes.md b/contracts/mixnet/v2-changes.md index ecb290703c..dc09e6784a 100644 --- a/contracts/mixnet/v2-changes.md +++ b/contracts/mixnet/v2-changes.md @@ -898,6 +898,6 @@ As with everything in this module, storage was also completely revamped. The cha ## Final remarks -As mentioned during multiple chats, I think the migration the rest of our codebase is going to be a huge undertaking mostly because of how many aspects of the system this change is affecting. From the top of my head, we'd need to definitely change our `nymd client` (and as a result `validator-api`, `clients`, etc.) and also the vesting contract. +As mentioned during multiple chats, I think the migration the rest of our codebase is going to be a huge undertaking mostly because of how many aspects of the system this change is affecting. From the top of my head, we'd need to definitely change our `nyxd client` (and as a result `validator-api`, `clients`, etc.) and also the vesting contract. With the latter case (and with the current mixnet contract), it's going to be even trickier given that the current contract is already live. We will need to adjust how the values are stored, i.e. mixnodes are now indexed by `NodeId` as opposed to `IdentityKey`. My recommendation would be to create a migration such that it would "cancel" / "return" (you name it) all existing delegations and bonds so that the users would have to make new ones under the new contract. diff --git a/docker-compose.yml b/docker-compose.yml index 6c756e2ebd..7108925d69 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,7 +18,7 @@ services: container_name: genesis_validator volumes: - "genesis_volume:/genesis_volume" - - "genesis_nymd:/root/.nymd" + - "genesis_nyxd:/root/.nyxd" environment: *NETWORK networks: localnet: @@ -34,7 +34,7 @@ services: - "2317:1317" volumes: - "genesis_volume:/genesis_volume" - - "secondary_nymd:/root/.nymd" + - "secondary_nyxd:/root/.nyxd" environment: *NETWORK networks: localnet: @@ -120,8 +120,8 @@ services: volumes: genesis_volume: - genesis_nymd: - secondary_nymd: + genesis_nyxd: + secondary_nyxd: # contract_volume: # mongo_data: diff --git a/docker/validator/init_and_start.sh b/docker/validator/init_and_start.sh index 722e7224d2..a1e8820fbc 100755 --- a/docker/validator/init_and_start.sh +++ b/docker/validator/init_and_start.sh @@ -7,39 +7,39 @@ cd /root if [ "$1" = "genesis" ]; then if [ ! -f "/root/.nymd/config/genesis.json" ]; then - ./nymd init nymnet --chain-id nymnet 2> /dev/null + ./nyxd init nymnet --chain-id nymnet 2> /dev/null # staking/governance token is hardcoded in config, change this - sed -i "s/\"stake\"/\"u${STAKE_DENOM}\"/" /root/.nymd/config/genesis.json - sed -i 's/minimum-gas-prices = ""/minimum-gas-prices = "0.025u'"${DENOM}"'"/' /root/.nymd/config/app.toml - sed -i '0,/enable = false/s//enable = true/g' /root/.nymd/config/app.toml - sed -i 's/cors_allowed_origins = \[\]/cors_allowed_origins = \["*"\]/' /root/.nymd/config/config.toml - sed -i 's/create_empty_blocks = true/create_empty_blocks = false/' /root/.nymd/config/config.toml - sed -i 's/laddr = "tcp:\/\/127.0.0.1:26657"/laddr = "tcp:\/\/0.0.0.0:26657"/' /root/.nymd/config/config.toml + sed -i "s/\"stake\"/\"u${STAKE_DENOM}\"/" /root/.nyxd/config/genesis.json + sed -i 's/minimum-gas-prices = ""/minimum-gas-prices = "0.025u'"${DENOM}"'"/' /root/.nyxd/config/app.toml + sed -i '0,/enable = false/s//enable = true/g' /root/.nyxd/config/app.toml + sed -i 's/cors_allowed_origins = \[\]/cors_allowed_origins = \["*"\]/' /root/.nyxd/config/config.toml + sed -i 's/create_empty_blocks = true/create_empty_blocks = false/' /root/.nyxd/config/config.toml + sed -i 's/laddr = "tcp:\/\/127.0.0.1:26657"/laddr = "tcp:\/\/0.0.0.0:26657"/' /root/.nyxd/config/config.toml # create accounts - yes "${PASSPHRASE}" | ./nymd keys add node_admin 2>&1 >/dev/null | tail -n 1 > /root/.nymd/mnemonic - yes "${PASSPHRASE}" | ./nymd keys add secondary 2>&1 >/dev/null | tail -n 1 > /root/.nymd/secondary_mnemonic - cp /root/.nymd/mnemonic /genesis_volume/genesis_mnemonic - cp /root/.nymd/secondary_mnemonic /genesis_volume/secondary_mnemonic + yes "${PASSPHRASE}" | ./nyxd keys add node_admin 2>&1 >/dev/null | tail -n 1 > /root/.nyxd/mnemonic + yes "${PASSPHRASE}" | ./nyxd keys add secondary 2>&1 >/dev/null | tail -n 1 > /root/.nyxd/secondary_mnemonic + cp /root/.nyxd/mnemonic /genesis_volume/genesis_mnemonic + cp /root/.nyxd/secondary_mnemonic /genesis_volume/secondary_mnemonic # add genesis accounts with some initial tokens - GENESIS_ADDRESS=$(yes "${PASSPHRASE}" | ./nymd keys show node_admin -a) - SECONDARY_ADDRESS=$(yes "${PASSPHRASE}" | ./nymd keys show secondary -a) - yes "${PASSPHRASE}" | ./nymd add-genesis-account "${GENESIS_ADDRESS}" 1000000000000000u"${DENOM}",1000000000000000u"${STAKE_DENOM}" - yes "${PASSPHRASE}" | ./nymd add-genesis-account "${SECONDARY_ADDRESS}" 1000000000000000u"${DENOM}",1000000000000000u"${STAKE_DENOM}" + GENESIS_ADDRESS=$(yes "${PASSPHRASE}" | ./nyxd keys show node_admin -a) + SECONDARY_ADDRESS=$(yes "${PASSPHRASE}" | ./nyxd keys show secondary -a) + yes "${PASSPHRASE}" | ./nyxd add-genesis-account "${GENESIS_ADDRESS}" 1000000000000000u"${DENOM}",1000000000000000u"${STAKE_DENOM}" + yes "${PASSPHRASE}" | ./nyxd add-genesis-account "${SECONDARY_ADDRESS}" 1000000000000000u"${DENOM}",1000000000000000u"${STAKE_DENOM}" - yes "${PASSPHRASE}" | ./nymd gentx node_admin 1000000000u"${STAKE_DENOM}" --chain-id nymnet 2> /dev/null - ./nymd collect-gentxs 2> /dev/null - ./nymd validate-genesis > /dev/null - cp /root/.nymd/config/genesis.json /genesis_volume/genesis.json + yes "${PASSPHRASE}" | ./nyxd gentx node_admin 1000000000u"${STAKE_DENOM}" --chain-id nymnet 2> /dev/null + ./nyxd collect-gentxs 2> /dev/null + ./nyxd validate-genesis > /dev/null + cp /root/.nyxd/config/genesis.json /genesis_volume/genesis.json else echo "Validator already initialized, starting with the existing configuration." echo "If you want to re-init the validator, destroy the existing container" fi - ./nymd start + ./nyxd start elif [ "$1" = "secondary" ]; then if [ ! -f "/root/.nymd/config/genesis.json" ]; then - ./nymd init nymnet --chain-id nym-secondary 2> /dev/null + ./nyxd init nymnet --chain-id nym-secondary 2> /dev/null # Wait until the genesis node writes the genesis.json to the shared volume while ! [ -s /genesis_volume/genesis.json ]; do @@ -49,29 +49,29 @@ elif [ "$1" = "secondary" ]; then # wait for the actual validator to start up sleep 5 - cp /genesis_volume/genesis.json /root/.nymd/config/genesis.json - GENESIS_PEER=$(cat /root/.nymd/config/genesis.json | grep '"memo"' | cut -d'"' -f 4) - GENESIS_IP=$(cat /root/.nymd/config/genesis.json | grep '"memo"' | cut -d'@' -f2 | cut -d: -f1) - sed -i 's/persistent_peers = ""/persistent_peers = "'"${GENESIS_PEER}"'"/' /root/.nymd/config/config.toml - sed -i 's/minimum-gas-prices = ""/minimum-gas-prices = "0.025u'"${BECH32_PREFIX}"'"/' /root/.nymd/config/app.toml - sed -i '0,/enable = false/s//enable = true/g' /root/.nymd/config/app.toml - sed -i 's/cors_allowed_origins = \[\]/cors_allowed_origins = \["*"\]/' /root/.nymd/config/config.toml - sed -i 's/create_empty_blocks = true/create_empty_blocks = false/' /root/.nymd/config/config.toml - sed -i 's/laddr = "tcp:\/\/127.0.0.1:26657"/laddr = "tcp:\/\/0.0.0.0:26657"/' /root/.nymd/config/config.toml + cp /genesis_volume/genesis.json /root/.nyxd/config/genesis.json + GENESIS_PEER=$(cat /root/.nyxd/config/genesis.json | grep '"memo"' | cut -d'"' -f 4) + GENESIS_IP=$(cat /root/.nyxd/config/genesis.json | grep '"memo"' | cut -d'@' -f2 | cut -d: -f1) + sed -i 's/persistent_peers = ""/persistent_peers = "'"${GENESIS_PEER}"'"/' /root/.nyxd/config/config.toml + sed -i 's/minimum-gas-prices = ""/minimum-gas-prices = "0.025u'"${BECH32_PREFIX}"'"/' /root/.nyxd/config/app.toml + sed -i '0,/enable = false/s//enable = true/g' /root/.nyxd/config/app.toml + sed -i 's/cors_allowed_origins = \[\]/cors_allowed_origins = \["*"\]/' /root/.nyxd/config/config.toml + sed -i 's/create_empty_blocks = true/create_empty_blocks = false/' /root/.nyxd/config/config.toml + sed -i 's/laddr = "tcp:\/\/127.0.0.1:26657"/laddr = "tcp:\/\/0.0.0.0:26657"/' /root/.nyxd/config/config.toml # import mnemonic generated by the genesis validator (have a local copy for ease of use) - cp /genesis_volume/secondary_mnemonic /root/.nymd/mnemonic - { cat /root/.nymd/mnemonic; echo "${PASSPHRASE}"; echo "${PASSPHRASE}"; } | ./nymd keys add node_admin --recover #> /dev/null - ./nymd validate-genesis > /dev/null + cp /genesis_volume/secondary_mnemonic /root/.nyxd/mnemonic + { cat /root/.nyxd/mnemonic; echo "${PASSPHRASE}"; echo "${PASSPHRASE}"; } | ./nyxd keys add node_admin --recover #> /dev/null + ./nyxd validate-genesis > /dev/null # create validator # don't even ask about those sleeps... - { echo "${PASSPHRASE}"; sleep 10; yes; sleep 10; } | ./nymd tx staking create-validator --amount=10000000u"${STAKE_DENOM}" --fees 100000u"${DENOM}" --pubkey="$(./nymd tendermint show-validator)" --moniker="secondary" --commission-rate="0.10" --commission-max-rate="0.20" --commission-max-change-rate="0.01" --min-self-delegation="1" --chain-id=nymnet --from=node_admin -b async --node http://"${GENESIS_IP}":26657 + { echo "${PASSPHRASE}"; sleep 10; yes; sleep 10; } | ./nyxd tx staking create-validator --amount=10000000u"${STAKE_DENOM}" --fees 100000u"${DENOM}" --pubkey="$(./nyxd tendermint show-validator)" --moniker="secondary" --commission-rate="0.10" --commission-max-rate="0.20" --commission-max-change-rate="0.01" --min-self-delegation="1" --chain-id=nymnet --from=node_admin -b async --node http://"${GENESIS_IP}":26657 else echo "Validator already initialized, starting with the existing configuration." echo "If you want to re-init the validator, destroy the existing container" fi - ./nymd start + ./nyxd start else echo "Wrong command. Usage: ./$0 [genesis/secondary]" fi diff --git a/docker/validator/setup.sh b/docker/validator/setup.sh index efd40f0e14..4b176fb04e 100755 --- a/docker/validator/setup.sh +++ b/docker/validator/setup.sh @@ -8,7 +8,7 @@ git checkout "${WASMD_VERSION}" WASMD_COMMIT_HASH=$(git rev-parse HEAD) mkdir build go build \ - -o build/nymd -mod=readonly -tags "netgo,ledger" \ + -o build/nyxd -mod=readonly -tags "netgo,ledger" \ -ldflags "-X github.com/cosmos/cosmos-sdk/version.Name=nymd \ -X github.com/cosmos/cosmos-sdk/version.AppName=nymd \ -X github.com/CosmWasm/wasmd/app.NodeDir=.nymd \ diff --git a/envs/mainnet.env b/envs/mainnet.env index 751081adb8..3a8ec4b17c 100644 --- a/envs/mainnet.env +++ b/envs/mainnet.env @@ -17,5 +17,5 @@ MULTISIG_CONTRACT_ADDRESS=n19lc9u84cz0yz3fww5283nucc9yvr8gsjmgeul0 COCONUT_DKG_CONTRACT_ADDRESS=n19lc9u84cz0yz3fww5283nucc9yvr8gsjmgeul0 REWARDING_VALIDATOR_ADDRESS=n10yyd98e2tuwu0f7ypz9dy3hhjw7v772q6287gy STATISTICS_SERVICE_DOMAIN_ADDRESS="https://mainnet-stats.nymte.ch:8090" -NYMD_VALIDATOR="https://rpc.nymtech.net"; +nyxd_VALIDATOR="https://rpc.nymtech.net"; API_VALIDATOR="https://validator.nymtech.net/api/" diff --git a/envs/qa-qwerty.env b/envs/qa-qwerty.env index 3f37a02385..6bb6895d72 100644 --- a/envs/qa-qwerty.env +++ b/envs/qa-qwerty.env @@ -17,5 +17,5 @@ MULTISIG_CONTRACT_ADDRESS=n14krxe8ukzagwhvec0rmteexu62w8k9kp9sra9ww6em2hnmzcukqs COCONUT_DKG_CONTRACT_ADDRESS=n1rl5n6cxuz2hdy3f7d9hsnw8zn0zwwwr0r4dxfz7tktgpgkcnz9zshmvksc REWARDING_VALIDATOR_ADDRESS=n10yyd98e2tuwu0f7ypz9dy3hhjw7v772q6287gy STATISTICS_SERVICE_DOMAIN_ADDRESS="https://mainnet-stats.nymte.ch:8090" -NYMD_VALIDATOR="https://qwerty-validator.qa.nymte.ch/" +NYXD_VALIDATOR="https://qwerty-validator.qa.nymte.ch/" API_VALIDATOR="https://qwerty-validator-api.qa.nymte.ch/api" diff --git a/envs/qa.env b/envs/qa.env index 64511fa922..999850f798 100644 --- a/envs/qa.env +++ b/envs/qa.env @@ -17,5 +17,5 @@ MULTISIG_CONTRACT_ADDRESS=n17p9rzwnnfxcjp32un9ug7yhhzgtkhvl988qccs COCONUT_DKG_CONTRACT_ADDRESS=n17p9rzwnnfxcjp32un9ug7yhhzgtkhvl988qccs REWARDING_VALIDATOR_ADDRESS=n1tfzd4qz3a45u8p4mr5zmzv66457uwjgcl05jdq STATISTICS_SERVICE_DOMAIN_ADDRESS="http://0.0.0.0" -NYMD_VALIDATOR="https://qa-validator.nymtech.net" +NYXD_VALIDATOR="https://qa-validator.nymtech.net" API_VALIDATOR="https://qa-validator-api.nymtech.net/api" diff --git a/explorer-api/Cargo.toml b/explorer-api/Cargo.toml index 8832f18372..129423cf7f 100644 --- a/explorer-api/Cargo.toml +++ b/explorer-api/Cargo.toml @@ -34,4 +34,4 @@ contracts-common = { path = "../common/cosmwasm-smart-contracts/contracts-common network-defaults = { path = "../common/network-defaults" } logging = { path = "../common/logging"} task = { path = "../common/task" } -validator-client = { path = "../common/client-libs/validator-client", features=["nymd-client"] } +validator-client = { path = "../common/client-libs/validator-client", features=["nyxd-client"] } diff --git a/explorer-api/src/client.rs b/explorer-api/src/client.rs index 717a0800e5..ca9449f971 100644 --- a/explorer-api/src/client.rs +++ b/explorer-api/src/client.rs @@ -1,10 +1,10 @@ use network_defaults::{ - var_names::{API_VALIDATOR, NYMD_VALIDATOR}, + var_names::{NYM_API, NYXD}, NymNetworkDetails, }; use reqwest::Url; use std::{str::FromStr, sync::Arc}; -use validator_client::nymd::QueryNymdClient; +use validator_client::nyxd::QueryNyxdClient; // since this is just a query client, we don't need any locking mechanism to keep sequence numbers in check // nor we need to access any of its methods taking mutable reference (like updating api URL) @@ -12,7 +12,7 @@ use validator_client::nymd::QueryNymdClient; #[derive(Clone)] pub(crate) struct ThreadsafeValidatorClient( - pub(crate) Arc>, + pub(crate) Arc>, ); impl ThreadsafeValidatorClient { @@ -26,17 +26,17 @@ impl ThreadsafeValidatorClient { } pub(crate) fn new_validator_client() -> ThreadsafeValidatorClient { - let nymd_url = Url::from_str(&std::env::var(NYMD_VALIDATOR).expect("nymd validator not set")) - .expect("nymd validator not in url format"); - let api_url = Url::from_str(&std::env::var(API_VALIDATOR).expect("nymd validator not set")) - .expect("nymd validator not in url format"); + let nyxd_url = Url::from_str(&std::env::var(NYXD).expect("nyxd validator not set")) + .expect("nyxd validator not in url format"); + let api_url = Url::from_str(&std::env::var(NYM_API).expect("nyxd validator not set")) + .expect("nyxd validator not in url format"); let details = NymNetworkDetails::new_from_env(); let client_config = validator_client::Config::try_from_nym_network_details(&details) .expect("failed to construct valid validator client config with the provided network") - .with_urls(nymd_url, api_url); + .with_urls(nyxd_url, api_url); ThreadsafeValidatorClient(Arc::new( - validator_client::Client::new_query(client_config).expect("Failed to connect to nymd!"), + validator_client::Client::new_query(client_config).expect("Failed to connect to nyxd!"), )) } diff --git a/explorer-api/src/mix_node/delegations.rs b/explorer-api/src/mix_node/delegations.rs index 3d061c942a..00c55446e8 100644 --- a/explorer-api/src/mix_node/delegations.rs +++ b/explorer-api/src/mix_node/delegations.rs @@ -12,7 +12,7 @@ pub(crate) async fn get_single_mixnode_delegations( ) -> Vec { match client .0 - .get_all_nymd_single_mixnode_delegations(mix_id) + .get_all_nyxd_single_mixnode_delegations(mix_id) .await { Ok(result) => result, diff --git a/explorer-api/src/tasks.rs b/explorer-api/src/tasks.rs index b7e72f72d2..6452405761 100644 --- a/explorer-api/src/tasks.rs +++ b/explorer-api/src/tasks.rs @@ -6,8 +6,8 @@ use std::future::Future; use mixnet_contract_common::GatewayBond; use task::TaskClient; use validator_client::models::MixNodeBondAnnotated; -use validator_client::nymd::error::NymdError; -use validator_client::nymd::{Paging, QueryNymdClient, ValidatorResponse}; +use validator_client::nyxd::error::NyxdError; +use validator_client::nyxd::{Paging, QueryNyxdClient, ValidatorResponse}; use validator_client::ValidatorClientError; use crate::mix_nodes::CACHE_REFRESH_RATE; @@ -26,7 +26,7 @@ impl ExplorerApiTasks { // a helper to remove duplicate code when grabbing active/rewarded/all mixnodes async fn retrieve_mixnodes<'a, F, Fut>(&'a self, f: F) -> Vec where - F: FnOnce(&'a validator_client::Client) -> Fut, + F: FnOnce(&'a validator_client::Client) -> Fut, Fut: Future, ValidatorClientError>>, { let bonds = match f(&self.state.inner.validator_client.0).await { @@ -57,14 +57,14 @@ impl ExplorerApiTasks { .await } - async fn retrieve_all_validators(&self) -> Result { + async fn retrieve_all_validators(&self) -> Result { info!("About to retrieve all validators..."); let height = self .state .inner .validator_client .0 - .nymd + .nyxd .get_current_block_height() .await?; let response: ValidatorResponse = self @@ -72,7 +72,7 @@ impl ExplorerApiTasks { .inner .validator_client .0 - .nymd + .nyxd .get_validators(height.value(), Paging::All) .await?; info!("Fetched {} validators", response.validators.len()); diff --git a/explorer-api/src/validators/models.rs b/explorer-api/src/validators/models.rs index cc68b58f40..a66052fbbb 100644 --- a/explorer-api/src/validators/models.rs +++ b/explorer-api/src/validators/models.rs @@ -6,7 +6,7 @@ use std::sync::Arc; use serde::Serialize; use tokio::sync::RwLock; -use validator_client::nymd::ValidatorResponse; +use validator_client::nyxd::ValidatorResponse; use crate::cache::Cache; diff --git a/gateway/Cargo.toml b/gateway/Cargo.toml index 8dbe55f59d..c75feb9ed2 100644 --- a/gateway/Cargo.toml +++ b/gateway/Cargo.toml @@ -68,7 +68,7 @@ pemstore = { path = "../common/pemstore" } statistics-common = { path = "../common/statistics" } nym-api-requests = { path = "../nym-api/nym-api-requests" } validator-client = { path = "../common/client-libs/validator-client", features = [ - "nymd-client", + "nyxd-client", ] } version-checker = { path = "../common/version-checker" } diff --git a/gateway/src/commands/init.rs b/gateway/src/commands/init.rs index 6bd9ca1d84..a0fe45f914 100644 --- a/gateway/src/commands/init.rs +++ b/gateway/src/commands/init.rs @@ -10,7 +10,7 @@ use config::NymConfig; use crypto::asymmetric::{encryption, identity}; use std::net::IpAddr; use std::path::PathBuf; -use validator_client::nymd; +use validator_client::nyxd; #[derive(Args, Clone)] pub struct Init { @@ -24,7 +24,7 @@ pub struct Init { /// The wallet address you will use to bond this gateway, e.g. nymt1z9egw0knv47nmur0p8vk4rcx59h9gg4zuxrrr9 #[clap(long)] - wallet_address: nymd::AccountId, + wallet_address: nyxd::AccountId, /// The port on which the gateway will be listening for sphinx packets #[clap(long)] @@ -50,9 +50,14 @@ pub struct Init { /// Comma separated list of endpoints of the validator #[cfg(feature = "coconut")] - #[clap(long, alias = "validators", value_delimiter = ',')] + #[clap( + long, + alias = "validators", + alias = "nymd_validators", + value_delimiter = ',' + )] // the alias here is included for backwards compatibility (1.1.4 and before) - nymd_validators: Option>, + nyxd_urls: Option>, /// Cosmos wallet mnemonic needed for double spending protection #[clap(long)] @@ -89,7 +94,7 @@ impl From for OverrideConfig { statistics_service_url: init_config.statistics_service_url, #[cfg(feature = "coconut")] - nymd_validators: init_config.nymd_validators, + nyxd_urls: init_config.nyxd_urls, #[cfg(feature = "coconut")] only_coconut_credentials: init_config.only_coconut_credentials, } @@ -178,7 +183,7 @@ mod tests { statistics_service_url: None, enabled_statistics: None, #[cfg(feature = "coconut")] - nymd_validators: None, + nyxd_urls: None, #[cfg(feature = "coconut")] only_coconut_credentials: false, }; diff --git a/gateway/src/commands/mod.rs b/gateway/src/commands/mod.rs index 61f39b7bb5..e5139187ba 100644 --- a/gateway/src/commands/mod.rs +++ b/gateway/src/commands/mod.rs @@ -9,12 +9,12 @@ use completions::{fig_generate, ArgShell}; use crypto::bech32_address_validation; use network_defaults::mainnet::read_var_if_not_default; use network_defaults::var_names::{ - API_VALIDATOR, BECH32_PREFIX, CONFIGURED, STATISTICS_SERVICE_DOMAIN_ADDRESS, + BECH32_PREFIX, CONFIGURED, NYM_API, STATISTICS_SERVICE_DOMAIN_ADDRESS, }; use std::net::IpAddr; use std::path::PathBuf; use std::process; -use validator_client::nymd::{self}; +use validator_client::nyxd::{self}; pub(crate) mod init; pub(crate) mod node_details; @@ -49,7 +49,7 @@ pub(crate) enum Commands { // Configuration that can be overridden. pub(crate) struct OverrideConfig { host: Option, - wallet_address: Option, + wallet_address: Option, mix_port: Option, clients_port: Option, datastore: Option, @@ -60,7 +60,7 @@ pub(crate) struct OverrideConfig { mnemonic: Option, #[cfg(feature = "coconut")] - nymd_validators: Option>, + nyxd_urls: Option>, #[cfg(feature = "coconut")] only_coconut_credentials: bool, } @@ -120,7 +120,7 @@ pub(crate) fn override_config(mut config: Config, args: OverrideConfig) -> Confi if let Some(nym_apis) = args.nym_apis { config = config.with_custom_nym_apis(nym_apis); } else if std::env::var(CONFIGURED).is_ok() { - if let Some(raw_validators) = read_var_if_not_default(API_VALIDATOR) { + if let Some(raw_validators) = read_var_if_not_default(NYM_API) { config = config.with_custom_nym_apis(::config::parse_urls(&raw_validators)) } } @@ -141,13 +141,13 @@ pub(crate) fn override_config(mut config: Config, args: OverrideConfig) -> Confi #[cfg(feature = "coconut")] { - use network_defaults::var_names::NYMD_VALIDATOR; + use network_defaults::var_names::NYXD; - if let Some(nymd_validators) = args.nymd_validators { - config = config.with_custom_validator_nymd(nymd_validators); + if let Some(nyxd_urls) = args.nyxd_urls { + config = config.with_custom_validator_nyxd(nyxd_urls); } else if std::env::var(CONFIGURED).is_ok() { - if let Some(raw_validators) = read_var_if_not_default(NYMD_VALIDATOR) { - config = config.with_custom_validator_nymd(::config::parse_urls(&raw_validators)) + if let Some(raw_validators) = read_var_if_not_default(NYXD) { + config = config.with_custom_validator_nyxd(::config::parse_urls(&raw_validators)) } } config = config.with_only_coconut_credentials(args.only_coconut_credentials); diff --git a/gateway/src/commands/run.rs b/gateway/src/commands/run.rs index c3ceb04b57..b80de51123 100644 --- a/gateway/src/commands/run.rs +++ b/gateway/src/commands/run.rs @@ -10,7 +10,7 @@ use config::NymConfig; use log::*; use std::net::IpAddr; use std::path::PathBuf; -use validator_client::nymd; +use validator_client::nyxd; #[derive(Args, Clone)] pub struct Run { @@ -24,7 +24,7 @@ pub struct Run { /// The wallet address you will use to bond this gateway, e.g. nymt1z9egw0knv47nmur0p8vk4rcx59h9gg4zuxrrr9 #[clap(long)] - wallet_address: Option, + wallet_address: Option, /// The port on which the gateway will be listening for sphinx packets #[clap(long)] @@ -50,9 +50,14 @@ pub struct Run { /// Comma separated list of endpoints of the validator #[cfg(feature = "coconut")] - #[clap(long, alias = "validators", value_delimiter = ',')] + #[clap( + long, + alias = "validators", + alias = "nymd_validators", + value_delimiter = ',' + )] // the alias here is included for backwards compatibility (1.1.4 and before) - nymd_validators: Option>, + nyxd_urls: Option>, /// Cosmos wallet mnemonic #[clap(long)] @@ -89,7 +94,7 @@ impl From for OverrideConfig { statistics_service_url: run_config.statistics_service_url, #[cfg(feature = "coconut")] - nymd_validators: run_config.nymd_validators, + nyxd_urls: run_config.nyxd_urls, #[cfg(feature = "coconut")] only_coconut_credentials: run_config.only_coconut_credentials, } diff --git a/gateway/src/commands/sign.rs b/gateway/src/commands/sign.rs index 63052c6084..c04d937e2c 100644 --- a/gateway/src/commands/sign.rs +++ b/gateway/src/commands/sign.rs @@ -11,7 +11,7 @@ use clap::{ArgGroup, Args}; use config::NymConfig; use crypto::asymmetric::identity; use log::error; -use validator_client::nymd; +use validator_client::nyxd; #[derive(Args, Clone)] #[clap(group(ArgGroup::new("sign").required(true).args(&["wallet_address", "text"])))] @@ -22,7 +22,7 @@ pub struct Sign { /// Signs your blockchain address with your identity key #[clap(long)] - wallet_address: Option, + wallet_address: Option, /// Signs an arbitrary piece of text with your identity key #[clap(long)] @@ -31,7 +31,7 @@ pub struct Sign { enum SignedTarget { Text(String), - Address(nymd::AccountId), + Address(nyxd::AccountId), } impl TryFrom for SignedTarget { @@ -60,7 +60,7 @@ pub fn load_identity_keys(pathfinder: &GatewayPathfinder) -> identity::KeyPair { identity_keypair } -fn print_signed_address(private_key: &identity::PrivateKey, wallet_address: nymd::AccountId) { +fn print_signed_address(private_key: &identity::PrivateKey, wallet_address: nyxd::AccountId) { // perform extra validation to ensure we have correct prefix validate_bech32_address_or_exit(wallet_address.as_ref()); diff --git a/gateway/src/config/mod.rs b/gateway/src/config/mod.rs index e2c863f34e..f4211ee56a 100644 --- a/gateway/src/config/mod.rs +++ b/gateway/src/config/mod.rs @@ -4,14 +4,14 @@ use crate::config::template::config_template; use config::defaults::{DEFAULT_CLIENT_LISTENING_PORT, DEFAULT_MIX_LISTENING_PORT}; use config::NymConfig; -use network_defaults::mainnet::{API_VALIDATOR, NYMD_VALIDATOR, STATISTICS_SERVICE_DOMAIN_ADDRESS}; +use network_defaults::mainnet::{NYM_API, NYXD_URL, STATISTICS_SERVICE_DOMAIN_ADDRESS}; use serde::{Deserialize, Serialize}; use std::net::IpAddr; use std::path::PathBuf; use std::str::FromStr; use std::time::Duration; use url::Url; -use validator_client::nymd; +use validator_client::nyxd; pub mod persistence; mod template; @@ -150,8 +150,8 @@ impl Config { } #[cfg(feature = "coconut")] - pub fn with_custom_validator_nymd(mut self, validator_nymd_urls: Vec) -> Self { - self.gateway.validator_nymd_urls = validator_nymd_urls; + pub fn with_custom_validator_nyxd(mut self, validator_nyxd_urls: Vec) -> Self { + self.gateway.nyxd_urls = validator_nyxd_urls; self } @@ -195,7 +195,7 @@ impl Config { self } - pub fn with_wallet_address(mut self, wallet_address: nymd::AccountId) -> Self { + pub fn with_wallet_address(mut self, wallet_address: nyxd::AccountId) -> Self { self.gateway.wallet_address = Some(wallet_address); self } @@ -238,8 +238,8 @@ impl Config { } #[cfg(feature = "coconut")] - pub fn get_validator_nymd_endpoints(&self) -> Vec { - self.gateway.validator_nymd_urls.clone() + pub fn get_nyxd_urls(&self) -> Vec { + self.gateway.nyxd_urls.clone() } #[cfg(feature = "coconut")] @@ -295,7 +295,7 @@ impl Config { &self.gateway.version } - pub fn get_wallet_address(&self) -> Option { + pub fn get_wallet_address(&self) -> Option { self.gateway.wallet_address.clone() } } @@ -346,17 +346,19 @@ pub struct Gateway { /// Path to file containing public sphinx key. public_sphinx_key_file: PathBuf, - /// Wheather gateway collects and sends anonymized statistics + /// Whether gateway collects and sends anonymized statistics enabled_statistics: bool, /// Domain address of the statistics service statistics_service_url: Url, /// Addresses to APIs from which the node gets the view of the network. + #[serde(alias = "validator_api_urls")] nym_api_urls: Vec, /// Addresses to validators which the node uses to check for double spending of ERC20 tokens. - validator_nymd_urls: Vec, + #[serde(alias = "validator_nymd_urls")] + nyxd_urls: Vec, /// Mnemonic of a cosmos wallet used in checking for double spending. cosmos_mnemonic: bip39::Mnemonic, @@ -371,7 +373,7 @@ pub struct Gateway { /// The Cosmos wallet address that will control this gateway // the only reason this is an Option is because of the lack of existence of a sane default value - wallet_address: Option, + wallet_address: Option, } impl Gateway { @@ -412,8 +414,8 @@ impl Default for Gateway { public_sphinx_key_file: Default::default(), enabled_statistics: false, statistics_service_url: Url::from_str(STATISTICS_SERVICE_DOMAIN_ADDRESS).expect("Invalid default statistics service URL"), - nym_api_urls: vec![Url::from_str(API_VALIDATOR).expect("Invalid default API URL")], - validator_nymd_urls: vec![Url::from_str(NYMD_VALIDATOR).expect("Invalid default nymd URL")], + nym_api_urls: vec![Url::from_str(NYM_API).expect("Invalid default API URL")], + nyxd_urls: vec![Url::from_str(NYXD_URL).expect("Invalid default nyxd URL")], cosmos_mnemonic: bip39::Mnemonic::from_str("exact antique hybrid width raise anchor puzzle degree fee quit long crack net vague hip despair write put useless civil mechanic broom music day").unwrap(), nym_root_directory: Config::default_root_directory(), persistent_storage: Default::default(), diff --git a/gateway/src/config/template.rs b/gateway/src/config/template.rs index 0d1759e820..2690c38385 100644 --- a/gateway/src/config/template.rs +++ b/gateway/src/config/template.rs @@ -66,9 +66,9 @@ nym_api_urls = [ {{/each}} ] -# Addresses to validators which the node uses to check for double spending of ERC20 tokens. -validator_nymd_urls = [ - {{#each gateway.validator_nymd_urls }} +# Addresses to validators which the node uses to check for double spending of nym tokens. +nyxd_urls = [ + {{#each gateway.nyxd_urls }} '{{this}}', {{/each}} ] diff --git a/gateway/src/node/client_handling/websocket/connection_handler/authenticated.rs b/gateway/src/node/client_handling/websocket/connection_handler/authenticated.rs index 40ca0d7715..38036741ce 100644 --- a/gateway/src/node/client_handling/websocket/connection_handler/authenticated.rs +++ b/gateway/src/node/client_handling/websocket/connection_handler/authenticated.rs @@ -48,8 +48,8 @@ pub(crate) enum RequestHandlingError { #[error("This gateway is only accepting coconut credentials for bandwidth")] OnlyCoconutCredentials, - #[error("Nymd Error - {0}")] - NymdError(#[from] validator_client::nymd::error::NymdError), + #[error("Nyxd Error - {0}")] + NyxdError(#[from] validator_client::nyxd::error::NyxdError), #[cfg(feature = "coconut")] #[error("Validator API error - {0}")] diff --git a/gateway/src/node/client_handling/websocket/connection_handler/coconut.rs b/gateway/src/node/client_handling/websocket/connection_handler/coconut.rs index ba53fe4dbd..4f12446330 100644 --- a/gateway/src/node/client_handling/websocket/connection_handler/coconut.rs +++ b/gateway/src/node/client_handling/websocket/connection_handler/coconut.rs @@ -7,10 +7,10 @@ use log::*; use coconut_interface::{Credential, VerificationKey}; use validator_client::{ - nymd::{ + nyxd::{ cosmwasm_client::logs::{find_attribute, BANDWIDTH_PROPOSAL_ID}, traits::{CoconutBandwidthSigningClient, MultisigQueryClient, MultisigSigningClient}, - Coin, Fee, SigningNymdClient, + Coin, Fee, SigningNyxdClient, }, Client, CoconutApiClient, }; @@ -22,7 +22,7 @@ const MAX_FEEGRANT_UNYM: u128 = 10000; pub(crate) struct CoconutVerifier { nym_api_clients: Vec, - nymd_client: Client, + nyxd_client: Client, mix_denom_base: String, aggregated_verification_key: VerificationKey, } @@ -30,7 +30,7 @@ pub(crate) struct CoconutVerifier { impl CoconutVerifier { pub fn new( api_clients: Vec, - nymd_client: Client, + nyxd_client: Client, mix_denom_base: String, aggregated_verification_key: VerificationKey, ) -> Result { @@ -42,7 +42,7 @@ impl CoconutVerifier { } Ok(CoconutVerifier { nym_api_clients: api_clients, - nymd_client, + nyxd_client, mix_denom_base, aggregated_verification_key, }) @@ -58,15 +58,15 @@ impl CoconutVerifier { let revoke_fee = Some(Fee::Auto(Some(1.5))); let res = self - .nymd_client - .nymd + .nyxd_client + .nyxd .spend_credential( Coin::new( credential.voucher_value().into(), self.mix_denom_base.clone(), ), credential.blinded_serial_number(), - self.nymd_client.nymd.address().to_string(), + self.nyxd_client.nyxd.address().to_string(), None, ) .await?; @@ -80,7 +80,7 @@ impl CoconutVerifier { reason: String::from("proposal id could not be parsed to u64"), })?; - let proposal = self.nymd_client.nymd.get_proposal(proposal_id).await?; + let proposal = self.nyxd_client.nyxd.get_proposal(proposal_id).await?; if !credential.has_blinded_serial_number(&proposal.description)? { return Err(RequestHandlingError::ProposalIdError { reason: String::from("proposal has different serial number"), @@ -90,11 +90,11 @@ impl CoconutVerifier { let req = nym_api_requests::coconut::VerifyCredentialBody::new( credential.clone(), proposal_id, - self.nymd_client.nymd.address().clone(), + self.nyxd_client.nyxd.address().clone(), ); for client in self.nym_api_clients.iter() { - self.nymd_client - .nymd + self.nyxd_client + .nyxd .grant_allowance( &client.cosmos_address, vec![Coin::new(MAX_FEEGRANT_UNYM, self.mix_denom_base.clone())], @@ -106,8 +106,8 @@ impl CoconutVerifier { ) .await?; let ret = client.api_client.verify_bandwidth_credential(&req).await; - self.nymd_client - .nymd + self.nyxd_client + .nyxd .revoke_allowance( &client.cosmos_address, "Cleanup the previous allowance for releasing funds".to_string(), @@ -119,8 +119,8 @@ impl CoconutVerifier { } } - self.nymd_client - .nymd + self.nyxd_client + .nyxd .execute_proposal(proposal_id, None) .await?; diff --git a/gateway/src/node/client_handling/websocket/connection_handler/eth_events.rs b/gateway/src/node/client_handling/websocket/connection_handler/eth_events.rs index e60159c564..f6365376c5 100644 --- a/gateway/src/node/client_handling/websocket/connection_handler/eth_events.rs +++ b/gateway/src/node/client_handling/websocket/connection_handler/eth_events.rs @@ -8,8 +8,8 @@ use credentials::token::bandwidth::TokenCredential; use crypto::asymmetric::identity::{PublicKey, Signature, SIGNATURE_LENGTH}; use network_defaults::{ETH_EVENT_NAME, ETH_MIN_BLOCK_DEPTH}; use std::str::FromStr; -use validator_client::nymd::traits::MixnetQueryClient; -use validator_client::nymd::{AccountId, NymdClient, SigningNymdClient}; +use validator_client::nxmd::traits::MixnetQueryClient; +use validator_client::nyxd::{AccountId, NyxdClient, SigningNyxdClient}; use web3::contract::tokens::Detokenize; use web3::contract::{Contract, Error}; use web3::transports::Http; diff --git a/gateway/src/node/mod.rs b/gateway/src/node/mod.rs index ead37ec62a..626eaa8592 100644 --- a/gateway/src/node/mod.rs +++ b/gateway/src/node/mod.rs @@ -236,21 +236,21 @@ where ); } - fn random_api_client(&self) -> validator_client::ApiClient { + fn random_api_client(&self) -> validator_client::NymApiClient { let endpoints = self.config.get_nym_api_endpoints(); let nym_api = endpoints .choose(&mut thread_rng()) .expect("The list of validator apis is empty"); - validator_client::ApiClient::new(nym_api.clone()) + validator_client::NymApiClient::new(nym_api.clone()) } #[cfg(feature = "coconut")] - fn random_nymd_client( + fn random_nyxd_client( &self, - ) -> validator_client::Client { - let endpoints = self.config.get_validator_nymd_endpoints(); - let validator_nymd = endpoints + ) -> validator_client::Client { + let endpoints = self.config.get_nyxd_urls(); + let validator_nyxd = endpoints .choose(&mut thread_rng()) .expect("The list of validators is empty"); @@ -263,8 +263,8 @@ where let mut client = Client::new_signing(client_config, self.config.get_cosmos_mnemonic()) .expect("Could not connect with mnemonic"); client - .change_nymd(validator_nymd.clone()) - .expect("Could not use the random nymd URL"); + .change_nyxd(validator_nyxd.clone()) + .expect("Could not use the random nyxd URL"); client } @@ -305,8 +305,8 @@ where #[cfg(feature = "coconut")] let coconut_verifier = { - let nymd_client = self.random_nymd_client(); - let api_clients = CoconutApiClient::all_coconut_api_clients(&nymd_client) + let nyxd_client = self.random_nyxd_client(); + let api_clients = CoconutApiClient::all_coconut_api_clients(&nyxd_client) .await .expect("Could not query all api clients"); let validators_verification_key = obtain_aggregate_verification_key(&api_clients) @@ -314,7 +314,7 @@ where .expect("failed to contact validators to obtain their verification keys"); CoconutVerifier::new( api_clients, - nymd_client, + nyxd_client, std::env::var(network_defaults::var_names::MIX_DENOM) .expect("mix denom base not set"), validators_verification_key, diff --git a/integrations/bity/Cargo.toml b/integrations/bity/Cargo.toml index feae848a70..327d3aeeaa 100644 --- a/integrations/bity/Cargo.toml +++ b/integrations/bity/Cargo.toml @@ -15,7 +15,7 @@ cosmrs = { git = "https://github.com/neacsu/cosmos-rust", branch = "neacsu/feegr nym-cli-commands = { path = "../../common/commands" } validator-client = { path = "../../common/client-libs/validator-client", features = [ - "nymd-client", + "nyxd-client", ] } [dev-dependencies] diff --git a/integrations/bity/src/lib.rs b/integrations/bity/src/lib.rs index 9af11eecfb..232d686e3e 100644 --- a/integrations/bity/src/lib.rs +++ b/integrations/bity/src/lib.rs @@ -8,7 +8,7 @@ mod tests { use crate::{sign, verify}; use cosmrs::AccountId; use std::str::FromStr; - use validator_client::nymd::wallet::DirectSecp256k1HdWallet; + use validator_client::nyxd::wallet::DirectSecp256k1HdWallet; fn get_order(prefix: &str) -> anyhow::Result<(OrderSignature, String)> { let mnemonic = "crush minute paddle tobacco message debate cabin peace bar jacket execute twenty winner view sure mask popular couch penalty fragile demise fresh pizza stove"; diff --git a/integrations/bity/src/sign/mod.rs b/integrations/bity/src/sign/mod.rs index feed824868..65de7536c6 100644 --- a/integrations/bity/src/sign/mod.rs +++ b/integrations/bity/src/sign/mod.rs @@ -1,13 +1,13 @@ use crate::order::OrderSignature; -use validator_client::nymd::error::NymdError; -use validator_client::nymd::wallet::{AccountData, DirectSecp256k1HdWallet}; +use validator_client::nyxd::error::NyxdError; +use validator_client::nyxd::wallet::{AccountData, DirectSecp256k1HdWallet}; /// Signs an order message to purchase Nym with Bity pub fn sign_order( wallet: &DirectSecp256k1HdWallet, signer: &AccountData, message: String, -) -> Result { +) -> Result { Ok(OrderSignature { account_id: signer.address().clone(), public_key: signer.public_key(), diff --git a/mixnode/src/commands/init.rs b/mixnode/src/commands/init.rs index 81e61eb5ac..d5ea3e80c6 100644 --- a/mixnode/src/commands/init.rs +++ b/mixnode/src/commands/init.rs @@ -9,7 +9,7 @@ use clap::Args; use config::NymConfig; use crypto::asymmetric::{encryption, identity}; use std::net::IpAddr; -use validator_client::nymd; +use validator_client::nyxd; #[derive(Args, Clone)] pub(crate) struct Init { @@ -23,7 +23,7 @@ pub(crate) struct Init { /// The wallet address you will use to bond this mixnode, e.g. nymt1z9egw0knv47nmur0p8vk4rcx59h9gg4zuxrrr9 #[clap(long)] - wallet_address: nymd::AccountId, + wallet_address: nyxd::AccountId, /// The port on which the mixnode will be listening for mix packets #[clap(long)] diff --git a/mixnode/src/commands/mod.rs b/mixnode/src/commands/mod.rs index ffff8b0d9e..c69d23fc3f 100644 --- a/mixnode/src/commands/mod.rs +++ b/mixnode/src/commands/mod.rs @@ -7,11 +7,11 @@ use clap::Subcommand; use colored::Colorize; use completions::{fig_generate, ArgShell}; use config::defaults::mainnet::read_var_if_not_default; -use config::defaults::var_names::{API_VALIDATOR, BECH32_PREFIX, CONFIGURED}; +use config::defaults::var_names::{BECH32_PREFIX, CONFIGURED, NYM_API}; use crypto::bech32_address_validation; use std::net::IpAddr; use std::process; -use validator_client::nymd; +use validator_client::nyxd; mod describe; mod init; @@ -51,7 +51,7 @@ pub(crate) enum Commands { struct OverrideConfig { id: String, host: Option, - wallet_address: Option, + wallet_address: Option, mix_port: Option, verloc_port: Option, http_api_port: Option, @@ -96,7 +96,7 @@ fn override_config(mut config: Config, args: OverrideConfig) -> Config { if let Some(nym_apis) = args.nym_apis { config = config.with_custom_nym_apis(nym_apis); } else if std::env::var(CONFIGURED).is_ok() { - if let Some(raw_validators) = read_var_if_not_default(API_VALIDATOR) { + if let Some(raw_validators) = read_var_if_not_default(NYM_API) { config = config.with_custom_nym_apis(::config::parse_urls(&raw_validators)) } } diff --git a/mixnode/src/commands/run.rs b/mixnode/src/commands/run.rs index 859ea2406a..932e844273 100644 --- a/mixnode/src/commands/run.rs +++ b/mixnode/src/commands/run.rs @@ -8,7 +8,7 @@ use crate::node::MixNode; use clap::Args; use config::NymConfig; use std::net::IpAddr; -use validator_client::nymd; +use validator_client::nyxd; #[derive(Args, Clone)] pub(crate) struct Run { @@ -22,7 +22,7 @@ pub(crate) struct Run { /// The wallet address you will use to bond this mixnode, e.g. nymt1z9egw0knv47nmur0p8vk4rcx59h9gg4zuxrrr9 #[clap(long)] - wallet_address: Option, + wallet_address: Option, /// The port on which the mixnode will be listening for mix packets #[clap(long)] diff --git a/mixnode/src/commands/sign.rs b/mixnode/src/commands/sign.rs index e9b137be79..f78a45b2d1 100644 --- a/mixnode/src/commands/sign.rs +++ b/mixnode/src/commands/sign.rs @@ -11,7 +11,7 @@ use clap::{ArgGroup, Args}; use config::NymConfig; use crypto::asymmetric::identity; use log::error; -use validator_client::nymd; +use validator_client::nyxd; use super::version_check; @@ -25,7 +25,7 @@ pub(crate) struct Sign { /// Signs your blockchain address with your identity key // the alias here is included for backwards compatibility (1.1.4 and before) #[clap(long, alias = "address")] - wallet_address: Option, + wallet_address: Option, /// Signs an arbitrary piece of text with your identity key #[clap(long)] @@ -34,7 +34,7 @@ pub(crate) struct Sign { enum SignedTarget { Text(String), - Address(nymd::AccountId), + Address(nyxd::AccountId), } impl TryFrom for SignedTarget { @@ -54,7 +54,7 @@ impl TryFrom for SignedTarget { } } -fn print_signed_address(private_key: &identity::PrivateKey, wallet_address: nymd::AccountId) { +fn print_signed_address(private_key: &identity::PrivateKey, wallet_address: nyxd::AccountId) { // perform extra validation to ensure we have correct prefix validate_bech32_address_or_exit(wallet_address.as_ref()); diff --git a/mixnode/src/config/mod.rs b/mixnode/src/config/mod.rs index 8941e555f2..2b69e45725 100644 --- a/mixnode/src/config/mod.rs +++ b/mixnode/src/config/mod.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use crate::config::template::config_template; -use config::defaults::mainnet::API_VALIDATOR; +use config::defaults::mainnet::NYM_API; use config::defaults::{ DEFAULT_HTTP_API_LISTENING_PORT, DEFAULT_MIX_LISTENING_PORT, DEFAULT_VERLOC_LISTENING_PORT, }; @@ -13,7 +13,7 @@ use std::path::PathBuf; use std::str::FromStr; use std::time::Duration; use url::Url; -use validator_client::nymd; +use validator_client::nyxd; pub mod persistence; mod template; @@ -196,7 +196,7 @@ impl Config { self } - pub fn with_wallet_address(mut self, wallet_address: nymd::AccountId) -> Self { + pub fn with_wallet_address(mut self, wallet_address: nyxd::AccountId) -> Self { self.mixnode.wallet_address = Some(wallet_address); self } @@ -310,7 +310,7 @@ impl Config { self.verloc.retry_timeout } - pub fn get_wallet_address(&self) -> Option { + pub fn get_wallet_address(&self) -> Option { self.mixnode.wallet_address.clone() } } @@ -371,7 +371,7 @@ struct MixNode { /// The Cosmos wallet address that will control this mixnode // the only reason this is an Option is because of the lack of existence of a sane default value - wallet_address: Option, + wallet_address: Option, } impl MixNode { @@ -406,7 +406,7 @@ impl Default for MixNode { public_identity_key_file: Default::default(), private_sphinx_key_file: Default::default(), public_sphinx_key_file: Default::default(), - nym_api_urls: vec![Url::from_str(API_VALIDATOR).expect("Invalid default API URL")], + nym_api_urls: vec![Url::from_str(NYM_API).expect("Invalid default API URL")], nym_root_directory: Config::default_root_directory(), wallet_address: None, } diff --git a/mixnode/src/node/mod.rs b/mixnode/src/node/mod.rs index 3195ebe099..c95ada3b01 100644 --- a/mixnode/src/node/mod.rs +++ b/mixnode/src/node/mod.rs @@ -265,13 +265,13 @@ impl MixNode { atomic_verloc_results } - fn random_api_client(&self) -> validator_client::ApiClient { + fn random_api_client(&self) -> validator_client::NymApiClient { let endpoints = self.config.get_nym_api_endpoints(); let nym_api = endpoints .choose(&mut thread_rng()) .expect("The list of validator apis is empty"); - validator_client::ApiClient::new(nym_api.clone()) + validator_client::NymApiClient::new(nym_api.clone()) } // TODO: ask DH whether this function still makes sense in ^0.10 diff --git a/nym-api/Cargo.toml b/nym-api/Cargo.toml index a790bdc4db..b89227f868 100644 --- a/nym-api/Cargo.toml +++ b/nym-api/Cargo.toml @@ -89,7 +89,7 @@ task = { path = "../common/task" } topology = { path = "../common/topology" } nym-api-requests = { path = "nym-api-requests" } validator-client = { path = "../common/client-libs/validator-client", features = [ - "nymd-client", + "nyxd-client", ] } version-checker = { path = "../common/version-checker" } diff --git a/nym-api/src/coconut/client.rs b/nym-api/src/coconut/client.rs index 92af589921..48788a03be 100644 --- a/nym-api/src/coconut/client.rs +++ b/nym-api/src/coconut/client.rs @@ -9,8 +9,8 @@ use coconut_dkg_common::verification_key::{ContractVKShare, VerificationKeyShare use contracts_common::dealings::ContractSafeBytes; use cw3::ProposalResponse; use dkg::Threshold; -use validator_client::nymd::cosmwasm_client::types::ExecuteResult; -use validator_client::nymd::{AccountId, Fee, TxResponse}; +use validator_client::nyxd::cosmwasm_client::types::ExecuteResult; +use validator_client::nyxd::{AccountId, Fee, TxResponse}; #[async_trait] pub trait Client { diff --git a/nym-api/src/coconut/comm.rs b/nym-api/src/coconut/comm.rs index 42a428f153..75a15f9bc0 100644 --- a/nym-api/src/coconut/comm.rs +++ b/nym-api/src/coconut/comm.rs @@ -2,10 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 use crate::coconut::error::Result; -use crate::nymd_client::Client; +use crate::nyxd_client::Client; use coconut_interface::VerificationKey; use credentials::coconut::utils::obtain_aggregate_verification_key; -use validator_client::nymd::SigningNymdClient; +use validator_client::nyxd::SigningNyxdClient; use validator_client::CoconutApiClient; #[async_trait] @@ -14,19 +14,19 @@ pub trait APICommunicationChannel { } pub(crate) struct QueryCommunicationChannel { - nymd_client: Client, + nyxd_client: Client, } impl QueryCommunicationChannel { - pub fn new(nymd_client: Client) -> Self { - QueryCommunicationChannel { nymd_client } + pub fn new(nyxd_client: Client) -> Self { + QueryCommunicationChannel { nyxd_client } } } #[async_trait] impl APICommunicationChannel for QueryCommunicationChannel { async fn aggregated_verification_key(&self) -> Result { - let client = self.nymd_client.0.read().await; + let client = self.nyxd_client.0.read().await; let coconut_api_clients = CoconutApiClient::all_coconut_api_clients(&client).await?; let vk = obtain_aggregate_verification_key(&coconut_api_clients).await?; Ok(vk) diff --git a/nym-api/src/coconut/deposit.rs b/nym-api/src/coconut/deposit.rs index dcee8cebc0..06656ab725 100644 --- a/nym-api/src/coconut/deposit.rs +++ b/nym-api/src/coconut/deposit.rs @@ -9,7 +9,7 @@ use credentials::coconut::bandwidth::BandwidthVoucher; use crypto::asymmetric::encryption; use crypto::asymmetric::identity::{self, Signature}; use nym_api_requests::coconut::BlindSignRequestBody; -use validator_client::nymd::TxResponse; +use validator_client::nyxd::TxResponse; use super::error::{CoconutError, Result}; @@ -99,8 +99,8 @@ mod test { use nymcoconut::{prepare_blind_sign, BlindSignRequest, Parameters}; use rand_07::rngs::OsRng; use std::str::FromStr; - use validator_client::nymd::tx::Hash; - use validator_client::nymd::{Event, Tag}; + use validator_client::nyxd::tx::Hash; + use validator_client::nyxd::{Event, Tag}; #[tokio::test] async fn extract_encryption_key_test() { diff --git a/nym-api/src/coconut/dkg/client.rs b/nym-api/src/coconut/dkg/client.rs index 61b583b84b..6243b5ec2c 100644 --- a/nym-api/src/coconut/dkg/client.rs +++ b/nym-api/src/coconut/dkg/client.rs @@ -9,9 +9,9 @@ use coconut_dkg_common::verification_key::{ContractVKShare, VerificationKeyShare use contracts_common::dealings::ContractSafeBytes; use cw3::ProposalResponse; use dkg::Threshold; -use validator_client::nymd::cosmwasm_client::logs::{find_attribute, NODE_INDEX}; -use validator_client::nymd::cosmwasm_client::types::ExecuteResult; -use validator_client::nymd::AccountId; +use validator_client::nyxd::cosmwasm_client::logs::{find_attribute, NODE_INDEX}; +use validator_client::nyxd::cosmwasm_client::types::ExecuteResult; +use validator_client::nyxd::AccountId; pub(crate) struct DkgClient { inner: Box, @@ -22,12 +22,12 @@ impl DkgClient { // Until we determine why that is, retry the query a few more times const RETRIES: usize = 3; - pub(crate) fn new(nymd_client: C) -> Self + pub(crate) fn new(nyxd_client: C) -> Self where C: Client + Send + Sync + 'static, { DkgClient { - inner: Box::new(nymd_client), + inner: Box::new(nyxd_client), } } diff --git a/nym-api/src/coconut/dkg/controller.rs b/nym-api/src/coconut/dkg/controller.rs index bebb68f4d1..ad60cf2027 100644 --- a/nym-api/src/coconut/dkg/controller.rs +++ b/nym-api/src/coconut/dkg/controller.rs @@ -11,7 +11,7 @@ use crate::coconut::dkg::{ verification_key::verification_key_submission, }; use crate::coconut::keypair::KeyPair as CoconutKeyPair; -use crate::{nymd_client, Config}; +use crate::{nyxd_client, Config}; use anyhow::Result; use coconut_dkg_common::types::EpochState; use dkg::bte::keys::KeyPair as DkgKeyPair; @@ -21,7 +21,7 @@ use std::path::PathBuf; use std::time::{Duration, SystemTime}; use task::TaskClient; use tokio::time::interval; -use validator_client::nymd::SigningNymdClient; +use validator_client::nyxd::SigningNyxdClient; pub(crate) fn init_keypair(config: &Config) -> Result<()> { let mut rng = OsRng; @@ -49,7 +49,7 @@ pub(crate) struct DkgController { impl DkgController { pub(crate) async fn new( config: &Config, - nymd_client: nymd_client::Client, + nyxd_client: nyxd_client::Client, coconut_keypair: CoconutKeyPair, rng: R, ) -> Result { @@ -67,7 +67,7 @@ impl DkgController { PersistentState::load_from_file(config.persistent_state_path()).unwrap_or_default(); Ok(DkgController { - dkg_client: DkgClient::new(nymd_client), + dkg_client: DkgClient::new(nyxd_client), secret_key_path: config.secret_key_path(), verification_key_path: config.verification_key_path(), state: State::new( diff --git a/nym-api/src/coconut/dkg/dealing.rs b/nym-api/src/coconut/dkg/dealing.rs index 1ecf272176..a32176c9b0 100644 --- a/nym-api/src/coconut/dkg/dealing.rs +++ b/nym-api/src/coconut/dkg/dealing.rs @@ -66,7 +66,7 @@ pub(crate) mod tests { use std::str::FromStr; use std::sync::{Arc, RwLock}; use url::Url; - use validator_client::nymd::AccountId; + use validator_client::nyxd::AccountId; const TEST_VALIDATORS_ADDRESS: [&str; 3] = [ "n1aq9kakfgwqcufr23lsv644apavcntrsqsk4yus", diff --git a/nym-api/src/coconut/dkg/public_key.rs b/nym-api/src/coconut/dkg/public_key.rs index 0ce3bd45b3..aa3fa72330 100644 --- a/nym-api/src/coconut/dkg/public_key.rs +++ b/nym-api/src/coconut/dkg/public_key.rs @@ -42,7 +42,7 @@ pub(crate) mod tests { use std::path::PathBuf; use std::str::FromStr; use url::Url; - use validator_client::nymd::AccountId; + use validator_client::nyxd::AccountId; const TEST_VALIDATOR_ADDRESS: &str = "n19lc9u84cz0yz3fww5283nucc9yvr8gsjmgeul0"; diff --git a/nym-api/src/coconut/dkg/verification_key.rs b/nym-api/src/coconut/dkg/verification_key.rs index 1ef88e0d54..2d19ec43b6 100644 --- a/nym-api/src/coconut/dkg/verification_key.rs +++ b/nym-api/src/coconut/dkg/verification_key.rs @@ -18,7 +18,7 @@ use nymcoconut::tests::helpers::transpose_matrix; use nymcoconut::{check_vk_pairing, Base58, KeyPair, Parameters, SecretKey, VerificationKey}; use pemstore::KeyPairPath; use std::collections::BTreeMap; -use validator_client::nymd::cosmwasm_client::logs::find_attribute; +use validator_client::nyxd::cosmwasm_client::logs::find_attribute; // Filter the dealers based on what dealing they posted (or not) in the contract async fn deterministic_filter_dealers( @@ -264,7 +264,7 @@ pub(crate) mod tests { use std::str::FromStr; use std::sync::{Arc, RwLock}; use url::Url; - use validator_client::nymd::AccountId; + use validator_client::nyxd::AccountId; struct MockContractDb { dealer_details_db: Arc>>, diff --git a/nym-api/src/coconut/error.rs b/nym-api/src/coconut/error.rs index 4c3a712eb2..dc484e691e 100644 --- a/nym-api/src/coconut/error.rs +++ b/nym-api/src/coconut/error.rs @@ -12,7 +12,7 @@ use crypto::asymmetric::{ identity::{Ed25519RecoveryError, SignatureError}, }; use dkg::error::DkgError; -use validator_client::nymd::error::NymdError; +use validator_client::nyxd::error::NyxdError; use crate::node_status_api::models::NymApiStorageError; @@ -35,8 +35,8 @@ pub enum CoconutError { #[error("Could not parse tx hash in request body")] TxHashParseError, - #[error("Nymd error - {0}")] - NymdError(#[from] NymdError), + #[error("Nyxd error - {0}")] + NyxdError(#[from] NyxdError), #[error("Validator client error - {0}")] ValidatorClientError(#[from] validator_client::ValidatorClientError), diff --git a/nym-api/src/coconut/mod.rs b/nym-api/src/coconut/mod.rs index ba3afa12b6..6fa4b2ed58 100644 --- a/nym-api/src/coconut/mod.rs +++ b/nym-api/src/coconut/mod.rs @@ -34,7 +34,7 @@ use nym_api_requests::coconut::{ BlindSignRequestBody, BlindedSignatureResponse, VerifyCredentialBody, VerifyCredentialResponse, }; use validator_client::nym_api::routes::{BANDWIDTH, COCONUT_ROUTES}; -use validator_client::nymd::{Coin, Fee}; +use validator_client::nyxd::{Coin, Fee}; use getset::{CopyGetters, Getters}; use rand_07::rngs::OsRng; diff --git a/nym-api/src/coconut/tests.rs b/nym-api/src/coconut/tests.rs index d0165e1f1e..49f58e8c47 100644 --- a/nym-api/src/coconut/tests.rs +++ b/nym-api/src/coconut/tests.rs @@ -30,8 +30,8 @@ use validator_client::nym_api::routes::{ API_VERSION, BANDWIDTH, COCONUT_BLIND_SIGN, COCONUT_PARTIAL_BANDWIDTH_CREDENTIAL, COCONUT_ROUTES, COCONUT_VERIFY_BANDWIDTH_CREDENTIAL, }; -use validator_client::nymd::Coin; -use validator_client::nymd::{tx::Hash, AccountId, DeliverTx, Event, Fee, Tag, TxResponse}; +use validator_client::nyxd::Coin; +use validator_client::nyxd::{tx::Hash, AccountId, DeliverTx, Event, Fee, Tag, TxResponse}; use crate::coconut::State; use crate::NymApiStorage; @@ -53,8 +53,8 @@ use rocket::local::asynchronous::Client; use std::collections::HashMap; use std::str::FromStr; use std::sync::{Arc, RwLock}; -use validator_client::nymd::cosmwasm_client::logs::Log; -use validator_client::nymd::cosmwasm_client::types::ExecuteResult; +use validator_client::nyxd::cosmwasm_client::logs::Log; +use validator_client::nyxd::cosmwasm_client::types::ExecuteResult; const TEST_COIN_DENOM: &str = "unym"; const TEST_REWARDING_VALIDATOR_ADDRESS: &str = "n19lc9u84cz0yz3fww5283nucc9yvr8gsjmgeul0"; @@ -466,7 +466,7 @@ async fn signed_before() { .write() .unwrap() .insert(tx_hash.to_string(), tx_entry.clone()); - let nymd_client = + let nyxd_client = DummyClient::new(AccountId::from_str(TEST_REWARDING_VALIDATOR_ADDRESS).unwrap()) .with_tx_db(&tx_db); let comm_channel = DummyCommunicationChannel::new(key_pair.verification_key()); @@ -474,7 +474,7 @@ async fn signed_before() { staged_key_pair.set(key_pair).await; let rocket = rocket::build().attach(InternalSignRequest::stage( - nymd_client, + nyxd_client, TEST_COIN_DENOM.to_string(), staged_key_pair, comm_channel, @@ -530,7 +530,7 @@ async fn signed_before() { #[tokio::test] async fn state_functions() { - let nymd_client = + let nyxd_client = DummyClient::new(AccountId::from_str(TEST_REWARDING_VALIDATOR_ADDRESS).unwrap()); let params = Parameters::new(4).unwrap(); let key_pair = ttp_keygen(¶ms, 1, 1).unwrap().remove(0); @@ -541,7 +541,7 @@ async fn state_functions() { let staged_key_pair = crate::coconut::KeyPair::new(); staged_key_pair.set(key_pair).await; let state = State::new( - nymd_client, + nyxd_client, TEST_COIN_DENOM.to_string(), staged_key_pair, comm_channel, @@ -703,7 +703,7 @@ async fn blind_sign_correct() { .write() .unwrap() .insert(tx_hash.to_string(), tx_entry.clone()); - let nymd_client = + let nyxd_client = DummyClient::new(AccountId::from_str(TEST_REWARDING_VALIDATOR_ADDRESS).unwrap()) .with_tx_db(&tx_db); let comm_channel = DummyCommunicationChannel::new(key_pair.verification_key()); @@ -711,7 +711,7 @@ async fn blind_sign_correct() { staged_key_pair.set(key_pair).await; let rocket = rocket::build().attach(InternalSignRequest::stage( - nymd_client, + nyxd_client, TEST_COIN_DENOM.to_string(), staged_key_pair, comm_channel, @@ -781,14 +781,14 @@ async fn signature_test() { let mut db_dir = std::env::temp_dir(); db_dir.push(&key_pair.verification_key().to_bs58()[..8]); let storage = NymApiStorage::init(db_dir).await.unwrap(); - let nymd_client = + let nyxd_client = DummyClient::new(AccountId::from_str(TEST_REWARDING_VALIDATOR_ADDRESS).unwrap()); let comm_channel = DummyCommunicationChannel::new(key_pair.verification_key()); let staged_key_pair = crate::coconut::KeyPair::new(); staged_key_pair.set(key_pair).await; let rocket = rocket::build().attach(InternalSignRequest::stage( - nymd_client, + nyxd_client, TEST_COIN_DENOM.to_string(), staged_key_pair, comm_channel, @@ -848,7 +848,7 @@ async fn verification_of_bandwidth_credential() { let validator_address = AccountId::from_str(TEST_REWARDING_VALIDATOR_ADDRESS).unwrap(); let proposal_db = Arc::new(RwLock::new(HashMap::new())); let spent_credential_db = Arc::new(RwLock::new(HashMap::new())); - let nymd_client = DummyClient::new(validator_address.clone()) + let nyxd_client = DummyClient::new(validator_address.clone()) .with_proposal_db(&proposal_db) .with_spent_credential_db(&spent_credential_db); let mut db_dir = std::env::temp_dir(); @@ -874,7 +874,7 @@ async fn verification_of_bandwidth_credential() { let staged_key_pair = crate::coconut::KeyPair::new(); staged_key_pair.set(key_pair).await; let rocket = rocket::build().attach(InternalSignRequest::stage( - nymd_client.clone(), + nyxd_client.clone(), TEST_COIN_DENOM.to_string(), staged_key_pair, comm_channel.clone(), diff --git a/nym-api/src/config/mod.rs b/nym-api/src/config/mod.rs index 4be947f264..e56faddc77 100644 --- a/nym-api/src/config/mod.rs +++ b/nym-api/src/config/mod.rs @@ -389,7 +389,7 @@ impl Config { self } - pub fn with_custom_nymd_validator(mut self, validator: Url) -> Self { + pub fn with_custom_nyxd_validator(mut self, validator: Url) -> Self { self.base.local_validator = validator; self } @@ -450,7 +450,7 @@ impl Config { self.rewarding.enabled } - pub fn get_nymd_validator_url(&self) -> Url { + pub fn get_nyxd_url(&self) -> Url { self.base.local_validator.clone() } diff --git a/nym-api/src/contract_cache/mod.rs b/nym-api/src/contract_cache/mod.rs index 0775ca5a85..4608c9d9d5 100644 --- a/nym-api/src/contract_cache/mod.rs +++ b/nym-api/src/contract_cache/mod.rs @@ -1,7 +1,7 @@ // Copyright 2021-2022 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::nymd_client::Client; +use crate::nyxd_client::Client; use ::time::OffsetDateTime; use anyhow::Result; use mixnet_contract_common::families::FamilyHead; @@ -24,7 +24,7 @@ use std::time::Duration; use task::TaskClient; use tokio::sync::{watch, RwLock}; use tokio::time; -use validator_client::nymd::CosmWasmClient; +use validator_client::nyxd::CosmWasmClient; pub(crate) mod routes; @@ -36,7 +36,7 @@ pub enum CacheNotification { } pub struct ValidatorCacheRefresher { - nymd_client: Client, + nyxd_client: Client, cache: ValidatorCache, caching_interval: Duration, @@ -109,13 +109,13 @@ impl Deref for Cache { impl ValidatorCacheRefresher { pub(crate) fn new( - nymd_client: Client, + nyxd_client: Client, caching_interval: Duration, cache: ValidatorCache, ) -> Self { let (tx, _) = watch::channel(CacheNotification::Start); ValidatorCacheRefresher { - nymd_client, + nyxd_client, cache, caching_interval, update_notifier: tx, @@ -130,7 +130,7 @@ impl ValidatorCacheRefresher { where C: CosmWasmClient + Sync + Send, { - self.nymd_client + self.nyxd_client .get_rewarded_set_mixnodes() .await .map(|nodes| nodes.into_iter().collect()) @@ -160,13 +160,13 @@ impl ValidatorCacheRefresher { where C: CosmWasmClient + Sync + Send, { - let rewarding_params = self.nymd_client.get_current_rewarding_parameters().await?; - let current_interval = self.nymd_client.get_current_interval().await?.interval; + let rewarding_params = self.nyxd_client.get_current_rewarding_parameters().await?; + let current_interval = self.nyxd_client.get_current_interval().await?.interval; - let mixnodes = self.nymd_client.get_mixnodes().await?; - let gateways = self.nymd_client.get_gateways().await?; + let mixnodes = self.nyxd_client.get_mixnodes().await?; + let gateways = self.nyxd_client.get_gateways().await?; - let mix_to_family = self.nymd_client.get_all_family_members().await?; + let mix_to_family = self.nyxd_client.get_all_family_members().await?; let rewarded_set_map = self.get_rewarded_set_map().await; diff --git a/nym-api/src/epoch_operations/error.rs b/nym-api/src/epoch_operations/error.rs index 4455dfcfcc..91e8005dd7 100644 --- a/nym-api/src/epoch_operations/error.rs +++ b/nym-api/src/epoch_operations/error.rs @@ -3,7 +3,7 @@ use crate::node_status_api::models::NymApiStorageError; use thiserror::Error; -use validator_client::nymd::error::NymdError; +use validator_client::nyxd::error::NyxdError; use validator_client::ValidatorClientError; #[derive(Debug, Error)] @@ -11,7 +11,7 @@ pub enum RewardingError { // #[error("There were no mixnodes to reward (network is dead)")] // NoMixnodesToReward, #[error("Failed to execute the smart contract - {0}")] - ContractExecutionFailure(NymdError), + ContractExecutionFailure(NyxdError), // The inner error should be modified at some point... #[error("We run into storage issues - {0}")] @@ -32,8 +32,8 @@ pub enum RewardingError { }, } -impl From for RewardingError { - fn from(err: NymdError) -> Self { +impl From for RewardingError { + fn from(err: NyxdError) -> Self { RewardingError::ContractExecutionFailure(err) } } diff --git a/nym-api/src/epoch_operations/mod.rs b/nym-api/src/epoch_operations/mod.rs index 7f109d3dea..c38a52c706 100644 --- a/nym-api/src/epoch_operations/mod.rs +++ b/nym-api/src/epoch_operations/mod.rs @@ -13,7 +13,7 @@ // and hence this might be a good place for it. use crate::contract_cache::ValidatorCache; -use crate::nymd_client::Client; +use crate::nyxd_client::Client; use crate::storage::models::RewardingReport; use crate::storage::NymApiStorage; use mixnet_contract_common::families::FamilyHead; @@ -27,7 +27,7 @@ use std::collections::HashMap; use std::collections::HashSet; use std::time::Duration; use tokio::time::sleep; -use validator_client::nymd::SigningNymdClient; +use validator_client::nyxd::SigningNyxdClient; pub(crate) mod error; mod helpers; @@ -54,7 +54,7 @@ impl From for ExecuteMsg { } pub struct RewardedSetUpdater { - nymd_client: Client, + nyxd_client: Client, validator_cache: ValidatorCache, storage: NymApiStorage, } @@ -73,16 +73,16 @@ impl RewardedSetUpdater { pub(crate) async fn current_interval_details( &self, ) -> Result { - Ok(self.nymd_client.get_current_interval().await?) + Ok(self.nyxd_client.get_current_interval().await?) } pub(crate) async fn new( - nymd_client: Client, + nyxd_client: Client, validator_cache: ValidatorCache, storage: NymApiStorage, ) -> Result { Ok(RewardedSetUpdater { - nymd_client, + nyxd_client, validator_cache, storage, }) @@ -179,7 +179,7 @@ impl RewardedSetUpdater { if to_reward.is_empty() { info!("There are no nodes to reward in this epoch"); - } else if let Err(err) = self.nymd_client.send_rewarding_messages(&to_reward).await { + } else if let Err(err) = self.nyxd_client.send_rewarding_messages(&to_reward).await { error!( "failed to perform mixnode rewarding for epoch {}! Error encountered: {}", current_interval.current_epoch_absolute_id(), @@ -205,7 +205,7 @@ impl RewardedSetUpdater { async fn nodes_to_reward(&self, interval: Interval) -> Vec { // try to get current up to date view of the network bypassing the cache // in case the epochs were significantly shortened for the purposes of testing - let rewarded_set: Vec = match self.nymd_client.get_rewarded_set_mixnodes().await { + let rewarded_set: Vec = match self.nyxd_client.get_rewarded_set_mixnodes().await { Ok(nodes) => nodes.into_iter().map(|(id, _)| id).collect::>(), Err(err) => { warn!("failed to obtain the current rewarded set - {err}. falling back to the cached version"); @@ -243,7 +243,7 @@ impl RewardedSetUpdater { all_mixnodes: &[MixNodeDetails], ) -> Result<(), RewardingError> { // we grab rewarding parameters here as they might have gotten updated when performing epoch actions - let rewarding_parameters = self.nymd_client.get_current_rewarding_parameters().await?; + let rewarding_parameters = self.nyxd_client.get_current_rewarding_parameters().await?; let new_rewarded_set = self.determine_rewarded_set(all_mixnodes, rewarding_parameters.rewarded_set_size)?; @@ -251,7 +251,7 @@ impl RewardedSetUpdater { let (layer_assignments, _families_in_layer) = self.determine_layers(&new_rewarded_set).await?; - self.nymd_client + self.nyxd_client .advance_current_epoch(layer_assignments, rewarding_parameters.active_set_size) .await?; @@ -302,7 +302,7 @@ impl RewardedSetUpdater { // as separate transactions log::info!("Reconciling all pending epoch events..."); - if let Err(err) = self.nymd_client.reconcile_epoch_events().await { + if let Err(err) = self.nyxd_client.reconcile_epoch_events().await { log::error!("FAILED to reconcile epoch events... - {err}"); return Err(err.into()); } else { diff --git a/nym-api/src/main.rs b/nym-api/src/main.rs index aa2981d90f..3e2ea89bd2 100644 --- a/nym-api/src/main.rs +++ b/nym-api/src/main.rs @@ -9,7 +9,7 @@ use crate::contract_cache::ValidatorCacheRefresher; use crate::epoch_operations::RewardedSetUpdater; use crate::network_monitor::NetworkMonitorBuilder; use crate::node_status_api::uptime_updater::HistoricalUptimeUpdater; -use crate::nymd_client::Client; +use crate::nyxd_client::Client; use crate::storage::NymApiStorage; use ::config::defaults::mainnet::read_var_if_not_default; use ::config::defaults::setup_env; @@ -35,7 +35,7 @@ use std::time::Duration; use std::{fs, process}; use task::{wait_for_signal, TaskManager}; use tokio::sync::Notify; -use validator_client::nymd::{self, SigningNymdClient}; +use validator_client::nyxd::{self, SigningNyxdClient}; #[cfg(feature = "coconut")] use coconut::{ @@ -51,7 +51,7 @@ pub(crate) mod contract_cache; mod epoch_operations; mod network_monitor; mod node_status_api; -pub(crate) mod nymd_client; +pub(crate) mod nyxd_client; pub(crate) mod storage; mod swagger; @@ -101,13 +101,13 @@ struct ApiArgs { #[clap(short = 'r', long, requires = "enable_monitor", requires = "mnemonic")] enable_rewarding: bool, - /// Endpoint to nymd instance from which the monitor will grab nodes to test + /// Endpoint to nyxd instance from which the monitor will grab nodes to test #[clap(long)] - nymd_validator: Option, + nyxd_validator: Option, /// Address of the mixnet contract managing the network #[clap(long)] - mixnet_contract: Option, + mixnet_contract: Option, /// Mnemonic of the network monitor used for rewarding operators // even though we're currently converting the mnemonic to string (and then back to the concrete type) @@ -172,8 +172,8 @@ fn override_config(mut config: Config, args: ApiArgs) -> Config { .with_rewarding_enabled(args.enable_rewarding) .with_disabled_credentials_mode(!args.enabled_credentials_mode); - if let Some(nymd_validator) = args.nymd_validator { - config = config.with_custom_nymd_validator(nymd_validator); + if let Some(nyxd_validator) = args.nyxd_validator { + config = config.with_custom_nyxd_validator(nyxd_validator); } if let Some(mixnet_contract) = args.mixnet_contract { @@ -244,7 +244,7 @@ fn setup_liftoff_notify(notify: Arc) -> AdHoc { fn setup_network_monitor<'a>( config: &'a Config, - _nymd_client: Client, + _nyxd_client: Client, system_version: &str, rocket: &Rocket, ) -> Option> { @@ -258,7 +258,7 @@ fn setup_network_monitor<'a>( Some(NetworkMonitorBuilder::new( config, - _nymd_client, + _nyxd_client, system_version, node_status_storage, validator_cache, @@ -279,7 +279,7 @@ async fn setup_rocket( config: &Config, _mix_denom: String, liftoff_notify: Arc, - _nymd_client: Client, + _nyxd_client: Client, #[cfg(feature = "coconut")] coconut_keypair: coconut::keypair::KeyPair, ) -> Result> { let openapi_settings = rocket_okapi::settings::OpenApiSettings::default(); @@ -314,10 +314,10 @@ async fn setup_rocket( #[cfg(feature = "coconut")] let rocket = if config.get_coconut_signer_enabled() { rocket.attach(InternalSignRequest::stage( - _nymd_client.clone(), + _nyxd_client.clone(), _mix_denom, coconut_keypair, - QueryCommunicationChannel::new(_nymd_client), + QueryCommunicationChannel::new(_nyxd_client), storage.clone().unwrap(), )) } else { @@ -403,7 +403,7 @@ async fn run_nym_api(args: ApiArgs) -> Result<()> { let mix_denom = std::env::var(MIX_DENOM).expect("mix denom not set"); - let signing_nymd_client = Client::new_signing(&config); + let signing_nyxd_client = Client::new_signing(&config); let liftoff_notify = Arc::new(Notify::new()); // We need a bigger timeout @@ -417,14 +417,14 @@ async fn run_nym_api(args: ApiArgs) -> Result<()> { &config, mix_denom, Arc::clone(&liftoff_notify), - signing_nymd_client.clone(), + signing_nyxd_client.clone(), #[cfg(feature = "coconut")] coconut_keypair.clone(), ) .await?; let monitor_builder = setup_network_monitor( &config, - signing_nymd_client.clone(), + signing_nyxd_client.clone(), system_version, &rocket, ); @@ -435,7 +435,7 @@ async fn run_nym_api(args: ApiArgs) -> Result<()> { #[cfg(feature = "coconut")] { let dkg_controller = - DkgController::new(&config, signing_nymd_client.clone(), coconut_keypair, OsRng) + DkgController::new(&config, signing_nyxd_client.clone(), coconut_keypair, OsRng) .await?; let shutdown_listener = shutdown.subscribe(); tokio::spawn(async move { dkg_controller.run(shutdown_listener).await }); @@ -455,7 +455,7 @@ async fn run_nym_api(args: ApiArgs) -> Result<()> { // spawn the validator cache refresher let validator_cache_refresher = ValidatorCacheRefresher::new( - signing_nymd_client.clone(), + signing_nyxd_client.clone(), config.get_caching_interval(), validator_cache.clone(), ); @@ -466,7 +466,7 @@ async fn run_nym_api(args: ApiArgs) -> Result<()> { // spawn rewarded set updater if config.get_rewarding_enabled() { let mut rewarded_set_updater = - RewardedSetUpdater::new(signing_nymd_client, validator_cache.clone(), storage) + RewardedSetUpdater::new(signing_nyxd_client, validator_cache.clone(), storage) .await?; let shutdown_listener = shutdown.subscribe(); tokio::spawn(async move { rewarded_set_updater.run(shutdown_listener).await.unwrap() }); @@ -475,10 +475,10 @@ async fn run_nym_api(args: ApiArgs) -> Result<()> { } else { // Spawn the validator cache refresher. // When the network monitor is not enabled, we spawn the validator cache refresher task - // with just a nymd client, in contrast to a signing client. - let nymd_client = Client::new_query(&config); + // with just a nyxd client, in contrast to a signing client. + let nyxd_client = Client::new_query(&config); let validator_cache_refresher = ValidatorCacheRefresher::new( - nymd_client, + nyxd_client, config.get_caching_interval(), validator_cache.clone(), ); diff --git a/nym-api/src/network_monitor/mod.rs b/nym-api/src/network_monitor/mod.rs index ff4d6bd585..e2a9dbdfc6 100644 --- a/nym-api/src/network_monitor/mod.rs +++ b/nym-api/src/network_monitor/mod.rs @@ -7,7 +7,7 @@ use futures::channel::mpsc; use gateway_client::bandwidth::BandwidthController; use std::sync::Arc; use task::TaskManager; -use validator_client::nymd::SigningNymdClient; +use validator_client::nyxd::SigningNyxdClient; use crate::config::Config; use crate::contract_cache::ValidatorCache; @@ -21,7 +21,7 @@ use crate::network_monitor::monitor::receiver::{ use crate::network_monitor::monitor::sender::PacketSender; use crate::network_monitor::monitor::summary_producer::SummaryProducer; use crate::network_monitor::monitor::Monitor; -use crate::nymd_client::Client; +use crate::nyxd_client::Client; use crate::storage::NymApiStorage; pub(crate) mod chunker; @@ -34,7 +34,7 @@ pub(crate) const ROUTE_TESTING_TEST_NONCE: u64 = 0; pub(crate) struct NetworkMonitorBuilder<'a> { config: &'a Config, - _nymd_client: Client, + _nyxd_client: Client, system_version: String, node_status_storage: NymApiStorage, validator_cache: ValidatorCache, @@ -43,14 +43,14 @@ pub(crate) struct NetworkMonitorBuilder<'a> { impl<'a> NetworkMonitorBuilder<'a> { pub(crate) fn new( config: &'a Config, - _nymd_client: Client, + _nyxd_client: Client, system_version: &str, node_status_storage: NymApiStorage, validator_cache: ValidatorCache, ) -> Self { NetworkMonitorBuilder { config, - _nymd_client, + _nyxd_client, system_version: system_version.to_string(), node_status_storage, validator_cache, @@ -80,7 +80,7 @@ impl<'a> NetworkMonitorBuilder<'a> { #[cfg(feature = "coconut")] let bandwidth_controller = { - let client = self._nymd_client.0.read().await; + let client = self._nyxd_client.0.read().await; let coconut_api_clients = validator_client::CoconutApiClient::all_coconut_api_clients(&client) .await diff --git a/nym-api/src/nymd_client.rs b/nym-api/src/nyxd_client.rs similarity index 88% rename from nym-api/src/nymd_client.rs rename to nym-api/src/nyxd_client.rs index f7780b2871..f18d304bcf 100644 --- a/nym-api/src/nymd_client.rs +++ b/nym-api/src/nyxd_client.rs @@ -13,10 +13,10 @@ use mixnet_contract_common::{ }; use std::sync::Arc; use tokio::sync::RwLock; -use validator_client::nymd::traits::{MixnetQueryClient, MixnetSigningClient}; -use validator_client::nymd::{ +use validator_client::nyxd::traits::{MixnetQueryClient, MixnetSigningClient}; +use validator_client::nyxd::{ hash::{Hash, SHA256_HASH_SIZE}, - Coin, CosmWasmClient, QueryNymdClient, SigningCosmWasmClient, SigningNymdClient, + Coin, CosmWasmClient, QueryNyxdClient, SigningCosmWasmClient, SigningNyxdClient, TendermintTime, }; use validator_client::ValidatorClientError; @@ -38,7 +38,7 @@ use contracts_common::dealings::ContractSafeBytes; #[cfg(feature = "coconut")] use cw3::ProposalResponse; #[cfg(feature = "coconut")] -use validator_client::nymd::{ +use validator_client::nyxd::{ cosmwasm_client::types::ExecuteResult, traits::{ CoconutBandwidthQueryClient, DkgQueryClient, DkgSigningClient, MultisigQueryClient, @@ -55,44 +55,44 @@ impl Clone for Client { } } -impl Client { +impl Client { pub(crate) fn new_query(config: &Config) -> Self { // the api address is irrelevant here as **WE ARE THE API** // and we won't be talking on the socket here. let api_url = format!("http://localhost:{}", DEFAULT_NYM_API_PORT) .parse() .unwrap(); - let nymd_url = config.get_nymd_validator_url(); + let nyxd_url = config.get_nyxd_url(); let details = NymNetworkDetails::new_from_env() .with_mixnet_contract(Some(config.get_mixnet_contract_address())); let client_config = validator_client::Config::try_from_nym_network_details(&details) .expect("failed to construct valid validator client config with the provided network") - .with_urls(nymd_url, api_url); + .with_urls(nyxd_url, api_url); let inner = - validator_client::Client::new_query(client_config).expect("Failed to connect to nymd!"); + validator_client::Client::new_query(client_config).expect("Failed to connect to nyxd!"); Client(Arc::new(RwLock::new(inner))) } } -impl Client { +impl Client { pub(crate) fn new_signing(config: &Config) -> Self { // the api address is irrelevant here as **WE ARE THE API** // and we won't be talking on the socket here. let api_url = format!("http://localhost:{}", DEFAULT_NYM_API_PORT) .parse() .unwrap(); - let nymd_url = config.get_nymd_validator_url(); + let nyxd_url = config.get_nyxd_url(); let details = NymNetworkDetails::new_from_env() .with_mixnet_contract(Some(config.get_mixnet_contract_address())); let client_config = validator_client::Config::try_from_nym_network_details(&details) .expect("failed to construct valid validator client config with the provided network") - .with_urls(nymd_url, api_url); + .with_urls(nyxd_url, api_url); let mnemonic = config .get_mnemonic() @@ -100,7 +100,7 @@ impl Client { .expect("the mnemonic is invalid!"); let inner = validator_client::Client::new_signing(client_config, mnemonic) - .expect("Failed to connect to nymd!"); + .expect("Failed to connect to nyxd!"); Client(Arc::new(RwLock::new(inner))) } @@ -119,7 +119,7 @@ impl Client { .0 .read() .await - .nymd + .nyxd .get_current_block_timestamp() .await?; @@ -140,7 +140,7 @@ impl Client { where C: CosmWasmClient + Sync, { - let hash = match self.0.read().await.nymd.get_block_hash(height).await? { + let hash = match self.0.read().await.nyxd.get_block_hash(height).await? { Hash::Sha256(hash) => Some(hash), Hash::None => None, }; @@ -152,14 +152,14 @@ impl Client { where C: CosmWasmClient + Sync + Send, { - self.0.read().await.get_all_nymd_mixnodes_detailed().await + self.0.read().await.get_all_nyxd_mixnodes_detailed().await } pub(crate) async fn get_gateways(&self) -> Result, ValidatorClientError> where C: CosmWasmClient + Sync + Send, { - self.0.read().await.get_all_nymd_gateways().await + self.0.read().await.get_all_nyxd_gateways().await } pub(crate) async fn get_current_interval( @@ -189,7 +189,7 @@ impl Client { self.0 .read() .await - .get_all_nymd_rewarded_set_mixnodes() + .get_all_nyxd_rewarded_set_mixnodes() .await } @@ -243,7 +243,7 @@ impl Client { self.0 .write() .await - .nymd + .nyxd .execute_multiple( &contract, msgs, @@ -265,7 +265,7 @@ impl Client { self.0 .write() .await - .nymd + .nyxd .advance_current_epoch(new_rewarded_set, expected_active_set_size, None) .await?; Ok(()) @@ -278,7 +278,7 @@ impl Client { self.0 .write() .await - .nymd + .nyxd .reconcile_epoch_events(None, None) .await?; Ok(()) @@ -292,28 +292,28 @@ where C: SigningCosmWasmClient + Sync + Send, { async fn address(&self) -> AccountId { - self.0.read().await.nymd.address().clone() + self.0.read().await.nyxd.address().clone() } async fn get_tx( &self, tx_hash: &str, - ) -> crate::coconut::error::Result { + ) -> crate::coconut::error::Result { let tx_hash = tx_hash - .parse::() + .parse::() .map_err(|_| CoconutError::TxHashParseError)?; - Ok(self.0.read().await.nymd.get_tx(tx_hash).await?) + Ok(self.0.read().await.nyxd.get_tx(tx_hash).await?) } async fn get_proposal( &self, proposal_id: u64, ) -> crate::coconut::error::Result { - Ok(self.0.read().await.nymd.get_proposal(proposal_id).await?) + Ok(self.0.read().await.nyxd.get_proposal(proposal_id).await?) } async fn list_proposals(&self) -> crate::coconut::error::Result> { - Ok(self.0.read().await.get_all_nymd_proposals().await?) + Ok(self.0.read().await.get_all_nyxd_proposals().await?) } async fn get_spent_credential( @@ -324,13 +324,13 @@ where .0 .read() .await - .nymd + .nyxd .get_spent_credential(blinded_serial_number) .await?) } async fn get_current_epoch(&self) -> crate::coconut::error::Result { - Ok(self.0.read().await.nymd.get_current_epoch().await?) + Ok(self.0.read().await.nyxd.get_current_epoch().await?) } async fn get_current_epoch_threshold( @@ -340,7 +340,7 @@ where .0 .read() .await - .nymd + .nyxd .get_current_epoch_threshold() .await?) } @@ -353,20 +353,20 @@ where .0 .read() .await - .nymd + .nyxd .get_dealer_details(self_address) .await?) } async fn get_current_dealers(&self) -> crate::coconut::error::Result> { - Ok(self.0.read().await.get_all_nymd_current_dealers().await?) + Ok(self.0.read().await.get_all_nyxd_current_dealers().await?) } async fn get_dealings( &self, idx: usize, ) -> crate::coconut::error::Result> { - Ok(self.0.read().await.get_all_nymd_epoch_dealings(idx).await?) + Ok(self.0.read().await.get_all_nyxd_epoch_dealings(idx).await?) } async fn get_verification_key_shares( @@ -376,7 +376,7 @@ where .0 .read() .await - .get_all_nymd_verification_key_shares() + .get_all_nyxd_verification_key_shares() .await?) } @@ -389,7 +389,7 @@ where self.0 .read() .await - .nymd + .nyxd .vote_proposal(proposal_id, vote_yes, fee) .await?; Ok(()) @@ -399,7 +399,7 @@ where self.0 .read() .await - .nymd + .nyxd .execute_proposal(proposal_id, None) .await?; Ok(()) @@ -409,7 +409,7 @@ where self.0 .write() .await - .nymd + .nyxd .advance_dkg_epoch_state(None) .await?; Ok(()) @@ -424,7 +424,7 @@ where .0 .write() .await - .nymd + .nyxd .register_dealer(bte_key, announce_address, None) .await?) } @@ -437,7 +437,7 @@ where .0 .write() .await - .nymd + .nyxd .submit_dealing_bytes(dealing_bytes, None) .await?) } @@ -450,7 +450,7 @@ where .0 .write() .await - .nymd + .nyxd .submit_verification_key_share(share, None) .await?) } diff --git a/nym-connect/CHANGELOG.md b/nym-connect/CHANGELOG.md index 8e6d4eb168..d6f0c7a05a 100644 --- a/nym-connect/CHANGELOG.md +++ b/nym-connect/CHANGELOG.md @@ -44,7 +44,7 @@ This release contains the new opt-in Test & Earn program, and it uses a stress-t - native-client/socks5-client: `disable_main_poisson_packet_distribution` Debug config option to make the client ignore poisson distribution in the main packet stream and ONLY send real message (and as fast as they come) ([#1664]) - native-client/socks5-client: `use_extended_packet_size` Debug config option to make the client use 'ExtendedPacketSize' for its traffic (32kB as opposed to 2kB in 1.0.2) ([#1671]) - network-requester: added additional Blockstream Green wallet endpoint to `example.allowed.list` ([#1611]) -- validator-client: added `query_contract_smart` and `query_contract_raw` on `NymdClient` ([#1558]) +- validator-client: added `query_contract_smart` and `query_contract_raw` on `NyxdClient` ([#1558]) [#1472]: https://github.com/nymtech/nym/pull/1472 [#1558]: https://github.com/nymtech/nym/pull/1558 diff --git a/nym-connect/src-tauri/src/config/mod.rs b/nym-connect/src-tauri/src/config/mod.rs index 200bc46862..4cf4570207 100644 --- a/nym-connect/src-tauri/src/config/mod.rs +++ b/nym-connect/src-tauri/src/config/mod.rs @@ -127,7 +127,7 @@ pub async fn init_socks5_config(provider_address: String, chosen_gateway_id: Str log::trace!("Creating config for id: {}", id); let mut config = Config::new(id.as_str(), &provider_address); - if let Ok(raw_validators) = std::env::var(config_common::defaults::var_names::API_VALIDATOR) { + if let Ok(raw_validators) = std::env::var(config_common::defaults::var_names::NYM_API) { config .get_base_mut() .set_custom_nym_apis(config_common::parse_urls(&raw_validators)); diff --git a/nym-wallet/CHANGELOG.md b/nym-wallet/CHANGELOG.md index 4f6a5d089a..2e4f234db1 100644 --- a/nym-wallet/CHANGELOG.md +++ b/nym-wallet/CHANGELOG.md @@ -48,7 +48,7 @@ This release contains a bugfix for hiding and displaying the mnemonic, and displ ## [nym-wallet-v1.0.9](https://github.com/nymtech/nym/releases/tag/nym-wallet-v1.0.8) (2022-09-08) -- wallet: change default `nymd` URL to https://rpc.nymtech.net +- wallet: change default `nyxd` URL to https://rpc.nymtech.net ## [nym-wallet-v1.0.8](https://github.com/nymtech/nym/releases/tag/nym-wallet-v1.0.8) (2022-08-11) @@ -145,7 +145,7 @@ This release contains a bugfix for hiding and displaying the mnemonic, and displ - Feature/adding discord [\#1184](https://github.com/nymtech/nym/pull/1184) ([gala1234](https://github.com/gala1234)) - wallet: config backend for validator selection [\#1183](https://github.com/nymtech/nym/pull/1183) ([octol](https://github.com/octol)) - Add storybook to wallet [\#1178](https://github.com/nymtech/nym/pull/1178) ([mmsinclair](https://github.com/mmsinclair)) -- wallet: connection test nymd and api urls independently [\#1170](https://github.com/nymtech/nym/pull/1170) ([octol](https://github.com/octol)) +- wallet: connection test nyxd and api urls independently [\#1170](https://github.com/nymtech/nym/pull/1170) ([octol](https://github.com/octol)) - wallet: wire up account storage [\#1153](https://github.com/nymtech/nym/pull/1153) ([octol](https://github.com/octol)) - Feature/signature on deposit [\#1151](https://github.com/nymtech/nym/pull/1151) ([neacsu](https://github.com/neacsu)) @@ -218,7 +218,7 @@ This release contains a bugfix for hiding and displaying the mnemonic, and displ - fix: make explorer footer year dynamic [\#1059](https://github.com/nymtech/nym/pull/1059) ([martinyung](https://github.com/martinyung)) - Add mnemonic just on creation, to display it [\#1057](https://github.com/nymtech/nym/pull/1057) ([neacsu](https://github.com/neacsu)) - Network Explorer: updates to API and UI to show the active set [\#1056](https://github.com/nymtech/nym/pull/1056) ([mmsinclair](https://github.com/mmsinclair)) -- Made contract addresses for query NymdClient construction optional [\#1055](https://github.com/nymtech/nym/pull/1055) ([jstuczyn](https://github.com/jstuczyn)) +- Made contract addresses for query NyxdClient construction optional [\#1055](https://github.com/nymtech/nym/pull/1055) ([jstuczyn](https://github.com/jstuczyn)) - Introduced RPC query for total token supply [\#1053](https://github.com/nymtech/nym/pull/1053) ([jstuczyn](https://github.com/jstuczyn)) - Feature/tokio console [\#1052](https://github.com/nymtech/nym/pull/1052) ([durch](https://github.com/durch)) - Implemented beta clippy lint recommendations [\#1051](https://github.com/nymtech/nym/pull/1051) ([jstuczyn](https://github.com/jstuczyn)) diff --git a/nym-wallet/nym-wallet-types/Cargo.toml b/nym-wallet/nym-wallet-types/Cargo.toml index 322aca5c06..d2f0bde28a 100644 --- a/nym-wallet/nym-wallet-types/Cargo.toml +++ b/nym-wallet/nym-wallet-types/Cargo.toml @@ -18,7 +18,7 @@ config = { path = "../../common/config" } network-defaults = { path = "../../common/network-defaults" } mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mixnet-contract" } validator-client = { path = "../../common/client-libs/validator-client", features = [ - "nymd-client", + "nyxd-client", ] } vesting-contract-common = { path = "../../common/cosmwasm-smart-contracts/vesting-contract" } # Used for Type conversion, can be extracted but its a lot of work diff --git a/nym-wallet/nym-wallet-types/nym-wallet/src/types/rust/ValidatorUrls.ts b/nym-wallet/nym-wallet-types/nym-wallet/src/types/rust/ValidatorUrls.ts index 2ac6693e0b..c78eefd6ae 100644 --- a/nym-wallet/nym-wallet-types/nym-wallet/src/types/rust/ValidatorUrls.ts +++ b/nym-wallet/nym-wallet-types/nym-wallet/src/types/rust/ValidatorUrls.ts @@ -1,2 +1,2 @@ -export interface Validator { nymd_url: string, nymd_name: string | null, api_url: string | null, } \ No newline at end of file +export interface Validator { nyxd_url: string, nyxd_name: string | null, api_url: string | null, } \ No newline at end of file diff --git a/nym-wallet/nym-wallet-types/src/network_config.rs b/nym-wallet/nym-wallet-types/src/network_config.rs index b1f987d5b0..c3ec62b265 100644 --- a/nym-wallet/nym-wallet-types/src/network_config.rs +++ b/nym-wallet/nym-wallet-types/src/network_config.rs @@ -32,19 +32,19 @@ pub struct ValidatorUrl { )] #[derive(Debug, Serialize, Deserialize)] pub struct Validator { - pub nymd_url: String, - pub nymd_name: Option, + pub nyxd_url: String, + pub nyxd_name: Option, pub api_url: Option, } impl fmt::Display for Validator { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let nymd_url = format!("nymd_url: {}", self.nymd_url); + let nyxd_url = format!("nyxd_url: {}", self.nyxd_url); let api_url = self .api_url .as_ref() .map(|api_url| format!(", api_url: {}", api_url)) .unwrap_or_default(); - write!(f, "{nymd_url}{api_url}") + write!(f, "{nyxd_url}{api_url}") } } diff --git a/nym-wallet/src-tauri/Cargo.toml b/nym-wallet/src-tauri/Cargo.toml index 2e03275a02..d554b65f83 100644 --- a/nym-wallet/src-tauri/Cargo.toml +++ b/nym-wallet/src-tauri/Cargo.toml @@ -55,7 +55,7 @@ cosmwasm-std = "1.0.0" cosmrs = { git = "https://github.com/neacsu/cosmos-rust", branch = "neacsu/feegrant_support" } validator-client = { path = "../../common/client-libs/validator-client", features = [ - "nymd-client", + "nyxd-client", ] } mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mixnet-contract" } vesting-contract-common = { path = "../../common/cosmwasm-smart-contracts/vesting-contract" } diff --git a/nym-wallet/src-tauri/src/coin.rs b/nym-wallet/src-tauri/src/coin.rs index 79b19171d9..4195a1736d 100644 --- a/nym-wallet/src-tauri/src/coin.rs +++ b/nym-wallet/src-tauri/src/coin.rs @@ -6,9 +6,9 @@ use serde::{Deserialize, Serialize}; use std::convert::TryFrom; use std::str::FromStr; use strum::IntoEnumIterator; -use validator_client::nymd::CosmosCoin; -use validator_client::nymd::Denom as CosmosDenom; -use validator_client::nymd::{Coin as BackendCoin, CosmWasmCoin}; +use validator_client::nyxd::CosmosCoin; +use validator_client::nyxd::Denom as CosmosDenom; +use validator_client::nyxd::{Coin as BackendCoin, CosmWasmCoin}; const MINOR_IN_MAJOR: f64 = 1_000_000.; diff --git a/nym-wallet/src-tauri/src/config/mod.rs b/nym-wallet/src-tauri/src/config/mod.rs index 49d7acfdd4..d30d6236bf 100644 --- a/nym-wallet/src-tauri/src/config/mod.rs +++ b/nym-wallet/src-tauri/src/config/mod.rs @@ -11,7 +11,7 @@ use serde::de::DeserializeOwned; use serde::{Deserialize, Serialize}; use strum::IntoEnumIterator; use url::Url; -use validator_client::nymd::AccountId as CosmosAccountId; +use validator_client::nyxd::AccountId as CosmosAccountId; use config::defaults::{DenomDetailsOwned, NymNetworkDetails, ValidatorDetails}; use nym_wallet_types::network::Network as WalletNetwork; @@ -20,7 +20,7 @@ use nym_wallet_types::network_config; use crate::error::BackendError; use crate::platform_constants::{CONFIG_DIR_NAME, CONFIG_FILENAME}; -pub const REMOTE_SOURCE_OF_VALIDATOR_URLS: &str = +pub const REMOTE_SOURCE_OF_NYXD_URLS: &str = "https://nymtech.net/.wellknown/wallet/validators.json"; const CURRENT_GLOBAL_CONFIG_VERSION: u32 = 1; @@ -56,12 +56,12 @@ pub struct NetworkConfig { version: Option, // User selected urls - selected_nymd_url: Option, + selected_nyxd_url: Option, selected_api_url: Option, // Additional user provided validators. - // It is an option for the purpuse of file serialization. - validator_urls: Option>, + // It is an option for the purpose of file serialization. + nyxd_urls: Option>, } impl Default for Base { @@ -85,16 +85,16 @@ impl Default for NetworkConfig { fn default() -> Self { Self { version: Some(CURRENT_NETWORK_CONFIG_VERSION), - selected_nymd_url: None, + selected_nyxd_url: None, selected_api_url: None, - validator_urls: None, + nyxd_urls: None, } } } impl NetworkConfig { fn validators(&self) -> impl Iterator { - self.validator_urls.iter().flat_map(|v| v.iter()) + self.nyxd_urls.iter().flat_map(|v| v.iter()) } } @@ -241,14 +241,14 @@ impl Config { .expect("Wrong format for bandwidth claim contract address") } - pub fn select_validator_nymd_url(&mut self, nymd_url: Url, network: WalletNetwork) { + pub fn select_nyxd_url(&mut self, nyxd_url: Url, network: WalletNetwork) { if let Some(net) = self.networks.get_mut(&network.as_key()) { - net.selected_nymd_url = Some(nymd_url); + net.selected_nyxd_url = Some(nyxd_url); } else { self.networks.insert( network.as_key(), NetworkConfig { - selected_nymd_url: Some(nymd_url), + selected_nyxd_url: Some(nyxd_url), ..NetworkConfig::default() }, ); @@ -262,17 +262,17 @@ impl Config { self.networks.insert( network.as_key(), NetworkConfig { - selected_nymd_url: Some(api_url), + selected_nyxd_url: Some(api_url), ..NetworkConfig::default() }, ); } } - pub fn get_selected_validator_nymd_url(&self, network: WalletNetwork) -> Option { + pub fn get_selected_validator_nyxd_url(&self, network: WalletNetwork) -> Option { self.networks .get(&network.as_key()) - .and_then(|config| config.selected_nymd_url.clone()) + .and_then(|config| config.selected_nyxd_url.clone()) } pub fn get_selected_nym_api_url(&self, network: &WalletNetwork) -> Option { @@ -283,16 +283,16 @@ impl Config { pub fn add_validator_url(&mut self, url: ValidatorConfigEntry, network: WalletNetwork) { if let Some(network_config) = self.networks.get_mut(&network.as_key()) { - if let Some(ref mut urls) = network_config.validator_urls { + if let Some(ref mut urls) = network_config.nyxd_urls { urls.push(url); } else { - network_config.validator_urls = Some(vec![url]); + network_config.nyxd_urls = Some(vec![url]); } } else { self.networks.insert( network.as_key(), NetworkConfig { - validator_urls: Some(vec![url]), + nyxd_urls: Some(vec![url]), ..NetworkConfig::default() }, ); @@ -301,7 +301,7 @@ impl Config { pub fn remove_validator_url(&mut self, url: ValidatorConfigEntry, network: WalletNetwork) { if let Some(network_config) = self.networks.get_mut(&network.as_key()) { - if let Some(ref mut urls) = network_config.validator_urls { + if let Some(ref mut urls) = network_config.nyxd_urls { // Removes duplicates too if there are any urls.retain(|existing_url| existing_url != &url); } @@ -321,8 +321,8 @@ where #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Hash)] pub struct ValidatorConfigEntry { - pub nymd_url: Url, - pub nymd_name: Option, + pub nyxd_url: Url, + pub nyxd_name: Option, pub api_url: Option, } @@ -331,8 +331,8 @@ impl TryFrom for ValidatorConfigEntry { fn try_from(validator: ValidatorDetails) -> Result { Ok(ValidatorConfigEntry { - nymd_url: validator.nymd_url.parse()?, - nymd_name: None, + nyxd_url: validator.nyxd_url.parse()?, + nyxd_name: None, api_url: match &validator.api_url { Some(url) => Some(url.parse()?), None => None, @@ -346,8 +346,8 @@ impl TryFrom for ValidatorConfigEntry { fn try_from(validator: network_config::Validator) -> Result { Ok(ValidatorConfigEntry { - nymd_url: validator.nymd_url.parse()?, - nymd_name: validator.nymd_name, + nyxd_url: validator.nyxd_url.parse()?, + nyxd_name: validator.nyxd_name, api_url: match &validator.api_url { Some(url) => Some(url.parse()?), None => None, @@ -358,8 +358,8 @@ impl TryFrom for ValidatorConfigEntry { impl fmt::Display for ValidatorConfigEntry { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let s1 = format!("nymd_url: {}", self.nymd_url); - let name = self.nymd_name.as_ref().map(|name| format!(" ({})", name)); + let s1 = format!("nyxd_url: {}", self.nyxd_url); + let name = self.nyxd_name.as_ref().map(|name| format!(" ({})", name)); let s2 = self .api_url .as_ref() @@ -510,23 +510,23 @@ mod tests { fn test_config() -> Config { let netconfig = NetworkConfig { - selected_nymd_url: None, + selected_nyxd_url: None, selected_api_url: Some("https://my_api_url.com".parse().unwrap()), - validator_urls: Some(vec![ + nyxd_urls: Some(vec![ ValidatorConfigEntry { - nymd_url: "https://foo".parse().unwrap(), - nymd_name: Some("FooName".to_string()), + nyxd_url: "https://foo".parse().unwrap(), + nyxd_name: Some("FooName".to_string()), api_url: None, }, ValidatorConfigEntry { - nymd_url: "https://bar".parse().unwrap(), - nymd_name: None, + nyxd_url: "https://bar".parse().unwrap(), + nyxd_name: None, api_url: Some("https://bar/api".parse().unwrap()), }, ValidatorConfigEntry { - nymd_url: "https://baz".parse().unwrap(), - nymd_name: None, + nyxd_url: "https://baz".parse().unwrap(), + nyxd_name: None, api_url: Some("https://baz/api".parse().unwrap()), }, ]), @@ -551,16 +551,16 @@ mod tests { r#"version = 1 selected_api_url = 'https://my_api_url.com/' -[[validator_urls]] -nymd_url = 'https://foo/' -nymd_name = 'FooName' +[[nyxd_urls]] +nyxd_url = 'https://foo/' +nyxd_name = 'FooName' -[[validator_urls]] -nymd_url = 'https://bar/' +[[nyxd_urls]] +nyxd_url = 'https://bar/' api_url = 'https://bar/api' -[[validator_urls]] -nymd_url = 'https://baz/' +[[nyxd_urls]] +nyxd_url = 'https://baz/' api_url = 'https://baz/api' "# ); @@ -575,22 +575,22 @@ api_url = 'https://baz/api' serde_json::to_string_pretty(netconfig).unwrap(), r#"{ "version": 1, - "selected_nymd_url": null, + "selected_nyxd_url": null, "selected_api_url": "https://my_api_url.com/", - "validator_urls": [ + "nyxd_urls": [ { - "nymd_url": "https://foo/", - "nymd_name": "FooName", + "nyxd_url": "https://foo/", + "nyxd_name": "FooName", "api_url": null }, { - "nymd_url": "https://bar/", - "nymd_name": null, + "nyxd_url": "https://bar/", + "nyxd_name": null, "api_url": "https://bar/api" }, { - "nymd_url": "https://baz/", - "nymd_name": null, + "nyxd_url": "https://baz/", + "nyxd_name": null, "api_url": "https://baz/api" } ] @@ -611,12 +611,12 @@ api_url = 'https://baz/api' fn get_urls_parsed_from_config() { let config = test_config(); - let nymd_url = config + let nyxd_url = config .get_configured_validators(WalletNetwork::MAINNET) .next() - .map(|v| v.nymd_url) + .map(|v| v.nyxd_url) .unwrap(); - assert_eq!(nymd_url.as_ref(), "https://foo/"); + assert_eq!(nyxd_url.as_ref(), "https://foo/"); // The first entry is missing an API URL let api_url = config @@ -630,12 +630,12 @@ api_url = 'https://baz/api' fn get_urls_from_defaults() { let config = Config::default(); - let nymd_url = config + let nyxd_url = config .get_base_validators(WalletNetwork::MAINNET) .next() - .map(|v| v.nymd_url) + .map(|v| v.nyxd_url) .unwrap(); - assert_eq!(nymd_url.as_ref(), "https://rpc.nymtech.net/"); + assert_eq!(nyxd_url.as_ref(), "https://rpc.nymtech.net/"); let api_url = config .get_base_validators(WalletNetwork::MAINNET) diff --git a/nym-wallet/src-tauri/src/error.rs b/nym-wallet/src-tauri/src/error.rs index 7f5dfe0812..e47a0ab272 100644 --- a/nym-wallet/src-tauri/src/error.rs +++ b/nym-wallet/src-tauri/src/error.rs @@ -5,7 +5,7 @@ use std::io; use std::num::ParseIntError; use thiserror::Error; use validator_client::nym_api::error::NymAPIError; -use validator_client::{nymd::error::NymdError, ValidatorClientError}; +use validator_client::{nyxd::error::NyxdError, ValidatorClientError}; #[derive(Error, Debug)] pub enum BackendError { @@ -25,10 +25,10 @@ pub enum BackendError { source: tendermint_rpc::Error, }, #[error("{pretty_error}")] - NymdError { + NyxdError { pretty_error: String, #[source] - source: NymdError, + source: NyxdError, }, #[error("{source}")] CosmwasmStd { @@ -132,29 +132,29 @@ impl Serialize for BackendError { } } -impl From for BackendError { - fn from(source: NymdError) -> Self { +impl From for BackendError { + fn from(source: NyxdError) -> Self { match source { - NymdError::AbciError { + NyxdError::AbciError { code: _, log: _, ref pretty_log, } => { if let Some(pretty_log) = pretty_log { - Self::NymdError { + Self::NyxdError { pretty_error: pretty_log.to_string(), source, } } else { - Self::NymdError { + Self::NyxdError { pretty_error: source.to_string(), source, } } } - nymd_error => Self::NymdError { - pretty_error: nymd_error.to_string(), - source: nymd_error, + nyxd_error => Self::NyxdError { + pretty_error: nyxd_error.to_string(), + source: nyxd_error, }, } } @@ -165,7 +165,7 @@ impl From for BackendError { match e { ValidatorClientError::NymAPIError { source } => source.into(), ValidatorClientError::MalformedUrlProvided(e) => e.into(), - ValidatorClientError::NymdError(e) => e.into(), + ValidatorClientError::NyxdError(e) => e.into(), ValidatorClientError::NoAPIUrlAvailable => TypesError::NoNymApiUrlConfigured.into(), } } diff --git a/nym-wallet/src-tauri/src/main.rs b/nym-wallet/src-tauri/src/main.rs index 8705891c0a..cc82f9f7df 100644 --- a/nym-wallet/src-tauri/src/main.rs +++ b/nym-wallet/src-tauri/src/main.rs @@ -88,11 +88,11 @@ fn main() { mixnet::bond::get_mixnode_uptime, network_config::add_validator, network_config::get_nym_api_urls, - network_config::get_validator_nymd_urls, + network_config::get_nyxd_urls, network_config::remove_validator, network_config::select_nym_api_url, - network_config::select_validator_nymd_url, - network_config::update_validator_urls, + network_config::select_nyxd_url, + network_config::update_nyxd_urls, state::load_config_from_files, state::save_config_to_files, utils::owns_gateway, diff --git a/nym-wallet/src-tauri/src/network_config.rs b/nym-wallet/src-tauri/src/network_config.rs index ce976b971d..bcac19bb62 100644 --- a/nym-wallet/src-tauri/src/network_config.rs +++ b/nym-wallet/src-tauri/src/network_config.rs @@ -7,12 +7,12 @@ use nym_wallet_types::network::Network as WalletNetwork; use nym_wallet_types::network_config::{Validator, ValidatorUrl, ValidatorUrls}; #[tauri::command] -pub async fn get_validator_nymd_urls( +pub async fn get_nyxd_urls( network: WalletNetwork, state: tauri::State<'_, WalletState>, ) -> Result { let state = state.read().await; - let urls: Vec = state.get_nymd_urls(network).collect(); + let urls: Vec = state.get_nyxd_urls(network).collect(); Ok(ValidatorUrls { urls }) } @@ -27,16 +27,13 @@ pub async fn get_nym_api_urls( } #[tauri::command] -pub async fn select_validator_nymd_url( +pub async fn select_nyxd_url( url: &str, network: WalletNetwork, state: tauri::State<'_, WalletState>, ) -> Result<(), BackendError> { - log::debug!("Selecting new validator nymd_url for {network}: {url}"); - state - .write() - .await - .select_validator_nymd_url(url, network)?; + log::debug!("Selecting new nyxd url for {network}: {url}"); + state.write().await.select_nyxd_url(url, network)?; Ok(()) } @@ -46,7 +43,7 @@ pub async fn select_nym_api_url( network: WalletNetwork, state: tauri::State<'_, WalletState>, ) -> Result<(), BackendError> { - log::debug!("Selecting new validator api_url for {network}: {url}"); + log::debug!("Selecting new nym api url for {network}: {url}"); state.write().await.select_nym_api_url(url, network)?; Ok(()) } @@ -77,10 +74,8 @@ pub async fn remove_validator( // Update the list of validators by fecthing additional ones remotely. If it fails, just ignore. #[tauri::command] -pub async fn update_validator_urls( - state: tauri::State<'_, WalletState>, -) -> Result<(), BackendError> { +pub async fn update_nyxd_urls(state: tauri::State<'_, WalletState>) -> Result<(), BackendError> { let mut w_state = state.write().await; - let _r = w_state.fetch_updated_validator_urls().await; + let _r = w_state.fetch_updated_nyxd_urls().await; Ok(()) } diff --git a/nym-wallet/src-tauri/src/operations/mixnet/account.rs b/nym-wallet/src-tauri/src/operations/mixnet/account.rs index 9a3afafe6d..d9f3f122d7 100644 --- a/nym-wallet/src-tauri/src/operations/mixnet/account.rs +++ b/nym-wallet/src-tauri/src/operations/mixnet/account.rs @@ -14,8 +14,8 @@ use std::collections::HashMap; use std::str::FromStr; use strum::IntoEnumIterator; use url::Url; -use validator_client::nymd::wallet::{AccountData, DirectSecp256k1HdWallet}; -use validator_client::{nymd::SigningNymdClient, Client}; +use validator_client::nyxd::wallet::{AccountData, DirectSecp256k1HdWallet}; +use validator_client::{nyxd::SigningNyxdClient, Client}; #[tauri::command] pub async fn connect_with_mnemonic( @@ -30,12 +30,12 @@ pub async fn connect_with_mnemonic( pub async fn get_balance(state: tauri::State<'_, WalletState>) -> Result { let guard = state.read().await; let client = guard.current_client()?; - let address = client.nymd.address(); + let address = client.nyxd.address(); let network = guard.current_network(); let base_mix_denom = network.base_mix_denom(); match client - .nymd + .nyxd .get_balance(address, base_mix_denom.to_string()) .await? { @@ -67,7 +67,7 @@ pub async fn switch_network( let client = r_state.client(network)?; let denom = network.mix_denom(); - Account::new(client.nymd.address().to_string(), denom) + Account::new(client.nyxd.address().to_string(), denom) }; let mut w_state = state.write().await; @@ -96,7 +96,7 @@ async fn _connect_with_mnemonic( w_state.load_config_files(); } - network_config::update_validator_urls(state.clone()).await?; + network_config::update_nyxd_urls(state.clone()).await?; let config = { let state = state.read().await; @@ -115,11 +115,11 @@ async fn _connect_with_mnemonic( }; // Get all the urls needed for the connection test - let (untested_nymd_urls, untested_api_urls) = { + let (untested_nyxd_urls, untested_api_urls) = { let state = state.read().await; - (state.get_all_nymd_urls(), state.get_all_api_urls()) + (state.get_all_nyxd_urls(), state.get_all_api_urls()) }; - let default_nymd_urls: HashMap = untested_nymd_urls + let default_nyxd_urls: HashMap = untested_nyxd_urls .iter() .map(|(network, urls)| (*network, urls.iter().next().unwrap().clone())) .collect(); @@ -128,15 +128,15 @@ async fn _connect_with_mnemonic( .map(|(network, urls)| (*network, urls.iter().next().unwrap().clone())) .collect(); - // Run connection tests on all nymd and nym-api endpoints - let (nymd_urls, api_urls) = - run_connection_test(untested_nymd_urls, untested_api_urls, &config).await; + // Run connection tests on all nyxd and nym-api endpoints + let (nyxd_urls, api_urls) = + run_connection_test(untested_nyxd_urls, untested_api_urls, &config).await; // Create clients for all networks let clients = create_clients( - &nymd_urls, + &nyxd_urls, &api_urls, - &default_nymd_urls, + &default_nyxd_urls, &default_api_urls, &config, &mnemonic, @@ -149,7 +149,7 @@ async fn _connect_with_mnemonic( .find(|(network, _)| *network == default_network); let account_for_default_network = match client_for_default_network { Some((_, client)) => Ok(Account::new( - client.nymd.address().to_string(), + client.nyxd.address().to_string(), default_network.mix_denom(), )), None => Err(BackendError::NetworkNotSupported), @@ -170,7 +170,7 @@ async fn _connect_with_mnemonic( } async fn run_connection_test( - untested_nymd_urls: HashMap>, + untested_nyxd_urls: HashMap>, untested_api_urls: HashMap>, config: &Config, ) -> ( @@ -181,7 +181,7 @@ async fn run_connection_test( .map(|network| (network.into(), config.get_mixnet_contract_address(network))) .collect::>(); - let untested_nymd_urls = untested_nymd_urls + let untested_nyxd_urls = untested_nyxd_urls .into_iter() .flat_map(|(net, urls)| urls.into_iter().map(move |url| (net.into(), url))); @@ -190,7 +190,7 @@ async fn run_connection_test( .flat_map(|(net, urls)| urls.into_iter().map(move |url| (net.into(), url))); validator_client::connection_tester::run_validator_connection_test( - untested_nymd_urls, + untested_nyxd_urls, untested_api_urls, mixnet_contract_address, ) @@ -198,27 +198,27 @@ async fn run_connection_test( } fn create_clients( - nymd_urls: &HashMap>, + nyxd_urls: &HashMap>, api_urls: &HashMap>, - default_nymd_urls: &HashMap, + default_nyxd_urls: &HashMap, default_api_urls: &HashMap, config: &Config, mnemonic: &Mnemonic, -) -> Result)>, BackendError> { +) -> Result)>, BackendError> { let mut clients = Vec::new(); for network in WalletNetwork::iter() { - let nymd_url = if let Some(url) = config.get_selected_validator_nymd_url(network) { - log::debug!("Using selected nymd_url for {network}: {url}"); + let nyxd_url = if let Some(url) = config.get_selected_validator_nyxd_url(network) { + log::debug!("Using selected nyxd_url for {network}: {url}"); url.clone() } else { - let default_nymd_url = default_nymd_urls + let default_nyxd_url = default_nyxd_urls .get(&network) - .expect("Expected at least one nymd_url"); - select_random_responding_url(nymd_urls, network).unwrap_or_else(|| { + .expect("Expected at least one nyxd_url"); + select_random_responding_url(nyxd_urls, network).unwrap_or_else(|| { log::debug!( - "No successful nymd_urls for {network}: using default: {default_nymd_url}" + "No successful nyxd_urls for {network}: using default: {default_nyxd_url}" ); - default_nymd_url.clone() + default_nyxd_url.clone() }) }; @@ -235,7 +235,7 @@ fn create_clients( }) }; - log::info!("Connecting to: nymd_url: {nymd_url} for {network}"); + log::info!("Connecting to: nyxd_url: {nyxd_url} for {network}"); log::info!("Connecting to: api_url: {api_url} for {network}"); let network_details = NymNetworkDetails::from(network) @@ -249,10 +249,10 @@ fn create_clients( )); let config = validator_client::Config::try_from_nym_network_details(&network_details)? - .with_urls(nymd_url, api_url); + .with_urls(nyxd_url, api_url); let mut client = validator_client::Client::new_signing(config, mnemonic.clone())?; - client.set_nymd_simulated_gas_multiplier(CUSTOM_SIMULATED_GAS_MULTIPLIER); + client.set_nyxd_simulated_gas_multiplier(CUSTOM_SIMULATED_GAS_MULTIPLIER); clients.push((network, client)); } Ok(clients) diff --git a/nym-wallet/src-tauri/src/operations/mixnet/admin.rs b/nym-wallet/src-tauri/src/operations/mixnet/admin.rs index 5074c5500e..3633c3ac5d 100644 --- a/nym-wallet/src-tauri/src/operations/mixnet/admin.rs +++ b/nym-wallet/src-tauri/src/operations/mixnet/admin.rs @@ -6,8 +6,8 @@ use crate::state::WalletState; use mixnet_contract_common::ContractStateParams; use nym_types::transaction::TransactionExecuteResult; use nym_wallet_types::admin::TauriContractStateParams; -use validator_client::nymd::traits::{MixnetQueryClient, MixnetSigningClient}; -use validator_client::nymd::Fee; +use validator_client::nyxd::traits::{MixnetQueryClient, MixnetSigningClient}; +use validator_client::nyxd::Fee; #[tauri::command] pub async fn get_contract_settings( @@ -17,7 +17,7 @@ pub async fn get_contract_settings( let guard = state.read().await; let reg = guard.registered_coins()?; - let client = &guard.current_client()?.nymd; + let client = &guard.current_client()?.nyxd; let res = client.get_mixnet_contract_settings().await?; let converted = TauriContractStateParams::from_mixnet_contract_contract_state_params(res, reg)?; @@ -33,7 +33,7 @@ pub async fn update_contract_settings( ) -> Result { let guard = state.read().await; let reg = guard.registered_coins()?; - let client = &guard.current_client()?.nymd; + let client = &guard.current_client()?.nyxd; let fee_amount = guard.convert_tx_fee(fee.as_ref()); let mixnet_contract_settings_params: ContractStateParams = diff --git a/nym-wallet/src-tauri/src/operations/mixnet/bond.rs b/nym-wallet/src-tauri/src/operations/mixnet/bond.rs index 1ccdc243ae..c33c4c5190 100644 --- a/nym-wallet/src-tauri/src/operations/mixnet/bond.rs +++ b/nym-wallet/src-tauri/src/operations/mixnet/bond.rs @@ -3,7 +3,7 @@ use crate::error::BackendError; use crate::state::WalletState; -use crate::{nymd_client, Gateway, MixNode}; +use crate::{nyxd_client, Gateway, MixNode}; use mixnet_contract_common::{MixId, MixNodeConfigUpdate}; use nym_types::currency::DecCoin; use nym_types::gateway::GatewayBond; @@ -11,8 +11,8 @@ use nym_types::mixnode::{MixNodeCostParams, MixNodeDetails}; use nym_types::transaction::TransactionExecuteResult; use serde::{Deserialize, Serialize}; use std::time::Duration; -use validator_client::nymd::traits::{MixnetQueryClient, MixnetSigningClient}; -use validator_client::nymd::Fee; +use validator_client::nyxd::traits::{MixnetQueryClient, MixnetSigningClient}; +use validator_client::nyxd::Fee; #[derive(Debug, Serialize, Deserialize)] pub struct NodeDescription { @@ -43,7 +43,7 @@ pub async fn bond_gateway( ); let res = guard .current_client()? - .nymd + .nyxd .bond_gateway(gateway, owner_signature, pledge_base, fee) .await?; log::info!("<<< tx hash = {}", res.transaction_hash); @@ -61,7 +61,7 @@ pub async fn unbond_gateway( let guard = state.read().await; let fee_amount = guard.convert_tx_fee(fee.as_ref()); log::info!(">>> Unbond gateway, fee = {:?}", fee); - let res = guard.current_client()?.nymd.unbond_gateway(fee).await?; + let res = guard.current_client()?.nyxd.unbond_gateway(fee).await?; log::info!("<<< tx hash = {}", res.transaction_hash); log::trace!("<<< {:?}", res); Ok(TransactionExecuteResult::from_execute_result( @@ -92,7 +92,7 @@ pub async fn bond_mixnode( ); let res = guard .current_client()? - .nymd + .nyxd .bond_mixnode(mixnode, cost_params, owner_signature, pledge_base, fee) .await?; log::info!("<<< tx hash = {}", res.transaction_hash); @@ -119,7 +119,7 @@ pub async fn pledge_more( ); let res = guard .current_client()? - .nymd + .nyxd .pledge_more(additional_pledge_base, fee) .await?; log::info!("<<< tx hash = {}", res.transaction_hash); @@ -137,7 +137,7 @@ pub async fn unbond_mixnode( let guard = state.read().await; let fee_amount = guard.convert_tx_fee(fee.as_ref()); log::info!(">>> Unbond mixnode, fee = {:?}", fee); - let res = guard.current_client()?.nymd.unbond_mixnode(fee).await?; + let res = guard.current_client()?.nyxd.unbond_mixnode(fee).await?; log::info!("<<< tx hash = {}", res.transaction_hash); log::trace!("<<< {:?}", res); Ok(TransactionExecuteResult::from_execute_result( @@ -162,7 +162,7 @@ pub async fn update_mixnode_cost_params( ); let res = guard .current_client()? - .nymd + .nyxd .update_mixnode_cost_params(cost_params, fee) .await?; log::info!("<<< tx hash = {}", res.transaction_hash); @@ -187,7 +187,7 @@ pub async fn update_mixnode_config( ); let res = guard .current_client()? - .nymd + .nyxd .update_mixnode_config(update, fee) .await?; log::info!("<<< tx hash = {}", res.transaction_hash); @@ -204,7 +204,7 @@ pub async fn get_mixnode_avg_uptime( log::info!(">>> Get mixnode bond details"); let guard = state.read().await; let client = guard.current_client()?; - let res = client.nymd.get_owned_mixnode(client.nymd.address()).await?; + let res = client.nyxd.get_owned_mixnode(client.nyxd.address()).await?; match res.mixnode_details { Some(details) => { @@ -230,7 +230,7 @@ pub async fn mixnode_bond_details( log::info!(">>> Get mixnode bond details"); let guard = state.read().await; let client = guard.current_client()?; - let res = client.nymd.get_owned_mixnode(client.nymd.address()).await?; + let res = client.nyxd.get_owned_mixnode(client.nyxd.address()).await?; let details = res .mixnode_details .map(|details| { @@ -258,7 +258,7 @@ pub async fn gateway_bond_details( log::info!(">>> Get gateway bond details"); let guard = state.read().await; let client = guard.current_client()?; - let bond = client.nymd.get_owned_gateway(client.nymd.address()).await?; + let bond = client.nyxd.get_owned_gateway(client.nyxd.address()).await?; let res = bond .gateway .map(|bond| { @@ -286,7 +286,7 @@ pub async fn get_pending_operator_rewards( let guard = state.read().await; let res = guard .current_client()? - .nymd + .nyxd .get_pending_operator_reward(&address.parse()?) .await?; @@ -319,7 +319,7 @@ pub async fn get_number_of_mixnode_delegators( mix_id: MixId, state: tauri::State<'_, WalletState>, ) -> Result { - Ok(nymd_client!(state) + Ok(nyxd_client!(state) .get_mixnode_details(mix_id) .await? .mixnode_details diff --git a/nym-wallet/src-tauri/src/operations/mixnet/delegate.rs b/nym-wallet/src-tauri/src/operations/mixnet/delegate.rs index 8b8f615244..cf26c1f527 100644 --- a/nym-wallet/src-tauri/src/operations/mixnet/delegate.rs +++ b/nym-wallet/src-tauri/src/operations/mixnet/delegate.rs @@ -13,8 +13,8 @@ use nym_types::deprecated::{ use nym_types::mixnode::MixNodeCostParams; use nym_types::pending_events::PendingEpochEvent; use nym_types::transaction::TransactionExecuteResult; -use validator_client::nymd::traits::{MixnetQueryClient, MixnetSigningClient}; -use validator_client::nymd::Fee; +use validator_client::nyxd::traits::{MixnetQueryClient, MixnetSigningClient}; +use validator_client::nyxd::Fee; #[tauri::command] pub async fn get_pending_delegation_events( @@ -25,7 +25,7 @@ pub async fn get_pending_delegation_events( let reg = guard.registered_coins()?; let client = guard.current_client()?; - let events = client.get_all_nymd_pending_epoch_events().await?; + let events = client.get_all_nyxd_pending_epoch_events().await?; let converted = events .into_iter() .map(|e| PendingEpochEvent::try_from_mixnet_contract(e, reg)) @@ -36,9 +36,9 @@ pub async fn get_pending_delegation_events( // we only care about events concerning THIS client let mut client_specific_events = Vec::new(); for delegation_event in delegation_events { - if delegation_event.address_matches(client.nymd.address().as_ref()) { + if delegation_event.address_matches(client.nyxd.address().as_ref()) { let node_identity = client - .nymd + .nyxd .get_mixnode_details(delegation_event.mix_id) .await? .mixnode_details @@ -82,7 +82,7 @@ pub async fn delegate_to_mixnode( fee, ); let res = client - .nymd + .nyxd .delegate_to_mixnode(mix_id, delegation_base, fee) .await?; log::info!("<<< tx hash = {}", res.transaction_hash); @@ -108,7 +108,7 @@ pub async fn undelegate_from_mixnode( ); let res = guard .current_client()? - .nymd + .nyxd .undelegate_from_mixnode(mix_id, fee) .await?; log::info!("<<< tx hash = {}", res.transaction_hash); @@ -153,10 +153,10 @@ pub async fn get_all_mix_delegations( let client = guard.current_client()?; let reg = guard.registered_coins()?; - let address = client.nymd.address(); + let address = client.nyxd.address(); let network = guard.current_network(); let base_mix_denom = network.base_mix_denom().to_string(); - let vesting_contract = client.nymd.vesting_contract_address(); + let vesting_contract = client.nyxd.vesting_contract_address(); log::info!(" >>> Get delegations"); let delegations = client.get_all_delegator_delegations(address).await?; @@ -213,7 +213,7 @@ pub async fn get_all_mix_delegations( log::trace!(" >>> Get accumulated rewards: address = {}", address); let pending_reward = client - .nymd + .nyxd .get_pending_delegator_reward(address, d.mix_id, d.proxy.clone()) .await?; @@ -230,7 +230,7 @@ pub async fn get_all_mix_delegations( }; log::trace!(" >>> Get stake saturation: mix_id = {}", d.mix_id); - let stake_saturation = client.nymd.get_mixnode_stake_saturation(d.mix_id).await?; + let stake_saturation = client.nyxd.get_mixnode_stake_saturation(d.mix_id).await?; log::trace!(" <<< {:?}", stake_saturation); log::trace!( @@ -250,7 +250,7 @@ pub async fn get_all_mix_delegations( d.height ); let timestamp = client - .nymd + .nyxd .get_block_timestamp(Some(d.height as u32)) .await?; let delegated_on_iso_datetime = timestamp.to_rfc3339(); @@ -325,7 +325,7 @@ pub async fn get_pending_delegator_rewards( let guard = state.read().await; let res = guard .current_client()? - .nymd + .nyxd .get_pending_delegator_reward(&address.parse()?, mix_id, proxy) .await?; diff --git a/nym-wallet/src-tauri/src/operations/mixnet/families.rs b/nym-wallet/src-tauri/src/operations/mixnet/families.rs index 6e391ab722..aba66c9a58 100644 --- a/nym-wallet/src-tauri/src/operations/mixnet/families.rs +++ b/nym-wallet/src-tauri/src/operations/mixnet/families.rs @@ -1,8 +1,8 @@ use crate::error::BackendError; use crate::state::WalletState; use nym_types::transaction::TransactionExecuteResult; -use validator_client::nymd::traits::MixnetSigningClient; -use validator_client::nymd::Fee; +use validator_client::nyxd::traits::MixnetSigningClient; +use validator_client::nyxd::Fee; #[tauri::command] pub async fn create_family( @@ -15,7 +15,7 @@ pub async fn create_family( let fee_amount = guard.convert_tx_fee(fee.as_ref()); let res = guard .current_client()? - .nymd + .nyxd .create_family(signature, label, fee) .await?; Ok(TransactionExecuteResult::from_execute_result( @@ -34,7 +34,7 @@ pub async fn join_family( let fee_amount = guard.convert_tx_fee(fee.as_ref()); let res = guard .current_client()? - .nymd + .nyxd .join_family(signature, family_head, fee) .await?; Ok(TransactionExecuteResult::from_execute_result( @@ -53,7 +53,7 @@ pub async fn leave_family( let fee_amount = guard.convert_tx_fee(fee.as_ref()); let res = guard .current_client()? - .nymd + .nyxd .leave_family(signature, family_head, fee) .await?; Ok(TransactionExecuteResult::from_execute_result( @@ -72,7 +72,7 @@ pub async fn kick_family_member( let fee_amount = guard.convert_tx_fee(fee.as_ref()); let res = guard .current_client()? - .nymd + .nyxd .kick_family_member(signature, member, fee) .await?; Ok(TransactionExecuteResult::from_execute_result( diff --git a/nym-wallet/src-tauri/src/operations/mixnet/interval.rs b/nym-wallet/src-tauri/src/operations/mixnet/interval.rs index ce88d840b4..996f9bbf69 100644 --- a/nym-wallet/src-tauri/src/operations/mixnet/interval.rs +++ b/nym-wallet/src-tauri/src/operations/mixnet/interval.rs @@ -2,18 +2,18 @@ // SPDX-License-Identifier: Apache-2.0 use crate::error::BackendError; -use crate::nymd_client; +use crate::nyxd_client; use crate::state::WalletState; use nym_types::pending_events::{PendingEpochEvent, PendingIntervalEvent}; use nym_wallet_types::interval::Interval; -use validator_client::nymd::traits::MixnetQueryClient; +use validator_client::nyxd::traits::MixnetQueryClient; #[tauri::command] pub async fn get_current_interval( state: tauri::State<'_, WalletState>, ) -> Result { log::info!(">>> Get current interval"); - let res = nymd_client!(state).get_current_interval_details().await?; + let res = nyxd_client!(state).get_current_interval_details().await?; log::info!("<<< current interval = {:?}", res); Ok(res.interval.into()) } @@ -26,7 +26,7 @@ pub async fn get_pending_epoch_events( let guard = state.read().await; let reg = guard.registered_coins()?; let client = guard.current_client()?; - let res = client.get_all_nymd_pending_epoch_events().await?; + let res = client.get_all_nyxd_pending_epoch_events().await?; log::info!("<<< got = {:?} events", res.len()); @@ -46,7 +46,7 @@ pub async fn get_pending_interval_events( let guard = state.read().await; let reg = guard.registered_coins()?; let client = guard.current_client()?; - let res = client.get_all_nymd_pending_interval_events().await?; + let res = client.get_all_nyxd_pending_interval_events().await?; log::info!("<<< got = {:?} events", res.len()); diff --git a/nym-wallet/src-tauri/src/operations/mixnet/rewards.rs b/nym-wallet/src-tauri/src/operations/mixnet/rewards.rs index b4a048eeea..0a6fd3ae7f 100644 --- a/nym-wallet/src-tauri/src/operations/mixnet/rewards.rs +++ b/nym-wallet/src-tauri/src/operations/mixnet/rewards.rs @@ -3,8 +3,8 @@ use crate::state::WalletState; use crate::vesting::rewards::vesting_claim_delegator_reward; use mixnet_contract_common::{MixId, RewardingParams}; use nym_types::transaction::TransactionExecuteResult; -use validator_client::nymd::traits::{MixnetQueryClient, MixnetSigningClient}; -use validator_client::nymd::Fee; +use validator_client::nyxd::traits::{MixnetQueryClient, MixnetSigningClient}; +use validator_client::nyxd::Fee; #[tauri::command] pub async fn claim_operator_reward( @@ -17,7 +17,7 @@ pub async fn claim_operator_reward( let fee_amount = guard.convert_tx_fee(fee.as_ref()); let res = guard .current_client()? - .nymd + .nyxd .withdraw_operator_reward(fee) .await?; log::info!("<<< tx hash = {}", res.transaction_hash); @@ -38,7 +38,7 @@ pub async fn claim_delegator_reward( let fee_amount = guard.convert_tx_fee(fee.as_ref()); let res = guard .current_client()? - .nymd + .nyxd .withdraw_delegator_reward(mix_id, fee) .await?; log::info!("<<< tx hash = {}", res.transaction_hash); @@ -63,11 +63,11 @@ pub async fn claim_locked_and_unlocked_delegator_reward( let client = guard.current_client()?; log::trace!(">>> Get delegations: mix_id = {}", mix_id); - let address = client.nymd.address(); + let address = client.nyxd.address(); let delegations = client.get_all_delegator_delegations(address).await?; log::trace!("<<< {} delegations", delegations.len()); - let vesting_contract = client.nymd.vesting_contract_address().to_string(); + let vesting_contract = client.nyxd.vesting_contract_address().to_string(); let liquid_delegation = client.get_delegation_details(mix_id, address, None).await?; let vesting_delegation = client .get_delegation_details(mix_id, address, Some(vesting_contract)) @@ -105,7 +105,7 @@ pub async fn get_current_rewarding_parameters( let guard = state.read().await; let client = guard.current_client()?; - let reward_params = client.nymd.get_rewarding_parameters().await?; + let reward_params = client.nyxd.get_rewarding_parameters().await?; Ok(reward_params) } diff --git a/nym-wallet/src-tauri/src/operations/mixnet/send.rs b/nym-wallet/src-tauri/src/operations/mixnet/send.rs index 0e4cbdd6a3..b57cf0a267 100644 --- a/nym-wallet/src-tauri/src/operations/mixnet/send.rs +++ b/nym-wallet/src-tauri/src/operations/mixnet/send.rs @@ -3,7 +3,7 @@ use crate::state::WalletState; use nym_types::currency::DecCoin; use nym_types::transaction::{SendTxResult, TransactionDetails}; use std::str::FromStr; -use validator_client::nymd::{AccountId, Fee}; +use validator_client::nyxd::{AccountId, Fee}; #[tauri::command] pub async fn send( @@ -17,7 +17,7 @@ pub async fn send( let amount_base = guard.attempt_convert_to_base_coin(amount.clone())?; let to_address = AccountId::from_str(address)?; - let from_address = guard.current_client()?.nymd.address().to_string(); + let from_address = guard.current_client()?.nyxd.address().to_string(); let fee_amount = guard.convert_tx_fee(fee.as_ref()); log::info!( ">>> Send: display_amount = {}, base_amount = {}, from = {}, to = {}, fee = {:?}", @@ -29,7 +29,7 @@ pub async fn send( ); let raw_res = guard .current_client()? - .nymd + .nyxd .send(&to_address, vec![amount_base], memo, fee) .await?; log::info!("<<< tx hash = {}", raw_res.hash.to_string()); diff --git a/nym-wallet/src-tauri/src/operations/signatures/sign.rs b/nym-wallet/src-tauri/src/operations/signatures/sign.rs index abb132c1c8..6a0b05a1e4 100644 --- a/nym-wallet/src-tauri/src/operations/signatures/sign.rs +++ b/nym-wallet/src-tauri/src/operations/signatures/sign.rs @@ -23,7 +23,7 @@ pub async fn sign( ) -> Result { let guard = state.read().await; let client = guard.current_client()?; - let wallet = client.nymd.signer(); + let wallet = client.nyxd.signer(); let derived_accounts = wallet.try_derive_accounts()?; let account = derived_accounts.first().ok_or_else(|| { log::error!(">>> Unable to derive account"); @@ -50,7 +50,7 @@ async fn get_pubkey_from_account_address( let guard = state.read().await; let client = guard.current_client()?; let account = client - .nymd + .nyxd .get_account_details(address) .await? .ok_or_else(|| { @@ -116,7 +116,7 @@ pub async fn verify( // get public key from current account address let guard = state.read().await; let client = guard.current_client()?; - let address = client.nymd.address(); + let address = client.nyxd.address(); get_pubkey_from_account_address(address, &state).await? } }; diff --git a/nym-wallet/src-tauri/src/operations/simulate/admin.rs b/nym-wallet/src-tauri/src/operations/simulate/admin.rs index 29636bebf2..5ca826bb90 100644 --- a/nym-wallet/src-tauri/src/operations/simulate/admin.rs +++ b/nym-wallet/src-tauri/src/operations/simulate/admin.rs @@ -18,9 +18,9 @@ pub async fn simulate_update_contract_settings( params.try_convert_to_mixnet_contract_params(reg)?; let client = guard.current_client()?; - let mixnet_contract = client.nymd.mixnet_contract_address(); + let mixnet_contract = client.nyxd.mixnet_contract_address(); - let msg = client.nymd.wrap_contract_execute_message( + let msg = client.nyxd.wrap_contract_execute_message( mixnet_contract, &ExecuteMsg::UpdateContractStateParams { updated_parameters: mixnet_contract_settings_params, @@ -28,6 +28,6 @@ pub async fn simulate_update_contract_settings( vec![], )?; - let result = client.nymd.simulate(vec![msg]).await?; + let result = client.nyxd.simulate(vec![msg]).await?; guard.create_detailed_fee(result) } diff --git a/nym-wallet/src-tauri/src/operations/simulate/cosmos.rs b/nym-wallet/src-tauri/src/operations/simulate/cosmos.rs index 2796e02097..3679a1d863 100644 --- a/nym-wallet/src-tauri/src/operations/simulate/cosmos.rs +++ b/nym-wallet/src-tauri/src/operations/simulate/cosmos.rs @@ -6,7 +6,7 @@ use crate::operations::simulate::FeeDetails; use crate::state::WalletState; use nym_types::currency::DecCoin; use std::str::FromStr; -use validator_client::nymd::{AccountId, MsgSend}; +use validator_client::nyxd::{AccountId, MsgSend}; #[tauri::command] pub async fn simulate_send( @@ -21,7 +21,7 @@ pub async fn simulate_send( let amount = vec![amount_base.into()]; let client = guard.current_client()?; - let from_address = client.nymd.address().clone(); + let from_address = client.nyxd.address().clone(); // TODO: I'm still not 100% convinced whether this should be exposed here or handled somewhere else in the client code let msg = MsgSend { @@ -30,6 +30,6 @@ pub async fn simulate_send( amount, }; - let result = client.nymd.simulate(vec![msg]).await?; + let result = client.nyxd.simulate(vec![msg]).await?; guard.create_detailed_fee(result) } diff --git a/nym-wallet/src-tauri/src/operations/simulate/mixnet.rs b/nym-wallet/src-tauri/src/operations/simulate/mixnet.rs index 33e649690b..7adc677c74 100644 --- a/nym-wallet/src-tauri/src/operations/simulate/mixnet.rs +++ b/nym-wallet/src-tauri/src/operations/simulate/mixnet.rs @@ -25,13 +25,13 @@ async fn simulate_mixnet_operation( }; let client = guard.current_client()?; - let mixnet_contract = client.nymd.mixnet_contract_address(); + let mixnet_contract = client.nyxd.mixnet_contract_address(); let msg = client - .nymd + .nyxd .wrap_contract_execute_message(mixnet_contract, &msg, funds)?; - let result = client.nymd.simulate(vec![msg]).await?; + let result = client.nyxd.simulate(vec![msg]).await?; guard.create_detailed_fee(result) } diff --git a/nym-wallet/src-tauri/src/operations/simulate/mod.rs b/nym-wallet/src-tauri/src/operations/simulate/mod.rs index 256f6f9a84..384b8b9085 100644 --- a/nym-wallet/src-tauri/src/operations/simulate/mod.rs +++ b/nym-wallet/src-tauri/src/operations/simulate/mod.rs @@ -4,8 +4,8 @@ use cosmrs::tx; use cosmrs::tx::Gas; use nym_types::fees::FeeDetails; -use validator_client::nymd::cosmwasm_client::types::GasInfo; -use validator_client::nymd::{CosmosCoin, Fee, GasAdjustable, GasAdjustment, GasPrice}; +use validator_client::nyxd::cosmwasm_client::types::GasInfo; +use validator_client::nyxd::{CosmosCoin, Fee, GasAdjustable, GasAdjustment, GasPrice}; pub mod admin; pub mod cosmos; diff --git a/nym-wallet/src-tauri/src/operations/simulate/vesting.rs b/nym-wallet/src-tauri/src/operations/simulate/vesting.rs index 213c8d3fd8..aff0d9b4c5 100644 --- a/nym-wallet/src-tauri/src/operations/simulate/vesting.rs +++ b/nym-wallet/src-tauri/src/operations/simulate/vesting.rs @@ -26,13 +26,13 @@ async fn simulate_vesting_operation( }; let client = guard.current_client()?; - let vesting_contract = client.nymd.vesting_contract_address(); + let vesting_contract = client.nyxd.vesting_contract_address(); let msg = client - .nymd + .nyxd .wrap_contract_execute_message(vesting_contract, &msg, funds)?; - let result = client.nymd.simulate(vec![msg]).await?; + let result = client.nyxd.simulate(vec![msg]).await?; guard.create_detailed_fee(result) } diff --git a/nym-wallet/src-tauri/src/operations/vesting/bond.rs b/nym-wallet/src-tauri/src/operations/vesting/bond.rs index da5a71eee1..cb36653b47 100644 --- a/nym-wallet/src-tauri/src/operations/vesting/bond.rs +++ b/nym-wallet/src-tauri/src/operations/vesting/bond.rs @@ -1,5 +1,5 @@ use crate::error::BackendError; -use crate::nymd_client; +use crate::nyxd_client; use crate::state::WalletState; use crate::{Gateway, MixNode}; use mixnet_contract_common::MixNodeConfigUpdate; @@ -7,7 +7,7 @@ use mixnet_contract_common::MixNodeConfigUpdate; use nym_types::currency::DecCoin; use nym_types::mixnode::MixNodeCostParams; use nym_types::transaction::TransactionExecuteResult; -use validator_client::nymd::{Fee, VestingSigningClient}; +use validator_client::nyxd::{Fee, VestingSigningClient}; #[tauri::command] pub async fn vesting_bond_gateway( @@ -30,7 +30,7 @@ pub async fn vesting_bond_gateway( ); let res = guard .current_client()? - .nymd + .nyxd .vesting_bond_gateway(gateway, &owner_signature, pledge_base, fee) .await?; log::info!("<<< tx hash = {}", res.transaction_hash); @@ -51,7 +51,7 @@ pub async fn vesting_unbond_gateway( ">>> Unbond gateway bonded with locked tokens, fee = {:?}", fee ); - let res = nymd_client!(state).vesting_unbond_gateway(fee).await?; + let res = nyxd_client!(state).vesting_unbond_gateway(fee).await?; log::info!("<<< tx hash = {}", res.transaction_hash); log::trace!("<<< {:?}", res); Ok(TransactionExecuteResult::from_execute_result( @@ -83,7 +83,7 @@ pub async fn vesting_bond_mixnode( ); let res = guard .current_client()? - .nymd + .nyxd .vesting_bond_mixnode(mixnode, cost_params, &owner_signature, pledge_base, fee) .await?; log::info!("<<< tx hash = {}", res.transaction_hash); @@ -110,7 +110,7 @@ pub async fn vesting_pledge_more( ); let res = guard .current_client()? - .nymd + .nyxd .vesting_pledge_more(additional_pledge_base, fee) .await?; log::info!("<<< tx hash = {}", res.transaction_hash); @@ -133,7 +133,7 @@ pub async fn vesting_unbond_mixnode( ); let res = guard .current_client()? - .nymd + .nyxd .vesting_unbond_mixnode(fee) .await?; log::info!("<<< tx hash = {}", res.transaction_hash); @@ -161,7 +161,7 @@ pub async fn withdraw_vested_coins( ); let res = guard .current_client()? - .nymd + .nyxd .withdraw_vested_coins(amount_base, fee) .await?; log::info!("<<< tx hash = {}", res.transaction_hash); @@ -189,7 +189,7 @@ pub async fn vesting_update_mixnode_cost_params( ); let res = guard .current_client()? - .nymd + .nyxd .vesting_update_mixnode_cost_params(cost_params, fee) .await?; log::info!("<<< tx hash = {}", res.transaction_hash); @@ -214,7 +214,7 @@ pub async fn vesting_update_mixnode_config( ); let res = guard .current_client()? - .nymd + .nyxd .vesting_update_mixnode_config(update, fee) .await?; log::info!("<<< tx hash = {}", res.transaction_hash); diff --git a/nym-wallet/src-tauri/src/operations/vesting/delegate.rs b/nym-wallet/src-tauri/src/operations/vesting/delegate.rs index 59183878e5..0b3620b129 100644 --- a/nym-wallet/src-tauri/src/operations/vesting/delegate.rs +++ b/nym-wallet/src-tauri/src/operations/vesting/delegate.rs @@ -6,7 +6,7 @@ use crate::state::WalletState; use mixnet_contract_common::MixId; use nym_types::currency::DecCoin; use nym_types::transaction::TransactionExecuteResult; -use validator_client::nymd::{Fee, VestingSigningClient}; +use validator_client::nyxd::{Fee, VestingSigningClient}; #[tauri::command] pub async fn vesting_delegate_to_mixnode( @@ -28,7 +28,7 @@ pub async fn vesting_delegate_to_mixnode( ); let res = guard .current_client()? - .nymd + .nyxd .vesting_delegate_to_mixnode(mix_id, delegation, fee) .await?; log::info!("<<< tx hash = {}", res.transaction_hash); @@ -53,7 +53,7 @@ pub async fn vesting_undelegate_from_mixnode( ); let res = guard .current_client()? - .nymd + .nyxd .vesting_undelegate_from_mixnode(mix_id, fee) .await?; log::info!("<<< tx hash = {}", res.transaction_hash); diff --git a/nym-wallet/src-tauri/src/operations/vesting/queries.rs b/nym-wallet/src-tauri/src/operations/vesting/queries.rs index d05608fb25..5fe2d2dba7 100644 --- a/nym-wallet/src-tauri/src/operations/vesting/queries.rs +++ b/nym-wallet/src-tauri/src/operations/vesting/queries.rs @@ -2,13 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 use crate::error::BackendError; -use crate::nymd_client; +use crate::nyxd_client; use crate::state::WalletState; use cosmwasm_std::Timestamp; use nym_types::currency::DecCoin; use nym_types::vesting::VestingAccountInfo; use nym_types::vesting::{OriginalVestingResponse, PledgeData}; -use validator_client::nymd::VestingQueryClient; +use validator_client::nyxd::VestingQueryClient; use vesting_contract_common::Period; #[tauri::command] @@ -21,9 +21,9 @@ pub async fn locked_coins( let client = guard.current_client()?; let res = client - .nymd + .nyxd .locked_coins( - client.nymd.address().as_ref(), + client.nyxd.address().as_ref(), block_time.map(Timestamp::from_seconds), ) .await?; @@ -42,9 +42,9 @@ pub async fn spendable_coins( let client = guard.current_client()?; let res = client - .nymd + .nyxd .spendable_coins( - client.nymd.address().as_ref(), + client.nyxd.address().as_ref(), block_time.map(Timestamp::from_seconds), ) .await?; @@ -65,7 +65,7 @@ pub async fn vested_coins( let res = guard .current_client()? - .nymd + .nyxd .vested_coins( vesting_account_address, block_time.map(Timestamp::from_seconds), @@ -88,7 +88,7 @@ pub async fn vesting_coins( let res = guard .current_client()? - .nymd + .nyxd .vesting_coins( vesting_account_address, block_time.map(Timestamp::from_seconds), @@ -106,7 +106,7 @@ pub async fn vesting_start_time( state: tauri::State<'_, WalletState>, ) -> Result { log::info!(">>> Query vesting start time"); - let res = nymd_client!(state) + let res = nyxd_client!(state) .vesting_start_time(vesting_account_address) .await? .seconds(); @@ -120,7 +120,7 @@ pub async fn vesting_end_time( state: tauri::State<'_, WalletState>, ) -> Result { log::info!(">>> Query vesting end time"); - let res = nymd_client!(state) + let res = nyxd_client!(state) .vesting_end_time(vesting_account_address) .await? .seconds(); @@ -139,7 +139,7 @@ pub async fn original_vesting( let res = guard .current_client()? - .nymd + .nyxd .original_vesting(vesting_account_address) .await?; @@ -159,7 +159,7 @@ pub async fn delegated_free( let res = guard .current_client()? - .nymd + .nyxd .delegated_free( vesting_account_address, block_time.map(Timestamp::from_seconds), @@ -183,7 +183,7 @@ pub async fn delegated_vesting( let res = guard .current_client()? - .nymd + .nyxd .delegated_vesting( vesting_account_address, block_time.map(Timestamp::from_seconds), @@ -206,7 +206,7 @@ pub async fn vesting_get_mixnode_pledge( let res = guard .current_client()? - .nymd + .nyxd .get_mixnode_pledge(address) .await? .map(|pledge| PledgeData::from_vesting_contract(pledge, reg)) @@ -227,7 +227,7 @@ pub async fn vesting_get_gateway_pledge( let res = guard .current_client()? - .nymd + .nyxd .get_gateway_pledge(address) .await? .map(|pledge| PledgeData::from_vesting_contract(pledge, reg)) @@ -243,7 +243,7 @@ pub async fn get_current_vesting_period( state: tauri::State<'_, WalletState>, ) -> Result { log::info!(">>> Query current vesting period"); - let res = nymd_client!(state) + let res = nyxd_client!(state) .get_current_vesting_period(address) .await?; log::info!("<<< {:?}", res); @@ -259,7 +259,7 @@ pub async fn get_account_info( let guard = state.read().await; let res = guard.registered_coins()?; - let vesting_account = guard.current_client()?.nymd.get_account(address).await?; + let vesting_account = guard.current_client()?.nyxd.get_account(address).await?; let res = VestingAccountInfo::from_vesting_contract(vesting_account, res)?; log::info!("<<< {:?}", res); diff --git a/nym-wallet/src-tauri/src/operations/vesting/rewards.rs b/nym-wallet/src-tauri/src/operations/vesting/rewards.rs index ad3760a364..32fc67257a 100644 --- a/nym-wallet/src-tauri/src/operations/vesting/rewards.rs +++ b/nym-wallet/src-tauri/src/operations/vesting/rewards.rs @@ -5,7 +5,7 @@ use crate::error::BackendError; use crate::state::WalletState; use mixnet_contract_common::MixId; use nym_types::transaction::TransactionExecuteResult; -use validator_client::nymd::Fee; +use validator_client::nyxd::Fee; #[tauri::command] pub async fn vesting_claim_operator_reward( @@ -17,7 +17,7 @@ pub async fn vesting_claim_operator_reward( let fee_amount = guard.convert_tx_fee(fee.as_ref()); let res = guard .current_client()? - .nymd + .nyxd .execute_vesting_withdraw_operator_reward(None) .await?; log::info!("<<< tx hash = {}", res.transaction_hash); @@ -41,7 +41,7 @@ pub async fn vesting_claim_delegator_reward( let fee_amount = guard.convert_tx_fee(fee.as_ref()); let res = guard .current_client()? - .nymd + .nyxd .execute_vesting_withdraw_delegator_reward(mix_id, fee) .await?; log::info!("<<< tx hash = {}", res.transaction_hash); diff --git a/nym-wallet/src-tauri/src/state.rs b/nym-wallet/src-tauri/src/state.rs index 319e645c57..f81a58e6e0 100644 --- a/nym-wallet/src-tauri/src/state.rs +++ b/nym-wallet/src-tauri/src/state.rs @@ -16,8 +16,8 @@ use std::time::Duration; use strum::IntoEnumIterator; use tokio::sync::{RwLock, RwLockReadGuard, RwLockWriteGuard}; use url::Url; -use validator_client::nymd::cosmwasm_client::types::SimulateResponse; -use validator_client::nymd::{AccountId as CosmosAccountId, Coin, Fee, SigningNymdClient}; +use validator_client::nyxd::cosmwasm_client::types::SimulateResponse; +use validator_client::nyxd::{AccountId as CosmosAccountId, Coin, Fee, SigningNyxdClient}; use validator_client::Client; // Some hardcoded metadata overrides @@ -65,7 +65,7 @@ impl WalletState { #[derive(Default)] pub struct WalletStateInner { config: config::Config, - signing_clients: HashMap>, + signing_clients: HashMap>, current_network: Network, // All the accounts the we get from decrypting the wallet. We hold on to these for being able to @@ -156,8 +156,8 @@ impl WalletStateInner { ) -> Result { // this MUST succeed as we just used it before let client = self.current_client()?; - let gas_price = client.nymd.gas_price().clone(); - let gas_adjustment = client.nymd.gas_adjustment(); + let gas_price = client.nyxd.gas_price().clone(); + let gas_adjustment = client.nyxd.gas_adjustment(); let res = SimulateResult::new(simulate_response.gas_info, gas_price, gas_adjustment); @@ -169,7 +169,7 @@ impl WalletStateInner { Ok(FeeDetails::new(amount, res.to_fee())) } - pub fn client(&self, network: Network) -> Result<&Client, BackendError> { + pub fn client(&self, network: Network) -> Result<&Client, BackendError> { self.signing_clients .get(&network) .ok_or(BackendError::ClientNotInitialized) @@ -178,20 +178,20 @@ impl WalletStateInner { pub fn client_mut( &mut self, network: Network, - ) -> Result<&mut Client, BackendError> { + ) -> Result<&mut Client, BackendError> { self.signing_clients .get_mut(&network) .ok_or(BackendError::ClientNotInitialized) } - pub fn current_client(&self) -> Result<&Client, BackendError> { + pub fn current_client(&self) -> Result<&Client, BackendError> { self.signing_clients .get(&self.current_network) .ok_or(BackendError::ClientNotInitialized) } #[allow(unused)] - pub fn current_client_mut(&mut self) -> Result<&mut Client, BackendError> { + pub fn current_client_mut(&mut self) -> Result<&mut Client, BackendError> { self.signing_clients .get_mut(&self.current_network) .ok_or(BackendError::ClientNotInitialized) @@ -211,7 +211,7 @@ impl WalletStateInner { Ok(self.config.save_to_files()?) } - pub fn add_client(&mut self, network: Network, client: Client) { + pub fn add_client(&mut self, network: Network, client: Client) { self.signing_clients.insert(network, client); } @@ -258,26 +258,26 @@ impl WalletStateInner { let validators = validators_in_config .chain(fetched_validators) .chain(default_validators) - .unique_by(|v| (v.nymd_url.clone(), v.api_url.clone())); + .unique_by(|v| (v.nyxd_url.clone(), v.api_url.clone())); // Annotate with dynamic metadata validators.map(|v| { - let metadata = self.validator_metadata.get(&v.nymd_url); + let metadata = self.validator_metadata.get(&v.nyxd_url); let name = v - .nymd_name + .nyxd_name .or_else(|| metadata.and_then(|m| m.name.clone())); config::ValidatorConfigEntry { - nymd_url: v.nymd_url, - nymd_name: name, + nyxd_url: v.nyxd_url, + nyxd_name: name, api_url: v.api_url, } }) } - pub fn get_nymd_urls_only(&self, network: Network) -> impl Iterator + '_ { + pub fn get_nyxd_urls_only(&self, network: Network) -> impl Iterator + '_ { self.get_config_validator_entries(network) .into_iter() - .map(|v| v.nymd_url) + .map(|v| v.nyxd_url) } pub fn get_api_urls_only(&self, network: Network) -> impl Iterator + '_ { @@ -286,17 +286,17 @@ impl WalletStateInner { .filter_map(|v| v.api_url) } - /// Get the list of validator nymd urls in the network config format, suitable for passing on to + /// Get the list of validator nyxd urls in the network config format, suitable for passing on to /// the UI - pub fn get_nymd_urls( + pub fn get_nyxd_urls( &self, network: Network, ) -> impl Iterator + '_ { self.get_config_validator_entries(network) .into_iter() .map(|v| network_config::ValidatorUrl { - url: v.nymd_url.to_string(), - name: v.nymd_name, + url: v.nyxd_url.to_string(), + name: v.nyxd_name, }) } @@ -316,10 +316,10 @@ impl WalletStateInner { }) } - pub fn get_all_nymd_urls(&self) -> HashMap> { + pub fn get_all_nyxd_urls(&self) -> HashMap> { Network::iter() .flat_map(|network| { - self.get_nymd_urls_only(network) + self.get_nyxd_urls_only(network) .map(move |url| (network, url)) }) .into_group_map() @@ -334,18 +334,18 @@ impl WalletStateInner { .into_group_map() } - /// Fetch validator urls remotely. These are used to in addition to the base ones, and the user + /// Fetch nyxd urls remotely. These are used to in addition to the base ones, and the user /// configured ones. - pub async fn fetch_updated_validator_urls(&mut self) -> Result<(), BackendError> { + pub async fn fetch_updated_nyxd_urls(&mut self) -> Result<(), BackendError> { let client = reqwest::Client::builder() .timeout(Duration::from_secs(3)) .build()?; log::debug!( "Fetching validator urls from: {}", - crate::config::REMOTE_SOURCE_OF_VALIDATOR_URLS + crate::config::REMOTE_SOURCE_OF_NYXD_URLS ); let response = client - .get(crate::config::REMOTE_SOURCE_OF_VALIDATOR_URLS.to_string()) + .get(crate::config::REMOTE_SOURCE_OF_NYXD_URLS.to_string()) .send() .await?; @@ -361,13 +361,13 @@ impl WalletStateInner { log::debug!("Refreshing validator status"); // All urls for all networks - let nymd_urls = self - .get_all_nymd_urls() + let nyxd_urls = self + .get_all_nyxd_urls() .into_iter() .flat_map(|(_, urls)| urls.into_iter()); // Fetch status for all urls - let responses = fetch_status_for_urls(nymd_urls).await?; + let responses = fetch_status_for_urls(nyxd_urls).await?; // Update the stored metadata self.apply_responses(responses)?; @@ -413,14 +413,10 @@ impl WalletStateInner { } } - pub fn select_validator_nymd_url( - &mut self, - url: &str, - network: Network, - ) -> Result<(), BackendError> { - self.config.select_validator_nymd_url(url.parse()?, network); + pub fn select_nyxd_url(&mut self, url: &str, network: Network) -> Result<(), BackendError> { + self.config.select_nyxd_url(url.parse()?, network); if let Ok(client) = self.client_mut(network) { - client.change_nymd(url.parse()?)?; + client.change_nyxd(url.parse()?)?; } Ok(()) } @@ -443,13 +439,13 @@ impl WalletStateInner { } async fn fetch_status_for_urls( - nymd_urls: impl Iterator, + nyxd_urls: impl Iterator, ) -> Result>, BackendError> { let client = reqwest::Client::builder() .timeout(Duration::from_secs(3)) .build()?; - let responses = futures::future::join_all(nymd_urls.into_iter().map(|url| { + let responses = futures::future::join_all(nyxd_urls.into_iter().map(|url| { let client = &client; let status_url = url.join("status").unwrap_or_else(|_| url.clone()); async move { @@ -476,9 +472,9 @@ macro_rules! client { } #[macro_export] -macro_rules! nymd_client { +macro_rules! nyxd_client { ($state:ident) => { - $state.read().await.current_client()?.nymd + $state.read().await.current_client()?.nyxd }; } @@ -500,17 +496,17 @@ mod tests { state.add_validator_url( config::ValidatorConfigEntry { - nymd_url: "http://nymd_url.com".parse().unwrap(), - nymd_name: Some("NymdUrl".to_string()), - api_url: Some("http://nymd_url.com/api".parse().unwrap()), + nyxd_url: "http://nyxd_url.com".parse().unwrap(), + nyxd_name: Some("NyxdUrl".to_string()), + api_url: Some("http://nyxd_url.com/api".parse().unwrap()), }, Network::MAINNET, ); state.add_validator_url( config::ValidatorConfigEntry { - nymd_url: "http://foo.com".parse().unwrap(), - nymd_name: None, + nyxd_url: "http://foo.com".parse().unwrap(), + nyxd_name: None, api_url: None, }, Network::MAINNET, @@ -518,8 +514,8 @@ mod tests { state.add_validator_url( config::ValidatorConfigEntry { - nymd_url: "http://bar.com".parse().unwrap(), - nymd_name: None, + nyxd_url: "http://bar.com".parse().unwrap(), + nyxd_name: None, api_url: None, }, Network::MAINNET, @@ -527,10 +523,10 @@ mod tests { assert_eq!( state - .get_nymd_urls_only(Network::MAINNET) + .get_nyxd_urls_only(Network::MAINNET) .collect::>(), vec![ - "http://nymd_url.com/".parse().unwrap(), + "http://nyxd_url.com/".parse().unwrap(), "http://foo.com".parse().unwrap(), "http://bar.com".parse().unwrap(), "https://rpc.nymtech.net".parse().unwrap(), @@ -541,18 +537,18 @@ mod tests { .get_api_urls_only(Network::MAINNET) .collect::>(), vec![ - "http://nymd_url.com/api".parse().unwrap(), + "http://nyxd_url.com/api".parse().unwrap(), "https://validator.nymtech.net/api/".parse().unwrap(), ], ); assert_eq!( state - .get_all_nymd_urls() + .get_all_nyxd_urls() .get(&Network::MAINNET) .unwrap() .clone(), vec![ - "http://nymd_url.com/".parse().unwrap(), + "http://nyxd_url.com/".parse().unwrap(), "http://foo.com".parse().unwrap(), "http://bar.com".parse().unwrap(), "https://rpc.nymtech.net".parse().unwrap(), diff --git a/nym-wallet/src-tauri/src/utils.rs b/nym-wallet/src-tauri/src/utils.rs index f04d47722f..355a6cb6cd 100644 --- a/nym-wallet/src-tauri/src/utils.rs +++ b/nym-wallet/src-tauri/src/utils.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use crate::error::BackendError; -use crate::nymd_client; +use crate::nyxd_client; use crate::state::WalletState; use cosmwasm_std::Decimal; use mixnet_contract_common::{IdentityKey, MixId, Percent}; @@ -10,8 +10,8 @@ use nym_types::currency::DecCoin; use nym_types::mixnode::MixNodeCostParams; use nym_wallet_types::app::AppEnv; use serde::{Deserialize, Serialize}; -use validator_client::nymd::traits::MixnetQueryClient; -use validator_client::nymd::{tx, Coin, CosmosCoin, Gas, GasPrice}; +use validator_client::nyxd::traits::MixnetQueryClient; +use validator_client::nyxd::{tx, Coin, CosmosCoin, Gas, GasPrice}; fn get_env_as_option(key: &str) -> Option { match ::std::env::var(key) { @@ -31,8 +31,8 @@ pub fn get_env() -> AppEnv { #[tauri::command] pub async fn owns_mixnode(state: tauri::State<'_, WalletState>) -> Result { - Ok(nymd_client!(state) - .get_owned_mixnode(nymd_client!(state).address()) + Ok(nyxd_client!(state) + .get_owned_mixnode(nyxd_client!(state).address()) .await? .mixnode_details .is_some()) @@ -40,8 +40,8 @@ pub async fn owns_mixnode(state: tauri::State<'_, WalletState>) -> Result) -> Result { - Ok(nymd_client!(state) - .get_owned_gateway(nymd_client!(state).address()) + Ok(nyxd_client!(state) + .get_owned_gateway(nyxd_client!(state).address()) .await? .gateway .is_some()) @@ -52,7 +52,7 @@ pub async fn try_convert_pubkey_to_mix_id( state: tauri::State<'_, WalletState>, mix_identity: IdentityKey, ) -> Result, BackendError> { - let res = nymd_client!(state) + let res = nyxd_client!(state) .get_mixnode_details_by_identity(mix_identity) .await?; Ok(res.map(|mixnode_details| mixnode_details.mix_id())) @@ -185,7 +185,7 @@ pub async fn get_old_and_incorrect_hardcoded_fee( operation: Operation, ) -> Result { let guard = state.read().await; - let mut approximate_fee = operation.default_fee(guard.current_client()?.nymd.gas_price()); + let mut approximate_fee = operation.default_fee(guard.current_client()?.nyxd.gas_price()); // on all our chains it should only ever contain a single type of currency assert_eq!(approximate_fee.amount.len(), 1); let coin: Coin = approximate_fee.amount.pop().unwrap().into(); diff --git a/nym-wallet/src-tauri/src/wallet_storage/account_data.rs b/nym-wallet/src-tauri/src/wallet_storage/account_data.rs index d0027592d9..f5c7296442 100644 --- a/nym-wallet/src-tauri/src/wallet_storage/account_data.rs +++ b/nym-wallet/src-tauri/src/wallet_storage/account_data.rs @@ -15,7 +15,7 @@ // instead treating as muliple accounts with one entry. use serde::{Deserialize, Serialize}; -use validator_client::nymd::bip32::DerivationPath; +use validator_client::nyxd::bip32::DerivationPath; use zeroize::Zeroize; use crate::error::BackendError; @@ -356,7 +356,7 @@ impl Drop for MnemonicAccount { mod display_hd_path { use serde::{Deserialize, Deserializer, Serializer}; - use validator_client::nymd::bip32::DerivationPath; + use validator_client::nyxd::bip32::DerivationPath; pub fn serialize( hd_path: &DerivationPath, diff --git a/nym-wallet/src-tauri/src/wallet_storage/mod.rs b/nym-wallet/src-tauri/src/wallet_storage/mod.rs index bf9e3c3c6c..7bca66d01b 100644 --- a/nym-wallet/src-tauri/src/wallet_storage/mod.rs +++ b/nym-wallet/src-tauri/src/wallet_storage/mod.rs @@ -18,7 +18,7 @@ use chrono::Local; use std::ffi::OsString; use std::fs::{self, create_dir_all, OpenOptions}; use std::path::{Path, PathBuf}; -use validator_client::nymd::bip32::DerivationPath; +use validator_client::nyxd::bip32::DerivationPath; #[cfg(test)] use self::account_data::MnemonicAccount; diff --git a/tools/nym-cli/Cargo.toml b/tools/nym-cli/Cargo.toml index b919419faf..aa73944ab8 100644 --- a/tools/nym-cli/Cargo.toml +++ b/tools/nym-cli/Cargo.toml @@ -22,5 +22,5 @@ tap = "1" nym-cli-commands = { path = "../../common/commands" } logging = { path = "../../common/logging"} -validator-client = { path = "../../common/client-libs/validator-client", features = ["nymd-client"] } +validator-client = { path = "../../common/client-libs/validator-client", features = ["nyxd-client"] } network-defaults = { path = "../../common/network-defaults" } diff --git a/tools/nym-cli/README.md b/tools/nym-cli/README.md index 415e500564..b2ad624a6d 100644 --- a/tools/nym-cli/README.md +++ b/tools/nym-cli/README.md @@ -5,7 +5,7 @@ This is a CLI tool for interacting with: - the Nyx blockchain - the smart contracts for the Mixnet -It provides a convenient wrapper around the [`nymd client`](../../common/client-libs) with similar functionality to the`nyxd` binary for querying the chain or executing smart contract methods. +It provides a convenient wrapper around the [`nyxd client`](../../common/client-libs) with similar functionality to the`nyxd` binary for querying the chain or executing smart contract methods. And in the future it will provide an easy way to interact with Coconut, to issue and verify Coconut credenitals. @@ -41,7 +41,7 @@ You will need to pass the following with every command as an argument: ``` --mnemonic ---nymd-url +--nyxd-url --mixnet-contract --vesting-contract ``` diff --git a/tools/nym-cli/src/main.rs b/tools/nym-cli/src/main.rs index 306d383c34..49183df58a 100644 --- a/tools/nym-cli/src/main.rs +++ b/tools/nym-cli/src/main.rs @@ -5,7 +5,7 @@ use clap::{CommandFactory, Parser, Subcommand}; use log::{error, warn}; use logging::setup_logging; use nym_cli_commands::context::{get_network_details, ClientArgs}; -use validator_client::nymd::AccountId; +use validator_client::nyxd::AccountId; mod completion; mod validator; @@ -28,9 +28,9 @@ pub(crate) struct Cli { #[clap(long, global = true)] #[clap( - help = "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file" + help = "Overrides the nyxd URL provided either as an environment variable NYXD_VALIDATOR or in a config file" )] - pub(crate) nymd_url: Option, + pub(crate) nyxd_url: Option, #[clap(long, global = true)] #[clap( @@ -76,7 +76,7 @@ pub(crate) enum Commands { async fn execute(cli: Cli) -> anyhow::Result<()> { let args = ClientArgs { - nymd_url: cli.nymd_url, + nyxd_url: cli.nyxd_url, nym_api_url: cli.nym_api_url, mnemonic: cli.mnemonic, mixnet_contract_address: cli.mixnet_contract_address, diff --git a/tools/nym-cli/src/validator/account.rs b/tools/nym-cli/src/validator/account.rs index 36fc3460ba..e3d8d5c12d 100644 --- a/tools/nym-cli/src/validator/account.rs +++ b/tools/nym-cli/src/validator/account.rs @@ -3,7 +3,7 @@ use network_defaults::NymNetworkDetails; use nym_cli_commands::context::{create_query_client, create_signing_client, ClientArgs}; -use validator_client::nymd::AccountId; +use validator_client::nyxd::AccountId; pub(crate) async fn execute( global_args: ClientArgs, diff --git a/tools/nym-cli/user-docs/fig-spec.ts b/tools/nym-cli/user-docs/fig-spec.ts index 95825de55d..3fbb1c213a 100644 --- a/tools/nym-cli/user-docs/fig-spec.ts +++ b/tools/nym-cli/user-docs/fig-spec.ts @@ -34,10 +34,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -100,10 +100,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -170,10 +170,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -251,10 +251,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -317,10 +317,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -373,10 +373,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -435,10 +435,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -496,10 +496,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -565,10 +565,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -621,10 +621,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -683,10 +683,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -744,10 +744,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -805,10 +805,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -863,10 +863,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -919,10 +919,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -994,10 +994,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -1095,10 +1095,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -1176,10 +1176,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -1252,10 +1252,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -1322,10 +1322,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -1378,10 +1378,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -1440,10 +1440,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -1501,10 +1501,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -1562,10 +1562,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -1618,10 +1618,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -1720,10 +1720,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -1778,10 +1778,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -1840,10 +1840,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -1902,10 +1902,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -1963,10 +1963,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -2019,10 +2019,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -2085,10 +2085,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -2147,10 +2147,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -2209,10 +2209,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -2265,10 +2265,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -2327,10 +2327,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -2395,10 +2395,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -2459,10 +2459,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -2517,10 +2517,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -2573,10 +2573,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -2643,10 +2643,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -2707,10 +2707,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -2777,10 +2777,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -2841,10 +2841,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -2899,10 +2899,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -2955,10 +2955,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -3031,10 +3031,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -3089,10 +3089,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -3145,10 +3145,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -3207,10 +3207,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -3272,10 +3272,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -3330,10 +3330,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -3386,10 +3386,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -3454,10 +3454,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -3525,10 +3525,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -3583,10 +3583,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -3639,10 +3639,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -3762,10 +3762,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -3823,10 +3823,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -3953,10 +3953,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -4021,10 +4021,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -4079,10 +4079,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -4135,10 +4135,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -4255,10 +4255,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -4316,10 +4316,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -4432,10 +4432,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -4493,10 +4493,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -4551,10 +4551,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -4607,10 +4607,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -4665,10 +4665,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -4721,10 +4721,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -4779,10 +4779,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -4835,10 +4835,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -4893,10 +4893,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -4951,10 +4951,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, @@ -5007,10 +5007,10 @@ const completion: Fig.Spec = { }, }, { - name: "--nymd-url", - description: "Overrides the nymd URL provided either as an environment variable NYMD_VALIDATOR or in a config file", + name: "--nyxd-url", + description: "Overrides the nyxd URL provided either as an environment variable nyxd_VALIDATOR or in a config file", args: { - name: "nymd-url", + name: "nyxd-url", isOptional: true, }, }, diff --git a/tools/ts-rs-cli/Cargo.toml b/tools/ts-rs-cli/Cargo.toml index c327083a04..9d03747efe 100644 --- a/tools/ts-rs-cli/Cargo.toml +++ b/tools/ts-rs-cli/Cargo.toml @@ -11,7 +11,7 @@ ts-rs = "6.1.2" walkdir = "2" validator-client = { path = "../../common/client-libs/validator-client", features = [ - "nymd-client", "generate-ts" + "nyxd-client", "generate-ts" ] } nym-api-requests = { path = "../../nym-api/nym-api-requests", features = ["generate-ts"] } mixnet-contract-common = { path = "../../common/cosmwasm-smart-contracts/mixnet-contract", features = [ "generate-ts" ] }