@@ -66,6 +66,7 @@ import { TransactionType } from '../../../src/model/transaction/TransactionType'
6666import { TransferTransaction } from '../../../src/model/transaction/TransferTransaction' ;
6767import { UInt64 } from '../../../src/model/UInt64' ;
6868import { TestingAccount } from '../../conf/conf.spec' ;
69+ import { Mosaic } from '../../../src/model/model' ;
6970
7071describe ( 'TransactionMapping - createFromPayload' , ( ) => {
7172 let account : Account ;
@@ -361,7 +362,7 @@ describe('TransactionMapping - createFromPayload', () => {
361362 expect ( transaction . duration . equals ( UInt64 . fromUint ( 100 ) ) ) . to . be . equal ( true ) ;
362363 expect ( transaction . hashType ) . to . be . equal ( 0 ) ;
363364 expect ( transaction . secret ) . to . be . equal ( '9B3155B37159DA50AA52D5967C509B410F5A36A3B1E31ECB5AC76675D79B4A5E' ) ;
364- expect ( transaction . recipientAddress . plain ( ) ) . to . be . equal ( recipientAddress . plain ( ) ) ;
365+ expect ( ( transaction . recipientAddress as Address ) . plain ( ) ) . to . be . equal ( recipientAddress . plain ( ) ) ;
365366
366367 } ) ;
367368
@@ -382,7 +383,7 @@ describe('TransactionMapping - createFromPayload', () => {
382383 expect ( secretProofTransaction . hashType ) . to . be . equal ( 0 ) ;
383384 expect ( secretProofTransaction . secret ) . to . be . equal ( '9b3155b37159da50aa52d5967c509b410f5a36a3b1e31ecb5ac76675d79b4a5e' ) ;
384385 expect ( secretProofTransaction . proof ) . to . be . equal ( proof ) ;
385- expect ( secretProofTransaction . recipientAddress . plain ( ) ) . to . be . equal ( account . address . plain ( ) ) ;
386+ expect ( ( secretProofTransaction . recipientAddress as Address ) . plain ( ) ) . to . be . equal ( account . address . plain ( ) ) ;
386387
387388 } ) ;
388389
@@ -902,6 +903,51 @@ describe('TransactionMapping - createFromDTO (Transaction.toJSON() feed)', () =>
902903
903904 } ) ;
904905
906+ it ( 'should create SecretLockTransaction - Address alias' , ( ) => {
907+ const proof = 'B778A39A3663719DFC5E48C9D78431B1E45C2AF9DF538782BF199C189DABEAC7' ;
908+ const recipientAddress = new NamespaceId ( 'test' ) ;
909+ const secretLockTransaction = SecretLockTransaction . create (
910+ Deadline . create ( ) ,
911+ NetworkCurrencyMosaic . createAbsolute ( 10 ) ,
912+ UInt64 . fromUint ( 100 ) ,
913+ HashType . Op_Sha3_256 ,
914+ sha3_256 . create ( ) . update ( Convert . hexToUint8 ( proof ) ) . hex ( ) ,
915+ recipientAddress ,
916+ NetworkType . MIJIN_TEST ,
917+ ) ;
918+
919+ const transaction =
920+ TransactionMapping . createFromDTO ( secretLockTransaction . toJSON ( ) ) as SecretLockTransaction ;
921+
922+ expect ( transaction . type ) . to . be . equal ( TransactionType . SECRET_LOCK ) ;
923+ expect ( transaction . hashType ) . to . be . equal ( HashType . Op_Sha3_256 ) ;
924+ expect ( ( transaction . recipientAddress as NamespaceId ) . id . toHex ( ) ) . to . be . equal ( recipientAddress . toHex ( ) ) ;
925+
926+ } ) ;
927+
928+ it ( 'should create SecretLockTransaction - resolved Mosaic' , ( ) => {
929+ const proof = 'B778A39A3663719DFC5E48C9D78431B1E45C2AF9DF538782BF199C189DABEAC7' ;
930+ const recipientAddress = Address . createFromRawAddress ( 'SDBDG4IT43MPCW2W4CBBCSJJT42AYALQN7A4VVWL' ) ;
931+ const mosaicId = new NamespaceId ( 'test' ) ;
932+ const secretLockTransaction = SecretLockTransaction . create (
933+ Deadline . create ( ) ,
934+ new Mosaic ( new MosaicId ( [ 1 , 1 ] ) , UInt64 . fromUint ( 10 ) ) ,
935+ UInt64 . fromUint ( 100 ) ,
936+ HashType . Op_Sha3_256 ,
937+ sha3_256 . create ( ) . update ( Convert . hexToUint8 ( proof ) ) . hex ( ) ,
938+ recipientAddress ,
939+ NetworkType . MIJIN_TEST ,
940+ ) ;
941+
942+ const transaction =
943+ TransactionMapping . createFromDTO ( secretLockTransaction . toJSON ( ) ) as SecretLockTransaction ;
944+
945+ expect ( transaction . type ) . to . be . equal ( TransactionType . SECRET_LOCK ) ;
946+ expect ( transaction . hashType ) . to . be . equal ( HashType . Op_Sha3_256 ) ;
947+ expect ( transaction . mosaic . id . toHex ( ) ) . to . be . equal ( ( new MosaicId ( [ 1 , 1 ] ) ) . toHex ( ) ) ;
948+
949+ } ) ;
950+
905951 it ( 'should create SecretProofTransaction' , ( ) => {
906952 const proof = 'B778A39A3663719DFC5E48C9D78431B1E45C2AF9DF538782BF199C189DABEAC7' ;
907953 const secretProofTransaction = SecretProofTransaction . create (
@@ -924,6 +970,29 @@ describe('TransactionMapping - createFromDTO (Transaction.toJSON() feed)', () =>
924970
925971 } ) ;
926972
973+ it ( 'should create SecretProofTransaction - Address alias' , ( ) => {
974+ const proof = 'B778A39A3663719DFC5E48C9D78431B1E45C2AF9DF538782BF199C189DABEAC7' ;
975+ const recipientAddress = new NamespaceId ( 'test' ) ;
976+ const secretProofTransaction = SecretProofTransaction . create (
977+ Deadline . create ( ) ,
978+ HashType . Op_Sha3_256 ,
979+ sha3_256 . create ( ) . update ( Convert . hexToUint8 ( proof ) ) . hex ( ) ,
980+ recipientAddress ,
981+ proof ,
982+ NetworkType . MIJIN_TEST ,
983+ ) ;
984+
985+ const transaction =
986+ TransactionMapping . createFromDTO ( secretProofTransaction . toJSON ( ) ) as SecretProofTransaction ;
987+
988+ expect ( transaction . type ) . to . be . equal ( TransactionType . SECRET_PROOF ) ;
989+ expect ( transaction . hashType ) . to . be . equal ( HashType . Op_Sha3_256 ) ;
990+ expect ( transaction . secret ) . to . be . equal ( sha3_256 . create ( ) . update ( Convert . hexToUint8 ( proof ) ) . hex ( ) ) ;
991+ expect ( transaction . proof ) . to . be . equal ( proof ) ;
992+ expect ( ( transaction . recipientAddress as NamespaceId ) . id . toHex ( ) ) . to . be . equal ( recipientAddress . toHex ( ) ) ;
993+
994+ } ) ;
995+
927996 it ( 'should create ModifyMultiSigTransaction' , ( ) => {
928997 const modifyMultisigAccountTransaction = MultisigAccountModificationTransaction . create (
929998 Deadline . create ( ) ,
0 commit comments