Add TxDetail for stellar transactions
This commit is contained in:
@ -121,13 +121,10 @@ func getNewMessages(k Keybase, c chan<- ChatIn, filterString string) {
|
||||
|
||||
// Runner() runs keybase chat api-listen, and passes incoming messages to the message handler func
|
||||
func (k Keybase) Runner(handler func(ChatIn), channelFilters ...Channel) {
|
||||
c := make(chan ChatIn, 10)
|
||||
c := make(chan ChatIn, 50)
|
||||
defer close(c)
|
||||
go getNewMessages(k, c, createFilterString(channelFilters...))
|
||||
for {
|
||||
chat, ok := <-c
|
||||
if ok {
|
||||
go handler(chat)
|
||||
}
|
||||
go handler(<-c)
|
||||
}
|
||||
}
|
||||
|
||||
44
wallet.go
44
wallet.go
@ -8,6 +8,13 @@ import (
|
||||
// ---- Struct for sending to API
|
||||
type walletOut struct {
|
||||
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"`
|
||||
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 {
|
||||
Asset asset `json:"asset"`
|
||||
Amount string `json:"amount"`
|
||||
@ -41,6 +57,24 @@ type WalletResult struct {
|
||||
Balance []balance `json:"balance"`
|
||||
ExchangeRate exchangeRate `json:"exchangeRate"`
|
||||
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)
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user