Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: r/demo/users #3166

Open
wants to merge 161 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 148 commits
Commits
Show all changes
161 commits
Select commit Hold shift + click to select a range
38c2b9a
update user rendering
leohhhn Nov 20, 2024
4970a59
save
leohhhn Nov 20, 2024
833576b
Merge branch 'master' into refac/users
leohhhn Nov 21, 2024
2c4f497
register
leohhhn Nov 21, 2024
6f9b787
Merge branch 'master' into refac/users
leohhhn Nov 21, 2024
74d6ae7
add gnoland/users, expand sys/users
leohhhn Nov 21, 2024
487775b
add resolving
leohhhn Nov 21, 2024
25c3fa1
pausable to sys/users
leohhhn Nov 21, 2024
d06515e
update regex & add godoc
leohhhn Nov 21, 2024
905bc10
update regex & add godoc
leohhhn Nov 21, 2024
970b3f0
save
leohhhn Nov 21, 2024
0ad5292
save
leohhhn Nov 21, 2024
3d72544
fix err name
leohhhn Nov 21, 2024
2f68087
Merge branch 'master' into refac/users
leohhhn Nov 22, 2024
114de1b
Merge branch 'master' into refac/users
leohhhn Nov 22, 2024
a3ed4e6
add paginated fetch
leohhhn Nov 22, 2024
b7cc608
add list by prefix
leohhhn Nov 22, 2024
3e58017
fix imports
leohhhn Nov 22, 2024
69cfe1c
add admin tests
leohhhn Nov 22, 2024
46fcc93
fix
leohhhn Nov 26, 2024
9ee9c41
Merge branch 'refs/heads/master' into refac/users
leohhhn Nov 26, 2024
065b2de
rename func
leohhhn Nov 26, 2024
f94a97d
save
leohhhn Nov 26, 2024
1f0f9a1
add xxx
leohhhn Nov 27, 2024
1ad9c57
add cmt
leohhhn Nov 27, 2024
c036996
username>name, add tests
leohhhn Dec 3, 2024
fc2a105
Merge branch 'refs/heads/master' into refac/users
leohhhn Dec 3, 2024
db1731e
rename files, add util_test
leohhhn Dec 3, 2024
a1b40fe
add test
leohhhn Dec 3, 2024
21f4379
move pusers
leohhhn Dec 3, 2024
de48585
simplify p/users
leohhhn Dec 3, 2024
6b39d88
add ctor
leohhhn Dec 3, 2024
408db75
pusers>susers
leohhhn Dec 3, 2024
7939469
extendeduser
leohhhn Dec 3, 2024
7a8795a
rm comment
leohhhn Dec 3, 2024
ffef138
rm error
leohhhn Dec 3, 2024
49f8c7d
Merge branch 'master' into refac/users
leohhhn Dec 3, 2024
c0067c5
rm pointer
leohhhn Dec 3, 2024
0dadb34
rm pointer
leohhhn Dec 3, 2024
2bb8e7d
rm newuser
leohhhn Dec 3, 2024
64f9455
save
leohhhn Dec 4, 2024
d9aa544
Merge branch 'refs/heads/master' into refac/users
leohhhn Dec 8, 2024
1a94d25
rm extendeduserstore
leohhhn Dec 15, 2024
5bee1ee
rm update bio
leohhhn Dec 15, 2024
5a02dc6
rm prereg
leohhhn Dec 15, 2024
0e07c53
revert prereg
leohhhn Dec 15, 2024
776e1ac
rm extuserstore
leohhhn Dec 15, 2024
411965b
lookup
leohhhn Dec 16, 2024
285b26f
rm restricted
leohhhn Dec 16, 2024
882711a
aliasstore
leohhhn Dec 16, 2024
c871060
save
leohhhn Dec 16, 2024
61d438c
rename aliasstore & regex
leohhhn Dec 16, 2024
bc02264
move verifier
leohhhn Dec 16, 2024
2454e8e
add cmt
leohhhn Dec 16, 2024
e20299d
fix verifier, comment out resolveaddress funcs
leohhhn Dec 16, 2024
d27845e
add cmt
leohhhn Dec 17, 2024
0f335e1
expose ownable & pausable apis
leohhhn Dec 17, 2024
3f3e0bd
imports
leohhhn Dec 17, 2024
ee8e670
verifiy
leohhhn Dec 17, 2024
a2a17bc
Merge branch 'refs/heads/master' into refac/users
leohhhn Dec 17, 2024
b00cc3a
update verifier
leohhhn Dec 17, 2024
b73c944
add verifier tests, modify store
leohhhn Dec 17, 2024
b34e0ea
add fetcher funcs
leohhhn Dec 18, 2024
e1d1945
update tests
leohhhn Dec 18, 2024
75a87e0
update gnoland/users
leohhhn Dec 18, 2024
e92964c
Merge branch 'master' into refac/users
leohhhn Dec 18, 2024
e1f8e58
render
leohhhn Dec 18, 2024
c4098d9
save
leohhhn Dec 18, 2024
c455438
rm aon
leohhhn Dec 19, 2024
03b246e
rm lookup ctr
leohhhn Dec 19, 2024
0abf40d
field
leohhhn Dec 19, 2024
f964e6f
ctr
leohhhn Dec 19, 2024
3e99909
rm get all names
leohhhn Dec 19, 2024
7acd8b1
update store
leohhhn Dec 19, 2024
7841aa3
store
leohhhn Dec 19, 2024
8bbf5ae
Merge branch 'refs/heads/master' into refac/users
leohhhn Dec 25, 2024
55573ee
rm cmts
leohhhn Dec 25, 2024
18a9c50
rm old impl
leohhhn Jan 4, 2025
2bf6319
add new impl, fix tests
leohhhn Jan 4, 2025
3338554
add test
leohhhn Jan 4, 2025
001d759
add events
leohhhn Jan 4, 2025
a11686a
update verifier
leohhhn Jan 4, 2025
926e50f
update comments
leohhhn Jan 4, 2025
b9f0e19
rm unused const
leohhhn Jan 4, 2025
5b557a8
add validateCall
leohhhn Jan 5, 2025
5e97815
Merge branch 'master' into refac/users
leohhhn Jan 5, 2025
ef9338f
update r/gnoland/users
leohhhn Jan 5, 2025
defba3b
update deleteuser
leohhhn Jan 5, 2025
455b724
rm comment, extra file
leohhhn Jan 6, 2025
7a0cbe3
fix verifier tests
leohhhn Jan 6, 2025
8fdc53f
fix deletion
leohhhn Jan 6, 2025
ee7b38e
add govdao verifier update
leohhhn Jan 7, 2025
742f48f
fix imports
leohhhn Jan 7, 2025
da6ae8a
switch err checks
leohhhn Jan 8, 2025
12d0101
add package desc
leohhhn Jan 8, 2025
e8ddd56
rm t.parallel
leohhhn Jan 13, 2025
58e8dc0
Merge branch 'master' into refac/users
leohhhn Jan 13, 2025
57c626b
use p/moul/addrset
leohhhn Jan 13, 2025
09ed87e
update cmt
leohhhn Jan 13, 2025
761db0e
move to v1
leohhhn Jan 13, 2025
3578b49
fix
leohhhn Jan 14, 2025
d98e895
fix names
leohhhn Jan 14, 2025
a5114ec
fix
leohhhn Jan 14, 2025
d73d8f8
change api
leohhhn Jan 15, 2025
1d066dd
update api, tests
leohhhn Jan 15, 2025
c335636
rm govdao executors
leohhhn Jan 15, 2025
221b38f
name
leohhhn Jan 15, 2025
1cacf38
massive rename job 🫠
leohhhn Jan 16, 2025
07a8ca4
Merge branch 'refs/heads/master' into refac/users
leohhhn Jan 16, 2025
a0da376
fix lint
leohhhn Jan 16, 2025
5b07dc8
Merge branch 'master' into refac/users
leohhhn Jan 16, 2025
a68cd9d
fix test
leohhhn Jan 16, 2025
6041e86
fix tests
leohhhn Jan 16, 2025
fbfc932
rm traces of demo/users
leohhhn Jan 16, 2025
9afb231
fix rendering, expose addrstore
leohhhn Jan 16, 2025
4bc7ae7
404
leohhhn Jan 16, 2025
b9aa62b
render
leohhhn Jan 16, 2025
0eeac54
return board filetests, make them work
leohhhn Jan 16, 2025
7081f30
fix tests
leohhhn Jan 16, 2025
56eaa3a
Merge branch 'master' into refac/users
leohhhn Jan 16, 2025
4e58502
make fmt
leohhhn Jan 16, 2025
9890d32
update home page, update godoc
leohhhn Jan 16, 2025
70aae18
add v1 tests, rm emits
leohhhn Jan 16, 2025
4c6b55a
modify keeper to use r/sys/names instead of r/sys/users
leohhhn Jan 16, 2025
47ce6cf
add updatebio link
leohhhn Jan 17, 2025
73d698d
cmt
leohhhn Jan 17, 2025
3a71236
fixing txtar
leohhhn Jan 17, 2025
b333429
update txtar
leohhhn Jan 17, 2025
091bd8a
rm parallel
leohhhn Jan 17, 2025
021ff34
revert txtars
leohhhn Jan 17, 2025
b4e441d
update v1 rendering, expose both roavl stores
leohhhn Jan 17, 2025
d8624ef
rm listusersbyprefix
leohhhn Jan 17, 2025
a623b81
update rendering
leohhhn Jan 17, 2025
73f67fe
fix connect link
leohhhn Jan 17, 2025
cf74724
switch actions
leohhhn Jan 17, 2025
76f0e9e
update btns
leohhhn Jan 17, 2025
3c83640
Merge branch 'master' into refac/users
leohhhn Jan 18, 2025
56ead47
update genesis params
leohhhn Jan 18, 2025
8940f9c
fix namespace txtar, add comment executor funcs, modify genesis_params
leohhhn Jan 19, 2025
4bb226d
fix 2 txtars
leohhhn Jan 19, 2025
7be3dc0
add verifier tests
leohhhn Jan 19, 2025
b2940bb
update namespace test
leohhhn Jan 19, 2025
97f5ca7
Merge branch 'master' into refac/users
leohhhn Jan 19, 2025
bf81aa1
add executors
leohhhn Jan 19, 2025
877ccbc
typo
leohhhn Jan 19, 2025
6efcb30
embed users & boards source code into txtar
leohhhn Jan 19, 2025
2f2f085
rm genesis txs, update readme, update docs-partially
leohhhn Jan 20, 2025
00cbbb5
add registration & boards to genesis_txs, rm signatures
leohhhn Jan 20, 2025
c6c5613
rm leftover file
leohhhn Jan 20, 2025
ee6758f
Merge branch 'master' into refac/users
leohhhn Jan 20, 2025
69ac851
Merge branch 'master' into refac/users
thehowl Jan 21, 2025
b899731
fix broken test
leohhhn Jan 21, 2025
1dc09e9
rm leftover
leohhhn Jan 24, 2025
2a63dc4
Merge branch 'refs/heads/master' into refac/users
leohhhn Jan 27, 2025
326a7cd
fix home
leohhhn Jan 27, 2025
81ee4fd
pausable godoc
leohhhn Jan 27, 2025
ec8f58a
update test
leohhhn Jan 27, 2025
91723df
bump gas on tst
leohhhn Jan 27, 2025
3785d16
Merge branch 'master' into refac/users
leohhhn Jan 27, 2025
3dd585d
remove wal
leohhhn Jan 27, 2025
05a9f9a
update docs
leohhhn Jan 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ If you haven't already, take a moment to check out our [website](https://gno.lan
> can use it to check out
> [some](https://gno.land/r/demo/boards)
> [example](https://gno.land/r/gnoland/blog)
> [contracts](https://gno.land/r/demo/users).
> [contracts](https://gno.land/r/gnoland/users/v1).
>
> Use the `[source]` button in the header to inspect the program's source; use
> the `[help]` button to view how you can use [`gnokey`](./gno.land/cmd/gnokey)
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/stdlibs/std/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Should be used in combination with [`NewUserRealm`](#newuserrealm) &
addr := std.Address("g1ecely4gjy0yl6s9kt409ll330q9hk2lj9ls3ec")
std.TestSetRealm(std.NewUserRealm(addr))
// or
std.TestSetRealm(std.NewCodeRealm("gno.land/r/demo/users"))
std.TestSetRealm(std.NewCodeRealm("gno.land/r/gnoland/users/v1"))
```

---
Expand Down
7 changes: 5 additions & 2 deletions examples/gno.land/p/demo/pausable/pausable.gno
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package pausable

import (
"errors"
"std"

"gno.land/p/demo/ownable"
Expand All @@ -11,6 +12,8 @@ type Pausable struct {
paused bool
}

var ErrPaused = errors.New("pausable: realm is currently paused")
ajnavarro marked this conversation as resolved.
Show resolved Hide resolved

// New returns a new Pausable struct with non-paused state as default
func New() *Pausable {
return &Pausable{
Expand Down Expand Up @@ -39,7 +42,7 @@ func (p *Pausable) Pause() error {
}

p.paused = true
std.Emit("Paused", "account", p.Owner().String())
std.Emit("Paused", "by", p.Owner().String())

return nil
}
Expand All @@ -51,7 +54,7 @@ func (p *Pausable) Unpause() error {
}

p.paused = false
std.Emit("Unpaused", "account", p.Owner().String())
std.Emit("Unpaused", "by", p.Owner().String())

return nil
}
1 change: 0 additions & 1 deletion examples/gno.land/p/demo/users/gno.mod

This file was deleted.

14 changes: 0 additions & 14 deletions examples/gno.land/p/demo/users/types.gno

This file was deleted.

31 changes: 0 additions & 31 deletions examples/gno.land/p/demo/users/users.gno

This file was deleted.

1 change: 0 additions & 1 deletion examples/gno.land/p/demo/users/users_test.gno

This file was deleted.

147 changes: 0 additions & 147 deletions examples/gno.land/r/demo/boards/README.md

This file was deleted.

12 changes: 6 additions & 6 deletions examples/gno.land/r/demo/boards/misc.gno
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strconv"
"strings"

"gno.land/r/demo/users"
"gno.land/r/sys/users"
)

//----------------------------------------
Expand Down Expand Up @@ -78,18 +78,18 @@ func summaryOf(str string, length int) string {
}

func displayAddressMD(addr std.Address) string {
user := users.GetUserByAddress(addr)
user := users.ResolveAddress(addr)
if user == nil {
return "[" + addr.String() + "](/r/demo/users:" + addr.String() + ")"
return "[" + addr.String() + "](/r/gnoland/users/v1:" + addr.String() + ")"
} else {
return "[@" + user.Name + "](/r/demo/users:" + user.Name + ")"
return "[@" + user.Name() + "](/r/gnoland/users/v1:" + user.Name() + ")"
}
}

func usernameOf(addr std.Address) string {
user := users.GetUserByAddress(addr)
user := users.ResolveAddress(addr)
if user == nil {
return ""
}
return user.Name
return user.Name()
}
1 change: 1 addition & 0 deletions examples/gno.land/r/demo/boards/public.gno
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func CreateBoard(name string) BoardID {
if !(std.IsOriginCall() || std.PrevRealm().IsUser()) {
panic("invalid non-user call")
}

bid := incGetBoardID()
caller := std.GetOrigCaller()
if usernameOf(caller) == "" {
Expand Down
4 changes: 2 additions & 2 deletions examples/gno.land/r/demo/boards/z_0_a_filetest.gno
leohhhn marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// PKGPATH: gno.land/r/demo/boards_test
package boards_test
package boards

import (
"gno.land/r/demo/boards"
Expand All @@ -19,4 +19,4 @@ func main() {
}

// Error:
// unauthorized
// expected package name [boards_test] but got [boards]
ajnavarro marked this conversation as resolved.
Show resolved Hide resolved
23 changes: 0 additions & 23 deletions examples/gno.land/r/demo/boards/z_0_b_filetest.gno

This file was deleted.

8 changes: 6 additions & 2 deletions examples/gno.land/r/demo/boards/z_0_c_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ package boards_test
// SEND: 200000000ugnot

import (
"std"

"gno.land/r/demo/boards"
"gno.land/r/demo/users"
users "gno.land/r/gnoland/users/v1"
)

var bid boards.BoardID

func init() {
users.Register("", "gnouser", "my profile")
std.TestSetRealm(std.NewUserRealm(std.Address("g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"))) // so that CurrentRealm.Addr() matches OrigCaller
std.TestSetRealm(std.NewUserRealm(std.Address("g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"))) // so that CurrentRealm.Addr() matches OrigCaller
users.Register("gnouser123")
boards.CreateThread(1, "First Post (title)", "Body of the first post. (body)")
}

Expand Down
8 changes: 6 additions & 2 deletions examples/gno.land/r/demo/boards/z_0_d_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ package boards_test
// SEND: 200000000ugnot

import (
"std"

"gno.land/r/demo/boards"
"gno.land/r/demo/users"
users "gno.land/r/gnoland/users/v1"
)

var bid boards.BoardID

func init() {
users.Register("", "gnouser", "my profile")
std.TestSetRealm(std.NewUserRealm(std.Address("g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"))) // so that CurrentRealm.Addr() matches OrigCaller
std.TestSetRealm(std.NewUserRealm(std.Address("g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"))) // so that CurrentRealm.Addr() matches OrigCaller
users.Register("gnouser123")
bid = boards.CreateBoard("test_board")
boards.CreateReply(bid, 0, 0, "Reply of the second post")
}
Expand Down
7 changes: 5 additions & 2 deletions examples/gno.land/r/demo/boards/z_0_e_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ package boards_test
// SEND: 200000000ugnot

import (
"std"

"gno.land/r/demo/boards"
"gno.land/r/demo/users"
users "gno.land/r/gnoland/users/v1"
)

var bid boards.BoardID

func init() {
users.Register("", "gnouser", "my profile")
std.TestSetRealm(std.NewUserRealm(std.Address("g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"))) // so that CurrentRealm.Addr() matches OrigCaller
users.Register("gnouser123")
boards.CreateReply(bid, 0, 0, "Reply of the second post")
}

Expand Down
Loading
Loading