Skip to content

Commit ee1aa81

Browse files
authored
Merge pull request #308 from NEMStudios/task/g307_unresolved_address_bug
JAV-69 Fixed address alias deserialization bug
2 parents 50c816a + eece481 commit ee1aa81

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/core/utils/UnresolvedMapping.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class UnresolvedMapping {
6161
// namespaceId encoded hexadecimal notation provided
6262
// only 8 bytes are relevant to resolve the NamespaceId
6363
const relevantPart = address.substr(2, 16);
64-
return NamespaceId.createFromEncoded(relevantPart);
64+
return NamespaceId.createFromEncoded(Convert.uint8ToHex(Convert.hexToUint8Reverse(relevantPart)));
6565
}
6666

6767
// read address from encoded hexadecimal notation

test/model/transaction/TransferTransaction.spec.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,4 +359,23 @@ describe('TransferTransaction', () => {
359359
expect(sorted.mosaics[2].id.toHex()).to.be.equal('D525AD41D95FCF29');
360360

361361
});
362+
363+
it('Test Serialization and Deserialization Using namespaceIds', () => {
364+
const namespaceId = new NamespaceId('testaccount2');
365+
366+
const transferTransaction = TransferTransaction.create(
367+
Deadline.createFromDTO('1'),
368+
namespaceId,
369+
[NetworkCurrencyMosaic.createAbsolute(1)],
370+
PlainMessage.create('test-message'),
371+
NetworkType.MIJIN_TEST,
372+
);
373+
374+
const payload = transferTransaction.serialize();
375+
const newTransaction = CreateTransactionFromPayload(payload) as TransferTransaction;
376+
const newPayload = newTransaction.serialize();
377+
378+
expect(newPayload).to.be.equal(payload);
379+
expect(newTransaction.recipientToString()).to.be.equal(transferTransaction.recipientToString());
380+
});
362381
});

0 commit comments

Comments
 (0)