jsonrpc

package
v1.0.0-beta.6 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2025 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Logger      zerolog.Logger
	MaxBlobSize uint64
	Internal    struct {
		Get               func(ctx context.Context, ids []da.ID, ns []byte) ([]da.Blob, error)           `perm:"read"`
		GetIDs            func(ctx context.Context, height uint64, ns []byte) (*da.GetIDsResult, error)  `perm:"read"`
		GetProofs         func(ctx context.Context, ids []da.ID, ns []byte) ([]da.Proof, error)          `perm:"read"`
		Commit            func(ctx context.Context, blobs []da.Blob, ns []byte) ([]da.Commitment, error) `perm:"read"`
		Validate          func(context.Context, []da.ID, []da.Proof, []byte) ([]bool, error)             `perm:"read"`
		Submit            func(context.Context, []da.Blob, float64, []byte) ([]da.ID, error)             `perm:"write"`
		SubmitWithOptions func(context.Context, []da.Blob, float64, []byte, []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 []byte) ([]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 []byte) ([]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 []byte) (*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 []byte) ([]da.Proof, error)

GetProofs returns inclusion Proofs for Blobs specified by their IDs.

func (*API) Submit

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

Submit submits the Blobs to Data Availability layer.

func (*API) SubmitWithOptions

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

SubmitWithOptions submits the Blobs to Data Availability layer with additional options. It validates the entire batch against MaxBlobSize before submission. If any blob or the total batch size exceeds limits, it returns ErrBlobSizeOverLimit.

func (*API) Validate

func (api *API) Validate(ctx context.Context, ids []da.ID, proofs []da.Proof, ns []byte) ([]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, logger zerolog.Logger, addr, token string, maxBlobSize uint64) (*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
}

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(logger zerolog.Logger, address, port string, daImplementation da.DA) *Server

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

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