Quantcast
Channel: Recent Questions - Solana Stack Exchange
Viewing all articles
Browse latest Browse all 7939

How can I get the discriminator of an instruction in an Anchor Solana IDL?

$
0
0

First of all can someone explain to me what a discriminator is, in the context of Solana instructions, in simple terms?

Second, how can I get the discriminator of an instruction in an Anchor Solana IDL?

both of these Solana programs https://solscan.io/account/1349iiGjWC7ZTbu6otFmJwztms122jEEnShKgpVnNewy#anchorProgramIDL andhttps://solscan.io/account/7h7uYbDBZkiTvWLmMsWNAEs2VVNqfV56uSfP9hbjJMP8#anchorProgramIDL

have the same instruction name "completeWithdraw".

I have seen posts where they said to take the 8 first bytes of the "global:completeWithdraw", but wouldn't that mean they would have the same discriminator?

I have found in non-anchor IDLs, the discriminator is defined as part of the instruction object.https://github.com/pyth-network/pyth-client/blob/idl/program/idl.json


Viewing all articles
Browse latest Browse all 7939

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>