@hardkas/react 0.6.1-alpha → 0.7.1-alpha

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/dist/index.d.ts CHANGED
@@ -4855,6 +4855,8 @@ interface ArtifactSummary {
4855
4855
  }
4856
4856
  declare function useArtifacts(schemaFilter?: string): _tanstack_react_query.UseQueryResult<ArtifactSummary[], Error>;
4857
4857
  declare function useArtifact(id: string): _tanstack_react_query.UseQueryResult<any, Error>;
4858
+ declare function useExplain(id: string): _tanstack_react_query.UseQueryResult<any, Error>;
4859
+ declare function useWorkflow(txId: string): _tanstack_react_query.UseQueryResult<ArtifactSummary[], Error>;
4858
4860
 
4859
4861
  interface ReplaySummary {
4860
4862
  artifactId: string;
@@ -4880,6 +4882,7 @@ interface UseReplayStatusResponse {
4880
4882
  }
4881
4883
  declare function useReplayStatus(): _tanstack_react_query.UseQueryResult<UseReplayStatusResponse, Error>;
4882
4884
  declare function useReplayDetail(txId: string): _tanstack_react_query.UseQueryResult<any, Error>;
4885
+ declare function useReplay(id: string): _tanstack_react_query.UseQueryResult<any, Error>;
4883
4886
 
4884
4887
  interface DeploymentSummary {
4885
4888
  artifactId: string;
@@ -4907,4 +4910,4 @@ interface ActivityEvent {
4907
4910
  }
4908
4911
  declare function useActivity(): _tanstack_react_query.UseQueryResult<ActivityEvent[], Error>;
4909
4912
 
4910
- export { type ActivityEvent, type ArtifactSummary, type DeploymentSummary, type EventCallback, type HardKasAccountInfo, type HardKasAccountsResponse, type HardKasContextValue, type HardKasEventInfo, HardKasProvider, type HardKasReactConfig, type HealthInfo, type KasWareLocalState, type KasWareSessionMatch, type LineageEdge, type LineageNode, type MetaMaskLocalState, type OverviewStats, type ReplaySummary, type RuntimeEvent, type SSEStatus, type SandboxConnection, type SessionInfo, type TransactionDetail, type TransactionSummary, type UseEventsResponse, type UseReplayStatusResponse, useAccounts, useActivity, useArtifact, useArtifacts, useConnectKasWareLocal, useCreateSandboxSession, useDeployments, useDisconnectSandboxSession, useEvents, useHardKas, useHardKasHealth, useHardKasSession, useIgraAccount, useIgraBalance, useIgraInjectedAccount, useIgraReadContract, useIgraWaitForReceipt, useIgraWallet, useIgraWriteContract, useKasWareLocal, useKasWareSessionMatch, useKaspaBalance, useKaspaWallet, useLocalIgraWalletClient, useMetaMaskLocal, useOverview, usePairSandboxSession, useReplayDetail, useReplayStatus, useSandboxSessions, useSwitchToLocalIgra, useTransaction, useTransactions };
4913
+ export { type ActivityEvent, type ArtifactSummary, type DeploymentSummary, type EventCallback, type HardKasAccountInfo, type HardKasAccountsResponse, type HardKasContextValue, type HardKasEventInfo, HardKasProvider, type HardKasReactConfig, type HealthInfo, type KasWareLocalState, type KasWareSessionMatch, type LineageEdge, type LineageNode, type MetaMaskLocalState, type OverviewStats, type ReplaySummary, type RuntimeEvent, type SSEStatus, type SandboxConnection, type SessionInfo, type TransactionDetail, type TransactionSummary, type UseEventsResponse, type UseReplayStatusResponse, useAccounts, useActivity, useArtifact, useArtifacts, useConnectKasWareLocal, useCreateSandboxSession, useDeployments, useDisconnectSandboxSession, useEvents, useExplain, useHardKas, useHardKasHealth, useHardKasSession, useIgraAccount, useIgraBalance, useIgraInjectedAccount, useIgraReadContract, useIgraWaitForReceipt, useIgraWallet, useIgraWriteContract, useKasWareLocal, useKasWareSessionMatch, useKaspaBalance, useKaspaWallet, useLocalIgraWalletClient, useMetaMaskLocal, useOverview, usePairSandboxSession, useReplay, useReplayDetail, useReplayStatus, useSandboxSessions, useSwitchToLocalIgra, useTransaction, useTransactions, useWorkflow };
package/dist/index.js CHANGED
@@ -1252,6 +1252,31 @@ function useArtifact(id) {
1252
1252
  staleTime: 3e4
1253
1253
  });
1254
1254
  }
1255
+ function useExplain(id) {
1256
+ const { config, apiFetch } = useHardKas();
1257
+ return useQuery11({
1258
+ queryKey: ["hardkas", "explain", id],
1259
+ queryFn: async () => {
1260
+ if (!id) return null;
1261
+ try {
1262
+ const baseUrl = config.devServerUrl || "";
1263
+ const url = baseUrl ? baseUrl.endsWith("/") ? `${baseUrl}api/artifacts/${id}/explain` : `${baseUrl}/api/artifacts/${id}/explain` : `/api/artifacts/${id}/explain`;
1264
+ const response = await apiFetch(url);
1265
+ if (!response.ok) return null;
1266
+ const data = await response.json();
1267
+ return data.data || null;
1268
+ } catch (e) {
1269
+ console.error(`Failed to explain artifact '${id}':`, e);
1270
+ return null;
1271
+ }
1272
+ },
1273
+ enabled: !!id,
1274
+ staleTime: Infinity
1275
+ });
1276
+ }
1277
+ function useWorkflow(txId) {
1278
+ return useArtifacts("all");
1279
+ }
1255
1280
 
1256
1281
  // src/hooks/replay.ts
1257
1282
  import { useQuery as useQuery12, useQueryClient as useQueryClient11 } from "@tanstack/react-query";
@@ -1339,6 +1364,28 @@ function useReplayDetail(txId) {
1339
1364
  staleTime: 3e4
1340
1365
  });
1341
1366
  }
1367
+ function useReplay(id) {
1368
+ const { config, apiFetch } = useHardKas();
1369
+ return useQuery12({
1370
+ queryKey: ["hardkas", "replay-artifact", id],
1371
+ queryFn: async () => {
1372
+ if (!id) return null;
1373
+ try {
1374
+ const baseUrl = config.devServerUrl || "";
1375
+ const url = baseUrl ? baseUrl.endsWith("/") ? `${baseUrl}api/artifacts/${id}/replay` : `${baseUrl}/api/artifacts/${id}/replay` : `/api/artifacts/${id}/replay`;
1376
+ const response = await apiFetch(url, { method: "POST" });
1377
+ if (!response.ok) return null;
1378
+ const data = await response.json();
1379
+ return data.data || null;
1380
+ } catch (e) {
1381
+ console.error(`Failed to replay artifact '${id}':`, e);
1382
+ return null;
1383
+ }
1384
+ },
1385
+ enabled: !!id,
1386
+ staleTime: Infinity
1387
+ });
1388
+ }
1342
1389
 
1343
1390
  // src/hooks/deployments.ts
1344
1391
  import { useQuery as useQuery13, useQueryClient as useQueryClient12 } from "@tanstack/react-query";
@@ -1417,6 +1464,7 @@ export {
1417
1464
  useDeployments,
1418
1465
  useDisconnectSandboxSession,
1419
1466
  useEvents,
1467
+ useExplain,
1420
1468
  useHardKas,
1421
1469
  useHardKasHealth,
1422
1470
  useHardKasSession,
@@ -1435,10 +1483,12 @@ export {
1435
1483
  useMetaMaskLocal,
1436
1484
  useOverview,
1437
1485
  usePairSandboxSession,
1486
+ useReplay,
1438
1487
  useReplayDetail,
1439
1488
  useReplayStatus,
1440
1489
  useSandboxSessions,
1441
1490
  useSwitchToLocalIgra,
1442
1491
  useTransaction,
1443
- useTransactions
1492
+ useTransactions,
1493
+ useWorkflow
1444
1494
  };
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@hardkas/react",
3
- "version": "0.6.1-alpha",
3
+ "version": "0.7.1-alpha",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
+ "sideEffects": false,
7
8
  "exports": {
8
9
  ".": "./dist/index.js"
9
10
  },
@@ -14,15 +15,16 @@
14
15
  "dependencies": {
15
16
  "@tanstack/react-query": "^5.61.5",
16
17
  "viem": "^2.21.51",
17
- "@hardkas/core": "0.6.1-alpha",
18
- "@hardkas/sessions": "0.6.1-alpha",
19
- "@hardkas/kaspa-rpc": "0.6.1-alpha",
20
- "@hardkas/l2": "0.6.1-alpha"
18
+ "@hardkas/kaspa-rpc": "0.7.1-alpha",
19
+ "@hardkas/core": "0.7.1-alpha",
20
+ "@hardkas/l2": "0.7.1-alpha",
21
+ "@hardkas/sessions": "0.7.1-alpha"
21
22
  },
22
23
  "devDependencies": {
23
24
  "@testing-library/dom": "^10.4.1",
24
25
  "@testing-library/jest-dom": "^6.9.1",
25
26
  "@testing-library/react": "^16.3.2",
27
+ "@testing-library/user-event": "^14.6.1",
26
28
  "@types/react": "^18.3.12",
27
29
  "@types/react-dom": "^18.3.1",
28
30
  "@vitejs/plugin-react": "^4.7.0",