forked from PhasoraLabs/StellarGrantProtocol
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontract.ts
More file actions
111 lines (98 loc) · 2.58 KB
/
Copy pathcontract.ts
File metadata and controls
111 lines (98 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/**
* Contract Client
*
* Typed ContractClient class that wraps all StellarGrants contract methods.
* Uses auto-generated TypeScript bindings from the contract ABI.
*/
import { networkPassphraseConfig } from "./client";
const contractId = process.env.NEXT_PUBLIC_CONTRACT_ID || "";
export class ContractClient {
private _contractId: string;
private _rpcUrl: string;
private _networkPassphrase: string;
constructor(config?: {
contractId?: string;
rpcUrl?: string;
networkPassphrase?: string;
}) {
this._contractId = config?.contractId || contractId;
this._rpcUrl = config?.rpcUrl || process.env.NEXT_PUBLIC_STELLAR_RPC_URL || "";
this._networkPassphrase = config?.networkPassphrase || networkPassphraseConfig;
}
/**
* Read-only: Fetch a grant by ID
*/
async grantGet(_params: { grant_id: bigint }) {
// TODO: Implement contract method calls
throw new Error("Not implemented");
}
/**
* Read-only: Fetch all milestones for a grant
*/
async milestonesGet(_params: { grant_id: bigint }) {
// TODO: Implement contract method calls
throw new Error("Not implemented");
}
/**
* Read-only: Get contributor reputation score
*/
async contributorScore(_params: { address: string }) {
// TODO: Implement contract method calls
throw new Error("Not implemented");
}
/**
* Read-only: Get reviewer list for a grant
*/
async grantReviewers(_params: { grant_id: bigint }) {
// TODO: Implement contract method calls
throw new Error("Not implemented");
}
/**
* Write: Create a new grant
*/
async grantCreate(_params: {
owner: string;
title: string;
budget: bigint;
deadline: bigint;
milestones: bigint;
}) {
// TODO: Implement contract method calls
throw new Error("Not implemented");
}
/**
* Write: Fund a grant
*/
async grantFund(_params: {
grant_id: string;
token: string;
amount: bigint;
}) {
// TODO: Implement contract method calls
throw new Error("Not implemented");
}
/**
* Write: Submit milestone proof
*/
async milestoneSubmit(_params: {
grant_id: string;
milestone_idx: number;
proof_hash: string;
}) {
// TODO: Implement contract method calls
throw new Error("Not implemented");
}
/**
* Write: Approve milestone
*/
async milestoneApprove(_params: {
grant_id: string;
milestone_idx: number;
reviewer: string;
}) {
// TODO: Implement contract method calls
throw new Error("Not implemented");
}
}
// Export singleton instance
export const contractClient = new ContractClient();