Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get instruction type #283

Open
kuchaguangjie opened this issue Jan 29, 2025 · 0 comments
Open

get instruction type #283

kuchaguangjie opened this issue Jan 29, 2025 · 0 comments

Comments

@kuchaguangjie
Copy link

https://solana.stackexchange.com/questions/19331/best-way-to-find-the-transferchecked-and-transfer-instruction-from-a-tx
Here in the comment, it says the first byte of instruction data is instruction type.

rust code is here:
https://github.com/solana-program/token/blob/8fe3789d1dc3fdf849886e4c5a0db7bebaa86f63/program/src/instruction.rs#L506

Can you add a method to get instruction type from the instruction ?

I tried, with this but seems not correct:

func GetInstType(inst *solana.CompiledInstruction) int {
	if len(inst.Data) == 0 {
		return 0
	}
	return int(inst.Data[0])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant