Skip to content

Commit

Permalink
crates update for 2.x.x Solana crates compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
palinko91 authored and mvines committed Nov 18, 2024
1 parent 75dba94 commit 0727817
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ license = "WTFPL"
name = "jup-ag"
readme = "README.md"
repository = "https://github.com/mvines/rust-jup-ag"
version = "0.8.0"
version = "0.9.0"

[dependencies]
base64 = "0.13"
bincode = "1"
itertools = "0.10"
reqwest = { version = "0.11", features = ["json"] }
base64 = "0.22"
bincode = "1.3"
itertools = "0.13"
reqwest = { version = "0.12", features = ["json"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
solana-sdk = "1"
thiserror = "1"
solana-sdk = "2"
thiserror = "2"
tokio = "1"

[dev-dependencies]
tokio = {version = "1", features = ["full"]}
solana-client = "1"
spl-associated-token-account = "1"
spl-token = "3"
solana-client = "2"
spl-associated-token-account = "6"
spl-token = "7"
4 changes: 3 additions & 1 deletion src/field_instruction.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Deserialize Instruction with a custom function
pub mod instruction {
use base64::prelude::{Engine as _, BASE64_STANDARD};
use serde::{Deserialize, Deserializer};
use solana_sdk::{instruction::AccountMeta, instruction::Instruction, pubkey::Pubkey};
use std::str::FromStr;
Expand Down Expand Up @@ -46,7 +47,8 @@ pub mod instruction {
let instruction = Instruction {
program_id,
accounts,
data: base64::decode(&fields.data)
data: BASE64_STANDARD
.decode(&fields.data)
.map_err(|e| serde::de::Error::custom(format!("Error decoding data: {}", e)))?,
};

Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use {
base64::prelude::{Engine as _, BASE64_STANDARD},
itertools::Itertools,
serde::{Deserialize, Serialize},
solana_sdk::transaction::VersionedTransaction,
Expand Down Expand Up @@ -342,7 +343,7 @@ pub async fn swap(swap_request: SwapRequest) -> Result<Swap> {
)?;

fn decode(base64_transaction: String) -> Result<VersionedTransaction> {
bincode::deserialize(&base64::decode(base64_transaction)?).map_err(|err| err.into())
bincode::deserialize(&BASE64_STANDARD.decode(base64_transaction)?).map_err(|err| err.into())
}

Ok(Swap {
Expand Down

0 comments on commit 0727817

Please sign in to comment.