Skip to content

Commit 57b9a5c

Browse files
committed
Renamed RestrictionType to AccountRestrictionType
1 parent 71e41cd commit 57b9a5c

16 files changed

+78
-77
lines changed

e2e/infrastructure/AccountHttp.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ import {assert, expect} from 'chai';
1919
import {AccountHttp} from '../../src/infrastructure/AccountHttp';
2020
import { Listener, TransactionHttp } from '../../src/infrastructure/infrastructure';
2121
import { Account } from '../../src/model/account/Account';
22+
import { AccountRestrictionType } from '../../src/model/account/AccountRestrictionType';
2223
import {Address} from '../../src/model/account/Address';
23-
import { RestrictionModificationType } from '../../src/model/account/RestrictionModificationType';
24-
import { RestrictionType } from '../../src/model/account/RestrictionType';
2524
import {PublicAccount} from '../../src/model/account/PublicAccount';
25+
import { RestrictionModificationType } from '../../src/model/account/RestrictionModificationType';
2626
import {NetworkType} from '../../src/model/blockchain/NetworkType';
2727
import { NetworkCurrencyMosaic } from '../../src/model/mosaic/NetworkCurrencyMosaic';
2828
import { AliasActionType } from '../../src/model/namespace/AliasActionType';
@@ -200,7 +200,7 @@ describe('AccountHttp', () => {
200200
);
201201
const addressModification = AccountRestrictionTransaction.createAddressRestrictionModificationTransaction(
202202
Deadline.create(),
203-
RestrictionType.BlockAddress,
203+
AccountRestrictionType.BlockAddress,
204204
[addressPropertyFilter],
205205
NetworkType.MIJIN_TEST,
206206
);
@@ -426,7 +426,7 @@ describe('AccountHttp', () => {
426426
);
427427
const addressModification = AccountRestrictionTransaction.createAddressRestrictionModificationTransaction(
428428
Deadline.create(),
429-
RestrictionType.BlockAddress,
429+
AccountRestrictionType.BlockAddress,
430430
[addressPropertyFilter],
431431
NetworkType.MIJIN_TEST,
432432
);

e2e/infrastructure/TransactionHttp.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ import { NamespaceHttp } from '../../src/infrastructure/infrastructure';
2525
import {Listener} from '../../src/infrastructure/Listener';
2626
import {TransactionHttp} from '../../src/infrastructure/TransactionHttp';
2727
import {Account} from '../../src/model/account/Account';
28+
import { AccountRestrictionType } from '../../src/model/account/AccountRestrictionType';
2829
import { RestrictionModificationType } from '../../src/model/account/RestrictionModificationType';
29-
import { RestrictionType } from '../../src/model/account/RestrictionType';
3030
import {NetworkType} from '../../src/model/blockchain/NetworkType';
3131
import { Mosaic } from '../../src/model/mosaic/Mosaic';
3232
import {MosaicId} from '../../src/model/mosaic/MosaicId';
@@ -404,7 +404,7 @@ describe('TransactionHttp', () => {
404404
);
405405
const addressModification = AccountRestrictionTransaction.createAddressRestrictionModificationTransaction(
406406
Deadline.create(),
407-
RestrictionType.BlockAddress,
407+
AccountRestrictionType.BlockAddress,
408408
[addressRestrictionFilter],
409409
NetworkType.MIJIN_TEST,
410410
);
@@ -441,7 +441,7 @@ describe('TransactionHttp', () => {
441441
);
442442
const addressModification = AccountRestrictionTransaction.createAddressRestrictionModificationTransaction(
443443
Deadline.create(),
444-
RestrictionType.BlockAddress,
444+
AccountRestrictionType.BlockAddress,
445445
[addressRestrictionFilter],
446446
NetworkType.MIJIN_TEST,
447447
);
@@ -479,7 +479,7 @@ describe('TransactionHttp', () => {
479479
);
480480
const addressModification = AccountRestrictionTransaction.createMosaicRestrictionModificationTransaction(
481481
Deadline.create(),
482-
RestrictionType.BlockMosaic,
482+
AccountRestrictionType.BlockMosaic,
483483
[mosaicRestrictionFilter],
484484
NetworkType.MIJIN_TEST,
485485
);
@@ -516,7 +516,7 @@ describe('TransactionHttp', () => {
516516
);
517517
const addressModification = AccountRestrictionTransaction.createMosaicRestrictionModificationTransaction(
518518
Deadline.create(),
519-
RestrictionType.BlockMosaic,
519+
AccountRestrictionType.BlockMosaic,
520520
[mosaicRestrictionFilter],
521521
NetworkType.MIJIN_TEST,
522522
);
@@ -554,7 +554,7 @@ describe('TransactionHttp', () => {
554554
);
555555
const addressModification = AccountRestrictionTransaction.createOperationRestrictionModificationTransaction(
556556
Deadline.create(),
557-
RestrictionType.BlockTransaction,
557+
AccountRestrictionType.BlockTransaction,
558558
[operationRestrictionFilter],
559559
NetworkType.MIJIN_TEST,
560560
);
@@ -591,7 +591,7 @@ describe('TransactionHttp', () => {
591591
);
592592
const addressModification = AccountRestrictionTransaction.createOperationRestrictionModificationTransaction(
593593
Deadline.create(),
594-
RestrictionType.BlockTransaction,
594+
AccountRestrictionType.BlockTransaction,
595595
[operationRestrictionFilter],
596596
NetworkType.MIJIN_TEST,
597597
);

src/core/utils/DtoMapping.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
import { AccountRestriction } from '../../model/account/AccountRestriction';
1818
import { AccountRestrictions } from '../../model/account/AccountRestrictions';
1919
import { AccountRestrictionsInfo } from '../../model/account/AccountRestrictionsInfo';
20+
import { AccountRestrictionType } from '../../model/account/AccountRestrictionType';
2021
import { Address } from '../../model/account/Address';
21-
import { RestrictionType } from '../../model/account/RestrictionType';
2222
import { MosaicId } from '../../model/mosaic/MosaicId';
2323

2424
export class DtoMapping {
@@ -34,16 +34,16 @@ export class DtoMapping {
3434
new AccountRestrictions(Address.createFromEncoded(accountRestrictions.accountRestrictions.address),
3535
accountRestrictions.accountRestrictions.restrictions.map((prop) => {
3636
switch (prop.restrictionType) {
37-
case RestrictionType.AllowAddress:
38-
case RestrictionType.BlockAddress:
37+
case AccountRestrictionType.AllowAddress:
38+
case AccountRestrictionType.BlockAddress:
3939
return new AccountRestriction(prop.restrictionType,
4040
prop.values.map((value) => Address.createFromEncoded(value)));
41-
case RestrictionType.AllowMosaic:
42-
case RestrictionType.BlockMosaic:
41+
case AccountRestrictionType.AllowMosaic:
42+
case AccountRestrictionType.BlockMosaic:
4343
return new AccountRestriction(prop.restrictionType,
4444
prop.values.map((value) => new MosaicId(value)));
45-
case RestrictionType.AllowTransaction:
46-
case RestrictionType.BlockTransaction:
45+
case AccountRestrictionType.AllowTransaction:
46+
case AccountRestrictionType.BlockTransaction:
4747
return new AccountRestriction(prop.restrictionType, prop.values);
4848
default:
4949
throw new Error(`Invalid restriction type: ${prop.restrictionType}`);

src/model/account/AccountRestriction.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { RestrictionType } from './RestrictionType';
17+
import { AccountRestrictionType } from './AccountRestrictionType';
1818
/**
1919
* Account restriction structure describes restriction information.
2020
*/
@@ -29,7 +29,7 @@ export class AccountRestriction {
2929
/**
3030
* Account restriction type
3131
*/
32-
public readonly restrictionType: RestrictionType,
32+
public readonly restrictionType: AccountRestrictionType,
3333
/**
3434
* Restriction values.
3535
*/

src/model/account/RestrictionType.ts renamed to src/model/account/AccountRestrictionType.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* 0x80 + type The restriction is interpreted as a blocking operation.
2424
*/
2525

26-
export enum RestrictionType {
26+
export enum AccountRestrictionType {
2727
AllowAddress = 0x01,
2828
AllowMosaic = 0x02,
2929
AllowTransaction = 0x04,

src/model/model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export * from './account/AccountRestrictions';
2828
export * from './account/AccountRestrictionsInfo';
2929
export * from './account/AccountRestriction';
3030
export * from './account/RestrictionModificationType';
31-
export * from './account/RestrictionType';
31+
export * from './account/AccountRestrictionType';
3232
export * from './account/AccountNames';
3333

3434
// Blockchain

src/model/transaction/AccountAddressRestrictionModificationTransaction.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
import { Builder } from '../../infrastructure/builders/AccountRestrictionsAddressTransaction';
1818
import {VerifiableTransaction} from '../../infrastructure/builders/VerifiableTransaction';
19+
import { AccountRestrictionType } from '../account/AccountRestrictionType';
1920
import { PublicAccount } from '../account/PublicAccount';
20-
import { RestrictionType } from '../account/RestrictionType';
2121
import { NetworkType } from '../blockchain/NetworkType';
2222
import { UInt64 } from '../UInt64';
2323
import { AccountRestrictionModification } from './AccountRestrictionModification';
@@ -39,7 +39,7 @@ export class AccountAddressRestrictionModificationTransaction extends Transactio
3939
* @returns {AccountAddressRestrictionModificationTransaction}
4040
*/
4141
public static create(deadline: Deadline,
42-
restrictionType: RestrictionType,
42+
restrictionType: AccountRestrictionType,
4343
modifications: Array<AccountRestrictionModification<string>>,
4444
networkType: NetworkType,
4545
maxFee: UInt64 = new UInt64([0, 0])): AccountAddressRestrictionModificationTransaction {
@@ -66,7 +66,7 @@ export class AccountAddressRestrictionModificationTransaction extends Transactio
6666
version: number,
6767
deadline: Deadline,
6868
maxFee: UInt64,
69-
public readonly restrictionType: RestrictionType,
69+
public readonly restrictionType: AccountRestrictionType,
7070
public readonly modifications: Array<AccountRestrictionModification<string>>,
7171
signature?: string,
7272
signer?: PublicAccount,

src/model/transaction/AccountMosaicRestrictionModificationTransaction.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
import { Builder } from '../../infrastructure/builders/AccountRestrictionsMosaicTransaction';
1818
import {VerifiableTransaction} from '../../infrastructure/builders/VerifiableTransaction';
19+
import { AccountRestrictionType } from '../account/AccountRestrictionType';
1920
import { PublicAccount } from '../account/PublicAccount';
20-
import { RestrictionType } from '../account/RestrictionType';
2121
import { NetworkType } from '../blockchain/NetworkType';
2222
import { UInt64 } from '../UInt64';
2323
import { AccountRestrictionModification } from './AccountRestrictionModification';
@@ -39,7 +39,7 @@ export class AccountMosaicRestrictionModificationTransaction extends Transaction
3939
* @returns {AccountAddressRestrictionModificationTransaction}
4040
*/
4141
public static create(deadline: Deadline,
42-
restrictionType: RestrictionType,
42+
restrictionType: AccountRestrictionType,
4343
modifications: Array<AccountRestrictionModification<number[]>>,
4444
networkType: NetworkType,
4545
maxFee: UInt64 = new UInt64([0, 0])): AccountMosaicRestrictionModificationTransaction {
@@ -66,7 +66,7 @@ export class AccountMosaicRestrictionModificationTransaction extends Transaction
6666
version: number,
6767
deadline: Deadline,
6868
maxFee: UInt64,
69-
public readonly restrictionType: RestrictionType,
69+
public readonly restrictionType: AccountRestrictionType,
7070
public readonly modifications: Array<AccountRestrictionModification<number[]>>,
7171
signature?: string,
7272
signer?: PublicAccount,

src/model/transaction/AccountOperationRestrictionModificationTransaction.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
import { Builder } from '../../infrastructure/builders/AccountRestrictionsEntityTypeTransaction';
1818
import {VerifiableTransaction} from '../../infrastructure/builders/VerifiableTransaction';
19+
import { AccountRestrictionType } from '../account/AccountRestrictionType';
1920
import { PublicAccount } from '../account/PublicAccount';
20-
import { RestrictionType } from '../account/RestrictionType';
2121
import { NetworkType } from '../blockchain/NetworkType';
2222
import { UInt64 } from '../UInt64';
2323
import { AccountRestrictionModification } from './AccountRestrictionModification';
@@ -39,7 +39,7 @@ export class AccountOperationRestrictionModificationTransaction extends Transact
3939
* @returns {AccountOperationRestrictionModificationTransaction}
4040
*/
4141
public static create(deadline: Deadline,
42-
restrictionType: RestrictionType,
42+
restrictionType: AccountRestrictionType,
4343
modifications: Array<AccountRestrictionModification<TransactionType>>,
4444
networkType: NetworkType,
4545
maxFee: UInt64 = new UInt64([0, 0])): AccountOperationRestrictionModificationTransaction {
@@ -66,7 +66,7 @@ export class AccountOperationRestrictionModificationTransaction extends Transact
6666
version: number,
6767
deadline: Deadline,
6868
maxFee: UInt64,
69-
public readonly restrictionType: RestrictionType,
69+
public readonly restrictionType: AccountRestrictionType,
7070
public readonly modifications: Array<AccountRestrictionModification<TransactionType>>,
7171
signature?: string,
7272
signer?: PublicAccount,

src/model/transaction/AccountRestrictionTransaction.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { RestrictionType } from '../account/RestrictionType';
17+
import { AccountRestrictionType } from '../account/AccountRestrictionType';
1818
import { NetworkType } from '../blockchain/NetworkType';
1919
import { UInt64 } from '../UInt64';
2020
import { AccountAddressRestrictionModificationTransaction } from './AccountAddressRestrictionModificationTransaction';
@@ -36,12 +36,12 @@ export class AccountRestrictionTransaction {
3636
*/
3737
public static createAddressRestrictionModificationTransaction(
3838
deadline: Deadline,
39-
restrictionType: RestrictionType,
39+
restrictionType: AccountRestrictionType,
4040
modifications: Array<AccountRestrictionModification<string>>,
4141
networkType: NetworkType,
4242
maxFee: UInt64 = new UInt64([0, 0]),
4343
): AccountAddressRestrictionModificationTransaction {
44-
if (![RestrictionType.AllowAddress, RestrictionType.BlockAddress].includes(restrictionType)) {
44+
if (![AccountRestrictionType.AllowAddress, AccountRestrictionType.BlockAddress].includes(restrictionType)) {
4545
throw new Error ('Restriction type is not allowed.');
4646
}
4747
return AccountAddressRestrictionModificationTransaction.create(
@@ -64,12 +64,12 @@ export class AccountRestrictionTransaction {
6464
*/
6565
public static createMosaicRestrictionModificationTransaction(
6666
deadline: Deadline,
67-
restrictionType: RestrictionType,
67+
restrictionType: AccountRestrictionType,
6868
modifications: Array<AccountRestrictionModification<number[]>>,
6969
networkType: NetworkType,
7070
maxFee: UInt64 = new UInt64([0, 0]),
7171
): AccountMosaicRestrictionModificationTransaction {
72-
if (![RestrictionType.AllowMosaic, RestrictionType.BlockMosaic].includes(restrictionType)) {
72+
if (![AccountRestrictionType.AllowMosaic, AccountRestrictionType.BlockMosaic].includes(restrictionType)) {
7373
throw new Error ('Restriction type is not allowed.');
7474
}
7575
return AccountMosaicRestrictionModificationTransaction.create(
@@ -92,12 +92,12 @@ export class AccountRestrictionTransaction {
9292
*/
9393
public static createOperationRestrictionModificationTransaction(
9494
deadline: Deadline,
95-
restrictionType: RestrictionType,
95+
restrictionType: AccountRestrictionType,
9696
modifications: Array<AccountRestrictionModification<TransactionType>>,
9797
networkType: NetworkType,
9898
maxFee: UInt64 = new UInt64([0, 0]),
9999
): AccountOperationRestrictionModificationTransaction {
100-
if (![RestrictionType.AllowTransaction, RestrictionType.BlockTransaction].includes(restrictionType)) {
100+
if (![AccountRestrictionType.AllowTransaction, AccountRestrictionType.BlockTransaction].includes(restrictionType)) {
101101
throw new Error ('Restriction type is not allowed.');
102102
}
103103
return AccountOperationRestrictionModificationTransaction.create(

0 commit comments

Comments
 (0)