ceramic

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GITCOIN_PASSPORT_CERAMIC_ENDPOINT  = "ceramic.passport-iam.gitcoin.co"
	MAINNET_COMMUNITY_CERAMIC_ENDPOINT = "gateway.ceramic.network"
	CLAY_COMMUNITY_CERAMIC_ENDPOINT    = "gateway-clay.ceramic.network"
)
View Source
const (
	COMMIT_GENESIS uint = iota
	COMMIT_SIGNED
	COMMIT_ANCHOR
)
View Source
const (
	SIGNATURE_STATUS_GENESIS uint = iota
	SIGNATURE_STATUS_PARTIAL
	SIGNATURE_STATUS_SIGNED
)

Variables

This section is empty.

Functions

func Decode

func Decode(id string) (interface{}, error)

Decode can return either StreamID or CommitID

func GetUVarInt

func GetUVarInt(input []byte) (uint64, []byte, int, error)

GetUVarInt returns the uint, rest of the buffer, bytes consumed, and error https://github.com/multiformats/unsigned-varint

func IsStreamID

func IsStreamID(input string) bool

IsStreamID returns whether the given input is a valid StreamID

func PutUVarInt

func PutUVarInt(code uint64) []byte

Types

type API

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

API interacts with Ceramic API gateway

func NewAPI

func NewAPI(opts ...Opt) API

func (*API) GetStream

func (a *API) GetStream(streamid string) (*CeramicGetResponse, error)

type CeramicAnchorProof

type CeramicAnchorProof struct {
	BlockNumber    uint   `json:"blockNumber"`
	BlockTimestamp uint   `json:"blockTimestamp"`
	ChainId        string `json:"chainId"`
	Root           string `json:"root"`
	TxHash         string `json:"txHash"`
}

type CeramicGetResponse

type CeramicGetResponse struct {
	StreamID string             `json:"streamId"`
	State    CeramicStreamState `json:"state"`
}

type CeramicLogEntry

type CeramicLogEntry struct {
	CID       string `json:"cid"`
	Timestamp *uint  `json:"timestamp,omitempty"`
	Type      uint   `json:"type"`
}

type CeramicStreamMetadata

type CeramicStreamMetadata struct {
	Controllers            []string `json:"controllers"`
	Family                 *string  `json:"family,omitempty"`
	ForbidControllerChange *bool    `json:"forbidControllerChange,omitempty"`
	Schema                 *string  `json:"schema,omitempty"`
	Tags                   []string `json:"tags,omitempty"`
}

type CeramicStreamNext

type CeramicStreamNext struct {
	Content     *json.RawMessage       `json:"content,omitempty"`
	Controllers []string               `json:"controllers,omitempty"`
	Metadata    *CeramicStreamMetadata `json:"metadata,omitempty"`
}

type CeramicStreamState

type CeramicStreamState struct {
	AnchorProof *CeramicAnchorProof `json:"anchorProof,omitempty"`

	Content         json.RawMessage       `json:"content"`
	Log             []CeramicLogEntry     `json:"log"`
	Metadata        CeramicStreamMetadata `json:"metadata"`
	Next            *CeramicStreamNext    `json:"next,omitempty"`
	SignatureStatus uint                  `json:"signature"`
	Type            int                   `json:"type"`
}

https://developers.ceramic.network/reference/typescript/interfaces/_ceramicnetwork_common.streamstate-1.html

type CommitID

type CommitID struct {
	Entries []RecordEntry
	Common
}

type Common

type Common struct {
	StreamID string
	Encoding multibase.Encoding
	Type     uint64
}

StreamID supports common operations with StreamID https://github.com/ceramicnetwork/CIP/blob/main/CIPs/CIP-59/CIP-59.md

type Opt

type Opt func(api *API) *API

func WithHost

func WithHost(host string) Opt

type RecordEntry

type RecordEntry struct {
	CIDVersion  uint64
	ContentType multicodec.Code
	ContentID   string
}

type StreamID

type StreamID struct {
	Entry RecordEntry
	Common
}

Jump to

Keyboard shortcuts

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