38 lines
1.7 KiB
TypeScript
38 lines
1.7 KiB
TypeScript
/**
|
|
* Exponent for calculating how many indivisible units are there in one NEAR. See {@link NEAR_NOMINATION}.
|
|
*/
|
|
export declare const NEAR_NOMINATION_EXP = 24;
|
|
/**
|
|
* Number of indivisible units in one NEAR. Derived from {@link NEAR_NOMINATION_EXP}.
|
|
*/
|
|
export declare const NEAR_NOMINATION: bigint;
|
|
/**
|
|
* Convert account balance value from internal indivisible units to NEAR. 1 NEAR is defined by {@link NEAR_NOMINATION}.
|
|
* Effectively this divides given amount by {@link NEAR_NOMINATION}.
|
|
*
|
|
* @param balance decimal string representing balance in smallest non-divisible NEAR units (as specified by {@link NEAR_NOMINATION})
|
|
* @param fracDigits number of fractional digits to preserve in formatted string. Balance is rounded to match given number of digits.
|
|
* @returns Value in Ⓝ
|
|
*/
|
|
export declare function formatNearAmount(balance: string, fracDigits?: number): string;
|
|
/**
|
|
* Convert human readable NEAR amount to internal indivisible units.
|
|
* Effectively this multiplies given amount by {@link NEAR_NOMINATION}.
|
|
*
|
|
* @param amt decimal string (potentially fractional) denominated in NEAR.
|
|
* @returns The parsed yoctoⓃ amount or null if no amount was passed in
|
|
*/
|
|
export declare function parseNearAmount(amt?: string): string | null;
|
|
/**
|
|
* Encodes a Uint8Array or string into base58
|
|
* @param value Uint8Array or string representing a borsh encoded object
|
|
* @returns string base58 encoding of the value
|
|
*/
|
|
export declare function baseEncode(value: Uint8Array | string): string;
|
|
/**
|
|
* Decodes a base58 string into a Uint8Array
|
|
* @param value base58 encoded string
|
|
* @returns Uint8Array representing the decoded value
|
|
*/
|
|
export declare function baseDecode(value: string): Uint8Array;
|
|
//# sourceMappingURL=format.d.ts.map
|