ethereumjs-wallet

  • Version 1.0.2
  • Published
  • 162 kB
  • 8 dependencies
  • MIT license

Install

npm i ethereumjs-wallet
yarn add ethereumjs-wallet
pnpm add ethereumjs-wallet

Overview

Utilities for handling Ethereum keys

Index

Variables

variable thirdparty

const thirdparty: {
fromEtherWallet: typeof fromEtherWallet;
fromEtherCamp: typeof fromEtherCamp;
fromKryptoKit: typeof fromKryptoKit;
fromQuorumWallet: typeof fromQuorumWallet;
};

    Classes

    class hdkey

    class EthereumHDKey {}

      constructor

      constructor(_hdkey?: any);

        method deriveChild

        deriveChild: (index: number) => EthereumHDKey;
        • Derive a node based on a child index

        method derivePath

        derivePath: (path: string) => EthereumHDKey;
        • Derives a node based on a path (e.g. m/44'/0'/0/1)

        method fromExtendedKey

        static fromExtendedKey: (base58Key: string) => EthereumHDKey;
        • Create an instance based on a BIP32 extended private or public key.

        method fromMasterSeed

        static fromMasterSeed: (seedBuffer: any) => EthereumHDKey;
        • Creates an instance based on a seed.

          For the seed we suggest to use [bip39](https://npmjs.org/package/bip39) to create one from a BIP39 mnemonic.

        method getWallet

        getWallet: () => Wallet;
        • Return a Wallet instance as seen above

        method privateExtendedKey

        privateExtendedKey: () => any;
        • Returns a BIP32 extended private key (xprv)

        method publicExtendedKey

        publicExtendedKey: () => any;
        • Return a BIP32 extended public key (xpub)

        class Wallet

        class Wallet {}

          constructor

          constructor(privateKey?: any, publicKey?: any);

            method fromEthSale

            static fromEthSale: (
            input: string | EthSaleKeystore,
            password: string
            ) => Wallet;

              method fromExtendedPrivateKey

              static fromExtendedPrivateKey: (extendedPrivateKey: string) => Wallet;
              • Create an instance based on a BIP32 extended private key (xprv)

              method fromExtendedPublicKey

              static fromExtendedPublicKey: (extendedPublicKey: string) => Wallet;
              • Create an instance based on a BIP32 extended public key (xpub)

              method fromPrivateKey

              static fromPrivateKey: (privateKey: any) => Wallet;
              • Create an instance based on a raw private key

              method fromPublicKey

              static fromPublicKey: (publicKey: any, nonStrict?: boolean) => 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.

              method fromV1

              static fromV1: (input: string | V1Keystore, password: string) => Promise<Wallet>;
              • Import a wallet (Version 1 of the Ethereum wallet format).

                Parameter input

                A JSON serialized string, or an object representing V1 Keystore.

                Parameter password

                The keystore password.

              method fromV3

              static fromV3: (
              input: string | V3Keystore,
              password: string,
              nonStrict?: boolean
              ) => Promise<Wallet>;
              • Import a wallet (Version 3 of the Ethereum wallet format). Set nonStrict true to accept files with mixed-caps.

                Parameter input

                A JSON serialized string, or an object representing V3 Keystore.

                Parameter password

                The keystore password.

              method generate

              static generate: (icapDirect?: boolean) => Wallet;
              • Create an instance based on a new random key.

                Parameter icapDirect

                setting this to true will generate an address suitable for the ICAP Direct mode

              method generateVanityAddress

              static generateVanityAddress: (pattern: RegExp | string) => Wallet;
              • Create an instance where the address is valid against the supplied pattern (**this will be very slow**)

              method getAddress

              getAddress: () => any;
              • Returns the wallet's address.

              method getAddressString

              getAddressString: () => string;
              • Returns the wallet's address as a "0x" prefixed hex string

              method getChecksumAddressString

              getChecksumAddressString: () => string;
              • Returns the wallet's private key as a "0x" prefixed hex string checksummed according to [EIP 55](https://github.com/ethereum/EIPs/issues/55).

              method getPrivateKey

              getPrivateKey: () => any;
              • Returns the wallet's private key.

              method getPrivateKeyString

              getPrivateKeyString: () => string;

                method getPublicKey

                getPublicKey: () => any;
                • Returns the wallet's public key.

                method getPublicKeyString

                getPublicKeyString: () => string;
                • Returns the wallet's public key as a "0x" prefixed hex string

                method getV3Filename

                getV3Filename: (timestamp?: number) => string;
                • Return the suggested filename for V3 keystores.

                method toV3

                toV3: (password: string, opts?: Partial<V3Params>) => Promise<V3Keystore>;
                • Returns an Etherem Version 3 Keystore Format object representing the wallet

                  Parameter password

                  The password used to encrypt the Keystore.

                  Parameter opts

                  The options for the keystore. See [its spec](https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition) for more info.

                method toV3String

                toV3String: (password: string, opts?: Partial<V3Params>) => Promise<string>;

                  Package Files (3)

                  Dependencies (8)

                  Dev Dependencies (22)

                  Peer Dependencies (0)

                  No peer dependencies.

                  Badge

                  To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                  You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/ethereumjs-wallet.

                  • Markdown
                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/ethereumjs-wallet)
                  • HTML
                    <a href="https://www.jsdocs.io/package/ethereumjs-wallet"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>