diff --git a/examples/gno.land/p/demo/boards/board.gno b/examples/gno.land/p/demo/boards/board.gno new file mode 100644 index 00000000000..2e488b85be9 --- /dev/null +++ b/examples/gno.land/p/demo/boards/board.gno @@ -0,0 +1,137 @@ +package boards + +import ( + "std" + "strconv" + "time" + + "gno.land/p/demo/avl" +) + +//---------------------------------------- +// Board + +type BoardID uint64 + +func BoardIDKey(bid BoardID) string { + return padZero(uint64(bid), 10) +} + +func (bid BoardID) String() string { + return strconv.Itoa(int(bid)) +} + +type Board struct { + id BoardID // only set for public boards. + url string + name string + creator std.Address + threads avl.Tree // Post.id -> *Post + postsCtr uint64 // increments Post.id + createdAt time.Time + deleted avl.Tree // TODO reserved for fast-delete. +} + +/* TODO support this once we figure out how to ensure URL correctness. +// A private board is not tracked by gBoards*, +// but must be persisted by the caller's realm. +// Private boards have 0 id and does not ping +// back the remote board on reposts. +func NewPrivateBoard(url string, name string, creator std.Address) *Board { + return newBoard(0, url, name, creator) +} +*/ + +func NewBoard(id BoardID, url string, name string, creator std.Address) *Board { + return &Board{ + id: id, + url: url, + name: name, + creator: creator, + threads: avl.Tree{}, + createdAt: time.Now(), + deleted: avl.Tree{}, + } +} + +func (board *Board) Id() BoardID { + return board.id +} + +func (board *Board) Url() string { + return board.url +} + +func (board *Board) Name() string { + return board.name +} + +func (board *Board) Creator() std.Address { + return board.creator +} + +func (board *Board) Threads() avl.Tree { + return board.threads +} + +func (board *Board) CreatedAt() time.Time { + return board.createdAt +} + +func (board *Board) IsPrivate() bool { + return board.id == 0 +} + +func (board *Board) GetThread(pid PostID) *Post { + pidkey := postIDKey(pid) + postI, exists := board.threads.Get(pidkey) + if !exists { + return nil + } + return postI.(*Post) +} + +func (board *Board) AddThread(creator std.Address, title string, body string) *Post { + pid := board.incGetPostID() + pidkey := postIDKey(pid) + thread := NewPost(board, pid, creator, title, body, pid, 0, 0) + board.threads.Set(pidkey, thread) + return thread +} + +// NOTE: this can be potentially very expensive for threads with many replies. +// TODO: implement optional fast-delete where thread is simply moved. +func (board *Board) DeleteThread(pid PostID) { + pidkey := postIDKey(pid) + _, removed := board.threads.Remove(pidkey) + if !removed { + panic("thread does not exist with id " + pid.String()) + } +} + +func (board *Board) HasPermission(addr std.Address, perm Permission) bool { + if board.creator == addr { + switch perm { + case EditPermission: + return true + case DeletePermission: + return true + default: + return false + } + } + return false +} + +func (board *Board) incGetPostID() PostID { + board.postsCtr++ + return PostID(board.postsCtr) +} + +func (board *Board) GetURLFromThreadAndReplyID(threadID, replyID PostID) string { + if replyID == 0 { + return board.url + "/" + threadID.String() + } else { + return board.url + "/" + threadID.String() + "/" + replyID.String() + } +} diff --git a/examples/gno.land/p/demo/boards/gno.mod b/examples/gno.land/p/demo/boards/gno.mod new file mode 100644 index 00000000000..8aca345734f --- /dev/null +++ b/examples/gno.land/p/demo/boards/gno.mod @@ -0,0 +1,3 @@ +module gno.land/p/demo/boards + +require gno.land/p/demo/avl v0.0.0-latest diff --git a/examples/gno.land/p/demo/boards/misc.gno b/examples/gno.land/p/demo/boards/misc.gno new file mode 100644 index 00000000000..11859f062dc --- /dev/null +++ b/examples/gno.land/p/demo/boards/misc.gno @@ -0,0 +1,32 @@ +package boards + +import ( + "strconv" + "strings" +) + +func postIDKey(pid PostID) string { + return padZero(uint64(pid), 10) +} + +func padZero(u64 uint64, length int) string { + str := strconv.Itoa(int(u64)) + if len(str) >= length { + return str + } else { + return strings.Repeat("0", length-len(str)) + str + } +} + +// NOTE: length must be greater than 3. +func summaryOf(str string, length int) string { + lines := strings.SplitN(str, "\n", 2) + line := lines[0] + if len(line) > length { + line = line[:(length-3)] + "..." + } else if len(lines) > 1 { + // len(line) <= 80 + line = line + "..." + } + return line +} diff --git a/examples/gno.land/p/demo/boards/post.gno b/examples/gno.land/p/demo/boards/post.gno new file mode 100644 index 00000000000..06ab58d74ec --- /dev/null +++ b/examples/gno.land/p/demo/boards/post.gno @@ -0,0 +1,199 @@ +package boards + +import ( + "std" + "strconv" + "time" + + "gno.land/p/demo/avl" +) + +//---------------------------------------- +// Post + +// NOTE: a PostID is relative to the board. +type PostID uint64 + +func (pid PostID) String() string { + return strconv.Itoa(int(pid)) +} + +// A Post is a "thread" or a "reply" depending on context. +// A thread is a Post of a Board that holds other replies. +type Post struct { + board *Board + id PostID + creator std.Address + title string // optional + body string + replies avl.Tree // Post.id -> *Post + repliesAll avl.Tree // Post.id -> *Post (all replies, for top-level posts) + reposts avl.Tree // Board.id -> Post.id + threadID PostID // original Post.id + parentID PostID // parent Post.id (if reply or repost) + repostBoard BoardID // original Board.id (if repost) + createdAt time.Time + updatedAt time.Time +} + +func NewPost(board *Board, id PostID, creator std.Address, title, body string, threadID, parentID PostID, repostBoard BoardID) *Post { + return &Post{ + board: board, + id: id, + creator: creator, + title: title, + body: body, + replies: avl.Tree{}, + repliesAll: avl.Tree{}, + reposts: avl.Tree{}, + threadID: threadID, + parentID: parentID, + repostBoard: repostBoard, + createdAt: time.Now(), + } +} + +func (post *Post) Board() Board { + return *post.board +} + +func (post *Post) Id() PostID { + return post.id +} + +func (post *Post) Creator() std.Address { + return post.creator +} + +func (post *Post) Title() string { + return post.title +} + +func (post *Post) Body() string { + return post.body +} + +func (post *Post) Replies() avl.Tree { + return post.replies +} + +func (post *Post) RepliesAll() avl.Tree { + return post.repliesAll +} + +func (post *Post) Reposts() avl.Tree { + return post.reposts +} + +func (post *Post) ThreadID() PostID { + return post.threadID +} + +func (post *Post) ParentID() PostID { + return post.parentID +} + +func (post *Post) IsThread() bool { + return post.parentID == 0 +} + +func (post *Post) RepostBoard() BoardID { + return post.repostBoard +} + +func (post *Post) CreatedAt() time.Time { + return post.createdAt +} + +func (post *Post) AddReply(creator std.Address, body string) *Post { + board := post.board + pid := board.incGetPostID() + pidkey := postIDKey(pid) + reply := NewPost(board, pid, creator, "", body, post.threadID, post.id, 0) + post.replies.Set(pidkey, reply) + if post.threadID == post.id { + post.repliesAll.Set(pidkey, reply) + } else { + thread := board.GetThread(post.threadID) + thread.repliesAll.Set(pidkey, reply) + } + return reply +} + +func (post *Post) Update(title string, body string) { + post.title = title + post.body = body + post.updatedAt = time.Now() +} + +func (thread *Post) GetReply(pid PostID) *Post { + pidkey := postIDKey(pid) + replyI, ok := thread.repliesAll.Get(pidkey) + if !ok { + return nil + } else { + return replyI.(*Post) + } +} + +func (post *Post) AddRepostTo(creator std.Address, title, body string, dst *Board) *Post { + if !post.IsThread() { + panic("cannot repost non-thread post") + } + pid := dst.incGetPostID() + pidkey := postIDKey(pid) + repost := NewPost(dst, pid, creator, title, body, pid, post.id, post.board.id) + dst.threads.Set(pidkey, repost) + if !dst.IsPrivate() { + bidkey := BoardIDKey(dst.id) + post.reposts.Set(bidkey, pid) + } + return repost +} + +func (thread *Post) DeletePost(pid PostID) { + if thread.id == pid { + panic("should not happen") + } + pidkey := postIDKey(pid) + postI, removed := thread.repliesAll.Remove(pidkey) + if !removed { + panic("post not found in thread") + } + post := postI.(*Post) + if post.parentID != thread.id { + parent := thread.GetReply(post.parentID) + parent.replies.Remove(pidkey) + } else { + thread.replies.Remove(pidkey) + } +} + +func (post *Post) HasPermission(addr std.Address, perm Permission) bool { + if post.creator == addr { + switch perm { + case EditPermission: + return true + case DeletePermission: + return true + default: + return false + } + } + // post notes inherit permissions of the board. + return post.board.HasPermission(addr, perm) +} + +func (post *Post) GetSummary() string { + return summaryOf(post.body, 80) +} + +func (post *Post) GetURL() string { + if post.IsThread() { + return post.board.GetURLFromThreadAndReplyID( + post.id, 0) + } else { + return post.board.GetURLFromThreadAndReplyID( + post.threadID, post.id) + } +} diff --git a/examples/gno.land/r/demo/boards/role.gno b/examples/gno.land/p/demo/boards/role.gno similarity index 100% rename from examples/gno.land/r/demo/boards/role.gno rename to examples/gno.land/p/demo/boards/role.gno diff --git a/examples/gno.land/p/demo/groups/gno.mod b/examples/gno.land/p/demo/groups/gno.mod index f0749e3f411..fa7a7a33450 100644 --- a/examples/gno.land/p/demo/groups/gno.mod +++ b/examples/gno.land/p/demo/groups/gno.mod @@ -1,6 +1,6 @@ module gno.land/p/demo/groups require ( + gno.land/p/demo/boards v0.0.0-latest gno.land/p/demo/rat v0.0.0-latest - gno.land/r/demo/boards v0.0.0-latest ) diff --git a/examples/gno.land/p/demo/groups/groups.gno b/examples/gno.land/p/demo/groups/groups.gno index d7315ac982c..04dfa8f1a90 100644 --- a/examples/gno.land/p/demo/groups/groups.gno +++ b/examples/gno.land/p/demo/groups/groups.gno @@ -1,7 +1,7 @@ package groups import ( - "gno.land/r/demo/boards" + "gno.land/p/demo/boards" ) // TODO implement something and test. diff --git a/examples/gno.land/r/demo/boards/board.gno b/examples/gno.land/r/demo/boards/board.gno index a9cf56c2a91..e6c7a85c167 100644 --- a/examples/gno.land/r/demo/boards/board.gno +++ b/examples/gno.land/r/demo/boards/board.gno @@ -1,140 +1,30 @@ package boards import ( - "std" - "strconv" - "time" - - "gno.land/p/demo/avl" + "gno.land/p/demo/boards" ) -//---------------------------------------- -// Board - -type BoardID uint64 - -func (bid BoardID) String() string { - return strconv.Itoa(int(bid)) -} - -type Board struct { - id BoardID // only set for public boards. - url string - name string - creator std.Address - threads avl.Tree // Post.id -> *Post - postsCtr uint64 // increments Post.id - createdAt time.Time - deleted avl.Tree // TODO reserved for fast-delete. -} - -func newBoard(id BoardID, url string, name string, creator std.Address) *Board { - if !reName.MatchString(name) { - panic("invalid name: " + name) - } - exists := gBoardsByName.Has(name) - if exists { - panic("board already exists") - } - return &Board{ - id: id, - url: url, - name: name, - creator: creator, - threads: avl.Tree{}, - createdAt: time.Now(), - deleted: avl.Tree{}, - } -} - -/* TODO support this once we figure out how to ensure URL correctness. -// A private board is not tracked by gBoards*, -// but must be persisted by the caller's realm. -// Private boards have 0 id and does not ping -// back the remote board on reposts. -func NewPrivateBoard(url string, name string, creator std.Address) *Board { - return newBoard(0, url, name, creator) -} -*/ - -func (board *Board) IsPrivate() bool { - return board.id == 0 -} - -func (board *Board) GetThread(pid PostID) *Post { - pidkey := postIDKey(pid) - postI, exists := board.threads.Get(pidkey) - if !exists { - return nil - } - return postI.(*Post) -} - -func (board *Board) AddThread(creator std.Address, title string, body string) *Post { - pid := board.incGetPostID() - pidkey := postIDKey(pid) - thread := newPost(board, pid, creator, title, body, pid, 0, 0) - board.threads.Set(pidkey, thread) - return thread -} - -// NOTE: this can be potentially very expensive for threads with many replies. -// TODO: implement optional fast-delete where thread is simply moved. -func (board *Board) DeleteThread(pid PostID) { - pidkey := postIDKey(pid) - _, removed := board.threads.Remove(pidkey) - if !removed { - panic("thread does not exist with id " + pid.String()) - } -} - -func (board *Board) HasPermission(addr std.Address, perm Permission) bool { - if board.creator == addr { - switch perm { - case EditPermission: - return true - case DeletePermission: - return true - default: - return false - } - } - return false -} - // Renders the board for display suitable as plaintext in // console. This is suitable for demonstration or tests, // but not for prod. -func (board *Board) RenderBoard() string { +func RenderBoard(board *boards.Board) string { str := "" - str += "\\[[post](" + board.GetPostFormURL() + ")]\n\n" - if board.threads.Size() > 0 { - board.threads.Iterate("", "", func(key string, value interface{}) bool { + str += "\\[[post](" + GetPostFormURL(board) + ")]\n\n" + threads := board.Threads() + if threads.Size() > 0 { + threads.Iterate("", "", func(key string, value interface{}) bool { if str != "" { str += "----------------------------------------\n" } - str += value.(*Post).RenderSummary() + "\n" + str += RenderSummary(value.(*boards.Post)) + "\n" return false }) } return str } -func (board *Board) incGetPostID() PostID { - board.postsCtr++ - return PostID(board.postsCtr) -} - -func (board *Board) GetURLFromThreadAndReplyID(threadID, replyID PostID) string { - if replyID == 0 { - return board.url + "/" + threadID.String() - } else { - return board.url + "/" + threadID.String() + "/" + replyID.String() - } -} - -func (board *Board) GetPostFormURL() string { +func GetPostFormURL(board *boards.Board) string { return "/r/demo/boards?help&__func=CreateThread" + - "&bid=" + board.id.String() + + "&bid=" + board.Id().String() + "&body.type=textarea" } diff --git a/examples/gno.land/r/demo/boards/gno.mod b/examples/gno.land/r/demo/boards/gno.mod index 434ad019883..008678d394b 100644 --- a/examples/gno.land/r/demo/boards/gno.mod +++ b/examples/gno.land/r/demo/boards/gno.mod @@ -2,5 +2,6 @@ module gno.land/r/demo/boards require ( gno.land/p/demo/avl v0.0.0-latest + gno.land/p/demo/boards v0.0.0-latest gno.land/r/demo/users v0.0.0-latest ) diff --git a/examples/gno.land/r/demo/boards/misc.gno b/examples/gno.land/r/demo/boards/misc.gno index bc561ca7d22..1ae7bc7fa58 100644 --- a/examples/gno.land/r/demo/boards/misc.gno +++ b/examples/gno.land/r/demo/boards/misc.gno @@ -2,9 +2,9 @@ package boards import ( "std" - "strconv" "strings" + "gno.land/p/demo/boards" "gno.land/r/demo/users" ) @@ -12,44 +12,36 @@ import ( // private utility methods // XXX ensure these cannot be called from public. -func getBoard(bid BoardID) *Board { - bidkey := boardIDKey(bid) +func getBoard(bid boards.BoardID) *boards.Board { + bidkey := boards.BoardIDKey(bid) board_, exists := gBoards.Get(bidkey) if !exists { return nil } - board := board_.(*Board) + board := board_.(*boards.Board) return board } -func incGetBoardID() BoardID { +func incGetBoardID() boards.BoardID { gBoardsCtr++ - return BoardID(gBoardsCtr) + return boards.BoardID(gBoardsCtr) } -func padLeft(str string, length int) string { - if len(str) >= length { - return str +func displayAddressMD(addr std.Address) string { + user := users.GetUserByAddress(addr) + if user == nil { + return "[" + addr.String() + "](/r/demo/users:" + addr.String() + ")" } else { - return strings.Repeat(" ", length-len(str)) + str + return "[@" + user.Name + "](/r/demo/users:" + user.Name + ")" } } -func padZero(u64 uint64, length int) string { - str := strconv.Itoa(int(u64)) - if len(str) >= length { - return str - } else { - return strings.Repeat("0", length-len(str)) + str +func usernameOf(addr std.Address) string { + user := users.GetUserByAddress(addr) + if user == nil { + return "" } -} - -func boardIDKey(bid BoardID) string { - return padZero(uint64(bid), 10) -} - -func postIDKey(pid PostID) string { - return padZero(uint64(pid), 10) + return user.Name } func indentBody(indent string, body string) string { @@ -76,20 +68,3 @@ func summaryOf(str string, length int) string { } return line } - -func displayAddressMD(addr std.Address) string { - user := users.GetUserByAddress(addr) - if user == nil { - return "[" + addr.String() + "](/r/demo/users:" + addr.String() + ")" - } else { - return "[@" + user.Name + "](/r/demo/users:" + user.Name + ")" - } -} - -func usernameOf(addr std.Address) string { - user := users.GetUserByAddress(addr) - if user == nil { - return "" - } - return user.Name -} diff --git a/examples/gno.land/r/demo/boards/post.gno b/examples/gno.land/r/demo/boards/post.gno index f35cf23628c..c1a64f682ab 100644 --- a/examples/gno.land/r/demo/boards/post.gno +++ b/examples/gno.land/r/demo/boards/post.gno @@ -1,263 +1,128 @@ package boards import ( - "std" "strconv" - "time" - "gno.land/p/demo/avl" + "gno.land/p/demo/boards" ) -//---------------------------------------- -// Post - -// NOTE: a PostID is relative to the board. -type PostID uint64 - -func (pid PostID) String() string { - return strconv.Itoa(int(pid)) -} - -// A Post is a "thread" or a "reply" depending on context. -// A thread is a Post of a Board that holds other replies. -type Post struct { - board *Board - id PostID - creator std.Address - title string // optional - body string - replies avl.Tree // Post.id -> *Post - repliesAll avl.Tree // Post.id -> *Post (all replies, for top-level posts) - reposts avl.Tree // Board.id -> Post.id - threadID PostID // original Post.id - parentID PostID // parent Post.id (if reply or repost) - repostBoard BoardID // original Board.id (if repost) - createdAt time.Time - updatedAt time.Time -} - -func newPost(board *Board, id PostID, creator std.Address, title, body string, threadID, parentID PostID, repostBoard BoardID) *Post { - return &Post{ - board: board, - id: id, - creator: creator, - title: title, - body: body, - replies: avl.Tree{}, - repliesAll: avl.Tree{}, - reposts: avl.Tree{}, - threadID: threadID, - parentID: parentID, - repostBoard: repostBoard, - createdAt: time.Now(), - } -} - -func (post *Post) IsThread() bool { - return post.parentID == 0 -} - -func (post *Post) GetPostID() PostID { - return post.id -} - -func (post *Post) AddReply(creator std.Address, body string) *Post { - board := post.board - pid := board.incGetPostID() - pidkey := postIDKey(pid) - reply := newPost(board, pid, creator, "", body, post.threadID, post.id, 0) - post.replies.Set(pidkey, reply) - if post.threadID == post.id { - post.repliesAll.Set(pidkey, reply) - } else { - thread := board.GetThread(post.threadID) - thread.repliesAll.Set(pidkey, reply) - } - return reply -} - -func (post *Post) Update(title string, body string) { - post.title = title - post.body = body - post.updatedAt = time.Now() -} - -func (thread *Post) GetReply(pid PostID) *Post { - pidkey := postIDKey(pid) - replyI, ok := thread.repliesAll.Get(pidkey) - if !ok { - return nil - } else { - return replyI.(*Post) - } -} - -func (post *Post) AddRepostTo(creator std.Address, title, body string, dst *Board) *Post { - if !post.IsThread() { - panic("cannot repost non-thread post") - } - pid := dst.incGetPostID() - pidkey := postIDKey(pid) - repost := newPost(dst, pid, creator, title, body, pid, post.id, post.board.id) - dst.threads.Set(pidkey, repost) - if !dst.IsPrivate() { - bidkey := boardIDKey(dst.id) - post.reposts.Set(bidkey, pid) - } - return repost -} - -func (thread *Post) DeletePost(pid PostID) { - if thread.id == pid { - panic("should not happen") - } - pidkey := postIDKey(pid) - postI, removed := thread.repliesAll.Remove(pidkey) - if !removed { - panic("post not found in thread") - } - post := postI.(*Post) - if post.parentID != thread.id { - parent := thread.GetReply(post.parentID) - parent.replies.Remove(pidkey) - } else { - thread.replies.Remove(pidkey) - } -} - -func (post *Post) HasPermission(addr std.Address, perm Permission) bool { - if post.creator == addr { - switch perm { - case EditPermission: - return true - case DeletePermission: - return true - default: - return false - } - } - // post notes inherit permissions of the board. - return post.board.HasPermission(addr, perm) -} - -func (post *Post) GetSummary() string { - return summaryOf(post.body, 80) -} - -func (post *Post) GetURL() string { - if post.IsThread() { - return post.board.GetURLFromThreadAndReplyID( - post.id, 0) - } else { - return post.board.GetURLFromThreadAndReplyID( - post.threadID, post.id) - } -} - -func (post *Post) GetReplyFormURL() string { +func GetReplyFormURL(post *boards.Post) string { + board := post.Board() + bid := board.Id() return "/r/demo/boards?help&__func=CreateReply" + - "&bid=" + post.board.id.String() + - "&threadid=" + post.threadID.String() + - "&postid=" + post.id.String() + + "&bid=" + bid.String() + + "&threadid=" + post.ThreadID().String() + + "&postid=" + post.Id().String() + "&body.type=textarea" } -func (post *Post) GetRepostFormURL() string { +func GetRepostFormURL(post *boards.Post) string { + board := post.Board() + bid := board.Id() return "/r/demo/boards?help&__func=CreateRepost" + - "&bid=" + post.board.id.String() + - "&postid=" + post.id.String() + + "&bid=" + bid.String() + + "&postid=" + post.Id().String() + "&title.type=textarea" + "&body.type=textarea" + "&dstBoardID.type=textarea" } -func (post *Post) GetDeleteFormURL() string { +func GetDeleteFormURL(post *boards.Post) string { + board := post.Board() + bid := board.Id() return "/r/demo/boards?help&__func=DeletePost" + - "&bid=" + post.board.id.String() + - "&threadid=" + post.threadID.String() + - "&postid=" + post.id.String() + "&bid=" + bid.String() + + "&threadid=" + post.ThreadID().String() + + "&postid=" + post.Id().String() } -func (post *Post) RenderSummary() string { - if post.repostBoard != 0 { - dstBoard := getBoard(post.repostBoard) +func RenderSummary(post *boards.Post) string { + if post.RepostBoard() != 0 { + dstBoard := getBoard(post.RepostBoard()) if dstBoard == nil { panic("repostBoard does not exist") } - thread := dstBoard.GetThread(PostID(post.parentID)) + thread := dstBoard.GetThread(boards.PostID(post.ParentID())) if thread == nil { return "reposted post does not exist" } - return "Repost: " + post.GetSummary() + "\n" + thread.RenderSummary() + return "Repost: " + post.GetSummary() + "\n" + RenderSummary(thread) } + + replies := post.Replies() + reposts := post.Reposts() + str := "" - if post.title != "" { - str += "## [" + summaryOf(post.title, 80) + "](" + post.GetURL() + ")\n" + if post.Title() != "" { + str += "## [" + summaryOf(post.Title(), 80) + "](" + post.GetURL() + ")\n" str += "\n" } str += post.GetSummary() + "\n" - str += "\\- " + displayAddressMD(post.creator) + "," - str += " [" + post.createdAt.Format("2006-01-02 3:04pm MST") + "](" + post.GetURL() + ")" - str += " \\[[x](" + post.GetDeleteFormURL() + ")]" - str += " (" + strconv.Itoa(post.replies.Size()) + " replies)" - str += " (" + strconv.Itoa(post.reposts.Size()) + " reposts)" + "\n" + str += "\\- " + displayAddressMD(post.Creator()) + "," + str += " [" + post.CreatedAt().Format("2006-01-02 3:04pm MST") + "](" + post.GetURL() + ")" + str += " \\[[x](" + GetDeleteFormURL(post) + ")]" + str += " (" + strconv.Itoa(replies.Size()) + " replies)" + str += " (" + strconv.Itoa(reposts.Size()) + " reposts)" + "\n" return str } -func (post *Post) RenderPost(indent string, levels int) string { +func RenderPost(post *boards.Post, indent string, levels int) string { if post == nil { return "nil post" } str := "" - if post.title != "" { - str += indent + "# " + post.title + "\n" + if post.Title() != "" { + str += indent + "# " + post.Title() + "\n" str += indent + "\n" } - str += indentBody(indent, post.body) + "\n" // TODO: indent body lines. - str += indent + "\\- " + displayAddressMD(post.creator) + ", " - str += "[" + post.createdAt.Format("2006-01-02 3:04pm (MST)") + "](" + post.GetURL() + ")" - str += " \\[[reply](" + post.GetReplyFormURL() + ")]" + str += indentBody(indent, post.Body()) + "\n" // TODO: indent body lines. + str += indent + "\\- " + displayAddressMD(post.Creator()) + ", " + str += "[" + post.CreatedAt().Format("2006-01-02 3:04pm (MST)") + "](" + post.GetURL() + ")" + str += " \\[[reply](" + GetReplyFormURL(post) + ")]" if post.IsThread() { - str += " \\[[repost](" + post.GetRepostFormURL() + ")]" + str += " \\[[repost](" + GetRepostFormURL(post) + ")]" } - str += " \\[[x](" + post.GetDeleteFormURL() + ")]\n" + str += " \\[[x](" + GetDeleteFormURL(post) + ")]\n" + + replies := post.Replies() if levels > 0 { - if post.replies.Size() > 0 { - post.replies.Iterate("", "", func(key string, value interface{}) bool { + if replies.Size() > 0 { + replies.Iterate("", "", func(key string, value interface{}) bool { str += indent + "\n" - str += value.(*Post).RenderPost(indent+"> ", levels-1) + str += RenderPost(value.(*boards.Post), indent+"> ", levels-1) return false }) } } else { - if post.replies.Size() > 0 { + if replies.Size() > 0 { str += indent + "\n" - str += indent + "_[see all " + strconv.Itoa(post.replies.Size()) + " replies](" + post.GetURL() + ")_\n" + str += indent + "_[see all " + strconv.Itoa(replies.Size()) + " replies](" + post.GetURL() + ")_\n" } } return str } // render reply and link to context thread -func (post *Post) RenderInner() string { +func RenderInner(post *boards.Post) string { if post.IsThread() { panic("unexpected thread") } - threadID := post.threadID - // replyID := post.id - parentID := post.parentID + board := post.Board() + threadID := post.ThreadID() + parentID := post.ParentID() str := "" - str += "_[see thread](" + post.board.GetURLFromThreadAndReplyID( + str += "_[see thread](" + board.GetURLFromThreadAndReplyID( threadID, 0) + ")_\n\n" - thread := post.board.GetThread(post.threadID) - var parent *Post - if thread.id == parentID { + + thread := board.GetThread(post.ThreadID()) + var parent *boards.Post + if thread.Id() == parentID { parent = thread } else { parent = thread.GetReply(parentID) } - str += parent.RenderPost("", 0) + str += RenderPost(parent, "", 0) str += "\n" - str += post.RenderPost("> ", 5) + str += RenderPost(post, "> ", 5) return str } diff --git a/examples/gno.land/r/demo/boards/public.gno b/examples/gno.land/r/demo/boards/public.gno index 1ef2e72f4c2..e7bc45f77b0 100644 --- a/examples/gno.land/r/demo/boards/public.gno +++ b/examples/gno.land/r/demo/boards/public.gno @@ -3,20 +3,22 @@ package boards import ( "std" "strconv" + + "gno.land/p/demo/boards" ) //---------------------------------------- // Public facing functions -func GetBoardIDFromName(name string) (BoardID, bool) { +func GetBoardIDFromName(name string) (boards.BoardID, bool) { boardI, exists := gBoardsByName.Get(name) if !exists { return 0, false } - return boardI.(*Board).id, true + return boardI.(*boards.Board).Id(), true } -func CreateBoard(name string) BoardID { +func CreateBoard(name string) boards.BoardID { std.AssertOriginCall() bid := incGetBoardID() caller := std.GetOrigCaller() @@ -24,11 +26,18 @@ func CreateBoard(name string) BoardID { panic("unauthorized") } url := "/r/demo/boards:" + name - board := newBoard(bid, url, name, caller) - bidkey := boardIDKey(bid) + if !reName.MatchString(name) { + panic("invalid name: " + name) + } + exists := gBoardsByName.Has(name) + if exists { + panic("board already exists") + } + board := boards.NewBoard(bid, url, name, caller) + bidkey := boards.BoardIDKey(bid) gBoards.Set(bidkey, board) gBoardsByName.Set(name, board) - return board.id + return board.Id() } func checkAnonFee() bool { @@ -40,7 +49,7 @@ func checkAnonFee() bool { return false } -func CreateThread(bid BoardID, title string, body string) PostID { +func CreateThread(bid boards.BoardID, title string, body string) boards.PostID { std.AssertOriginCall() caller := std.GetOrigCaller() if usernameOf(caller) == "" { @@ -53,10 +62,10 @@ func CreateThread(bid BoardID, title string, body string) PostID { panic("board not exist") } thread := board.AddThread(caller, title, body) - return thread.id + return thread.Id() } -func CreateReply(bid BoardID, threadid, postid PostID, body string) PostID { +func CreateReply(bid boards.BoardID, threadid, postid boards.PostID, body string) boards.PostID { std.AssertOriginCall() caller := std.GetOrigCaller() if usernameOf(caller) == "" { @@ -74,17 +83,17 @@ func CreateReply(bid BoardID, threadid, postid PostID, body string) PostID { } if postid == threadid { reply := thread.AddReply(caller, body) - return reply.id + return reply.Id() } else { post := thread.GetReply(postid) reply := post.AddReply(caller, body) - return reply.id + return reply.Id() } } // If dstBoard is private, does not ping back. // If board specified by bid is private, panics. -func CreateRepost(bid BoardID, postid PostID, title string, body string, dstBoardID BoardID) PostID { +func CreateRepost(bid boards.BoardID, postid boards.PostID, title string, body string, dstBoardID boards.BoardID) boards.PostID { std.AssertOriginCall() caller := std.GetOrigCaller() if usernameOf(caller) == "" { @@ -109,10 +118,10 @@ func CreateRepost(bid BoardID, postid PostID, title string, body string, dstBoar panic("thread not exist") } repost := thread.AddRepostTo(caller, title, body, dst) - return repost.id + return repost.Id() } -func DeletePost(bid BoardID, threadid, postid PostID, reason string) { +func DeletePost(bid boards.BoardID, threadid, postid boards.PostID, reason string) { std.AssertOriginCall() caller := std.GetOrigCaller() board := getBoard(bid) @@ -125,7 +134,7 @@ func DeletePost(bid BoardID, threadid, postid PostID, reason string) { } if postid == threadid { // delete thread - if !thread.HasPermission(caller, DeletePermission) { + if !thread.HasPermission(caller, boards.DeletePermission) { panic("unauthorized") } board.DeleteThread(threadid) @@ -135,14 +144,14 @@ func DeletePost(bid BoardID, threadid, postid PostID, reason string) { if post == nil { panic("post not exist") } - if !post.HasPermission(caller, DeletePermission) { + if !post.HasPermission(caller, boards.DeletePermission) { panic("unauthorized") } thread.DeletePost(postid) } } -func EditPost(bid BoardID, threadid, postid PostID, title, body string) { +func EditPost(bid boards.BoardID, threadid, postid boards.PostID, title, body string) { std.AssertOriginCall() caller := std.GetOrigCaller() board := getBoard(bid) @@ -155,7 +164,7 @@ func EditPost(bid BoardID, threadid, postid PostID, title, body string) { } if postid == threadid { // edit thread - if !thread.HasPermission(caller, EditPermission) { + if !thread.HasPermission(caller, boards.EditPermission) { panic("unauthorized") } thread.Update(title, body) @@ -165,7 +174,7 @@ func EditPost(bid BoardID, threadid, postid PostID, title, body string) { if post == nil { panic("post not exist") } - if !post.HasPermission(caller, EditPermission) { + if !post.HasPermission(caller, boards.EditPermission) { panic("unauthorized") } post.Update(title, body) diff --git a/examples/gno.land/r/demo/boards/render.gno b/examples/gno.land/r/demo/boards/render.gno index 3709ad02e5d..99fb45f6aa9 100644 --- a/examples/gno.land/r/demo/boards/render.gno +++ b/examples/gno.land/r/demo/boards/render.gno @@ -3,25 +3,27 @@ package boards import ( "strconv" "strings" + + "gno.land/p/demo/boards" ) //---------------------------------------- // Render functions -func RenderBoard(bid BoardID) string { +func RenderBoardById(bid boards.BoardID) string { board := getBoard(bid) if board == nil { return "missing board" } - return board.RenderBoard() + return RenderBoard(board) } func Render(path string) string { if path == "" { str := "These are all the boards of this realm:\n\n" gBoards.Iterate("", "", func(key string, value interface{}) bool { - board := value.(*Board) - str += " * [" + board.url + "](" + board.url + ")\n" + board := value.(*boards.Board) + str += " * [" + board.Url() + "](" + board.Url() + ")\n" return false }) return str @@ -34,7 +36,7 @@ func Render(path string) string { if !exists { return "board does not exist: " + name } - return boardI.(*Board).RenderBoard() + return RenderBoard(boardI.(*boards.Board)) } else if len(parts) == 2 { // /r/demo/boards:BOARD_NAME/THREAD_ID name := parts[0] @@ -46,12 +48,12 @@ func Render(path string) string { if err != nil { return "invalid thread id: " + parts[1] } - board := boardI.(*Board) - thread := board.GetThread(PostID(pid)) + board := boardI.(*boards.Board) + thread := board.GetThread(boards.PostID(pid)) if thread == nil { return "thread does not exist with id: " + parts[1] } - return thread.RenderPost("", 5) + return RenderPost(thread, "", 5) } else if len(parts) == 3 { // /r/demo/boards:BOARD_NAME/THREAD_ID/REPLY_ID name := parts[0] @@ -63,8 +65,8 @@ func Render(path string) string { if err != nil { return "invalid thread id: " + parts[1] } - board := boardI.(*Board) - thread := board.GetThread(PostID(pid)) + board := boardI.(*boards.Board) + thread := board.GetThread(boards.PostID(pid)) if thread == nil { return "thread does not exist with id: " + parts[1] } @@ -72,11 +74,11 @@ func Render(path string) string { if err != nil { return "invalid reply id: " + parts[2] } - reply := thread.GetReply(PostID(rid)) + reply := thread.GetReply(boards.PostID(rid)) if reply == nil { return "reply does not exist with id: " + parts[2] } - return reply.RenderInner() + return RenderInner(reply) } else { return "unrecognized path " + path } diff --git a/examples/gno.land/r/demo/boards/z_0_a_filetest.gno b/examples/gno.land/r/demo/boards/z_0_a_filetest.gno index 872d01dd793..8c44ecdd74d 100644 --- a/examples/gno.land/r/demo/boards/z_0_a_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_0_a_filetest.gno @@ -2,10 +2,11 @@ package boards_test import ( + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" ) -var bid boards.BoardID +var bid pboards.BoardID func init() { bid = boards.CreateBoard("test_board") diff --git a/examples/gno.land/r/demo/boards/z_0_b_filetest.gno b/examples/gno.land/r/demo/boards/z_0_b_filetest.gno index 9ada8abd0c0..d00cfdac5fe 100644 --- a/examples/gno.land/r/demo/boards/z_0_b_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_0_b_filetest.gno @@ -4,11 +4,12 @@ package boards_test // SEND: 199000000ugnot import ( + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) -var bid boards.BoardID +var bid pboards.BoardID func init() { users.Register("", "gnouser", "my profile") diff --git a/examples/gno.land/r/demo/boards/z_0_c_filetest.gno b/examples/gno.land/r/demo/boards/z_0_c_filetest.gno index 36b7bcfda04..781bace5945 100644 --- a/examples/gno.land/r/demo/boards/z_0_c_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_0_c_filetest.gno @@ -4,11 +4,12 @@ package boards_test // SEND: 200000000ugnot import ( + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) -var bid boards.BoardID +var bid pboards.BoardID func init() { users.Register("", "gnouser", "my profile") diff --git a/examples/gno.land/r/demo/boards/z_0_d_filetest.gno b/examples/gno.land/r/demo/boards/z_0_d_filetest.gno index 2e9e3f1436f..ece49235332 100644 --- a/examples/gno.land/r/demo/boards/z_0_d_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_0_d_filetest.gno @@ -4,11 +4,12 @@ package boards_test // SEND: 200000000ugnot import ( + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) -var bid boards.BoardID +var bid pboards.BoardID func init() { users.Register("", "gnouser", "my profile") diff --git a/examples/gno.land/r/demo/boards/z_0_e_filetest.gno b/examples/gno.land/r/demo/boards/z_0_e_filetest.gno index a06713fcbe3..22ca6898e98 100644 --- a/examples/gno.land/r/demo/boards/z_0_e_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_0_e_filetest.gno @@ -4,11 +4,13 @@ package boards_test // SEND: 200000000ugnot import ( + pboards "gno.land/p/demo/boards" + "gno.land/r/demo/boards" "gno.land/r/demo/users" ) -var bid boards.BoardID +var bid pboards.BoardID func init() { users.Register("", "gnouser", "my profile") diff --git a/examples/gno.land/r/demo/boards/z_0_filetest.gno b/examples/gno.land/r/demo/boards/z_0_filetest.gno index f5611d3d6c3..99dbcc7dce3 100644 --- a/examples/gno.land/r/demo/boards/z_0_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_0_filetest.gno @@ -4,11 +4,12 @@ package boards_test // SEND: 200000000ugnot import ( + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) -var bid boards.BoardID +var bid pboards.BoardID func init() { users.Register("", "gnouser", "my profile") diff --git a/examples/gno.land/r/demo/boards/z_10_a_filetest.gno b/examples/gno.land/r/demo/boards/z_10_a_filetest.gno index 8ec2e45421a..30206e008be 100644 --- a/examples/gno.land/r/demo/boards/z_10_a_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_10_a_filetest.gno @@ -6,13 +6,14 @@ package boards_test import ( "strconv" + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) var ( - bid boards.BoardID - pid boards.PostID + bid pboards.BoardID + pid pboards.PostID ) func init() { diff --git a/examples/gno.land/r/demo/boards/z_10_b_filetest.gno b/examples/gno.land/r/demo/boards/z_10_b_filetest.gno index 0981d85a57f..af8b7e91bb7 100644 --- a/examples/gno.land/r/demo/boards/z_10_b_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_10_b_filetest.gno @@ -6,13 +6,14 @@ package boards_test import ( "strconv" + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) var ( - bid boards.BoardID - pid boards.PostID + bid pboards.BoardID + pid pboards.PostID ) func init() { diff --git a/examples/gno.land/r/demo/boards/z_10_c_filetest.gno b/examples/gno.land/r/demo/boards/z_10_c_filetest.gno index 51c597d7998..8691d79dbfe 100644 --- a/examples/gno.land/r/demo/boards/z_10_c_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_10_c_filetest.gno @@ -6,14 +6,15 @@ package boards_test import ( "strconv" + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) var ( - bid boards.BoardID - pid boards.PostID - rid boards.PostID + bid pboards.BoardID + pid pboards.PostID + rid pboards.PostID ) func init() { diff --git a/examples/gno.land/r/demo/boards/z_10_filetest.gno b/examples/gno.land/r/demo/boards/z_10_filetest.gno index f32d69c8056..94e339adc51 100644 --- a/examples/gno.land/r/demo/boards/z_10_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_10_filetest.gno @@ -6,13 +6,14 @@ package boards_test import ( "strconv" + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) var ( - bid boards.BoardID - pid boards.PostID + bid pboards.BoardID + pid pboards.PostID ) func init() { diff --git a/examples/gno.land/r/demo/boards/z_11_a_filetest.gno b/examples/gno.land/r/demo/boards/z_11_a_filetest.gno index fd62a884efa..6324591dbdc 100644 --- a/examples/gno.land/r/demo/boards/z_11_a_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_11_a_filetest.gno @@ -6,13 +6,14 @@ package boards_test import ( "strconv" + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) var ( - bid boards.BoardID - pid boards.PostID + bid pboards.BoardID + pid pboards.PostID ) func init() { diff --git a/examples/gno.land/r/demo/boards/z_11_b_filetest.gno b/examples/gno.land/r/demo/boards/z_11_b_filetest.gno index 63907146f82..33418c06ffd 100644 --- a/examples/gno.land/r/demo/boards/z_11_b_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_11_b_filetest.gno @@ -6,13 +6,14 @@ package boards_test import ( "strconv" + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) var ( - bid boards.BoardID - pid boards.PostID + bid pboards.BoardID + pid pboards.PostID ) func init() { diff --git a/examples/gno.land/r/demo/boards/z_11_c_filetest.gno b/examples/gno.land/r/demo/boards/z_11_c_filetest.gno index ba40fa39021..879d53ad92f 100644 --- a/examples/gno.land/r/demo/boards/z_11_c_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_11_c_filetest.gno @@ -6,13 +6,14 @@ package boards_test import ( "strconv" + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) var ( - bid boards.BoardID - pid boards.PostID + bid pboards.BoardID + pid pboards.PostID ) func init() { diff --git a/examples/gno.land/r/demo/boards/z_11_d_filetest.gno b/examples/gno.land/r/demo/boards/z_11_d_filetest.gno index b3803c505f2..f127dbd9ab4 100644 --- a/examples/gno.land/r/demo/boards/z_11_d_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_11_d_filetest.gno @@ -6,14 +6,15 @@ package boards_test import ( "strconv" + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) var ( - bid boards.BoardID - pid boards.PostID - rid boards.PostID + bid pboards.BoardID + pid pboards.PostID + rid pboards.PostID ) func init() { diff --git a/examples/gno.land/r/demo/boards/z_11_filetest.gno b/examples/gno.land/r/demo/boards/z_11_filetest.gno index 937673c8bd4..c894d7b55d6 100644 --- a/examples/gno.land/r/demo/boards/z_11_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_11_filetest.gno @@ -6,13 +6,14 @@ package boards_test import ( "strconv" + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) var ( - bid boards.BoardID - pid boards.PostID + bid pboards.BoardID + pid pboards.PostID ) func init() { diff --git a/examples/gno.land/r/demo/boards/z_12_filetest.gno b/examples/gno.land/r/demo/boards/z_12_filetest.gno index 59ab07d17d8..f032b7a6358 100644 --- a/examples/gno.land/r/demo/boards/z_12_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_12_filetest.gno @@ -4,14 +4,15 @@ package boards_test // SEND: 200000000ugnot import ( + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) var ( - bid1 boards.BoardID - bid2 boards.BoardID - pid boards.PostID + bid1 pboards.BoardID + bid2 pboards.BoardID + pid pboards.PostID ) func init() { diff --git a/examples/gno.land/r/demo/boards/z_1_filetest.gno b/examples/gno.land/r/demo/boards/z_1_filetest.gno index b5c7bb863e1..0a0f29b0b94 100644 --- a/examples/gno.land/r/demo/boards/z_1_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_1_filetest.gno @@ -4,11 +4,12 @@ package boards_test // SEND: 200000000ugnot import ( + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) -var board *boards.Board +var board *pboards.Board func init() { users.Register("", "gnouser", "my profile") diff --git a/examples/gno.land/r/demo/boards/z_2_filetest.gno b/examples/gno.land/r/demo/boards/z_2_filetest.gno index 2a6b937c875..a20c2ce8ecc 100644 --- a/examples/gno.land/r/demo/boards/z_2_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_2_filetest.gno @@ -6,13 +6,14 @@ package boards_test import ( "strconv" + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) var ( - bid boards.BoardID - pid boards.PostID + bid pboards.BoardID + pid pboards.PostID ) func init() { diff --git a/examples/gno.land/r/demo/boards/z_3_filetest.gno b/examples/gno.land/r/demo/boards/z_3_filetest.gno index 0d25dae08ae..839f2f1cfe6 100644 --- a/examples/gno.land/r/demo/boards/z_3_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_3_filetest.gno @@ -6,13 +6,14 @@ package boards_test import ( "strconv" + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) var ( - bid boards.BoardID - pid boards.PostID + bid pboards.BoardID + pid pboards.PostID ) func init() { diff --git a/examples/gno.land/r/demo/boards/z_4_filetest.gno b/examples/gno.land/r/demo/boards/z_4_filetest.gno index 2acafe05470..f6b94d0dc5c 100644 --- a/examples/gno.land/r/demo/boards/z_4_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_4_filetest.gno @@ -6,13 +6,14 @@ package boards_test import ( "strconv" + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) var ( - bid boards.BoardID - pid boards.PostID + bid pboards.BoardID + pid pboards.PostID ) func init() { @@ -48,7 +49,7 @@ func main() { // Realm: // switchrealm["gno.land/r/demo/users"] // switchrealm["gno.land/r/demo/boards"] -// u[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:101]={ +// u[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:100]={ // "Fields": [ // { // "T": { @@ -65,7 +66,7 @@ func main() { // "@type": "/gno.PointerType", // "Elt": { // "@type": "/gno.RefType", -// "ID": "gno.land/r/demo/boards.Post" +// "ID": "gno.land/p/demo/boards.Post" // } // }, // "V": { @@ -75,12 +76,12 @@ func main() { // "TV": { // "T": { // "@type": "/gno.RefType", -// "ID": "gno.land/r/demo/boards.Post" +// "ID": "gno.land/p/demo/boards.Post" // }, // "V": { // "@type": "/gno.RefValue", // "Escaped": true, -// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:102" +// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:101" // } // } // } @@ -118,13 +119,13 @@ func main() { // } // ], // "ObjectInfo": { -// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:101", -// "ModTime": "109", -// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:109", +// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:100", +// "ModTime": "108", +// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:108", // "RefCount": "1" // } // } -// c[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:110]={ +// c[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:109]={ // "Fields": [ // { // "T": { @@ -141,7 +142,7 @@ func main() { // "@type": "/gno.PointerType", // "Elt": { // "@type": "/gno.RefType", -// "ID": "gno.land/r/demo/boards.Post" +// "ID": "gno.land/p/demo/boards.Post" // } // }, // "V": { @@ -151,12 +152,12 @@ func main() { // "TV": { // "T": { // "@type": "/gno.RefType", -// "ID": "gno.land/r/demo/boards.Post" +// "ID": "gno.land/p/demo/boards.Post" // }, // "V": { // "@type": "/gno.RefValue", // "Escaped": true, -// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:111" +// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:110" // } // } // } @@ -194,13 +195,13 @@ func main() { // } // ], // "ObjectInfo": { -// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:110", +// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:109", // "ModTime": "0", -// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:109", +// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:108", // "RefCount": "1" // } // } -// c[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:109]={ +// c[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:108]={ // "Fields": [ // { // "T": { @@ -246,8 +247,8 @@ func main() { // }, // "V": { // "@type": "/gno.RefValue", -// "Hash": "b58581159917d8d7ad0992009d7184fc8ca00fcc", -// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:101" +// "Hash": "5a81eb87515d75f78a500e0447f0917f7d27b2cc", +// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:100" // } // } // } @@ -271,21 +272,21 @@ func main() { // }, // "V": { // "@type": "/gno.RefValue", -// "Hash": "fb593e86d35aaf607e0d21e6bd4f84519c44585f", -// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:110" +// "Hash": "21aef047fab9b0e30a36c3cd0ebb04f0c071526f", +// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:109" // } // } // } // } // ], // "ObjectInfo": { -// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:109", +// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:108", // "ModTime": "0", -// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:96", +// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:95", // "RefCount": "1" // } // } -// c[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:112]={ +// c[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:111]={ // "Fields": [ // { // "T": { @@ -298,13 +299,13 @@ func main() { // } // ], // "ObjectInfo": { -// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:112", +// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:111", // "ModTime": "0", -// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:111", +// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:110", // "RefCount": "1" // } // } -// c[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:113]={ +// c[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:112]={ // "Fields": [ // { // "T": { @@ -317,13 +318,13 @@ func main() { // } // ], // "ObjectInfo": { -// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:113", +// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:112", // "ModTime": "0", -// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:111", +// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:110", // "RefCount": "1" // } // } -// c[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:114]={ +// c[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:113]={ // "Fields": [ // { // "T": { @@ -336,13 +337,13 @@ func main() { // } // ], // "ObjectInfo": { -// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:114", +// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:113", // "ModTime": "0", -// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:111", +// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:110", // "RefCount": "1" // } // } -// c[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:115]={ +// c[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:114]={ // "Fields": [ // { // "N": "AAAAgJSeXbo=", @@ -379,13 +380,13 @@ func main() { // } // ], // "ObjectInfo": { -// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:115", +// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:114", // "ModTime": "0", -// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:111", +// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:110", // "RefCount": "1" // } // } -// c[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:116]={ +// c[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:115]={ // "Fields": [ // { // "T": { @@ -410,20 +411,20 @@ func main() { // } // ], // "ObjectInfo": { -// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:116", +// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:115", // "ModTime": "0", -// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:111", +// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:110", // "RefCount": "1" // } // } -// c[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:111]={ +// c[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:110]={ // "Fields": [ // { // "T": { // "@type": "/gno.PointerType", // "Elt": { // "@type": "/gno.RefType", -// "ID": "gno.land/r/demo/boards.Board" +// "ID": "gno.land/p/demo/boards.Board" // } // }, // "V": { @@ -433,12 +434,12 @@ func main() { // "TV": { // "T": { // "@type": "/gno.RefType", -// "ID": "gno.land/r/demo/boards.Board" +// "ID": "gno.land/p/demo/boards.Board" // }, // "V": { // "@type": "/gno.RefValue", // "Escaped": true, -// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:81" +// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:80" // } // } // } @@ -447,7 +448,7 @@ func main() { // "N": "BAAAAAAAAAA=", // "T": { // "@type": "/gno.RefType", -// "ID": "gno.land/r/demo/boards.PostID" +// "ID": "gno.land/p/demo/boards.PostID" // } // }, // { @@ -487,8 +488,8 @@ func main() { // }, // "V": { // "@type": "/gno.RefValue", -// "Hash": "130542396d7549d1d516a3ef4a63bb44ef3da06f", -// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:112" +// "Hash": "3d2b3588587d4a35e015d36ebe0627ae9c776ba9", +// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:111" // } // }, // { @@ -498,8 +499,8 @@ func main() { // }, // "V": { // "@type": "/gno.RefValue", -// "Hash": "80acd8746478317194b8546170335c796a4dfb3f", -// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:113" +// "Hash": "057ed4b205ae1a9ddf757a5f8b857ed157be8474", +// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:112" // } // }, // { @@ -509,28 +510,28 @@ func main() { // }, // "V": { // "@type": "/gno.RefValue", -// "Hash": "c1a8f769f3b9d52dd38ac4759116edaca287636f", -// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:114" +// "Hash": "8c1eb267263949ae7d56d2793447d39a67bc99b1", +// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:113" // } // }, // { // "N": "AgAAAAAAAAA=", // "T": { // "@type": "/gno.RefType", -// "ID": "gno.land/r/demo/boards.PostID" +// "ID": "gno.land/p/demo/boards.PostID" // } // }, // { // "N": "AgAAAAAAAAA=", // "T": { // "@type": "/gno.RefType", -// "ID": "gno.land/r/demo/boards.PostID" +// "ID": "gno.land/p/demo/boards.PostID" // } // }, // { // "T": { // "@type": "/gno.RefType", -// "ID": "gno.land/r/demo/boards.BoardID" +// "ID": "gno.land/p/demo/boards.BoardID" // } // }, // { @@ -540,8 +541,8 @@ func main() { // }, // "V": { // "@type": "/gno.RefValue", -// "Hash": "25ffc45509708ca0ae17271cb4c3a1dfb367b965", -// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:115" +// "Hash": "228747d8e66e9a8ef393e32a679d15b193fff36f", +// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:114" // } // }, // { @@ -551,19 +552,19 @@ func main() { // }, // "V": { // "@type": "/gno.RefValue", -// "Hash": "c3a60b602b564d07677a212372f4ac1cae4270fd", -// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:116" +// "Hash": "39aedff3aa8d8246df681ff0f576f8ac31cb5d55", +// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:115" // } // } // ], // "ObjectInfo": { -// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:111", +// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:110", // "IsEscaped": true, // "ModTime": "0", // "RefCount": "2" // } // } -// u[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:108]={ +// u[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:107]={ // "Fields": [ // { // "T": { @@ -580,7 +581,7 @@ func main() { // "@type": "/gno.PointerType", // "Elt": { // "@type": "/gno.RefType", -// "ID": "gno.land/r/demo/boards.Post" +// "ID": "gno.land/p/demo/boards.Post" // } // }, // "V": { @@ -590,12 +591,12 @@ func main() { // "TV": { // "T": { // "@type": "/gno.RefType", -// "ID": "gno.land/r/demo/boards.Post" +// "ID": "gno.land/p/demo/boards.Post" // }, // "V": { // "@type": "/gno.RefValue", // "Escaped": true, -// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:102" +// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:101" // } // } // } @@ -633,13 +634,13 @@ func main() { // } // ], // "ObjectInfo": { -// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:108", -// "ModTime": "117", -// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:117", +// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:107", +// "ModTime": "116", +// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:116", // "RefCount": "1" // } // } -// c[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:118]={ +// c[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:117]={ // "Fields": [ // { // "T": { @@ -656,7 +657,7 @@ func main() { // "@type": "/gno.PointerType", // "Elt": { // "@type": "/gno.RefType", -// "ID": "gno.land/r/demo/boards.Post" +// "ID": "gno.land/p/demo/boards.Post" // } // }, // "V": { @@ -666,12 +667,12 @@ func main() { // "TV": { // "T": { // "@type": "/gno.RefType", -// "ID": "gno.land/r/demo/boards.Post" +// "ID": "gno.land/p/demo/boards.Post" // }, // "V": { // "@type": "/gno.RefValue", // "Escaped": true, -// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:111" +// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:110" // } // } // } @@ -709,13 +710,13 @@ func main() { // } // ], // "ObjectInfo": { -// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:118", +// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:117", // "ModTime": "0", -// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:117", +// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:116", // "RefCount": "1" // } // } -// c[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:117]={ +// c[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:116]={ // "Fields": [ // { // "T": { @@ -761,8 +762,8 @@ func main() { // }, // "V": { // "@type": "/gno.RefValue", -// "Hash": "6a86bc7763703c8f2b9d286368921159d6db121c", -// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:108" +// "Hash": "02d885db40685b20d2e8c5f440ce464fb2820491", +// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:107" // } // } // } @@ -786,27 +787,27 @@ func main() { // }, // "V": { // "@type": "/gno.RefValue", -// "Hash": "52faa8a2dfefd4b6b6249eff2f9c123ad455e81d", -// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:118" +// "Hash": "aa8c933c8fa09380b426e2110c3d7e077249101a", +// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:117" // } // } // } // } // ], // "ObjectInfo": { -// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:117", +// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:116", // "ModTime": "0", -// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:97", +// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:96", // "RefCount": "1" // } // } -// u[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:81]={ +// u[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:80]={ // "Fields": [ // { // "N": "AQAAAAAAAAA=", // "T": { // "@type": "/gno.RefType", -// "ID": "gno.land/r/demo/boards.BoardID" +// "ID": "gno.land/p/demo/boards.BoardID" // } // }, // { @@ -846,8 +847,8 @@ func main() { // }, // "V": { // "@type": "/gno.RefValue", -// "Hash": "a8e67b9881af89ca2ec2f05778bf7528a54a5833", -// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:82" +// "Hash": "197d37a21a1ddf639f1394acda5e83acd0f33073", +// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:81" // } // }, // { @@ -864,8 +865,8 @@ func main() { // }, // "V": { // "@type": "/gno.RefValue", -// "Hash": "d8ae14a4620e3c6dedabd76cd0c5d7e3c205d647", -// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:83" +// "Hash": "643342836cb181aba35007cff63e9310eaa0e9d7", +// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:82" // } // }, // { @@ -875,19 +876,19 @@ func main() { // }, // "V": { // "@type": "/gno.RefValue", -// "Hash": "edb1857302fa916c562cd077cdf2a3626e29ae2b", -// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:84" +// "Hash": "8b4217cc89dc0538efb9788aafab3e8b672feba6", +// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:83" // } // } // ], // "ObjectInfo": { -// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:81", +// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:80", // "IsEscaped": true, -// "ModTime": "108", +// "ModTime": "107", // "RefCount": "6" // } // } -// u[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:96]={ +// u[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:95]={ // "Fields": [ // { // "T": { @@ -908,21 +909,21 @@ func main() { // }, // "V": { // "@type": "/gno.RefValue", -// "Hash": "609e7f519c65f94503427a14f973b4b83989cdc8", -// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:109" +// "Hash": "12c55b1fd02c98234daeff3070a2c114c6092ddb", +// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:108" // } // } // } // } // ], // "ObjectInfo": { -// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:96", -// "ModTime": "108", -// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:95", +// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:95", +// "ModTime": "107", +// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:94", // "RefCount": "1" // } // } -// u[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:97]={ +// u[f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:96]={ // "Fields": [ // { // "T": { @@ -943,21 +944,20 @@ func main() { // }, // "V": { // "@type": "/gno.RefValue", -// "Hash": "6760340f5b40e05221dc530940683b0b9a422503", -// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:117" +// "Hash": "f43e66802bf337537302c522ea36fbb62531c46f", +// "ObjectID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:116" // } // } // } // } // ], // "ObjectInfo": { -// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:97", -// "ModTime": "108", -// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:95", +// "ID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:96", +// "ModTime": "107", +// "OwnerID": "f6dbf411da22e67d74cd7ddba6a76cd7e14a4822:94", // "RefCount": "1" // } // } -// switchrealm["gno.land/r/demo/boards"] // switchrealm["gno.land/r/demo/users"] // switchrealm["gno.land/r/demo/users"] // switchrealm["gno.land/r/demo/users"] diff --git a/examples/gno.land/r/demo/boards/z_5_filetest.gno b/examples/gno.land/r/demo/boards/z_5_filetest.gno index 76fb4ee432c..9ed2b737892 100644 --- a/examples/gno.land/r/demo/boards/z_5_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_5_filetest.gno @@ -6,13 +6,14 @@ package boards_test import ( "strconv" + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) var ( - bid boards.BoardID - pid boards.PostID + bid pboards.BoardID + pid pboards.PostID ) func init() { diff --git a/examples/gno.land/r/demo/boards/z_6_filetest.gno b/examples/gno.land/r/demo/boards/z_6_filetest.gno index c1cd84d35a7..2c6716ce587 100644 --- a/examples/gno.land/r/demo/boards/z_6_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_6_filetest.gno @@ -6,14 +6,15 @@ package boards_test import ( "strconv" + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) var ( - bid boards.BoardID - pid boards.PostID - rid boards.PostID + bid pboards.BoardID + pid pboards.PostID + rid pboards.PostID ) func init() { diff --git a/examples/gno.land/r/demo/boards/z_8_filetest.gno b/examples/gno.land/r/demo/boards/z_8_filetest.gno index 226dae62b3f..2c8b450971b 100644 --- a/examples/gno.land/r/demo/boards/z_8_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_8_filetest.gno @@ -6,14 +6,15 @@ package boards_test import ( "strconv" + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) var ( - bid boards.BoardID - pid boards.PostID - rid boards.PostID + bid pboards.BoardID + pid pboards.PostID + rid pboards.PostID ) func init() { diff --git a/examples/gno.land/r/demo/boards/z_9_a_filetest.gno b/examples/gno.land/r/demo/boards/z_9_a_filetest.gno index 9ba9786c519..8f358080d4e 100644 --- a/examples/gno.land/r/demo/boards/z_9_a_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_9_a_filetest.gno @@ -6,11 +6,12 @@ package boards_test import ( "strconv" + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) -var dstBoard boards.BoardID +var dstBoard pboards.BoardID func init() { users.Register("", "gnouser", "my profile") diff --git a/examples/gno.land/r/demo/boards/z_9_b_filetest.gno b/examples/gno.land/r/demo/boards/z_9_b_filetest.gno index 4d53f60f10f..023284812df 100644 --- a/examples/gno.land/r/demo/boards/z_9_b_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_9_b_filetest.gno @@ -6,13 +6,14 @@ package boards_test import ( "strconv" + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) var ( - srcBoard boards.BoardID - pid boards.PostID + srcBoard pboards.BoardID + pid pboards.PostID ) func init() { diff --git a/examples/gno.land/r/demo/boards/z_9_filetest.gno b/examples/gno.land/r/demo/boards/z_9_filetest.gno index f2703bc1622..e7f0174fd8b 100644 --- a/examples/gno.land/r/demo/boards/z_9_filetest.gno +++ b/examples/gno.land/r/demo/boards/z_9_filetest.gno @@ -6,14 +6,15 @@ package boards_test import ( "strconv" + pboards "gno.land/p/demo/boards" "gno.land/r/demo/boards" "gno.land/r/demo/users" ) var ( - firstBoard boards.BoardID - secondBoard boards.BoardID - pid boards.PostID + firstBoard pboards.BoardID + secondBoard pboards.BoardID + pid pboards.PostID ) func init() {