mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
[wallet] Add GetAssetIDFromString method to get an asset id from either an id or a label string.
This commit is contained in:
parent
3832bd46e0
commit
da36309317
2 changed files with 13 additions and 0 deletions
|
|
@ -4327,6 +4327,13 @@ uint256 CWallet::GetAssetIDFromLabel(const std::string& label) const
|
|||
return uint256();
|
||||
}
|
||||
|
||||
CAssetID CWallet::GetAssetIDFromString(const std::string& asset) const
|
||||
{
|
||||
// TODO: may be worth LOCK(cs_wallet) here and do GetAsset* inline instead
|
||||
CAssetID id(uint256S(asset));
|
||||
return GetAssetLabelFromID(id) == "" ? GetAssetIDFromLabel(asset) : id;
|
||||
}
|
||||
|
||||
CKey CWallet::GetBlindingKey(const CScript* script) const
|
||||
{
|
||||
CKey key;
|
||||
|
|
|
|||
|
|
@ -1012,6 +1012,12 @@ public:
|
|||
std::string GetAssetLabelFromID(const uint256& id) const;
|
||||
/* Returns asset id corresponding to asset label */
|
||||
uint256 GetAssetIDFromLabel(const std::string& label) const;
|
||||
/**
|
||||
* Returns asset id coresponding to the given asset expression, which is either an asset label or a hex value.
|
||||
* @param asset A label string or a hex value corresponding to an asset
|
||||
* @return The asset ID for the given expression
|
||||
*/
|
||||
CAssetID GetAssetIDFromString(const std::string& asset) const;
|
||||
|
||||
//! script == NULL gives the backward compatible blinding key
|
||||
CKey GetBlindingKey(const CScript* script) const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue