1import { expect } from "chai";2import privateKey from "../substrate/privateKey";3import { createCollectionExpectSuccess } from "../util/helpers";4import { collectionIdToAddress, createEthAccount, itWeb3, transferBalanceToEth } from "./util/helpers";5import fungibleMetadataAbi from './fungibleMetadataAbi.json';67describe('Common metadata', () => {8 itWeb3('Returns collection name', async ({ api, web3 }) => {9 const collection = await createCollectionExpectSuccess({10 name: 'token name',11 mode: { type: 'NFT' }12 });13 const caller = createEthAccount(web3);14 await transferBalanceToEth(api, privateKey('//Alice'), caller, 999999);1516 const address = collectionIdToAddress(collection);17 const contract = new web3.eth.Contract(fungibleMetadataAbi as any, address);18 const name = await contract.methods.name().call({ from: caller });1920 expect(name).to.equal('token name');21 });2223 itWeb3('Returns symbol name', async ({ api, web3 }) => {24 const collection = await createCollectionExpectSuccess({25 tokenPrefix: 'TOK',26 mode: { type: 'NFT' }27 });28 const caller = createEthAccount(web3);29 await transferBalanceToEth(api, privateKey('//Alice'), caller, 999999);3031 const address = collectionIdToAddress(collection);32 const contract = new web3.eth.Contract(fungibleMetadataAbi as any, address);33 const symbol = await contract.methods.symbol().call({ from: caller });3435 expect(symbol).to.equal('TOK');36 });37});3839describe('Fungible metadata', () => {40 itWeb3('Returns fungible decimals', async ({ api, web3 }) => {41 const collection = await createCollectionExpectSuccess({42 mode: { type: 'Fungible', decimalPoints: 6 }43 });44 const caller = createEthAccount(web3);45 await transferBalanceToEth(api, privateKey('//Alice'), caller, 999999);4647 const address = collectionIdToAddress(collection);48 const contract = new web3.eth.Contract(fungibleMetadataAbi as any, address);49 const decimals = await contract.methods.decimals().call({ from: caller });5051 expect(+decimals).to.equal(6);52 })53})