|
|
@ -25,26 +25,26 @@ func walletAPIOut(k *Keybase, w WalletAPI) (WalletAPI, error) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// TxDetail returns details of a stellar transaction
|
|
|
|
// TxDetail returns details of a stellar transaction
|
|
|
|
func (k *Keybase) TxDetail(txid string) (WalletAPI, error) { |
|
|
|
func (w Wallet) TxDetail(txid string) (WalletAPI, error) { |
|
|
|
m := WalletAPI{ |
|
|
|
m := WalletAPI{ |
|
|
|
Params: &wParams{}, |
|
|
|
Params: &wParams{}, |
|
|
|
} |
|
|
|
} |
|
|
|
m.Method = "details" |
|
|
|
m.Method = "details" |
|
|
|
m.Params.Options.Txid = txid |
|
|
|
m.Params.Options.Txid = txid |
|
|
|
|
|
|
|
|
|
|
|
r, err := walletAPIOut(k, m) |
|
|
|
r, err := walletAPIOut(w.keybase, m) |
|
|
|
return r, 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 (w Wallet) StellarAddress(user string) (string, error) { |
|
|
|
m := WalletAPI{ |
|
|
|
m := WalletAPI{ |
|
|
|
Params: &wParams{}, |
|
|
|
Params: &wParams{}, |
|
|
|
} |
|
|
|
} |
|
|
|
m.Method = "lookup" |
|
|
|
m.Method = "lookup" |
|
|
|
m.Params.Options.Name = user |
|
|
|
m.Params.Options.Name = user |
|
|
|
|
|
|
|
|
|
|
|
r, err := walletAPIOut(k, m) |
|
|
|
r, err := walletAPIOut(w.keybase, m) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return "", err |
|
|
|
return "", err |
|
|
|
} |
|
|
|
} |
|
|
@ -52,7 +52,8 @@ func (k *Keybase) StellarAddress(user string) (string, error) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// RequestPayment sends a request for payment to a user
|
|
|
|
// RequestPayment sends a request for payment to a user
|
|
|
|
func (k *Keybase) RequestPayment(user string, amount float64, memo ...string) error { |
|
|
|
func (w Wallet) RequestPayment(user string, amount float64, memo ...string) error { |
|
|
|
|
|
|
|
k := w.keybase |
|
|
|
if len(memo) > 0 { |
|
|
|
if len(memo) > 0 { |
|
|
|
_, err := k.Exec("wallet", "request", user, fmt.Sprintf("%f", amount), "-m", memo[0]) |
|
|
|
_, err := k.Exec("wallet", "request", user, fmt.Sprintf("%f", amount), "-m", memo[0]) |
|
|
|
return err |
|
|
|
return err |
|
|
@ -62,7 +63,8 @@ func (k *Keybase) RequestPayment(user string, amount float64, memo ...string) er |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// CancelRequest cancels a request for payment previously sent to a user
|
|
|
|
// CancelRequest cancels a request for payment previously sent to a user
|
|
|
|
func (k *Keybase) CancelRequest(requestID string) error { |
|
|
|
func (w Wallet) CancelRequest(requestID string) error { |
|
|
|
|
|
|
|
k := w.keybase |
|
|
|
_, err := k.Exec("wallet", "cancel-request", requestID) |
|
|
|
_, err := k.Exec("wallet", "cancel-request", requestID) |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|