@sage-protocol/sdk 0.1.18 → 0.1.23
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 +98 -1
- package/dist/browser/index.mjs +43 -18
- package/dist/index.cjs +2972 -183
- package/dist/index.mjs +2968 -179
- package/dist/node/index.cjs +2968 -179
- package/dist/node/index.mjs +2968 -179
- package/package.json +1 -1
- package/types/index.d.ts +540 -6
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -131,8 +131,204 @@ export interface GovernanceOperationsModule {
|
|
|
131
131
|
}): Promise<TimelockRoleCheck[]>;
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
export interface VotesTokenDescription {
|
|
135
|
+
votingToken: AddressLike;
|
|
136
|
+
baseToken: AddressLike;
|
|
137
|
+
isWrapper: boolean;
|
|
138
|
+
multiplierNFT: AddressLike | null;
|
|
139
|
+
basis: bigint | null;
|
|
140
|
+
description: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// ============ Governance Profile Types (3-Axis Model) ============
|
|
144
|
+
|
|
145
|
+
export type GovernanceKind = 'operator' | 'token';
|
|
146
|
+
export type ProposalAccess = 'council-only' | 'community-threshold';
|
|
147
|
+
export type ExecutionAccess = 'council-only' | 'anyone';
|
|
148
|
+
export type GovernancePlaybook = 'council-closed' | 'council-drafts' | 'community' | 'legacy' | 'custom';
|
|
149
|
+
|
|
150
|
+
export interface GovernanceProfile {
|
|
151
|
+
/** Profile version: 1=legacy (detected via heuristics), 2=explicit 3-axis profile */
|
|
152
|
+
version: 1 | 2;
|
|
153
|
+
/** OPERATOR (council/EOA decides) or TOKEN (ERC20Votes snapshot) */
|
|
154
|
+
governanceKind: GovernanceKind | null;
|
|
155
|
+
/** COUNCIL_ONLY (only COUNCIL_ROLE) or COMMUNITY_THRESHOLD (token holders >= threshold) */
|
|
156
|
+
proposalAccess: ProposalAccess | null;
|
|
157
|
+
/** COUNCIL_ONLY (only council can execute) or ANYONE (public execution) */
|
|
158
|
+
executionAccess: ExecutionAccess | null;
|
|
159
|
+
/** Derived playbook name for UX */
|
|
160
|
+
playbook: GovernancePlaybook;
|
|
161
|
+
/** True if proposals require COUNCIL_ROLE */
|
|
162
|
+
isCouncil: boolean;
|
|
163
|
+
/** True if SXXX stake is required to propose (TOKEN + COMMUNITY_THRESHOLD only) */
|
|
164
|
+
requiresStake: boolean;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export interface GovernanceModeDetectionResult extends GovernanceProfile {
|
|
168
|
+
/** Legacy operator flag */
|
|
169
|
+
operator: boolean;
|
|
170
|
+
/** Legacy governance mode label */
|
|
171
|
+
governance: string;
|
|
172
|
+
governor: AddressLike | null;
|
|
173
|
+
timelock: AddressLike | null;
|
|
174
|
+
subdao: AddressLike | null;
|
|
175
|
+
stakeRequired: bigint | null;
|
|
176
|
+
depositWei: bigint | null;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface VotingStatus {
|
|
180
|
+
subdao: AddressLike | null;
|
|
181
|
+
governor: AddressLike;
|
|
182
|
+
stakeToken: AddressLike | null;
|
|
183
|
+
votingToken: AddressLike;
|
|
184
|
+
baseToken: AddressLike;
|
|
185
|
+
isWrapper: boolean;
|
|
186
|
+
multiplierNFT: AddressLike | null;
|
|
187
|
+
basis: bigint | null;
|
|
188
|
+
threshold: bigint | null;
|
|
189
|
+
votingPower: bigint | null;
|
|
190
|
+
tokenBalance: bigint | null;
|
|
191
|
+
delegate: AddressLike | null;
|
|
192
|
+
canPropose: boolean | null;
|
|
193
|
+
tokenMismatch: boolean;
|
|
194
|
+
stakeTokenVotes: bigint | null;
|
|
195
|
+
stakeTokenDelegate: AddressLike | null;
|
|
196
|
+
stakeTokenBalance: bigint | null;
|
|
197
|
+
description: string;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface ProposeGatesSummary {
|
|
201
|
+
threshold: bigint | null;
|
|
202
|
+
cooldown: bigint | null;
|
|
203
|
+
stake: bigint | null;
|
|
204
|
+
allowanceOk: boolean | null;
|
|
205
|
+
votesOk: boolean | null;
|
|
206
|
+
details: {
|
|
207
|
+
sxxxToken: AddressLike | null;
|
|
208
|
+
proposer: AddressLike;
|
|
209
|
+
governor: AddressLike;
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export interface ProposeReadiness extends ProposeGatesSummary {
|
|
214
|
+
executionReady: boolean | null;
|
|
215
|
+
executionError: string | null;
|
|
216
|
+
}
|
|
217
|
+
|
|
134
218
|
export interface GovernanceModule {
|
|
135
219
|
operations: GovernanceOperationsModule;
|
|
220
|
+
getGovernorInfo(args: { provider: ProviderLike; governor: AddressLike }): Promise<{
|
|
221
|
+
address: AddressLike;
|
|
222
|
+
name: string | null;
|
|
223
|
+
votingDelay: bigint | null;
|
|
224
|
+
votingPeriod: bigint | null;
|
|
225
|
+
proposalThreshold: bigint | null;
|
|
226
|
+
timelock: AddressLike | null;
|
|
227
|
+
sxxxToken: AddressLike | null;
|
|
228
|
+
quorumNumerator: bigint | null;
|
|
229
|
+
stakeAmount: bigint | null;
|
|
230
|
+
}>;
|
|
231
|
+
getProposal(args: { provider: ProviderLike; governor: AddressLike; id: bigint | number | string }): Promise<{
|
|
232
|
+
governor: AddressLike;
|
|
233
|
+
id: bigint;
|
|
234
|
+
state: any;
|
|
235
|
+
snapshot: bigint;
|
|
236
|
+
deadline: bigint;
|
|
237
|
+
votes: { against: bigint; for: bigint; abstain: bigint };
|
|
238
|
+
}>;
|
|
239
|
+
listProposals(args: { provider: ProviderLike; governor: AddressLike; fromBlock?: number | bigint | string; toBlock?: number | bigint | string }): Promise<ProposalTuple[]>;
|
|
240
|
+
getProposalMetadata(args: { provider: ProviderLike; governor: AddressLike; id: bigint | number | string; fromBlock?: number | bigint | string; toBlock?: number | bigint | string }): Promise<ProposalTuple & {
|
|
241
|
+
proposer: AddressLike;
|
|
242
|
+
blockNumber: number | bigint | null;
|
|
243
|
+
transactionHash: HashLike | null;
|
|
244
|
+
}>;
|
|
245
|
+
hashDescription(description: string): HashLike;
|
|
246
|
+
buildProposeTx(args: {
|
|
247
|
+
governor: AddressLike;
|
|
248
|
+
targets?: AddressLike[];
|
|
249
|
+
values?: bigint[] | BigNumberish[];
|
|
250
|
+
calldatas?: string[];
|
|
251
|
+
descriptionOrHash?: string;
|
|
252
|
+
}): TransactionPayload;
|
|
253
|
+
buildCastVoteTx(args: { governor: AddressLike; proposalId: bigint | number | string; support: number | string; reason?: string }): TransactionPayload;
|
|
254
|
+
buildQueueTx(args: {
|
|
255
|
+
governor: AddressLike;
|
|
256
|
+
targets?: AddressLike[];
|
|
257
|
+
values?: bigint[] | BigNumberish[];
|
|
258
|
+
calldatas?: string[];
|
|
259
|
+
descriptionOrHash?: string;
|
|
260
|
+
}): TransactionPayload;
|
|
261
|
+
buildExecuteTx(args: {
|
|
262
|
+
governor: AddressLike;
|
|
263
|
+
targets?: AddressLike[];
|
|
264
|
+
values?: bigint[] | BigNumberish[];
|
|
265
|
+
calldatas?: string[];
|
|
266
|
+
descriptionOrHash?: string;
|
|
267
|
+
}): TransactionPayload;
|
|
268
|
+
buildQueueByIdTx(args: { governor: AddressLike; proposalId: bigint | number | string }): TransactionPayload;
|
|
269
|
+
buildExecuteByIdTx(args: { governor: AddressLike; proposalId: bigint | number | string }): TransactionPayload;
|
|
270
|
+
decodeProposalEffects(args: {
|
|
271
|
+
provider: ProviderLike;
|
|
272
|
+
governor: AddressLike;
|
|
273
|
+
proposalId: bigint | number | string;
|
|
274
|
+
fromBlock?: number | bigint | string;
|
|
275
|
+
toBlock?: number | bigint | string;
|
|
276
|
+
}): Promise<any>;
|
|
277
|
+
getQuorumAt(args: { provider: ProviderLike; governor: AddressLike; blockTag?: bigint | number | string }): Promise<bigint | null>;
|
|
278
|
+
getQuorumLatestMinusOne(args: { provider: ProviderLike; governor: AddressLike }): Promise<bigint | null>;
|
|
279
|
+
getVotesLatestMinusOne(args: { provider: ProviderLike; token?: AddressLike; governor?: AddressLike; account: AddressLike }): Promise<bigint>;
|
|
280
|
+
simulatePropose(args: {
|
|
281
|
+
provider: ProviderLike;
|
|
282
|
+
governor: AddressLike;
|
|
283
|
+
targets?: AddressLike[];
|
|
284
|
+
values?: bigint[] | BigNumberish[];
|
|
285
|
+
calldatas?: string[];
|
|
286
|
+
description?: string;
|
|
287
|
+
sender?: AddressLike;
|
|
288
|
+
}): Promise<{ ok: boolean; error?: { type: string; message: string } }>;
|
|
289
|
+
resolveVotesToken(args: { provider: ProviderLike; subdao?: AddressLike; governor?: AddressLike }): Promise<AddressLike>;
|
|
290
|
+
resolveVotesTokenChain(args: { provider: ProviderLike; subdao?: AddressLike; governor?: AddressLike }): Promise<{
|
|
291
|
+
votingToken: AddressLike;
|
|
292
|
+
baseToken: AddressLike;
|
|
293
|
+
isWrapper: boolean;
|
|
294
|
+
}>;
|
|
295
|
+
describeVotesToken(args: { provider: ProviderLike; subdao?: AddressLike; governor?: AddressLike }): Promise<VotesTokenDescription>;
|
|
296
|
+
getVotingStatus(args: { provider: ProviderLike; subdao?: AddressLike; governor?: AddressLike; account: AddressLike }): Promise<VotingStatus>;
|
|
297
|
+
buildDelegateTx(args: { token: AddressLike; delegatee: AddressLike }): TransactionPayload;
|
|
298
|
+
buildDelegateSelfTx(args: { provider: ProviderLike; governor: AddressLike; account: AddressLike }): Promise<TransactionPayload>;
|
|
299
|
+
buildDelegateSelfPreferred(args: { provider: ProviderLike; subdao?: AddressLike; governor?: AddressLike; account: AddressLike }): Promise<TransactionPayload>;
|
|
300
|
+
delegateSelfAndVerify(args: {
|
|
301
|
+
provider: ProviderLike;
|
|
302
|
+
subdao?: AddressLike;
|
|
303
|
+
governor?: AddressLike;
|
|
304
|
+
account: AddressLike;
|
|
305
|
+
signer?: any;
|
|
306
|
+
minVotes?: bigint | number | string | null;
|
|
307
|
+
}): Promise<{ txHash: string | null; ok: boolean; votes: bigint; payload: TransactionPayload }>;
|
|
308
|
+
ensureProposeGates(args: { provider: ProviderLike; governor: AddressLike; proposer: AddressLike }): Promise<ProposeGatesSummary>;
|
|
309
|
+
readinessToPropose(args: {
|
|
310
|
+
provider: ProviderLike;
|
|
311
|
+
governor: AddressLike;
|
|
312
|
+
proposer: AddressLike;
|
|
313
|
+
execution?: {
|
|
314
|
+
provider: ProviderLike;
|
|
315
|
+
registry: AddressLike;
|
|
316
|
+
timelock: AddressLike;
|
|
317
|
+
subdao: AddressLike;
|
|
318
|
+
libraryId?: string;
|
|
319
|
+
manifestCID?: string;
|
|
320
|
+
promptCount?: bigint | number | string;
|
|
321
|
+
} | null;
|
|
322
|
+
}): Promise<ProposeReadiness>;
|
|
323
|
+
listActiveProposals(args: { url: string; governor: AddressLike; first?: number; skip?: number }): Promise<any>;
|
|
324
|
+
buildProposeTxByHash(args: {
|
|
325
|
+
governor: AddressLike;
|
|
326
|
+
targets?: AddressLike[];
|
|
327
|
+
values?: bigint[] | BigNumberish[];
|
|
328
|
+
calldatas?: string[];
|
|
329
|
+
descriptionHash: string;
|
|
330
|
+
}): TransactionPayload;
|
|
331
|
+
detectMode(args: { provider: ProviderLike; governor?: AddressLike; timelock?: AddressLike | null; subdao?: AddressLike | null }): Promise<GovernanceModeDetectionResult>;
|
|
136
332
|
[key: string]: any;
|
|
137
333
|
}
|
|
138
334
|
|
|
@@ -331,13 +527,13 @@ export interface LibrarySearchResponse {
|
|
|
331
527
|
}
|
|
332
528
|
|
|
333
529
|
export interface LibraryModule {
|
|
334
|
-
listManifests(args: { provider: ProviderLike; registry: AddressLike; offset?: number; limit?: number }): Promise<{ total: bigint; manifests: Array<{ manifestCID: string; previousCID: string; timestamp: bigint; proposer: AddressLike; promptCount: number; }> }>;
|
|
335
|
-
getManifestInfo(args: { provider: ProviderLike; registry: AddressLike; manifestCID: string }): Promise<
|
|
336
|
-
getLatestLibrary(args: { provider: ProviderLike; registry: AddressLike; subdao: AddressLike
|
|
530
|
+
listManifests(args: { provider: ProviderLike; registry: AddressLike; factoryAddress: AddressLike; offset?: number; limit?: number }): Promise<{ total: bigint; manifests: Array<{ manifestCID: string; previousCID: string; timestamp: bigint; proposer: AddressLike; promptCount: number; version: string; }> }>;
|
|
531
|
+
getManifestInfo(args: { provider: ProviderLike; registry: AddressLike; manifestCID: string }): Promise<never>;
|
|
532
|
+
getLatestLibrary(args: { provider: ProviderLike; registry: AddressLike; subdao: AddressLike }): Promise<{ manifestCID: string; previousCID: string; timestamp: bigint; proposer: AddressLike; promptCount: number; version: string; } | null>;
|
|
337
533
|
hasScopedOwnership(args: { provider: ProviderLike; registry: AddressLike; subdao: AddressLike; manifestCID: string }): Promise<boolean>;
|
|
338
|
-
|
|
534
|
+
buildUpdateLibraryTx(args: { registry: AddressLike; subdao: AddressLike; manifestCID: string; version?: string }): TransactionPayload;
|
|
339
535
|
buildAuthorizeTimelockTx(args: { registry: AddressLike; timelock: AddressLike; subdao: AddressLike }): TransactionPayload;
|
|
340
|
-
executionReadiness(args: { provider: ProviderLike; registry: AddressLike; timelock: AddressLike; subdao: AddressLike;
|
|
536
|
+
executionReadiness(args: { provider: ProviderLike; registry: AddressLike; timelock: AddressLike; subdao: AddressLike; manifestCID?: string; version?: string }): Promise<{ ok: boolean; error: string | null; missingRole: string | null }>;
|
|
341
537
|
searchRegistry(args: { provider: ProviderLike; registry: AddressLike; query: string; limit?: number; ipfsClient?: any; ipfsOptions?: Record<string, any>; libraryAdapter?: any; manifestFetcher?: (cid: string) => Promise<any>; }): Promise<LibrarySearchResponse>;
|
|
342
538
|
validation: { createManifestValidator(options?: Record<string, any>): ManifestValidator };
|
|
343
539
|
}
|
|
@@ -690,6 +886,122 @@ export interface BountySubmission {
|
|
|
690
886
|
exists: boolean;
|
|
691
887
|
}
|
|
692
888
|
|
|
889
|
+
// ---- Contributions Module ----
|
|
890
|
+
|
|
891
|
+
export type GovernanceModel = 'TOKEN_VOTING' | 'COUNCIL' | 'OPERATOR' | 'DIRECT';
|
|
892
|
+
|
|
893
|
+
export interface PromptContribution {
|
|
894
|
+
id: string;
|
|
895
|
+
dao: AddressLike;
|
|
896
|
+
daoName: string | null;
|
|
897
|
+
promptKey: string;
|
|
898
|
+
contributor: AddressLike;
|
|
899
|
+
cid: string;
|
|
900
|
+
timestamp: number;
|
|
901
|
+
createdAt: number;
|
|
902
|
+
updatedAt: number;
|
|
903
|
+
transactionHash: string | null;
|
|
904
|
+
governanceModel: GovernanceModel;
|
|
905
|
+
proposalId: bigint | null;
|
|
906
|
+
forVotes: bigint | null;
|
|
907
|
+
againstVotes: bigint | null;
|
|
908
|
+
abstainVotes: bigint | null;
|
|
909
|
+
uniqueVoters: number | null;
|
|
910
|
+
quorum: bigint | null;
|
|
911
|
+
fromBounty: boolean;
|
|
912
|
+
bountyId: bigint | null;
|
|
913
|
+
badgeId: bigint | null;
|
|
914
|
+
badgeEvidenceURI: string | null;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
export interface ContributionAggregates {
|
|
918
|
+
totalContributions: number;
|
|
919
|
+
uniqueContributors: number;
|
|
920
|
+
bountyOriginated: number;
|
|
921
|
+
governanceOriginated: number;
|
|
922
|
+
totalForVotes: bigint;
|
|
923
|
+
totalAgainstVotes: bigint;
|
|
924
|
+
averageVoterCount: number;
|
|
925
|
+
badgeCount: number;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
export interface GovernanceQuality {
|
|
929
|
+
model: GovernanceModel;
|
|
930
|
+
decentralization: number;
|
|
931
|
+
consensus: number;
|
|
932
|
+
raw: Record<string, any>;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
export interface SoulboundBadge {
|
|
936
|
+
id: string;
|
|
937
|
+
contract: AddressLike;
|
|
938
|
+
badgeId: bigint;
|
|
939
|
+
recipient: AddressLike;
|
|
940
|
+
evidenceURI: string | null;
|
|
941
|
+
blockNumber: number;
|
|
942
|
+
blockTimestamp: number;
|
|
943
|
+
transactionHash: string | null;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
export interface ContributionsModule {
|
|
947
|
+
GovernanceModel: {
|
|
948
|
+
TOKEN_VOTING: 'TOKEN_VOTING';
|
|
949
|
+
COUNCIL: 'COUNCIL';
|
|
950
|
+
OPERATOR: 'OPERATOR';
|
|
951
|
+
DIRECT: 'DIRECT';
|
|
952
|
+
};
|
|
953
|
+
|
|
954
|
+
listContributions(args: {
|
|
955
|
+
url: string;
|
|
956
|
+
subdao?: AddressLike;
|
|
957
|
+
promptKey?: string;
|
|
958
|
+
contributor?: AddressLike;
|
|
959
|
+
fromBounty?: boolean;
|
|
960
|
+
first?: number;
|
|
961
|
+
skip?: number;
|
|
962
|
+
orderBy?: 'updatedAt' | 'createdAt';
|
|
963
|
+
orderDirection?: 'asc' | 'desc';
|
|
964
|
+
}): Promise<PromptContribution[]>;
|
|
965
|
+
|
|
966
|
+
getByPrompt(args: {
|
|
967
|
+
url: string;
|
|
968
|
+
subdao: AddressLike;
|
|
969
|
+
promptKey: string;
|
|
970
|
+
}): Promise<{ contributions: PromptContribution[]; aggregates: ContributionAggregates }>;
|
|
971
|
+
|
|
972
|
+
getById(args: {
|
|
973
|
+
url: string;
|
|
974
|
+
id: string;
|
|
975
|
+
}): Promise<PromptContribution | null>;
|
|
976
|
+
|
|
977
|
+
getByContributor(args: {
|
|
978
|
+
url: string;
|
|
979
|
+
contributor: AddressLike;
|
|
980
|
+
first?: number;
|
|
981
|
+
skip?: number;
|
|
982
|
+
}): Promise<PromptContribution[]>;
|
|
983
|
+
|
|
984
|
+
getBadgesByRecipient(args: {
|
|
985
|
+
url: string;
|
|
986
|
+
recipient: AddressLike;
|
|
987
|
+
first?: number;
|
|
988
|
+
}): Promise<SoulboundBadge[]>;
|
|
989
|
+
|
|
990
|
+
getGovernanceQuality(
|
|
991
|
+
contribution: PromptContribution,
|
|
992
|
+
context?: { totalHolders?: number; totalCouncilMembers?: number }
|
|
993
|
+
): GovernanceQuality;
|
|
994
|
+
|
|
995
|
+
enrichWithGovernanceModel(
|
|
996
|
+
contribution: PromptContribution,
|
|
997
|
+
subdaoInfo: any
|
|
998
|
+
): PromptContribution;
|
|
999
|
+
|
|
1000
|
+
detectGovernanceModel(subdaoInfo: any): GovernanceModel;
|
|
1001
|
+
|
|
1002
|
+
computeAggregates(contributions: PromptContribution[]): ContributionAggregates;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
693
1005
|
export interface BountyModule {
|
|
694
1006
|
// Constants
|
|
695
1007
|
getMaxSubmissionsPerBounty(args: { provider: ProviderLike; bountySystem: AddressLike }): Promise<bigint>;
|
|
@@ -758,11 +1070,225 @@ export interface BountyModule {
|
|
|
758
1070
|
buildRemoveFromWhitelistTx(args: { bountySystem: AddressLike; bountyId: BigNumberish; addresses: AddressLike[] }): TransactionPayload;
|
|
759
1071
|
}
|
|
760
1072
|
|
|
1073
|
+
// ============ Git Storage Client Types ============
|
|
1074
|
+
|
|
1075
|
+
export type GitObjectType = 'blob' | 'tree' | 'commit';
|
|
1076
|
+
|
|
1077
|
+
export interface GitObject {
|
|
1078
|
+
/** Object ID (SHA-1 hash) */
|
|
1079
|
+
oid: string;
|
|
1080
|
+
/** Object type */
|
|
1081
|
+
type: GitObjectType;
|
|
1082
|
+
/** Object size in bytes */
|
|
1083
|
+
size: number;
|
|
1084
|
+
/** Base64 encoded object data */
|
|
1085
|
+
data: string;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
export interface GitRef {
|
|
1089
|
+
/** Reference name (e.g., 'refs/heads/main') */
|
|
1090
|
+
name: string;
|
|
1091
|
+
/** Object ID the ref points to */
|
|
1092
|
+
oid: string;
|
|
1093
|
+
/** Last update timestamp */
|
|
1094
|
+
updatedAt: number;
|
|
1095
|
+
/** Wallet address of last updater */
|
|
1096
|
+
updatedBy?: string;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
export interface GitCommit {
|
|
1100
|
+
/** Commit hash */
|
|
1101
|
+
oid: string;
|
|
1102
|
+
/** Tree object hash */
|
|
1103
|
+
treeOid: string;
|
|
1104
|
+
/** Parent commit hash */
|
|
1105
|
+
parentOid?: string;
|
|
1106
|
+
/** Commit message */
|
|
1107
|
+
message: string;
|
|
1108
|
+
/** Author name */
|
|
1109
|
+
authorName?: string;
|
|
1110
|
+
/** Author email */
|
|
1111
|
+
authorEmail?: string;
|
|
1112
|
+
/** Author wallet address */
|
|
1113
|
+
authorAddress?: string;
|
|
1114
|
+
/** Commit timestamp */
|
|
1115
|
+
timestamp: number;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
export interface LibraryMetadata {
|
|
1119
|
+
/** SubDAO address */
|
|
1120
|
+
subdao: string;
|
|
1121
|
+
/** Library name */
|
|
1122
|
+
name: string;
|
|
1123
|
+
/** Library description */
|
|
1124
|
+
description?: string;
|
|
1125
|
+
/** Library visibility */
|
|
1126
|
+
visibility: 'public' | 'private';
|
|
1127
|
+
/** Creation timestamp */
|
|
1128
|
+
createdAt: number;
|
|
1129
|
+
/** Last update timestamp */
|
|
1130
|
+
updatedAt: number;
|
|
1131
|
+
/** Fork information */
|
|
1132
|
+
forkOf?: {
|
|
1133
|
+
subdao: string;
|
|
1134
|
+
commit: string;
|
|
1135
|
+
};
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
export interface Collaborator {
|
|
1139
|
+
/** Wallet address */
|
|
1140
|
+
address: string;
|
|
1141
|
+
/** Permission level */
|
|
1142
|
+
permission: 'read' | 'write' | 'admin';
|
|
1143
|
+
/** When collaborator was added */
|
|
1144
|
+
addedAt: number;
|
|
1145
|
+
/** Who added the collaborator */
|
|
1146
|
+
addedBy?: string;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
export interface PushResult {
|
|
1150
|
+
/** Whether push succeeded */
|
|
1151
|
+
success: boolean;
|
|
1152
|
+
/** New commit hash */
|
|
1153
|
+
commitHash?: string;
|
|
1154
|
+
/** Error message if failed */
|
|
1155
|
+
error?: string;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
export interface PushPayload {
|
|
1159
|
+
/** Objects to push */
|
|
1160
|
+
objects: GitObject[];
|
|
1161
|
+
/** Ref updates (name -> oid) */
|
|
1162
|
+
refs: Record<string, string>;
|
|
1163
|
+
/** Commit message */
|
|
1164
|
+
message: string;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
export interface CloneResult {
|
|
1168
|
+
/** All objects in the library */
|
|
1169
|
+
objects: GitObject[];
|
|
1170
|
+
/** All refs (name -> oid) */
|
|
1171
|
+
refs: Record<string, string>;
|
|
1172
|
+
/** Library metadata */
|
|
1173
|
+
metadata: LibraryMetadata;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
export interface FetchResult {
|
|
1177
|
+
/** Objects since the given commit */
|
|
1178
|
+
objects: GitObject[];
|
|
1179
|
+
/** Current refs (name -> oid) */
|
|
1180
|
+
refs: Record<string, string>;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
export interface CollaboratorPermissions {
|
|
1184
|
+
canRead: boolean;
|
|
1185
|
+
canWrite: boolean;
|
|
1186
|
+
isAdmin: boolean;
|
|
1187
|
+
permission?: string;
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
export interface GitAuthProvider {
|
|
1191
|
+
/** Get wallet address */
|
|
1192
|
+
getAddress(): Promise<string>;
|
|
1193
|
+
/** Sign a message */
|
|
1194
|
+
signMessage(message: string): Promise<string>;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
export interface GitStorageClientOptions {
|
|
1198
|
+
/** Request timeout in milliseconds (default: 30000) */
|
|
1199
|
+
timeout?: number;
|
|
1200
|
+
/** Custom headers */
|
|
1201
|
+
headers?: Record<string, string>;
|
|
1202
|
+
/** Ethers signer for authenticated requests */
|
|
1203
|
+
signer?: GitAuthProvider | (() => Promise<GitAuthProvider>);
|
|
1204
|
+
/** Custom auth provider */
|
|
1205
|
+
getAuth?: () => Promise<{ address: string; signature: string; nonce: string }>;
|
|
1206
|
+
/** Bearer token for authentication */
|
|
1207
|
+
token?: string;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
export interface GitStorageClient {
|
|
1211
|
+
readonly baseUrl: string;
|
|
1212
|
+
readonly timeout: number;
|
|
1213
|
+
readonly headers: Record<string, string>;
|
|
1214
|
+
|
|
1215
|
+
// Library Management
|
|
1216
|
+
createLibrary(subdao: string, name: string, options?: {
|
|
1217
|
+
description?: string;
|
|
1218
|
+
visibility?: 'public' | 'private';
|
|
1219
|
+
}): Promise<LibraryMetadata>;
|
|
1220
|
+
|
|
1221
|
+
getLibrary(subdao: string): Promise<LibraryMetadata>;
|
|
1222
|
+
|
|
1223
|
+
listLibraries(options?: {
|
|
1224
|
+
limit?: number;
|
|
1225
|
+
cursor?: string;
|
|
1226
|
+
}): Promise<{ libraries: LibraryMetadata[]; cursor?: string }>;
|
|
1227
|
+
|
|
1228
|
+
deleteLibrary(subdao: string): Promise<{ ok: boolean }>;
|
|
1229
|
+
|
|
1230
|
+
// Git Object Operations
|
|
1231
|
+
putObjects(subdao: string, objects: GitObject[]): Promise<{ stored: number }>;
|
|
1232
|
+
getObject(subdao: string, oid: string): Promise<GitObject>;
|
|
1233
|
+
getObjects(subdao: string, oids: string[]): Promise<{ objects: GitObject[] }>;
|
|
1234
|
+
|
|
1235
|
+
// Reference Operations
|
|
1236
|
+
listRefs(subdao: string): Promise<{ refs: GitRef[] }>;
|
|
1237
|
+
getRef(subdao: string, refName: string): Promise<GitRef>;
|
|
1238
|
+
updateRef(subdao: string, refName: string, oid: string, options?: {
|
|
1239
|
+
oldOid?: string;
|
|
1240
|
+
}): Promise<{ ok: boolean }>;
|
|
1241
|
+
|
|
1242
|
+
// Sync Operations
|
|
1243
|
+
push(subdao: string, payload: PushPayload): Promise<PushResult>;
|
|
1244
|
+
clone(subdao: string): Promise<CloneResult>;
|
|
1245
|
+
fetch(subdao: string, since?: string): Promise<FetchResult>;
|
|
1246
|
+
|
|
1247
|
+
// File Access
|
|
1248
|
+
getHistory(subdao: string, options?: {
|
|
1249
|
+
ref?: string;
|
|
1250
|
+
limit?: number;
|
|
1251
|
+
}): Promise<{ commits: GitCommit[] }>;
|
|
1252
|
+
|
|
1253
|
+
getTree(subdao: string, ref: string, path: string): Promise<{ entries: Array<{
|
|
1254
|
+
name: string;
|
|
1255
|
+
type: 'blob' | 'tree';
|
|
1256
|
+
oid: string;
|
|
1257
|
+
}> }>;
|
|
1258
|
+
|
|
1259
|
+
getBlob(subdao: string, ref: string, path: string): Promise<{ content: string }>;
|
|
1260
|
+
getFile(subdao: string, ref: string, path: string): Promise<string>;
|
|
1261
|
+
|
|
1262
|
+
// Fork Operations
|
|
1263
|
+
fork(sourceSubdao: string, targetSubdao: string): Promise<{ success: boolean; commitHash?: string }>;
|
|
1264
|
+
getForks(subdao: string): Promise<{ forks: Array<{ subdao: string; forkedAt: number }> }>;
|
|
1265
|
+
getUpstream(subdao: string): Promise<{ upstreamSubdao: string; upstreamCommit: string; forkedAt: number }>;
|
|
1266
|
+
|
|
1267
|
+
// Collaborator Operations
|
|
1268
|
+
listCollaborators(subdao: string): Promise<{ collaborators: Collaborator[] }>;
|
|
1269
|
+
addCollaborator(subdao: string, address: string, permission: 'read' | 'write' | 'admin'): Promise<{ ok: boolean }>;
|
|
1270
|
+
removeCollaborator(subdao: string, address: string): Promise<{ ok: boolean }>;
|
|
1271
|
+
getPermissions(subdao: string, address: string): Promise<CollaboratorPermissions>;
|
|
1272
|
+
|
|
1273
|
+
// High-Level Convenience Methods
|
|
1274
|
+
pushManifest(subdao: string, manifest: object, message: string): Promise<PushResult>;
|
|
1275
|
+
getManifest(subdao: string, ref?: string): Promise<object>;
|
|
1276
|
+
|
|
1277
|
+
// Cache Management
|
|
1278
|
+
clearAuthCache(): void;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
export interface GitStorageClientConstructor {
|
|
1282
|
+
new (baseUrl: string, options?: GitStorageClientOptions): GitStorageClient;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
export declare const GitStorageClient: GitStorageClientConstructor;
|
|
1286
|
+
|
|
761
1287
|
export interface SageSDK {
|
|
762
1288
|
version: string;
|
|
763
1289
|
getProvider: (rpcUrl: string) => any;
|
|
764
1290
|
abi: Record<string, any>;
|
|
765
|
-
governance:
|
|
1291
|
+
governance: GovernanceModule;
|
|
766
1292
|
subdao: Record<string, any>;
|
|
767
1293
|
timelock: Record<string, any>;
|
|
768
1294
|
factory: Record<string, any>;
|
|
@@ -791,9 +1317,17 @@ export interface SageSDK {
|
|
|
791
1317
|
votingMultiplier: VotingMultiplierModule;
|
|
792
1318
|
auction: AuctionModule;
|
|
793
1319
|
bounty: BountyModule;
|
|
1320
|
+
contributions: ContributionsModule;
|
|
794
1321
|
subgraph: Record<string, any>;
|
|
795
1322
|
errors: Record<string, any>;
|
|
796
1323
|
resolveGovernanceContext: (args: any) => Promise<any>;
|
|
1324
|
+
// Client exports
|
|
1325
|
+
clients: {
|
|
1326
|
+
DiscoveryClient: any;
|
|
1327
|
+
GitStorageClient: GitStorageClientConstructor;
|
|
1328
|
+
};
|
|
1329
|
+
DiscoveryClient: any;
|
|
1330
|
+
GitStorageClient: GitStorageClientConstructor;
|
|
797
1331
|
}
|
|
798
1332
|
|
|
799
1333
|
declare const sdk: SageSDK;
|