git.delta.rocks / unique-network / refs/commits / 5202fc8f6f12

difftreelog

source

tests/src/collision-tests/turnsOffMinting.test.ts1.8 KiBsourcehistory
1import { IKeyringPair } from '@polkadot/types/types';
2import chai from 'chai';
3import chaiAsPromised from 'chai-as-promised';
4import privateKey from '../substrate/privateKey';
5import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';
6import waitNewBlocks from '../substrate/wait-new-blocks';
7import {
8  addToWhiteListExpectSuccess,
9  createCollectionExpectSuccess,
10  setMintPermissionExpectSuccess,
11} from '../util/helpers';
12
13chai.use(chaiAsPromised);
14const expect = chai.expect;
15let Alice: IKeyringPair;
16let Bob: IKeyringPair;
17let Ferdie: IKeyringPair;
18
19before(async () => {
20  await usingApi(async () => {
21    Alice = privateKey('//Alice');
22    Bob = privateKey('//Bob');
23    Ferdie = privateKey('//Ferdie');
24  });
25});
26
27describe('Turns off minting mode: ', () => {
28  // tslint:disable-next-line: max-line-length
29  it('The collection owner turns off minting mode and there are minting transactions in the same block ', async () => {
30    await usingApi(async (api) => {
31      const collectionId = await createCollectionExpectSuccess();
32      await setMintPermissionExpectSuccess(Alice, collectionId, true);
33      await addToWhiteListExpectSuccess(Alice, collectionId, Ferdie.address);
34      //
35      const mintItem = api.tx.nft.createItem(collectionId, Ferdie.address, 'NFT');
36      const offMinting = api.tx.nft.setMintPermission(collectionId, false);
37      await Promise.all
38      ([
39        mintItem.signAndSend(Ferdie),
40        offMinting.signAndSend(Alice),
41      ]);
42      const itemList: any = await api.query.nft.nftItemList(collectionId, mintItem);
43      expect(itemList.Owner.toString()).to.be.eq('5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM');
44      const blockHash = await api.query.system.number();
45      console.log(`blockHash: ${blockHash}`);
46    });
47  });
48});