From 3ed0ce87ba17907ab2ef4cab8c70eb2dcb8ac559 Mon Sep 17 00:00:00 2001 From: stefann-01 Date: Wed, 12 Feb 2025 10:32:52 +0100 Subject: [PATCH 1/2] fix owner for portal loop, use txlink package in render --- examples/gno.land/r/stefann/fomo3d/fomo3d.gno | 2 +- examples/gno.land/r/stefann/fomo3d/render.gno | 26 +++++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/examples/gno.land/r/stefann/fomo3d/fomo3d.gno b/examples/gno.land/r/stefann/fomo3d/fomo3d.gno index b2384ba07f4..618ff3a1b63 100644 --- a/examples/gno.land/r/stefann/fomo3d/fomo3d.gno +++ b/examples/gno.land/r/stefann/fomo3d/fomo3d.gno @@ -70,7 +70,7 @@ var ( ) func init() { - Ownable = ownable.New() + Ownable = ownable.NewWithAddress(std.Address("g1sd5ezmxt4rwpy52u6wl3l3y085n8x0p6nllxm8")) players = avl.NewTree() gameState.Ended = true hof.Register() diff --git a/examples/gno.land/r/stefann/fomo3d/render.gno b/examples/gno.land/r/stefann/fomo3d/render.gno index ba0c7b8f147..83a5f42705c 100644 --- a/examples/gno.land/r/stefann/fomo3d/render.gno +++ b/examples/gno.land/r/stefann/fomo3d/render.gno @@ -7,6 +7,7 @@ import ( "gno.land/p/demo/grc/grc721" "gno.land/p/demo/ufmt" + "gno.land/p/moul/txlink" "gno.land/r/demo/users" ) @@ -34,11 +35,20 @@ func RenderHome() string { // Play Game section builder.WriteString("## How to Play\n\n") - builder.WriteString(ufmt.Sprintf("1. **Buy Keys** - Send GNOT to this realm with function [`BuyKeys()`](%s)\n", gameState.BuyKeysLink)) - builder.WriteString(ufmt.Sprintf("2. **Collect Dividends** - Call [`ClaimDividends()`](%s) to collect your earnings\n", gameState.ClaimDividendsLink)) + builder.WriteString(ufmt.Sprintf("1. **Buy Keys** - Send GNOT to this realm with function [`BuyKeys()`](%s) or [click here](%s)\n", + gameState.BuyKeysLink, + txlink.Call("BuyKeys"), + )) + builder.WriteString(ufmt.Sprintf("2. **Collect Dividends** - Call [`ClaimDividends()`](%s) or [click here](%s) to collect your earnings\n", + gameState.ClaimDividendsLink, + txlink.Call("ClaimDividends"), + )) builder.WriteString("3. **Check Your Stats** - Append `:player/` followed by your address or namespace to the current URL to view your keys and dividends\n") if gameState.Ended { - builder.WriteString(ufmt.Sprintf("4. **Start New Round** - Call [`StartGame()`](%s) to begin a new round\n", gameState.StartGameLink)) + builder.WriteString(ufmt.Sprintf("4. **Start New Round** - Call [`StartGame()`](%s) or [click here](%s) to begin a new round\n", + gameState.StartGameLink, + txlink.Call("StartGame"), + )) } builder.WriteString("\n") @@ -113,9 +123,15 @@ func RenderPlayer(addr std.Address, keys int64, dividends int64) string { } builder.WriteString("## Actions\n\n") - builder.WriteString(ufmt.Sprintf("* To buy more keys, send GNOT to this realm with [`BuyKeys()`](%s)\n", gameState.BuyKeysLink)) + builder.WriteString(ufmt.Sprintf("* To buy more keys, send GNOT to this realm with [`BuyKeys()`](%s) or [click here](%s)\n", + gameState.BuyKeysLink, + txlink.Call("BuyKeys"), + )) if dividends > 0 { - builder.WriteString("* You have unclaimed dividends! Call `ClaimDividends()` to collect them\n") + builder.WriteString(ufmt.Sprintf("* You have unclaimed dividends! Call [`ClaimDividends()`](%s) or [click here](%s) to collect them\n", + gameState.ClaimDividendsLink, + txlink.Call("ClaimDividends"), + )) } return builder.String() From 51f382d0ddff4a9879eb1544696441ace8faaee7 Mon Sep 17 00:00:00 2001 From: stefann-01 Date: Wed, 12 Feb 2025 11:14:17 +0100 Subject: [PATCH 2/2] fix mix --- examples/gno.land/r/stefann/fomo3d/render.gno | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/gno.land/r/stefann/fomo3d/render.gno b/examples/gno.land/r/stefann/fomo3d/render.gno index 83a5f42705c..ea75a7c76d7 100644 --- a/examples/gno.land/r/stefann/fomo3d/render.gno +++ b/examples/gno.land/r/stefann/fomo3d/render.gno @@ -35,19 +35,19 @@ func RenderHome() string { // Play Game section builder.WriteString("## How to Play\n\n") - builder.WriteString(ufmt.Sprintf("1. **Buy Keys** - Send GNOT to this realm with function [`BuyKeys()`](%s) or [click here](%s)\n", - gameState.BuyKeysLink, + builder.WriteString(ufmt.Sprintf("1. **Buy Keys** - Send GNOT to this realm with [`BuyKeys()`](%s) or [click here](%s)\n", txlink.Call("BuyKeys"), + gameState.BuyKeysLink, )) builder.WriteString(ufmt.Sprintf("2. **Collect Dividends** - Call [`ClaimDividends()`](%s) or [click here](%s) to collect your earnings\n", - gameState.ClaimDividendsLink, txlink.Call("ClaimDividends"), + gameState.ClaimDividendsLink, )) builder.WriteString("3. **Check Your Stats** - Append `:player/` followed by your address or namespace to the current URL to view your keys and dividends\n") if gameState.Ended { builder.WriteString(ufmt.Sprintf("4. **Start New Round** - Call [`StartGame()`](%s) or [click here](%s) to begin a new round\n", - gameState.StartGameLink, txlink.Call("StartGame"), + gameState.StartGameLink, )) } builder.WriteString("\n") @@ -124,13 +124,13 @@ func RenderPlayer(addr std.Address, keys int64, dividends int64) string { builder.WriteString("## Actions\n\n") builder.WriteString(ufmt.Sprintf("* To buy more keys, send GNOT to this realm with [`BuyKeys()`](%s) or [click here](%s)\n", - gameState.BuyKeysLink, txlink.Call("BuyKeys"), + gameState.BuyKeysLink, )) if dividends > 0 { builder.WriteString(ufmt.Sprintf("* You have unclaimed dividends! Call [`ClaimDividends()`](%s) or [click here](%s) to collect them\n", - gameState.ClaimDividendsLink, txlink.Call("ClaimDividends"), + gameState.ClaimDividendsLink, )) }