@ethereumjs/wallet / Wallet
• new Wallet(privateKey?
, publicKey?
)
Name | Type | Default value |
---|---|---|
privateKey? |
Uint8Array |
undefined |
publicKey |
undefined | Uint8Array |
undefined |
▸ getAddress(): Uint8Array
Returns the wallet’s address.
Uint8Array
▸ getAddressString(): string
Returns the wallet’s address as a “0x” prefixed hex string
string
▸ getChecksumAddressString(): string
Returns the wallet’s private key as a “0x” prefixed hex string checksummed according to EIP 55.
string
▸ getPrivateKey(): Uint8Array
Returns the wallet’s private key.
Uint8Array
▸ getPrivateKeyString(): string
string
▸ getPublicKey(): Uint8Array
Returns the wallet’s public key.
Uint8Array
▸ getPublicKeyString(): string
Returns the wallet’s public key as a “0x” prefixed hex string
string
▸ getV3Filename(timestamp?
): string
Return the suggested filename for V3 keystores.
Name | Type |
---|---|
timestamp? |
number |
string
▸ toV3(password
, opts?
): Promise
<V3Keystore
>
Returns an Etherem Version 3 Keystore Format object representing the wallet
Name | Type | Description |
---|---|---|
password |
string |
The password used to encrypt the Keystore. |
opts? |
Partial <V3Params > |
The options for the keystore. See its spec for more info. |
Promise
<V3Keystore
>
▸ toV3String(password
, opts?
): Promise
<string
>
Name | Type |
---|---|
password |
string |
opts? |
Partial <V3Params > |
Promise
<string
>
▸ verifyPublicKey(publicKey
): boolean
Verify the publicKey, privateKey pair
Name | Type | Description |
---|---|---|
publicKey |
Uint8Array |
the public key to verify against the private key of the wallet |
boolean
▸ Static
fromEthSale(input
, password
): Promise
<Wallet
>
Name | Type |
---|---|
input |
string | EthSaleKeystore |
password |
string |
Promise
<Wallet
>
▸ Static
fromExtendedPrivateKey(extendedPrivateKey
): Wallet
Create an instance based on a BIP32 extended private key (xprv)
Name | Type |
---|---|
extendedPrivateKey |
string |
▸ Static
fromExtendedPublicKey(extendedPublicKey
): Wallet
Create an instance based on a BIP32 extended public key (xpub)
Name | Type |
---|---|
extendedPublicKey |
string |
▸ Static
fromPrivateKey(privateKey
): Wallet
Create an instance based on a raw private key
Name | Type |
---|---|
privateKey |
Uint8Array |
▸ Static
fromPublicKey(publicKey
, nonStrict?
): Wallet
Create an instance based on a public key (certain methods will not be available)
This method only accepts uncompressed Ethereum-style public keys, unless
the nonStrict
flag is set to true.
Name | Type | Default value |
---|---|---|
publicKey |
Uint8Array |
undefined |
nonStrict |
boolean |
false |
▸ Static
fromV1(input
, password
): Promise
<Wallet
>
Import a wallet (Version 1 of the Ethereum wallet format).
Name | Type | Description |
---|---|---|
input |
string | V1Keystore |
A JSON serialized string, or an object representing V1 Keystore. |
password |
string |
The keystore password. |
Promise
<Wallet
>
▸ Static
fromV3(input
, password
, nonStrict?
): Promise
<Wallet
>
Import a wallet (Version 3 of the Ethereum wallet format). Set nonStrict
true to accept files with mixed-caps.
Name | Type | Default value | Description |
---|---|---|---|
input |
string | V3Keystore |
undefined |
A JSON serialized string, or an object representing V3 Keystore. |
password |
string |
undefined |
The keystore password. |
nonStrict |
boolean |
false |
- |
Promise
<Wallet
>
▸ Static
generate(icapDirect?
): Wallet
Create an instance based on a new random key.
Name | Type | Default value | Description |
---|---|---|---|
icapDirect |
boolean |
false |
setting this to true will generate an address suitable for the ICAP Direct mode |
▸ Static
generateVanityAddress(pattern
): Wallet
Create an instance where the address is valid against the supplied pattern (this will be very slow)
Name | Type |
---|---|
pattern |
string | RegExp |