rippled
Classes | Public Types | Public Member Functions | Static Public Attributes | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ripple::test::jtx::Account Class Reference

Immutable cryptographic account descriptor. More...

Collaboration diagram for ripple::test::jtx::Account:
Collaboration graph
[legend]

Classes

struct  privateCtorTag
 

Public Types

enum  AcctStringType { base58Seed, other }
 

Public Member Functions

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

Static Public Attributes

static const Account master
 The master account. More...
 

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 37 of file Account.h.

Member Enumeration Documentation

◆ AcctStringType

Enumerator
base58Seed 
other 

Definition at line 76 of file Account.h.

Constructor & Destructor Documentation

◆ Account() [1/7]

ripple::test::jtx::Account::Account ( )
default

◆ Account() [2/7]

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

◆ Account() [3/7]

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

◆ Account() [4/7]

ripple::test::jtx::Account::Account ( std::string  name,
KeyType  type = KeyType::secp256k1 
)

Create an account from a simple string name.

Definition at line 75 of file Account.cpp.

◆ Account() [5/7]

ripple::test::jtx::Account::Account ( char const *  name,
KeyType  type = KeyType::secp256k1 
)

Definition at line 61 of file Account.h.

◆ Account() [6/7]

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

Definition at line 36 of file Account.cpp.

◆ Account() [7/7]

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

Create an account from a base58 seed string.

Throws on invalid seed.

Definition at line 80 of file Account.cpp.

Member Function Documentation

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ name()

std::string const& ripple::test::jtx::Account::name ( ) const

Return the name.

Definition at line 82 of file Account.h.

◆ pk()

PublicKey const& ripple::test::jtx::Account::pk ( ) const

Return the public key.

Definition at line 89 of file Account.h.

◆ sk()

SecretKey const& ripple::test::jtx::Account::sk ( ) const

Return the secret key.

Definition at line 96 of file Account.h.

◆ id()

AccountID ripple::test::jtx::Account::id ( ) const

Returns the Account ID.

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

Definition at line 106 of file Account.h.

◆ human()

std::string const& ripple::test::jtx::Account::human ( ) const

Returns the human readable public key.

Definition at line 113 of file Account.h.

◆ operator AccountID()

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

Implicit conversion to AccountID.

This allows passing an Account where an AccountID is expected.

Definition at line 123 of file Account.h.

◆ operator[]()

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

Returns an IOU for the specified gateway currency.

Definition at line 89 of file Account.cpp.

◆ fromCache()

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

Definition at line 49 of file Account.cpp.

Member Data Documentation

◆ master

const Account ripple::test::jtx::Account::master
static

The master account.

Definition at line 47 of file Account.h.

◆ cache_

std::unordered_map< std::pair< std::string, KeyType >, Account, beast::uhash<> > ripple::test::jtx::Account::cache_
staticprivate

Definition at line 135 of file Account.h.

◆ name_

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

Definition at line 141 of file Account.h.

◆ pk_

PublicKey ripple::test::jtx::Account::pk_
private

Definition at line 142 of file Account.h.

◆ sk_

SecretKey ripple::test::jtx::Account::sk_
private

Definition at line 143 of file Account.h.

◆ id_

AccountID ripple::test::jtx::Account::id_
private

Definition at line 144 of file Account.h.

◆ human_

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

Definition at line 145 of file Account.h.