Skip to content

Commit

Permalink
Add Support for Switchboard's GameOfNodes voter-weight add-in (solana…
Browse files Browse the repository at this point in the history
…-labs#732)

* switchboard ui addin

* added some switchboard things

* switchboard

* SwitchboardQueueVoterClient skeleton. bug with next.js

* removed accidental test-ledger

* loads the SwitchboardQueueVoterClient now

* began writing the logic to determine switchboardQueueVoting power in a realm with the Switchboard add-in

* load switchboard API so we can get info about queues and oracles

* fixed new Program()

* removed uncessary import in useWalletStore

* switchboard notes in readme

* Update README.md

* modify-sb-init: modify votingClient for parity with nft addin

* modify-sb-init: move around plugin files to match nft plugin

* modify-sb-init: fix anchor provider accross the ui (this is probably already in main)

* modify-sb-init: add sb logic to voting plugin hook for some async stuff / finding matching realm + voting power

* modify-sb-init: fix linting

* Update get sb vwr

* Add Switchboard Voting Power and Governance Selection

* verified createProposal works with switchboard add-in, but need to clean up

* use addin instead of switchboard program

* fixed some more conflicts

* fixed positional arguments in getVoterWeight in useRealm

* fixed createProposal

* integrated upstream changes

* removed debug

* removed another log statement

* removed magic keypairs, and added IDLs for SwitchboardGovernance

* fix new sbv2 api

* cleaned up comments

* for my own dev environment, i hardcode program version.

* instruction templates

* working instruction template for admitOracle

* removed logs and removed the true

* removed true and corrected to useCommunityVoterWeightAddin

* reset yarn.lock to master

* removed more logs

* added an undefined councilToken member to SwitchboardVoterWeight

* fixed type errors for yarn build

* builds succesfully with yarn build

* attempt to make buildable with upstream changes

* fixed revokeoracle instruction template. still need to clean up and fix lints / build.

* make test-all pass

* passes yarn test-all

* cleaned up comments

Co-authored-by: Connor O'Hara <[email protected]>
Co-authored-by: Albert Hermida <[email protected]>
  • Loading branch information
3 people authored Jun 15, 2022
1 parent 75d1aa9 commit f7b58fb
Show file tree
Hide file tree
Showing 32 changed files with 17,094 additions and 103 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# Switchboard Add-in Support

## To set this up for development with Switchboard, the first step is to get [this](https://github.com/switchboard-xyz/switchboard-core/blob/main/switchboard_v2/tests/addin-tests.ts) to work.
- [install anchor](https://project-serum.github.io/anchor/getting-started/installation.html#installing-dependencies)[install anchor](https://project-serum.github.io/anchor/getting-started/installation.html#installing-dependencies) if you don't currently have it installed
- navigate to the `switchboard_v2` directory within `switchboard-core` and run `anchor test`. This will build switchboardv2 and run the addin-tests.ts script, which will set up a realm, governance, queue, oracles, permissions, and proposal.
- you will need to make sure the pubkeys of the governance program and switchboard program throughout the codebase are pointed to your local pubkeys of those programs:
- you can determine the pubkeys of the localnet switchboardv2 and governance programs by navigating to `switchboard-core/switchboard_v2/target/deploy` and running `solana-keygen pubkey switchboard_v2-keypair.json` and `solana-keygen pubkey spl_governance-keypair.json` respectively
- You'll need to set the `declare_id!(...)` in Switchboardv2's `lib.rs` to point at your localnet switchboard program's pubkey, and you'll need to set Switchboardv2's `lib.rs` `GOVERNANCE_PID` variable to the spl_governance pubkey.
- you'll also need to ensure that `sbv2.ts` variable GOVERNANCE_PID points at the correct pubkey for your localnet governance program
- when you want to run the UI, start a local validator by running `solana-test-validator`. This will created a directory called `test-ledger` in the location you run the command.
- run the addin test suite, `anchor test`
- start the governance-ui by running `yarn dev`

## Working on governance-ui
- most of the work is in `hooks/useRealm.ts` and `hooks/useVotingPlugins.ts` in the governance-ui. The UI work is in `components/TokenBalance`

# NextJS Typescript Boilerplate

Bootstrap a developer-friendly NextJS app configured with:
Expand Down
Loading

0 comments on commit f7b58fb

Please sign in to comment.