UNPKG

2.39 kBTypeScriptView Raw
1/// <reference types="node" />
2/// <reference types="pouchdb-core" />
3import BigNumber from 'bignumber.js';
4import BN from 'bn.js';
5declare function lazyAsync<Input, Value>(getValue: (input: Input) => Promise<Value>): (input: Input) => Promise<Value>;
6declare function lazyOrValue<Value>(getValue: (() => Value) | Value): () => Value;
7declare function weightedAverage(input: ReadonlyArray<{
8 readonly value: number;
9 readonly weight: BigNumber;
10}>): number;
11declare function weightedFilter<T>(input: readonly T[], startIn: number, endIn: number, getValueIn: (value: T) => BN): ReadonlyArray<readonly [T, BigNumber]>;
12declare function equals<T>(clazz: new (...args: any[]) => T, thiz: T, equalsFunc: (other: T) => boolean): (other: any) => boolean;
13export declare const utils: {
14 toASCII: (bytes: Buffer) => string;
15 toUTF8: (bytes: Buffer) => string;
16 calculateClaimAmount: ({ coins, decrementInterval, generationAmount, getSystemFee, }: {
17 readonly coins: readonly {
18 readonly value: BN;
19 readonly startHeight: number;
20 readonly endHeight: number;
21 }[];
22 readonly decrementInterval: number;
23 readonly generationAmount: readonly number[];
24 readonly getSystemFee: (index: number) => Promise<BN>;
25 }) => Promise<BN>;
26 randomUInt64: () => BN;
27 toKeyString: (clazz: {
28 readonly name: string;
29 }, toKey: () => string) => () => string;
30 equals: typeof equals;
31 lazyAsync: typeof lazyAsync;
32 lazyOrValue: typeof lazyOrValue;
33 weightedAverage: typeof weightedAverage;
34 weightedFilter: typeof weightedFilter;
35 FD: BN;
36 FFFF: BN;
37 FFFFFFFF: BN;
38 ZERO: BN;
39 ONE: BN;
40 TWO: BN;
41 NEGATIVE_ONE: BN;
42 INT_MAX_VALUE: BN;
43 SATOSHI: BN;
44 NEGATIVE_SATOSHI: BN;
45 USHORT_MAX_NUMBER: number;
46 USHORT_MAX_NUMBER_PLUS_ONE: number;
47 USHORT_MAX: BN;
48 USHORT_MAX_PLUS_ONE: BN;
49 UINT_MAX_NUMBER: number;
50 UINT_MAX: BN;
51 ONE_HUNDRED_MILLION: BN;
52 ONE_THOUSAND_TWENTY_FOUR: BN;
53 EIGHT: BN;
54 TEN: BN;
55 SIXTEEN: BN;
56 ZERO_BIG_NUMBER: BigNumber;
57 NEGATIVE_ONE_BIG_NUMBER: BigNumber;
58 toSignedBuffer: (value: BN) => Buffer;
59 fromSignedBuffer: (value: Buffer) => BN;
60 bigNumberToBN: (value: BigNumber, decimals: number) => BN;
61 lazy: <Value>(getValue: () => Value) => () => Value;
62 randomUInt: () => number;
63};
64export {};