integration test: get block, tx, receipt, filter logs, code at

This commit is contained in:
ramil
2021-04-19 11:32:36 +03:00
parent 141b3eaffe
commit 3c57fa1064
14 changed files with 879 additions and 80 deletions
+31
View File
@@ -0,0 +1,31 @@
package integration
import (
"encoding/json"
"net/http"
)
type ContractDeployed struct {
Address string
TransactionHash string
BlockNumber int
BlockHash string
}
func DeployContract() (*ContractDeployed, error) {
res, err := http.Get("http://localhost:3000/v1/deployContract")
if err != nil {
return nil, err
}
defer res.Body.Close()
var contract ContractDeployed
decoder := json.NewDecoder(res.Body)
err = decoder.Decode(&contract)
if err != nil {
return nil, err
}
return &contract, nil
}