aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.go27
1 files changed, 23 insertions, 4 deletions
diff --git a/main.go b/main.go
index f67c3f3..d70d879 100644
--- a/main.go
+++ b/main.go
@@ -7,12 +7,31 @@ import (
"os"
)
-func main() {
+func sendMoney(from string, to string, amount string) (transaction_id string, err error) {
c := coinbase.ApiKeyClientSandbox(os.Getenv("COINBASE_KEY"), os.Getenv("COINBASE_SECRET"))
- balance, err := c.GetBalance()
+ params := &coinbase.TransactionParams{
+ To: to,
+ Amount: amount,
+ Notes: "You just bought a house",
+ }
+
+ confirmation, err := c.SendMoney(params)
+ if err != nil {
+ return "", err
+ } else {
+ fmt.Println(confirmation.Transaction.Status)
+ fmt.Println(confirmation.Transaction.Id)
+
+ return confirmation.Transaction.Id, nil
+ }
+}
+
+func main() {
+ transaction_id, err := sendMoney("TODO", "n2Qd6da1jiFgij5SSncFKh7MoFN74GdUxv", "0.0001")
if err != nil {
- log.Print(err)
+ log.Println(err)
+ } else {
+ fmt.Println(transaction_id)
}
- fmt.Printf("Balance is %f BTC\n", balance)
}