difftreelog
misk: Rename property keys
in: master
4 files changed
pallets/common/src/erc.rsdiffbeforeafterboth--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -446,12 +446,12 @@
property_key_from_bytes(b"baseURI").expect(EXPECT_CONVERT_ERROR)
}
- pub fn u_key() -> up_data_structs::PropertyKey {
- property_key_from_bytes(b"u").expect(EXPECT_CONVERT_ERROR)
+ pub fn url_key() -> up_data_structs::PropertyKey {
+ property_key_from_bytes(b"url").expect(EXPECT_CONVERT_ERROR)
}
- pub fn s_key() -> up_data_structs::PropertyKey {
- property_key_from_bytes(b"s").expect(EXPECT_CONVERT_ERROR)
+ pub fn suffix_key() -> up_data_structs::PropertyKey {
+ property_key_from_bytes(b"suffix").expect(EXPECT_CONVERT_ERROR)
}
pub const ERC721_METADATA: &[u8] = b"ERC721Metadata";
pallets/nonfungible/src/erc.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -232,7 +232,7 @@
let token_id_u32: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
- if let Ok(url) = get_token_property(self, token_id_u32, &u_key()) {
+ if let Ok(url) = get_token_property(self, token_id_u32, &url_key()) {
if !url.is_empty() {
return Ok(url);
}
@@ -250,7 +250,7 @@
e
))
})?;
- if let Ok(suffix) = get_token_property(self, token_id_u32, &s_key()) {
+ if let Ok(suffix) = get_token_property(self, token_id_u32, &suffix_key()) {
if !suffix.is_empty() {
return Ok(base_uri + suffix.as_str());
}
@@ -497,7 +497,7 @@
token_id: uint256,
token_uri: string,
) -> Result<bool> {
- let key = u_key();
+ let key = url_key();
let permission = get_token_permission::<T>(self.id, &key)?;
if !permission.collection_admin {
return Err("Operation is not allowed".into());
@@ -702,7 +702,7 @@
to: address,
tokens: Vec<(uint256, string)>,
) -> Result<bool> {
- let key = u_key();
+ let key = url_key();
let caller = T::CrossAccountId::from_eth(caller);
let to = T::CrossAccountId::from_eth(to);
let mut expected_index = <TokensMinted<T>>::get(self.id)
pallets/unique/src/eth/mod.rsdiffbeforeafterboth--- a/pallets/unique/src/eth/mod.rs
+++ b/pallets/unique/src/eth/mod.rs
@@ -97,7 +97,7 @@
token_property_permissions
.try_push(up_data_structs::PropertyKeyPermission {
- key: u_key(),
+ key: url_key(),
permission: up_data_structs::PropertyPermission {
mutable: false,
collection_admin: true,
@@ -109,7 +109,7 @@
if add_properties {
token_property_permissions
.try_push(up_data_structs::PropertyKeyPermission {
- key: s_key(),
+ key: suffix_key(),
permission: up_data_structs::PropertyPermission {
mutable: false,
collection_admin: true,
tests/src/eth/nonFungible.test.tsdiffbeforeafterboth122 ).send();122 ).send();123 123 124 // Set URL124 // Set URL125 await contract.methods.setProperty(nextTokenId, 'u', Buffer.from('Token URI')).send();125 await contract.methods.setProperty(nextTokenId, 'url', Buffer.from('Token URI')).send();126 126 127 const events = normalizeEvents(result.events);127 const events = normalizeEvents(result.events);128 const address = collectionIdToAddress(collectionId);128 const address = collectionIdToAddress(collectionId);192 192 193 // Set suffix193 // Set suffix194 const suffix = '/some/suffix';194 const suffix = '/some/suffix';195 await contract.methods.setProperty(nextTokenId, 's', Buffer.from(suffix)).send();195 await contract.methods.setProperty(nextTokenId, 'suffix', Buffer.from(suffix)).send();196196197 const events = normalizeEvents(result.events);197 const events = normalizeEvents(result.events);198 const address = collectionIdToAddress(collectionId);198 const address = collectionIdToAddress(collectionId);