Skip to content

Commit 1582774

Browse files
Steven LiuSteven Liu
authored andcommitted
fixed a few bugs on account property transaction
1 parent 0d4e609 commit 1582774

File tree

7 files changed

+24
-15
lines changed

7 files changed

+24
-15
lines changed

src/model/account/PropertyType.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
export enum PropertyType {
2727
AllowAddress = 0x01,
2828
AllowMosaic = 0x02,
29-
AllowTransaction = 0x03,
30-
Sentinel = 0x04,
29+
AllowTransaction = 0x04,
30+
Sentinel = 0x05,
3131
BlockAddress = (0x80 + 0x01),
3232
BlockMosaic = (0x80 + 0x02),
33-
BlockTransaction = (0x80 + 0x03),
33+
BlockTransaction = (0x80 + 0x04),
3434
}

src/model/transaction/AccountPropertyTransaction.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ export class AccountPropertyTransaction {
7070
* @param networkType - The network type.
7171
* @returns {ModifyAccountPropertyEntityTypeTransaction}
7272
*/
73-
public static createEntityTypeProertyModificationransaction(deadline: Deadline,
74-
propertyType: PropertyType,
75-
modifications: Array<AccountPropertyModification<number>>,
76-
networkType: NetworkType): ModifyAccountPropertyEntityTypeTransaction {
73+
public static createEntityTypePropertyModificationTransaction(deadline: Deadline,
74+
propertyType: PropertyType,
75+
modifications: Array<AccountPropertyModification<number>>,
76+
networkType: NetworkType): ModifyAccountPropertyEntityTypeTransaction {
7777
if (![PropertyType.AllowTransaction, PropertyType.BlockTransaction].includes(propertyType)) {
7878
throw new Error ('Property type is not allowed.');
7979
}

src/model/transaction/ModifyAccountPropertyAddressTransaction.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { Deadline } from './Deadline';
2424
import { Transaction } from './Transaction';
2525
import { TransactionInfo } from './TransactionInfo';
2626
import { TransactionType } from './TransactionType';
27+
import { TransactionVersion } from './TransactionVersion';
2728

2829
export class ModifyAccountPropertyAddressTransaction extends Transaction {
2930

@@ -40,7 +41,7 @@ export class ModifyAccountPropertyAddressTransaction extends Transaction {
4041
modifications: Array<AccountPropertyModification<string>>,
4142
networkType: NetworkType): ModifyAccountPropertyAddressTransaction {
4243
return new ModifyAccountPropertyAddressTransaction(networkType,
43-
3,
44+
TransactionVersion.ACCOUNT_PROPERTY,
4445
deadline,
4546
new UInt64([0, 0]),
4647
propertyType,

src/model/transaction/ModifyAccountPropertyEntityTypeTransaction.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { Deadline } from './Deadline';
2525
import { Transaction } from './Transaction';
2626
import { TransactionInfo } from './TransactionInfo';
2727
import { TransactionType } from './TransactionType';
28+
import { TransactionVersion } from './TransactionVersion';
2829

2930
export class ModifyAccountPropertyEntityTypeTransaction extends Transaction {
3031

@@ -41,7 +42,7 @@ export class ModifyAccountPropertyEntityTypeTransaction extends Transaction {
4142
modifications: Array<AccountPropertyModification<number>>,
4243
networkType: NetworkType): ModifyAccountPropertyEntityTypeTransaction {
4344
return new ModifyAccountPropertyEntityTypeTransaction(networkType,
44-
3,
45+
TransactionVersion.ACCOUNT_PROPERTY,
4546
deadline,
4647
new UInt64([0, 0]),
4748
propertyType,

src/model/transaction/ModifyAccountPropertyMosaicTransaction.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { Deadline } from './Deadline';
2424
import { Transaction } from './Transaction';
2525
import { TransactionInfo } from './TransactionInfo';
2626
import { TransactionType } from './TransactionType';
27+
import { TransactionVersion } from './TransactionVersion';
2728

2829
export class ModifyAccountPropertyMosaicTransaction extends Transaction {
2930

@@ -40,7 +41,7 @@ export class ModifyAccountPropertyMosaicTransaction extends Transaction {
4041
modifications: Array<AccountPropertyModification<number[]>>,
4142
networkType: NetworkType): ModifyAccountPropertyMosaicTransaction {
4243
return new ModifyAccountPropertyMosaicTransaction(networkType,
43-
3,
44+
TransactionVersion.ACCOUNT_PROPERTY,
4445
deadline,
4546
new UInt64([0, 0]),
4647
propertyType,

src/model/transaction/TransactionVersion.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
*
2020
* Transaction format versions are defined in catapult-server in
2121
* each transaction's plugin source code.
22-
*
22+
*
2323
* In [catapult-server](https://github.com/nemtech/catapult-server), the `DEFINE_TRANSACTION_CONSTANTS` macro
2424
* is used to define the `TYPE` and `VERSION` of the transaction format.
25-
*
25+
*
2626
* @see https://github.com/nemtech/catapult-server/blob/master/plugins/txes/transfer/src/model/TransferTransaction.h#L37
2727
*/
2828
export class TransactionVersion {
@@ -97,4 +97,10 @@ export class TransactionVersion {
9797
* @type {number}
9898
*/
9999
public static readonly MOSAIC_ALIAS = 1;
100+
101+
/**
102+
* Account Property transaction version
103+
* @type {number}
104+
*/
105+
public static readonly ACCOUNT_PROPERTY = 1;
100106
}

test/model/transaction/AccountPropertyTransaction.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ describe('AccountPropertyTransaction', () => {
163163
PropertyModificationType.Add,
164164
entityType,
165165
);
166-
const entityTypePropertyTransaction = AccountPropertyTransaction.createEntityTypeProertyModificationransaction(
166+
const entityTypePropertyTransaction = AccountPropertyTransaction.createEntityTypePropertyModificationTransaction(
167167
Deadline.create(),
168168
PropertyType.AllowTransaction,
169169
[entityTypePropertyFilter],
@@ -175,7 +175,7 @@ describe('AccountPropertyTransaction', () => {
175175
expect(signedTransaction.payload.substring(
176176
240,
177177
signedTransaction.payload.length,
178-
)).to.be.equal('0301004E420000');
178+
)).to.be.equal('0401004E42');
179179

180180
});
181181

@@ -188,7 +188,7 @@ describe('AccountPropertyTransaction', () => {
188188
);
189189

190190
expect(() => {
191-
AccountPropertyTransaction.createEntityTypeProertyModificationransaction(
191+
AccountPropertyTransaction.createEntityTypePropertyModificationTransaction(
192192
Deadline.create(),
193193
PropertyType.Sentinel,
194194
[entityTypePropertyFilter],

0 commit comments

Comments
 (0)