SDK DAO Creation
Create a DAO using the SDK
Create a DAO Using the SDK
Prerequisites
TypeScript SDK
npm install @realms-today/spl-governance @solana/web3.jsStep 1: Create a Realm
import {
withCreateRealm,
MintMaxVoteWeightSource,
} from '@realms-today/spl-governance';
import {
Connection,
Keypair,
PublicKey,
sendAndConfirmTransaction,
Transaction,
TransactionInstruction,
} from '@solana/web3.js';
import BN from 'bn.js';
const connection = new Connection('https://api.mainnet-beta.solana.com');
const payer = Keypair.fromSecretKey(/* your key */);
const communityMint = new PublicKey('YOUR_COMMUNITY_TOKEN_MINT');
const councilMint = new PublicKey('YOUR_COUNCIL_TOKEN_MINT'); // optional
// You can use the default shared instance or deploy your own
const programId = new PublicKey('GovER5Lthms3bLBqWub97yVrMmEogzX7xNjdXpPPCVZw');
const programVersion = 3;
const realmName = 'My DAO';
const instructions: TransactionInstruction[] = [];
const realmAddress = await withCreateRealm(
instructions,
programId,
programVersion,
realmName,
payer.publicKey, // realm authority
communityMint,
payer.publicKey, // payer
councilMint, // optional council mint (undefined if none)
MintMaxVoteWeightSource.FULL_SUPPLY_FRACTION,
new BN(1), // min community weight to create governance
);
const tx = new Transaction().add(...instructions);
await sendAndConfirmTransaction(connection, tx, [payer]);Step 2: Deposit Governing Tokens
Step 3: Create a Governance
Step 4: Create the Native Treasury (DAO Wallet)
Step 5: Create a Proposal
Step 6: Cast a Vote
Rust SDK
Program Instances
Instance
Program ID
Notes
Governance Configuration Reference
Parameter
Description
Last updated