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

Helpers to distinguish between single_signer_accounts and multi_sig accounts #211

Open
2 tasks
DOBEN opened this issue Sep 4, 2024 · 0 comments
Open
2 tasks
Labels
[Type] Task An additional feature or improvement.

Comments

@DOBEN
Copy link
Member

DOBEN commented Sep 4, 2024

Task description

Add helper functions on the account_info type to distinguish between single_signer_accounts and multi_sig_accounts. Such logic is often implemented in many dapps to e.g. exclude multi-sig accounts from interacting with specific services. By providing a dedicated function, the logic can be easier re-used.
https://github.com/Concordium/concordium-dapp-examples/blob/e34d1a55e92bb912695147f9561afe4af6af2620/compliant-reward-distribution/indexer-and-server/src/bin/server.rs#L495

    let signer_account_info = state
        .node_client
        .get_account_info(
            &AccountIdentifier::Address(*signer),
            BlockIdentifier::LastFinal,
        )
        .await
        .map_err(ServerError::QueryError)?;

Sub-tasks

  • 2 helper functions that return boolean:
let is_single_signer: bool = signer_account_info.is_single_signer_account();
let is_multi_signer: bool = signer_account_info.is_multi_sig_account();
  • 2 helper functions that throw an error:
signer_account_info.assert_single_signer_account()?;
signer_account_info.assert_multi_sig_account()?;
@DOBEN DOBEN added the [Type] Task An additional feature or improvement. label Sep 4, 2024
@DOBEN DOBEN changed the title Function on account_info to check Helpers to distinguish between single_signer_accounts and multi_sig accounts Sep 4, 2024
@DOBEN DOBEN changed the title Helpers to distinguish between single_signer_accounts and multi_sig accounts Helpers to distinguish between single_signer_accounts and multi_sig accounts Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Task An additional feature or improvement.
Projects
None yet
Development

No branches or pull requests

1 participant