model

package
v0.0.0-...-54b74c5 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 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,
) ([]*cModel.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 {
	// ID of the input
	ID string `json:"id"`
	// 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"`
	// Input index in the Inpux Box
	InputBoxIndex string `json:"inputBoxIndex"`

	BlockTimestamp string `json:"blockTimestamp"`

	PrevRandao string `json:"prevRandao"`
}

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

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 only inputs from 'inputbox' or 'espresso'
	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"`
	// InputId string
	Proof Proof `json:"proof"`
}

Informational statement that can be validated in the base layer blockchain

func ConvertConvenientNoticeV1

func ConvertConvenientNoticeV1(cNotice cModel.ConvenienceNotice) *Notice

type NoticeConnection

type NoticeConnection = Connection[*Notice]

func ConvertToNoticeConnectionV1

func ConvertToNoticeConnectionV1(
	notices []cModel.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 {
	OutputIndex          string   `json:"outputIndex"`
	OutputHashesSiblings []string `json:"outputHashesSiblings"`
}

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"`

	Value string `json:"value"`

	Executed bool `json:"executed"`

	Proof Proof `json:"proof"`

	TransactionHash string `json:"transactionHash"`
}

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

func ConvertConvenientVoucherV1

func ConvertConvenientVoucherV1(cVoucher cModel.ConvenienceVoucher) *Voucher

type VoucherConnection

type VoucherConnection = Connection[*Voucher]

func ConvertToVoucherConnectionV1

func ConvertToVoucherConnectionV1(
	vouchers []cModel.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