1234567891011121314151617import {itEth, usingEthPlaygrounds, expect} from './util/index.js';18import type {IKeyringPair} from '@polkadot/types/types';19import {COLLECTION_HELPER, Pallets} from '@unique/test-utils/util.js';2021describe('[eth]CollectionHelperAddress test: ERC20/ERC721 ', () => {22 let donor: IKeyringPair;2324 before(async function() {25 await usingEthPlaygrounds(async (_, privateKey) => {26 donor = await privateKey({url: import.meta.url});27 });28 });2930 itEth('NFT', async ({helper}) => {31 const owner = await helper.eth.createAccountWithBalance(donor);3233 const {collectionAddress: nftCollectionAddress} = await helper.eth.createNFTCollection(owner, 'Sponsor', 'absolutely anything', 'ROC');34 const nftCollection = await helper.ethNativeContract.collection(nftCollectionAddress, 'nft', owner);3536 expect((await nftCollection.methods.collectionHelperAddress().call())37 .toString().toLowerCase()).to.be.equal(COLLECTION_HELPER);38 });3940 itEth.ifWithPallets('RFT ', [Pallets.ReFungible], async ({helper}) => {41 const owner = await helper.eth.createAccountWithBalance(donor);4243 const {collectionAddress: rftCollectionAddress} = await helper.eth.createRFTCollection(owner, 'Sponsor', 'absolutely anything', 'ROC');4445 const rftCollection = await helper.ethNativeContract.collection(rftCollectionAddress, 'rft', owner);46 expect((await rftCollection.methods.collectionHelperAddress().call())47 .toString().toLowerCase()).to.be.equal(COLLECTION_HELPER);48 });4950 itEth('FT', async ({helper}) => {51 const owner = await helper.eth.createAccountWithBalance(donor);5253 const {collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Sponsor', 18, 'absolutely anything', 'ROC');54 const collection = await helper.ethNativeContract.collection(collectionAddress, 'ft', owner);5556 expect((await collection.methods.collectionHelperAddress().call())57 .toString().toLowerCase()).to.be.equal(COLLECTION_HELPER);58 });5960 itEth('[collectionHelpers] convert collectionId into address', async ({helper}) => {61 const owner = await helper.eth.createAccountWithBalance(donor);62 const collectionId = 7;63 const collectionAddress = helper.ethAddress.fromCollectionId(collectionId);64 const helperContract = await helper.ethNativeContract.collectionHelpers(owner);6566 expect(await helperContract.methods.collectionAddress(collectionId).call()).to.be.equal(collectionAddress);67 expect(parseInt(await helperContract.methods.collectionId(collectionAddress).call())).to.be.equal(collectionId);68 });6970});