TypeScript SDK
Overview
The Prop House SDK simplifies interactions with and querying of the Prop House Protocol from any modern browser or Node.js.
Features
Installation
Usage
Initialization
The PropHouse class acts as the entry point for all Prop House protocol interactions.
To create a PropHouse
instance, provide the chain ID and a signer or provider:
House & Round Creation
A round can be created on new or existing house in a single transaction. The round can be fully funded, partially funded, or not funded at all during creation. The round can always be funded at a later time.
When funding a round, the PropHouse
contract must be approved to spend tokens prior to deposit. The address of the PropHouse
contract can be found at propHouse.contract.address
. If funding with ETH, no approval is necessary.
We currently support the following voting strategies:
BALANCE_OF_ERC721
- Voting power is determined by a user's ERC721 token balance. An optional voting power multiplier can be provided.BALANCE_OF_ERC1155
- Voting power is determined by a user's ERC1155 token balance for a specific token ID. An optional voting power multiplier can be provided.BALANCE_OF_ERC20
- Voting power is determined by a user's ERC20 token balance. An optional voting power multiplier can be provided.ALLOWLIST
- Voting power is determined by the addresses and voting power values provided. Currently, we support an allowlist of up to 2,000 members.CHECKPOINTABLE_ERC721
- Voting power is determined by a user's checkpointed ERC721 voting power, which allows delegates who don't actually hold an ERC721 balance to vote. Currently, this strategy ONLY supports the mainnet Nouns ERC721 token.
Create a round on a new house
Create a round on an existing house
Create and fund a round on a new house
Create and fund a round on an existing house
Round Asset Management
If a round is not fully funded during creation, it can be funded by anyone at any time. The protocol records depositor addresses and amounts, which allows depositors to recoup their assets, and ONLY their assets, if a round is cancelled.
Ensure that the PropHouse
contract has been approved to spend tokens prior to deposit.
Deposit a single asset to a round
Deposit many assets to a round
Proposal & Vote Submission
We leverage Starknet meta-transactions to greatly reduce the cost of proposal and vote submission. By default, the Prop House SDK sends proposals and votes through the relayer that's operated by the Prop House team.
Timed Round
Proposal Submission
This method (proposeViaSignature
) signs a proposal message using the provided signer and submits it to the Starknet meta-transaction relayer.
Vote Submission
The method (voteViaSignature
) signs a vote message using the provided signer and submits it to the Starknet meta-transaction relayer.
Typed Subgraph Client
A query
property is exposed on the PropHouse
instance, which provides a variety of methods for querying house and round state.
Alternatively, the QueryWrapper
class can be instantiated on its own:
This class is called the QueryWrapper
because it wraps queries to multiple chains under the hood (Ethereum & Starknet).
General
Get global stats
Get global protocol stats, including the number of total rounds and proposals created, as well as unique proposers and voters.
Houses
Get houses
Get paginated houses. Accepts an optional pagination and ordering configuration.
Get houses where account has creator permissions
Get paginated houses where the provided account has creator permissions. Accepts the account address, and an optional pagination and ordering configuration.
Get houses where account is owner
Get paginated houses where the provided account is the house owner. Accepts the account address, and an optional pagination and ordering configuration.
Get houses where account is owner or has creator permissions
Get paginated houses where the provided account is the house owner or has creator permissions. Accepts the account address, and an optional pagination and ordering configuration.
Get house
Get a single house. Accepts the house address.
Rounds
Get rounds
Get paginated rounds. Accepts an optional pagination and ordering configuration.
Get rounds for house
Get paginated rounds on the provided house. Accepts the house address, and an optional pagination and ordering configuration.
Get rounds where title contains
Get paginated rounds where the title contains the provided partial title text. Accepts the partial title text, and an optional pagination and ordering configuration.
Get rounds managed by account
Get paginated rounds currently managed by the provided account address. Accepts the account address, and an optional pagination and ordering configuration.
Get rounds relevant to account
Get paginated rounds in which the provided account address is a proposer or voter. Accepts the account address, and an optional pagination and ordering configuration.
Get rounds with house info relevant to account
Get paginated rounds, including their house information, in which the provided account address is a proposer or voter. Accepts the account address, and an optional pagination and ordering configuration.
Get rounds with house info
Get paginated rounds, including their house information. Accepts an optional pagination and ordering configuration.
Get rounds with house info where title contains
Get paginated rounds, including their house information, where the title contains the provided partial title text. Accepts the partial title text, and an optional pagination and ordering configuration.
Get rounds with house info managed by account
Get paginated rounds, including their house information, in which the provided account address is the round manager. Accepts the account address, and an optional pagination and ordering configuration.
Get round
Get a single round. Accepts the round address.
Get round with house info
Get a single round, including its house information. Accepts the round address.
Get round Starknet address
Get a round's Starknet address. Accepts the round address.
Get round merkle root
Get the merkle root containing the winner information for a given round. Returns null
if the round hasn't been finalized. Accepts the round address.
Proposals
Get proposals
Get paginated proposals. Accepts an optional pagination and ordering configuration.
Get proposals by account
Get paginated proposals where the proposer is the provided account address. Accepts an account address, and an optional pagination and ordering configuration.
Get proposals for round
Get paginated proposals in the provided round. Accepts the round address, and an optional pagination and ordering configuration.
Get proposal
Get a single proposal. Accepts the round address and proposal ID.
Get round proposal count
Get the number of proposals that have been submitted to a given round. Accepts the round address.
Votes
Get votes
Get paginated votes. Accepts an optional pagination and ordering configuration.
Get votes for rounds
Get paginated votes in the provided round. Accepts the round address, and an optional pagination and ordering configuration.
Get votes for proposal
Get paginated votes for the provided proposal. Accepts the round address that contains the proposal, the proposal ID, and an optional pagination and ordering configuration.
Get votes by account
Get paginated votes by an account. Accepts the account address, and an optional pagination and ordering configuration.
Get votes by account for round
Get paginated votes by an account in a given round. Accepts the account address, the round address, and an optional pagination and ordering configuration.
Get round vote count
Get the number of votes that have been submitted in a given round. Accepts the round address.
Deposits
Get deposits
Get paginated round deposits. Accepts an optional pagination and ordering configuration.
Get round deposits by account
Get paginated round deposits by the provided account. Accepts an account address, and an optional pagination and ordering configuration.
Balances
Get balances
Get paginated asset balances for many rounds, Accepts an optional pagination and ordering configuration.
Get round balances
Get paginated asset balances for a single round. Accepts the round address, and an optional pagination and ordering configuration.
Claims
Get claims
Get paginated asset claims for many rounds, Accepts an optional pagination and ordering configuration.
Get round claims by account
Get paginated round claims by the provided account. Accepts an account address, and an optional pagination and ordering configuration.
Governance Power Strategies
Governance power strategies are valid for both proposal gating and voting.
Get gov power strategies
Get paginated governance power strategies. Accepts an optional pagination and ordering configuration.
Get round proposing strategies
Get paginated proposing strategies for a given round. Accepts a round address, and an optional pagination and ordering configuration.
Get round voting strategies
Get paginated voting strategies for a given round. Accepts a round address, and an optional pagination and ordering configuration.
Custom
You can also make custom queries using the underlying EVM
and Starknet
GraphQL clients:
Last updated