@hiero-ledger/sdk
Version:
76 lines (75 loc) • 1.84 kB
TypeScript
/**
* @typedef {object} ExchangeRateJSON
* @property {number} hbars
* @property {number} cents
* @property {Date} expirationTime
* @property {number} exchangeRateInCents
*/
/**
* Represents an exchange rate between hbars and cents (USD).
* This class provides functionality for handling and converting exchange rates
* between Hedera's native HBAR currency and US cents.
*/
export default class ExchangeRate {
/**
* @internal
* @param {import("@hashgraph/proto").proto.IExchangeRate} rate
* @returns {ExchangeRate}
*/
static _fromProtobuf(rate: import("@hashgraph/proto").proto.IExchangeRate): ExchangeRate;
/**
* @private
* @param {object} props
* @param {number} props.hbars
* @param {number} props.cents
* @param {Date} props.expirationTime
*/
private constructor();
/**
* Denotes Hbar equivalent to cents (USD)
*
* @readonly
* @type {number}
*/
readonly hbars: number;
/**
* Denotes cents (USD) equivalent to Hbar
*
* @readonly
* @type {number}
*/
readonly cents: number;
/**
* Expiration time of this exchange rate
*
* @readonly
* @type {Date}
*/
readonly expirationTime: Date;
/**
* Calculated exchange rate
*
* @readonly
* @type {number}
*/
readonly exchangeRateInCents: number;
/**
* @internal
* @returns {import("@hashgraph/proto").proto.IExchangeRate}
*/
_toProtobuf(): import("@hashgraph/proto").proto.IExchangeRate;
/**
* @returns {ExchangeRateJSON}
*/
toJSON(): ExchangeRateJSON;
/**
* @returns {string}
*/
toString(): string;
}
export type ExchangeRateJSON = {
hbars: number;
cents: number;
expirationTime: Date;
exchangeRateInCents: number;
};