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

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

v1 source realm

Package gnotif is a registry of notification triggers. Each trigger names a realm and an event type to watch, and the...

Overview

Package gnotif is a registry of notification triggers. Each trigger names a realm and an event type to watch, and the text of the notification that gnotif servers send when a matching event lands on chain. A later registry version follows the rules in https://gnotif.xyz/docs/how-it-works/#rules-for-a-new-registry-version.

Constants 1

const Subpath

1const Subpath = "gnotif"
source

Subpath is the subpath of a realm's gnotif identity: me := cur.Sub(gnotif.Subpath).

Functions 5

func Active

Action
1func Active(target string) string
source

Active lists target's active trigger ids, comma-separated, oldest first.

func Drop

crossing Action
1func Drop(cur realm, target, ids string)
source

Drop removes target's listed active triggers, ids separated by commas. Spaces around an id are ignored. Only target's namespace owner may call it, directly, with their own key. A call that lists an id more than once, or one that is not an active trigger of target, removes nothing. Drop leaves the realm's handle live: Revoke stops the realm from setting them again.

func Render

1func Render(path string) string
source

Render serves "" (the first page), "page/N", "trigger/<id>" and "target/<path>".

func Revoke

crossing Action
1func Revoke(cur realm, target string)
source

Revoke ends target's handle: its methods panic from then on, and target's triggers stay. The realm can Open a new handle. Only target's namespace owner may call it, directly, with their own key.

func Open

crossing Action
1func Open(cur realm) *Handle
source

Open returns the handle that changes the triggers of the realm whose gnotif identity calls it. It panics while the realm holds a handle its namespace owner has not revoked, and unless that owner signed the transaction and sent it straight to the realm.

Types 2

type Handle

struct
1type Handle struct {
2	target   string
3	approver string // the namespace owner who signed the Open
4}
source

Handle changes the triggers of the realm that opened it. Each method also needs that realm's gnotif identity as its caller, so the pointer alone is useless to any other realm.

Methods on Handle

func Remove

crossing method on Handle
1func (h *Handle) Remove(cur realm, name string)
source

Remove removes the trigger under name, and with it every user's choice to receive it.

func Set

crossing method on Handle
1func (h *Handle) Set(cur realm, name string, t Trigger) string
source

Set stores t under name and returns its id. A new name gets a new id. On a name in use, t must watch the same event, filter and param: the id stays, so users who turned the trigger on keep it.

type Trigger

ident
1type Trigger = trigger.Trigger
source

Trigger is an alias, so a dapp imports only the registry.

Dependencies

Source Files 5