@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.
Files changed (37) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/{chunk-BNILOX3O.js → chunk-JVXGNW3Q.js} +35 -4
  3. package/dist/chunk-JVXGNW3Q.js.map +1 -0
  4. package/dist/{chunk-BTAVED7S.js → chunk-XLA7DARS.js} +35 -6
  5. package/dist/chunk-XLA7DARS.js.map +1 -0
  6. package/dist/components/index.cjs +129 -48
  7. package/dist/components/index.cjs.map +1 -1
  8. package/dist/components/index.d.cts +2 -2
  9. package/dist/components/index.d.ts +2 -2
  10. package/dist/components/index.js +2 -2
  11. package/dist/hooks/index.cjs +89 -0
  12. package/dist/hooks/index.cjs.map +1 -1
  13. package/dist/hooks/index.d.cts +50 -3
  14. package/dist/hooks/index.d.ts +50 -3
  15. package/dist/hooks/index.js +62 -4
  16. package/dist/hooks/index.js.map +1 -1
  17. package/dist/{index-DQ3Xovkq.d.ts → index-CmVz0OOm.d.ts} +50 -5
  18. package/dist/{index-UxuvIlmD.d.cts → index-DAZzhuO4.d.cts} +50 -5
  19. package/dist/index.cjs +119 -38
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +3 -3
  22. package/dist/index.d.ts +3 -3
  23. package/dist/index.js +3 -3
  24. package/dist/{useAgentTrackRecord-BCvRHYM2.d.cts → useAgentTrackRecord-DPt3SfYz.d.cts} +39 -2
  25. package/dist/{useAgentTrackRecord-BCvRHYM2.d.ts → useAgentTrackRecord-DPt3SfYz.d.ts} +39 -2
  26. package/package.json +1 -1
  27. package/src/components/GuaranteedBadge.tsx +73 -0
  28. package/src/components/index.ts +4 -0
  29. package/src/components/strings.ts +8 -0
  30. package/src/hooks/index.ts +13 -0
  31. package/src/hooks/internal.ts +3 -0
  32. package/src/hooks/useCompletionBond.ts +156 -0
  33. package/src/hooks/useTaskGuarantee.ts +120 -0
  34. package/src/index.ts +2 -0
  35. package/src/types.ts +5 -2
  36. package/dist/chunk-BNILOX3O.js.map +0 -1
  37. package/dist/chunk-BTAVED7S.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { QueryClient, QueryClientConfig } from '@tanstack/react-query';
2
2
  import * as react from 'react';
3
3
  import { ReactNode } from 'react';
4
- import { A as AgencProviderConfig, a as AgencContextValue, V as ValidatedReferrerConfig, R as ReferrerCapability, b as ReferrerConfig, c as AgencNetwork, C as CreateReadTransportConfig, d as ReadTransport } from './index-UxuvIlmD.cjs';
5
- export { e as AgentVerificationReader, f as AgentVerificationReaderOptions, g as AgentVerificationResult, h as AgentVerificationRpc, B as Badge, i as BadgeProps, j as BadgeTone, k as Button, l as ButtonProps, m as ButtonVariant, n as COMPONENT_CATALOG, o as ComponentStringId, D as DEFAULT_TRUST_HREF, p as DisputeBanner, q as DisputeBannerProps, E as EN_COMPONENT_STRINGS, r as EN_STRINGS, G as GpaReadSource, H as HireButton, s as HireButtonProps, t as HireCheckoutListing, u as HireCheckoutModal, v as HireCheckoutModalProps, I as IndexerConfig, L as ListingCard, w as ListingCardData, x as ListingCardProps, y as ListingGrid, z as ListingGridProps, M as Modal, F as ModalProps, J as ModerationBadge, K as ModerationBadgeProps, N as ModerationState, P as PoweredByAgenC, O as PoweredByAgenCProps, Q as ProviderCard, S as ProviderCardProps, T as ReadListingResult, U as ReferrerDisclosure, W as ReferrerDisclosureProps, X as ReviewPanel, Y as ReviewPanelProps, Z as Spinner, _ as SpinnerProps, $ as StateKind, a0 as StateMessage, a1 as StateMessageProps, a2 as StringCatalog, a3 as StringId, a4 as StringVars, a5 as TaskTimeline, a6 as TaskTimelineProps, a7 as ThemableProps, a8 as TranslateOptions, a9 as UNVERIFIED, aa as UseAgentVerificationOptions, ab as UseAgentVerificationResult, ac as VerifiedBadge, ad as VerifiedBadgeProps, ae as agentVerificationReaderFromRpc, af as cx, ag as decodeListingCategory, ah as decodeListingName, ai as decodeListingTags, aj as elementClass, ak as evaluateAgentVerification, al as formatPriceSol, am as formatRate, an as formatSol, ao as moderationStateOf, ap as rootClass, aq as t, ar as tc, as as toHex, at as truncateAddress, au as useAgentVerification, av as useFocusTrap } from './index-UxuvIlmD.cjs';
4
+ import { A as AgencProviderConfig, a as AgencContextValue, V as ValidatedReferrerConfig, R as ReferrerCapability, b as ReferrerConfig, c as AgencNetwork, C as CreateReadTransportConfig, d as ReadTransport } from './index-DAZzhuO4.cjs';
5
+ export { e as AgentVerificationReader, f as AgentVerificationReaderOptions, g as AgentVerificationResult, h as AgentVerificationRpc, B as Badge, i as BadgeProps, j as BadgeTone, k as Button, l as ButtonProps, m as ButtonVariant, n as COMPONENT_CATALOG, o as ComponentStringId, D as DEFAULT_TRUST_HREF, p as DisputeBanner, q as DisputeBannerProps, E as EN_COMPONENT_STRINGS, r as EN_STRINGS, G as GpaReadSource, s as GuaranteedBadge, t as GuaranteedBadgeProps, H as HireButton, u as HireButtonProps, v as HireCheckoutListing, w as HireCheckoutModal, x as HireCheckoutModalProps, I as IndexerConfig, L as ListingCard, y as ListingCardData, z as ListingCardProps, F as ListingGrid, J as ListingGridProps, M as Modal, K as ModalProps, N as ModerationBadge, O as ModerationBadgeProps, P as ModerationState, Q as PoweredByAgenC, S as PoweredByAgenCProps, T as ProviderCard, U as ProviderCardProps, W as ReadListingResult, X as ReferrerDisclosure, Y as ReferrerDisclosureProps, Z as ReviewPanel, _ as ReviewPanelProps, $ as Spinner, a0 as SpinnerProps, a1 as StateKind, a2 as StateMessage, a3 as StateMessageProps, a4 as StringCatalog, a5 as StringId, a6 as StringVars, a7 as TaskTimeline, a8 as TaskTimelineProps, a9 as ThemableProps, aa as TranslateOptions, ab as UNVERIFIED, ac as UseAgentVerificationOptions, ad as UseAgentVerificationResult, ae as VerifiedBadge, af as VerifiedBadgeProps, ag as agentVerificationReaderFromRpc, ah as cx, ai as decodeListingCategory, aj as decodeListingName, ak as decodeListingTags, al as elementClass, am as evaluateAgentVerification, an as formatPriceSol, ao as formatRate, ap as formatSol, aq as moderationStateOf, ar as rootClass, as as t, at as tc, au as toHex, av as truncateAddress, aw as useAgentVerification, ax as useFocusTrap } from './index-DAZzhuO4.cjs';
6
6
  export { EN_SIGNER_STRINGS, SignerFromWalletAdapterOptions, SignerStringId, VersionedTransactionCtor, VersionedTransactionLike, WalletAdapterLike, signerFromEmbeddedWallet, signerFromWalletAccount, signerFromWalletAdapter } from './signers/index.cjs';
7
7
  export { E as EmbeddedWalletConnection, a as EmbeddedWalletProvider, S as SignerFromWalletAccountOptions, W as WalletStandardAccountLike, b as WalletStandardSignTransaction } from './types-jvISR6bc.cjs';
8
8
  export { Address, TransactionSigner } from '@solana/kit';
9
9
  export { DecodedProgramAccount, IndexerAgentTrackRecord, IndexerHire, IndexerListing, ListActiveListingsOptions, MarketplaceClient, ServiceListing } from '@tetsuo-ai/marketplace-sdk';
10
- import './useAgentTrackRecord-BCvRHYM2.cjs';
10
+ import './useAgentTrackRecord-DPt3SfYz.cjs';
11
11
 
12
12
  /**
13
13
  * `<AgencProvider>` — the one context that wires reads, writes, and the
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { QueryClient, QueryClientConfig } from '@tanstack/react-query';
2
2
  import * as react from 'react';
3
3
  import { ReactNode } from 'react';
4
- import { A as AgencProviderConfig, a as AgencContextValue, V as ValidatedReferrerConfig, R as ReferrerCapability, b as ReferrerConfig, c as AgencNetwork, C as CreateReadTransportConfig, d as ReadTransport } from './index-DQ3Xovkq.js';
5
- export { e as AgentVerificationReader, f as AgentVerificationReaderOptions, g as AgentVerificationResult, h as AgentVerificationRpc, B as Badge, i as BadgeProps, j as BadgeTone, k as Button, l as ButtonProps, m as ButtonVariant, n as COMPONENT_CATALOG, o as ComponentStringId, D as DEFAULT_TRUST_HREF, p as DisputeBanner, q as DisputeBannerProps, E as EN_COMPONENT_STRINGS, r as EN_STRINGS, G as GpaReadSource, H as HireButton, s as HireButtonProps, t as HireCheckoutListing, u as HireCheckoutModal, v as HireCheckoutModalProps, I as IndexerConfig, L as ListingCard, w as ListingCardData, x as ListingCardProps, y as ListingGrid, z as ListingGridProps, M as Modal, F as ModalProps, J as ModerationBadge, K as ModerationBadgeProps, N as ModerationState, P as PoweredByAgenC, O as PoweredByAgenCProps, Q as ProviderCard, S as ProviderCardProps, T as ReadListingResult, U as ReferrerDisclosure, W as ReferrerDisclosureProps, X as ReviewPanel, Y as ReviewPanelProps, Z as Spinner, _ as SpinnerProps, $ as StateKind, a0 as StateMessage, a1 as StateMessageProps, a2 as StringCatalog, a3 as StringId, a4 as StringVars, a5 as TaskTimeline, a6 as TaskTimelineProps, a7 as ThemableProps, a8 as TranslateOptions, a9 as UNVERIFIED, aa as UseAgentVerificationOptions, ab as UseAgentVerificationResult, ac as VerifiedBadge, ad as VerifiedBadgeProps, ae as agentVerificationReaderFromRpc, af as cx, ag as decodeListingCategory, ah as decodeListingName, ai as decodeListingTags, aj as elementClass, ak as evaluateAgentVerification, al as formatPriceSol, am as formatRate, an as formatSol, ao as moderationStateOf, ap as rootClass, aq as t, ar as tc, as as toHex, at as truncateAddress, au as useAgentVerification, av as useFocusTrap } from './index-DQ3Xovkq.js';
4
+ import { A as AgencProviderConfig, a as AgencContextValue, V as ValidatedReferrerConfig, R as ReferrerCapability, b as ReferrerConfig, c as AgencNetwork, C as CreateReadTransportConfig, d as ReadTransport } from './index-CmVz0OOm.js';
5
+ export { e as AgentVerificationReader, f as AgentVerificationReaderOptions, g as AgentVerificationResult, h as AgentVerificationRpc, B as Badge, i as BadgeProps, j as BadgeTone, k as Button, l as ButtonProps, m as ButtonVariant, n as COMPONENT_CATALOG, o as ComponentStringId, D as DEFAULT_TRUST_HREF, p as DisputeBanner, q as DisputeBannerProps, E as EN_COMPONENT_STRINGS, r as EN_STRINGS, G as GpaReadSource, s as GuaranteedBadge, t as GuaranteedBadgeProps, H as HireButton, u as HireButtonProps, v as HireCheckoutListing, w as HireCheckoutModal, x as HireCheckoutModalProps, I as IndexerConfig, L as ListingCard, y as ListingCardData, z as ListingCardProps, F as ListingGrid, J as ListingGridProps, M as Modal, K as ModalProps, N as ModerationBadge, O as ModerationBadgeProps, P as ModerationState, Q as PoweredByAgenC, S as PoweredByAgenCProps, T as ProviderCard, U as ProviderCardProps, W as ReadListingResult, X as ReferrerDisclosure, Y as ReferrerDisclosureProps, Z as ReviewPanel, _ as ReviewPanelProps, $ as Spinner, a0 as SpinnerProps, a1 as StateKind, a2 as StateMessage, a3 as StateMessageProps, a4 as StringCatalog, a5 as StringId, a6 as StringVars, a7 as TaskTimeline, a8 as TaskTimelineProps, a9 as ThemableProps, aa as TranslateOptions, ab as UNVERIFIED, ac as UseAgentVerificationOptions, ad as UseAgentVerificationResult, ae as VerifiedBadge, af as VerifiedBadgeProps, ag as agentVerificationReaderFromRpc, ah as cx, ai as decodeListingCategory, aj as decodeListingName, ak as decodeListingTags, al as elementClass, am as evaluateAgentVerification, an as formatPriceSol, ao as formatRate, ap as formatSol, aq as moderationStateOf, ar as rootClass, as as t, at as tc, au as toHex, av as truncateAddress, aw as useAgentVerification, ax as useFocusTrap } from './index-CmVz0OOm.js';
6
6
  export { EN_SIGNER_STRINGS, SignerFromWalletAdapterOptions, SignerStringId, VersionedTransactionCtor, VersionedTransactionLike, WalletAdapterLike, signerFromEmbeddedWallet, signerFromWalletAccount, signerFromWalletAdapter } from './signers/index.js';
7
7
  export { E as EmbeddedWalletConnection, a as EmbeddedWalletProvider, S as SignerFromWalletAccountOptions, W as WalletStandardAccountLike, b as WalletStandardSignTransaction } from './types-jvISR6bc.js';
8
8
  export { Address, TransactionSigner } from '@solana/kit';
9
9
  export { DecodedProgramAccount, IndexerAgentTrackRecord, IndexerHire, IndexerListing, ListActiveListingsOptions, MarketplaceClient, ServiceListing } from '@tetsuo-ai/marketplace-sdk';
10
- import './useAgentTrackRecord-BCvRHYM2.js';
10
+ import './useAgentTrackRecord-DPt3SfYz.js';
11
11
 
12
12
  /**
13
13
  * `<AgencProvider>` — the one context that wires reads, writes, and the
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { createReadTransport } from './chunk-AKPPKMQ2.js';
2
2
  export { ReadTransportUnsupportedError, createReadTransport } from './chunk-AKPPKMQ2.js';
3
3
  export { EN_SIGNER_STRINGS, signerFromEmbeddedWallet, signerFromWalletAccount, signerFromWalletAdapter } from './chunk-ON6XR4XO.js';
4
- export { AGENC_THEME_CLASS, AGENC_TOKENS_CSS_PATH, Badge, Button, COMPONENT_CATALOG, DEFAULT_TRUST_HREF, DisputeBanner, EN_COMPONENT_STRINGS, HireButton, HireCheckoutModal, ListingCard, ListingGrid, Modal, ModerationBadge, PoweredByAgenC, ProviderCard, ReferrerDisclosure, ReviewPanel, Spinner, StateMessage, TaskTimeline, UNVERIFIED, VerifiedBadge, agencThemeStyleTag, agentVerificationReaderFromRpc, cx, decodeListingCategory, decodeListingName, decodeListingTags, elementClass, evaluateAgentVerification, formatPriceSol, formatRate, formatSol, moderationStateOf, resolveThemeClassName, rootClass, tc, toHex, truncateAddress, useAgentVerification, useFocusTrap } from './chunk-BNILOX3O.js';
5
- import { AgencContext } from './chunk-BTAVED7S.js';
6
- export { AgencContext, useAgencContext } from './chunk-BTAVED7S.js';
4
+ export { AGENC_THEME_CLASS, AGENC_TOKENS_CSS_PATH, Badge, Button, COMPONENT_CATALOG, DEFAULT_TRUST_HREF, DisputeBanner, EN_COMPONENT_STRINGS, GuaranteedBadge, HireButton, HireCheckoutModal, ListingCard, ListingGrid, Modal, ModerationBadge, PoweredByAgenC, ProviderCard, ReferrerDisclosure, ReviewPanel, Spinner, StateMessage, TaskTimeline, UNVERIFIED, VerifiedBadge, agencThemeStyleTag, agentVerificationReaderFromRpc, cx, decodeListingCategory, decodeListingName, decodeListingTags, elementClass, evaluateAgentVerification, formatPriceSol, formatRate, formatSol, moderationStateOf, resolveThemeClassName, rootClass, tc, toHex, truncateAddress, useAgentVerification, useFocusTrap } from './chunk-JVXGNW3Q.js';
5
+ import { AgencContext } from './chunk-XLA7DARS.js';
6
+ export { AgencContext, useAgencContext } from './chunk-XLA7DARS.js';
7
7
  import { t } from './chunk-H6PJIDQR.js';
8
8
  export { EN_STRINGS, t } from './chunk-H6PJIDQR.js';
9
9
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
@@ -1,6 +1,43 @@
1
- import { facade, Dispute, IndexerAgentTrackRecord } from '@tetsuo-ai/marketplace-sdk';
1
+ import { TaskGuarantee, facade, Dispute, IndexerAgentTrackRecord } from '@tetsuo-ai/marketplace-sdk';
2
2
  import { Address } from '@solana/kit';
3
3
 
4
+ /** Reads a task's {@link TaskGuarantee} (the SDK `fetchTaskGuarantee` shape). */
5
+ type TaskGuaranteeReader = (taskPda: Address | string) => Promise<TaskGuarantee>;
6
+ /** Options for {@link useTaskGuarantee}. */
7
+ interface UseTaskGuaranteeOptions {
8
+ /**
9
+ * Injected reader seam (wins over the provider `rpcUrl` default). Wire it
10
+ * from litesvm/gpa-sim in tests or from your own transport.
11
+ */
12
+ guaranteeReader?: TaskGuaranteeReader;
13
+ /** Disable the read. Default `true` when `taskPda` + a read source exist. */
14
+ enabled?: boolean;
15
+ }
16
+ /** Return value of {@link useTaskGuarantee}. */
17
+ interface UseTaskGuaranteeResult {
18
+ /** The full bond state (worker/creator bonds + flag), or null until read. */
19
+ guarantee: TaskGuarantee | null;
20
+ /**
21
+ * Convenience: `guarantee?.guaranteed ?? false` — `true` iff the worker
22
+ * bond is live (posted and unresolved).
23
+ */
24
+ guaranteed: boolean;
25
+ /** True while the first read is in flight. */
26
+ isLoading: boolean;
27
+ /** The read error, or null. */
28
+ error: Error | null;
29
+ /** Force a refetch (e.g. after posting/reclaiming a bond). */
30
+ refetch: () => void;
31
+ }
32
+ /**
33
+ * Read a task's Guaranteed Hire state.
34
+ *
35
+ * @param taskPda - The Task PDA (falsy disables the read).
36
+ * @param options - Reader seam + enabled.
37
+ * @returns {@link UseTaskGuaranteeResult}.
38
+ */
39
+ declare function useTaskGuarantee(taskPda: Address | string | undefined | null, options?: UseTaskGuaranteeOptions): UseTaskGuaranteeResult;
40
+
4
41
  /**
5
42
  * Input to a standard `hire(...)` — a buyer that has a registered marketplace
6
43
  * agent (`creatorAgent`). This task settles on the HIRE COMPLETION path (the
@@ -246,4 +283,4 @@ declare function projectTrackRecord(raw: IndexerAgentTrackRecord): AgentTrackRec
246
283
  */
247
284
  declare function useAgentTrackRecord(agentPda: Address | string | undefined | null, options?: UseAgentTrackRecordOptions): UseAgentTrackRecordResult;
248
285
 
249
- export { type AcceptInput as A, type DisputeReader as D, type HumanlessHireInput as H, type InitiateDisputeInput as I, type RejectInput as R, type TrackRecordOutcome as T, type UseAgentTrackRecordOptions as U, type AgentTrackRecord as a, type AnyHireInput as b, type DisputeStatus as c, type HireInput as d, type HireResult as e, type HireStatus as f, type RequestChangesInput as g, type ReviewAction as h, type ReviewStatus as i, type UseAgentTrackRecordResult as j, type UseDisputeOptions as k, type UseDisputeResult as l, type UseHireResult as m, type UseSubmissionReviewResult as n, useDispute as o, projectTrackRecord as p, useHire as q, useSubmissionReview as r, useAgentTrackRecord as u };
286
+ export { type AcceptInput as A, type DisputeReader as D, type HumanlessHireInput as H, type InitiateDisputeInput as I, type RejectInput as R, type TaskGuaranteeReader as T, type UseAgentTrackRecordOptions as U, type AgentTrackRecord as a, type AnyHireInput as b, type DisputeStatus as c, type HireInput as d, type HireResult as e, type HireStatus as f, type RequestChangesInput as g, type ReviewAction as h, type ReviewStatus as i, type TrackRecordOutcome as j, type UseAgentTrackRecordResult as k, type UseDisputeOptions as l, type UseDisputeResult as m, type UseHireResult as n, type UseSubmissionReviewResult as o, type UseTaskGuaranteeOptions as p, type UseTaskGuaranteeResult as q, projectTrackRecord as r, useDispute as s, useHire as t, useAgentTrackRecord as u, useSubmissionReview as v, useTaskGuarantee as w };
@@ -1,6 +1,43 @@
1
- import { facade, Dispute, IndexerAgentTrackRecord } from '@tetsuo-ai/marketplace-sdk';
1
+ import { TaskGuarantee, facade, Dispute, IndexerAgentTrackRecord } from '@tetsuo-ai/marketplace-sdk';
2
2
  import { Address } from '@solana/kit';
3
3
 
4
+ /** Reads a task's {@link TaskGuarantee} (the SDK `fetchTaskGuarantee` shape). */
5
+ type TaskGuaranteeReader = (taskPda: Address | string) => Promise<TaskGuarantee>;
6
+ /** Options for {@link useTaskGuarantee}. */
7
+ interface UseTaskGuaranteeOptions {
8
+ /**
9
+ * Injected reader seam (wins over the provider `rpcUrl` default). Wire it
10
+ * from litesvm/gpa-sim in tests or from your own transport.
11
+ */
12
+ guaranteeReader?: TaskGuaranteeReader;
13
+ /** Disable the read. Default `true` when `taskPda` + a read source exist. */
14
+ enabled?: boolean;
15
+ }
16
+ /** Return value of {@link useTaskGuarantee}. */
17
+ interface UseTaskGuaranteeResult {
18
+ /** The full bond state (worker/creator bonds + flag), or null until read. */
19
+ guarantee: TaskGuarantee | null;
20
+ /**
21
+ * Convenience: `guarantee?.guaranteed ?? false` — `true` iff the worker
22
+ * bond is live (posted and unresolved).
23
+ */
24
+ guaranteed: boolean;
25
+ /** True while the first read is in flight. */
26
+ isLoading: boolean;
27
+ /** The read error, or null. */
28
+ error: Error | null;
29
+ /** Force a refetch (e.g. after posting/reclaiming a bond). */
30
+ refetch: () => void;
31
+ }
32
+ /**
33
+ * Read a task's Guaranteed Hire state.
34
+ *
35
+ * @param taskPda - The Task PDA (falsy disables the read).
36
+ * @param options - Reader seam + enabled.
37
+ * @returns {@link UseTaskGuaranteeResult}.
38
+ */
39
+ declare function useTaskGuarantee(taskPda: Address | string | undefined | null, options?: UseTaskGuaranteeOptions): UseTaskGuaranteeResult;
40
+
4
41
  /**
5
42
  * Input to a standard `hire(...)` — a buyer that has a registered marketplace
6
43
  * agent (`creatorAgent`). This task settles on the HIRE COMPLETION path (the
@@ -246,4 +283,4 @@ declare function projectTrackRecord(raw: IndexerAgentTrackRecord): AgentTrackRec
246
283
  */
247
284
  declare function useAgentTrackRecord(agentPda: Address | string | undefined | null, options?: UseAgentTrackRecordOptions): UseAgentTrackRecordResult;
248
285
 
249
- export { type AcceptInput as A, type DisputeReader as D, type HumanlessHireInput as H, type InitiateDisputeInput as I, type RejectInput as R, type TrackRecordOutcome as T, type UseAgentTrackRecordOptions as U, type AgentTrackRecord as a, type AnyHireInput as b, type DisputeStatus as c, type HireInput as d, type HireResult as e, type HireStatus as f, type RequestChangesInput as g, type ReviewAction as h, type ReviewStatus as i, type UseAgentTrackRecordResult as j, type UseDisputeOptions as k, type UseDisputeResult as l, type UseHireResult as m, type UseSubmissionReviewResult as n, useDispute as o, projectTrackRecord as p, useHire as q, useSubmissionReview as r, useAgentTrackRecord as u };
286
+ export { type AcceptInput as A, type DisputeReader as D, type HumanlessHireInput as H, type InitiateDisputeInput as I, type RejectInput as R, type TaskGuaranteeReader as T, type UseAgentTrackRecordOptions as U, type AgentTrackRecord as a, type AnyHireInput as b, type DisputeStatus as c, type HireInput as d, type HireResult as e, type HireStatus as f, type RequestChangesInput as g, type ReviewAction as h, type ReviewStatus as i, type TrackRecordOutcome as j, type UseAgentTrackRecordResult as k, type UseDisputeOptions as l, type UseDisputeResult as m, type UseHireResult as n, type UseSubmissionReviewResult as o, type UseTaskGuaranteeOptions as p, type UseTaskGuaranteeResult as q, projectTrackRecord as r, useDispute as s, useHire as t, useAgentTrackRecord as u, useSubmissionReview as v, useTaskGuarantee as w };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tetsuo-ai/marketplace-react",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Headless React hooks + themable components for the AgenC marketplace — provider, indexer-first read transport, and live referrer config",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -0,0 +1,73 @@
1
+ /**
2
+ * `<GuaranteedBadge task={...} />` — the Guaranteed Hire badge (WP-H3).
3
+ *
4
+ * Renders NOTHING unless the task is guaranteed (a live worker completion
5
+ * bond: the worker staked 25% of the reward on passing review). When it is,
6
+ * shows a small success-tone badge with plain-English copy; the full detail
7
+ * sentence rides on `title`/`aria-label`.
8
+ *
9
+ * Connected by default: given `task`, it reads through {@link useTaskGuarantee}
10
+ * (provider `rpcUrl` gPA read, or the `guaranteeReader` seam). Pass a
11
+ * pre-resolved `guarantee` to use it presentationally (no read at all) — an
12
+ * explicit `guarantee` (including `null`) wins over the `task` read.
13
+ *
14
+ * HONEST BOUNDARY (phase 1): the copy says the buyer is refunded and the
15
+ * worker FORFEITS the bond — it deliberately does NOT promise the buyer the
16
+ * bond itself, because a forfeited bond pays the protocol treasury until
17
+ * phase 2 redirects it to the harmed party. Keep host copy within that line.
18
+ *
19
+ * @module components/GuaranteedBadge
20
+ */
21
+ import type { ReactNode } from "react";
22
+ import type { TaskGuarantee } from "@tetsuo-ai/marketplace-sdk";
23
+ import {
24
+ useTaskGuarantee,
25
+ type TaskGuaranteeReader,
26
+ } from "../hooks/useTaskGuarantee.js";
27
+ import type { Address } from "../types.js";
28
+ import { tc } from "./format.js";
29
+ import { Badge, type ThemableProps } from "./primitives.js";
30
+
31
+ /** Props for {@link GuaranteedBadge}. */
32
+ export interface GuaranteedBadgeProps extends ThemableProps {
33
+ /** The Task PDA to read the guarantee for (connected mode). */
34
+ task?: Address | string | null;
35
+ /**
36
+ * Pre-resolved guarantee state (presentational mode — overrides the `task`
37
+ * read entirely; pass `null` for a known-unguaranteed task).
38
+ */
39
+ guarantee?: TaskGuarantee | null;
40
+ /** Injected reader seam forwarded to {@link useTaskGuarantee} (tests/litesvm). */
41
+ guaranteeReader?: TaskGuaranteeReader;
42
+ }
43
+
44
+ /**
45
+ * Show that a task's result is backed by the worker's 25% completion bond.
46
+ * Renders nothing while loading, on read errors, and for unguaranteed tasks —
47
+ * the badge only ever ASSERTS a live guarantee, never its absence.
48
+ */
49
+ export function GuaranteedBadge({
50
+ task,
51
+ guarantee,
52
+ guaranteeReader,
53
+ unstyled,
54
+ className,
55
+ }: GuaranteedBadgeProps): ReactNode {
56
+ const overridden = guarantee !== undefined;
57
+ const read = useTaskGuarantee(overridden ? null : task, {
58
+ guaranteeReader,
59
+ enabled: !overridden,
60
+ });
61
+ const resolved = overridden ? guarantee : read.guarantee;
62
+ if (!resolved?.guaranteed) return null;
63
+ return (
64
+ <Badge
65
+ tone="success"
66
+ unstyled={unstyled}
67
+ className={className}
68
+ label={tc("components.guarantee.detail")}
69
+ >
70
+ {tc("components.guarantee.badge")}
71
+ </Badge>
72
+ );
73
+ }
@@ -45,6 +45,10 @@ export {
45
45
  type ModerationState,
46
46
  type VerifiedBadgeProps,
47
47
  } from "./badges.js";
48
+ export {
49
+ GuaranteedBadge,
50
+ type GuaranteedBadgeProps,
51
+ } from "./GuaranteedBadge.js";
48
52
 
49
53
  // Presentational formatting helpers + the component string resolver.
50
54
  export {
@@ -120,6 +120,14 @@ export const EN_COMPONENT_STRINGS = {
120
120
  "components.provider.claimedDomainLabel":
121
121
  "Claimed domain {domain} (not verified on-chain)",
122
122
 
123
+ // GuaranteedBadge (WP-H3 Guaranteed Hire). The detail copy is deliberately
124
+ // phase-1-honest: the buyer is refunded (escrow) and the worker FORFEITS the
125
+ // bond — it does NOT say the buyer receives the bond, because a forfeited
126
+ // bond pays the protocol treasury until phase 2 redirects it.
127
+ "components.guarantee.badge": "Guaranteed — worker has 25% at stake",
128
+ "components.guarantee.detail":
129
+ "Worker has 25% at stake — if the result fails review you're refunded and the worker forfeits the bond.",
130
+
123
131
  // PoweredByAgenC.
124
132
  "components.poweredBy.label": "Powered by AgenC",
125
133
  "components.poweredBy.trustLink": "Learn how this works",
@@ -42,6 +42,12 @@ export {
42
42
  type UseTaskStatusOptions,
43
43
  type UseTaskStatusResult,
44
44
  } from "./useTaskStatus.js";
45
+ export {
46
+ useTaskGuarantee,
47
+ type TaskGuaranteeReader,
48
+ type UseTaskGuaranteeOptions,
49
+ type UseTaskGuaranteeResult,
50
+ } from "./useTaskGuarantee.js";
45
51
 
46
52
  // Writes
47
53
  export {
@@ -113,6 +119,13 @@ export {
113
119
  type UseDisputeOptions,
114
120
  type UseDisputeResult,
115
121
  } from "./useDispute.js";
122
+ export {
123
+ useCompletionBond,
124
+ type CompletionBondStatus,
125
+ type PostCompletionBondInput,
126
+ type ReclaimCompletionBondInput,
127
+ type UseCompletionBondResult,
128
+ } from "./useCompletionBond.js";
116
129
 
117
130
  // Wallet bridge
118
131
  export {
@@ -45,6 +45,9 @@ export const queryKeys = {
45
45
  [QUERY_KEY_ROOT, "taskStatus", taskPda] as const,
46
46
  /** One task's dispute record. */
47
47
  dispute: (taskPda: string) => [QUERY_KEY_ROOT, "dispute", taskPda] as const,
48
+ /** One task's completion-bond ("Guaranteed Hire") state. */
49
+ taskGuarantee: (taskPda: string) =>
50
+ [QUERY_KEY_ROOT, "taskGuarantee", taskPda] as const,
48
51
  /** One referrer wallet's earnings (indexer-gated; see useReferrerEarnings). */
49
52
  referrerEarnings: (wallet: string) =>
50
53
  [QUERY_KEY_ROOT, "referrerEarnings", wallet] as const,
@@ -0,0 +1,156 @@
1
+ /**
2
+ * `useCompletionBond(taskPda)` — the completion-bond ("Guaranteed Hire")
3
+ * mutations for one task.
4
+ *
5
+ * Two verbs over the write client, each its own mutation (independent
6
+ * pending/error per button, like `useSubmissionReview`):
7
+ * - `post(...)` — post a completion bond (`client.postCompletionBond`). The
8
+ * bond PDA is auto-derived from (task, signing wallet); size is fixed
9
+ * on-chain at 25% of the reward (`BOND_BPS`), SOL-only in v1. A worker
10
+ * posting the role-1 bond is what makes the task read as GUARANTEED.
11
+ * - `reclaim(...)` — the recovery crank (`client.reclaimCompletionBond`) for a
12
+ * bond a settlement left live; refunds to the recorded posting wallet.
13
+ *
14
+ * A successful verb invalidates the task's `useTaskGuarantee` cache entry so
15
+ * badges refresh without manual wiring. Typed `AgencError`s surface UNTOUCHED.
16
+ *
17
+ * HONEST BOUNDARY (phase 1 — do not overclaim in UI copy): a FORFEITED bond
18
+ * pays the protocol **treasury**, not the harmed party; the buyer's protection
19
+ * is the escrow refund plus the worker's skin in the game. Phase 2 (batch-2
20
+ * program work) redirects forfeiture to the harmed party.
21
+ *
22
+ * @module hooks/useCompletionBond
23
+ */
24
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
25
+ import { useCallback } from "react";
26
+ import type { facade as facadeNs } from "@tetsuo-ai/marketplace-sdk";
27
+ import { useAgencContext } from "../provider/context.js";
28
+ import {
29
+ mutationStatusOf,
30
+ pdaKey,
31
+ queryKeys,
32
+ requireClient,
33
+ type MutationStatus,
34
+ } from "./internal.js";
35
+
36
+ /**
37
+ * Per-call input for `post` (task auto-bound; the bonding `authority` signer
38
+ * defaults to the client's signer). `role` stays explicit: 1 = worker (the
39
+ * guarantee), 0 = creator.
40
+ */
41
+ export type PostCompletionBondInput = Omit<
42
+ Parameters<typeof facadeNs.postCompletionBond>[0],
43
+ "task" | "authority"
44
+ > & {
45
+ /** Override the bonding authority signer (defaults to the client signer). */
46
+ authority?: Parameters<typeof facadeNs.postCompletionBond>[0]["authority"];
47
+ };
48
+
49
+ /**
50
+ * Per-call input for `reclaim` (task auto-bound; `party` — the posting wallet
51
+ * the refund returns to — defaults to the client signer's address). The
52
+ * instruction is a permissionless crank, so any fee payer may run it.
53
+ */
54
+ export type ReclaimCompletionBondInput = Omit<
55
+ Parameters<typeof facadeNs.reclaimCompletionBond>[0],
56
+ "task" | "party"
57
+ > & {
58
+ /** Override the bond's posting wallet (defaults to the client signer). */
59
+ party?: Parameters<typeof facadeNs.reclaimCompletionBond>[0]["party"];
60
+ };
61
+
62
+ /** Lifecycle status of a bond verb. */
63
+ export type CompletionBondStatus = MutationStatus;
64
+
65
+ /** Return value of {@link useCompletionBond}. */
66
+ export interface UseCompletionBondResult {
67
+ /** Post a bond. Resolves to the tx signature; rejects with `AgencError`. */
68
+ post: (input: PostCompletionBondInput) => Promise<string>;
69
+ /** Reclaim a settled-but-live bond. Resolves to the tx signature. */
70
+ reclaim: (input: ReclaimCompletionBondInput) => Promise<string>;
71
+ /** Aggregate status: `pending` if either verb is in flight, else last settled. */
72
+ status: CompletionBondStatus;
73
+ /** The most recent error across the two verbs, or null. */
74
+ error: Error | null;
75
+ /** Signature of the last successful action, or null. */
76
+ signature: string | null;
77
+ /** True while either verb is in flight. */
78
+ isPending: boolean;
79
+ /** Reset both mutations to idle. */
80
+ reset: () => void;
81
+ }
82
+
83
+ /**
84
+ * Completion-bond actions for one task.
85
+ *
86
+ * @param taskPda - The Task PDA (bound to both verbs).
87
+ * @returns {@link UseCompletionBondResult}.
88
+ */
89
+ export function useCompletionBond(
90
+ taskPda: Parameters<typeof facadeNs.postCompletionBond>[0]["task"],
91
+ ): UseCompletionBondResult {
92
+ const ctx = useAgencContext();
93
+ const queryClient = useQueryClient();
94
+
95
+ const invalidateGuarantee = useCallback(() => {
96
+ void queryClient.invalidateQueries({
97
+ queryKey: queryKeys.taskGuarantee(pdaKey(taskPda)),
98
+ });
99
+ }, [queryClient, taskPda]);
100
+
101
+ const postMut = useMutation<string, Error, PostCompletionBondInput>({
102
+ mutationFn: async (input) => {
103
+ const client = requireClient(ctx.client);
104
+ const { signature } = await client.postCompletionBond({
105
+ ...input,
106
+ task: taskPda,
107
+ authority: input.authority ?? client.signer,
108
+ } as Parameters<typeof facadeNs.postCompletionBond>[0]);
109
+ invalidateGuarantee();
110
+ return signature;
111
+ },
112
+ });
113
+
114
+ const reclaimMut = useMutation<string, Error, ReclaimCompletionBondInput>({
115
+ mutationFn: async (input) => {
116
+ const client = requireClient(ctx.client);
117
+ const { signature } = await client.reclaimCompletionBond({
118
+ ...input,
119
+ task: taskPda,
120
+ party: input.party ?? client.signer.address,
121
+ } as Parameters<typeof facadeNs.reclaimCompletionBond>[0]);
122
+ invalidateGuarantee();
123
+ return signature;
124
+ },
125
+ });
126
+
127
+ const post = useCallback(
128
+ (input: PostCompletionBondInput) => postMut.mutateAsync(input),
129
+ [postMut],
130
+ );
131
+ const reclaim = useCallback(
132
+ (input: ReclaimCompletionBondInput) => reclaimMut.mutateAsync(input),
133
+ [reclaimMut],
134
+ );
135
+
136
+ const isPending = postMut.isPending || reclaimMut.isPending;
137
+ const status: CompletionBondStatus = isPending
138
+ ? "pending"
139
+ : mutationStatusOf(
140
+ // Surface the most recently-touched verb's terminal state.
141
+ [postMut, reclaimMut].find((m) => m.isError || m.isSuccess) ?? postMut,
142
+ );
143
+
144
+ return {
145
+ post,
146
+ reclaim,
147
+ status,
148
+ error: postMut.error ?? reclaimMut.error ?? null,
149
+ signature: postMut.data ?? reclaimMut.data ?? null,
150
+ isPending,
151
+ reset: () => {
152
+ postMut.reset();
153
+ reclaimMut.reset();
154
+ },
155
+ };
156
+ }
@@ -0,0 +1,120 @@
1
+ /**
2
+ * `useTaskGuarantee(taskPda)` — a task's completion-bond ("Guaranteed Hire")
3
+ * state, read-only.
4
+ *
5
+ * Guaranteed Hire is the productized read of the LIVE completion-bond
6
+ * machinery: a worker who posts a completion bond stakes 25% of the reward on
7
+ * passing review, and forfeits it if the result is rejected or they lose a
8
+ * dispute. `guaranteed` is `true` iff the worker bond is posted and unresolved
9
+ * (bond PDAs are closed by every settlement exit, so live == unresolved).
10
+ *
11
+ * HONEST BOUNDARY (phase 1 — do not overclaim in UI copy): a FORFEITED bond
12
+ * pays the protocol **treasury**, not the harmed party. The buyer's protection
13
+ * today is the escrow refund on a failed review PLUS the worker's 25% skin in
14
+ * the game — the buyer does not receive the bond itself. Phase 2 (batch-2
15
+ * program work) redirects forfeiture to the harmed party.
16
+ *
17
+ * ## How it reads
18
+ *
19
+ * The bond accounts are keyed by (task, posting wallet) and the worker's
20
+ * wallet is not derivable from the Task account alone, so this is a
21
+ * `getProgramAccounts` read (`CompletionBond.task` memcmp) — the SDK's
22
+ * `fetchTaskGuarantee`. Resolution order:
23
+ * 1. `options.guaranteeReader` — an injected reader seam (tests, litesvm,
24
+ * custom transports; same pattern as `useTaskStatus`/`useDispute`);
25
+ * 2. the provider's resolved `rpcUrl` — a kit RPC is built for the read. NOTE:
26
+ * the RPC must allow `getProgramAccounts` (many public providers restrict
27
+ * it); a rejection surfaces in `error`, never a crash.
28
+ * Without either, the hook stays idle.
29
+ *
30
+ * @module hooks/useTaskGuarantee
31
+ */
32
+ import { useQuery } from "@tanstack/react-query";
33
+ import { useMemo } from "react";
34
+ import { createSolanaRpc } from "@solana/kit";
35
+ import {
36
+ fetchTaskGuarantee,
37
+ type ProgramAccountsSource,
38
+ type TaskGuarantee,
39
+ } from "@tetsuo-ai/marketplace-sdk";
40
+ import { useAgencContext } from "../provider/context.js";
41
+ import type { Address } from "../types.js";
42
+ import { pdaKey, queryKeys } from "./internal.js";
43
+
44
+ /** Reads a task's {@link TaskGuarantee} (the SDK `fetchTaskGuarantee` shape). */
45
+ export type TaskGuaranteeReader = (
46
+ taskPda: Address | string,
47
+ ) => Promise<TaskGuarantee>;
48
+
49
+ /** Options for {@link useTaskGuarantee}. */
50
+ export interface UseTaskGuaranteeOptions {
51
+ /**
52
+ * Injected reader seam (wins over the provider `rpcUrl` default). Wire it
53
+ * from litesvm/gpa-sim in tests or from your own transport.
54
+ */
55
+ guaranteeReader?: TaskGuaranteeReader;
56
+ /** Disable the read. Default `true` when `taskPda` + a read source exist. */
57
+ enabled?: boolean;
58
+ }
59
+
60
+ /** Return value of {@link useTaskGuarantee}. */
61
+ export interface UseTaskGuaranteeResult {
62
+ /** The full bond state (worker/creator bonds + flag), or null until read. */
63
+ guarantee: TaskGuarantee | null;
64
+ /**
65
+ * Convenience: `guarantee?.guaranteed ?? false` — `true` iff the worker
66
+ * bond is live (posted and unresolved).
67
+ */
68
+ guaranteed: boolean;
69
+ /** True while the first read is in flight. */
70
+ isLoading: boolean;
71
+ /** The read error, or null. */
72
+ error: Error | null;
73
+ /** Force a refetch (e.g. after posting/reclaiming a bond). */
74
+ refetch: () => void;
75
+ }
76
+
77
+ /**
78
+ * Read a task's Guaranteed Hire state.
79
+ *
80
+ * @param taskPda - The Task PDA (falsy disables the read).
81
+ * @param options - Reader seam + enabled.
82
+ * @returns {@link UseTaskGuaranteeResult}.
83
+ */
84
+ export function useTaskGuarantee(
85
+ taskPda: Address | string | undefined | null,
86
+ options?: UseTaskGuaranteeOptions,
87
+ ): UseTaskGuaranteeResult {
88
+ const ctx = useAgencContext();
89
+ const injected = options?.guaranteeReader;
90
+ const rpcUrl = ctx.rpcUrl;
91
+
92
+ // Injected seam wins; else build a gPA read over the provider's rpcUrl.
93
+ const reader = useMemo<TaskGuaranteeReader | null>(() => {
94
+ if (injected) return injected;
95
+ if (!rpcUrl) return null;
96
+ return (pda) =>
97
+ fetchTaskGuarantee(
98
+ createSolanaRpc(rpcUrl) as unknown as ProgramAccountsSource,
99
+ pda as Address,
100
+ );
101
+ }, [injected, rpcUrl]);
102
+
103
+ const enabled =
104
+ (options?.enabled ?? true) && Boolean(taskPda) && reader !== null;
105
+
106
+ const query = useQuery<TaskGuarantee, Error>({
107
+ queryKey: queryKeys.taskGuarantee(taskPda ? pdaKey(taskPda) : ""),
108
+ enabled,
109
+ queryFn: () => reader!(taskPda as Address | string),
110
+ });
111
+
112
+ const guarantee = query.data ?? null;
113
+ return {
114
+ guarantee,
115
+ guaranteed: guarantee?.guaranteed ?? false,
116
+ isLoading: query.isLoading,
117
+ error: query.error ?? null,
118
+ refetch: () => void query.refetch(),
119
+ };
120
+ }
package/src/index.ts CHANGED
@@ -88,6 +88,7 @@ export {
88
88
  Button,
89
89
  DEFAULT_TRUST_HREF,
90
90
  DisputeBanner,
91
+ GuaranteedBadge,
91
92
  HireButton,
92
93
  HireCheckoutModal,
93
94
  ListingCard,
@@ -132,6 +133,7 @@ export {
132
133
  type ButtonVariant,
133
134
  type ComponentStringId,
134
135
  type DisputeBannerProps,
136
+ type GuaranteedBadgeProps,
135
137
  type HireButtonProps,
136
138
  type HireCheckoutListing,
137
139
  type HireCheckoutModalProps,
package/src/types.ts CHANGED
@@ -200,9 +200,12 @@ export interface AgencContextValue {
200
200
  client: MarketplaceClient | null;
201
201
  /**
202
202
  * The resolved HTTP RPC endpoint (config override or the network default),
203
- * or `null` when none resolves. Hooks use it for single-account reads —
203
+ * or `null` when none resolves. Hooks use it for targeted per-task reads —
204
204
  * e.g. resolving the WP-A1 `moderation_attestor` roster account during
205
- * activation. NOT a gPA/list-query source; the read transport owns those.
205
+ * activation, and the `useTaskGuarantee` completion-bond read (a
206
+ * task-scoped `getProgramAccounts` with no single-account equivalent; the
207
+ * RPC must allow gPA, and an injected reader seam bypasses it). LIST
208
+ * queries stay with the read transport.
206
209
  */
207
210
  rpcUrl: string | null;
208
211
  /**