Documentation
¶
Overview ¶
This module is a wrapper for the nonodo model that converts the internal types to GraphQL-compatible types.
Index ¶
- Constants
- Variables
- type CompletionStatus
- type Connection
- type Edge
- type Input
- type InputConnection
- type InputEdge
- type InputFilter
- type ModelWrapper
- func (m *ModelWrapper) GetInput(index int) (*Input, error)
- func (m *ModelWrapper) GetInputs(first *int, last *int, after *string, before *string, where *InputFilter) (*InputConnection, error)
- func (m *ModelWrapper) GetNotice(noticeIndex int, inputIndex int) (*Notice, error)
- func (m *ModelWrapper) GetNotices(first *int, last *int, after *string, before *string, inputIndex *int) (*NoticeConnection, error)
- func (m *ModelWrapper) GetReport(reportIndex int, inputIndex int) (*Report, error)
- func (m *ModelWrapper) GetReports(first *int, last *int, after *string, before *string, inputIndex *int) (*ReportConnection, error)
- func (m *ModelWrapper) GetVoucher(voucherIndex int, inputIndex int) (*Voucher, error)
- func (m *ModelWrapper) GetVouchers(first *int, last *int, after *string, before *string, inputIndex *int) (*VoucherConnection, error)
- type Notice
- type NoticeConnection
- type NoticeEdge
- type OutputValidityProof
- type PageInfo
- type Proof
- type Report
- type ReportConnection
- type ReportEdge
- type Voucher
- type VoucherConnection
- type VoucherEdge
Constants ¶
const DefaultPaginationLimit = 1000
Variables ¶
var AllCompletionStatus = []CompletionStatus{ CompletionStatusUnprocessed, CompletionStatusAccepted, CompletionStatusRejected, CompletionStatusException, CompletionStatusMachineHalted, CompletionStatusCycleLimitExceeded, CompletionStatusTimeLimitExceeded, CompletionStatusPayloadLengthLimitExceeded, }
var InvalidCursorErr = errors.New("invalid pagination cursor")
var InvalidLimitErr = errors.New("limit cannot be negative")
var MixedPaginationErr = errors.New(
"cannot mix forward pagination (first, after) with backward pagination (last, before)")
Functions ¶
This section is empty.
Types ¶
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
type Edge ¶
type Edge[T any] struct { // Node instance Node T `json:"node"` // contains filtered or unexported fields }
Pagination entry
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
type InputConnection ¶
type InputConnection = Connection[*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
func (*ModelWrapper) GetInputs ¶
func (m *ModelWrapper) GetInputs( first *int, last *int, after *string, before *string, where *InputFilter, ) (*InputConnection, error)
func (*ModelWrapper) GetNotice ¶
func (m *ModelWrapper) GetNotice(noticeIndex int, inputIndex int) (*Notice, error)
func (*ModelWrapper) GetNotices ¶
func (m *ModelWrapper) GetNotices( first *int, last *int, after *string, before *string, inputIndex *int, ) (*NoticeConnection, error)
func (*ModelWrapper) GetReport ¶
func (m *ModelWrapper) GetReport(reportIndex int, inputIndex int) (*Report, error)
func (*ModelWrapper) GetReports ¶
func (m *ModelWrapper) GetReports( first *int, last *int, after *string, before *string, inputIndex *int, ) (*ReportConnection, error)
func (*ModelWrapper) GetVoucher ¶
func (m *ModelWrapper) GetVoucher(voucherIndex int, inputIndex int) (*Voucher, error)
func (*ModelWrapper) GetVouchers ¶
func (m *ModelWrapper) GetVouchers( first *int, last *int, after *string, before *string, inputIndex *int, ) (*VoucherConnection, error)
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]
type NoticeEdge ¶
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 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"`
}
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]