1234567import {ApiPromise} from '@polkadot/api';8import {IKeyringPair} from '@polkadot/types/types';9import chai from 'chai';10import chaiAsPromised from 'chai-as-promised';11import privateKey from '../substrate/privateKey';12import usingApi, {submitTransactionAsync} from '../substrate/substrate-api';13import {createCollectionExpectSuccess, createItemExpectSuccess, uniqueEventMessage, normalizeAccountId} from '../util/helpers';1415chai.use(chaiAsPromised);16const expect = chai.expect;1718describe('Transfer from event ', () => {19 let alice: IKeyringPair;20 let bob: IKeyringPair;21 const checkSection = 'Transfer';22 const checkTreasury = 'Deposit';23 const checkSystem = 'ExtrinsicSuccess';24 before(async () => {25 await usingApi(async () => {26 alice = privateKey('//Alice');27 bob = privateKey('//Bob');28 });29 });30 it('Check event from transferFrom(): ', async () => {31 await usingApi(async (api: ApiPromise) => {32 const collectionID = await createCollectionExpectSuccess();33 const itemID = await createItemExpectSuccess(alice, collectionID, 'NFT');34 const transferFrom = api.tx.unique.transferFrom(normalizeAccountId(alice.address), normalizeAccountId(bob.address), collectionID, itemID, 1);35 const events = await submitTransactionAsync(alice, transferFrom);36 const msg = JSON.stringify(uniqueEventMessage(events));37 expect(msg).to.be.contain(checkSection);38 expect(msg).to.be.contain(checkTreasury);39 expect(msg).to.be.contain(checkSystem);40 });41 });42});