Skip to content Search Apps Documentation Source Content Run Reset Eval Playground 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.

wrapping.gno

0.88 Kb · 35 lines
 1package wrapping
 2
 3import (
 4	"crypto/sha256"
 5	"encoding/hex"
 6	"strconv"
 7	"strings"
 8)
 9
10// Dispatch returns the stamp for a numbered parcel.
11func Dispatch(parcel int) string {
12	digest := sha256.Sum256([]byte("gnoel/dispatch/v2/" + strconv.Itoa(parcel)))
13	return "SNOWBALL-" + strings.ToUpper(hex.EncodeToString(digest[:6]))
14}
15
16func Render(_ string) string {
17	return `# Rudolph's dispatch firmware
18
19Inspect the Gno source, then open [Help and Eval](/r/g1f4k94fjje9tpeekkrnyv2qc7stwxdqp9vcfjg8/wrapping/v0$help#func-Dispatch) to query it.
20
21` + "\n" + "```go\n" + `package wrapping
22
23import (
24	"crypto/sha256"
25	"encoding/hex"
26	"strconv"
27	"strings"
28)
29
30// Dispatch returns the stamp for a numbered parcel.
31func Dispatch(parcel int) string {
32	digest := sha256.Sum256([]byte("gnoel/dispatch/v2/" + strconv.Itoa(parcel)))
33	return "SNOWBALL-" + strings.ToUpper(hex.EncodeToString(digest[:6]))
34}` + "\n```\n"
35}