UNPKG

@kodex-data/prototypes

Version:

A library of TypeScript prototypes that extend built-in types in JavaScript, providing additional functionality to make development easier and more efficient. This library includes prototypes for working with big numbers, Ethereum Virtual Machine (EVM) fu

54 lines (53 loc) 1.55 kB
import type BN from 'bn.js'; import type { BigNumber } from '@ethersproject/bignumber'; import type { BigNumber as BigNumberJS } from 'bignumber.js'; /** * An object representing a fraction with numerator mul and denominator div. * @date 8.3.2023 - 08:38:04 * * @export * @interface Fraction * @typedef {Fraction} * @template T The type of the numerator and denominator. Defaults to string. */ export interface Fraction<T = string> { mul: T; div: T; } /** The types of BigNumber libraries supported by toBN function. */ export type BnTypes = 'bignumber.js' | 'ethers-bn' | 'bn.js' | 'bigint'; /** The input types accepted by the `toBN` function. */ export type ToBnInputs = BigNumber | BigNumberJS | BN | string | number | bigint; /** * Options to configure the toBN function. * @date 8.3.2023 - 08:39:51 * * @export * @interface ToBnOptions * @typedef {ToBnOptions} */ export interface ToBnOptions { /** The type of BigNumber library to use. Defaults to `bignumber.js`. */ type?: BnTypes; /** The base to use for the bignumber.js library. Ignored by other libraries. */ base?: number; } /** * An object representing the minimum and maximum values in an array of BigNumber-like objects. * @date 8.3.2023 - 08:40:49 * * @export * @interface MinMax * @typedef {MinMax} */ export interface MinMax { /** The minimum value in the array. */ min: BigNumberJS; /** The maximum value in the array. */ max: BigNumberJS; } export interface CIDs { v0: string; v1: string; hex: string; }