diff --git a/chatIn.go b/chatIn.go index ba0c460..3b6a1d0 100644 --- a/chatIn.go +++ b/chatIn.go @@ -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) } } diff --git a/wallet.go b/wallet.go index 9a38406..0863b03 100644 --- a/wallet.go +++ b/wallet.go @@ -7,7 +7,14 @@ import ( // ---- Struct for sending to API 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"` 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"` @@ -35,12 +51,30 @@ type exchangeRate struct { Rate string `json:"rate"` } type WalletResult struct { - AccountID string `json:"accountID"` - IsPrimary bool `json:"isPrimary"` - Name string `json:"name"` - Balance []balance `json:"balance"` - ExchangeRate exchangeRate `json:"exchangeRate"` - AccountMode int `json:"accountMode"` + AccountID string `json:"accountID"` + IsPrimary bool `json:"isPrimary"` + Name string `json:"name"` + 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 +}