Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
CriesofCarrots committed Mar 7, 2024
1 parent 19caee7 commit f0e1904
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions account-decoder/src/parse_token_extension.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -40,7 +40,7 @@ pub enum UiExtension {
UnparseableExtension,
}

pub fn parse_extension<S: BaseState>(
pub fn parse_extension<S: BaseState + Pack>(
extension_type: &ExtensionType,
account: &StateWithExtensions<S>,
) -> UiExtension {
Expand Down
15 changes: 15 additions & 0 deletions scripts/patch-spl-crates-for-anchor.sh
Original file line number Diff line number Diff line change
@@ -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")
}

Expand All @@ -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 $?
Expand All @@ -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 $?

Expand All @@ -46,10 +58,13 @@ patch_crates_io() {
declare Cargo_toml="$1"
declare spl_dir="$2"
cat >> "$Cargo_toml" <<EOF
spl-associated-token-account = { path = "$spl_dir/associated-token-account/program" }
spl-memo = { path = "$spl_dir/memo/program" }
spl-token = { path = "$spl_dir/token/program" }
spl-token-2022 = { path = "$spl_dir/token/program-2022" }
spl-tlv-account-resolution = { path = "$spl_dir/libraries/tlv-account-resolution" }
spl-token-group-interface = { path = "$spl_dir/token-group/interface" }
spl-token-metadata-interface = { path = "$spl_dir/token-metadata/interface" }
spl-transfer-hook-interface = { path = "$spl_dir/token/transfer-hook/interface" }
EOF
}
2 changes: 1 addition & 1 deletion transaction-status/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ base64 = { workspace = true }
bincode = { workspace = true }
# Update this borsh dependency to the workspace version once
# spl-associated-token-account is upgraded and used in the monorepo.
borsh = { version = "0.10.3" }
borsh = { workspace = true }
bs58 = { workspace = true }
lazy_static = { workspace = true }
log = { workspace = true }
Expand Down

0 comments on commit f0e1904

Please sign in to comment.