Skip to content

Commit cf5fcba

Browse files
author
Baha
committed
fix: metadata value ser/deser is fixed
1 parent aef6b6e commit cf5fcba

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/infrastructure/transaction/CreateTransactionFromDTO.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
import { Convert } from '../..';
1617
import { UnresolvedMapping } from '../../core/utils';
1718
import { MessageFactory, MosaicSupplyRevocationTransaction, UInt64 } from '../../model';
1819
import { Address, PublicAccount } from '../../model/account';
@@ -392,7 +393,7 @@ const CreateStandaloneTransactionFromDTO = (transactionDTO, transactionInfo): Tr
392393
extractRecipient(transactionDTO.targetAddress),
393394
UInt64.fromHex(transactionDTO.scopedMetadataKey),
394395
transactionDTO.valueSizeDelta,
395-
transactionDTO.value,
396+
Convert.hexToUint8(transactionDTO.value),
396397
signature,
397398
signer,
398399
transactionInfo,
@@ -407,7 +408,7 @@ const CreateStandaloneTransactionFromDTO = (transactionDTO, transactionInfo): Tr
407408
UInt64.fromHex(transactionDTO.scopedMetadataKey),
408409
UnresolvedMapping.toUnresolvedMosaic(transactionDTO.targetMosaicId),
409410
transactionDTO.valueSizeDelta,
410-
transactionDTO.value,
411+
Convert.hexToUint8(transactionDTO.value),
411412
signature,
412413
signer,
413414
transactionInfo,
@@ -422,7 +423,7 @@ const CreateStandaloneTransactionFromDTO = (transactionDTO, transactionInfo): Tr
422423
UInt64.fromHex(transactionDTO.scopedMetadataKey),
423424
NamespaceId.createFromEncoded(transactionDTO.targetNamespaceId),
424425
transactionDTO.valueSizeDelta,
425-
transactionDTO.value,
426+
Convert.hexToUint8(transactionDTO.value),
426427
signature,
427428
signer,
428429
transactionInfo,

src/infrastructure/transaction/SerializeTransactionToJSON.ts

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

17+
import { Convert } from '../..';
1718
import {
1819
AccountAddressRestrictionTransaction,
1920
AccountKeyLinkTransaction,
@@ -245,7 +246,7 @@ export const SerializeTransactionToJSON = (transaction: Transaction): any => {
245246
scopedMetadataKey: accountMetadataTx.scopedMetadataKey.toHex(),
246247
valueSizeDelta: accountMetadataTx.valueSizeDelta,
247248
valueSize: accountMetadataTx.value.length,
248-
value: accountMetadataTx.value,
249+
value: Convert.uint8ToHex(accountMetadataTx.value),
249250
};
250251
} else if (transaction.type === TransactionType.MOSAIC_METADATA) {
251252
const mosaicMetadataTx = transaction as MosaicMetadataTransaction;
@@ -255,7 +256,7 @@ export const SerializeTransactionToJSON = (transaction: Transaction): any => {
255256
valueSizeDelta: mosaicMetadataTx.valueSizeDelta,
256257
targetMosaicId: mosaicMetadataTx.targetMosaicId.id.toHex(),
257258
valueSize: mosaicMetadataTx.value.length,
258-
value: mosaicMetadataTx.value,
259+
value: Convert.uint8ToHex(mosaicMetadataTx.value),
259260
};
260261
} else if (transaction.type === TransactionType.NAMESPACE_METADATA) {
261262
const namespaceMetaTx = transaction as NamespaceMetadataTransaction;
@@ -265,7 +266,7 @@ export const SerializeTransactionToJSON = (transaction: Transaction): any => {
265266
valueSizeDelta: namespaceMetaTx.valueSizeDelta,
266267
targetNamespaceId: namespaceMetaTx.targetNamespaceId.id.toHex(),
267268
valueSize: namespaceMetaTx.value.length,
268-
value: namespaceMetaTx.value,
269+
value: Convert.uint8ToHex(namespaceMetaTx.value),
269270
};
270271
} else if (transaction.type === TransactionType.VRF_KEY_LINK) {
271272
const vrfKeyLinkTx = transaction as VrfKeyLinkTransaction;

0 commit comments

Comments
 (0)