Skip to content

Commit

Permalink
Merge pull request #162 from rg911/master
Browse files Browse the repository at this point in the history
Fixed bug on  transaction serliazation due to Dto definition changed
  • Loading branch information
Grégory Saive authored Jun 5, 2019
2 parents 9a4cd82 + 1f9669f commit c724c95
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/infrastructure/transaction/SerializeTransactionToJSON.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ export const SerializeTransactionToJSON = (transaction: Transaction): any => {
case TransactionType.LINK_ACCOUNT:
return {
remoteAccountKey: (transaction as AccountLinkTransaction).remoteAccountKey,
linkAction: (transaction as AccountLinkTransaction).linkAction,
action: (transaction as AccountLinkTransaction).linkAction,
};
case TransactionType.ADDRESS_ALIAS:
return {
aliasAction: (transaction as AddressAliasTransaction).actionType,
action: (transaction as AddressAliasTransaction).actionType,
namespaceId: (transaction as AddressAliasTransaction).namespaceId.toDTO(),
address: (transaction as AddressAliasTransaction).address.toDTO(),
};
Expand Down Expand Up @@ -101,7 +101,7 @@ export const SerializeTransactionToJSON = (transaction: Transaction): any => {
};
case TransactionType.MOSAIC_ALIAS:
return {
aliasAction: (transaction as MosaicAliasTransaction).actionType,
action: (transaction as MosaicAliasTransaction).actionType,
namespaceId: (transaction as MosaicAliasTransaction).namespaceId.toDTO(),
mosaicId: (transaction as MosaicAliasTransaction).mosaicId.toDTO(),
};
Expand Down
2 changes: 1 addition & 1 deletion src/model/transaction/AccountPropertyModification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class AccountPropertyModification<T> {
toDTO() {
return {
value: this.value,
modificationType: this.modificationType,
type: this.modificationType,
};
}
}
6 changes: 3 additions & 3 deletions test/infrastructure/SerializeTransactionToJSON.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('SerializeTransactionToJSON', () => {
const json = accountLinkTransaction.toJSON();

expect(json.transaction.remoteAccountKey).to.be.equal(account.publicKey);
expect(json.transaction.linkAction).to.be.equal(LinkAction.Link);
expect(json.transaction.action).to.be.equal(LinkAction.Link);
});

it('should create AccountPropertyAddressTransaction', () => {
Expand Down Expand Up @@ -149,7 +149,7 @@ describe('SerializeTransactionToJSON', () => {
const json = addressAliasTransaction.toJSON();

expect(json.transaction.type).to.be.equal(TransactionType.ADDRESS_ALIAS);
expect(json.transaction.aliasAction).to.be.equal(AliasActionType.Link);
expect(json.transaction.action).to.be.equal(AliasActionType.Link);
});

it('should create MosaicAliasTransaction', () => {
Expand All @@ -165,7 +165,7 @@ describe('SerializeTransactionToJSON', () => {
const json = mosaicAliasTransaction.toJSON();

expect(json.transaction.type).to.be.equal(TransactionType.MOSAIC_ALIAS);
expect(json.transaction.aliasAction).to.be.equal(AliasActionType.Link);
expect(json.transaction.action).to.be.equal(AliasActionType.Link);

});

Expand Down

0 comments on commit c724c95

Please sign in to comment.