Skip to content

Commit 32e28e6

Browse files
authored
Merge pull request #20 from 0xcregis/19-fix-cancel-ed25519-public-key-check-for-solanaaddress
fix: cancel public key check for solana address
2 parents b792837 + 7a24cb9 commit 32e28e6

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "anychain-solana"
33
description = "A Rust library for Solana-focused cryptocurrency wallets, enabling seamless transactions on the Solana blockchain"
4-
version = "0.1.12"
4+
version = "0.1.13"
55
keywords = ["solana", "blockchain", "wallet", "transactions"]
66
categories = ["cryptography::cryptocurrencies"]
77
authors = ["Shawndslee", "cregis.com"]

src/address.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ impl FromStr for SolanaAddress {
6565
if pubkey_vec.len() != PUBLIC_KEY_LENGTH {
6666
return Err(AddressError::InvalidAddress(addr.to_string()));
6767
}
68-
let buffer: [u8; PUBLIC_KEY_LENGTH] = pubkey_vec.as_slice().try_into().unwrap();
69-
let _ = ed25519_dalek::PublicKey::from_bytes(&buffer)
70-
.map_err(|error| AddressError::Message(error.to_string()))?;
71-
7268
Ok(Self(addr.to_string()))
7369
}
7470
}
@@ -127,4 +123,14 @@ mod tests {
127123
address.to_string()
128124
);
129125
}
126+
127+
#[test]
128+
fn test_is_valid_address() {
129+
assert!(SolanaAddress::is_valid(
130+
"6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN"
131+
));
132+
assert!(SolanaAddress::is_valid(
133+
"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"
134+
));
135+
}
130136
}

0 commit comments

Comments
 (0)