@zeroxyz/sdk 0.1.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/CHANGELOG.md +18 -0
- package/LICENSE +21 -0
- package/README.md +281 -0
- package/dist/chunk-7STN754W.cjs +3048 -0
- package/dist/chunk-7STN754W.cjs.map +1 -0
- package/dist/chunk-XQEHJX2X.js +3017 -0
- package/dist/chunk-XQEHJX2X.js.map +1 -0
- package/dist/client-B50UYxPr.d.cts +836 -0
- package/dist/client-B50UYxPr.d.ts +836 -0
- package/dist/index.cjs +150 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +148 -0
- package/dist/index.d.ts +148 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/testing.cjs +51 -0
- package/dist/testing.cjs.map +1 -0
- package/dist/testing.d.cts +14 -0
- package/dist/testing.d.ts +14 -0
- package/dist/testing.js +47 -0
- package/dist/testing.js.map +1 -0
- package/package.json +95 -0
- package/testing/package.json +5 -0
|
@@ -0,0 +1,836 @@
|
|
|
1
|
+
import { LocalAccount, SignableMessage, Hex, TypedDataDefinition } from 'viem';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
type OnSessionRefreshed = (next: {
|
|
5
|
+
accessToken: string;
|
|
6
|
+
refreshToken: string;
|
|
7
|
+
}) => void | Promise<void>;
|
|
8
|
+
type SessionCredentialsInput = {
|
|
9
|
+
accessToken: string;
|
|
10
|
+
refreshToken: string;
|
|
11
|
+
onRefreshed?: OnSessionRefreshed;
|
|
12
|
+
};
|
|
13
|
+
type SessionCredentials = {
|
|
14
|
+
kind: "session";
|
|
15
|
+
accessToken: string;
|
|
16
|
+
refreshToken: string;
|
|
17
|
+
onRefreshed: OnSessionRefreshed;
|
|
18
|
+
};
|
|
19
|
+
type AccountCredentials = {
|
|
20
|
+
kind: "account";
|
|
21
|
+
account: LocalAccount;
|
|
22
|
+
};
|
|
23
|
+
type NoCredentials = {
|
|
24
|
+
kind: "none";
|
|
25
|
+
};
|
|
26
|
+
type Credentials = SessionCredentials | AccountCredentials | NoCredentials;
|
|
27
|
+
|
|
28
|
+
type PaymentProtocol = "x402" | "mpp";
|
|
29
|
+
type PaymentChain = "base" | "base-sepolia" | "tempo" | "tempo-testnet" | "unknown";
|
|
30
|
+
type PaymentSessionMeta = {
|
|
31
|
+
channelId: `0x${string}`;
|
|
32
|
+
escrowContract: `0x${string}`;
|
|
33
|
+
chainId: number;
|
|
34
|
+
recipient: `0x${string}` | null;
|
|
35
|
+
cumulativeAmount: string;
|
|
36
|
+
};
|
|
37
|
+
type PaymentResult = {
|
|
38
|
+
protocol: PaymentProtocol;
|
|
39
|
+
chain: PaymentChain;
|
|
40
|
+
txHash: string | null;
|
|
41
|
+
amount: string;
|
|
42
|
+
asset: "USDC";
|
|
43
|
+
session?: PaymentSessionMeta;
|
|
44
|
+
};
|
|
45
|
+
type PayInput = {
|
|
46
|
+
url: string;
|
|
47
|
+
method?: string;
|
|
48
|
+
headers?: Record<string, string>;
|
|
49
|
+
body?: string | Uint8Array;
|
|
50
|
+
maxPay?: string;
|
|
51
|
+
account?: LocalAccount;
|
|
52
|
+
signal?: AbortSignal;
|
|
53
|
+
timeoutMs?: number;
|
|
54
|
+
displayCostAmount?: string;
|
|
55
|
+
};
|
|
56
|
+
type PayResult = {
|
|
57
|
+
response: Response;
|
|
58
|
+
payment: PaymentResult;
|
|
59
|
+
warnings?: string[];
|
|
60
|
+
};
|
|
61
|
+
declare const TEMPO_CHAIN_ID = 4217;
|
|
62
|
+
declare const TEMPO_TESTNET_CHAIN_ID = 42431;
|
|
63
|
+
type SessionReceiptPayload = {
|
|
64
|
+
channelId: string;
|
|
65
|
+
challengeId: string;
|
|
66
|
+
acceptedCumulative: string;
|
|
67
|
+
spent: string;
|
|
68
|
+
txHash?: string;
|
|
69
|
+
metered?: boolean;
|
|
70
|
+
};
|
|
71
|
+
declare const coerceTempoChainId: (raw: unknown) => {
|
|
72
|
+
id: number;
|
|
73
|
+
chain: "tempo" | "tempo-testnet";
|
|
74
|
+
} | null;
|
|
75
|
+
declare const tempoChainLabelFromId: (chainId: unknown) => PaymentChain;
|
|
76
|
+
declare const paymentHasAnchor: (payment: PaymentResult | null) => boolean;
|
|
77
|
+
declare const FETCH_WARNINGS: Readonly<{
|
|
78
|
+
readonly paidButStill402NotRecorded: "paid_but_still_402_not_recorded";
|
|
79
|
+
readonly paymentSettlementUnconfirmed: "payment_settlement_unconfirmed";
|
|
80
|
+
readonly paymentAmountUnknown: "payment_amount_unknown";
|
|
81
|
+
readonly mppSessionCloseFailed: "mpp_session_close_failed";
|
|
82
|
+
readonly sessionOpenUnobserved: "session_open_unobserved";
|
|
83
|
+
readonly bodyTruncated: "body_truncated";
|
|
84
|
+
}>;
|
|
85
|
+
declare const FETCH_SKIP_REASONS: Readonly<{
|
|
86
|
+
readonly bodyReadFailed: "body_read_failed";
|
|
87
|
+
readonly mppSessionCloseFailedNotRecorded: "mpp_session_close_failed_not_recorded";
|
|
88
|
+
readonly paidButStill402NotRecorded: "paid_but_still_402_not_recorded";
|
|
89
|
+
readonly paymentSettlementUnconfirmed: "payment_settlement_unconfirmed";
|
|
90
|
+
}>;
|
|
91
|
+
declare class Payments {
|
|
92
|
+
private readonly client;
|
|
93
|
+
private relayInitialized;
|
|
94
|
+
constructor(client: ZeroClient);
|
|
95
|
+
/**
|
|
96
|
+
* Settle an x402 payment for a single request.
|
|
97
|
+
*
|
|
98
|
+
* Routes through `@x402/fetch`, which handles the full 402 → sign →
|
|
99
|
+
* retry round-trip. The settlement transaction hash (when present in
|
|
100
|
+
* the `payment-response` header AND the facilitator reports success)
|
|
101
|
+
* is extracted into the returned `payment` metadata.
|
|
102
|
+
*
|
|
103
|
+
* Aborts before signing if the server's challenge amount exceeds
|
|
104
|
+
* `maxPay`. The cap is denominated in USDC (the asset of every Zero
|
|
105
|
+
* payment today); the API will gain a `maxPayAsset` field if other
|
|
106
|
+
* assets are added.
|
|
107
|
+
*
|
|
108
|
+
* MPP capabilities use `payMpp()` instead — `client.fetch` routes based
|
|
109
|
+
* on the detected 402 protocol.
|
|
110
|
+
*/
|
|
111
|
+
pay: (input: PayInput) => Promise<PayResult>;
|
|
112
|
+
/**
|
|
113
|
+
* @internal — called by `client.fetch` after MPP protocol detection.
|
|
114
|
+
*
|
|
115
|
+
* Runs a single `mppx.fetch` against the Tempo payment-channel protocol.
|
|
116
|
+
* In-band balance/bridge logic runs from mppx's `onChallenge` callback so
|
|
117
|
+
* the lifecycle is a single HTTP round-trip from the SDK consumer's view
|
|
118
|
+
* (no pre-probe — session facilitators that re-run inference per request
|
|
119
|
+
* can't reconcile the extra state).
|
|
120
|
+
*
|
|
121
|
+
* Session-intent capabilities (long-lived channels) close their voucher
|
|
122
|
+
* after the seller's 200; close failures throw `ZeroSessionCloseFailedError`
|
|
123
|
+
* carrying the orphaned channel for out-of-band reconciliation.
|
|
124
|
+
*/
|
|
125
|
+
payMpp: (input: PayInput) => Promise<PayResult>;
|
|
126
|
+
private buildOrphanError;
|
|
127
|
+
private prepareTempoFunds;
|
|
128
|
+
private bridgeBaseToTempo;
|
|
129
|
+
private ensureRelayClient;
|
|
130
|
+
private readUsdcBalance;
|
|
131
|
+
private tempoChainLabel;
|
|
132
|
+
private completeMppSession;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
type FetchOptions = {
|
|
136
|
+
method?: string;
|
|
137
|
+
headers?: Record<string, string>;
|
|
138
|
+
body?: string | Uint8Array;
|
|
139
|
+
maxPay?: string;
|
|
140
|
+
capabilityId?: string;
|
|
141
|
+
searchId?: string;
|
|
142
|
+
account?: LocalAccount;
|
|
143
|
+
signal?: AbortSignal;
|
|
144
|
+
timeoutMs?: number;
|
|
145
|
+
requestSchema?: Record<string, unknown>;
|
|
146
|
+
maxResponseBytes?: number;
|
|
147
|
+
displayCostAmount?: string;
|
|
148
|
+
deriveRunMetadata?: (response: {
|
|
149
|
+
status: number;
|
|
150
|
+
ok: boolean;
|
|
151
|
+
bodyRaw: string | null;
|
|
152
|
+
bodyEncoding?: "base64";
|
|
153
|
+
}) => {
|
|
154
|
+
responseSchema?: Record<string, unknown>;
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
type FetchOutcome = "success" | "payment_failed" | "payment_rejected" | "payment_close_failed" | "server_error" | "network_error";
|
|
158
|
+
type UpstreamError = {
|
|
159
|
+
status: number;
|
|
160
|
+
message?: string;
|
|
161
|
+
snippetHash: string;
|
|
162
|
+
snippetLength: number;
|
|
163
|
+
};
|
|
164
|
+
type FetchResult = {
|
|
165
|
+
runId: string | null;
|
|
166
|
+
ok: boolean;
|
|
167
|
+
status: number | null;
|
|
168
|
+
latencyMs: number;
|
|
169
|
+
payment: PaymentResult | null;
|
|
170
|
+
outcome: FetchOutcome;
|
|
171
|
+
body: unknown;
|
|
172
|
+
bodyRaw: string | null;
|
|
173
|
+
bodyEncoding?: "base64";
|
|
174
|
+
error?: string;
|
|
175
|
+
upstreamError?: UpstreamError;
|
|
176
|
+
runTrackingSkipped?: string[];
|
|
177
|
+
warnings?: string[];
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
declare const userWalletDtoSchema: z.ZodObject<{
|
|
181
|
+
walletAddress: z.ZodString;
|
|
182
|
+
source: z.ZodEnum<{
|
|
183
|
+
self_custody: "self_custody";
|
|
184
|
+
privy_embedded: "privy_embedded";
|
|
185
|
+
}>;
|
|
186
|
+
isPrimary: z.ZodBoolean;
|
|
187
|
+
linkedAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodDate]>>>;
|
|
188
|
+
delegationGranted: z.ZodBoolean;
|
|
189
|
+
signerQuorumId: z.ZodNullable<z.ZodString>;
|
|
190
|
+
maxTransactionUsdcBaseUnits: z.ZodNullable<z.ZodNumber>;
|
|
191
|
+
}, z.core.$strip>;
|
|
192
|
+
declare const welcomeBonusSummarySchema: z.ZodObject<{
|
|
193
|
+
status: z.ZodString;
|
|
194
|
+
amountUsd: z.ZodNumber;
|
|
195
|
+
}, z.core.$strip>;
|
|
196
|
+
declare const internalUserDtoSchema: z.ZodObject<{
|
|
197
|
+
id: z.ZodString;
|
|
198
|
+
email: z.ZodNullable<z.ZodString>;
|
|
199
|
+
createdAt: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodDate]>>;
|
|
200
|
+
lastLoginAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodDate]>>>;
|
|
201
|
+
onboardingCompleted: z.ZodOptional<z.ZodBoolean>;
|
|
202
|
+
delegationGranted: z.ZodOptional<z.ZodBoolean>;
|
|
203
|
+
wallets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
204
|
+
walletAddress: z.ZodString;
|
|
205
|
+
source: z.ZodEnum<{
|
|
206
|
+
self_custody: "self_custody";
|
|
207
|
+
privy_embedded: "privy_embedded";
|
|
208
|
+
}>;
|
|
209
|
+
isPrimary: z.ZodBoolean;
|
|
210
|
+
linkedAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodDate]>>>;
|
|
211
|
+
delegationGranted: z.ZodBoolean;
|
|
212
|
+
signerQuorumId: z.ZodNullable<z.ZodString>;
|
|
213
|
+
maxTransactionUsdcBaseUnits: z.ZodNullable<z.ZodNumber>;
|
|
214
|
+
}, z.core.$strip>>>;
|
|
215
|
+
balance: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
216
|
+
amount: z.ZodString;
|
|
217
|
+
asset: z.ZodString;
|
|
218
|
+
}, z.core.$strip>>>;
|
|
219
|
+
welcomeBonus: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
220
|
+
status: z.ZodString;
|
|
221
|
+
amountUsd: z.ZodNumber;
|
|
222
|
+
}, z.core.$strip>>>;
|
|
223
|
+
}, z.core.$strip>;
|
|
224
|
+
declare const publicUserDtoSchema: z.ZodObject<{
|
|
225
|
+
user: z.ZodObject<{
|
|
226
|
+
id: z.ZodString;
|
|
227
|
+
email: z.ZodNullable<z.ZodString>;
|
|
228
|
+
}, z.core.$strip>;
|
|
229
|
+
walletAddress: z.ZodNullable<z.ZodString>;
|
|
230
|
+
balance: z.ZodNullable<z.ZodObject<{
|
|
231
|
+
amount: z.ZodString;
|
|
232
|
+
asset: z.ZodString;
|
|
233
|
+
}, z.core.$strip>>;
|
|
234
|
+
welcomeBonus: z.ZodNullable<z.ZodObject<{
|
|
235
|
+
status: z.ZodString;
|
|
236
|
+
amountUsd: z.ZodNumber;
|
|
237
|
+
}, z.core.$strip>>;
|
|
238
|
+
}, z.core.$strip>;
|
|
239
|
+
type InternalUserDto = z.infer<typeof internalUserDtoSchema>;
|
|
240
|
+
type PublicUserDto = z.infer<typeof publicUserDtoSchema>;
|
|
241
|
+
type UserWalletDto = z.infer<typeof userWalletDtoSchema>;
|
|
242
|
+
type WelcomeBonusSummary = z.infer<typeof welcomeBonusSummarySchema>;
|
|
243
|
+
|
|
244
|
+
declare const deviceStartResponseSchema: z.ZodObject<{
|
|
245
|
+
deviceCode: z.ZodString;
|
|
246
|
+
userCode: z.ZodString;
|
|
247
|
+
verificationUri: z.ZodString;
|
|
248
|
+
pollInterval: z.ZodNumber;
|
|
249
|
+
expiresAt: z.ZodNumber;
|
|
250
|
+
}, z.core.$strip>;
|
|
251
|
+
type DeviceStartResponse = z.infer<typeof deviceStartResponseSchema>;
|
|
252
|
+
type DevicePollResult = {
|
|
253
|
+
status: "pending";
|
|
254
|
+
} | {
|
|
255
|
+
status: "expired";
|
|
256
|
+
} | {
|
|
257
|
+
status: "ok";
|
|
258
|
+
accessToken: string;
|
|
259
|
+
refreshToken: string;
|
|
260
|
+
expiresIn: number;
|
|
261
|
+
user: z.infer<typeof internalUserDtoSchema>;
|
|
262
|
+
};
|
|
263
|
+
declare const sessionExchangeResponseSchema: z.ZodObject<{
|
|
264
|
+
token: z.ZodString;
|
|
265
|
+
expiresAt: z.ZodNumber;
|
|
266
|
+
}, z.core.$strip>;
|
|
267
|
+
type SessionExchangeResponse = z.infer<typeof sessionExchangeResponseSchema>;
|
|
268
|
+
|
|
269
|
+
declare class AuthDevice {
|
|
270
|
+
private readonly client;
|
|
271
|
+
constructor(client: ZeroClient);
|
|
272
|
+
start: (opts?: {
|
|
273
|
+
signal?: AbortSignal;
|
|
274
|
+
}) => Promise<DeviceStartResponse>;
|
|
275
|
+
poll: (deviceCode: string, opts?: {
|
|
276
|
+
signal?: AbortSignal;
|
|
277
|
+
}) => Promise<DevicePollResult>;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
type SignMessageInput = {
|
|
281
|
+
message: SignableMessage;
|
|
282
|
+
};
|
|
283
|
+
type SignTypedDataInput = TypedDataDefinition;
|
|
284
|
+
type SignTransactionInput = {
|
|
285
|
+
unsignedTransaction: Hex;
|
|
286
|
+
};
|
|
287
|
+
type SignOptions = {
|
|
288
|
+
expectedAddress?: string;
|
|
289
|
+
};
|
|
290
|
+
declare class Auth {
|
|
291
|
+
private readonly client;
|
|
292
|
+
readonly device: AuthDevice;
|
|
293
|
+
constructor(client: ZeroClient);
|
|
294
|
+
me: (opts?: {
|
|
295
|
+
signal?: AbortSignal;
|
|
296
|
+
}) => Promise<InternalUserDto>;
|
|
297
|
+
profile: (opts?: {
|
|
298
|
+
signal?: AbortSignal;
|
|
299
|
+
}) => Promise<PublicUserDto>;
|
|
300
|
+
wallets: (opts?: {
|
|
301
|
+
signal?: AbortSignal;
|
|
302
|
+
}) => Promise<UserWalletDto[]>;
|
|
303
|
+
exchangeSessionCode: (code: string, opts?: {
|
|
304
|
+
signal?: AbortSignal;
|
|
305
|
+
}) => Promise<SessionExchangeResponse>;
|
|
306
|
+
logout: (refreshToken: string, opts?: {
|
|
307
|
+
signal?: AbortSignal;
|
|
308
|
+
}) => Promise<void>;
|
|
309
|
+
refresh: () => Promise<void>;
|
|
310
|
+
signMessage: (input: SignMessageInput, opts?: SignOptions) => Promise<Hex>;
|
|
311
|
+
signTransaction: (input: SignTransactionInput, opts?: SignOptions) => Promise<Hex>;
|
|
312
|
+
signTypedData: (input: SignTypedDataInput, opts?: SignOptions) => Promise<Hex>;
|
|
313
|
+
private assertSignerMatches;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
declare const BUG_REPORT_CATEGORIES: readonly ["search_relevance", "ranking_issue", "missing_capability", "wrong_schema", "misleading_description", "broken_execution", "payment_failure", "billing_anomaly", "cli_bug", "security", "other"];
|
|
317
|
+
type BugReportCategory = (typeof BUG_REPORT_CATEGORIES)[number];
|
|
318
|
+
declare const createBugReportResponseSchema: z.ZodObject<{
|
|
319
|
+
bugReportId: z.ZodString;
|
|
320
|
+
status: z.ZodString;
|
|
321
|
+
deduped: z.ZodBoolean;
|
|
322
|
+
category: z.ZodNullable<z.ZodEnum<{
|
|
323
|
+
search_relevance: "search_relevance";
|
|
324
|
+
ranking_issue: "ranking_issue";
|
|
325
|
+
missing_capability: "missing_capability";
|
|
326
|
+
wrong_schema: "wrong_schema";
|
|
327
|
+
misleading_description: "misleading_description";
|
|
328
|
+
broken_execution: "broken_execution";
|
|
329
|
+
payment_failure: "payment_failure";
|
|
330
|
+
billing_anomaly: "billing_anomaly";
|
|
331
|
+
cli_bug: "cli_bug";
|
|
332
|
+
security: "security";
|
|
333
|
+
other: "other";
|
|
334
|
+
}>>;
|
|
335
|
+
title: z.ZodNullable<z.ZodString>;
|
|
336
|
+
attached: z.ZodObject<{
|
|
337
|
+
capabilityId: z.ZodNullable<z.ZodNumber>;
|
|
338
|
+
runId: z.ZodNullable<z.ZodNumber>;
|
|
339
|
+
searchId: z.ZodNullable<z.ZodNumber>;
|
|
340
|
+
}, z.core.$strip>;
|
|
341
|
+
}, z.core.$strip>;
|
|
342
|
+
type CreateBugReportInput = {
|
|
343
|
+
description: string;
|
|
344
|
+
category?: BugReportCategory;
|
|
345
|
+
title?: string;
|
|
346
|
+
severity?: number;
|
|
347
|
+
reproduction?: string;
|
|
348
|
+
capabilityId?: string;
|
|
349
|
+
runId?: string;
|
|
350
|
+
searchId?: string;
|
|
351
|
+
cliContext?: Record<string, unknown>;
|
|
352
|
+
idempotencyKey?: string;
|
|
353
|
+
};
|
|
354
|
+
type CreateBugReportResponse = z.infer<typeof createBugReportResponseSchema>;
|
|
355
|
+
|
|
356
|
+
declare class BugReports {
|
|
357
|
+
private readonly client;
|
|
358
|
+
constructor(client: ZeroClient);
|
|
359
|
+
create: (input: CreateBugReportInput, opts?: {
|
|
360
|
+
signal?: AbortSignal;
|
|
361
|
+
}) => Promise<CreateBugReportResponse>;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
declare const capabilityResponseSchema: z.ZodObject<{
|
|
365
|
+
uid: z.ZodString;
|
|
366
|
+
slug: z.ZodString;
|
|
367
|
+
name: z.ZodString;
|
|
368
|
+
description: z.ZodString;
|
|
369
|
+
url: z.ZodString;
|
|
370
|
+
urlTemplate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
371
|
+
method: z.ZodString;
|
|
372
|
+
headers: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
373
|
+
bodySchema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
374
|
+
responseSchema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
375
|
+
example: z.ZodNullable<z.ZodObject<{
|
|
376
|
+
request: z.ZodUnknown;
|
|
377
|
+
response: z.ZodUnknown;
|
|
378
|
+
}, z.core.$strip>>;
|
|
379
|
+
tags: z.ZodNullable<z.ZodArray<z.ZodString>>;
|
|
380
|
+
exampleAgentPrompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
381
|
+
displayCostAmount: z.ZodString;
|
|
382
|
+
displayCostAsset: z.ZodString;
|
|
383
|
+
reviewCount: z.ZodNumber;
|
|
384
|
+
rating: z.ZodObject<{
|
|
385
|
+
score: z.ZodString;
|
|
386
|
+
successRate: z.ZodString;
|
|
387
|
+
reviews: z.ZodNumber;
|
|
388
|
+
stars: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
389
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
390
|
+
unrated: "unrated";
|
|
391
|
+
rated: "rated";
|
|
392
|
+
}>>;
|
|
393
|
+
}, z.core.$strip>;
|
|
394
|
+
priceObserved: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
395
|
+
minCents: z.ZodNullable<z.ZodString>;
|
|
396
|
+
medianCents: z.ZodNullable<z.ZodString>;
|
|
397
|
+
maxCents: z.ZodNullable<z.ZodString>;
|
|
398
|
+
p95Cents: z.ZodNullable<z.ZodString>;
|
|
399
|
+
sampleCount: z.ZodNumber;
|
|
400
|
+
varies: z.ZodBoolean;
|
|
401
|
+
failureChargeRate: z.ZodNullable<z.ZodNumber>;
|
|
402
|
+
}, z.core.$strip>>>;
|
|
403
|
+
paymentMethods: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
404
|
+
uid: z.ZodString;
|
|
405
|
+
protocol: z.ZodString;
|
|
406
|
+
methodType: z.ZodString;
|
|
407
|
+
chain: z.ZodNullable<z.ZodString>;
|
|
408
|
+
mode: z.ZodString;
|
|
409
|
+
costAmount: z.ZodString;
|
|
410
|
+
costPer: z.ZodString;
|
|
411
|
+
priority: z.ZodNumber;
|
|
412
|
+
}, z.core.$strip>>>;
|
|
413
|
+
availabilityStatus: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
414
|
+
unknown: "unknown";
|
|
415
|
+
healthy: "healthy";
|
|
416
|
+
down: "down";
|
|
417
|
+
}>>>;
|
|
418
|
+
displayStatus: z.ZodOptional<z.ZodEnum<{
|
|
419
|
+
unknown: "unknown";
|
|
420
|
+
healthy: "healthy";
|
|
421
|
+
stable: "stable";
|
|
422
|
+
degraded: "degraded";
|
|
423
|
+
unhealthy: "unhealthy";
|
|
424
|
+
}>>;
|
|
425
|
+
activationCount: z.ZodOptional<z.ZodNumber>;
|
|
426
|
+
lastUsedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
427
|
+
lastSuccessfullyRanAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
428
|
+
}, z.core.$strip>;
|
|
429
|
+
type CapabilityResponse = z.infer<typeof capabilityResponseSchema>;
|
|
430
|
+
type GetCapabilityOptions = {
|
|
431
|
+
searchId?: string;
|
|
432
|
+
signal?: AbortSignal;
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
declare class Capabilities {
|
|
436
|
+
private readonly client;
|
|
437
|
+
constructor(client: ZeroClient);
|
|
438
|
+
get: (id: string, opts?: GetCapabilityOptions) => Promise<CapabilityResponse>;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
declare const createRunResponseSchema: z.ZodObject<{
|
|
442
|
+
runId: z.ZodString;
|
|
443
|
+
}, z.core.$strip>;
|
|
444
|
+
declare const runListItemSchema: z.ZodObject<{
|
|
445
|
+
uid: z.ZodString;
|
|
446
|
+
capabilityUid: z.ZodString;
|
|
447
|
+
capabilitySlug: z.ZodString;
|
|
448
|
+
capabilityName: z.ZodString;
|
|
449
|
+
status: z.ZodNullable<z.ZodNumber>;
|
|
450
|
+
latencyMs: z.ZodNullable<z.ZodNumber>;
|
|
451
|
+
cost: z.ZodNullable<z.ZodObject<{
|
|
452
|
+
amount: z.ZodString;
|
|
453
|
+
asset: z.ZodNullable<z.ZodString>;
|
|
454
|
+
}, z.core.$strip>>;
|
|
455
|
+
payment: z.ZodNullable<z.ZodObject<{
|
|
456
|
+
protocol: z.ZodString;
|
|
457
|
+
chain: z.ZodNullable<z.ZodString>;
|
|
458
|
+
txHash: z.ZodNullable<z.ZodString>;
|
|
459
|
+
mode: z.ZodNullable<z.ZodString>;
|
|
460
|
+
}, z.core.$strip>>;
|
|
461
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
462
|
+
reviewed: z.ZodBoolean;
|
|
463
|
+
}, z.core.$strip>;
|
|
464
|
+
declare const listRunsResponseSchema: z.ZodObject<{
|
|
465
|
+
runs: z.ZodArray<z.ZodObject<{
|
|
466
|
+
uid: z.ZodString;
|
|
467
|
+
capabilityUid: z.ZodString;
|
|
468
|
+
capabilitySlug: z.ZodString;
|
|
469
|
+
capabilityName: z.ZodString;
|
|
470
|
+
status: z.ZodNullable<z.ZodNumber>;
|
|
471
|
+
latencyMs: z.ZodNullable<z.ZodNumber>;
|
|
472
|
+
cost: z.ZodNullable<z.ZodObject<{
|
|
473
|
+
amount: z.ZodString;
|
|
474
|
+
asset: z.ZodNullable<z.ZodString>;
|
|
475
|
+
}, z.core.$strip>>;
|
|
476
|
+
payment: z.ZodNullable<z.ZodObject<{
|
|
477
|
+
protocol: z.ZodString;
|
|
478
|
+
chain: z.ZodNullable<z.ZodString>;
|
|
479
|
+
txHash: z.ZodNullable<z.ZodString>;
|
|
480
|
+
mode: z.ZodNullable<z.ZodString>;
|
|
481
|
+
}, z.core.$strip>>;
|
|
482
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
483
|
+
reviewed: z.ZodBoolean;
|
|
484
|
+
}, z.core.$strip>>;
|
|
485
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
486
|
+
}, z.core.$strip>;
|
|
487
|
+
declare const createReviewResponseSchema: z.ZodObject<{
|
|
488
|
+
reviewId: z.ZodString;
|
|
489
|
+
recorded: z.ZodBoolean;
|
|
490
|
+
updated: z.ZodOptional<z.ZodBoolean>;
|
|
491
|
+
}, z.core.$strip>;
|
|
492
|
+
declare const batchReviewResponseSchema: z.ZodObject<{
|
|
493
|
+
results: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
494
|
+
runId: z.ZodString;
|
|
495
|
+
ok: z.ZodLiteral<true>;
|
|
496
|
+
reviewId: z.ZodString;
|
|
497
|
+
updated: z.ZodBoolean;
|
|
498
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
499
|
+
runId: z.ZodString;
|
|
500
|
+
ok: z.ZodLiteral<false>;
|
|
501
|
+
status: z.ZodNumber;
|
|
502
|
+
error: z.ZodString;
|
|
503
|
+
}, z.core.$strip>]>>;
|
|
504
|
+
summary: z.ZodObject<{
|
|
505
|
+
total: z.ZodNumber;
|
|
506
|
+
ok: z.ZodNumber;
|
|
507
|
+
failed: z.ZodNumber;
|
|
508
|
+
}, z.core.$strip>;
|
|
509
|
+
}, z.core.$strip>;
|
|
510
|
+
type RunListItem = z.infer<typeof runListItemSchema>;
|
|
511
|
+
type ListRunsResponse = z.infer<typeof listRunsResponseSchema>;
|
|
512
|
+
type CreateRunResponse = z.infer<typeof createRunResponseSchema>;
|
|
513
|
+
type CreateReviewResponse = z.infer<typeof createReviewResponseSchema>;
|
|
514
|
+
type BatchReviewResponse = z.infer<typeof batchReviewResponseSchema>;
|
|
515
|
+
type CreateRunInput = {
|
|
516
|
+
capabilityId: string;
|
|
517
|
+
paymentMethodId?: string;
|
|
518
|
+
searchId?: string;
|
|
519
|
+
status?: number;
|
|
520
|
+
latencyMs?: number;
|
|
521
|
+
costAmount?: string;
|
|
522
|
+
costAsset?: string;
|
|
523
|
+
paymentProtocol?: string;
|
|
524
|
+
paymentChain?: string;
|
|
525
|
+
paymentTxHash?: string;
|
|
526
|
+
paymentMode?: string;
|
|
527
|
+
errorSnippetHash?: string;
|
|
528
|
+
errorSnippetLength?: number;
|
|
529
|
+
requestSchema?: Record<string, unknown>;
|
|
530
|
+
responseSchema?: Record<string, unknown>;
|
|
531
|
+
};
|
|
532
|
+
type CreateReviewInput = {
|
|
533
|
+
runId: string;
|
|
534
|
+
success: boolean;
|
|
535
|
+
accuracy: number;
|
|
536
|
+
value: number;
|
|
537
|
+
reliability: number;
|
|
538
|
+
content?: string;
|
|
539
|
+
};
|
|
540
|
+
type ListRunsParams = {
|
|
541
|
+
capabilityId?: string;
|
|
542
|
+
unreviewed?: boolean;
|
|
543
|
+
limit?: number;
|
|
544
|
+
cursor?: string;
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
declare class Runs {
|
|
548
|
+
private readonly client;
|
|
549
|
+
constructor(client: ZeroClient);
|
|
550
|
+
create: (input: CreateRunInput, opts?: {
|
|
551
|
+
signal?: AbortSignal;
|
|
552
|
+
}) => Promise<CreateRunResponse>;
|
|
553
|
+
list: (params?: ListRunsParams, opts?: {
|
|
554
|
+
signal?: AbortSignal;
|
|
555
|
+
}) => Promise<ListRunsResponse>;
|
|
556
|
+
review: (input: CreateReviewInput, opts?: {
|
|
557
|
+
signal?: AbortSignal;
|
|
558
|
+
}) => Promise<CreateReviewResponse>;
|
|
559
|
+
createReviewsBatch: (reviews: CreateReviewInput[], opts?: {
|
|
560
|
+
signal?: AbortSignal;
|
|
561
|
+
}) => Promise<BatchReviewResponse>;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
type BalanceChainId = "base" | "tempo";
|
|
565
|
+
|
|
566
|
+
declare const migrateAuthorizationResponseSchema: z.ZodObject<{
|
|
567
|
+
transactionHash: z.ZodString;
|
|
568
|
+
}, z.core.$strip>;
|
|
569
|
+
type MigrateAuthorization = {
|
|
570
|
+
from: string;
|
|
571
|
+
to: string;
|
|
572
|
+
value: string;
|
|
573
|
+
validAfter: string;
|
|
574
|
+
validBefore: string;
|
|
575
|
+
nonce: string;
|
|
576
|
+
signature: string;
|
|
577
|
+
};
|
|
578
|
+
type MigrateAuthorizationResponse = z.infer<typeof migrateAuthorizationResponseSchema>;
|
|
579
|
+
type BalanceReadError = {
|
|
580
|
+
chain: BalanceChainId;
|
|
581
|
+
message: string;
|
|
582
|
+
};
|
|
583
|
+
type WalletBalance = {
|
|
584
|
+
amount: string;
|
|
585
|
+
asset: "USDC";
|
|
586
|
+
errors?: BalanceReadError[];
|
|
587
|
+
};
|
|
588
|
+
type BalanceOptions = {
|
|
589
|
+
chain?: BalanceChainId | "total";
|
|
590
|
+
address?: `0x${string}`;
|
|
591
|
+
signal?: AbortSignal;
|
|
592
|
+
};
|
|
593
|
+
type FundingUrlOptions = {
|
|
594
|
+
amount?: string;
|
|
595
|
+
provider?: "stripe" | "coinbase";
|
|
596
|
+
signal?: AbortSignal;
|
|
597
|
+
};
|
|
598
|
+
declare class Wallet {
|
|
599
|
+
private readonly client;
|
|
600
|
+
private readonly clients;
|
|
601
|
+
constructor(client: ZeroClient);
|
|
602
|
+
get address(): `0x${string}` | null;
|
|
603
|
+
balance: (opts?: BalanceOptions) => Promise<WalletBalance>;
|
|
604
|
+
list: (opts?: {
|
|
605
|
+
signal?: AbortSignal;
|
|
606
|
+
}) => Promise<UserWalletDto[]>;
|
|
607
|
+
provision: (opts?: {
|
|
608
|
+
signal?: AbortSignal;
|
|
609
|
+
}) => Promise<UserWalletDto>;
|
|
610
|
+
migrateAuthorization: (authorization: MigrateAuthorization, opts?: {
|
|
611
|
+
signal?: AbortSignal;
|
|
612
|
+
}) => Promise<MigrateAuthorizationResponse>;
|
|
613
|
+
fundingUrl: (opts?: FundingUrlOptions) => Promise<string>;
|
|
614
|
+
private getPublicClient;
|
|
615
|
+
/**
|
|
616
|
+
* @internal
|
|
617
|
+
*
|
|
618
|
+
* Per-chain USDC balance read. Exposed (rather than private) so unit
|
|
619
|
+
* tests can stub it without standing up a real viem public client —
|
|
620
|
+
* viem's `http()` transport doesn't go through `client.fetchImpl`, so
|
|
621
|
+
* the standard mock-fetch trick doesn't cover this path.
|
|
622
|
+
*/
|
|
623
|
+
readChainBalance: (chain: BalanceChainId, address: `0x${string}`) => Promise<bigint>;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
type ZeroClientLike = any;
|
|
627
|
+
type LogLevel = "debug" | "info" | "warn" | "error";
|
|
628
|
+
type LogEvent = {
|
|
629
|
+
level: LogLevel;
|
|
630
|
+
message: string;
|
|
631
|
+
meta?: Record<string, unknown>;
|
|
632
|
+
};
|
|
633
|
+
type Logger = (event: LogEvent) => void;
|
|
634
|
+
type RefreshSessionFn = (signal?: AbortSignal) => Promise<{
|
|
635
|
+
accessToken: string;
|
|
636
|
+
refreshToken: string;
|
|
637
|
+
} | null>;
|
|
638
|
+
type ClientOptions = {
|
|
639
|
+
session?: SessionCredentialsInput;
|
|
640
|
+
account?: LocalAccount;
|
|
641
|
+
refresh?: RefreshSessionFn;
|
|
642
|
+
baseUrl?: string;
|
|
643
|
+
timeout?: number;
|
|
644
|
+
maxRetries?: number;
|
|
645
|
+
fetch?: typeof fetch;
|
|
646
|
+
fetchOptions?: Omit<RequestInit, "method" | "body" | "headers">;
|
|
647
|
+
defaultHeaders?: Record<string, string>;
|
|
648
|
+
apiVersion?: string;
|
|
649
|
+
logger?: Logger;
|
|
650
|
+
/**
|
|
651
|
+
* @internal
|
|
652
|
+
*
|
|
653
|
+
* Wiring slot used by `withAccount` to share the parent client's
|
|
654
|
+
* account cache. Never set from public construction.
|
|
655
|
+
*/
|
|
656
|
+
_sharedAccountCache?: Map<string, ZeroClientLike>;
|
|
657
|
+
};
|
|
658
|
+
declare const DEFAULT_BASE_URL = "https://api.zero.xyz";
|
|
659
|
+
declare const DEFAULT_TIMEOUT_MS = 60000;
|
|
660
|
+
declare const DEFAULT_MAX_RETRIES = 2;
|
|
661
|
+
|
|
662
|
+
declare const searchResultSchema: z.ZodObject<{
|
|
663
|
+
id: z.ZodString;
|
|
664
|
+
position: z.ZodNumber;
|
|
665
|
+
slug: z.ZodString;
|
|
666
|
+
name: z.ZodString;
|
|
667
|
+
canonicalName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
668
|
+
description: z.ZodString;
|
|
669
|
+
whatItDoes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
670
|
+
url: z.ZodString;
|
|
671
|
+
urlTemplate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
672
|
+
cost: z.ZodObject<{
|
|
673
|
+
amount: z.ZodString;
|
|
674
|
+
asset: z.ZodString;
|
|
675
|
+
}, z.core.$strip>;
|
|
676
|
+
reviewCount: z.ZodOptional<z.ZodNumber>;
|
|
677
|
+
rating: z.ZodObject<{
|
|
678
|
+
score: z.ZodString;
|
|
679
|
+
successRate: z.ZodString;
|
|
680
|
+
reviews: z.ZodNumber;
|
|
681
|
+
stars: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
682
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
683
|
+
unrated: "unrated";
|
|
684
|
+
rated: "rated";
|
|
685
|
+
}>>;
|
|
686
|
+
}, z.core.$strip>;
|
|
687
|
+
availabilityStatus: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
688
|
+
unknown: "unknown";
|
|
689
|
+
healthy: "healthy";
|
|
690
|
+
down: "down";
|
|
691
|
+
}>>>;
|
|
692
|
+
displayStatus: z.ZodOptional<z.ZodEnum<{
|
|
693
|
+
unknown: "unknown";
|
|
694
|
+
healthy: "healthy";
|
|
695
|
+
stable: "stable";
|
|
696
|
+
degraded: "degraded";
|
|
697
|
+
unhealthy: "unhealthy";
|
|
698
|
+
}>>;
|
|
699
|
+
}, z.core.$strip>;
|
|
700
|
+
declare const searchResponseSchema: z.ZodObject<{
|
|
701
|
+
searchId: z.ZodString;
|
|
702
|
+
total: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
703
|
+
offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
704
|
+
hasMore: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
705
|
+
capabilities: z.ZodArray<z.ZodObject<{
|
|
706
|
+
id: z.ZodString;
|
|
707
|
+
position: z.ZodNumber;
|
|
708
|
+
slug: z.ZodString;
|
|
709
|
+
name: z.ZodString;
|
|
710
|
+
canonicalName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
711
|
+
description: z.ZodString;
|
|
712
|
+
whatItDoes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
713
|
+
url: z.ZodString;
|
|
714
|
+
urlTemplate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
715
|
+
cost: z.ZodObject<{
|
|
716
|
+
amount: z.ZodString;
|
|
717
|
+
asset: z.ZodString;
|
|
718
|
+
}, z.core.$strip>;
|
|
719
|
+
reviewCount: z.ZodOptional<z.ZodNumber>;
|
|
720
|
+
rating: z.ZodObject<{
|
|
721
|
+
score: z.ZodString;
|
|
722
|
+
successRate: z.ZodString;
|
|
723
|
+
reviews: z.ZodNumber;
|
|
724
|
+
stars: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
725
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
726
|
+
unrated: "unrated";
|
|
727
|
+
rated: "rated";
|
|
728
|
+
}>>;
|
|
729
|
+
}, z.core.$strip>;
|
|
730
|
+
availabilityStatus: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
731
|
+
unknown: "unknown";
|
|
732
|
+
healthy: "healthy";
|
|
733
|
+
down: "down";
|
|
734
|
+
}>>>;
|
|
735
|
+
displayStatus: z.ZodOptional<z.ZodEnum<{
|
|
736
|
+
unknown: "unknown";
|
|
737
|
+
healthy: "healthy";
|
|
738
|
+
stable: "stable";
|
|
739
|
+
degraded: "degraded";
|
|
740
|
+
unhealthy: "unhealthy";
|
|
741
|
+
}>>;
|
|
742
|
+
}, z.core.$strip>>;
|
|
743
|
+
}, z.core.$strip>;
|
|
744
|
+
type SearchResult = z.infer<typeof searchResultSchema>;
|
|
745
|
+
type SearchResponse = z.infer<typeof searchResponseSchema>;
|
|
746
|
+
type SearchOptions = {
|
|
747
|
+
offset?: number;
|
|
748
|
+
limit?: number;
|
|
749
|
+
maxCost?: string;
|
|
750
|
+
protocol?: "x402" | "mpp";
|
|
751
|
+
freeOnly?: boolean;
|
|
752
|
+
availabilityStatus?: "healthy" | "unknown" | "degraded" | "down";
|
|
753
|
+
includeAll?: boolean;
|
|
754
|
+
source?: string;
|
|
755
|
+
excludeSource?: string;
|
|
756
|
+
signal?: AbortSignal;
|
|
757
|
+
};
|
|
758
|
+
|
|
759
|
+
declare class ZeroClient {
|
|
760
|
+
readonly baseUrl: string;
|
|
761
|
+
readonly timeout: number;
|
|
762
|
+
readonly maxRetries: number;
|
|
763
|
+
readonly apiVersion: string | undefined;
|
|
764
|
+
readonly defaultHeaders: Record<string, string>;
|
|
765
|
+
readonly fetchImpl: typeof fetch;
|
|
766
|
+
readonly fetchOptions: ClientOptions["fetchOptions"];
|
|
767
|
+
readonly logger: Logger | undefined;
|
|
768
|
+
private credentials;
|
|
769
|
+
private refreshInFlight;
|
|
770
|
+
private managedAccount;
|
|
771
|
+
private managedAccountInFlight;
|
|
772
|
+
private managedAccountAC;
|
|
773
|
+
private managedAccountGen;
|
|
774
|
+
private withAccountCache;
|
|
775
|
+
readonly auth: Auth;
|
|
776
|
+
readonly bugReports: BugReports;
|
|
777
|
+
readonly capabilities: Capabilities;
|
|
778
|
+
readonly payments: Payments;
|
|
779
|
+
readonly runs: Runs;
|
|
780
|
+
readonly wallet: Wallet;
|
|
781
|
+
private readonly refreshOverride;
|
|
782
|
+
constructor(options?: ClientOptions);
|
|
783
|
+
static fromPrivateKey: (privateKey: Hex, opts?: Omit<ClientOptions, "session" | "account">) => ZeroClient;
|
|
784
|
+
static fromMnemonic: (mnemonic: string, opts?: Omit<ClientOptions, "session" | "account">) => ZeroClient;
|
|
785
|
+
/**
|
|
786
|
+
* @internal
|
|
787
|
+
*
|
|
788
|
+
* Live credential accessor for transport + auth modules. Returns the
|
|
789
|
+
* discriminated union (not a snapshot) so auth-dispatch always sees the
|
|
790
|
+
* freshest access token after rotation. Exposed publicly only to bridge
|
|
791
|
+
* the SDK's module boundary — consumers should not call this directly,
|
|
792
|
+
* and the shape is not part of the stable surface.
|
|
793
|
+
*/
|
|
794
|
+
getCredentials: () => Credentials;
|
|
795
|
+
/**
|
|
796
|
+
* @internal
|
|
797
|
+
*
|
|
798
|
+
* Single in-flight refresh helper. Concurrent callers share one
|
|
799
|
+
* invocation. Used by the transport's 401 path; consumers should call
|
|
800
|
+
* `client.auth.refresh()` for explicit rotation.
|
|
801
|
+
*
|
|
802
|
+
* Only the FIRST caller's signal participates in the in-flight
|
|
803
|
+
* refresh — combining signals retroactively isn't possible.
|
|
804
|
+
*/
|
|
805
|
+
refreshSessionOnce: (signal?: AbortSignal) => Promise<boolean>;
|
|
806
|
+
private runRefreshOverride;
|
|
807
|
+
applyRefreshedTokens: (next: {
|
|
808
|
+
accessToken: string;
|
|
809
|
+
refreshToken: string;
|
|
810
|
+
}) => Promise<void>;
|
|
811
|
+
setSessionTokens: (tokens: {
|
|
812
|
+
accessToken: string;
|
|
813
|
+
refreshToken: string;
|
|
814
|
+
}) => void;
|
|
815
|
+
withSession: (session: SessionCredentialsInput) => ZeroClient;
|
|
816
|
+
withAccount: (account: LocalAccount) => ZeroClient;
|
|
817
|
+
/**
|
|
818
|
+
* Evict cached `withAccount` sub-clients. Pass an account to drop a
|
|
819
|
+
* single tenant's entry; omit the argument to clear the entire cache.
|
|
820
|
+
* Call on tenant churn (session expiry, deprovisioning) — without
|
|
821
|
+
* eviction the cache grows for the base client's lifetime.
|
|
822
|
+
*/
|
|
823
|
+
clearAccountCache: (account?: LocalAccount) => void;
|
|
824
|
+
/** @internal — used by payments.pay() in session mode. Cached, dedupes concurrent lookups. */
|
|
825
|
+
resolveManagedAccount: (signal?: AbortSignal) => Promise<LocalAccount>;
|
|
826
|
+
private raceWithSignal;
|
|
827
|
+
/** Drop the cached managed-signing account and abort any in-flight /me lookup. */
|
|
828
|
+
clearManagedAccount: () => void;
|
|
829
|
+
/** @internal — Read cached managed account without triggering resolution. */
|
|
830
|
+
peekManagedAccount: () => LocalAccount | null;
|
|
831
|
+
search: (query: string, opts?: SearchOptions) => Promise<SearchResponse>;
|
|
832
|
+
fetch: (url: string, opts?: FetchOptions) => Promise<FetchResult>;
|
|
833
|
+
close: () => Promise<void>;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
export { type BugReportCategory as $, type AccountCredentials as A, BugReports as B, type Credentials as C, Wallet as D, type ClientOptions as E, type FetchOptions as F, DEFAULT_BASE_URL as G, DEFAULT_MAX_RETRIES as H, DEFAULT_TIMEOUT_MS as I, type Logger as J, type LogLevel as K, type LogEvent as L, type MigrateAuthorization as M, type NoCredentials as N, type OnSessionRefreshed as O, type PaymentSessionMeta as P, type InternalUserDto as Q, Runs as R, type SessionCredentials as S, TEMPO_CHAIN_ID as T, type UpstreamError as U, type PublicUserDto as V, type WalletBalance as W, type UserWalletDto as X, type WelcomeBonusSummary as Y, ZeroClient as Z, BUG_REPORT_CATEGORIES as _, type SessionCredentialsInput as a, type CreateBugReportInput as a0, type CreateBugReportResponse as a1, type CapabilityResponse as a2, type GetCapabilityOptions as a3, type DevicePollResult as a4, type DeviceStartResponse as a5, type SessionExchangeResponse as a6, type BatchReviewResponse as a7, type CreateReviewInput as a8, type CreateReviewResponse as a9, type CreateRunInput as aa, type CreateRunResponse as ab, type ListRunsParams as ac, type ListRunsResponse as ad, type RunListItem as ae, type SearchOptions as af, type SearchResponse as ag, type SearchResult as ah, type FetchOutcome as b, type FetchResult as c, type SignMessageInput as d, type SignTransactionInput as e, type SignTypedDataInput as f, Auth as g, AuthDevice as h, Capabilities as i, type PayInput as j, type PaymentChain as k, type PaymentProtocol as l, type PaymentResult as m, type PayResult as n, type SessionReceiptPayload as o, coerceTempoChainId as p, FETCH_SKIP_REASONS as q, FETCH_WARNINGS as r, Payments as s, paymentHasAnchor as t, TEMPO_TESTNET_CHAIN_ID as u, tempoChainLabelFromId as v, type BalanceOptions as w, type BalanceReadError as x, type FundingUrlOptions as y, type MigrateAuthorizationResponse as z };
|