@tetsuo-ai/marketplace-react 0.4.1 → 0.6.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.
Files changed (84) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/README.md +97 -51
  3. package/dist/chunk-7NKRSPPN.js +227 -0
  4. package/dist/chunk-7NKRSPPN.js.map +1 -0
  5. package/dist/{chunk-JVXGNW3Q.js → chunk-CDDHUFMG.js} +6 -5
  6. package/dist/chunk-CDDHUFMG.js.map +1 -0
  7. package/dist/chunk-FIDFPM5A.cjs +40 -0
  8. package/dist/chunk-FIDFPM5A.cjs.map +1 -0
  9. package/dist/chunk-IJKWKY4H.cjs +1370 -0
  10. package/dist/chunk-IJKWKY4H.cjs.map +1 -0
  11. package/dist/chunk-JTSG5FGC.cjs +397 -0
  12. package/dist/chunk-JTSG5FGC.cjs.map +1 -0
  13. package/dist/chunk-ONC6L3IX.cjs +97 -0
  14. package/dist/chunk-ONC6L3IX.cjs.map +1 -0
  15. package/dist/chunk-R76EUYDI.cjs +233 -0
  16. package/dist/chunk-R76EUYDI.cjs.map +1 -0
  17. package/dist/{chunk-XLA7DARS.js → chunk-RG5JZ6JL.js} +159 -36
  18. package/dist/chunk-RG5JZ6JL.js.map +1 -0
  19. package/dist/components/index.cjs +158 -1594
  20. package/dist/components/index.cjs.map +1 -1
  21. package/dist/components/index.d.cts +2 -2
  22. package/dist/components/index.d.ts +2 -2
  23. package/dist/components/index.js +2 -2
  24. package/dist/hooks/index.cjs +656 -509
  25. package/dist/hooks/index.cjs.map +1 -1
  26. package/dist/hooks/index.d.cts +63 -29
  27. package/dist/hooks/index.d.ts +63 -29
  28. package/dist/hooks/index.js +619 -196
  29. package/dist/hooks/index.js.map +1 -1
  30. package/dist/{index-CmVz0OOm.d.ts → index-BAyr1ODZ.d.ts} +28 -3
  31. package/dist/{index-DAZzhuO4.d.cts → index-C20NVU7_.d.cts} +28 -3
  32. package/dist/index.cjs +284 -1833
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.d.cts +7 -8
  35. package/dist/index.d.ts +7 -8
  36. package/dist/index.js +64 -4
  37. package/dist/index.js.map +1 -1
  38. package/dist/signers/index.cjs +22 -161
  39. package/dist/signers/index.cjs.map +1 -1
  40. package/dist/signers/index.d.cts +16 -11
  41. package/dist/signers/index.d.ts +16 -11
  42. package/dist/signers/index.js +1 -1
  43. package/dist/testing/index.d.cts +1 -1
  44. package/dist/testing/index.d.ts +1 -1
  45. package/dist/theme/agenc-tailwind-preset.cjs +134 -108
  46. package/dist/{types-jvISR6bc.d.cts → types-B10rndEI.d.cts} +16 -7
  47. package/dist/{types-jvISR6bc.d.ts → types-B10rndEI.d.ts} +16 -7
  48. package/dist/{useAgentTrackRecord-DPt3SfYz.d.cts → useAgentTrackRecord-Ch7gHTFj.d.cts} +1 -1
  49. package/dist/{useAgentTrackRecord-DPt3SfYz.d.ts → useAgentTrackRecord-Ch7gHTFj.d.ts} +1 -1
  50. package/package.json +7 -4
  51. package/src/components/HireCheckoutModal.tsx +5 -2
  52. package/src/hooks/index.ts +1 -0
  53. package/src/hooks/internal.ts +178 -24
  54. package/src/hooks/useAgentTrackRecord.ts +5 -2
  55. package/src/hooks/useCompletionBond.ts +56 -21
  56. package/src/hooks/useDispute.ts +46 -9
  57. package/src/hooks/useHire.ts +113 -23
  58. package/src/hooks/useHumanlessHireFlow.ts +335 -115
  59. package/src/hooks/useListing.ts +2 -2
  60. package/src/hooks/useListings.ts +2 -2
  61. package/src/hooks/useRateHire.ts +32 -5
  62. package/src/hooks/useReferrerEarnings.ts +4 -1
  63. package/src/hooks/useSubmissionReview.ts +95 -32
  64. package/src/hooks/useTaskActivation.ts +51 -9
  65. package/src/hooks/useTaskGuarantee.ts +4 -1
  66. package/src/hooks/useTaskLifecycle.ts +104 -24
  67. package/src/hooks/useTaskStatus.ts +121 -26
  68. package/src/hooks/useTaskWork.ts +76 -12
  69. package/src/hooks/useWalletSigner.ts +11 -16
  70. package/src/index.ts +3 -0
  71. package/src/provider/AgencProvider.tsx +95 -3
  72. package/src/provider/referrer.ts +1 -1
  73. package/src/signers/README.md +13 -7
  74. package/src/signers/index.ts +6 -1
  75. package/src/signers/strings.ts +13 -1
  76. package/src/signers/types.ts +16 -5
  77. package/src/signers/wallet-account.ts +115 -29
  78. package/src/signers/wallet-adapter.ts +38 -4
  79. package/src/theme/agenc-tailwind-preset.cjs +134 -108
  80. package/src/types.ts +27 -1
  81. package/dist/chunk-JVXGNW3Q.js.map +0 -1
  82. package/dist/chunk-ON6XR4XO.js +0 -128
  83. package/dist/chunk-ON6XR4XO.js.map +0 -1
  84. package/dist/chunk-XLA7DARS.js.map +0 -1
@@ -1,125 +1,20 @@
1
1
  'use strict';
2
2
 
3
+ var chunkONC6L3IX_cjs = require('../chunk-ONC6L3IX.cjs');
4
+ var chunkJTSG5FGC_cjs = require('../chunk-JTSG5FGC.cjs');
5
+ var chunkFIDFPM5A_cjs = require('../chunk-FIDFPM5A.cjs');
3
6
  var reactQuery = require('@tanstack/react-query');
4
7
  var react = require('react');
5
- var kit = require('@solana/kit');
6
8
  var marketplaceSdk = require('@tetsuo-ai/marketplace-sdk');
9
+ var kit = require('@solana/kit');
7
10
 
8
- // src/hooks/useListings.ts
9
-
10
- // src/strings/index.ts
11
- var EN_STRINGS = {
12
- // Provider / context wiring errors (developer-facing, but routed for parity).
13
- "provider.missingContext": "useAgencContext must be used within <AgencProvider>.",
14
- "provider.missingWriteClient": "No write client is configured. Pass config.client, or config.rpcUrl + config.signer, to <AgencProvider> before using a mutating hook.",
15
- "provider.missingSigner": "No signer is configured on <AgencProvider>. Connect a wallet or pass config.signer.",
16
- // Referrer config validation / capability surface.
17
- "referrer.invalidWallet": "Referrer wallet is not a valid base58 Solana address: {wallet}.",
18
- "referrer.invalidFeeBps": "Referrer feeBps must be an integer between {min} and {max} (basis points); got {feeBps}.",
19
- "referrer.notLive": "Referral fee is not active for this hire.",
20
- "referrer.notLiveReason": "No referrer is configured for this provider.",
21
- "referrer.earningsNotLiveReason": "Referral settlement is live, but no earnings endpoint is available on this network (configure indexer.baseUrl).",
22
- "referrer.earningsFetchFailed": "The referrer earnings endpoint could not be read.",
23
- // Read transport.
24
- "transport.noReadSource": "No read source is configured. Pass an indexer baseUrl, an rpc/queryTransport, to <AgencProvider> or createReadTransport().",
25
- // Generic loading / empty / error states (components extend these).
26
- "state.loading": "Loading\u2026",
27
- "state.empty": "Nothing to show yet.",
28
- "state.error": "Something went wrong.",
29
- // Hire flow shells (components fill out the rest).
30
- "hire.cta": "Hire",
31
- "hire.pending": "Confirming\u2026",
32
- "hire.funded": "Escrow funded."
33
- };
34
- function t(id, vars, options) {
35
- const catalog = options?.catalog ?? EN_STRINGS;
36
- const template = catalog[id] ?? id;
37
- return template;
38
- }
39
-
40
- // src/provider/context.ts
41
- var AgencContext = react.createContext(null);
42
- AgencContext.displayName = "AgencContext";
43
- function useAgencContext() {
44
- const ctx = react.useContext(AgencContext);
45
- if (ctx === null) {
46
- throw new Error(t("provider.missingContext"));
47
- }
48
- return ctx;
49
- }
50
-
51
- // src/hooks/internal.ts
52
- var QUERY_KEY_ROOT = "agenc";
53
- var queryKeys = {
54
- /** All listings list queries (with their filter object as the leaf). */
55
- listings: (filter) => [QUERY_KEY_ROOT, "listings", filter ?? null],
56
- /** One listing + its joined provider/track-record/moderation. */
57
- listing: (pda) => [QUERY_KEY_ROOT, "listing", pda],
58
- /** One agent's indexer track record. */
59
- agentTrackRecord: (agentPda) => [QUERY_KEY_ROOT, "agentTrackRecord", agentPda],
60
- /** One task's status (read via transport / svm decode). */
61
- taskStatus: (taskPda) => [QUERY_KEY_ROOT, "taskStatus", taskPda],
62
- /** One task's dispute record. */
63
- dispute: (taskPda) => [QUERY_KEY_ROOT, "dispute", taskPda],
64
- /** One task's completion-bond ("Guaranteed Hire") state. */
65
- taskGuarantee: (taskPda) => [QUERY_KEY_ROOT, "taskGuarantee", taskPda],
66
- /** One referrer wallet's earnings (indexer-gated; see useReferrerEarnings). */
67
- referrerEarnings: (wallet) => [QUERY_KEY_ROOT, "referrerEarnings", wallet]
68
- };
69
- function requireClient(client) {
70
- if (client === null) {
71
- throw new Error(t("provider.missingWriteClient"));
72
- }
73
- return client;
74
- }
75
- function mutationStatusOf(mutation) {
76
- if (mutation.isPending) return "pending";
77
- if (mutation.isError) return "error";
78
- if (mutation.isSuccess) return "success";
79
- return "idle";
80
- }
81
- function pdaKey(pda) {
82
- return String(pda);
83
- }
84
- function resolveReferrerArgs(ctx) {
85
- const capability = ctx.resolveReferrerCapability();
86
- if (!capability.live || !capability.referrer) {
87
- return { referrerArgs: {}, referrerInjected: false };
88
- }
89
- return {
90
- referrerArgs: {
91
- referrer: capability.referrer.wallet,
92
- referrerFeeBps: capability.referrer.feeBps
93
- },
94
- referrerInjected: true
95
- };
96
- }
97
- function signerAddress(signerOrAddress) {
98
- if (typeof signerOrAddress === "string") {
99
- return signerOrAddress;
100
- }
101
- if (typeof signerOrAddress === "object" && signerOrAddress !== null && "address" in signerOrAddress && typeof signerOrAddress.address === "string") {
102
- return signerOrAddress.address;
103
- }
104
- throw new Error("Expected a TransactionSigner or Address with an address field.");
105
- }
106
- function withoutReferrerArgs(input) {
107
- const {
108
- referrer: _referrer,
109
- referrerFeeBps: _referrerFeeBps,
110
- ...rest
111
- } = input;
112
- return rest;
113
- }
114
-
115
- // src/hooks/useListings.ts
116
11
  var DEFAULT_PAGE_SIZE = 12;
117
12
  function useListings(filter, options) {
118
- const { read } = useAgencContext();
13
+ const { read, cacheNamespace } = chunkJTSG5FGC_cjs.useAgencContext();
119
14
  const pageSize = options?.pageSize ?? DEFAULT_PAGE_SIZE;
120
15
  const enabled = options?.enabled ?? true;
121
16
  const query = reactQuery.useQuery({
122
- queryKey: queryKeys.listings(filter),
17
+ queryKey: chunkJTSG5FGC_cjs.queryKeys.listings(filter, cacheNamespace),
123
18
  queryFn: () => read.listActiveListings(filter),
124
19
  enabled
125
20
  });
@@ -147,24 +42,11 @@ function useListings(filter, options) {
147
42
  refetch
148
43
  };
149
44
  }
150
- var ReadTransportUnsupportedError = class extends Error {
151
- /** The unsupported operation name. */
152
- operation;
153
- constructor(operation) {
154
- super(
155
- `Read operation "${operation}" requires the indexer backend; the gPA fallback has no trustless equivalent. Configure an indexer baseUrl on <AgencProvider> to use it.`
156
- );
157
- this.name = "ReadTransportUnsupportedError";
158
- this.operation = operation;
159
- }
160
- };
161
-
162
- // src/hooks/useListing.ts
163
45
  function useListing(pda, options) {
164
- const { read } = useAgencContext();
46
+ const { read, cacheNamespace } = chunkJTSG5FGC_cjs.useAgencContext();
165
47
  const enabled = (options?.enabled ?? true) && Boolean(pda);
166
48
  const query = reactQuery.useQuery({
167
- queryKey: queryKeys.listing(pda ? pdaKey(pda) : ""),
49
+ queryKey: chunkJTSG5FGC_cjs.queryKeys.listing(pda ? chunkJTSG5FGC_cjs.pdaKey(pda) : "", cacheNamespace),
168
50
  enabled,
169
51
  queryFn: async () => {
170
52
  const result = await read.getListing(pda);
@@ -173,7 +55,7 @@ function useListing(pda, options) {
173
55
  try {
174
56
  trackRecord = await read.agentTrackRecord(provider);
175
57
  } catch (err) {
176
- if (!(err instanceof ReadTransportUnsupportedError)) throw err;
58
+ if (!(err instanceof chunkONC6L3IX_cjs.ReadTransportUnsupportedError)) throw err;
177
59
  }
178
60
  return {
179
61
  address: result.address,
@@ -220,10 +102,13 @@ function projectTrackRecord(raw) {
220
102
  };
221
103
  }
222
104
  function useAgentTrackRecord(agentPda, options) {
223
- const { read } = useAgencContext();
105
+ const { read, cacheNamespace } = chunkJTSG5FGC_cjs.useAgencContext();
224
106
  const enabled = (options?.enabled ?? true) && Boolean(agentPda);
225
107
  const query = reactQuery.useQuery({
226
- queryKey: queryKeys.agentTrackRecord(agentPda ? pdaKey(agentPda) : ""),
108
+ queryKey: chunkJTSG5FGC_cjs.queryKeys.agentTrackRecord(
109
+ agentPda ? chunkJTSG5FGC_cjs.pdaKey(agentPda) : "",
110
+ cacheNamespace
111
+ ),
227
112
  enabled,
228
113
  queryFn: async () => {
229
114
  const raw = await read.agentTrackRecord(agentPda);
@@ -247,17 +132,32 @@ var TERMINAL_STATUSES = /* @__PURE__ */ new Set([
247
132
  marketplaceSdk.TaskStatus.Cancelled,
248
133
  marketplaceSdk.TaskStatus.RejectFrozen
249
134
  ]);
135
+ var DEFAULT_MAX_EVENTS = 256;
136
+ var MAX_POLL_INTERVAL_MS = 2147483647;
250
137
  function hasResult(task) {
251
138
  return task !== null && task.result.length > 0 && task.result.some((b) => b !== 0);
252
139
  }
253
140
  function useTaskStatus(taskPda, options) {
254
- useAgencContext();
141
+ const ctx = chunkJTSG5FGC_cjs.useAgencContext();
255
142
  const reader = options?.taskReader;
256
143
  const enabled = (options?.enabled ?? true) && Boolean(taskPda) && Boolean(reader);
257
144
  const pollIntervalMs = options?.pollIntervalMs ?? 2e3;
258
- const [events, setEvents] = react.useState([]);
145
+ const maxEvents = options?.maxEvents ?? DEFAULT_MAX_EVENTS;
146
+ if (!Number.isSafeInteger(pollIntervalMs) || pollIntervalMs < 0 || pollIntervalMs > MAX_POLL_INTERVAL_MS) {
147
+ throw new RangeError(
148
+ `useTaskStatus: pollIntervalMs must be a non-negative integer no greater than ${MAX_POLL_INTERVAL_MS} (got ${pollIntervalMs})`
149
+ );
150
+ }
151
+ if (!Number.isSafeInteger(maxEvents) || maxEvents < 0) {
152
+ throw new RangeError(
153
+ `useTaskStatus: maxEvents must be a non-negative safe integer (got ${maxEvents})`
154
+ );
155
+ }
156
+ const taskIdentity = taskPda ? chunkJTSG5FGC_cjs.pdaKey(taskPda) : "";
157
+ const [eventState, setEventState] = react.useState(() => ({ taskIdentity, events: [] }));
158
+ const events = eventState.taskIdentity === taskIdentity ? eventState.events : [];
259
159
  const query = reactQuery.useQuery({
260
- queryKey: queryKeys.taskStatus(taskPda ? pdaKey(taskPda) : ""),
160
+ queryKey: chunkJTSG5FGC_cjs.queryKeys.taskStatus(taskIdentity, ctx.cacheNamespace),
261
161
  enabled,
262
162
  queryFn: () => reader(taskPda),
263
163
  // Poll until terminal / target reached; then stop (return `false`).
@@ -275,22 +175,52 @@ function useTaskStatus(taskPda, options) {
275
175
  refetchRef.current = query.refetch;
276
176
  const eventsSource = options?.events;
277
177
  react.useEffect(() => {
278
- if (!eventsSource) return;
178
+ setEventState({ taskIdentity, events: [] });
179
+ if (!enabled || !eventsSource || !taskPda) return;
180
+ const controller = new AbortController();
181
+ const aborted = /* @__PURE__ */ Symbol("aborted");
182
+ const abortPromise = new Promise((resolve) => {
183
+ controller.signal.addEventListener("abort", () => resolve(aborted), {
184
+ once: true
185
+ });
186
+ });
187
+ let iterator = null;
279
188
  let cancelled = false;
280
- (async () => {
189
+ let finished = false;
190
+ void (async () => {
281
191
  try {
282
- for await (const ev of eventsSource) {
192
+ const iterable = typeof eventsSource === "function" ? eventsSource({ signal: controller.signal, taskPda }) : eventsSource;
193
+ iterator = iterable[Symbol.asyncIterator]();
194
+ while (!cancelled) {
195
+ const next = await Promise.race([iterator.next(), abortPromise]);
196
+ if (next === aborted) break;
283
197
  if (cancelled) break;
284
- setEvents((prev) => [...prev, ev]);
198
+ if (next.done) {
199
+ finished = true;
200
+ break;
201
+ }
202
+ setEventState((prev) => ({
203
+ taskIdentity,
204
+ events: prev.taskIdentity === taskIdentity ? maxEvents === 0 ? [] : [...prev.events, next.value].slice(-maxEvents) : maxEvents === 0 ? [] : [next.value]
205
+ }));
285
206
  void refetchRef.current();
286
207
  }
287
208
  } catch {
209
+ } finally {
210
+ finished = true;
288
211
  }
289
212
  })();
290
213
  return () => {
291
214
  cancelled = true;
215
+ controller.abort();
216
+ if (!finished && iterator?.return) {
217
+ try {
218
+ void Promise.resolve(iterator.return()).catch(() => void 0);
219
+ } catch {
220
+ }
221
+ }
292
222
  };
293
- }, [eventsSource]);
223
+ }, [enabled, eventsSource, maxEvents, taskIdentity, taskPda]);
294
224
  const task = query.data ?? null;
295
225
  return {
296
226
  task,
@@ -302,168 +232,6 @@ function useTaskStatus(taskPda, options) {
302
232
  refetch: () => void query.refetch()
303
233
  };
304
234
  }
305
- function useTaskGuarantee(taskPda, options) {
306
- const ctx = useAgencContext();
307
- const injected = options?.guaranteeReader;
308
- const rpcUrl = ctx.rpcUrl;
309
- const reader = react.useMemo(() => {
310
- if (injected) return injected;
311
- if (!rpcUrl) return null;
312
- return (pda) => marketplaceSdk.fetchTaskGuarantee(
313
- kit.createSolanaRpc(rpcUrl),
314
- pda
315
- );
316
- }, [injected, rpcUrl]);
317
- const enabled = (options?.enabled ?? true) && Boolean(taskPda) && reader !== null;
318
- const query = reactQuery.useQuery({
319
- queryKey: queryKeys.taskGuarantee(taskPda ? pdaKey(taskPda) : ""),
320
- enabled,
321
- queryFn: () => reader(taskPda)
322
- });
323
- const guarantee = query.data ?? null;
324
- return {
325
- guarantee,
326
- guaranteed: guarantee?.guaranteed ?? false,
327
- isLoading: query.isLoading,
328
- error: query.error ?? null,
329
- refetch: () => void query.refetch()
330
- };
331
- }
332
- function readRpc(input) {
333
- return input.rpc ?? (input.rpcUrl ? kit.createSolanaRpc(input.rpcUrl) : null);
334
- }
335
- async function resolveRosterEntry(rpc, moderator) {
336
- const [moderationConfigPda] = await marketplaceSdk.findModerationConfigPda();
337
- const moderationConfig = await marketplaceSdk.fetchMaybeModerationConfig(
338
- rpc,
339
- moderationConfigPda
340
- );
341
- if (moderationConfig.exists && moderationConfig.data.moderationAuthority === moderator) {
342
- return void 0;
343
- }
344
- const [rosterPda] = await marketplaceSdk.findModerationAttestorPda({ attestor: moderator });
345
- const roster = await marketplaceSdk.fetchMaybeModerationAttestor(rpc, rosterPda);
346
- return roster.exists ? rosterPda : void 0;
347
- }
348
- async function resolveActivationModerationAccounts(input) {
349
- try {
350
- const rpc = readRpc(input);
351
- if (!rpc) return {};
352
- const moderationAttestor = await resolveRosterEntry(rpc, input.moderator);
353
- const attestorPart = moderationAttestor !== void 0 ? { moderationAttestor } : {};
354
- const [v2Pda] = await marketplaceSdk.findTaskModerationPda({
355
- task: input.task,
356
- jobSpecHash: input.jobSpecHash,
357
- moderator: input.moderator
358
- });
359
- const v2 = await marketplaceSdk.fetchMaybeTaskModeration(rpc, v2Pda);
360
- if (v2.exists) return attestorPart;
361
- const [legacyPda] = await marketplaceSdk.facade.findLegacyTaskModerationPda({
362
- task: input.task,
363
- jobSpecHash: input.jobSpecHash
364
- });
365
- const legacy = await marketplaceSdk.fetchMaybeTaskModeration(rpc, legacyPda);
366
- if (legacy.exists && legacy.data.moderator === input.moderator) {
367
- return { ...attestorPart, taskModeration: legacyPda };
368
- }
369
- return attestorPart;
370
- } catch {
371
- return {};
372
- }
373
- }
374
- async function resolveHireListingModerationAccounts(input) {
375
- try {
376
- const rpc = readRpc(input);
377
- if (!rpc) return {};
378
- const moderationAttestor = await resolveRosterEntry(rpc, input.moderator);
379
- const attestorPart = moderationAttestor !== void 0 ? { moderationAttestor } : {};
380
- const [v2Pda] = await marketplaceSdk.findListingModerationPda({
381
- listing: input.listing,
382
- jobSpecHash: input.listingSpecHash,
383
- moderator: input.moderator
384
- });
385
- const v2 = await marketplaceSdk.fetchMaybeListingModeration(rpc, v2Pda);
386
- if (v2.exists) return attestorPart;
387
- const [legacyPda] = await marketplaceSdk.facade.findLegacyListingModerationPda({
388
- listing: input.listing,
389
- jobSpecHash: input.listingSpecHash
390
- });
391
- const legacy = await marketplaceSdk.fetchMaybeListingModeration(rpc, legacyPda);
392
- if (legacy.exists && legacy.data.moderator === input.moderator) {
393
- return { ...attestorPart, listingModeration: legacyPda };
394
- }
395
- return attestorPart;
396
- } catch {
397
- return {};
398
- }
399
- }
400
-
401
- // src/hooks/useHire.ts
402
- function useHire() {
403
- const ctx = useAgencContext();
404
- const mutation = reactQuery.useMutation({
405
- mutationFn: async (input) => {
406
- const client = requireClient(ctx.client);
407
- const { referrerArgs, referrerInjected } = resolveReferrerArgs(ctx);
408
- const hireInput = withoutReferrerArgs(input);
409
- const listingSpecHash = input.listingSpecHash;
410
- let moderationArgs = {};
411
- if (input.moderationAttestor === void 0 && input.moderatorIsAttestor === void 0 && input.listingModeration === void 0 && listingSpecHash !== void 0) {
412
- moderationArgs = await resolveHireListingModerationAccounts({
413
- rpcUrl: ctx.rpcUrl,
414
- listing: input.listing,
415
- listingSpecHash,
416
- moderator: input.moderator
417
- });
418
- }
419
- const creator = input.creator ?? client.signer;
420
- let signature;
421
- if (input.humanless === true) {
422
- const result = await client.hireFromListingHumanless({
423
- ...hireInput,
424
- ...moderationArgs,
425
- creator,
426
- ...referrerArgs
427
- });
428
- signature = result.signature;
429
- } else {
430
- const authority = input.authority ?? client.signer;
431
- const result = await client.hireFromListing({
432
- ...hireInput,
433
- ...moderationArgs,
434
- authority,
435
- creator,
436
- ...referrerArgs
437
- });
438
- signature = result.signature;
439
- }
440
- const [taskPda] = await marketplaceSdk.findTaskPda({
441
- creator: signerAddress(creator),
442
- taskId: input.taskId
443
- });
444
- return { signature, taskPda, referrerInjected };
445
- }
446
- });
447
- const hire = react.useCallback(
448
- (input) => mutation.mutateAsync(input),
449
- [mutation]
450
- );
451
- const status = react.useMemo(() => {
452
- if (mutation.isPending) return "pending";
453
- if (mutation.isError) return "error";
454
- if (mutation.isSuccess) return "success";
455
- return "idle";
456
- }, [mutation.isPending, mutation.isError, mutation.isSuccess]);
457
- return {
458
- hire,
459
- status,
460
- taskPda: mutation.data?.taskPda ?? null,
461
- signature: mutation.data?.signature ?? null,
462
- error: mutation.error ?? null,
463
- isPending: mutation.isPending,
464
- reset: mutation.reset
465
- };
466
- }
467
235
  function statusOf(m) {
468
236
  if (m.isPending) return "pending";
469
237
  if (m.isError) return "error";
@@ -471,63 +239,107 @@ function statusOf(m) {
471
239
  return "idle";
472
240
  }
473
241
  function useSubmissionReview(taskPda) {
474
- const ctx = useAgencContext();
242
+ const ctx = chunkJTSG5FGC_cjs.useAgencContext();
243
+ const lastAction = react.useRef(
244
+ null
245
+ );
475
246
  const acceptMut = reactQuery.useMutation({
476
- mutationFn: async (input) => {
477
- const client = requireClient(ctx.client);
247
+ mutationFn: async ({ client, input }) => {
478
248
  const { signature: signature2 } = await client.acceptTaskResult({
479
249
  ...input,
480
- task: taskPda,
481
- creator: input.creator ?? client.signer
250
+ task: taskPda
482
251
  });
483
252
  return signature2;
484
253
  }
485
254
  });
486
255
  const rejectMut = reactQuery.useMutation({
487
- mutationFn: async (input) => {
488
- const client = requireClient(ctx.client);
256
+ mutationFn: async ({ client, input }) => {
489
257
  const ix = await marketplaceSdk.facade.rejectTaskResult({
490
258
  ...input,
491
- task: taskPda,
492
- creator: input.creator ?? client.signer
259
+ task: taskPda
493
260
  });
494
261
  const { signature: signature2 } = await client.send([ix]);
495
262
  return signature2;
496
263
  }
497
264
  });
498
265
  const requestChangesMut = reactQuery.useMutation({
499
- mutationFn: async (input) => {
500
- const client = requireClient(ctx.client);
266
+ mutationFn: async ({ client, input }) => {
501
267
  const ix = await marketplaceSdk.facade.requestChanges({
502
268
  ...input,
503
- task: taskPda,
504
- creator: input.creator ?? client.signer
269
+ task: taskPda
505
270
  });
506
271
  const { signature: signature2 } = await client.send([ix]);
507
272
  return signature2;
508
273
  }
509
274
  });
510
275
  const accept = react.useCallback(
511
- (input) => acceptMut.mutateAsync(input),
512
- [acceptMut]
276
+ async (input) => {
277
+ const client = chunkJTSG5FGC_cjs.requireClient(ctx.client);
278
+ const detachedInput = chunkJTSG5FGC_cjs.snapshotRecord(input);
279
+ const creator = chunkJTSG5FGC_cjs.stabilizeSelectedTransactionSigner(
280
+ client.signer,
281
+ detachedInput.creator
282
+ );
283
+ const snapshottedInput = chunkJTSG5FGC_cjs.snapshotRecord({
284
+ ...detachedInput,
285
+ creator,
286
+ ...detachedInput.bidSettlement === void 0 ? {} : { bidSettlement: chunkJTSG5FGC_cjs.snapshotRecord(detachedInput.bidSettlement) }
287
+ });
288
+ lastAction.current = "accept";
289
+ return acceptMut.mutateAsync({ client, input: snapshottedInput });
290
+ },
291
+ [acceptMut, ctx.client]
513
292
  );
514
293
  const reject = react.useCallback(
515
- (input) => rejectMut.mutateAsync(input),
516
- [rejectMut]
294
+ async (input) => {
295
+ const client = chunkJTSG5FGC_cjs.requireClient(ctx.client);
296
+ const detachedInput = chunkJTSG5FGC_cjs.snapshotRecord(input);
297
+ const creator = chunkJTSG5FGC_cjs.stabilizeSelectedTransactionSigner(
298
+ client.signer,
299
+ detachedInput.creator
300
+ );
301
+ const snapshottedInput = chunkJTSG5FGC_cjs.snapshotRecord({
302
+ ...detachedInput,
303
+ creator,
304
+ rejectionHash: chunkJTSG5FGC_cjs.snapshotFixedBytes32(
305
+ detachedInput.rejectionHash,
306
+ "useSubmissionReview.reject: rejectionHash"
307
+ )
308
+ });
309
+ lastAction.current = "reject";
310
+ return rejectMut.mutateAsync({ client, input: snapshottedInput });
311
+ },
312
+ [ctx.client, rejectMut]
517
313
  );
518
314
  const requestChanges = react.useCallback(
519
- (input) => requestChangesMut.mutateAsync(input),
520
- [requestChangesMut]
315
+ async (input) => {
316
+ const client = chunkJTSG5FGC_cjs.requireClient(ctx.client);
317
+ const detachedInput = chunkJTSG5FGC_cjs.snapshotRecord(input);
318
+ const creator = chunkJTSG5FGC_cjs.stabilizeSelectedTransactionSigner(
319
+ client.signer,
320
+ detachedInput.creator
321
+ );
322
+ const snapshottedInput = chunkJTSG5FGC_cjs.snapshotRecord({
323
+ ...detachedInput,
324
+ creator,
325
+ changesHash: chunkJTSG5FGC_cjs.snapshotFixedBytes32(
326
+ detachedInput.changesHash,
327
+ "useSubmissionReview.requestChanges: changesHash"
328
+ )
329
+ });
330
+ lastAction.current = "requestChanges";
331
+ return requestChangesMut.mutateAsync({
332
+ client,
333
+ input: snapshottedInput
334
+ });
335
+ },
336
+ [ctx.client, requestChangesMut]
521
337
  );
522
338
  const anyPending = acceptMut.isPending || rejectMut.isPending || requestChangesMut.isPending;
523
- const status = anyPending ? "pending" : statusOf(
524
- // Surface the most recently-touched verb's terminal state.
525
- [acceptMut, rejectMut, requestChangesMut].find(
526
- (m) => m.isError || m.isSuccess
527
- ) ?? acceptMut
528
- );
529
- const error = acceptMut.error ?? rejectMut.error ?? requestChangesMut.error ?? null;
530
- const signature = acceptMut.data ?? rejectMut.data ?? requestChangesMut.data ?? null;
339
+ const latest = lastAction.current === "reject" ? rejectMut : lastAction.current === "requestChanges" ? requestChangesMut : acceptMut;
340
+ const status = anyPending ? "pending" : statusOf(latest);
341
+ const error = latest.error ?? null;
342
+ const signature = latest.data ?? null;
531
343
  return {
532
344
  accept,
533
345
  reject,
@@ -536,6 +348,7 @@ function useSubmissionReview(taskPda) {
536
348
  error,
537
349
  signature,
538
350
  reset: () => {
351
+ lastAction.current = null;
539
352
  acceptMut.reset();
540
353
  rejectMut.reset();
541
354
  requestChangesMut.reset();
@@ -543,33 +356,62 @@ function useSubmissionReview(taskPda) {
543
356
  };
544
357
  }
545
358
  function useTaskActivation(taskPda) {
546
- const ctx = useAgencContext();
359
+ const ctx = chunkJTSG5FGC_cjs.useAgencContext();
547
360
  const mutation = reactQuery.useMutation({
548
- mutationFn: async (input) => {
549
- const client = requireClient(ctx.client);
361
+ mutationFn: async ({
362
+ client,
363
+ input,
364
+ taskPda: snapshottedTaskPda,
365
+ creator,
366
+ orchestrationRpcUrl,
367
+ orchestrationRpc
368
+ }) => {
550
369
  const callerResolved = input.moderationAttestor !== void 0 || input.moderatorIsAttestor !== void 0 || input.taskModeration !== void 0;
551
- const resolved = callerResolved ? {} : await resolveActivationModerationAccounts({
552
- rpcUrl: ctx.rpcUrl,
553
- task: taskPda,
370
+ const resolved = callerResolved ? {} : await chunkJTSG5FGC_cjs.resolveActivationModerationAccounts({
371
+ rpcUrl: orchestrationRpcUrl,
372
+ ...orchestrationRpc === null ? {} : { rpc: orchestrationRpc },
373
+ task: snapshottedTaskPda,
554
374
  jobSpecHash: input.jobSpecHash,
555
375
  moderator: input.moderator
556
376
  });
557
377
  const { signature } = await client.setTaskJobSpec({
558
378
  ...input,
559
379
  ...resolved,
560
- task: taskPda,
561
- creator: input.creator ?? client.signer
380
+ task: snapshottedTaskPda,
381
+ creator
562
382
  });
563
383
  return signature;
564
384
  }
565
385
  });
566
386
  const activate = react.useCallback(
567
- (input) => mutation.mutateAsync(input),
568
- [mutation]
387
+ async (input) => {
388
+ const client = chunkJTSG5FGC_cjs.requireClient(ctx.client);
389
+ const detachedInput = { ...input };
390
+ const snapshottedInput = {
391
+ ...detachedInput,
392
+ jobSpecHash: chunkJTSG5FGC_cjs.snapshotFixedBytes32(
393
+ detachedInput.jobSpecHash,
394
+ "useTaskActivation: jobSpecHash"
395
+ )
396
+ };
397
+ const creator = chunkJTSG5FGC_cjs.stabilizeSelectedTransactionSigner(
398
+ client.signer,
399
+ detachedInput.creator
400
+ );
401
+ return mutation.mutateAsync({
402
+ client,
403
+ input: snapshottedInput,
404
+ taskPda,
405
+ creator,
406
+ orchestrationRpcUrl: ctx.orchestrationRpcUrl,
407
+ orchestrationRpc: ctx.orchestrationRpc
408
+ });
409
+ },
410
+ [ctx, mutation]
569
411
  );
570
412
  return {
571
413
  activate,
572
- status: mutationStatusOf(mutation),
414
+ status: chunkJTSG5FGC_cjs.mutationStatusOf(mutation),
573
415
  signature: mutation.data ?? null,
574
416
  error: mutation.error ?? null,
575
417
  isPending: mutation.isPending,
@@ -583,20 +425,114 @@ function emptyProgress() {
583
425
  activationSignature: null,
584
426
  jobSpecHash: null,
585
427
  jobSpecUri: null,
586
- referrerInjected: false
428
+ referrerInjected: false,
429
+ recovery: null
430
+ };
431
+ }
432
+ function readCreatorAddress(creator, label) {
433
+ try {
434
+ return kit.address(creator.address);
435
+ } catch (cause) {
436
+ throw new TypeError(
437
+ `useHumanlessHireFlow: ${label} must expose a valid Solana address`,
438
+ { cause }
439
+ );
440
+ }
441
+ }
442
+ function assertCreatorUnchanged(creator, expectedAddress) {
443
+ if (readCreatorAddress(creator, "creator") !== expectedAddress) {
444
+ throw new TypeError(
445
+ "useHumanlessHireFlow: creator address changed after enqueue; no transaction was submitted"
446
+ );
447
+ }
448
+ return creator;
449
+ }
450
+ function snapshotFlowInput(input, defaultCreator) {
451
+ let jobSpec;
452
+ try {
453
+ jobSpec = marketplaceSdk.snapshotStructuredClone(
454
+ input.jobSpec,
455
+ "useHumanlessHireFlow: jobSpec"
456
+ );
457
+ } catch (cause) {
458
+ throw new TypeError(
459
+ "useHumanlessHireFlow: jobSpec must be structured-cloneable",
460
+ { cause }
461
+ );
462
+ }
463
+ const creator = chunkJTSG5FGC_cjs.stabilizeSelectedTransactionSigner(
464
+ defaultCreator,
465
+ input.creator
466
+ );
467
+ return {
468
+ creatorAddress: readCreatorAddress(creator, "creator"),
469
+ input: {
470
+ ...input,
471
+ hire: {
472
+ ...input.hire,
473
+ taskId: chunkJTSG5FGC_cjs.snapshotFixedBytes32(
474
+ input.hire.taskId,
475
+ "useHumanlessHireFlow: hire.taskId"
476
+ ),
477
+ listingSpecHash: chunkJTSG5FGC_cjs.snapshotFixedBytes32(
478
+ input.hire.listingSpecHash,
479
+ "useHumanlessHireFlow: hire.listingSpecHash"
480
+ ),
481
+ taskJobSpecHash: chunkJTSG5FGC_cjs.snapshotFixedBytes32(
482
+ input.hire.taskJobSpecHash,
483
+ "useHumanlessHireFlow: hire.taskJobSpecHash"
484
+ )
485
+ },
486
+ jobSpec,
487
+ ...input.activation === void 0 ? {} : { activation: { ...input.activation } },
488
+ creator
489
+ }
490
+ };
491
+ }
492
+ function snapshotRecovery(recovery) {
493
+ return recovery.phase === "activating" ? {
494
+ ...recovery,
495
+ jobSpecHash: chunkJTSG5FGC_cjs.snapshotFixedBytes32(
496
+ recovery.jobSpecHash,
497
+ "useHumanlessHireFlow: recovery.jobSpecHash"
498
+ )
499
+ } : { ...recovery };
500
+ }
501
+ function progressFromRecovery(recovery, referrerInjected) {
502
+ const committed = recovery.phase !== "hiring";
503
+ const activating = recovery.phase === "activating" ? recovery : null;
504
+ return {
505
+ taskPda: recovery.taskPda,
506
+ hireSignature: committed && recovery.hireSignature !== "" ? recovery.hireSignature : null,
507
+ activationSignature: null,
508
+ jobSpecHash: activating?.jobSpecHash ?? null,
509
+ jobSpecUri: activating?.jobSpecUri ?? null,
510
+ referrerInjected,
511
+ recovery
587
512
  };
588
513
  }
589
- function validateModerationResult(result) {
514
+ function validateModerationResult(result, committedHash) {
590
515
  if (result.moderationAttested !== true) {
591
516
  throw new Error(
592
517
  "Task moderation was not attested; activation was not signed."
593
518
  );
594
519
  }
595
- if (!(result.jobSpecHash instanceof Uint8Array) || result.jobSpecHash.byteLength !== 32) {
520
+ let jobSpecHash;
521
+ try {
522
+ jobSpecHash = chunkJTSG5FGC_cjs.snapshotFixedBytes32(
523
+ result.jobSpecHash,
524
+ "useHumanlessHireFlow: moderation.jobSpecHash"
525
+ );
526
+ } catch {
596
527
  throw new Error(
597
528
  "Task moderation returned an invalid jobSpecHash; activation was not signed."
598
529
  );
599
530
  }
531
+ if (!jobSpecHash.every((byte, index) => byte === committedHash[index])) {
532
+ throw new Error(
533
+ "Task moderation returned a jobSpecHash different from the hash committed at hire; activation was not signed."
534
+ );
535
+ }
600
536
  const jobSpecUri = result.jobSpecUri.trim();
601
537
  if (!jobSpecUri) {
602
538
  throw new Error(
@@ -609,100 +545,118 @@ function validateModerationResult(result) {
609
545
  );
610
546
  }
611
547
  return {
612
- jobSpecHash: result.jobSpecHash,
548
+ jobSpecHash,
613
549
  jobSpecUri,
614
550
  moderator: result.moderator
615
551
  };
616
552
  }
617
553
  function useHumanlessHireFlow() {
618
- const ctx = useAgencContext();
554
+ const ctx = chunkJTSG5FGC_cjs.useAgencContext();
619
555
  const [phase, setPhase] = react.useState("idle");
620
556
  const [progress, setProgress] = react.useState(emptyProgress);
621
557
  const flowInFlight = react.useRef(false);
622
558
  const mutation = reactQuery.useMutation({
623
- mutationFn: async (input) => {
624
- const client = requireClient(ctx.client);
625
- const creator = input.creator ?? client.signer;
626
- const { referrerArgs, referrerInjected } = resolveReferrerArgs(ctx);
627
- const hireInput = withoutReferrerArgs(input.hire);
628
- setPhase("hiring");
629
- setProgress(emptyProgress());
559
+ mutationFn: async ({
560
+ input,
561
+ creatorAddress,
562
+ recovery,
563
+ client,
564
+ rpc,
565
+ rpcUrl,
566
+ referral
567
+ }) => {
568
+ const creator = assertCreatorUnchanged(input.creator, creatorAddress);
569
+ const { referrerArgs, referrerInjected } = referral;
570
+ const hireInput = chunkJTSG5FGC_cjs.withoutReferrerArgs(input.hire);
571
+ const activationInput = { ...input.activation ?? {} };
572
+ let activationRecovery = recovery?.phase === "activating" ? recovery : null;
573
+ setPhase(recovery?.phase ?? "hiring");
574
+ setProgress(
575
+ recovery === null ? { ...emptyProgress(), referrerInjected } : progressFromRecovery(recovery, referrerInjected)
576
+ );
630
577
  try {
631
- const hireListingSpecHash = input.hire.listingSpecHash;
632
- let hireModerationArgs = {};
633
- if (input.hire.moderationAttestor === void 0 && input.hire.moderatorIsAttestor === void 0 && input.hire.listingModeration === void 0 && hireListingSpecHash !== void 0) {
634
- hireModerationArgs = await resolveHireListingModerationAccounts({
635
- rpcUrl: ctx.rpcUrl,
636
- listing: input.hire.listing,
637
- listingSpecHash: hireListingSpecHash,
638
- moderator: input.hire.moderator
639
- });
640
- }
641
- const hireResult = await client.hireFromListingHumanless({
642
- ...hireInput,
643
- ...hireModerationArgs,
644
- creator,
645
- ...referrerArgs
646
- });
647
- const [taskPda] = await marketplaceSdk.findTaskPda({
648
- creator: signerAddress(creator),
649
- taskId: input.hire.taskId
650
- });
651
- setProgress({
652
- ...emptyProgress(),
653
- taskPda,
654
- hireSignature: hireResult.signature,
655
- referrerInjected
656
- });
657
- setPhase("moderating");
658
- const moderation = await input.hostAndModerateJobSpec({
659
- taskPda,
660
- taskId: input.hire.taskId,
661
- listing: input.hire.listing,
578
+ const orchestration = {
579
+ hire: {
580
+ ...hireInput,
581
+ ...referrerArgs
582
+ },
662
583
  jobSpec: input.jobSpec,
663
- hireSignature: hireResult.signature,
664
- referrerInjected
665
- });
666
- const { jobSpecHash, jobSpecUri, moderator } = validateModerationResult(moderation);
667
- setProgress((current) => ({
668
- ...current,
669
- jobSpecHash,
670
- jobSpecUri
671
- }));
672
- setPhase("activating");
673
- const activationModerator = input.activation?.moderator ?? moderator;
674
- const activationCallerResolved = input.activation?.moderationAttestor !== void 0 || input.activation?.moderatorIsAttestor !== void 0 || input.activation?.taskModeration !== void 0;
675
- const activationModerationArgs = activationCallerResolved ? {} : await resolveActivationModerationAccounts({
676
- rpcUrl: ctx.rpcUrl,
677
- task: taskPda,
678
- jobSpecHash,
679
- moderator: activationModerator
680
- });
681
- const activationResult = await client.setTaskJobSpec({
682
- ...input.activation ?? {},
683
- ...activationModerationArgs,
684
- task: taskPda,
584
+ activation: activationInput,
685
585
  creator,
686
- jobSpecHash,
687
- jobSpecUri,
688
- moderator: activationModerator
689
- });
586
+ hostAndModerateJobSpec: async (host) => {
587
+ const committed = {
588
+ phase: "moderating",
589
+ taskPda: host.taskPda,
590
+ hireSignature: host.hireSignature,
591
+ hireIntentDigest: host.hireIntentDigest,
592
+ ...host.hireReconciled === true ? { hireReconciled: true } : {}
593
+ };
594
+ setProgress(progressFromRecovery(committed, referrerInjected));
595
+ const moderation = await input.hostAndModerateJobSpec({
596
+ taskPda: host.taskPda,
597
+ taskId: host.taskId,
598
+ listing: host.listing,
599
+ jobSpec: host.jobSpec,
600
+ hireSignature: host.hireSignature,
601
+ ...host.hireReconciled === true ? { hireReconciled: true } : {},
602
+ referrerInjected
603
+ });
604
+ const validated = validateModerationResult(
605
+ moderation,
606
+ input.hire.taskJobSpecHash
607
+ );
608
+ const activationModerator = input.activation?.moderator ?? validated.moderator;
609
+ activationRecovery = {
610
+ phase: "activating",
611
+ taskPda: host.taskPda,
612
+ hireSignature: host.hireSignature,
613
+ hireIntentDigest: host.hireIntentDigest,
614
+ ...host.hireReconciled === true ? { hireReconciled: true } : {},
615
+ ...validated,
616
+ moderator: activationModerator
617
+ };
618
+ return moderation;
619
+ },
620
+ onPhase: (nextPhase) => {
621
+ setPhase(nextPhase);
622
+ if (nextPhase === "activating" && activationRecovery !== null) {
623
+ setProgress(
624
+ progressFromRecovery(activationRecovery, referrerInjected)
625
+ );
626
+ }
627
+ },
628
+ ...rpc !== null ? { rpc } : {},
629
+ ...rpcUrl !== null ? { rpcUrl } : {}
630
+ };
631
+ const orchestrationResult = recovery === null ? await marketplaceSdk.hireAndActivate(client, orchestration) : await marketplaceSdk.resumeHireAndActivate(client, orchestration, recovery);
690
632
  const result = {
691
- taskPda,
692
- hireSignature: hireResult.signature,
693
- activationSignature: activationResult.signature,
694
- jobSpecHash,
695
- jobSpecUri,
633
+ taskPda: orchestrationResult.taskPda,
634
+ hireSignature: orchestrationResult.hireSignature,
635
+ activationSignature: orchestrationResult.activationSignature,
636
+ jobSpecHash: orchestrationResult.jobSpecHash,
637
+ jobSpecUri: orchestrationResult.jobSpecUri,
696
638
  referrerInjected,
697
- moderation: moderation.moderation
639
+ ...orchestrationResult.hireReconciled === true ? { hireReconciled: true } : {},
640
+ ...orchestrationResult.activationReconciled === true ? { activationReconciled: true } : {},
641
+ moderation: orchestrationResult.moderation
698
642
  };
699
- setProgress((current) => ({
700
- ...current,
701
- activationSignature: activationResult.signature
702
- }));
643
+ setProgress({
644
+ taskPda: result.taskPda,
645
+ hireSignature: result.hireSignature || null,
646
+ activationSignature: result.activationSignature || null,
647
+ jobSpecHash: result.jobSpecHash,
648
+ jobSpecUri: result.jobSpecUri,
649
+ referrerInjected,
650
+ recovery: null
651
+ });
703
652
  setPhase("activated");
704
653
  return result;
705
654
  } catch (error) {
655
+ if (error instanceof marketplaceSdk.HireAndActivateError) {
656
+ setProgress(progressFromRecovery(error.progress, referrerInjected));
657
+ } else if (error instanceof marketplaceSdk.HireAndActivateFinalizedFailure) {
658
+ setProgress({ ...emptyProgress(), referrerInjected });
659
+ }
706
660
  setPhase("error");
707
661
  throw error;
708
662
  }
@@ -715,12 +669,44 @@ function useHumanlessHireFlow() {
715
669
  }
716
670
  flowInFlight.current = true;
717
671
  try {
718
- return await mutation.mutateAsync(input);
672
+ const client = chunkJTSG5FGC_cjs.requireClient(ctx.client);
673
+ const snapshot = snapshotFlowInput(input, client.signer);
674
+ return await mutation.mutateAsync({
675
+ ...snapshot,
676
+ recovery: null,
677
+ client,
678
+ rpc: ctx.orchestrationRpc,
679
+ rpcUrl: ctx.orchestrationRpcUrl,
680
+ referral: chunkJTSG5FGC_cjs.resolveReferrerArgs(ctx)
681
+ });
682
+ } finally {
683
+ flowInFlight.current = false;
684
+ }
685
+ },
686
+ [ctx, mutation]
687
+ );
688
+ const resumeHireAndActivate = react.useCallback(
689
+ async (input, recovery) => {
690
+ if (flowInFlight.current) {
691
+ throw new Error("A humanless hire flow is already in progress.");
692
+ }
693
+ flowInFlight.current = true;
694
+ try {
695
+ const client = chunkJTSG5FGC_cjs.requireClient(ctx.client);
696
+ const snapshot = snapshotFlowInput(input, client.signer);
697
+ return await mutation.mutateAsync({
698
+ ...snapshot,
699
+ recovery: snapshotRecovery(recovery),
700
+ client,
701
+ rpc: ctx.orchestrationRpc,
702
+ rpcUrl: ctx.orchestrationRpcUrl,
703
+ referral: chunkJTSG5FGC_cjs.resolveReferrerArgs(ctx)
704
+ });
719
705
  } finally {
720
706
  flowInFlight.current = false;
721
707
  }
722
708
  },
723
- [mutation]
709
+ [ctx, mutation]
724
710
  );
725
711
  const reset = react.useCallback(() => {
726
712
  mutation.reset();
@@ -729,8 +715,9 @@ function useHumanlessHireFlow() {
729
715
  }, [mutation]);
730
716
  return {
731
717
  hireAndActivate,
718
+ resumeHireAndActivate,
732
719
  phase,
733
- status: mutationStatusOf(mutation),
720
+ status: chunkJTSG5FGC_cjs.mutationStatusOf(mutation),
734
721
  progress,
735
722
  result: mutation.data ?? null,
736
723
  error: mutation.error ?? null,
@@ -739,10 +726,10 @@ function useHumanlessHireFlow() {
739
726
  };
740
727
  }
741
728
  function useTaskWork(taskPda) {
742
- const ctx = useAgencContext();
729
+ const ctx = chunkJTSG5FGC_cjs.useAgencContext();
730
+ const lastAction = react.useRef(null);
743
731
  const claimMut = reactQuery.useMutation({
744
- mutationFn: async (input) => {
745
- const client = requireClient(ctx.client);
732
+ mutationFn: async ({ client, input }) => {
746
733
  const { signature } = await client.claimTaskWithJobSpec({
747
734
  ...input,
748
735
  task: taskPda
@@ -751,8 +738,7 @@ function useTaskWork(taskPda) {
751
738
  }
752
739
  });
753
740
  const submitMut = reactQuery.useMutation({
754
- mutationFn: async (input) => {
755
- const client = requireClient(ctx.client);
741
+ mutationFn: async ({ client, input }) => {
756
742
  const { signature } = await client.submitTaskResult({
757
743
  ...input,
758
744
  task: taskPda
@@ -760,84 +746,175 @@ function useTaskWork(taskPda) {
760
746
  return signature;
761
747
  }
762
748
  });
763
- const claim = react.useCallback((input) => claimMut.mutateAsync(input), [claimMut]);
749
+ const claim = react.useCallback(
750
+ async (input) => {
751
+ const client = chunkJTSG5FGC_cjs.requireClient(ctx.client);
752
+ const detachedInput = chunkJTSG5FGC_cjs.snapshotRecord(input);
753
+ const authority = chunkJTSG5FGC_cjs.stabilizeSelectedTransactionSigner(
754
+ client.signer,
755
+ detachedInput.authority
756
+ );
757
+ const snapshottedInput = chunkJTSG5FGC_cjs.snapshotRecord({
758
+ ...detachedInput,
759
+ authority,
760
+ ...detachedInput.jobSpecHash === void 0 ? {} : {
761
+ jobSpecHash: chunkJTSG5FGC_cjs.snapshotFixedBytes32(
762
+ detachedInput.jobSpecHash,
763
+ "useTaskWork.claim: jobSpecHash"
764
+ )
765
+ }
766
+ });
767
+ lastAction.current = "claim";
768
+ return claimMut.mutateAsync({ client, input: snapshottedInput });
769
+ },
770
+ [claimMut, ctx.client]
771
+ );
764
772
  const submit = react.useCallback(
765
- (input) => submitMut.mutateAsync(input),
766
- [submitMut]
773
+ async (input) => {
774
+ const client = chunkJTSG5FGC_cjs.requireClient(ctx.client);
775
+ const detachedInput = chunkJTSG5FGC_cjs.snapshotRecord(input);
776
+ const authority = chunkJTSG5FGC_cjs.stabilizeSelectedTransactionSigner(
777
+ client.signer,
778
+ detachedInput.authority
779
+ );
780
+ const snapshottedInput = chunkJTSG5FGC_cjs.snapshotRecord({
781
+ ...detachedInput,
782
+ authority,
783
+ proofHash: chunkJTSG5FGC_cjs.snapshotFixedBytes32(
784
+ detachedInput.proofHash,
785
+ "useTaskWork.submit: proofHash"
786
+ ),
787
+ resultData: chunkJTSG5FGC_cjs.snapshotOptionalFixedBytes(
788
+ detachedInput.resultData,
789
+ 64,
790
+ "useTaskWork.submit: resultData"
791
+ )
792
+ });
793
+ lastAction.current = "submit";
794
+ return submitMut.mutateAsync({ client, input: snapshottedInput });
795
+ },
796
+ [ctx.client, submitMut]
767
797
  );
768
798
  const active = claimMut.isPending || submitMut.isPending;
769
- const latest = [claimMut, submitMut].find((m) => m.isError || m.isSuccess) ?? claimMut;
799
+ const latest = lastAction.current === "submit" ? submitMut : claimMut;
770
800
  return {
771
801
  claim,
772
802
  submit,
773
- status: active ? "pending" : mutationStatusOf(latest),
803
+ status: active ? "pending" : chunkJTSG5FGC_cjs.mutationStatusOf(latest),
774
804
  signature: latest.data ?? null,
775
- error: claimMut.error ?? submitMut.error ?? null,
805
+ error: latest.error ?? null,
776
806
  isPending: active,
777
807
  reset: () => {
808
+ lastAction.current = null;
778
809
  claimMut.reset();
779
810
  submitMut.reset();
780
811
  }
781
812
  };
782
813
  }
783
814
  function useTaskLifecycle(taskPda) {
784
- const ctx = useAgencContext();
815
+ const ctx = chunkJTSG5FGC_cjs.useAgencContext();
816
+ const lastAction = react.useRef(null);
785
817
  const cancelMut = reactQuery.useMutation({
786
- mutationFn: async (input) => {
787
- const client = requireClient(ctx.client);
818
+ mutationFn: async ({ client, input }) => {
788
819
  const { signature } = await client.cancelTask({
789
- ...input ?? {},
790
- task: taskPda,
791
- authority: input?.authority ?? client.signer
820
+ ...input,
821
+ task: taskPda
792
822
  });
793
823
  return signature;
794
824
  }
795
825
  });
796
826
  const closeMut = reactQuery.useMutation({
797
- mutationFn: async (input) => {
798
- const client = requireClient(ctx.client);
827
+ mutationFn: async ({ client, input }) => {
799
828
  const { signature } = await client.closeTask({
800
- ...input ?? {},
801
- task: taskPda,
802
- authority: input?.authority ?? client.signer
829
+ ...input,
830
+ task: taskPda
803
831
  });
804
832
  return signature;
805
833
  }
806
834
  });
807
835
  const autoAcceptMut = reactQuery.useMutation({
808
- mutationFn: async (input) => {
809
- const client = requireClient(ctx.client);
836
+ mutationFn: async ({ client, input }) => {
810
837
  const { signature } = await client.autoAcceptTaskResult({
811
838
  ...input,
812
- task: taskPda,
813
- authority: input.authority ?? client.signer
839
+ task: taskPda
814
840
  });
815
841
  return signature;
816
842
  }
817
843
  });
818
844
  const cancel = react.useCallback(
819
- (input) => cancelMut.mutateAsync(input),
820
- [cancelMut]
845
+ async (input) => {
846
+ const client = chunkJTSG5FGC_cjs.requireClient(ctx.client);
847
+ const detachedInput = chunkJTSG5FGC_cjs.snapshotRecord(input ?? {});
848
+ const authority = chunkJTSG5FGC_cjs.stabilizeSelectedTransactionSigner(
849
+ client.signer,
850
+ detachedInput.authority
851
+ );
852
+ const snapshottedInput = chunkJTSG5FGC_cjs.snapshotRecord({
853
+ ...detachedInput,
854
+ authority,
855
+ // audit F5/F12: cancelTask requires the bond PDAs; the SDK facade derives
856
+ // them from authority / workerBondAuthority. Default the worker wallet to
857
+ // the task PDA itself — it can never be a bond poster (PDAs can't sign),
858
+ // so the derived worker-bond PDA is the empty no-op account.
859
+ workerBondAuthority: detachedInput.workerBondAuthority ?? taskPda,
860
+ ...detachedInput.workerAccounts === void 0 ? {} : {
861
+ workerAccounts: chunkJTSG5FGC_cjs.snapshotRecordArray(detachedInput.workerAccounts)
862
+ },
863
+ ...detachedInput.bidSettlement === void 0 ? {} : { bidSettlement: chunkJTSG5FGC_cjs.snapshotRecord(detachedInput.bidSettlement) }
864
+ });
865
+ lastAction.current = "cancel";
866
+ return cancelMut.mutateAsync({ client, input: snapshottedInput });
867
+ },
868
+ [cancelMut, ctx.client]
821
869
  );
822
870
  const close = react.useCallback(
823
- (input) => closeMut.mutateAsync(input),
824
- [closeMut]
871
+ async (input) => {
872
+ const client = chunkJTSG5FGC_cjs.requireClient(ctx.client);
873
+ const detachedInput = chunkJTSG5FGC_cjs.snapshotRecord(input ?? {});
874
+ const authority = chunkJTSG5FGC_cjs.stabilizeSelectedTransactionSigner(
875
+ client.signer,
876
+ detachedInput.authority
877
+ );
878
+ const snapshottedInput = chunkJTSG5FGC_cjs.snapshotRecord({
879
+ ...detachedInput,
880
+ authority,
881
+ ...detachedInput.children === void 0 ? {} : { children: chunkJTSG5FGC_cjs.snapshotRecordArray(detachedInput.children) }
882
+ });
883
+ lastAction.current = "close";
884
+ return closeMut.mutateAsync({ client, input: snapshottedInput });
885
+ },
886
+ [closeMut, ctx.client]
825
887
  );
826
888
  const autoAccept = react.useCallback(
827
- (input) => autoAcceptMut.mutateAsync(input),
828
- [autoAcceptMut]
889
+ async (input) => {
890
+ const client = chunkJTSG5FGC_cjs.requireClient(ctx.client);
891
+ const detachedInput = chunkJTSG5FGC_cjs.snapshotRecord(input);
892
+ const authority = chunkJTSG5FGC_cjs.stabilizeSelectedTransactionSigner(
893
+ client.signer,
894
+ detachedInput.authority
895
+ );
896
+ const snapshottedInput = chunkJTSG5FGC_cjs.snapshotRecord({
897
+ ...detachedInput,
898
+ authority,
899
+ ...detachedInput.bidSettlement === void 0 ? {} : { bidSettlement: chunkJTSG5FGC_cjs.snapshotRecord(detachedInput.bidSettlement) }
900
+ });
901
+ lastAction.current = "autoAccept";
902
+ return autoAcceptMut.mutateAsync({ client, input: snapshottedInput });
903
+ },
904
+ [autoAcceptMut, ctx.client]
829
905
  );
830
906
  const active = cancelMut.isPending || closeMut.isPending || autoAcceptMut.isPending;
831
- const latest = [cancelMut, closeMut, autoAcceptMut].find((m) => m.isError || m.isSuccess) ?? cancelMut;
907
+ const latest = lastAction.current === "close" ? closeMut : lastAction.current === "autoAccept" ? autoAcceptMut : cancelMut;
832
908
  return {
833
909
  cancel,
834
910
  close,
835
911
  autoAccept,
836
- status: active ? "pending" : mutationStatusOf(latest),
912
+ status: active ? "pending" : chunkJTSG5FGC_cjs.mutationStatusOf(latest),
837
913
  signature: latest.data ?? null,
838
- error: cancelMut.error ?? closeMut.error ?? autoAcceptMut.error ?? null,
914
+ error: latest.error ?? null,
839
915
  isPending: active,
840
916
  reset: () => {
917
+ lastAction.current = null;
841
918
  cancelMut.reset();
842
919
  closeMut.reset();
843
920
  autoAcceptMut.reset();
@@ -845,22 +922,40 @@ function useTaskLifecycle(taskPda) {
845
922
  };
846
923
  }
847
924
  function useRateHire(taskPda) {
848
- const ctx = useAgencContext();
925
+ const ctx = chunkJTSG5FGC_cjs.useAgencContext();
849
926
  const mutation = reactQuery.useMutation({
850
- mutationFn: async (input) => {
851
- const client = requireClient(ctx.client);
927
+ mutationFn: async ({ client, input }) => {
852
928
  const { signature } = await client.rateHire({
853
929
  ...input,
854
- task: taskPda,
855
- buyer: input.buyer ?? client.signer
930
+ task: taskPda
856
931
  });
857
932
  return signature;
858
933
  }
859
934
  });
860
- const rate = react.useCallback((input) => mutation.mutateAsync(input), [mutation]);
935
+ const rate = react.useCallback(
936
+ async (input) => {
937
+ const client = chunkJTSG5FGC_cjs.requireClient(ctx.client);
938
+ const detachedInput = chunkJTSG5FGC_cjs.snapshotRecord(input);
939
+ const buyer = chunkJTSG5FGC_cjs.stabilizeSelectedTransactionSigner(
940
+ client.signer,
941
+ detachedInput.buyer
942
+ );
943
+ const snapshottedInput = chunkJTSG5FGC_cjs.snapshotRecord({
944
+ ...detachedInput,
945
+ buyer,
946
+ reviewHash: chunkJTSG5FGC_cjs.snapshotOptionalFixedBytes(
947
+ detachedInput.reviewHash,
948
+ 32,
949
+ "useRateHire.rate: reviewHash"
950
+ )
951
+ });
952
+ return mutation.mutateAsync({ client, input: snapshottedInput });
953
+ },
954
+ [ctx.client, mutation]
955
+ );
861
956
  return {
862
957
  rate,
863
- status: mutationStatusOf(mutation),
958
+ status: chunkJTSG5FGC_cjs.mutationStatusOf(mutation),
864
959
  signature: mutation.data ?? null,
865
960
  error: mutation.error ?? null,
866
961
  isPending: mutation.isPending,
@@ -868,29 +963,54 @@ function useRateHire(taskPda) {
868
963
  };
869
964
  }
870
965
  function useDispute(taskPda, options) {
871
- const ctx = useAgencContext();
966
+ const ctx = chunkJTSG5FGC_cjs.useAgencContext();
872
967
  const reader = options?.disputeReader;
873
968
  const enabled = (options?.enabled ?? true) && Boolean(taskPda) && Boolean(reader);
874
969
  const read = reactQuery.useQuery({
875
- queryKey: queryKeys.dispute(taskPda ? pdaKey(taskPda) : ""),
970
+ queryKey: chunkJTSG5FGC_cjs.queryKeys.dispute(
971
+ taskPda ? chunkJTSG5FGC_cjs.pdaKey(taskPda) : "",
972
+ ctx.cacheNamespace
973
+ ),
876
974
  enabled,
877
975
  queryFn: () => reader(taskPda)
878
976
  });
879
977
  const mutation = reactQuery.useMutation({
880
- mutationFn: async (input) => {
881
- const client = requireClient(ctx.client);
978
+ mutationFn: async ({ client, input }) => {
882
979
  const { signature } = await client.initiateDispute({
883
980
  ...input,
884
- task: taskPda,
885
- authority: input.authority ?? client.signer
981
+ task: taskPda
886
982
  });
887
983
  void read.refetch();
888
984
  return signature;
889
985
  }
890
986
  });
891
987
  const initiate = react.useCallback(
892
- (input) => mutation.mutateAsync(input),
893
- [mutation]
988
+ async (input) => {
989
+ const client = chunkJTSG5FGC_cjs.requireClient(ctx.client);
990
+ const detachedInput = chunkJTSG5FGC_cjs.snapshotRecord(input);
991
+ const authority = chunkJTSG5FGC_cjs.stabilizeSelectedTransactionSigner(
992
+ client.signer,
993
+ detachedInput.authority
994
+ );
995
+ const snapshottedInput = chunkJTSG5FGC_cjs.snapshotRecord({
996
+ ...detachedInput,
997
+ authority,
998
+ disputeId: chunkJTSG5FGC_cjs.snapshotFixedBytes32(
999
+ detachedInput.disputeId,
1000
+ "useDispute.initiate: disputeId"
1001
+ ),
1002
+ taskId: chunkJTSG5FGC_cjs.snapshotFixedBytes32(
1003
+ detachedInput.taskId,
1004
+ "useDispute.initiate: taskId"
1005
+ ),
1006
+ evidenceHash: chunkJTSG5FGC_cjs.snapshotFixedBytes32(
1007
+ detachedInput.evidenceHash,
1008
+ "useDispute.initiate: evidenceHash"
1009
+ )
1010
+ });
1011
+ return mutation.mutateAsync({ client, input: snapshottedInput });
1012
+ },
1013
+ [ctx.client, mutation]
894
1014
  );
895
1015
  const status = mutation.isPending ? "pending" : mutation.isError ? "error" : mutation.isSuccess ? "success" : "idle";
896
1016
  return {
@@ -905,73 +1025,82 @@ function useDispute(taskPda, options) {
905
1025
  };
906
1026
  }
907
1027
  function useCompletionBond(taskPda) {
908
- const ctx = useAgencContext();
1028
+ const ctx = chunkJTSG5FGC_cjs.useAgencContext();
909
1029
  const queryClient = reactQuery.useQueryClient();
1030
+ const lastAction = react.useRef(null);
910
1031
  const invalidateGuarantee = react.useCallback(() => {
911
1032
  void queryClient.invalidateQueries({
912
- queryKey: queryKeys.taskGuarantee(pdaKey(taskPda))
1033
+ queryKey: chunkJTSG5FGC_cjs.queryKeys.taskGuarantee(chunkJTSG5FGC_cjs.pdaKey(taskPda), ctx.cacheNamespace)
913
1034
  });
914
- }, [queryClient, taskPda]);
1035
+ }, [ctx.cacheNamespace, queryClient, taskPda]);
915
1036
  const postMut = reactQuery.useMutation({
916
- mutationFn: async (input) => {
917
- const client = requireClient(ctx.client);
1037
+ mutationFn: async ({ client, input }) => {
918
1038
  const { signature } = await client.postCompletionBond({
919
1039
  ...input,
920
- task: taskPda,
921
- authority: input.authority ?? client.signer
1040
+ task: taskPda
922
1041
  });
923
1042
  invalidateGuarantee();
924
1043
  return signature;
925
1044
  }
926
1045
  });
927
1046
  const reclaimMut = reactQuery.useMutation({
928
- mutationFn: async (input) => {
929
- const client = requireClient(ctx.client);
1047
+ mutationFn: async ({ client, input }) => {
930
1048
  const { signature } = await client.reclaimCompletionBond({
931
1049
  ...input,
932
- task: taskPda,
933
- party: input.party ?? client.signer.address
1050
+ task: taskPda
934
1051
  });
935
1052
  invalidateGuarantee();
936
1053
  return signature;
937
1054
  }
938
1055
  });
939
1056
  const post = react.useCallback(
940
- (input) => postMut.mutateAsync(input),
941
- [postMut]
1057
+ async (input) => {
1058
+ const client = chunkJTSG5FGC_cjs.requireClient(ctx.client);
1059
+ const detachedInput = chunkJTSG5FGC_cjs.snapshotRecord(input);
1060
+ const authority = chunkJTSG5FGC_cjs.stabilizeSelectedTransactionSigner(
1061
+ client.signer,
1062
+ detachedInput.authority
1063
+ );
1064
+ const snapshottedInput = chunkJTSG5FGC_cjs.snapshotRecord({
1065
+ ...detachedInput,
1066
+ authority
1067
+ });
1068
+ lastAction.current = "post";
1069
+ return postMut.mutateAsync({ client, input: snapshottedInput });
1070
+ },
1071
+ [ctx.client, postMut]
942
1072
  );
943
1073
  const reclaim = react.useCallback(
944
- (input) => reclaimMut.mutateAsync(input),
945
- [reclaimMut]
1074
+ async (input) => {
1075
+ const client = chunkJTSG5FGC_cjs.requireClient(ctx.client);
1076
+ const detachedInput = chunkJTSG5FGC_cjs.snapshotRecord(input);
1077
+ const feePayer = chunkJTSG5FGC_cjs.stabilizeSelectedTransactionSigner(client.signer);
1078
+ const snapshottedInput = chunkJTSG5FGC_cjs.snapshotRecord({
1079
+ ...detachedInput,
1080
+ party: detachedInput.party ?? feePayer.address
1081
+ });
1082
+ lastAction.current = "reclaim";
1083
+ return reclaimMut.mutateAsync({ client, input: snapshottedInput });
1084
+ },
1085
+ [ctx.client, reclaimMut]
946
1086
  );
947
1087
  const isPending = postMut.isPending || reclaimMut.isPending;
948
- const status = isPending ? "pending" : mutationStatusOf(
949
- // Surface the most recently-touched verb's terminal state.
950
- [postMut, reclaimMut].find((m) => m.isError || m.isSuccess) ?? postMut
951
- );
1088
+ const latest = lastAction.current === "reclaim" ? reclaimMut : postMut;
1089
+ const status = isPending ? "pending" : chunkJTSG5FGC_cjs.mutationStatusOf(latest);
952
1090
  return {
953
1091
  post,
954
1092
  reclaim,
955
1093
  status,
956
- error: postMut.error ?? reclaimMut.error ?? null,
957
- signature: postMut.data ?? reclaimMut.data ?? null,
1094
+ error: latest.error ?? null,
1095
+ signature: latest.data ?? null,
958
1096
  isPending,
959
1097
  reset: () => {
1098
+ lastAction.current = null;
960
1099
  postMut.reset();
961
1100
  reclaimMut.reset();
962
1101
  }
963
1102
  };
964
1103
  }
965
- function useWalletSigner(options) {
966
- const ctx = useAgencContext();
967
- const adapter = options?.adapter;
968
- const signer = adapter?.signer ?? ctx.signer ?? null;
969
- const connected = adapter !== void 0 ? adapter.connected ?? adapter.signer !== null : ctx.signer !== null;
970
- const connect = react.useCallback(() => {
971
- return adapter?.connect ? adapter.connect() : void 0;
972
- }, [adapter]);
973
- return { signer, connected, connect };
974
- }
975
1104
  var EARNINGS_INDEXER_DEFAULTS = {
976
1105
  mainnet: "https://api.agenc.ag"
977
1106
  };
@@ -979,13 +1108,16 @@ function resolveEarningsBaseUrl(ctx) {
979
1108
  return ctx.indexerBaseUrl ?? EARNINGS_INDEXER_DEFAULTS[ctx.network] ?? null;
980
1109
  }
981
1110
  function useReferrerEarnings(wallet) {
982
- const ctx = useAgencContext();
1111
+ const ctx = chunkJTSG5FGC_cjs.useAgencContext();
983
1112
  const capability = ctx.resolveReferrerCapability();
984
1113
  const earningsBase = resolveEarningsBaseUrl(ctx);
985
1114
  const enabled = capability.live && earningsBase !== null && Boolean(wallet);
986
1115
  const query = reactQuery.useQuery(
987
1116
  {
988
- queryKey: queryKeys.referrerEarnings(wallet ? pdaKey(wallet) : ""),
1117
+ queryKey: chunkJTSG5FGC_cjs.queryKeys.referrerEarnings(
1118
+ wallet ? chunkJTSG5FGC_cjs.pdaKey(wallet) : "",
1119
+ ctx.cacheNamespace
1120
+ ),
989
1121
  enabled,
990
1122
  queryFn: async () => {
991
1123
  const url = `${earningsBase}/api/explorer/referrers/${encodeURIComponent(
@@ -996,7 +1128,7 @@ function useReferrerEarnings(wallet) {
996
1128
  });
997
1129
  if (!response.ok) {
998
1130
  throw new Error(
999
- t("referrer.earningsFetchFailed") + ` (HTTP ${response.status})`
1131
+ chunkFIDFPM5A_cjs.t("referrer.earningsFetchFailed") + ` (HTTP ${response.status})`
1000
1132
  );
1001
1133
  }
1002
1134
  const body = await response.json();
@@ -1020,7 +1152,7 @@ function useReferrerEarnings(wallet) {
1020
1152
  hires: [],
1021
1153
  isLoading: false,
1022
1154
  error: null,
1023
- reason: capability.live ? t("referrer.earningsNotLiveReason") : capability.reason ?? t("referrer.notLiveReason"),
1155
+ reason: capability.live ? chunkFIDFPM5A_cjs.t("referrer.earningsNotLiveReason") : capability.reason ?? chunkFIDFPM5A_cjs.t("referrer.notLiveReason"),
1024
1156
  refetch: () => {
1025
1157
  }
1026
1158
  };
@@ -1035,13 +1167,30 @@ function useReferrerEarnings(wallet) {
1035
1167
  };
1036
1168
  }
1037
1169
 
1038
- exports.QUERY_KEY_ROOT = QUERY_KEY_ROOT;
1170
+ Object.defineProperty(exports, "QUERY_KEY_ROOT", {
1171
+ enumerable: true,
1172
+ get: function () { return chunkJTSG5FGC_cjs.QUERY_KEY_ROOT; }
1173
+ });
1174
+ Object.defineProperty(exports, "queryKeys", {
1175
+ enumerable: true,
1176
+ get: function () { return chunkJTSG5FGC_cjs.queryKeys; }
1177
+ });
1178
+ Object.defineProperty(exports, "useHire", {
1179
+ enumerable: true,
1180
+ get: function () { return chunkJTSG5FGC_cjs.useHire; }
1181
+ });
1182
+ Object.defineProperty(exports, "useTaskGuarantee", {
1183
+ enumerable: true,
1184
+ get: function () { return chunkJTSG5FGC_cjs.useTaskGuarantee; }
1185
+ });
1186
+ Object.defineProperty(exports, "useWalletSigner", {
1187
+ enumerable: true,
1188
+ get: function () { return chunkJTSG5FGC_cjs.useWalletSigner; }
1189
+ });
1039
1190
  exports.projectTrackRecord = projectTrackRecord;
1040
- exports.queryKeys = queryKeys;
1041
1191
  exports.useAgentTrackRecord = useAgentTrackRecord;
1042
1192
  exports.useCompletionBond = useCompletionBond;
1043
1193
  exports.useDispute = useDispute;
1044
- exports.useHire = useHire;
1045
1194
  exports.useHumanlessHireFlow = useHumanlessHireFlow;
1046
1195
  exports.useListing = useListing;
1047
1196
  exports.useListings = useListings;
@@ -1049,10 +1198,8 @@ exports.useRateHire = useRateHire;
1049
1198
  exports.useReferrerEarnings = useReferrerEarnings;
1050
1199
  exports.useSubmissionReview = useSubmissionReview;
1051
1200
  exports.useTaskActivation = useTaskActivation;
1052
- exports.useTaskGuarantee = useTaskGuarantee;
1053
1201
  exports.useTaskLifecycle = useTaskLifecycle;
1054
1202
  exports.useTaskStatus = useTaskStatus;
1055
1203
  exports.useTaskWork = useTaskWork;
1056
- exports.useWalletSigner = useWalletSigner;
1057
1204
  //# sourceMappingURL=index.cjs.map
1058
1205
  //# sourceMappingURL=index.cjs.map