git.delta.rocks / unique-network / refs/commits / 99b194acc32e

difftreelog

test fix marketplace config

Yaroslav Bolyukin2021-11-29parent: #6bc741d.patch.diff
in: master

1 file changed

modifiedtests/src/eth/marketplace/marketplace.test.tsdiffbeforeafterboth
1import {readFile} from 'fs/promises';1import {readFile} from 'fs/promises';
2import {getBalanceSingle, transferBalanceExpectSuccess} from '../../substrate/get-balance';2import {getBalanceSingle, transferBalanceExpectSuccess} from '../../substrate/get-balance';
3import privateKey from '../../substrate/privateKey';3import privateKey from '../../substrate/privateKey';
4import {addToAllowListExpectSuccess, confirmSponsorshipExpectSuccess, createCollectionExpectSuccess, createFungibleItemExpectSuccess, createItemExpectSuccess, getTokenOwner, setCollectionSponsorExpectSuccess, transferExpectSuccess, transferFromExpectSuccess} from '../../util/helpers';4import {addToAllowListExpectSuccess, confirmSponsorshipExpectSuccess, createCollectionExpectSuccess, createFungibleItemExpectSuccess, createItemExpectSuccess, getTokenOwner, setCollectionLimitsExpectSuccess, setCollectionSponsorExpectSuccess, transferExpectSuccess, transferFromExpectSuccess} from '../../util/helpers';
5import {collectionIdToAddress, contractHelpers, createEthAccountWithBalance, executeEthTxOnSub, GAS_ARGS, itWeb3, subToEth, subToEthLowercase, transferBalanceToEth} from '../util/helpers';5import {collectionIdToAddress, contractHelpers, createEthAccountWithBalance, executeEthTxOnSub, GAS_ARGS, itWeb3, subToEth, subToEthLowercase, transferBalanceToEth} from '../util/helpers';
6import {evmToAddress} from '@polkadot/util-crypto';6import {evmToAddress} from '@polkadot/util-crypto';
7import nonFungibleAbi from '../nonFungibleAbi.json';7import nonFungibleAbi from '../nonFungibleAbi.json';
25 await transferBalanceToEth(api, alice, matcher.options.address);25 await transferBalanceToEth(api, alice, matcher.options.address);
2626
27 const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});27 const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
28 await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorApproveTimeout: 1});
28 const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId), {from: matcherOwner});29 const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId), {from: matcherOwner});
29 await setCollectionSponsorExpectSuccess(collectionId, alice.address);30 await setCollectionSponsorExpectSuccess(collectionId, alice.address);
31 await transferBalanceToEth(api, alice, subToEth(alice.address));
30 await confirmSponsorshipExpectSuccess(collectionId);32 await confirmSponsorshipExpectSuccess(collectionId);
3133
32 await helpers.methods.toggleAllowed(matcher.options.address, subToEth(alice.address), true).send({from: matcherOwner});34 await helpers.methods.toggleAllowed(matcher.options.address, subToEth(alice.address), true).send({from: matcherOwner});
33 await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(alice.address)));35 await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(alice.address)));
3436
35 const seller = privateKey('//Bob');37 const seller = privateKey(`//Seller/${Date.now()}`);
36 await helpers.methods.toggleAllowed(matcher.options.address, subToEth(seller.address), true).send({from: matcherOwner});38 await helpers.methods.toggleAllowed(matcher.options.address, subToEth(seller.address), true).send({from: matcherOwner});
37 await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(seller.address)));
3839
39 const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', seller.address);40 const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', seller.address);
4041
151 await transferBalanceToEth(api, alice, matcher.options.address);152 await transferBalanceToEth(api, alice, matcher.options.address);
152153
153 const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});154 const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
155 await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorApproveTimeout: 1});
154 const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId), {from: matcherOwner});156 const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId), {from: matcherOwner});
155 await setCollectionSponsorExpectSuccess(collectionId, alice.address);157 await setCollectionSponsorExpectSuccess(collectionId, alice.address);
158 await transferBalanceToEth(api, alice, subToEth(alice.address));
156 await confirmSponsorshipExpectSuccess(collectionId);159 await confirmSponsorshipExpectSuccess(collectionId);
157160
158 await helpers.methods.toggleAllowed(matcher.options.address, subToEth(alice.address), true).send({from: matcherOwner});161 await helpers.methods.toggleAllowed(matcher.options.address, subToEth(alice.address), true).send({from: matcherOwner});
159 await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(alice.address)));162 await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(alice.address)));
160163
161 const seller = privateKey('//Bob');164 const seller = privateKey(`//Seller/${Date.now()}`);
162 await helpers.methods.toggleAllowed(matcher.options.address, subToEth(seller.address), true).send({from: matcherOwner});165 await helpers.methods.toggleAllowed(matcher.options.address, subToEth(seller.address), true).send({from: matcherOwner});
163 await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(seller.address)));
164166
165 const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', seller.address);167 const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', seller.address);
166168