-
Notifications
You must be signed in to change notification settings - Fork 398
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
docs: improve Realm, PrevRealm and CurrentRealm docs #2592
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
Related: #1469 My PR above has been sitting for a long time, maybe someone else should take a look and we can merge it. @zivkovicmilos hasn't gotten around to it. |
I'll take a look @leohhhn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this. A few things should be addressed before merging and there is a question about the wording in the PrevRealm section.
application in your mind with built-in composability, | ||
transparency, and censorship resistance. Here are some ideas of what you can build with realms: | ||
A Realm represents an on-chain entity which has an address, can execute code | ||
and is capable of managing Coins associated with the given address. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and is capable of managing Coins associated with the given address. | |
and is capable of managing [Coins](../reference/stdlibs/std/coins.md) associated with the given address. |
application while being: | ||
|
||
- Composable: using other realms is an `import` statement away. | ||
- Transparent: like all code on Gno.land, they must be added to the chain in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Transparent: like all code on Gno.land, they must be added to the chain in | |
- Transparent: like all code on gno.land, they must be added to the chain in |
I understand we are now supposed to refer to gno.land in all lowercase from now on.
- Self-custodial financial exchanges (decentralized exchanges), like | ||
[Gnoswap](https://github.com/gnoswap-labs/gnoswap). | ||
- Chess servers, like [GnoChess](https://github.com/gnolang/gnochess), and | ||
generally speaking game servers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generally speaking game servers. | |
generally speaking, game servers. |
```go | ||
func CurrentRealm() Realm | ||
``` | ||
Returns current [Realm](realm.md) object. | ||
CurrentRealm returns the [Realm](md) in which the caller is being executed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CurrentRealm returns the [Realm](md) in which the caller is being executed. | |
CurrentRealm returns the [Realm](realm.md) in which the caller is being executed. |
|
||
PrevRealm returns the [Realm](realm.md) which called the code being executed. | ||
The value of PrevRealm remains the same if called by a function within the | ||
same realm, or a function in a pure package. It will change if called by a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will change if called by a realm with a different pkgpath.
Was this copied from the PrevRealm section? Because it doesn't change when called by realm1 which has a different pkgpath than the main package.
func CurrentRealm() Realm { | ||
addr, path := getRealm(0) | ||
return Realm{Address(addr), path} | ||
} | ||
|
||
// PrevRealm returns the [Realm] which called the code being executed. | ||
// The value of PrevRealm remains the same if called by a function within the | ||
// same realm, or a function in a pure package. It will change if called by a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as in the doc
This PR is stale because it has been open 3 months with no activity. Remove stale label or comment or this will be closed in 3 months. |
This PR is stale because it has been open 3 months with no activity. Remove stale label or comment or this will be closed in 3 months. |
stale and updated in docs-v2 |
Following some confusion for onbloc.