From 1570fa83190e1427e07cd4e385fff4867e5916bb Mon Sep 17 00:00:00 2001 From: Trubnikov Sergey Date: Fri, 16 Sep 2022 14:38:38 +0000 Subject: [PATCH] feat: Add `collection_admins` method to eth collection. --- --- a/tests/src/eth/collectionAdmin.test.ts +++ b/tests/src/eth/collectionAdmin.test.ts @@ -64,24 +64,24 @@ expect(adminList).to.be.like([{Substrate: newAdmin.address}]); }); - // itEth('Check adminlist', async ({helper, privateKey}) => { - // const owner = await helper.eth.createAccountWithBalance(donor); + itEth('Check adminlist', async ({helper, privateKey}) => { + const owner = await helper.eth.createAccountWithBalance(donor); - // const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C'); - // const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner); + const {collectionAddress, collectionId} = await helper.eth.createNonfungibleCollection(owner, 'A', 'B', 'C'); + const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner); - // const admin1 = helper.eth.createAccount(); - // const admin2 = await privateKey('admin'); - // await collectionEvm.methods.addCollectionAdmin(admin1).send(); - // await collectionEvm.methods.addCollectionAdminCross(helper.ethCrossAccount.fromKeyringPair(admin2)).send(); + const admin1 = helper.eth.createAccount(); + const admin2 = privateKey('admin'); + await collectionEvm.methods.addCollectionAdmin(admin1).send(); + await collectionEvm.methods.addCollectionAdminSubstrate(admin2.addressRaw).send(); - // const adminListRpc = await helper.collection.getAdmins(collectionId); - // let adminListEth = await collectionEvm.methods.collectionAdmins().call(); - // adminListEth = adminListEth.map((element: IEthCrossAccountId) => { - // return helper.address.convertCrossAccountFromEthCrossAcoount(element); - // }); - // expect(adminListRpc).to.be.like(adminListEth); - // }); + const adminListRpc = await helper.collection.getAdmins(collectionId); + let adminListEth = await collectionEvm.methods.collectionAdmins().call(); + adminListEth = adminListEth.map((element: IEthCrossAccountId) => { + return helper.address.convertCrossAccountFromEthCrossAcoount(element); + }); + expect(adminListRpc).to.be.like(adminListEth); + }); itEth('Verify owner or admin', async ({helper}) => { const owner = await helper.eth.createAccountWithBalance(donor); --- a/tests/src/util/playgrounds/unique.ts +++ b/tests/src/util/playgrounds/unique.ts @@ -40,6 +40,7 @@ AcalaAssetMetadata, MoonbeamAssetInfo, DemocracyStandardAccountVote, + IEthCrossAccountId, } from './types'; import {RuntimeDispatchInfo} from '@polkadot/types/interfaces'; -- gitstuff