Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
fix: Rename the error in AddressError
Browse files Browse the repository at this point in the history
  • Loading branch information
code0xff committed Sep 10, 2024
1 parent 6d8a3f7 commit 78098b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
6 changes: 0 additions & 6 deletions frame/cosmos/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,9 @@ serde_json = { workspace = true, default-features = false, optional = true }
# Substrate
frame-support = { workspace = true, default-features = false }
impl-trait-for-tuples = { workspace = true }
sp-core = { workspace = true, default-features = false }
sp-runtime-interface = { workspace = true, default-features = false }
sp-runtime = { workspace = true, default-features = false }

[dev-dependencies]
array-bytes = { workspace = true }
base64ct = { workspace = true, features = ["alloc"] }
hex = { workspace = true, default-features = false }

[features]
Expand All @@ -45,8 +41,6 @@ std = [
"scale-info/std",
"serde/std",
"serde_json/std",
"sp-core/std",
"sp-runtime-interface/std",
"sp-runtime/std",
"hex/std",
]
Expand Down
6 changes: 3 additions & 3 deletions frame/cosmos/types/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ use alloc::{

#[derive(Clone, PartialEq, Eq, Debug)]
pub enum AddressError {
Bech32Error(bech32::DecodeError),
DecodeError(bech32::DecodeError),
}

pub fn acc_address_from_bech32(address: &str) -> Result<(String, Vec<u8>), AddressError> {
bech32::decode(address)
.map(|(hrp, data)| (hrp.to_string(), data))
.map_err(AddressError::Bech32Error)
.map_err(AddressError::DecodeError)
}

#[cfg(test)]
mod tests {
use super::acc_address_from_bech32;
use super::*;

#[test]
fn acc_address_from_bech32_test() {
Expand Down

0 comments on commit 78098b2

Please sign in to comment.