difftreelog
Check isOwnerOrAdminCross for rft, nft and ft
in: master
+ Remove only for vesting test
2 files changed
tests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth151516import {IKeyringPair} from '@polkadot/types/types';16import {IKeyringPair} from '@polkadot/types/types';17import {expect} from 'chai';17import {expect} from 'chai';18import {Pallets} from '../util';18import {IEthCrossAccountId} from '../util/playgrounds/types';19import {IEthCrossAccountId} from '../util/playgrounds/types';19import {usingEthPlaygrounds, itEth} from './util';20import {usingEthPlaygrounds, itEth} from './util';20import {EthUniqueHelper} from './util/playgrounds/unique.dev';21import {EthUniqueHelper} from './util/playgrounds/unique.dev';39 });40 });40 });41 });414243 [44 {mode: 'nft' as const, requiredPallets: []},45 {mode: 'rft' as const, requiredPallets: [Pallets.ReFungible]},46 {mode: 'ft' as const, requiredPallets: []},47 ].map(testCase => {42 itEth('can add account admin by owner', async ({helper, privateKey}) => {48 itEth.ifWithPallets(`can add account admin by owner for ${testCase.mode}`, testCase.requiredPallets, async ({helper, privateKey}) => {43 // arrange49 // arrange44 const owner = await helper.eth.createAccountWithBalance(donor);50 const owner = await helper.eth.createAccountWithBalance(donor);45 const adminSub = await privateKey('//admin2');51 const adminSub = await privateKey('//admin2');49 const adminCrossSub = helper.ethCrossAccount.fromKeyringPair(adminSub);55 const adminCrossSub = helper.ethCrossAccount.fromKeyringPair(adminSub);50 const adminCrossEth = helper.ethCrossAccount.fromAddress(adminEth);56 const adminCrossEth = helper.ethCrossAccount.fromAddress(adminEth);51 57 52 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');58 const {collectionAddress, collectionId} = await helper.eth.createCollection(testCase.mode, owner, 'A', 'B', 'C');53 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);59 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, testCase.mode, owner, true);546061 // Check isOwnerOrAdminCross returns false:62 expect(await collectionEvm.methods.isOwnerOrAdminCross(adminCrossSub).call()).to.be.false;63 expect(await collectionEvm.methods.isOwnerOrAdminCross(adminCrossEth).call()).to.be.false;64 expect(await collectionEvm.methods.isOwnerOrAdminCross(helper.ethCrossAccount.fromAddress(adminDeprecated)).call()).to.be.false;65 55 // Soft-deprecated: can addCollectionAdmin 66 // Soft-deprecated: can addCollectionAdmin 56 await collectionEvm.methods.addCollectionAdmin(adminDeprecated).send();67 await collectionEvm.methods.addCollectionAdmin(adminDeprecated).send();70 });81 });71 expect(adminListRpc).to.be.like(adminListEth);82 expect(adminListRpc).to.be.like(adminListEth);8384 // 3. check isOwnerOrAdminCross returns true:85 expect(await collectionEvm.methods.isOwnerOrAdminCross(adminCrossSub).call()).to.be.true;86 expect(await collectionEvm.methods.isOwnerOrAdminCross(adminCrossEth).call()).to.be.true;87 expect(await collectionEvm.methods.isOwnerOrAdminCross(helper.ethCrossAccount.fromAddress(adminDeprecated)).call()).to.be.true;72 });88 });89 });739074 itEth('cross account admin can mint', async ({helper}) => {91 itEth('cross account admin can mint', async ({helper}) => {75 // arrange: create collection and accounts92 // arrange: create collection and accountstests/src/vesting.test.tsdiffbeforeafterboth28 });28 });29 });29 });303031 itSub.only('can perform vestedTransfer and claim tokens', async ({helper}) => {31 itSub('can perform vestedTransfer and claim tokens', async ({helper}) => {32 // arrange32 // arrange33 const [sender, recepient] = await helper.arrange.createAccounts([1000n, 1n], donor);33 const [sender, recepient] = await helper.arrange.createAccounts([1000n, 1n], donor);34 const currentRelayBlock = await helper.chain.getRelayBlockNumber();34 const currentRelayBlock = await helper.chain.getRelayBlockNumber();