Add transaction show API to library.
This commit is contained in:
parent
ed51ece75c
commit
3027fb9b98
2 changed files with 21 additions and 0 deletions
|
@ -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")
|
||||
|
|
|
@ -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.")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue