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

Issues with returned policy format #159

Open
OllieMurray opened this issue Apr 15, 2022 · 2 comments
Open

Issues with returned policy format #159

OllieMurray opened this issue Apr 15, 2022 · 2 comments

Comments

@OllieMurray
Copy link

sputnik dao contract - returns from view calls like get_policy are not provided in a format that can be re-submitted to the DAO using 'propose policy' . It is likely the case that returns to calls in all contracts on near are not formatted such that they could then be loaded to json files and submitted in function calls to near contracts. It could be useful to include functionality in near to format returns responses in the following format
"roles": [
{
"name": "Test",
"kind": { "Member": ["nghiatutuan.near", "thalasith.near"] },
"permissions": [":"],
"vote_policy": {
"*": {
"weight_kind": "TokenWeight",
"quorum": "0",
"threshold": "1"
}
}
}
...

as opposed to the current format
roles: [
{
name: 'Test',
kind: { 'Member'
...
so that they can then be submitted to the contract for processing after user field modification without the need for formatting.

For clarity, the difference in formats between the above examples is that the format that can be submitted has " " around field names and their values. the current format only has ' ' around field values.

@TrevorJTClarke
Copy link
Contributor

@OllieMurray interesting find, can you give more details on how you generated this example?

@ctindogaru
Copy link
Collaborator

@OllieMurray thanks for the report.

At the moment, we are returning a Policy struct when calling the get_policy method. From what I understand, you want us to return a JSON value instead. That's possible, but it would be a backward incompatible change and it might break existing users.

What I suggest is to create a different method called get_json_policy that would return a json representation of the policy. How does that sound?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants