difftreelog
Add call-methods checks
in: master
6 files changed
tests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth--- a/tests/src/eth/collectionAdmin.test.ts
+++ b/tests/src/eth/collectionAdmin.test.ts
@@ -62,6 +62,8 @@
expect(await collectionEvm.methods.isOwnerOrAdminCross(adminCrossSub).call()).to.be.false;
expect(await collectionEvm.methods.isOwnerOrAdminCross(adminCrossEth).call()).to.be.false;
expect(await collectionEvm.methods.isOwnerOrAdminCross(helper.ethCrossAccount.fromAddress(adminDeprecated)).call()).to.be.false;
+ expect(await collectionEvm.methods.collectionAdmins().call()).to.be.like([]);
+
// Soft-deprecated: can addCollectionAdmin
await collectionEvm.methods.addCollectionAdmin(adminDeprecated).send();
tests/src/eth/collectionSponsoring.test.tsdiffbeforeafterboth--- a/tests/src/eth/collectionSponsoring.test.ts
+++ b/tests/src/eth/collectionSponsoring.test.ts
@@ -101,11 +101,13 @@
expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.true;
await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsor});
+ let sponsorTuple = await collectionEvm.methods.collectionSponsor().call({from: owner});
+ expect(helper.address.restoreCrossAccountFromBigInt(BigInt(sponsorTuple.sub))).to.be.eq(helper.address.ethToSubstrate(sponsor));
expect(await collectionEvm.methods.hasCollectionPendingSponsor().call({from: owner})).to.be.false;
await collectionEvm.methods.removeCollectionSponsor().send({from: owner});
- const sponsorTuple = await collectionEvm.methods.collectionSponsor().call({from: owner});
+ sponsorTuple = await collectionEvm.methods.collectionSponsor().call({from: owner});
expect(sponsorTuple.eth).to.be.eq('0x0000000000000000000000000000000000000000');
}));
tests/src/eth/createFTCollection.test.tsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.8//9// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {IKeyringPair} from '@polkadot/types/types';18import {evmToAddress} from '@polkadot/util-crypto';19import {Pallets, requirePalletsOrSkip} from '../util';20import {expect, itEth, usingEthPlaygrounds} from './util';21import { CollectionLimits } from './util/playgrounds/types';2223const DECIMALS = 18;2425describe('Create FT collection from EVM', () => {26 let donor: IKeyringPair;2728 before(async function() {29 await usingEthPlaygrounds(async (helper, privateKey) => {30 requirePalletsOrSkip(this, helper, [Pallets.Fungible]);31 donor = await privateKey({filename: __filename});32 });33 });34 35 // Soft-deprecated36 itEth('[eth] Set sponsorship', async ({helper}) => {37 const owner = await helper.eth.createAccountWithBalance(donor);38 const sponsor = await helper.eth.createAccountWithBalance(donor);39 const ss58Format = helper.chain.getChainProperties().ss58Format;40 const description = 'absolutely anything';41 42 const {collectionId, collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Sponsor', DECIMALS, description, 'ENVY');4344 const collection = helper.ethNativeContract.collection(collectionAddress, 'ft', owner, true);45 await collection.methods.setCollectionSponsor(sponsor).send();4647 let data = (await helper.rft.getData(collectionId))!;48 expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));4950 await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('ConfirmSponsorshipFail');5152 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor, true);53 await sponsorCollection.methods.confirmCollectionSponsorship().send();5455 data = (await helper.rft.getData(collectionId))!;56 expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));57 });5859 itEth('[cross] Set sponsorship', async ({helper}) => {60 const owner = await helper.eth.createAccountWithBalance(donor);61 const sponsor = await helper.eth.createAccountWithBalance(donor);62 const ss58Format = helper.chain.getChainProperties().ss58Format;63 const description = 'absolutely anything';64 const {collectionId, collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Sponsor', DECIMALS, description, 'ENVY');65 66 const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);67 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);68 await collection.methods.setCollectionSponsorCross(sponsorCross).send();6970 let data = (await helper.rft.getData(collectionId))!;71 expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));7273 await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('ConfirmSponsorshipFail');7475 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);76 await sponsorCollection.methods.confirmCollectionSponsorship().send();7778 data = (await helper.rft.getData(collectionId))!;79 expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));80 expect(await collection.methods.description().call()).to.deep.equal(description);81 });8283 itEth('Collection address exist', async ({helper}) => {84 const owner = await helper.eth.createAccountWithBalance(donor);85 const collectionAddressForNonexistentCollection = '0x17C4E6453CC49AAAAEACA894E6D9683E00112233';86 expect(await helper.ethNativeContract.collectionHelpers(collectionAddressForNonexistentCollection)87 .methods.isCollectionExist(collectionAddressForNonexistentCollection).call())88 .to.be.false;89 90 const {collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Exister', DECIMALS, 'absolutely anything', 'WIWT');91 expect(await helper.ethNativeContract.collectionHelpers(collectionAddress)92 .methods.isCollectionExist(collectionAddress).call())93 .to.be.true;94 });95 96 itEth('destroyCollection', async ({helper}) => {97 const owner = await helper.eth.createAccountWithBalance(donor);98 const {collectionAddress, collectionId} = await helper.eth.createFungibleCollection(owner, 'Exister', DECIMALS, 'absolutely anything', 'WIWT');99 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);100101 const result = await collectionHelper.methods102 .destroyCollection(collectionAddress)103 .send({from: owner});104105 const events = helper.eth.normalizeEvents(result.events);106 107 expect(events).to.be.deep.equal([108 {109 address: collectionHelper.options.address,110 event: 'CollectionDestroyed',111 args: {112 collectionId: collectionAddress,113 },114 },115 ]);116117 expect(await collectionHelper.methods118 .isCollectionExist(collectionAddress)119 .call()).to.be.false;120 expect(await helper.collection.getData(collectionId)).to.be.null;121 });122});123124describe('(!negative tests!) Create FT collection from EVM', () => {125 let donor: IKeyringPair;126 let nominal: bigint;127128 before(async function() {129 await usingEthPlaygrounds(async (helper, privateKey) => {130 requirePalletsOrSkip(this, helper, [Pallets.Fungible]);131 donor = await privateKey({filename: __filename});132 nominal = helper.balance.getOneTokenNominal();133 });134 });135136 itEth('(!negative test!) Create collection (bad lengths)', async ({helper}) => {137 const owner = await helper.eth.createAccountWithBalance(donor);138 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);139 {140 const MAX_NAME_LENGTH = 64;141 const collectionName = 'A'.repeat(MAX_NAME_LENGTH + 1);142 const description = 'A';143 const tokenPrefix = 'A';144145 await expect(collectionHelper.methods146 .createFTCollection(collectionName, DECIMALS, description, tokenPrefix)147 .call({value: Number(2n * nominal)})).to.be.rejectedWith('name is too long. Max length is ' + MAX_NAME_LENGTH);148 }149 {150 const MAX_DESCRIPTION_LENGTH = 256;151 const collectionName = 'A';152 const description = 'A'.repeat(MAX_DESCRIPTION_LENGTH + 1);153 const tokenPrefix = 'A';154 await expect(collectionHelper.methods155 .createFTCollection(collectionName, DECIMALS, description, tokenPrefix)156 .call({value: Number(2n * nominal)})).to.be.rejectedWith('description is too long. Max length is ' + MAX_DESCRIPTION_LENGTH);157 }158 {159 const MAX_TOKEN_PREFIX_LENGTH = 16;160 const collectionName = 'A';161 const description = 'A';162 const tokenPrefix = 'A'.repeat(MAX_TOKEN_PREFIX_LENGTH + 1);163 await expect(collectionHelper.methods164 .createFTCollection(collectionName, DECIMALS, description, tokenPrefix)165 .call({value: Number(2n * nominal)})).to.be.rejectedWith('token_prefix is too long. Max length is ' + MAX_TOKEN_PREFIX_LENGTH);166 }167 });168 169 itEth('(!negative test!) cannot create collection if value !== 2', async ({helper}) => {170 const owner = await helper.eth.createAccountWithBalance(donor);171 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);172 const expects = [0n, 1n, 30n].map(async value => {173 await expect(collectionHelper.methods174 .createFTCollection('Peasantry', DECIMALS, 'absolutely anything', 'TWIW')175 .call({value: Number(value * nominal)})).to.be.rejectedWith('Sent amount not equals to collection creation price (2000000000000000000)');176 });177 await Promise.all(expects);178 });179180 // Soft-deprecated181 itEth('(!negative test!) [eth] Check owner', async ({helper}) => {182 const owner = await helper.eth.createAccountWithBalance(donor);183 const peasant = helper.eth.createAccount();184 const {collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Transgressed', DECIMALS, 'absolutely anything', 'YVNE');185 const peasantCollection = helper.ethNativeContract.collection(collectionAddress, 'ft', peasant, true);186 const EXPECTED_ERROR = 'NoPermission';187 {188 const sponsor = await helper.eth.createAccountWithBalance(donor);189 await expect(peasantCollection.methods190 .setCollectionSponsor(sponsor)191 .call()).to.be.rejectedWith(EXPECTED_ERROR);192 193 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'ft', sponsor, true);194 await expect(sponsorCollection.methods195 .confirmCollectionSponsorship()196 .call()).to.be.rejectedWith('ConfirmSponsorshipFail');197 }198 {199 await expect(peasantCollection.methods200 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)201 .call()).to.be.rejectedWith(EXPECTED_ERROR);202 }203 });204205 itEth('(!negative test!) [cross] Check owner', async ({helper}) => {206 const owner = await helper.eth.createAccountWithBalance(donor);207 const peasant = helper.eth.createAccount();208 const {collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Transgressed', DECIMALS, 'absolutely anything', 'YVNE');209 const peasantCollection = helper.ethNativeContract.collection(collectionAddress, 'ft', peasant);210 const EXPECTED_ERROR = 'NoPermission';211 {212 const sponsor = await helper.eth.createAccountWithBalance(donor);213 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);214 await expect(peasantCollection.methods215 .setCollectionSponsorCross(sponsorCross)216 .call()).to.be.rejectedWith(EXPECTED_ERROR);217 218 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'ft', sponsor);219 await expect(sponsorCollection.methods220 .confirmCollectionSponsorship()221 .call()).to.be.rejectedWith('ConfirmSponsorshipFail');222 }223 {224 await expect(peasantCollection.methods225 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)226 .call()).to.be.rejectedWith(EXPECTED_ERROR);227 }228 }); 229});1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.8//9// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {IKeyringPair} from '@polkadot/types/types';18import {evmToAddress} from '@polkadot/util-crypto';19import {Pallets, requirePalletsOrSkip} from '../util';20import {expect, itEth, usingEthPlaygrounds} from './util';21import {CollectionLimits} from './util/playgrounds/types';2223const DECIMALS = 18;2425describe('Create FT collection from EVM', () => {26 let donor: IKeyringPair;2728 before(async function() {29 await usingEthPlaygrounds(async (helper, privateKey) => {30 requirePalletsOrSkip(this, helper, [Pallets.Fungible]);31 donor = await privateKey({filename: __filename});32 });33 });34 35 // TODO move sponsorship tests to another file:36 // Soft-deprecated37 itEth('[eth] Set sponsorship', async ({helper}) => {38 const owner = await helper.eth.createAccountWithBalance(donor);39 const sponsor = await helper.eth.createAccountWithBalance(donor);40 const ss58Format = helper.chain.getChainProperties().ss58Format;41 const description = 'absolutely anything';42 43 const {collectionId, collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Sponsor', DECIMALS, description, 'ENVY');4445 const collection = helper.ethNativeContract.collection(collectionAddress, 'ft', owner, true);46 await collection.methods.setCollectionSponsor(sponsor).send();4748 let data = (await helper.rft.getData(collectionId))!;49 expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));5051 await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('ConfirmSponsorshipFail');5253 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor, true);54 await sponsorCollection.methods.confirmCollectionSponsorship().send();5556 data = (await helper.rft.getData(collectionId))!;57 expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));58 });5960 itEth('[cross] Set sponsorship', async ({helper}) => {61 const owner = await helper.eth.createAccountWithBalance(donor);62 const sponsor = await helper.eth.createAccountWithBalance(donor);63 const ss58Format = helper.chain.getChainProperties().ss58Format;64 const description = 'absolutely anything';65 const {collectionId, collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Sponsor', DECIMALS, description, 'ENVY');66 67 const collection = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);68 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);69 await collection.methods.setCollectionSponsorCross(sponsorCross).send();7071 let data = (await helper.rft.getData(collectionId))!;72 expect(data.raw.sponsorship.Unconfirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));7374 await expect(collection.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('ConfirmSponsorshipFail');7576 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'rft', sponsor);77 await sponsorCollection.methods.confirmCollectionSponsorship().send();7879 data = (await helper.rft.getData(collectionId))!;80 expect(data.raw.sponsorship.Confirmed).to.be.equal(evmToAddress(sponsor, Number(ss58Format)));81 expect(await collection.methods.description().call()).to.deep.equal(description);82 });8384 itEth('Collection address exist', async ({helper}) => {85 const owner = await helper.eth.createAccountWithBalance(donor);86 const collectionAddressForNonexistentCollection = '0x17C4E6453CC49AAAAEACA894E6D9683E00112233';87 expect(await helper.ethNativeContract.collectionHelpers(collectionAddressForNonexistentCollection)88 .methods.isCollectionExist(collectionAddressForNonexistentCollection).call())89 .to.be.false;90 91 const {collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Exister', DECIMALS, 'absolutely anything', 'WIWT');92 expect(await helper.ethNativeContract.collectionHelpers(collectionAddress)93 .methods.isCollectionExist(collectionAddress).call())94 .to.be.true;95 96 // check collectionOwner:97 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'ft', owner, true);98 const collectionOwner = await collectionEvm.methods.collectionOwner().call();99 expect(helper.address.restoreCrossAccountFromBigInt(BigInt(collectionOwner.sub))).to.eq(helper.address.ethToSubstrate(owner));100 });101 102 itEth('destroyCollection', async ({helper}) => {103 const owner = await helper.eth.createAccountWithBalance(donor);104 const {collectionAddress, collectionId} = await helper.eth.createFungibleCollection(owner, 'Exister', DECIMALS, 'absolutely anything', 'WIWT');105 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);106107 const result = await collectionHelper.methods108 .destroyCollection(collectionAddress)109 .send({from: owner});110111 const events = helper.eth.normalizeEvents(result.events);112 113 expect(events).to.be.deep.equal([114 {115 address: collectionHelper.options.address,116 event: 'CollectionDestroyed',117 args: {118 collectionId: collectionAddress,119 },120 },121 ]);122123 expect(await collectionHelper.methods124 .isCollectionExist(collectionAddress)125 .call()).to.be.false;126 expect(await helper.collection.getData(collectionId)).to.be.null;127 });128});129130describe('(!negative tests!) Create FT collection from EVM', () => {131 let donor: IKeyringPair;132 let nominal: bigint;133134 before(async function() {135 await usingEthPlaygrounds(async (helper, privateKey) => {136 requirePalletsOrSkip(this, helper, [Pallets.Fungible]);137 donor = await privateKey({filename: __filename});138 nominal = helper.balance.getOneTokenNominal();139 });140 });141142 itEth('(!negative test!) Create collection (bad lengths)', async ({helper}) => {143 const owner = await helper.eth.createAccountWithBalance(donor);144 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);145 {146 const MAX_NAME_LENGTH = 64;147 const collectionName = 'A'.repeat(MAX_NAME_LENGTH + 1);148 const description = 'A';149 const tokenPrefix = 'A';150151 await expect(collectionHelper.methods152 .createFTCollection(collectionName, DECIMALS, description, tokenPrefix)153 .call({value: Number(2n * nominal)})).to.be.rejectedWith('name is too long. Max length is ' + MAX_NAME_LENGTH);154 }155 {156 const MAX_DESCRIPTION_LENGTH = 256;157 const collectionName = 'A';158 const description = 'A'.repeat(MAX_DESCRIPTION_LENGTH + 1);159 const tokenPrefix = 'A';160 await expect(collectionHelper.methods161 .createFTCollection(collectionName, DECIMALS, description, tokenPrefix)162 .call({value: Number(2n * nominal)})).to.be.rejectedWith('description is too long. Max length is ' + MAX_DESCRIPTION_LENGTH);163 }164 {165 const MAX_TOKEN_PREFIX_LENGTH = 16;166 const collectionName = 'A';167 const description = 'A';168 const tokenPrefix = 'A'.repeat(MAX_TOKEN_PREFIX_LENGTH + 1);169 await expect(collectionHelper.methods170 .createFTCollection(collectionName, DECIMALS, description, tokenPrefix)171 .call({value: Number(2n * nominal)})).to.be.rejectedWith('token_prefix is too long. Max length is ' + MAX_TOKEN_PREFIX_LENGTH);172 }173 });174 175 itEth('(!negative test!) cannot create collection if value !== 2', async ({helper}) => {176 const owner = await helper.eth.createAccountWithBalance(donor);177 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);178 const expects = [0n, 1n, 30n].map(async value => {179 await expect(collectionHelper.methods180 .createFTCollection('Peasantry', DECIMALS, 'absolutely anything', 'TWIW')181 .call({value: Number(value * nominal)})).to.be.rejectedWith('Sent amount not equals to collection creation price (2000000000000000000)');182 });183 await Promise.all(expects);184 });185186 // Soft-deprecated187 itEth('(!negative test!) [eth] Check owner', async ({helper}) => {188 const owner = await helper.eth.createAccountWithBalance(donor);189 const peasant = helper.eth.createAccount();190 const {collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Transgressed', DECIMALS, 'absolutely anything', 'YVNE');191 const peasantCollection = helper.ethNativeContract.collection(collectionAddress, 'ft', peasant, true);192 const EXPECTED_ERROR = 'NoPermission';193 {194 const sponsor = await helper.eth.createAccountWithBalance(donor);195 await expect(peasantCollection.methods196 .setCollectionSponsor(sponsor)197 .call()).to.be.rejectedWith(EXPECTED_ERROR);198 199 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'ft', sponsor, true);200 await expect(sponsorCollection.methods201 .confirmCollectionSponsorship()202 .call()).to.be.rejectedWith('ConfirmSponsorshipFail');203 }204 {205 await expect(peasantCollection.methods206 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)207 .call()).to.be.rejectedWith(EXPECTED_ERROR);208 }209 });210211 itEth('(!negative test!) [cross] Check owner', async ({helper}) => {212 const owner = await helper.eth.createAccountWithBalance(donor);213 const peasant = helper.eth.createAccount();214 const {collectionAddress} = await helper.eth.createFungibleCollection(owner, 'Transgressed', DECIMALS, 'absolutely anything', 'YVNE');215 const peasantCollection = helper.ethNativeContract.collection(collectionAddress, 'ft', peasant);216 const EXPECTED_ERROR = 'NoPermission';217 {218 const sponsor = await helper.eth.createAccountWithBalance(donor);219 const sponsorCross = helper.ethCrossAccount.fromAddress(sponsor);220 await expect(peasantCollection.methods221 .setCollectionSponsorCross(sponsorCross)222 .call()).to.be.rejectedWith(EXPECTED_ERROR);223 224 const sponsorCollection = helper.ethNativeContract.collection(collectionAddress, 'ft', sponsor);225 await expect(sponsorCollection.methods226 .confirmCollectionSponsorship()227 .call()).to.be.rejectedWith('ConfirmSponsorshipFail');228 }229 {230 await expect(peasantCollection.methods231 .setCollectionLimit(CollectionLimits.AccountTokenOwnership, true, 1000)232 .call()).to.be.rejectedWith(EXPECTED_ERROR);233 }234 }); 235});tests/src/eth/createNFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createNFTCollection.test.ts
+++ b/tests/src/eth/createNFTCollection.test.ts
@@ -132,6 +132,11 @@
expect(await helper.ethNativeContract.collectionHelpers(collectionAddress)
.methods.isCollectionExist(collectionAddress).call())
.to.be.true;
+
+ // check collectionOwner:
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'ft', owner, true);
+ const collectionOwner = await collectionEvm.methods.collectionOwner().call();
+ expect(helper.address.restoreCrossAccountFromBigInt(BigInt(collectionOwner.sub))).to.eq(helper.address.ethToSubstrate(owner));
});
});
tests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth--- a/tests/src/eth/createRFTCollection.test.ts
+++ b/tests/src/eth/createRFTCollection.test.ts
@@ -88,27 +88,6 @@
]);
});
- // this test will occasionally fail when in async environment.
- itEth.skip('Check collection address exist', async ({helper}) => {
- const owner = await helper.eth.createAccountWithBalance(donor);
-
- const expectedCollectionId = +(await helper.callRpc('api.rpc.unique.collectionStats')).created + 1;
- const expectedCollectionAddress = helper.ethAddress.fromCollectionId(expectedCollectionId);
- const collectionHelpers = helper.ethNativeContract.collectionHelpers(owner);
-
- expect(await collectionHelpers.methods
- .isCollectionExist(expectedCollectionAddress)
- .call()).to.be.false;
-
- await collectionHelpers.methods
- .createRFTCollection('A', 'A', 'A')
- .send({value: Number(2n * helper.balance.getOneTokenNominal())});
-
- expect(await collectionHelpers.methods
- .isCollectionExist(expectedCollectionAddress)
- .call()).to.be.true;
- });
-
// Soft-deprecated
itEth('[eth] Set sponsorship', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
@@ -164,6 +143,11 @@
expect(await helper.ethNativeContract.collectionHelpers(collectionAddress)
.methods.isCollectionExist(collectionAddress).call())
.to.be.true;
+
+ // check collectionOwner:
+ const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'ft', owner, true);
+ const collectionOwner = await collectionEvm.methods.collectionOwner().call();
+ expect(helper.address.restoreCrossAccountFromBigInt(BigInt(collectionOwner.sub))).to.eq(helper.address.ethToSubstrate(owner));
});
});
tests/src/eth/nonFungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -167,7 +167,6 @@
expect(event.returnValues.to).to.be.equal(receiver);
expect(await contract.methods.tokenURI(tokenId).call()).to.be.equal('Test URI');
- console.log(await contract.methods.crossOwnerOf(tokenId).call());
expect(await contract.methods.crossOwnerOf(tokenId).call()).to.be.like([receiver, '0']);
// TODO: this wont work right now, need release 919000 first
// await helper.methods.setOffchainSchema(collectionIdAddress, 'https://offchain-service.local/token-info/{id}').send();
@@ -200,8 +199,7 @@
},
};
});
-
-
+
const collection = await helper.nft.mintCollection(minter, {
tokenPrefix: 'ethp',
tokenPropertyPermissions: permissions,