diff --git a/examples/gno.land/r/matijamarjanovic/gnocket/wallet_registry.gno b/examples/gno.land/r/matijamarjanovic/gnocket/wallet_registry.gno index 0e7a67b423b..e1ffc1d386c 100644 --- a/examples/gno.land/r/matijamarjanovic/gnocket/wallet_registry.gno +++ b/examples/gno.land/r/matijamarjanovic/gnocket/wallet_registry.gno @@ -51,6 +51,10 @@ func NewWallet() *Wallet { return wallet } +// TODO: Add GetMyBalances() for user to get their balance + +// TODO: Add SetPublic() for user to set their wallet public + func GetAllTokens() string { return tokenhub.GetAllTokens() } @@ -61,10 +65,35 @@ func GetAllTokensNoNFTs() string { func Render(path string) string { - + userToDisplay := getAddressForUsername(path) + RenderUserPage(userToDisplay) sb := strings.Builder{} sb.WriteString("") return sb.String() } + +func RenderUserPage(userToDisplay std.Address) string { + + wallet := wallets.Get(string(userToDisplay)) + if wallet.public { + //TODO : render wallet content for the public + } + + return "" +} + + +func getAddressForUsername(addrOrName string) std.Address { + addr := std.Address(addrOrName) + + if addr.IsValid() { + return addr + } + if user := users.GetUserByName(addrOrName); user != nil { + return user.Address + } + + return "" +} \ No newline at end of file