ElvWallet

new ElvWallet()

Create a new ElvWallet connected to the given provider

NOTE: It is recommended to initialize wallets from the ElvClient, not using this constructor

See:
  • ElvClient#GenerateWallet()
Source:

Methods

AddAccount({
accountNameoptional,
privateKey
})
→ Signer

Add an account from a private key (Ethereum keystore format)

Returns: Signer with the private key, connected to the provider
Parameters:
Name Type Attributes Description
accountName string <optional>

Name of account to save in wallet. Account will be saved in the wallet if provided.

privateKey string

Private key to use

Examples
 AddAccount({
  "accountName": "test",
  "privateKey": "<filtered>"
});


<Ethers#Wallet>
 AddAccount({
  "accountName": "mnemonic",
  "privateKey": "<filtered>"
});


<Ethers#Wallet>
 AddAccount({
  "accountName": "private key",
  "privateKey": "<filtered>"
});


<Ethers#Wallet>
 AddAccount({
  "privateKey": "<filtered>"
});


<Ethers#Wallet>
Source:

async AddAccountFromEncryptedPK({
accountNameoptional,
encryptedPrivateKey
})
→ Promise.<Signer>

Add an account from an encrypted private key (Ethereum keystore format)

Returns: Signer with the decrypted private key, connected to the provider
Parameters:
Name Type Attributes Description
accountName string <optional>

Name of account to save in wallet. Account will be saved in the wallet if provided.

encryptedPrivateKey string

Encrypted private key to decrypt

Examples
async AddAccountFromEncryptedPK({
  "accountName": "private key",
  "encryptedPrivateKey": "{\"address\":\"ef55143b962328914c35c16e225b8aa768434abf\",\"crypto\":{\"cipher\":\"aes-128-ctr\",\"ciphertext\":\"4314d3d5b80ac0c87add387cb3fdf940a4d6d9d999501aa18b5b224f4be70a74\",\"cipherparams\":{\"iv\":\"41cb3d70282553819d836f51540dcca3\"},\"kdf\":\"scrypt\",\"kdfparams\":{\"dklen\":32,\"n\":262144,\"p\":1,\"r\":8,\"salt\":\"03003c0e1f63de7890226b63bf0768fc4faa98eb6c7c1767a72a0cf34c791ac1\"},\"mac\":\"5afd202da30fdadb880dec99a2e8ff4a209fb7aa38c2dd662cc4a375667ce582\"},\"id\":\"05f541df-9dd5-4485-8704-71998d90e6cc\",\"version\":3}",
  "password": "test"
});


<Ethers#Wallet>
async AddAccountFromEncryptedPK({
  "accountName": "private key",
  "encryptedPrivateKey": {
    "address": "ef55143b962328914c35c16e225b8aa768434abf",
    "crypto": {
      "cipher": "aes-128-ctr",
      "ciphertext": "4314d3d5b80ac0c87add387cb3fdf940a4d6d9d999501aa18b5b224f4be70a74",
      "cipherparams": {
        "iv": "41cb3d70282553819d836f51540dcca3"
      },
      "kdf": "scrypt",
      "kdfparams": {
        "dklen": 32,
        "n": 262144,
        "p": 1,
        "r": 8,
        "salt": "03003c0e1f63de7890226b63bf0768fc4faa98eb6c7c1767a72a0cf34c791ac1"
      },
      "mac": "5afd202da30fdadb880dec99a2e8ff4a209fb7aa38c2dd662cc4a375667ce582"
    },
    "id": "05f541df-9dd5-4485-8704-71998d90e6cc",
    "version": 3
  },
  "password": "test"
});


<Ethers#Wallet>
async AddAccountFromEncryptedPK({
  "encryptedPrivateKey": "{\"address\":\"95ced938f7991cd0dfcb48f0a06a40fa1af46ebc\",\"id\":\"cb3470a3-6531-4ce4-8b5c-efc5912265f1\",\"version\":3,\"Crypto\":{\"cipher\":\"aes-128-ctr\",\"cipherparams\":{\"iv\":\"c953ac2866ba4ed94f3c94ae38c0af25\"},\"ciphertext\":\"2672b966d9a9c636a1f5e7f5028bfcf24416028bd4e8096675af2815a10ee50e\",\"kdf\":\"scrypt\",\"kdfparams\":{\"salt\":\"0d0ab65f6046720d5c7e43aa3f8ad29a138ea834ce4b5c1a746538a030efd187\",\"n\":16384,\"dklen\":32,\"p\":1,\"r\":8},\"mac\":\"d907fa3fb1f0f97a7ff1242a467769ecd85fa232fe835890a9a900f5a38ef9b0\"}}",
  "password": "test"
});


<Ethers#Wallet>
Source:

AddAccountFromMnemonic({
accountNameoptional,
mnemonic
})
→ Signer

Generate a private key from the given mnemonic

Returns: Signer with the generated private key, connected to the provider
Parameters:
Name Type Attributes Description
accountName string <optional>

Name of account to save in wallet. Account will be saved in the wallet if provided.

mnemonic string

Mnemonic from which to generate a private key

Example
 AddAccountFromMnemonic({
  "accountName": "mnemonic",
  "mnemonic": "bread volume zone start cannon shiver excess resource model spice infant link"
});


<Ethers#Wallet>
Source:

async GenerateEncryptedPrivateKey({
accountNameoptional,
signeroptional,
password
})
→ Promise.<string>

Generate the encrypted private key (Ethereum keystore format) of the signer's private key The private key to decrypt can be specified either by passing the signer object, or by passing the account name of a saved account

Note: Either the signer OR the account name should be specified

Returns: The encrypted private key (in Ethereum keystore format)
Parameters:
Name Type Attributes Description
accountName string <optional>

Saved account to encrypt the private key of

signer string <optional>

Signer to encrypt the private key of

password string

Password to encrypt the private key with

Example
async GenerateEncryptedPrivateKey({
  "signer": "<Ethers#Wallet>",
  "password": "test",
  "options": {
    "scrypt": {
      "N": 16384
    }
  }
});


"{\"address\":\"95ced938f7991cd0dfcb48f0a06a40fa1af46ebc\",\"id\":\"cb3470a3-6531-4ce4-8b5c-efc5912265f1\",\"version\":3,\"Crypto\":{\"cipher\":\"aes-128-ctr\",\"cipherparams\":{\"iv\":\"c953ac2866ba4ed94f3c94ae38c0af25\"},\"ciphertext\":\"2672b966d9a9c636a1f5e7f5028bfcf24416028bd4e8096675af2815a10ee50e\",\"kdf\":\"scrypt\",\"kdfparams\":{\"salt\":\"0d0ab65f6046720d5c7e43aa3f8ad29a138ea834ce4b5c1a746538a030efd187\",\"n\":16384,\"dklen\":32,\"p\":1,\"r\":8},\"mac\":\"d907fa3fb1f0f97a7ff1242a467769ecd85fa232fe835890a9a900f5a38ef9b0\"}}"
Source:

GenerateMnemonic() → string

Generate a mnemonic that can be used to initialize a private key

Returns: Space-separated list of random words
Example
 GenerateMnemonic();


"bread volume zone start cannon shiver excess resource model spice infant link"
Source:

GetAccount({accountName}) → Signer|undefined

Get the signer of a previously saved account by name

Returns: Signer of the saved account, if it exists
Parameters:
Name Type Description
accountName string

Name of the account

Examples
 GetAccount({
  "accountName": "test"
});


<Ethers#Wallet>
 GetAccount({
  "accountName": "test"
});


<No Return Value>
 GetAccount({
  "accountName": "mnemonic"
});


<Ethers#Wallet>
Source:

async GetAccountBalance({
accountNameoptional,
signeroptional
})
→ number

Get the balance of the account. The account to query can be specified either by passing the signer object, or by passing the account name of a saved account

Note: Either the signer OR the account name should be specified

Returns: Account balance of the specified account, in ETH
Parameters:
Name Type Attributes Description
accountName string <optional>

Saved account to query the account balance of

signer Signer <optional>

Signer to query the account balance of

Examples
async GetAccountBalance({
  "accountName": "mnemonic"
});


"0.0"
async GetAccountBalance({
  "signer": "<Ethers#Wallet>"
});


"0.0"
Source:

RemoveAccount({accountName})

Remove a previously saved account from this wallet

Parameters:
Name Type Description
accountName string

Name of the account to delete

Example
 RemoveAccount({
  "accountName": "test"
});


<No Return Value>
Source: