From 6e94b343defef814c1b82958b8cb45cda806a530 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 26 Jul 2019 14:47:44 -0400 Subject: [PATCH] Update wallet types, and make wallet methods adhere to new structure --- types.go | 6 +++--- wallet.go | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/types.go b/types.go index 2a33e4e..725814c 100644 --- a/types.go +++ b/types.go @@ -256,9 +256,9 @@ type Chat struct { // WalletAPI holds data for sending to API type WalletAPI struct { - Method string `json:"method"` - Params wParams `json:"params"` - Result wResult `json:"result"` + Method string `json:"method,omitempty"` + Params *wParams `json:"params,omitempty"` + Result *wResult `json:"result,omitempty"` } type wOptions struct { Name string `json:"name"` diff --git a/wallet.go b/wallet.go index 6e526a1..6618e18 100644 --- a/wallet.go +++ b/wallet.go @@ -22,18 +22,22 @@ func walletAPIOut(keybasePath string, w WalletAPI) (WalletAPI, error) { } // TxDetail returns details of a stellar transaction -func (k *Keybase) TxDetail(txid string) (wResult, error) { - m := WalletAPI{} +func (k *Keybase) TxDetail(txid string) (WalletAPI, error) { + m := WalletAPI{ + Params: &wParams{}, + } m.Method = "details" m.Params.Options.Txid = txid r, err := walletAPIOut(k.Path, m) - return r.Result, err + return r, err } // StellarAddress returns the primary stellar address of a given user func (k *Keybase) StellarAddress(user string) (string, error) { - m := WalletAPI{} + m := WalletAPI{ + Params: &wParams{}, + } m.Method = "lookup" m.Params.Options.Name = user