diff --git a/gno/r/social_feeds/CMD.md b/gno/r/social_feeds/CMD.md index e47839e999..0f2d9d021d 100644 --- a/gno/r/social_feeds/CMD.md +++ b/gno/r/social_feeds/CMD.md @@ -1,39 +1,54 @@ +gnokey maketx addpkg \ + -deposit="1ugnot" \ + -gas-fee="1ugnot" \ + -gas-wanted="50000000" \ + -broadcast="true" \ + -remote="https://rpc.gno.land:443" \ + -chainid="portal-loop" \ + -pkgdir="." \ + -pkgpath="gno.land/r/demo/teritori/social_feeds" \ + mykey2 + gnokey maketx call \ - -pkgpath "gno.land/r/demo/social_feeds" \ + -pkgpath "gno.land/r/demo/teritori/social_feeds" \ -func "CreateFeed" \ -gas-fee 1000000ugnot \ -gas-wanted 3000000 \ - -send "" \ + -remote="https://rpc.gno.land:443" \ + -chainid="portal-loop" \ -broadcast \ -args "teritori" \ - test1 + mykey2 gnokey maketx call \ - -pkgpath "gno.land/r/demo/social_feeds" \ + -pkgpath "gno.land/r/demo/teritori/social_feeds" \ -func "CreatePost" \ -gas-fee 1000000ugnot \ -gas-wanted 2000000 \ - -send "" \ + -remote="https://rpc.gno.land:443" \ + -chainid="portal-loop" \ -broadcast \ -args "1" \ -args "0" \ -args "2" \ -args '{"gifs": [], "files": [], "title": "", "message": "Hello world 2 !", "hashtags": [], "mentions": [], "createdAt": "2023-08-03T01:39:45.522Z", "updatedAt": "2023-08-03T01:39:45.522Z"}' \ - test1 + mykey2 gnokey maketx call \ - -pkgpath "gno.land/r/demo/social_feeds" \ + -pkgpath "gno.land/r/demo/teritori/social_feeds" \ -func "TipPost" \ -gas-fee 1000000ugnot \ -gas-wanted 3000000 \ - -send "1000000ugnot" \ + -send "1000ugnot" \ + -remote="https://rpc.gno.land:443" \ + -chainid="portal-loop" \ -broadcast \ -args "1" \ -args "1" \ - test1 + mykey2 gnokey maketx call \ - -pkgpath "gno.land/r/demo/social_feeds" \ + -pkgpath "gno.land/r/demo/teritori/social_feeds" \ -func "HidePostForMe" \ -gas-fee 1000000ugnot \ -gas-wanted 3000000 \ @@ -41,27 +56,10 @@ gnokey maketx call \ -broadcast \ -args "1" \ -args "1" \ - test1 + mykey2 // Query posts -gnokey query vm/qeval --data 'gno.land/r/demo/social_feeds +gnokey query vm/qeval --data 'gno.land/r/demo/teritori/social_feeds GetPosts(1, "", []uint64{}, 0, 10)' -gnokey maketx addpkg \ - -deposit="1ugnot" \ - -gas-fee="1ugnot" \ - -gas-wanted="5000000" \ - -broadcast="true" \ - -pkgdir="." \ - -pkgpath="gno.land/r/demo/social_feeds_v2" \ - test1 - -gnokey maketx call \ - -pkgpath "gno.land/r/demo/social_feeds" \ - -func "MigrateFromPreviousFeed" \ - -gas-fee 1000000ugnot \ - -gas-wanted 2000000 \ - -send "" \ - -broadcast \ - test1 diff --git a/gno/r/social_feeds/feeds.gno b/gno/r/social_feeds/feeds.gno index ae0f4ed8ce..352a9555cd 100644 --- a/gno/r/social_feeds/feeds.gno +++ b/gno/r/social_feeds/feeds.gno @@ -10,10 +10,9 @@ import ( // Realm (package) state var ( - gFeeds avl.Tree // id -> *Feed - gFeedsCtr int // increments Feed.id - gFeedsByName avl.Tree // name -> *Feed - gDefaultAnonFee = 100000000 // minimum fee required if anonymous + gFeeds avl.Tree // id -> *Feed + gFeedsCtr int // increments Feed.id + gFeedsByName avl.Tree // name -> *Feed ) //---------------------------------------- diff --git a/gno/r/social_feeds/feeds_test.gno b/gno/r/social_feeds/feeds_test.gno index 3c76f878c1..8a6b1b338c 100644 --- a/gno/r/social_feeds/feeds_test.gno +++ b/gno/r/social_feeds/feeds_test.gno @@ -11,10 +11,8 @@ import ( "gno.land/p/demo/avl" ujson "gno.land/p/demo/teritori/ujson" "gno.land/p/demo/testutils" - "gno.land/r/demo/boards" // Fake previous version for testing feedsV7 "gno.land/r/demo/teritori/social_feeds" - "gno.land/r/demo/users" ) var ( diff --git a/gno/r/social_feeds/flags.gno b/gno/r/social_feeds/flags.gno index 26018d15f3..4bd0e6cc47 100644 --- a/gno/r/social_feeds/flags.gno +++ b/gno/r/social_feeds/flags.gno @@ -7,14 +7,14 @@ import ( "gno.land/p/demo/teritori/flags_index" ) -var SEPARATOR = "/" +var seperator = "/" func getFlagID(fid FeedID, pid PostID) flags_index.FlagID { - return flags_index.FlagID(fid.String() + SEPARATOR + pid.String()) + return flags_index.FlagID(fid.String() + seperator + pid.String()) } func parseFlagID(flagID flags_index.FlagID) (FeedID, PostID) { - parts := strings.Split(string(flagID), SEPARATOR) + parts := strings.Split(string(flagID), seperator) if len(parts) != 2 { panic("invalid flag ID '" + string(flagID) + "'") } diff --git a/gno/r/social_feeds/gno.mod b/gno/r/social_feeds/gno.mod index 45e9eb93f4..34b3e573e4 100644 --- a/gno/r/social_feeds/gno.mod +++ b/gno/r/social_feeds/gno.mod @@ -7,6 +7,4 @@ require ( gno.land/p/demo/teritori/ujson v0.0.0-latest gno.land/p/demo/testutils v0.0.0-latest gno.land/p/demo/ufmt v0.0.0-latest - gno.land/r/demo/boards v0.0.0-latest - gno.land/r/demo/users v0.0.0-latest ) diff --git a/gno/r/social_feeds/messages.gno b/gno/r/social_feeds/messages.gno index edc3399520..49dc24dd80 100644 --- a/gno/r/social_feeds/messages.gno +++ b/gno/r/social_feeds/messages.gno @@ -7,8 +7,6 @@ import ( "gno.land/p/demo/teritori/ujson" ) -var PKG_PATH = "gno.land/r/demo/teritori/social_feeds" - // Ban a post type ExecutableMessageBanPost struct { dao_interfaces.ExecutableMessage diff --git a/gno/r/social_feeds/misc.gno b/gno/r/social_feeds/misc.gno index 00d7ec8811..3ec86ea2e7 100644 --- a/gno/r/social_feeds/misc.gno +++ b/gno/r/social_feeds/misc.gno @@ -1,12 +1,8 @@ package social_feeds import ( - "encoding/base64" - "std" "strconv" "strings" - - "gno.land/r/demo/users" ) func getFeed(fid FeedID) *Feed { @@ -32,15 +28,6 @@ func incGetFeedID() FeedID { return FeedID(gFeedsCtr) } -func usernameOf(addr std.Address) string { - user := users.GetUserByAddress(addr) - if user == nil { - return "" - } else { - return user.Name - } -} - func feedIDKey(fid FeedID) string { return padZero(uint64(fid), 10) } @@ -66,10 +53,6 @@ func padZero(u64 uint64, length int) string { } } -func bytesToString(b []byte) string { - return base64.RawURLEncoding.EncodeToString(b) -} - func intToString(val int) string { return strconv.Itoa(val) }