@@ -31,6 +31,7 @@ import { Mosaic } from '../../src/model/mosaic/Mosaic';
3131import { MosaicId } from '../../src/model/mosaic/MosaicId' ;
3232import { MosaicNonce } from '../../src/model/mosaic/MosaicNonce' ;
3333import { MosaicProperties } from '../../src/model/mosaic/MosaicProperties' ;
34+ import { MosaicRestrictionType } from '../../src/model/mosaic/MosaicRestrictionType' ;
3435import { MosaicSupplyType } from '../../src/model/mosaic/MosaicSupplyType' ;
3536import { NetworkCurrencyMosaic } from '../../src/model/mosaic/NetworkCurrencyMosaic' ;
3637import { AliasActionType } from '../../src/model/namespace/AliasActionType' ;
@@ -49,13 +50,16 @@ import { HashLockTransaction } from '../../src/model/transaction/HashLockTransac
4950import { HashType } from '../../src/model/transaction/HashType' ;
5051import { LinkAction } from '../../src/model/transaction/LinkAction' ;
5152import { LockFundsTransaction } from '../../src/model/transaction/LockFundsTransaction' ;
53+ import { MosaicAddressRestrictionTransaction } from '../../src/model/transaction/MosaicAddressRestrictionTransaction' ;
5254import { MosaicAliasTransaction } from '../../src/model/transaction/MosaicAliasTransaction' ;
5355import { MosaicDefinitionTransaction } from '../../src/model/transaction/MosaicDefinitionTransaction' ;
56+ import { MosaicGlobalRestrictionTransaction } from '../../src/model/transaction/MosaicGlobalRestrictionTransaction' ;
5457import { MosaicSupplyChangeTransaction } from '../../src/model/transaction/MosaicSupplyChangeTransaction' ;
5558import { PlainMessage } from '../../src/model/transaction/PlainMessage' ;
5659import { RegisterNamespaceTransaction } from '../../src/model/transaction/RegisterNamespaceTransaction' ;
5760import { SecretLockTransaction } from '../../src/model/transaction/SecretLockTransaction' ;
5861import { SecretProofTransaction } from '../../src/model/transaction/SecretProofTransaction' ;
62+ import { SignedTransaction } from '../../src/model/transaction/SignedTransaction' ;
5963import { Transaction } from '../../src/model/transaction/Transaction' ;
6064import { TransactionType } from '../../src/model/transaction/TransactionType' ;
6165import { TransferTransaction } from '../../src/model/transaction/TransferTransaction' ;
@@ -117,6 +121,7 @@ describe('TransactionHttp', () => {
117121 } ) ;
118122 } ) ;
119123 } ) ;
124+
120125 describe ( 'MosaicDefinitionTransaction' , ( ) => {
121126 let listener : Listener ;
122127 before ( ( ) => {
@@ -137,6 +142,7 @@ describe('TransactionHttp', () => {
137142 supplyMutable : true ,
138143 transferable : true ,
139144 divisibility : 3 ,
145+ restrictable : true ,
140146 duration : UInt64 . fromUint ( 1000 ) ,
141147 } ) ,
142148 NetworkType . MIJIN_TEST ,
@@ -159,6 +165,7 @@ describe('TransactionHttp', () => {
159165 transactionHttp . announce ( signedTransaction ) ;
160166 } ) ;
161167 } ) ;
168+
162169 describe ( 'MosaicDefinitionTransaction' , ( ) => {
163170 let listener : Listener ;
164171 before ( ( ) => {
@@ -178,6 +185,7 @@ describe('TransactionHttp', () => {
178185 supplyMutable : true ,
179186 transferable : true ,
180187 divisibility : 3 ,
188+ restrictable : true ,
181189 } ) ,
182190 NetworkType . MIJIN_TEST ,
183191 ) ;
@@ -197,6 +205,119 @@ describe('TransactionHttp', () => {
197205 transactionHttp . announce ( signedTransaction ) ;
198206 } ) ;
199207 } ) ;
208+
209+ describe ( 'MosaicGlobalRestrictionTransaction' , ( ) => {
210+ let listener : Listener ;
211+ before ( ( ) => {
212+ listener = new Listener ( config . apiUrl ) ;
213+ return listener . open ( ) ;
214+ } ) ;
215+ after ( ( ) => {
216+ return listener . close ( ) ;
217+ } ) ;
218+
219+ it ( 'standalone' , ( done ) => {
220+ const mosaicGlobalRestrictionTransaction = MosaicGlobalRestrictionTransaction . create (
221+ Deadline . create ( ) ,
222+ mosaicId ,
223+ new MosaicId ( UInt64 . fromUint ( 0 ) . toDTO ( ) ) ,
224+ UInt64 . fromUint ( 4444 ) ,
225+ UInt64 . fromUint ( 0 ) ,
226+ MosaicRestrictionType . NONE ,
227+ UInt64 . fromUint ( 0 ) ,
228+ MosaicRestrictionType . GE ,
229+ NetworkType . MIJIN_TEST ,
230+ ) ;
231+ const signedTransaction = mosaicGlobalRestrictionTransaction . signWith ( account , generationHash ) ;
232+
233+ listener . confirmed ( account . address ) . subscribe ( ( transaction : MosaicAliasTransaction ) => {
234+ done ( ) ;
235+ } ) ;
236+ listener . status ( account . address ) . subscribe ( ( error ) => {
237+ console . log ( 'Error:' , error ) ;
238+ assert ( false ) ;
239+ done ( ) ;
240+ } ) ;
241+ transactionHttp . announce ( signedTransaction ) ;
242+ } ) ;
243+ } ) ;
244+ describe ( 'MosaicGlobalRestrictionTransaction' , ( ) => {
245+ let listener : Listener ;
246+ before ( ( ) => {
247+ listener = new Listener ( config . apiUrl ) ;
248+ return listener . open ( ) ;
249+ } ) ;
250+ after ( ( ) => {
251+ return listener . close ( ) ;
252+ } ) ;
253+ it ( 'aggregate' , ( done ) => {
254+ const mosaicGlobalRestrictionTransaction = MosaicGlobalRestrictionTransaction . create (
255+ Deadline . create ( ) ,
256+ mosaicId ,
257+ new MosaicId ( UInt64 . fromUint ( 0 ) . toDTO ( ) ) ,
258+ UInt64 . fromUint ( 9999 ) ,
259+ UInt64 . fromUint ( 10 ) ,
260+ MosaicRestrictionType . GE ,
261+ UInt64 . fromUint ( 1 ) ,
262+ MosaicRestrictionType . GE ,
263+ NetworkType . MIJIN_TEST ,
264+ ) ;
265+ const aggregateTransaction = AggregateTransaction . createComplete ( Deadline . create ( ) ,
266+ [ mosaicGlobalRestrictionTransaction . toAggregate ( account . publicAccount ) ] ,
267+ NetworkType . MIJIN_TEST ,
268+ [ ] ,
269+ ) ;
270+ const signedTransaction = aggregateTransaction . signWith ( account , generationHash ) ;
271+ listener . confirmed ( account . address ) . subscribe ( ( transaction : Transaction ) => {
272+ done ( ) ;
273+ } ) ;
274+ listener . status ( account . address ) . subscribe ( ( error ) => {
275+ console . log ( 'Error:' , error ) ;
276+ assert ( false ) ;
277+ done ( ) ;
278+ } ) ;
279+ transactionHttp . announce ( signedTransaction ) ;
280+ } ) ;
281+ } ) ;
282+
283+ describe ( 'MosaicAddressRestrictionTransaction' , ( ) => {
284+ let listener : Listener ;
285+ before ( ( ) => {
286+ listener = new Listener ( config . apiUrl ) ;
287+ return listener . open ( ) ;
288+ } ) ;
289+ after ( ( ) => {
290+ return listener . close ( ) ;
291+ } ) ;
292+ it ( 'aggregate' , ( done ) => {
293+ const mosaicAddressRestrictionTransaction = MosaicAddressRestrictionTransaction . create (
294+ Deadline . create ( ) ,
295+ mosaicId ,
296+ UInt64 . fromUint ( 4444 ) ,
297+ account3 . address ,
298+ UInt64 . fromHex ( 'FFFFFFFFFFFFFFFF' ) ,
299+ UInt64 . fromUint ( 2 ) ,
300+ NetworkType . MIJIN_TEST ,
301+ ) ;
302+ const aggregateTransaction = AggregateTransaction . createComplete ( Deadline . create ( ) ,
303+ [ mosaicAddressRestrictionTransaction . toAggregate ( account . publicAccount ) ] ,
304+ NetworkType . MIJIN_TEST ,
305+ [ ] ,
306+ ) ;
307+ const signedTransaction = aggregateTransaction . signWith ( account , generationHash ) ;
308+ listener . confirmed ( account . address ) . subscribe ( ( transaction : Transaction ) => {
309+ done ( ) ;
310+ } ) ;
311+ console . log ( SignedTransaction ) ;
312+ listener . status ( account . address ) . subscribe ( ( error ) => {
313+ console . log ( 'Error:' , error ) ;
314+ assert ( false ) ;
315+ done ( ) ;
316+ } ) ;
317+ transactionHttp . announce ( signedTransaction ) ;
318+ } ) ;
319+ } ) ;
320+
200321 describe ( 'TransferTransaction' , ( ) => {
201322 let listener : Listener ;
202323 before ( ( ) => {
0 commit comments