Update wallet types, and make wallet methods adhere to new structure
This commit is contained in:
6
types.go
6
types.go
@ -256,9 +256,9 @@ type Chat struct {
|
|||||||
|
|
||||||
// WalletAPI holds data for sending to API
|
// WalletAPI holds data for sending to API
|
||||||
type WalletAPI struct {
|
type WalletAPI struct {
|
||||||
Method string `json:"method"`
|
Method string `json:"method,omitempty"`
|
||||||
Params wParams `json:"params"`
|
Params *wParams `json:"params,omitempty"`
|
||||||
Result wResult `json:"result"`
|
Result *wResult `json:"result,omitempty"`
|
||||||
}
|
}
|
||||||
type wOptions struct {
|
type wOptions struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
|||||||
12
wallet.go
12
wallet.go
@ -22,18 +22,22 @@ func walletAPIOut(keybasePath string, w WalletAPI) (WalletAPI, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TxDetail returns details of a stellar transaction
|
// TxDetail returns details of a stellar transaction
|
||||||
func (k *Keybase) TxDetail(txid string) (wResult, error) {
|
func (k *Keybase) TxDetail(txid string) (WalletAPI, error) {
|
||||||
m := WalletAPI{}
|
m := WalletAPI{
|
||||||
|
Params: &wParams{},
|
||||||
|
}
|
||||||
m.Method = "details"
|
m.Method = "details"
|
||||||
m.Params.Options.Txid = txid
|
m.Params.Options.Txid = txid
|
||||||
|
|
||||||
r, err := walletAPIOut(k.Path, m)
|
r, err := walletAPIOut(k.Path, m)
|
||||||
return r.Result, err
|
return r, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// StellarAddress returns the primary stellar address of a given user
|
// StellarAddress returns the primary stellar address of a given user
|
||||||
func (k *Keybase) StellarAddress(user string) (string, error) {
|
func (k *Keybase) StellarAddress(user string) (string, error) {
|
||||||
m := WalletAPI{}
|
m := WalletAPI{
|
||||||
|
Params: &wParams{},
|
||||||
|
}
|
||||||
m.Method = "lookup"
|
m.Method = "lookup"
|
||||||
m.Params.Options.Name = user
|
m.Params.Options.Name = user
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user