|
|
@ -7,7 +7,14 @@ import ( |
|
|
|
|
|
|
|
|
|
|
|
// ---- Struct for sending to API
|
|
|
|
// ---- Struct for sending to API
|
|
|
|
type walletOut struct { |
|
|
|
type walletOut struct { |
|
|
|
Method string `json:"method"` |
|
|
|
Method string `json:"method"` |
|
|
|
|
|
|
|
Params walletOutParams `json:"params"` |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
type walletOutOptions struct { |
|
|
|
|
|
|
|
Txid string `json:"txid"` |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
type walletOutParams struct { |
|
|
|
|
|
|
|
Options walletOutOptions `json:"options"` |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ----
|
|
|
|
// ----
|
|
|
@ -25,6 +32,15 @@ type asset struct { |
|
|
|
Desc string `json:"desc"` |
|
|
|
Desc string `json:"desc"` |
|
|
|
InfoURL string `json:"infoUrl"` |
|
|
|
InfoURL string `json:"infoUrl"` |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
type sourceAsset struct { |
|
|
|
|
|
|
|
Type string `json:"type"` |
|
|
|
|
|
|
|
Code string `json:"code"` |
|
|
|
|
|
|
|
Issuer string `json:"issuer"` |
|
|
|
|
|
|
|
VerifiedDomain string `json:"verifiedDomain"` |
|
|
|
|
|
|
|
IssuerName string `json:"issuerName"` |
|
|
|
|
|
|
|
Desc string `json:"desc"` |
|
|
|
|
|
|
|
InfoURL string `json:"infoUrl"` |
|
|
|
|
|
|
|
} |
|
|
|
type balance struct { |
|
|
|
type balance struct { |
|
|
|
Asset asset `json:"asset"` |
|
|
|
Asset asset `json:"asset"` |
|
|
|
Amount string `json:"amount"` |
|
|
|
Amount string `json:"amount"` |
|
|
@ -35,12 +51,30 @@ type exchangeRate struct { |
|
|
|
Rate string `json:"rate"` |
|
|
|
Rate string `json:"rate"` |
|
|
|
} |
|
|
|
} |
|
|
|
type WalletResult struct { |
|
|
|
type WalletResult struct { |
|
|
|
AccountID string `json:"accountID"` |
|
|
|
AccountID string `json:"accountID"` |
|
|
|
IsPrimary bool `json:"isPrimary"` |
|
|
|
IsPrimary bool `json:"isPrimary"` |
|
|
|
Name string `json:"name"` |
|
|
|
Name string `json:"name"` |
|
|
|
Balance []balance `json:"balance"` |
|
|
|
Balance []balance `json:"balance"` |
|
|
|
ExchangeRate exchangeRate `json:"exchangeRate"` |
|
|
|
ExchangeRate exchangeRate `json:"exchangeRate"` |
|
|
|
AccountMode int `json:"accountMode"` |
|
|
|
AccountMode int `json:"accountMode"` |
|
|
|
|
|
|
|
TxID string `json:"txID"` |
|
|
|
|
|
|
|
Time int64 `json:"time"` |
|
|
|
|
|
|
|
Status string `json:"status"` |
|
|
|
|
|
|
|
StatusDetail string `json:"statusDetail"` |
|
|
|
|
|
|
|
Amount string `json:"amount"` |
|
|
|
|
|
|
|
Asset asset `json:"asset"` |
|
|
|
|
|
|
|
DisplayAmount string `json:"displayAmount"` |
|
|
|
|
|
|
|
DisplayCurrency string `json:"displayCurrency"` |
|
|
|
|
|
|
|
SourceAmountMax string `json:"sourceAmountMax"` |
|
|
|
|
|
|
|
SourceAmountActual string `json:"sourceAmountActual"` |
|
|
|
|
|
|
|
SourceAsset sourceAsset `json:"sourceAsset"` |
|
|
|
|
|
|
|
FromStellar string `json:"fromStellar"` |
|
|
|
|
|
|
|
ToStellar string `json:"toStellar"` |
|
|
|
|
|
|
|
FromUsername string `json:"fromUsername"` |
|
|
|
|
|
|
|
ToUsername string `json:"toUsername"` |
|
|
|
|
|
|
|
Note string `json:"note"` |
|
|
|
|
|
|
|
NoteErr string `json:"noteErr"` |
|
|
|
|
|
|
|
Unread bool `json:"unread"` |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ----
|
|
|
|
// ----
|
|
|
@ -69,3 +103,13 @@ func (k Keybase) Balances() ([]WalletResult, error) { |
|
|
|
r, err := walletAPIOut(k.Path, m) |
|
|
|
r, err := walletAPIOut(k.Path, m) |
|
|
|
return r.Result, err |
|
|
|
return r.Result, err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TxDetail() returns details of a stellar transaction
|
|
|
|
|
|
|
|
func (k Keybase) TxDetail(txid string) (WalletResult, error) { |
|
|
|
|
|
|
|
m := walletOut{} |
|
|
|
|
|
|
|
m.Method = "details" |
|
|
|
|
|
|
|
m.Params.Options.Txid = txid |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
r, err := walletAPIOut(k.Path, m) |
|
|
|
|
|
|
|
return r.Result[0], err |
|
|
|
|
|
|
|
} |
|
|
|