Documentation ¶
Overview ¶
Package cnrc implements a Celestia Node REST Client
Index ¶
- Constants
- Variables
- type ABCIMessageLog
- type ABCIMessageLogs
- type Attribute
- type Client
- func (c *Client) Balance(ctx context.Context) error
- func (c *Client) Header(ctx context.Context, height uint64) error
- func (c *Client) NamespacedData(ctx context.Context, namespace Namespace, height uint64) ([][]byte, error)
- func (c *Client) NamespacedShares(ctx context.Context, namespace Namespace, height uint64) ([][]byte, error)
- func (c *Client) SubmitPFB(ctx context.Context, namespace Namespace, data []byte, fee int64, ...) (*TxResponse, error)
- func (c *Client) SubmitTx(ctx context.Context, tx []byte) error
- type Namespace
- func (n Namespace) Bytes() []byte
- func (n Namespace) Equals(n2 Namespace) bool
- func (n Namespace) IsGreaterOrEqualThan(n2 Namespace) bool
- func (n Namespace) IsGreaterThan(n2 Namespace) bool
- func (n Namespace) IsLessOrEqualThan(n2 Namespace) bool
- func (n Namespace) IsLessThan(n2 Namespace) bool
- func (n Namespace) IsParityShares() bool
- func (n Namespace) IsPayForBlob() bool
- func (n Namespace) IsReserved() bool
- func (n Namespace) IsReservedPadding() bool
- func (n Namespace) IsTailPadding() bool
- func (n Namespace) IsTx() bool
- func (n Namespace) Repeat(times int) []Namespace
- func (n Namespace) ValidateBlobNamespace() error
- type Option
- type StringEvent
- type StringEvents
- type SubmitPFBRequest
- type TxResponse
Constants ¶
const ( // NamespaveVersionSize is the size of a namespace version in bytes. NamespaceVersionSize = 1 // NamespaceIDSize is the size of a namespace ID in bytes. NamespaceIDSize = 28 // NamespaceSize is the size of a namespace (version + ID) in bytes. NamespaceSize = NamespaceVersionSize + NamespaceIDSize // NamespaceVersionZero is the first namespace version. NamespaceVersionZero = uint8(0) // NamespaceVersionMax is the max namespace version. NamespaceVersionMax = math.MaxUint8 // NamespaceZeroPrefixSize is the number of `0` bytes that are prefixed to // namespace IDs for version 0. NamespaceVersionZeroPrefixSize = 18 // NamespaceVersionZeroIDSize is the number of bytes available for // user-specified namespace ID in a namespace ID for version 0. NamespaceVersionZeroIDSize = NamespaceIDSize - NamespaceVersionZeroPrefixSize )
Variables ¶
var ( // NamespaceVersionZeroPrefix is the prefix of a namespace ID for version 0. NamespaceVersionZeroPrefix = bytes.Repeat([]byte{0}, NamespaceVersionZeroPrefixSize) // TxNamespace is the namespace reserved for transaction data. TxNamespace = MustNewV0([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 1}) // IntermediateStateRootsNamespace is the namespace reserved for // intermediate state root data. IntermediateStateRootsNamespace = MustNewV0([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 2}) // PayForBlobNamespace is the namespace reserved for PayForBlobs transactions. PayForBlobNamespace = MustNewV0([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 4}) // ReservedPaddingNamespace is the namespace used for padding after all // reserved namespaces. In practice this padding is after transactions // (ordinary and PFBs) but before blobs. ReservedPaddingNamespace = MustNewV0([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 255}) // MaxReservedNamespace is lexicographically the largest namespace that is // reserved for protocol use. MaxReservedNamespace = MustNewV0([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 255}) // TailPaddingNamespace is the namespace reserved for tail padding. All data // with this namespace will be ignored. TailPaddingNamespace = Namespace{ Version: math.MaxUint8, ID: append(bytes.Repeat([]byte{0xFF}, NamespaceIDSize-1), 0xFE), } ParitySharesNamespace = Namespace{ Version: math.MaxUint8, ID: bytes.Repeat([]byte{0xFF}, NamespaceIDSize), } )
Functions ¶
This section is empty.
Types ¶
type ABCIMessageLog ¶
type ABCIMessageLog struct { MsgIndex uint32 `protobuf:"varint,1,opt,name=msg_index,json=msgIndex,proto3" json:"msg_index,omitempty"` Log string `protobuf:"bytes,2,opt,name=log,proto3" json:"log,omitempty"` // Events contains a slice of Event objects that were emitted during some // execution. Events StringEvents `protobuf:"bytes,3,rep,name=events,proto3,castrepeated=StringEvents" json:"events"` }
ABCIMessageLog defines a structure containing an indexed tx ABCI message log.
type ABCIMessageLogs ¶
type ABCIMessageLogs []ABCIMessageLog
ABCIMessageLogs represents a slice of ABCIMessageLog.
type Attribute ¶
type Attribute struct { Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` }
Attribute defines an attribute wrapper where the key and value are strings instead of raw bytes.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) NamespacedData ¶
func (*Client) NamespacedShares ¶
type Namespace ¶ added in v0.4.1
func MustNew ¶ added in v0.4.1
MustNew returns a new namespace with the provided version and id. It panics if the provided version or id are not supported.
func MustNewV0 ¶ added in v0.4.1
MustNewV0 returns a new namespace with version 0 and the provided id. This function panics if the provided id is not exactly NamespaceVersionZeroIDSize bytes.
func (Namespace) IsGreaterOrEqualThan ¶ added in v0.4.1
func (Namespace) IsGreaterThan ¶ added in v0.4.1
func (Namespace) IsLessOrEqualThan ¶ added in v0.4.1
func (Namespace) IsLessThan ¶ added in v0.4.1
func (Namespace) IsParityShares ¶ added in v0.4.1
func (Namespace) IsPayForBlob ¶ added in v0.4.1
func (Namespace) IsReserved ¶ added in v0.4.1
func (Namespace) IsReservedPadding ¶ added in v0.4.1
func (Namespace) IsTailPadding ¶ added in v0.4.1
func (Namespace) ValidateBlobNamespace ¶ added in v0.4.1
ValidateBlobNamespace returns an error if this namespace is not a valid blob namespace.
type Option ¶
func WithTimeout ¶
type StringEvent ¶
type StringEvent struct { Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` Attributes []Attribute `protobuf:"bytes,2,rep,name=attributes,proto3" json:"attributes"` }
StringEvent defines en Event object wrapper where all the attributes contain key/value pairs that are strings instead of raw bytes.
type StringEvents ¶
type StringEvents []StringEvent
StringAttributes defines a slice of StringEvents objects.
type SubmitPFBRequest ¶ added in v0.3.0
type SubmitPFBRequest struct { NamespaceID string `json:"namespace_id"` Data string `json:"data"` Fee int64 `json:"fee"` GasLimit uint64 `json:"gas_limit"` }
SubmitPFBRequest represents a request to submit a PayForBlob transaction.
type TxResponse ¶
type TxResponse struct { // The block height Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` // The transaction hash. TxHash string `protobuf:"bytes,2,opt,name=txhash,proto3" json:"txhash,omitempty"` // Namespace for the Code Codespace string `protobuf:"bytes,3,opt,name=codespace,proto3" json:"codespace,omitempty"` // Response code. Code uint32 `protobuf:"varint,4,opt,name=code,proto3" json:"code,omitempty"` // Result bytes, if any. Data string `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` // The output of the application's logger (raw string). May be // non-deterministic. RawLog string `protobuf:"bytes,6,opt,name=raw_log,json=rawLog,proto3" json:"raw_log,omitempty"` // The output of the application's logger (typed). May be non-deterministic. Logs ABCIMessageLogs `protobuf:"bytes,7,rep,name=logs,proto3,castrepeated=ABCIMessageLogs" json:"logs"` // Additional information. May be non-deterministic. Info string `protobuf:"bytes,8,opt,name=info,proto3" json:"info,omitempty"` // Amount of gas requested for transaction. GasWanted int64 `protobuf:"varint,9,opt,name=gas_wanted,json=gasWanted,proto3" json:"gas_wanted,omitempty"` // Amount of gas consumed by transaction. GasUsed int64 `protobuf:"varint,10,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` // The request transaction bytes. Tx *types.Any `protobuf:"bytes,11,opt,name=tx,proto3" json:"tx,omitempty"` // Time of the previous block. For heights > 1, it's the weighted median of // the timestamps of the valid votes in the block.LastCommit. For height == 1, // it's genesis time. Timestamp string `protobuf:"bytes,12,opt,name=timestamp,proto3" json:"timestamp,omitempty"` }
TxResponse defines a structure containing relevant tx data and metadata. The tags are stringified and the log is JSON decoded.