# Class: Rent
Configuration of network rent.
# Table of contents
# Constructors
# Accessors
# Methods
# Constructors
# constructor
• new Rent(lamportsPerByteYear
, exemptionThreshold
, burnPercent
)
# Parameters
Name | Type | Description |
---|---|---|
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. |
# Defined in
internal.d.ts:341 (opens new window)
# Accessors
# burnPercent
• get
burnPercent(): number
The percentage of collected rent that is burned.
# Returns
number
# Defined in
internal.d.ts:351 (opens new window)
• set
burnPercent(val
): void
# Parameters
Name | Type |
---|---|
val | number |
# Returns
void
# Defined in
internal.d.ts:352 (opens new window)
# exemptionThreshold
• get
exemptionThreshold(): number
Amount of time (in years) a balance must include rent for the account to be rent exempt.
# Returns
number
# Defined in
internal.d.ts:348 (opens new window)
• set
exemptionThreshold(val
): void
# Parameters
Name | Type |
---|---|
val | number |
# Returns
void
# Defined in
internal.d.ts:349 (opens new window)
# lamportsPerByteYear
• get
lamportsPerByteYear(): bigint
Rental rate in lamports/byte-year.
# Returns
bigint
# Defined in
internal.d.ts:345 (opens new window)
• set
lamportsPerByteYear(val
): void
# Parameters
Name | Type |
---|---|
val | bigint |
# Returns
void
# Defined in
internal.d.ts:346 (opens new window)
# Methods
# calculateBurn
▸ calculateBurn(rentCollected
): [bigint
, bigint
]
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
Name | Type |
---|---|
rentCollected | bigint |
# Returns
[bigint
, bigint
]
The amount burned and the amount to distribute to validators.
# Defined in
internal.d.ts:362 (opens new window)
# due
▸ due(balance
, dataLen
, yearsElapsed
): bigint
Rent due on account's data length with balance.
# Parameters
Name | Type | Description |
---|---|---|
balance | bigint | The account balance. |
dataLen | bigint | The account data length. |
yearsElapsed | number | Time elapsed in years. |
# Returns
bigint
The rent due.
# Defined in
internal.d.ts:385 (opens new window)
# dueAmount
▸ dueAmount(dataLen
, yearsElapsed
): bigint
Rent due for account that is known to be not exempt.
# Parameters
Name | Type | Description |
---|---|---|
dataLen | bigint | The account data length. |
yearsElapsed | number | Time elapsed in years. |
# Returns
bigint
The amount due.
# Defined in
internal.d.ts:393 (opens new window)
# isExempt
▸ isExempt(balance
, dataLen
): boolean
Whether a given balance and data length would be exempt.
# Parameters
Name | Type |
---|---|
balance | bigint |
dataLen | bigint |
# Returns
boolean
# Defined in
internal.d.ts:376 (opens new window)
# minimumBalance
▸ minimumBalance(dataLen
): bigint
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
Name | Type | Description |
---|---|---|
dataLen | bigint | The account data size. |
# Returns
bigint
The minimum balance due.
# Defined in
internal.d.ts:374 (opens new window)
# toString
▸ toString(): string
# Returns
string
# Defined in
internal.d.ts:407 (opens new window)
# default
▸ Static
default(): Rent
Initialize rent with the default Solana settings.
# Returns
# Defined in
internal.d.ts:343 (opens new window)
# free
▸ Static
free(): Rent
Creates a Rent
that charges no lamports.
This is used for testing.
# Returns
# Defined in
internal.d.ts:400 (opens new window)
# withSlotsPerEpoch
▸ Static
withSlotsPerEpoch(slotsPerEpoch
): Rent
Creates a Rent
that is scaled based on the number of slots in an epoch.
This is used for testing.
# Parameters
Name | Type |
---|---|
slotsPerEpoch | bigint |