@ethereumjs/util / Address
Handling and generating Ethereum addresses
- equals
- isPrecompileOrSystemAddress
- isZero
- toBytes
- toString
- fromPrivateKey
- fromPublicKey
- fromString
- generate
- generate2
- zero
• new Address(bytes
)
Name | Type |
---|---|
bytes |
Uint8Array |
packages/util/src/address.ts:17
• Readonly
bytes: Uint8Array
packages/util/src/address.ts:15
▸ equals(address
): boolean
Is address equal to another.
Name | Type |
---|---|
address |
Address |
boolean
packages/util/src/address.ts:97
▸ isPrecompileOrSystemAddress(): boolean
True if address is in the address range defined by EIP-1352
boolean
packages/util/src/address.ts:112
▸ isZero(): boolean
Is address zero.
boolean
packages/util/src/address.ts:104
▸ toBytes(): Uint8Array
Returns a new Uint8Array representation of address.
Uint8Array
packages/util/src/address.ts:129
▸ toString(): string
Returns hex encoding of address.
string
packages/util/src/address.ts:122
▸ Static
fromPrivateKey(privateKey
): Address
Returns an address for a given private key.
Name | Type | Description |
---|---|---|
privateKey |
Uint8Array |
A private key must be 256 bits wide |
packages/util/src/address.ts:58
▸ Static
fromPublicKey(pubKey
): Address
Returns an address for a given public key.
Name | Type | Description |
---|---|---|
pubKey |
Uint8Array |
The two points of an uncompressed key |
packages/util/src/address.ts:46
▸ Static
fromString(str
): Address
Returns an Address object from a hex-encoded string.
Name | Type | Description |
---|---|---|
str |
string |
Hex-encoded address |
packages/util/src/address.ts:35
▸ Static
generate(from
, nonce
): Address
Generates an address for a newly created contract.
Name | Type | Description |
---|---|---|
from |
Address |
The address which is creating this new address |
nonce |
bigint |
The nonce of the from account |
packages/util/src/address.ts:71
▸ Static
generate2(from
, salt
, initCode
): Address
Generates an address for a contract created using CREATE2.
Name | Type | Description |
---|---|---|
from |
Address |
The address which is creating this new address |
salt |
Uint8Array |
A salt |
initCode |
Uint8Array |
The init code of the contract being created |
packages/util/src/address.ts:84
▸ Static
zero(): Address
Returns the zero address.