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

difftreelog

feat change `collection_properties` return type to named struct

Grigoriy Simonov2022-11-23parent: #93efc9e.patch.diff
in: master

16 files changed

modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -178,7 +178,7 @@
 	///
 	/// @param keys Properties keys. Empty keys for all propertyes.
 	/// @return Vector of properties key/value pairs.
-	fn collection_properties(&self, keys: Vec<string>) -> Result<Vec<(string, bytes)>> {
+	fn collection_properties(&self, keys: Vec<string>) -> Result<Vec<PropertyStruct>> {
 		let keys = keys
 			.into_iter()
 			.map(|key| {
@@ -200,7 +200,7 @@
 				let key =
 					string::from_utf8(p.key.into()).map_err(|e| Error::Revert(format!("{}", e)))?;
 				let value = bytes(p.value.to_vec());
-				Ok((key, value))
+				Ok(PropertyStruct { key, value })
 			})
 			.collect::<Result<Vec<_>>>()?;
 		Ok(properties)
modifiedpallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth
--- a/pallets/fungible/src/stubs/UniqueFungible.sol
+++ b/pallets/fungible/src/stubs/UniqueFungible.sol
@@ -87,11 +87,11 @@
 	/// @return Vector of properties key/value pairs.
 	/// @dev EVM selector for this function is: 0x285fb8e6,
 	///  or in textual repr: collectionProperties(string[])
-	function collectionProperties(string[] memory keys) public view returns (Tuple16[] memory) {
+	function collectionProperties(string[] memory keys) public view returns (Property[] memory) {
 		require(false, stub_error);
 		keys;
 		dummy;
-		return new Tuple16[](0);
+		return new Property[](0);
 	}
 
 	// /// Set the sponsor of the collection.
@@ -423,12 +423,6 @@
 struct EthCrossAccount {
 	address eth;
 	uint256 sub;
-}
-
-/// @dev anonymous struct
-struct Tuple16 {
-	string field_0;
-	bytes field_1;
 }
 
 /// @dev Property struct
modifiedpallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth
--- a/pallets/nonfungible/src/stubs/UniqueNFT.sol
+++ b/pallets/nonfungible/src/stubs/UniqueNFT.sol
@@ -188,11 +188,11 @@
 	/// @return Vector of properties key/value pairs.
 	/// @dev EVM selector for this function is: 0x285fb8e6,
 	///  or in textual repr: collectionProperties(string[])
-	function collectionProperties(string[] memory keys) public view returns (Tuple27[] memory) {
+	function collectionProperties(string[] memory keys) public view returns (Property[] memory) {
 		require(false, stub_error);
 		keys;
 		dummy;
-		return new Tuple27[](0);
+		return new Property[](0);
 	}
 
 	// /// Set the sponsor of the collection.
@@ -530,12 +530,6 @@
 struct Tuple30 {
 	address field_0;
 	uint256 field_1;
-}
-
-/// @dev anonymous struct
-struct Tuple27 {
-	string field_0;
-	bytes field_1;
 }
 
 /// @title ERC-721 Non-Fungible Token Standard, optional metadata extension
modifiedpallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth
--- a/pallets/refungible/src/stubs/UniqueRefungible.sol
+++ b/pallets/refungible/src/stubs/UniqueRefungible.sol
@@ -188,11 +188,11 @@
 	/// @return Vector of properties key/value pairs.
 	/// @dev EVM selector for this function is: 0x285fb8e6,
 	///  or in textual repr: collectionProperties(string[])
-	function collectionProperties(string[] memory keys) public view returns (Tuple26[] memory) {
+	function collectionProperties(string[] memory keys) public view returns (Property[] memory) {
 		require(false, stub_error);
 		keys;
 		dummy;
-		return new Tuple26[](0);
+		return new Property[](0);
 	}
 
 	// /// Set the sponsor of the collection.
@@ -530,12 +530,6 @@
 struct Tuple29 {
 	address field_0;
 	uint256 field_1;
-}
-
-/// @dev anonymous struct
-struct Tuple26 {
-	string field_0;
-	bytes field_1;
 }
 
 /// @dev the ERC-165 identifier for this interface is 0x5b5e139f
modifiedpallets/refungible/src/stubs/UniqueRefungibleToken.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedtests/src/eth/abi/fungible.jsondiffbeforeafterboth
--- a/tests/src/eth/abi/fungible.json
+++ b/tests/src/eth/abi/fungible.json
@@ -216,10 +216,10 @@
     "outputs": [
       {
         "components": [
-          { "internalType": "string", "name": "field_0", "type": "string" },
-          { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+          { "internalType": "string", "name": "key", "type": "string" },
+          { "internalType": "bytes", "name": "value", "type": "bytes" }
         ],
-        "internalType": "struct Tuple16[]",
+        "internalType": "struct Property[]",
         "name": "",
         "type": "tuple[]"
       }
modifiedtests/src/eth/abi/nonFungible.jsondiffbeforeafterboth
--- a/tests/src/eth/abi/nonFungible.json
+++ b/tests/src/eth/abi/nonFungible.json
@@ -246,10 +246,10 @@
     "outputs": [
       {
         "components": [
-          { "internalType": "string", "name": "field_0", "type": "string" },
-          { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+          { "internalType": "string", "name": "key", "type": "string" },
+          { "internalType": "bytes", "name": "value", "type": "bytes" }
         ],
-        "internalType": "struct Tuple27[]",
+        "internalType": "struct Property[]",
         "name": "",
         "type": "tuple[]"
       }
modifiedtests/src/eth/abi/reFungible.jsondiffbeforeafterboth
--- a/tests/src/eth/abi/reFungible.json
+++ b/tests/src/eth/abi/reFungible.json
@@ -228,10 +228,10 @@
     "outputs": [
       {
         "components": [
-          { "internalType": "string", "name": "field_0", "type": "string" },
-          { "internalType": "bytes", "name": "field_1", "type": "bytes" }
+          { "internalType": "string", "name": "key", "type": "string" },
+          { "internalType": "bytes", "name": "value", "type": "bytes" }
         ],
-        "internalType": "struct Tuple26[]",
+        "internalType": "struct Property[]",
         "name": "",
         "type": "tuple[]"
       }
modifiedtests/src/eth/api/UniqueFungible.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueFungible.sol
+++ b/tests/src/eth/api/UniqueFungible.sol
@@ -60,7 +60,7 @@
 	/// @return Vector of properties key/value pairs.
 	/// @dev EVM selector for this function is: 0x285fb8e6,
 	///  or in textual repr: collectionProperties(string[])
-	function collectionProperties(string[] memory keys) external view returns (Tuple16[] memory);
+	function collectionProperties(string[] memory keys) external view returns (Property[] memory);
 
 	// /// Set the sponsor of the collection.
 	// ///
@@ -276,12 +276,6 @@
 struct EthCrossAccount {
 	address eth;
 	uint256 sub;
-}
-
-/// @dev anonymous struct
-struct Tuple16 {
-	string field_0;
-	bytes field_1;
 }
 
 /// @dev Property struct
modifiedtests/src/eth/api/UniqueNFT.soldiffbeforeafterboth
127 /// @return Vector of properties key/value pairs.127 /// @return Vector of properties key/value pairs.
128 /// @dev EVM selector for this function is: 0x285fb8e6,128 /// @dev EVM selector for this function is: 0x285fb8e6,
129 /// or in textual repr: collectionProperties(string[])129 /// or in textual repr: collectionProperties(string[])
130 function collectionProperties(string[] memory keys) external view returns (Tuple25[] memory);130 function collectionProperties(string[] memory keys) external view returns (Property[] memory);
131131
132 // /// Set the sponsor of the collection.132 // /// Set the sponsor of the collection.
133 // ///133 // ///
169 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.169 /// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
170 /// @dev EVM selector for this function is: 0x6ec0a9f1,170 /// @dev EVM selector for this function is: 0x6ec0a9f1,
171 /// or in textual repr: collectionSponsor()171 /// or in textual repr: collectionSponsor()
172 function collectionSponsor() external view returns (Tuple28 memory);172 function collectionSponsor() external view returns (Tuple27 memory);
173173
174 /// Set limits for the collection.174 /// Set limits for the collection.
175 /// @dev Throws error if limit not found.175 /// @dev Throws error if limit not found.
346}346}
347347
348/// @dev anonymous struct348/// @dev anonymous struct
349struct Tuple28 {349struct Tuple27 {
350 address field_0;350 address field_0;
351 uint256 field_1;351 uint256 field_1;
352}352}
353
354/// @dev anonymous struct
355struct Tuple25 {
356 string field_0;
357 bytes field_1;
358}
359353
360/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension354/// @title ERC-721 Non-Fungible Token Standard, optional metadata extension
361/// @dev See https://eips.ethereum.org/EIPS/eip-721355/// @dev See https://eips.ethereum.org/EIPS/eip-721
modifiedtests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth
--- a/tests/src/eth/api/UniqueRefungible.sol
+++ b/tests/src/eth/api/UniqueRefungible.sol
@@ -127,7 +127,7 @@
 	/// @return Vector of properties key/value pairs.
 	/// @dev EVM selector for this function is: 0x285fb8e6,
 	///  or in textual repr: collectionProperties(string[])
-	function collectionProperties(string[] memory keys) external view returns (Tuple24[] memory);
+	function collectionProperties(string[] memory keys) external view returns (Property[] memory);
 
 	// /// Set the sponsor of the collection.
 	// ///
@@ -169,7 +169,7 @@
 	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
 	/// @dev EVM selector for this function is: 0x6ec0a9f1,
 	///  or in textual repr: collectionSponsor()
-	function collectionSponsor() external view returns (Tuple27 memory);
+	function collectionSponsor() external view returns (Tuple26 memory);
 
 	/// Set limits for the collection.
 	/// @dev Throws error if limit not found.
@@ -346,15 +346,9 @@
 }
 
 /// @dev anonymous struct
-struct Tuple27 {
+struct Tuple26 {
 	address field_0;
 	uint256 field_1;
-}
-
-/// @dev anonymous struct
-struct Tuple24 {
-	string field_0;
-	bytes field_1;
 }
 
 /// @dev the ERC-165 identifier for this interface is 0x5b5e139f