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:370
The percentage of collected rent that is burned.
Returns
number
Set Signature
set burnPercent(
val):void
Defined in: internal.d.ts:371
Parameters
val
number
Returns
void
exemptionThreshold
Get Signature
get exemptionThreshold():
number
Defined in: internal.d.ts:367
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:368
Parameters
val
number
Returns
void
lamportsPerByteYear
Get Signature
get lamportsPerByteYear():
bigint
Defined in: internal.d.ts:364
Rental rate in lamports/byte-year.
Returns
bigint
Set Signature
set lamportsPerByteYear(
val):void
Defined in: internal.d.ts:365
Parameters
val
bigint
Returns
void
Methods
calculateBurn()
calculateBurn(
rentCollected): [bigint,bigint]
Defined in: internal.d.ts:381
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:404
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:412
Rent due for account that is known to be not exempt.
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:395
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:393
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:425
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:418
Creates a Rent that charges no lamports.
This is used for testing.
Returns
Rent
withSlotsPerEpoch()
staticwithSlotsPerEpoch(slotsPerEpoch):Rent
Defined in: internal.d.ts:424
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