UNPKG

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