UNPKG

1.76 kBTypeScriptView Raw
1/// <reference types="node" />
2import BN from 'bn.js';
3export declare class Address {
4 readonly buf: Buffer;
5 constructor(buf: Buffer);
6 /**
7 * Returns the zero address.
8 */
9 static zero(): Address;
10 /**
11 * Returns an Address object from a hex-encoded string.
12 * @param str - Hex-encoded address
13 */
14 static fromString(str: string): Address;
15 /**
16 * Returns an address for a given public key.
17 * @param pubKey The two points of an uncompressed key
18 */
19 static fromPublicKey(pubKey: Buffer): Address;
20 /**
21 * Returns an address for a given private key.
22 * @param privateKey A private key must be 256 bits wide
23 */
24 static fromPrivateKey(privateKey: Buffer): Address;
25 /**
26 * Generates an address for a newly created contract.
27 * @param from The address which is creating this new address
28 * @param nonce The nonce of the from account
29 */
30 static generate(from: Address, nonce: BN): Address;
31 /**
32 * Generates an address for a contract created using CREATE2.
33 * @param from The address which is creating this new address
34 * @param salt A salt
35 * @param initCode The init code of the contract being created
36 */
37 static generate2(from: Address, salt: Buffer, initCode: Buffer): Address;
38 /**
39 * Is address equal to another.
40 */
41 equals(address: Address): boolean;
42 /**
43 * Is address zero.
44 */
45 isZero(): boolean;
46 /**
47 * True if address is in the address range defined
48 * by EIP-1352
49 */
50 isPrecompileOrSystemAddress(): boolean;
51 /**
52 * Returns hex encoding of address.
53 */
54 toString(): string;
55 /**
56 * Returns Buffer representation of address.
57 */
58 toBuffer(): Buffer;
59}