60 lines
1.7 KiB
TypeScript
60 lines
1.7 KiB
TypeScript
/// <reference types="node" />
|
|
import BN from 'bn.js';
|
|
export declare class Address {
|
|
readonly buf: Buffer;
|
|
constructor(buf: Buffer);
|
|
/**
|
|
* Returns the zero address.
|
|
*/
|
|
static zero(): Address;
|
|
/**
|
|
* Returns an Address object from a hex-encoded string.
|
|
* @param str - Hex-encoded address
|
|
*/
|
|
static fromString(str: string): Address;
|
|
/**
|
|
* Returns an address for a given public key.
|
|
* @param pubKey The two points of an uncompressed key
|
|
*/
|
|
static fromPublicKey(pubKey: Buffer): Address;
|
|
/**
|
|
* Returns an address for a given private key.
|
|
* @param privateKey A private key must be 256 bits wide
|
|
*/
|
|
static fromPrivateKey(privateKey: Buffer): Address;
|
|
/**
|
|
* Generates an address for a newly created contract.
|
|
* @param from The address which is creating this new address
|
|
* @param nonce The nonce of the from account
|
|
*/
|
|
static generate(from: Address, nonce: BN): Address;
|
|
/**
|
|
* Generates an address for a contract created using CREATE2.
|
|
* @param from The address which is creating this new address
|
|
* @param salt A salt
|
|
* @param initCode The init code of the contract being created
|
|
*/
|
|
static generate2(from: Address, salt: Buffer, initCode: Buffer): Address;
|
|
/**
|
|
* Is address equal to another.
|
|
*/
|
|
equals(address: Address): boolean;
|
|
/**
|
|
* Is address zero.
|
|
*/
|
|
isZero(): boolean;
|
|
/**
|
|
* True if address is in the address range defined
|
|
* by EIP-1352
|
|
*/
|
|
isPrecompileOrSystemAddress(): boolean;
|
|
/**
|
|
* Returns hex encoding of address.
|
|
*/
|
|
toString(): string;
|
|
/**
|
|
* Returns Buffer representation of address.
|
|
*/
|
|
toBuffer(): Buffer;
|
|
}
|