UX.SOL

Component

Fee Estimate

Displays provider-calculated transaction fees with an itemized total, network and source context, observed timestamp, refresh, loading, and error states.

Preview

Compiles a real 1-lamport devnet self-transfer message. No transaction is signed or submitted, so no fee is spent.

Fee estimate

Estimated charges for the current transaction message.

Fee not calculated yet

Build the transaction message, then request a fee from your provider.

Fees can change when the transaction message, blockhash, or network conditions change.

Installation

terminal
$npx shadcn@latest add https://uxdotsol.xyz/r/fee-estimate.json

Usage

fee-estimate.tsx
import {
FeeEstimate,
type FeeEstimateData,
} from "@/components/uxdotsol/components/fee-estimate";
 
export function TransferFee({
estimate,
}: {
estimate: FeeEstimateData | null;
}) {
return (
<FeeEstimate
estimate={estimate}
onRefresh={() => calculateFeeForCurrentMessage()}
/>
);
}

Props / Arguments

NameTypeDefaultDescription
estimateFeeEstimateData | nullundefinedNormalized provider result with total, itemized fees, source, network, and observation time.
status / errorFeeEstimateStatus / Error | string | nullinferred / undefinedControlled request state. A failed refresh can retain the previous estimate without presenting it as fresh.
title / description / emptyTitle / emptyDescriptionstringfee guidanceAccessible headings and honest pre-calculation guidance.
refreshLabel / onRefreshstring / () => void'Refresh estimate' / undefinedOptional provider refresh action, disabled while a real request is pending.
disclaimer / classNamestring / stringchange warning / ''Custom estimate caveat and outer classes.

Types

NameTypeDefaultDescription
FeeEstimateData{ total; items; network?; source?; updatedAt? }-Provider-neutral fee evidence for one transaction message.
FeeEstimateLine{ id; label; amount; description? }-One network, priority, rent, service, or provider fee line.
FeeEstimateStatus'idle' | 'loading' | 'success' | 'error'-Controlled provider request state.