Skip to content

Helpers to distinguish between single_signer_accounts and multi_sig accounts #211

@DOBEN

Description

@DOBEN

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()?;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions