git.delta.rocks / unique-network / refs/commits / a1997cfc97bc

difftreelog

refactor set_token_property_permissions

Fahrrader2022-06-15parent: #ed591ba.patch.diff
in: master

15 files changed

modifiedpallets/common/src/lib.rsdiffbeforeafterboth
1019 }1019 }
10201020
1021 #[transactional]1021 #[transactional]
1022 pub fn set_property_permissions(1022 pub fn set_token_property_permissions(
1023 collection: &CollectionHandle<T>,1023 collection: &CollectionHandle<T>,
1024 sender: &T::CrossAccountId,1024 sender: &T::CrossAccountId,
1025 property_permissions: Vec<PropertyKeyPermission>,1025 property_permissions: Vec<PropertyKeyPermission>,
1239 fn delete_collection_properties(amount: u32) -> Weight;1239 fn delete_collection_properties(amount: u32) -> Weight;
1240 fn set_token_properties(amount: u32) -> Weight;1240 fn set_token_properties(amount: u32) -> Weight;
1241 fn delete_token_properties(amount: u32) -> Weight;1241 fn delete_token_properties(amount: u32) -> Weight;
1242 fn set_property_permissions(amount: u32) -> Weight;1242 fn set_token_property_permissions(amount: u32) -> Weight;
1243 fn transfer() -> Weight;1243 fn transfer() -> Weight;
1244 fn approve() -> Weight;1244 fn approve() -> Weight;
1245 fn transfer_from() -> Weight;1245 fn transfer_from() -> Weight;
1318 token_id: TokenId,1318 token_id: TokenId,
1319 property_keys: Vec<PropertyKey>,1319 property_keys: Vec<PropertyKey>,
1320 ) -> DispatchResultWithPostInfo;1320 ) -> DispatchResultWithPostInfo;
1321 fn set_property_permissions(1321 fn set_token_property_permissions(
1322 &self,1322 &self,
1323 sender: &T::CrossAccountId,1323 sender: &T::CrossAccountId,
1324 property_permissions: Vec<PropertyKeyPermission>,1324 property_permissions: Vec<PropertyKeyPermission>,
modifiedpallets/fungible/src/common.rsdiffbeforeafterboth
72 072 0
73 }73 }
7474
75 fn set_property_permissions(_amount: u32) -> Weight {75 fn set_token_property_permissions(_amount: u32) -> Weight {
76 // Error76 // Error
77 077 0
78 }78 }
302 fail!(<Error<T>>::SettingPropertiesNotAllowed)302 fail!(<Error<T>>::SettingPropertiesNotAllowed)
303 }303 }
304304
305 fn set_property_permissions(305 fn set_token_property_permissions(
306 &self,306 &self,
307 _sender: &T::CrossAccountId,307 _sender: &T::CrossAccountId,
308 _property_permissions: Vec<PropertyKeyPermission>,308 _property_permissions: Vec<PropertyKeyPermission>,
modifiedpallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth
147 <Pallet<T>>::set_allowance(&collection, &sender, item, Some(&burner))?;147 <Pallet<T>>::set_allowance(&collection, &sender, item, Some(&burner))?;
148 }: {<Pallet<T>>::burn_from(&collection, &burner, &sender, item, &Unlimited)?}148 }: {<Pallet<T>>::burn_from(&collection, &burner, &sender, item, &Unlimited)?}
149149
150 set_property_permissions {150 set_token_property_permissions {
151 let b in 0..MAX_PROPERTIES_PER_ITEM;151 let b in 0..MAX_PROPERTIES_PER_ITEM;
152 bench_init!{152 bench_init!{
153 owner: sub; collection: collection(owner);153 owner: sub; collection: collection(owner);
161 token_owner: false,161 token_owner: false,
162 },162 },
163 }).collect::<Vec<_>>();163 }).collect::<Vec<_>>();
164 }: {<Pallet<T>>::set_property_permissions(&collection, &owner, perms)?}164 }: {<Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?}
165165
166 set_token_properties {166 set_token_properties {
167 let b in 0..MAX_PROPERTIES_PER_ITEM;167 let b in 0..MAX_PROPERTIES_PER_ITEM;
177 token_owner: true,177 token_owner: true,
178 },178 },
179 }).collect::<Vec<_>>();179 }).collect::<Vec<_>>();
180 <Pallet<T>>::set_property_permissions(&collection, &owner, perms)?;180 <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
181 let props = (0..b).map(|k| Property {181 let props = (0..b).map(|k| Property {
182 key: property_key(k as usize),182 key: property_key(k as usize),
183 value: property_value(),183 value: property_value(),
199 token_owner: true,199 token_owner: true,
200 },200 },
201 }).collect::<Vec<_>>();201 }).collect::<Vec<_>>();
202 <Pallet<T>>::set_property_permissions(&collection, &owner, perms)?;202 <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;
203 let props = (0..b).map(|k| Property {203 let props = (0..b).map(|k| Property {
204 key: property_key(k as usize),204 key: property_key(k as usize),
205 value: property_value(),205 value: property_value(),
modifiedpallets/nonfungible/src/common.rsdiffbeforeafterboth
89 <SelfWeightOf<T>>::delete_token_properties(amount)89 <SelfWeightOf<T>>::delete_token_properties(amount)
90 }90 }
9191
92 fn set_property_permissions(amount: u32) -> Weight {92 fn set_token_property_permissions(amount: u32) -> Weight {
93 <SelfWeightOf<T>>::set_property_permissions(amount)93 <SelfWeightOf<T>>::set_token_property_permissions(amount)
94 }94 }
9595
96 fn transfer() -> Weight {96 fn transfer() -> Weight {
242 )242 )
243 }243 }
244244
245 fn set_property_permissions(245 fn set_token_property_permissions(
246 &self,246 &self,
247 sender: &T::CrossAccountId,247 sender: &T::CrossAccountId,
248 property_permissions: Vec<PropertyKeyPermission>,248 property_permissions: Vec<PropertyKeyPermission>,
249 ) -> DispatchResultWithPostInfo {249 ) -> DispatchResultWithPostInfo {
250 let weight =250 let weight =
251 <CommonWeights<T>>::set_property_permissions(property_permissions.len() as u32);251 <CommonWeights<T>>::set_token_property_permissions(property_permissions.len() as u32);
252252
253 with_weight(253 with_weight(
254 <Pallet<T>>::set_property_permissions(self, sender, property_permissions),254 <Pallet<T>>::set_token_property_permissions(self, sender, property_permissions),
255 weight,255 weight,
256 )256 )
257 }257 }
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
594 <PalletCommon<T>>::delete_collection_properties(collection, sender, property_keys)594 <PalletCommon<T>>::delete_collection_properties(collection, sender, property_keys)
595 }595 }
596596
597 pub fn set_property_permissions(597 pub fn set_token_property_permissions(
598 collection: &CollectionHandle<T>,598 collection: &CollectionHandle<T>,
599 sender: &T::CrossAccountId,599 sender: &T::CrossAccountId,
600 property_permissions: Vec<PropertyKeyPermission>,600 property_permissions: Vec<PropertyKeyPermission>,
601 ) -> DispatchResult {601 ) -> DispatchResult {
602 <PalletCommon<T>>::set_property_permissions(collection, sender, property_permissions)602 <PalletCommon<T>>::set_token_property_permissions(collection, sender, property_permissions)
603 }603 }
604604
605 pub fn set_property_permission(605 pub fn set_property_permission(
modifiedpallets/nonfungible/src/weights.rsdiffbeforeafterboth
42 fn approve() -> Weight;42 fn approve() -> Weight;
43 fn transfer_from() -> Weight;43 fn transfer_from() -> Weight;
44 fn burn_from() -> Weight;44 fn burn_from() -> Weight;
45 fn set_property_permissions(b: u32) -> Weight;45 fn set_token_property_permissions(b: u32) -> Weight;
46 fn set_token_properties(b: u32) -> Weight;46 fn set_token_properties(b: u32) -> Weight;
47 fn delete_token_properties(b: u32) -> Weight;47 fn delete_token_properties(b: u32) -> Weight;
48}48}
159 .saturating_add(T::DbWeight::get().writes(5 as Weight))159 .saturating_add(T::DbWeight::get().writes(5 as Weight))
160 }160 }
161 // Storage: Common CollectionPropertyPermissions (r:1 w:1)161 // Storage: Common CollectionPropertyPermissions (r:1 w:1)
162 fn set_property_permissions(b: u32, ) -> Weight {162 fn set_token_property_permissions(b: u32, ) -> Weight {
163 (0 as Weight)163 (0 as Weight)
164 // Standard Error: 3_432_000164 // Standard Error: 3_432_000
165 .saturating_add((126_888_000 as Weight).saturating_mul(b as Weight))165 .saturating_add((126_888_000 as Weight).saturating_mul(b as Weight))
299 .saturating_add(RocksDbWeight::get().writes(5 as Weight))299 .saturating_add(RocksDbWeight::get().writes(5 as Weight))
300 }300 }
301 // Storage: Common CollectionPropertyPermissions (r:1 w:1)301 // Storage: Common CollectionPropertyPermissions (r:1 w:1)
302 fn set_property_permissions(b: u32, ) -> Weight {302 fn set_token_property_permissions(b: u32, ) -> Weight {
303 (0 as Weight)303 (0 as Weight)
304 // Standard Error: 3_432_000304 // Standard Error: 3_432_000
305 .saturating_add((126_888_000 as Weight).saturating_mul(b as Weight))305 .saturating_add((126_888_000 as Weight).saturating_mul(b as Weight))
modifiedpallets/refungible/src/common.rsdiffbeforeafterboth
85 <SelfWeightOf<T>>::delete_token_properties(amount)85 <SelfWeightOf<T>>::delete_token_properties(amount)
86 }86 }
8787
88 fn set_property_permissions(amount: u32) -> Weight {88 fn set_token_property_permissions(amount: u32) -> Weight {
89 <SelfWeightOf<T>>::set_property_permissions(amount)89 <SelfWeightOf<T>>::set_token_property_permissions(amount)
90 }90 }
9191
92 fn transfer() -> Weight {92 fn transfer() -> Weight {
315 fail!(<Error<T>>::SettingPropertiesNotAllowed)315 fail!(<Error<T>>::SettingPropertiesNotAllowed)
316 }316 }
317317
318 fn set_property_permissions(318 fn set_token_property_permissions(
319 &self,319 &self,
320 _sender: &T::CrossAccountId,320 _sender: &T::CrossAccountId,
321 _property_permissions: Vec<PropertyKeyPermission>,321 _property_permissions: Vec<PropertyKeyPermission>,
modifiedpallets/refungible/src/weights.rsdiffbeforeafterboth
40 fn burn_item_fully() -> Weight;40 fn burn_item_fully() -> Weight;
41 fn set_token_properties(amount: u32) -> Weight;41 fn set_token_properties(amount: u32) -> Weight;
42 fn delete_token_properties(amount: u32) -> Weight;42 fn delete_token_properties(amount: u32) -> Weight;
43 fn set_property_permissions(amount: u32) -> Weight;43 fn set_token_property_permissions(amount: u32) -> Weight;
44 fn transfer_normal() -> Weight;44 fn transfer_normal() -> Weight;
45 fn transfer_creating() -> Weight;45 fn transfer_creating() -> Weight;
46 fn transfer_removing() -> Weight;46 fn transfer_removing() -> Weight;
142 0142 0
143 }143 }
144144
145 fn set_property_permissions(_amount: u32) -> Weight {145 fn set_token_property_permissions(_amount: u32) -> Weight {
146 // Error146 // Error
147 0147 0
148 }148 }
320 0320 0
321 }321 }
322322
323 fn set_property_permissions(_amount: u32) -> Weight {323 fn set_token_property_permissions(_amount: u32) -> Weight {
324 // Error324 // Error
325 0325 0
326 }326 }
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
670 dispatch_tx::<T, _>(collection_id, |d| d.delete_token_properties(sender, token_id, property_keys))670 dispatch_tx::<T, _>(collection_id, |d| d.delete_token_properties(sender, token_id, property_keys))
671 }671 }
672672
673 #[weight = T::CommonWeightInfo::set_property_permissions(property_permissions.len() as u32)]673 #[weight = T::CommonWeightInfo::set_token_property_permissions(property_permissions.len() as u32)]
674 #[transactional]674 #[transactional]
675 pub fn set_property_permissions(675 pub fn set_token_property_permissions(
676 origin,676 origin,
677 collection_id: CollectionId,677 collection_id: CollectionId,
678 property_permissions: Vec<PropertyKeyPermission>,678 property_permissions: Vec<PropertyKeyPermission>,
681681
682 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);682 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
683683
684 dispatch_tx::<T, _>(collection_id, |d| d.set_property_permissions(&sender, property_permissions))684 dispatch_tx::<T, _>(collection_id, |d| d.set_token_property_permissions(&sender, property_permissions))
685 }685 }
686686
687 #[weight = T::CommonWeightInfo::create_multiple_items_ex(&data)]687 #[weight = T::CommonWeightInfo::create_multiple_items_ex(&data)]
modifiedruntime/common/src/weights.rsdiffbeforeafterboth
70 dispatch_weight::<T>() + max_weight_of!(delete_token_properties(amount))70 dispatch_weight::<T>() + max_weight_of!(delete_token_properties(amount))
71 }71 }
7272
73 fn set_property_permissions(amount: u32) -> Weight {73 fn set_token_property_permissions(amount: u32) -> Weight {
74 dispatch_weight::<T>() + max_weight_of!(set_property_permissions(amount))74 dispatch_weight::<T>() + max_weight_of!(set_token_property_permissions(amount))
75 }75 }
7676
77 fn transfer() -> Weight {77 fn transfer() -> Weight {
modifiedtests/src/createMultipleItems.test.tsdiffbeforeafterboth
48 const alice = privateKeyWrapper('//Alice');48 const alice = privateKeyWrapper('//Alice');
49 await submitTransactionAsync(49 await submitTransactionAsync(
50 alice, 50 alice,
51 api.tx.unique.setPropertyPermissions(collectionId, [{key: 'data', permission: {tokenOwner: true}}]),51 api.tx.unique.setTokenPropertyPermissions(collectionId, [{key: 'data', permission: {tokenOwner: true}}]),
52 );52 );
53 53
54 const args = [54 const args = [
470470
471 const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});471 const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
472472
473 const tx1 = api.tx.unique.setPropertyPermissions(collectionId, propPerms);473 const tx1 = api.tx.unique.setTokenPropertyPermissions(collectionId, propPerms);
474 await expect(executeTransaction(api, alice, tx1)).to.be.rejectedWith(/common\.PropertyLimitReached/);474 await expect(executeTransaction(api, alice, tx1)).to.be.rejectedWith(/common\.PropertyLimitReached/);
475475
476 const itemsListIndexBefore = await getLastTokenId(api, collectionId);476 const itemsListIndexBefore = await getLastTokenId(api, collectionId);
modifiedtests/src/createMultipleItemsEx.test.tsdiffbeforeafterboth
222 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});222 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
223 await usingApi(async (api, privateKeyWrapper) => {223 await usingApi(async (api, privateKeyWrapper) => {
224 const alice = privateKeyWrapper('//Alice');224 const alice = privateKeyWrapper('//Alice');
225 await expect(executeTransaction(api, alice, api.tx.unique.setPropertyPermissions(collection, propPerms))).to.be.rejectedWith(/common\.PropertyLimitReached/);225 await expect(executeTransaction(api, alice, api.tx.unique.setTokenPropertyPermissions(collection, propPerms))).to.be.rejectedWith(/common\.PropertyLimitReached/);
226 });226 });
227 });227 });
228228
modifiedtests/src/eth/tokenProperties.test.tsdiffbeforeafterboth
29 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});29 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
30 const token = await createItemExpectSuccess(alice, collection, 'NFT');30 const token = await createItemExpectSuccess(alice, collection, 'NFT');
3131
32 await executeTransaction(api, alice, api.tx.unique.setPropertyPermissions(collection, [{32 await executeTransaction(api, alice, api.tx.unique.setTokenPropertyPermissions(collection, [{
33 key: 'testKey',33 key: 'testKey',
34 permission: {34 permission: {
35 collectionAdmin: true,35 collectionAdmin: true,
52 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});52 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
53 const token = await createItemExpectSuccess(alice, collection, 'NFT');53 const token = await createItemExpectSuccess(alice, collection, 'NFT');
5454
55 await executeTransaction(api, alice, api.tx.unique.setPropertyPermissions(collection, [{55 await executeTransaction(api, alice, api.tx.unique.setTokenPropertyPermissions(collection, [{
56 key: 'testKey',56 key: 'testKey',
57 permission: {57 permission: {
58 mutable: true,58 mutable: true,
77 const collection = await createCollectionExpectSuccess({mode: {type:'NFT'}});77 const collection = await createCollectionExpectSuccess({mode: {type:'NFT'}});
78 const token = await createItemExpectSuccess(alice, collection, 'NFT');78 const token = await createItemExpectSuccess(alice, collection, 'NFT');
7979
80 await executeTransaction(api, alice, api.tx.unique.setPropertyPermissions(collection, [{80 await executeTransaction(api, alice, api.tx.unique.setTokenPropertyPermissions(collection, [{
81 key: 'testKey',81 key: 'testKey',
82 permission: {82 permission: {
83 collectionAdmin: true,83 collectionAdmin: true,
modifiedtests/src/nesting/properties.test.tsdiffbeforeafterboth
38 await expect(executeTransaction(38 await expect(executeTransaction(
39 api, 39 api,
40 alice, 40 alice,
41 api.tx.unique.setPropertyPermissions(collectionId, propertyPermissions), 41 api.tx.unique.setTokenPropertyPermissions(collectionId, propertyPermissions),
42 )).to.not.be.rejected;42 )).to.not.be.rejected;
4343
44 const collectionProperties = [44 const collectionProperties = [
362 await expect(executeTransaction(362 await expect(executeTransaction(
363 api, 363 api,
364 alice, 364 alice,
365 api.tx.unique.setPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: true}}]), 365 api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: true}}]),
366 )).to.not.be.rejected;366 )).to.not.be.rejected;
367367
368 await addCollectionAdminExpectSuccess(alice, collection, bob.address);368 await addCollectionAdminExpectSuccess(alice, collection, bob.address);
369369
370 await expect(executeTransaction(370 await expect(executeTransaction(
371 api, 371 api,
372 alice, 372 alice,
373 api.tx.unique.setPropertyPermissions(collection, [{key: 'mindgame', permission: {collectionAdmin: true, tokenOwner: false}}]), 373 api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'mindgame', permission: {collectionAdmin: true, tokenOwner: false}}]),
374 )).to.not.be.rejected;374 )).to.not.be.rejected;
375375
376 const propertyRights = (await api.rpc.unique.propertyPermissions(collection, ['skullduggery', 'mindgame'])).toHuman();376 const propertyRights = (await api.rpc.unique.propertyPermissions(collection, ['skullduggery', 'mindgame'])).toHuman();
388 await expect(executeTransaction(388 await expect(executeTransaction(
389 api, 389 api,
390 alice, 390 alice,
391 api.tx.unique.setPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: true, collectionAdmin: true}}]), 391 api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: true, collectionAdmin: true}}]),
392 )).to.not.be.rejected;392 )).to.not.be.rejected;
393393
394 await expect(executeTransaction(394 await expect(executeTransaction(
395 api, 395 api,
396 alice, 396 alice,
397 api.tx.unique.setPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: false, tokenOwner: true}}]), 397 api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: false, tokenOwner: true}}]),
398 )).to.not.be.rejected;398 )).to.not.be.rejected;
399399
400 const propertyRights = (await api.rpc.unique.propertyPermissions(collection, ['skullduggery'])).toHuman();400 const propertyRights = (await api.rpc.unique.propertyPermissions(collection, ['skullduggery'])).toHuman();
420 await expect(executeTransaction(420 await expect(executeTransaction(
421 api, 421 api,
422 bob, 422 bob,
423 api.tx.unique.setPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: true, tokenOwner: true}}]), 423 api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: true, tokenOwner: true}}]),
424 )).to.be.rejectedWith(/common\.NoPermission/);424 )).to.be.rejectedWith(/common\.NoPermission/);
425425
426 const propertyRights = (await api.rpc.unique.propertyPermissions(collection, ['skullduggery'])).toJSON();426 const propertyRights = (await api.rpc.unique.propertyPermissions(collection, ['skullduggery'])).toJSON();
443 await expect(executeTransaction(443 await expect(executeTransaction(
444 api, 444 api,
445 alice, 445 alice,
446 api.tx.unique.setPropertyPermissions(collection, constitution), 446 api.tx.unique.setTokenPropertyPermissions(collection, constitution),
447 )).to.be.rejectedWith(/common\.PropertyLimitReached/);447 )).to.be.rejectedWith(/common\.PropertyLimitReached/);
448448
449 const propertyRights = (await api.query.common.collectionPropertyPermissions(collection)).toJSON();449 const propertyRights = (await api.query.common.collectionPropertyPermissions(collection)).toJSON();
458 await expect(executeTransaction(458 await expect(executeTransaction(
459 api, 459 api,
460 alice, 460 alice,
461 api.tx.unique.setPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: false, tokenOwner: true}}]), 461 api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'skullduggery', permission: {mutable: false, tokenOwner: true}}]),
462 )).to.not.be.rejected;462 )).to.not.be.rejected;
463463
464 await expect(executeTransaction(464 await expect(executeTransaction(
465 api, 465 api,
466 alice, 466 alice,
467 api.tx.unique.setPropertyPermissions(collection, [{key: 'skullduggery', permission: {}}]), 467 api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'skullduggery', permission: {}}]),
468 )).to.be.rejectedWith(/common\.NoPermission/);468 )).to.be.rejectedWith(/common\.NoPermission/);
469469
470 const propertyRights = (await api.rpc.unique.propertyPermissions(collection, ['skullduggery'])).toHuman();470 const propertyRights = (await api.rpc.unique.propertyPermissions(collection, ['skullduggery'])).toHuman();
488 await expect(executeTransaction(488 await expect(executeTransaction(
489 api, 489 api,
490 alice, 490 alice,
491 api.tx.unique.setPropertyPermissions(collection, invalidProperties[i]), 491 api.tx.unique.setTokenPropertyPermissions(collection, invalidProperties[i]),
492 ), `on setting the new badly-named property #${i}`).to.be.rejectedWith(/common\.InvalidCharacterInPropertyKey/);492 ), `on setting the new badly-named property #${i}`).to.be.rejectedWith(/common\.InvalidCharacterInPropertyKey/);
493 }493 }
494494
495 await expect(executeTransaction(495 await expect(executeTransaction(
496 api, 496 api,
497 alice, 497 alice,
498 api.tx.unique.setPropertyPermissions(collection, [{key: '', permission: {}}]), 498 api.tx.unique.setTokenPropertyPermissions(collection, [{key: '', permission: {}}]),
499 ), 'on rejecting an unnamed property').to.be.rejectedWith(/common\.EmptyPropertyKey/);499 ), 'on rejecting an unnamed property').to.be.rejectedWith(/common\.EmptyPropertyKey/);
500500
501 const correctKey = '--0x03116e387820CA05'; // PolkadotJS would parse this as an already encoded hex-string501 const correctKey = '--0x03116e387820CA05'; // PolkadotJS would parse this as an already encoded hex-string
502 await expect(executeTransaction(502 await expect(executeTransaction(
503 api, 503 api,
504 alice, 504 alice,
505 api.tx.unique.setPropertyPermissions(collection, [505 api.tx.unique.setTokenPropertyPermissions(collection, [
506 {key: correctKey, permission: {collectionAdmin: true}},506 {key: correctKey, permission: {collectionAdmin: true}},
507 ]), 507 ]),
508 ), 'on setting the correctly-but-still-badly-named property').to.not.be.rejected;508 ), 'on setting the correctly-but-still-badly-named property').to.not.be.rejected;
576 await expect(executeTransaction(576 await expect(executeTransaction(
577 api, 577 api,
578 alice, 578 alice,
579 api.tx.unique.setPropertyPermissions(collection, [{key: key, permission: permission.permission}]), 579 api.tx.unique.setTokenPropertyPermissions(collection, [{key: key, permission: permission.permission}]),
580 ), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;580 ), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;
581581
582 await expect(executeTransaction(582 await expect(executeTransaction(
612 await expect(executeTransaction(612 await expect(executeTransaction(
613 api, 613 api,
614 alice, 614 alice,
615 api.tx.unique.setPropertyPermissions(collection, [{key: key, permission: permission.permission}]), 615 api.tx.unique.setTokenPropertyPermissions(collection, [{key: key, permission: permission.permission}]),
616 ), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;616 ), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;
617617
618 await expect(executeTransaction(618 await expect(executeTransaction(
655 await expect(executeTransaction(655 await expect(executeTransaction(
656 api, 656 api,
657 alice, 657 alice,
658 api.tx.unique.setPropertyPermissions(collection, [{key: key, permission: permission.permission}]), 658 api.tx.unique.setTokenPropertyPermissions(collection, [{key: key, permission: permission.permission}]),
659 ), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;659 ), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;
660660
661 await expect(executeTransaction(661 await expect(executeTransaction(
721 await expect(executeTransaction(721 await expect(executeTransaction(
722 api, 722 api,
723 alice, 723 alice,
724 api.tx.unique.setPropertyPermissions(collection, [{key: `${i}`, permission: passage.permission}]), 724 api.tx.unique.setTokenPropertyPermissions(collection, [{key: `${i}`, permission: passage.permission}]),
725 ), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;725 ), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;
726726
727 await expect(executeTransaction(727 await expect(executeTransaction(
798 await expect(executeTransaction(798 await expect(executeTransaction(
799 api, 799 api,
800 alice, 800 alice,
801 api.tx.unique.setPropertyPermissions(collection, [{key: 'now-existent', permission: {}}]), 801 api.tx.unique.setTokenPropertyPermissions(collection, [{key: 'now-existent', permission: {}}]),
802 ), 'on setting a new non-permitted property').to.not.be.rejected;802 ), 'on setting a new non-permitted property').to.not.be.rejected;
803803
804 await expect(executeTransaction(804 await expect(executeTransaction(
818 await expect(executeTransaction(818 await expect(executeTransaction(
819 api, 819 api,
820 alice, 820 alice,
821 api.tx.unique.setPropertyPermissions(collection, [821 api.tx.unique.setTokenPropertyPermissions(collection, [
822 {key: 'a_holy_book', permission: {collectionAdmin: true, tokenOwner: true}}, 822 {key: 'a_holy_book', permission: {collectionAdmin: true, tokenOwner: true}},
823 {key: 'young_years', permission: {collectionAdmin: true, tokenOwner: true}},823 {key: 'young_years', permission: {collectionAdmin: true, tokenOwner: true}},
824 ]), 824 ]),
modifiedtests/src/rmrk/rmrk.test.tsdiffbeforeafterboth
129 await expect(executeTransaction(api, alice, txDeleteCollectionProperties), 'deleting collection properties')129 await expect(executeTransaction(api, alice, txDeleteCollectionProperties), 'deleting collection properties')
130 .to.be.rejectedWith(/common\.CollectionIsExternal/);130 .to.be.rejectedWith(/common\.CollectionIsExternal/);
131131
132 const txSetPropertyPermissions = api.tx.unique.setPropertyPermissions(uniqueCollectionId, [{key: 'a', permission: {mutable: true}}]);132 const txsetTokenPropertyPermissions = api.tx.unique.setTokenPropertyPermissions(uniqueCollectionId, [{key: 'a', permission: {mutable: true}}]);
133 await expect(executeTransaction(api, alice, txSetPropertyPermissions), 'setting property permissions')133 await expect(executeTransaction(api, alice, txsetTokenPropertyPermissions), 'setting property permissions')
134 .to.be.rejectedWith(/common\.CollectionIsExternal/);134 .to.be.rejectedWith(/common\.CollectionIsExternal/);
135135
136 // NFT136 // NFT