Skip to content

Commit

Permalink
fix: change api for tron estimateenergy
Browse files Browse the repository at this point in the history
  • Loading branch information
sunhongtao committed Jan 15, 2024
1 parent 0120158 commit df80815
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion blockchain/service/http_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ func (h *HttpHandler) EstimateGasForTron(ctx *gin.Context) {
return
}

energy := root.Get("energy_required").Int()
energy := root.Get("energy_used").Int()

h.Success(ctx, string(b), energy, ctx.Request.RequestURI)
}
Expand Down
2 changes: 1 addition & 1 deletion blockchain/service/tron/tron.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func (t *Tron) EstimateGasForTron(chainCode int64, from, to, functionSelector, p
"visible": true
}`
req = fmt.Sprintf(req, from, to, functionSelector, parameter)
res, err := t.SendReq(chainCode, req, "wallet/estimateenergy")
res, err := t.SendReq(chainCode, req, "wallet/triggerconstantcontract")
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/blockchain/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

func main() {
var configPath string
flag.StringVar(&configPath, "blockchain", "./cmd/blockchain/config_ether.json", "The system file of config")
flag.StringVar(&configPath, "blockchain", "./cmd/blockchain/config_tron.json", "The system file of config")
flag.Parse()
if len(configPath) < 1 {
panic("can not find config file")
Expand Down
4 changes: 2 additions & 2 deletions cmd/blockchain/config_tron.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
},
"Nodes": [
{
"BlockChain": 205,
"NodeUrl": "http://3.225.171.164:8090",
"BlockChain": 198,
"NodeUrl": "https://api.shasta.trongrid.io",
"NodeToken": ""
}
]
Expand Down

0 comments on commit df80815

Please sign in to comment.