@@ -44,6 +44,7 @@ import {AggregateTransaction} from '../../src/model/transaction/AggregateTransac
4444import { CosignatureSignedTransaction } from '../../src/model/transaction/CosignatureSignedTransaction' ;
4545import { CosignatureTransaction } from '../../src/model/transaction/CosignatureTransaction' ;
4646import { Deadline } from '../../src/model/transaction/Deadline' ;
47+ import { HashLockTransaction } from '../../src/model/transaction/HashLockTransaction' ;
4748import { HashType } from '../../src/model/transaction/HashType' ;
4849import { LinkAction } from '../../src/model/transaction/LinkAction' ;
4950import { LockFundsTransaction } from '../../src/model/transaction/LockFundsTransaction' ;
@@ -485,7 +486,7 @@ describe('TransactionHttp', () => {
485486 const accountLinkTransaction = AccountLinkTransaction . create (
486487 Deadline . create ( ) ,
487488 harvestingAccount . publicKey ,
488- LinkAction . Unlink ,
489+ LinkAction . Link ,
489490 NetworkType . MIJIN_TEST ,
490491 ) ;
491492 const signedTransaction = accountLinkTransaction . signWith ( account , generationHash ) ;
@@ -757,7 +758,7 @@ describe('TransactionHttp', () => {
757758 } ) ;
758759 } ) ;
759760
760- describe ( 'SecretLockTransaction - MosaicAlias' , ( ) => {
761+ describe ( 'HashLockTransaction - MosaicAlias' , ( ) => {
761762 let listener : Listener ;
762763 before ( ( ) => {
763764 listener = new Listener ( config . apiUrl ) ;
@@ -767,15 +768,19 @@ describe('TransactionHttp', () => {
767768 return listener . close ( ) ;
768769 } ) ;
769770 it ( 'standalone' , ( done ) => {
770- const secretLockTransaction = SecretLockTransaction . create (
771+ const aggregateTransaction = AggregateTransaction . createBonded (
771772 Deadline . create ( ) ,
772- new Mosaic ( namespaceId , UInt64 . fromUint ( 10 * Math . pow ( 10 , NetworkCurrencyMosaic . DIVISIBILITY ) ) ) ,
773- UInt64 . fromUint ( 100 ) ,
774- HashType . Op_Sha3_256 ,
775- sha3_256 . create ( ) . update ( nacl_catapult . randomBytes ( 20 ) ) . hex ( ) ,
776- account2 . address ,
773+ [ ] ,
777774 NetworkType . MIJIN_TEST ,
775+ [ ] ,
778776 ) ;
777+ const signedTransaction = account . sign ( aggregateTransaction , generationHash ) ;
778+ const hashLockTransaction = HashLockTransaction . create ( Deadline . create ( ) ,
779+ new Mosaic ( new NamespaceId ( 'cat.currency' ) , UInt64 . fromUint ( 10 * Math . pow ( 10 , NetworkCurrencyMosaic . DIVISIBILITY ) ) ) ,
780+ UInt64 . fromUint ( 10000 ) ,
781+ signedTransaction ,
782+ NetworkType . MIJIN_TEST ) ;
783+
779784 listener . confirmed ( account . address ) . subscribe ( ( transaction : Transaction ) => {
780785 done ( ) ;
781786 } ) ;
@@ -784,7 +789,7 @@ describe('TransactionHttp', () => {
784789 assert ( false ) ;
785790 done ( ) ;
786791 } ) ;
787- transactionHttp . announce ( secretLockTransaction . signWith ( account , generationHash ) ) ;
792+ transactionHttp . announce ( hashLockTransaction . signWith ( account , generationHash ) ) ;
788793 } ) ;
789794 } ) ;
790795
@@ -905,8 +910,6 @@ describe('TransactionHttp', () => {
905910 return listener . close ( ) ;
906911 } ) ;
907912 it ( 'should announce aggregated complete transaction' , ( done ) => {
908- const signerAccount = account ;
909-
910913 const tx = TransferTransaction . create (
911914 Deadline . create ( ) ,
912915 account2 . address ,
@@ -917,12 +920,12 @@ describe('TransactionHttp', () => {
917920 const aggTx = AggregateTransaction . createComplete (
918921 Deadline . create ( ) ,
919922 [
920- tx . toAggregate ( signerAccount . publicAccount ) ,
923+ tx . toAggregate ( account . publicAccount ) ,
921924 ] ,
922925 NetworkType . MIJIN_TEST ,
923926 [ ] ,
924927 ) ;
925- const signedTx = signerAccount . sign ( aggTx , generationHash ) ;
928+ const signedTx = account . sign ( aggTx , generationHash ) ;
926929 listener . confirmed ( account . address ) . subscribe ( ( transaction : Transaction ) => {
927930 done ( ) ;
928931 } ) ;
@@ -1220,6 +1223,9 @@ describe('TransactionHttp', () => {
12201223 NetworkType . MIJIN_TEST ,
12211224 ) ;
12221225 listener . confirmed ( account . address ) . subscribe ( ( transaction : Transaction ) => {
1226+ listener . confirmed ( account2 . address ) . subscribe ( ( transaction : Transaction ) => {
1227+ done ( ) ;
1228+ } ) ;
12231229 const secretProofTransaction = SecretProofTransaction . create (
12241230 Deadline . create ( ) ,
12251231 HashType . Op_Sha3_256 ,
@@ -1231,9 +1237,6 @@ describe('TransactionHttp', () => {
12311237 const signedTx = secretProofTransaction . signWith ( account2 , generationHash ) ;
12321238 transactionHttp . announce ( signedTx ) ;
12331239 } ) ;
1234- listener . confirmed ( account2 . address ) . subscribe ( ( transaction : Transaction ) => {
1235- done ( ) ;
1236- } ) ;
12371240 listener . status ( account2 . address ) . subscribe ( ( error ) => {
12381241 console . log ( 'Error:' , error ) ;
12391242 assert ( false ) ;
@@ -1281,7 +1284,7 @@ describe('TransactionHttp', () => {
12811284 [ secretProofTransaction . toAggregate ( account2 . publicAccount ) ] ,
12821285 NetworkType . MIJIN_TEST ,
12831286 [ ] ) ;
1284- transactionHttp . announce ( aggregateSecretProofTransaction . signWith ( account2 , generationHash ) ) ;
1287+ transactionHttp . announce ( aggregateSecretProofTransaction . signWith ( account2 , generationHash ) ) ;
12851288 } ) ;
12861289 listener . status ( account . address ) . subscribe ( ( error ) => {
12871290 console . log ( 'Error:' , error ) ;
@@ -1373,7 +1376,7 @@ describe('TransactionHttp', () => {
13731376 [ secretProofTransaction . toAggregate ( account2 . publicAccount ) ] ,
13741377 NetworkType . MIJIN_TEST ,
13751378 [ ] ) ;
1376- transactionHttp . announce ( aggregateSecretProofTransaction . signWith ( account2 , generationHash ) ) ;
1379+ transactionHttp . announce ( aggregateSecretProofTransaction . signWith ( account2 , generationHash ) ) ;
13771380 } ) ;
13781381 listener . status ( account . address ) . subscribe ( ( error ) => {
13791382 console . log ( 'Error:' , error ) ;
@@ -1408,6 +1411,14 @@ describe('TransactionHttp', () => {
14081411 NetworkType . MIJIN_TEST ,
14091412 ) ;
14101413 listener . confirmed ( account . address ) . subscribe ( ( transaction : Transaction ) => {
1414+ listener . confirmed ( account2 . address ) . subscribe ( ( transaction : Transaction ) => {
1415+ done ( ) ;
1416+ } ) ;
1417+ listener . status ( account2 . address ) . subscribe ( ( error ) => {
1418+ console . log ( 'Error:' , error ) ;
1419+ assert ( false ) ;
1420+ done ( ) ;
1421+ } ) ;
14111422 const secretProofTransaction = SecretProofTransaction . create (
14121423 Deadline . create ( ) ,
14131424 HashType . Op_Hash_160 ,
@@ -1419,14 +1430,6 @@ describe('TransactionHttp', () => {
14191430 const signedTx = secretProofTransaction . signWith ( account2 , generationHash ) ;
14201431 transactionHttp . announce ( signedTx ) ;
14211432 } ) ;
1422- listener . confirmed ( account2 . address ) . subscribe ( ( transaction : Transaction ) => {
1423- done ( ) ;
1424- } ) ;
1425- listener . status ( account2 . address ) . subscribe ( ( error ) => {
1426- console . log ( 'Error:' , error ) ;
1427- assert ( false ) ;
1428- done ( ) ;
1429- } ) ;
14301433 listener . status ( account . address ) . subscribe ( ( error ) => {
14311434 console . log ( 'Error:' , error ) ;
14321435 assert ( false ) ;
@@ -1480,7 +1483,7 @@ describe('TransactionHttp', () => {
14801483 [ secretProofTransaction . toAggregate ( account2 . publicAccount ) ] ,
14811484 NetworkType . MIJIN_TEST ,
14821485 [ ] ) ;
1483- transactionHttp . announce ( aggregateSecretProofTransaction . signWith ( account2 , generationHash ) ) ;
1486+ transactionHttp . announce ( aggregateSecretProofTransaction . signWith ( account2 , generationHash ) ) ;
14841487 } ) ;
14851488 listener . status ( account . address ) . subscribe ( ( error ) => {
14861489 console . log ( 'Error:' , error ) ;
@@ -1556,7 +1559,7 @@ describe('TransactionHttp', () => {
15561559 const hash = sha256 ( Buffer . from ( secretSeed , 'hex' ) ) ;
15571560 const secret = sha256 ( Buffer . from ( hash , 'hex' ) ) ;
15581561 const proof = secretSeed ;
1559- let proofAnnounced = false ;
1562+ const proofAnnounced = false ;
15601563 const secretLockTransaction = SecretLockTransaction . create (
15611564 Deadline . create ( ) ,
15621565 NetworkCurrencyMosaic . createAbsolute ( 10 ) ,
@@ -1587,7 +1590,7 @@ describe('TransactionHttp', () => {
15871590 [ secretProofTransaction . toAggregate ( account2 . publicAccount ) ] ,
15881591 NetworkType . MIJIN_TEST ,
15891592 [ ] ) ;
1590- transactionHttp . announce ( aggregateSecretProofTransaction . signWith ( account2 , generationHash ) ) ;
1593+ transactionHttp . announce ( aggregateSecretProofTransaction . signWith ( account2 , generationHash ) ) ;
15911594 } ) ;
15921595 listener . status ( account . address ) . subscribe ( ( error ) => {
15931596 console . log ( 'Error:' , error ) ;
0 commit comments