@tetsuo-ai/marketplace-react 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/{chunk-BNILOX3O.js → chunk-JVXGNW3Q.js} +35 -4
- package/dist/chunk-JVXGNW3Q.js.map +1 -0
- package/dist/{chunk-BTAVED7S.js → chunk-XLA7DARS.js} +35 -6
- package/dist/chunk-XLA7DARS.js.map +1 -0
- package/dist/components/index.cjs +129 -48
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +2 -2
- package/dist/hooks/index.cjs +89 -0
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.cts +50 -3
- package/dist/hooks/index.d.ts +50 -3
- package/dist/hooks/index.js +62 -4
- package/dist/hooks/index.js.map +1 -1
- package/dist/{index-DQ3Xovkq.d.ts → index-CmVz0OOm.d.ts} +50 -5
- package/dist/{index-UxuvIlmD.d.cts → index-DAZzhuO4.d.cts} +50 -5
- package/dist/index.cjs +119 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/{useAgentTrackRecord-BCvRHYM2.d.cts → useAgentTrackRecord-DPt3SfYz.d.cts} +39 -2
- package/dist/{useAgentTrackRecord-BCvRHYM2.d.ts → useAgentTrackRecord-DPt3SfYz.d.ts} +39 -2
- package/package.json +1 -1
- package/src/components/GuaranteedBadge.tsx +73 -0
- package/src/components/index.ts +4 -0
- package/src/components/strings.ts +8 -0
- package/src/hooks/index.ts +13 -0
- package/src/hooks/internal.ts +3 -0
- package/src/hooks/useCompletionBond.ts +156 -0
- package/src/hooks/useTaskGuarantee.ts +120 -0
- package/src/index.ts +2 -0
- package/src/types.ts +5 -2
- package/dist/chunk-BNILOX3O.js.map +0 -1
- package/dist/chunk-BTAVED7S.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
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,
|
|
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, s as GuaranteedBadge, t as GuaranteedBadgeProps, H as HireButton, u as HireButtonProps, v as HireCheckoutListing, w as HireCheckoutModal, x as HireCheckoutModalProps, L as ListingCard, y as ListingCardData, z as ListingCardProps, F as ListingGrid, J as ListingGridProps, M as Modal, K as ModalProps, N as ModerationBadge, O as ModerationBadgeProps, P as ModerationState, Q as PoweredByAgenC, S as PoweredByAgenCProps, T as ProviderCard, U as ProviderCardProps, X as ReferrerDisclosure, Y as ReferrerDisclosureProps, Z as ReviewPanel, _ as ReviewPanelProps, $ as Spinner, a0 as SpinnerProps, a1 as StateKind, a2 as StateMessage, a3 as StateMessageProps, a7 as TaskTimeline, a8 as TaskTimelineProps, a9 as ThemableProps, ab as UNVERIFIED, ac as UseAgentVerificationOptions, ad as UseAgentVerificationResult, ae as VerifiedBadge, af as VerifiedBadgeProps, ag as agentVerificationReaderFromRpc, ah as cx, ai as decodeListingCategory, aj as decodeListingName, ak as decodeListingTags, al as elementClass, am as evaluateAgentVerification, an as formatPriceSol, ao as formatRate, ap as formatSol, aq as moderationStateOf, ar as rootClass, at as tc, au as toHex, av as truncateAddress, aw as useAgentVerification, ax as useFocusTrap } from '../index-DAZzhuO4.cjs';
|
|
2
2
|
import 'react';
|
|
3
3
|
import '@tetsuo-ai/marketplace-sdk';
|
|
4
|
+
import '../useAgentTrackRecord-DPt3SfYz.cjs';
|
|
4
5
|
import '@solana/kit';
|
|
5
|
-
import '../useAgentTrackRecord-BCvRHYM2.cjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
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,
|
|
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, s as GuaranteedBadge, t as GuaranteedBadgeProps, H as HireButton, u as HireButtonProps, v as HireCheckoutListing, w as HireCheckoutModal, x as HireCheckoutModalProps, L as ListingCard, y as ListingCardData, z as ListingCardProps, F as ListingGrid, J as ListingGridProps, M as Modal, K as ModalProps, N as ModerationBadge, O as ModerationBadgeProps, P as ModerationState, Q as PoweredByAgenC, S as PoweredByAgenCProps, T as ProviderCard, U as ProviderCardProps, X as ReferrerDisclosure, Y as ReferrerDisclosureProps, Z as ReviewPanel, _ as ReviewPanelProps, $ as Spinner, a0 as SpinnerProps, a1 as StateKind, a2 as StateMessage, a3 as StateMessageProps, a7 as TaskTimeline, a8 as TaskTimelineProps, a9 as ThemableProps, ab as UNVERIFIED, ac as UseAgentVerificationOptions, ad as UseAgentVerificationResult, ae as VerifiedBadge, af as VerifiedBadgeProps, ag as agentVerificationReaderFromRpc, ah as cx, ai as decodeListingCategory, aj as decodeListingName, ak as decodeListingTags, al as elementClass, am as evaluateAgentVerification, an as formatPriceSol, ao as formatRate, ap as formatSol, aq as moderationStateOf, ar as rootClass, at as tc, au as toHex, av as truncateAddress, aw as useAgentVerification, ax as useFocusTrap } from '../index-CmVz0OOm.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import '@tetsuo-ai/marketplace-sdk';
|
|
4
|
+
import '../useAgentTrackRecord-DPt3SfYz.js';
|
|
4
5
|
import '@solana/kit';
|
|
5
|
-
import '../useAgentTrackRecord-BCvRHYM2.js';
|
package/dist/components/index.js
CHANGED
|
@@ -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-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { Badge, Button, COMPONENT_CATALOG, DEFAULT_TRUST_HREF, DisputeBanner, EN_COMPONENT_STRINGS, GuaranteedBadge, HireButton, HireCheckoutModal, ListingCard, ListingGrid, Modal, ModerationBadge, PoweredByAgenC, ProviderCard, ReferrerDisclosure, ReviewPanel, Spinner, StateMessage, TaskTimeline, UNVERIFIED, VerifiedBadge, agentVerificationReaderFromRpc, cx, decodeListingCategory, decodeListingName, decodeListingTags, elementClass, evaluateAgentVerification, formatPriceSol, formatRate, formatSol, moderationStateOf, rootClass, tc, toHex, truncateAddress, useAgentVerification, useFocusTrap } from '../chunk-JVXGNW3Q.js';
|
|
2
|
+
import '../chunk-XLA7DARS.js';
|
|
3
3
|
import '../chunk-H6PJIDQR.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/dist/hooks/index.cjs
CHANGED
|
@@ -61,6 +61,8 @@ var queryKeys = {
|
|
|
61
61
|
taskStatus: (taskPda) => [QUERY_KEY_ROOT, "taskStatus", taskPda],
|
|
62
62
|
/** One task's dispute record. */
|
|
63
63
|
dispute: (taskPda) => [QUERY_KEY_ROOT, "dispute", taskPda],
|
|
64
|
+
/** One task's completion-bond ("Guaranteed Hire") state. */
|
|
65
|
+
taskGuarantee: (taskPda) => [QUERY_KEY_ROOT, "taskGuarantee", taskPda],
|
|
64
66
|
/** One referrer wallet's earnings (indexer-gated; see useReferrerEarnings). */
|
|
65
67
|
referrerEarnings: (wallet) => [QUERY_KEY_ROOT, "referrerEarnings", wallet]
|
|
66
68
|
};
|
|
@@ -300,6 +302,33 @@ function useTaskStatus(taskPda, options) {
|
|
|
300
302
|
refetch: () => void query.refetch()
|
|
301
303
|
};
|
|
302
304
|
}
|
|
305
|
+
function useTaskGuarantee(taskPda, options) {
|
|
306
|
+
const ctx = useAgencContext();
|
|
307
|
+
const injected = options?.guaranteeReader;
|
|
308
|
+
const rpcUrl = ctx.rpcUrl;
|
|
309
|
+
const reader = react.useMemo(() => {
|
|
310
|
+
if (injected) return injected;
|
|
311
|
+
if (!rpcUrl) return null;
|
|
312
|
+
return (pda) => marketplaceSdk.fetchTaskGuarantee(
|
|
313
|
+
kit.createSolanaRpc(rpcUrl),
|
|
314
|
+
pda
|
|
315
|
+
);
|
|
316
|
+
}, [injected, rpcUrl]);
|
|
317
|
+
const enabled = (options?.enabled ?? true) && Boolean(taskPda) && reader !== null;
|
|
318
|
+
const query = reactQuery.useQuery({
|
|
319
|
+
queryKey: queryKeys.taskGuarantee(taskPda ? pdaKey(taskPda) : ""),
|
|
320
|
+
enabled,
|
|
321
|
+
queryFn: () => reader(taskPda)
|
|
322
|
+
});
|
|
323
|
+
const guarantee = query.data ?? null;
|
|
324
|
+
return {
|
|
325
|
+
guarantee,
|
|
326
|
+
guaranteed: guarantee?.guaranteed ?? false,
|
|
327
|
+
isLoading: query.isLoading,
|
|
328
|
+
error: query.error ?? null,
|
|
329
|
+
refetch: () => void query.refetch()
|
|
330
|
+
};
|
|
331
|
+
}
|
|
303
332
|
function readRpc(input) {
|
|
304
333
|
return input.rpc ?? (input.rpcUrl ? kit.createSolanaRpc(input.rpcUrl) : null);
|
|
305
334
|
}
|
|
@@ -875,6 +904,64 @@ function useDispute(taskPda, options) {
|
|
|
875
904
|
reset: mutation.reset
|
|
876
905
|
};
|
|
877
906
|
}
|
|
907
|
+
function useCompletionBond(taskPda) {
|
|
908
|
+
const ctx = useAgencContext();
|
|
909
|
+
const queryClient = reactQuery.useQueryClient();
|
|
910
|
+
const invalidateGuarantee = react.useCallback(() => {
|
|
911
|
+
void queryClient.invalidateQueries({
|
|
912
|
+
queryKey: queryKeys.taskGuarantee(pdaKey(taskPda))
|
|
913
|
+
});
|
|
914
|
+
}, [queryClient, taskPda]);
|
|
915
|
+
const postMut = reactQuery.useMutation({
|
|
916
|
+
mutationFn: async (input) => {
|
|
917
|
+
const client = requireClient(ctx.client);
|
|
918
|
+
const { signature } = await client.postCompletionBond({
|
|
919
|
+
...input,
|
|
920
|
+
task: taskPda,
|
|
921
|
+
authority: input.authority ?? client.signer
|
|
922
|
+
});
|
|
923
|
+
invalidateGuarantee();
|
|
924
|
+
return signature;
|
|
925
|
+
}
|
|
926
|
+
});
|
|
927
|
+
const reclaimMut = reactQuery.useMutation({
|
|
928
|
+
mutationFn: async (input) => {
|
|
929
|
+
const client = requireClient(ctx.client);
|
|
930
|
+
const { signature } = await client.reclaimCompletionBond({
|
|
931
|
+
...input,
|
|
932
|
+
task: taskPda,
|
|
933
|
+
party: input.party ?? client.signer.address
|
|
934
|
+
});
|
|
935
|
+
invalidateGuarantee();
|
|
936
|
+
return signature;
|
|
937
|
+
}
|
|
938
|
+
});
|
|
939
|
+
const post = react.useCallback(
|
|
940
|
+
(input) => postMut.mutateAsync(input),
|
|
941
|
+
[postMut]
|
|
942
|
+
);
|
|
943
|
+
const reclaim = react.useCallback(
|
|
944
|
+
(input) => reclaimMut.mutateAsync(input),
|
|
945
|
+
[reclaimMut]
|
|
946
|
+
);
|
|
947
|
+
const isPending = postMut.isPending || reclaimMut.isPending;
|
|
948
|
+
const status = isPending ? "pending" : mutationStatusOf(
|
|
949
|
+
// Surface the most recently-touched verb's terminal state.
|
|
950
|
+
[postMut, reclaimMut].find((m) => m.isError || m.isSuccess) ?? postMut
|
|
951
|
+
);
|
|
952
|
+
return {
|
|
953
|
+
post,
|
|
954
|
+
reclaim,
|
|
955
|
+
status,
|
|
956
|
+
error: postMut.error ?? reclaimMut.error ?? null,
|
|
957
|
+
signature: postMut.data ?? reclaimMut.data ?? null,
|
|
958
|
+
isPending,
|
|
959
|
+
reset: () => {
|
|
960
|
+
postMut.reset();
|
|
961
|
+
reclaimMut.reset();
|
|
962
|
+
}
|
|
963
|
+
};
|
|
964
|
+
}
|
|
878
965
|
function useWalletSigner(options) {
|
|
879
966
|
const ctx = useAgencContext();
|
|
880
967
|
const adapter = options?.adapter;
|
|
@@ -952,6 +1039,7 @@ exports.QUERY_KEY_ROOT = QUERY_KEY_ROOT;
|
|
|
952
1039
|
exports.projectTrackRecord = projectTrackRecord;
|
|
953
1040
|
exports.queryKeys = queryKeys;
|
|
954
1041
|
exports.useAgentTrackRecord = useAgentTrackRecord;
|
|
1042
|
+
exports.useCompletionBond = useCompletionBond;
|
|
955
1043
|
exports.useDispute = useDispute;
|
|
956
1044
|
exports.useHire = useHire;
|
|
957
1045
|
exports.useHumanlessHireFlow = useHumanlessHireFlow;
|
|
@@ -961,6 +1049,7 @@ exports.useRateHire = useRateHire;
|
|
|
961
1049
|
exports.useReferrerEarnings = useReferrerEarnings;
|
|
962
1050
|
exports.useSubmissionReview = useSubmissionReview;
|
|
963
1051
|
exports.useTaskActivation = useTaskActivation;
|
|
1052
|
+
exports.useTaskGuarantee = useTaskGuarantee;
|
|
964
1053
|
exports.useTaskLifecycle = useTaskLifecycle;
|
|
965
1054
|
exports.useTaskStatus = useTaskStatus;
|
|
966
1055
|
exports.useTaskWork = useTaskWork;
|