Since this feature is used by more users recently it would be great to access it in Horizon. Seems to be very easy to implement.
Desired change to the JSON. Add a new array that is present if there are any unauthorized trustlines:
...,
"balances": [
{
"balance": "10.0000000",
"limit": "922337203685.4775807",
"asset_type": "credit_alphanum12",
"asset_code": "DUBUNDA",
"asset_issuer": "GCGTJPNBL7TNUO647AWQFEEL2PHK4BJ56RZCT77H2R6AHPCUC7CCHHGV"
},
{
"balance": "9999.9999900",
"asset_type": "native"
}
],
"unauthorized_balances":[
{
"balance": "0.0000000",
"limit": "922337203685.4775807",
"asset_type": "credit_alphanum4",
"asset_code": "USD",
"asset_issuer": "GCGTJPNBL7TNUO647AWQFEEL2PHK4BJ56RZCT77H2R6AHPCUC7CCHHGV"
},
],
...
@bartekn,
can I take it?
I see Jed added "help wanted" tag so I think you can give it a try :). Let me know if you need any help.
@r8d8 I am going to sync my own horizon instance with the testnet in order to look at the trustlines table content, from the code there is no feeling that only authorized trustlines show up:
var selectTrustline = sq.Select(
"tl.accountid",
"tl.assettype",
"tl.issuer",
"tl.assetcode",
"tl.tlimit",
"tl.balance",
"tl.flags",
).From("trustlines tl")
then
// populate balances
this.Balances = make([]Balance, len(ct)+1)
for i, tl := range ct {
err = this.Balances[i].Populate(ctx, tl)
if err != nil {
return
}
}
@bartekn,
can you please specify how this authorization state should be presented.
If I got it right, here is request to db that returns info for account, and then API callback for account info
Related to stellar/horizon#298
@r8d8 Thanks, haven't noticed this. Let's track it in https://github.com/stellar/horizon/issues/298
other way. let's close the other issue and track this here.
@nullstyle In the returned JSON from /accounts, would you be ok with another array called "unauthorized_balances" or something that lists the trustlines that still need go be auth'd by the issuer? It seemed like originally you wanted a separate endpoint to get the unauthorized trustlines of an account but maybe just clearly separating them out would be enough?