model

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 7 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 ConvenientVoucher

type ConvenientVoucher struct {
	// Voucher index within the context of the input that produced it
	Index int `json:"index"`
	// Input whose processing produced the voucher
	Input *Input `json:"input"`
	// 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"`
	// Proof object that allows this voucher to be validated and
	// executed on the base layer blockchain
	Proof *Proof `json:"proof,omitempty"`
	// Executed
	Executed *bool `json:"executed,omitempty"`
}

type ConvenientVoucherConnection

type ConvenientVoucherConnection = Connection[*ConvenientVoucher]

func ConvertToVoucherConnection

func ConvertToVoucherConnection(
	vouchers []convenience.ConvenienceVoucher,
	offset int, total int,
) (*ConvenientVoucherConnection, error)

type ConvenientVoucherEdge

type ConvenientVoucherEdge = Edge[*ConvenientVoucher]

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

Request submitted to the application to advance its state

func ConvertInput

func ConvertInput(input model.AdvanceInput) *Input

type InputConnection

type InputConnection = Connection[*Input]

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 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"`
	// Proof object that allows this notice to be validated by the base layer blockchain
	Proof *Proof `json:"proof,omitempty"`
}

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 OutputValidityProof

type OutputValidityProof struct {
	// Local input index within the context of the related epoch
	InputIndexWithinEpoch int `json:"inputIndexWithinEpoch"`
	// Output index within the context of the input that produced it
	OutputIndexWithinInput int `json:"outputIndexWithinInput"`
	// Merkle root of all output hashes of the related input, given in Ethereum hex binary format (32 bytes), starting with '0x'
	OutputHashesRootHash string `json:"outputHashesRootHash"`
	// Merkle root of all voucher hashes of the related epoch, given in Ethereum hex binary format (32 bytes), starting with '0x'
	VouchersEpochRootHash string `json:"vouchersEpochRootHash"`
	// Merkle root of all notice hashes of the related epoch, given in Ethereum hex binary format (32 bytes), starting with '0x'
	NoticesEpochRootHash string `json:"noticesEpochRootHash"`
	// Hash of the machine state claimed for the related epoch, given in Ethereum hex binary format (32 bytes), starting with '0x'
	MachineStateHash string `json:"machineStateHash"`
	// Proof that this output hash is in the output-hashes merkle tree. This array of siblings is bottom-up ordered (from the leaf to the root). Each hash is given in Ethereum hex binary format (32 bytes), starting with '0x'.
	OutputHashInOutputHashesSiblings []string `json:"outputHashInOutputHashesSiblings"`
	// Proof that this output-hashes root hash is in epoch's output merkle tree. This array of siblings is bottom-up ordered (from the leaf to the root). Each hash is given in Ethereum hex binary format (32 bytes), starting with '0x'.
	OutputHashesInEpochSiblings []string `json:"outputHashesInEpochSiblings"`
}

Validity proof for an output

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 {
	// Validity proof for an output
	Validity *OutputValidityProof `json:"validity"`
	// Data that allows the validity proof to be contextualized within submitted claims, given as a payload in Ethereum hex binary format, starting with '0x'
	Context string `json:"context"`
}

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"`
	// Proof object that allows this voucher to be validated and executed on the base layer
	// blockchain
	Proof *Proof `json:"proof,omitempty"`

	Executed bool
}

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