server

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Whitelist for smart contract functions that never need protection.

OFAC banned addresses

Request represents an incoming client request

Index

Constants

This section is empty.

Variables

View Source
var MetaMaskFix = NewMetaMaskFixer()
View Source
var Now = time.Now // used to mock time in tests

Functions

func GetIP

func GetIP(r *http.Request) string

func GetSenderFromRawTx

func GetSenderFromRawTx(tx *types.Transaction) (string, error)

func GetSenderFromTx

func GetSenderFromTx(tx *types.Transaction) (string, error)

func GetTx

func GetTx(rawTxHex string) (*types.Transaction, error)

func IsBlacklisted

func IsBlacklisted(ip string) bool

func IsMetamask

func IsMetamask(r *http.Request) bool

CHROME_ID: nkbihfbeogaeaoehlefnkodbefgpgknn

func IsMetamaskMoz

func IsMetamaskMoz(r *http.Request) bool

FIREFOX_ID: webextension@metamask.io

func NewMetaMaskFixer

func NewMetaMaskFixer() metaMaskFixer

func ProxyRequest

func ProxyRequest(proxyUrl string, body []byte) (*http.Response, error)

func TruncateText

func TruncateText(s string, max int) string

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 JsonRpcError

type JsonRpcError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

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)

type RpcEndPointServer

type RpcEndPointServer struct {
	// contains filtered or unexported fields
}

func NewRpcEndPointServer

func NewRpcEndPointServer(listenAddress, proxyUrl, txManagerUrl string) *RpcEndPointServer

func (*RpcEndPointServer) HandleHttpRequest

func (r *RpcEndPointServer) HandleHttpRequest(respw http.ResponseWriter, req *http.Request)

func (*RpcEndPointServer) Start

func (r *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, txManagerUrl string) *RpcRequest

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL