- generateAddress
- generateAddress2
- importPublic
- isValidAddress
- isValidChecksumAddress
- isValidPrivate
- isValidPublic
- isZeroAddress
- privateToAddress
- privateToPublic
- pubToAddress
- toChecksumAddress
- zeroAddress
• publicToAddress: pubToAddress = pubToAddress
Defined in account.ts:258
▸ generateAddress(from
: Buffer, nonce
: Buffer): Buffer
Defined in account.ts:180
Generates an address of a newly created contract.
Parameters:
Name | Type | Description |
---|---|---|
from |
Buffer | The address which is creating this new address |
nonce |
Buffer | The nonce of the from account |
Returns: Buffer
▸ generateAddress2(from
: Buffer, salt
: Buffer, initCode
: Buffer): Buffer
Defined in account.ts:201
Generates an address for a contract created using CREATE2.
Parameters:
Name | Type | Description |
---|---|---|
from |
Buffer | The address which is creating this new address |
salt |
Buffer | A salt |
initCode |
Buffer | The init code of the contract being created |
Returns: Buffer
▸ importPublic(publicKey
: Buffer): Buffer
Defined in account.ts:281
Converts a public key to the Ethereum format.
Parameters:
Name | Type |
---|---|
publicKey |
Buffer |
Returns: Buffer
▸ isValidAddress(hexAddress
: string): boolean
Defined in account.ts:128
Checks if the address is a valid. Accepts checksummed addresses too.
Parameters:
Name | Type |
---|---|
hexAddress |
string |
Returns: boolean
▸ isValidChecksumAddress(hexAddress
: string, eip1191ChainId?
: undefined | number): boolean
Defined in account.ts:168
Checks if the address is a valid checksummed address.
See toChecksumAddress' documentation for details about the eip1191ChainId parameter.
Parameters:
Name | Type |
---|---|
hexAddress |
string |
eip1191ChainId? |
undefined | number |
Returns: boolean
▸ isValidPrivate(privateKey
: Buffer): boolean
Defined in account.ts:219
Checks if the private key satisfies the rules of the curve secp256k1.
Parameters:
Name | Type |
---|---|
privateKey |
Buffer |
Returns: boolean
▸ isValidPublic(publicKey
: Buffer, sanitize
: boolean): boolean
Defined in account.ts:229
Checks if the public key satisfies the rules of the curve secp256k1 and the requirements of Ethereum.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
publicKey |
Buffer | - | The two points of an uncompressed key, unless sanitize is enabled |
sanitize |
boolean | false | Accept public keys in other formats |
Returns: boolean
▸ isZeroAddress(hexAddress
: string): boolean
Defined in account.ts:301
Checks if a given address is the zero address.
Parameters:
Name | Type |
---|---|
hexAddress |
string |
Returns: boolean
▸ privateToAddress(privateKey
: Buffer): Buffer
Defined in account.ts:264
Returns the ethereum address of a given private key.
Parameters:
Name | Type | Description |
---|---|---|
privateKey |
Buffer | A private key must be 256 bits wide |
Returns: Buffer
▸ privateToPublic(privateKey
: Buffer): Buffer
Defined in account.ts:272
Returns the ethereum public key of a given private key.
Parameters:
Name | Type | Description |
---|---|---|
privateKey |
Buffer | A private key must be 256 bits wide |
Returns: Buffer
▸ pubToAddress(pubKey
: Buffer, sanitize
: boolean): Buffer
Defined in account.ts:249
Returns the ethereum address of a given public key. Accepts "Ethereum public keys" and SEC1 encoded keys.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
pubKey |
Buffer | - | The two points of an uncompressed key, unless sanitize is enabled |
sanitize |
boolean | false | Accept public keys in other formats |
Returns: Buffer
▸ toChecksumAddress(hexAddress
: string, eip1191ChainId?
: undefined | number): string
Defined in account.ts:143
Returns a checksummed address.
If a eip1191ChainId is provided, the chainId will be included in the checksum calculation. This has the effect of checksummed addresses for one chain having invalid checksums for others. For more details see EIP-1191.
WARNING: Checksums with and without the chainId will differ. As of 2019-06-26, the most commonly used variation in Ethereum was without the chainId. This may change in the future.
Parameters:
Name | Type |
---|---|
hexAddress |
string |
eip1191ChainId? |
undefined | number |
Returns: string
▸ zeroAddress(): string
Defined in account.ts:292
Returns the zero address.
Returns: string