API Reference / Rent
Class: Rent
Defined in: internal.d.ts:349
Configuration of network rent.
Constructors
Constructor
new Rent(
lamportsPerByteYear
,exemptionThreshold
,burnPercent
):Rent
Defined in: internal.d.ts:355
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:365
The percentage of collected rent that is burned.
Returns
number
Set Signature
set burnPercent(
val
):void
Defined in: internal.d.ts:366
Parameters
val
number
Returns
void
exemptionThreshold
Get Signature
get exemptionThreshold():
number
Defined in: internal.d.ts:362
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:363
Parameters
val
number
Returns
void
lamportsPerByteYear
Get Signature
get lamportsPerByteYear():
bigint
Defined in: internal.d.ts:359
Rental rate in lamports/byte-year.
Returns
bigint
Set Signature
set lamportsPerByteYear(
val
):void
Defined in: internal.d.ts:360
Parameters
val
bigint
Returns
void
Methods
calculateBurn()
calculateBurn(
rentCollected
): [bigint
,bigint
]
Defined in: internal.d.ts:376
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:399
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:407
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:390
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:388
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:420
Returns
string
default()
static
default():Rent
Defined in: internal.d.ts:357
Initialize rent with the default Solana settings.
Returns
Rent
free()
static
free():Rent
Defined in: internal.d.ts:413
Creates a Rent
that charges no lamports.
This is used for testing.
Returns
Rent
withSlotsPerEpoch()
static
withSlotsPerEpoch(slotsPerEpoch
):Rent
Defined in: internal.d.ts:419
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