Skip to content
Open
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
23 changes: 23 additions & 0 deletions rpc/util.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package rpc

import "github.com/gagliardetto/solana-go"

func IsTokenMint(acc *Account) bool {
data := acc.Data.GetBinary()
n := len(data)

switch acc.Owner {
case solana.TokenProgramID:
return n == 82
case solana.Token2022ProgramID:
if n == 82 {
return true //Normal Mint
}
if n <= 165 {
return false //Normal Token Account
}
return data[165] == 1 // Mint Extensions
}

return false
}
Loading