git.delta.rocks / unique-network / refs/commits / ccf797c021e8

difftreelog

Fix admin test and remove //Alice

Max Andreev2022-12-01parent: #4a008cd.patch.diff
in: master

2 files changed

modifiedtests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth
77 const {collectionAddress, collectionId} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, 'Mint collection', 'a', 'b', 'uri');77 const {collectionAddress, collectionId} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, 'Mint collection', 'a', 'b', 'uri');
78 const adminEth = (await helper.eth.createAccountWithBalance(donor)).toLowerCase();78 const adminEth = (await helper.eth.createAccountWithBalance(donor)).toLowerCase();
79 const adminCrossEth = helper.ethCrossAccount.fromAddress(adminEth);79 const adminCrossEth = helper.ethCrossAccount.fromAddress(adminEth);
80 const [adminSub] = await helper.arrange.createAccounts([100n], donor);
81 const adminCrossSub = helper.ethCrossAccount.fromKeyringPair(adminSub);
80 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);82 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
81 83
82 // cannot mint while not admin84 // cannot mint while not admin
83 await expect(collectionEvm.methods.mint(owner).send({from: adminEth})).to.be.rejectedWith('PublicMintingNotAllowed');85 await expect(collectionEvm.methods.mint(owner).send({from: adminEth})).to.be.rejected;
84 86 await expect(helper.nft.mintToken(adminSub, {collectionId, owner: {Ethereum: owner}})).to.be.rejectedWith(/common.PublicMintingNotAllowed/);
87
85 // admin can mint token:88 // admin (sub and eth) can mint token:
86 await collectionEvm.methods.addCollectionAdminCross(adminCrossEth).send();89 await collectionEvm.methods.addCollectionAdminCross(adminCrossEth).send();
90 await collectionEvm.methods.addCollectionAdminCross(adminCrossSub).send();
87 await collectionEvm.methods.mint(owner).send({from: adminEth});91 await collectionEvm.methods.mint(owner).send({from: adminEth});
92 await helper.nft.mintToken(adminSub, {collectionId, owner: {Ethereum: owner}});
8893
89 expect(await helper.collection.getLastTokenId(collectionId)).to.eq(1);94 expect(await helper.collection.getLastTokenId(collectionId)).to.eq(2);
90 });95 });
9196
92 itEth('cannot add invalid cross account admin', async ({helper}) => {97 itEth('cannot add invalid cross account admin', async ({helper}) => {
modifiedtests/src/eth/nonFungible.test.tsdiffbeforeafterboth
360 }360 }
361 });361 });
362362
363 itEth('Can perform transferFromCross()', async ({helper, privateKey}) => {363 itEth('Can perform transferFromCross()', async ({helper}) => {
364 const minter = await privateKey('//Alice');
365 const collection = await helper.nft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});364 const collection = await helper.nft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});
366365
367 const owner = await privateKey('//Bob');366 const [owner, receiver] = await helper.arrange.createAccounts([100n, 100n], donor);
368 const spender = await helper.eth.createAccountWithBalance(donor);367 const spender = await helper.eth.createAccountWithBalance(donor);
369 const receiver = await privateKey('//Charlie');
370368
371 const token = await collection.mintToken(minter, {Substrate: owner.address});369 const token = await collection.mintToken(minter, {Substrate: owner.address});
372370