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

Immutable cryptographic account descriptor. More...

#include <Account.h>

Collaboration diagram for xrpl::test::jtx::Account:

Classes

struct  PrivateCtorTag

Public Types

enum class  AcctStringType { Base58Seed , Other }

Public Member Functions

 Account ()=delete
 Account (Account &&)=default
 Account (Account const &)=default
Accountoperator= (Account const &)=default
Accountoperator= (Account &&)=default
 Account (std::string name, AccountID const &id)
 Create an Account from an account ID.
 Account (AcctStringType stringType, std::string base58SeedStr)
 Create an account from a base58 seed string.
std::string const & name () const
 Return the name.
PublicKey const & pk () const
 Return the public key.
SecretKey const & sk () const
 Return the secret key.
AccountID id () const
 Returns the Account ID.
std::string const & human () const
 Returns the human readable public key.
 operator AccountID () const
 Implicit conversion to AccountID.
IOU operator[] (std::string const &s) const
 Returns an IOU for the specified gateway currency.
 Account (std::string name, KeyType type=KeyType::Secp256k1)
 Create an account from a simple string name.
 Account (char const *name, KeyType type=KeyType::Secp256k1)
 Account (std::string name, std::pair< PublicKey, SecretKey > const &keys, Account::PrivateCtorTag)

Static Public Attributes

static Account const kMaster {"masterpassphrase"}
 The master account.

Static Private Member Functions

static Account fromCache (AcctStringType stringType, std::string name, KeyType type)

Private Attributes

std::string name_
PublicKey pk_
SecretKey sk_
AccountID id_
std::string human_

Static Private Attributes

static std::unordered_map< std::pair< std::string, KeyType >, Account, beast::Uhash<> > cache

Detailed Description

Immutable cryptographic account descriptor.

Definition at line 16 of file jtx/Account.h.

Member Enumeration Documentation

◆ AcctStringType

Enumerator
Base58Seed 
Other 

Definition at line 55 of file jtx/Account.h.

Constructor & Destructor Documentation

◆ Account() [1/8]

xrpl::test::jtx::Account::Account ( )
delete

◆ Account() [2/8]

xrpl::test::jtx::Account::Account ( Account && )
default

◆ Account() [3/8]

xrpl::test::jtx::Account::Account ( Account const & )
default

◆ Account() [4/8]

xrpl::test::jtx::Account::Account ( std::string name,
KeyType type = KeyType::Secp256k1 )

Create an account from a simple string name.

Definition at line 70 of file jtx/impl/Account.cpp.

◆ Account() [5/8]

xrpl::test::jtx::Account::Account ( char const * name,
KeyType type = KeyType::Secp256k1 )

Definition at line 40 of file jtx/Account.h.

◆ Account() [6/8]

xrpl::test::jtx::Account::Account ( std::string name,
std::pair< PublicKey, SecretKey > const & keys,
Account::PrivateCtorTag  )

Definition at line 31 of file jtx/impl/Account.cpp.

◆ Account() [7/8]

xrpl::test::jtx::Account::Account ( std::string name,
AccountID const & id )
explicit

Create an Account from an account ID.

Should only be used when the secret key is unavailable, such as for pseudo-accounts.

Definition at line 83 of file jtx/impl/Account.cpp.

◆ Account() [8/8]

xrpl::test::jtx::Account::Account ( AcctStringType stringType,
std::string base58SeedStr )

Create an account from a base58 seed string.

Throws on invalid seed.

Definition at line 75 of file jtx/impl/Account.cpp.

Member Function Documentation

◆ operator=() [1/2]

Account & xrpl::test::jtx::Account::operator= ( Account const & )
default

◆ operator=() [2/2]

Account & xrpl::test::jtx::Account::operator= ( Account && )
default

◆ name()

std::string const & xrpl::test::jtx::Account::name ( ) const
nodiscard

Return the name.

Definition at line 61 of file jtx/Account.h.

◆ pk()

PublicKey const & xrpl::test::jtx::Account::pk ( ) const
nodiscard

Return the public key.

Definition at line 68 of file jtx/Account.h.

◆ sk()

SecretKey const & xrpl::test::jtx::Account::sk ( ) const
nodiscard

Return the secret key.

Definition at line 75 of file jtx/Account.h.

◆ id()

AccountID xrpl::test::jtx::Account::id ( ) const
nodiscard

Returns the Account ID.

The Account ID is the uint160 hash of the public key.

Definition at line 85 of file jtx/Account.h.

◆ human()

std::string const & xrpl::test::jtx::Account::human ( ) const
nodiscard

Returns the human readable public key.

Definition at line 92 of file jtx/Account.h.

◆ operator AccountID()

xrpl::test::jtx::Account::operator AccountID ( ) const

Implicit conversion to AccountID.

This allows passing an Account where an AccountID is expected.

Definition at line 102 of file jtx/Account.h.

◆ operator[]()

IOU xrpl::test::jtx::Account::operator[] ( std::string const & s) const

Returns an IOU for the specified gateway currency.

Definition at line 92 of file jtx/impl/Account.cpp.

◆ fromCache()

Account xrpl::test::jtx::Account::fromCache ( AcctStringType stringType,
std::string name,
KeyType type )
staticprivate

Definition at line 44 of file jtx/impl/Account.cpp.

Member Data Documentation

◆ kMaster

Account const xrpl::test::Account::kMaster {"masterpassphrase"}
static

The master account.

Definition at line 26 of file jtx/Account.h.

◆ cache

std::unordered_map< std::pair< std::string, KeyType >, Account, beast::Uhash<> > xrpl::test::jtx::Account::cache
staticprivate

Definition at line 112 of file jtx/Account.h.

◆ name_

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

Definition at line 118 of file jtx/Account.h.

◆ pk_

PublicKey xrpl::test::jtx::Account::pk_
private

Definition at line 119 of file jtx/Account.h.

◆ sk_

SecretKey xrpl::test::jtx::Account::sk_
private

Definition at line 120 of file jtx/Account.h.

◆ id_

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

Definition at line 121 of file jtx/Account.h.

◆ human_

std::string xrpl::test::jtx::Account::human_
private

Definition at line 122 of file jtx/Account.h.