Address Derivation
import { PublicKey } from '@solana/web3.js';
const CLAIMR = new PublicKey('3FsU2B8R7sP5ih7w2RoxtJEHfvBVeXtM8WwF6rjMbUrT');
function getClaimrAddress(twitterId: string): PublicKey {
const [pda] = PublicKey.findProgramAddressSync(
[Buffer.from('claimr'), Buffer.from(twitterId)],
CLAIMR
);
return pda;
}
const address = getClaimrAddress('44196397');Twitter ID, not handle
getClaimrAddress('44196397'); // right
getClaimrAddress('elonmusk'); // wrong - completely different addressWhen to use this vs API
Last updated