Realm detail
test
gno.land/r/nym-encapsulate001/test
Indexed deployment identity with independently loaded latest RPC source, functions, and Render.
Indexed deployment
Identity
- Package path
- gno.land/r/nym-encapsulate001/test
- Block
- 266664
- Deployed (UTC)
- Transaction
- VoMJo5JHYx25emc4WVH0qgxmiFb5v9SQxOXQOBNgKtU=
Latest RPC state
Source
package test
import (
"gno.land/p/nt/avl/v0"
"gno.land/p/nt/ownable/v0"
"gno.land/p/nt/seqid/v0"
)
// FieldKind is the input type a field renders as, and the validation it gets.
type FieldKind string
const (
KindText FieldKind = "text"
KindTextarea FieldKind = "textarea"
KindNumber FieldKind = "number"
KindSelect FieldKind = "select"
)
// Limits. Answers are stored on chain and the respondent pays the storage
// deposit for them, so the caps exist to keep that cost predictable rather
// than to save the realm anything.
const (
MaxFields = 8
MaxTitleLen = 120
MaxDescriptionLen = 2048
MaxLabelLen = 120
MaxOptionLen = 120
MaxTextLen = 256
MaxTextareaLen = 2048
MaxNumberLen = 64
)
// Field is one question on a form.
type Field struct {
Label string
Kind FieldKind
Required bool
Options []string // select only
}
// MaxLen is the longest answer the field accepts.
func (f Field) MaxLen() int {
switch f.Kind {
case KindTextarea:
return MaxTextareaLen
case KindNumber:
return MaxNumberLen
case KindSelect:
return MaxOptionLen
default:
return MaxTextLen
}
}
// Form is a published questionnaire and its responses.
type Form struct {
ID seqid.ID
Title string
Description string
Fields []Field
OnePerAddr bool
Deadline int64 // chain height; 0 means none
Closed bool
CreatedAt int64
owner *ownable.Ownable
responses *avl.Tree // response id -> *Response
byAddr *avl.Tree // author address -> response id
}
// Owner returns the form owner's address.
func (f *Form) Owner() address {
return f.owner.Owner()
}
// ResponseCount returns how many responses the form currently holds.
func (f *Form) ResponseCount() int {
return f.responses.Size()
}
// IsOpen reports whether the form accepts submissions at the given height.
func (f *Form) IsOpen(height int64) bool {
if f.Closed {
return false
}
return f.Deadline == 0 || height < f.Deadline
}
// Response is one submission to a form. Answers align with Form.Fields.
type Response struct {
ID seqid.ID
Form seqid.ID
Author address
Height int64
Answers []string
}
Latest RPC state
Exported functions
- Create(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, title string, description string, labels string, kinds string, required string, options string, onePerAddr bool, deadline int64) string
- Close(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, id string)
- Reopen(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, id string)
- TransferOwnership(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, id string, to string)
- GetForm(id string) (*gno.land/r/nym-encapsulate001/test.Form, bool)
- ResponseCount(id string) int
- FormCount() int
- Render(path string) string
- Submit(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, id string, a1 string, a2 string, a3 string, a4 string, a5 string, a6 string, a7 string, a8 string)
- Withdraw(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, id string)
Latest RPC state · Realm Render
Forms
Publish a form, collect responses on chain, read them back here. Respondents fill it in on this page and pay their own storage deposit; withdrawing a response refunds it.
| Form | Status | Responses | Fields | Owner | | --- | --- | --- | --- | --- | | Valoper questionnaire | open | 1 | 6 | g1eyr3hf…x2v0 |
Create a form
Call Create with a title, a description, and four pipe-separated field specs — labels, kinds (text|textarea|number|select), required flags (1|0) and select options (comma-separated). Up to 8 fields.
Create a form