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.rsdiffbeforeafterboth979798 token_property_permissions98 token_property_permissions99 .try_push(up_data_structs::PropertyKeyPermission {99 .try_push(up_data_structs::PropertyKeyPermission {100 key: u_key(),100 key: url_key(),101 permission: up_data_structs::PropertyPermission {101 permission: up_data_structs::PropertyPermission {102 mutable: false,102 mutable: false,103 collection_admin: true,103 collection_admin: true,109 if add_properties {109 if add_properties {110 token_property_permissions110 token_property_permissions111 .try_push(up_data_structs::PropertyKeyPermission {111 .try_push(up_data_structs::PropertyKeyPermission {112 key: s_key(),112 key: suffix_key(),113 permission: up_data_structs::PropertyPermission {113 permission: up_data_structs::PropertyPermission {114 mutable: false,114 mutable: false,115 collection_admin: true,115 collection_admin: true,tests/src/eth/nonFungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -122,7 +122,7 @@
).send();
// Set URL
- await contract.methods.setProperty(nextTokenId, 'u', Buffer.from('Token URI')).send();
+ await contract.methods.setProperty(nextTokenId, 'url', Buffer.from('Token URI')).send();
const events = normalizeEvents(result.events);
const address = collectionIdToAddress(collectionId);
@@ -192,7 +192,7 @@
// Set suffix
const suffix = '/some/suffix';
- await contract.methods.setProperty(nextTokenId, 's', Buffer.from(suffix)).send();
+ await contract.methods.setProperty(nextTokenId, 'suffix', Buffer.from(suffix)).send();
const events = normalizeEvents(result.events);
const address = collectionIdToAddress(collectionId);