API Reference / Rent
Class: Rent
Defined in: internal.d.ts:354
Configuration of network rent.
Constructors
Constructor
new Rent(
lamportsPerByteYear,exemptionThreshold,burnPercent):Rent
Defined in: internal.d.ts:360
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:376
The percentage of collected rent that is burned.
Returns
number
Set Signature
set burnPercent(
val):void
Defined in: internal.d.ts:377
Parameters
val
number
Returns
void
exemptionThreshold
Get Signature
get exemptionThreshold():
number
Defined in: internal.d.ts:373
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:374
Parameters
val
number
Returns
void
lamportsPerByteYear
Get Signature
get lamportsPerByteYear():
bigint
Defined in: internal.d.ts:370
Rental rate in lamports/byte-year.
Note: since SIMD-0194 the underlying sysvar stores lamports/byte with the exemption threshold folded in (default 6960, threshold 1.0), so on current clusters this returns double the historical 3480 value.
Returns
bigint
Set Signature
set lamportsPerByteYear(
val):void
Defined in: internal.d.ts:371
Parameters
val
bigint
Returns
void
Methods
calculateBurn()
calculateBurn(
rentCollected): [bigint,bigint]
Defined in: internal.d.ts:387
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:410
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:422
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:401
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:399
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:439
Returns
string
default()
staticdefault():Rent
Defined in: internal.d.ts:362
Initialize rent with the default Solana settings.
Returns
Rent
free()
staticfree():Rent
Defined in: internal.d.ts:428
Creates a Rent that charges no lamports.
This is used for testing.
Returns
Rent
withSlotsPerEpoch()
staticwithSlotsPerEpoch(slotsPerEpoch):Rent
Defined in: internal.d.ts:438
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.