web3provider

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const PermissionContactCode = "contact-code"
View Source
const PermissionUnknown = "unknown"
View Source
const PermissionWeb3 = "web3"
View Source
const RequestAPI = "api-request"
View Source
const ResponseAPI = "api-response"
View Source
const Web3ResponseError = "web3-response-error"
View Source
const Web3SendAsyncCallback = "web3-send-async-callback"
View Source
const Web3SendAsyncReadOnly = "web3-send-async-read-only"

Variables

View Source
var ErrorInvalidAPIRequest = errors.New("invalid API request")
View Source
var ErrorUnknownPermission = errors.New("unknown permission")

Functions

This section is empty.

Types

type API

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

API is class with methods available over RPC.

func NewAPI

func NewAPI(s *Service) *API

func (*API) EcRecover

func (api *API) EcRecover(data hexutil.Bytes, sig hexutil.Bytes) (types.Address, error)

func (*API) ProcessAPIRequest

func (api *API) ProcessAPIRequest(request APIRequest) (*APIResponse, error)

func (*API) ProcessRequest

func (api *API) ProcessRequest(requestType string, payload json.RawMessage) (interface{}, error)

func (*API) ProcessWeb3ReadOnlyRequest

func (api *API) ProcessWeb3ReadOnlyRequest(request Web3SendAsyncReadOnlyRequest) (*Web3SendAsyncReadOnlyResponse, error)

type APIRequest

type APIRequest struct {
	MessageID  interface{} `json:"messageId,omitempty"`
	Address    string      `json:"address,omitempty"`
	Hostname   string      `json:"hostname"`
	Permission string      `json:"permission"`
}

type APIResponse

type APIResponse struct {
	ProviderResponse

	MessageID  interface{} `json:"messageId,omitempty"`
	Permission string      `json:"permission"`
	Data       interface{} `json:"data,omitempty"`
	IsAllowed  bool        `json:"isAllowed"`
}

type ETHPayload

type ETHPayload struct {
	ID       interface{}   `json:"id,omitempty"`
	JSONRPC  string        `json:"jsonrpc"`
	From     string        `json:"from"`
	Method   string        `json:"method"`
	Params   []interface{} `json:"params"`
	Password string        `json:"password,omitempty"`
	ChainID  uint64        `json:"chainId,omitempty"`
}

type JSONRPCResponse

type JSONRPCResponse struct {
	ID      interface{} `json:"id,omitempty"`
	JSONRPC string      `json:"jsonrpc"`
	Result  interface{} `json:"result"`
}

type ProviderResponse

type ProviderResponse struct {
	ResponseType string `json:"type"`
}

type Service

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

func NewService

func NewService(appDB *sql.DB, accountsDB *accounts.Database, rpcClient *rpc.Client, config *params.NodeConfig, accountsManager *account.GethManager, rpcFiltersSrvc *rpcfilters.Service, transactor *transactions.Transactor) *Service

func (*Service) APIs

func (s *Service) APIs() []gethrpc.API

func (*Service) Protocols

func (s *Service) Protocols() []p2p.Protocol

func (*Service) Start

func (s *Service) Start() error

func (*Service) Stop

func (s *Service) Stop() error

type Web3SendAsyncReadOnlyError

type Web3SendAsyncReadOnlyError struct {
	Code    uint   `json:"code"`
	Message string `json:"message,omitempty"`
}

type Web3SendAsyncReadOnlyRequest

type Web3SendAsyncReadOnlyRequest struct {
	Title     string      `json:"title,omitempty"`
	MessageID interface{} `json:"messageId"`
	Payload   ETHPayload  `json:"payload"`
	Hostname  string      `json:"hostname"`
	Address   string      `json:"address,omitempty"`
}

type Web3SendAsyncReadOnlyResponse

type Web3SendAsyncReadOnlyResponse struct {
	ProviderResponse

	MessageID interface{} `json:"messageId"`
	Error     interface{} `json:"error,omitempty"`
	Result    interface{} `json:"result,omitempty"`
}

Jump to

Keyboard shortcuts

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