Skip to content

Commit

Permalink
Update base64 syntax and remove allow-deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
CriesofCarrots committed Jul 10, 2024
1 parent a7dff2d commit f3b29a7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions rpc-client-api/src/filter.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![allow(deprecated)]
use {
base64::{prelude::BASE64_STANDARD, Engine},
serde::Deserialize,
solana_inline_spl::{token::GenericTokenAccount, token_2022::Account},
solana_sdk::account::{AccountSharedData, ReadableAccount},
Expand Down Expand Up @@ -41,7 +41,7 @@ impl RpcFilterType {
if bytes.len() > MAX_DATA_BASE64_SIZE {
return Err(RpcFilterError::DataTooLarge);
}
let bytes = base64::decode(bytes)?;
let bytes = BASE64_STANDARD.decode(bytes)?;
if bytes.len() > MAX_DATA_SIZE {
Err(RpcFilterError::DataTooLarge)
} else {
Expand Down Expand Up @@ -171,7 +171,7 @@ impl Memcmp {
use MemcmpEncodedBytes::*;
match &self.bytes {
Base58(bytes) => bs58::decode(bytes).into_vec().ok().map(Cow::Owned),
Base64(bytes) => base64::decode(bytes).ok().map(Cow::Owned),
Base64(bytes) => BASE64_STANDARD.decode(bytes).ok().map(Cow::Owned),
Bytes(bytes) => Some(Cow::Borrowed(bytes)),
}
}
Expand All @@ -185,7 +185,7 @@ impl Memcmp {
Ok(())
}
Base64(bytes) => {
let bytes = base64::decode(bytes)?;
let bytes = BASE64_STANDARD.decode(bytes)?;
self.bytes = Bytes(bytes);
Ok(())
}
Expand Down Expand Up @@ -234,7 +234,7 @@ mod tests {
let ff_data = vec![0xffu8; MAX_DATA_SIZE];
let data58 = bs58::encode(&ff_data).into_string();
assert_eq!(data58.len(), MAX_DATA_BASE58_SIZE);
let data64 = base64::encode(&ff_data);
let data64 = BASE64_STANDARD.encode(&ff_data);
assert_eq!(data64.len(), MAX_DATA_BASE64_SIZE);
}

Expand Down

0 comments on commit f3b29a7

Please sign in to comment.