@sage-protocol/sdk 0.1.21 → 0.1.24
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 +2 -2
- package/dist/browser/index.mjs +495 -45
- package/dist/index.cjs +5235 -2939
- package/dist/index.mjs +5249 -2953
- package/dist/node/index.cjs +5249 -2953
- package/dist/node/index.mjs +5249 -2953
- package/package.json +1 -1
- package/types/index.d.ts +429 -15
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -140,6 +140,42 @@ export interface VotesTokenDescription {
|
|
|
140
140
|
description: string;
|
|
141
141
|
}
|
|
142
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
|
+
|
|
143
179
|
export interface VotingStatus {
|
|
144
180
|
subdao: AddressLike | null;
|
|
145
181
|
governor: AddressLike;
|
|
@@ -163,7 +199,13 @@ export interface VotingStatus {
|
|
|
163
199
|
|
|
164
200
|
export interface ProposeGatesSummary {
|
|
165
201
|
threshold: bigint | null;
|
|
166
|
-
|
|
202
|
+
sxxxBalance: bigint | null;
|
|
203
|
+
thresholdMet: boolean | null;
|
|
204
|
+
cooldownRemaining: bigint | null;
|
|
205
|
+
cooldownElapsed: boolean | null;
|
|
206
|
+
canPropose: boolean | null;
|
|
207
|
+
votingPower: bigint | null;
|
|
208
|
+
votesTimepoint: bigint | null;
|
|
167
209
|
stake: bigint | null;
|
|
168
210
|
allowanceOk: boolean | null;
|
|
169
211
|
votesOk: boolean | null;
|
|
@@ -172,6 +214,8 @@ export interface ProposeGatesSummary {
|
|
|
172
214
|
proposer: AddressLike;
|
|
173
215
|
governor: AddressLike;
|
|
174
216
|
};
|
|
217
|
+
/** Alias of cooldownRemaining (legacy) */
|
|
218
|
+
cooldown: bigint | null;
|
|
175
219
|
}
|
|
176
220
|
|
|
177
221
|
export interface ProposeReadiness extends ProposeGatesSummary {
|
|
@@ -189,6 +233,9 @@ export interface GovernanceModule {
|
|
|
189
233
|
proposalThreshold: bigint | null;
|
|
190
234
|
timelock: AddressLike | null;
|
|
191
235
|
sxxxToken: AddressLike | null;
|
|
236
|
+
/** Fixed quorum as absolute vote count (e.g., 100e18 = 100 SXXX) */
|
|
237
|
+
quorumVotes: bigint | null;
|
|
238
|
+
/** @deprecated Use quorumVotes instead */
|
|
192
239
|
quorumNumerator: bigint | null;
|
|
193
240
|
stakeAmount: bigint | null;
|
|
194
241
|
}>;
|
|
@@ -240,7 +287,10 @@ export interface GovernanceModule {
|
|
|
240
287
|
}): Promise<any>;
|
|
241
288
|
getQuorumAt(args: { provider: ProviderLike; governor: AddressLike; blockTag?: bigint | number | string }): Promise<bigint | null>;
|
|
242
289
|
getQuorumLatestMinusOne(args: { provider: ProviderLike; governor: AddressLike }): Promise<bigint | null>;
|
|
290
|
+
getVotesTimepointLatestMinusOne(args: { provider: ProviderLike }): Promise<bigint>;
|
|
291
|
+
getVotesAtTimepoint(args: { provider: ProviderLike; token?: AddressLike; governor?: AddressLike; account: AddressLike; timepoint: bigint | number | string }): Promise<bigint>;
|
|
243
292
|
getVotesLatestMinusOne(args: { provider: ProviderLike; token?: AddressLike; governor?: AddressLike; account: AddressLike }): Promise<bigint>;
|
|
293
|
+
getVotesLatestMinusOneWithTimepoint(args: { provider: ProviderLike; token?: AddressLike; governor?: AddressLike; account: AddressLike }): Promise<{ votes: bigint; timepoint: bigint }>;
|
|
244
294
|
simulatePropose(args: {
|
|
245
295
|
provider: ProviderLike;
|
|
246
296
|
governor: AddressLike;
|
|
@@ -269,6 +319,20 @@ export interface GovernanceModule {
|
|
|
269
319
|
signer?: any;
|
|
270
320
|
minVotes?: bigint | number | string | null;
|
|
271
321
|
}): Promise<{ txHash: string | null; ok: boolean; votes: bigint; payload: TransactionPayload }>;
|
|
322
|
+
getProposalThresholdStatus(args: { provider: ProviderLike; governor: AddressLike; proposer: AddressLike }): Promise<{
|
|
323
|
+
governor: AddressLike;
|
|
324
|
+
proposer: AddressLike;
|
|
325
|
+
proposalThreshold: bigint | null;
|
|
326
|
+
sxxxToken: AddressLike | null;
|
|
327
|
+
sxxxBalance: bigint | null;
|
|
328
|
+
proposerVotes: bigint | null;
|
|
329
|
+
votesTimepoint: bigint | null;
|
|
330
|
+
thresholdMet: boolean | null;
|
|
331
|
+
cooldownRemaining: bigint | null;
|
|
332
|
+
cooldownElapsed: boolean | null;
|
|
333
|
+
canPropose: boolean;
|
|
334
|
+
}>;
|
|
335
|
+
getProposalCancelability(args: { provider: ProviderLike; governor: AddressLike; proposalId: bigint | number | string }): Promise<any>;
|
|
272
336
|
ensureProposeGates(args: { provider: ProviderLike; governor: AddressLike; proposer: AddressLike }): Promise<ProposeGatesSummary>;
|
|
273
337
|
readinessToPropose(args: {
|
|
274
338
|
provider: ProviderLike;
|
|
@@ -284,6 +348,18 @@ export interface GovernanceModule {
|
|
|
284
348
|
promptCount?: bigint | number | string;
|
|
285
349
|
} | null;
|
|
286
350
|
}): Promise<ProposeReadiness>;
|
|
351
|
+
getAuthorityAndReadiness(args: {
|
|
352
|
+
provider: ProviderLike;
|
|
353
|
+
subdao?: AddressLike | null;
|
|
354
|
+
governor?: AddressLike | null;
|
|
355
|
+
account?: AddressLike | null;
|
|
356
|
+
action: 'propose' | 'vote' | 'queue' | 'execute' | 'timelock-schedule' | 'update-library';
|
|
357
|
+
proposalId?: bigint | number | string | null;
|
|
358
|
+
libraryRegistry?: AddressLike | null;
|
|
359
|
+
dao?: AddressLike | null;
|
|
360
|
+
manifestCID?: string | null;
|
|
361
|
+
version?: string | null;
|
|
362
|
+
}): Promise<any>;
|
|
287
363
|
listActiveProposals(args: { url: string; governor: AddressLike; first?: number; skip?: number }): Promise<any>;
|
|
288
364
|
buildProposeTxByHash(args: {
|
|
289
365
|
governor: AddressLike;
|
|
@@ -292,15 +368,7 @@ export interface GovernanceModule {
|
|
|
292
368
|
calldatas?: string[];
|
|
293
369
|
descriptionHash: string;
|
|
294
370
|
}): TransactionPayload;
|
|
295
|
-
detectMode(args: { provider: ProviderLike; governor?: AddressLike; timelock?: AddressLike | null; subdao?: AddressLike | null }): Promise<
|
|
296
|
-
operator: boolean;
|
|
297
|
-
governance: string;
|
|
298
|
-
governor: AddressLike | null;
|
|
299
|
-
timelock: AddressLike | null;
|
|
300
|
-
subdao: AddressLike | null;
|
|
301
|
-
stakeRequired: bigint | null;
|
|
302
|
-
depositWei: bigint | null;
|
|
303
|
-
}>;
|
|
371
|
+
detectMode(args: { provider: ProviderLike; governor?: AddressLike; timelock?: AddressLike | null; subdao?: AddressLike | null }): Promise<GovernanceModeDetectionResult>;
|
|
304
372
|
[key: string]: any;
|
|
305
373
|
}
|
|
306
374
|
|
|
@@ -341,6 +409,13 @@ export interface IpfsClient {
|
|
|
341
409
|
warm?: boolean;
|
|
342
410
|
gateways?: string[] | string;
|
|
343
411
|
}): Promise<IpfsUploadResult>;
|
|
412
|
+
uploadRawJson(content: object, options?: {
|
|
413
|
+
name?: string;
|
|
414
|
+
providers?: string[] | string;
|
|
415
|
+
provider?: string;
|
|
416
|
+
warm?: boolean;
|
|
417
|
+
gateways?: string[] | string;
|
|
418
|
+
}): Promise<IpfsUploadResult>;
|
|
344
419
|
downloadJson(args: { cid: string; gateways?: string[] | string; headers?: Record<string, string> }): Promise<any>;
|
|
345
420
|
warmGateways(cid: string, options?: { gateways?: string[] | string; timeoutMs?: number; concurrency?: number }): Promise<{ warmed: string[] }>;
|
|
346
421
|
buildGatewayUrls(cid: string, extra?: string[] | string): string[];
|
|
@@ -371,6 +446,7 @@ export interface IpfsModule {
|
|
|
371
446
|
pinataSecretKey?: string;
|
|
372
447
|
pinataJwt?: string;
|
|
373
448
|
workerUploadUrl?: string;
|
|
449
|
+
workerUploadRawPath?: string;
|
|
374
450
|
workerUploadToken?: string;
|
|
375
451
|
workerBaseUrl?: string;
|
|
376
452
|
workerAddress?: string;
|
|
@@ -499,13 +575,13 @@ export interface LibrarySearchResponse {
|
|
|
499
575
|
}
|
|
500
576
|
|
|
501
577
|
export interface LibraryModule {
|
|
502
|
-
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; }> }>;
|
|
503
|
-
getManifestInfo(args: { provider: ProviderLike; registry: AddressLike; manifestCID: string }): Promise<
|
|
504
|
-
getLatestLibrary(args: { provider: ProviderLike; registry: AddressLike; subdao: AddressLike
|
|
578
|
+
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; }> }>;
|
|
579
|
+
getManifestInfo(args: { provider: ProviderLike; registry: AddressLike; manifestCID: string }): Promise<never>;
|
|
580
|
+
getLatestLibrary(args: { provider: ProviderLike; registry: AddressLike; subdao: AddressLike }): Promise<{ manifestCID: string; previousCID: string; timestamp: bigint; proposer: AddressLike; promptCount: number; version: string; } | null>;
|
|
505
581
|
hasScopedOwnership(args: { provider: ProviderLike; registry: AddressLike; subdao: AddressLike; manifestCID: string }): Promise<boolean>;
|
|
506
|
-
|
|
582
|
+
buildUpdateLibraryTx(args: { registry: AddressLike; subdao: AddressLike; manifestCID: string; version?: string }): TransactionPayload;
|
|
507
583
|
buildAuthorizeTimelockTx(args: { registry: AddressLike; timelock: AddressLike; subdao: AddressLike }): TransactionPayload;
|
|
508
|
-
executionReadiness(args: { provider: ProviderLike; registry: AddressLike; timelock: AddressLike; subdao: AddressLike;
|
|
584
|
+
executionReadiness(args: { provider: ProviderLike; registry: AddressLike; timelock: AddressLike; subdao: AddressLike; manifestCID?: string; version?: string }): Promise<{ ok: boolean; error: string | null; missingRole: string | null }>;
|
|
509
585
|
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>;
|
|
510
586
|
validation: { createManifestValidator(options?: Record<string, any>): ManifestValidator };
|
|
511
587
|
}
|
|
@@ -858,6 +934,122 @@ export interface BountySubmission {
|
|
|
858
934
|
exists: boolean;
|
|
859
935
|
}
|
|
860
936
|
|
|
937
|
+
// ---- Contributions Module ----
|
|
938
|
+
|
|
939
|
+
export type GovernanceModel = 'TOKEN_VOTING' | 'COUNCIL' | 'OPERATOR' | 'DIRECT';
|
|
940
|
+
|
|
941
|
+
export interface PromptContribution {
|
|
942
|
+
id: string;
|
|
943
|
+
dao: AddressLike;
|
|
944
|
+
daoName: string | null;
|
|
945
|
+
promptKey: string;
|
|
946
|
+
contributor: AddressLike;
|
|
947
|
+
cid: string;
|
|
948
|
+
timestamp: number;
|
|
949
|
+
createdAt: number;
|
|
950
|
+
updatedAt: number;
|
|
951
|
+
transactionHash: string | null;
|
|
952
|
+
governanceModel: GovernanceModel;
|
|
953
|
+
proposalId: bigint | null;
|
|
954
|
+
forVotes: bigint | null;
|
|
955
|
+
againstVotes: bigint | null;
|
|
956
|
+
abstainVotes: bigint | null;
|
|
957
|
+
uniqueVoters: number | null;
|
|
958
|
+
quorum: bigint | null;
|
|
959
|
+
fromBounty: boolean;
|
|
960
|
+
bountyId: bigint | null;
|
|
961
|
+
badgeId: bigint | null;
|
|
962
|
+
badgeEvidenceURI: string | null;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
export interface ContributionAggregates {
|
|
966
|
+
totalContributions: number;
|
|
967
|
+
uniqueContributors: number;
|
|
968
|
+
bountyOriginated: number;
|
|
969
|
+
governanceOriginated: number;
|
|
970
|
+
totalForVotes: bigint;
|
|
971
|
+
totalAgainstVotes: bigint;
|
|
972
|
+
averageVoterCount: number;
|
|
973
|
+
badgeCount: number;
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
export interface GovernanceQuality {
|
|
977
|
+
model: GovernanceModel;
|
|
978
|
+
decentralization: number;
|
|
979
|
+
consensus: number;
|
|
980
|
+
raw: Record<string, any>;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
export interface SoulboundBadge {
|
|
984
|
+
id: string;
|
|
985
|
+
contract: AddressLike;
|
|
986
|
+
badgeId: bigint;
|
|
987
|
+
recipient: AddressLike;
|
|
988
|
+
evidenceURI: string | null;
|
|
989
|
+
blockNumber: number;
|
|
990
|
+
blockTimestamp: number;
|
|
991
|
+
transactionHash: string | null;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
export interface ContributionsModule {
|
|
995
|
+
GovernanceModel: {
|
|
996
|
+
TOKEN_VOTING: 'TOKEN_VOTING';
|
|
997
|
+
COUNCIL: 'COUNCIL';
|
|
998
|
+
OPERATOR: 'OPERATOR';
|
|
999
|
+
DIRECT: 'DIRECT';
|
|
1000
|
+
};
|
|
1001
|
+
|
|
1002
|
+
listContributions(args: {
|
|
1003
|
+
url: string;
|
|
1004
|
+
subdao?: AddressLike;
|
|
1005
|
+
promptKey?: string;
|
|
1006
|
+
contributor?: AddressLike;
|
|
1007
|
+
fromBounty?: boolean;
|
|
1008
|
+
first?: number;
|
|
1009
|
+
skip?: number;
|
|
1010
|
+
orderBy?: 'updatedAt' | 'createdAt';
|
|
1011
|
+
orderDirection?: 'asc' | 'desc';
|
|
1012
|
+
}): Promise<PromptContribution[]>;
|
|
1013
|
+
|
|
1014
|
+
getByPrompt(args: {
|
|
1015
|
+
url: string;
|
|
1016
|
+
subdao: AddressLike;
|
|
1017
|
+
promptKey: string;
|
|
1018
|
+
}): Promise<{ contributions: PromptContribution[]; aggregates: ContributionAggregates }>;
|
|
1019
|
+
|
|
1020
|
+
getById(args: {
|
|
1021
|
+
url: string;
|
|
1022
|
+
id: string;
|
|
1023
|
+
}): Promise<PromptContribution | null>;
|
|
1024
|
+
|
|
1025
|
+
getByContributor(args: {
|
|
1026
|
+
url: string;
|
|
1027
|
+
contributor: AddressLike;
|
|
1028
|
+
first?: number;
|
|
1029
|
+
skip?: number;
|
|
1030
|
+
}): Promise<PromptContribution[]>;
|
|
1031
|
+
|
|
1032
|
+
getBadgesByRecipient(args: {
|
|
1033
|
+
url: string;
|
|
1034
|
+
recipient: AddressLike;
|
|
1035
|
+
first?: number;
|
|
1036
|
+
}): Promise<SoulboundBadge[]>;
|
|
1037
|
+
|
|
1038
|
+
getGovernanceQuality(
|
|
1039
|
+
contribution: PromptContribution,
|
|
1040
|
+
context?: { totalHolders?: number; totalCouncilMembers?: number }
|
|
1041
|
+
): GovernanceQuality;
|
|
1042
|
+
|
|
1043
|
+
enrichWithGovernanceModel(
|
|
1044
|
+
contribution: PromptContribution,
|
|
1045
|
+
subdaoInfo: any
|
|
1046
|
+
): PromptContribution;
|
|
1047
|
+
|
|
1048
|
+
detectGovernanceModel(subdaoInfo: any): GovernanceModel;
|
|
1049
|
+
|
|
1050
|
+
computeAggregates(contributions: PromptContribution[]): ContributionAggregates;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
861
1053
|
export interface BountyModule {
|
|
862
1054
|
// Constants
|
|
863
1055
|
getMaxSubmissionsPerBounty(args: { provider: ProviderLike; bountySystem: AddressLike }): Promise<bigint>;
|
|
@@ -926,6 +1118,220 @@ export interface BountyModule {
|
|
|
926
1118
|
buildRemoveFromWhitelistTx(args: { bountySystem: AddressLike; bountyId: BigNumberish; addresses: AddressLike[] }): TransactionPayload;
|
|
927
1119
|
}
|
|
928
1120
|
|
|
1121
|
+
// ============ Git Storage Client Types ============
|
|
1122
|
+
|
|
1123
|
+
export type GitObjectType = 'blob' | 'tree' | 'commit';
|
|
1124
|
+
|
|
1125
|
+
export interface GitObject {
|
|
1126
|
+
/** Object ID (SHA-1 hash) */
|
|
1127
|
+
oid: string;
|
|
1128
|
+
/** Object type */
|
|
1129
|
+
type: GitObjectType;
|
|
1130
|
+
/** Object size in bytes */
|
|
1131
|
+
size: number;
|
|
1132
|
+
/** Base64 encoded object data */
|
|
1133
|
+
data: string;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
export interface GitRef {
|
|
1137
|
+
/** Reference name (e.g., 'refs/heads/main') */
|
|
1138
|
+
name: string;
|
|
1139
|
+
/** Object ID the ref points to */
|
|
1140
|
+
oid: string;
|
|
1141
|
+
/** Last update timestamp */
|
|
1142
|
+
updatedAt: number;
|
|
1143
|
+
/** Wallet address of last updater */
|
|
1144
|
+
updatedBy?: string;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
export interface GitCommit {
|
|
1148
|
+
/** Commit hash */
|
|
1149
|
+
oid: string;
|
|
1150
|
+
/** Tree object hash */
|
|
1151
|
+
treeOid: string;
|
|
1152
|
+
/** Parent commit hash */
|
|
1153
|
+
parentOid?: string;
|
|
1154
|
+
/** Commit message */
|
|
1155
|
+
message: string;
|
|
1156
|
+
/** Author name */
|
|
1157
|
+
authorName?: string;
|
|
1158
|
+
/** Author email */
|
|
1159
|
+
authorEmail?: string;
|
|
1160
|
+
/** Author wallet address */
|
|
1161
|
+
authorAddress?: string;
|
|
1162
|
+
/** Commit timestamp */
|
|
1163
|
+
timestamp: number;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
export interface LibraryMetadata {
|
|
1167
|
+
/** SubDAO address */
|
|
1168
|
+
subdao: string;
|
|
1169
|
+
/** Library name */
|
|
1170
|
+
name: string;
|
|
1171
|
+
/** Library description */
|
|
1172
|
+
description?: string;
|
|
1173
|
+
/** Library visibility */
|
|
1174
|
+
visibility: 'public' | 'private';
|
|
1175
|
+
/** Creation timestamp */
|
|
1176
|
+
createdAt: number;
|
|
1177
|
+
/** Last update timestamp */
|
|
1178
|
+
updatedAt: number;
|
|
1179
|
+
/** Fork information */
|
|
1180
|
+
forkOf?: {
|
|
1181
|
+
subdao: string;
|
|
1182
|
+
commit: string;
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
export interface Collaborator {
|
|
1187
|
+
/** Wallet address */
|
|
1188
|
+
address: string;
|
|
1189
|
+
/** Permission level */
|
|
1190
|
+
permission: 'read' | 'write' | 'admin';
|
|
1191
|
+
/** When collaborator was added */
|
|
1192
|
+
addedAt: number;
|
|
1193
|
+
/** Who added the collaborator */
|
|
1194
|
+
addedBy?: string;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
export interface PushResult {
|
|
1198
|
+
/** Whether push succeeded */
|
|
1199
|
+
success: boolean;
|
|
1200
|
+
/** New commit hash */
|
|
1201
|
+
commitHash?: string;
|
|
1202
|
+
/** Error message if failed */
|
|
1203
|
+
error?: string;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
export interface PushPayload {
|
|
1207
|
+
/** Objects to push */
|
|
1208
|
+
objects: GitObject[];
|
|
1209
|
+
/** Ref updates (name -> oid) */
|
|
1210
|
+
refs: Record<string, string>;
|
|
1211
|
+
/** Commit message */
|
|
1212
|
+
message: string;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
export interface CloneResult {
|
|
1216
|
+
/** All objects in the library */
|
|
1217
|
+
objects: GitObject[];
|
|
1218
|
+
/** All refs (name -> oid) */
|
|
1219
|
+
refs: Record<string, string>;
|
|
1220
|
+
/** Library metadata */
|
|
1221
|
+
metadata: LibraryMetadata;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
export interface FetchResult {
|
|
1225
|
+
/** Objects since the given commit */
|
|
1226
|
+
objects: GitObject[];
|
|
1227
|
+
/** Current refs (name -> oid) */
|
|
1228
|
+
refs: Record<string, string>;
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
export interface CollaboratorPermissions {
|
|
1232
|
+
canRead: boolean;
|
|
1233
|
+
canWrite: boolean;
|
|
1234
|
+
isAdmin: boolean;
|
|
1235
|
+
permission?: string;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
export interface GitAuthProvider {
|
|
1239
|
+
/** Get wallet address */
|
|
1240
|
+
getAddress(): Promise<string>;
|
|
1241
|
+
/** Sign a message */
|
|
1242
|
+
signMessage(message: string): Promise<string>;
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
export interface GitStorageClientOptions {
|
|
1246
|
+
/** Request timeout in milliseconds (default: 30000) */
|
|
1247
|
+
timeout?: number;
|
|
1248
|
+
/** Custom headers */
|
|
1249
|
+
headers?: Record<string, string>;
|
|
1250
|
+
/** Ethers signer for authenticated requests */
|
|
1251
|
+
signer?: GitAuthProvider | (() => Promise<GitAuthProvider>);
|
|
1252
|
+
/** Custom auth provider */
|
|
1253
|
+
getAuth?: () => Promise<{ address: string; signature: string; nonce: string }>;
|
|
1254
|
+
/** Bearer token for authentication */
|
|
1255
|
+
token?: string;
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
export interface GitStorageClient {
|
|
1259
|
+
readonly baseUrl: string;
|
|
1260
|
+
readonly timeout: number;
|
|
1261
|
+
readonly headers: Record<string, string>;
|
|
1262
|
+
|
|
1263
|
+
// Library Management
|
|
1264
|
+
createLibrary(subdao: string, name: string, options?: {
|
|
1265
|
+
description?: string;
|
|
1266
|
+
visibility?: 'public' | 'private';
|
|
1267
|
+
}): Promise<LibraryMetadata>;
|
|
1268
|
+
|
|
1269
|
+
getLibrary(subdao: string): Promise<LibraryMetadata>;
|
|
1270
|
+
|
|
1271
|
+
listLibraries(options?: {
|
|
1272
|
+
limit?: number;
|
|
1273
|
+
cursor?: string;
|
|
1274
|
+
}): Promise<{ libraries: LibraryMetadata[]; cursor?: string }>;
|
|
1275
|
+
|
|
1276
|
+
deleteLibrary(subdao: string): Promise<{ ok: boolean }>;
|
|
1277
|
+
|
|
1278
|
+
// Git Object Operations
|
|
1279
|
+
putObjects(subdao: string, objects: GitObject[]): Promise<{ stored: number }>;
|
|
1280
|
+
getObject(subdao: string, oid: string): Promise<GitObject>;
|
|
1281
|
+
getObjects(subdao: string, oids: string[]): Promise<{ objects: GitObject[] }>;
|
|
1282
|
+
|
|
1283
|
+
// Reference Operations
|
|
1284
|
+
listRefs(subdao: string): Promise<{ refs: GitRef[] }>;
|
|
1285
|
+
getRef(subdao: string, refName: string): Promise<GitRef>;
|
|
1286
|
+
updateRef(subdao: string, refName: string, oid: string, options?: {
|
|
1287
|
+
oldOid?: string;
|
|
1288
|
+
}): Promise<{ ok: boolean }>;
|
|
1289
|
+
|
|
1290
|
+
// Sync Operations
|
|
1291
|
+
push(subdao: string, payload: PushPayload): Promise<PushResult>;
|
|
1292
|
+
clone(subdao: string): Promise<CloneResult>;
|
|
1293
|
+
fetch(subdao: string, since?: string): Promise<FetchResult>;
|
|
1294
|
+
|
|
1295
|
+
// File Access
|
|
1296
|
+
getHistory(subdao: string, options?: {
|
|
1297
|
+
ref?: string;
|
|
1298
|
+
limit?: number;
|
|
1299
|
+
}): Promise<{ commits: GitCommit[] }>;
|
|
1300
|
+
|
|
1301
|
+
getTree(subdao: string, ref: string, path: string): Promise<{ entries: Array<{
|
|
1302
|
+
name: string;
|
|
1303
|
+
type: 'blob' | 'tree';
|
|
1304
|
+
oid: string;
|
|
1305
|
+
}> }>;
|
|
1306
|
+
|
|
1307
|
+
getBlob(subdao: string, ref: string, path: string): Promise<{ content: string }>;
|
|
1308
|
+
getFile(subdao: string, ref: string, path: string): Promise<string>;
|
|
1309
|
+
|
|
1310
|
+
// Fork Operations
|
|
1311
|
+
fork(sourceSubdao: string, targetSubdao: string): Promise<{ success: boolean; commitHash?: string }>;
|
|
1312
|
+
getForks(subdao: string): Promise<{ forks: Array<{ subdao: string; forkedAt: number }> }>;
|
|
1313
|
+
getUpstream(subdao: string): Promise<{ upstreamSubdao: string; upstreamCommit: string; forkedAt: number }>;
|
|
1314
|
+
|
|
1315
|
+
// Collaborator Operations
|
|
1316
|
+
listCollaborators(subdao: string): Promise<{ collaborators: Collaborator[] }>;
|
|
1317
|
+
addCollaborator(subdao: string, address: string, permission: 'read' | 'write' | 'admin'): Promise<{ ok: boolean }>;
|
|
1318
|
+
removeCollaborator(subdao: string, address: string): Promise<{ ok: boolean }>;
|
|
1319
|
+
getPermissions(subdao: string, address: string): Promise<CollaboratorPermissions>;
|
|
1320
|
+
|
|
1321
|
+
// High-Level Convenience Methods
|
|
1322
|
+
pushManifest(subdao: string, manifest: object, message: string): Promise<PushResult>;
|
|
1323
|
+
getManifest(subdao: string, ref?: string): Promise<object>;
|
|
1324
|
+
|
|
1325
|
+
// Cache Management
|
|
1326
|
+
clearAuthCache(): void;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
export interface GitStorageClientConstructor {
|
|
1330
|
+
new (baseUrl: string, options?: GitStorageClientOptions): GitStorageClient;
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
export declare const GitStorageClient: GitStorageClientConstructor;
|
|
1334
|
+
|
|
929
1335
|
export interface SageSDK {
|
|
930
1336
|
version: string;
|
|
931
1337
|
getProvider: (rpcUrl: string) => any;
|
|
@@ -959,9 +1365,17 @@ export interface SageSDK {
|
|
|
959
1365
|
votingMultiplier: VotingMultiplierModule;
|
|
960
1366
|
auction: AuctionModule;
|
|
961
1367
|
bounty: BountyModule;
|
|
1368
|
+
contributions: ContributionsModule;
|
|
962
1369
|
subgraph: Record<string, any>;
|
|
963
1370
|
errors: Record<string, any>;
|
|
964
1371
|
resolveGovernanceContext: (args: any) => Promise<any>;
|
|
1372
|
+
// Client exports
|
|
1373
|
+
clients: {
|
|
1374
|
+
DiscoveryClient: any;
|
|
1375
|
+
GitStorageClient: GitStorageClientConstructor;
|
|
1376
|
+
};
|
|
1377
|
+
DiscoveryClient: any;
|
|
1378
|
+
GitStorageClient: GitStorageClientConstructor;
|
|
965
1379
|
}
|
|
966
1380
|
|
|
967
1381
|
declare const sdk: SageSDK;
|