Commit 22230e08 authored by gshx's avatar gshx

Merge branch 'heco-testnet' of https://code.wuban.net.cn/liwei/multisend into heco-testnet

parents ca527f36 0c6ea0bb
...@@ -142,7 +142,7 @@ func (web *WebServicer) ParamHandler(w http.ResponseWriter, r *http.Request) { ...@@ -142,7 +142,7 @@ func (web *WebServicer) ParamHandler(w http.ResponseWriter, r *http.Request) {
resp.MaxTxCount = MaxTxCount resp.MaxTxCount = MaxTxCount
resp.MaxRequestAmount = MaxRequestAmount resp.MaxRequestAmount = MaxRequestAmount
for i := 0; i <= 1000; i++ { for i := 1; i <= 1001; i++ {
path := hdwallet.MustParseDerivationPath(fmt.Sprintf("m/44'/60'/0'/0/%d", i)) path := hdwallet.MustParseDerivationPath(fmt.Sprintf("m/44'/60'/0'/0/%d", i))
account, err := wallet.Derive(path, false) account, err := wallet.Derive(path, false)
...@@ -151,7 +151,7 @@ func (web *WebServicer) ParamHandler(w http.ResponseWriter, r *http.Request) { ...@@ -151,7 +151,7 @@ func (web *WebServicer) ParamHandler(w http.ResponseWriter, r *http.Request) {
return return
} }
if i == 0 { if i == 1 {
resp.From = account.Address.Hex() resp.From = account.Address.Hex()
continue continue
} }
...@@ -310,31 +310,6 @@ func (web *WebServicer) Calculate(w http.ResponseWriter, r *http.Request) { ...@@ -310,31 +310,6 @@ func (web *WebServicer) Calculate(w http.ResponseWriter, r *http.Request) {
everyTxAmountAsStr := r.URL.Query().Get("everyTxAmount") everyTxAmountAsStr := r.URL.Query().Get("everyTxAmount")
txNumStr := r.URL.Query().Get("txNum") txNumStr := r.URL.Query().Get("txNum")
requestAmountAsInt, err := strconv.ParseInt(requestAmountAsStr, 10, 64)
// if err != nil {
// http.Error(w, err.Error(), http.StatusBadRequest)
// return
// }
// currentAmount, err := strconv.ParseInt(currentAmountStr, 10, 64) // strconv.Atoi(currentAmountStr)
// if err != nil {
// http.Error(w, err.Error(), http.StatusBadRequest)
// return
// }
// everyTxAmountAsInt, err := strconv.ParseInt(everyTxAmountAsStr, 10, 64) // strconv.Atoi(everyTxAmountAsStr)
// if err != nil {
// http.Error(w, err.Error(), http.StatusBadRequest)
// return
// }
// txNum, err := strconv.ParseInt(txNumStr, 10, 64) //strconv.Atoi(txNumStr)
// if err != nil {
// http.Error(w, err.Error(), http.StatusBadRequest)
// return
// }
requestAmount, err := decimal.NewFromString(requestAmountAsStr) requestAmount, err := decimal.NewFromString(requestAmountAsStr)
if err != nil { if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest) http.Error(w, err.Error(), http.StatusBadRequest)
...@@ -361,11 +336,16 @@ func (web *WebServicer) Calculate(w http.ResponseWriter, r *http.Request) { ...@@ -361,11 +336,16 @@ func (web *WebServicer) Calculate(w http.ResponseWriter, r *http.Request) {
res := requestAmount.Add(currentAmount).Sub(everyTxAmount.Mul(txNum)) res := requestAmount.Add(currentAmount).Sub(everyTxAmount.Mul(txNum))
fmt.Printf("len(resAsJson): %v \n", res.String()) resAsJson, err := json.Marshal(res)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
w.Write([]byte(res.String())) w.Write(resAsJson)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment