-
Notifications
You must be signed in to change notification settings - Fork 991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewriting the Wallet.toml file to have a subsection for tokens #135
Comments
Doing this would allow us to move away from using the hardcoded |
This seems to be much harder than I imagined ... Will need to discuss with someone, naive solution becomes very messy |
It could be worth doing a pre-refactor of |
I propose that rather than splitting up the addresses into different groups, we add another field just for We could add this in a sub-table "traits" and following the same pattern we could then add other special account traits and they don't have to be exclusive (hence traits, not types): #[derive(Copy)]
enum AddressTrait { Token }
struct Store {
...,
address_traits: HashMap<AddressTrait, HashSet<Address>>,
}
...
fn get_addresses_with_trait(&self, r#type: AddressTrait) -> HashSet<Address> {
// defaults to an empty set
self.address_traits.get(r#type).unwrap_or_default()
} In toml I guess it could look like this:
|
just a note for |
@karbyshev can you take this on as part of the wallet work? |
I'm working on this btw @karbyshev |
At the moment, the wallet.toml has a simple structure of the addresses data structure in the wallet.toml file as below:
![Addresses](https://user-images.githubusercontent.com/51077282/172619121-27d3e84b-f717-4a77-b83e-0b9ff5c101d0.png)
However, ideally, we have functions that check balances of tokens, and there could be some structure that keeps track of token addresses specifically in order to be friendly with such functionality (there is no point in looking through the every address when we are just looking for tokens). Something like below.
![How_we_want_it](https://user-images.githubusercontent.com/51077282/172619153-e3dba3a1-dfc9-414d-ac96-006f4b7ab03e.png)
This may require us to have a separate function such as
add_token_address
,add_internal_address
, that adds these addresses specifically to the subfolder it corresponds to. This may have some issues I cannot foresee, but will require some rewriting. However, I think it may be worth it in the long term.Finally, there seems to be some rewriting of the wallet.toml (for example when I run
anomac balances
) that will need to be looked at.The text was updated successfully, but these errors were encountered: