mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Tie the STAccount class to the NewcoinAddress code.
This commit is contained in:
@@ -350,6 +350,17 @@ uint256 STObject::getValueFieldH256(SOE_Field field) const
|
||||
return cf->getValue();
|
||||
}
|
||||
|
||||
NewcoinAddress STObject::getValueFieldAccount(SOE_Field field) const
|
||||
{
|
||||
const SerializedType* rf = peekAtPField(field);
|
||||
if (!rf) throw std::runtime_error("Field not found");
|
||||
SerializedTypeID id = rf->getSType();
|
||||
if (id == STI_OBJECT) return NewcoinAddress(); // optional field not present
|
||||
const STAccount* cf = dynamic_cast<const STAccount *>(rf);
|
||||
if (!cf) throw std::runtime_error("Wrong field type");
|
||||
return cf->getValueNCA();
|
||||
}
|
||||
|
||||
std::vector<unsigned char> STObject::getValueFieldVL(SOE_Field field) const
|
||||
{
|
||||
const SerializedType* rf = peekAtPField(field);
|
||||
|
||||
@@ -102,6 +102,7 @@ public:
|
||||
uint64 getValueFieldU64(SOE_Field field) const;
|
||||
uint160 getValueFieldH160(SOE_Field field) const;
|
||||
uint256 getValueFieldH256(SOE_Field field) const;
|
||||
NewcoinAddress getValueFieldAccount(SOE_Field field) const;
|
||||
std::vector<unsigned char> getValueFieldVL(SOE_Field field) const;
|
||||
std::vector<TaggedListItem> getValueFieldTL(SOE_Field field) const;
|
||||
|
||||
@@ -114,6 +115,8 @@ public:
|
||||
void setValueFieldVL(SOE_Field field, const std::vector<unsigned char>&);
|
||||
void setValueFieldTL(SOE_Field field, const std::vector<TaggedListItem>&);
|
||||
void setValueFieldAccount(SOE_Field field, const uint160&);
|
||||
void setValueFieldAccount(SOE_Field field, const NewcoinAddress& addr)
|
||||
{ setValueFieldAccount(field, addr.getAccountID()); }
|
||||
|
||||
bool isFieldPresent(SOE_Field field) const;
|
||||
void makeFieldPresent(SOE_Field field);
|
||||
|
||||
Reference in New Issue
Block a user