From f0e19041a9b843c13646817f3dabb0a8e1ffeb68 Mon Sep 17 00:00:00 2001 From: Tyera Eulberg Date: Wed, 6 Mar 2024 23:02:30 -0700 Subject: [PATCH] wip --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- account-decoder/src/parse_token_extension.rs | 4 ++-- scripts/patch-spl-crates-for-anchor.sh | 15 +++++++++++++++ transaction-status/Cargo.toml | 2 +- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0ac4606bbea1be..c9ee620b1962a3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7452,7 +7452,7 @@ dependencies = [ "Inflector", "base64 0.21.7", "bincode", - "borsh 0.10.3", + "borsh 1.2.1", "bs58", "lazy_static", "log", @@ -7876,9 +7876,9 @@ dependencies = [ [[package]] name = "spl-token-2022" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fec83597cf7be923c5c3bdfd2fcc08cdfacd2eeb6c4e413da06b6916f50827" +checksum = "309a3b7982b34879a196f263bdb53ef80f0341dfdf589084c0a15dc4c40418be" dependencies = [ "arrayref", "bytemuck", diff --git a/Cargo.toml b/Cargo.toml index 6cbd56762fbfe8..1765701d57b9b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -393,7 +393,7 @@ spl-instruction-padding = "0.1" spl-memo = "=4.0.1" spl-pod = "=0.1.1" spl-token = "=4.0.1" -spl-token-2022 = "=2.0.1" +spl-token-2022 = "=2.0.2" spl-token-group-interface = "=0.1.1" spl-token-metadata-interface = "=0.2.1" static_assertions = "1.1.0" diff --git a/account-decoder/src/parse_token_extension.rs b/account-decoder/src/parse_token_extension.rs index a2fdef41b47407..76700a44018498 100644 --- a/account-decoder/src/parse_token_extension.rs +++ b/account-decoder/src/parse_token_extension.rs @@ -1,6 +1,6 @@ use { crate::parse_token::UiAccountState, - solana_sdk::clock::UnixTimestamp, + solana_sdk::{clock::UnixTimestamp, program_pack::Pack}, spl_token_2022::{ extension::{self, BaseState, BaseStateWithExtensions, ExtensionType, StateWithExtensions}, solana_program::pubkey::Pubkey, @@ -40,7 +40,7 @@ pub enum UiExtension { UnparseableExtension, } -pub fn parse_extension( +pub fn parse_extension( extension_type: &ExtensionType, account: &StateWithExtensions, ) -> UiExtension { diff --git a/scripts/patch-spl-crates-for-anchor.sh b/scripts/patch-spl-crates-for-anchor.sh index 93ea67b8fceb20..992f65c232beca 100644 --- a/scripts/patch-spl-crates-for-anchor.sh +++ b/scripts/patch-spl-crates-for-anchor.sh @@ -1,15 +1,21 @@ +spl_associated_token_account_version= spl_memo_version= spl_token_version= spl_token_2022_version= spl_tlv_account_resolution_verison= +spl_token_group_interface_verison= +spl_token_metadata_interface_verison= spl_transfer_hook_interface_version= get_spl_versions() { declare spl_dir="$1" + spl_associated_token_account_version=$(readCargoVariable version "$spl_dir/associated-token-account/program/Cargo.toml") spl_memo_version=$(readCargoVariable version "$spl_dir/memo/program/Cargo.toml") spl_token_version=$(readCargoVariable version "$spl_dir/token/program/Cargo.toml") spl_token_2022_version=$(readCargoVariable version "$spl_dir/token/program-2022/Cargo.toml"| head -c1) # only use the major version for convenience spl_tlv_account_resolution_verison=$(readCargoVariable version "$spl_dir/libraries/tlv-account-resolution/Cargo.toml") + spl_token_group_interface_verison=$(readCargoVariable version "$spl_dir/token-group/interface/Cargo.toml") + spl_token_metadata_interface_verison=$(readCargoVariable version "$spl_dir/token-metadata/interface/Cargo.toml") spl_transfer_hook_interface_version=$(readCargoVariable version "$spl_dir/token/transfer-hook/interface/Cargo.toml") } @@ -26,6 +32,8 @@ update_spl_dependencies() { declare tomls=() while IFS='' read -r line; do tomls+=("$line"); done < <(find "$project_root" -name Cargo.toml) + sed -i -e "s#\(spl-associated-token-account = \"\)[^\"]*\(\"\)#\1$spl_associated_token_account_version\2#g" "${tomls[@]}" || return $? + sed -i -e "s#\(spl-associated-token-account = { version = \"\)[^\"]*\(\"\)#\1$spl_associated_token_account_version\2#g" "${tomls[@]}" || return $? sed -i -e "s#\(spl-memo = \"\)[^\"]*\(\"\)#\1$spl_memo_version\2#g" "${tomls[@]}" || return $? sed -i -e "s#\(spl-memo = { version = \"\)[^\"]*\(\"\)#\1$spl_memo_version\2#g" "${tomls[@]}" || return $? sed -i -e "s#\(spl-token = \"\)[^\"]*\(\"\)#\1$spl_token_version\2#g" "${tomls[@]}" || return $? @@ -34,6 +42,10 @@ update_spl_dependencies() { sed -i -e "s#\(spl-token-2022 = { version = \"\)[^\"]*\(\"\)#\1$spl_token_2022_version\2#g" "${tomls[@]}" || return $? sed -i -e "s#\(spl-tlv-account-resolution = \"\)[^\"]*\(\"\)#\1=$spl_tlv_account_resolution_verison\2#g" "${tomls[@]}" || return $? sed -i -e "s#\(spl-tlv-account-resolution = { version = \"\)[^\"]*\(\"\)#\1=$spl_tlv_account_resolution_verison\2#g" "${tomls[@]}" || return $? + sed -i -e "s#\(spl-token-group-interface = \"\)[^\"]*\(\"\)#\1=$spl_token_group_interface_verison\2#g" "${tomls[@]}" || return $? + sed -i -e "s#\(spl-token-group-interface = { version = \"\)[^\"]*\(\"\)#\1=$spl_token_group_interface_verison\2#g" "${tomls[@]}" || return $? + sed -i -e "s#\(spl-token-metadata-interface = \"\)[^\"]*\(\"\)#\1=$spl_token_metadata_interface_verison\2#g" "${tomls[@]}" || return $? + sed -i -e "s#\(spl-token-metadata-interface = { version = \"\)[^\"]*\(\"\)#\1=$spl_token_metadata_interface_verison\2#g" "${tomls[@]}" || return $? sed -i -e "s#\(spl-transfer-hook-interface = \"\)[^\"]*\(\"\)#\1=$spl_transfer_hook_interface_version\2#g" "${tomls[@]}" || return $? sed -i -e "s#\(spl-transfer-hook-interface = { version = \"\)[^\"]*\(\"\)#\1=$spl_transfer_hook_interface_version\2#g" "${tomls[@]}" || return $? @@ -46,10 +58,13 @@ patch_crates_io() { declare Cargo_toml="$1" declare spl_dir="$2" cat >> "$Cargo_toml" <