Skip to content

Commit f34231a

Browse files
committed
Applied new DTOs from nem2-doc
Renamed all `account properties` to `restrictions`
1 parent 155aa1a commit f34231a

File tree

104 files changed

+1115
-1117
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+1115
-1117
lines changed

e2e/infrastructure/AccountHttp.spec.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ describe('AccountHttp', () => {
198198
RestrictionModificationType.Add,
199199
account3.address,
200200
);
201-
const addressModification = AccountRestrictionTransaction.createAddressPropertyModificationTransaction(
201+
const addressModification = AccountRestrictionTransaction.createAddressRestrictionModificationTransaction(
202202
Deadline.create(),
203203
RestrictionType.BlockAddress,
204204
[addressPropertyFilter],
@@ -282,22 +282,22 @@ describe('AccountHttp', () => {
282282
});
283283
});
284284

285-
describe('getAccountProperty', () => {
286-
it('should call getAccountProperty successfully', (done) => {
285+
describe('getAccountRestrictions', () => {
286+
it('should call getAccountRestrictions successfully', (done) => {
287287
setTimeout(() => {
288-
accountHttp.getAccountProperties(accountAddress).subscribe((accountProperty) => {
289-
deepEqual(accountProperty.accountRestrictions.address, accountAddress);
288+
accountHttp.getAccountRestrictions(accountAddress).subscribe((accountRestrictions) => {
289+
deepEqual(accountRestrictions.accountRestrictions.address, accountAddress);
290290
done();
291291
});
292292
}, 1000);
293293
});
294294
});
295295

296-
describe('getAccountProperties', () => {
297-
it('should call getAccountProperties successfully', (done) => {
296+
describe('getAccountRestrictions', () => {
297+
it('should call getAccountRestrictions successfully', (done) => {
298298
setTimeout(() => {
299-
accountHttp.getAccountPropertiesFromAccounts([accountAddress]).subscribe((accountProperties) => {
300-
deepEqual(accountProperties[0]!.accountRestrictions.address, accountAddress);
299+
accountHttp.getAccountRestrictionsFromAccounts([accountAddress]).subscribe((accountRestrictions) => {
300+
deepEqual(accountRestrictions[0]!.accountRestrictions.address, accountAddress);
301301
done();
302302
});
303303
}, 1000);
@@ -409,7 +409,7 @@ describe('AccountHttp', () => {
409409
transactionHttp.announce(signedTransaction);
410410
});
411411
});
412-
describe('Remove test AccountProperty - Address', () => {
412+
describe('Remove test AccountRestriction - Address', () => {
413413
let listener: Listener;
414414
before (() => {
415415
listener = new Listener(config.apiUrl);
@@ -424,7 +424,7 @@ describe('AccountHttp', () => {
424424
RestrictionModificationType.Remove,
425425
account3.address,
426426
);
427-
const addressModification = AccountRestrictionTransaction.createAddressPropertyModificationTransaction(
427+
const addressModification = AccountRestrictionTransaction.createAddressRestrictionModificationTransaction(
428428
Deadline.create(),
429429
RestrictionType.BlockAddress,
430430
[addressPropertyFilter],

e2e/infrastructure/TransactionHttp.spec.ts

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ import { NamespaceHttp } from '../../src/infrastructure/infrastructure';
2424
import {Listener} from '../../src/infrastructure/Listener';
2525
import {TransactionHttp} from '../../src/infrastructure/TransactionHttp';
2626
import {Account} from '../../src/model/account/Account';
27-
import {Address} from '../../src/model/account/Address';
2827
import { RestrictionModificationType } from '../../src/model/account/RestrictionModificationType';
2928
import { RestrictionType } from '../../src/model/account/RestrictionType';
30-
import {PublicAccount} from '../../src/model/account/PublicAccount';
3129
import {NetworkType} from '../../src/model/blockchain/NetworkType';
3230
import { Mosaic } from '../../src/model/mosaic/Mosaic';
3331
import {MosaicId} from '../../src/model/mosaic/MosaicId';
@@ -38,31 +36,26 @@ import {NetworkCurrencyMosaic} from '../../src/model/mosaic/NetworkCurrencyMosai
3836
import { AliasActionType } from '../../src/model/namespace/AliasActionType';
3937
import { NamespaceId } from '../../src/model/namespace/NamespaceId';
4038
import { AccountAddressRestrictionModificationTransaction } from '../../src/model/transaction/AccountAddressRestrictionModificationTransaction';
41-
import { AccountOperationRestrictionModificationTransaction } from '../../src/model/transaction/AccountOperationRestrictionModificationTransaction';
4239
import { AccountLinkTransaction } from '../../src/model/transaction/AccountLinkTransaction';
4340
import { AccountMosaicRestrictionModificationTransaction } from '../../src/model/transaction/AccountMosaicRestrictionModificationTransaction';
41+
import { AccountOperationRestrictionModificationTransaction } from '../../src/model/transaction/AccountOperationRestrictionModificationTransaction';
4442
import { AccountRestrictionModification } from '../../src/model/transaction/AccountRestrictionModification';
4543
import { AccountRestrictionTransaction } from '../../src/model/transaction/AccountRestrictionTransaction';
4644
import { AddressAliasTransaction } from '../../src/model/transaction/AddressAliasTransaction';
4745
import {AggregateTransaction} from '../../src/model/transaction/AggregateTransaction';
4846
import {CosignatureSignedTransaction} from '../../src/model/transaction/CosignatureSignedTransaction';
49-
import {CosignatureTransaction} from '../../src/model/transaction/CosignatureTransaction';
5047
import {Deadline} from '../../src/model/transaction/Deadline';
5148
import { HashLockTransaction } from '../../src/model/transaction/HashLockTransaction';
5249
import {HashType} from '../../src/model/transaction/HashType';
5350
import { LinkAction } from '../../src/model/transaction/LinkAction';
5451
import {LockFundsTransaction} from '../../src/model/transaction/LockFundsTransaction';
55-
import {ModifyMultisigAccountTransaction} from '../../src/model/transaction/ModifyMultisigAccountTransaction';
5652
import { MosaicAliasTransaction } from '../../src/model/transaction/MosaicAliasTransaction';
5753
import {MosaicDefinitionTransaction} from '../../src/model/transaction/MosaicDefinitionTransaction';
5854
import {MosaicSupplyChangeTransaction} from '../../src/model/transaction/MosaicSupplyChangeTransaction';
59-
import {MultisigCosignatoryModification} from '../../src/model/transaction/MultisigCosignatoryModification';
60-
import {MultisigCosignatoryModificationType} from '../../src/model/transaction/MultisigCosignatoryModificationType';
61-
import {EmptyMessage, PlainMessage} from '../../src/model/transaction/PlainMessage';
55+
import { PlainMessage } from '../../src/model/transaction/PlainMessage';
6256
import {RegisterNamespaceTransaction} from '../../src/model/transaction/RegisterNamespaceTransaction';
6357
import {SecretLockTransaction} from '../../src/model/transaction/SecretLockTransaction';
6458
import {SecretProofTransaction} from '../../src/model/transaction/SecretProofTransaction';
65-
import {SignedTransaction} from '../../src/model/transaction/SignedTransaction';
6659
import {Transaction} from '../../src/model/transaction/Transaction';
6760
import {TransactionType} from '../../src/model/transaction/TransactionType';
6861
import {TransferTransaction} from '../../src/model/transaction/TransferTransaction';
@@ -283,14 +276,14 @@ describe('TransactionHttp', () => {
283276
});
284277

285278
it('standalone', (done) => {
286-
const addressPropertyFilter = AccountRestrictionModification.createForAddress(
279+
const addressRestrictionFilter = AccountRestrictionModification.createForAddress(
287280
RestrictionModificationType.Add,
288281
account3.address,
289282
);
290-
const addressModification = AccountRestrictionTransaction.createAddressPropertyModificationTransaction(
283+
const addressModification = AccountRestrictionTransaction.createAddressRestrictionModificationTransaction(
291284
Deadline.create(),
292285
RestrictionType.BlockAddress,
293-
[addressPropertyFilter],
286+
[addressRestrictionFilter],
294287
NetworkType.MIJIN_TEST,
295288
);
296289
const signedTransaction = addressModification.signWith(account, generationHash);
@@ -299,7 +292,7 @@ describe('TransactionHttp', () => {
299292
expect(transaction.modifications, 'Modifications').not.to.be.undefined;
300293
expect(transaction.modifications[0].modificationType, 'Modifications.ModificationType').not.to.be.undefined;
301294
expect(transaction.modifications[0].value, 'Modifications.Value').not.to.be.undefined;
302-
expect(transaction.restrictionType, 'PropertyType').not.to.be.undefined;
295+
expect(transaction.restrictionType, 'RestrictionType').not.to.be.undefined;
303296
done();
304297
});
305298
listener.status(account.address).subscribe((error) => {
@@ -320,14 +313,14 @@ describe('TransactionHttp', () => {
320313
return listener.close();
321314
});
322315
it('aggregate', (done) => {
323-
const addressPropertyFilter = AccountRestrictionModification.createForAddress(
316+
const addressRestrictionFilter = AccountRestrictionModification.createForAddress(
324317
RestrictionModificationType.Remove,
325318
account3.address,
326319
);
327-
const addressModification = AccountRestrictionTransaction.createAddressPropertyModificationTransaction(
320+
const addressModification = AccountRestrictionTransaction.createAddressRestrictionModificationTransaction(
328321
Deadline.create(),
329322
RestrictionType.BlockAddress,
330-
[addressPropertyFilter],
323+
[addressRestrictionFilter],
331324
NetworkType.MIJIN_TEST,
332325
);
333326
const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(),
@@ -358,14 +351,14 @@ describe('TransactionHttp', () => {
358351
});
359352

360353
it('standalone', (done) => {
361-
const mosaicPropertyFilter = AccountRestrictionModification.createForMosaic(
354+
const mosaicRestrictionFilter = AccountRestrictionModification.createForMosaic(
362355
RestrictionModificationType.Add,
363356
mosaicId,
364357
);
365-
const addressModification = AccountRestrictionTransaction.createMosaicPropertyModificationTransaction(
358+
const addressModification = AccountRestrictionTransaction.createMosaicRestrictionModificationTransaction(
366359
Deadline.create(),
367360
RestrictionType.BlockMosaic,
368-
[mosaicPropertyFilter],
361+
[mosaicRestrictionFilter],
369362
NetworkType.MIJIN_TEST,
370363
);
371364
const signedTransaction = addressModification.signWith(account, generationHash);
@@ -374,7 +367,7 @@ describe('TransactionHttp', () => {
374367
expect(transaction.modifications, 'Modifications').not.to.be.undefined;
375368
expect(transaction.modifications[0].modificationType, 'Modifications.ModificationType').not.to.be.undefined;
376369
expect(transaction.modifications[0].value, 'Modifications.Value').not.to.be.undefined;
377-
expect(transaction.restrictionType, 'PropertyType').not.to.be.undefined;
370+
expect(transaction.restrictionType, 'RestrictionType').not.to.be.undefined;
378371
done();
379372
});
380373
listener.status(account.address).subscribe((error) => {
@@ -395,14 +388,14 @@ describe('TransactionHttp', () => {
395388
return listener.close();
396389
});
397390
it('aggregate', (done) => {
398-
const mosaicPropertyFilter = AccountRestrictionModification.createForMosaic(
391+
const mosaicRestrictionFilter = AccountRestrictionModification.createForMosaic(
399392
RestrictionModificationType.Remove,
400393
mosaicId,
401394
);
402-
const addressModification = AccountRestrictionTransaction.createMosaicPropertyModificationTransaction(
395+
const addressModification = AccountRestrictionTransaction.createMosaicRestrictionModificationTransaction(
403396
Deadline.create(),
404397
RestrictionType.BlockMosaic,
405-
[mosaicPropertyFilter],
398+
[mosaicRestrictionFilter],
406399
NetworkType.MIJIN_TEST,
407400
);
408401
const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(),
@@ -422,7 +415,7 @@ describe('TransactionHttp', () => {
422415
transactionHttp.announce(signedTransaction);
423416
});
424417
});
425-
describe('AccountRestrictionTransaction - EntityType', () => {
418+
describe('AccountRestrictionTransaction - Operation', () => {
426419
let listener: Listener;
427420
before (() => {
428421
listener = new Listener(config.apiUrl);
@@ -433,14 +426,14 @@ describe('TransactionHttp', () => {
433426
});
434427

435428
it('standalone', (done) => {
436-
const entityTypePropertyFilter = AccountRestrictionModification.createForEntityType(
429+
const operationRestrictionFilter = AccountRestrictionModification.createForOperation(
437430
RestrictionModificationType.Add,
438431
TransactionType.LINK_ACCOUNT,
439432
);
440-
const addressModification = AccountRestrictionTransaction.createEntityTypePropertyModificationTransaction(
433+
const addressModification = AccountRestrictionTransaction.createOperationRestrictionModificationTransaction(
441434
Deadline.create(),
442435
RestrictionType.BlockTransaction,
443-
[entityTypePropertyFilter],
436+
[operationRestrictionFilter],
444437
NetworkType.MIJIN_TEST,
445438
);
446439
const signedTransaction = addressModification.signWith(account3, generationHash);
@@ -449,7 +442,7 @@ describe('TransactionHttp', () => {
449442
expect(transaction.modifications, 'Modifications').not.to.be.undefined;
450443
expect(transaction.modifications[0].modificationType, 'Modifications.ModificationType').not.to.be.undefined;
451444
expect(transaction.modifications[0].value, 'Modifications.Value').not.to.be.undefined;
452-
expect(transaction.restrictionType, 'PropertyType').not.to.be.undefined;
445+
expect(transaction.restrictionType, 'RestrictionType').not.to.be.undefined;
453446
done();
454447
});
455448
listener.status(account3.address).subscribe((error) => {
@@ -460,7 +453,7 @@ describe('TransactionHttp', () => {
460453
transactionHttp.announce(signedTransaction);
461454
});
462455
});
463-
describe('AccountRestrictionTransaction - EntityType', () => {
456+
describe('AccountRestrictionTransaction - Operation', () => {
464457
let listener: Listener;
465458
before (() => {
466459
listener = new Listener(config.apiUrl);
@@ -470,14 +463,14 @@ describe('TransactionHttp', () => {
470463
return listener.close();
471464
});
472465
it('aggregate', (done) => {
473-
const entityTypePropertyFilter = AccountRestrictionModification.createForEntityType(
466+
const operationRestrictionFilter = AccountRestrictionModification.createForOperation(
474467
RestrictionModificationType.Remove,
475468
TransactionType.LINK_ACCOUNT,
476469
);
477-
const addressModification = AccountRestrictionTransaction.createEntityTypePropertyModificationTransaction(
470+
const addressModification = AccountRestrictionTransaction.createOperationRestrictionModificationTransaction(
478471
Deadline.create(),
479472
RestrictionType.BlockTransaction,
480-
[entityTypePropertyFilter],
473+
[operationRestrictionFilter],
481474
NetworkType.MIJIN_TEST,
482475
);
483476
const aggregateTransaction = AggregateTransaction.createComplete(Deadline.create(),

src/core/utils/DtoMapping.ts

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

17+
import { AccountRestriction } from '../../model/account/AccountRestriction';
1718
import { AccountRestrictions } from '../../model/account/AccountRestrictions';
1819
import { AccountRestrictionsInfo } from '../../model/account/AccountRestrictionsInfo';
19-
import { AccountRestriction } from '../../model/account/AccountRestriction';
2020
import { Address } from '../../model/account/Address';
2121
import { RestrictionType } from '../../model/account/RestrictionType';
2222
import { MosaicId } from '../../model/mosaic/MosaicId';
2323

2424
export class DtoMapping {
2525

2626
/**
27-
* Create AccountPropertyInfo class from Json.
28-
* @param {object} dataJson The account property json object.
29-
* @returns {module: model/Account/AccountPropertiesInfo} The AccountPropertiesInfo class.
27+
* Create AccountRestrictionsInfo class from Json.
28+
* @param {object} dataJson The account restriction json object.
29+
* @returns {module: model/Account/AccountRestrictionsInfo} The AccountRestrictionsInfo class.
3030
*/
31-
public static extractAccountPropertyFromDto(accountProperties): AccountRestrictionsInfo {
31+
public static extractAccountRestrictionFromDto(accountRestrictions): AccountRestrictionsInfo {
3232
return new AccountRestrictionsInfo(
33-
accountProperties.meta,
34-
new AccountRestrictions(Address.createFromEncoded(accountProperties.accountProperties.address),
35-
accountProperties.accountProperties.properties.map((prop) => {
36-
switch (prop.propertyType) {
33+
accountRestrictions.meta,
34+
new AccountRestrictions(Address.createFromEncoded(accountRestrictions.accountRestrictions.address),
35+
accountRestrictions.accountRestrictions.restrictions.map((prop) => {
36+
switch (prop.restrictionType) {
3737
case RestrictionType.AllowAddress:
3838
case RestrictionType.BlockAddress:
39-
return new AccountRestriction(prop.propertyType,
39+
return new AccountRestriction(prop.restrictionType,
4040
prop.values.map((value) => Address.createFromEncoded(value)));
4141
case RestrictionType.AllowMosaic:
4242
case RestrictionType.BlockMosaic:
43-
return new AccountRestriction(prop.propertyType,
43+
return new AccountRestriction(prop.restrictionType,
4444
prop.values.map((value) => new MosaicId(value)));
4545
case RestrictionType.AllowTransaction:
4646
case RestrictionType.BlockTransaction:
47-
return new AccountRestriction(prop.propertyType, prop.values);
47+
return new AccountRestriction(prop.restrictionType, prop.values);
4848
default:
49-
throw new Error(`Invalid property type: ${prop.propertyType}`);
49+
throw new Error(`Invalid restriction type: ${prop.restrictionType}`);
5050
}
5151
})));
5252
}

0 commit comments

Comments
 (0)