TaxManager
Manage the Tax Transfer Hook — automated transfer fees on Token-2022 tokens
Import
Properties
| Property | Type | Description |
|---|---|---|
configPDA | PublicKey | The TaxConfig PDA address |
extraAccountMetasPDA | PublicKey | The ExtraAccountMetas PDA address |
delegatePDA | PublicKey | The TaxDelegate PDA (permanent delegate) |
Methods
initialize(authority, taxBps, maxTaxBps, taxVault)
Creates the TaxConfig PDA for the mint.
| Parameter | Type | Description |
|---|---|---|
authority | PublicKey | Admin who can update settings |
taxBps | number | Tax rate in basis points (100 = 1%) |
maxTaxBps | number | Hard cap that taxBps can never exceed |
taxVault | PublicKey | Destination for collected taxes |
initializeExtraAccountMetas(payer)
Creates the ExtraAccountMetaList PDA.
Must be called before any transfer.
updateTaxRate(authority, newBps)
Updates the tax rate. Cannot exceed maxTaxBps.
updateTaxVault(authority, newVault)
Changes the tax collection wallet.
addExemptWallets(authority, wallets)
Exempts wallets from tax (e.g., market makers, treasury).
removeExemptWallets(authority, wallets)
Removes tax exemptions.
toggleActive(authority, isActive)
Kill switch. When isActive=false, no tax is collected on transfers.
updateAuthority(authority, newAuthority)
Transfers admin rights.
fetchConfig()
Fetches the current on-chain tax config.
calculateTax(amount, bps)
Utility to compute expected tax: amount * bps / 10000.