quest-dao-client 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # quest-dao-client
2
+
3
+ The official library for interacting with QuestDAO's on-chain quest and voting systems.
4
+
5
+ ## features
6
+
7
+ - **createQuest**: lock bounties in escrow for agent-specific tasks.
8
+ - **delegateVote**: participate in DAO governance by delegating voting power.
9
+ - **Robustness**: handles all Clarity value conversions automatically.
10
+
11
+ ## installation
12
+
13
+ ```bash
14
+ npm install quest-dao-client
15
+ ```
16
+
17
+ ## usage
18
+
19
+ ```typescript
20
+ import { createQuest } from 'quest-dao-client';
21
+
22
+ await createQuest({
23
+ contractAddress: 'ST...',
24
+ senderKey: '...',
25
+ network: 'mainnet'
26
+ }, 'ST_AGENT_OWNER...', 42, 1000000); // 1 STX bounty
27
+ ```
@@ -0,0 +1,7 @@
1
+ export interface QuestOptions {
2
+ contractAddress: string;
3
+ senderKey: string;
4
+ network?: 'mainnet' | 'testnet';
5
+ }
6
+ export declare function createQuest(opts: QuestOptions, agentOwner: string, agentId: number, bounty: number): Promise<import("@stacks/transactions").TxBroadcastResult>;
7
+ export declare function delegateVote(opts: QuestOptions, delegateAddress: string): Promise<import("@stacks/transactions").TxBroadcastResult>;
package/dist/index.js ADDED
@@ -0,0 +1,38 @@
1
+ import { makeContractCall, broadcastTransaction, AnchorMode, PostConditionMode, uintCV, standardPrincipalCV, } from '@stacks/transactions';
2
+ import { StacksMainnet, StacksTestnet } from '@stacks/network';
3
+ export async function createQuest(opts, agentOwner, agentId, bounty) {
4
+ const network = opts.network === 'mainnet' ? new StacksMainnet() : new StacksTestnet();
5
+ const txOptions = {
6
+ contractAddress: opts.contractAddress,
7
+ contractName: 'quest-escrow',
8
+ functionName: 'create-quest',
9
+ functionArgs: [
10
+ standardPrincipalCV(agentOwner),
11
+ uintCV(agentId),
12
+ uintCV(bounty),
13
+ ],
14
+ senderKey: opts.senderKey,
15
+ network,
16
+ anchorMode: AnchorMode.Any,
17
+ postConditionMode: PostConditionMode.Allow,
18
+ fee: 400,
19
+ };
20
+ const transaction = await makeContractCall(txOptions);
21
+ return broadcastTransaction(transaction, network);
22
+ }
23
+ export async function delegateVote(opts, delegateAddress) {
24
+ const network = opts.network === 'mainnet' ? new StacksMainnet() : new StacksTestnet();
25
+ const txOptions = {
26
+ contractAddress: opts.contractAddress,
27
+ contractName: 'dao-voting',
28
+ functionName: 'delegate',
29
+ functionArgs: [standardPrincipalCV(delegateAddress)],
30
+ senderKey: opts.senderKey,
31
+ network,
32
+ anchorMode: AnchorMode.Any,
33
+ postConditionMode: PostConditionMode.Allow,
34
+ fee: 400,
35
+ };
36
+ const transaction = await makeContractCall(txOptions);
37
+ return broadcastTransaction(transaction, network);
38
+ }
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "quest-dao-client",
3
+ "version": "1.0.0",
4
+ "description": "Client library for QuestDAO escrow and voting.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "scripts": {
12
+ "build": "tsc",
13
+ "prepublishOnly": "npm run build"
14
+ },
15
+ "keywords": [
16
+ "stacks",
17
+ "dao",
18
+ "quest",
19
+ "escrow",
20
+ "voting"
21
+ ],
22
+ "author": "QuestDAO Team",
23
+ "license": "MIT",
24
+ "dependencies": {
25
+ "@stacks/transactions": "^6.15.0",
26
+ "@stacks/network": "^6.17.0"
27
+ },
28
+ "devDependencies": {
29
+ "typescript": "^5.4.5"
30
+ }
31
+ }