Skip to content
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

wallet - token support #108

Open
ixje opened this issue Jun 1, 2021 · 2 comments
Open

wallet - token support #108

ixje opened this issue Jun 1, 2021 · 2 comments
Assignees
Labels
feature-wallet wallet feature branch

Comments

@ixje
Copy link
Member

ixje commented Jun 1, 2021

from #80 (comment)

    def token_add(self, token_hash: UInt160) -> bool:
        # true if added, false if already exists

    def token_delete(self, token_hash: UInt160) -> bool:
        # true if deleted, false if failed if not found

    def token_delete_by_name(self, token_name: str) -> bool:
        # true if deleted, false if e.g. not found

My current view is that a Wallet is merely as a container holding Accounts. Therefore adding these functions to account means an Account is associated with 0 or more tokens. There can be helpers for Wallet to aggregate balances of a certain token in all available accounts, but that is beyond the scope. The extra field of the Account can be used for storing the token hashes when exporting.

@ixje ixje added the feature-wallet wallet feature branch label Jun 1, 2021
@ixje
Copy link
Member Author

ixje commented Jun 2, 2021

The alternative is to add these functions to Wallet. The upside is that from a wallet you do a single import/add/delete. The downside is you're forced to use a Wallet and it has to search all accounts for balance every time, even though you might know certain accounts will never have any.

@luc10921
Copy link

luc10921 commented Jul 6, 2021

How should the token_delete_by_name(self, token_name: str) method be implemented? Currently, the only way to add a token is using token_add(self, token_hash: UInt160).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-wallet wallet feature branch
Projects
None yet
Development

No branches or pull requests

2 participants