Add transaction show API to library.

This commit is contained in:
Mark Beamer Jr 2021-04-15 16:03:45 -04:00
parent ed51ece75c
commit 3027fb9b98
No known key found for this signature in database
GPG key ID: 1C314FB89AD76973
2 changed files with 21 additions and 0 deletions

View file

@ -220,6 +220,13 @@ func (d *Client) AddressUnused(account *string) (*AddressUnusedResponse, error)
})
}
func (d *Client) TransactionShow(txid string) (*TransactionSummary, error) {
response := new(TransactionSummary)
return response, d.call(response, "transaction_show", map[string]interface{}{
"txid": txid,
})
}
func (d *Client) ChannelList(account *string, page uint64, pageSize uint64, wid *string) (*ChannelListResponse, error) {
if page == 0 {
return nil, errors.Err("pages start from 1")

View file

@ -791,3 +791,17 @@ func TestClient_WalletRemoveWalletAdd(t *testing.T) {
t.Fatalf("wallet ID mismatch, expected %q, got %q", wallet.ID, addedWallet.Name)
}
}
func TestClient_TransactionSummary(t *testing.T) {
d := NewClient("")
r, err := d.TransactionShow("d104a1616c6af581e2046819de678f370d624e97cf176f95acaec4b183a42db6")
if err != nil {
t.Error(err)
}
if len(r.Outputs) != 2 {
t.Fatal("found wrong transaction")
}
if r.Outputs[0].Amount != "5.0" {
t.Error("found wrong lbc amount for transaction.")
}
}