@singi-labs/sifa-sdk 0.12.49 → 0.12.50

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.
@@ -479,6 +479,18 @@ async function fetchPendingConfirmations(config, options = {}) {
479
479
  return { confirmations: [] };
480
480
  }
481
481
  }
482
+ async function fetchGivenConfirmations(config, options = {}) {
483
+ try {
484
+ const data = await apiFetch(
485
+ config,
486
+ "/api/confirmations/mine",
487
+ { cache: "no-store", credentials: "include", timeoutMs: 5e3, ...options }
488
+ );
489
+ return { confirmations: data?.confirmations ?? [] };
490
+ } catch {
491
+ return { confirmations: [] };
492
+ }
493
+ }
482
494
  function createConfirmation(config, data, options = {}) {
483
495
  return apiWriteCreate(config, "/api/confirmation", data, options);
484
496
  }
@@ -1499,7 +1511,9 @@ var sifaQueryKeys = {
1499
1511
  // Scoped to the session for the same reason as the endorsement inbox: the
1500
1512
  // AppView reads the subject from the session cookie, so there is only ever
1501
1513
  // one inbox per client.
1502
- pending: () => ["sifa", "confirmation", "pending"]
1514
+ pending: () => ["sifa", "confirmation", "pending"],
1515
+ /** Confirmations this session has given, for the withdraw surface. */
1516
+ given: () => ["sifa", "confirmation", "given"]
1503
1517
  },
1504
1518
  stream: {
1505
1519
  all: () => ["sifa", "stream"],
@@ -2117,6 +2131,14 @@ function usePendingConfirmations(options) {
2117
2131
  ...options
2118
2132
  });
2119
2133
  }
2134
+ function useGivenConfirmations(options) {
2135
+ const config = useSifaConfig();
2136
+ return reactQuery.useQuery({
2137
+ queryKey: sifaQueryKeys.confirmation.given(),
2138
+ queryFn: () => fetchGivenConfirmations(config),
2139
+ ...options
2140
+ });
2141
+ }
2120
2142
  function useCreateConfirmation(claimerHandleOrDid, options) {
2121
2143
  const config = useSifaConfig();
2122
2144
  const queryClient = reactQuery.useQueryClient();
@@ -2127,6 +2149,9 @@ function useCreateConfirmation(claimerHandleOrDid, options) {
2127
2149
  await queryClient.invalidateQueries({
2128
2150
  queryKey: sifaQueryKeys.confirmation.pending()
2129
2151
  });
2152
+ await queryClient.invalidateQueries({
2153
+ queryKey: sifaQueryKeys.confirmation.given()
2154
+ });
2130
2155
  if (claimerHandleOrDid) {
2131
2156
  await queryClient.invalidateQueries({
2132
2157
  queryKey: sifaQueryKeys.profile.byHandle(claimerHandleOrDid)
@@ -3086,6 +3111,7 @@ exports.fetchExternalAccounts = fetchExternalAccounts;
3086
3111
  exports.fetchFeaturedProfile = fetchFeaturedProfile;
3087
3112
  exports.fetchFollowing = fetchFollowing;
3088
3113
  exports.fetchGetProfileView = fetchGetProfileView;
3114
+ exports.fetchGivenConfirmations = fetchGivenConfirmations;
3089
3115
  exports.fetchHeatmapData = fetchHeatmapData;
3090
3116
  exports.fetchHiddenApps = fetchHiddenApps;
3091
3117
  exports.fetchMyGithubPullRequests = fetchMyGithubPullRequests;
@@ -3214,6 +3240,7 @@ exports.useFollowing = useFollowing;
3214
3240
  exports.useFollowingFeed = useFollowingFeed;
3215
3241
  exports.useFollowingList = useFollowingList;
3216
3242
  exports.useGetProfileView = useGetProfileView;
3243
+ exports.useGivenConfirmations = useGivenConfirmations;
3217
3244
  exports.useHeatmapData = useHeatmapData;
3218
3245
  exports.useHiddenApps = useHiddenApps;
3219
3246
  exports.useHideKeytraceClaim = useHideKeytraceClaim;