difftreelog
fix PR
in: master
3 files changed
tests/src/eth/events.test.tsdiffbeforeafterboth--- a/tests/src/eth/events.test.ts
+++ b/tests/src/eth/events.test.ts
@@ -19,7 +19,7 @@
import {EthUniqueHelper, itEth, usingEthPlaygrounds} from './util';
import {IEvent, TCollectionMode} from '../util/playgrounds/types';
import {Pallets, requirePalletsOrSkip} from '../util';
-import {NormalizedEvent} from './util/playgrounds/types';
+import {EthTokenPermissions, NormalizedEvent} from './util/playgrounds/types';
let donor: IKeyringPair;
@@ -119,7 +119,13 @@
ethEvents.push(event);
});
const {unsubscribe, collectedEvents: subEvents} = await helper.subscribeEvents([{section: 'common', names: ['PropertyPermissionSet']}]);
- await collection.methods.setTokenPropertyPermissions([['testKey', [[0, true], [1, true], [2, true]]]]).send({from: owner});
+ await collection.methods.setTokenPropertyPermissions([
+ ['A', [
+ [EthTokenPermissions.Mutable, true],
+ [EthTokenPermissions.TokenOwner, true],
+ [EthTokenPermissions.CollectionAdmin, true]],
+ ],
+ ]).send({from: owner});
await helper.wait.newBlocks(1);
expect(ethEvents).to.be.like([
{
@@ -374,7 +380,13 @@
const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
const result = await collection.methods.mint(owner).send({from: owner});
const tokenId = result.events.Transfer.returnValues.tokenId;
- await collection.methods.setTokenPropertyPermissions([['A', [[0, true], [1, true], [2, true]]]]).send({from: owner});
+ await collection.methods.setTokenPropertyPermissions([
+ ['A', [
+ [EthTokenPermissions.Mutable, true],
+ [EthTokenPermissions.TokenOwner, true],
+ [EthTokenPermissions.CollectionAdmin, true]],
+ ],
+ ]).send({from: owner});
const ethEvents: any = [];
tests/src/eth/tokenProperties.test.tsdiffbeforeafterboth20import {ITokenPropertyPermission} from '../util/playgrounds/types';20import {ITokenPropertyPermission} from '../util/playgrounds/types';21import {Pallets} from '../util';21import {Pallets} from '../util';22import {UniqueNFTCollection, UniqueNFToken, UniqueRFTCollection} from '../util/playgrounds/unique';22import {UniqueNFTCollection, UniqueNFToken, UniqueRFTCollection} from '../util/playgrounds/unique';23import {EthTokenPermissions} from './util/playgrounds/types';232424describe('EVM token properties', () => {25describe('EVM token properties', () => {25 let donor: IKeyringPair;26 let donor: IKeyringPair;36 {mode: 'nft' as const, requiredPallets: []},37 {mode: 'nft' as const, requiredPallets: []},37 {mode: 'rft' as const, requiredPallets: [Pallets.ReFungible]},38 {mode: 'rft' as const, requiredPallets: [Pallets.ReFungible]},38 ].map(testCase =>39 ].map(testCase =>39 itEth.ifWithPallets.only(`[${testCase.mode}] Set and get token property permissions`, testCase.requiredPallets, async({helper}) => {40 itEth.ifWithPallets(`[${testCase.mode}] Set and get token property permissions`, testCase.requiredPallets, async({helper}) => {40 const owner = await helper.eth.createAccountWithBalance(donor);41 const owner = await helper.eth.createAccountWithBalance(donor);41 const caller = await helper.ethCrossAccount.createAccountWithBalance(donor);42 const caller = await helper.ethCrossAccount.createAccountWithBalance(donor);42 for(const [mutable,collectionAdmin, tokenOwner] of cartesian([], [false, true], [false, true], [false, true])) {43 for(const [mutable,collectionAdmin, tokenOwner] of cartesian([], [false, true], [false, true], [false, true])) {43 const {collectionId, collectionAddress} = await helper.eth.createCollection(testCase.mode, owner, 'A', 'B', 'C');44 const {collectionId, collectionAddress} = await helper.eth.createCollection(testCase.mode, owner, 'A', 'B', 'C');44 const collection = await helper.ethNativeContract.collection(collectionAddress, testCase.mode, owner);45 const collection = await helper.ethNativeContract.collection(collectionAddress, testCase.mode, owner);45 await collection.methods.addCollectionAdminCross(caller).send({from: owner});46 await collection.methods.addCollectionAdminCross(caller).send({from: owner});464747 await collection.methods.setTokenPropertyPermissions([['testKey', [[0, mutable], [1, tokenOwner], [2, collectionAdmin]]]]).send({from: caller.eth});48 await collection.methods.setTokenPropertyPermissions([48 49 ['testKey', [50 [EthTokenPermissions.Mutable, mutable], 51 [EthTokenPermissions.TokenOwner, tokenOwner], 52 [EthTokenPermissions.CollectionAdmin, collectionAdmin]],53 ],54 ]).send({from: caller.eth});55 49 expect(await helper[testCase.mode].getPropertyPermissions(collectionId)).to.be.deep.equal([{56 expect(await helper[testCase.mode].getPropertyPermissions(collectionId)).to.be.deep.equal([{52 }]);59 }]);536054 expect(await collection.methods.tokenPropertyPermissions().call({from: caller.eth})).to.be.like([61 expect(await collection.methods.tokenPropertyPermissions().call({from: caller.eth})).to.be.like([55 ['testKey', [['0', mutable], ['1', tokenOwner], ['2', collectionAdmin]]],62 ['testKey', [63 [EthTokenPermissions.Mutable.toString(), mutable], 64 [EthTokenPermissions.TokenOwner.toString(), tokenOwner], 65 [EthTokenPermissions.CollectionAdmin.toString(), collectionAdmin]],66 ],56 ]);67 ]);57 }68 }tests/src/eth/util/playgrounds/types.tsdiffbeforeafterboth--- a/tests/src/eth/util/playgrounds/types.ts
+++ b/tests/src/eth/util/playgrounds/types.ts
@@ -20,3 +20,8 @@
export type EthProperty = string[];
+export enum EthTokenPermissions {
+ Mutable,
+ TokenOwner,
+ CollectionAdmin
+}
\ No newline at end of file