Skip to content

Commit

Permalink
Merge branch 'bengt+tomas/wallet-tokens' (#1081)
Browse files Browse the repository at this point in the history
* bengt+tomas/wallet-tokens:
  wallet: remove `impl Default for Alias`
  changelog: add #1081
  [ci] wasm checksums update
  test/e2e: lowercase all token aliases
  wallet/store: add tokens VP type for addresses from genesis
  removed hardcoded address::type from most places
  added address vp type
  • Loading branch information
tzemanovic committed Apr 6, 2023
2 parents f608908 + 50a27c4 commit 7597e72
Show file tree
Hide file tree
Showing 11 changed files with 248 additions and 144 deletions.
3 changes: 3 additions & 0 deletions .changelog/unreleased/improvements/1081-wallet-tokens.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Added a wallet section for token addresses to replace hard-
coded values with addresses loaded from genesis configuration.
([#1081](https://github.com/anoma/namada/pull/1081))
8 changes: 7 additions & 1 deletion apps/src/lib/cli/context.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! CLI input types can be used for command arguments
use std::collections::HashSet;
use std::env;
use std::marker::PhantomData;
use std::path::{Path, PathBuf};
Expand All @@ -16,7 +17,7 @@ use crate::client::tx::ShieldedContext;
use crate::config::genesis::genesis_config;
use crate::config::global::GlobalConfig;
use crate::config::{self, Config};
use crate::wallet::Wallet;
use crate::wallet::{AddressVpType, Wallet};
use crate::wasm_loader;

/// Env. var to set chain ID
Expand Down Expand Up @@ -187,6 +188,11 @@ impl Context {
pub fn read_wasm(&self, file_name: impl AsRef<Path>) -> Vec<u8> {
wasm_loader::read_wasm_or_exit(self.wasm_dir(), file_name)
}

/// Get address with vp type
pub fn tokens(&self) -> HashSet<Address> {
self.wallet.get_addresses_with_vp_type(AddressVpType::Token)
}
}

/// Load global config from expected path in the `base_dir` or try to generate a
Expand Down
Loading

0 comments on commit 7597e72

Please sign in to comment.