difftreelog
chore fix tests
in: master
12 files changed
tests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth33 3334 const result = await collectionHelper.methods34 const result = await collectionHelper.methods35 .createNonfungibleCollection('A', 'B', 'C')35 .createNonfungibleCollection('A', 'B', 'C')36 .send();36 .send({value: Number(2n * UNIQUE)});37 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);37 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);383839 const newAdmin = createEthAccount(web3);39 const newAdmin = createEthAccount(web3);69 69 70 const result = await collectionHelper.methods70 const result = await collectionHelper.methods71 .createNonfungibleCollection('A', 'B', 'C')71 .createNonfungibleCollection('A', 'B', 'C')72 .send();72 .send({value: Number(2n * UNIQUE)});73 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);73 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);747475 const newAdmin = createEthAccount(web3);75 const newAdmin = createEthAccount(web3);85 85 86 const result = await collectionHelper.methods86 const result = await collectionHelper.methods87 .createNonfungibleCollection('A', 'B', 'C')87 .createNonfungibleCollection('A', 'B', 'C')88 .send();88 .send({value: Number(2n * UNIQUE)});89 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);89 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);909091 const admin = await createEthAccountWithBalance(api, web3, privateKeyWrapper);91 const admin = await createEthAccountWithBalance(api, web3, privateKeyWrapper);108 108 109 const result = await collectionHelper.methods109 const result = await collectionHelper.methods110 .createNonfungibleCollection('A', 'B', 'C')110 .createNonfungibleCollection('A', 'B', 'C')111 .send();111 .send({value: Number(2n * UNIQUE)});112 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);112 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);113113114 const notAdmin = await createEthAccountWithBalance(api, web3, privateKeyWrapper);114 const notAdmin = await createEthAccountWithBalance(api, web3, privateKeyWrapper);174 174 175 const result = await collectionHelper.methods175 const result = await collectionHelper.methods176 .createNonfungibleCollection('A', 'B', 'C')176 .createNonfungibleCollection('A', 'B', 'C')177 .send();177 .send({value: Number(2n * UNIQUE)});178 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);178 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);179179180 const newAdmin = createEthAccount(web3);180 const newAdmin = createEthAccount(web3);222 222 223 const result = await collectionHelper.methods223 const result = await collectionHelper.methods224 .createNonfungibleCollection('A', 'B', 'C')224 .createNonfungibleCollection('A', 'B', 'C')225 .send();225 .send({value: Number(2n * UNIQUE)});226 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);226 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);227227228 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);228 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);249 249 250 const result = await collectionHelper.methods250 const result = await collectionHelper.methods251 .createNonfungibleCollection('A', 'B', 'C')251 .createNonfungibleCollection('A', 'B', 'C')252 .send();252 .send({value: Number(2n * UNIQUE)});253 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);253 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);254254255 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);255 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);326 const collectionHelper = evmCollectionHelpers(web3, owner);326 const collectionHelper = evmCollectionHelpers(web3, owner);327 const result = await collectionHelper.methods327 const result = await collectionHelper.methods328 .createNonfungibleCollection('A', 'B', 'C')328 .createNonfungibleCollection('A', 'B', 'C')329 .send();329 .send({value: Number(2n * UNIQUE)});330 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);330 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);331 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);331 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);332 332 342 const collectionHelper = evmCollectionHelpers(web3, owner);342 const collectionHelper = evmCollectionHelpers(web3, owner);343 const result = await collectionHelper.methods343 const result = await collectionHelper.methods344 .createNonfungibleCollection('A', 'B', 'C')344 .createNonfungibleCollection('A', 'B', 'C')345 .send();345 .send({value: Number(2n * UNIQUE)});346 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);346 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);347 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);347 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);348348357 const collectionHelper = evmCollectionHelpers(web3, owner);357 const collectionHelper = evmCollectionHelpers(web3, owner);358 const result = await collectionHelper.methods358 const result = await collectionHelper.methods359 .createNonfungibleCollection('A', 'B', 'C')359 .createNonfungibleCollection('A', 'B', 'C')360 .send();360 .send({value: Number(2n * UNIQUE)});361 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);361 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);362 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);362 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);363 363 tests/src/eth/collectionSponsoring.test.tsdiffbeforeafterboth1import {addToAllowListExpectSuccess, bigIntToSub, confirmSponsorshipExpectSuccess, createCollectionExpectSuccess, enablePublicMintingExpectSuccess, getDetailedCollectionInfo, setCollectionSponsorExpectSuccess} from '../util/helpers';1import {addToAllowListExpectSuccess, confirmSponsorshipExpectSuccess, createCollectionExpectSuccess, enablePublicMintingExpectSuccess, getDetailedCollectionInfo, setCollectionSponsorExpectSuccess, UNIQUE} from '../util/helpers';2import {itWeb3, createEthAccount, collectionIdToAddress, GAS_ARGS, normalizeEvents, createEthAccountWithBalance, evmCollectionHelpers, getCollectionAddressFromResult, evmCollection, ethBalanceViaSub} from './util/helpers';2import {itWeb3, createEthAccount, collectionIdToAddress, GAS_ARGS, normalizeEvents, createEthAccountWithBalance, evmCollectionHelpers, getCollectionAddressFromResult, evmCollection, ethBalanceViaSub} from './util/helpers';3import nonFungibleAbi from './nonFungibleAbi.json';3import nonFungibleAbi from './nonFungibleAbi.json';4import {expect} from 'chai';4import {expect} from 'chai';5import {evmToAddress} from '@polkadot/util-crypto';5import {evmToAddress} from '@polkadot/util-crypto';6import {submitTransactionAsync} from '../substrate/substrate-api';7import getBalance from '../substrate/get-balance';869describe('evm collection sponsoring', () => {7describe('evm collection sponsoring', () => {10 itWeb3('sponsors mint transactions', async ({web3, privateKeyWrapper}) => {8 itWeb3('sponsors mint transactions', async ({web3, privateKeyWrapper}) => {64 itWeb3('Remove sponsor', async ({api, web3, privateKeyWrapper}) => {62 itWeb3('Remove sponsor', async ({api, web3, privateKeyWrapper}) => {65 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);63 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);66 const collectionHelpers = evmCollectionHelpers(web3, owner);64 const collectionHelpers = evmCollectionHelpers(web3, owner);67 let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send();65 let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send({value: Number(2n * UNIQUE)});68 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);66 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);69 const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);67 const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);70 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);68 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);85 itWeb3('Sponsoring collection from evm address via access list', async ({api, web3, privateKeyWrapper}) => {83 itWeb3('Sponsoring collection from evm address via access list', async ({api, web3, privateKeyWrapper}) => {86 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);84 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);87 const collectionHelpers = evmCollectionHelpers(web3, owner);85 const collectionHelpers = evmCollectionHelpers(web3, owner);88 let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send();86 let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send({value: Number(2n * UNIQUE)});89 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);87 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);90 const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);88 const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);91 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);89 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);210 itWeb3('Check that transaction via EVM spend money from sponsor address', async ({api, web3, privateKeyWrapper}) => {208 itWeb3('Check that transaction via EVM spend money from sponsor address', async ({api, web3, privateKeyWrapper}) => {211 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);209 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);212 const collectionHelpers = evmCollectionHelpers(web3, owner);210 const collectionHelpers = evmCollectionHelpers(web3, owner);213 let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send();211 let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send({value: Number(2n * UNIQUE)});214 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);212 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);215 const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);213 const sponsor = await createEthAccountWithBalance(api, web3, privateKeyWrapper);216 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);214 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);tests/src/eth/createNFTCollection.test.tsdiffbeforeafterboth17import {evmToAddress} from '@polkadot/util-crypto';17import {evmToAddress} from '@polkadot/util-crypto';18import {IKeyringPair} from '@polkadot/types/types';18import {IKeyringPair} from '@polkadot/types/types';19import {expect, itEth, usingEthPlaygrounds} from './util/playgrounds';19import {expect, itEth, usingEthPlaygrounds} from './util/playgrounds';20import {UNIQUE} from '../util/helpers';202121describe('Create NFT collection from EVM', () => {22describe('Create NFT collection from EVM', () => {22 let donor: IKeyringPair;23 let donor: IKeyringPair;646565 await collectionHelpers.methods66 await collectionHelpers.methods66 .createNonfungibleCollection('A', 'A', 'A')67 .createNonfungibleCollection('A', 'A', 'A')67 .send();68 .send({value: Number(2n * UNIQUE)});68 69 69 expect(await collectionHelpers.methods70 expect(await collectionHelpers.methods70 .isCollectionExist(expectedCollectionAddress)71 .isCollectionExist(expectedCollectionAddress)164165165 await expect(collectionHelper.methods166 await expect(collectionHelper.methods166 .createNonfungibleCollection(collectionName, description, tokenPrefix)167 .createNonfungibleCollection(collectionName, description, tokenPrefix)167 .call()).to.be.rejectedWith('name is too long. Max length is ' + MAX_NAME_LENGTH);168 .call({value: Number(2n * UNIQUE)})).to.be.rejectedWith('name is too long. Max length is ' + MAX_NAME_LENGTH);168 169 169 }170 }170 {171 {174 const tokenPrefix = 'A';175 const tokenPrefix = 'A';175 await expect(collectionHelper.methods176 await expect(collectionHelper.methods176 .createNonfungibleCollection(collectionName, description, tokenPrefix)177 .createNonfungibleCollection(collectionName, description, tokenPrefix)177 .call()).to.be.rejectedWith('description is too long. Max length is ' + MAX_DESCRIPTION_LENGTH);178 .call({value: Number(2n * UNIQUE)})).to.be.rejectedWith('description is too long. Max length is ' + MAX_DESCRIPTION_LENGTH);178 }179 }179 {180 {180 const MAX_TOKEN_PREFIX_LENGTH = 16;181 const MAX_TOKEN_PREFIX_LENGTH = 16;183 const tokenPrefix = 'A'.repeat(MAX_TOKEN_PREFIX_LENGTH + 1);184 const tokenPrefix = 'A'.repeat(MAX_TOKEN_PREFIX_LENGTH + 1);184 await expect(collectionHelper.methods185 await expect(collectionHelper.methods185 .createNonfungibleCollection(collectionName, description, tokenPrefix)186 .createNonfungibleCollection(collectionName, description, tokenPrefix)186 .call()).to.be.rejectedWith('token_prefix is too long. Max length is ' + MAX_TOKEN_PREFIX_LENGTH);187 .call({value: Number(2n * UNIQUE)})).to.be.rejectedWith('token_prefix is too long. Max length is ' + MAX_TOKEN_PREFIX_LENGTH);187 }188 }188 });189 });189 190 190 itEth('(!negative test!) Create collection (no funds)', async ({helper}) => {191 itEth('(!negative test!) Create collection (no funds)', async ({helper}) => {191 const owner = helper.eth.createAccount();192 const owner = await helper.eth.createAccountWithBalance(donor);192 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);193 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);193 await expect(collectionHelper.methods194 await expect(collectionHelper.methods194 .createNonfungibleCollection('Peasantry', 'absolutely anything', 'CVE')195 .createNonfungibleCollection('Peasantry', 'absolutely anything', 'CVE')195 .call()).to.be.rejectedWith('NotSufficientFounds');196 .call({value: Number(1n * UNIQUE)})).to.be.rejectedWith('Sent amount not equals to collection creation price (2000000000000000000)');196 });197 });197198198 itEth('(!negative test!) Check owner', async ({helper}) => {199 itEth('(!negative test!) Check owner', async ({helper}) => {tests/src/eth/createRFTCollection.test.tsdiffbeforeafterboth18import {IKeyringPair} from '@polkadot/types/types';18import {IKeyringPair} from '@polkadot/types/types';19import {Pallets, requirePalletsOrSkip} from '../util/playgrounds';19import {Pallets, requirePalletsOrSkip} from '../util/playgrounds';20import {expect, itEth, usingEthPlaygrounds} from './util/playgrounds';20import {expect, itEth, usingEthPlaygrounds} from './util/playgrounds';21import {UNIQUE} from '../util/helpers';212222describe('Create RFT collection from EVM', () => {23describe('Create RFT collection from EVM', () => {23 let donor: IKeyringPair;24 let donor: IKeyringPair;656666 await collectionHelpers.methods67 await collectionHelpers.methods67 .createRFTCollection('A', 'A', 'A')68 .createRFTCollection('A', 'A', 'A')68 .send();69 .send({value: Number(2n * UNIQUE)});69 70 70 expect(await collectionHelpers.methods71 expect(await collectionHelpers.methods71 .isCollectionExist(expectedCollectionAddress)72 .isCollectionExist(expectedCollectionAddress)166167167 await expect(collectionHelper.methods168 await expect(collectionHelper.methods168 .createRFTCollection(collectionName, description, tokenPrefix)169 .createRFTCollection(collectionName, description, tokenPrefix)169 .call()).to.be.rejectedWith('name is too long. Max length is ' + MAX_NAME_LENGTH);170 .call({value: Number(2n * UNIQUE)})).to.be.rejectedWith('name is too long. Max length is ' + MAX_NAME_LENGTH);170 }171 }171 {172 {172 const MAX_DESCRIPTION_LENGTH = 256;173 const MAX_DESCRIPTION_LENGTH = 256;175 const tokenPrefix = 'A';176 const tokenPrefix = 'A';176 await expect(collectionHelper.methods177 await expect(collectionHelper.methods177 .createRFTCollection(collectionName, description, tokenPrefix)178 .createRFTCollection(collectionName, description, tokenPrefix)178 .call()).to.be.rejectedWith('description is too long. Max length is ' + MAX_DESCRIPTION_LENGTH);179 .call({value: Number(2n * UNIQUE)})).to.be.rejectedWith('description is too long. Max length is ' + MAX_DESCRIPTION_LENGTH);179 }180 }180 {181 {181 const MAX_TOKEN_PREFIX_LENGTH = 16;182 const MAX_TOKEN_PREFIX_LENGTH = 16;184 const tokenPrefix = 'A'.repeat(MAX_TOKEN_PREFIX_LENGTH + 1);185 const tokenPrefix = 'A'.repeat(MAX_TOKEN_PREFIX_LENGTH + 1);185 await expect(collectionHelper.methods186 await expect(collectionHelper.methods186 .createRFTCollection(collectionName, description, tokenPrefix)187 .createRFTCollection(collectionName, description, tokenPrefix)187 .call()).to.be.rejectedWith('token_prefix is too long. Max length is ' + MAX_TOKEN_PREFIX_LENGTH);188 .call({value: Number(2n * UNIQUE)})).to.be.rejectedWith('token_prefix is too long. Max length is ' + MAX_TOKEN_PREFIX_LENGTH);188 }189 }189 });190 });190 191 191 itEth('(!negative test!) Create collection (no funds)', async ({helper}) => {192 itEth('(!negative test!) Create collection (no funds)', async ({helper}) => {192 const owner = helper.eth.createAccount();193 const owner = await helper.eth.createAccountWithBalance(donor);193 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);194 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);194 await expect(collectionHelper.methods195 await expect(collectionHelper.methods195 .createRFTCollection('Peasantry', 'absolutely anything', 'TWIW')196 .createRFTCollection('Peasantry', 'absolutely anything', 'TWIW')196 .call()).to.be.rejectedWith('NotSufficientFounds');197 .call({value: Number(1n * UNIQUE)})).to.be.rejectedWith('Sent amount not equals to collection creation price (2000000000000000000)');197 });198 });198199199 itEth('(!negative test!) Check owner', async ({helper}) => {200 itEth('(!negative test!) Check owner', async ({helper}) => {tests/src/eth/fractionalizer/Fractionalizer.soldiffbeforeafterboth81 string calldata _name,81 string calldata _name,82 string calldata _description,82 string calldata _description,83 string calldata _tokenPrefix83 string calldata _tokenPrefix84 ) external onlyOwner {84 ) external payable onlyOwner {85 require(rftCollection == address(0), "RFT collection is already set");85 require(rftCollection == address(0), "RFT collection is already set");86 address collectionHelpers = 0x6C4E9fE1AE37a41E93CEE429e8E1881aBdcbb54F;86 address collectionHelpers = 0x6C4E9fE1AE37a41E93CEE429e8E1881aBdcbb54F;87 rftCollection = CollectionHelpers(collectionHelpers).createRFTCollection(_name, _description, _tokenPrefix);87 rftCollection = CollectionHelpers(collectionHelpers).createRFTCollection{value: msg.value}(_name, _description, _tokenPrefix);88 emit RFTCollectionSet(rftCollection);88 emit RFTCollectionSet(rftCollection);89 }89 }9090tests/src/eth/fractionalizer/fractionalizer.test.tsdiffbeforeafterboth93 const fractionalizer = await deployFractionalizer(web3, owner);93 const fractionalizer = await deployFractionalizer(web3, owner);94 const amount = 10n * UNIQUE;94 const amount = 10n * UNIQUE;95 await web3.eth.sendTransaction({from: owner, to: fractionalizer.options.address, value: `${amount}`, ...GAS_ARGS});95 await web3.eth.sendTransaction({from: owner, to: fractionalizer.options.address, value: `${amount}`, ...GAS_ARGS});96 const result = await fractionalizer.methods.createAndSetRFTCollection('A', 'B', 'C').send();96 const result = await fractionalizer.methods.createAndSetRFTCollection('A', 'B', 'C').send({value: Number(2n * UNIQUE)});97 const rftCollectionAddress = result.events.RFTCollectionSet.returnValues._collection;97 const rftCollectionAddress = result.events.RFTCollectionSet.returnValues._collection;98 return {fractionalizer, rftCollectionAddress};98 return {fractionalizer, rftCollectionAddress};99}99}141 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);141 const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);142 const fractionalizer = await deployFractionalizer(web3, owner);142 const fractionalizer = await deployFractionalizer(web3, owner);143 const tx = api.tx.balances.transfer(evmToAddress(fractionalizer.options.address), 10n * UNIQUE);143 const tx = api.tx.balances.transfer(evmToAddress(fractionalizer.options.address), 10n * UNIQUE);144 await submitTransactionAsync(alice, tx);144 await executeTransaction(api, alice, tx);145145146 const result = await fractionalizer.methods.createAndSetRFTCollection('A', 'B', 'C').send({from: owner});146 const result = await fractionalizer.methods.createAndSetRFTCollection('A', 'B', 'C').send({from: owner, value: Number(2n * UNIQUE)});147 expect(result.events).to.be.like({147 expect(result.events).to.be.like({148 RFTCollectionSet: {},148 RFTCollectionSet: {},149 });149 });295 const tx = api.tx.balances.transfer(evmToAddress(fractionalizer.options.address), 10n * UNIQUE);295 const tx = api.tx.balances.transfer(evmToAddress(fractionalizer.options.address), 10n * UNIQUE);296 await submitTransactionAsync(alice, tx);296 await submitTransactionAsync(alice, tx);297297298 const result = await fractionalizer.methods.createAndSetRFTCollection('A', 'B', 'C').send({from: owner});298 const result = await fractionalizer.methods.createAndSetRFTCollection('A', 'B', 'C').send({from: owner, value: Number(2n * UNIQUE)});299 const collectionIdAddress = result.events.RFTCollectionSet.returnValues._collection;299 const collectionIdAddress = result.events.RFTCollectionSet.returnValues._collection;300300301 await expect(fractionalizer.methods.setRFTCollection(collectionIdAddress).call())301 await expect(fractionalizer.methods.setRFTCollection(collectionIdAddress).call())tests/src/eth/nonFungible.test.tsdiffbeforeafterboth17import {itEth, usingEthPlaygrounds, expect, EthUniqueHelper} from './util/playgrounds';17import {itEth, usingEthPlaygrounds, expect, EthUniqueHelper} from './util/playgrounds';18import {IKeyringPair} from '@polkadot/types/types';18import {IKeyringPair} from '@polkadot/types/types';19import {Contract} from 'web3-eth-contract';19import {Contract} from 'web3-eth-contract';20import {UNIQUE} from '../util/helpers';202121describe('NFT: Information getting', () => {22describe('NFT: Information getting', () => {22 let donor: IKeyringPair;23 let donor: IKeyringPair;83 const receiver = helper.eth.createAccount();84 const receiver = helper.eth.createAccount();848585 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);86 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);86 let result = await collectionHelper.methods.createERC721MetadataCompatibleCollection('Mint collection', 'a', 'b', tokenPrefix).send();87 let result = await collectionHelper.methods.createERC721MetadataCompatibleCollection('Mint collection', 'a', 'b', tokenPrefix).send({value: Number(2n * UNIQUE)});87 const collectionAddress = helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);88 const collectionAddress = helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);88 const contract = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);89 const contract = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);89 90 tests/src/eth/proxy/nonFungibleProxy.test.tsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617import {createCollectionExpectSuccess, createItemExpectSuccess} from '../../util/helpers';17import {createCollectionExpectSuccess, createItemExpectSuccess, UNIQUE} from '../../util/helpers';18import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, evmCollection, evmCollectionHelpers, GAS_ARGS, getCollectionAddressFromResult, itWeb3, normalizeEvents} from '../util/helpers';18import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, evmCollection, evmCollectionHelpers, GAS_ARGS, getCollectionAddressFromResult, itWeb3, normalizeEvents} from '../util/helpers';19import nonFungibleAbi from '../nonFungibleAbi.json';19import nonFungibleAbi from '../nonFungibleAbi.json';20import {expect} from 'chai';20import {expect} from 'chai';93 const collectionHelper = evmCollectionHelpers(web3, owner);93 const collectionHelper = evmCollectionHelpers(web3, owner);94 const result = await collectionHelper.methods94 const result = await collectionHelper.methods95 .createNonfungibleCollection('A', 'A', 'A')95 .createNonfungibleCollection('A', 'A', 'A')96 .send();96 .send({value: Number(2n * UNIQUE)});97 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);97 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);98 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);98 const caller = await createEthAccountWithBalance(api, web3, privateKeyWrapper);99 const receiver = createEthAccount(web3);99 const receiver = createEthAccount(web3);tests/src/eth/reFungibleToken.test.tsdiffbeforeafterboth18import {EthUniqueHelper, expect, itEth, usingEthPlaygrounds} from './util/playgrounds';18import {EthUniqueHelper, expect, itEth, usingEthPlaygrounds} from './util/playgrounds';19import {IKeyringPair} from '@polkadot/types/types';19import {IKeyringPair} from '@polkadot/types/types';20import {Contract} from 'web3-eth-contract';20import {Contract} from 'web3-eth-contract';21import {UNIQUE} from '../util/helpers';212222describe('Refungible token: Information getting', () => {23describe('Refungible token: Information getting', () => {23 let donor: IKeyringPair;24 let donor: IKeyringPair;80 const receiver = helper.eth.createAccount();81 const receiver = helper.eth.createAccount();818282 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);83 const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);83 let result = await collectionHelper.methods.createERC721MetadataCompatibleCollection('Mint collection', 'a', 'b', tokenPrefix).send();84 let result = await collectionHelper.methods.createERC721MetadataCompatibleCollection('Mint collection', 'a', 'b', tokenPrefix).send({value: Number(2n * UNIQUE)});84 const collectionAddress = helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);85 const collectionAddress = helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);85 const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);86 const contract = helper.ethNativeContract.collection(collectionAddress, 'rft', owner);86 87 tests/src/eth/util/helpers.tsdiffbeforeafterboth145 const collectionHelper = evmCollectionHelpers(web3, owner);145 const collectionHelper = evmCollectionHelpers(web3, owner);146 const result = await collectionHelper.methods146 const result = await collectionHelper.methods147 .createRFTCollection('A', 'B', 'C')147 .createRFTCollection('A', 'B', 'C')148 .send();148 .send({value: Number(2n * UNIQUE)});149 return await getCollectionAddressFromResult(api, result);149 return await getCollectionAddressFromResult(api, result);150}150}151151154 const collectionHelper = evmCollectionHelpers(web3, owner);154 const collectionHelper = evmCollectionHelpers(web3, owner);155 const result = await collectionHelper.methods155 const result = await collectionHelper.methods156 .createNonfungibleCollection('A', 'B', 'C')156 .createNonfungibleCollection('A', 'B', 'C')157 .send();157 .send({value: Number(2n * UNIQUE)});158 return await getCollectionAddressFromResult(api, result);158 return await getCollectionAddressFromResult(api, result);159}159}160160tests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth170 }170 }171171172 async createNonfungibleCollection(signer: string, name: string, description: string, tokenPrefix: string): Promise<{collectionId: number, collectionAddress: string}> {172 async createNonfungibleCollection(signer: string, name: string, description: string, tokenPrefix: string): Promise<{collectionId: number, collectionAddress: string}> {173 const collectionCreationPrice = this.helper.balance.getCollectionCreationPrice();173 const collectionHelper = this.helper.ethNativeContract.collectionHelpers(signer);174 const collectionHelper = this.helper.ethNativeContract.collectionHelpers(signer);174175 175 const result = await collectionHelper.methods.createNonfungibleCollection(name, description, tokenPrefix).send();176 const result = await collectionHelper.methods.createNonfungibleCollection(name, description, tokenPrefix).send({value: Number(collectionCreationPrice)});176177177 const collectionAddress = this.helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);178 const collectionAddress = this.helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);178 const collectionId = this.helper.ethAddress.extractCollectionId(collectionAddress);179 const collectionId = this.helper.ethAddress.extractCollectionId(collectionAddress);181 }182 }182183183 async createRefungibleCollection(signer: string, name: string, description: string, tokenPrefix: string): Promise<{collectionId: number, collectionAddress: string}> {184 async createRefungibleCollection(signer: string, name: string, description: string, tokenPrefix: string): Promise<{collectionId: number, collectionAddress: string}> {185 const collectionCreationPrice = this.helper.balance.getCollectionCreationPrice();184 const collectionHelper = this.helper.ethNativeContract.collectionHelpers(signer);186 const collectionHelper = this.helper.ethNativeContract.collectionHelpers(signer);185187 186 const result = await collectionHelper.methods.createRFTCollection(name, description, tokenPrefix).send();188 const result = await collectionHelper.methods.createRFTCollection(name, description, tokenPrefix).send({value: Number(collectionCreationPrice)});187189188 const collectionAddress = this.helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);190 const collectionAddress = this.helper.ethAddress.normalizeAddress(result.events.CollectionCreated.returnValues.collectionId);189 const collectionId = this.helper.ethAddress.extractCollectionId(collectionAddress);191 const collectionId = this.helper.ethAddress.extractCollectionId(collectionAddress);tests/src/util/playgrounds/unique.tsdiffbeforeafterboth20342034203520352036class BalanceGroup extends HelperGroup {2036class BalanceGroup extends HelperGroup {2037 getCollectionCreationPrice(): bigint {2038 return 2n * this.helper.balance.getOneTokenNominal();2039 }2037 /**2040 /**2038 * Representation of the native token in the smallest unit - one OPAL (OPL), QUARTZ (QTZ), or UNIQUE (UNQ).2041 * Representation of the native token in the smallest unit - one OPAL (OPL), QUARTZ (QTZ), or UNIQUE (UNQ).2039 * @example getOneTokenNominal()2042 * @example getOneTokenNominal()