git.delta.rocks / unique-network / refs/commits / 1570fa83190e

difftreelog

feat Add `collection_admins` method to eth collection.

Trubnikov Sergey2022-09-16parent: #147da77.patch.diff
in: master

2 files changed

modifiedtests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth
--- 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);
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
40 AcalaAssetMetadata,40 AcalaAssetMetadata,
41 MoonbeamAssetInfo,41 MoonbeamAssetInfo,
42 DemocracyStandardAccountVote,42 DemocracyStandardAccountVote,
43 IEthCrossAccountId,
43} from './types';44} from './types';
44import {RuntimeDispatchInfo} from '@polkadot/types/interfaces';45import {RuntimeDispatchInfo} from '@polkadot/types/interfaces';
4546