Skip to content

AccountRestrictionFlags should be simiplied into smaller enum types #568

@Wayonb

Description

@Wayonb

Currently AccountRestrictionFlags is used with three different account restriction transaction type. The problem is that not all of enum value in AccountRestrictionFlags is valid for each transaction type. This can lead to runtime failures instead of catching errors at compile time.

Suggestion is to break AccountRestrictionFlags into three smaller enum types, each specific to transaction type.

e.g. This would be for the account address restriction tx.

export enum AccountAddressRestrictionFlags {
/**
* Allow only incoming transactions from a given address.
*/
AllowIncomingAddress = AccountRestrictionTypeEnum.Address,

/**
 * Allow only outgoing transactions to a given address.
 */
AllowOutgoingAddress = AccountRestrictionTypeEnum.Address + AccountRestrictionTypeEnum.Outgoing,

/**
 * Block incoming transactions from a given address.
 */
BlockIncomingAddress = AccountRestrictionTypeEnum.Address + AccountRestrictionTypeEnum.Block,

/**
 * Block outgoing transactions from a given address.
 */
BlockOutgoingAddress = AccountRestrictionTypeEnum.Address + AccountRestrictionTypeEnum.Block + AccountRestrictionTypeEnum.Outgoing,

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions