GithubHelp home page GithubHelp logo

solana-labs / governance-ui Goto Github PK

View Code? Open in Web Editor NEW
281.0 8.0 538.0 142.8 MB

Home Page: https://realms.today

License: Apache License 2.0

Shell 0.01% TypeScript 99.39% JavaScript 0.28% CSS 0.32% Procfile 0.01%

governance-ui's Introduction

Using custom Swap API endpoints

You can set custom URLs via the configuration for any self-hosted Jupiter APIs, like the V6 Swap API or Paid Hosted APIs Here is an example:

NEXT_PUBLIC_JUPTER_SWAP_API_ENDPOINT=https://quote-api.jup.ag/v6

governance-ui's People

Contributors

0xcen avatar 0xshuk avatar abrzezinski94 avatar asktree avatar brittcyr avatar bryzettler avatar dankelleher avatar dependabot[bot] avatar dukemtambo avatar emoney023 avatar evgeniivoznyuk avatar guibescos avatar ilovespectra avatar johnrees avatar jpbogle avatar kevinheavey avatar kishithemechanic avatar microwavedcola1 avatar mjcage avatar mschneider avatar mury12 avatar nramadas avatar ochaloup avatar orelsanpls avatar saml33 avatar sebastianbor avatar silas-x avatar stevesarmiento avatar tlrjs avatar tomjohn1028 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

governance-ui's Issues

Cluster navigation button

As a user, I would like to have a button that allows me to switch between mainnet, devnet, and custom RPC endpoints.
The Solana explorer does this well:
image
image

I'll find the relevant component code and link it here and we can discuss how to implement it in the governance-ui.

Text overflowing outside of div

Not sure if this is a bug or intentional for testing, but in both cases it better to handle it.
One possible solution will be add trailing .... , when text overflows max-width (eg : Solana-is-a-decentra....)

Browser : Safari
System : MacOS

Screenshot 2022-05-08 at 6 49 51 AM

NFT collection governance

hi guys we have a collection of 111 NFTS used for governance. i have it set to 51% which uses the total collection size. my question:

Is it possible to be set at 51% of those who voted. so ie : if only 100 votes, to pass it would need 51 of those votes as opposed to the 57 needed when using the entire collection. if so how would i go about setting this up? thanks

Cannot add Token Treasury to DAO

Two weeks ago I was able to add a token treasury to a DAO, where the UI asked for the type of treasury (SOL, Token, or NFT) and the token mint address. This seems to no longer be an option and only SOL treasuries can be added. If I refresh the "Create new DAO wallet" page (https://realms.today/dao/YOUR_DAO_ADDRESS/treasury/new) the type dropdown and mint address textboxes appear briefly until they disappear about 7 seconds later.

I see no errors in the browser console, only the text:

Program version (simulation) {major: 2, minor: 2, patch: 4}
refresh

I have also ensured that I have deposited more tokens than the value set for "Min community tokens to create governance".

I have tested this on devnet and mainnet.

nft voting plugin

Can anybody explain what this verified collection ID that is needed for the nft voting plugin? my cmv2 minted collection is verified and the metadata supports this verified = 1, but i dont see this verified ID as shown in the docs. creator id, cm id, update authority etc yes... can anyone please tell me where i can find this or where / how to create.. thanks

Package.json [dev]Dependencies cleanup

devDependencies

  • dependency @emotion/babel-preset-css-prop appears unused, removing it doesn't break the build, which it would if it were an essential build/compilation dependency
  • dependency identity-obj-proxy appears unused

Dependencies

  • dependency "@metaplex/js" "^4.2.1" appears to be unused.
  • dependency "@project-serum/borsh": "^0.2.2" appears to be unused.
    • if it is required by another package, it should show explicitly either as a dependency or peerDependency of said package.
  • dependency @project-serum/common appears to be redundant with Anchor ?
  • dependency @project-serum/sol-wallet-adapter shouldn't be needed, it's only used to provide a Wallet or SigneWalletAdapter type..
  • dependency moment is bloated, inneficient & ~outdated, ideally should be replaced by modern, lightweight alternatives such as date-fns, or day.js / luxon, if native Intl API is insufficient
  • dependency node-fetch is only used for a single script, can trivially be removed in favor of native http.request utility function
  • dependency react-portal can be removed in favor of React's native portal API.
  • dependency ts-node & tsconfig-paths are properly unnecessary

Improved proposal TX failure handling

Solana's network has been dropping transactions left and right these days. When submitting a proposal that is split into more than one transaction often times the create proposal TX may make it through, but the insert tx/instruction to the proposal fails.

The create proposal code should help recover or use these accounts.

Native Treasury Accounts Not Handled Properly

There are a few places where the code checks that a treasury account has both a mint and a token. These are sometimes not true for native treasury accounts. One example of this is native accounts aren't included in the total treasury balance.

Unable to mint a large amount of tokens

I have created a token with the default of 9 decimals and the largest value I can enter to mint in the UI is 9007199, which lines up with JavaScript Number.MAX_SAFE_INTEGER (9007199254740991) assuming 9 digits that represent the decimals are then added. In other words, 9007199000000000 works, but 9007200000000000 does not.

When I press Preview instruction I get

Can't simulate transaction
The instruction is invalid

No social card previews or metadata on shared proposal URLs

if you share a proposal URL on social platforms, the link preview doesn't show any information

twitter

Screenshot 2021-12-23 at 10 53 17 AM

telegram

Screenshot 2021-12-23 at 10 49 11 AM

this is assumably because the parsers either do not load javascript, or they do but don't wait for the data to load from RPCs

> curl -sNL https://dao-beta.mango.markets/dao/MNGO/proposal/AgwjETY7YNSZHara17PFSkN6DPWcefiEe5RYQoo5VNL8 | xmllint --html --xpath "/html/head/meta[starts-with(@property, 'og:')]" -


<meta property="og:type" content="website"><meta property="og:title" content="Solana Governance"><meta property="og:description" content="Discuss and vote on Solana Governance proposals.">

proposed solution

consider loading RPC data server-side from next/vercel (especially if it's a crawler user-agent) to enable rich previews

Notifier not fetching all proposals due to RPC rate limits

The governance notifier is currently using the public RPC endpoint and is being rate limited on the getProgramAccounts instruction.

There is no retry logic when this happens the data it uses is incomplete. I think it either needs to implement retry or throttling behaviour, or use a different endpoint.

public rpc - api.mainnet-beta.solana.com

Unexpected response {"jsonrpc":"2.0","error":{"code":429,"message":"Too requests for a specific RPC call, contact your app developer or [email protected]."},"id":1}

-- countJustOpenedForVoting: 0, countVotingNotStartedYet: 19, countClosed: 43

genesysgo rpc

-- countJustOpenedForVoting: 0, countVotingNotStartedYet: 20, countClosed: 45

theindex.io

-- countJustOpenedForVoting: 0, countVotingNotStartedYet: 20, countClosed: 45

Handling Governance DAO metadata in the code is unscalable

Problem:

Governance DAO metadata is currently added to a json file to show up on the realms deployed UI.

This is not scalable and if DAOs ever get popular on Solana this will be a major time sink. Case in point: the unscalable token-list.

Solution:

Token list is making its way on chain for metadata. Governance Metadata should be on chain as well. Governance metadata should be created like the token metadata. Token metadata is a PDA off of the mint that the mint authority is required to initially create it. In it has the fields needed for metadata:

{
  "name": "USD Coin",
  "symbol": "USDC",
  "description": "Fully reserved fiat-backed stablecoin created by Circle.",
  "image": "https://www.circle.com/hs-fs/hubfs/sundaes/USDC.png?width=540&height=540&name=USDC.png"
}

Governance metadata should be a PDA off of the realm address or equivalent to mint, and store just the same information:

{
    "symbol": "BD",
    "displayName": "Bland DAO",
    "programId": "GovER5Lthms3bLBqWub97yVrMmEogzX7xNjdXpPPCVZw",
    "realmId": "DMTkorwRhKbPGioE5kr1BHDBEcwFSUepyuz66ro3MQXU",
    "website": "https://website.land",
    "twitter": "@twitterhandle",
    "ogImage": "www.logo.png"
  }

Let's kill this problem before it becomes a huge problem.

Question - how to add logo, website, twitter metadata?

First off, thanks for making the wizard it works really well! I see many organizations have metadata, but didn't see any options for these items during the creation steps.

  1. How can I add them?
  2. Is it possible to update the the organization name?

Logo on tiles
image

Website / twitter / etc after clicking
image

Package.json metadata & scripts cleanup

Metadata

  • Package name currently is with-typescript-eslint-jest.
    • Change to @solana/governance-ui
  • Author is @erikdstock
    • remove the field if no specific author
  • License is MIT
    • is this correct?
    • in any case, have a corresponding LICENSE file in the repository

Scripts

  • tc script is not explicit, prefer typecheck:watch or remove if not really used
  • type-check script would be less confusing to type imo if it were named typecheck
  • test-all script name is misleading, could be validate

Add Transfer Program Upgrade Authority proposal support

Screen Shot 2022-06-28 at 5 04 33 PM

Currently Realms does not support transferring program authorities. Transferring program authorities is beneficial if
A) a DO wants to change current infrastructure to have a separate protocol council realm
B) a DO gets bought out (likely by another DO) and needs to transfer all assets

Feature: fund an assembly budget from a governance treasury vault

This workflow would required the concept of a meta-instruction.

The user should be able specify all budget parameters in one form:

  1. funding treasury vault
  2. all budget distributors and the size of their budget allocation
  3. the dates defining the period in which this budget can be used

This would result in a series of Instructions:

  1. Create new distribution mint owned by the token governance account of the treasury vault
  2. Create associated token accounts for this mint for n user
  3. Mint the appropriate amount of distribution tokens to n users
  4. Initialize the distributor
  5. Transfer the budget into the distributor vault

Set Realm Authority: display governance addresses

Set Realm Authority seems a little confusing as it displays the asset accounts rather than the high level governance accounts.

As a user I was expecting the addresses here to match up with one of the governances on the left as I would not want the authority to be set to some asset account address.

image

Error when showing the DAO members

create-realm: mints supply error

The number of decimals in the token supply * the decimals cannot exceed 16, else it throws an error Number can only safely store up to 53 bits

For example, create a community mint with the default 9 decimals, then mint 10_000_000 tokens.

pages/realms/new.tsx:152:
  const handleCommunityMint = async (mintId) => {
    handleSetForm({
      communityMintId: mintId,
      communityMint: undefined,
    })
    try {
      const mintPublicKey = new PublicKey(mintId)
      const mint = await tryGetMint(connection.current, mintPublicKey)
      console.log("tryGetMint");
      if (mint) {
        console.log("mint!.account.supply", mint!.account.supply);
        const supply = mint!.account.supply.toNumber()
        try {
          const supply = mint!.account.supply.toNumber()
        } catch (e) {
          console.log('failed to get mint supply', e)
        }
        ```

I'm not sure the best way to resolve this. Maybe leaving supply as a BN will do the trick, will have to trace the code and see how many changes are needed. 

Wallet button icon doesn't reflect wallet

Selecting a wallet other than Phantom does not update the wallet icon:
image
You can see the icon and the wallet [Solflare], do not match:
image

Steps to reproduce the behavior:

  1. Click on drop list on Wallet Selector
  2. Select Solflare
  3. Green tick changed to selected wallet (note: might be good to make this more obvious, it didn't occur to me immediately that I needed to close and click again to "invoke" wallet)
  4. Close drop list and wallet has changed to Solflare, but icon is still Phantom.

Expected behavior
The icon should match the wallet.

Make it possible to SingOff Draft Proposals

Summary

It's currently possible to create a draft proposal but then there is no way to Sign it off without using Realm Explorer

Solution

Make it possible to Sign off draft proposal (based on the Realm Explorer code).
The Sing Off button should be located in the Vote panel

Feature: Establish a program update council

There are a few workflows that require creating a new governance from the UI.
One example would be the recent vote I created to establish a program update council: https://dao-beta.mango.markets/dao/MNGO/proposal/GqowP2B2ZaACxrhUy2nAq7Hem4ZoN5HNtb4zpgRfzF8r

Here are the steps I went through to set this up:

  1. create a 0 decimal mint with spl-token cli
  2. create an associated token account for every council member with spl-token cli
  3. transfer mint under governance
  4. create a proposal to mint the tokens to the associated token accounts
  5. create a new realm governed by the new mint
  6. create a new governance governing the mango v3 program
  7. transfer program update key to the new governance

From now on we can vote on program updates using the council mint.

Unable to create token transfer proposal

(devnet) When creating a proposal to send a token from a treasury (NFT or else), the "Propose" button stays greyed out even though I have both council and community tokens deposited.

Screenshot 2022-04-15 at 12 44 43

The function canUseGovernanceForInstruction doesn't seem to be returning the right boolean from checking if I have the required tokens or not. Changing to hardcoded return true enables the Propose button and I'm able to create and execute proposals. Link to code.

Screenshot 2022-04-15 at 12 46 22

Inconsistent cluster state

I'm trying to a full governance UI run through on devnet and running into some weird state issues. I'm using a mint from devnet to create a Treasury account, but the request for the AccountInfo returns null because it is connecting to the mainnet RPC url. Yet the cluster query string param is set to devnet and you can see the devnet toggle is also set.

Screen Shot 2022-03-10 at 2 20 11 PM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.