API Reference / Rent
Class: Rent
Defined in: internal.d.ts:362
Configuration of network rent.
Constructors
Constructor
new Rent(
lamportsPerByteYear,exemptionThreshold,burnPercent):Rent
Defined in: internal.d.ts:368
Parameters
lamportsPerByteYear
bigint
Rental rate in lamports/byte-year.
exemptionThreshold
number
Amount of time (in years) a balance must include rent for the account to be rent exempt.
burnPercent
number
The percentage of collected rent that is burned.
Returns
Rent
Accessors
burnPercent
Get Signature
get burnPercent():
number
Defined in: internal.d.ts:385
The percentage of collected rent that is burned.
Returns
number
Set Signature
set burnPercent(
val):void
Defined in: internal.d.ts:386
Parameters
val
number
Returns
void
exemptionThreshold
Get Signature
get exemptionThreshold():
number
Defined in: internal.d.ts:382
Amount of time (in years) a balance must include rent for the account to be rent exempt.
Returns
number
Set Signature
set exemptionThreshold(
val):void
Defined in: internal.d.ts:383
Parameters
val
number
Returns
void
lamportsPerByteYear
Get Signature
get lamportsPerByteYear():
bigint
Defined in: internal.d.ts:379
Rental rate in lamports/byte-year.
Note: since SIMD-0194 the underlying sysvar stores lamports/byte with the exemption threshold folded in (threshold 1.0, 6960 per byte before the SIMD-0437 reductions and 5080 with the mainnet feature set), so on current clusters this returns more than the historical 3480 value.
Returns
bigint
Set Signature
set lamportsPerByteYear(
val):void
Defined in: internal.d.ts:380
Parameters
val
bigint
Returns
void
Methods
calculateBurn()
calculateBurn(
rentCollected): [bigint,bigint]
Defined in: internal.d.ts:396
Calculate how much rent to burn from the collected rent.
The first value returned is the amount burned. The second is the amount to distribute to validators.
Parameters
rentCollected
bigint
Returns
[bigint, bigint]
The amount burned and the amount to distribute to validators.
due()
due(
balance,dataLen,yearsElapsed):bigint
Defined in: internal.d.ts:419
Rent due on account's data length with balance.
Parameters
balance
bigint
The account balance.
dataLen
bigint
The account data length.
yearsElapsed
number
Time elapsed in years.
Returns
bigint
The rent due.
dueAmount()
dueAmount(
dataLen,yearsElapsed):bigint
Defined in: internal.d.ts:431
Rent due for account that is known to be not exempt.
Note: since SIMD-0194 the underlying rate is lamports/byte with the exemption threshold folded in, so on current clusters this returns double the pre-SIMD-0194 amount for the same inputs.
Parameters
dataLen
bigint
The account data length.
yearsElapsed
number
Time elapsed in years.
Returns
bigint
The amount due.
isExempt()
isExempt(
balance,dataLen):boolean
Defined in: internal.d.ts:410
Whether a given balance and data length would be exempt.
Parameters
balance
bigint
dataLen
bigint
Returns
boolean
minimumBalance()
minimumBalance(
dataLen):bigint
Defined in: internal.d.ts:408
Minimum balance due for rent-exemption of a given account data size.
Note: a stripped-down version of this calculation is used in calculate_split_rent_exempt_reserve in the stake program. When this function is updated, eg. when making rent variable, the stake program will need to be refactored.
Parameters
dataLen
bigint
The account data size.
Returns
bigint
The minimum balance due.
toString()
toString():
string
Defined in: internal.d.ts:448
Returns
string
default()
staticdefault():Rent
Defined in: internal.d.ts:370
Initialize rent with the default Solana settings.
Returns
Rent
free()
staticfree():Rent
Defined in: internal.d.ts:437
Creates a Rent that charges no lamports.
This is used for testing.
Returns
Rent
withSlotsPerEpoch()
staticwithSlotsPerEpoch(slotsPerEpoch):Rent
Defined in: internal.d.ts:447
Creates a Rent that is scaled based on the number of slots in an epoch.
This is used for testing.
Parameters
slotsPerEpoch
bigint
Returns
Rent
Deprecated
Epoch-based rent scaling was removed upstream (SIMD-0194); the argument is ignored and the default rent is returned. The old scaling never affected the rent-exempt minimum balance.