jsonrpc

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: Apache-2.0 Imports: 9 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Internal struct {
		MaxBlobSize       func(ctx context.Context) (uint64, error)                                            `perm:"read"`
		Get               func(ctx context.Context, ids []da.ID, ns da.Namespace) ([]da.Blob, error)           `perm:"read"`
		GetIDs            func(ctx context.Context, height uint64, ns da.Namespace) (*da.GetIDsResult, error)  `perm:"read"`
		GetProofs         func(ctx context.Context, ids []da.ID, ns da.Namespace) ([]da.Proof, error)          `perm:"read"`
		Commit            func(ctx context.Context, blobs []da.Blob, ns da.Namespace) ([]da.Commitment, error) `perm:"read"`
		Validate          func(context.Context, []da.ID, []da.Proof, da.Namespace) ([]bool, error)             `perm:"read"`
		Submit            func(context.Context, []da.Blob, float64, da.Namespace) ([]da.ID, error)             `perm:"write"`
		SubmitWithOptions func(context.Context, []da.Blob, float64, da.Namespace, []byte) ([]da.ID, error)     `perm:"write"`
	}
}

API defines the jsonrpc service module API

func (*API) Commit

func (api *API) Commit(ctx context.Context, blobs []da.Blob, ns da.Namespace) ([]da.Commitment, error)

Commit creates a Commitment for each given Blob.

func (*API) Get

func (api *API) Get(ctx context.Context, ids []da.ID, ns da.Namespace) ([]da.Blob, error)

Get returns Blob for each given ID, or an error.

func (*API) GetIDs

func (api *API) GetIDs(ctx context.Context, height uint64, ns da.Namespace) (*da.GetIDsResult, error)

GetIDs returns IDs of all Blobs located in DA at given height.

func (*API) GetProofs

func (api *API) GetProofs(ctx context.Context, ids []da.ID, ns da.Namespace) ([]da.Proof, error)

GetProofs returns inclusion Proofs for Blobs specified by their IDs.

func (*API) MaxBlobSize

func (api *API) MaxBlobSize(ctx context.Context) (uint64, error)

MaxBlobSize returns the max blob size

func (*API) Submit

func (api *API) Submit(ctx context.Context, blobs []da.Blob, gasPrice float64, ns da.Namespace) ([]da.ID, error)

Submit submits the Blobs to Data Availability layer.

func (*API) SubmitWithOptions added in v0.6.1

func (api *API) SubmitWithOptions(ctx context.Context, blobs []da.Blob, gasPrice float64, ns da.Namespace, options []byte) ([]da.ID, error)

SubmitWithOptions submits the Blobs to Data Availability layer.

func (*API) Validate

func (api *API) Validate(ctx context.Context, ids []da.ID, proofs []da.Proof, ns da.Namespace) ([]bool, error)

Validate validates Commitments against the corresponding Proofs. This should be possible without retrieving the Blobs.

type Client

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

Client is the jsonrpc client

func NewClient

func NewClient(ctx context.Context, addr string, token string) (*Client, error)

NewClient creates a new Client with one connection per namespace with the given token as the authorization token.

func (*Client) Close

func (c *Client) Close()

Close closes the connections to all namespaces registered on the staticClient.

type Module

type Module interface {
	da.DA
}

Module wraps the DA interface

type Server

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

Server is a jsonrpc service that can serve the DA interface

func NewServer

func NewServer(address, port string, DA da.DA) *Server

NewServer accepts the host address port and the DA implementation to serve as a jsonrpc service

func (*Server) RegisterService

func (s *Server) RegisterService(namespace string, service interface{}, out interface{})

RegisterService registers a service onto the RPC server. All methods on the service will then be exposed over the RPC.

func (*Server) Start

func (s *Server) Start(context.Context) error

Start starts the RPC Server. This function can be called multiple times concurrently Once started, subsequent calls are a no-op

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop stops the RPC Server. This function can be called multiple times concurrently Once stopped, subsequent calls are a no-op

Jump to

Keyboard shortcuts

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