Documentation
¶
Overview ¶
Whitelist for smart contract functions that never need protection.
OFAC banned addresses ¶
Request represents an incoming client request
Index ¶
- Variables
- func GetIP(r *http.Request) string
- func GetSenderFromRawTx(tx *types.Transaction) (string, error)
- func GetSenderFromTx(tx *types.Transaction) (string, error)
- func GetTx(rawTxHex string) (*types.Transaction, error)
- func IsBlacklisted(ip string) bool
- func IsMetamask(r *http.Request) bool
- func IsMetamaskMoz(r *http.Request) bool
- func NewNonceFix(txHash string) *nonceFix
- func ProxyRequest(proxyUrl string, body []byte) (*http.Response, error)
- func ShouldSendTxToRelay(txHash string) bool
- func TruncateText(s string, max int) string
- type GetBundleStatusByTransactionHashResponse
- type GlobalState
- type HealthResponse
- type JsonRpcError
- type JsonRpcRequest
- type JsonRpcResponse
- func NewJsonRpcResponse(id interface{}, result json.RawMessage) *JsonRpcResponse
- func SendRpcAndParseResponseTo(url string, req *JsonRpcRequest) (*JsonRpcResponse, error)
- func SendRpcWithSignatureAndParseResponse(url string, privKey *ecdsa.PrivateKey, jsonRpcReq *JsonRpcRequest) (jsonRpcResponse *JsonRpcResponse, responseBytes *[]byte, err error)
- type PrivateTxApiResponse
- type RelayErrorResponse
- type RpcEndPointServer
- type RpcRequest
- type StringWithTime
Constants ¶
This section is empty.
Variables ¶
View Source
var DebugDontSendTx = os.Getenv("DEBUG_DONT_SEND_RAWTX") != ""
View Source
var Now = time.Now // used to mock time in tests
View Source
var ProtectTxApiHost = "https://protect.flashbots.net"
View Source
var State = NewGlobalState()
Metamask fix helper
Functions ¶
func GetSenderFromRawTx ¶
func GetSenderFromRawTx(tx *types.Transaction) (string, error)
func GetSenderFromTx ¶
func GetSenderFromTx(tx *types.Transaction) (string, error)
func IsBlacklisted ¶
func NewNonceFix ¶ added in v1.3.0
func NewNonceFix(txHash string) *nonceFix
func ShouldSendTxToRelay ¶ added in v1.3.0
func TruncateText ¶
Types ¶
type GetBundleStatusByTransactionHashResponse ¶
type GetBundleStatusByTransactionHashResponse struct {
TxHash string `json:"txHash"` // "0x0aeb9c61b342f7fc94a10d41c5d30a049a9cfa9ab764c6dd02204a19960ee567"
Status string `json:"status"` // "FAILED_BUNDLE"
Message string `json:"message"` // "Expired - The base fee was to low to execute this transaction, please try again"
Error string `json:"error"` // "max fee per gas less than block base fee"
BlocksCount int `json:"blocksCount"` // 2
ReceivedTimestamp int `json:"receivedTimestamp"` // 1634568851003
StatusTimestamp int `json:"statusTimestamp"` // 1634568873862
}
type GlobalState ¶ added in v1.3.0
type GlobalState struct {
// contains filtered or unexported fields
}
todo: put into redis
func NewGlobalState ¶ added in v1.3.0
func NewGlobalState() *GlobalState
type HealthResponse ¶ added in v1.2.0
type JsonRpcError ¶
RpcError: https://www.jsonrpc.org/specification#error_object
func (JsonRpcError) Error ¶
func (err JsonRpcError) Error() string
type JsonRpcRequest ¶
type JsonRpcRequest struct {
Id interface{} `json:"id"`
Method string `json:"method"`
Params []interface{} `json:"params"`
Version string `json:"jsonrpc,omitempty"`
}
func NewJsonRpcRequest ¶
func NewJsonRpcRequest(id interface{}, method string, params []interface{}) *JsonRpcRequest
func NewJsonRpcRequest1 ¶
func NewJsonRpcRequest1(id interface{}, method string, param interface{}) *JsonRpcRequest
type JsonRpcResponse ¶
type JsonRpcResponse struct {
Id interface{} `json:"id"`
Result json.RawMessage `json:"result"`
Error *JsonRpcError `json:"error,omitempty"`
Version string `json:"jsonrpc"`
}
func NewJsonRpcResponse ¶
func NewJsonRpcResponse(id interface{}, result json.RawMessage) *JsonRpcResponse
func SendRpcAndParseResponseTo ¶
func SendRpcAndParseResponseTo(url string, req *JsonRpcRequest) (*JsonRpcResponse, error)
func SendRpcWithSignatureAndParseResponse ¶ added in v1.1.0
func SendRpcWithSignatureAndParseResponse(url string, privKey *ecdsa.PrivateKey, jsonRpcReq *JsonRpcRequest) (jsonRpcResponse *JsonRpcResponse, responseBytes *[]byte, err error)
type PrivateTxApiResponse ¶ added in v1.1.0
type PrivateTxApiResponse struct {
Status string `json:"status"`
Hash string `json:"hash"`
MaxBlockNumber int `json:"maxBlockNumber"`
}
func GetTxStatus ¶ added in v1.3.0
func GetTxStatus(txHash string) (*PrivateTxApiResponse, error)
type RelayErrorResponse ¶ added in v1.3.0
type RelayErrorResponse struct {
Error string `json:"error"`
}
type RpcEndPointServer ¶
type RpcEndPointServer struct {
// contains filtered or unexported fields
}
func NewRpcEndPointServer ¶
func NewRpcEndPointServer(version string, listenAddress, proxyUrl, relayUrl string, relaySigningKey *ecdsa.PrivateKey) *RpcEndPointServer
func (*RpcEndPointServer) HandleHttpRequest ¶
func (s *RpcEndPointServer) HandleHttpRequest(respw http.ResponseWriter, req *http.Request)
func (*RpcEndPointServer) Start ¶
func (s *RpcEndPointServer) Start()
type RpcRequest ¶
type RpcRequest struct {
// contains filtered or unexported fields
}
RPC request for a single client JSON-RPC request
func NewRpcRequest ¶
func NewRpcRequest(respw *http.ResponseWriter, req *http.Request, proxyUrl string, relayUrl string, relaySigningKey *ecdsa.PrivateKey) *RpcRequest
type StringWithTime ¶ added in v1.3.0
type StringWithTime struct {
// contains filtered or unexported fields
}
func NewStringWithTime ¶ added in v1.3.0
func NewStringWithTime(s string) StringWithTime
Click to show internal directories.
Click to hide internal directories.