@@ -54,6 +54,7 @@ describe('RestrictionHttp', () => {
54
54
let restrictionHttp : RestrictionHttp ;
55
55
let transactionHttp : TransactionHttp ;
56
56
let mosaicId : MosaicId ;
57
+ let referenceMosaicId : MosaicId ;
57
58
let generationHash : string ;
58
59
let config ;
59
60
@@ -122,6 +123,40 @@ describe('RestrictionHttp', () => {
122
123
} ) ;
123
124
} ) ;
124
125
126
+ describe ( 'MosaicDefinitionTransaction' , ( ) => {
127
+ let listener : Listener ;
128
+ before ( ( ) => {
129
+ listener = new Listener ( config . apiUrl ) ;
130
+ return listener . open ( ) ;
131
+ } ) ;
132
+ after ( ( ) => {
133
+ return listener . close ( ) ;
134
+ } ) ;
135
+ it ( 'standalone' , ( done ) => {
136
+ const nonce = MosaicNonce . createRandom ( ) ;
137
+ referenceMosaicId = MosaicId . createFromNonce ( nonce , account . publicAccount ) ;
138
+ const mosaicDefinitionTransaction = MosaicDefinitionTransaction . create (
139
+ Deadline . create ( ) ,
140
+ nonce ,
141
+ referenceMosaicId ,
142
+ MosaicFlags . create ( true , true , true ) ,
143
+ 3 ,
144
+ UInt64 . fromUint ( 1000 ) ,
145
+ NetworkType . MIJIN_TEST ,
146
+ ) ;
147
+ const signedTransaction = mosaicDefinitionTransaction . signWith ( account , generationHash ) ;
148
+ listener . confirmed ( account . address ) . subscribe ( ( ) => {
149
+ done ( ) ;
150
+ } ) ;
151
+ listener . status ( account . address ) . subscribe ( ( error ) => {
152
+ console . log ( 'Error:' , error ) ;
153
+ assert ( false ) ;
154
+ done ( ) ;
155
+ } ) ;
156
+ transactionHttp . announce ( signedTransaction ) ;
157
+ } ) ;
158
+ } ) ;
159
+
125
160
describe ( 'Setup Test AccountAddressRestriction' , ( ) => {
126
161
let listener : Listener ;
127
162
before ( ( ) => {
@@ -156,7 +191,42 @@ describe('RestrictionHttp', () => {
156
191
} ) ;
157
192
} ) ;
158
193
159
- describe ( 'MosaicGlobalRestrictionTransaction' , ( ) => {
194
+ describe ( 'MosaicGlobalRestrictionTransaction - Reference' , ( ) => {
195
+ let listener : Listener ;
196
+ before ( ( ) => {
197
+ listener = new Listener ( config . apiUrl ) ;
198
+ return listener . open ( ) ;
199
+ } ) ;
200
+ after ( ( ) => {
201
+ return listener . close ( ) ;
202
+ } ) ;
203
+
204
+ it ( 'standalone' , ( done ) => {
205
+ const mosaicGlobalRestrictionTransaction = MosaicGlobalRestrictionTransaction . create (
206
+ Deadline . create ( ) ,
207
+ referenceMosaicId ,
208
+ UInt64 . fromUint ( 60641 ) ,
209
+ UInt64 . fromUint ( 0 ) ,
210
+ MosaicRestrictionType . NONE ,
211
+ UInt64 . fromUint ( 0 ) ,
212
+ MosaicRestrictionType . GE ,
213
+ NetworkType . MIJIN_TEST ,
214
+ ) ;
215
+ const signedTransaction = mosaicGlobalRestrictionTransaction . signWith ( account , generationHash ) ;
216
+
217
+ listener . confirmed ( account . address ) . subscribe ( ( ) => {
218
+ done ( ) ;
219
+ } ) ;
220
+ listener . status ( account . address ) . subscribe ( ( error ) => {
221
+ console . log ( 'Error:' , error ) ;
222
+ assert ( false ) ;
223
+ done ( ) ;
224
+ } ) ;
225
+ transactionHttp . announce ( signedTransaction ) ;
226
+ } ) ;
227
+ } ) ;
228
+
229
+ describe ( 'MosaicGlobalRestrictionTransaction - with referenceMosaicId' , ( ) => {
160
230
let listener : Listener ;
161
231
before ( ( ) => {
162
232
listener = new Listener ( config . apiUrl ) ;
@@ -176,6 +246,8 @@ describe('RestrictionHttp', () => {
176
246
UInt64 . fromUint ( 0 ) ,
177
247
MosaicRestrictionType . GE ,
178
248
NetworkType . MIJIN_TEST ,
249
+ // TODO:
250
+ // referenceMosaicId,
179
251
) ;
180
252
const signedTransaction = mosaicGlobalRestrictionTransaction . signWith ( account , generationHash ) ;
181
253
@@ -262,7 +334,7 @@ describe('RestrictionHttp', () => {
262
334
deepEqual ( mosaicRestriction . mosaicId . toHex ( ) , mosaicId . toHex ( ) ) ;
263
335
deepEqual ( mosaicRestriction . entryType , MosaicRestrictionEntryType . ADDRESS ) ;
264
336
deepEqual ( mosaicRestriction . targetAddress . plain ( ) , account3 . address . plain ( ) ) ;
265
- deepEqual ( mosaicRestriction . restrictions [ 0 ] . get ( UInt64 . fromUint ( 60641 ) . toHex ( ) ) , UInt64 . fromUint ( 2 ) . toString ( ) ) ;
337
+ deepEqual ( mosaicRestriction . restrictions . get ( UInt64 . fromUint ( 60641 ) . toString ( ) ) , UInt64 . fromUint ( 2 ) . toString ( ) ) ;
266
338
done ( ) ;
267
339
} ) ;
268
340
} , 1000 ) ;
@@ -276,7 +348,7 @@ describe('RestrictionHttp', () => {
276
348
deepEqual ( mosaicRestriction [ 0 ] . mosaicId . toHex ( ) , mosaicId . toHex ( ) ) ;
277
349
deepEqual ( mosaicRestriction [ 0 ] . entryType , MosaicRestrictionEntryType . ADDRESS ) ;
278
350
deepEqual ( mosaicRestriction [ 0 ] . targetAddress . plain ( ) , account3 . address . plain ( ) ) ;
279
- deepEqual ( mosaicRestriction [ 0 ] . restrictions [ 0 ] . get ( UInt64 . fromUint ( 60641 ) . toHex ( ) ) , UInt64 . fromUint ( 2 ) . toString ( ) ) ;
351
+ deepEqual ( mosaicRestriction [ 0 ] . restrictions . get ( UInt64 . fromUint ( 60641 ) . toString ( ) ) , UInt64 . fromUint ( 2 ) . toString ( ) ) ;
280
352
done ( ) ;
281
353
} ) ;
282
354
} , 1000 ) ;
@@ -289,11 +361,11 @@ describe('RestrictionHttp', () => {
289
361
restrictionHttp . getMosaicGlobalRestriction ( mosaicId ) . subscribe ( ( mosaicRestriction ) => {
290
362
deepEqual ( mosaicRestriction . mosaicId . toHex ( ) , mosaicId . toHex ( ) ) ;
291
363
deepEqual ( mosaicRestriction . entryType , MosaicRestrictionEntryType . GLOBAL ) ;
292
- deepEqual ( mosaicRestriction . restrictions [ 0 ] . get ( UInt64 . fromUint ( 60641 ) . toHex ( ) ) ! . referenceMosaicId . toHex ( ) ,
364
+ deepEqual ( mosaicRestriction . restrictions . get ( UInt64 . fromUint ( 60641 ) . toString ( ) ) ! . referenceMosaicId . toHex ( ) ,
293
365
new MosaicId ( UInt64 . fromUint ( 0 ) . toHex ( ) ) . toHex ( ) ) ;
294
- deepEqual ( mosaicRestriction . restrictions [ 0 ] . get ( UInt64 . fromUint ( 60641 ) . toHex ( ) ) ! . restrictionType ,
366
+ deepEqual ( mosaicRestriction . restrictions . get ( UInt64 . fromUint ( 60641 ) . toString ( ) ) ! . restrictionType ,
295
367
MosaicRestrictionType . GE ) ;
296
- deepEqual ( mosaicRestriction . restrictions [ 0 ] . get ( UInt64 . fromUint ( 60641 ) . toHex ( ) ) ! . restrictionValue . toString ( ) ,
368
+ deepEqual ( mosaicRestriction . restrictions . get ( UInt64 . fromUint ( 60641 ) . toString ( ) ) ! . restrictionValue . toString ( ) ,
297
369
UInt64 . fromUint ( 0 ) . toString ( ) ) ;
298
370
done ( ) ;
299
371
} ) ;
@@ -307,11 +379,11 @@ describe('RestrictionHttp', () => {
307
379
restrictionHttp . getMosaicGlobalRestrictions ( [ mosaicId ] ) . subscribe ( ( mosaicRestriction ) => {
308
380
deepEqual ( mosaicRestriction [ 0 ] . mosaicId . toHex ( ) , mosaicId . toHex ( ) ) ;
309
381
deepEqual ( mosaicRestriction [ 0 ] . entryType , MosaicRestrictionEntryType . GLOBAL ) ;
310
- deepEqual ( mosaicRestriction [ 0 ] . restrictions [ 0 ] . get ( UInt64 . fromUint ( 60641 ) . toHex ( ) ) ! . referenceMosaicId . toHex ( ) ,
382
+ deepEqual ( mosaicRestriction [ 0 ] . restrictions . get ( UInt64 . fromUint ( 60641 ) . toString ( ) ) ! . referenceMosaicId . toHex ( ) ,
311
383
new MosaicId ( UInt64 . fromUint ( 0 ) . toHex ( ) ) . toHex ( ) ) ;
312
- deepEqual ( mosaicRestriction [ 0 ] . restrictions [ 0 ] . get ( UInt64 . fromUint ( 60641 ) . toHex ( ) ) ! . restrictionType ,
384
+ deepEqual ( mosaicRestriction [ 0 ] . restrictions . get ( UInt64 . fromUint ( 60641 ) . toString ( ) ) ! . restrictionType ,
313
385
MosaicRestrictionType . GE ) ;
314
- deepEqual ( mosaicRestriction [ 0 ] . restrictions [ 0 ] . get ( UInt64 . fromUint ( 60641 ) . toHex ( ) ) ! . restrictionValue . toString ( ) ,
386
+ deepEqual ( mosaicRestriction [ 0 ] . restrictions . get ( UInt64 . fromUint ( 60641 ) . toString ( ) ) ! . restrictionValue . toString ( ) ,
315
387
UInt64 . fromUint ( 0 ) . toString ( ) ) ;
316
388
done ( ) ;
317
389
} ) ;
0 commit comments