difftreelog
CORE-386 Rename eth methods
in: master
8 files changed
pallets/common/src/erc.rsdiffbeforeafterboth83 Ok(prop.to_vec())83 Ok(prop.to_vec())84 }84 }858586 fn eth_set_sponsor(&mut self, caller: caller, sponsor: address) -> Result<void> {86 fn set_collection_sponsor(&mut self, caller: caller, sponsor: address) -> Result<void> {87 check_is_owner(caller, self)?;87 check_is_owner(caller, self)?;888889 let sponsor = T::CrossAccountId::from_eth(sponsor);89 let sponsor = T::CrossAccountId::from_eth(sponsor);92 Ok(())92 Ok(())93 }93 }949495 fn eth_confirm_sponsorship(&mut self, caller: caller) -> Result<void> {95 fn confirm_collection_sponsorship(&mut self, caller: caller) -> Result<void> {96 let caller = T::CrossAccountId::from_eth(caller);96 let caller = T::CrossAccountId::from_eth(caller);97 if !self.confirm_sponsorship(caller.as_sub()) {97 if !self.confirm_sponsorship(caller.as_sub()) {98 return Err(Error::Revert("Caller is not set as sponsor".into()));98 return Err(Error::Revert("Caller is not set as sponsor".into()));101 Ok(())101 Ok(())102 }102 }103103104 #[solidity(rename_selector = "setLimit")]104 #[solidity(rename_selector = "setCollectionLimit")]105 fn set_int_limit(&mut self, caller: caller, limit: string, value: uint32) -> Result<void> {105 fn set_int_limit(&mut self, caller: caller, limit: string, value: uint32) -> Result<void> {106 check_is_owner(caller, self)?;106 check_is_owner(caller, self)?;107 let mut limits = self.limits.clone();107 let mut limits = self.limits.clone();138 Ok(())138 Ok(())139 }139 }140140141 #[solidity(rename_selector = "setLimit")]141 #[solidity(rename_selector = "setCollectionLimit")]142 fn set_bool_limit(&mut self, caller: caller, limit: string, value: bool) -> Result<void> {142 fn set_bool_limit(&mut self, caller: caller, limit: string, value: bool) -> Result<void> {143 check_is_owner(caller, self)?;143 check_is_owner(caller, self)?;144 let mut limits = self.limits.clone();144 let mut limits = self.limits.clone();192 // Ok(())192 // Ok(())193 // }193 // }194194195 fn add_admin(&self, caller: caller, new_admin: address) -> Result<void> {195 fn add_collection_admin(&self, caller: caller, new_admin: address) -> Result<void> {196 let caller = T::CrossAccountId::from_eth(caller);196 let caller = T::CrossAccountId::from_eth(caller);197 self.check_is_owner_or_admin(&caller)197 self.check_is_owner_or_admin(&caller)198 .map_err(dispatch_to_evm::<T>)?;198 .map_err(dispatch_to_evm::<T>)?;202 Ok(())202 Ok(())203 }203 }204204205 fn remove_admin(&self, caller: caller, admin: address) -> Result<void> {205 fn remove_collection_admin(&self, caller: caller, admin: address) -> Result<void> {206 let caller = T::CrossAccountId::from_eth(caller);206 let caller = T::CrossAccountId::from_eth(caller);207 self.check_is_owner_or_admin(&caller)207 self.check_is_owner_or_admin(&caller)208 .map_err(dispatch_to_evm::<T>)?;208 .map_err(dispatch_to_evm::<T>)?;212 Ok(())212 Ok(())213 }213 }214214215 #[solidity(rename_selector = "setNesting")]215 #[solidity(rename_selector = "setCollectionNesting")]216 fn set_nesting_bool(&mut self, caller: caller, enable: bool) -> Result<void> {216 fn set_nesting_bool(&mut self, caller: caller, enable: bool) -> Result<void> {217 let caller = T::CrossAccountId::from_eth(caller);217 let caller = T::CrossAccountId::from_eth(caller);218 self.check_is_owner_or_admin(&caller)218 self.check_is_owner_or_admin(&caller)225 Ok(())225 Ok(())226 }226 }227227228 #[solidity(rename_selector = "setNesting")]228 #[solidity(rename_selector = "setCollectionNesting")]229 fn set_nesting(&mut self, caller: caller, enable: bool, collections: Vec<address>) -> Result<void> {229 fn set_nesting(&mut self, caller: caller, enable: bool, collections: Vec<address>) -> Result<void> {230 if collections.is_empty() {230 if collections.is_empty() {231 return Err("No addresses provided".into());231 return Err("No addresses provided".into());253 Ok(())253 Ok(())254 }254 }255255256 fn set_access(&mut self, caller: caller, mode: string) -> Result<void> {256 fn set_collection_access(&mut self, caller: caller, mode: string) -> Result<void> {257 let caller = T::CrossAccountId::from_eth(caller);257 let caller = T::CrossAccountId::from_eth(caller);258 self.check_is_owner_or_admin(&caller)258 self.check_is_owner_or_admin(&caller)259 .map_err(dispatch_to_evm::<T>)?;259 .map_err(dispatch_to_evm::<T>)?;266 Ok(())266 Ok(())267 }267 }268268269 fn add_to_allow_list(&self, caller: caller, user: address) -> Result<void> {269 fn add_to_collection_allow_list(&self, caller: caller, user: address) -> Result<void> {270 let caller = check_is_owner_or_admin(caller, self)?;270 let caller = check_is_owner_or_admin(caller, self)?;271 let user = T::CrossAccountId::from_eth(user);271 let user = T::CrossAccountId::from_eth(user);272 <Pallet<T>>::toggle_allowlist(self, &caller, &user, true)272 <Pallet<T>>::toggle_allowlist(self, &caller, &user, true)273 .map_err(dispatch_to_evm::<T>)?;273 .map_err(dispatch_to_evm::<T>)?;274 Ok(())274 Ok(())275 }275 }276276277 fn remove_from_allow_list(&self, caller: caller, user: address) -> Result<void> {277 fn remove_from_collection_allow_list(&self, caller: caller, user: address) -> Result<void> {278 let caller = check_is_owner_or_admin(caller, self)?;278 let caller = check_is_owner_or_admin(caller, self)?;279 let user = T::CrossAccountId::from_eth(user);279 let user = T::CrossAccountId::from_eth(user);280 <Pallet<T>>::toggle_allowlist(self, &caller, &user, false)280 <Pallet<T>>::toggle_allowlist(self, &caller, &user, false)281 .map_err(dispatch_to_evm::<T>)?;281 .map_err(dispatch_to_evm::<T>)?;282 Ok(())282 Ok(())283 }283 }284284285 fn set_mint_mode(&mut self, caller: caller, mode: bool) -> Result<void> {285 fn set_collection_mint_mode(&mut self, caller: caller, mode: bool) -> Result<void> {286 check_is_owner_or_admin(caller, self)?;286 check_is_owner_or_admin(caller, self)?;287 self.collection.permissions.mint_mode = Some(mode);287 self.collection.permissions.mint_mode = Some(mode);288 save(self);288 save(self);pallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth51 event MintingFinished();51 event MintingFinished();52}52}5354// Selector: 1248b7d155contract Collection is Dummy, ERC165 {56 // Selector: setCollectionProperty(string,bytes) 2f073f6657 function setCollectionProperty(string memory key, bytes memory value)58 public59 {60 require(false, stub_error);61 key;62 value;63 dummy = 0;64 }6566 // Selector: deleteCollectionProperty(string) 7b7debce67 function deleteCollectionProperty(string memory key) public {68 require(false, stub_error);69 key;70 dummy = 0;71 }7273 // Throws error if key not found74 //75 // Selector: collectionProperty(string) cf24fd6d76 function collectionProperty(string memory key)77 public78 view79 returns (bytes memory)80 {81 require(false, stub_error);82 key;83 dummy;84 return hex"";85 }8687 // Selector: setCollectionSponsor(address) 7623402e88 function setCollectionSponsor(address sponsor) public {89 require(false, stub_error);90 sponsor;91 dummy = 0;92 }9394 // Selector: confirmCollectionSponsorship() 3c50e97a95 function confirmCollectionSponsorship() public {96 require(false, stub_error);97 dummy = 0;98 }99100 // Selector: setCollectionLimit(string,uint32) 6a3841db101 function setCollectionLimit(string memory limit, uint32 value) public {102 require(false, stub_error);103 limit;104 value;105 dummy = 0;106 }107108 // Selector: setCollectionLimit(string,bool) 993b7fba109 function setCollectionLimit(string memory limit, bool value) public {110 require(false, stub_error);111 limit;112 value;113 dummy = 0;114 }115116 // Selector: contractAddress() f6b4dfb4117 function contractAddress() public view returns (address) {118 require(false, stub_error);119 dummy;120 return 0x0000000000000000000000000000000000000000;121 }122123 // Selector: addCollectionAdmin(address) 92e462c7124 function addCollectionAdmin(address newAdmin) public view {125 require(false, stub_error);126 newAdmin;127 dummy;128 }129130 // Selector: removeCollectionAdmin(address) fafd7b42131 function removeCollectionAdmin(address admin) public view {132 require(false, stub_error);133 admin;134 dummy;135 }136137 // Selector: setCollectionNesting(bool) 112d4586138 function setCollectionNesting(bool enable) public {139 require(false, stub_error);140 enable;141 dummy = 0;142 }143144 // Selector: setCollectionNesting(bool,address[]) 64872396145 function setCollectionNesting(bool enable, address[] memory collections)146 public147 {148 require(false, stub_error);149 enable;150 collections;151 dummy = 0;152 }153154 // Selector: setCollectionAccess(string) 392172a9155 function setCollectionAccess(string memory mode) public {156 require(false, stub_error);157 mode;158 dummy = 0;159 }160161 // Selector: addToCollectionAllowList(address) 67844fe6162 function addToCollectionAllowList(address user) public view {163 require(false, stub_error);164 user;165 dummy;166 }167168 // Selector: removeFromCollectionAllowList(address) 85c51acb169 function removeFromCollectionAllowList(address user) public view {170 require(false, stub_error);171 user;172 dummy;173 }174175 // Selector: setCollectionMintMode(bool) 00018e84176 function setCollectionMintMode(bool mode) public {177 require(false, stub_error);178 mode;179 dummy = 0;180 }181}5318254// Selector: 41369377183// Selector: 4136937755contract TokenProperties is Dummy, ERC165 {184contract TokenProperties is Dummy, ERC165 {380 }509 }381}510}382383// Selector: f56cd7fa384contract Collection is Dummy, ERC165 {385 // Selector: setCollectionProperty(string,bytes) 2f073f66386 function setCollectionProperty(string memory key, bytes memory value)387 public388 {389 require(false, stub_error);390 key;391 value;392 dummy = 0;393 }394395 // Selector: deleteCollectionProperty(string) 7b7debce396 function deleteCollectionProperty(string memory key) public {397 require(false, stub_error);398 key;399 dummy = 0;400 }401402 // Throws error if key not found403 //404 // Selector: collectionProperty(string) cf24fd6d405 function collectionProperty(string memory key)406 public407 view408 returns (bytes memory)409 {410 require(false, stub_error);411 key;412 dummy;413 return hex"";414 }415416 // Selector: ethSetSponsor(address) 8f9af356417 function ethSetSponsor(address sponsor) public {418 require(false, stub_error);419 sponsor;420 dummy = 0;421 }422423 // Selector: ethConfirmSponsorship() a8580d1a424 function ethConfirmSponsorship() public {425 require(false, stub_error);426 dummy = 0;427 }428429 // Selector: setLimit(string,uint32) 68db30ca430 function setLimit(string memory limit, uint32 value) public {431 require(false, stub_error);432 limit;433 value;434 dummy = 0;435 }436437 // Selector: setLimit(string,bool) ea67e4c2438 function setLimit(string memory limit, bool value) public {439 require(false, stub_error);440 limit;441 value;442 dummy = 0;443 }444445 // Selector: contractAddress() f6b4dfb4446 function contractAddress() public view returns (address) {447 require(false, stub_error);448 dummy;449 return 0x0000000000000000000000000000000000000000;450 }451452 // Selector: addAdmin(address) 70480275453 function addAdmin(address newAdmin) public view {454 require(false, stub_error);455 newAdmin;456 dummy;457 }458459 // Selector: removeAdmin(address) 1785f53c460 function removeAdmin(address admin) public view {461 require(false, stub_error);462 admin;463 dummy;464 }465466 // Selector: setNesting(bool) e8fc50dd467 function setNesting(bool enable) public {468 require(false, stub_error);469 enable;470 dummy = 0;471 }472473 // Selector: setNesting(bool,address[]) 7df12a9a474 function setNesting(bool enable, address[] memory collections) public {475 require(false, stub_error);476 enable;477 collections;478 dummy = 0;479 }480481 // Selector: setAccess(string) 488f56aa482 function setAccess(string memory mode) public {483 require(false, stub_error);484 mode;485 dummy = 0;486 }487488 // Selector: addToAllowList(address) 31f59102489 function addToAllowList(address user) public view {490 require(false, stub_error);491 user;492 dummy;493 }494495 // Selector: removeFromAllowList(address) eba8dabc496 function removeFromAllowList(address user) public view {497 require(false, stub_error);498 user;499 dummy;500 }501502 // Selector: setMintMode(bool) 5dea9bd5503 function setMintMode(bool mode) public {504 require(false, stub_error);505 mode;506 dummy = 0;507 }508}509511510contract UniqueNFT is512contract UniqueNFT is511 Dummy,513 Dummy,tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth42 event MintingFinished();42 event MintingFinished();43}43}4445// Selector: 1248b7d146interface Collection is Dummy, ERC165 {47 // Selector: setCollectionProperty(string,bytes) 2f073f6648 function setCollectionProperty(string memory key, bytes memory value)49 external;5051 // Selector: deleteCollectionProperty(string) 7b7debce52 function deleteCollectionProperty(string memory key) external;5354 // Throws error if key not found55 //56 // Selector: collectionProperty(string) cf24fd6d57 function collectionProperty(string memory key)58 external59 view60 returns (bytes memory);6162 // Selector: setCollectionSponsor(address) 7623402e63 function setCollectionSponsor(address sponsor) external;6465 // Selector: confirmCollectionSponsorship() 3c50e97a66 function confirmCollectionSponsorship() external;6768 // Selector: setCollectionLimit(string,uint32) 6a3841db69 function setCollectionLimit(string memory limit, uint32 value) external;7071 // Selector: setCollectionLimit(string,bool) 993b7fba72 function setCollectionLimit(string memory limit, bool value) external;7374 // Selector: contractAddress() f6b4dfb475 function contractAddress() external view returns (address);7677 // Selector: addCollectionAdmin(address) 92e462c778 function addCollectionAdmin(address newAdmin) external view;7980 // Selector: removeCollectionAdmin(address) fafd7b4281 function removeCollectionAdmin(address admin) external view;8283 // Selector: setCollectionNesting(bool) 112d458684 function setCollectionNesting(bool enable) external;8586 // Selector: setCollectionNesting(bool,address[]) 6487239687 function setCollectionNesting(bool enable, address[] memory collections)88 external;8990 // Selector: setCollectionAccess(string) 392172a991 function setCollectionAccess(string memory mode) external;9293 // Selector: addToCollectionAllowList(address) 67844fe694 function addToCollectionAllowList(address user) external view;9596 // Selector: removeFromCollectionAllowList(address) 85c51acb97 function removeFromCollectionAllowList(address user) external view;9899 // Selector: setCollectionMintMode(bool) 00018e84100 function setCollectionMintMode(bool mode) external;101}4410245// Selector: 41369377103// Selector: 4136937746interface TokenProperties is Dummy, ERC165 {104interface TokenProperties is Dummy, ERC165 {213 returns (bool);271 returns (bool);214}272}215216// Selector: f56cd7fa217interface Collection is Dummy, ERC165 {218 // Selector: setCollectionProperty(string,bytes) 2f073f66219 function setCollectionProperty(string memory key, bytes memory value)220 external;221222 // Selector: deleteCollectionProperty(string) 7b7debce223 function deleteCollectionProperty(string memory key) external;224225 // Throws error if key not found226 //227 // Selector: collectionProperty(string) cf24fd6d228 function collectionProperty(string memory key)229 external230 view231 returns (bytes memory);232233 // Selector: ethSetSponsor(address) 8f9af356234 function ethSetSponsor(address sponsor) external;235236 // Selector: ethConfirmSponsorship() a8580d1a237 function ethConfirmSponsorship() external;238239 // Selector: setLimit(string,uint32) 68db30ca240 function setLimit(string memory limit, uint32 value) external;241242 // Selector: setLimit(string,bool) ea67e4c2243 function setLimit(string memory limit, bool value) external;244245 // Selector: contractAddress() f6b4dfb4246 function contractAddress() external view returns (address);247248 // Selector: addAdmin(address) 70480275249 function addAdmin(address newAdmin) external view;250251 // Selector: removeAdmin(address) 1785f53c252 function removeAdmin(address admin) external view;253254 // Selector: setNesting(bool) e8fc50dd255 function setNesting(bool enable) external;256257 // Selector: setNesting(bool,address[]) 7df12a9a258 function setNesting(bool enable, address[] memory collections) external;259260 // Selector: setAccess(string) 488f56aa261 function setAccess(string memory mode) external;262263 // Selector: addToAllowList(address) 31f59102264 function addToAllowList(address user) external view;265266 // Selector: removeFromAllowList(address) eba8dabc267 function removeFromAllowList(address user) external view;268269 // Selector: setMintMode(bool) 5dea9bd5270 function setMintMode(bool mode) external;271}272273273interface UniqueNFT is274interface UniqueNFT is274 Dummy,275 Dummy,tests/src/eth/contractSponsoring.test.tsdiffbeforeafterboth222 });222 });223223224 //TODO: CORE-302 add eth methods224 //TODO: CORE-302 add eth methods225 itWeb3('Sponsoring collection from evm address via access list', async ({api, web3}) => {225 itWeb3.skip('Sponsoring collection from evm address via access list', async ({api, web3}) => {226 const owner = await createEthAccountWithBalance(api, web3);226 const owner = await createEthAccountWithBalance(api, web3);227 const collectionHelpers = evmCollectionHelpers(web3, owner);227 const collectionHelpers = evmCollectionHelpers(web3, owner);228 let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send();228 let result = await collectionHelpers.methods.createNonfungibleCollection('Sponsor collection', '1', '1').send();292 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);292 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);293 const sponsor = await createEthAccountWithBalance(api, web3);293 const sponsor = await createEthAccountWithBalance(api, web3);294 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);294 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);295 result = await collectionEvm.methods.ethSetSponsor(sponsor).send();295 result = await collectionEvm.methods.setCollectionSponsor(sponsor).send();296 let collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;296 let collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;297 expect(collectionSub.sponsorship.isUnconfirmed).to.be.true;297 expect(collectionSub.sponsorship.isUnconfirmed).to.be.true;298 expect(collectionSub.sponsorship.asUnconfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));298 expect(collectionSub.sponsorship.asUnconfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));299 await expect(collectionEvm.methods.ethConfirmSponsorship().call()).to.be.rejectedWith('Caller is not set as sponsor');299 await expect(collectionEvm.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('Caller is not set as sponsor');300 const sponsorCollection = evmCollection(web3, sponsor, collectionIdAddress);300 const sponsorCollection = evmCollection(web3, sponsor, collectionIdAddress);301 await sponsorCollection.methods.ethConfirmSponsorship().send();301 await sponsorCollection.methods.confirmCollectionSponsorship().send();302 collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;302 collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;303 expect(collectionSub.sponsorship.isConfirmed).to.be.true;303 expect(collectionSub.sponsorship.isConfirmed).to.be.true;304 expect(collectionSub.sponsorship.asConfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));304 expect(collectionSub.sponsorship.asConfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));305305306 const user = createEthAccount(web3);306 const user = createEthAccount(web3);307 await collectionEvm.methods.addAdmin(user).send();307 await collectionEvm.methods.addCollectionAdmin(user).send();308 308 309 const ownerBalanceBefore = await ethBalanceViaSub(api, owner);309 const ownerBalanceBefore = await ethBalanceViaSub(api, owner);310 const sponsorBalanceBefore = await ethBalanceViaSub(api, sponsor);310 const sponsorBalanceBefore = await ethBalanceViaSub(api, sponsor);tests/src/eth/createCollection.test.tsdiffbeforeafterboth75 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);75 const {collectionIdAddress, collectionId} = await getCollectionAddressFromResult(api, result);76 const sponsor = await createEthAccountWithBalance(api, web3);76 const sponsor = await createEthAccountWithBalance(api, web3);77 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);77 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);78 result = await collectionEvm.methods.ethSetSponsor(sponsor).send();78 result = await collectionEvm.methods.setCollectionSponsor(sponsor).send();79 let collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;79 let collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;80 expect(collectionSub.sponsorship.isUnconfirmed).to.be.true;80 expect(collectionSub.sponsorship.isUnconfirmed).to.be.true;81 expect(collectionSub.sponsorship.asUnconfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));81 expect(collectionSub.sponsorship.asUnconfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));82 await expect(collectionEvm.methods.ethConfirmSponsorship().call()).to.be.rejectedWith('Caller is not set as sponsor');82 await expect(collectionEvm.methods.confirmCollectionSponsorship().call()).to.be.rejectedWith('Caller is not set as sponsor');83 const sponsorCollection = evmCollection(web3, sponsor, collectionIdAddress);83 const sponsorCollection = evmCollection(web3, sponsor, collectionIdAddress);84 await sponsorCollection.methods.ethConfirmSponsorship().send();84 await sponsorCollection.methods.confirmCollectionSponsorship().send();85 collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;85 collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;86 expect(collectionSub.sponsorship.isConfirmed).to.be.true;86 expect(collectionSub.sponsorship.isConfirmed).to.be.true;87 expect(collectionSub.sponsorship.asConfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));87 expect(collectionSub.sponsorship.asConfirmed.toHuman()).to.be.eq(evmToAddress(sponsor));105 };105 };106106107 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);107 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);108 await collectionEvm.methods['setLimit(string,uint32)']('accountTokenOwnershipLimit', limits.accountTokenOwnershipLimit).send();108 await collectionEvm.methods['setCollectionLimit(string,uint32)']('accountTokenOwnershipLimit', limits.accountTokenOwnershipLimit).send();109 await collectionEvm.methods['setLimit(string,uint32)']('sponsoredDataSize', limits.sponsoredDataSize).send();109 await collectionEvm.methods['setCollectionLimit(string,uint32)']('sponsoredDataSize', limits.sponsoredDataSize).send();110 await collectionEvm.methods['setLimit(string,uint32)']('sponsoredDataRateLimit', limits.sponsoredDataRateLimit).send();110 await collectionEvm.methods['setCollectionLimit(string,uint32)']('sponsoredDataRateLimit', limits.sponsoredDataRateLimit).send();111 await collectionEvm.methods['setLimit(string,uint32)']('tokenLimit', limits.tokenLimit).send();111 await collectionEvm.methods['setCollectionLimit(string,uint32)']('tokenLimit', limits.tokenLimit).send();112 await collectionEvm.methods['setLimit(string,uint32)']('sponsorTransferTimeout', limits.sponsorTransferTimeout).send();112 await collectionEvm.methods['setCollectionLimit(string,uint32)']('sponsorTransferTimeout', limits.sponsorTransferTimeout).send();113 await collectionEvm.methods['setLimit(string,uint32)']('sponsorApproveTimeout', limits.sponsorApproveTimeout).send();113 await collectionEvm.methods['setCollectionLimit(string,uint32)']('sponsorApproveTimeout', limits.sponsorApproveTimeout).send();114 await collectionEvm.methods['setLimit(string,bool)']('ownerCanTransfer', limits.ownerCanTransfer).send();114 await collectionEvm.methods['setCollectionLimit(string,bool)']('ownerCanTransfer', limits.ownerCanTransfer).send();115 await collectionEvm.methods['setLimit(string,bool)']('ownerCanDestroy', limits.ownerCanDestroy).send();115 await collectionEvm.methods['setCollectionLimit(string,bool)']('ownerCanDestroy', limits.ownerCanDestroy).send();116 await collectionEvm.methods['setLimit(string,bool)']('transfersEnabled', limits.transfersEnabled).send();116 await collectionEvm.methods['setCollectionLimit(string,bool)']('transfersEnabled', limits.transfersEnabled).send();117 117 118 const collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;118 const collectionSub = (await getDetailedCollectionInfo(api, collectionId))!;119 expect(collectionSub.limits.accountTokenOwnershipLimit.unwrap().toNumber()).to.be.eq(limits.accountTokenOwnershipLimit);119 expect(collectionSub.limits.accountTokenOwnershipLimit.unwrap().toNumber()).to.be.eq(limits.accountTokenOwnershipLimit);201 {201 {202 const sponsor = await createEthAccountWithBalance(api, web3);202 const sponsor = await createEthAccountWithBalance(api, web3);203 await expect(contractEvmFromNotOwner.methods203 await expect(contractEvmFromNotOwner.methods204 .ethSetSponsor(sponsor)204 .setCollectionSponsor(sponsor)205 .call()).to.be.rejectedWith(EXPECTED_ERROR);205 .call()).to.be.rejectedWith(EXPECTED_ERROR);206 206 207 const sponsorCollection = evmCollection(web3, sponsor, collectionIdAddress);207 const sponsorCollection = evmCollection(web3, sponsor, collectionIdAddress);208 await expect(sponsorCollection.methods208 await expect(sponsorCollection.methods209 .ethConfirmSponsorship()209 .confirmCollectionSponsorship()210 .call()).to.be.rejectedWith('Caller is not set as sponsor');210 .call()).to.be.rejectedWith('Caller is not set as sponsor');211 }211 }212 {212 {213 await expect(contractEvmFromNotOwner.methods213 await expect(contractEvmFromNotOwner.methods214 .setLimit('account_token_ownership_limit', '1000')214 .setCollectionLimit('account_token_ownership_limit', '1000')215 .call()).to.be.rejectedWith(EXPECTED_ERROR);215 .call()).to.be.rejectedWith(EXPECTED_ERROR);216 }216 }217 });217 });223 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);223 const {collectionIdAddress} = await getCollectionAddressFromResult(api, result);224 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);224 const collectionEvm = evmCollection(web3, owner, collectionIdAddress);225 await expect(collectionEvm.methods225 await expect(collectionEvm.methods226 .setLimit('badLimit', 'true')226 .setCollectionLimit('badLimit', 'true')227 .call()).to.be.rejectedWith('Unknown boolean limit "badLimit"');227 .call()).to.be.rejectedWith('Unknown boolean limit "badLimit"');228 });228 });229});229});tests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth84 "inputs": [84 "inputs": [85 { "internalType": "address", "name": "newAdmin", "type": "address" }85 { "internalType": "address", "name": "newAdmin", "type": "address" }86 ],86 ],87 "name": "addAdmin",87 "name": "addCollectionAdmin",88 "outputs": [],88 "outputs": [],89 "stateMutability": "view",89 "stateMutability": "view",90 "type": "function"90 "type": "function"93 "inputs": [93 "inputs": [94 { "internalType": "address", "name": "user", "type": "address" }94 { "internalType": "address", "name": "user", "type": "address" }95 ],95 ],96 "name": "addToAllowList",96 "name": "addToCollectionAllowList",97 "outputs": [],97 "outputs": [],98 "stateMutability": "view",98 "stateMutability": "view",99 "type": "function"99 "type": "function"143 "stateMutability": "view",143 "stateMutability": "view",144 "type": "function"144 "type": "function"145 },145 },146 {147 "inputs": [],148 "name": "confirmCollectionSponsorship",149 "outputs": [],150 "stateMutability": "nonpayable",151 "type": "function"152 },146 {153 {147 "inputs": [],154 "inputs": [],148 "name": "contractAddress",155 "name": "contractAddress",167 "stateMutability": "nonpayable",174 "stateMutability": "nonpayable",168 "type": "function"175 "type": "function"169 },176 },170 {171 "inputs": [],172 "name": "ethConfirmSponsorship",173 "outputs": [],174 "stateMutability": "nonpayable",175 "type": "function"176 },177 {178 "inputs": [179 { "internalType": "address", "name": "sponsor", "type": "address" }180 ],181 "name": "ethSetSponsor",182 "outputs": [],183 "stateMutability": "nonpayable",184 "type": "function"185 },186 {177 {187 "inputs": [],178 "inputs": [],188 "name": "finishMinting",179 "name": "finishMinting",302 "inputs": [293 "inputs": [303 { "internalType": "address", "name": "admin", "type": "address" }294 { "internalType": "address", "name": "admin", "type": "address" }304 ],295 ],305 "name": "removeAdmin",296 "name": "removeCollectionAdmin",306 "outputs": [],297 "outputs": [],307 "stateMutability": "view",298 "stateMutability": "view",308 "type": "function"299 "type": "function"311 "inputs": [302 "inputs": [312 { "internalType": "address", "name": "user", "type": "address" }303 { "internalType": "address", "name": "user", "type": "address" }313 ],304 ],314 "name": "removeFromAllowList",305 "name": "removeFromCollectionAllowList",315 "outputs": [],306 "outputs": [],316 "stateMutability": "view",307 "stateMutability": "view",317 "type": "function"308 "type": "function"339 "stateMutability": "nonpayable",330 "stateMutability": "nonpayable",340 "type": "function"331 "type": "function"341 },332 },342 {343 "inputs": [{ "internalType": "string", "name": "mode", "type": "string" }],344 "name": "setAccess",345 "outputs": [],346 "stateMutability": "nonpayable",347 "type": "function"348 },349 {333 {350 "inputs": [334 "inputs": [351 { "internalType": "address", "name": "operator", "type": "address" },335 { "internalType": "address", "name": "operator", "type": "address" },357 "type": "function"341 "type": "function"358 },342 },359 {343 {360 "inputs": [344 "inputs": [{ "internalType": "string", "name": "mode", "type": "string" }],361 { "internalType": "string", "name": "key", "type": "string" },362 { "internalType": "bytes", "name": "value", "type": "bytes" }363 ],364 "name": "setCollectionProperty",345 "name": "setCollectionAccess",365 "outputs": [],346 "outputs": [],366 "stateMutability": "nonpayable",347 "stateMutability": "nonpayable",367 "type": "function"348 "type": "function"371 { "internalType": "string", "name": "limit", "type": "string" },352 { "internalType": "string", "name": "limit", "type": "string" },372 { "internalType": "uint32", "name": "value", "type": "uint32" }353 { "internalType": "uint32", "name": "value", "type": "uint32" }373 ],354 ],374 "name": "setLimit",355 "name": "setCollectionLimit",375 "outputs": [],356 "outputs": [],376 "stateMutability": "nonpayable",357 "stateMutability": "nonpayable",377 "type": "function"358 "type": "function"381 { "internalType": "string", "name": "limit", "type": "string" },362 { "internalType": "string", "name": "limit", "type": "string" },382 { "internalType": "bool", "name": "value", "type": "bool" }363 { "internalType": "bool", "name": "value", "type": "bool" }383 ],364 ],384 "name": "setLimit",365 "name": "setCollectionLimit",385 "outputs": [],366 "outputs": [],386 "stateMutability": "nonpayable",367 "stateMutability": "nonpayable",387 "type": "function"368 "type": "function"388 },369 },389 {370 {390 "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],371 "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],391 "name": "setMintMode",372 "name": "setCollectionMintMode",392 "outputs": [],373 "outputs": [],393 "stateMutability": "nonpayable",374 "stateMutability": "nonpayable",394 "type": "function"375 "type": "function"395 },376 },377 {378 "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],379 "name": "setCollectionNesting",380 "outputs": [],381 "stateMutability": "nonpayable",382 "type": "function"383 },396 {384 {397 "inputs": [385 "inputs": [398 { "internalType": "bool", "name": "enable", "type": "bool" },386 { "internalType": "bool", "name": "enable", "type": "bool" },402 "type": "address[]"390 "type": "address[]"403 }391 }404 ],392 ],405 "name": "setNesting",393 "name": "setCollectionNesting",406 "outputs": [],394 "outputs": [],407 "stateMutability": "nonpayable",395 "stateMutability": "nonpayable",408 "type": "function"396 "type": "function"409 },397 },410 {398 {411 "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],399 "inputs": [400 { "internalType": "string", "name": "key", "type": "string" },401 { "internalType": "bytes", "name": "value", "type": "bytes" }402 ],412 "name": "setNesting",403 "name": "setCollectionProperty",413 "outputs": [],404 "outputs": [],414 "stateMutability": "nonpayable",405 "stateMutability": "nonpayable",415 "type": "function"406 "type": "function"416 },407 },408 {409 "inputs": [410 { "internalType": "address", "name": "sponsor", "type": "address" }411 ],412 "name": "setCollectionSponsor",413 "outputs": [],414 "stateMutability": "nonpayable",415 "type": "function"416 },417 {417 {418 "inputs": [418 "inputs": [419 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },419 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },tests/src/eth/proxy/nonFungibleProxy.test.tsdiffbeforeafterboth99 const collectionEvmOwned = evmCollection(web3, owner, collectionIdAddress);99 const collectionEvmOwned = evmCollection(web3, owner, collectionIdAddress);100 const collectionEvm = evmCollection(web3, caller, collectionIdAddress);100 const collectionEvm = evmCollection(web3, caller, collectionIdAddress);101 const contract = await proxyWrap(api, web3, collectionEvm);101 const contract = await proxyWrap(api, web3, collectionEvm);102 await collectionEvmOwned.methods.addAdmin(contract.options.address).send();102 await collectionEvmOwned.methods.addCollectionAdmin(contract.options.address).send();103103104 {104 {105 const nextTokenId = await contract.methods.nextTokenId().call();105 const nextTokenId = await contract.methods.nextTokenId().call();