From 0727817bc133a7cb88417d0ec2bedeb2a57ebcae Mon Sep 17 00:00:00 2001 From: palinko91 Date: Sat, 16 Nov 2024 19:00:17 +0100 Subject: [PATCH] crates update for 2.x.x Solana crates compatibility --- Cargo.toml | 20 ++++++++++---------- src/field_instruction.rs | 4 +++- src/lib.rs | 3 ++- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 00c1610..e742720 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/src/field_instruction.rs b/src/field_instruction.rs index 125f25a..fd61d74 100644 --- a/src/field_instruction.rs +++ b/src/field_instruction.rs @@ -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; @@ -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)))?, }; diff --git a/src/lib.rs b/src/lib.rs index 3566a29..b968ccd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,5 @@ use { + base64::prelude::{Engine as _, BASE64_STANDARD}, itertools::Itertools, serde::{Deserialize, Serialize}, solana_sdk::transaction::VersionedTransaction, @@ -342,7 +343,7 @@ pub async fn swap(swap_request: SwapRequest) -> Result { )?; fn decode(base64_transaction: String) -> Result { - 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 {