|
@@ -147,7 +147,7 @@ func Test_ListUnspent(t *testing.T) {
|
|
|
timestamp := fmt.Sprintf("%v", time.Now().Unix())
|
|
|
t.Logf("post url:%v", geturl)
|
|
|
|
|
|
- postdata := fmt.Sprintf(`{"cointype":"DCR","Sync":false,"address":[],"timestamp":"%v"}`, timestamp)
|
|
|
+ postdata := fmt.Sprintf(`{"cointype":"DCR","Sync":true,"address":["Dsi95trBH3gjLxf6PB3zLvtRXkSixjMFA1F"],"timestamp":"%v"}`, timestamp)
|
|
|
request, err := http.NewRequest("POST", geturl, strings.NewReader(postdata))
|
|
|
if err != nil {
|
|
|
t.Errorf("err:%s", err.Error())
|
|
@@ -202,66 +202,65 @@ func Test_SendRawTransaction(t *testing.T) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-/*
|
|
|
-func Test_SumCoinBalance(t *testing.T) {
|
|
|
- client := http.DefaultClient
|
|
|
- //geturl := fmt.Sprintf(`http://localhost:15741/coinproxy/sumcoinbalance`)
|
|
|
- geturl := fmt.Sprintf(`http://118.31.213.53:8803/coinproxy/sumcoinbalance`)
|
|
|
- t.Logf("post url:%v", geturl)
|
|
|
-
|
|
|
- //var b []byte
|
|
|
- postdata := fmt.Sprintf(`{"cointype":"DCR","sumamount":600}`)
|
|
|
- request, err := http.NewRequest("POST", geturl, strings.NewReader(postdata))
|
|
|
- if err != nil {
|
|
|
- t.Errorf("err:%s", err.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- resp, err := client.Do(request)
|
|
|
- if err != nil {
|
|
|
- t.Errorf("err:%s", err.Error())
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- defer resp.Body.Close()
|
|
|
- rbs, err := ioutil.ReadAll(resp.Body)
|
|
|
- if err != nil {
|
|
|
- t.Errorf("err:%s", err.Error())
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- t.Logf("read bytes:%v", string(rbs))
|
|
|
- return
|
|
|
-}
|
|
|
-*/
|
|
|
-
|
|
|
-func Test_AccountsBalance(t *testing.T) {
|
|
|
- client := http.DefaultClient
|
|
|
- geturl := fmt.Sprintf(`http://localhost:15741/coinproxy/accountsbalance`)
|
|
|
- timetamp := fmt.Sprintf("%v", time.Now().Unix())
|
|
|
-
|
|
|
- t.Logf("post url:%v", geturl)
|
|
|
-
|
|
|
- posdata := fmt.Sprintf(`{"cointype":"DCR","timestamp":"%v"}`, timetamp)
|
|
|
- request, err := http.NewRequest("POST", geturl, strings.NewReader(posdata))
|
|
|
- if err != nil {
|
|
|
- t.Error("err:%s", err.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- resp, err := client.Do(request)
|
|
|
- if err != nil {
|
|
|
- t.Errorf("err:%s", err.Error())
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- defer resp.Body.Close()
|
|
|
- rbs, err := ioutil.ReadAll(resp.Body)
|
|
|
- if err != nil {
|
|
|
- t.Errorf("err:%s", err.Error())
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- t.Logf("read bytes:%v", string(rbs))
|
|
|
-}
|
|
|
+//func Test_SumCoinBalance(t *testing.T) {
|
|
|
+// client := http.DefaultClient
|
|
|
+// //geturl := fmt.Sprintf(`http://localhost:15741/coinproxy/sumcoinbalance`)
|
|
|
+// geturl := fmt.Sprintf(`http://118.31.213.53:8803/coinproxy/sumcoinbalance`)
|
|
|
+// t.Logf("post url:%v", geturl)
|
|
|
+
|
|
|
+// //var b []byte
|
|
|
+// postdata := fmt.Sprintf(`{"cointype":"DCR","sumamount":2000,"minamount":50}`)
|
|
|
+// request, err := http.NewRequest("POST", geturl, strings.NewReader(postdata))
|
|
|
+// if err != nil {
|
|
|
+// t.Errorf("err:%s", err.Error())
|
|
|
+// return
|
|
|
+// }
|
|
|
+// resp, err := client.Do(request)
|
|
|
+// if err != nil {
|
|
|
+// t.Errorf("err:%s", err.Error())
|
|
|
+// return
|
|
|
+// }
|
|
|
+
|
|
|
+// defer resp.Body.Close()
|
|
|
+// rbs, err := ioutil.ReadAll(resp.Body)
|
|
|
+// if err != nil {
|
|
|
+// t.Errorf("err:%s", err.Error())
|
|
|
+// return
|
|
|
+// }
|
|
|
+
|
|
|
+// t.Logf("read bytes:%v", string(rbs))
|
|
|
+// return
|
|
|
+//}
|
|
|
+
|
|
|
+//func Test_AccountsBalance(t *testing.T) {
|
|
|
+// client := http.DefaultClient
|
|
|
+// geturl := fmt.Sprintf(`http://118.31.213.53:8803/coinproxy/accountsbalance`)
|
|
|
+// //geturl := fmt.Sprintf(`http://localhost:15741/coinproxy/accountsbalance`)
|
|
|
+// timetamp := fmt.Sprintf("%v", time.Now().Unix())
|
|
|
+
|
|
|
+// t.Logf("post url:%v", geturl)
|
|
|
+
|
|
|
+// posdata := fmt.Sprintf(`{"cointype":"DCR","timestamp":"%v"}`, timetamp)
|
|
|
+// request, err := http.NewRequest("POST", geturl, strings.NewReader(posdata))
|
|
|
+// if err != nil {
|
|
|
+// t.Error("err:%s", err.Error())
|
|
|
+// return
|
|
|
+// }
|
|
|
+// resp, err := client.Do(request)
|
|
|
+// if err != nil {
|
|
|
+// t.Errorf("err:%s", err.Error())
|
|
|
+// return
|
|
|
+// }
|
|
|
+
|
|
|
+// defer resp.Body.Close()
|
|
|
+// rbs, err := ioutil.ReadAll(resp.Body)
|
|
|
+// if err != nil {
|
|
|
+// t.Errorf("err:%s", err.Error())
|
|
|
+// return
|
|
|
+// }
|
|
|
+
|
|
|
+// t.Logf("read bytes:%v", string(rbs))
|
|
|
+//}
|
|
|
|
|
|
/*
|
|
|
func Test_TransferAccounts(t *testing.T) {
|