# `gno.land/p/moul/txlink` Build a clickable "call this function" link for a realm's `Render` output, so a page can offer a transaction instead of telling the reader what to type. ```go // current realm, one arg txlink.Call("AddTodo", "todo", "buy milk") // -> /r/moul/home$help&func=AddTodo&todo=buy+milk // builder, with a send amount txlink.NewLink("Donate"). AddArgs("message", "thanks"). SetSend("1000000ugnot"). URL() ``` The output is the gnoweb `$help&func=` form: following it opens the help page with the function selected and the arguments pre-filled. The user still signs. Nothing here broadcasts, and nothing here can. ## Three prefixes, picked for you `Realm.prefix()` decides what the link is relative to: | `Realm` value | link | | --- | --- | | `""` (the default) | the **current** realm, read from `CurrentRealm().PkgPath()` | | a path on this chain | `/r/...`, chain domain trimmed | | a path on another chain | `https:///r/...` | So `txlink.Call(...)` in a realm links to itself, and `txlink.Realm("gno.land/r/other/x").Call(...)` links to a neighbour, without either caller hardcoding a domain. Do not build the string yourself: a hardcoded self-link is wrong the moment the realm moves, which [`r/moul/demo/render`](../../../r/moul/demo/render) still demonstrates by accident. ## Details that bite - **Arguments are key/value pairs, so an odd count panics.** `AddArgs` takes them flat (`"k1", "v1", "k2", "v2"`). - **A key starting with `.` panics.** `.send` is reserved; use `SetSend`. - **The builder is nil-safe.** `NewLink("")` returns nil and every method on a nil builder returns nil, so a chain never panics halfway; `URL()` on it returns `""`. - `func=` is kept first in the query string on purpose, ahead of the url-encoded rest, so the links stay readable. Related: [`p/moul/helplink`](../helplink) is the fuller version of the same idea; `txlink` is the streamlined one. For parsing the path on the way **in**, see [`p/moul/realmpath`](../realmpath). --- Part of **[moul/gno-contracts](https://github.com/moul/gno-contracts)** — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage. > ⚠️ **Disclaimer:** provided as-is, without warranty; not security-audited. Full disclaimer: [DISCLAIMER](https://github.com/moul/gno-contracts/blob/main/DISCLAIMER.md).