git.delta.rocks / unique-network / refs/commits / 02783a223963

difftreelog

source

tests/src/eth/collectionSponsoring.test.ts1.7 KiBsourcehistory
1import privateKey from '../substrate/privateKey';2import {addToAllowListExpectSuccess, confirmSponsorshipExpectSuccess, createCollectionExpectSuccess, enablePublicMintingExpectSuccess, setCollectionSponsorExpectSuccess} from '../util/helpers';3import {itWeb3, createEthAccount, collectionIdToAddress, GAS_ARGS, normalizeEvents} from './util/helpers';4import nonFungibleAbi from './nonFungibleAbi.json';5import {expect} from 'chai';67describe('evm collection sponsoring', () => {8  itWeb3('sponsors mint transactions', async ({web3}) => {9    const alice = privateKey('//Alice');1011    const collection = await createCollectionExpectSuccess();12    await setCollectionSponsorExpectSuccess(collection, alice.address);13    await confirmSponsorshipExpectSuccess(collection);1415    const minter = createEthAccount(web3);16    expect(await web3.eth.getBalance(minter)).to.equal('0');1718    const address = collectionIdToAddress(collection);19    const contract = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collection), {from: minter, ...GAS_ARGS});2021    await enablePublicMintingExpectSuccess(alice, collection);22    await addToAllowListExpectSuccess(alice, collection, {Ethereum: minter});2324    const nextTokenId = await contract.methods.nextTokenId().call();25    expect(nextTokenId).to.equal('1');26    const result = await contract.methods.mint(minter, nextTokenId).send();27    const events = normalizeEvents(result.events);28    expect(events).to.be.deep.equal([29      {30        address,31        event: 'Transfer',32        args: {33          from: '0x0000000000000000000000000000000000000000',34          to: minter,35          tokenId: nextTokenId,36        },37      },38    ]);39  });40});