difftreelog
Quick fix for nesting tests
in: master
5 files changed
tests/src/nesting/graphs.test.tsdiffbeforeafterboth--- a/tests/src/nesting/graphs.test.ts
+++ b/tests/src/nesting/graphs.test.ts
@@ -14,7 +14,7 @@
* ```
*/
async function buildComplexObjectGraph(api: ApiPromise, sender: IKeyringPair): Promise<number> {
- const events = await executeTransaction(api, sender, api.tx.unique.createCollectionEx({mode: 'NFT', limits: {nestingRule: 'Owner'}}));
+ const events = await executeTransaction(api, sender, api.tx.unique.createCollectionEx({mode: 'NFT', permissions: {nesting: 'Owner'}}));
const {collectionId} = getCreateCollectionResult(events);
await executeTransaction(api, sender, api.tx.unique.createMultipleItemsEx(collectionId, {NFT: Array(8).fill({owner: {Substrate: sender.address}})}));
tests/src/nesting/nest.test.tsdiffbeforeafterboth10 enablePublicMintingExpectSuccess,10 enablePublicMintingExpectSuccess,11 getTokenOwner, 11 getTokenOwner,12 getTopmostTokenOwner,12 getTopmostTokenOwner,13 setCollectionLimitsExpectSuccess, 13 setCollectionPermissionsExceptSuccess,14 transferExpectFailure, 14 transferExpectFailure,15 transferExpectSuccess, 15 transferExpectSuccess,16 transferFromExpectSuccess,16 transferFromExpectSuccess,31 it('Performs the full suite: bundles a token, transfers, and allows to unnest', async () => {31 it('Performs the full suite: bundles a token, transfers, and allows to unnest', async () => {32 await usingApi(async api => {32 await usingApi(async api => {33 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});33 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});34 await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: 'Owner'});34 await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: 'Owner'});35 const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');35 const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');363637 // Create a nested token37 // Create a nested token63 it('NFT: allows an Owner to nest/unnest their token', async () => {63 it('NFT: allows an Owner to nest/unnest their token', async () => {64 await usingApi(async api => {64 await usingApi(async api => {65 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});65 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});66 await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: 'Owner'});66 await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: 'Owner'});67 const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');67 const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');686869 // Create a nested token69 // Create a nested token82 it('NFT: allows an Owner to nest/unnest their token (Restricted nesting)', async () => {82 it('NFT: allows an Owner to nest/unnest their token (Restricted nesting)', async () => {83 await usingApi(async api => {83 await usingApi(async api => {84 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});84 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});85 await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: {OwnerRestricted:[collection]}});85 await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: {OwnerRestricted:[collection]}});86 const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');86 const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');878788 // Create a nested token88 // Create a nested token103 it('Fungible: allows an Owner to nest/unnest their token', async () => {103 it('Fungible: allows an Owner to nest/unnest their token', async () => {104 await usingApi(async api => {104 await usingApi(async api => {105 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});105 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});106 await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: 'Owner'});106 await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: 'Owner'});107 const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT', {Substrate: alice.address});107 const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT', {Substrate: alice.address});108 const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};108 const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};109109130130131 const collectionFT = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});131 const collectionFT = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});132132133 await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: {OwnerRestricted:[collectionFT]}});133 await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: {OwnerRestricted: [collectionFT]}});134134135 // Create a nested token135 // Create a nested token136 await expect(executeTransaction(api, alice, api.tx.unique.createItem(136 await expect(executeTransaction(api, alice, api.tx.unique.createItem(150 it('ReFungible: allows an Owner to nest/unnest their token', async () => {150 it('ReFungible: allows an Owner to nest/unnest their token', async () => {151 await usingApi(async api => {151 await usingApi(async api => {152 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});152 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});153 await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: 'Owner'});153 await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: 'Owner'});154 const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT', {Substrate: alice.address});154 const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT', {Substrate: alice.address});155 const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};155 const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};156156177177178 const collectionRFT = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});178 const collectionRFT = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});179179180 await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: {OwnerRestricted:[collectionRFT]}});180 await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: {OwnerRestricted:[collectionRFT]}});181181182 // Create a nested token182 // Create a nested token183 await expect(executeTransaction(api, alice, api.tx.unique.createItem(183 await expect(executeTransaction(api, alice, api.tx.unique.createItem(204 it('Disallows excessive token nesting', async () => {204 it('Disallows excessive token nesting', async () => {205 await usingApi(async api => {205 await usingApi(async api => {206 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});206 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});207 await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: 'Owner'});207 await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: 'Owner'});208 const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');208 const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');209209210 // Create a nested-token matryoshka210 // Create a nested-token matryoshka226 it('NFT: disallows to nest token if nesting is disabled', async () => {226 it('NFT: disallows to nest token if nesting is disabled', async () => {227 await usingApi(async api => {227 await usingApi(async api => {228 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});228 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});229 await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: 'Disabled'});229 await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: 'Disabled'});230 const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');230 const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');231231232 // Try to create a nested token232 // Try to create a nested token248 it('NFT: disallows a non-Owner to nest someone else\'s token', async () => {248 it('NFT: disallows a non-Owner to nest someone else\'s token', async () => {249 await usingApi(async api => {249 await usingApi(async api => {250 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});250 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});251 await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: 'Owner'});251 await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: 'Owner'});252252253 await addToAllowListExpectSuccess(alice, collection, bob.address);253 await addToAllowListExpectSuccess(alice, collection, bob.address);254 await enableAllowListExpectSuccess(alice, collection);254 await enableAllowListExpectSuccess(alice, collection);274 it('NFT: disallows a non-Owner to nest someone else\'s token (Restricted nesting)', async () => {274 it('NFT: disallows a non-Owner to nest someone else\'s token (Restricted nesting)', async () => {275 await usingApi(async api => {275 await usingApi(async api => {276 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});276 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});277 await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: {OwnerRestricted:[collection]}});277 await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: {OwnerRestricted:[collection]}});278278279 await addToAllowListExpectSuccess(alice, collection, bob.address);279 await addToAllowListExpectSuccess(alice, collection, bob.address);280 await enableAllowListExpectSuccess(alice, collection);280 await enableAllowListExpectSuccess(alice, collection);300 it('NFT: disallows to nest token in an unlisted collection', async () => {300 it('NFT: disallows to nest token in an unlisted collection', async () => {301 await usingApi(async api => {301 await usingApi(async api => {302 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});302 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});303 await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: {OwnerRestricted:[]}});303 await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: {OwnerRestricted:[]}});304304305 // Create a token to attempt to be nested into305 // Create a token to attempt to be nested into306 const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');306 const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');324 it('Fungible: disallows to nest token if nesting is disabled', async () => {324 it('Fungible: disallows to nest token if nesting is disabled', async () => {325 await usingApi(async api => {325 await usingApi(async api => {326 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});326 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});327 await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: 'Disabled'});327 await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: 'Disabled'});328 const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT');328 const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT');329 const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};329 const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};330330352 it('Fungible: disallows a non-Owner to nest someone else\'s token', async () => {352 it('Fungible: disallows a non-Owner to nest someone else\'s token', async () => {353 await usingApi(async api => {353 await usingApi(async api => {354 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});354 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});355 await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: 'Owner'});355 await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: 'Owner'});356356357 await addToAllowListExpectSuccess(alice, collectionNFT, bob.address);357 await addToAllowListExpectSuccess(alice, collectionNFT, bob.address);358 await enableAllowListExpectSuccess(alice, collectionNFT);358 await enableAllowListExpectSuccess(alice, collectionNFT);389 const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};389 const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};390390391 const collectionFT = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});391 const collectionFT = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});392 await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: {OwnerRestricted:[collectionFT]}});392 await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: {OwnerRestricted:[collectionFT]}});393393394 // Try to create a nested token in the wrong collection394 // Try to create a nested token in the wrong collection395 await expect(executeTransaction(api, alice, api.tx.unique.createItem(395 await expect(executeTransaction(api, alice, api.tx.unique.createItem(407 it('Fungible: disallows to nest token in an unlisted collection', async () => {407 it('Fungible: disallows to nest token in an unlisted collection', async () => {408 await usingApi(async api => {408 await usingApi(async api => {409 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});409 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});410 await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: {OwnerRestricted:[]}});410 await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: {OwnerRestricted:[]}});411411412 // Create a token to attempt to be nested into412 // Create a token to attempt to be nested into413 const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT');413 const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT');433 it('ReFungible: disallows to nest token if nesting is disabled', async () => {433 it('ReFungible: disallows to nest token if nesting is disabled', async () => {434 await usingApi(async api => {434 await usingApi(async api => {435 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});435 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});436 await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: 'Disabled'});436 await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: 'Disabled'});437 const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT');437 const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT');438 const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};438 const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};439439463 it('ReFungible: disallows a non-Owner to nest someone else\'s token', async () => {463 it('ReFungible: disallows a non-Owner to nest someone else\'s token', async () => {464 await usingApi(async api => {464 await usingApi(async api => {465 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});465 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});466 await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: 'Owner'});466 await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: 'Owner'});467467468 await addToAllowListExpectSuccess(alice, collectionNFT, bob.address);468 await addToAllowListExpectSuccess(alice, collectionNFT, bob.address);469 await enableAllowListExpectSuccess(alice, collectionNFT);469 await enableAllowListExpectSuccess(alice, collectionNFT);500 const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};500 const targetAddress = {Ethereum: tokenIdToAddress(collectionNFT, targetToken)};501501502 const collectionRFT = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});502 const collectionRFT = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});503 await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: {OwnerRestricted:[collectionRFT]}});503 await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: {OwnerRestricted:[collectionRFT]}});504504505 // Try to create a nested token in the wrong collection505 // Try to create a nested token in the wrong collection506 await expect(executeTransaction(api, alice, api.tx.unique.createItem(506 await expect(executeTransaction(api, alice, api.tx.unique.createItem(518 it('ReFungible: disallows to nest token to an unlisted collection', async () => {518 it('ReFungible: disallows to nest token to an unlisted collection', async () => {519 await usingApi(async api => {519 await usingApi(async api => {520 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});520 const collectionNFT = await createCollectionExpectSuccess({mode: {type: 'NFT'}});521 await setCollectionLimitsExpectSuccess(alice, collectionNFT, {nestingRule: {OwnerRestricted:[]}});521 await setCollectionPermissionsExceptSuccess(alice, collectionNFT, {nesting: {OwnerRestricted:[]}});522522523 // Create a token to attempt to be nested into523 // Create a token to attempt to be nested into524 const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT');524 const targetToken = await createItemExpectSuccess(alice, collectionNFT, 'NFT');tests/src/nesting/rules-smoke.test.tsdiffbeforeafterboth--- a/tests/src/nesting/rules-smoke.test.ts
+++ b/tests/src/nesting/rules-smoke.test.ts
@@ -14,8 +14,8 @@
const bob = privateKey('//Bob');
const events = await executeTransaction(api, alice, api.tx.unique.createCollectionEx({
mode: 'NFT',
- limits: {
- nestingRule: {OwnerRestricted: []},
+ permissions: {
+ nesting: {OwnerRestricted: []},
},
}));
const collection = getCreateCollectionResult(events).collectionId;
@@ -39,7 +39,7 @@
it('called for nonfungible', async () => {
await usingApi(async api => {
const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
- await expect(executeTransaction(api, alice, api.tx.unique.createItem(collection, nestTarget, {NFT: {ConstData: []}})))
+ await expect(executeTransaction(api, alice, api.tx.unique.createItem(collection, nestTarget, {NFT: {properties: []}})))
.to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);
const token = await createItemExpectSuccess(alice, collection, 'NFT', {Substrate: alice.address});
@@ -51,7 +51,7 @@
it('called for refungible', async () => {
await usingApi(async api => {
const collection = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
- await expect(executeTransaction(api, alice, api.tx.unique.createItem(collection, nestTarget, {ReFungible: {ConstData: []}})))
+ await expect(executeTransaction(api, alice, api.tx.unique.createItem(collection, nestTarget, {ReFungible: {}})))
.to.be.rejectedWith(/^common\.SourceCollectionIsNotAllowedToNest$/);
const token = await createItemExpectSuccess(alice, collection, 'ReFungible', {Substrate: alice.address});
tests/src/nesting/unnest.test.tsdiffbeforeafterboth--- a/tests/src/nesting/unnest.test.ts
+++ b/tests/src/nesting/unnest.test.ts
@@ -8,7 +8,7 @@
getBalance,
getTokenOwner,
normalizeAccountId,
- setCollectionLimitsExpectSuccess,
+ setCollectionPermissionsExceptSuccess,
transferExpectSuccess,
transferFromExpectSuccess,
} from '../util/helpers';
@@ -28,7 +28,7 @@
it('NFT: allows the owner to successfully unnest a token', async () => {
await usingApi(async api => {
const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
- await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: 'Owner'});
+ await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: 'Owner'});
const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
const targetAddress = {Ethereum: tokenIdToAddress(collection, targetToken)};
@@ -57,7 +57,7 @@
it('Fungible: allows the owner to successfully unnest a token', async () => {
await usingApi(async api => {
const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
- await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: 'Owner'});
+ await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: 'Owner'});
const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
const targetAddress = {Ethereum: tokenIdToAddress(collection, targetToken)};
@@ -84,7 +84,7 @@
it('ReFungible: allows the owner to successfully unnest a token', async () => {
await usingApi(async api => {
const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
- await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: 'Owner'});
+ await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: 'Owner'});
const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
const targetAddress = {Ethereum: tokenIdToAddress(collection, targetToken)};
@@ -119,7 +119,7 @@
it('Disallows a non-owner to unnest/burn a token', async () => {
await usingApi(async api => {
const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
- await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: 'Owner'});
+ await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: 'Owner'});
const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
const targetAddress = {Ethereum: tokenIdToAddress(collection, targetToken)};
@@ -149,7 +149,7 @@
// Recursive nesting
it('Prevents Ouroboros creation', async () => {
const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
- await setCollectionLimitsExpectSuccess(alice, collection, {nestingRule: 'Owner'});
+ await setCollectionPermissionsExceptSuccess(alice, collection, {nesting: 'Owner'});
const targetToken = await createItemExpectSuccess(alice, collection, 'NFT');
// Create a nested token ouroboros
tests/src/util/helpers.tsdiffbeforeafterboth--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -325,7 +325,7 @@
};
export async function createCollectionExpectSuccess(params: Partial<CreateCollectionParams> = {}): Promise<number> {
- const {name, description, mode, tokenPrefix, schemaVersion} = {...defaultCreateCollectionParams, ...params};
+ const {name, description, mode, tokenPrefix} = {...defaultCreateCollectionParams, ...params};
let collectionId = 0;
await usingApi(async (api) => {
@@ -348,8 +348,7 @@
name: strToUTF16(name),
description: strToUTF16(description),
tokenPrefix: strToUTF16(tokenPrefix),
- mode: modeprm as any,
- schemaVersion: schemaVersion,
+ mode: modeprm as any
});
const events = await submitTransactionAsync(alicePrivateKey, tx);
const result = getCreateCollectionResult(events);
@@ -555,6 +554,16 @@
});
}
+export const setCollectionPermissionsExceptSuccess = async (sender: IKeyringPair, collectionId: number, permissions: {mintMode?: boolean, access?: 'Normal' | 'AllowList', nesting?: 'Disabled' | 'Owner' | {OwnerRestricted: number[]}}) => {
+ await usingApi(async(api) => {
+ const tx = api.tx.unique.setCollectionPermissions(collectionId, permissions);
+ const events = await submitTransactionAsync(sender, tx);
+ const result = getGenericResult(events);
+
+ expect(result.success).to.be.true;
+ });
+}
+
export async function setCollectionLimitsExpectFailure(sender: IKeyringPair, collectionId: number, limits: any) {
await usingApi(async (api) => {
const tx = api.tx.unique.setCollectionLimits(collectionId, limits);
@@ -1299,7 +1308,7 @@
// What to expect
// tslint:disable-next-line:no-unused-expression
expect(result.success).to.be.true;
- expect(collection.access.toHuman()).to.be.equal(accessMode);
+ expect(collection.permissions.access.toHuman()).to.be.equal(accessMode);
});
}
@@ -1344,7 +1353,7 @@
// Get the collection
const collection = await queryCollectionExpectSuccess(api, collectionId);
- expect(collection.mintMode.toHuman()).to.be.equal(enabled);
+ expect(collection.permissions.mintMode.toHuman()).to.be.equal(enabled);
});
}