difftreelog
feature: Added `delete_properties` in eth functions. The `delete_property` function is now deprecated.
in: master
15 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6376,7 +6376,7 @@
[[package]]
name = "pallet-nonfungible"
-version = "0.1.7"
+version = "0.1.8"
dependencies = [
"ethereum",
"evm-coder",
@@ -6498,7 +6498,7 @@
[[package]]
name = "pallet-refungible"
-version = "0.2.6"
+version = "0.2.7"
dependencies = [
"derivative",
"ethereum",
pallets/nonfungible/CHANGELOG.mddiffbeforeafterboth--- a/pallets/nonfungible/CHANGELOG.md
+++ b/pallets/nonfungible/CHANGELOG.md
@@ -3,10 +3,19 @@
All notable changes to this project will be documented in this file.
<!-- bureaucrate goes here -->
+
+## [v0.1.8] - 2022-11-11
+
+### Changed
+
+- Added `delete_properties` in eth functions. The `delete_property` function is now deprecated.
+
## [v0.1.7] - 2022-11-02
+
### Changed
- - Use named structure `EthCrossAccount` in eth functions.
+- Use named structure `EthCrossAccount` in eth functions.
+
## [v0.1.6] - 2022-20-10
### Change
pallets/nonfungible/Cargo.tomldiffbeforeafterboth--- a/pallets/nonfungible/Cargo.toml
+++ b/pallets/nonfungible/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "pallet-nonfungible"
-version = "0.1.7"
+version = "0.1.8"
license = "GPLv3"
edition = "2021"
pallets/nonfungible/src/erc.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -162,6 +162,7 @@
/// @dev Throws error if `msg.sender` has no permission to edit the property.
/// @param tokenId ID of the token.
/// @param key Property key.
+ #[solidity(hide)]
fn delete_property(&mut self, token_id: uint256, caller: caller, key: string) -> Result<()> {
let caller = T::CrossAccountId::from_eth(caller);
let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
@@ -177,6 +178,37 @@
.map_err(dispatch_to_evm::<T>)
}
+ /// @notice Delete token properties value.
+ /// @dev Throws error if `msg.sender` has no permission to edit the property.
+ /// @param tokenId ID of the token.
+ /// @param keys Properties key.
+ fn delete_properties(
+ &mut self,
+ token_id: uint256,
+ caller: caller,
+ keys: Vec<string>,
+ ) -> Result<()> {
+ let caller = T::CrossAccountId::from_eth(caller);
+ let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
+ let keys = keys
+ .into_iter()
+ .map(|k| Ok(<Vec<u8>>::from(k).try_into().map_err(|_| "key too long")?))
+ .collect::<Result<Vec<_>>>()?;
+
+ let nesting_budget = self
+ .recorder
+ .weight_calls_budget(<StructureWeight<T>>::find_parent());
+
+ <Pallet<T>>::delete_token_properties(
+ self,
+ &caller,
+ TokenId(token_id),
+ keys.into_iter(),
+ &nesting_budget,
+ )
+ .map_err(dispatch_to_evm::<T>)
+ }
+
/// @notice Get token property value.
/// @dev Throws error if key not found
/// @param tokenId ID of the token.
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth--- a/pallets/nonfungible/src/stubs/UniqueNFT.sol
+++ b/pallets/nonfungible/src/stubs/UniqueNFT.sol
@@ -18,7 +18,7 @@
}
/// @title A contract that allows to set and delete token properties and change token property permissions.
-/// @dev the ERC-165 identifier for this interface is 0x55dba919
+/// @dev the ERC-165 identifier for this interface is 0x91a97a68
contract TokenProperties is Dummy, ERC165 {
/// @notice Set permissions for token property.
/// @dev Throws error if `msg.sender` is not admin or owner of the collection.
@@ -74,16 +74,29 @@
dummy = 0;
}
- /// @notice Delete token property value.
+ // /// @notice Delete token property value.
+ // /// @dev Throws error if `msg.sender` has no permission to edit the property.
+ // /// @param tokenId ID of the token.
+ // /// @param key Property key.
+ // /// @dev EVM selector for this function is: 0x066111d1,
+ // /// or in textual repr: deleteProperty(uint256,string)
+ // function deleteProperty(uint256 tokenId, string memory key) public {
+ // require(false, stub_error);
+ // tokenId;
+ // key;
+ // dummy = 0;
+ // }
+
+ /// @notice Delete token properties value.
/// @dev Throws error if `msg.sender` has no permission to edit the property.
/// @param tokenId ID of the token.
- /// @param key Property key.
- /// @dev EVM selector for this function is: 0x066111d1,
- /// or in textual repr: deleteProperty(uint256,string)
- function deleteProperty(uint256 tokenId, string memory key) public {
+ /// @param keys Properties key.
+ /// @dev EVM selector for this function is: 0xc472d371,
+ /// or in textual repr: deleteProperties(uint256,string[])
+ function deleteProperties(uint256 tokenId, string[] memory keys) public {
require(false, stub_error);
tokenId;
- key;
+ keys;
dummy = 0;
}
pallets/refungible/CHANGELOG.mddiffbeforeafterboth--- a/pallets/refungible/CHANGELOG.md
+++ b/pallets/refungible/CHANGELOG.md
@@ -2,10 +2,20 @@
All notable changes to this project will be documented in this file.
+<!-- bureaucrate goes here -->
+
+## [v0.2.7] - 2022-11-11
+
+### Changed
+
+- Added `delete_properties` in eth functions. The `delete_property` function is now deprecated.
+
## [v0.2.6] - 2022-11-02
+
### Changed
- - Use named structure `EthCrossAccount` in eth functions.
+- Use named structure `EthCrossAccount` in eth functions.
+
## [v0.2.5] - 2022-20-10
### Change
@@ -17,8 +27,6 @@
### Change
- Add bound `AsRef<[u8; 32]>` to `T::CrossAccountId`.
-
-<!-- bureaucrate goes here -->
## [v0.2.3] 2022-08-16
pallets/refungible/Cargo.tomldiffbeforeafterboth--- a/pallets/refungible/Cargo.toml
+++ b/pallets/refungible/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "pallet-refungible"
-version = "0.2.6"
+version = "0.2.7"
license = "GPLv3"
edition = "2021"
pallets/refungible/src/erc.rsdiffbeforeafterboth--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -164,6 +164,7 @@
/// @dev Throws error if `msg.sender` has no permission to edit the property.
/// @param tokenId ID of the token.
/// @param key Property key.
+ #[solidity(hide)]
fn delete_property(&mut self, token_id: uint256, caller: caller, key: string) -> Result<()> {
let caller = T::CrossAccountId::from_eth(caller);
let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
@@ -179,6 +180,37 @@
.map_err(dispatch_to_evm::<T>)
}
+ /// @notice Delete token properties value.
+ /// @dev Throws error if `msg.sender` has no permission to edit the property.
+ /// @param tokenId ID of the token.
+ /// @param keys Properties key.
+ fn delete_properties(
+ &mut self,
+ token_id: uint256,
+ caller: caller,
+ keys: Vec<string>,
+ ) -> Result<()> {
+ let caller = T::CrossAccountId::from_eth(caller);
+ let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
+ let keys = keys
+ .into_iter()
+ .map(|k| Ok(<Vec<u8>>::from(k).try_into().map_err(|_| "key too long")?))
+ .collect::<Result<Vec<_>>>()?;
+
+ let nesting_budget = self
+ .recorder
+ .weight_calls_budget(<StructureWeight<T>>::find_parent());
+
+ <Pallet<T>>::delete_token_properties(
+ self,
+ &caller,
+ TokenId(token_id),
+ keys.into_iter(),
+ &nesting_budget,
+ )
+ .map_err(dispatch_to_evm::<T>)
+ }
+
/// @notice Get token property value.
/// @dev Throws error if key not found
/// @param tokenId ID of the token.
pallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth--- a/pallets/refungible/src/stubs/UniqueRefungible.sol
+++ b/pallets/refungible/src/stubs/UniqueRefungible.sol
@@ -18,7 +18,7 @@
}
/// @title A contract that allows to set and delete token properties and change token property permissions.
-/// @dev the ERC-165 identifier for this interface is 0x55dba919
+/// @dev the ERC-165 identifier for this interface is 0x91a97a68
contract TokenProperties is Dummy, ERC165 {
/// @notice Set permissions for token property.
/// @dev Throws error if `msg.sender` is not admin or owner of the collection.
@@ -74,16 +74,29 @@
dummy = 0;
}
- /// @notice Delete token property value.
+ // /// @notice Delete token property value.
+ // /// @dev Throws error if `msg.sender` has no permission to edit the property.
+ // /// @param tokenId ID of the token.
+ // /// @param key Property key.
+ // /// @dev EVM selector for this function is: 0x066111d1,
+ // /// or in textual repr: deleteProperty(uint256,string)
+ // function deleteProperty(uint256 tokenId, string memory key) public {
+ // require(false, stub_error);
+ // tokenId;
+ // key;
+ // dummy = 0;
+ // }
+
+ /// @notice Delete token properties value.
/// @dev Throws error if `msg.sender` has no permission to edit the property.
/// @param tokenId ID of the token.
- /// @param key Property key.
- /// @dev EVM selector for this function is: 0x066111d1,
- /// or in textual repr: deleteProperty(uint256,string)
- function deleteProperty(uint256 tokenId, string memory key) public {
+ /// @param keys Properties key.
+ /// @dev EVM selector for this function is: 0xc472d371,
+ /// or in textual repr: deleteProperties(uint256,string[])
+ function deleteProperties(uint256 tokenId, string[] memory keys) public {
require(false, stub_error);
tokenId;
- key;
+ keys;
dummy = 0;
}
tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -13,7 +13,7 @@
}
/// @title A contract that allows to set and delete token properties and change token property permissions.
-/// @dev the ERC-165 identifier for this interface is 0x55dba919
+/// @dev the ERC-165 identifier for this interface is 0x91a97a68
interface TokenProperties is Dummy, ERC165 {
/// @notice Set permissions for token property.
/// @dev Throws error if `msg.sender` is not admin or owner of the collection.
@@ -51,13 +51,21 @@
/// or in textual repr: setProperties(uint256,(string,bytes)[])
function setProperties(uint256 tokenId, Tuple21[] memory properties) external;
- /// @notice Delete token property value.
+ // /// @notice Delete token property value.
+ // /// @dev Throws error if `msg.sender` has no permission to edit the property.
+ // /// @param tokenId ID of the token.
+ // /// @param key Property key.
+ // /// @dev EVM selector for this function is: 0x066111d1,
+ // /// or in textual repr: deleteProperty(uint256,string)
+ // function deleteProperty(uint256 tokenId, string memory key) external;
+
+ /// @notice Delete token properties value.
/// @dev Throws error if `msg.sender` has no permission to edit the property.
/// @param tokenId ID of the token.
- /// @param key Property key.
- /// @dev EVM selector for this function is: 0x066111d1,
- /// or in textual repr: deleteProperty(uint256,string)
- function deleteProperty(uint256 tokenId, string memory key) external;
+ /// @param keys Properties key.
+ /// @dev EVM selector for this function is: 0xc472d371,
+ /// or in textual repr: deleteProperties(uint256,string[])
+ function deleteProperties(uint256 tokenId, string[] memory keys) external;
/// @notice Get token property value.
/// @dev Throws error if key not found
tests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueRefungible.sol
+++ b/tests/src/eth/api/UniqueRefungible.sol
@@ -13,7 +13,7 @@
}
/// @title A contract that allows to set and delete token properties and change token property permissions.
-/// @dev the ERC-165 identifier for this interface is 0x55dba919
+/// @dev the ERC-165 identifier for this interface is 0x91a97a68
interface TokenProperties is Dummy, ERC165 {
/// @notice Set permissions for token property.
/// @dev Throws error if `msg.sender` is not admin or owner of the collection.
@@ -51,13 +51,21 @@
/// or in textual repr: setProperties(uint256,(string,bytes)[])
function setProperties(uint256 tokenId, Tuple20[] memory properties) external;
- /// @notice Delete token property value.
+ // /// @notice Delete token property value.
+ // /// @dev Throws error if `msg.sender` has no permission to edit the property.
+ // /// @param tokenId ID of the token.
+ // /// @param key Property key.
+ // /// @dev EVM selector for this function is: 0x066111d1,
+ // /// or in textual repr: deleteProperty(uint256,string)
+ // function deleteProperty(uint256 tokenId, string memory key) external;
+
+ /// @notice Delete token properties value.
/// @dev Throws error if `msg.sender` has no permission to edit the property.
/// @param tokenId ID of the token.
- /// @param key Property key.
- /// @dev EVM selector for this function is: 0x066111d1,
- /// or in textual repr: deleteProperty(uint256,string)
- function deleteProperty(uint256 tokenId, string memory key) external;
+ /// @param keys Properties key.
+ /// @dev EVM selector for this function is: 0xc472d371,
+ /// or in textual repr: deleteProperties(uint256,string[])
+ function deleteProperties(uint256 tokenId, string[] memory keys) external;
/// @notice Get token property value.
/// @dev Throws error if key not found
tests/src/eth/collectionProperties.test.tsdiffbeforeafterboth--- a/tests/src/eth/collectionProperties.test.ts
+++ b/tests/src/eth/collectionProperties.test.ts
@@ -139,7 +139,7 @@
await contract.methods.setProperty(tokenId1, 'URI', Buffer.from(URI)).send();
expect(await contract.methods.tokenURI(tokenId1).call()).to.equal(URI);
- await contract.methods.deleteProperty(tokenId1, 'URI').send();
+ await contract.methods.deleteProperties(tokenId1, ['URI']).send();
expect(await contract.methods.tokenURI(tokenId1).call()).to.equal(BASE_URI + SUFFIX);
const token2Result = await contract.methods.mintWithTokenURI(bruh, URI).send();
@@ -147,7 +147,7 @@
expect(await contract.methods.tokenURI(tokenId2).call()).to.equal(URI);
- await contract.methods.deleteProperty(tokenId2, 'URI').send();
+ await contract.methods.deleteProperties(tokenId2, ['URI']).send();
expect(await contract.methods.tokenURI(tokenId2).call()).to.equal(BASE_URI);
await contract.methods.setProperty(tokenId2, 'URISuffix', Buffer.from(SUFFIX)).send();
tests/src/eth/nonFungibleAbi.jsondiffbeforeafterboth--- a/tests/src/eth/nonFungibleAbi.json
+++ b/tests/src/eth/nonFungibleAbi.json
@@ -334,9 +334,9 @@
{
"inputs": [
{ "internalType": "uint256", "name": "tokenId", "type": "uint256" },
- { "internalType": "string", "name": "key", "type": "string" }
+ { "internalType": "string[]", "name": "keys", "type": "string[]" }
],
- "name": "deleteProperty",
+ "name": "deleteProperties",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
tests/src/eth/reFungibleAbi.jsondiffbeforeafterboth1[2 {3 "anonymous": false,4 "inputs": [5 {6 "indexed": true,7 "internalType": "address",8 "name": "owner",9 "type": "address"10 },11 {12 "indexed": true,13 "internalType": "address",14 "name": "approved",15 "type": "address"16 },17 {18 "indexed": true,19 "internalType": "uint256",20 "name": "tokenId",21 "type": "uint256"22 }23 ],24 "name": "Approval",25 "type": "event"26 },27 {28 "anonymous": false,29 "inputs": [30 {31 "indexed": true,32 "internalType": "address",33 "name": "owner",34 "type": "address"35 },36 {37 "indexed": true,38 "internalType": "address",39 "name": "operator",40 "type": "address"41 },42 {43 "indexed": false,44 "internalType": "bool",45 "name": "approved",46 "type": "bool"47 }48 ],49 "name": "ApprovalForAll",50 "type": "event"51 },52 {53 "anonymous": false,54 "inputs": [],55 "name": "MintingFinished",56 "type": "event"57 },58 {59 "anonymous": false,60 "inputs": [61 {62 "indexed": true,63 "internalType": "address",64 "name": "from",65 "type": "address"66 },67 {68 "indexed": true,69 "internalType": "address",70 "name": "to",71 "type": "address"72 },73 {74 "indexed": true,75 "internalType": "uint256",76 "name": "tokenId",77 "type": "uint256"78 }79 ],80 "name": "Transfer",81 "type": "event"82 },83 {84 "inputs": [85 { "internalType": "address", "name": "newAdmin", "type": "address" }86 ],87 "name": "addCollectionAdmin",88 "outputs": [],89 "stateMutability": "nonpayable",90 "type": "function"91 },92 {93 "inputs": [94 {95 "components": [96 { "internalType": "address", "name": "eth", "type": "address" },97 { "internalType": "uint256", "name": "sub", "type": "uint256" }98 ],99 "internalType": "struct EthCrossAccount",100 "name": "newAdmin",101 "type": "tuple"102 }103 ],104 "name": "addCollectionAdminCross",105 "outputs": [],106 "stateMutability": "nonpayable",107 "type": "function"108 },109 {110 "inputs": [111 { "internalType": "address", "name": "user", "type": "address" }112 ],113 "name": "addToCollectionAllowList",114 "outputs": [],115 "stateMutability": "nonpayable",116 "type": "function"117 },118 {119 "inputs": [120 {121 "components": [122 { "internalType": "address", "name": "eth", "type": "address" },123 { "internalType": "uint256", "name": "sub", "type": "uint256" }124 ],125 "internalType": "struct EthCrossAccount",126 "name": "user",127 "type": "tuple"128 }129 ],130 "name": "addToCollectionAllowListCross",131 "outputs": [],132 "stateMutability": "nonpayable",133 "type": "function"134 },135 {136 "inputs": [137 { "internalType": "address", "name": "user", "type": "address" }138 ],139 "name": "allowed",140 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],141 "stateMutability": "view",142 "type": "function"143 },144 {145 "inputs": [146 { "internalType": "address", "name": "approved", "type": "address" },147 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }148 ],149 "name": "approve",150 "outputs": [],151 "stateMutability": "nonpayable",152 "type": "function"153 },154 {155 "inputs": [156 { "internalType": "address", "name": "owner", "type": "address" }157 ],158 "name": "balanceOf",159 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],160 "stateMutability": "view",161 "type": "function"162 },163 {164 "inputs": [165 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }166 ],167 "name": "burn",168 "outputs": [],169 "stateMutability": "nonpayable",170 "type": "function"171 },172 {173 "inputs": [174 { "internalType": "address", "name": "from", "type": "address" },175 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }176 ],177 "name": "burnFrom",178 "outputs": [],179 "stateMutability": "nonpayable",180 "type": "function"181 },182 {183 "inputs": [184 {185 "components": [186 { "internalType": "address", "name": "eth", "type": "address" },187 { "internalType": "uint256", "name": "sub", "type": "uint256" }188 ],189 "internalType": "struct EthCrossAccount",190 "name": "from",191 "type": "tuple"192 },193 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }194 ],195 "name": "burnFromCross",196 "outputs": [],197 "stateMutability": "nonpayable",198 "type": "function"199 },200 {201 "inputs": [202 { "internalType": "address", "name": "newOwner", "type": "address" }203 ],204 "name": "changeCollectionOwner",205 "outputs": [],206 "stateMutability": "nonpayable",207 "type": "function"208 },209 {210 "inputs": [],211 "name": "collectionAdmins",212 "outputs": [213 {214 "components": [215 { "internalType": "address", "name": "eth", "type": "address" },216 { "internalType": "uint256", "name": "sub", "type": "uint256" }217 ],218 "internalType": "struct EthCrossAccount[]",219 "name": "",220 "type": "tuple[]"221 }222 ],223 "stateMutability": "view",224 "type": "function"225 },226 {227 "inputs": [],228 "name": "collectionOwner",229 "outputs": [230 {231 "components": [232 { "internalType": "address", "name": "eth", "type": "address" },233 { "internalType": "uint256", "name": "sub", "type": "uint256" }234 ],235 "internalType": "struct EthCrossAccount",236 "name": "",237 "type": "tuple"238 }239 ],240 "stateMutability": "view",241 "type": "function"242 },243 {244 "inputs": [245 { "internalType": "string[]", "name": "keys", "type": "string[]" }246 ],247 "name": "collectionProperties",248 "outputs": [249 {250 "components": [251 { "internalType": "string", "name": "field_0", "type": "string" },252 { "internalType": "bytes", "name": "field_1", "type": "bytes" }253 ],254 "internalType": "struct Tuple20[]",255 "name": "",256 "type": "tuple[]"257 }258 ],259 "stateMutability": "view",260 "type": "function"261 },262 {263 "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],264 "name": "collectionProperty",265 "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],266 "stateMutability": "view",267 "type": "function"268 },269 {270 "inputs": [],271 "name": "collectionSponsor",272 "outputs": [273 {274 "components": [275 { "internalType": "address", "name": "field_0", "type": "address" },276 { "internalType": "uint256", "name": "field_1", "type": "uint256" }277 ],278 "internalType": "struct Tuple23",279 "name": "",280 "type": "tuple"281 }282 ],283 "stateMutability": "view",284 "type": "function"285 },286 {287 "inputs": [],288 "name": "confirmCollectionSponsorship",289 "outputs": [],290 "stateMutability": "nonpayable",291 "type": "function"292 },293 {294 "inputs": [],295 "name": "contractAddress",296 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],297 "stateMutability": "view",298 "type": "function"299 },300 {301 "inputs": [302 { "internalType": "string[]", "name": "keys", "type": "string[]" }303 ],304 "name": "deleteCollectionProperties",305 "outputs": [],306 "stateMutability": "nonpayable",307 "type": "function"308 },309 {310 "inputs": [{ "internalType": "string", "name": "key", "type": "string" }],311 "name": "deleteCollectionProperty",312 "outputs": [],313 "stateMutability": "nonpayable",314 "type": "function"315 },316 {317 "inputs": [318 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },319 { "internalType": "string", "name": "key", "type": "string" }320 ],321 "name": "deleteProperty",322 "outputs": [],323 "stateMutability": "nonpayable",324 "type": "function"325 },326 {327 "inputs": [],328 "name": "finishMinting",329 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],330 "stateMutability": "nonpayable",331 "type": "function"332 },333 {334 "inputs": [335 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }336 ],337 "name": "getApproved",338 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],339 "stateMutability": "view",340 "type": "function"341 },342 {343 "inputs": [],344 "name": "hasCollectionPendingSponsor",345 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],346 "stateMutability": "view",347 "type": "function"348 },349 {350 "inputs": [351 { "internalType": "address", "name": "owner", "type": "address" },352 { "internalType": "address", "name": "operator", "type": "address" }353 ],354 "name": "isApprovedForAll",355 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],356 "stateMutability": "view",357 "type": "function"358 },359 {360 "inputs": [361 { "internalType": "address", "name": "user", "type": "address" }362 ],363 "name": "isOwnerOrAdmin",364 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],365 "stateMutability": "view",366 "type": "function"367 },368 {369 "inputs": [370 {371 "components": [372 { "internalType": "address", "name": "eth", "type": "address" },373 { "internalType": "uint256", "name": "sub", "type": "uint256" }374 ],375 "internalType": "struct EthCrossAccount",376 "name": "user",377 "type": "tuple"378 }379 ],380 "name": "isOwnerOrAdminCross",381 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],382 "stateMutability": "view",383 "type": "function"384 },385 {386 "inputs": [{ "internalType": "address", "name": "to", "type": "address" }],387 "name": "mint",388 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],389 "stateMutability": "nonpayable",390 "type": "function"391 },392 {393 "inputs": [394 { "internalType": "address", "name": "to", "type": "address" },395 { "internalType": "string", "name": "tokenUri", "type": "string" }396 ],397 "name": "mintWithTokenURI",398 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],399 "stateMutability": "nonpayable",400 "type": "function"401 },402 {403 "inputs": [],404 "name": "mintingFinished",405 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],406 "stateMutability": "view",407 "type": "function"408 },409 {410 "inputs": [],411 "name": "name",412 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],413 "stateMutability": "view",414 "type": "function"415 },416 {417 "inputs": [],418 "name": "nextTokenId",419 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],420 "stateMutability": "view",421 "type": "function"422 },423 {424 "inputs": [425 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }426 ],427 "name": "ownerOf",428 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],429 "stateMutability": "view",430 "type": "function"431 },432 {433 "inputs": [434 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },435 { "internalType": "string", "name": "key", "type": "string" }436 ],437 "name": "property",438 "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],439 "stateMutability": "view",440 "type": "function"441 },442 {443 "inputs": [444 { "internalType": "address", "name": "admin", "type": "address" }445 ],446 "name": "removeCollectionAdmin",447 "outputs": [],448 "stateMutability": "nonpayable",449 "type": "function"450 },451 {452 "inputs": [453 {454 "components": [455 { "internalType": "address", "name": "eth", "type": "address" },456 { "internalType": "uint256", "name": "sub", "type": "uint256" }457 ],458 "internalType": "struct EthCrossAccount",459 "name": "admin",460 "type": "tuple"461 }462 ],463 "name": "removeCollectionAdminCross",464 "outputs": [],465 "stateMutability": "nonpayable",466 "type": "function"467 },468 {469 "inputs": [],470 "name": "removeCollectionSponsor",471 "outputs": [],472 "stateMutability": "nonpayable",473 "type": "function"474 },475 {476 "inputs": [477 { "internalType": "address", "name": "user", "type": "address" }478 ],479 "name": "removeFromCollectionAllowList",480 "outputs": [],481 "stateMutability": "nonpayable",482 "type": "function"483 },484 {485 "inputs": [486 {487 "components": [488 { "internalType": "address", "name": "eth", "type": "address" },489 { "internalType": "uint256", "name": "sub", "type": "uint256" }490 ],491 "internalType": "struct EthCrossAccount",492 "name": "user",493 "type": "tuple"494 }495 ],496 "name": "removeFromCollectionAllowListCross",497 "outputs": [],498 "stateMutability": "nonpayable",499 "type": "function"500 },501 {502 "inputs": [503 { "internalType": "address", "name": "from", "type": "address" },504 { "internalType": "address", "name": "to", "type": "address" },505 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }506 ],507 "name": "safeTransferFrom",508 "outputs": [],509 "stateMutability": "nonpayable",510 "type": "function"511 },512 {513 "inputs": [514 { "internalType": "address", "name": "from", "type": "address" },515 { "internalType": "address", "name": "to", "type": "address" },516 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },517 { "internalType": "bytes", "name": "data", "type": "bytes" }518 ],519 "name": "safeTransferFromWithData",520 "outputs": [],521 "stateMutability": "nonpayable",522 "type": "function"523 },524 {525 "inputs": [526 { "internalType": "address", "name": "operator", "type": "address" },527 { "internalType": "bool", "name": "approved", "type": "bool" }528 ],529 "name": "setApprovalForAll",530 "outputs": [],531 "stateMutability": "nonpayable",532 "type": "function"533 },534 {535 "inputs": [{ "internalType": "uint8", "name": "mode", "type": "uint8" }],536 "name": "setCollectionAccess",537 "outputs": [],538 "stateMutability": "nonpayable",539 "type": "function"540 },541 {542 "inputs": [543 { "internalType": "string", "name": "limit", "type": "string" },544 { "internalType": "uint32", "name": "value", "type": "uint32" }545 ],546 "name": "setCollectionLimit",547 "outputs": [],548 "stateMutability": "nonpayable",549 "type": "function"550 },551 {552 "inputs": [553 { "internalType": "string", "name": "limit", "type": "string" },554 { "internalType": "bool", "name": "value", "type": "bool" }555 ],556 "name": "setCollectionLimit",557 "outputs": [],558 "stateMutability": "nonpayable",559 "type": "function"560 },561 {562 "inputs": [{ "internalType": "bool", "name": "mode", "type": "bool" }],563 "name": "setCollectionMintMode",564 "outputs": [],565 "stateMutability": "nonpayable",566 "type": "function"567 },568 {569 "inputs": [{ "internalType": "bool", "name": "enable", "type": "bool" }],570 "name": "setCollectionNesting",571 "outputs": [],572 "stateMutability": "nonpayable",573 "type": "function"574 },575 {576 "inputs": [577 { "internalType": "bool", "name": "enable", "type": "bool" },578 {579 "internalType": "address[]",580 "name": "collections",581 "type": "address[]"582 }583 ],584 "name": "setCollectionNesting",585 "outputs": [],586 "stateMutability": "nonpayable",587 "type": "function"588 },589 {590 "inputs": [591 {592 "components": [593 { "internalType": "string", "name": "field_0", "type": "string" },594 { "internalType": "bytes", "name": "field_1", "type": "bytes" }595 ],596 "internalType": "struct Tuple20[]",597 "name": "properties",598 "type": "tuple[]"599 }600 ],601 "name": "setCollectionProperties",602 "outputs": [],603 "stateMutability": "nonpayable",604 "type": "function"605 },606 {607 "inputs": [608 { "internalType": "string", "name": "key", "type": "string" },609 { "internalType": "bytes", "name": "value", "type": "bytes" }610 ],611 "name": "setCollectionProperty",612 "outputs": [],613 "stateMutability": "nonpayable",614 "type": "function"615 },616 {617 "inputs": [618 { "internalType": "address", "name": "sponsor", "type": "address" }619 ],620 "name": "setCollectionSponsor",621 "outputs": [],622 "stateMutability": "nonpayable",623 "type": "function"624 },625 {626 "inputs": [627 {628 "components": [629 { "internalType": "address", "name": "eth", "type": "address" },630 { "internalType": "uint256", "name": "sub", "type": "uint256" }631 ],632 "internalType": "struct EthCrossAccount",633 "name": "sponsor",634 "type": "tuple"635 }636 ],637 "name": "setCollectionSponsorCross",638 "outputs": [],639 "stateMutability": "nonpayable",640 "type": "function"641 },642 {643 "inputs": [644 {645 "components": [646 { "internalType": "address", "name": "eth", "type": "address" },647 { "internalType": "uint256", "name": "sub", "type": "uint256" }648 ],649 "internalType": "struct EthCrossAccount",650 "name": "newOwner",651 "type": "tuple"652 }653 ],654 "name": "setOwnerCross",655 "outputs": [],656 "stateMutability": "nonpayable",657 "type": "function"658 },659 {660 "inputs": [661 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },662 {663 "components": [664 { "internalType": "string", "name": "field_0", "type": "string" },665 { "internalType": "bytes", "name": "field_1", "type": "bytes" }666 ],667 "internalType": "struct Tuple20[]",668 "name": "properties",669 "type": "tuple[]"670 }671 ],672 "name": "setProperties",673 "outputs": [],674 "stateMutability": "nonpayable",675 "type": "function"676 },677 {678 "inputs": [679 { "internalType": "uint256", "name": "tokenId", "type": "uint256" },680 { "internalType": "string", "name": "key", "type": "string" },681 { "internalType": "bytes", "name": "value", "type": "bytes" }682 ],683 "name": "setProperty",684 "outputs": [],685 "stateMutability": "nonpayable",686 "type": "function"687 },688 {689 "inputs": [690 { "internalType": "string", "name": "key", "type": "string" },691 { "internalType": "bool", "name": "isMutable", "type": "bool" },692 { "internalType": "bool", "name": "collectionAdmin", "type": "bool" },693 { "internalType": "bool", "name": "tokenOwner", "type": "bool" }694 ],695 "name": "setTokenPropertyPermission",696 "outputs": [],697 "stateMutability": "nonpayable",698 "type": "function"699 },700 {701 "inputs": [702 { "internalType": "bytes4", "name": "interfaceID", "type": "bytes4" }703 ],704 "name": "supportsInterface",705 "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],706 "stateMutability": "view",707 "type": "function"708 },709 {710 "inputs": [],711 "name": "symbol",712 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],713 "stateMutability": "view",714 "type": "function"715 },716 {717 "inputs": [718 { "internalType": "uint256", "name": "index", "type": "uint256" }719 ],720 "name": "tokenByIndex",721 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],722 "stateMutability": "view",723 "type": "function"724 },725 {726 "inputs": [727 { "internalType": "uint256", "name": "token", "type": "uint256" }728 ],729 "name": "tokenContractAddress",730 "outputs": [{ "internalType": "address", "name": "", "type": "address" }],731 "stateMutability": "view",732 "type": "function"733 },734 {735 "inputs": [736 { "internalType": "address", "name": "owner", "type": "address" },737 { "internalType": "uint256", "name": "index", "type": "uint256" }738 ],739 "name": "tokenOfOwnerByIndex",740 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],741 "stateMutability": "view",742 "type": "function"743 },744 {745 "inputs": [746 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }747 ],748 "name": "tokenURI",749 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],750 "stateMutability": "view",751 "type": "function"752 },753 {754 "inputs": [],755 "name": "totalSupply",756 "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],757 "stateMutability": "view",758 "type": "function"759 },760 {761 "inputs": [762 { "internalType": "address", "name": "to", "type": "address" },763 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }764 ],765 "name": "transfer",766 "outputs": [],767 "stateMutability": "nonpayable",768 "type": "function"769 },770 {771 "inputs": [772 { "internalType": "address", "name": "from", "type": "address" },773 { "internalType": "address", "name": "to", "type": "address" },774 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }775 ],776 "name": "transferFrom",777 "outputs": [],778 "stateMutability": "nonpayable",779 "type": "function"780 },781 {782 "inputs": [783 {784 "components": [785 { "internalType": "address", "name": "eth", "type": "address" },786 { "internalType": "uint256", "name": "sub", "type": "uint256" }787 ],788 "internalType": "struct EthCrossAccount",789 "name": "from",790 "type": "tuple"791 },792 {793 "components": [794 { "internalType": "address", "name": "eth", "type": "address" },795 { "internalType": "uint256", "name": "sub", "type": "uint256" }796 ],797 "internalType": "struct EthCrossAccount",798 "name": "to",799 "type": "tuple"800 },801 { "internalType": "uint256", "name": "tokenId", "type": "uint256" }802 ],803 "name": "transferFromCross",804 "outputs": [],805 "stateMutability": "nonpayable",806 "type": "function"807 },808 {809 "inputs": [],810 "name": "uniqueCollectionType",811 "outputs": [{ "internalType": "string", "name": "", "type": "string" }],812 "stateMutability": "view",813 "type": "function"814 }815]tests/src/eth/tokenProperties.test.tsdiffbeforeafterboth--- a/tests/src/eth/tokenProperties.test.ts
+++ b/tests/src/eth/tokenProperties.test.ts
@@ -138,18 +138,25 @@
mutable: true,
collectionAdmin: true,
},
+ },
+ {
+ key: 'testKey_1',
+ permission: {
+ mutable: true,
+ collectionAdmin: true,
+ },
}],
});
const token = await collection.mintToken(alice);
- await token.setProperties(alice, [{key: 'testKey', value: 'testValue'}]);
+ await token.setProperties(alice, [{key: 'testKey', value: 'testValue'}, {key: 'testKey_1', value: 'testValue_1'}]);
await collection.addAdmin(alice, {Ethereum: caller});
const address = helper.ethAddress.fromCollectionId(collection.collectionId);
const contract = helper.ethNativeContract.collection(address, 'nft', caller);
- await contract.methods.deleteProperty(token.tokenId, 'testKey').send({from: caller});
+ await contract.methods.deleteProperties(token.tokenId, ['testKey', 'testKey_1']).send({from: caller});
const result = await token.getProperties(['testKey']);
expect(result.length).to.equal(0);