difftreelog
Skip rft tests
in: master
2 files changed
tests/src/eth/collectionLimits.test.tsdiffbeforeafterboth1import {IKeyringPair} from '@polkadot/types/types';1import {IKeyringPair} from '@polkadot/types/types';2import {Pallets} from '../util';2import {expect, itEth, usingEthPlaygrounds} from './util';3import {expect, itEth, usingEthPlaygrounds} from './util';3445131414 [15 [15 {case: 'nft' as const, method: 'createNFTCollection' as const},16 {case: 'nft' as const, method: 'createNFTCollection' as const},16 {case: 'rft' as const, method: 'createRFTCollection' as const},17 {case: 'rft' as const, method: 'createRFTCollection' as const, requiredPallets: [Pallets.ReFungible]},17 {case: 'ft' as const, method: 'createFTCollection' as const},18 {case: 'ft' as const, method: 'createFTCollection' as const},18 ].map(testCase =>19 ].map(testCase =>19 itEth(`for ${testCase.case}`, async ({helper}) => {20 itEth.ifWithPallets(`for ${testCase.case}`, testCase.requiredPallets || [], async ({helper}) => {20 const owner = await helper.eth.createAccountWithBalance(donor);21 const owner = await helper.eth.createAccountWithBalance(donor);21 const {collectionId, collectionAddress} = await helper.eth.createCollecion(testCase.method, owner, 'Limits', 'absolutely anything', 'FLO', 18);22 const {collectionId, collectionAddress} = await helper.eth.createCollecion(testCase.method, owner, 'Limits', 'absolutely anything', 'FLO', 18);22 const limits = {23 const limits = {717272 [73 [73 {case: 'nft' as const, method: 'createNFTCollection' as const},74 {case: 'nft' as const, method: 'createNFTCollection' as const},74 {case: 'rft' as const, method: 'createRFTCollection' as const},75 {case: 'rft' as const, method: 'createRFTCollection' as const, requiredPallets: [Pallets.ReFungible]},75 {case: 'ft' as const, method: 'createFTCollection' as const},76 {case: 'ft' as const, method: 'createFTCollection' as const},76 ].map(testCase =>77 ].map(testCase =>77 itEth(`for ${testCase.case}`, async ({helper}) => {78 itEth.ifWithPallets(`for ${testCase.case}`, testCase.requiredPallets || [], async ({helper}) => {78 const invalidLimits = {79 const invalidLimits = {79 accountTokenOwnershipLimit: BigInt(Number.MAX_SAFE_INTEGER),80 accountTokenOwnershipLimit: BigInt(Number.MAX_SAFE_INTEGER),80 transfersEnabled: 3,81 transfersEnabled: 3,tests/src/eth/collectionProperties.test.tsdiffbeforeafterboth18import {Pallets} from '../util';18import {Pallets} from '../util';19import {IProperty, ITokenPropertyPermission} from '../util/playgrounds/types';19import {IProperty, ITokenPropertyPermission} from '../util/playgrounds/types';20import {IKeyringPair} from '@polkadot/types/types';20import {IKeyringPair} from '@polkadot/types/types';21import {TCollectionMode} from '../util/playgrounds/types';222123describe('EVM collection properties', () => {22describe('EVM collection properties', () => {24 let donor: IKeyringPair;23 let donor: IKeyringPair;134 });133 });135 });134 });136135136 [137 const checkERC721Metadata = async (helper: EthUniqueHelper, mode: 'nft' | 'rft') => {137 {case: 'nft' as const},138 {case: 'rft' as const, requiredPallets: [Pallets.ReFungible]},139 ].map(testCase => 140 itEth.ifWithPallets(`ERC721Metadata property can be set for ${testCase.case} collection`, testCase.requiredPallets || [], async ({helper}) => {138 const caller = await helper.eth.createAccountWithBalance(donor);141 const caller = await helper.eth.createAccountWithBalance(donor);139 const bruh = await helper.eth.createAccountWithBalance(donor);142 const bruh = await helper.eth.createAccountWithBalance(donor);140143 143 const URI = 'uri1';146 const URI = 'uri1';144147 145 const collectionHelpers = helper.ethNativeContract.collectionHelpers(caller);148 const collectionHelpers = helper.ethNativeContract.collectionHelpers(caller);146 const creatorMethod = mode === 'rft' ? 'createRFTCollection' : 'createNFTCollection';149 const creatorMethod = testCase.case === 'rft' ? 'createRFTCollection' : 'createNFTCollection';147150 148 const {collectionId, collectionAddress} = await helper.eth[creatorMethod](caller, 'n', 'd', 'p');151 const {collectionId, collectionAddress} = await helper.eth[creatorMethod](caller, 'n', 'd', 'p');149 const bruhCross = helper.ethCrossAccount.fromAddress(bruh);152 const bruhCross = helper.ethCrossAccount.fromAddress(bruh);150153 151 const contract = helper.ethNativeContract.collectionById(collectionId, mode, caller);154 const contract = helper.ethNativeContract.collectionById(collectionId, testCase.case, caller);152 await contract.methods.addCollectionAdminCross(bruhCross).send(); // to check that admin will work too155 await contract.methods.addCollectionAdminCross(bruhCross).send(); // to check that admin will work too153156 154 const collection1 = helper.nft.getCollectionObject(collectionId);157 const collection1 = helper.nft.getCollectionObject(collectionId);204207 205 await contract.methods.setProperties(tokenId2, [{key: 'URISuffix', value: Buffer.from(SUFFIX)}]).send();208 await contract.methods.setProperties(tokenId2, [{key: 'URISuffix', value: Buffer.from(SUFFIX)}]).send();206 expect(await contract.methods.tokenURI(tokenId2).call()).to.equal(BASE_URI + SUFFIX);209 expect(await contract.methods.tokenURI(tokenId2).call()).to.equal(BASE_URI + SUFFIX);207 };210 }));208209 itEth('ERC721Metadata property can be set for NFT collection', async({helper}) => {210 await checkERC721Metadata(helper, 'nft');211 });212213 itEth.ifWithPallets('ERC721Metadata property can be set for RFT collection', [Pallets.ReFungible], async({helper}) => {214 await checkERC721Metadata(helper, 'rft');215 });216});211});217212218describe('EVM collection property', () => {213describe('EVM collection property', () => {224 });219 });225 });220 });226221222 [223 {case: 'nft' as const},224 {case: 'rft' as const, requiredPallets: [Pallets.ReFungible]},227 async function testSetReadProperties(helper: EthUniqueHelper, mode: TCollectionMode) {225 {case: 'ft' as const},226 ].map(testCase => 227 itEth.ifWithPallets(`can set/read properties ${testCase.case}`, testCase.requiredPallets || [], async ({helper}) => {228 const collection = await helper[mode].mintCollection(donor, {name: 'A', description: 'B', tokenPrefix: 'C'});228 const collection = await helper[testCase.case].mintCollection(donor, {name: 'A', description: 'B', tokenPrefix: 'C'});229229230 const sender = await helper.eth.createAccountWithBalance(donor, 100n);230 const sender = await helper.eth.createAccountWithBalance(donor, 100n);231 await collection.addAdmin(donor, {Ethereum: sender});231 await collection.addAdmin(donor, {Ethereum: sender});232232 233 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);233 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);234 const contract = helper.ethNativeContract.collection(collectionAddress, mode, sender);234 const contract = helper.ethNativeContract.collection(collectionAddress, testCase.case, sender);235235 236 const keys = ['key0', 'key1'];236 const keys = ['key0', 'key1'];237237 243 await contract.methods.setCollectionProperties(writeProperties).send();243 await contract.methods.setCollectionProperties(writeProperties).send();244 const readProperties = await contract.methods.collectionProperties([keys[0], keys[1]]).call();244 const readProperties = await contract.methods.collectionProperties([keys[0], keys[1]]).call();245 expect(readProperties).to.be.like(writeProperties);245 expect(readProperties).to.be.like(writeProperties);246 }246 }));247247248 itEth('Set/read properties ft', async ({helper}) => {248 [249 await testSetReadProperties(helper, 'ft');249 {case: 'nft' as const},250 });250 {case: 'rft' as const, requiredPallets: [Pallets.ReFungible]},251 itEth.ifWithPallets('Set/read properties rft', [Pallets.ReFungible], async ({helper}) => {252 await testSetReadProperties(helper, 'rft');253 });254 itEth('Set/read properties nft', async ({helper}) => {255 await testSetReadProperties(helper, 'nft');256 });257258 async function testDeleteProperties(helper: EthUniqueHelper, mode: TCollectionMode) {251 {case: 'ft' as const},252 ].map(testCase => 253 itEth.ifWithPallets(`can delete properties ${testCase.case}`, testCase.requiredPallets || [], async ({helper}) => {259 const collection = await helper[mode].mintCollection(donor, {name: 'A', description: 'B', tokenPrefix: 'C'});254 const collection = await helper[testCase.case].mintCollection(donor, {name: 'A', description: 'B', tokenPrefix: 'C'});260255261 const sender = await helper.eth.createAccountWithBalance(donor, 100n);256 const sender = await helper.eth.createAccountWithBalance(donor, 100n);262 await collection.addAdmin(donor, {Ethereum: sender});257 await collection.addAdmin(donor, {Ethereum: sender});263258 264 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);259 const collectionAddress = helper.ethAddress.fromCollectionId(collection.collectionId);265 const contract = helper.ethNativeContract.collection(collectionAddress, mode, sender);260 const contract = helper.ethNativeContract.collection(collectionAddress, testCase.case, sender);266261 267 const keys = ['key0', 'key1', 'key2', 'key3'];262 const keys = ['key0', 'key1', 'key2', 'key3'];268263 289 const readProperties = await contract.methods.collectionProperties([]).call();284 const readProperties = await contract.methods.collectionProperties([]).call();290 expect(readProperties).to.be.like(expectProperties);285 expect(readProperties).to.be.like(expectProperties);291 }286 }292 }287 }));293 294 itEth('Delete properties ft', async ({helper}) => {295 await testDeleteProperties(helper, 'ft');296 });297 itEth.ifWithPallets('Delete properties rft', [Pallets.ReFungible], async ({helper}) => {298 await testDeleteProperties(helper, 'rft');299 });300 itEth('Delete properties nft', async ({helper}) => {301 await testDeleteProperties(helper, 'nft');302 });303 304});288});305289