@@ -18,16 +18,17 @@ import {deepEqual} from 'assert';
1818import { assert , expect } from 'chai' ;
1919import { AccountHttp } from '../../src/infrastructure/AccountHttp' ;
2020import { Listener , TransactionHttp } from '../../src/infrastructure/infrastructure' ;
21+ import { RestrictionHttp } from '../../src/infrastructure/RestrictionHttp' ;
2122import { Account } from '../../src/model/account/Account' ;
22- import { AccountRestrictionModificationAction } from '../../src/model/account/AccountRestrictionModificationAction' ;
23- import { AccountRestrictionType } from '../../src/model/account/AccountRestrictionType' ;
2423import { Address } from '../../src/model/account/Address' ;
2524import { PublicAccount } from '../../src/model/account/PublicAccount' ;
2625import { NetworkType } from '../../src/model/blockchain/NetworkType' ;
2726import { PlainMessage } from '../../src/model/message/PlainMessage' ;
2827import { NetworkCurrencyMosaic } from '../../src/model/mosaic/NetworkCurrencyMosaic' ;
2928import { AliasAction } from '../../src/model/namespace/AliasAction' ;
3029import { NamespaceId } from '../../src/model/namespace/NamespaceId' ;
30+ import { AccountRestrictionModificationAction } from '../../src/model/restriction/AccountRestrictionModificationAction' ;
31+ import { AccountRestrictionType } from '../../src/model/restriction/AccountRestrictionType' ;
3132import { AccountRestrictionModification } from '../../src/model/transaction/AccountRestrictionModification' ;
3233import { AccountRestrictionTransaction } from '../../src/model/transaction/AccountRestrictionTransaction' ;
3334import { AddressAliasTransaction } from '../../src/model/transaction/AddressAliasTransaction' ;
@@ -52,6 +53,7 @@ describe('AccountHttp', () => {
5253 let accountPublicKey : string ;
5354 let publicAccount : PublicAccount ;
5455 let accountHttp : AccountHttp ;
56+ let restrictionHttp : RestrictionHttp ;
5557 let transactionHttp : TransactionHttp ;
5658 let namespaceId : NamespaceId ;
5759 let generationHash : string ;
@@ -78,6 +80,7 @@ describe('AccountHttp', () => {
7880 generationHash = json . generationHash ;
7981 accountHttp = new AccountHttp ( json . apiUrl ) ;
8082 transactionHttp = new TransactionHttp ( json . apiUrl ) ;
83+ restrictionHttp = new RestrictionHttp ( json . apiUrl ) ;
8184 done ( ) ;
8285 } ) ;
8386 } ) ;
@@ -183,39 +186,6 @@ describe('AccountHttp', () => {
183186 } ) ;
184187 } ) ;
185188
186- describe ( 'Setup Test AccountAddressRestriction' , ( ) => {
187- let listener : Listener ;
188- before ( ( ) => {
189- listener = new Listener ( config . apiUrl ) ;
190- return listener . open ( ) ;
191- } ) ;
192- after ( ( ) => {
193- return listener . close ( ) ;
194- } ) ;
195-
196- it ( 'Announce AccountRestrictionTransaction' , ( done ) => {
197- const addressPropertyFilter = AccountRestrictionModification . createForAddress (
198- AccountRestrictionModificationAction . Add ,
199- account3 . address ,
200- ) ;
201- const addressModification = AccountRestrictionTransaction . createAddressRestrictionModificationTransaction (
202- Deadline . create ( ) ,
203- AccountRestrictionType . AllowIncomingAddress ,
204- [ addressPropertyFilter ] ,
205- NetworkType . MIJIN_TEST ,
206- ) ;
207- const signedTransaction = addressModification . signWith ( account , generationHash ) ;
208- listener . confirmed ( account . address ) . subscribe ( ( ) => {
209- done ( ) ;
210- } ) ;
211- listener . status ( account . address ) . subscribe ( ( error ) => {
212- console . log ( 'Error:' , error ) ;
213- assert ( false ) ;
214- done ( ) ;
215- } ) ;
216- transactionHttp . announce ( signedTransaction ) ;
217- } ) ;
218- } ) ;
219189 describe ( 'Setup test multisig account' , ( ) => {
220190 let listener : Listener ;
221191 before ( ( ) => {
@@ -281,28 +251,6 @@ describe('AccountHttp', () => {
281251 } ) ;
282252 } ) ;
283253
284- describe ( 'getAccountRestrictions' , ( ) => {
285- it ( 'should call getAccountRestrictions successfully' , ( done ) => {
286- setTimeout ( ( ) => {
287- accountHttp . getAccountRestrictions ( accountAddress ) . subscribe ( ( accountRestrictions ) => {
288- deepEqual ( accountRestrictions . accountRestrictions . address , accountAddress ) ;
289- done ( ) ;
290- } ) ;
291- } , 1000 ) ;
292- } ) ;
293- } ) ;
294-
295- describe ( 'getAccountRestrictionsFromAccounts' , ( ) => {
296- it ( 'should call getAccountRestrictionsFromAccounts successfully' , ( done ) => {
297- setTimeout ( ( ) => {
298- accountHttp . getAccountRestrictionsFromAccounts ( [ accountAddress ] ) . subscribe ( ( accountRestrictions ) => {
299- deepEqual ( accountRestrictions [ 0 ] ! . accountRestrictions . address , accountAddress ) ;
300- done ( ) ;
301- } ) ;
302- } , 1000 ) ;
303- } ) ;
304- } ) ;
305-
306254 describe ( 'getMultisigAccountGraphInfo' , ( ) => {
307255 it ( 'should call getMultisigAccountGraphInfo successfully' , ( done ) => {
308256 setTimeout ( ( ) => {
@@ -408,39 +356,6 @@ describe('AccountHttp', () => {
408356 transactionHttp . announce ( signedTransaction ) ;
409357 } ) ;
410358 } ) ;
411- describe ( 'Remove test AccountRestriction - Address' , ( ) => {
412- let listener : Listener ;
413- before ( ( ) => {
414- listener = new Listener ( config . apiUrl ) ;
415- return listener . open ( ) ;
416- } ) ;
417- after ( ( ) => {
418- return listener . close ( ) ;
419- } ) ;
420-
421- it ( 'Announce AccountRestrictionTransaction' , ( done ) => {
422- const addressPropertyFilter = AccountRestrictionModification . createForAddress (
423- AccountRestrictionModificationAction . Remove ,
424- account3 . address ,
425- ) ;
426- const addressModification = AccountRestrictionTransaction . createAddressRestrictionModificationTransaction (
427- Deadline . create ( ) ,
428- AccountRestrictionType . AllowIncomingAddress ,
429- [ addressPropertyFilter ] ,
430- NetworkType . MIJIN_TEST ,
431- ) ;
432- const signedTransaction = addressModification . signWith ( account , generationHash ) ;
433- listener . confirmed ( account . address ) . subscribe ( ( ) => {
434- done ( ) ;
435- } ) ;
436- listener . status ( account . address ) . subscribe ( ( error ) => {
437- console . log ( 'Error:' , error ) ;
438- assert ( false ) ;
439- done ( ) ;
440- } ) ;
441- transactionHttp . announce ( signedTransaction ) ;
442- } ) ;
443- } ) ;
444359
445360 describe ( 'Restore test multisig Accounts' , ( ) => {
446361 let listener : Listener ;
0 commit comments