client

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: Apache-2.0 Imports: 20 Imported by: 4

README

celestia-openrpc

OpenRPC is a client of celestia-node RPC, without depenencies on celestia-node/celestia-app/cosmos-sdk.

This is a temporary measure to resolve dependency issues when celestia-node is imported by rollkit.

Documentation

Index

Constants

View Source
const AuthKey = "Authorization"

Variables

This section is empty.

Functions

This section is empty.

Types

type BlobAPI

type BlobAPI struct {
	Submit   func(context.Context, []*blob.Blob, *SubmitOptions) (uint64, error)                        `perm:"write"`
	Get      func(context.Context, uint64, share.Namespace, blob.Commitment) (*blob.Blob, error)        `perm:"read"`
	GetAll   func(context.Context, uint64, []share.Namespace) ([]*blob.Blob, error)                     `perm:"read"`
	GetProof func(context.Context, uint64, share.Namespace, blob.Commitment) (*blob.Proof, error)       `perm:"read"`
	Included func(context.Context, uint64, share.Namespace, *blob.Proof, blob.Commitment) (bool, error) `perm:"read"`
}

type Client

type Client struct {
	Fraud  FraudAPI
	Blob   BlobAPI
	Header HeaderAPI
	State  StateAPI
	Share  ShareAPI
	DAS    DASAPI
	P2P    P2PAPI
	Node   NodeAPI
	// contains filtered or unexported fields
}

func NewClient

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

func (*Client) Close

func (c *Client) Close()

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

type DASAPI

type DASAPI struct {
	SamplingStats func(ctx context.Context) (das.SamplingStats, error) `perm:"read"`
	WaitCatchUp   func(ctx context.Context) error                      `perm:"read"`
}

type FraudAPI

type FraudAPI struct {
	Subscribe func(context.Context, fraud.ProofType) (<-chan *Proof, error) `perm:"read"`
	Get       func(context.Context, fraud.ProofType) ([]Proof, error)       `perm:"read"`
}

type HeaderAPI

type HeaderAPI struct {
	LocalHead func(context.Context) (*header.ExtendedHeader, error) `perm:"read"`
	GetByHash func(
		ctx context.Context,
		hash libhead.Hash,
	) (*header.ExtendedHeader, error) `perm:"read"`
	GetRangeByHeight func(
		context.Context,
		*header.ExtendedHeader,
		uint64,
	) ([]*header.ExtendedHeader, error) `perm:"read"`
	GetByHeight func(context.Context, uint64) (*header.ExtendedHeader, error)    `perm:"read"`
	SyncState   func(ctx context.Context) (sync.State, error)                    `perm:"read"`
	SyncWait    func(ctx context.Context) error                                  `perm:"read"`
	NetworkHead func(ctx context.Context) (*header.ExtendedHeader, error)        `perm:"read"`
	Subscribe   func(ctx context.Context) (<-chan *header.ExtendedHeader, error) `perm:"read"`
}

type NodeAPI

type NodeAPI struct {
	Info        func(context.Context) (node.Info, error)                           `perm:"admin"`
	LogLevelSet func(ctx context.Context, name, level string) error                `perm:"admin"`
	AuthVerify  func(ctx context.Context, token string) ([]auth.Permission, error) `perm:"admin"`
	AuthNew     func(ctx context.Context, perms []auth.Permission) ([]byte, error) `perm:"admin"`
}

type P2PAPI

type P2PAPI struct {
	Peers                func(context.Context) ([]peer.ID, error)                             `perm:"admin"`
	PeerInfo             func(ctx context.Context, id peer.ID) (peer.AddrInfo, error)         `perm:"admin"`
	Connect              func(ctx context.Context, pi peer.AddrInfo) error                    `perm:"admin"`
	ClosePeer            func(ctx context.Context, id peer.ID) error                          `perm:"admin"`
	Connectedness        func(ctx context.Context, id peer.ID) (network.Connectedness, error) `perm:"admin"`
	NATStatus            func(context.Context) (network.Reachability, error)                  `perm:"admin"`
	BlockPeer            func(ctx context.Context, p peer.ID) error                           `perm:"admin"`
	UnblockPeer          func(ctx context.Context, p peer.ID) error                           `perm:"admin"`
	ListBlockedPeers     func(context.Context) ([]peer.ID, error)                             `perm:"admin"`
	Protect              func(ctx context.Context, id peer.ID, tag string) error              `perm:"admin"`
	Unprotect            func(ctx context.Context, id peer.ID, tag string) (bool, error)      `perm:"admin"`
	IsProtected          func(ctx context.Context, id peer.ID, tag string) (bool, error)      `perm:"admin"`
	BandwidthStats       func(context.Context) (metrics.Stats, error)                         `perm:"admin"`
	BandwidthForPeer     func(ctx context.Context, id peer.ID) (metrics.Stats, error)         `perm:"admin"`
	BandwidthForProtocol func(ctx context.Context, proto protocol.ID) (metrics.Stats, error)  `perm:"admin"`
	ResourceState        func(context.Context) (rcmgr.ResourceManagerStat, error)             `perm:"admin"`
	PubSubPeers          func(ctx context.Context, topic string) ([]peer.ID, error)           `perm:"admin"`
}

type Proof

type Proof struct {
	fraud.Proof[*header.ExtendedHeader]
}

Proof embeds the fraud.Proof interface type to provide a concrete type for JSON serialization.

type ShareAPI

type ShareAPI struct {
	SharesAvailable func(context.Context, *header.ExtendedHeader) error `perm:"read"`
	GetShare        func(
		ctx context.Context,
		eh *header.ExtendedHeader,
		row, col int,
	) (share.Share, error) `perm:"read"`
	GetEDS func(
		ctx context.Context,
		eh *header.ExtendedHeader,
	) (*rsmt2d.ExtendedDataSquare, error) `perm:"read"`
	GetSharesByNamespace func(
		ctx context.Context,
		eh *header.ExtendedHeader,
		namespace share.Namespace,
	) (share.NamespacedShares, error) `perm:"read"`
}

type StateAPI

type StateAPI struct {
	AccountAddress    func(ctx context.Context) (state.Address, error)                      `perm:"read"`
	IsStopped         func(ctx context.Context) bool                                        `perm:"read"`
	Balance           func(ctx context.Context) (*state.Balance, error)                     `perm:"read"`
	BalanceForAddress func(ctx context.Context, addr state.Address) (*state.Balance, error) `perm:"read"`
	Transfer          func(
		ctx context.Context,
		to state.AccAddress,
		amount,
		fee state.Int,
		gasLimit uint64,
	) (*state.TxResponse, error) `perm:"write"`
	SubmitTx         func(ctx context.Context, tx state.Tx) (*state.TxResponse, error) `perm:"write"`
	SubmitPayForBlob func(
		ctx context.Context,
		fee state.Int,
		gasLim uint64,
		blobs []*blob.Blob,
	) (*state.TxResponse, error) `perm:"write"`
	CancelUnbondingDelegation func(
		ctx context.Context,
		valAddr state.ValAddress,
		amount,
		height,
		fee state.Int,
		gasLim uint64,
	) (*state.TxResponse, error) `perm:"write"`
	BeginRedelegate func(
		ctx context.Context,
		srcValAddr,
		dstValAddr state.ValAddress,
		amount,
		fee state.Int,
		gasLim uint64,
	) (*state.TxResponse, error) `perm:"write"`
	Undelegate func(
		ctx context.Context,
		delAddr state.ValAddress,
		amount,
		fee state.Int,
		gasLim uint64,
	) (*state.TxResponse, error) `perm:"write"`
	Delegate func(
		ctx context.Context,
		delAddr state.ValAddress,
		amount,
		fee state.Int,
		gasLim uint64,
	) (*state.TxResponse, error) `perm:"write"`
	QueryDelegation func(
		ctx context.Context,
		valAddr state.ValAddress,
	) (*state.QueryDelegationResponse, error) `perm:"read"`
	QueryUnbonding func(
		ctx context.Context,
		valAddr state.ValAddress,
	) (*state.QueryUnbondingDelegationResponse, error) `perm:"read"`
	QueryRedelegations func(
		ctx context.Context,
		srcValAddr,
		dstValAddr state.ValAddress,
	) (*state.QueryRedelegationsResponse, error) `perm:"read"`
}

type SubmitOptions added in v0.2.0

type SubmitOptions struct {
	Fee      int64
	GasLimit uint64
}

SubmitOptions contains the information about fee and gasLimit price in order to configure the Submit request.

func DefaultSubmitOptions added in v0.2.0

func DefaultSubmitOptions() *SubmitOptions

DefaultSubmitOptions creates a default fee and gas price values.

Directories

Path Synopsis
types
das
sdk

Jump to

Keyboard shortcuts

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