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 Required
getClaimrAddress('44196397'); // correct
getClaimrAddress('elonmusk'); // incorrect - produces a different addressWhen to Use Local vs API
Scenario
Recommendation
Last updated