difftreelog
fix after rebase
in: master
4 files changed
tests/src/eth/collectionLimits.test.tsdiffbeforeafterboth--- a/tests/src/eth/collectionLimits.test.ts
+++ b/tests/src/eth/collectionLimits.test.ts
@@ -13,13 +13,13 @@
});
[
- {case: 'nft' as const, method: 'createNFTCollection' as const},
- {case: 'rft' as const, method: 'createRFTCollection' as const, requiredPallets: [Pallets.ReFungible]},
- {case: 'ft' as const, method: 'createFTCollection' as const},
+ {case: 'nft' as const},
+ {case: 'rft' as const, requiredPallets: [Pallets.ReFungible]},
+ {case: 'ft' as const},
].map(testCase =>
itEth.ifWithPallets(`for ${testCase.case}`, testCase.requiredPallets || [], async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
- const {collectionId, collectionAddress} = await helper.eth.createCollecion(testCase.method, owner, 'Limits', 'absolutely anything', 'FLO', 18);
+ const {collectionId, collectionAddress} = await helper.eth.createCollection(testCase.case, owner, 'Limits', 'absolutely anything', 'FLO', 18);
const limits = {
accountTokenOwnershipLimit: 1000,
sponsoredDataSize: 1024,
@@ -71,9 +71,9 @@
});
[
- {case: 'nft' as const, method: 'createNFTCollection' as const},
- {case: 'rft' as const, method: 'createRFTCollection' as const, requiredPallets: [Pallets.ReFungible]},
- {case: 'ft' as const, method: 'createFTCollection' as const},
+ {case: 'nft' as const},
+ {case: 'rft' as const, requiredPallets: [Pallets.ReFungible]},
+ {case: 'ft' as const},
].map(testCase =>
itEth.ifWithPallets(`for ${testCase.case}`, testCase.requiredPallets || [], async ({helper}) => {
const invalidLimits = {
@@ -82,7 +82,7 @@
};
const owner = await helper.eth.createAccountWithBalance(donor);
- const {collectionAddress} = await helper.eth.createCollecion(testCase.method, owner, 'Limits', 'absolutely anything', 'ISNI', 18);
+ const {collectionAddress} = await helper.eth.createCollection(testCase.case, owner, 'Limits', 'absolutely anything', 'ISNI', 18);
const collectionEvm = helper.ethNativeContract.collection(collectionAddress, testCase.case, owner);
await expect(collectionEvm.methods
.setCollectionLimit('badLimit', '1')
tests/src/eth/collectionSponsoring.test.tsdiffbeforeafterboth--- a/tests/src/eth/collectionSponsoring.test.ts
+++ b/tests/src/eth/collectionSponsoring.test.ts
@@ -128,7 +128,7 @@
let sponsorship = (await collectionSub.getData())!.raw.sponsorship;
expect(sponsorship.Unconfirmed).to.be.eq(helper.address.ethToSubstrate(sponsorEth, true));
// Account cannot confirm sponsorship if it is not set as a sponsor
- await expect(collectionEvm.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('caller is not set as sponsor');
+ await expect(collectionEvm.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('ConfirmUnsetSponsorFail');
// Sponsor can confirm sponsorship:
await collectionEvm.methods.confirmCollectionSponsorship().send({from: sponsorEth});
@@ -173,7 +173,7 @@
tokenId: '1',
},
},
- ]);
+ );
const ownerBalanceAfter = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));
const sponsorBalanceAfter = await helper.balance.getSubstrate(helper.address.ethToSubstrate(sponsorEth));
@@ -289,7 +289,7 @@
tokenId: '1',
},
},
- ]);
+ );
expect(await collectionEvm.methods.tokenURI(tokenId).call({from: user})).to.be.equal('Test URI');
const ownerBalanceAfter = await helper.balance.getSubstrate(helper.address.ethToSubstrate(owner));
tests/src/eth/destroyCollection.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 {Pallets} from '../util';19import {expect, itEth, usingEthPlaygrounds} from './util';2021describe('Destroy Collection from EVM', function() {22 let donor: IKeyringPair;23 const testCases = [24 {method: 'createRFTCollection' as const, params: ['Limits', 'absolutely anything', 'OLF'], requiredPallets: [Pallets.ReFungible]},25 {method: 'createNFTCollection' as const, params: ['Limits', 'absolutely anything', 'OLF'], requiredPallets: [Pallets.NFT]},26 {method: 'createFTCollection' as const, params: ['Limits', 'absolutely anything', 'OLF', 18], requiredPallets: [Pallets.Fungible]},27 ];2829 before(async function() {30 await usingEthPlaygrounds(async (_, privateKey) => {31 donor = await privateKey({filename: __filename});32 });33 });3435 testCases.map((testCase) => 36 itEth.ifWithPallets(`Cannot burn non-owned or non-existing collection ${testCase.method}`, testCase.requiredPallets, async ({helper}) => {37 const owner = await helper.eth.createAccountWithBalance(donor);38 const signer = await helper.eth.createAccountWithBalance(donor);39 40 const unexistedCollection = helper.ethAddress.fromCollectionId(1000000);41 42 const collectionHelpers = helper.ethNativeContract.collectionHelpers(signer);43 const {collectionAddress} = await helper.eth.createCollecion(testCase.method, owner, ...testCase.params as [string, string, string, number?]);4445 // cannot burn collec46 await expect(collectionHelpers.methods47 .destroyCollection(collectionAddress)48 .send({from: signer})).to.be.rejected;49 50 await expect(collectionHelpers.methods51 .destroyCollection(unexistedCollection)52 .send({from: signer})).to.be.rejected;53 54 expect(await collectionHelpers.methods55 .isCollectionExist(unexistedCollection)56 .call()).to.be.false;57 58 expect(await collectionHelpers.methods59 .isCollectionExist(collectionAddress)60 .call()).to.be.true;61 }));62});tests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth--- a/tests/src/eth/util/playgrounds/unique.dev.ts
+++ b/tests/src/eth/util/playgrounds/unique.dev.ts
@@ -202,7 +202,7 @@
const collectionHelper = this.helper.ethNativeContract.collectionHelpers(signer);
const functionName: string = this.createCollectionMethodName(mode);
- const functionParams = functionName === 'createFTCollection' ? [name, decimals, description, tokenPrefix] : [name, description, tokenPrefix];
+ const functionParams = mode === 'ft' ? [name, decimals, description, tokenPrefix] : [name, description, tokenPrefix];
const result = await collectionHelper.methods[functionName](...functionParams).send({value: Number(collectionCreationPrice)});
const collectionAddress = this.helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);
@@ -231,7 +231,7 @@
}
createFungibleCollection(signer: string, name: string, decimals: number, description: string, tokenPrefix: string): Promise<{ collectionId: number, collectionAddress: string, events: NormalizedEvent[]}> {
- return this.createCollecion('createFTCollection', signer, name, description, tokenPrefix, decimals);
+ return this.createCollection('ft', signer, name, description, tokenPrefix, decimals);
}
async createERC721MetadataCompatibleRFTCollection(signer: string, name: string, description: string, tokenPrefix: string, baseUri: string): Promise<{collectionId: number, collectionAddress: string, events: NormalizedEvent[] }> {