Claiming Token Creator Fees
Pump.fun rewards token creators by allowing them to collect a fraction of the fees generated from trading activity on their token. You can use the PumpPortal Lightning or Local Transaction APIs to claim any creator fees from Pump.fun. The Lightning Transaction API can now also be used to claim creator fees from Meteora Dynamic Bonding Curves.
Examples below:
Lightning Transaction Examples:
- Python
- JavaScript
import requests
response = requests.post(url="https://pumpportal.fun/api/trade?api-key=your-api-key-here", data={
"action": "collectCreatorFee",
"priorityFee": 0.000001,
"pool": "meteora-dbc" # "pump" or "meteora-dbc"
"mint": "token CA" # the token for which you are claiming fees
# Note: pump.fun claims creator fees all at once, so you do not need to specify "mint"
})
data = response.json() # Tx signature or error(s)
const response = await fetch("https://pumpportal.fun/api/trade?api-key=your-api-key-here", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"action": "collectCreatorFee",
"priorityFee": 0.000001,
"pool": "meteora-dbc" // "pump" or "meteora-dbc"
"mint": "token CA" // the token for which you are claiming fees
// Note: pump.fun claims creator fees all at once, so you do not need to specify "mint"
})
});
const data = await response.json(); // JSON object with tx signature or error(s)
Local Transaction Examples:
- Python
- JavaScript
import requests
from solders.transaction import VersionedTransaction
from solders.keypair import Keypair
from solders.commitment_config import CommitmentLevel
from solders.rpc.requests import SendVersionedTransaction
from solders.rpc.config import RpcSendTransactionConfig
response = requests.post(url="https://pumpportal.fun/api/trade-local", data={
"publicKey": "Your public key here",
"action": "collectCreatorFee",
"priorityFee": 0.000001,
})
keypair = Keypair.from_base58_string("Your base 58 private key here")
tx = VersionedTransaction(VersionedTransaction.from_bytes(response.content).message, [keypair])
commitment = CommitmentLevel.Confirmed
config = RpcSendTransactionConfig(preflight_commitment=commitment)
txPayload = SendVersionedTransaction(tx, config)
response = requests.post(
url="Your RPC Endpoint here - Eg: https://api.mainnet-beta.solana.com/",
headers={"Content-Type": "application/json"},
data=SendVersionedTransaction(tx, config).to_json()
)
txSignature = response.json()['result']
print(f'Transaction: https://solscan.io/tx/{txSignature}')
import { VersionedTransaction, Connection, Keypair } from '@solana/web3.js';
import bs58 from "bs58";
const RPC_ENDPOINT = "Your RPC Endpoint";
const web3Connection = new Connection(
RPC_ENDPOINT,
'confirmed',
);
async function sendPortalTransaction(){
const response = await fetch(`https://pumpportal.fun/api/trade-local`, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"publicKey": "Your public key here",
"action": "collectCreatorFee",
"priorityFee": 0.000001,
})
});
if(response.status === 200){ // successfully generated transaction
const data = await response.arrayBuffer();
const tx = VersionedTransaction.deserialize(new Uint8Array(data));
const signerKeyPair = Keypair.fromSecretKey(bs58.decode("your-wallet-private-key"));
tx.sign([signerKeyPair]);
const signature = await web3Connection.sendTransaction(tx)
console.log("Transaction: https://solscan.io/tx/" + signature);
} else {
console.log(response.statusText); // log error
}
}
sendPortalTransaction();