Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions crates/core/src/surfnet/locker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -954,11 +954,11 @@ impl SurfnetSvmLocker {

let token_programs = token_accounts_before
.iter()
.map(|(i, _)| {
.map(|(i, ta)| {
svm_reader
.get_account(&transaction_accounts[*i])
.unwrap()
.owner
.map(|a| a.owner)
.unwrap_or(ta.token_program_id())
})
.collect::<Vec<_>>()
.clone();
Expand Down
7 changes: 7 additions & 0 deletions crates/core/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,13 @@ pub enum TokenAccount {
}

impl TokenAccount {
pub fn token_program_id(&self) -> Pubkey {
match self {
Self::SplToken2022(_) => spl_token_2022::id(),
Self::SplToken(_) => spl_token::id(),
}
}

pub fn unpack(bytes: &[u8]) -> SurfpoolResult<Self> {
if let Ok(account) = spl_token_2022::state::Account::unpack(bytes) {
Ok(Self::SplToken2022(account))
Expand Down