forked from machinomy/types-ethereumjs-util
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
95 lines (51 loc) · 4.04 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Type definitions for ethereumjs-util 5.2
// Project: https://github.com/ethereumjs/ethereumjs-util#readme
// Definitions by: Juan J. Jimenez-Anca <https://github.com/cortopy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
// TODO: import types for [`rlp`](https://github.com/ethereumjs/rlp)
// TODO: import types for [`secp256k1`](https://github.com/cryptocoinjs/secp256k1-node/)
declare module 'ethereumjs-util' {
import BN = require("bn.js");
export const SHA3_NULL_S: string;
export const SHA3_RLP_ARRAY_S: string;
export const SHA3_RLP_S: string;
export function addHexPrefix(str: string): string;
export function baToJSON(ba: Buffer | Uint8Array | string[]): Buffer | Uint8Array | string[] | null;
export function bufferToHex(buf: Buffer | Uint8Array): string;
export function bufferToInt(buf: Buffer | Uint8Array): number;
export function defineProperties(self: { [k: string]: any }, fields: string[], data: { [k: string]: any }): { [k: string]: any };
export function ecrecover(msgHash: Buffer | Uint8Array, v: number, r: Buffer | Uint8Array, s: Buffer | Uint8Array): Buffer | Uint8Array;
export function ecsign(msgHash: Buffer | Uint8Array, privateKey: Buffer | Uint8Array): { [k: string]: any };
export function fromRpcSig(sig: string): { [k: string]: any };
export function fromSigned(num: Buffer | Uint8Array): BN;
export function generateAddress(from: Buffer | Uint8Array, nonce: Buffer | Uint8Array): Buffer | Uint8Array;
export function generateAddress2(from: Buffer | string, salt: Buffer | string, initCode: Buffer | string): Buffer;
export function hashPersonalMessage(message: Buffer | Uint8Array | any[]): Buffer | Uint8Array;
export function importPublic(publicKey: Buffer | Uint8Array): Buffer | Uint8Array;
export function isPrecompiled(address: Buffer | Uint8Array): boolean;
export function isValidAddress(address: string): boolean;
export function isValidChecksumAddress(address: Buffer | Uint8Array): boolean;
export function isValidPrivate(privateKey: Buffer | Uint8Array): boolean;
export function isValidPublic(publicKey: Buffer | Uint8Array, sanitize?: boolean): any;
export function isValidSignature(v: Buffer | Uint8Array, r: Buffer | Uint8Array, s: Buffer | Uint8Array, homestead?: boolean): boolean;
export function isZeroAddress(address: string): boolean;
export function keccak(a: Buffer | Uint8Array | any[] | string | number, bits?: number): Buffer | Uint8Array;
export function keccak256(a: Buffer | Uint8Array | any[] | string | number): Buffer | Uint8Array;
export function privateToAddress(privateKey: Buffer | Uint8Array): Buffer | Uint8Array;
export function privateToPublic(privateKey: Buffer | Uint8Array): Buffer | Uint8Array;
export function pubToAddress(pubKey: Buffer | Uint8Array, sanitize?: boolean): Buffer | Uint8Array;
export function ripemd160(a: Buffer | Uint8Array | any[] | string | number, padded: boolean): Buffer | Uint8Array;
export function rlphash(a: Buffer | Uint8Array | any[] | string | number): Buffer | Uint8Array;
export function setLengthLeft(msg: Buffer | Uint8Array | any[], length: number, right?: boolean): Buffer | Uint8Array | any[];
export function setLengthRight(msg: Buffer | Uint8Array | any[], length: number): Buffer | Uint8Array | any[];
export function sha256(a: Buffer | Uint8Array | any[] | string | number): Buffer | Uint8Array;
export function sha3(a: Buffer | Uint8Array | any[] | string | number, bits?: number): Buffer | Uint8Array;
export function toBuffer(v: any): Buffer | Uint8Array;
export function toChecksumAddress(address: string): string;
export function toRpcSig(v: number, r: Buffer | Uint8Array, s: Buffer | Uint8Array): string;
export function toUnsigned(num: BN): Buffer | Uint8Array;
export function unpad<T extends Buffer | Uint8Array | any[] | string>(a: T): T;
export function zeros(bytes: number): Buffer | Uint8Array;
export function zeroAddress(): string;
}