git.delta.rocks / unique-network / refs/commits / 6bc9f6eef346

difftreelog

source

tests/src/eth/collectionSponsoring.test.ts1.6 KiBsourcehistory
1import {addToAllowListExpectSuccess, confirmSponsorshipExpectSuccess, createCollectionExpectSuccess, enablePublicMintingExpectSuccess, setCollectionSponsorExpectSuccess} from '../util/helpers';2import {itWeb3, createEthAccount, collectionIdToAddress, GAS_ARGS, normalizeEvents} from './util/helpers';3import nonFungibleAbi from './nonFungibleAbi.json';4import {expect} from 'chai';56describe('evm collection sponsoring', () => {7  itWeb3('sponsors mint transactions', async ({web3, privateKeyWrapper}) => {8    const alice = privateKeyWrapper('//Alice');910    const collection = await createCollectionExpectSuccess();11    await setCollectionSponsorExpectSuccess(collection, alice.address);12    await confirmSponsorshipExpectSuccess(collection);1314    const minter = createEthAccount(web3);15    expect(await web3.eth.getBalance(minter)).to.equal('0');1617    const address = collectionIdToAddress(collection);18    const contract = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collection), {from: minter, ...GAS_ARGS});1920    await enablePublicMintingExpectSuccess(alice, collection);21    await addToAllowListExpectSuccess(alice, collection, {Ethereum: minter});2223    const nextTokenId = await contract.methods.nextTokenId().call();24    expect(nextTokenId).to.equal('1');25    const result = await contract.methods.mint(minter, nextTokenId).send();26    const events = normalizeEvents(result.events);27    expect(events).to.be.deep.equal([28      {29        address,30        event: 'Transfer',31        args: {32          from: '0x0000000000000000000000000000000000000000',33          to: minter,34          tokenId: nextTokenId,35        },36      },37    ]);38  });39});