align to new SDK v0.42.0
This commit is contained in:
parent
af728f12d9
commit
025c715ab4
3 changed files with 60 additions and 45 deletions
|
@ -408,11 +408,18 @@ func (d *Client) ChannelAbandon(txID string, nOut uint64, accountID *string, blo
|
|||
return response, nil
|
||||
}
|
||||
|
||||
func (d *Client) AddressList(account *string) (*AddressListResponse, error) {
|
||||
func (d *Client) AddressList(account *string, address *string) (*AddressListResponse, error) {
|
||||
response := new(AddressListResponse)
|
||||
return response, d.call(response, "address_list", map[string]interface{}{
|
||||
"account_id": account,
|
||||
})
|
||||
|
||||
args := struct {
|
||||
AccountID *string `json:"account_id,omitempty"`
|
||||
Address *string `json:"address,omitempty"`
|
||||
}{
|
||||
AccountID: account,
|
||||
Address: address,
|
||||
}
|
||||
structs.DefaultTagName = "json"
|
||||
return response, d.call(response, "address_list", structs.Map(args))
|
||||
}
|
||||
|
||||
func (d *Client) ClaimList(account *string, page uint64, pageSize uint64) (*ClaimListResponse, error) {
|
||||
|
|
|
@ -250,7 +250,7 @@ func TestClient_ChannelAbandon(t *testing.T) {
|
|||
|
||||
func TestClient_AddressList(t *testing.T) {
|
||||
d := NewClient("")
|
||||
got, err := d.AddressList(nil)
|
||||
got, err := d.AddressList(nil, nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
|
@ -269,6 +269,17 @@ func TestClient_ClaimList(t *testing.T) {
|
|||
prettyPrint(*got)
|
||||
}
|
||||
|
||||
func TestClient_TransactionList(t *testing.T) {
|
||||
_ = os.Setenv("BLOCKCHAIN_NAME", "lbrycrd_regtest")
|
||||
d := NewClient("")
|
||||
got, err := d.TransactionList(nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
prettyPrint(*got)
|
||||
}
|
||||
|
||||
func TestClient_SupportTest(t *testing.T) {
|
||||
_ = os.Setenv("BLOCKCHAIN_NAME", "lbrycrd_regtest")
|
||||
d := NewClient("")
|
||||
|
|
|
@ -270,7 +270,12 @@ type AccountFundResponse TransactionSummary
|
|||
|
||||
type Address string
|
||||
type AddressUnusedResponse Address
|
||||
type AddressListResponse []Address
|
||||
type AddressListResponse []struct {
|
||||
Account string `json:"account"`
|
||||
Address Address `json:"address"`
|
||||
Pubkey string `json:"pubkey"`
|
||||
UsedTimes uint64 `json:"used_times"`
|
||||
}
|
||||
type ChannelExportResponse string
|
||||
|
||||
type ChannelListResponse struct {
|
||||
|
@ -473,45 +478,37 @@ type UTXOListResponse []struct {
|
|||
|
||||
type UTXOReleaseResponse *string
|
||||
|
||||
type transactionListBlob struct {
|
||||
Address string `json:"address"`
|
||||
Amount string `json:"amount"`
|
||||
BalanceDelta string `json:"balance_delta"`
|
||||
ClaimId string `json:"claim_id"`
|
||||
ClaimName string `json:"claim_name"`
|
||||
Nout int `json:"nout"`
|
||||
}
|
||||
|
||||
//TODO: this repeats all the fields from transactionListBlob which doesn't make sense
|
||||
// but if i extend the type with transactionListBlob it doesn't fill the fields. does our unmarshaller crap out on these?
|
||||
type supportBlob struct {
|
||||
Address string `json:"address"`
|
||||
Amount string `json:"amount"`
|
||||
BalanceDelta string `json:"balance_delta"`
|
||||
ClaimId string `json:"claim_id"`
|
||||
ClaimName string `json:"claim_name"`
|
||||
Nout int `json:"nout"`
|
||||
IsTip bool `json:"is_tip"`
|
||||
}
|
||||
|
||||
type TransactionListResponse []struct {
|
||||
AbandonInfo struct {
|
||||
Address string `json:"address"`
|
||||
Amount string `json:"amount"`
|
||||
BalanceDelta string `json:"balance_delta"`
|
||||
ClaimId string `json:"claim_id"`
|
||||
ClaimName string `json:"claim_name"`
|
||||
Nout int `json:"nout"`
|
||||
} `json:"abandon_info"`
|
||||
ClaimInfo struct {
|
||||
Address string `json:"address"`
|
||||
Amount string `json:"amount"`
|
||||
BalanceDelta string `json:"balance_delta"`
|
||||
ClaimId string `json:"claim_id"`
|
||||
ClaimName string `json:"claim_name"`
|
||||
Nout int `json:"nout"`
|
||||
} `json:"claim_info"`
|
||||
AbandonInfo []transactionListBlob `json:"abandon_info"`
|
||||
ClaimInfo []transactionListBlob `json:"claim_info"`
|
||||
Confirmations int64 `json:"confirmations"`
|
||||
Date string `json:"date"`
|
||||
Fee string `json:"fee"`
|
||||
SupportInfo struct {
|
||||
Address string `json:"address"`
|
||||
Amount string `json:"amount"`
|
||||
BalanceDelta string `json:"balance_delta"`
|
||||
ClaimId string `json:"claim_id"`
|
||||
ClaimName string `json:"claim_name"`
|
||||
IsTip bool `json:"is_tip"`
|
||||
Nout int `json:"nout"`
|
||||
} `json:"support_info"`
|
||||
SupportInfo []supportBlob `json:"support_info"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
Txid string `json:"txid"`
|
||||
UpdateInfo struct {
|
||||
Address string `json:"address"`
|
||||
Amount string `json:"amount"`
|
||||
BalanceDelta string `json:"balance_delta"`
|
||||
ClaimId string `json:"claim_id"`
|
||||
ClaimName string `json:"claim_name"`
|
||||
Nout int `json:"nout"`
|
||||
} `json:"update_info"`
|
||||
UpdateInfo []transactionListBlob `json:"update_info"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue