Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

test4 package

Overview

Package test4 is a Google-Forms-shaped questionnaire realm: publish a form, collect responses on chain, read them back rendered — with gnoweb as the only UI.

How it works

The realm renders each form with p/jeronimoalbi/mdform. gnoweb turns that markdown into a real HTML form whose submit builds a /vm.m_call to Submit, mapping every input to the Submit parameter of the same name. A respondent fills the form in a browser, signs with their wallet, and the answers land in realm state. No frontend, no backend, no indexer.

Slugs

A form's ID is a slug chosen at creation — lowercase letters, digits and single hyphens, 3 to 48 characters, unique per realm. It is the URL segment: /r/<ns>/forms:valoper-questionnaire. Response IDs are sequential.

Field encoding

Create takes four parallel, pipe-separated strings so it stays usable from gnokey and gnoweb without structured arguments:

Example
1labels:   "Name|Why gno.land?|Server type"
2kinds:    "text|textarea|select"
3required: "1|1|0"
4options:  "||cloud,on-prem,data-center"

Kinds are text, textarea, number and select. Options are comma-separated and only read for select fields. A form has at most MaxFields (8) fields; Submit accordingly takes eight answer slots, of which the form's field count are read and the rest must be empty. gnoweb passes "" for any parameter the form does not render an input for.

Who pays

Respondents pay the storage deposit for their own answers, which is the spam resistance. Withdraw deletes a response and the chain refunds the deposit to the caller — which is why only the author may withdraw: a deletion by the owner would refund the owner with the respondent's coins.

What is public

Everything. Answers, who gave them, and when are all readable by anyone from realm state and from the transactions themselves. This realm is for information that can be public. Sealed responses would need encryption on the respondent's side before the transaction exists, which gnoweb cannot do on a realm's behalf; that is a deliberate non-goal of v1.

Routes

Example
1/r/<ns>/forms                     index
2/r/<ns>/forms:<id>                a form, fillable
3/r/<ns>/forms:<id>/responses      responses, paginated
4/r/<ns>/forms:<id>/responses.csv  responses as CSV in a code block

Functions

Close

func Close(cur realm, id string)

Close stops a form from accepting responses. Owner only.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/nym-encapsulate001/test4" -func "Close" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/nym-encapsulate001/test4" -func "Close" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx
  

Create

func Create(cur realm, slug, title, description, labels, kinds, required, options string, onePerAddr bool, deadline int64) string

Create publishes a new form under slug, which becomes its ID and its URL segment (/r/<ns>/forms:<slug>). Slugs are unique per realm.

Fields are described by four parallel, pipe-separated strings so the call stays usable from gnokey and gnoweb without structured arguments:

Example
1labels:   "Name|Why gno.land?|Server type"
2kinds:    "text|textarea|select"
3required: "1|1|0"
4options:  "||cloud,on-prem,data-center"   (comma-separated; only select uses it)

deadline is a chain height after which the form stops accepting responses, or 0 for none. onePerAddr limits each address to a single response.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/nym-encapsulate001/test4" -func "Create" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/nym-encapsulate001/test4" -func "Create" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx
  

CreateForm

func CreateForm(cur realm, slug, title, description string, l1, k1, r1, o1 string, l2, k2, r2, o2 string, l3, k3, r3, o3 string, l4, k4, r4, o4 string, l5, k5, r5, o5 string, l6, k6, r6, o6 string, l7, k7, r7, o7 string, l8, k8, r8, o8 string, onePerAddr, deadline string, ) string

CreateForm is Create for the browser: the index page renders it as a gnoweb form, one row per field, so nothing has to be typed into the wallet.

Every parameter is a string because gnoweb submits "" for an empty or unchecked input, and "" is not a bool or an int64 as far as the VM is concerned. Checkboxes send "1" when ticked. Blank rows are skipped; a row with an empty kind is text. deadline "" means none.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/nym-encapsulate001/test4" -func "CreateForm" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/nym-encapsulate001/test4" -func "CreateForm" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx
  

FormCount

func FormCount() int

FormCount returns how many forms exist.

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/nym-encapsulate001/test4.FormCount()"

Result

Render

func Render(path string) string

Render routes:

Example
1/r/<ns>/forms                     index of forms
2/r/<ns>/forms:<id>                a form, fillable in gnoweb
3/r/<ns>/forms:<id>/responses      its responses, paginated
4/r/<ns>/forms:<id>/responses.csv  its responses as CSV

Param

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/nym-encapsulate001/test4.Render()"

Result

Reopen

func Reopen(cur realm, id string)

Reopen lets a closed form accept responses again. Owner only. A form whose deadline has passed stays closed regardless.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/nym-encapsulate001/test4" -func "Reopen" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/nym-encapsulate001/test4" -func "Reopen" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx
  

ResponseCount

func ResponseCount(id string) int

ResponseCount returns the number of responses a form has, or 0 if the form does not exist.

Param

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/nym-encapsulate001/test4.ResponseCount()"

Result

Submit

func Submit(cur realm, id string, a1, a2, a3, a4, a5, a6, a7, a8 string)

Submit records a response to a form. Answers a1..a8 align with the form's fields in order; slots beyond the form's field count must be empty.

gnoweb builds this call from the rendered form: each input is named after the parameter it fills, and parameters with no input arrive as "".

The respondent pays the storage deposit for their own answers, and gets it back on Withdraw.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/nym-encapsulate001/test4" -func "Submit" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/nym-encapsulate001/test4" -func "Submit" -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx
  

TransferOwnership

func TransferOwnership(cur realm, id string, to address)

TransferOwnership hands a form to another address. Owner only.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/nym-encapsulate001/test4" -func "TransferOwnership" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/nym-encapsulate001/test4" -func "TransferOwnership" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx
  

Withdraw

func Withdraw(cur realm, id string)

Withdraw deletes the caller's response to a form. The storage deposit the answers were holding is refunded to the caller by the chain.

Only the author can withdraw. Owners cannot delete responses: the refund goes to whoever deletes, which would hand the owner the respondent's deposit.

Param

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/nym-encapsulate001/test4" -func "Withdraw" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "pearl-1" -remote "https://rpc.pearl.testnets.gno.land" ADDRESSgnokey query -remote "https://rpc.pearl.testnets.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/nym-encapsulate001/test4" -func "Withdraw" -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "pearl-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.pearl.testnets.gno.land" call.tx
  

GetForm

func GetForm(id string) (*Form, bool)

GetForm returns a form by ID.

Param

Command

gnokey query vm/qeval -remote "https://rpc.pearl.testnets.gno.land" -data "gno.land/r/nym-encapsulate001/test4.GetForm()"

Result