@chaoschain/sdk 0.3.1 → 0.3.2
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/CHANGELOG.md +15 -0
- package/README.md +49 -0
- package/dist/{IPFSLocal-B4hnMEfS.d.ts → IPFSLocal-B_Sgmd_Q.d.ts} +1 -1
- package/dist/{IPFSLocal-zRj6kG8e.d.cts → IPFSLocal-DjFddwHD.d.cts} +1 -1
- package/dist/gateway/index.cjs +591 -0
- package/dist/gateway/index.cjs.map +1 -0
- package/dist/gateway/index.d.cts +3 -0
- package/dist/gateway/index.d.ts +3 -0
- package/dist/gateway/index.js +581 -0
- package/dist/gateway/index.js.map +1 -0
- package/dist/index-CL0fidQs.d.ts +223 -0
- package/dist/index-iUO5l1VD.d.cts +223 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -393
- package/dist/index.d.ts +9 -393
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/providers/compute/index.d.cts +1 -1
- package/dist/providers/compute/index.d.ts +1 -1
- package/dist/providers/storage/index.d.cts +2 -2
- package/dist/providers/storage/index.d.ts +2 -2
- package/dist/session/index.cjs +196 -0
- package/dist/session/index.cjs.map +1 -0
- package/dist/session/index.d.cts +169 -0
- package/dist/session/index.d.ts +169 -0
- package/dist/session/index.js +189 -0
- package/dist/session/index.js.map +1 -0
- package/dist/{types-BBVtx_jV.d.cts → types-C0Ay90UI.d.cts} +1 -1
- package/dist/{types-BBVtx_jV.d.ts → types-C0Ay90UI.d.ts} +1 -1
- package/package.json +11 -1
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { G as GatewayClientConfig, $ as GatewayHealthResponse, g as WorkflowStatus, h as ScoreSubmissionMode, s as PendingWorkResponse, t as WorkEvidenceResponse, q as WorkflowError } from './types-C0Ay90UI.js';
|
|
2
|
+
|
|
3
|
+
declare class GatewayClient {
|
|
4
|
+
private gatewayUrl;
|
|
5
|
+
private timeout;
|
|
6
|
+
private maxPollTime;
|
|
7
|
+
private pollInterval;
|
|
8
|
+
private defaultHeaders?;
|
|
9
|
+
private auth?;
|
|
10
|
+
private retryConfig?;
|
|
11
|
+
constructor(config: GatewayClientConfig);
|
|
12
|
+
private _resolveTimeout;
|
|
13
|
+
private _resolveAuthMode;
|
|
14
|
+
private _buildHeaders;
|
|
15
|
+
private _classifyStatusCode;
|
|
16
|
+
private _normalizeError;
|
|
17
|
+
private _getRetryDelayMs;
|
|
18
|
+
private _sleep;
|
|
19
|
+
/**
|
|
20
|
+
* Make HTTP request to Gateway.
|
|
21
|
+
* Handles errors and transforms them to Gateway exceptions.
|
|
22
|
+
*/
|
|
23
|
+
private _request;
|
|
24
|
+
/**
|
|
25
|
+
* Parse workflow status from API response.
|
|
26
|
+
*/
|
|
27
|
+
private _parseWorkflowStatus;
|
|
28
|
+
healthCheck(): Promise<GatewayHealthResponse>;
|
|
29
|
+
isHealthy(): Promise<boolean>;
|
|
30
|
+
/**
|
|
31
|
+
* Create a work submission workflow.
|
|
32
|
+
* POST /workflows/work-submission
|
|
33
|
+
*
|
|
34
|
+
* SDK prepares inputs; Gateway handles:
|
|
35
|
+
* - Evidence upload to Arweave
|
|
36
|
+
* - Transaction submission
|
|
37
|
+
* - Confirmation waiting
|
|
38
|
+
*
|
|
39
|
+
* @param studioAddress - Ethereum address of the studio
|
|
40
|
+
* @param epoch - Epoch number
|
|
41
|
+
* @param agentAddress - Ethereum address of the submitting agent
|
|
42
|
+
* @param dataHash - Bytes32 hash of the work (as hex string)
|
|
43
|
+
* @param threadRoot - Bytes32 DKG thread root (as hex string)
|
|
44
|
+
* @param evidenceRoot - Bytes32 evidence Merkle root (as hex string)
|
|
45
|
+
* @param evidenceContent - Raw evidence bytes (will be base64 encoded)
|
|
46
|
+
* @param signerAddress - Ethereum address of the signer (must be registered in Gateway)
|
|
47
|
+
* @returns WorkflowStatus - Initial status of the created workflow
|
|
48
|
+
*/
|
|
49
|
+
submitWork(studioAddress: string, epoch: number, agentAddress: string, dataHash: string, threadRoot: string, evidenceRoot: string, evidenceContent: Buffer | string, signerAddress: string): Promise<WorkflowStatus>;
|
|
50
|
+
/**
|
|
51
|
+
* Create a score submission workflow.
|
|
52
|
+
* POST /workflows/score-submission
|
|
53
|
+
*
|
|
54
|
+
* Supports two modes:
|
|
55
|
+
* - DIRECT (default): Simple direct scoring, requires workerAddress
|
|
56
|
+
* - COMMIT_REVEAL: Commit-reveal pattern, requires salt
|
|
57
|
+
*
|
|
58
|
+
* @param studioAddress - Ethereum address of the studio
|
|
59
|
+
* @param epoch - Epoch number
|
|
60
|
+
* @param validatorAddress - Ethereum address of the validator
|
|
61
|
+
* @param dataHash - Bytes32 hash of the work being scored (as hex string)
|
|
62
|
+
* @param scores - Array of dimension scores (0-10000 basis points)
|
|
63
|
+
* @param signerAddress - Ethereum address of the signer
|
|
64
|
+
* @param options - Additional options (workerAddress, salt, mode)
|
|
65
|
+
*/
|
|
66
|
+
submitScore(studioAddress: string, epoch: number, validatorAddress: string, dataHash: string, scores: number[], signerAddress: string, options?: {
|
|
67
|
+
workerAddress?: string;
|
|
68
|
+
salt?: string;
|
|
69
|
+
mode?: ScoreSubmissionMode;
|
|
70
|
+
}): Promise<WorkflowStatus>;
|
|
71
|
+
/**
|
|
72
|
+
* Create a close epoch workflow.
|
|
73
|
+
* POST /workflows/close-epoch
|
|
74
|
+
*
|
|
75
|
+
* This is economically final — cannot be undone.
|
|
76
|
+
*
|
|
77
|
+
* @param studioAddress - Ethereum address of the studio
|
|
78
|
+
* @param epoch - Epoch number to close
|
|
79
|
+
* @param signerAddress - Ethereum address of the signer
|
|
80
|
+
*/
|
|
81
|
+
closeEpoch(studioAddress: string, epoch: number, signerAddress: string): Promise<WorkflowStatus>;
|
|
82
|
+
/**
|
|
83
|
+
* Get workflow status by ID.
|
|
84
|
+
* GET /workflows/{id}
|
|
85
|
+
*/
|
|
86
|
+
getWorkflow(workflowId: string): Promise<WorkflowStatus>;
|
|
87
|
+
/**
|
|
88
|
+
* List workflows with optional filters.
|
|
89
|
+
* GET /workflows?studio=&state=&type=
|
|
90
|
+
*/
|
|
91
|
+
listWorkflows(options?: {
|
|
92
|
+
studio?: string;
|
|
93
|
+
state?: string;
|
|
94
|
+
workflowType?: string;
|
|
95
|
+
}): Promise<WorkflowStatus[]>;
|
|
96
|
+
/**
|
|
97
|
+
* Poll workflow until it reaches a terminal state.
|
|
98
|
+
*
|
|
99
|
+
* @param workflowId - UUID of the workflow
|
|
100
|
+
* @param options - Polling options
|
|
101
|
+
* @throws WorkflowFailedError - If workflow reaches FAILED state
|
|
102
|
+
* @throws GatewayTimeoutError - If maxWait exceeded
|
|
103
|
+
*/
|
|
104
|
+
waitForCompletion(workflowId: string, options?: {
|
|
105
|
+
maxWait?: number;
|
|
106
|
+
pollInterval?: number;
|
|
107
|
+
onProgress?: (status: WorkflowStatus) => void;
|
|
108
|
+
}): Promise<WorkflowStatus>;
|
|
109
|
+
/**
|
|
110
|
+
* Submit work and wait for completion.
|
|
111
|
+
*/
|
|
112
|
+
submitWorkAndWait(studioAddress: string, epoch: number, agentAddress: string, dataHash: string, threadRoot: string, evidenceRoot: string, evidenceContent: Buffer | string, signerAddress: string, options?: {
|
|
113
|
+
onProgress?: (status: WorkflowStatus) => void;
|
|
114
|
+
}): Promise<WorkflowStatus>;
|
|
115
|
+
/**
|
|
116
|
+
* Submit score and wait for completion.
|
|
117
|
+
*/
|
|
118
|
+
submitScoreAndWait(studioAddress: string, epoch: number, validatorAddress: string, dataHash: string, scores: number[], signerAddress: string, options?: {
|
|
119
|
+
workerAddress?: string;
|
|
120
|
+
workAddress?: string;
|
|
121
|
+
salt?: string;
|
|
122
|
+
mode?: ScoreSubmissionMode;
|
|
123
|
+
onProgress?: (status: WorkflowStatus) => void;
|
|
124
|
+
}): Promise<WorkflowStatus>;
|
|
125
|
+
/**
|
|
126
|
+
* Close epoch and wait for completion.
|
|
127
|
+
*/
|
|
128
|
+
closeEpochAndWait(studioAddress: string, epoch: number, signerAddress: string, options?: {
|
|
129
|
+
onProgress?: (status: WorkflowStatus) => void;
|
|
130
|
+
}): Promise<WorkflowStatus>;
|
|
131
|
+
/**
|
|
132
|
+
* Fetch pending (unfinalized) work for a studio from the gateway.
|
|
133
|
+
*
|
|
134
|
+
* @param studioAddress - 0x-prefixed studio contract address
|
|
135
|
+
* @param options - Optional limit/offset for pagination
|
|
136
|
+
* @returns Typed pending work response
|
|
137
|
+
*/
|
|
138
|
+
getPendingWork(studioAddress: string, options?: {
|
|
139
|
+
limit?: number;
|
|
140
|
+
offset?: number;
|
|
141
|
+
}): Promise<PendingWorkResponse>;
|
|
142
|
+
/**
|
|
143
|
+
* Fetch full evidence graph for a work submission.
|
|
144
|
+
* Endpoint: GET /v1/work/{hash}/evidence
|
|
145
|
+
*/
|
|
146
|
+
getWorkEvidence(workHash: string): Promise<WorkEvidenceResponse>;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Exception classes for the ChaosChain SDK.
|
|
151
|
+
*
|
|
152
|
+
* This module defines all custom exceptions used throughout the SDK
|
|
153
|
+
* to provide clear error handling and debugging information.
|
|
154
|
+
*/
|
|
155
|
+
declare class ChaosChainSDKError extends Error {
|
|
156
|
+
details: Record<string, any>;
|
|
157
|
+
constructor(message: string, details?: Record<string, any>);
|
|
158
|
+
toString(): string;
|
|
159
|
+
}
|
|
160
|
+
declare class AgentRegistrationError extends ChaosChainSDKError {
|
|
161
|
+
constructor(message: string, details?: Record<string, any>);
|
|
162
|
+
}
|
|
163
|
+
declare class PaymentError extends ChaosChainSDKError {
|
|
164
|
+
constructor(message: string, details?: Record<string, any>);
|
|
165
|
+
}
|
|
166
|
+
declare class StorageError extends ChaosChainSDKError {
|
|
167
|
+
constructor(message: string, details?: Record<string, any>);
|
|
168
|
+
}
|
|
169
|
+
declare class IntegrityVerificationError extends ChaosChainSDKError {
|
|
170
|
+
constructor(message: string, details?: Record<string, any>);
|
|
171
|
+
}
|
|
172
|
+
declare class ContractError extends ChaosChainSDKError {
|
|
173
|
+
constructor(message: string, details?: Record<string, any>);
|
|
174
|
+
}
|
|
175
|
+
declare class ValidationError extends ChaosChainSDKError {
|
|
176
|
+
constructor(message: string, details?: Record<string, any>);
|
|
177
|
+
}
|
|
178
|
+
declare class ConfigurationError extends ChaosChainSDKError {
|
|
179
|
+
constructor(message: string, details?: Record<string, any>);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Options passed when constructing a GatewayError (statusCode, response, category, retryable).
|
|
183
|
+
*/
|
|
184
|
+
interface GatewayErrorDetails {
|
|
185
|
+
statusCode?: number;
|
|
186
|
+
response?: Record<string, any>;
|
|
187
|
+
category?: 'transient' | 'permanent' | 'auth' | 'unknown';
|
|
188
|
+
retryable?: boolean;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Base error from Gateway API.
|
|
192
|
+
*/
|
|
193
|
+
declare class GatewayError extends ChaosChainSDKError {
|
|
194
|
+
readonly statusCode?: number;
|
|
195
|
+
readonly response?: Record<string, any>;
|
|
196
|
+
readonly category?: 'transient' | 'permanent' | 'auth' | 'unknown';
|
|
197
|
+
readonly retryable?: boolean;
|
|
198
|
+
constructor(message: string, details?: GatewayErrorDetails);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Failed to connect to Gateway.
|
|
202
|
+
*/
|
|
203
|
+
declare class GatewayConnectionError extends GatewayError {
|
|
204
|
+
constructor(message: string);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Gateway request or polling timed out.
|
|
208
|
+
*/
|
|
209
|
+
declare class GatewayTimeoutError extends GatewayError {
|
|
210
|
+
readonly workflowId: string;
|
|
211
|
+
readonly lastStatus?: WorkflowStatus;
|
|
212
|
+
constructor(workflowId: string, message: string, lastStatus?: WorkflowStatus);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Workflow reached FAILED state.
|
|
216
|
+
*/
|
|
217
|
+
declare class WorkflowFailedError extends GatewayError {
|
|
218
|
+
readonly workflowId: string;
|
|
219
|
+
readonly workflowError: WorkflowError;
|
|
220
|
+
constructor(workflowId: string, error: WorkflowError);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export { AgentRegistrationError as A, ChaosChainSDKError as C, GatewayClient as G, IntegrityVerificationError as I, PaymentError as P, StorageError as S, ValidationError as V, WorkflowFailedError as W, ContractError as a, ConfigurationError as b, GatewayError as c, GatewayConnectionError as d, GatewayTimeoutError as e };
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { G as GatewayClientConfig, $ as GatewayHealthResponse, g as WorkflowStatus, h as ScoreSubmissionMode, s as PendingWorkResponse, t as WorkEvidenceResponse, q as WorkflowError } from './types-C0Ay90UI.cjs';
|
|
2
|
+
|
|
3
|
+
declare class GatewayClient {
|
|
4
|
+
private gatewayUrl;
|
|
5
|
+
private timeout;
|
|
6
|
+
private maxPollTime;
|
|
7
|
+
private pollInterval;
|
|
8
|
+
private defaultHeaders?;
|
|
9
|
+
private auth?;
|
|
10
|
+
private retryConfig?;
|
|
11
|
+
constructor(config: GatewayClientConfig);
|
|
12
|
+
private _resolveTimeout;
|
|
13
|
+
private _resolveAuthMode;
|
|
14
|
+
private _buildHeaders;
|
|
15
|
+
private _classifyStatusCode;
|
|
16
|
+
private _normalizeError;
|
|
17
|
+
private _getRetryDelayMs;
|
|
18
|
+
private _sleep;
|
|
19
|
+
/**
|
|
20
|
+
* Make HTTP request to Gateway.
|
|
21
|
+
* Handles errors and transforms them to Gateway exceptions.
|
|
22
|
+
*/
|
|
23
|
+
private _request;
|
|
24
|
+
/**
|
|
25
|
+
* Parse workflow status from API response.
|
|
26
|
+
*/
|
|
27
|
+
private _parseWorkflowStatus;
|
|
28
|
+
healthCheck(): Promise<GatewayHealthResponse>;
|
|
29
|
+
isHealthy(): Promise<boolean>;
|
|
30
|
+
/**
|
|
31
|
+
* Create a work submission workflow.
|
|
32
|
+
* POST /workflows/work-submission
|
|
33
|
+
*
|
|
34
|
+
* SDK prepares inputs; Gateway handles:
|
|
35
|
+
* - Evidence upload to Arweave
|
|
36
|
+
* - Transaction submission
|
|
37
|
+
* - Confirmation waiting
|
|
38
|
+
*
|
|
39
|
+
* @param studioAddress - Ethereum address of the studio
|
|
40
|
+
* @param epoch - Epoch number
|
|
41
|
+
* @param agentAddress - Ethereum address of the submitting agent
|
|
42
|
+
* @param dataHash - Bytes32 hash of the work (as hex string)
|
|
43
|
+
* @param threadRoot - Bytes32 DKG thread root (as hex string)
|
|
44
|
+
* @param evidenceRoot - Bytes32 evidence Merkle root (as hex string)
|
|
45
|
+
* @param evidenceContent - Raw evidence bytes (will be base64 encoded)
|
|
46
|
+
* @param signerAddress - Ethereum address of the signer (must be registered in Gateway)
|
|
47
|
+
* @returns WorkflowStatus - Initial status of the created workflow
|
|
48
|
+
*/
|
|
49
|
+
submitWork(studioAddress: string, epoch: number, agentAddress: string, dataHash: string, threadRoot: string, evidenceRoot: string, evidenceContent: Buffer | string, signerAddress: string): Promise<WorkflowStatus>;
|
|
50
|
+
/**
|
|
51
|
+
* Create a score submission workflow.
|
|
52
|
+
* POST /workflows/score-submission
|
|
53
|
+
*
|
|
54
|
+
* Supports two modes:
|
|
55
|
+
* - DIRECT (default): Simple direct scoring, requires workerAddress
|
|
56
|
+
* - COMMIT_REVEAL: Commit-reveal pattern, requires salt
|
|
57
|
+
*
|
|
58
|
+
* @param studioAddress - Ethereum address of the studio
|
|
59
|
+
* @param epoch - Epoch number
|
|
60
|
+
* @param validatorAddress - Ethereum address of the validator
|
|
61
|
+
* @param dataHash - Bytes32 hash of the work being scored (as hex string)
|
|
62
|
+
* @param scores - Array of dimension scores (0-10000 basis points)
|
|
63
|
+
* @param signerAddress - Ethereum address of the signer
|
|
64
|
+
* @param options - Additional options (workerAddress, salt, mode)
|
|
65
|
+
*/
|
|
66
|
+
submitScore(studioAddress: string, epoch: number, validatorAddress: string, dataHash: string, scores: number[], signerAddress: string, options?: {
|
|
67
|
+
workerAddress?: string;
|
|
68
|
+
salt?: string;
|
|
69
|
+
mode?: ScoreSubmissionMode;
|
|
70
|
+
}): Promise<WorkflowStatus>;
|
|
71
|
+
/**
|
|
72
|
+
* Create a close epoch workflow.
|
|
73
|
+
* POST /workflows/close-epoch
|
|
74
|
+
*
|
|
75
|
+
* This is economically final — cannot be undone.
|
|
76
|
+
*
|
|
77
|
+
* @param studioAddress - Ethereum address of the studio
|
|
78
|
+
* @param epoch - Epoch number to close
|
|
79
|
+
* @param signerAddress - Ethereum address of the signer
|
|
80
|
+
*/
|
|
81
|
+
closeEpoch(studioAddress: string, epoch: number, signerAddress: string): Promise<WorkflowStatus>;
|
|
82
|
+
/**
|
|
83
|
+
* Get workflow status by ID.
|
|
84
|
+
* GET /workflows/{id}
|
|
85
|
+
*/
|
|
86
|
+
getWorkflow(workflowId: string): Promise<WorkflowStatus>;
|
|
87
|
+
/**
|
|
88
|
+
* List workflows with optional filters.
|
|
89
|
+
* GET /workflows?studio=&state=&type=
|
|
90
|
+
*/
|
|
91
|
+
listWorkflows(options?: {
|
|
92
|
+
studio?: string;
|
|
93
|
+
state?: string;
|
|
94
|
+
workflowType?: string;
|
|
95
|
+
}): Promise<WorkflowStatus[]>;
|
|
96
|
+
/**
|
|
97
|
+
* Poll workflow until it reaches a terminal state.
|
|
98
|
+
*
|
|
99
|
+
* @param workflowId - UUID of the workflow
|
|
100
|
+
* @param options - Polling options
|
|
101
|
+
* @throws WorkflowFailedError - If workflow reaches FAILED state
|
|
102
|
+
* @throws GatewayTimeoutError - If maxWait exceeded
|
|
103
|
+
*/
|
|
104
|
+
waitForCompletion(workflowId: string, options?: {
|
|
105
|
+
maxWait?: number;
|
|
106
|
+
pollInterval?: number;
|
|
107
|
+
onProgress?: (status: WorkflowStatus) => void;
|
|
108
|
+
}): Promise<WorkflowStatus>;
|
|
109
|
+
/**
|
|
110
|
+
* Submit work and wait for completion.
|
|
111
|
+
*/
|
|
112
|
+
submitWorkAndWait(studioAddress: string, epoch: number, agentAddress: string, dataHash: string, threadRoot: string, evidenceRoot: string, evidenceContent: Buffer | string, signerAddress: string, options?: {
|
|
113
|
+
onProgress?: (status: WorkflowStatus) => void;
|
|
114
|
+
}): Promise<WorkflowStatus>;
|
|
115
|
+
/**
|
|
116
|
+
* Submit score and wait for completion.
|
|
117
|
+
*/
|
|
118
|
+
submitScoreAndWait(studioAddress: string, epoch: number, validatorAddress: string, dataHash: string, scores: number[], signerAddress: string, options?: {
|
|
119
|
+
workerAddress?: string;
|
|
120
|
+
workAddress?: string;
|
|
121
|
+
salt?: string;
|
|
122
|
+
mode?: ScoreSubmissionMode;
|
|
123
|
+
onProgress?: (status: WorkflowStatus) => void;
|
|
124
|
+
}): Promise<WorkflowStatus>;
|
|
125
|
+
/**
|
|
126
|
+
* Close epoch and wait for completion.
|
|
127
|
+
*/
|
|
128
|
+
closeEpochAndWait(studioAddress: string, epoch: number, signerAddress: string, options?: {
|
|
129
|
+
onProgress?: (status: WorkflowStatus) => void;
|
|
130
|
+
}): Promise<WorkflowStatus>;
|
|
131
|
+
/**
|
|
132
|
+
* Fetch pending (unfinalized) work for a studio from the gateway.
|
|
133
|
+
*
|
|
134
|
+
* @param studioAddress - 0x-prefixed studio contract address
|
|
135
|
+
* @param options - Optional limit/offset for pagination
|
|
136
|
+
* @returns Typed pending work response
|
|
137
|
+
*/
|
|
138
|
+
getPendingWork(studioAddress: string, options?: {
|
|
139
|
+
limit?: number;
|
|
140
|
+
offset?: number;
|
|
141
|
+
}): Promise<PendingWorkResponse>;
|
|
142
|
+
/**
|
|
143
|
+
* Fetch full evidence graph for a work submission.
|
|
144
|
+
* Endpoint: GET /v1/work/{hash}/evidence
|
|
145
|
+
*/
|
|
146
|
+
getWorkEvidence(workHash: string): Promise<WorkEvidenceResponse>;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Exception classes for the ChaosChain SDK.
|
|
151
|
+
*
|
|
152
|
+
* This module defines all custom exceptions used throughout the SDK
|
|
153
|
+
* to provide clear error handling and debugging information.
|
|
154
|
+
*/
|
|
155
|
+
declare class ChaosChainSDKError extends Error {
|
|
156
|
+
details: Record<string, any>;
|
|
157
|
+
constructor(message: string, details?: Record<string, any>);
|
|
158
|
+
toString(): string;
|
|
159
|
+
}
|
|
160
|
+
declare class AgentRegistrationError extends ChaosChainSDKError {
|
|
161
|
+
constructor(message: string, details?: Record<string, any>);
|
|
162
|
+
}
|
|
163
|
+
declare class PaymentError extends ChaosChainSDKError {
|
|
164
|
+
constructor(message: string, details?: Record<string, any>);
|
|
165
|
+
}
|
|
166
|
+
declare class StorageError extends ChaosChainSDKError {
|
|
167
|
+
constructor(message: string, details?: Record<string, any>);
|
|
168
|
+
}
|
|
169
|
+
declare class IntegrityVerificationError extends ChaosChainSDKError {
|
|
170
|
+
constructor(message: string, details?: Record<string, any>);
|
|
171
|
+
}
|
|
172
|
+
declare class ContractError extends ChaosChainSDKError {
|
|
173
|
+
constructor(message: string, details?: Record<string, any>);
|
|
174
|
+
}
|
|
175
|
+
declare class ValidationError extends ChaosChainSDKError {
|
|
176
|
+
constructor(message: string, details?: Record<string, any>);
|
|
177
|
+
}
|
|
178
|
+
declare class ConfigurationError extends ChaosChainSDKError {
|
|
179
|
+
constructor(message: string, details?: Record<string, any>);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Options passed when constructing a GatewayError (statusCode, response, category, retryable).
|
|
183
|
+
*/
|
|
184
|
+
interface GatewayErrorDetails {
|
|
185
|
+
statusCode?: number;
|
|
186
|
+
response?: Record<string, any>;
|
|
187
|
+
category?: 'transient' | 'permanent' | 'auth' | 'unknown';
|
|
188
|
+
retryable?: boolean;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Base error from Gateway API.
|
|
192
|
+
*/
|
|
193
|
+
declare class GatewayError extends ChaosChainSDKError {
|
|
194
|
+
readonly statusCode?: number;
|
|
195
|
+
readonly response?: Record<string, any>;
|
|
196
|
+
readonly category?: 'transient' | 'permanent' | 'auth' | 'unknown';
|
|
197
|
+
readonly retryable?: boolean;
|
|
198
|
+
constructor(message: string, details?: GatewayErrorDetails);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Failed to connect to Gateway.
|
|
202
|
+
*/
|
|
203
|
+
declare class GatewayConnectionError extends GatewayError {
|
|
204
|
+
constructor(message: string);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Gateway request or polling timed out.
|
|
208
|
+
*/
|
|
209
|
+
declare class GatewayTimeoutError extends GatewayError {
|
|
210
|
+
readonly workflowId: string;
|
|
211
|
+
readonly lastStatus?: WorkflowStatus;
|
|
212
|
+
constructor(workflowId: string, message: string, lastStatus?: WorkflowStatus);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Workflow reached FAILED state.
|
|
216
|
+
*/
|
|
217
|
+
declare class WorkflowFailedError extends GatewayError {
|
|
218
|
+
readonly workflowId: string;
|
|
219
|
+
readonly workflowError: WorkflowError;
|
|
220
|
+
constructor(workflowId: string, error: WorkflowError);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export { AgentRegistrationError as A, ChaosChainSDKError as C, GatewayClient as G, IntegrityVerificationError as I, PaymentError as P, StorageError as S, ValidationError as V, WorkflowFailedError as W, ContractError as a, ConfigurationError as b, GatewayError as c, GatewayConnectionError as d, GatewayTimeoutError as e };
|
package/dist/index.cjs
CHANGED
|
@@ -16185,7 +16185,7 @@ var ChaosChainSDK = class _ChaosChainSDK {
|
|
|
16185
16185
|
* Get SDK version
|
|
16186
16186
|
*/
|
|
16187
16187
|
getVersion() {
|
|
16188
|
-
return "0.3.
|
|
16188
|
+
return "0.3.2";
|
|
16189
16189
|
}
|
|
16190
16190
|
/**
|
|
16191
16191
|
* Get SDK capabilities summary
|
|
@@ -16983,7 +16983,7 @@ function verifyWorkEvidence(evidence, context) {
|
|
|
16983
16983
|
}
|
|
16984
16984
|
|
|
16985
16985
|
// src/index.ts
|
|
16986
|
-
var SDK_VERSION = "0.3.
|
|
16986
|
+
var SDK_VERSION = "0.3.2";
|
|
16987
16987
|
var ERC8004_VERSION = "1.0";
|
|
16988
16988
|
var X402_VERSION = "1.0";
|
|
16989
16989
|
var src_default = ChaosChainSDK;
|