Ether Binder
Set of utilities for interacting with Ethereum and it's smart contracts with PHP, with generating ABI bindings and Ethereum-related types
Loading...
Searching...
No Matches
M8B\EtherBinder\Wallet\MnemonicWallet Class Reference
Inheritance diagram for M8B\EtherBinder\Wallet\MnemonicWallet:
M8B\EtherBinder\Wallet\AbstractWallet

Public Member Functions

 __construct (#[SensitiveParameter] string|array $words, #[SensitiveParameter] string $passPhrase="", string $path="m/44'/60'/0'/0/0", MnemonicLanguage|string $language=MnemonicLanguage::ENGLISH)
 
 key ()
 
 getKeyRaw (bool $bin=false)
 
 getAddress ()
 

Static Public Member Functions

static genNew (int $wordCount=24, MnemonicLanguage|string $language=MnemonicLanguage::ENGLISH)
 

Protected Attributes

Key $key
 

Detailed Description

MnemonicWallet extends the AbstractWallet to create a wallet from a mnemonic phrase. It handles the derivation and management of keys using BIP39 and HD Wallet standards.

Author
DubbaThony

Constructor & Destructor Documentation

◆ __construct()

M8B\EtherBinder\Wallet\MnemonicWallet::__construct ( # string|array $words[SensitiveParameter],
# string $passPhrase[SensitiveParameter] = "",
string $path = "m/44'/60'/0'/0/0",
MnemonicLanguage|string $language = MnemonicLanguage::ENGLISH )

Constructor to create a MnemonicWallet from words. While constructing, the words are processed into private key.

Parameters
string | array$wordsMnemonic phrase words.
string$passPhraseOptional passphrase for seed generation. For any passphrase it will generate another key, and there is no way of knowing if passphrase matched other than checking returning address is what was expected
string$pathHD Wallet derivation path.
MnemonicLanguage | string$languageLanguage for the mnemonic words.
Exceptions
WrongMnemonicPathException
MnemonicWalletInternalException
InvalidHexException

Member Function Documentation

◆ genNew()

static M8B\EtherBinder\Wallet\MnemonicWallet::genNew ( int $wordCount = 24,
MnemonicLanguage|string $language = MnemonicLanguage::ENGLISH )
static

Generates a new mnemonic phrase. If you don't have reason, use defaults.

Parameters
int$wordCountNumber of words in the mnemonic phrase.
MnemonicLanguage | string$languageLanguage for the mnemonic words. Defaults to english
Returns
array List of words for the mnemonic.
Exceptions
MnemonicWalletInternalException

◆ getAddress()

M8B\EtherBinder\Wallet\AbstractWallet::getAddress ( )
inherited

Returns the wallet's associated Ethereum address.

Returns
Address The Ethereum address.
Exceptions
EthBinderLogicExceptionLogic exception

◆ getKeyRaw()

M8B\EtherBinder\Wallet\AbstractWallet::getKeyRaw ( bool $bin = false)
inherited

Returns the raw private key in binary or hexadecimal format.

Parameters
bool$binIf true, returns in binary. Otherwise, returns in hexadecimal.
Returns
string The raw key.

◆ key()

M8B\EtherBinder\Wallet\AbstractWallet::key ( )
inherited

Returns the underlying private key object stored in the wallet.

Returns
Key The Key object.

The documentation for this class was generated from the following file: