model

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

This module is a wrapper for the nonodo model that converts the internal types to GraphQL-compatible types.

Index

Constants

View Source
const DefaultPaginationLimit = 1000

Variables

Functions

func ConvertToConvenienceFilter

func ConvertToConvenienceFilter(
	filter []*ConvenientFilter,
) ([]*convenience.ConvenienceFilter, error)

Types

type AddressFilterInput

type AddressFilterInput struct {
	Eq  *string             `json:"eq,omitempty"`
	Ne  *string             `json:"ne,omitempty"`
	In  []*string           `json:"in,omitempty"`
	Nin []*string           `json:"nin,omitempty"`
	And []*ConvenientFilter `json:"and,omitempty"`
	Or  []*ConvenientFilter `json:"or,omitempty"`
}

type BooleanFilterInput

type BooleanFilterInput struct {
	Eq  *bool               `json:"eq,omitempty"`
	Ne  *bool               `json:"ne,omitempty"`
	And []*ConvenientFilter `json:"and,omitempty"`
	Or  []*ConvenientFilter `json:"or,omitempty"`
}

type CompletionStatus

type CompletionStatus string
const (
	CompletionStatusUnprocessed                CompletionStatus = "UNPROCESSED"
	CompletionStatusAccepted                   CompletionStatus = "ACCEPTED"
	CompletionStatusRejected                   CompletionStatus = "REJECTED"
	CompletionStatusException                  CompletionStatus = "EXCEPTION"
	CompletionStatusMachineHalted              CompletionStatus = "MACHINE_HALTED"
	CompletionStatusCycleLimitExceeded         CompletionStatus = "CYCLE_LIMIT_EXCEEDED"
	CompletionStatusTimeLimitExceeded          CompletionStatus = "TIME_LIMIT_EXCEEDED"
	CompletionStatusPayloadLengthLimitExceeded CompletionStatus = "PAYLOAD_LENGTH_LIMIT_EXCEEDED"
)

func (CompletionStatus) IsValid

func (e CompletionStatus) IsValid() bool

func (CompletionStatus) MarshalGQL

func (e CompletionStatus) MarshalGQL(w io.Writer)

func (CompletionStatus) String

func (e CompletionStatus) String() string

func (*CompletionStatus) UnmarshalGQL

func (e *CompletionStatus) UnmarshalGQL(v interface{}) error

type Connection

type Connection[T any] struct {
	// Total number of entries that match the query
	TotalCount int `json:"totalCount"`
	// Pagination entries returned for the current page
	Edges []*Edge[T] `json:"edges"`
	// Pagination metadata
	PageInfo *PageInfo `json:"pageInfo"`
}

Pagination result

func NewConnection

func NewConnection[T any](offset int, total int, nodes []T) *Connection[T]

Create a new connection for the given slice of elements.

type ConvenientFilter

type ConvenientFilter struct {
	Destination *AddressFilterInput `json:"destination,omitempty"`
	Executed    *BooleanFilterInput `json:"executed,omitempty"`
	And         []*ConvenientFilter `json:"and,omitempty"`
	Or          []*ConvenientFilter `json:"or,omitempty"`
}

type Edge

type Edge[T any] struct {
	// Node instance
	Node T `json:"node"`
	// contains filtered or unexported fields
}

Pagination entry

func (*Edge[T]) Cursor

func (e *Edge[T]) Cursor() string

Encode the cursor from the offset.

type Input

type Input struct {
	// Input index starting from genesis
	Index int `json:"index"`
	// Status of the input
	Status CompletionStatus `json:"status"`
	// Address responsible for submitting the input
	MsgSender string `json:"msgSender"`
	// Timestamp associated with the input submission, as defined by the base layer's block in
	// which it was recorded
	Timestamp string `json:"timestamp"`
	// Number of the base layer block in which the input was recorded
	BlockNumber string `json:"blockNumber"`
	// Input payload in Ethereum hex binary format, starting with '0x'
	Payload string `json:"payload"`
	// Timestamp associated with the Espresso input submission
	EspressoTimestamp string `json:"espressoTimestamp"`
	// Number of the Espresso block in which the input was recorded
	EspressoBlockNumber string `json:"espressoBlockNumber"`
}

Request submitted to the application to advance its state

func ConvertInput

func ConvertInput(input cModel.AdvanceInput) (*Input, error)

type InputConnection

type InputConnection = Connection[*Input]

func ConvertToInputConnectionV1 added in v1.3.0

func ConvertToInputConnectionV1(
	inputs []cModel.AdvanceInput,
	offset int, total int,
) (*InputConnection, error)

type InputEdge

type InputEdge = Edge[*Input]

type InputFilter

type InputFilter struct {
	// Filter only inputs with index lower than a given value
	IndexLowerThan *int `json:"indexLowerThan,omitempty"`
	// Filter only inputs with index greater than a given value
	IndexGreaterThan *int `json:"indexGreaterThan,omitempty"`
	// Filter only inputs with the message sender
	MsgSender *string `json:"msgSender,omitempty"`
	// Filter by input type. Espresso or inputbox
	Type *string `json:"type,omitempty"`
}

Filter object to restrict results depending on input properties

type ModelWrapper

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

Nonodo model wrapper that convert types to GraphQL types.

func NewModelWrapper

func NewModelWrapper(model *model.NonodoModel) *ModelWrapper

type Notice

type Notice struct {
	// Notice index within the context of the input that produced it
	Index int `json:"index"`
	// Index of the input
	InputIndex int
	// Notice data as a payload in Ethereum hex binary format, starting with '0x'
	Payload string `json:"payload"`
}

Informational statement that can be validated in the base layer blockchain

type NoticeConnection

type NoticeConnection = Connection[*Notice]

func ConvertToNoticeConnectionV1

func ConvertToNoticeConnectionV1(
	notices []convenience.ConvenienceNotice,
	offset int, total int,
) (*NoticeConnection, error)

type NoticeEdge

type NoticeEdge = Edge[*Notice]

type PageInfo

type PageInfo struct {
	// Cursor pointing to the first entry of the page
	StartCursor *string `json:"startCursor,omitempty"`
	// Cursor pointing to the last entry of the page
	EndCursor *string `json:"endCursor,omitempty"`
	// Indicates if there are additional entries after the end curs
	HasNextPage bool `json:"hasNextPage"`
	// Indicates if there are additional entries before the start curs
	HasPreviousPage bool `json:"hasPreviousPage"`
}

Page metadata for the cursor-based Connection pagination pattern

type Proof

type Proof struct {
	FirstIndex int `json:"firstIndex"`
	// Reads a single `Input` that is related to this `Proof`.
	InputByInputIndex *Input `json:"inputByInputIndex,omitempty"`
	InputIndex        int    `json:"inputIndex"`
	LastInput         int    `json:"lastInput"`
	// A globally unique identifier. Can be used in various places throughout the system to identify this single value.
	NodeID                                   string    `json:"nodeId"`
	OutputIndex                              int       `json:"outputIndex"`
	ValidityInputIndexWithinEpoch            int       `json:"validityInputIndexWithinEpoch"`
	ValidityMachineStateHash                 string    `json:"validityMachineStateHash"`
	ValidityOutputEpochRootHash              string    `json:"validityOutputEpochRootHash"`
	ValidityOutputHashInOutputHashesSiblings []*string `json:"validityOutputHashInOutputHashesSiblings"`
	ValidityOutputHashesInEpochSiblings      []*string `json:"validityOutputHashesInEpochSiblings"`
	ValidityOutputHashesRootHash             string    `json:"validityOutputHashesRootHash"`
	ValidityOutputIndexWithinInput           int       `json:"validityOutputIndexWithinInput"`
}

Data that can be used as proof to validate notices and execute vouchers on the base layer blockchain

type Report

type Report struct {
	// Report index within the context of the input that produced it
	Index int `json:"index"`
	// Index of the input
	InputIndex int
	// Report data as a payload in Ethereum hex binary format, starting with '0x'
	Payload string `json:"payload"`
}

Application log or diagnostic information

type ReportConnection

type ReportConnection = Connection[*Report]

type ReportEdge

type ReportEdge = Edge[*Report]

type Voucher

type Voucher struct {
	// Voucher index within the context of the input that produced it
	Index int `json:"index"`
	// Index of the input
	InputIndex int
	// Transaction destination address in Ethereum hex binary format (20 bytes), starting with
	// '0x'
	Destination string `json:"destination"`
	// Transaction payload in Ethereum hex binary format, starting with '0x'
	Payload string `json:"payload"`

	Executed bool `json:"executed"`
}

Representation of a transaction that can be carried out on the base layer blockchain, such as a transfer of assets

type VoucherConnection

type VoucherConnection = Connection[*Voucher]

func ConvertToVoucherConnectionV1

func ConvertToVoucherConnectionV1(
	vouchers []convenience.ConvenienceVoucher,
	offset int, total int,
) (*VoucherConnection, error)

type VoucherEdge

type VoucherEdge = Edge[*Voucher]

Jump to

Keyboard shortcuts

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