Skip to main content
A Wallet manages a single private key which is used to sign transactions, messages and other common payloads. This class is generally the main entry point for developers that wish to use a private key directly, as it can create instances from a large variety of common sources, including raw private key, BIP-39 mnemonics and encrypted JSON wallets.

Extends

  • BaseWallet

Constructors

new Wallet()

Create a new wallet for the private key, optionally connected to provider.

Parameters

Returns

Wallet

Overrides

BaseWallet.constructor

Source

wallet/wallet.ts:34

Properties

Accessors

address

The address of this wallet.

Returns

string

Source

wallet/base-wallet.ts:71

privateKey

The private key for this wallet.

Returns

string

Source

wallet/base-wallet.ts:91

signingKey

The SigningKey used for signing payloads.

Returns

SigningKey

Source

wallet/base-wallet.ts:81

Methods

connect()

Connects the wallet to a provider.

Parameters

Returns

Wallet The connected wallet.

Overrides

BaseWallet.connect

Source

wallet/wallet.ts:49

encrypt()

Resolves to a JSON Keystore Wallet encrypted with password. If progressCallback is specified, it will receive periodic updates as the encryption process progresses.

Parameters

Returns

Promise<string> The encrypted JSON wallet.

Source

wallet/wallet.ts:62

encryptSync()

Returns a JSON Keystore Wallet encrypted with password. It is preferred to use the async version instead, which allows a ProgressCallback to keep the user informed. This method will block the event loop (freezing all UI) until it is complete, which may be a non-trivial duration.

Parameters

Returns

string The encrypted JSON wallet.

Source

wallet/wallet.ts:79

getAddress()

Returns the address of this wallet.

Parameters

Returns

Promise<string> The wallet address.

Inherited from

BaseWallet.getAddress

Source

wallet/base-wallet.ts:103

signMessage()

Signs a message.

Parameters

Returns

Promise<string> The signed message.

Inherited from

BaseWallet.signMessage

Async

Source

wallet/base-wallet.ts:161

signMessageSync()

Returns the signature for message signed with this wallet.

Parameters

Returns

string The serialized signature.

Inherited from

BaseWallet.signMessageSync

Source

wallet/base-wallet.ts:173

signTransaction()

Signs a transaction.

Parameters

Returns

Promise<string> The signed transaction.

Inherited from

BaseWallet.signTransaction

Source

wallet/base-wallet.ts:123

signTypedData()

Signs typed data.

Parameters

Returns

Promise<string> The signed typed data.

Inherited from

BaseWallet.signTypedData

Async

Source

wallet/base-wallet.ts:186

fromEncryptedJson()

Creates (asynchronously) a Wallet by decrypting the json with password. If progress is provided, it is called periodically during decryption so that any UI can be updated.

Parameters

Returns

Promise<Wallet> The decrypted wallet.

Source

wallet/wallet.ts:111

fromEncryptedJsonSync()

Creates a Wallet by decrypting the json with password. The fromEncryptedJson method is preferred, as this method will lock up and freeze the UI during decryption, which may take some time.

Parameters

Returns

QuaiHDWallet | Wallet The decrypted wallet.

Source

wallet/wallet.ts:134