git.delta.rocks / unique-network / refs/commits / 79fd5e9b275c

difftreelog

Add checks to removeCollectionAdminCross

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

1 file changed

modifiedtests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth
239 const owner = await helper.eth.createAccountWithBalance(donor);239 const owner = await helper.eth.createAccountWithBalance(donor);
240 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');240 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');
241241
242 const [newAdmin] = await helper.arrange.createAccounts([10n], donor);242 const [adminSub] = await helper.arrange.createAccounts([10n], donor);
243 const adminEth = (await helper.eth.createAccountWithBalance(donor)).toLowerCase();
243 const newAdminCross = helper.ethCrossAccount.fromKeyringPair(newAdmin);244 const adminCrossSub = helper.ethCrossAccount.fromKeyringPair(adminSub);
245 const adminCrossEth = helper.ethCrossAccount.fromAddress(adminEth);
246
244 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);247 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);
245 await collectionEvm.methods.addCollectionAdminCross(newAdminCross).send();248 await collectionEvm.methods.addCollectionAdminCross(adminCrossSub).send();
249 await collectionEvm.methods.addCollectionAdminCross(adminCrossEth).send();
250
246 {251 {
247 const adminList = await helper.callRpc('api.rpc.unique.adminlist', [collectionId]);252 const adminList = await helper.collection.getAdmins(collectionId);
248 expect(adminList[0].asSubstrate.toString().toLocaleLowerCase())253 expect(adminList).to.deep.include({Substrate: adminSub.address});
249 .to.be.eq(newAdmin.address.toLocaleLowerCase());254 expect(adminList).to.deep.include({Ethereum: adminEth});
250 }255 }
251256
252 await collectionEvm.methods.removeCollectionAdminCross(newAdminCross).send();257 await collectionEvm.methods.removeCollectionAdminCross(adminCrossSub).send();
258 await collectionEvm.methods.removeCollectionAdminCross(adminCrossEth).send();
253 const adminList = await helper.callRpc('api.rpc.unique.adminlist', [collectionId]);259 const adminList = await helper.collection.getAdmins(collectionId);
254 expect(adminList.length).to.be.eq(0);260 expect(adminList.length).to.be.eq(0);
261
262 // Non admin cannot mint:
263 await expect(helper.nft.mintToken(adminSub, {collectionId, owner: {Substrate: adminSub.address}})).to.be.rejectedWith(/common.PublicMintingNotAllowed/);
264 await expect(collectionEvm.methods.mint(adminEth).send({from: adminEth})).to.be.rejected;
255 });265 });
256266
257 // Soft-deprecated267 // Soft-deprecated