Skip to content

Commit 8f44ef3

Browse files
committed
CreateTransactionFromDTO takes care when message is null
1 parent 33d1dc6 commit 8f44ef3

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

e2e/infrastructure/transaction/CreateTransactionFromDTO.spec.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,53 @@ describe('CreateTransactionFromDTO', () => {
7171
ValidateTransaction.validateStandaloneTx(transferTransaction, transferTransactionDTO);
7272
});
7373

74+
it('standalone without message', () => {
75+
const transferTransactionDTO = {
76+
meta: {
77+
hash: '18C036C20B32348D63684E09A13128A2C18F6A75650D3A5FB43853D716E5E219',
78+
height: [
79+
1,
80+
0,
81+
],
82+
id: '59FDA0733F17CF0001772CA7',
83+
index: 19,
84+
merkleComponentHash: '18C036C20B32348D63684E09A13128A2C18F6A75650D3A5FB43853D716E5E219',
85+
},
86+
transaction: {
87+
deadline: [
88+
10000,
89+
0,
90+
],
91+
fee: [
92+
0,
93+
0,
94+
],
95+
mosaics: [
96+
{
97+
amount: [
98+
3863990592,
99+
95248,
100+
],
101+
id: [
102+
3646934825,
103+
3576016193,
104+
],
105+
},
106+
],
107+
recipient: '9050B9837EFAB4BBE8A4B9BB32D812F9885C00D8FC1650E142',
108+
signature: '553E696EB4A54E43A11D180EBA57E4B89D0048C9DD2604A9E0608120018B9E0' +
109+
'2F6EE63025FEEBCED3293B622AF8581334D0BDAB7541A9E7411E7EE4EF0BC5D0E',
110+
signer: 'B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF',
111+
type: 16724,
112+
version: 36867,
113+
},
114+
};
115+
116+
const transferTransaction = CreateTransactionFromDTO(transferTransactionDTO);
117+
118+
ValidateTransaction.validateStandaloneTx(transferTransaction, transferTransactionDTO);
119+
});
120+
74121
it('aggregate', () => {
75122
const aggregateTransferTransactionDTO = {
76123
meta: {

src/infrastructure/transaction/CreateTransactionFromDTO.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ const CreateStandaloneTransactionFromDTO = (transactionDTO, transactionInfo): Tr
125125
UInt64.fromUint(transactionDTO.maxFee || 0),
126126
extractRecipient(transactionDTO.recipient),
127127
extractMosaics(transactionDTO.mosaics),
128-
extractMessage(transactionDTO.message.payload),
128+
extractMessage(transactionDTO.message !== undefined ? transactionDTO.message.payload : undefined),
129129
transactionDTO.signature,
130130
transactionDTO.signer ? PublicAccount.createFromPublicKey(transactionDTO.signer,
131131
extractNetworkType(transactionDTO.version)) : undefined,

0 commit comments

Comments
 (0)