You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 30, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+42-41Lines changed: 42 additions & 41 deletions
Original file line number
Diff line number
Diff line change
@@ -28,81 +28,82 @@ Features not supported:
28
28
29
29
## Wallet API
30
30
31
-
Constructors:
31
+
For information about the Wallet's API, please go to [./docs/classes/wallet.md](./docs/classes/wallet.md).
32
32
33
-
-`generate([icap])` - create an instance based on a new random key (setting `icap` to true will generate an address suitable for the `ICAP Direct mode`)
34
-
-`generateVanityAddress(pattern)` - create an instance where the address is valid against the supplied pattern (**this will be very slow**)
35
-
-`fromPrivateKey(input)` - create an instance based on a raw private key
36
-
-`fromExtendedPrivateKey(input)` - create an instance based on a BIP32 extended private key (xprv)
37
-
-`fromPublicKey(input, [nonStrict])` - create an instance based on a public key (certain methods will not be available)
38
-
-`fromExtendedPublicKey(input)` - create an instance based on a BIP32 extended public key (xpub)
39
-
-`fromV1(input, password)` - import a wallet (Version 1 of the Ethereum wallet format)
40
-
-`fromV3(input, password, [nonStrict])` - import a wallet (Version 3 of the Ethereum wallet format). Set `nonStrict` true to accept files with mixed-caps.
41
-
-`fromEthSale(input, password)` - import an Ethereum Pre Sale wallet
33
+
You can import the `Wallet` class like this
42
34
43
-
For the V1, V3 and EthSale formats the input is a JSON serialized string. All these formats require a password.
35
+
Node.js / ES5:
44
36
45
-
Note: `fromPublicKey()` only accepts uncompressed Ethereum-style public keys, unless the `nonStrict` flag is set to true.
46
-
47
-
Instance methods:
48
-
49
-
-`getPrivateKey()` - return the private key
50
-
-`getPublicKey()` - return the public key
51
-
-`getAddress()` - return the address
52
-
-`getChecksumAddressString()` - return the [address with checksum](https://github.com/ethereum/EIPs/issues/55)
53
-
-`getV3Filename([timestamp])` - return the suggested filename for V3 keystores
54
-
-`toV3(password, [options])` - return the wallet as a JSON string (Version 3 of the Ethereum wallet format)
37
+
```js
38
+
const { Wallet } =require('ethereumjs-wallet')
39
+
```
55
40
56
-
All of the above instance methods return a Buffer or JSON. Use the `String` suffixed versions for a string output, such as `getPrivateKeyString()`.
41
+
ESM / TypeScript:
57
42
58
-
Note: `getPublicKey()` only returns uncompressed Ethereum-style public keys.
43
+
```js
44
+
import { Wallet } from'ethereumjs-wallet'
45
+
```
59
46
60
47
## Thirdparty API
61
48
62
49
Importing various third party wallets is possible through the `thirdparty` submodule:
0 commit comments