rippled
Loading...
Searching...
No Matches
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...

#include <Account.h>

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

Classes

struct  privateCtorTag
 

Public Types

enum  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 master
 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 19 of file Account.h.

Member Enumeration Documentation

◆ AcctStringType

Enumerator
base58Seed 
other 

Definition at line 62 of file Account.h.

Constructor & Destructor Documentation

◆ Account() [1/8]

ripple::test::jtx::Account::Account ( )
delete

◆ Account() [2/8]

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

◆ Account() [3/8]

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

◆ Account() [4/8]

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

Create an account from a simple string name.

Definition at line 57 of file Account.cpp.

◆ Account() [5/8]

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

Definition at line 43 of file Account.h.

◆ Account() [6/8]

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

Definition at line 18 of file Account.cpp.

◆ Account() [7/8]

ripple::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 70 of file Account.cpp.

◆ Account() [8/8]

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

◆ pk()

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

Return the public key.

Definition at line 75 of file Account.h.

◆ sk()

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

Return the secret key.

Definition at line 82 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 92 of file Account.h.

◆ human()

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

Returns the human readable public key.

Definition at line 99 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 109 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 79 of file Account.cpp.

◆ fromCache()

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

Definition at line 31 of file Account.cpp.

Member Data Documentation

◆ master

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

The master account.

Definition at line 29 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 121 of file Account.h.

◆ name_

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

Definition at line 127 of file Account.h.

◆ pk_

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

Definition at line 128 of file Account.h.

◆ sk_

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

Definition at line 129 of file Account.h.

◆ id_

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

Definition at line 130 of file Account.h.

◆ human_

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

Definition at line 131 of file Account.h.