difftreelog
CORE-386 Fix names and tests
in: master
8 files changed
pallets/common/src/erc.rsdiffbeforeafterboth--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -211,7 +211,7 @@
Ok(())
}
- #[solidity(rename_selector = "setNesting")]
+ #[solidity(rename_selector = "setCollectionNesting")]
fn set_nesting_bool(&mut self, caller: caller, enable: bool) -> Result<void> {
check_is_owner_or_admin(caller, self)?;
let permissions = CollectionPermissions {
@@ -231,7 +231,7 @@
save(self)
}
- #[solidity(rename_selector = "setNesting")]
+ #[solidity(rename_selector = "setCollectionNesting")]
fn set_nesting(
&mut self,
caller: caller,
@@ -309,7 +309,7 @@
Ok(())
}
- fn set_mint_mode(&mut self, caller: caller, mode: bool) -> Result<void> {
+ fn set_collection_mint_mode(&mut self, caller: caller, mode: bool) -> Result<void> {
check_is_owner_or_admin(caller, self)?;
let permissions = CollectionPermissions { mint_mode: Some(mode), .. Default::default() };
self.collection.permissions = <Pallet<T>>::clamp_permissions(
pallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth--- a/pallets/nonfungible/src/stubs/UniqueNFT.sol
+++ b/pallets/nonfungible/src/stubs/UniqueNFT.sol
@@ -330,7 +330,7 @@
}
}
-// Selector: c0de6be0
+// Selector: 7d9262e6
contract Collection is Dummy, ERC165 {
// Selector: setCollectionProperty(string,bytes) 2f073f66
function setCollectionProperty(string memory key, bytes memory value)
@@ -427,15 +427,17 @@
dummy;
}
- // Selector: setNesting(bool) e8fc50dd
- function setNesting(bool enable) public {
+ // Selector: setCollectionNesting(bool) 112d4586
+ function setCollectionNesting(bool enable) public {
require(false, stub_error);
enable;
dummy = 0;
}
- // Selector: setNesting(bool,address[]) 7df12a9a
- function setNesting(bool enable, address[] memory collections) public {
+ // Selector: setCollectionNesting(bool,address[]) 64872396
+ function setCollectionNesting(bool enable, address[] memory collections)
+ public
+ {
require(false, stub_error);
enable;
collections;
@@ -463,8 +465,8 @@
dummy;
}
- // Selector: setMintMode(bool) 5dea9bd5
- function setMintMode(bool mode) public {
+ // Selector: setCollectionMintMode(bool) 00018e84
+ function setCollectionMintMode(bool mode) public {
require(false, stub_error);
mode;
dummy = 0;
tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56// Anonymous struct7struct Tuple0 {8 uint256 field_0;9 string field_1;10}1112// Common stubs holder13interface Dummy {1415}1617interface ERC165 is Dummy {18 function supportsInterface(bytes4 interfaceID) external view returns (bool);19}2021// Inline22interface ERC721Events {23 event Transfer(24 address indexed from,25 address indexed to,26 uint256 indexed tokenId27 );28 event Approval(29 address indexed owner,30 address indexed approved,31 uint256 indexed tokenId32 );33 event ApprovalForAll(34 address indexed owner,35 address indexed operator,36 bool approved37 );38}3940// Inline41interface ERC721MintableEvents {42 event MintingFinished();43}4445// Selector: 4136937746interface TokenProperties is Dummy, ERC165 {47 // Selector: setTokenPropertyPermission(string,bool,bool,bool) 222d97fa48 function setTokenPropertyPermission(49 string memory key,50 bool isMutable,51 bool collectionAdmin,52 bool tokenOwner53 ) external;5455 // Selector: setProperty(uint256,string,bytes) 1752d67b56 function setProperty(57 uint256 tokenId,58 string memory key,59 bytes memory value60 ) external;6162 // Selector: deleteProperty(uint256,string) 066111d163 function deleteProperty(uint256 tokenId, string memory key) external;6465 // Throws error if key not found66 //67 // Selector: property(uint256,string) 7228c32768 function property(uint256 tokenId, string memory key)69 external70 view71 returns (bytes memory);72}7374// Selector: 42966c6875interface ERC721Burnable is Dummy, ERC165 {76 // Selector: burn(uint256) 42966c6877 function burn(uint256 tokenId) external;78}7980// Selector: 5880016181interface ERC721 is Dummy, ERC165, ERC721Events {82 // Selector: balanceOf(address) 70a0823183 function balanceOf(address owner) external view returns (uint256);8485 // Selector: ownerOf(uint256) 6352211e86 function ownerOf(uint256 tokenId) external view returns (address);8788 // Not implemented89 //90 // Selector: safeTransferFromWithData(address,address,uint256,bytes) 60a1167291 function safeTransferFromWithData(92 address from,93 address to,94 uint256 tokenId,95 bytes memory data96 ) external;9798 // Not implemented99 //100 // Selector: safeTransferFrom(address,address,uint256) 42842e0e101 function safeTransferFrom(102 address from,103 address to,104 uint256 tokenId105 ) external;106107 // Selector: transferFrom(address,address,uint256) 23b872dd108 function transferFrom(109 address from,110 address to,111 uint256 tokenId112 ) external;113114 // Selector: approve(address,uint256) 095ea7b3115 function approve(address approved, uint256 tokenId) external;116117 // Not implemented118 //119 // Selector: setApprovalForAll(address,bool) a22cb465120 function setApprovalForAll(address operator, bool approved) external;121122 // Not implemented123 //124 // Selector: getApproved(uint256) 081812fc125 function getApproved(uint256 tokenId) external view returns (address);126127 // Not implemented128 //129 // Selector: isApprovedForAll(address,address) e985e9c5130 function isApprovedForAll(address owner, address operator)131 external132 view133 returns (address);134}135136// Selector: 5b5e139f137interface ERC721Metadata is Dummy, ERC165 {138 // Selector: name() 06fdde03139 function name() external view returns (string memory);140141 // Selector: symbol() 95d89b41142 function symbol() external view returns (string memory);143144 // Returns token's const_metadata145 //146 // Selector: tokenURI(uint256) c87b56dd147 function tokenURI(uint256 tokenId) external view returns (string memory);148}149150// Selector: 68ccfe89151interface ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {152 // Selector: mintingFinished() 05d2035b153 function mintingFinished() external view returns (bool);154155 // `token_id` should be obtained with `next_token_id` method,156 // unlike standard, you can't specify it manually157 //158 // Selector: mint(address,uint256) 40c10f19159 function mint(address to, uint256 tokenId) external returns (bool);160161 // `token_id` should be obtained with `next_token_id` method,162 // unlike standard, you can't specify it manually163 //164 // Selector: mintWithTokenURI(address,uint256,string) 50bb4e7f165 function mintWithTokenURI(166 address to,167 uint256 tokenId,168 string memory tokenUri169 ) external returns (bool);170171 // Not implemented172 //173 // Selector: finishMinting() 7d64bcb4174 function finishMinting() external returns (bool);175}176177// Selector: 780e9d63178interface ERC721Enumerable is Dummy, ERC165 {179 // Selector: tokenByIndex(uint256) 4f6ccce7180 function tokenByIndex(uint256 index) external view returns (uint256);181182 // Not implemented183 //184 // Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59185 function tokenOfOwnerByIndex(address owner, uint256 index)186 external187 view188 returns (uint256);189190 // Selector: totalSupply() 18160ddd191 function totalSupply() external view returns (uint256);192}193194// Selector: c0de6be0195interface Collection is Dummy, ERC165 {196 // Selector: setCollectionProperty(string,bytes) 2f073f66197 function setCollectionProperty(string memory key, bytes memory value)198 external;199200 // Selector: deleteCollectionProperty(string) 7b7debce201 function deleteCollectionProperty(string memory key) external;202203 // Throws error if key not found204 //205 // Selector: collectionProperty(string) cf24fd6d206 function collectionProperty(string memory key)207 external208 view209 returns (bytes memory);210211 // Selector: setCollectionSponsor(address) 7623402e212 function setCollectionSponsor(address sponsor) external;213214 // Selector: confirmCollectionSponsorship() 3c50e97a215 function confirmCollectionSponsorship() external;216217 // Selector: setCollectionLimit(string,uint32) 6a3841db218 function setCollectionLimit(string memory limit, uint32 value) external;219220 // Selector: setCollectionLimit(string,bool) 993b7fba221 function setCollectionLimit(string memory limit, bool value) external;222223 // Selector: contractAddress() f6b4dfb4224 function contractAddress() external view returns (address);225226 // Selector: addCollectionAdminSubstrate(uint256) 5730062b227 function addCollectionAdminSubstrate(uint256 newAdmin) external view;228229 // Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9230 function removeCollectionAdminSubstrate(uint256 newAdmin) external view;231232 // Selector: addCollectionAdmin(address) 92e462c7233 function addCollectionAdmin(address newAdmin) external view;234235 // Selector: removeCollectionAdmin(address) fafd7b42236 function removeCollectionAdmin(address admin) external view;237238 // Selector: setNesting(bool) e8fc50dd239 function setNesting(bool enable) external;240241 // Selector: setNesting(bool,address[]) 7df12a9a242 function setNesting(bool enable, address[] memory collections) external;243244 // Selector: setCollectionAccess(uint8) 41835d4c245 function setCollectionAccess(uint8 mode) external;246247 // Selector: addToCollectionAllowList(address) 67844fe6248 function addToCollectionAllowList(address user) external view;249250 // Selector: removeFromCollectionAllowList(address) 85c51acb251 function removeFromCollectionAllowList(address user) external view;252253 // Selector: setMintMode(bool) 5dea9bd5254 function setMintMode(bool mode) external;255}256257// Selector: d74d154f258interface ERC721UniqueExtensions is Dummy, ERC165 {259 // Selector: transfer(address,uint256) a9059cbb260 function transfer(address to, uint256 tokenId) external;261262 // Selector: burnFrom(address,uint256) 79cc6790263 function burnFrom(address from, uint256 tokenId) external;264265 // Selector: nextTokenId() 75794a3c266 function nextTokenId() external view returns (uint256);267268 // Selector: mintBulk(address,uint256[]) 44a9945e269 function mintBulk(address to, uint256[] memory tokenIds)270 external271 returns (bool);272273 // Selector: mintBulkWithTokenURI(address,(uint256,string)[]) 36543006274 function mintBulkWithTokenURI(address to, Tuple0[] memory tokens)275 external276 returns (bool);277}278279interface UniqueNFT is280 Dummy,281 ERC165,282 ERC721,283 ERC721Metadata,284 ERC721Enumerable,285 ERC721UniqueExtensions,286 ERC721Mintable,287 ERC721Burnable,288 Collection,289 TokenProperties290{}1// SPDX-License-Identifier: OTHER2// This code is automatically generated34pragma solidity >=0.8.0 <0.9.0;56// Anonymous struct7struct Tuple0 {8 uint256 field_0;9 string field_1;10}1112// Common stubs holder13interface Dummy {1415}1617interface ERC165 is Dummy {18 function supportsInterface(bytes4 interfaceID) external view returns (bool);19}2021// Inline22interface ERC721Events {23 event Transfer(24 address indexed from,25 address indexed to,26 uint256 indexed tokenId27 );28 event Approval(29 address indexed owner,30 address indexed approved,31 uint256 indexed tokenId32 );33 event ApprovalForAll(34 address indexed owner,35 address indexed operator,36 bool approved37 );38}3940// Inline41interface ERC721MintableEvents {42 event MintingFinished();43}4445// Selector: 4136937746interface TokenProperties is Dummy, ERC165 {47 // Selector: setTokenPropertyPermission(string,bool,bool,bool) 222d97fa48 function setTokenPropertyPermission(49 string memory key,50 bool isMutable,51 bool collectionAdmin,52 bool tokenOwner53 ) external;5455 // Selector: setProperty(uint256,string,bytes) 1752d67b56 function setProperty(57 uint256 tokenId,58 string memory key,59 bytes memory value60 ) external;6162 // Selector: deleteProperty(uint256,string) 066111d163 function deleteProperty(uint256 tokenId, string memory key) external;6465 // Throws error if key not found66 //67 // Selector: property(uint256,string) 7228c32768 function property(uint256 tokenId, string memory key)69 external70 view71 returns (bytes memory);72}7374// Selector: 42966c6875interface ERC721Burnable is Dummy, ERC165 {76 // Selector: burn(uint256) 42966c6877 function burn(uint256 tokenId) external;78}7980// Selector: 5880016181interface ERC721 is Dummy, ERC165, ERC721Events {82 // Selector: balanceOf(address) 70a0823183 function balanceOf(address owner) external view returns (uint256);8485 // Selector: ownerOf(uint256) 6352211e86 function ownerOf(uint256 tokenId) external view returns (address);8788 // Not implemented89 //90 // Selector: safeTransferFromWithData(address,address,uint256,bytes) 60a1167291 function safeTransferFromWithData(92 address from,93 address to,94 uint256 tokenId,95 bytes memory data96 ) external;9798 // Not implemented99 //100 // Selector: safeTransferFrom(address,address,uint256) 42842e0e101 function safeTransferFrom(102 address from,103 address to,104 uint256 tokenId105 ) external;106107 // Selector: transferFrom(address,address,uint256) 23b872dd108 function transferFrom(109 address from,110 address to,111 uint256 tokenId112 ) external;113114 // Selector: approve(address,uint256) 095ea7b3115 function approve(address approved, uint256 tokenId) external;116117 // Not implemented118 //119 // Selector: setApprovalForAll(address,bool) a22cb465120 function setApprovalForAll(address operator, bool approved) external;121122 // Not implemented123 //124 // Selector: getApproved(uint256) 081812fc125 function getApproved(uint256 tokenId) external view returns (address);126127 // Not implemented128 //129 // Selector: isApprovedForAll(address,address) e985e9c5130 function isApprovedForAll(address owner, address operator)131 external132 view133 returns (address);134}135136// Selector: 5b5e139f137interface ERC721Metadata is Dummy, ERC165 {138 // Selector: name() 06fdde03139 function name() external view returns (string memory);140141 // Selector: symbol() 95d89b41142 function symbol() external view returns (string memory);143144 // Returns token's const_metadata145 //146 // Selector: tokenURI(uint256) c87b56dd147 function tokenURI(uint256 tokenId) external view returns (string memory);148}149150// Selector: 68ccfe89151interface ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {152 // Selector: mintingFinished() 05d2035b153 function mintingFinished() external view returns (bool);154155 // `token_id` should be obtained with `next_token_id` method,156 // unlike standard, you can't specify it manually157 //158 // Selector: mint(address,uint256) 40c10f19159 function mint(address to, uint256 tokenId) external returns (bool);160161 // `token_id` should be obtained with `next_token_id` method,162 // unlike standard, you can't specify it manually163 //164 // Selector: mintWithTokenURI(address,uint256,string) 50bb4e7f165 function mintWithTokenURI(166 address to,167 uint256 tokenId,168 string memory tokenUri169 ) external returns (bool);170171 // Not implemented172 //173 // Selector: finishMinting() 7d64bcb4174 function finishMinting() external returns (bool);175}176177// Selector: 780e9d63178interface ERC721Enumerable is Dummy, ERC165 {179 // Selector: tokenByIndex(uint256) 4f6ccce7180 function tokenByIndex(uint256 index) external view returns (uint256);181182 // Not implemented183 //184 // Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59185 function tokenOfOwnerByIndex(address owner, uint256 index)186 external187 view188 returns (uint256);189190 // Selector: totalSupply() 18160ddd191 function totalSupply() external view returns (uint256);192}193194// Selector: 7d9262e6195interface Collection is Dummy, ERC165 {196 // Selector: setCollectionProperty(string,bytes) 2f073f66197 function setCollectionProperty(string memory key, bytes memory value)198 external;199200 // Selector: deleteCollectionProperty(string) 7b7debce201 function deleteCollectionProperty(string memory key) external;202203 // Throws error if key not found204 //205 // Selector: collectionProperty(string) cf24fd6d206 function collectionProperty(string memory key)207 external208 view209 returns (bytes memory);210211 // Selector: setCollectionSponsor(address) 7623402e212 function setCollectionSponsor(address sponsor) external;213214 // Selector: confirmCollectionSponsorship() 3c50e97a215 function confirmCollectionSponsorship() external;216217 // Selector: setCollectionLimit(string,uint32) 6a3841db218 function setCollectionLimit(string memory limit, uint32 value) external;219220 // Selector: setCollectionLimit(string,bool) 993b7fba221 function setCollectionLimit(string memory limit, bool value) external;222223 // Selector: contractAddress() f6b4dfb4224 function contractAddress() external view returns (address);225226 // Selector: addCollectionAdminSubstrate(uint256) 5730062b227 function addCollectionAdminSubstrate(uint256 newAdmin) external view;228229 // Selector: removeCollectionAdminSubstrate(uint256) 4048fcf9230 function removeCollectionAdminSubstrate(uint256 newAdmin) external view;231232 // Selector: addCollectionAdmin(address) 92e462c7233 function addCollectionAdmin(address newAdmin) external view;234235 // Selector: removeCollectionAdmin(address) fafd7b42236 function removeCollectionAdmin(address admin) external view;237238 // Selector: setCollectionNesting(bool) 112d4586239 function setCollectionNesting(bool enable) external;240241 // Selector: setCollectionNesting(bool,address[]) 64872396242 function setCollectionNesting(bool enable, address[] memory collections)243 external;244245 // Selector: setCollectionAccess(uint8) 41835d4c246 function setCollectionAccess(uint8 mode) external;247248 // Selector: addToCollectionAllowList(address) 67844fe6249 function addToCollectionAllowList(address user) external view;250251 // Selector: removeFromCollectionAllowList(address) 85c51acb252 function removeFromCollectionAllowList(address user) external view;253254 // Selector: setCollectionMintMode(bool) 00018e84255 function setCollectionMintMode(bool mode) external;256}257258// Selector: d74d154f259interface ERC721UniqueExtensions is Dummy, ERC165 {260 // Selector: transfer(address,uint256) a9059cbb261 function transfer(address to, uint256 tokenId) external;262263 // Selector: burnFrom(address,uint256) 79cc6790264 function burnFrom(address from, uint256 tokenId) external;265266 // Selector: nextTokenId() 75794a3c267 function nextTokenId() external view returns (uint256);268269 // Selector: mintBulk(address,uint256[]) 44a9945e270 function mintBulk(address to, uint256[] memory tokenIds)271 external272 returns (bool);273274 // Selector: mintBulkWithTokenURI(address,(uint256,string)[]) 36543006275 function mintBulkWithTokenURI(address to, Tuple0[] memory tokens)276 external277 returns (bool);278}279280interface UniqueNFT is281 Dummy,282 ERC165,283 ERC721,284 ERC721Metadata,285 ERC721Enumerable,286 ERC721UniqueExtensions,287 ERC721Mintable,288 ERC721Burnable,289 Collection,290 TokenProperties291{}tests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth--- a/tests/src/eth/collectionAdmin.test.ts
+++ b/tests/src/eth/collectionAdmin.test.ts
@@ -25,8 +25,8 @@
} from './util/helpers';
describe('Add collection admins', () => {
- itWeb3('Add admin by owner', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('Add admin by owner', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -42,8 +42,8 @@
.to.be.eq(newAdmin.toLocaleLowerCase());
});
- itWeb3('Add substrate admin by owner', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('Add substrate admin by owner', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -60,8 +60,8 @@
.to.be.eq(newAdmin.address.toLocaleLowerCase());
});
- itWeb3('(!negative tests!) Add admin by ADMIN is not allowed', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('(!negative tests!) Add admin by ADMIN is not allowed', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -69,7 +69,7 @@
.send();
const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
- const admin = await createEthAccountWithBalance(api, web3);
+ const admin = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
await collectionEvm.methods.addCollectionAdmin(admin).send();
@@ -83,8 +83,8 @@
.to.be.eq(admin.toLocaleLowerCase());
});
- itWeb3('(!negative tests!) Add admin by USER is not allowed', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('(!negative tests!) Add admin by USER is not allowed', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -92,7 +92,7 @@
.send();
const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
- const notAdmin = await createEthAccountWithBalance(api, web3);
+ const notAdmin = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
const user = await createEthAccount(web3);
@@ -103,8 +103,8 @@
expect(adminList.length).to.be.eq(0);
});
- itWeb3('(!negative tests!) Add substrate admin by ADMIN is not allowed', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('(!negative tests!) Add substrate admin by ADMIN is not allowed', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -112,7 +112,7 @@
.send();
const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
- const admin = await createEthAccountWithBalance(api, web3);
+ const admin = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
await collectionEvm.methods.addCollectionAdmin(admin).send();
@@ -126,8 +126,8 @@
.to.be.eq(admin.toLocaleLowerCase());
});
- itWeb3('(!negative tests!) Add substrate admin by USER is not allowed', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('(!negative tests!) Add substrate admin by USER is not allowed', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -135,7 +135,7 @@
.send();
const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);
- const notAdmin0 = await createEthAccountWithBalance(api, web3);
+ const notAdmin0 = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
const notAdmin1 = privateKey('//Alice');
await expect(collectionEvm.methods.addCollectionAdminSubstrate(notAdmin1.addressRaw).call({from: notAdmin0}))
@@ -147,8 +147,8 @@
});
describe('Remove collection admins', () => {
- itWeb3('Remove admin by owner', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('Remove admin by owner', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -171,8 +171,8 @@
expect(adminList.length).to.be.eq(0);
});
- itWeb3('Remove substrate admin by owner', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('Remove substrate admin by owner', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -194,8 +194,8 @@
expect(adminList.length).to.be.eq(0);
});
- itWeb3('(!negative tests!) Remove admin by ADMIN is not allowed', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('(!negative tests!) Remove admin by ADMIN is not allowed', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -205,7 +205,7 @@
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
- const admin0 = await createEthAccountWithBalance(api, web3);
+ const admin0 = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
await collectionEvm.methods.addCollectionAdmin(admin0).send();
const admin1 = await createEthAccount(web3);
await collectionEvm.methods.addCollectionAdmin(admin1).send();
@@ -221,8 +221,8 @@
}
});
- itWeb3('(!negative tests!) Remove admin by USER is not allowed', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('(!negative tests!) Remove admin by USER is not allowed', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -232,7 +232,7 @@
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
- const admin = await createEthAccountWithBalance(api, web3);
+ const admin = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
await collectionEvm.methods.addCollectionAdmin(admin).send();
const notAdmin = await createEthAccount(web3);
@@ -246,8 +246,8 @@
}
});
- itWeb3('(!negative tests!) Remove substrate admin by ADMIN is not allowed', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('(!negative tests!) Remove substrate admin by ADMIN is not allowed', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -258,7 +258,7 @@
const adminSub = privateKey('//Alice');
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
await collectionEvm.methods.addCollectionAdminSubstrate(adminSub.addressRaw).send();
- const adminEth = await createEthAccountWithBalance(api, web3);
+ const adminEth = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
await collectionEvm.methods.addCollectionAdmin(adminEth).send();
await expect(collectionEvm.methods.removeCollectionAdminSubstrate(adminSub.addressRaw).call({from: adminEth}))
@@ -271,8 +271,8 @@
.to.be.deep.contains(adminEth.toLocaleLowerCase());
});
- itWeb3('(!negative tests!) Remove substrate admin by USER is not allowed', async ({api, web3}) => {
- const owner = await createEthAccountWithBalance(api, web3);
+ itWeb3('(!negative tests!) Remove substrate admin by USER is not allowed', async ({api, web3, privateKeyWrapper}) => {
+ const owner = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
const collectionHelper = evmCollectionHelpers(web3, owner);
const result = await collectionHelper.methods
@@ -283,7 +283,7 @@
const adminSub = privateKey('//Alice');
const collectionEvm = evmCollection(web3, owner, collectionIdAddress);
await collectionEvm.methods.addCollectionAdminSubstrate(adminSub.addressRaw).send();
- const notAdminEth = await createEthAccountWithBalance(api, web3);
+ const notAdminEth = await createEthAccountWithBalance(api, web3, privateKeyWrapper);
await expect(collectionEvm.methods.removeCollectionAdminSubstrate(adminSub.addressRaw).call({from: notAdminEth}))
.to.be.rejectedWith('NoPermission');
tests/src/eth/contractSponsoring.test.tsdiffbeforeafterboth--- a/tests/src/eth/contractSponsoring.test.ts
+++ b/tests/src/eth/contractSponsoring.test.ts
@@ -250,7 +250,7 @@
await collectionEvm.methods.setCollectionAccess(1 /*'AllowList'*/).send({from: owner});
await collectionEvm.methods.addToCollectionAllowList(user).send({from: owner});
- await collectionEvm.methods.setMintMode(true).send({from: owner});
+ await collectionEvm.methods.setCollectionMintMode(true).send({from: owner});
const newPermissions = (await getDetailedCollectionInfo(api, collectionId))!.permissions.toHuman();
expect(newPermissions.mintMode).to.be.true;
tests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth--- a/tests/src/eth/nonFungibleAbi.json
+++ b/tests/src/eth/nonFungibleAbi.json
@@ -386,27 +386,15 @@
"type": "function"
},
{
- "inputs": [
- { "internalType": "string", "name": "key", "type": "string" },
- { "internalType": "bytes", "name": "value", "type": "bytes" }
- ],
- "name": "setCollectionProperty",
- "outputs": [],
- "stateMutability": "nonpayable",
- "type": "function"
- },
- {
- "inputs": [
- { "internalType": "address", "name": "sponsor", "type": "address" }
- ],
- "name": "setCollectionSponsor",
+ "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],
+ "name": "setCollectionMintMode",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
- "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],
- "name": "setMintMode",
+ "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],
+ "name": "setCollectionNesting",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
@@ -420,14 +408,26 @@
"type": "address[]"
}
],
- "name": "setNesting",
+ "name": "setCollectionNesting",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
- "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],
- "name": "setNesting",
+ "inputs": [
+ { "internalType": "string", "name": "key", "type": "string" },
+ { "internalType": "bytes", "name": "value", "type": "bytes" }
+ ],
+ "name": "setCollectionProperty",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ { "internalType": "address", "name": "sponsor", "type": "address" }
+ ],
+ "name": "setCollectionSponsor",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
tests/src/removeCollectionAdmin.test.tsdiffbeforeafterboth--- a/tests/src/removeCollectionAdmin.test.ts
+++ b/tests/src/removeCollectionAdmin.test.ts
@@ -111,18 +111,24 @@
});
});
- it('Admin can\'t remove collection admin.', async () => {
+ it.only('Admin can\'t remove collection admin.', async () => {
await usingApi(async (api, privateKeyWrapper) => {
const collectionId = await createCollectionExpectSuccess();
const alice = privateKeyWrapper('//Alice');
const bob = privateKeyWrapper('//Bob');
const charlie = privateKeyWrapper('//Charlie');
+ const addBobAdminTx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(bob.address));
+ await submitTransactionAsync(alice, addBobAdminTx);
+ const addCharlieAdminTx = api.tx.unique.addCollectionAdmin(collectionId, normalizeAccountId(charlie.address));
+ await submitTransactionAsync(alice, addCharlieAdminTx);
+
const adminListAfterAddAdmin = await getAdminList(api, collectionId);
expect(adminListAfterAddAdmin).to.be.deep.contains(normalizeAccountId(bob.address));
+ expect(adminListAfterAddAdmin).to.be.deep.contains(normalizeAccountId(charlie.address));
const removeAdminTx = api.tx.unique.removeCollectionAdmin(collectionId, normalizeAccountId(bob.address));
- await expect(submitTransactionAsync(charlie, removeAdminTx)).to.be.rejected;
+ await expect(submitTransactionExpectFailAsync(charlie, removeAdminTx)).to.be.rejected;
const adminListAfterRemoveAdmin = await getAdminList(api, collectionId);
expect(adminListAfterRemoveAdmin).to.be.deep.contains(normalizeAccountId(bob.address));