difftreelog
Style update
in: master
6 files changed
pallets/nft/src/mock.rsdiffbeforeafterboth--- a/pallets/nft/src/mock.rs
+++ b/pallets/nft/src/mock.rs
@@ -98,12 +98,6 @@
type WeightInfo = ();
}
-<<<<<<< HEAD
-type Timestamp = pallet_timestamp::Pallet<Test>;
-type Randomness = pallet_randomness_collective_flip::Pallet<Test>;
-
-=======
->>>>>>> origin/develop
parameter_types! {
pub const CollectionCreationPrice: u32 = 0;
pub TreasuryAccountId: u64 = 1234;
pallets/nft/src/tests.rsdiffbeforeafterboth--- a/pallets/nft/src/tests.rs
+++ b/pallets/nft/src/tests.rs
@@ -2080,206 +2080,210 @@
Error::<Test>::NoPermission
);
-#[test]
-fn collection_transfer_flag_works() {
- new_test_ext().execute_with(|| {
- let origin1 = Origin::signed(1);
+ #[test]
+ fn collection_transfer_flag_works() {
+ new_test_ext().execute_with(|| {
+ let origin1 = Origin::signed(1);
- let collection_id = create_test_collection(&CollectionMode::NFT, 1);
- assert_ok!(TemplateModule::set_transfers_enabled_flag(origin1, 1, true));
+ let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+ assert_ok!(TemplateModule::set_transfers_enabled_flag(origin1, 1, true));
- let data = default_nft_data();
- create_test_item(collection_id, &data.into());
- assert_eq!(TemplateModule::balance_count(1, 1), 1);
- assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
+ let data = default_nft_data();
+ create_test_item(collection_id, &data.into());
+ assert_eq!(TemplateModule::balance_count(1, 1), 1);
+ assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
- let origin1 = Origin::signed(1);
+ let origin1 = Origin::signed(1);
- // default scenario
- assert_ok!(TemplateModule::transfer(origin1, account(2), 1, 1, 1000));
- assert_eq!(TemplateModule::nft_item_id(1, 1).unwrap().owner, account(2));
- assert_eq!(TemplateModule::balance_count(1, 1), 0);
- assert_eq!(TemplateModule::balance_count(1, 2), 1);
+ // default scenario
+ assert_ok!(TemplateModule::transfer(origin1, account(2), 1, 1, 1000));
+ assert_eq!(TemplateModule::nft_item_id(1, 1).unwrap().owner, account(2));
+ assert_eq!(TemplateModule::balance_count(1, 1), 0);
+ assert_eq!(TemplateModule::balance_count(1, 2), 1);
- assert_eq!(TemplateModule::address_tokens(1, 2), [1]);
- });
-}
+ assert_eq!(TemplateModule::address_tokens(1, 2), [1]);
+ });
+ }
-#[test]
-fn set_variable_meta_data_on_nft_with_admin_flag() {
- new_test_ext().execute_with(|| {
- default_limits();
+ #[test]
+ fn set_variable_meta_data_on_nft_with_admin_flag() {
+ new_test_ext().execute_with(|| {
+ default_limits();
- let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, 2, 1);
+ let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, 2, 1);
- let origin1 = Origin::signed(1);
- let origin2 = Origin::signed(2);
+ let origin1 = Origin::signed(1);
+ let origin2 = Origin::signed(2);
- assert_ok!(TemplateModule::set_mint_permission(
- origin2.clone(),
- collection_id,
- true
- ));
- assert_ok!(TemplateModule::add_to_white_list(
- origin2.clone(),
- collection_id,
- account(1)
- ));
+ assert_ok!(TemplateModule::set_mint_permission(
+ origin2.clone(),
+ collection_id,
+ true
+ ));
+ assert_ok!(TemplateModule::add_to_white_list(
+ origin2.clone(),
+ collection_id,
+ account(1)
+ ));
- assert_ok!(TemplateModule::add_collection_admin(
- origin2.clone(),
- collection_id,
- account(1)
- ));
+ assert_ok!(TemplateModule::add_collection_admin(
+ origin2.clone(),
+ collection_id,
+ account(1)
+ ));
- let data = default_nft_data();
- create_test_item(1, &data.into());
+ let data = default_nft_data();
+ create_test_item(1, &data.into());
- TemplateModule::set_meta_update_permission_flag(
- origin2.clone(),
- collection_id,
- MetaUpdatePermission::Admin,
- );
+ TemplateModule::set_meta_update_permission_flag(
+ origin2.clone(),
+ collection_id,
+ MetaUpdatePermission::Admin,
+ );
- let variable_data = b"test set_variable_meta_data method.".to_vec();
- assert_ok!(TemplateModule::set_variable_meta_data(
- origin1,
- collection_id,
- 1,
- variable_data.clone()
- ));
+ let variable_data = b"test set_variable_meta_data method.".to_vec();
+ assert_ok!(TemplateModule::set_variable_meta_data(
+ origin1,
+ collection_id,
+ 1,
+ variable_data.clone()
+ ));
- assert_eq!(
- TemplateModule::nft_item_id(collection_id, 1)
- .unwrap()
- .variable_data,
- variable_data
- );
- });
-}
+ assert_eq!(
+ TemplateModule::nft_item_id(collection_id, 1)
+ .unwrap()
+ .variable_data,
+ variable_data
+ );
+ });
+ }
-#[test]
-fn set_variable_meta_data_on_nft_with_admin_flag_neg() {
- new_test_ext().execute_with(|| {
- default_limits();
+ #[test]
+ fn set_variable_meta_data_on_nft_with_admin_flag_neg() {
+ new_test_ext().execute_with(|| {
+ default_limits();
- let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, 2, 1);
+ let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, 2, 1);
- let origin1 = Origin::signed(1);
- let origin2 = Origin::signed(2);
+ let origin1 = Origin::signed(1);
+ let origin2 = Origin::signed(2);
- assert_ok!(TemplateModule::set_mint_permission(
- origin2.clone(),
- collection_id,
- true
- ));
- assert_ok!(TemplateModule::add_to_white_list(
- origin2.clone(),
- collection_id,
- account(1)
- ));
+ assert_ok!(TemplateModule::set_mint_permission(
+ origin2.clone(),
+ collection_id,
+ true
+ ));
+ assert_ok!(TemplateModule::add_to_white_list(
+ origin2.clone(),
+ collection_id,
+ account(1)
+ ));
- let data = default_nft_data();
- create_test_item(1, &data.into());
+ let data = default_nft_data();
+ create_test_item(1, &data.into());
- TemplateModule::set_meta_update_permission_flag(
- origin2.clone(),
- collection_id,
- MetaUpdatePermission::Admin,
- );
+ TemplateModule::set_meta_update_permission_flag(
+ origin2.clone(),
+ collection_id,
+ MetaUpdatePermission::Admin,
+ );
- let variable_data = b"test set_variable_meta_data method.".to_vec();
- assert_noop!(
- TemplateModule::set_variable_meta_data(
- origin1,
- collection_id,
- 1,
- variable_data.clone()
- ),
- Error::<Test>::NoPermission
- );
- });
-}
+ let variable_data = b"test set_variable_meta_data method.".to_vec();
+ assert_noop!(
+ TemplateModule::set_variable_meta_data(
+ origin1,
+ collection_id,
+ 1,
+ variable_data.clone()
+ ),
+ Error::<Test>::NoPermission
+ );
+ });
+ }
-#[test]
-fn set_variable_meta_flag_after_freeze() {
- new_test_ext().execute_with(|| {
- default_limits();
+ #[test]
+ fn set_variable_meta_flag_after_freeze() {
+ new_test_ext().execute_with(|| {
+ default_limits();
- let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, 2, 1);
+ let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, 2, 1);
- let origin2 = Origin::signed(2);
+ let origin2 = Origin::signed(2);
- TemplateModule::set_meta_update_permission_flag(
- origin2.clone(),
- collection_id,
- MetaUpdatePermission::None,
- );
- assert_noop!(
- TemplateModule::set_meta_update_permission_flag(
- origin2.clone(),
- collection_id,
- MetaUpdatePermission::Admin
- ),
- Error::<Test>::MetadataFlagFrozen
- );
- });
-}
+ TemplateModule::set_meta_update_permission_flag(
+ origin2.clone(),
+ collection_id,
+ MetaUpdatePermission::None,
+ );
+ assert_noop!(
+ TemplateModule::set_meta_update_permission_flag(
+ origin2.clone(),
+ collection_id,
+ MetaUpdatePermission::Admin
+ ),
+ Error::<Test>::MetadataFlagFrozen
+ );
+ });
+ }
-#[test]
-fn set_variable_meta_data_on_nft_with_none_flag_neg() {
- new_test_ext().execute_with(|| {
- default_limits();
+ #[test]
+ fn set_variable_meta_data_on_nft_with_none_flag_neg() {
+ new_test_ext().execute_with(|| {
+ default_limits();
- let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, 1, 1);
- let origin1 = Origin::signed(1);
+ let collection_id = create_test_collection_for_owner(&CollectionMode::NFT, 1, 1);
+ let origin1 = Origin::signed(1);
- let data = default_nft_data();
- create_test_item(1, &data.into());
+ let data = default_nft_data();
+ create_test_item(1, &data.into());
- TemplateModule::set_meta_update_permission_flag(
- origin1.clone(),
- collection_id,
- MetaUpdatePermission::None,
- );
+ TemplateModule::set_meta_update_permission_flag(
+ origin1.clone(),
+ collection_id,
+ MetaUpdatePermission::None,
+ );
- let variable_data = b"test set_variable_meta_data method.".to_vec();
- assert_noop!(
- TemplateModule::set_variable_meta_data(
- origin1.clone(),
- collection_id,
- 1,
- variable_data.clone()
- ),
- Error::<Test>::MetadataUpdateDenied
- );
+ let variable_data = b"test set_variable_meta_data method.".to_vec();
+ assert_noop!(
+ TemplateModule::set_variable_meta_data(
+ origin1.clone(),
+ collection_id,
+ 1,
+ variable_data.clone()
+ ),
+ Error::<Test>::MetadataUpdateDenied
+ );
+ });
+ }
-#[test]
-fn collection_transfer_flag_works_neg() {
- new_test_ext().execute_with(|| {
- let origin1 = Origin::signed(1);
+ #[test]
+ fn collection_transfer_flag_works_neg() {
+ new_test_ext().execute_with(|| {
+ let origin1 = Origin::signed(1);
- let collection_id = create_test_collection(&CollectionMode::NFT, 1);
- assert_ok!(TemplateModule::set_transfers_enabled_flag(
- origin1, 1, false
- ));
+ let collection_id = create_test_collection(&CollectionMode::NFT, 1);
+ assert_ok!(TemplateModule::set_transfers_enabled_flag(
+ origin1, 1, false
+ ));
- let data = default_nft_data();
- create_test_item(collection_id, &data.into());
- assert_eq!(TemplateModule::balance_count(1, 1), 1);
- assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
+ let data = default_nft_data();
+ create_test_item(collection_id, &data.into());
+ assert_eq!(TemplateModule::balance_count(1, 1), 1);
+ assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
- let origin1 = Origin::signed(1);
+ let origin1 = Origin::signed(1);
- // default scenario
- assert_noop!(
- TemplateModule::transfer(origin1, account(2), 1, 1, 1000),
- Error::<Test>::TransferNotAllowed
- );
- assert_eq!(TemplateModule::nft_item_id(1, 1).unwrap().owner, account(1));
- assert_eq!(TemplateModule::balance_count(1, 1), 1);
- assert_eq!(TemplateModule::balance_count(1, 2), 0);
+ // default scenario
+ assert_noop!(
+ TemplateModule::transfer(origin1, account(2), 1, 1, 1000),
+ Error::<Test>::TransferNotAllowed
+ );
+ assert_eq!(TemplateModule::nft_item_id(1, 1).unwrap().owner, account(1));
+ assert_eq!(TemplateModule::balance_count(1, 1), 1);
+ assert_eq!(TemplateModule::balance_count(1, 2), 0);
- assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
+ assert_eq!(TemplateModule::address_tokens(1, 1), [1]);
+ });
+ }
});
}
tests/src/addCollectionAdmin.test.tsdiffbeforeafterboth1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import { ApiPromise } from '@polkadot/api';7import BN from 'bn.js';8import chai from 'chai';9import chaiAsPromised from 'chai-as-promised';10import privateKey from './substrate/privateKey';11import { default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync } from './substrate/substrate-api';12import {createCollectionExpectSuccess, destroyCollectionExpectSuccess, normalizeAccountId} from './util/helpers';1314chai.use(chaiAsPromised);15const expect = chai.expect;1617describe('Integration Test addCollectionAdmin(collection_id, new_admin_id):', () => {18 it('Add collection admin.', async () => {19 await usingApi(async (api) => {20 const collectionId = await createCollectionExpectSuccess();21 const alice = privateKey('//Alice');22 const bob = privateKey('//Bob');2324 const collection: any = (await api.query.nft.collectionById(collectionId)).toJSON();25 expect(collection.Owner).to.be.equal(alice.address);2627 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));28 await submitTransactionAsync(alice, changeAdminTx);2930 const adminListAfterAddAdmin: any = (await api.query.nft.adminList(collectionId));31 expect(adminListAfterAddAdmin).to.be.contains(normalizeAccountId(bob.address));32 });33 });3435 it('Add admin using added collection admin.', async () => {36 await usingApi(async (api) => {37 const collectionId = await createCollectionExpectSuccess();38 const Alice = privateKey('//Alice');39 const Bob = privateKey('//Bob');40 const Charlie = privateKey('//CHARLIE');4142 const collection: any = (await api.query.nft.collectionById(collectionId)).toJSON();43 expect(collection.Owner).to.be.equal(Alice.address);4445 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));46 await submitTransactionAsync(Alice, changeAdminTx);4748 const adminListAfterAddAdmin: any = (await api.query.nft.adminList(collectionId));49 expect(adminListAfterAddAdmin).to.be.contains(normalizeAccountId(Bob.address));5051 const changeAdminTxCharlie = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Charlie.address));52 await submitTransactionAsync(Bob, changeAdminTxCharlie);53 const adminListAfterAddNewAdmin: any = (await api.query.nft.adminList(collectionId));54 expect(adminListAfterAddNewAdmin).to.be.contains(normalizeAccountId(Bob.address));55 expect(adminListAfterAddNewAdmin).to.be.contains(normalizeAccountId(Charlie.address));56 });57 });58});5960describe('Negative Integration Test addCollectionAdmin(collection_id, new_admin_id):', () => {61 it("Not owner can't add collection admin.", async () => {62 await usingApi(async (api) => {63 const collectionId = await createCollectionExpectSuccess();64 const alice = privateKey('//Alice');65 const nonOwner = privateKey('//Bob_stash');6667 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(alice.address));68 await expect(submitTransactionExpectFailAsync(nonOwner, changeAdminTx)).to.be.rejected;6970 const adminListAfterAddAdmin: any = (await api.query.nft.adminList(collectionId));71 expect(adminListAfterAddAdmin).not.to.be.contains(normalizeAccountId(alice.address));7273 // Verifying that nothing bad happened (network is live, new collections can be created, etc.)74 await createCollectionExpectSuccess();75 });76 });77 it("Can't add collection admin of not existing collection.", async () => {78 await usingApi(async (api) => {79 // tslint:disable-next-line: no-bitwise80 const collectionId = (1 << 32) - 1;81 const alice = privateKey('//Alice');82 const bob = privateKey('//Bob');8384 const changeOwnerTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));85 await expect(submitTransactionExpectFailAsync(alice, changeOwnerTx)).to.be.rejected;8687 // Verifying that nothing bad happened (network is live, new collections can be created, etc.)88 await createCollectionExpectSuccess();89 });90 });9192 it("Can't add an admin to a destroyed collection.", async () => {93 await usingApi(async (api) => {94 const collectionId = await createCollectionExpectSuccess();95 const Alice = privateKey('//Alice');96 const Bob = privateKey('//Bob');97 await destroyCollectionExpectSuccess(collectionId);98 const changeOwnerTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));99 await expect(submitTransactionExpectFailAsync(Alice, changeOwnerTx)).to.be.rejected;100101 // Verifying that nothing bad happened (network is live, new collections can be created, etc.)102 await createCollectionExpectSuccess();103 });104 });105106 it('Add an admin to a collection that has reached the maximum number of admins limit', async () => {107 await usingApi(async (api: ApiPromise) => {108 const Alice = privateKey('//Alice');109 const accounts = [110 'GsvVmjr1CBHwQHw84pPHMDxgNY3iBLz6Qn7qS3CH8qPhrHz',111 'FoQJpPyadYccjavVdTWxpxU7rUEaYhfLCPwXgkfD6Zat9QP',112 'JKspFU6ohf1Grg3Phdzj2pSgWvsYWzSfKghhfzMbdhNBWs5',113 'Fr4NzY1udSFFLzb2R3qxVQkwz9cZraWkyfH4h3mVVk7BK7P',114 'DfnTB4z7eUvYRqcGtTpFsLC69o6tvBSC1pEv8vWPZFtCkaK',115 'HnMAUz7r2G8G3hB27SYNyit5aJmh2a5P4eMdDtACtMFDbam',116 'DE14BzQ1bDXWPKeLoAqdLAm1GpyAWaWF1knF74cEZeomTBM',117 ];118 const collectionId = await createCollectionExpectSuccess();119120 const chainAdminLimit = (api.consts.nft.collectionAdminsLimit as any).toNumber();121 expect(chainAdminLimit).to.be.equal(5);122123 for (let i = 0; i < chainAdminLimit; i++) {124 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(accounts[i]));125 await submitTransactionAsync(Alice, changeAdminTx);126 const adminListAfterAddAdmin: any = (await api.query.nft.adminList(collectionId));127 expect(adminListAfterAddAdmin).to.be.contains(normalizeAccountId(accounts[i]));128 }129130 const tx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(accounts[chainAdminLimit]));131 await expect(submitTransactionExpectFailAsync(Alice, tx)).to.be.rejected;132 });133 });134});1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import { ApiPromise } from '@polkadot/api';7import chai from 'chai';8import chaiAsPromised from 'chai-as-promised';9import privateKey from './substrate/privateKey';10import { default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync } from './substrate/substrate-api';11import {createCollectionExpectSuccess, destroyCollectionExpectSuccess, normalizeAccountId} from './util/helpers';1213chai.use(chaiAsPromised);14const expect = chai.expect;1516describe('Integration Test addCollectionAdmin(collection_id, new_admin_id):', () => {17 it('Add collection admin.', async () => {18 await usingApi(async (api) => {19 const collectionId = await createCollectionExpectSuccess();20 const alice = privateKey('//Alice');21 const bob = privateKey('//Bob');2223 const collection: any = (await api.query.nft.collectionById(collectionId)).toJSON();24 expect(collection.Owner).to.be.equal(alice.address);2526 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));27 await submitTransactionAsync(alice, changeAdminTx);2829 const adminListAfterAddAdmin: any = (await api.query.nft.adminList(collectionId));30 expect(adminListAfterAddAdmin).to.be.contains(normalizeAccountId(bob.address));31 });32 });3334 it('Add admin using added collection admin.', async () => {35 await usingApi(async (api) => {36 const collectionId = await createCollectionExpectSuccess();37 const Alice = privateKey('//Alice');38 const Bob = privateKey('//Bob');39 const Charlie = privateKey('//CHARLIE');4041 const collection: any = (await api.query.nft.collectionById(collectionId)).toJSON();42 expect(collection.Owner).to.be.equal(Alice.address);4344 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));45 await submitTransactionAsync(Alice, changeAdminTx);4647 const adminListAfterAddAdmin: any = (await api.query.nft.adminList(collectionId));48 expect(adminListAfterAddAdmin).to.be.contains(normalizeAccountId(Bob.address));4950 const changeAdminTxCharlie = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Charlie.address));51 await submitTransactionAsync(Bob, changeAdminTxCharlie);52 const adminListAfterAddNewAdmin: any = (await api.query.nft.adminList(collectionId));53 expect(adminListAfterAddNewAdmin).to.be.contains(normalizeAccountId(Bob.address));54 expect(adminListAfterAddNewAdmin).to.be.contains(normalizeAccountId(Charlie.address));55 });56 });57});5859describe('Negative Integration Test addCollectionAdmin(collection_id, new_admin_id):', () => {60 it("Not owner can't add collection admin.", async () => {61 await usingApi(async (api) => {62 const collectionId = await createCollectionExpectSuccess();63 const alice = privateKey('//Alice');64 const nonOwner = privateKey('//Bob_stash');6566 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(alice.address));67 await expect(submitTransactionExpectFailAsync(nonOwner, changeAdminTx)).to.be.rejected;6869 const adminListAfterAddAdmin: any = (await api.query.nft.adminList(collectionId));70 expect(adminListAfterAddAdmin).not.to.be.contains(normalizeAccountId(alice.address));7172 // Verifying that nothing bad happened (network is live, new collections can be created, etc.)73 await createCollectionExpectSuccess();74 });75 });76 it("Can't add collection admin of not existing collection.", async () => {77 await usingApi(async (api) => {78 // tslint:disable-next-line: no-bitwise79 const collectionId = (1 << 32) - 1;80 const alice = privateKey('//Alice');81 const bob = privateKey('//Bob');8283 const changeOwnerTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));84 await expect(submitTransactionExpectFailAsync(alice, changeOwnerTx)).to.be.rejected;8586 // Verifying that nothing bad happened (network is live, new collections can be created, etc.)87 await createCollectionExpectSuccess();88 });89 });9091 it("Can't add an admin to a destroyed collection.", async () => {92 await usingApi(async (api) => {93 const collectionId = await createCollectionExpectSuccess();94 const Alice = privateKey('//Alice');95 const Bob = privateKey('//Bob');96 await destroyCollectionExpectSuccess(collectionId);97 const changeOwnerTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));98 await expect(submitTransactionExpectFailAsync(Alice, changeOwnerTx)).to.be.rejected;99100 // Verifying that nothing bad happened (network is live, new collections can be created, etc.)101 await createCollectionExpectSuccess();102 });103 });104105 it('Add an admin to a collection that has reached the maximum number of admins limit', async () => {106 await usingApi(async (api: ApiPromise) => {107 const Alice = privateKey('//Alice');108 const accounts = [109 'GsvVmjr1CBHwQHw84pPHMDxgNY3iBLz6Qn7qS3CH8qPhrHz',110 'FoQJpPyadYccjavVdTWxpxU7rUEaYhfLCPwXgkfD6Zat9QP',111 'JKspFU6ohf1Grg3Phdzj2pSgWvsYWzSfKghhfzMbdhNBWs5',112 'Fr4NzY1udSFFLzb2R3qxVQkwz9cZraWkyfH4h3mVVk7BK7P',113 'DfnTB4z7eUvYRqcGtTpFsLC69o6tvBSC1pEv8vWPZFtCkaK',114 'HnMAUz7r2G8G3hB27SYNyit5aJmh2a5P4eMdDtACtMFDbam',115 'DE14BzQ1bDXWPKeLoAqdLAm1GpyAWaWF1knF74cEZeomTBM',116 ];117 const collectionId = await createCollectionExpectSuccess();118119 const chainAdminLimit = (api.consts.nft.collectionAdminsLimit as any).toNumber();120 expect(chainAdminLimit).to.be.equal(5);121122 for (let i = 0; i < chainAdminLimit; i++) {123 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(accounts[i]));124 await submitTransactionAsync(Alice, changeAdminTx);125 const adminListAfterAddAdmin: any = (await api.query.nft.adminList(collectionId));126 expect(adminListAfterAddAdmin).to.be.contains(normalizeAccountId(accounts[i]));127 }128129 const tx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(accounts[chainAdminLimit]));130 await expect(submitTransactionExpectFailAsync(Alice, tx)).to.be.rejected;131 });132 });133});tests/src/collision-tests/adminLimitsOff.test.tsdiffbeforeafterboth--- a/tests/src/collision-tests/adminLimitsOff.test.ts
+++ b/tests/src/collision-tests/adminLimitsOff.test.ts
@@ -1,5 +1,4 @@
import { IKeyringPair } from '@polkadot/types/types';
-import BN from 'bn.js';
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import privateKey from '../substrate/privateKey';
tests/src/eth/nonFungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -6,7 +6,6 @@
import privateKey from '../substrate/privateKey';
import { approveExpectSuccess, burnItemExpectSuccess, createCollectionExpectSuccess, createItemExpectSuccess, transferExpectSuccess, transferFromExpectSuccess, UNIQUE } from '../util/helpers';
import { collectionIdToAddress, createEthAccount, createEthAccountWithBalance, GAS_ARGS, itWeb3, normalizeEvents, recordEthFee, recordEvents, subToEth, transferBalanceToEth } from './util/helpers';
-import { evmToAddress } from '@polkadot/util-crypto';
import nonFungibleAbi from './nonFungibleAbi.json';
import { expect } from 'chai';
import waitNewBlocks from '../substrate/wait-new-blocks';
tests/src/util/helpers.tsdiffbeforeafterboth--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -1084,15 +1084,6 @@
await setMintPermissionExpectSuccess(sender, collectionId, true);
}
-export async function addCollectionAdminExpectSuccess(sender: IKeyringPair, collectionId: number, address: IKeyringPair) {
- await usingApi(async (api) => {
- const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(address.address));
- const events = await submitTransactionAsync(sender, changeAdminTx);
- const result = getCreateCollectionResult(events);
- expect(result.success).to.be.true;
- });
-}
-
export async function setMintPermissionExpectFailure(sender: IKeyringPair, collectionId: number, enabled: boolean) {
await usingApi(async (api) => {
// Run the transaction