Closed thr0wn closed 3 years ago
I like the design, just some comments and suggestions:
token
) for the token UID and in the lib as well.HathorWallet
new methods of having an options
parameter for the optional ones. Then the method signature would be getAddressInfo(address, options = {})
, where options
could have include_utxos
and token
.script_pub_key
and is_script
and their usage?What do you think?
Thanks for your suggestions.
script_pub_key
and is_script
, but I am not 100% sure of their usage. I've only documented it here because yiimp
has references to those fields. But I will investigate more and post any updates on it.For me it's approved.
@pedroferreira1
{
// Base64 encoded locking script (Currently only P2PKH or P2SH)
// Same script as the outputs received by this address or empty ""
"script_pub_key": string,
// True if the script_pub_key is not empty
"is_script": boolean,
// pubkeyhash or scripthash, otherwise unknown
"script_type" : string,
}
Note that script_pub_key
will be identical to the scripts of its funds (received outputs).
@thr0wn Here are my comments:
1) GetAddressInfoReturn
should include which token it is related to.
2) GetAddressInfoReturn
should limit the number of utxos to a maximum (or maybe just never include it and let the UTXO Consolidation API handle the utxos).
3) GetAddressInfoReturn
should not send the pubKey because it is a sensitive information. We might allow the user to request the pubKey but I'm not sure about it. Why would we do it?
Thanks for your comments @msbrogli.
utxo consolidation api
handling utxos. Added a note about it.@thr0wn What note? I feel we should just remove the utxos
at all. They are not useful here, aren't they?
@msbrogli, I misunderstood point 2, sorry. utxos
removed.
Approved.
Motivation
An API to get information about a specific address is helpful for a variety of use cases. Some of them are:
Solution
hathor-wallet-lib
A new method called
getAddressInfo
must be created onHathorWallet
to return theaddress information
. It is important to note that to calculatetotal_amount_received
,total_amount_sent
,total_amount_available
andtotal_amount_locked
will be necessary to iterate through the transaction history.HathorWallet.getAddressInfo
interface:HathorWallet.getAddressInfo
should throw an error to the following cases:address
parameter does not belong tohathor-wallet-headless
address
parameter is an invalid Hathor addressGET
/wallet/address-info
(hathor-wallet-headless)Endpoint
/wallet/address-info
Response Success: Same as
GetAddressInfoReturn
above.Error when the address does not belong to
hathor-wallet-headless
:Error when the address is invalid:
Tasks
getAddressInfo
onHathorWallet
/wallet/address-info
.Estimated time
3 days