Revenue Interactions
A slice of protocol fees is distributed to wallets that have FAF staked. This page shows how to read a wallet's claimable USDC balance and submit the on-chain claim.
Setup
import dotenv from 'dotenv'
import {
BN_ZERO,
nativeToUiDecimals,
PerpetualsClient,
PoolConfig,
USD_DECIMALS,
} from 'flash-sdk'
import { AnchorProvider, BN } from '@coral-xyz/anchor'
import {
AddressLookupTableAccount,
ComputeBudgetProgram,
PublicKey,
Signer,
TransactionInstruction,
} from '@solana/web3.js'
dotenv.config()
// Crypto.1 is the canonical anchor — switch to `devnet.1` for devnet testing.
export const POOL_CONFIG = PoolConfig.fromIdsByName('Crypto.1', 'mainnet-beta')
// Revenue is paid in USDC. Override only if a future pool changes this.
const REVENUE_TOKEN_SYMBOL = 'USDC'
// Generous CU budget — matches the flash-main-ui claim flow.
const CU_CLAIM_REVENUE = 200_000
const RPC_URL = process.env.RPC_URL
if (!RPC_URL) throw new Error('RPC_URL is not set')
const provider = AnchorProvider.local(RPC_URL, {
commitment: 'processed',
preflightCommitment: 'processed',
skipPreflight: true,
})
export const flashClient = new PerpetualsClient(
provider,
POOL_CONFIG.programId,
POOL_CONFIG.perpComposibilityProgramId,
POOL_CONFIG.fbNftRewardProgramId,
POOL_CONFIG.rewardDistributionProgram.programId,
{ prioritizationFee: 0 },
)Get claimable revenue
Claim revenue
Common gotchas
Last updated
Was this helpful?

