@tetsuo-ai/marketplace-react 0.1.1 → 0.3.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 (58) hide show
  1. package/CHANGELOG.md +33 -3
  2. package/README.md +50 -20
  3. package/dist/{chunk-ABS77JB2.js → chunk-D2TDU3TJ.js} +3 -3
  4. package/dist/{chunk-ABS77JB2.js.map → chunk-D2TDU3TJ.js.map} +1 -1
  5. package/dist/{chunk-GN5DYVN5.js → chunk-ECU7HGO3.js} +6 -5
  6. package/dist/chunk-ECU7HGO3.js.map +1 -0
  7. package/dist/{chunk-YORZNYZZ.js → chunk-FAIRTAIB.js} +53 -17
  8. package/dist/chunk-FAIRTAIB.js.map +1 -0
  9. package/dist/{chunk-5OTKSRHM.js → chunk-MNJ2EQDJ.js} +3 -3
  10. package/dist/{chunk-5OTKSRHM.js.map → chunk-MNJ2EQDJ.js.map} +1 -1
  11. package/dist/{chunk-A7ETZFNH.js → chunk-WJUVTFJ7.js} +6 -6
  12. package/dist/chunk-WJUVTFJ7.js.map +1 -0
  13. package/dist/components/index.cjs +47 -16
  14. package/dist/components/index.cjs.map +1 -1
  15. package/dist/components/index.d.cts +2 -2
  16. package/dist/components/index.d.ts +2 -2
  17. package/dist/components/index.js +3 -3
  18. package/dist/hooks/index.cjs +350 -28
  19. package/dist/hooks/index.cjs.map +1 -1
  20. package/dist/hooks/index.d.cts +160 -36
  21. package/dist/hooks/index.d.ts +160 -36
  22. package/dist/hooks/index.js +299 -19
  23. package/dist/hooks/index.js.map +1 -1
  24. package/dist/{index-zLJX8XdK.d.ts → index-C9R3B80j.d.ts} +29 -37
  25. package/dist/{index-DUsGVhDz.d.cts → index-CTTh1ZPg.d.cts} +29 -37
  26. package/dist/index.cjs +68 -32
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +10 -19
  29. package/dist/index.d.ts +10 -19
  30. package/dist/index.js +17 -12
  31. package/dist/index.js.map +1 -1
  32. package/dist/signers/index.cjs +4 -3
  33. package/dist/signers/index.cjs.map +1 -1
  34. package/dist/signers/index.js +2 -2
  35. package/dist/{useAgentTrackRecord-BLf1nrbu.d.cts → useAgentTrackRecord-BCvRHYM2.d.cts} +7 -7
  36. package/dist/{useAgentTrackRecord-BLf1nrbu.d.ts → useAgentTrackRecord-BCvRHYM2.d.ts} +7 -7
  37. package/package.json +4 -3
  38. package/src/components/HireButton.tsx +1 -2
  39. package/src/components/HireCheckoutModal.tsx +8 -9
  40. package/src/components/ReferrerDisclosure.tsx +8 -12
  41. package/src/components/strings.ts +2 -2
  42. package/src/hooks/index.ts +47 -4
  43. package/src/hooks/internal.ts +74 -2
  44. package/src/hooks/useHire.ts +30 -38
  45. package/src/hooks/useHumanlessHireFlow.ts +259 -0
  46. package/src/hooks/useRateHire.ts +52 -0
  47. package/src/hooks/useReferrerEarnings.ts +32 -33
  48. package/src/hooks/useTaskActivation.ts +58 -0
  49. package/src/hooks/useTaskLifecycle.ts +110 -0
  50. package/src/hooks/useTaskWork.ts +76 -0
  51. package/src/index.ts +2 -2
  52. package/src/provider/AgencProvider.tsx +3 -3
  53. package/src/provider/referrer.ts +24 -32
  54. package/src/strings/index.ts +5 -3
  55. package/src/types.ts +7 -10
  56. package/dist/chunk-A7ETZFNH.js.map +0 -1
  57. package/dist/chunk-GN5DYVN5.js.map +0 -1
  58. package/dist/chunk-YORZNYZZ.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,17 +1,17 @@
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-DUsGVhDz.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-DUsGVhDz.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-CTTh1ZPg.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-CTTh1ZPg.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-BLf1nrbu.cjs';
10
+ import './useAgentTrackRecord-BCvRHYM2.cjs';
11
11
 
12
12
  /**
13
13
  * `<AgencProvider>` — the one context that wires reads, writes, and the
14
- * (P6.2-gated) referrer config for every AgenC hook/component beneath it.
14
+ * live referrer config for every AgenC hook/component beneath it.
15
15
  *
16
16
  * Wraps a bundled TanStack {@link QueryClientProvider} so hooks get
17
17
  * caching/refetch/optimistic states with no consumer config. The
@@ -71,12 +71,11 @@ declare function useAgencContext(): AgencContextValue;
71
71
  /** Minimum referral fee, in basis points. */
72
72
  declare const REFERRER_FEE_BPS_MIN = 0;
73
73
  /**
74
- * Maximum referral fee, in basis points. 10000 bps = 100%. The on-chain P6.2
75
- * leg will enforce its own cap; this client-side bound is a sane outer guard so
76
- * an obviously-wrong config (e.g. a typo'd 99999) is rejected at provider
77
- * construction rather than silently stored.
74
+ * Maximum referral fee, in basis points. Mirrors the on-chain per-leg cap
75
+ * (`MAX_REFERRER_FEE_BPS = 2000`) so invalid provider config fails before the
76
+ * user signs a transaction.
78
77
  */
79
- declare const REFERRER_FEE_BPS_MAX = 10000;
78
+ declare const REFERRER_FEE_BPS_MAX = 2000;
80
79
  /**
81
80
  * Validate + normalize a raw {@link ReferrerConfig} into a
82
81
  * {@link ValidatedReferrerConfig}.
@@ -87,18 +86,10 @@ declare const REFERRER_FEE_BPS_MAX = 10000;
87
86
  */
88
87
  declare function validateReferrerConfig(config: ReferrerConfig): ValidatedReferrerConfig;
89
88
  /**
90
- * Resolve whether a referral fee can actually be charged on the target cluster.
91
- *
92
- * THE P6.2 GATE — returns `live: false` UNCONDITIONALLY today.
93
- *
94
- * TODO(P6.2 / P6.5): once the on-chain referrer args + 4th settlement leg
95
- * (PLAN.md P6.2) are deployed, replace the hardcoded `false` with a real check
96
- * against P6.5 `getDeployedSurface` for the target cluster. Until then, returning
97
- * a truthy `live` here would cause silent fee injection against a program that
98
- * cannot honor it — strictly forbidden by PLAN_2 §0.
89
+ * Resolve whether a referral fee can actually be charged by this provider.
99
90
  *
100
91
  * @param referrer - The validated referrer config under the provider, or null.
101
- * @returns A {@link ReferrerCapability} (always `{ live: false, ... }` today).
92
+ * @returns A {@link ReferrerCapability}; live only when a referrer is configured.
102
93
  */
103
94
  declare function resolveReferrerCapability(referrer: ValidatedReferrerConfig | null): ReferrerCapability;
104
95
 
package/dist/index.d.ts CHANGED
@@ -1,17 +1,17 @@
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-zLJX8XdK.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-zLJX8XdK.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-C9R3B80j.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-C9R3B80j.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-BLf1nrbu.js';
10
+ import './useAgentTrackRecord-BCvRHYM2.js';
11
11
 
12
12
  /**
13
13
  * `<AgencProvider>` — the one context that wires reads, writes, and the
14
- * (P6.2-gated) referrer config for every AgenC hook/component beneath it.
14
+ * live referrer config for every AgenC hook/component beneath it.
15
15
  *
16
16
  * Wraps a bundled TanStack {@link QueryClientProvider} so hooks get
17
17
  * caching/refetch/optimistic states with no consumer config. The
@@ -71,12 +71,11 @@ declare function useAgencContext(): AgencContextValue;
71
71
  /** Minimum referral fee, in basis points. */
72
72
  declare const REFERRER_FEE_BPS_MIN = 0;
73
73
  /**
74
- * Maximum referral fee, in basis points. 10000 bps = 100%. The on-chain P6.2
75
- * leg will enforce its own cap; this client-side bound is a sane outer guard so
76
- * an obviously-wrong config (e.g. a typo'd 99999) is rejected at provider
77
- * construction rather than silently stored.
74
+ * Maximum referral fee, in basis points. Mirrors the on-chain per-leg cap
75
+ * (`MAX_REFERRER_FEE_BPS = 2000`) so invalid provider config fails before the
76
+ * user signs a transaction.
78
77
  */
79
- declare const REFERRER_FEE_BPS_MAX = 10000;
78
+ declare const REFERRER_FEE_BPS_MAX = 2000;
80
79
  /**
81
80
  * Validate + normalize a raw {@link ReferrerConfig} into a
82
81
  * {@link ValidatedReferrerConfig}.
@@ -87,18 +86,10 @@ declare const REFERRER_FEE_BPS_MAX = 10000;
87
86
  */
88
87
  declare function validateReferrerConfig(config: ReferrerConfig): ValidatedReferrerConfig;
89
88
  /**
90
- * Resolve whether a referral fee can actually be charged on the target cluster.
91
- *
92
- * THE P6.2 GATE — returns `live: false` UNCONDITIONALLY today.
93
- *
94
- * TODO(P6.2 / P6.5): once the on-chain referrer args + 4th settlement leg
95
- * (PLAN.md P6.2) are deployed, replace the hardcoded `false` with a real check
96
- * against P6.5 `getDeployedSurface` for the target cluster. Until then, returning
97
- * a truthy `live` here would cause silent fee injection against a program that
98
- * cannot honor it — strictly forbidden by PLAN_2 §0.
89
+ * Resolve whether a referral fee can actually be charged by this provider.
99
90
  *
100
91
  * @param referrer - The validated referrer config under the provider, or null.
101
- * @returns A {@link ReferrerCapability} (always `{ live: false, ... }` today).
92
+ * @returns A {@link ReferrerCapability}; live only when a referrer is configured.
102
93
  */
103
94
  declare function resolveReferrerCapability(referrer: ValidatedReferrerConfig | null): ReferrerCapability;
104
95
 
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { createReadTransport } from './chunk-ABS77JB2.js';
2
- export { ReadTransportUnsupportedError, createReadTransport } from './chunk-ABS77JB2.js';
3
- export { EN_SIGNER_STRINGS, signerFromEmbeddedWallet, signerFromWalletAccount, signerFromWalletAdapter } from './chunk-5OTKSRHM.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-A7ETZFNH.js';
5
- import { AgencContext } from './chunk-YORZNYZZ.js';
6
- export { AgencContext, useAgencContext } from './chunk-YORZNYZZ.js';
7
- import { t } from './chunk-GN5DYVN5.js';
8
- export { EN_STRINGS, t } from './chunk-GN5DYVN5.js';
1
+ import { createReadTransport } from './chunk-D2TDU3TJ.js';
2
+ export { ReadTransportUnsupportedError, createReadTransport } from './chunk-D2TDU3TJ.js';
3
+ export { EN_SIGNER_STRINGS, signerFromEmbeddedWallet, signerFromWalletAccount, signerFromWalletAdapter } from './chunk-MNJ2EQDJ.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-WJUVTFJ7.js';
5
+ import { AgencContext } from './chunk-FAIRTAIB.js';
6
+ export { AgencContext, useAgencContext } from './chunk-FAIRTAIB.js';
7
+ import { t } from './chunk-ECU7HGO3.js';
8
+ export { EN_STRINGS, t } from './chunk-ECU7HGO3.js';
9
9
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
10
10
  import { createMarketplaceClient } from '@tetsuo-ai/marketplace-sdk';
11
11
  import { useState, useMemo } from 'react';
@@ -39,7 +39,7 @@ function resolveEndpoints(network, rpcUrl, rpcSubscriptionsUrl) {
39
39
  return { rpcUrl: resolvedRpc, rpcSubscriptionsUrl: resolvedWs };
40
40
  }
41
41
  var REFERRER_FEE_BPS_MIN = 0;
42
- var REFERRER_FEE_BPS_MAX = 1e4;
42
+ var REFERRER_FEE_BPS_MAX = 2e3;
43
43
  function validateReferrerConfig(config) {
44
44
  const { wallet, feeBps } = config;
45
45
  if (typeof wallet !== "string" || !isAddress(wallet)) {
@@ -57,10 +57,15 @@ function validateReferrerConfig(config) {
57
57
  return { wallet, feeBps };
58
58
  }
59
59
  function resolveReferrerCapability(referrer) {
60
+ if (!referrer) {
61
+ return {
62
+ live: false,
63
+ reason: t("referrer.notLiveReason")
64
+ };
65
+ }
60
66
  return {
61
- live: false,
62
- reason: t("referrer.notLiveReason"),
63
- ...referrer ? { referrer } : {}
67
+ live: true,
68
+ referrer
64
69
  };
65
70
  }
66
71
  var DEFAULT_QUERY_CLIENT_CONFIG = {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/provider/network.ts","../src/provider/referrer.ts","../src/provider/AgencProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAcA,IAAM,qBAAA,GAA6D;AAAA,EACjE,QAAA,EAAU,uBAAA;AAAA,EACV,MAAA,EAAQ,+BAAA;AAAA;AAAA,EAER,OAAA,EAAS;AACX,CAAA;AAMA,IAAM,mBAAA,GAA2D;AAAA,EAC/D,QAAA,EAAU,qBAAA;AAAA,EACV,MAAA,EAAQ,6BAAA;AAAA,EACR,OAAA,EAAS;AACX,CAAA;AAGO,SAAS,uBAAuB,MAAA,EAAwB;AAC7D,EAAA,IAAI,cAAA,CAAe,I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Q,MAAA,CAAO;AAAA,GAChB,CAAA;AACH;AAaO,SAAS,cAAc,KAAA,EAAsC;AAClE,EAAA,MAAM,EAAE,MAAA,EAAQ,QAAA,EAAS,GAAI,KAAA;AAI7B,EAAA,MAAM,CAAC,mBAAmB,CAAA,GAAI,QAAA;AAAA,IAC5B,MACE,KAAA,CAAM,WAAA,IACN,IAAI,WAAA,CAAY,KAAA,CAAM,qBAAqB,2BAA2B;AAAA,GAC1E;AACA,EAAA,MAAM,WAAA,GAAc,MAAM,WAAA,IAAe,mBAAA;AAEzC,EAAA,MAAM,KAAA,GAAQ,QAA2B,MAAM;AAC7C,IAAA,MAAM,OAAA,GAAwB,OAAO,OAAA,IAAW,SAAA;AAIhD,IAAA,MAAM,WAA2C,MAAA,CAAO,QAAA,GACpD,sBAAA,CAAuB,MAAA,CAAO,QAAQ,CAAA,GACtC,IAAA;AAEJ,IAAA,MAAM,IAAA,GAAO,mBAAmB,MAAM,CAAA;AACtC,IAAA,MAAM,MAAA,GAAS,gBAAA,CAAiB,MAAA,EAAQ,OAAO,CAAA;AAE/C,IAAA,OAAO;AAAA,MACL,OAAA;AAAA,MACA,IAAA;AAAA,MACA,MAAA;AAAA,MACA,MAAA,EAAQ,OAAO,MAAA,IAAU,IAAA;AAAA,MACzB,QAAA;AAAA,MACA,yBAAA,EAA2B,MAAM,yBAAA,CAA8B,QAAQ;AAAA,KACzE;AAAA,EAGF,CAAA,EAAG,CAAC,MAAM,CAAC,CAAA;AAEX,EAAA,uBACE,GAAA,CAAC,mBAAA,EAAA,EAAoB,MAAA,EAAQ,WAAA,EAC3B,QAAA,kBAAA,GAAA,CAAC,aAAa,QAAA,EAAb,EAAsB,KAAA,EAAe,QAAA,EAAS,CAAA,EACjD,CAAA;AAEJ","file":"index.js","sourcesContent":["/**\n * Network → endpoint defaults.\n *\n * Reuses the resolution philosophy of the SDK sandbox env seam\n * (`resolveSandboxEnvironment`): explicit config beats a per-network default,\n * and the WebSocket endpoint is derived from the HTTP one when not given. This\n * is intentionally a SMALL, synchronous, SSR-safe mirror — the provider needs\n * no `process`/`fs` access and the sandbox seam's async file-reading path.\n *\n * @module provider/network\n */\nimport type { AgencNetwork } from \"../types.js\";\n\n/** Per-network default HTTP RPC endpoints. `mainnet` has no public default. */\nconst NETWORK_HTTP_DEFAULTS: Record<AgencNetwork, string | null> = {\n localnet: \"http://127.0.0.1:8899\",\n devnet: \"https://api.devnet.solana.com\",\n // No public default: mainnet RPC is operator-supplied (rate/cost sensitive).\n mainnet: null,\n};\n\n/**\n * `solana-test-validator` serves PubSub on RPC port + 1 (8900), so localnet's\n * WS endpoint is NOT derivable from the HTTP URL by scheme swap alone.\n */\nconst NETWORK_WS_DEFAULTS: Record<AgencNetwork, string | null> = {\n localnet: \"ws://127.0.0.1:8900\",\n devnet: \"wss://api.devnet.solana.com\",\n mainnet: null,\n};\n\n/** Derive a ws(s) endpoint from an http(s) one (same host/port/path). */\nexport function deriveSubscriptionsUrl(rpcUrl: string): string {\n if (/^https:\\/\\//i.test(rpcUrl)) {\n return `wss://${rpcUrl.slice(\"https://\".length)}`;\n }\n if (/^http:\\/\\//i.test(rpcUrl)) {\n return `ws://${rpcUrl.slice(\"http://\".length)}`;\n }\n return rpcUrl;\n}\n\n/** A resolved pair of RPC endpoints (either may be `null` when unresolvable). */\nexport interface ResolvedEndpoints {\n rpcUrl: string | null;\n rpcSubscriptionsUrl: string | null;\n}\n\n/**\n * Resolve the HTTP + WS RPC endpoints for a network, honoring explicit\n * overrides. Returns `{ rpcUrl: null }` when neither an override nor a default\n * exists (mainnet with no `rpcUrl`) — the provider treats that as \"no write\n * client buildable from URLs\", not a throw, so a read-only/indexer-only or\n * `client`-override setup still works.\n */\nexport function resolveEndpoints(\n network: AgencNetwork,\n rpcUrl?: string,\n rpcSubscriptionsUrl?: string,\n): ResolvedEndpoints {\n const resolvedRpc = rpcUrl ?? NETWORK_HTTP_DEFAULTS[network];\n const resolvedWs =\n rpcSubscriptionsUrl ??\n (rpcUrl !== undefined\n ? deriveSubscriptionsUrl(rpcUrl)\n : NETWORK_WS_DEFAULTS[network]);\n return { rpcUrl: resolvedRpc, rpcSubscriptionsUrl: resolvedWs };\n}\n","/**\n * Referrer config validation + the P6.2 capability gate.\n *\n * ## THE P6.2 GATE (PLAN_2 §0, MANDATORY)\n *\n * Referrer args + the 4th settlement leg are an UNBUILT Phase-6 on-chain change\n * (PLAN.md P6.2). The SDK `facade.hireFromListing` has NO referrer params yet.\n * So this module:\n * - ACCEPTS + VALIDATES `referrer: { wallet, feeBps }` and stores the normalized\n * form (validation is real: bad base58 throws, out-of-range bps rejected);\n * - exposes {@link resolveReferrerCapability}, which currently returns\n * `{ live: false, reason: \"P6.2 not deployed\" }` — HARDCODED false today, with\n * a clear TODO citing P6.2 / P6.5 `getDeployedSurface` as the future signal.\n *\n * When NOT live (today, always): referrer is NEVER injected into a hire, the\n * earnings hook returns a documented not-live state, and disclosure UI may still\n * SHOW \"this site earns a referral fee (pending protocol support)\". We NEVER\n * fake earnings or silently inject.\n *\n * @module provider/referrer\n */\nimport { isAddress } from \"@solana/kit\";\nimport { t } from \"../strings/index.js\";\nimport type {\n Address,\n ReferrerCapability,\n ReferrerConfig,\n ValidatedReferrerConfig,\n} from \"../types.js\";\n\n/** Minimum referral fee, in basis points. */\nexport const REFERRER_FEE_BPS_MIN = 0;\n/**\n * Maximum referral fee, in basis points. 10000 bps = 100%. The on-chain P6.2\n * leg will enforce its own cap; this client-side bound is a sane outer guard so\n * an obviously-wrong config (e.g. a typo'd 99999) is rejected at provider\n * construction rather than silently stored.\n */\nexport const REFERRER_FEE_BPS_MAX = 10_000;\n\n/**\n * Validate + normalize a raw {@link ReferrerConfig} into a\n * {@link ValidatedReferrerConfig}.\n *\n * @throws TypeError when `wallet` is not a valid base58 Solana address.\n * @throws RangeError when `feeBps` is not an integer in\n * `[REFERRER_FEE_BPS_MIN, REFERRER_FEE_BPS_MAX]`.\n */\nexport function validateReferrerConfig(\n config: ReferrerConfig,\n): ValidatedReferrerConfig {\n const { wallet, feeBps } = config;\n if (typeof wallet !== \"string\" || !isAddress(wallet)) {\n throw new TypeError(t(\"referrer.invalidWallet\", { wallet: String(wallet) }));\n }\n if (\n typeof feeBps !== \"number\" ||\n !Number.isInteger(feeBps) ||\n feeBps < REFERRER_FEE_BPS_MIN ||\n feeBps > REFERRER_FEE_BPS_MAX\n ) {\n throw new RangeError(\n t(\"referrer.invalidFeeBps\", {\n min: REFERRER_FEE_BPS_MIN,\n max: REFERRER_FEE_BPS_MAX,\n feeBps: String(feeBps),\n }),\n );\n }\n return { wallet: wallet as Address, feeBps };\n}\n\n/**\n * Resolve whether a referral fee can actually be charged on the target cluster.\n *\n * THE P6.2 GATE — returns `live: false` UNCONDITIONALLY today.\n *\n * TODO(P6.2 / P6.5): once the on-chain referrer args + 4th settlement leg\n * (PLAN.md P6.2) are deployed, replace the hardcoded `false` with a real check\n * against P6.5 `getDeployedSurface` for the target cluster. Until then, returning\n * a truthy `live` here would cause silent fee injection against a program that\n * cannot honor it — strictly forbidden by PLAN_2 §0.\n *\n * @param referrer - The validated referrer config under the provider, or null.\n * @returns A {@link ReferrerCapability} (always `{ live: false, ... }` today).\n */\nexport function resolveReferrerCapability(\n referrer: ValidatedReferrerConfig | null,\n): ReferrerCapability {\n // P6.2 GATE: hardcoded not-live. Do NOT make this conditionally true until\n // P6.2 is deployed AND P6.5 getDeployedSurface confirms it on the cluster.\n return {\n live: false,\n reason: t(\"referrer.notLiveReason\"),\n ...(referrer ? { referrer } : {}),\n };\n}\n","/**\n * `<AgencProvider>` — the one context that wires reads, writes, and the\n * (P6.2-gated) referrer config for every AgenC hook/component beneath it.\n *\n * Wraps a bundled TanStack {@link QueryClientProvider} so hooks get\n * caching/refetch/optimistic states with no consumer config. The\n * {@link AgencProviderConfig.client} and {@link AgencProviderConfig.queryTransport}\n * slots are PUBLIC test seams: `startLocalMarketplace().client` plugs straight\n * into `client` for hook e2e, and a mock {@link ReadTransport} plugs into\n * `queryTransport`.\n *\n * SSR-safe: no `window`/`document` access at module scope or during render; all\n * resolution is pure. The provider memoizes the context value and the\n * QueryClient on config identity so SSR + hydration stay stable.\n *\n * @module provider/AgencProvider\n */\nimport {\n QueryClient,\n QueryClientProvider,\n type QueryClientConfig,\n} from \"@tanstack/react-query\";\nimport { createMarketplaceClient } from \"@tetsuo-ai/marketplace-sdk\";\nimport { useMemo, useState, type ReactNode } from \"react\";\nimport { createReadTransport } from \"../transport/index.js\";\nimport type {\n AgencContextValue,\n AgencNetwork,\n AgencProviderConfig,\n MarketplaceClient,\n ReadTransport,\n ValidatedReferrerConfig,\n} from \"../types.js\";\nimport { AgencContext } from \"./context.js\";\nimport { resolveEndpoints } from \"./network.js\";\nimport {\n resolveReferrerCapability as resolveReferrerCapabilityImpl,\n validateReferrerConfig,\n} from \"./referrer.js\";\n\n/** Props for {@link AgencProvider}. */\nexport interface AgencProviderProps {\n /** Provider configuration. See {@link AgencProviderConfig}. */\n config: AgencProviderConfig;\n /**\n * Optional pre-built TanStack QueryClient. When omitted, the provider creates\n * one lazily (stable across renders). Pass your own to share a cache with the\n * rest of your app.\n */\n queryClient?: QueryClient;\n /** Override config for the lazily-created QueryClient (ignored if you pass one). */\n queryClientConfig?: QueryClientConfig;\n children: ReactNode;\n}\n\n/** Default QueryClient tuning for marketplace reads (sane, overridable). */\nconst DEFAULT_QUERY_CLIENT_CONFIG: QueryClientConfig = {\n defaultOptions: {\n queries: {\n // Marketplace listings change on-chain slowly relative to a UI session;\n // a short stale window avoids refetch storms while staying fresh.\n staleTime: 15_000,\n retry: 1,\n refetchOnWindowFocus: false,\n },\n },\n};\n\n/**\n * Build the read transport from config. The `queryTransport` override wins;\n * otherwise indexer-first (when `indexer.baseUrl` is set) with a gPA fallback\n * over the resolved RPC URL.\n *\n * NOTE: the gPA fallback needs a kit `Rpc<GetProgramAccountsApi>`, which we do\n * NOT build here from a bare URL — the SDK write client owns RPC construction.\n * When only a URL (no indexer, no queryTransport) is available, reads require\n * an indexer; the transport factory throws a descriptive error on first use.\n */\nfunction buildReadTransport(\n config: AgencProviderConfig,\n): ReadTransport {\n return createReadTransport({\n indexer: config.indexer,\n queryTransport: config.queryTransport,\n // The gPA read source is provided only via queryTransport in v1 (a kit RPC\n // or ProgramAccountsTransport). A future revision can derive a kit RPC from\n // the resolved rpcUrl; for now indexer-first is the supported read path and\n // queryTransport is the test/mocks seam.\n });\n}\n\n/**\n * Build the write client from config. The `client` override wins. Otherwise a\n * client is built only when BOTH a resolvable `rpcUrl` and a `signer` exist;\n * absent either, the provider exposes `client: null` and mutating hooks surface\n * a clear error (read-only / indexer-only setups are valid).\n */\nfunction buildWriteClient(\n config: AgencProviderConfig,\n network: AgencNetwork,\n): MarketplaceClient | null {\n if (config.client) return config.client;\n if (!config.signer) return null;\n const { rpcUrl, rpcSubscriptionsUrl } = resolveEndpoints(\n network,\n config.rpcUrl,\n config.rpcSubscriptionsUrl,\n );\n if (rpcUrl === null) return null;\n return createMarketplaceClient({\n rpcUrl,\n ...(rpcSubscriptionsUrl ? { rpcSubscriptionsUrl } : {}),\n signer: config.signer,\n });\n}\n\n/**\n * The AgenC provider. Place at the root of any tree that uses AgenC hooks or\n * components.\n *\n * @example\n * ```tsx\n * <AgencProvider config={{ network: \"devnet\", indexer: { baseUrl } }}>\n * <App />\n * </AgencProvider>\n * ```\n */\nexport function AgencProvider(props: AgencProviderProps): ReactNode {\n const { config, children } = props;\n\n // Lazily create (and keep stable) the QueryClient. useState initializer runs\n // once; passing your own `queryClient` overrides it.\n const [internalQueryClient] = useState<QueryClient>(\n () =>\n props.queryClient ??\n new QueryClient(props.queryClientConfig ?? DEFAULT_QUERY_CLIENT_CONFIG),\n );\n const queryClient = props.queryClient ?? internalQueryClient;\n\n const value = useMemo<AgencContextValue>(() => {\n const network: AgencNetwork = config.network ?? \"mainnet\";\n\n // Validate + normalize referrer ALWAYS (the P6.2 gate decides injection,\n // not validation). A bad config throws here, at provider construction.\n const referrer: ValidatedReferrerConfig | null = config.referrer\n ? validateReferrerConfig(config.referrer)\n : null;\n\n const read = buildReadTransport(config);\n const client = buildWriteClient(config, network);\n\n return {\n network,\n read,\n client,\n signer: config.signer ?? null,\n referrer,\n resolveReferrerCapability: () => resolveReferrerCapabilityImpl(referrer),\n };\n // Re-resolve when any wiring input changes. Referrer object identity is\n // intentionally part of the deps (a new referrer config must re-validate).\n }, [config]);\n\n return (\n <QueryClientProvider client={queryClient}>\n <AgencContext.Provider value={value}>{children}</AgencContext.Provider>\n </QueryClientProvider>\n );\n}\n"]}
1
+ {"version":3,"sources":["../src/provider/network.ts","../src/provider/referrer.ts","../src/provider/AgencProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAcA,IAAM,qBAAA,GAA6D;AAAA,EACjE,QAAA,EAAU,uBAAA;AAAA,EACV,MAAA,EAAQ,+BAAA;AAAA;AAAA,EAER,OAAA,EAAS;AACX,CAAA;AAMA,IAAM,mBAAA,GAA2D;AAAA,EAC/D,QAAA,EAAU,qBAAA;AAAA,EACV,MAAA,EAAQ,6BAAA;AAAA,EACR,OAAA,EAAS;AACX,CAAA;AAGO,SAAS,uBAAuB,MAAA,EAAwB;AAC7D,EAAA,IAAI,cAAA,CAAe,IAAA,CAAK,MAAM,CAAA,EAAG;AAC/B,IAAA,OAAO,CAAA,MAAA,EAAS,MAAA,CAAO,KAAA,CAAM,UAAA,CAAW,MAAM,CAAC,CAAA,CAAA;AAAA,EACjD;AACA,EAAA,IAAI,aAAA,CAAc,IAAA,CAAK,MAAM,CAAA,EAAG;AAC9B,IAAA,OAAO,CAAA,KAAA,EAAQ,MAAA,CAAO,KAAA,CAAM,SAAA,CAAU,MAAM,CAAC,CAAA,CAAA;AAAA,EAC/C;AACA,EAAA,OAAO,MAAA;AACT;AAeO,SAAS,gBAAA,CACd,OAAA,EACA,MAAA,EACA,mBAAA,EACmB;AACnB,EAAA,MAAM,WAAA,GAAc,MAAA,IAAU,qBAAA,CAAsB,OAAO,CAAA;AAC3D,EAAA,MAAM,UAAA,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SAAA;AAIhD,IAAA,MAAM,WAA2C,MAAA,CAAO,QAAA,GACpD,sBAAA,CAAuB,MAAA,CAAO,QAAQ,CAAA,GACtC,IAAA;AAEJ,IAAA,MAAM,IAAA,GAAO,mBAAmB,MAAM,CAAA;AACtC,IAAA,MAAM,MAAA,GAAS,gBAAA,CAAiB,MAAA,EAAQ,OAAO,CAAA;AAE/C,IAAA,OAAO;AAAA,MACL,OAAA;AAAA,MACA,IAAA;AAAA,MACA,MAAA;AAAA,MACA,MAAA,EAAQ,OAAO,MAAA,IAAU,IAAA;AAAA,MACzB,QAAA;AAAA,MACA,yBAAA,EAA2B,MAAM,yBAAA,CAA8B,QAAQ;AAAA,KACzE;AAAA,EAGF,CAAA,EAAG,CAAC,MAAM,CAAC,CAAA;AAEX,EAAA,uBACE,GAAA,CAAC,mBAAA,EAAA,EAAoB,MAAA,EAAQ,WAAA,EAC3B,QAAA,kBAAA,GAAA,CAAC,aAAa,QAAA,EAAb,EAAsB,KAAA,EAAe,QAAA,EAAS,CAAA,EACjD,CAAA;AAEJ","file":"index.js","sourcesContent":["/**\n * Network → endpoint defaults.\n *\n * Reuses the resolution philosophy of the SDK sandbox env seam\n * (`resolveSandboxEnvironment`): explicit config beats a per-network default,\n * and the WebSocket endpoint is derived from the HTTP one when not given. This\n * is intentionally a SMALL, synchronous, SSR-safe mirror — the provider needs\n * no `process`/`fs` access and the sandbox seam's async file-reading path.\n *\n * @module provider/network\n */\nimport type { AgencNetwork } from \"../types.js\";\n\n/** Per-network default HTTP RPC endpoints. `mainnet` has no public default. */\nconst NETWORK_HTTP_DEFAULTS: Record<AgencNetwork, string | null> = {\n localnet: \"http://127.0.0.1:8899\",\n devnet: \"https://api.devnet.solana.com\",\n // No public default: mainnet RPC is operator-supplied (rate/cost sensitive).\n mainnet: null,\n};\n\n/**\n * `solana-test-validator` serves PubSub on RPC port + 1 (8900), so localnet's\n * WS endpoint is NOT derivable from the HTTP URL by scheme swap alone.\n */\nconst NETWORK_WS_DEFAULTS: Record<AgencNetwork, string | null> = {\n localnet: \"ws://127.0.0.1:8900\",\n devnet: \"wss://api.devnet.solana.com\",\n mainnet: null,\n};\n\n/** Derive a ws(s) endpoint from an http(s) one (same host/port/path). */\nexport function deriveSubscriptionsUrl(rpcUrl: string): string {\n if (/^https:\\/\\//i.test(rpcUrl)) {\n return `wss://${rpcUrl.slice(\"https://\".length)}`;\n }\n if (/^http:\\/\\//i.test(rpcUrl)) {\n return `ws://${rpcUrl.slice(\"http://\".length)}`;\n }\n return rpcUrl;\n}\n\n/** A resolved pair of RPC endpoints (either may be `null` when unresolvable). */\nexport interface ResolvedEndpoints {\n rpcUrl: string | null;\n rpcSubscriptionsUrl: string | null;\n}\n\n/**\n * Resolve the HTTP + WS RPC endpoints for a network, honoring explicit\n * overrides. Returns `{ rpcUrl: null }` when neither an override nor a default\n * exists (mainnet with no `rpcUrl`) — the provider treats that as \"no write\n * client buildable from URLs\", not a throw, so a read-only/indexer-only or\n * `client`-override setup still works.\n */\nexport function resolveEndpoints(\n network: AgencNetwork,\n rpcUrl?: string,\n rpcSubscriptionsUrl?: string,\n): ResolvedEndpoints {\n const resolvedRpc = rpcUrl ?? NETWORK_HTTP_DEFAULTS[network];\n const resolvedWs =\n rpcSubscriptionsUrl ??\n (rpcUrl !== undefined\n ? deriveSubscriptionsUrl(rpcUrl)\n : NETWORK_WS_DEFAULTS[network]);\n return { rpcUrl: resolvedRpc, rpcSubscriptionsUrl: resolvedWs };\n}\n","/**\n * Referrer config validation + the live referral-settlement capability.\n *\n * ## REFERRER SETTLEMENT\n *\n * Referrer args + the 4th settlement leg are part of the full 84-instruction\n * surface. The SDK `facade.hireFromListing` and\n * `facade.hireFromListingHumanless` both accept referrer fields. This module:\n * - ACCEPTS + VALIDATES `referrer: { wallet, feeBps }` and stores the normalized\n * form (validation is real: bad base58 throws, out-of-range bps rejected);\n * - exposes {@link resolveReferrerCapability}, which reports live when a valid\n * referrer config is present.\n *\n * Aggregated earnings are separate from settlement. `useReferrerEarnings` still\n * remains indexer-gated and must not fabricate totals before that endpoint is\n * published.\n *\n * @module provider/referrer\n */\nimport { isAddress } from \"@solana/kit\";\nimport { t } from \"../strings/index.js\";\nimport type {\n Address,\n ReferrerCapability,\n ReferrerConfig,\n ValidatedReferrerConfig,\n} from \"../types.js\";\n\n/** Minimum referral fee, in basis points. */\nexport const REFERRER_FEE_BPS_MIN = 0;\n/**\n * Maximum referral fee, in basis points. Mirrors the on-chain per-leg cap\n * (`MAX_REFERRER_FEE_BPS = 2000`) so invalid provider config fails before the\n * user signs a transaction.\n */\nexport const REFERRER_FEE_BPS_MAX = 2_000;\n\n/**\n * Validate + normalize a raw {@link ReferrerConfig} into a\n * {@link ValidatedReferrerConfig}.\n *\n * @throws TypeError when `wallet` is not a valid base58 Solana address.\n * @throws RangeError when `feeBps` is not an integer in\n * `[REFERRER_FEE_BPS_MIN, REFERRER_FEE_BPS_MAX]`.\n */\nexport function validateReferrerConfig(\n config: ReferrerConfig,\n): ValidatedReferrerConfig {\n const { wallet, feeBps } = config;\n if (typeof wallet !== \"string\" || !isAddress(wallet)) {\n throw new TypeError(t(\"referrer.invalidWallet\", { wallet: String(wallet) }));\n }\n if (\n typeof feeBps !== \"number\" ||\n !Number.isInteger(feeBps) ||\n feeBps < REFERRER_FEE_BPS_MIN ||\n feeBps > REFERRER_FEE_BPS_MAX\n ) {\n throw new RangeError(\n t(\"referrer.invalidFeeBps\", {\n min: REFERRER_FEE_BPS_MIN,\n max: REFERRER_FEE_BPS_MAX,\n feeBps: String(feeBps),\n }),\n );\n }\n return { wallet: wallet as Address, feeBps };\n}\n\n/**\n * Resolve whether a referral fee can actually be charged by this provider.\n *\n * @param referrer - The validated referrer config under the provider, or null.\n * @returns A {@link ReferrerCapability}; live only when a referrer is configured.\n */\nexport function resolveReferrerCapability(\n referrer: ValidatedReferrerConfig | null,\n): ReferrerCapability {\n if (!referrer) {\n return {\n live: false,\n reason: t(\"referrer.notLiveReason\"),\n };\n }\n return {\n live: true,\n referrer,\n };\n}\n","/**\n * `<AgencProvider>` — the one context that wires reads, writes, and the\n * live referrer config for every AgenC hook/component beneath it.\n *\n * Wraps a bundled TanStack {@link QueryClientProvider} so hooks get\n * caching/refetch/optimistic states with no consumer config. The\n * {@link AgencProviderConfig.client} and {@link AgencProviderConfig.queryTransport}\n * slots are PUBLIC test seams: `startLocalMarketplace().client` plugs straight\n * into `client` for hook e2e, and a mock {@link ReadTransport} plugs into\n * `queryTransport`.\n *\n * SSR-safe: no `window`/`document` access at module scope or during render; all\n * resolution is pure. The provider memoizes the context value and the\n * QueryClient on config identity so SSR + hydration stay stable.\n *\n * @module provider/AgencProvider\n */\nimport {\n QueryClient,\n QueryClientProvider,\n type QueryClientConfig,\n} from \"@tanstack/react-query\";\nimport { createMarketplaceClient } from \"@tetsuo-ai/marketplace-sdk\";\nimport { useMemo, useState, type ReactNode } from \"react\";\nimport { createReadTransport } from \"../transport/index.js\";\nimport type {\n AgencContextValue,\n AgencNetwork,\n AgencProviderConfig,\n MarketplaceClient,\n ReadTransport,\n ValidatedReferrerConfig,\n} from \"../types.js\";\nimport { AgencContext } from \"./context.js\";\nimport { resolveEndpoints } from \"./network.js\";\nimport {\n resolveReferrerCapability as resolveReferrerCapabilityImpl,\n validateReferrerConfig,\n} from \"./referrer.js\";\n\n/** Props for {@link AgencProvider}. */\nexport interface AgencProviderProps {\n /** Provider configuration. See {@link AgencProviderConfig}. */\n config: AgencProviderConfig;\n /**\n * Optional pre-built TanStack QueryClient. When omitted, the provider creates\n * one lazily (stable across renders). Pass your own to share a cache with the\n * rest of your app.\n */\n queryClient?: QueryClient;\n /** Override config for the lazily-created QueryClient (ignored if you pass one). */\n queryClientConfig?: QueryClientConfig;\n children: ReactNode;\n}\n\n/** Default QueryClient tuning for marketplace reads (sane, overridable). */\nconst DEFAULT_QUERY_CLIENT_CONFIG: QueryClientConfig = {\n defaultOptions: {\n queries: {\n // Marketplace listings change on-chain slowly relative to a UI session;\n // a short stale window avoids refetch storms while staying fresh.\n staleTime: 15_000,\n retry: 1,\n refetchOnWindowFocus: false,\n },\n },\n};\n\n/**\n * Build the read transport from config. The `queryTransport` override wins;\n * otherwise indexer-first (when `indexer.baseUrl` is set) with a gPA fallback\n * over the resolved RPC URL.\n *\n * NOTE: the gPA fallback needs a kit `Rpc<GetProgramAccountsApi>`, which we do\n * NOT build here from a bare URL — the SDK write client owns RPC construction.\n * When only a URL (no indexer, no queryTransport) is available, reads require\n * an indexer; the transport factory throws a descriptive error on first use.\n */\nfunction buildReadTransport(\n config: AgencProviderConfig,\n): ReadTransport {\n return createReadTransport({\n indexer: config.indexer,\n queryTransport: config.queryTransport,\n // The gPA read source is provided only via queryTransport in v1 (a kit RPC\n // or ProgramAccountsTransport). A future revision can derive a kit RPC from\n // the resolved rpcUrl; for now indexer-first is the supported read path and\n // queryTransport is the test/mocks seam.\n });\n}\n\n/**\n * Build the write client from config. The `client` override wins. Otherwise a\n * client is built only when BOTH a resolvable `rpcUrl` and a `signer` exist;\n * absent either, the provider exposes `client: null` and mutating hooks surface\n * a clear error (read-only / indexer-only setups are valid).\n */\nfunction buildWriteClient(\n config: AgencProviderConfig,\n network: AgencNetwork,\n): MarketplaceClient | null {\n if (config.client) return config.client;\n if (!config.signer) return null;\n const { rpcUrl, rpcSubscriptionsUrl } = resolveEndpoints(\n network,\n config.rpcUrl,\n config.rpcSubscriptionsUrl,\n );\n if (rpcUrl === null) return null;\n return createMarketplaceClient({\n rpcUrl,\n ...(rpcSubscriptionsUrl ? { rpcSubscriptionsUrl } : {}),\n signer: config.signer,\n });\n}\n\n/**\n * The AgenC provider. Place at the root of any tree that uses AgenC hooks or\n * components.\n *\n * @example\n * ```tsx\n * <AgencProvider config={{ network: \"devnet\", indexer: { baseUrl } }}>\n * <App />\n * </AgencProvider>\n * ```\n */\nexport function AgencProvider(props: AgencProviderProps): ReactNode {\n const { config, children } = props;\n\n // Lazily create (and keep stable) the QueryClient. useState initializer runs\n // once; passing your own `queryClient` overrides it.\n const [internalQueryClient] = useState<QueryClient>(\n () =>\n props.queryClient ??\n new QueryClient(props.queryClientConfig ?? DEFAULT_QUERY_CLIENT_CONFIG),\n );\n const queryClient = props.queryClient ?? internalQueryClient;\n\n const value = useMemo<AgencContextValue>(() => {\n const network: AgencNetwork = config.network ?? \"mainnet\";\n\n // Validate + normalize referrer at provider construction. A bad config\n // throws here, before any hire transaction can be built.\n const referrer: ValidatedReferrerConfig | null = config.referrer\n ? validateReferrerConfig(config.referrer)\n : null;\n\n const read = buildReadTransport(config);\n const client = buildWriteClient(config, network);\n\n return {\n network,\n read,\n client,\n signer: config.signer ?? null,\n referrer,\n resolveReferrerCapability: () => resolveReferrerCapabilityImpl(referrer),\n };\n // Re-resolve when any wiring input changes. Referrer object identity is\n // intentionally part of the deps (a new referrer config must re-validate).\n }, [config]);\n\n return (\n <QueryClientProvider client={queryClient}>\n <AgencContext.Provider value={value}>{children}</AgencContext.Provider>\n </QueryClientProvider>\n );\n}\n"]}
@@ -10,11 +10,12 @@ var EN_STRINGS = {
10
10
  "provider.missingContext": "useAgencContext must be used within <AgencProvider>.",
11
11
  "provider.missingWriteClient": "No write client is configured. Pass config.client, or config.rpcUrl + config.signer, to <AgencProvider> before using a mutating hook.",
12
12
  "provider.missingSigner": "No signer is configured on <AgencProvider>. Connect a wallet or pass config.signer.",
13
- // Referrer config validation (the P6.2 gate surface).
13
+ // Referrer config validation / capability surface.
14
14
  "referrer.invalidWallet": "Referrer wallet is not a valid base58 Solana address: {wallet}.",
15
15
  "referrer.invalidFeeBps": "Referrer feeBps must be an integer between {min} and {max} (basis points); got {feeBps}.",
16
- "referrer.notLive": "This site earns a referral fee (pending protocol support).",
17
- "referrer.notLiveReason": "Referral settlement is not yet deployed on this cluster (PLAN.md P6.2). Referrer config is accepted and validated but not injected into hires.",
16
+ "referrer.notLive": "Referral fee is not active for this hire.",
17
+ "referrer.notLiveReason": "No referrer is configured for this provider.",
18
+ "referrer.earningsNotLiveReason": "Referral settlement is live, but aggregated referrer earnings are not yet exposed by the indexer.",
18
19
  // Read transport.
19
20
  "transport.noReadSource": "No read source is configured. Pass an indexer baseUrl, an rpc/queryTransport, to <AgencProvider> or createReadTransport().",
20
21
  // Generic loading / empty / error states (components extend these).
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/strings/index.ts","../../src/signers/strings.ts","../../src/signers/wallet-account.ts","../../src/signers/wallet-adapter.ts","../../src/signers/embedded-wallet.ts"],"names":["address","getTransactionEncoder","getTransactionDecoder"],"mappings":";;;;;;;AAkCO,IAAM,UAAA,GAAa;AAAA;AAAA,EAExB,yBAAA,EACE,sDAAA;AAAA,EACF,6BAAA,EACE,uIAAA;AAAA,EACF,wBAAA,EACE,qFAAA;AAAA;AAAA,EAGF,wBAAA,EACE,iEAAA;AAAA,EACF,wBAAA,EACE,0FAAA;AAAA,EACF,kBAAA,EACE,4DAAA;AAAA,EACF,wBAAA,EACE,gJAAA;AAAA;AAAA,EAGF,wBAAA,EACE,4HAAA;AAAA;AAAA,EAGF,eAAA,EAAiB,eAAA;AAAA,EACjB,aAAA,EAAe,sBAAA;AAAA,EACf,aAAA,EAAe,uBAAA;AAAA;AAAA,EAGf,UAAA,EAAY,MAAA;AAAA,EACZ,cAAA,EAAgB,kBAAA;AAAA,EAChB,aAAA,EAAe;AACjB,CAAA;AAwCO,SAAS,CAAA,CACd,EAAA,EACA,IAAA,EACA,OAAA,EACQ;AACR,EAAA,MAAM,OAAA,GAAyB,SAAS,OAAA,IAAW,UAAA;AACnD,EAAA,MAAM,QAAA,GAAW,OAAA,CAAQ,EAAE,CAAA,IAAK,EAAA;AAChC,EAAA,IAAI,IAAA,KAAS,QAAW,OAAO,QAAA;AAC/B,EAAA,OAAO,QAAA,CAAS,OAAA,CAAQ,YAAA,EAAc,CAAC,OAAO,GAAA,KAAgB;AAC5D,IAAA,MAAM,KAAA,GAAQ,KAAK,GAAG,CAAA;AACtB,IAAA,OAAO,KAAA,KAAU,MAAA,GAAY,KAAA,GAAQ,MAAA,CA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EAAW;AACd,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,EAAA,CAAG,0BAAA,EAA4B,EAAE,OAAA,EAAS,eAAe;AAAA,OAC3D;AAAA,IACF;AACA,IAAA,OAAO,SAAA;AAAA,EACT;AAEA,EAAA,OAAO;AAAA,IACL,OAAA,EAAS,aAAA;AAAA,IACT,MAAM,iBAAiB,YAAA,EAAc;AACnC,MAAA,OAAO,OAAA,CAAQ,GAAA;AAAA,QACb,YAAA,CAAa,GAAA,CAAI,OAAO,WAAA,MAAiB;AAAA,UACvC,CAAC,aAAa,GAAG,MAAM,QAAQ,WAAW;AAAA,SAC5C,CAAE;AAAA,OACJ;AAAA,IACF;AAAA,GACF;AACF;AC5GO,SAAS,yBACd,UAAA,EACmB;AACnB,EAAA,MAAM,aAAA,GAAgBF,WAAAA,CAAQ,UAAA,CAAW,OAAO,CAAA;AAEhD,EAAA,OAAO;AAAA,IACL,OAAA,EAAS,aAAA;AAAA,IACT,MAAM,iBAAiB,YAAA,EAAsC;AAC3D,MAAA,MAAM,UAAA,GACJ,MAAM,UAAA,CAAW,gBAAA,CAAiB,YAAY,CAAA;AAChD,MAAA,IAAI,UAAA,CAAW,MAAA,KAAW,YAAA,CAAa,MAAA,EAAQ;AAC7C,QAAA,MAAM,IAAI,KAAA;AAAA,UACR,GAAG,+BAAA,EAAiC;AAAA,YAClC,UAAU,YAAA,CAAa,MAAA;AAAA,YACvB,KAAK,UAAA,CAAW;AAAA,WACjB;AAAA,SACH;AAAA,MACF;AACA,MAAA,OAAO,YAAA,CAAa,GAAA,CAAI,CAAC,CAAA,EAAG,CAAA,MAAO;AAAA,QACjC,CAAC,aAAa,GAAG,UAAA,CAAW,CAAC;AAAA,OAC/B,CAAE,CAAA;AAAA,IACJ;AAAA,GACF;AACF","file":"index.cjs","sourcesContent":["/**\n * Minimal English string catalog + a `t(id, vars?)` resolver.\n *\n * Every user-facing string in this package and its downstream hooks/components\n * routes through this module so a future `{ locale }` can resolve translations\n * **without an API break** (PLAN_2 Part A design constraint). v1 ships English\n * only; the resolver signature is already locale-shaped.\n *\n * ## Why a catalog and not inline literals\n *\n * Components published to third parties cannot assume the host's language. By\n * keying every literal here:\n * - adding a locale is a data change (a new {@link StringCatalog}), not a code\n * change to every component;\n * - the message ids are a stable contract the components agent binds to;\n * - `{var}` interpolation is centralized and SSR-safe (pure string ops, no\n * `Intl` global assumptions at module scope).\n *\n * @module strings\n */\n\n/**\n * The catalog shape: every message id maps to an English template. `{name}`\n * placeholders are filled by {@link t} from the `vars` argument.\n */\nexport interface StringCatalog {\n readonly [id: string]: string;\n}\n\n/**\n * Default English catalog. Keep ids namespaced by surface\n * (`provider.*`, `referrer.*`, `transport.*`, `hire.*`, ...) so the components\n * agent can extend it without collisions.\n */\nexport const EN_STRINGS = {\n // Provider / context wiring errors (developer-facing, but routed for parity).\n \"provider.missingContext\":\n \"useAgencContext must be used within <AgencProvider>.\",\n \"provider.missingWriteClient\":\n \"No write client is configured. Pass config.client, or config.rpcUrl + config.signer, to <AgencProvider> before using a mutating hook.\",\n \"provider.missingSigner\":\n \"No signer is configured on <AgencProvider>. Connect a wallet or pass config.signer.\",\n\n // Referrer config validation (the P6.2 gate surface).\n \"referrer.invalidWallet\":\n \"Referrer wallet is not a valid base58 Solana address: {wallet}.\",\n \"referrer.invalidFeeBps\":\n \"Referrer feeBps must be an integer between {min} and {max} (basis points); got {feeBps}.\",\n \"referrer.notLive\":\n \"This site earns a referral fee (pending protocol support).\",\n \"referrer.notLiveReason\":\n \"Referral settlement is not yet deployed on this cluster (PLAN.md P6.2). Referrer config is accepted and validated but not injected into hires.\",\n\n // Read transport.\n \"transport.noReadSource\":\n \"No read source is configured. Pass an indexer baseUrl, an rpc/queryTransport, to <AgencProvider> or createReadTransport().\",\n\n // Generic loading / empty / error states (components extend these).\n \"state.loading\": \"Loading…\",\n \"state.empty\": \"Nothing to show yet.\",\n \"state.error\": \"Something went wrong.\",\n\n // Hire flow shells (components fill out the rest).\n \"hire.cta\": \"Hire\",\n \"hire.pending\": \"Confirming…\",\n \"hire.funded\": \"Escrow funded.\",\n} as const satisfies StringCatalog;\n\n/** A message id present in the default English catalog. */\nexport type StringId = keyof typeof EN_STRINGS;\n\n/** Interpolation variables for {@link t}: `{name}` → `vars.name`. */\nexport type StringVars = Record<string, string | number | bigint>;\n\n/**\n * Options for {@link t}. `locale` is accepted today (English-only) so adding\n * real locales later does not break the call signature; `catalog` lets a host\n * inject an override/extension catalog.\n */\nexport interface TranslateOptions {\n /** BCP-47 locale tag. v1 resolves everything to English regardless. */\n locale?: string;\n /** Override catalog (e.g. a future locale, or host-supplied copy). */\n catalog?: StringCatalog;\n}\n\n/**\n * Resolve a message id to its localized string with `{var}` interpolation.\n *\n * Unknown ids and unmatched placeholders are returned verbatim (the id itself,\n * or the `{placeholder}` left intact) rather than throwing — a missing string\n * must never crash a money-handling UI.\n *\n * @param id - The message id (a {@link StringId}, or any string for host\n * catalogs).\n * @param vars - Values for `{name}` placeholders in the template.\n * @param options - Optional `locale` (forward-compatible) and `catalog`\n * override.\n * @returns The interpolated string.\n *\n * @example\n * ```ts\n * t(\"referrer.invalidFeeBps\", { min: 0, max: 10000, feeBps: 99999 });\n * // -> \"Referrer feeBps must be an integer between 0 and 10000 ...; got 99999.\"\n * ```\n */\nexport function t(\n id: StringId | (string & {}),\n vars?: StringVars,\n options?: TranslateOptions,\n): string {\n const catalog: StringCatalog = options?.catalog ?? EN_STRINGS;\n const template = catalog[id] ?? id;\n if (vars === undefined) return template;\n return template.replace(/\\{(\\w+)\\}/g, (match, key: string) => {\n const value = vars[key];\n return value === undefined ? match : String(value);\n });\n}\n","/**\n * Signer-adapter string catalog (the `signer.*` namespace).\n *\n * Kept local to `src/signers/**` so the adapters route every user-facing string\n * through the package's {@link t} resolver (the PLAN_2 Part A locale contract)\n * WITHOUT cross-editing the shared `src/strings` catalog owned by another\n * surface. A future locale can extend `EN_SIGNER_STRINGS` the same way.\n *\n * @module signers/strings\n */\nimport { t, type StringCatalog } from \"../strings/index.js\";\n\n/** English `signer.*` strings used by the wallet/embedded adapters. */\nexport const EN_SIGNER_STRINGS = {\n \"signer.walletNoSignFeature\":\n \"Wallet account {address} does not expose a solana:signTransaction feature. Pass options.signTransaction explicitly, or use a Wallet Standard account that supports transaction signing.\",\n \"signer.walletNoSignature\":\n \"The wallet returned no signature for account {address}. The wallet may have rejected or modified the transaction so the fee-payer signature is absent.\",\n \"signer.embeddedSignatureCount\":\n \"Embedded wallet returned {got} signatures for {expected} transactions; expected one per transaction.\",\n \"signer.walletAdapterDisconnected\":\n \"The wallet adapter is not connected (publicKey is null). Connect the wallet before creating a signer.\",\n \"signer.walletAdapterNoSign\":\n \"The wallet adapter does not expose signTransaction. Use a wallet that supports transaction signing, or migrate to the Wallet Standard path (signerFromWalletAccount).\",\n} as const satisfies StringCatalog;\n\n/** A `signer.*` message id. */\nexport type SignerStringId = keyof typeof EN_SIGNER_STRINGS;\n\n/**\n * `t()` bound to the signer catalog: resolves `signer.*` ids while preserving\n * the shared resolver's interpolation + verbatim-fallback behavior.\n */\nexport function ts(\n id: SignerStringId,\n vars?: Record<string, string | number | bigint>,\n): string {\n return t(id, vars, { catalog: EN_SIGNER_STRINGS });\n}\n","/**\n * Wallet Standard → kit `TransactionSigner` bridge (PLAN.md P4.1 / PLAN_2 D-1).\n *\n * Turns a connected browser wallet into the {@link TransactionSigner} the SDK's\n * `createMarketplaceClient` consumes. The SDK client signs via\n * `signTransactionMessageWithSigners(...)` and submits through its OWN transport\n * — so it needs a PARTIAL signer (one that returns signatures without sending),\n * NOT a `TransactionSendingSigner` (which `signTransactionMessageWithSigners`\n * deliberately ignores). This bridge therefore produces a\n * {@link TransactionPartialSigner}: it serializes each transaction, hands it to\n * the wallet's `solana:signTransaction` feature, and diffs the returned signed\n * transaction to recover THIS account's signature.\n *\n * @see {@link signerFromWalletAccount}\n * @module signers/wallet-account\n */\nimport {\n address,\n getTransactionDecoder,\n getTransactionEncoder,\n type Address,\n type SignatureBytes,\n type Transaction,\n} from \"@solana/kit\";\nimport { ts } from \"./strings.js\";\nimport type {\n SignerFromWalletAccountOptions,\n TransactionSigner,\n WalletStandardAccountLike,\n WalletStandardSignTransaction,\n} from \"./types.js\";\n\nconst SOLANA_SIGN_TRANSACTION = \"solana:signTransaction\";\n\n/** Resolve the wallet's `solana:signTransaction` method from account/options. */\nfunction resolveSignTransaction(\n account: WalletStandardAccountLike,\n options: SignerFromWalletAccountOptions,\n): WalletStandardSignTransaction {\n if (options.signTransaction) return options.signTransaction;\n const feature = account.features?.[SOLANA_SIGN_TRANSACTION] as\n | { signTransaction?: WalletStandardSignTransaction }\n | undefined;\n if (feature?.signTransaction) return feature.signTransaction;\n throw new Error(ts(\"signer.walletNoSignFeature\", { address: account.address }));\n}\n\n/** Pick the CAIP-2 chain to forward to the wallet. */\nfunction resolveChain(\n account: WalletStandardAccountLike,\n options: SignerFromWalletAccountOptions,\n): string | undefined {\n if (options.chain) return options.chain;\n return account.chains?.find((c) => c.startsWith(\"solana:\"));\n}\n\n/**\n * Bridge a Wallet Standard account into a kit {@link TransactionSigner}.\n *\n * Accepts either a real `UiWalletAccount` (the `@solana/react` path — pass the\n * account and a `chain`, or pass the hook's feature via\n * {@link SignerFromWalletAccountOptions.signTransaction}) or any object exposing\n * the `solana:signTransaction` feature. The returned signer is a\n * {@link TransactionPartialSigner}, the exact shape the SDK client expects.\n *\n * Wallets may MODIFY a transaction before signing (priority fees, guard\n * instructions). We honor that by decoding the wallet's returned signed\n * transaction and extracting only THIS account's signature; the SDK client then\n * re-assembles and submits. (If a wallet rewrites the message such that the\n * fee-payer's own prior signing is invalidated, that is a wallet contract the\n * SDK's single-fee-payer flow already assumes won't happen for the payer.)\n *\n * SSR-safe: constructs no browser globals; the wallet round-trip only runs when\n * a transaction is actually signed.\n *\n * @param account - The connected Wallet Standard account (needs `address`).\n * @param options - Chain + an optional explicit `signTransaction` override.\n * @returns A kit {@link TransactionSigner} usable as `config.signer`.\n * @throws Error if no `solana:signTransaction` feature can be resolved.\n *\n * @example\n * ```ts\n * // With @solana/react (Wallet Standard):\n * const account = useSelectedWalletAccount(); // UiWalletAccount\n * const signer = signerFromWalletAccount(account, { chain: \"solana:devnet\" });\n * // -> pass `signer` to <AgencProvider config={{ signer, rpcUrl }}>.\n * ```\n */\nexport function signerFromWalletAccount(\n account: WalletStandardAccountLike,\n options: SignerFromWalletAccountOptions = {},\n): TransactionSigner {\n const signerAddress: Address = address(account.address);\n const signTransaction = resolveSignTransaction(account, options);\n const chain = resolveChain(account, options);\n const encoder = getTransactionEncoder();\n const decoder = getTransactionDecoder();\n\n async function signOne(transaction: Transaction): Promise<SignatureBytes> {\n const wireBytes = new Uint8Array(encoder.encode(transaction));\n const [output] = await signTransaction({\n transaction: wireBytes,\n ...(chain ? { chain } : {}),\n });\n if (!output) {\n throw new Error(ts(\"signer.walletNoSignature\", { address: account.address }));\n }\n const signed = decoder.decode(output.signedTransaction);\n const signature = signed.signatures[signerAddress];\n if (!signature) {\n throw new Error(ts(\"signer.walletNoSignature\", { address: account.address }));\n }\n return signature as SignatureBytes;\n }\n\n return {\n address: signerAddress,\n async signTransactions(transactions) {\n // Sign in parallel — partial signers are order-independent (each returns a\n // single-entry SignatureDictionary the caller merges).\n return Promise.all(\n transactions.map(async (transaction) => ({\n [signerAddress]: await signOne(transaction),\n })),\n );\n },\n } satisfies TransactionSigner;\n}\n","/**\n * LEGACY `@solana/wallet-adapter` compatibility shim (PLAN.md P4.1).\n *\n * The supported, robust path for browser wallets is the Wallet Standard bridge\n * ({@link signerFromWalletAccount} via `@solana/react`): every modern wallet —\n * including all wallet-adapter wallets — registers as a Wallet Standard wallet,\n * so a wallet-adapter app can migrate by reading the selected account through\n * `@solana/react` and dropping it into `signerFromWalletAccount`. PREFER THAT.\n *\n * This shim exists for apps still holding a raw wallet-adapter\n * `WalletContextState` (web3.js v1 `signTransaction`). It bridges WITHOUT a hard\n * dependency on `@solana/wallet-adapter-*` OR `@solana/web3.js` (1.x): the\n * caller injects the web3.js `VersionedTransaction` class (the only piece we\n * cannot reconstruct), and we round-trip through the shared wire format — a kit\n * {@link Transaction} and a web3.js `VersionedTransaction` serialize to the SAME\n * bytes, so no semantic re-encoding is needed.\n *\n * SSR-safe: no browser globals at module scope.\n *\n * @module signers/wallet-adapter\n */\nimport {\n address,\n getTransactionDecoder,\n getTransactionEncoder,\n type SignatureBytes,\n type Transaction,\n} from \"@solana/kit\";\nimport { ts } from \"./strings.js\";\nimport type { TransactionSigner } from \"./types.js\";\n\n/**\n * The web3.js v1 `VersionedTransaction` surface this shim needs: a static\n * `deserialize(bytes)` and an instance `serialize()`. Pass the real class from\n * `@solana/web3.js` — typed structurally so this module never imports it.\n */\nexport interface VersionedTransactionLike {\n serialize(): Uint8Array;\n}\n\n/** The static side of the injected `VersionedTransaction` class. */\nexport interface VersionedTransactionCtor {\n deserialize(bytes: Uint8Array): VersionedTransactionLike;\n}\n\n/**\n * The minimal slice of a wallet-adapter `WalletContextState` this shim consumes.\n * Both `publicKey` (anything with a base58 `toString()`/`toBase58()`) and the\n * v1 `signTransaction` are required; a connected adapter exposes both.\n */\nexport interface WalletAdapterLike {\n /** The connected account's public key (base58 via `toBase58()`/`toString()`). */\n readonly publicKey:\n | { toBase58(): string }\n | { toString(): string }\n | string\n | null;\n /** web3.js v1 sign — returns the same transaction type, signed. */\n signTransaction?: <T extends VersionedTransactionLike>(\n transaction: T,\n ) => Promise<T>;\n}\n\n/** Options for {@link signerFromWalletAdapter}. */\nexport interface SignerFromWalletAdapterOptions {\n /**\n * The web3.js `VersionedTransaction` class (`import { VersionedTransaction }\n * from \"@solana/web3.js\"`). Required — it is the one piece this no-dep shim\n * cannot supply itself.\n */\n VersionedTransaction: VersionedTransactionCtor;\n}\n\nfunction resolveAdapterAddress(adapter: WalletAdapterLike): string {\n const { publicKey } = adapter;\n if (publicKey == null) {\n throw new Error(ts(\"signer.walletAdapterDisconnected\"));\n }\n if (typeof publicKey === \"string\") return publicKey;\n if (\"toBase58\" in publicKey && typeof publicKey.toBase58 === \"function\") {\n return publicKey.toBase58();\n }\n return String(publicKey);\n}\n\n/**\n * Bridge a LEGACY `@solana/wallet-adapter` `WalletContextState` into a kit\n * {@link TransactionSigner}.\n *\n * Use only when you cannot reach the wallet through `@solana/react`. The result\n * is a {@link TransactionPartialSigner} (the SDK client owns submission), built\n * by serializing the kit transaction to wire bytes, rehydrating it as a web3.js\n * `VersionedTransaction`, handing THAT to the adapter's `signTransaction`, then\n * decoding the signed wire bytes back to a kit transaction to extract this\n * account's signature.\n *\n * @param adapter - A connected wallet-adapter state (`publicKey` + `signTransaction`).\n * @param options - Must inject the web3.js `VersionedTransaction` class.\n * @returns A kit {@link TransactionSigner} usable as `config.signer`.\n * @throws Error if the adapter is disconnected or lacks `signTransaction`.\n *\n * @example\n * ```ts\n * import { VersionedTransaction } from \"@solana/web3.js\";\n * import { useWallet } from \"@solana/wallet-adapter-react\";\n *\n * const wallet = useWallet();\n * const signer = signerFromWalletAdapter(wallet, { VersionedTransaction });\n * // -> pass `signer` to <AgencProvider config={{ signer, rpcUrl }}>.\n * ```\n */\nexport function signerFromWalletAdapter(\n adapter: WalletAdapterLike,\n options: SignerFromWalletAdapterOptions,\n): TransactionSigner {\n const signerAddress = address(resolveAdapterAddress(adapter));\n const { signTransaction } = adapter;\n if (typeof signTransaction !== \"function\") {\n throw new Error(ts(\"signer.walletAdapterNoSign\"));\n }\n const { VersionedTransaction } = options;\n const encoder = getTransactionEncoder();\n const decoder = getTransactionDecoder();\n\n async function signOne(transaction: Transaction): Promise<SignatureBytes> {\n const wireBytes = new Uint8Array(encoder.encode(transaction));\n const legacyTx = VersionedTransaction.deserialize(wireBytes);\n const signed = await signTransaction!(legacyTx);\n const signedTx = decoder.decode(new Uint8Array(signed.serialize()));\n const signature = signedTx.signatures[signerAddress];\n if (!signature) {\n throw new Error(\n ts(\"signer.walletNoSignature\", { address: signerAddress }),\n );\n }\n return signature as SignatureBytes;\n }\n\n return {\n address: signerAddress,\n async signTransactions(transactions) {\n return Promise.all(\n transactions.map(async (transaction) => ({\n [signerAddress]: await signOne(transaction),\n })),\n );\n },\n } satisfies TransactionSigner;\n}\n","/**\n * Embedded / walletless → kit `TransactionSigner` bridge (PLAN_2 D-1).\n *\n * The \"no wallet, no SOL\" buyer path. A vendor-neutral\n * {@link EmbeddedWalletProvider} (Privy / Dynamic / Web3Auth — `[HUMAN]`-gated)\n * handles email/social login + key custody; this module lifts a live\n * {@link EmbeddedWalletConnection} into the kit {@link TransactionSigner} the SDK\n * client consumes. As with the Wallet Standard bridge, the result is a PARTIAL\n * signer — the vendor signs, the SDK client's transport broadcasts.\n *\n * @see {@link signerFromEmbeddedWallet}\n * @see {@link createMockEmbeddedWallet} — the local-keypair test adapter.\n * @module signers/embedded-wallet\n */\nimport { address, type SignatureBytes, type Transaction } from \"@solana/kit\";\nimport { ts } from \"./strings.js\";\nimport type {\n EmbeddedWalletConnection,\n TransactionSigner,\n} from \"./types.js\";\n\n/**\n * Bridge a CONNECTED embedded-wallet connection into a kit\n * {@link TransactionSigner}.\n *\n * Call this AFTER `provider.connect()` resolves — it needs the live\n * {@link EmbeddedWalletConnection} (address + `signTransactions`). The hooks\n * layer (`useWalletSigner`) is expected to own the connect lifecycle and call\n * this once a connection exists.\n *\n * @param connection - A live embedded-wallet connection.\n * @returns A kit {@link TransactionSigner} usable as `config.signer`.\n *\n * @example\n * ```ts\n * const connection = await provider.connect(); // vendor login\n * const signer = signerFromEmbeddedWallet(connection);\n * // -> pass `signer` to <AgencProvider config={{ signer, rpcUrl }}>.\n * ```\n */\nexport function signerFromEmbeddedWallet(\n connection: EmbeddedWalletConnection,\n): TransactionSigner {\n const signerAddress = address(connection.address);\n\n return {\n address: signerAddress,\n async signTransactions(transactions: readonly Transaction[]) {\n const signatures: readonly SignatureBytes[] =\n await connection.signTransactions(transactions);\n if (signatures.length !== transactions.length) {\n throw new Error(\n ts(\"signer.embeddedSignatureCount\", {\n expected: transactions.length,\n got: signatures.length,\n }),\n );\n }\n return transactions.map((_, i) => ({\n [signerAddress]: signatures[i] as SignatureBytes,\n }));\n },\n } satisfies TransactionSigner;\n}\n"]}
1
+ {"version":3,"sources":["../../src/strings/index.ts","../../src/signers/strings.ts","../../src/signers/wallet-account.ts","../../src/signers/wallet-adapter.ts","../../src/signers/embedded-wallet.ts"],"names":["address","getTransactionEncoder","getTransactionDecoder"],"mappings":";;;;;;;AAkCO,IAAM,UAAA,GAAa;AAAA;AAAA,EAExB,yBAAA,EACE,sDAAA;AAAA,EACF,6BAAA,EACE,uIAAA;AAAA,EACF,wBAAA,EACE,qFAAA;AAAA;AAAA,EAGF,wBAAA,EACE,iEAAA;AAAA,EACF,wBAAA,EACE,0FAAA;AAAA,EACF,kBAAA,EACE,2CAAA;AAAA,EACF,wBAAA,EACE,8CAAA;AAAA,EACF,gCAAA,EACE,mGAAA;AAAA;AAAA,EAGF,wBAAA,EACE,4HAAA;AAAA;AAAA,EAGF,eAAA,EAAiB,eAAA;AAAA,EACjB,aAAA,EAAe,sBAAA;AAAA,EACf,aAAA,EAAe,uBAAA;AAAA;AAAA,EAGf,UAAA,EAAY,MAAA;AAAA,EACZ,cAAA,EAAgB,kBAAA;AAAA,EAChB,aAAA,EAAe;AACjB,CAAA;AAwCO,SAAS,CAAA,CACd,EAAA,EACA,IAAA,EACA,OAAA,EACQ;AACR,EAAA,MAAM,OAAA,GAAyB,SAAS,OAAA,IAAW,UAAA;AACnD,EAAA,MAAM,QAAA,GAAW,OAAA,CAAQ,EAAE,CAAA,IAAK,EAAA;AAChC,EAAA,IAAI,IAAA,KAAS,QAAW,OAAO,QAAA;AAC/B,EAAA,OAAO,QAAA,CAAS,OAAA,CAAQ,YAAA,EAAc,CAAC,OAAO,GAAA,KAAgB;AAC5D,IAAA,MAAM,KAAA,GAAQ,KAAK,GAAG,CAAA;AACtB,IAAA,OAAO,KAAA,KAAU,MAAA,GAAY,KAAA,GAAQ,MAAA,CAAO,KAAK,CAAA;AAAA,EACnD,CAAC,CAAA;AACH;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,EAAA,CAAG,0BAAA,EAA4B,EAAE,OAAA,EAAS,eAAe;AAAA,OAC3D;AAAA,IACF;AACA,IAAA,OAAO,SAAA;AAAA,EACT;AAEA,EAAA,OAAO;AAAA,IACL,OAAA,EAAS,aAAA;AAAA,IACT,MAAM,iBAAiB,YAAA,EAAc;AACnC,MAAA,OAAO,OAAA,CAAQ,GAAA;AAAA,QACb,YAAA,CAAa,GAAA,CAAI,OAAO,WAAA,MAAiB;AAAA,UACvC,CAAC,aAAa,GAAG,MAAM,QAAQ,WAAW;AAAA,SAC5C,CAAE;AAAA,OACJ;AAAA,IACF;AAAA,GACF;AACF;AC5GO,SAAS,yBACd,UAAA,EACmB;AACnB,EAAA,MAAM,aAAA,GAAgBF,WAAAA,CAAQ,UAAA,CAAW,OAAO,CAAA;AAEhD,EAAA,OAAO;AAAA,IACL,OAAA,EAAS,aAAA;AAAA,IACT,MAAM,iBAAiB,YAAA,EAAsC;AAC3D,MAAA,MAAM,UAAA,GACJ,MAAM,UAAA,CAAW,gBAAA,CAAiB,YAAY,CAAA;AAChD,MAAA,IAAI,UAAA,CAAW,MAAA,KAAW,YAAA,CAAa,MAAA,EAAQ;AAC7C,QAAA,MAAM,IAAI,KAAA;AAAA,UACR,GAAG,+BAAA,EAAiC;AAAA,YAClC,UAAU,YAAA,CAAa,MAAA;AAAA,YACvB,KAAK,UAAA,CAAW;AAAA,WACjB;AAAA,SACH;AAAA,MACF;AACA,MAAA,OAAO,YAAA,CAAa,GAAA,CAAI,CAAC,CAAA,EAAG,CAAA,MAAO;AAAA,QACjC,CAAC,aAAa,GAAG,UAAA,CAAW,CAAC;AAAA,OAC/B,CAAE,CAAA;AAAA,IACJ;AAAA,GACF;AACF","file":"index.cjs","sourcesContent":["/**\n * Minimal English string catalog + a `t(id, vars?)` resolver.\n *\n * Every user-facing string in this package and its downstream hooks/components\n * routes through this module so a future `{ locale }` can resolve translations\n * **without an API break** (PLAN_2 Part A design constraint). v1 ships English\n * only; the resolver signature is already locale-shaped.\n *\n * ## Why a catalog and not inline literals\n *\n * Components published to third parties cannot assume the host's language. By\n * keying every literal here:\n * - adding a locale is a data change (a new {@link StringCatalog}), not a code\n * change to every component;\n * - the message ids are a stable contract the components agent binds to;\n * - `{var}` interpolation is centralized and SSR-safe (pure string ops, no\n * `Intl` global assumptions at module scope).\n *\n * @module strings\n */\n\n/**\n * The catalog shape: every message id maps to an English template. `{name}`\n * placeholders are filled by {@link t} from the `vars` argument.\n */\nexport interface StringCatalog {\n readonly [id: string]: string;\n}\n\n/**\n * Default English catalog. Keep ids namespaced by surface\n * (`provider.*`, `referrer.*`, `transport.*`, `hire.*`, ...) so the components\n * agent can extend it without collisions.\n */\nexport const EN_STRINGS = {\n // Provider / context wiring errors (developer-facing, but routed for parity).\n \"provider.missingContext\":\n \"useAgencContext must be used within <AgencProvider>.\",\n \"provider.missingWriteClient\":\n \"No write client is configured. Pass config.client, or config.rpcUrl + config.signer, to <AgencProvider> before using a mutating hook.\",\n \"provider.missingSigner\":\n \"No signer is configured on <AgencProvider>. Connect a wallet or pass config.signer.\",\n\n // Referrer config validation / capability surface.\n \"referrer.invalidWallet\":\n \"Referrer wallet is not a valid base58 Solana address: {wallet}.\",\n \"referrer.invalidFeeBps\":\n \"Referrer feeBps must be an integer between {min} and {max} (basis points); got {feeBps}.\",\n \"referrer.notLive\":\n \"Referral fee is not active for this hire.\",\n \"referrer.notLiveReason\":\n \"No referrer is configured for this provider.\",\n \"referrer.earningsNotLiveReason\":\n \"Referral settlement is live, but aggregated referrer earnings are not yet exposed by the indexer.\",\n\n // Read transport.\n \"transport.noReadSource\":\n \"No read source is configured. Pass an indexer baseUrl, an rpc/queryTransport, to <AgencProvider> or createReadTransport().\",\n\n // Generic loading / empty / error states (components extend these).\n \"state.loading\": \"Loading…\",\n \"state.empty\": \"Nothing to show yet.\",\n \"state.error\": \"Something went wrong.\",\n\n // Hire flow shells (components fill out the rest).\n \"hire.cta\": \"Hire\",\n \"hire.pending\": \"Confirming…\",\n \"hire.funded\": \"Escrow funded.\",\n} as const satisfies StringCatalog;\n\n/** A message id present in the default English catalog. */\nexport type StringId = keyof typeof EN_STRINGS;\n\n/** Interpolation variables for {@link t}: `{name}` → `vars.name`. */\nexport type StringVars = Record<string, string | number | bigint>;\n\n/**\n * Options for {@link t}. `locale` is accepted today (English-only) so adding\n * real locales later does not break the call signature; `catalog` lets a host\n * inject an override/extension catalog.\n */\nexport interface TranslateOptions {\n /** BCP-47 locale tag. v1 resolves everything to English regardless. */\n locale?: string;\n /** Override catalog (e.g. a future locale, or host-supplied copy). */\n catalog?: StringCatalog;\n}\n\n/**\n * Resolve a message id to its localized string with `{var}` interpolation.\n *\n * Unknown ids and unmatched placeholders are returned verbatim (the id itself,\n * or the `{placeholder}` left intact) rather than throwing — a missing string\n * must never crash a money-handling UI.\n *\n * @param id - The message id (a {@link StringId}, or any string for host\n * catalogs).\n * @param vars - Values for `{name}` placeholders in the template.\n * @param options - Optional `locale` (forward-compatible) and `catalog`\n * override.\n * @returns The interpolated string.\n *\n * @example\n * ```ts\n * t(\"referrer.invalidFeeBps\", { min: 0, max: 10000, feeBps: 99999 });\n * // -> \"Referrer feeBps must be an integer between 0 and 10000 ...; got 99999.\"\n * ```\n */\nexport function t(\n id: StringId | (string & {}),\n vars?: StringVars,\n options?: TranslateOptions,\n): string {\n const catalog: StringCatalog = options?.catalog ?? EN_STRINGS;\n const template = catalog[id] ?? id;\n if (vars === undefined) return template;\n return template.replace(/\\{(\\w+)\\}/g, (match, key: string) => {\n const value = vars[key];\n return value === undefined ? match : String(value);\n });\n}\n","/**\n * Signer-adapter string catalog (the `signer.*` namespace).\n *\n * Kept local to `src/signers/**` so the adapters route every user-facing string\n * through the package's {@link t} resolver (the PLAN_2 Part A locale contract)\n * WITHOUT cross-editing the shared `src/strings` catalog owned by another\n * surface. A future locale can extend `EN_SIGNER_STRINGS` the same way.\n *\n * @module signers/strings\n */\nimport { t, type StringCatalog } from \"../strings/index.js\";\n\n/** English `signer.*` strings used by the wallet/embedded adapters. */\nexport const EN_SIGNER_STRINGS = {\n \"signer.walletNoSignFeature\":\n \"Wallet account {address} does not expose a solana:signTransaction feature. Pass options.signTransaction explicitly, or use a Wallet Standard account that supports transaction signing.\",\n \"signer.walletNoSignature\":\n \"The wallet returned no signature for account {address}. The wallet may have rejected or modified the transaction so the fee-payer signature is absent.\",\n \"signer.embeddedSignatureCount\":\n \"Embedded wallet returned {got} signatures for {expected} transactions; expected one per transaction.\",\n \"signer.walletAdapterDisconnected\":\n \"The wallet adapter is not connected (publicKey is null). Connect the wallet before creating a signer.\",\n \"signer.walletAdapterNoSign\":\n \"The wallet adapter does not expose signTransaction. Use a wallet that supports transaction signing, or migrate to the Wallet Standard path (signerFromWalletAccount).\",\n} as const satisfies StringCatalog;\n\n/** A `signer.*` message id. */\nexport type SignerStringId = keyof typeof EN_SIGNER_STRINGS;\n\n/**\n * `t()` bound to the signer catalog: resolves `signer.*` ids while preserving\n * the shared resolver's interpolation + verbatim-fallback behavior.\n */\nexport function ts(\n id: SignerStringId,\n vars?: Record<string, string | number | bigint>,\n): string {\n return t(id, vars, { catalog: EN_SIGNER_STRINGS });\n}\n","/**\n * Wallet Standard → kit `TransactionSigner` bridge (PLAN.md P4.1 / PLAN_2 D-1).\n *\n * Turns a connected browser wallet into the {@link TransactionSigner} the SDK's\n * `createMarketplaceClient` consumes. The SDK client signs via\n * `signTransactionMessageWithSigners(...)` and submits through its OWN transport\n * — so it needs a PARTIAL signer (one that returns signatures without sending),\n * NOT a `TransactionSendingSigner` (which `signTransactionMessageWithSigners`\n * deliberately ignores). This bridge therefore produces a\n * {@link TransactionPartialSigner}: it serializes each transaction, hands it to\n * the wallet's `solana:signTransaction` feature, and diffs the returned signed\n * transaction to recover THIS account's signature.\n *\n * @see {@link signerFromWalletAccount}\n * @module signers/wallet-account\n */\nimport {\n address,\n getTransactionDecoder,\n getTransactionEncoder,\n type Address,\n type SignatureBytes,\n type Transaction,\n} from \"@solana/kit\";\nimport { ts } from \"./strings.js\";\nimport type {\n SignerFromWalletAccountOptions,\n TransactionSigner,\n WalletStandardAccountLike,\n WalletStandardSignTransaction,\n} from \"./types.js\";\n\nconst SOLANA_SIGN_TRANSACTION = \"solana:signTransaction\";\n\n/** Resolve the wallet's `solana:signTransaction` method from account/options. */\nfunction resolveSignTransaction(\n account: WalletStandardAccountLike,\n options: SignerFromWalletAccountOptions,\n): WalletStandardSignTransaction {\n if (options.signTransaction) return options.signTransaction;\n const feature = account.features?.[SOLANA_SIGN_TRANSACTION] as\n | { signTransaction?: WalletStandardSignTransaction }\n | undefined;\n if (feature?.signTransaction) return feature.signTransaction;\n throw new Error(ts(\"signer.walletNoSignFeature\", { address: account.address }));\n}\n\n/** Pick the CAIP-2 chain to forward to the wallet. */\nfunction resolveChain(\n account: WalletStandardAccountLike,\n options: SignerFromWalletAccountOptions,\n): string | undefined {\n if (options.chain) return options.chain;\n return account.chains?.find((c) => c.startsWith(\"solana:\"));\n}\n\n/**\n * Bridge a Wallet Standard account into a kit {@link TransactionSigner}.\n *\n * Accepts either a real `UiWalletAccount` (the `@solana/react` path — pass the\n * account and a `chain`, or pass the hook's feature via\n * {@link SignerFromWalletAccountOptions.signTransaction}) or any object exposing\n * the `solana:signTransaction` feature. The returned signer is a\n * {@link TransactionPartialSigner}, the exact shape the SDK client expects.\n *\n * Wallets may MODIFY a transaction before signing (priority fees, guard\n * instructions). We honor that by decoding the wallet's returned signed\n * transaction and extracting only THIS account's signature; the SDK client then\n * re-assembles and submits. (If a wallet rewrites the message such that the\n * fee-payer's own prior signing is invalidated, that is a wallet contract the\n * SDK's single-fee-payer flow already assumes won't happen for the payer.)\n *\n * SSR-safe: constructs no browser globals; the wallet round-trip only runs when\n * a transaction is actually signed.\n *\n * @param account - The connected Wallet Standard account (needs `address`).\n * @param options - Chain + an optional explicit `signTransaction` override.\n * @returns A kit {@link TransactionSigner} usable as `config.signer`.\n * @throws Error if no `solana:signTransaction` feature can be resolved.\n *\n * @example\n * ```ts\n * // With @solana/react (Wallet Standard):\n * const account = useSelectedWalletAccount(); // UiWalletAccount\n * const signer = signerFromWalletAccount(account, { chain: \"solana:devnet\" });\n * // -> pass `signer` to <AgencProvider config={{ signer, rpcUrl }}>.\n * ```\n */\nexport function signerFromWalletAccount(\n account: WalletStandardAccountLike,\n options: SignerFromWalletAccountOptions = {},\n): TransactionSigner {\n const signerAddress: Address = address(account.address);\n const signTransaction = resolveSignTransaction(account, options);\n const chain = resolveChain(account, options);\n const encoder = getTransactionEncoder();\n const decoder = getTransactionDecoder();\n\n async function signOne(transaction: Transaction): Promise<SignatureBytes> {\n const wireBytes = new Uint8Array(encoder.encode(transaction));\n const [output] = await signTransaction({\n transaction: wireBytes,\n ...(chain ? { chain } : {}),\n });\n if (!output) {\n throw new Error(ts(\"signer.walletNoSignature\", { address: account.address }));\n }\n const signed = decoder.decode(output.signedTransaction);\n const signature = signed.signatures[signerAddress];\n if (!signature) {\n throw new Error(ts(\"signer.walletNoSignature\", { address: account.address }));\n }\n return signature as SignatureBytes;\n }\n\n return {\n address: signerAddress,\n async signTransactions(transactions) {\n // Sign in parallel — partial signers are order-independent (each returns a\n // single-entry SignatureDictionary the caller merges).\n return Promise.all(\n transactions.map(async (transaction) => ({\n [signerAddress]: await signOne(transaction),\n })),\n );\n },\n } satisfies TransactionSigner;\n}\n","/**\n * LEGACY `@solana/wallet-adapter` compatibility shim (PLAN.md P4.1).\n *\n * The supported, robust path for browser wallets is the Wallet Standard bridge\n * ({@link signerFromWalletAccount} via `@solana/react`): every modern wallet —\n * including all wallet-adapter wallets — registers as a Wallet Standard wallet,\n * so a wallet-adapter app can migrate by reading the selected account through\n * `@solana/react` and dropping it into `signerFromWalletAccount`. PREFER THAT.\n *\n * This shim exists for apps still holding a raw wallet-adapter\n * `WalletContextState` (web3.js v1 `signTransaction`). It bridges WITHOUT a hard\n * dependency on `@solana/wallet-adapter-*` OR `@solana/web3.js` (1.x): the\n * caller injects the web3.js `VersionedTransaction` class (the only piece we\n * cannot reconstruct), and we round-trip through the shared wire format — a kit\n * {@link Transaction} and a web3.js `VersionedTransaction` serialize to the SAME\n * bytes, so no semantic re-encoding is needed.\n *\n * SSR-safe: no browser globals at module scope.\n *\n * @module signers/wallet-adapter\n */\nimport {\n address,\n getTransactionDecoder,\n getTransactionEncoder,\n type SignatureBytes,\n type Transaction,\n} from \"@solana/kit\";\nimport { ts } from \"./strings.js\";\nimport type { TransactionSigner } from \"./types.js\";\n\n/**\n * The web3.js v1 `VersionedTransaction` surface this shim needs: a static\n * `deserialize(bytes)` and an instance `serialize()`. Pass the real class from\n * `@solana/web3.js` — typed structurally so this module never imports it.\n */\nexport interface VersionedTransactionLike {\n serialize(): Uint8Array;\n}\n\n/** The static side of the injected `VersionedTransaction` class. */\nexport interface VersionedTransactionCtor {\n deserialize(bytes: Uint8Array): VersionedTransactionLike;\n}\n\n/**\n * The minimal slice of a wallet-adapter `WalletContextState` this shim consumes.\n * Both `publicKey` (anything with a base58 `toString()`/`toBase58()`) and the\n * v1 `signTransaction` are required; a connected adapter exposes both.\n */\nexport interface WalletAdapterLike {\n /** The connected account's public key (base58 via `toBase58()`/`toString()`). */\n readonly publicKey:\n | { toBase58(): string }\n | { toString(): string }\n | string\n | null;\n /** web3.js v1 sign — returns the same transaction type, signed. */\n signTransaction?: <T extends VersionedTransactionLike>(\n transaction: T,\n ) => Promise<T>;\n}\n\n/** Options for {@link signerFromWalletAdapter}. */\nexport interface SignerFromWalletAdapterOptions {\n /**\n * The web3.js `VersionedTransaction` class (`import { VersionedTransaction }\n * from \"@solana/web3.js\"`). Required — it is the one piece this no-dep shim\n * cannot supply itself.\n */\n VersionedTransaction: VersionedTransactionCtor;\n}\n\nfunction resolveAdapterAddress(adapter: WalletAdapterLike): string {\n const { publicKey } = adapter;\n if (publicKey == null) {\n throw new Error(ts(\"signer.walletAdapterDisconnected\"));\n }\n if (typeof publicKey === \"string\") return publicKey;\n if (\"toBase58\" in publicKey && typeof publicKey.toBase58 === \"function\") {\n return publicKey.toBase58();\n }\n return String(publicKey);\n}\n\n/**\n * Bridge a LEGACY `@solana/wallet-adapter` `WalletContextState` into a kit\n * {@link TransactionSigner}.\n *\n * Use only when you cannot reach the wallet through `@solana/react`. The result\n * is a {@link TransactionPartialSigner} (the SDK client owns submission), built\n * by serializing the kit transaction to wire bytes, rehydrating it as a web3.js\n * `VersionedTransaction`, handing THAT to the adapter's `signTransaction`, then\n * decoding the signed wire bytes back to a kit transaction to extract this\n * account's signature.\n *\n * @param adapter - A connected wallet-adapter state (`publicKey` + `signTransaction`).\n * @param options - Must inject the web3.js `VersionedTransaction` class.\n * @returns A kit {@link TransactionSigner} usable as `config.signer`.\n * @throws Error if the adapter is disconnected or lacks `signTransaction`.\n *\n * @example\n * ```ts\n * import { VersionedTransaction } from \"@solana/web3.js\";\n * import { useWallet } from \"@solana/wallet-adapter-react\";\n *\n * const wallet = useWallet();\n * const signer = signerFromWalletAdapter(wallet, { VersionedTransaction });\n * // -> pass `signer` to <AgencProvider config={{ signer, rpcUrl }}>.\n * ```\n */\nexport function signerFromWalletAdapter(\n adapter: WalletAdapterLike,\n options: SignerFromWalletAdapterOptions,\n): TransactionSigner {\n const signerAddress = address(resolveAdapterAddress(adapter));\n const { signTransaction } = adapter;\n if (typeof signTransaction !== \"function\") {\n throw new Error(ts(\"signer.walletAdapterNoSign\"));\n }\n const { VersionedTransaction } = options;\n const encoder = getTransactionEncoder();\n const decoder = getTransactionDecoder();\n\n async function signOne(transaction: Transaction): Promise<SignatureBytes> {\n const wireBytes = new Uint8Array(encoder.encode(transaction));\n const legacyTx = VersionedTransaction.deserialize(wireBytes);\n const signed = await signTransaction!(legacyTx);\n const signedTx = decoder.decode(new Uint8Array(signed.serialize()));\n const signature = signedTx.signatures[signerAddress];\n if (!signature) {\n throw new Error(\n ts(\"signer.walletNoSignature\", { address: signerAddress }),\n );\n }\n return signature as SignatureBytes;\n }\n\n return {\n address: signerAddress,\n async signTransactions(transactions) {\n return Promise.all(\n transactions.map(async (transaction) => ({\n [signerAddress]: await signOne(transaction),\n })),\n );\n },\n } satisfies TransactionSigner;\n}\n","/**\n * Embedded / walletless → kit `TransactionSigner` bridge (PLAN_2 D-1).\n *\n * The \"no wallet, no SOL\" buyer path. A vendor-neutral\n * {@link EmbeddedWalletProvider} (Privy / Dynamic / Web3Auth — `[HUMAN]`-gated)\n * handles email/social login + key custody; this module lifts a live\n * {@link EmbeddedWalletConnection} into the kit {@link TransactionSigner} the SDK\n * client consumes. As with the Wallet Standard bridge, the result is a PARTIAL\n * signer — the vendor signs, the SDK client's transport broadcasts.\n *\n * @see {@link signerFromEmbeddedWallet}\n * @see {@link createMockEmbeddedWallet} — the local-keypair test adapter.\n * @module signers/embedded-wallet\n */\nimport { address, type SignatureBytes, type Transaction } from \"@solana/kit\";\nimport { ts } from \"./strings.js\";\nimport type {\n EmbeddedWalletConnection,\n TransactionSigner,\n} from \"./types.js\";\n\n/**\n * Bridge a CONNECTED embedded-wallet connection into a kit\n * {@link TransactionSigner}.\n *\n * Call this AFTER `provider.connect()` resolves — it needs the live\n * {@link EmbeddedWalletConnection} (address + `signTransactions`). The hooks\n * layer (`useWalletSigner`) is expected to own the connect lifecycle and call\n * this once a connection exists.\n *\n * @param connection - A live embedded-wallet connection.\n * @returns A kit {@link TransactionSigner} usable as `config.signer`.\n *\n * @example\n * ```ts\n * const connection = await provider.connect(); // vendor login\n * const signer = signerFromEmbeddedWallet(connection);\n * // -> pass `signer` to <AgencProvider config={{ signer, rpcUrl }}>.\n * ```\n */\nexport function signerFromEmbeddedWallet(\n connection: EmbeddedWalletConnection,\n): TransactionSigner {\n const signerAddress = address(connection.address);\n\n return {\n address: signerAddress,\n async signTransactions(transactions: readonly Transaction[]) {\n const signatures: readonly SignatureBytes[] =\n await connection.signTransactions(transactions);\n if (signatures.length !== transactions.length) {\n throw new Error(\n ts(\"signer.embeddedSignatureCount\", {\n expected: transactions.length,\n got: signatures.length,\n }),\n );\n }\n return transactions.map((_, i) => ({\n [signerAddress]: signatures[i] as SignatureBytes,\n }));\n },\n } satisfies TransactionSigner;\n}\n"]}
@@ -1,4 +1,4 @@
1
- export { EN_SIGNER_STRINGS, signerFromEmbeddedWallet, signerFromWalletAccount, signerFromWalletAdapter } from '../chunk-5OTKSRHM.js';
2
- import '../chunk-GN5DYVN5.js';
1
+ export { EN_SIGNER_STRINGS, signerFromEmbeddedWallet, signerFromWalletAccount, signerFromWalletAdapter } from '../chunk-MNJ2EQDJ.js';
2
+ import '../chunk-ECU7HGO3.js';
3
3
  //# sourceMappingURL=index.js.map
4
4
  //# sourceMappingURL=index.js.map
@@ -8,10 +8,10 @@ import { Address } from '@solana/kit';
8
8
  * MINUS the fee-payer signers, which default to the provider's write-client
9
9
  * signer (authority == creator == buyer). Pass them only to override.
10
10
  *
11
- * NOTE: deliberately NO referrer field — the referrer is provider-level config,
12
- * gated by P6.2, and is never threaded through a per-call hire input.
11
+ * NOTE: deliberately NO referrer field — the referrer is provider-level config
12
+ * and is injected only when `resolveReferrerCapability()` is live.
13
13
  */
14
- type HireInput = Omit<Parameters<typeof facade.hireFromListing>[0], "authority" | "creator"> & {
14
+ type HireInput = Omit<Parameters<typeof facade.hireFromListing>[0], "authority" | "creator" | "referrer" | "referrerFeeBps"> & {
15
15
  /** Standard hire (default). */
16
16
  humanless?: false;
17
17
  /** Override the buyer authority signer (defaults to the client signer). */
@@ -27,7 +27,7 @@ type HireInput = Omit<Parameters<typeof facade.hireFromListing>[0], "authority"
27
27
  * `facade.hireFromListingHumanless` input minus the `creator` signer (defaulted
28
28
  * to the client signer).
29
29
  */
30
- type HumanlessHireInput = Omit<Parameters<typeof facade.hireFromListingHumanless>[0], "creator"> & {
30
+ type HumanlessHireInput = Omit<Parameters<typeof facade.hireFromListingHumanless>[0], "creator" | "referrer" | "referrerFeeBps"> & {
31
31
  /** Discriminates the humanless storefront-visitor hire. */
32
32
  humanless: true;
33
33
  /** Override the buyer/creator signer (defaults to the client signer). */
@@ -44,8 +44,8 @@ interface HireResult {
44
44
  /** The minted Task PDA (derived from creator + taskId). */
45
45
  taskPda: Address;
46
46
  /**
47
- * Whether a referrer fee leg was injected into THIS hire. Always `false`
48
- * today (the P6.2 gate). Audit signal — never fabricated.
47
+ * Whether a referrer fee leg was injected into THIS hire. Audit signal —
48
+ * never fabricated.
49
49
  */
50
50
  referrerInjected: boolean;
51
51
  }
@@ -246,4 +246,4 @@ declare function projectTrackRecord(raw: IndexerAgentTrackRecord): AgentTrackRec
246
246
  */
247
247
  declare function useAgentTrackRecord(agentPda: Address | string | undefined | null, options?: UseAgentTrackRecordOptions): UseAgentTrackRecordResult;
248
248
 
249
- export { type AcceptInput as A, type DisputeReader as D, type HireInput 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 HireResult as d, type HireStatus as e, type HumanlessHireInput 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 };
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 };
@@ -8,10 +8,10 @@ import { Address } from '@solana/kit';
8
8
  * MINUS the fee-payer signers, which default to the provider's write-client
9
9
  * signer (authority == creator == buyer). Pass them only to override.
10
10
  *
11
- * NOTE: deliberately NO referrer field — the referrer is provider-level config,
12
- * gated by P6.2, and is never threaded through a per-call hire input.
11
+ * NOTE: deliberately NO referrer field — the referrer is provider-level config
12
+ * and is injected only when `resolveReferrerCapability()` is live.
13
13
  */
14
- type HireInput = Omit<Parameters<typeof facade.hireFromListing>[0], "authority" | "creator"> & {
14
+ type HireInput = Omit<Parameters<typeof facade.hireFromListing>[0], "authority" | "creator" | "referrer" | "referrerFeeBps"> & {
15
15
  /** Standard hire (default). */
16
16
  humanless?: false;
17
17
  /** Override the buyer authority signer (defaults to the client signer). */
@@ -27,7 +27,7 @@ type HireInput = Omit<Parameters<typeof facade.hireFromListing>[0], "authority"
27
27
  * `facade.hireFromListingHumanless` input minus the `creator` signer (defaulted
28
28
  * to the client signer).
29
29
  */
30
- type HumanlessHireInput = Omit<Parameters<typeof facade.hireFromListingHumanless>[0], "creator"> & {
30
+ type HumanlessHireInput = Omit<Parameters<typeof facade.hireFromListingHumanless>[0], "creator" | "referrer" | "referrerFeeBps"> & {
31
31
  /** Discriminates the humanless storefront-visitor hire. */
32
32
  humanless: true;
33
33
  /** Override the buyer/creator signer (defaults to the client signer). */
@@ -44,8 +44,8 @@ interface HireResult {
44
44
  /** The minted Task PDA (derived from creator + taskId). */
45
45
  taskPda: Address;
46
46
  /**
47
- * Whether a referrer fee leg was injected into THIS hire. Always `false`
48
- * today (the P6.2 gate). Audit signal — never fabricated.
47
+ * Whether a referrer fee leg was injected into THIS hire. Audit signal —
48
+ * never fabricated.
49
49
  */
50
50
  referrerInjected: boolean;
51
51
  }
@@ -246,4 +246,4 @@ declare function projectTrackRecord(raw: IndexerAgentTrackRecord): AgentTrackRec
246
246
  */
247
247
  declare function useAgentTrackRecord(agentPda: Address | string | undefined | null, options?: UseAgentTrackRecordOptions): UseAgentTrackRecordResult;
248
248
 
249
- export { type AcceptInput as A, type DisputeReader as D, type HireInput 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 HireResult as d, type HireStatus as e, type HumanlessHireInput 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 };
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 };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tetsuo-ai/marketplace-react",
3
- "version": "0.1.1",
4
- "description": "Headless React hooks + themable components for the AgenC marketplace — provider, indexer-first read transport, and the P6.2-gated referrer config",
3
+ "version": "0.3.0",
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",
7
7
  "module": "./dist/index.js",
@@ -80,13 +80,14 @@
80
80
  "typecheck": "tsc --noEmit",
81
81
  "test": "vitest run",
82
82
  "test:watch": "vitest",
83
+ "prepack": "npm run build",
83
84
  "ladle": "ladle serve",
84
85
  "ladle:build": "ladle build"
85
86
  },
86
87
  "peerDependencies": {
87
88
  "@solana/kit": "^6.9.0",
88
89
  "@solana/program-client-core": "^6.4.0",
89
- "@tetsuo-ai/marketplace-sdk": "^0.4.0 || ^0.5.0 || ^0.6.0",
90
+ "@tetsuo-ai/marketplace-sdk": "^0.7.0",
90
91
  "react": ">=18"
91
92
  },
92
93
  "dependencies": {
@@ -4,8 +4,7 @@
4
4
  * This is the one component that binds the hooks directly: it renders a price-
5
5
  * aware CTA that opens {@link HireCheckoutModal}, drives the hire through
6
6
  * `useHire()`, resolves the signer via `useWalletSigner()`, and threads the
7
- * provider's configured referrer + the P6.2 capability into the modal's
8
- * disclosure (never injecting a fee — the gate lives in `useHire`).
7
+ * provider's configured referrer + capability into the modal's disclosure.
9
8
  *
10
9
  * ## Why the caller supplies the hire input
11
10
  *
@@ -2,8 +2,8 @@
2
2
  * `<HireCheckoutModal>` — the embeddable money path (PLAN_2 A3).
3
3
  *
4
4
  * The accessible, themable checkout dialog: it shows the price, the moderation
5
- * attestation badge, the escrow-funding explanation, the referrer disclosure
6
- * (P6.2-gated), and walks the buyer through idle → confirming → funded /
5
+ * attestation badge, the escrow-funding explanation, the referrer disclosure,
6
+ * and walks the buyer through idle → confirming → funded /
7
7
  * error confirmation states.
8
8
  *
9
9
  * ## Accessibility (STRUCTURAL — this is published to third parties)
@@ -13,12 +13,11 @@
13
13
  * transaction), ARIA dialog roles, and live-region status announcements for
14
14
  * the confirming/funded/error transitions.
15
15
  *
16
- * ## The P6.2 referrer gate
16
+ * ## Referrer disclosure
17
17
  *
18
- * The disclosure renders when a `referrer` is configured, with the pending-
19
- * support copy until `referrerLive` is true (always false today). The modal
20
- * NEVER computes or claims a fee was charged — it discloses configured intent
21
- * only. Injection/earnings stay in the hooks, blocked on P6.2.
18
+ * The disclosure renders when a `referrer` is configured. The modal never
19
+ * computes earnings; injection lives in `useHire()` and aggregate earnings live
20
+ * in `useReferrerEarnings()`.
22
21
  *
23
22
  * ## Wiring
24
23
  *
@@ -79,8 +78,8 @@ export interface HireCheckoutModalProps {
79
78
  */
80
79
  referrer?: ValidatedReferrerConfig | null;
81
80
  /**
82
- * Whether referral settlement is live (P6.2). Always false today. Drives the
83
- * disclosure copy only; never implies a fee was charged.
81
+ * Whether referral settlement is active for this hire. Drives the disclosure
82
+ * copy only; never computes earnings.
84
83
  */
85
84
  referrerLive?: boolean;
86
85
  /** Whether a signer/wallet is connected (gates the confirm button). */