@metadaoproject/futarchy-sdk

4.0.0-alpha.54 • Public • Published

Futarchy TypeScript SDK for The MetaDAO

The Futarchy TypeScript SDK provides developers with a powerful, easy-to-use interface to interact with futarchy-based Solana programs deployed by The MetaDAO that enabled proposals powered by decision-markets. This SDK abstracts away ,any complexities, allowing developers to manage DAOs, proposals, and token balances with simple, asynchronous function calls.

Features

  • DAO Management: Fetch details of all DAOs or a specific DAO within The MetaDAO ecosystem.
  • Proposals: Retrieve proposals associated with a DAO, along with their respective vaults.
  • Token Balances: Query wallet balances of DAO tokens as well as conditional tokens of proposals for DAO members.

Installation

pnpm install -P @metadaoproject/futarchy-sdk

Usage

To start using the SDK, you need to import it into your project, along with necessary types from Solana's web3.js library. You can import the RPC client for example. Then you select the AUTOCRAT_VERSION you would like(0 is the latest). AUTOCRAT_VERSION refers to the version of the main Solana program that powers The MetaDAO.

import { PublicKey } from "@solana/web3.js";
import { FutarchyRPCClient, AUTOCRAT_VERSIONS } from "@metadaoproject/futarchy-sdk";

Initializing the Client

Now with the goodies imported, initialize the FutarchyRPCClient.

const provider = new AnchorProvider(connection, wallet, {});
const programVersion = AUTOCRAT_VERSIONS[0];
const client = FutarchyRPCClient.make(programVersion, provider);

Fetching DAOs

To fetch all DAOs:

const daos = await client.daos.fetchAllDaos();

To fetch a specific DAO by its address:

const daoAddress = "YourDaoAddressHere";
const dao = await client.daos.fetchDao(daoAddress);

Working with Proposals

To fetch proposals for a specific DAO:

const proposals = await client.proposals.fetchProposals(dao);

Managing Token Balances

To fetch main token wallet balances for a DAO member:

const ownerWallet = new PublicKey("YourWalletPublicKeyHere");
const balances = await client.balances.fetchMainTokenWalletBalances(
  dao,
  ownerWallet
);

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
4.0.0-alpha.5491latest

Version History

VersionDownloads (Last 7 Days)Published
4.0.0-alpha.5491
4.0.0-alpha.530
4.0.0-alpha.520
4.0.0-alpha.510
4.0.0-alpha.500
4.0.0-alpha.490
4.0.0-alpha.480
4.0.0-alpha.470
4.0.0-alpha.460
4.0.0-alpha.450
4.0.0-alpha.440
4.0.0-alpha.430
4.0.0-alpha.420
4.0.0-alpha.410
4.0.0-alpha.400
4.0.0-alpha.390
4.0.0-alpha.380
4.0.0-alpha.370
4.0.0-alpha.360
4.0.0-alpha.350
4.0.0-alpha.340
4.0.0-alpha.330
4.0.0-alpha.320
4.0.0-alpha.3128
4.0.0-alpha.300
4.0.0-alpha.290
4.0.0-alpha.280
4.0.0-alpha.270
4.0.0-alpha.260
4.0.0-alpha.250
4.0.0-alpha.240
4.0.0-alpha.230
4.0.0-alpha.210
4.0.0-alpha.200
4.0.0-alpha.190
4.0.0-alpha.180
4.0.0-alpha.170
4.0.0-alpha.160
4.0.0-alpha.150
4.0.0-alpha.140
4.0.0-alpha.130
4.0.0-alpha.120
4.0.0-alpha.110
4.0.0-alpha.100
4.0.0-alpha.90
4.0.0-alpha.80
4.0.0-alpha.70
4.0.0-alpha.60
4.0.0-alpha.50
4.0.0-alpha.30
4.0.0-alpha.20
4.0.0-alpha.10
4.0.0-alpha.00
3.0.0-alpha.210
3.0.0-alpha.200
3.0.0-alpha.190
3.0.0-alpha.180
3.0.0-alpha.170
3.0.0-alpha.160
3.0.0-alpha.150
3.0.0-alpha.140
3.0.0-alpha.130
3.0.0-alpha.110
3.0.0-alpha.100
3.0.0-alpha.90
3.0.0-alpha.80
3.0.0-alpha.70
3.0.0-alpha.60
3.0.0-alpha.50
3.0.0-alpha.40
3.0.0-alpha.30
3.0.0-alpha.20
3.0.0-alpha.10
3.0.0-alpha.00
2.0.0-alpha.260
2.0.0-alpha.250
2.0.0-alpha.240
2.0.0-alpha.230
2.0.0-alpha.220
2.0.0-alpha.210
2.0.0-alpha.200
2.0.0-alpha.190
2.0.0-alpha.180
2.0.0-alpha.170
2.0.0-alpha.160
2.0.0-alpha.150
2.0.0-alpha.140
2.0.0-alpha.130
2.0.0-alpha.120
2.0.0-alpha.110
2.0.0-alpha.100
2.0.0-alpha.90
2.0.0-alpha.80
2.0.0-alpha.70
2.0.0-alpha.60
2.0.0-alpha.50
2.0.0-alpha.40
2.0.0-alpha.30
2.0.0-alpha.20
2.0.0-alpha.10
2.0.0-alpha.00
1.1.0-alpha.360
1.1.0-alpha.350
1.1.0-alpha.340
1.1.0-alpha.330
1.1.0-alpha.320
1.1.0-alpha.310
1.1.0-alpha.300
1.1.0-alpha.290
1.1.0-alpha.280
1.1.0-alpha.270
1.1.0-alpha.260
1.1.0-alpha.250
1.1.0-alpha.240
1.1.0-alpha.230
1.1.0-alpha.220
1.1.0-alpha.210
1.1.0-alpha.200
1.1.0-alpha.190
1.1.0-alpha.180
1.1.0-alpha.170
1.1.0-alpha.160
1.1.0-alpha.150
1.1.0-alpha.140
1.1.0-alpha.130
1.1.0-alpha.120
1.1.0-alpha.110
1.1.0-alpha.100
1.1.0-alpha.90
1.1.0-alpha.80
1.1.0-alpha.70
1.1.0-alpha.60
1.1.0-alpha.50
1.1.0-alpha.40
1.1.0-alpha.30
1.1.0-alpha.20
1.1.0-alpha.10
1.1.0-alpha.00

Package Sidebar

Install

npm i @metadaoproject/futarchy-sdk

Weekly Downloads

119

Version

4.0.0-alpha.54

License

none

Unpacked Size

4.5 MB

Total Files

297

Last publish

Collaborators

  • reidg
  • decartesol
  • lukasdeco
  • 0xnallok
  • metaproph3t