git.delta.rocks / unique-network / refs/commits / 6b48a5a77b12

difftreelog

OwnerCanTransfer flag

Dev2022-06-14parent: #681a5b7.patch.diff
in: master

10 files changed

modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -1164,6 +1164,7 @@
 		old_limit: &CollectionLimits,
 		mut new_limit: CollectionLimits,
 	) -> Result<CollectionLimits, DispatchError> {
+		let limits = old_limit;
 		limit_default!(old_limit, new_limit,
 			account_token_ownership_limit => ensure!(
 				new_limit <= MAX_TOKEN_OWNERSHIP,
@@ -1190,6 +1191,7 @@
 			),
 			sponsor_approve_timeout => {},
 			owner_can_transfer => ensure!(
+				!limits.owner_can_transfer_instaled() ||
 				old_limit || !new_limit,
 				<Error<T>>::OwnerPermissionsCantBeReverted,
 			),
modifiedprimitives/data-structs/src/lib.rsdiffbeforeafterboth
--- a/primitives/data-structs/src/lib.rs
+++ b/primitives/data-structs/src/lib.rs
@@ -409,7 +409,10 @@
 			.min(MAX_SPONSOR_TIMEOUT)
 	}
 	pub fn owner_can_transfer(&self) -> bool {
-		self.owner_can_transfer.unwrap_or(true)
+		self.owner_can_transfer.unwrap_or(false)
+	}
+	pub fn owner_can_transfer_instaled(&self) -> bool {
+		self.owner_can_transfer.is_some()
 	}
 	pub fn owner_can_destroy(&self) -> bool {
 		self.owner_can_destroy.unwrap_or(true)
modifiedtests/src/approve.test.tsdiffbeforeafterboth
--- a/tests/src/approve.test.ts
+++ b/tests/src/approve.test.ts
@@ -28,7 +28,7 @@
   setCollectionLimitsExpectSuccess,
   transferExpectSuccess,
   addCollectionAdminExpectSuccess,
-  adminApproveFromExpectSuccess,
+  adminApproveFromExpectFail,
   getCreatedCollectionCount,
   transferFromExpectSuccess,
   transferFromExpectFail,
@@ -84,11 +84,11 @@
     await approveExpectSuccess(reFungibleCollectionId, newReFungibleTokenId, alice, bob.address, 0);
   });
 
-  it('can be called by collection owner on non-owned item when OwnerCanTransfer == true', async () => {
+  it('can`t be called by collection owner on non-owned item when OwnerCanTransfer == false', async () => {
     const collectionId = await createCollectionExpectSuccess();
     const itemId = await createItemExpectSuccess(alice, collectionId, 'NFT', bob.address);
 
-    await adminApproveFromExpectSuccess(collectionId, itemId, alice, bob.address, charlie.address);
+    await adminApproveFromExpectFail(collectionId, itemId, alice, bob.address, charlie.address);
   });
 });
 
@@ -292,7 +292,7 @@
   });
 });
 
-describe('Administrator and collection owner do not need approval in order to execute TransferFrom:', () => {
+describe('Administrator and collection owner do not need approval in order to execute TransferFrom (with owner_can_transfer_flag = true):', () => {
   let alice: IKeyringPair;
   let bob: IKeyringPair;
   let charlie: IKeyringPair;
@@ -309,6 +309,7 @@
 
   it('NFT', async () => {
     const collectionId = await createCollectionExpectSuccess();
+    await setCollectionLimitsExpectSuccess(alice, collectionId, {ownerCanTransfer: true});
     const itemId = await createItemExpectSuccess(alice, collectionId, 'NFT', charlie.address);
     await transferFromExpectSuccess(collectionId, itemId, alice, charlie, dave, 1, 'NFT');
     await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
@@ -317,6 +318,7 @@
 
   it('Fungible up to an approved amount', async () => {
     const collectionId = await createCollectionExpectSuccess({mode:{type: 'Fungible', decimalPoints: 0}});
+    await setCollectionLimitsExpectSuccess(alice, collectionId, {ownerCanTransfer: true});
     const itemId = await createItemExpectSuccess(alice, collectionId, 'Fungible', charlie.address); 
     await transferFromExpectSuccess(collectionId, itemId, alice, charlie, dave, 1, 'Fungible');
     await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
@@ -325,6 +327,7 @@
 
   it('ReFungible up to an approved amount', async () => {
     const collectionId = await createCollectionExpectSuccess({mode:{type: 'ReFungible'}});
+    await setCollectionLimitsExpectSuccess(alice, collectionId, {ownerCanTransfer: true});
     const itemId = await createItemExpectSuccess(alice, collectionId, 'ReFungible', charlie.address);
     await transferFromExpectSuccess(collectionId, itemId, alice, charlie, dave, 1, 'ReFungible');
     await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
@@ -402,7 +405,7 @@
     const itemId = await createItemExpectSuccess(alice, collectionId, 'NFT', alice.address);
 
     await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
-    await adminApproveFromExpectSuccess(collectionId, itemId, bob, alice.address, charlie.address);
+    await adminApproveFromExpectFail(collectionId, itemId, bob, alice.address, charlie.address);
   });
 });
 
modifiedtests/src/burnItem.test.tsdiffbeforeafterboth
--- a/tests/src/burnItem.test.ts
+++ b/tests/src/burnItem.test.ts
@@ -23,6 +23,7 @@
   normalizeAccountId,
   addCollectionAdminExpectSuccess,
   getBalance,
+  setCollectionLimitsExpectSuccess,
   isTokenExists,
 } from './util/helpers';
 
@@ -149,6 +150,7 @@
   it('Burn item in NFT collection', async () => {
     const createMode = 'NFT';
     const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});
+    await setCollectionLimitsExpectSuccess(alice, collectionId, {ownerCanTransfer: true});
     const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);
     await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
 
@@ -167,6 +169,7 @@
   it('Burn item in Fungible collection', async () => {
     const createMode = 'Fungible';
     const collectionId = await createCollectionExpectSuccess({mode: {type: createMode, decimalPoints: 0}});
+    await setCollectionLimitsExpectSuccess(alice, collectionId, {ownerCanTransfer: true});
     const tokenId = await createItemExpectSuccess(alice, collectionId, createMode); // Helper creates 10 fungible tokens
     await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
 
@@ -189,6 +192,7 @@
   it('Burn item in ReFungible collection', async () => {
     const createMode = 'ReFungible';
     const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});
+    await setCollectionLimitsExpectSuccess(alice, collectionId, {ownerCanTransfer: true});
     const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);
     await addCollectionAdminExpectSuccess(alice, collectionId, bob.address);
 
modifiedtests/src/eth/crossTransfer.test.tsdiffbeforeafterboth
before · tests/src/eth/crossTransfer.test.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {createCollectionExpectSuccess,18  createFungibleItemExpectSuccess,19  transferExpectSuccess,20  transferFromExpectSuccess,21  createItemExpectSuccess} from '../util/helpers';22import {collectionIdToAddress,23  createEthAccountWithBalance,24  subToEth,25  GAS_ARGS, itWeb3} from './util/helpers';26import fungibleAbi from './fungibleAbi.json';27import nonFungibleAbi from './nonFungibleAbi.json';2829describe('Token transfer between substrate address and EVM address. Fungible', () => {30  itWeb3('The private key X create a substrate address. Alice sends a token to the corresponding EVM address, and X can send it to Bob in the substrate', async ({privateKeyWrapper}) => {31    const collection = await createCollectionExpectSuccess({32      name: 'token name',33      mode: {type: 'Fungible', decimalPoints: 0},34    });35    const alice = privateKeyWrapper('//Alice');36    const bob = privateKeyWrapper('//Bob');37    const charlie = privateKeyWrapper('//Charlie');38    await createFungibleItemExpectSuccess(alice, collection, {Value: 200n}, {Substrate: alice.address});39    await transferExpectSuccess(collection, 0, alice, {Ethereum: subToEth(charlie.address)} , 200, 'Fungible');40    await transferFromExpectSuccess(collection, 0, alice, {Ethereum: subToEth(charlie.address)}, charlie, 50, 'Fungible');41    await transferExpectSuccess(collection, 0, charlie, bob, 50, 'Fungible');42  });4344  itWeb3('The private key X create a EVM address. Alice sends a token to the substrate address corresponding to this EVM address, and X can send it to Bob in the EVM', async ({api, web3, privateKeyWrapper}) => {45    const collection = await createCollectionExpectSuccess({46      name: 'token name',47      mode: {type: 'Fungible', decimalPoints: 0},48    });49    const alice = privateKeyWrapper('//Alice');50    const bob = privateKeyWrapper('//Bob');51    const bobProxy = await createEthAccountWithBalance(api, web3, privateKeyWrapper);52    const aliceProxy = await createEthAccountWithBalance(api, web3, privateKeyWrapper);5354    await createFungibleItemExpectSuccess(alice, collection, {Value: 200n}, alice.address);55    await transferExpectSuccess(collection, 0, alice, {Ethereum: aliceProxy} , 200, 'Fungible');56    const address = collectionIdToAddress(collection);57    const contract = new web3.eth.Contract(fungibleAbi as any, address, {from: aliceProxy, ...GAS_ARGS});5859    await contract.methods.transfer(bobProxy, 50).send({from: aliceProxy});60    await transferFromExpectSuccess(collection, 0, alice, {Ethereum: bobProxy}, bob, 50, 'Fungible');61    await transferExpectSuccess(collection, 0, bob, alice, 50, 'Fungible');62  });63});6465describe('Token transfer between substrate address and EVM address. NFT', () => {66  itWeb3('The private key X create a substrate address. Alice sends a token to the corresponding EVM address, and X can send it to Bob in the substrate', async ({privateKeyWrapper}) => {67    const collection = await createCollectionExpectSuccess({68      name: 'token name',69      mode: {type: 'NFT'},70    });71    const alice = privateKeyWrapper('//Alice');72    const bob = privateKeyWrapper('//Bob');73    const charlie = privateKeyWrapper('//Charlie');74    const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Substrate: alice.address});75    await transferExpectSuccess(collection, tokenId, alice, {Ethereum: subToEth(charlie.address)}, 1, 'NFT');76    await transferFromExpectSuccess(collection, tokenId, alice, {Ethereum: subToEth(charlie.address)}, charlie, 1, 'NFT');77    await transferExpectSuccess(collection, tokenId, charlie, bob, 1, 'NFT');78  });7980  itWeb3('The private key X create a EVM address. Alice sends a token to the substrate address corresponding to this EVM address, and X can send it to Bob in the EVM', async ({api, web3, privateKeyWrapper}) => {81    const collection = await createCollectionExpectSuccess({82      name: 'token name',83      mode: {type: 'NFT'},84    });85    const alice = privateKeyWrapper('//Alice');86    const bob = privateKeyWrapper('//Bob');87    const charlie = privateKeyWrapper('//Charlie');88    const bobProxy = await createEthAccountWithBalance(api, web3, privateKeyWrapper);89    const aliceProxy = await createEthAccountWithBalance(api, web3, privateKeyWrapper);90    const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Substrate: alice.address});91    await transferExpectSuccess(collection, tokenId, alice, {Ethereum: aliceProxy} , 1, 'NFT');92    const address = collectionIdToAddress(collection);93    const contract = new web3.eth.Contract(nonFungibleAbi as any, address, {from: aliceProxy, ...GAS_ARGS});94    await contract.methods.transfer(bobProxy, 1).send({from: aliceProxy});95    await transferFromExpectSuccess(collection, tokenId, alice, {Ethereum: bobProxy}, bob, 1, 'NFT');96    await transferExpectSuccess(collection, tokenId, bob, charlie, 1, 'NFT');97  });98});
after · tests/src/eth/crossTransfer.test.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {createCollectionExpectSuccess,18  createFungibleItemExpectSuccess,19  transferExpectSuccess,20  transferFromExpectSuccess,21  setCollectionLimitsExpectSuccess,22  createItemExpectSuccess} from '../util/helpers';23import {collectionIdToAddress,24  createEthAccountWithBalance,25  subToEth,26  GAS_ARGS, itWeb3} from './util/helpers';27import fungibleAbi from './fungibleAbi.json';28import nonFungibleAbi from './nonFungibleAbi.json';2930describe('Token transfer between substrate address and EVM address. Fungible', () => {31  itWeb3('The private key X create a substrate address. Alice sends a token to the corresponding EVM address, and X can send it to Bob in the substrate', async ({privateKeyWrapper}) => {32    const collection = await createCollectionExpectSuccess({33      name: 'token name',34      mode: {type: 'Fungible', decimalPoints: 0},35    });36    const alice = privateKeyWrapper('//Alice');37    const bob = privateKeyWrapper('//Bob');38    const charlie = privateKeyWrapper('//Charlie');39    await setCollectionLimitsExpectSuccess(alice, collection, {ownerCanTransfer: true});40    await createFungibleItemExpectSuccess(alice, collection, {Value: 200n}, {Substrate: alice.address});41    await transferExpectSuccess(collection, 0, alice, {Ethereum: subToEth(charlie.address)} , 200, 'Fungible');42    await transferFromExpectSuccess(collection, 0, alice, {Ethereum: subToEth(charlie.address)}, charlie, 50, 'Fungible');43    await transferExpectSuccess(collection, 0, charlie, bob, 50, 'Fungible');44  });4546  itWeb3('The private key X create a EVM address. Alice sends a token to the substrate address corresponding to this EVM address, and X can send it to Bob in the EVM', async ({api, web3, privateKeyWrapper}) => {47    const collection = await createCollectionExpectSuccess({48      name: 'token name',49      mode: {type: 'Fungible', decimalPoints: 0},50    });51    const alice = privateKeyWrapper('//Alice');52    const bob = privateKeyWrapper('//Bob');53    await setCollectionLimitsExpectSuccess(alice, collection, {ownerCanTransfer: true});54    const bobProxy = await createEthAccountWithBalance(api, web3, privateKeyWrapper);55    const aliceProxy = await createEthAccountWithBalance(api, web3, privateKeyWrapper);5657    await createFungibleItemExpectSuccess(alice, collection, {Value: 200n}, alice.address);58    await transferExpectSuccess(collection, 0, alice, {Ethereum: aliceProxy} , 200, 'Fungible');59    const address = collectionIdToAddress(collection);60    const contract = new web3.eth.Contract(fungibleAbi as any, address, {from: aliceProxy, ...GAS_ARGS});6162    await contract.methods.transfer(bobProxy, 50).send({from: aliceProxy});63    await transferFromExpectSuccess(collection, 0, alice, {Ethereum: bobProxy}, bob, 50, 'Fungible');64    await transferExpectSuccess(collection, 0, bob, alice, 50, 'Fungible');65  });66});6768describe('Token transfer between substrate address and EVM address. NFT', () => {69  itWeb3('The private key X create a substrate address. Alice sends a token to the corresponding EVM address, and X can send it to Bob in the substrate', async ({privateKeyWrapper}) => {70    const collection = await createCollectionExpectSuccess({71      name: 'token name',72      mode: {type: 'NFT'},73    });74    const alice = privateKeyWrapper('//Alice');75    const bob = privateKeyWrapper('//Bob');76    const charlie = privateKeyWrapper('//Charlie');77    await setCollectionLimitsExpectSuccess(alice, collection, {ownerCanTransfer: true});78    const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Substrate: alice.address});79    await transferExpectSuccess(collection, tokenId, alice, {Ethereum: subToEth(charlie.address)}, 1, 'NFT');80    await transferFromExpectSuccess(collection, tokenId, alice, {Ethereum: subToEth(charlie.address)}, charlie, 1, 'NFT');81    await transferExpectSuccess(collection, tokenId, charlie, bob, 1, 'NFT');82  });8384  itWeb3('The private key X create a EVM address. Alice sends a token to the substrate address corresponding to this EVM address, and X can send it to Bob in the EVM', async ({api, web3, privateKeyWrapper}) => {85    const collection = await createCollectionExpectSuccess({86      name: 'token name',87      mode: {type: 'NFT'},88    });89    const alice = privateKeyWrapper('//Alice');90    const bob = privateKeyWrapper('//Bob');91    const charlie = privateKeyWrapper('//Charlie');92    await setCollectionLimitsExpectSuccess(alice, collection, {ownerCanTransfer: true});93    const bobProxy = await createEthAccountWithBalance(api, web3, privateKeyWrapper);94    const aliceProxy = await createEthAccountWithBalance(api, web3, privateKeyWrapper);95    const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Substrate: alice.address});96    await transferExpectSuccess(collection, tokenId, alice, {Ethereum: aliceProxy} , 1, 'NFT');97    const address = collectionIdToAddress(collection);98    const contract = new web3.eth.Contract(nonFungibleAbi as any, address, {from: aliceProxy, ...GAS_ARGS});99    await contract.methods.transfer(bobProxy, 1).send({from: aliceProxy});100    await transferFromExpectSuccess(collection, tokenId, alice, {Ethereum: bobProxy}, bob, 1, 'NFT');101    await transferExpectSuccess(collection, tokenId, bob, charlie, 1, 'NFT');102  });103});
modifiedtests/src/limits.test.tsdiffbeforeafterboth
--- a/tests/src/limits.test.ts
+++ b/tests/src/limits.test.ts
@@ -406,6 +406,7 @@
   it('Effective collection limits', async () => {
     await usingApi(async (api) => {
       const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
+      await setCollectionLimitsExpectSuccess(alice, collectionId, {ownerCanTransfer: true});
       
       { // Check that limits is undefined
         const collection = await api.rpc.unique.collectionById(collectionId);
@@ -419,7 +420,7 @@
         expect(limits.tokenLimit.toHuman()).to.be.null;
         expect(limits.sponsorTransferTimeout.toHuman()).to.be.null;
         expect(limits.sponsorApproveTimeout.toHuman()).to.be.null;
-        expect(limits.ownerCanTransfer.toHuman()).to.be.null;
+        expect(limits.ownerCanTransfer.toHuman()).to.be.true;
         expect(limits.ownerCanDestroy.toHuman()).to.be.null;
         expect(limits.transfersEnabled.toHuman()).to.be.null;
       }
modifiedtests/src/nesting/graphs.test.tsdiffbeforeafterboth
--- a/tests/src/nesting/graphs.test.ts
+++ b/tests/src/nesting/graphs.test.ts
@@ -3,7 +3,7 @@
 import {expect} from 'chai';
 import {tokenIdToCross} from '../eth/util/helpers';
 import usingApi, {executeTransaction} from '../substrate/substrate-api';
-import {getCreateCollectionResult, transferExpectSuccess} from '../util/helpers';
+import {getCreateCollectionResult, transferExpectSuccess, setCollectionLimitsExpectSuccess} from '../util/helpers';
 
 /**
  * ```dot
@@ -36,6 +36,7 @@
     await usingApi(async (api, privateKeyWrapper) => {
       const alice = privateKeyWrapper('//Alice');
       const collection = await buildComplexObjectGraph(api, alice);
+      await setCollectionLimitsExpectSuccess(alice, collection, {ownerCanTransfer: true});
 
       // to self
       await expect(
modifiedtests/src/nesting/nest.test.tsdiffbeforeafterboth
--- a/tests/src/nesting/nest.test.ts
+++ b/tests/src/nesting/nest.test.ts
@@ -15,6 +15,7 @@
   transferExpectFailure,
   transferExpectSuccess,
   transferFromExpectSuccess,
+  setCollectionLimitsExpectSuccess,
 } from '../util/helpers';
 import {IKeyringPair} from '@polkadot/types/types';
 
@@ -92,6 +93,7 @@
   it('Checks token children', async () => {
     await usingApi(async api => {
       const collectionA = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
+      await setCollectionLimitsExpectSuccess(alice, collectionA, {ownerCanTransfer: true});
       await setCollectionPermissionsExpectSuccess(alice, collectionA, {nesting: {tokenOwner: true}});
       const collectionB = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
 
modifiedtests/src/transferFrom.test.tsdiffbeforeafterboth
--- a/tests/src/transferFrom.test.ts
+++ b/tests/src/transferFrom.test.ts
@@ -99,6 +99,7 @@
 
   it('can be called by collection owner on non-owned item when OwnerCanTransfer == true', async () => {
     const collectionId = await createCollectionExpectSuccess();
+    await setCollectionLimitsExpectSuccess(alice, collectionId, {ownerCanTransfer: true});
     const itemId = await createItemExpectSuccess(alice, collectionId, 'NFT', bob.address);
 
     await transferFromExpectSuccess(collectionId, itemId, alice, bob, charlie);
@@ -257,6 +258,7 @@
     await usingApi(async () => {
       // nft
       const nftCollectionId = await createCollectionExpectSuccess();
+      await setCollectionLimitsExpectSuccess(alice, nftCollectionId, {ownerCanTransfer: true});
       const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');
       await burnItemExpectSuccess(alice, nftCollectionId, newNftTokenId, 1);
       await approveExpectFail(nftCollectionId, newNftTokenId, alice, bob);
@@ -266,6 +268,7 @@
   it('transferFrom burnt token before approve Fungible', async () => {
     await usingApi(async () => {
       const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
+      await setCollectionLimitsExpectSuccess(alice, fungibleCollectionId, {ownerCanTransfer: true});
       const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');
       await burnItemExpectSuccess(alice, fungibleCollectionId, newFungibleTokenId, 10);
       await approveExpectSuccess(fungibleCollectionId, newFungibleTokenId, alice, bob.address);
@@ -276,6 +279,7 @@
   it('transferFrom burnt token before approve ReFungible', async () => {
     await usingApi(async () => {
       const reFungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
+      await setCollectionLimitsExpectSuccess(alice, reFungibleCollectionId, {ownerCanTransfer: true});
       const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');
       await burnItemExpectSuccess(alice, reFungibleCollectionId, newReFungibleTokenId, 100);
       await approveExpectFail(reFungibleCollectionId, newReFungibleTokenId, alice, bob);
modifiedtests/src/util/helpers.tsdiffbeforeafterboth
--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -921,6 +921,18 @@
   });
 }
 
+export async function adminApproveFromExpectFail(
+  collectionId: number,
+  tokenId: number, admin: IKeyringPair, owner: CrossAccountId | string, approved: CrossAccountId | string, amount: number | bigint = 1,
+) {
+  await usingApi(async (api: ApiPromise) => {
+    const approveUniqueTx = api.tx.unique.approve(normalizeAccountId(approved), collectionId, tokenId, amount);
+    const events = await expect(submitTransactionAsync(admin, approveUniqueTx)).to.be.rejected;
+    const result = getGenericResult(events);
+    expect(result.success).to.be.false;
+  });
+}
+
 export async function
 getFreeBalance(account: IKeyringPair): Promise<bigint> {
   let balance = 0n;