Overview

No package to install. Just copy what you need or use the API.

When to use what

Task
Recommendation

Look up by handle

API - handles the Twitter lookup

Derive from Twitter ID

Code - if you have the ID already

Check balance

API - combines PDA + vault

Trigger collection

API - easier than building the tx

Quick reference

import { PublicKey } from '@solana/web3.js';

const CLAIMR = new PublicKey('3FsU2B8R7sP5ih7w2RoxtJEHfvBVeXtM8WwF6rjMbUrT');
const PUMP = new PublicKey('6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P');

function getClaimrAddress(twitterId: string): PublicKey {
  const [pda] = PublicKey.findProgramAddressSync(
    [Buffer.from('claimr'), Buffer.from(twitterId)],
    CLAIMR
  );
  return pda;
}

function getCreatorVault(creator: PublicKey): PublicKey {
  const [vault] = PublicKey.findProgramAddressSync(
    [Buffer.from('creator-vault'), creator.toBuffer()],
    PUMP
  );
  return vault;
}

If you're deriving locally: npm install @solana/web3.js

Last updated