Skip to content

API ReferenceReact provider and hooksFunction

useVaultWithdrawalFeeBasisPoints()

function useVaultWithdrawalFeeBasisPoints(params?): UseAnvilQueryResult<number>;

Fetches the CollateralVault’s current withdrawal fee in basis points.

The vault deducts this fee before transferring, so an account withdrawing its whole available balance receives less than that balance. No refetch interval is set: a fee change is a governance action, not a per-block fact, so the value refreshes on TanStack’s ordinary triggers (remount and window focus) rather than on a timer.

Parameters

ParameterTypeDescription
paramsGetVaultWithdrawalFeeBasisPointsParamsOptional owning vault; defaults to the profile’s current vault.

Returns

UseAnvilQueryResult<number>

The read envelope. data is the fee in basis points (100 = 1%) and stays undefined until the first read settles; isLoading and error report request state, and retry re-runs the latest completed or failed request.

Throws

Error when rendered outside <AnvilProvider>, by way of useAnvilSDK.

Example

export function WithdrawalFeeNotice({
collateralContractAddress,
}: {
collateralContractAddress: Address;
}) {
const { data: basisPoints } = useVaultWithdrawalFeeBasisPoints({
collateralContractAddress,
});
if (basisPoints === undefined) return null;
return <p>Withdrawals are charged {basisPoints / 100}%.</p>;
}