Skip to content

accountHttp.getAccountRestrictions could return an array of restrictions #277

@dgarcia360

Description

@dgarcia360
  1. Expected behavior and actual behavior.

While developing a nem2-cli command for getting the account restrictions linked to an address, I have noticed that accountHttp.getAccountRestrictions returns an AccountRestrictionsInfo object, having to navigate throwgh the object as follows:

const accountHttp = new AccountHttp(profile.url);
        accountHttp.getAccountRestrictions(address)
            .subscribe((accountRestrictions) => {
                this.spinner.stop(true);
                if (accountRestrictions.accountRestrictions.restrictions.length > 0) {
                    console.log(new AccountRestrictionsTable(accountRestrictions.accountRestrictions.restrictions).toString());
                } else {
                    console.log('\n The address does not have any account restriction assigned.');
                }
            }, (err) => {
                this.spinner.stop(true);
                let text = '';
                text += chalk.red('Error');
                console.log(text, err.response !== undefined ? err.response.text : err);
            });

We could think of returning an array of AccountRestriction[], because we already know the address we are querying and to match other services responses (e.g. blockHttp.getBlockTransactions returns Transaction[] and not a TransactionInfo object)

  1. Specifications like the version of the project, operating system, or hardware.
  • nem2-sdk@0.13.3

Metadata

Metadata

Assignees

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