difftreelog
misk: Rename property keys
in: master
4 files changed
pallets/common/src/erc.rsdiffbeforeafterboth446 property_key_from_bytes(b"baseURI").expect(EXPECT_CONVERT_ERROR)446 property_key_from_bytes(b"baseURI").expect(EXPECT_CONVERT_ERROR)447 }447 }448448449 pub fn u_key() -> up_data_structs::PropertyKey {449 pub fn url_key() -> up_data_structs::PropertyKey {450 property_key_from_bytes(b"u").expect(EXPECT_CONVERT_ERROR)450 property_key_from_bytes(b"url").expect(EXPECT_CONVERT_ERROR)451 }451 }452452453 pub fn s_key() -> up_data_structs::PropertyKey {453 pub fn suffix_key() -> up_data_structs::PropertyKey {454 property_key_from_bytes(b"s").expect(EXPECT_CONVERT_ERROR)454 property_key_from_bytes(b"suffix").expect(EXPECT_CONVERT_ERROR)455 }455 }456456457 pub const ERC721_METADATA: &[u8] = b"ERC721Metadata";457 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.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);