|
@@ -46,7 +46,8 @@ import (
|
|
|
|
|
|
func Test_Balance(t *testing.T) {
|
|
|
client := http.DefaultClient
|
|
|
- geturl := fmt.Sprintf(`http://localhost:15741/coinproxy/coinbalance`)
|
|
|
+ geturl := fmt.Sprintf(`http://118.31.213.53:8803/coinproxy/coinbalance`)
|
|
|
+ //geturl := fmt.Sprintf(`http://localhost:15741/coinproxy/coinbalance`)
|
|
|
timestamp := fmt.Sprintf("%v", time.Now().Unix())
|
|
|
t.Logf("post url:%v", geturl)
|
|
|
|
|
@@ -79,7 +80,7 @@ func Test_Balance(t *testing.T) {
|
|
|
//first get block height then test transinfo
|
|
|
|
|
|
client := http.DefaultClient
|
|
|
- geturl := fmt.Sprintf(`http://localhost:15741/coinproxy/query/transinfo`)
|
|
|
+ geturl := fmt.Sprintf(`http://118.31.213.53:8803/coinproxy/query/transinfo`)
|
|
|
timestamp := fmt.Sprintf("%v", time.Now().Unix())
|
|
|
t.Logf("post url:%v", geturl)
|
|
|
|
|
@@ -109,6 +110,7 @@ func Test_Balance(t *testing.T) {
|
|
|
|
|
|
func Test_ChainHeight(t *testing.T) {
|
|
|
client := http.DefaultClient
|
|
|
+ //geturl := fmt.Sprintf(`http://118.31.213.53:8803/coinproxy/blockchain/height`)
|
|
|
geturl := fmt.Sprintf(`http://localhost:15741/coinproxy/blockchain/height`)
|
|
|
timestamp := fmt.Sprintf("%v", time.Now().Unix())
|
|
|
t.Logf("post url:%v", geturl)
|
|
@@ -138,9 +140,10 @@ func Test_ChainHeight(t *testing.T) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func Test_ListUnspent(t *testing.T) {
|
|
|
+/*func Test_ListUnspent(t *testing.T) {
|
|
|
client := http.DefaultClient
|
|
|
- geturl := fmt.Sprintf(`http://localhost:15741/coinproxy/listunspent`)
|
|
|
+ geturl := fmt.Sprintf(`http://118.31.213.53:8803/coinproxy/listunspent`)
|
|
|
+ //geturl := fmt.Sprintf(`http://localhost:15741/coinproxy/listunspent`)
|
|
|
timestamp := fmt.Sprintf("%v", time.Now().Unix())
|
|
|
t.Logf("post url:%v", geturl)
|
|
|
|
|
@@ -167,10 +170,11 @@ func Test_ListUnspent(t *testing.T) {
|
|
|
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+*/
|
|
|
func Test_SendRawTransaction(t *testing.T) {
|
|
|
client := http.DefaultClient
|
|
|
geturl := fmt.Sprintf(`http://localhost:15741/coinproxy/sendrawtransaction`)
|
|
|
+ //geturl := fmt.Sprintf(`http://118.31.213.53:8803/coinproxy/sendrawtransaction`)
|
|
|
t.Logf("post url:%v", geturl)
|
|
|
|
|
|
//var b []byte
|
|
@@ -198,13 +202,15 @@ 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://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":5.0}`)
|
|
|
+ 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())
|
|
@@ -226,15 +232,17 @@ func Test_SumCoinBalance(t *testing.T) {
|
|
|
t.Logf("read bytes:%v", string(rbs))
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
-/*func Test_TransferAccounts(t *testing.T) {
|
|
|
+*/
|
|
|
+/*
|
|
|
+func Test_TransferAccounts(t *testing.T) {
|
|
|
client := http.DefaultClient
|
|
|
- geturl := fmt.Sprintf(`http://localhost:15741/coinproxy/sendcoins`)
|
|
|
+ //geturl := fmt.Sprintf(`http://localhost:15741/coinproxy/sendcoins`)
|
|
|
+ geturl := fmt.Sprintf(`http://118.31.213.53:8803/coinproxy/sendcoins`)
|
|
|
timestamp := fmt.Sprintf("%v", time.Now().Unix())
|
|
|
t.Logf("post url:%v", geturl)
|
|
|
|
|
|
//var b []byte
|
|
|
- postdata := fmt.Sprintf(`{"cointype":"DCR","amount":"0.002747","address":"DsgbyoXAB2PdsiU3yDpCtBww7FcxhTAV2Vr","timestamp":"%v","signature":"%v"}`, timestamp, Signature([]byte("/coinproxy/sendcoins"), timestamp))
|
|
|
+ postdata := fmt.Sprintf(`{"cointype":"DCR","amount":"0.02","address":"DsctbrcDVEF4g4gqTpRF8ciZMqwe4va32uK","timestamp":"%v","signature":"%v"}`, timestamp, Signature([]byte("/coinproxy/sendcoins"), timestamp))
|
|
|
request, err := http.NewRequest("POST", geturl, strings.NewReader(postdata))
|
|
|
if err != nil {
|
|
|
t.Errorf("err:%s", err.Error())
|