xrpld
Loading...
Searching...
No Matches
xrpl::test::Account Class Reference

A test account with cryptographic keys. More...

#include <Account.h>

Collaboration diagram for xrpl::test::Account:

Public Member Functions

 Account (std::string_view name, KeyType type=KeyType::Secp256k1)
 Create an account from a name.
std::string const & name () const noexcept
 Return the human-readable name.
AccountID const & id () const noexcept
 Return the AccountID.
PublicKey const & pk () const noexcept
 Return the public key.
SecretKey const & sk () const noexcept
 Return the secret key.
 operator AccountID const & () const noexcept
 Implicit conversion to AccountID.

Static Public Attributes

static Account const kMaster
 The master account that holds all XRP in genesis.

Private Attributes

std::string name_
std::pair< PublicKey, SecretKeykeyPair_
AccountID id_

Detailed Description

A test account with cryptographic keys.

Generates keys deterministically from a name, making tests reproducible. The same name always produces the same AccountID and keys.

Definition at line 20 of file /libxrpl/helpers/Account.h.

Constructor & Destructor Documentation

◆ Account()

xrpl::test::Account::Account ( std::string_view name,
KeyType type = KeyType::Secp256k1 )
explicit

Create an account from a name.

Keys are derived deterministically from the name.

Parameters
nameHuman-readable name for the account.
typeKey type to use (defaults to secp256k1).

Definition at line 12 of file /libxrpl/helpers/Account.cpp.

Member Function Documentation

◆ name()

std::string const & xrpl::test::Account::name ( ) const
nodiscardnoexcept

Return the human-readable name.

Definition at line 43 of file /libxrpl/helpers/Account.h.

◆ id()

AccountID const & xrpl::test::Account::id ( ) const
nodiscardnoexcept

Return the AccountID.

Definition at line 50 of file /libxrpl/helpers/Account.h.

◆ pk()

PublicKey const & xrpl::test::Account::pk ( ) const
nodiscardnoexcept

Return the public key.

Definition at line 57 of file /libxrpl/helpers/Account.h.

◆ sk()

SecretKey const & xrpl::test::Account::sk ( ) const
nodiscardnoexcept

Return the secret key.

Definition at line 64 of file /libxrpl/helpers/Account.h.

◆ operator AccountID const &()

xrpl::test::Account::operator AccountID const & ( ) const
noexcept

Implicit conversion to AccountID.

Definition at line 70 of file /libxrpl/helpers/Account.h.

Member Data Documentation

◆ kMaster

Account const xrpl::test::Account::kMaster
static

The master account that holds all XRP in genesis.

This account is created in the genesis ledger with all 100 billion XRP. It uses the well-known seed "masterpassphrase".

Definition at line 29 of file /libxrpl/helpers/Account.h.

◆ name_

std::string xrpl::test::Account::name_
private

Definition at line 76 of file /libxrpl/helpers/Account.h.

◆ keyPair_

std::pair<PublicKey, SecretKey> xrpl::test::Account::keyPair_
private

Definition at line 77 of file /libxrpl/helpers/Account.h.

◆ id_

AccountID xrpl::test::Account::id_
private

Definition at line 78 of file /libxrpl/helpers/Account.h.