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

feat: add new options endpoint #940

Merged
merged 4 commits into from
Oct 9, 2024
Merged

feat: add new options endpoint #940

merged 4 commits into from
Oct 9, 2024

Conversation

wa0x6e
Copy link
Contributor

@wa0x6e wa0x6e commented Oct 8, 2024

Closes https://github.com/snapshot-labs/workflow/issues/223

This PR adds a new options endpoint to return all data from the options table

Endpoint do not have any filter and pagination, and will always return all results.

Create the table with

CREATE TABLE options (
  name VARCHAR(100) NOT NULL,
  value VARCHAR(100) NOT NULL,
  PRIMARY KEY (name)
);

Then you can query with

query {
  options {
  	name 
  	value
	}
}

which should return something like

{
  "data": {
    "options": [
      {
        "name": "limit.test",
        "value": "12"
      }
    ]
  }
}

Insert data for mainnet (from https://github.com/snapshot-labs/snapshot-sequencer/blob/2a94d8fdcb592d9b087a33508eb02db76613cccd/src/helpers/limits.ts)

INSERT INTO `options` (`name`, `value`) VALUES
('ecosystem_spaces', 'orbapp.eth,cakevote.eth,outcome.eth,polls.lenster.xyz,daotest.dcl.eth,arbitrumfoundation.eth'),
('limit.active_proposals_per_author', '20'),
('limit.ecosystem_space.proposal.day', '150'),
('limit.ecosystem_space.proposal.month', '750'),
('limit.flagged_space.proposal.day', '0'),
('limit.flagged_space.proposal.month', '0'),
('limit.follows_per_user', '25'),
('limit.space.proposal.day', '3'),
('limit.space.proposal.month', '15'),
('limit.turbo_space.proposal.day', '40'),
('limit.turbo_space.proposal.month', '200'),
('limit.verified_space.proposal.day', '20'),
('limit.verified_space.proposal.month', '100');

Should be the same for testnet, beside ecosystem spaces, which should just be citiesdao.eth

@wa0x6e wa0x6e marked this pull request as ready for review October 8, 2024 10:49
src/graphql/operations/options.ts Outdated Show resolved Hide resolved
src/helpers/schema.sql Show resolved Hide resolved
@wa0x6e wa0x6e requested a review from ChaituVR October 8, 2024 13:37
Copy link
Member

@ChaituVR ChaituVR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tAck

@wa0x6e wa0x6e merged commit 2313dac into master Oct 9, 2024
2 checks passed
@wa0x6e wa0x6e deleted the feat-constant-table branch October 9, 2024 08:26
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

Successfully merging this pull request may close these issues.

2 participants