Skip to content

Commit

Permalink
refactor: remove alternative names
Browse files Browse the repository at this point in the history
  • Loading branch information
crisdut committed Jul 25, 2023
1 parent 5ecc18c commit 80fd950
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 25 deletions.
4 changes: 2 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ fn main() -> Result<()> {
.to_ascii_lowercase();

doc.ASSETS_STOCK
.entry(format!("{NETWORK}-{assets_stock_hash}"))
.entry(format!("{NETWORK}-{assets_stock_hash}.c15"))
.or_insert(assets_stock_name);

doc.ASSETS_WALLETS
.entry(format!("{NETWORK}-{assets_wallets_hash}"))
.entry(format!("{NETWORK}-{assets_wallets_hash}.c15"))
.or_insert(assets_wallets_name);

let toml = toml::to_string(&doc)?;
Expand Down
4 changes: 2 additions & 2 deletions file_hashes.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[ASSETS_STOCK]
bitcoin-4b1bc93ea7f03c49c4424b56561c9c7437e5f16e5714cece615a48e249264a84 = "urn:ubideco:stl:4fGZWR5mH5zZzRZ1r7CSRe776zm3hLBUngfXc4s3vm3V#saturn-flash-emerald-bitmask-fungible_assets_stock.c15"
"bitcoin-4b1bc93ea7f03c49c4424b56561c9c7437e5f16e5714cece615a48e249264a84.c15" = "urn:ubideco:stl:4fGZWR5mH5zZzRZ1r7CSRe776zm3hLBUngfXc4s3vm3V#saturn-flash-emerald-bitmask-fungible_assets_stock.c15"

[ASSETS_WALLETS]
bitcoin-6075e9716c984b37840f76ad2b50b3d1b98ed286884e5ceba5bcc8e6b74988d3 = "urn:ubideco:stl:4fGZWR5mH5zZzRZ1r7CSRe776zm3hLBUngfXc4s3vm3V#saturn-flash-emerald-bitmask-fungible_assets_wallets.c15"
"bitcoin-6075e9716c984b37840f76ad2b50b3d1b98ed286884e5ceba5bcc8e6b74988d3.c15" = "urn:ubideco:stl:4fGZWR5mH5zZzRZ1r7CSRe776zm3hLBUngfXc4s3vm3V#saturn-flash-emerald-bitmask-fungible_assets_wallets.c15"
25 changes: 7 additions & 18 deletions src/rgb/carbonado.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ use strict_encoding::{StrictDeserialize, StrictSerialize};

use crate::{
carbonado::{retrieve, store},
rgb::{
constants::{OLD_LIB_ID_RGB, RGB_STRICT_TYPE_VERSION},
structs::RgbAccount,
},
rgb::{constants::RGB_STRICT_TYPE_VERSION, structs::RgbAccount},
};

#[derive(Debug, Clone, Eq, PartialEq, Display, From, Error)]
Expand Down Expand Up @@ -70,13 +67,9 @@ pub async fn retrieve_stock(sk: &str, name: &str) -> Result<Stock, StorageError>
.to_hex()
.to_lowercase();

let (data, _) = retrieve(
sk,
&format!("{hashed_name}.c15"),
vec![&name.to_string(), &format!("{OLD_LIB_ID_RGB}-{name}")],
)
.await
.map_err(|op| StorageError::CarbonadoRetrive(name.to_string(), op.to_string()))?;
let (data, _) = retrieve(sk, &format!("{hashed_name}.c15"), vec![])
.await
.map_err(|op| StorageError::CarbonadoRetrive(name.to_string(), op.to_string()))?;

if data.is_empty() {
Ok(Stock::default())
Expand Down Expand Up @@ -118,13 +111,9 @@ pub async fn retrieve_wallets(sk: &str, name: &str) -> Result<RgbAccount, Storag
.to_hex()
.to_lowercase();

let (data, _) = retrieve(
sk,
&format!("{hashed_name}.c15"),
vec![&name.to_string(), &format!("{OLD_LIB_ID_RGB}-{name}")],
)
.await
.map_err(|op| StorageError::CarbonadoRetrive(name.to_string(), op.to_string()))?;
let (data, _) = retrieve(sk, &format!("{hashed_name}.c15"), vec![])
.await
.map_err(|op| StorageError::CarbonadoRetrive(name.to_string(), op.to_string()))?;

if data.is_empty() {
Ok(RgbAccount::default())
Expand Down
3 changes: 0 additions & 3 deletions src/rgb/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ pub const RGB_DEFAULT_NAME: &str = "default";
pub const RGB_OLDEST_VERSION: [u8; 8] = [0; 8];
pub const RGB_STRICT_TYPE_VERSION: [u8; 8] = *b"rgbst160";

// Latest RGB ID before UBIDECO semantic ID changes
pub const OLD_LIB_ID_RGB: &str = "memphis_asia_crash_4fGZWR5mH5zZzRZ1r7CSRe776zm3hLBUngfXc4s3vm3V";

// General Errors
#[cfg(target_arch = "wasm32")]
pub const CARBONADO_UNAVALIABLE: &str = "carbonado filesystem";
Expand Down

0 comments on commit 80fd950

Please sign in to comment.