Skip to content

Commit

Permalink
Pedro/private tx list (#1418)
Browse files Browse the repository at this point in the history
* Adds Private transaction data fetching

* Adds Private transaction data fetching

* Adds Private transaction data fetching

* lint

* working e2e private txs

* lint

* tweaks

* remove unused sql query

* Fix tx to msg conversion

* comment out integration obsscan and obsgateway tests

* Encrypting calls

* go mod tidy

* lint

* fix test
  • Loading branch information
otherview authored Aug 4, 2023
1 parent 06e63f1 commit f491393
Show file tree
Hide file tree
Showing 37 changed files with 1,840 additions and 983 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ tools/obscuroscan/main/main
integration/eth2network/main/main



# Logs files
**/enclave_logs.txt
**/host_logs.txt
Expand All @@ -47,6 +48,7 @@ integration/eth2network/main/main

# Temp env files
testnet/.env
.obscuro/

# Docs build files
docs/_site
Expand Down
3 changes: 3 additions & 0 deletions go/common/enclave.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ type Enclave interface {
type EnclaveScan interface {
// GetTotalContractCount returns the total number of contracts that have been deployed
GetTotalContractCount() (*big.Int, SystemError)

// GetReceiptsByAddress returns a list of receipts given the sender address
GetReceiptsByAddress(encryptedParams EncryptedParamsGetStorageAt) (*responses.Receipts, SystemError)
}

// BlockSubmissionResponse is the response sent from the enclave back to the node after ingesting a block
Expand Down
22 changes: 22 additions & 0 deletions go/common/httputil/httputil.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"fmt"
"io"
"net/http"

"github.com/valyala/fasthttp"
)

const (
Expand Down Expand Up @@ -75,3 +77,23 @@ func EnableCORS(resp http.ResponseWriter, req *http.Request) bool {
}
return false
}

// PostDataJSON sends a JSON payload to the given URL and returns the status, response body, and any error encountered.
func PostDataJSON(url string, data []byte) (int, []byte, error) {
req := fasthttp.AcquireRequest()
defer fasthttp.ReleaseRequest(req)

req.SetRequestURI(url)
req.Header.SetMethod("POST")
req.Header.SetContentType("application/json")
req.SetBody(data)

resp := fasthttp.AcquireResponse()
defer fasthttp.ReleaseResponse(resp)

if err := fasthttp.Do(req, resp); err != nil {
return 0, nil, fmt.Errorf("error while sending request: %w", err)
}

return resp.StatusCode(), resp.Body(), nil
}
Loading

0 comments on commit f491393

Please sign in to comment.