@tetsuo-ai/marketplace-react 0.4.0 → 0.4.1
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 +22 -0
- package/dist/{chunk-BNILOX3O.js → chunk-JVXGNW3Q.js} +35 -4
- package/dist/chunk-JVXGNW3Q.js.map +1 -0
- package/dist/{chunk-BTAVED7S.js → chunk-XLA7DARS.js} +35 -6
- package/dist/chunk-XLA7DARS.js.map +1 -0
- package/dist/components/index.cjs +129 -48
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +2 -2
- package/dist/hooks/index.cjs +89 -0
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.cts +50 -3
- package/dist/hooks/index.d.ts +50 -3
- package/dist/hooks/index.js +62 -4
- package/dist/hooks/index.js.map +1 -1
- package/dist/{index-DQ3Xovkq.d.ts → index-CmVz0OOm.d.ts} +50 -5
- package/dist/{index-UxuvIlmD.d.cts → index-DAZzhuO4.d.cts} +50 -5
- package/dist/index.cjs +119 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/{useAgentTrackRecord-BCvRHYM2.d.cts → useAgentTrackRecord-DPt3SfYz.d.cts} +39 -2
- package/dist/{useAgentTrackRecord-BCvRHYM2.d.ts → useAgentTrackRecord-DPt3SfYz.d.ts} +39 -2
- package/package.json +1 -1
- package/src/components/GuaranteedBadge.tsx +73 -0
- package/src/components/index.ts +4 -0
- package/src/components/strings.ts +8 -0
- package/src/hooks/index.ts +13 -0
- package/src/hooks/internal.ts +3 -0
- package/src/hooks/useCompletionBond.ts +156 -0
- package/src/hooks/useTaskGuarantee.ts +120 -0
- package/src/index.ts +2 -0
- package/src/types.ts +5 -2
- package/dist/chunk-BNILOX3O.js.map +0 -1
- package/dist/chunk-BTAVED7S.js.map +0 -1
package/dist/hooks/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DecodedProgramAccount, ServiceListing, ListActiveListingsOptions, IndexerAgentTrackRecord, IndexerListing, Task, TaskStatus, facade } from '@tetsuo-ai/marketplace-sdk';
|
|
2
2
|
import { Address, TransactionSigner } from '@solana/kit';
|
|
3
|
-
import { H as HumanlessHireInput } from '../useAgentTrackRecord-
|
|
4
|
-
export { A as AcceptInput, a as AgentTrackRecord, b as AnyHireInput, D as DisputeReader, c as DisputeStatus, d as HireInput, e as HireResult, f as HireStatus, I as InitiateDisputeInput, R as RejectInput, g as RequestChangesInput, h as ReviewAction, i as ReviewStatus, T as TrackRecordOutcome, U as UseAgentTrackRecordOptions,
|
|
3
|
+
import { H as HumanlessHireInput } from '../useAgentTrackRecord-DPt3SfYz.cjs';
|
|
4
|
+
export { A as AcceptInput, a as AgentTrackRecord, b as AnyHireInput, D as DisputeReader, c as DisputeStatus, d as HireInput, e as HireResult, f as HireStatus, I as InitiateDisputeInput, R as RejectInput, g as RequestChangesInput, h as ReviewAction, i as ReviewStatus, T as TaskGuaranteeReader, j as TrackRecordOutcome, U as UseAgentTrackRecordOptions, k as UseAgentTrackRecordResult, l as UseDisputeOptions, m as UseDisputeResult, n as UseHireResult, o as UseSubmissionReviewResult, p as UseTaskGuaranteeOptions, q as UseTaskGuaranteeResult, r as projectTrackRecord, u as useAgentTrackRecord, s as useDispute, t as useHire, v as useSubmissionReview, w as useTaskGuarantee } from '../useAgentTrackRecord-DPt3SfYz.cjs';
|
|
5
5
|
|
|
6
6
|
/** A decoded active listing row (address + decoded account). */
|
|
7
7
|
type ListingRow = DecodedProgramAccount<ServiceListing>;
|
|
@@ -192,6 +192,8 @@ declare const queryKeys: {
|
|
|
192
192
|
readonly taskStatus: (taskPda: string) => readonly ["agenc", "taskStatus", string];
|
|
193
193
|
/** One task's dispute record. */
|
|
194
194
|
readonly dispute: (taskPda: string) => readonly ["agenc", "dispute", string];
|
|
195
|
+
/** One task's completion-bond ("Guaranteed Hire") state. */
|
|
196
|
+
readonly taskGuarantee: (taskPda: string) => readonly ["agenc", "taskGuarantee", string];
|
|
195
197
|
/** One referrer wallet's earnings (indexer-gated; see useReferrerEarnings). */
|
|
196
198
|
readonly referrerEarnings: (wallet: string) => readonly ["agenc", "referrerEarnings", string];
|
|
197
199
|
};
|
|
@@ -331,6 +333,51 @@ interface UseRateHireResult {
|
|
|
331
333
|
}
|
|
332
334
|
declare function useRateHire(taskPda: Parameters<typeof facade.rateHire>[0]["task"]): UseRateHireResult;
|
|
333
335
|
|
|
336
|
+
/**
|
|
337
|
+
* Per-call input for `post` (task auto-bound; the bonding `authority` signer
|
|
338
|
+
* defaults to the client's signer). `role` stays explicit: 1 = worker (the
|
|
339
|
+
* guarantee), 0 = creator.
|
|
340
|
+
*/
|
|
341
|
+
type PostCompletionBondInput = Omit<Parameters<typeof facade.postCompletionBond>[0], "task" | "authority"> & {
|
|
342
|
+
/** Override the bonding authority signer (defaults to the client signer). */
|
|
343
|
+
authority?: Parameters<typeof facade.postCompletionBond>[0]["authority"];
|
|
344
|
+
};
|
|
345
|
+
/**
|
|
346
|
+
* Per-call input for `reclaim` (task auto-bound; `party` — the posting wallet
|
|
347
|
+
* the refund returns to — defaults to the client signer's address). The
|
|
348
|
+
* instruction is a permissionless crank, so any fee payer may run it.
|
|
349
|
+
*/
|
|
350
|
+
type ReclaimCompletionBondInput = Omit<Parameters<typeof facade.reclaimCompletionBond>[0], "task" | "party"> & {
|
|
351
|
+
/** Override the bond's posting wallet (defaults to the client signer). */
|
|
352
|
+
party?: Parameters<typeof facade.reclaimCompletionBond>[0]["party"];
|
|
353
|
+
};
|
|
354
|
+
/** Lifecycle status of a bond verb. */
|
|
355
|
+
type CompletionBondStatus = MutationStatus;
|
|
356
|
+
/** Return value of {@link useCompletionBond}. */
|
|
357
|
+
interface UseCompletionBondResult {
|
|
358
|
+
/** Post a bond. Resolves to the tx signature; rejects with `AgencError`. */
|
|
359
|
+
post: (input: PostCompletionBondInput) => Promise<string>;
|
|
360
|
+
/** Reclaim a settled-but-live bond. Resolves to the tx signature. */
|
|
361
|
+
reclaim: (input: ReclaimCompletionBondInput) => Promise<string>;
|
|
362
|
+
/** Aggregate status: `pending` if either verb is in flight, else last settled. */
|
|
363
|
+
status: CompletionBondStatus;
|
|
364
|
+
/** The most recent error across the two verbs, or null. */
|
|
365
|
+
error: Error | null;
|
|
366
|
+
/** Signature of the last successful action, or null. */
|
|
367
|
+
signature: string | null;
|
|
368
|
+
/** True while either verb is in flight. */
|
|
369
|
+
isPending: boolean;
|
|
370
|
+
/** Reset both mutations to idle. */
|
|
371
|
+
reset: () => void;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Completion-bond actions for one task.
|
|
375
|
+
*
|
|
376
|
+
* @param taskPda - The Task PDA (bound to both verbs).
|
|
377
|
+
* @returns {@link UseCompletionBondResult}.
|
|
378
|
+
*/
|
|
379
|
+
declare function useCompletionBond(taskPda: Parameters<typeof facade.postCompletionBond>[0]["task"]): UseCompletionBondResult;
|
|
380
|
+
|
|
334
381
|
/**
|
|
335
382
|
* The minimal adapter shape this hook bridges. The forthcoming
|
|
336
383
|
* `@tetsuo-ai/signer-adapters` hook is expected to return exactly this shape
|
|
@@ -426,4 +473,4 @@ interface UseReferrerEarningsResult {
|
|
|
426
473
|
*/
|
|
427
474
|
declare function useReferrerEarnings(wallet: Address | string | undefined | null): UseReferrerEarningsResult;
|
|
428
475
|
|
|
429
|
-
export { type AutoAcceptTaskResultInput, type CancelTaskInput, type ClaimTaskInput, type CloseTaskInput, type HumanlessHireFlowActivationInput, type HumanlessHireFlowCreator, type HumanlessHireFlowHireInput, type HumanlessHireFlowHost, type HumanlessHireFlowHostInput, type HumanlessHireFlowInput, type HumanlessHireFlowJobSpecHash, type HumanlessHireFlowModerationResult, type HumanlessHireFlowPhase, type HumanlessHireFlowProgress, type HumanlessHireFlowResult, type HumanlessHireFlowStatus, HumanlessHireInput, type ListingDetail, type ListingRow, type ObservedEvent, QUERY_KEY_ROOT, type RateHireInput, type RateHireStatus, type ReferrerHire, type SubmitTaskResultInput, type TaskActivationInput, type TaskActivationStatus, type TaskEventsSource, type TaskLifecycleStatus, type TaskReader, type TaskWorkStatus, type UseHumanlessHireFlowResult, type UseListingOptions, type UseListingResult, type UseListingsFilter, type UseListingsOptions, type UseListingsResult, type UseRateHireResult, type UseReferrerEarningsResult, type UseTaskActivationResult, type UseTaskLifecycleResult, type UseTaskStatusOptions, type UseTaskStatusResult, type UseTaskWorkResult, type UseWalletSignerOptions, type UseWalletSignerResult, type WalletSignerAdapter, queryKeys, useHumanlessHireFlow, useListing, useListings, useRateHire, useReferrerEarnings, useTaskActivation, useTaskLifecycle, useTaskStatus, useTaskWork, useWalletSigner };
|
|
476
|
+
export { type AutoAcceptTaskResultInput, type CancelTaskInput, type ClaimTaskInput, type CloseTaskInput, type CompletionBondStatus, type HumanlessHireFlowActivationInput, type HumanlessHireFlowCreator, type HumanlessHireFlowHireInput, type HumanlessHireFlowHost, type HumanlessHireFlowHostInput, type HumanlessHireFlowInput, type HumanlessHireFlowJobSpecHash, type HumanlessHireFlowModerationResult, type HumanlessHireFlowPhase, type HumanlessHireFlowProgress, type HumanlessHireFlowResult, type HumanlessHireFlowStatus, HumanlessHireInput, type ListingDetail, type ListingRow, type ObservedEvent, type PostCompletionBondInput, QUERY_KEY_ROOT, type RateHireInput, type RateHireStatus, type ReclaimCompletionBondInput, type ReferrerHire, type SubmitTaskResultInput, type TaskActivationInput, type TaskActivationStatus, type TaskEventsSource, type TaskLifecycleStatus, type TaskReader, type TaskWorkStatus, type UseCompletionBondResult, type UseHumanlessHireFlowResult, type UseListingOptions, type UseListingResult, type UseListingsFilter, type UseListingsOptions, type UseListingsResult, type UseRateHireResult, type UseReferrerEarningsResult, type UseTaskActivationResult, type UseTaskLifecycleResult, type UseTaskStatusOptions, type UseTaskStatusResult, type UseTaskWorkResult, type UseWalletSignerOptions, type UseWalletSignerResult, type WalletSignerAdapter, queryKeys, useCompletionBond, useHumanlessHireFlow, useListing, useListings, useRateHire, useReferrerEarnings, useTaskActivation, useTaskLifecycle, useTaskStatus, useTaskWork, useWalletSigner };
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DecodedProgramAccount, ServiceListing, ListActiveListingsOptions, IndexerAgentTrackRecord, IndexerListing, Task, TaskStatus, facade } from '@tetsuo-ai/marketplace-sdk';
|
|
2
2
|
import { Address, TransactionSigner } from '@solana/kit';
|
|
3
|
-
import { H as HumanlessHireInput } from '../useAgentTrackRecord-
|
|
4
|
-
export { A as AcceptInput, a as AgentTrackRecord, b as AnyHireInput, D as DisputeReader, c as DisputeStatus, d as HireInput, e as HireResult, f as HireStatus, I as InitiateDisputeInput, R as RejectInput, g as RequestChangesInput, h as ReviewAction, i as ReviewStatus, T as TrackRecordOutcome, U as UseAgentTrackRecordOptions,
|
|
3
|
+
import { H as HumanlessHireInput } from '../useAgentTrackRecord-DPt3SfYz.js';
|
|
4
|
+
export { A as AcceptInput, a as AgentTrackRecord, b as AnyHireInput, D as DisputeReader, c as DisputeStatus, d as HireInput, e as HireResult, f as HireStatus, I as InitiateDisputeInput, R as RejectInput, g as RequestChangesInput, h as ReviewAction, i as ReviewStatus, T as TaskGuaranteeReader, j as TrackRecordOutcome, U as UseAgentTrackRecordOptions, k as UseAgentTrackRecordResult, l as UseDisputeOptions, m as UseDisputeResult, n as UseHireResult, o as UseSubmissionReviewResult, p as UseTaskGuaranteeOptions, q as UseTaskGuaranteeResult, r as projectTrackRecord, u as useAgentTrackRecord, s as useDispute, t as useHire, v as useSubmissionReview, w as useTaskGuarantee } from '../useAgentTrackRecord-DPt3SfYz.js';
|
|
5
5
|
|
|
6
6
|
/** A decoded active listing row (address + decoded account). */
|
|
7
7
|
type ListingRow = DecodedProgramAccount<ServiceListing>;
|
|
@@ -192,6 +192,8 @@ declare const queryKeys: {
|
|
|
192
192
|
readonly taskStatus: (taskPda: string) => readonly ["agenc", "taskStatus", string];
|
|
193
193
|
/** One task's dispute record. */
|
|
194
194
|
readonly dispute: (taskPda: string) => readonly ["agenc", "dispute", string];
|
|
195
|
+
/** One task's completion-bond ("Guaranteed Hire") state. */
|
|
196
|
+
readonly taskGuarantee: (taskPda: string) => readonly ["agenc", "taskGuarantee", string];
|
|
195
197
|
/** One referrer wallet's earnings (indexer-gated; see useReferrerEarnings). */
|
|
196
198
|
readonly referrerEarnings: (wallet: string) => readonly ["agenc", "referrerEarnings", string];
|
|
197
199
|
};
|
|
@@ -331,6 +333,51 @@ interface UseRateHireResult {
|
|
|
331
333
|
}
|
|
332
334
|
declare function useRateHire(taskPda: Parameters<typeof facade.rateHire>[0]["task"]): UseRateHireResult;
|
|
333
335
|
|
|
336
|
+
/**
|
|
337
|
+
* Per-call input for `post` (task auto-bound; the bonding `authority` signer
|
|
338
|
+
* defaults to the client's signer). `role` stays explicit: 1 = worker (the
|
|
339
|
+
* guarantee), 0 = creator.
|
|
340
|
+
*/
|
|
341
|
+
type PostCompletionBondInput = Omit<Parameters<typeof facade.postCompletionBond>[0], "task" | "authority"> & {
|
|
342
|
+
/** Override the bonding authority signer (defaults to the client signer). */
|
|
343
|
+
authority?: Parameters<typeof facade.postCompletionBond>[0]["authority"];
|
|
344
|
+
};
|
|
345
|
+
/**
|
|
346
|
+
* Per-call input for `reclaim` (task auto-bound; `party` — the posting wallet
|
|
347
|
+
* the refund returns to — defaults to the client signer's address). The
|
|
348
|
+
* instruction is a permissionless crank, so any fee payer may run it.
|
|
349
|
+
*/
|
|
350
|
+
type ReclaimCompletionBondInput = Omit<Parameters<typeof facade.reclaimCompletionBond>[0], "task" | "party"> & {
|
|
351
|
+
/** Override the bond's posting wallet (defaults to the client signer). */
|
|
352
|
+
party?: Parameters<typeof facade.reclaimCompletionBond>[0]["party"];
|
|
353
|
+
};
|
|
354
|
+
/** Lifecycle status of a bond verb. */
|
|
355
|
+
type CompletionBondStatus = MutationStatus;
|
|
356
|
+
/** Return value of {@link useCompletionBond}. */
|
|
357
|
+
interface UseCompletionBondResult {
|
|
358
|
+
/** Post a bond. Resolves to the tx signature; rejects with `AgencError`. */
|
|
359
|
+
post: (input: PostCompletionBondInput) => Promise<string>;
|
|
360
|
+
/** Reclaim a settled-but-live bond. Resolves to the tx signature. */
|
|
361
|
+
reclaim: (input: ReclaimCompletionBondInput) => Promise<string>;
|
|
362
|
+
/** Aggregate status: `pending` if either verb is in flight, else last settled. */
|
|
363
|
+
status: CompletionBondStatus;
|
|
364
|
+
/** The most recent error across the two verbs, or null. */
|
|
365
|
+
error: Error | null;
|
|
366
|
+
/** Signature of the last successful action, or null. */
|
|
367
|
+
signature: string | null;
|
|
368
|
+
/** True while either verb is in flight. */
|
|
369
|
+
isPending: boolean;
|
|
370
|
+
/** Reset both mutations to idle. */
|
|
371
|
+
reset: () => void;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Completion-bond actions for one task.
|
|
375
|
+
*
|
|
376
|
+
* @param taskPda - The Task PDA (bound to both verbs).
|
|
377
|
+
* @returns {@link UseCompletionBondResult}.
|
|
378
|
+
*/
|
|
379
|
+
declare function useCompletionBond(taskPda: Parameters<typeof facade.postCompletionBond>[0]["task"]): UseCompletionBondResult;
|
|
380
|
+
|
|
334
381
|
/**
|
|
335
382
|
* The minimal adapter shape this hook bridges. The forthcoming
|
|
336
383
|
* `@tetsuo-ai/signer-adapters` hook is expected to return exactly this shape
|
|
@@ -426,4 +473,4 @@ interface UseReferrerEarningsResult {
|
|
|
426
473
|
*/
|
|
427
474
|
declare function useReferrerEarnings(wallet: Address | string | undefined | null): UseReferrerEarningsResult;
|
|
428
475
|
|
|
429
|
-
export { type AutoAcceptTaskResultInput, type CancelTaskInput, type ClaimTaskInput, type CloseTaskInput, type HumanlessHireFlowActivationInput, type HumanlessHireFlowCreator, type HumanlessHireFlowHireInput, type HumanlessHireFlowHost, type HumanlessHireFlowHostInput, type HumanlessHireFlowInput, type HumanlessHireFlowJobSpecHash, type HumanlessHireFlowModerationResult, type HumanlessHireFlowPhase, type HumanlessHireFlowProgress, type HumanlessHireFlowResult, type HumanlessHireFlowStatus, HumanlessHireInput, type ListingDetail, type ListingRow, type ObservedEvent, QUERY_KEY_ROOT, type RateHireInput, type RateHireStatus, type ReferrerHire, type SubmitTaskResultInput, type TaskActivationInput, type TaskActivationStatus, type TaskEventsSource, type TaskLifecycleStatus, type TaskReader, type TaskWorkStatus, type UseHumanlessHireFlowResult, type UseListingOptions, type UseListingResult, type UseListingsFilter, type UseListingsOptions, type UseListingsResult, type UseRateHireResult, type UseReferrerEarningsResult, type UseTaskActivationResult, type UseTaskLifecycleResult, type UseTaskStatusOptions, type UseTaskStatusResult, type UseTaskWorkResult, type UseWalletSignerOptions, type UseWalletSignerResult, type WalletSignerAdapter, queryKeys, useHumanlessHireFlow, useListing, useListings, useRateHire, useReferrerEarnings, useTaskActivation, useTaskLifecycle, useTaskStatus, useTaskWork, useWalletSigner };
|
|
476
|
+
export { type AutoAcceptTaskResultInput, type CancelTaskInput, type ClaimTaskInput, type CloseTaskInput, type CompletionBondStatus, type HumanlessHireFlowActivationInput, type HumanlessHireFlowCreator, type HumanlessHireFlowHireInput, type HumanlessHireFlowHost, type HumanlessHireFlowHostInput, type HumanlessHireFlowInput, type HumanlessHireFlowJobSpecHash, type HumanlessHireFlowModerationResult, type HumanlessHireFlowPhase, type HumanlessHireFlowProgress, type HumanlessHireFlowResult, type HumanlessHireFlowStatus, HumanlessHireInput, type ListingDetail, type ListingRow, type ObservedEvent, type PostCompletionBondInput, QUERY_KEY_ROOT, type RateHireInput, type RateHireStatus, type ReclaimCompletionBondInput, type ReferrerHire, type SubmitTaskResultInput, type TaskActivationInput, type TaskActivationStatus, type TaskEventsSource, type TaskLifecycleStatus, type TaskReader, type TaskWorkStatus, type UseCompletionBondResult, type UseHumanlessHireFlowResult, type UseListingOptions, type UseListingResult, type UseListingsFilter, type UseListingsOptions, type UseListingsResult, type UseRateHireResult, type UseReferrerEarningsResult, type UseTaskActivationResult, type UseTaskLifecycleResult, type UseTaskStatusOptions, type UseTaskStatusResult, type UseTaskWorkResult, type UseWalletSignerOptions, type UseWalletSignerResult, type WalletSignerAdapter, queryKeys, useCompletionBond, useHumanlessHireFlow, useListing, useListings, useRateHire, useReferrerEarnings, useTaskActivation, useTaskLifecycle, useTaskStatus, useTaskWork, useWalletSigner };
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReadTransportUnsupportedError } from '../chunk-AKPPKMQ2.js';
|
|
2
|
-
import { useAgencContext, queryKeys, pdaKey, requireClient, resolveActivationModerationAccounts, mutationStatusOf, resolveReferrerArgs, withoutReferrerArgs, resolveHireListingModerationAccounts, signerAddress } from '../chunk-
|
|
3
|
-
export { QUERY_KEY_ROOT, queryKeys, useHire, useWalletSigner } from '../chunk-
|
|
2
|
+
import { useAgencContext, queryKeys, pdaKey, requireClient, resolveActivationModerationAccounts, mutationStatusOf, resolveReferrerArgs, withoutReferrerArgs, resolveHireListingModerationAccounts, signerAddress } from '../chunk-XLA7DARS.js';
|
|
3
|
+
export { QUERY_KEY_ROOT, queryKeys, useHire, useTaskGuarantee, useWalletSigner } from '../chunk-XLA7DARS.js';
|
|
4
4
|
import { t } from '../chunk-H6PJIDQR.js';
|
|
5
|
-
import { useQuery, useMutation } from '@tanstack/react-query';
|
|
5
|
+
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
6
6
|
import { useState, useMemo, useCallback, useRef, useEffect } from 'react';
|
|
7
7
|
import { TaskStatus, facade, findTaskPda } from '@tetsuo-ai/marketplace-sdk';
|
|
8
8
|
|
|
@@ -622,6 +622,64 @@ function useDispute(taskPda, options) {
|
|
|
622
622
|
reset: mutation.reset
|
|
623
623
|
};
|
|
624
624
|
}
|
|
625
|
+
function useCompletionBond(taskPda) {
|
|
626
|
+
const ctx = useAgencContext();
|
|
627
|
+
const queryClient = useQueryClient();
|
|
628
|
+
const invalidateGuarantee = useCallback(() => {
|
|
629
|
+
void queryClient.invalidateQueries({
|
|
630
|
+
queryKey: queryKeys.taskGuarantee(pdaKey(taskPda))
|
|
631
|
+
});
|
|
632
|
+
}, [queryClient, taskPda]);
|
|
633
|
+
const postMut = useMutation({
|
|
634
|
+
mutationFn: async (input) => {
|
|
635
|
+
const client = requireClient(ctx.client);
|
|
636
|
+
const { signature } = await client.postCompletionBond({
|
|
637
|
+
...input,
|
|
638
|
+
task: taskPda,
|
|
639
|
+
authority: input.authority ?? client.signer
|
|
640
|
+
});
|
|
641
|
+
invalidateGuarantee();
|
|
642
|
+
return signature;
|
|
643
|
+
}
|
|
644
|
+
});
|
|
645
|
+
const reclaimMut = useMutation({
|
|
646
|
+
mutationFn: async (input) => {
|
|
647
|
+
const client = requireClient(ctx.client);
|
|
648
|
+
const { signature } = await client.reclaimCompletionBond({
|
|
649
|
+
...input,
|
|
650
|
+
task: taskPda,
|
|
651
|
+
party: input.party ?? client.signer.address
|
|
652
|
+
});
|
|
653
|
+
invalidateGuarantee();
|
|
654
|
+
return signature;
|
|
655
|
+
}
|
|
656
|
+
});
|
|
657
|
+
const post = useCallback(
|
|
658
|
+
(input) => postMut.mutateAsync(input),
|
|
659
|
+
[postMut]
|
|
660
|
+
);
|
|
661
|
+
const reclaim = useCallback(
|
|
662
|
+
(input) => reclaimMut.mutateAsync(input),
|
|
663
|
+
[reclaimMut]
|
|
664
|
+
);
|
|
665
|
+
const isPending = postMut.isPending || reclaimMut.isPending;
|
|
666
|
+
const status = isPending ? "pending" : mutationStatusOf(
|
|
667
|
+
// Surface the most recently-touched verb's terminal state.
|
|
668
|
+
[postMut, reclaimMut].find((m) => m.isError || m.isSuccess) ?? postMut
|
|
669
|
+
);
|
|
670
|
+
return {
|
|
671
|
+
post,
|
|
672
|
+
reclaim,
|
|
673
|
+
status,
|
|
674
|
+
error: postMut.error ?? reclaimMut.error ?? null,
|
|
675
|
+
signature: postMut.data ?? reclaimMut.data ?? null,
|
|
676
|
+
isPending,
|
|
677
|
+
reset: () => {
|
|
678
|
+
postMut.reset();
|
|
679
|
+
reclaimMut.reset();
|
|
680
|
+
}
|
|
681
|
+
};
|
|
682
|
+
}
|
|
625
683
|
var EARNINGS_INDEXER_DEFAULTS = {
|
|
626
684
|
mainnet: "https://api.agenc.ag"
|
|
627
685
|
};
|
|
@@ -685,6 +743,6 @@ function useReferrerEarnings(wallet) {
|
|
|
685
743
|
};
|
|
686
744
|
}
|
|
687
745
|
|
|
688
|
-
export { projectTrackRecord, useAgentTrackRecord, useDispute, useHumanlessHireFlow, useListing, useListings, useRateHire, useReferrerEarnings, useSubmissionReview, useTaskActivation, useTaskLifecycle, useTaskStatus, useTaskWork };
|
|
746
|
+
export { projectTrackRecord, useAgentTrackRecord, useCompletionBond, useDispute, useHumanlessHireFlow, useListing, useListings, useRateHire, useReferrerEarnings, useSubmissionReview, useTaskActivation, useTaskLifecycle, useTaskStatus, useTaskWork };
|
|
689
747
|
//# sourceMappingURL=index.js.map
|
|
690
748
|
//# sourceMappingURL=index.js.map
|