@tetsuo-ai/marketplace-react 0.3.1 → 0.3.2

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 (39) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/{chunk-FAIRTAIB.js → chunk-2Y6JN2VZ.js} +3 -3
  3. package/dist/{chunk-FAIRTAIB.js.map → chunk-2Y6JN2VZ.js.map} +1 -1
  4. package/dist/{chunk-D2TDU3TJ.js → chunk-AKPPKMQ2.js} +3 -3
  5. package/dist/{chunk-D2TDU3TJ.js.map → chunk-AKPPKMQ2.js.map} +1 -1
  6. package/dist/{chunk-ECU7HGO3.js → chunk-H6PJIDQR.js} +4 -3
  7. package/dist/chunk-H6PJIDQR.js.map +1 -0
  8. package/dist/{chunk-MNJ2EQDJ.js → chunk-ON6XR4XO.js} +3 -3
  9. package/dist/{chunk-MNJ2EQDJ.js.map → chunk-ON6XR4XO.js.map} +1 -1
  10. package/dist/{chunk-WJUVTFJ7.js → chunk-ZAMIL27X.js} +4 -4
  11. package/dist/{chunk-WJUVTFJ7.js.map → chunk-ZAMIL27X.js.map} +1 -1
  12. package/dist/components/index.cjs +2 -1
  13. package/dist/components/index.cjs.map +1 -1
  14. package/dist/components/index.d.cts +1 -1
  15. package/dist/components/index.d.ts +1 -1
  16. package/dist/components/index.js +3 -3
  17. package/dist/hooks/index.cjs +42 -8
  18. package/dist/hooks/index.cjs.map +1 -1
  19. package/dist/hooks/index.d.cts +6 -8
  20. package/dist/hooks/index.d.ts +6 -8
  21. package/dist/hooks/index.js +44 -11
  22. package/dist/hooks/index.js.map +1 -1
  23. package/dist/{index-DGq7M4mo.d.ts → index-DQ3Xovkq.d.ts} +8 -1
  24. package/dist/{index-CrEAPlme.d.cts → index-UxuvIlmD.d.cts} +8 -1
  25. package/dist/index.cjs +3 -1
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +2 -2
  28. package/dist/index.d.ts +2 -2
  29. package/dist/index.js +9 -8
  30. package/dist/index.js.map +1 -1
  31. package/dist/signers/index.cjs +2 -1
  32. package/dist/signers/index.cjs.map +1 -1
  33. package/dist/signers/index.js +2 -2
  34. package/package.json +1 -1
  35. package/src/hooks/useReferrerEarnings.ts +73 -38
  36. package/src/provider/AgencProvider.tsx +1 -0
  37. package/src/strings/index.ts +3 -1
  38. package/src/types.ts +6 -0
  39. package/dist/chunk-ECU7HGO3.js.map +0 -1
@@ -1,4 +1,4 @@
1
- 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, H as HireButton, s as HireButtonProps, t as HireCheckoutListing, u as HireCheckoutModal, v as HireCheckoutModalProps, 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, 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, a5 as TaskTimeline, a6 as TaskTimelineProps, a7 as ThemableProps, 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, ar as tc, as as toHex, at as truncateAddress, au as useAgentVerification, av as useFocusTrap } from '../index-CrEAPlme.cjs';
1
+ 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, H as HireButton, s as HireButtonProps, t as HireCheckoutListing, u as HireCheckoutModal, v as HireCheckoutModalProps, 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, 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, a5 as TaskTimeline, a6 as TaskTimelineProps, a7 as ThemableProps, 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, ar as tc, as as toHex, at as truncateAddress, au as useAgentVerification, av as useFocusTrap } from '../index-UxuvIlmD.cjs';
2
2
  import 'react';
3
3
  import '@tetsuo-ai/marketplace-sdk';
4
4
  import '@solana/kit';
@@ -1,4 +1,4 @@
1
- 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, H as HireButton, s as HireButtonProps, t as HireCheckoutListing, u as HireCheckoutModal, v as HireCheckoutModalProps, 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, 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, a5 as TaskTimeline, a6 as TaskTimelineProps, a7 as ThemableProps, 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, ar as tc, as as toHex, at as truncateAddress, au as useAgentVerification, av as useFocusTrap } from '../index-DGq7M4mo.js';
1
+ 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, H as HireButton, s as HireButtonProps, t as HireCheckoutListing, u as HireCheckoutModal, v as HireCheckoutModalProps, 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, 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, a5 as TaskTimeline, a6 as TaskTimelineProps, a7 as ThemableProps, 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, ar as tc, as as toHex, at as truncateAddress, au as useAgentVerification, av as useFocusTrap } from '../index-DQ3Xovkq.js';
2
2
  import 'react';
3
3
  import '@tetsuo-ai/marketplace-sdk';
4
4
  import '@solana/kit';
@@ -1,5 +1,5 @@
1
- export { 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, agentVerificationReaderFromRpc, cx, decodeListingCategory, decodeListingName, decodeListingTags, elementClass, evaluateAgentVerification, formatPriceSol, formatRate, formatSol, moderationStateOf, rootClass, tc, toHex, truncateAddress, useAgentVerification, useFocusTrap } from '../chunk-WJUVTFJ7.js';
2
- import '../chunk-FAIRTAIB.js';
3
- import '../chunk-ECU7HGO3.js';
1
+ export { 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, agentVerificationReaderFromRpc, cx, decodeListingCategory, decodeListingName, decodeListingTags, elementClass, evaluateAgentVerification, formatPriceSol, formatRate, formatSol, moderationStateOf, rootClass, tc, toHex, truncateAddress, useAgentVerification, useFocusTrap } from '../chunk-ZAMIL27X.js';
2
+ import '../chunk-2Y6JN2VZ.js';
3
+ import '../chunk-H6PJIDQR.js';
4
4
  //# sourceMappingURL=index.js.map
5
5
  //# sourceMappingURL=index.js.map
@@ -18,7 +18,8 @@ var EN_STRINGS = {
18
18
  "referrer.invalidFeeBps": "Referrer feeBps must be an integer between {min} and {max} (basis points); got {feeBps}.",
19
19
  "referrer.notLive": "Referral fee is not active for this hire.",
20
20
  "referrer.notLiveReason": "No referrer is configured for this provider.",
21
- "referrer.earningsNotLiveReason": "Referral settlement is live, but aggregated referrer earnings are not yet exposed by the indexer.",
21
+ "referrer.earningsNotLiveReason": "Referral settlement is live, but no earnings endpoint is available on this network (configure indexer.baseUrl).",
22
+ "referrer.earningsFetchFailed": "The referrer earnings endpoint could not be read.",
22
23
  // Read transport.
23
24
  "transport.noReadSource": "No read source is configured. Pass an indexer baseUrl, an rpc/queryTransport, to <AgencProvider> or createReadTransport().",
24
25
  // Generic loading / empty / error states (components extend these).
@@ -807,23 +808,48 @@ function useWalletSigner(options) {
807
808
  }, [adapter]);
808
809
  return { signer, connected, connect };
809
810
  }
810
- var EARNINGS_INDEXER_LIVE = false;
811
+ var EARNINGS_INDEXER_DEFAULTS = {
812
+ mainnet: "https://api.agenc.ag"
813
+ };
814
+ function resolveEarningsBaseUrl(ctx) {
815
+ return ctx.indexerBaseUrl ?? EARNINGS_INDEXER_DEFAULTS[ctx.network] ?? null;
816
+ }
811
817
  function useReferrerEarnings(wallet) {
812
818
  const ctx = useAgencContext();
813
819
  const capability = ctx.resolveReferrerCapability();
814
- const enabled = capability.live && EARNINGS_INDEXER_LIVE;
815
- reactQuery.useQuery(
820
+ const earningsBase = resolveEarningsBaseUrl(ctx);
821
+ const enabled = capability.live && earningsBase !== null && Boolean(wallet);
822
+ const query = reactQuery.useQuery(
816
823
  {
817
824
  queryKey: queryKeys.referrerEarnings(wallet ? pdaKey(wallet) : ""),
818
825
  enabled,
819
826
  queryFn: async () => {
820
- throw new Error(
821
- "useReferrerEarnings: the referrer earnings indexer is not deployed; this query must never run while EARNINGS_INDEXER_LIVE is false."
822
- );
827
+ const url = `${earningsBase}/api/explorer/referrers/${encodeURIComponent(
828
+ String(wallet)
829
+ )}/hires`;
830
+ const response = await fetch(url, {
831
+ headers: { accept: "application/json" }
832
+ });
833
+ if (!response.ok) {
834
+ throw new Error(
835
+ t("referrer.earningsFetchFailed") + ` (HTTP ${response.status})`
836
+ );
837
+ }
838
+ const body = await response.json();
839
+ const hires = (body.hires ?? []).map((h) => ({
840
+ taskPda: String(h.taskPda ?? ""),
841
+ hireRecordPda: String(h.hireRecordPda ?? ""),
842
+ feeLamports: BigInt(h.feeLamports ?? "0"),
843
+ signature: String(h.signature ?? "")
844
+ }));
845
+ return {
846
+ totalLamports: BigInt(body.totalLamports ?? "0"),
847
+ hires
848
+ };
823
849
  }
824
850
  }
825
851
  );
826
- if (!capability.live || !EARNINGS_INDEXER_LIVE) {
852
+ if (!enabled) {
827
853
  return {
828
854
  live: false,
829
855
  totalLamports: 0n,
@@ -835,6 +861,14 @@ function useReferrerEarnings(wallet) {
835
861
  }
836
862
  };
837
863
  }
864
+ return {
865
+ live: true,
866
+ totalLamports: query.data?.totalLamports ?? 0n,
867
+ hires: query.data?.hires ?? [],
868
+ isLoading: query.isLoading,
869
+ error: query.error ?? null,
870
+ refetch: () => void query.refetch()
871
+ };
838
872
  }
839
873
 
840
874
  exports.QUERY_KEY_ROOT = QUERY_KEY_ROOT;