@stelis/say-ur-intent 0.0.0 → 0.0.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.
- package/README.md +4 -39
- package/dist/adapters/adapterLifecycleValidators.js +7 -0
- package/dist/adapters/adapterPromptSurfaces.js +71 -0
- package/dist/adapters/deepbook/deepbookHumanReviewProducer.js +175 -0
- package/dist/adapters/deepbook/deepbookQuotePolicy.js +112 -0
- package/dist/adapters/deepbook/deepbookReviewEvidence.js +507 -0
- package/dist/adapters/deepbook/deepbookReviewLifecycle.js +85 -0
- package/dist/adapters/deepbook/deepbookSwapIntent.js +79 -0
- package/dist/adapters/deepbook/deepbookTransactionMaterialProducer.js +269 -0
- package/dist/adapters/flowx/flowxSwapHumanReviewProducer.js +176 -0
- package/dist/adapters/flowx/flowxSwapIntent.js +79 -0
- package/dist/adapters/flowx/flowxSwapQuotePolicy.js +104 -0
- package/dist/adapters/flowx/flowxSwapReviewEvidence.js +468 -0
- package/dist/adapters/flowx/flowxSwapReviewLifecycle.js +85 -0
- package/dist/adapters/flowx/flowxSwapTransactionMaterialProducer.js +362 -0
- package/dist/adapters/intentPlanFactories.js +59 -0
- package/dist/adapters/reviewAdapters.js +81 -0
- package/dist/core/action/adapterLifecycleValidation.js +12 -0
- package/dist/core/action/forbiddenFields.js +43 -0
- package/dist/core/action/humanReadableReviewEvidence.js +203 -0
- package/dist/core/action/humanReadableReviewProjectionVerifier.js +29 -0
- package/dist/core/action/ptbVisualizationProducer.js +66 -0
- package/dist/core/action/reviewCheckResults.js +6 -0
- package/dist/core/action/reviewStateValidation.js +11 -0
- package/dist/core/action/reviewTimeSimulationEvidence.js +471 -0
- package/dist/core/action/schemas.js +529 -0
- package/dist/core/action/signableAdapterContract.js +993 -0
- package/dist/core/action/swapHumanReadableReviewProjection.js +124 -0
- package/dist/core/action/swapQuotePolicyEvidence.js +278 -0
- package/dist/core/action/transactionObjectOwnershipEvidence.js +247 -0
- package/dist/core/action/transactionObjectOwnershipProducer.js +329 -0
- package/dist/core/action/types.js +35 -0
- package/dist/core/action/walletReviewContractAssembler.js +282 -0
- package/dist/core/activity/activityStore.js +15 -0
- package/dist/core/activity/localDataService.js +258 -0
- package/dist/core/activity/localDataTypes.js +11 -0
- package/dist/core/activity/localDataValidation.js +396 -0
- package/dist/core/activity/schemaVersion.js +1 -0
- package/dist/core/activity/sqliteActivityStore.js +820 -0
- package/dist/core/activity/sqliteActivityStoreRows.js +430 -0
- package/dist/core/activity/sqliteActivityStoreSchema.js +258 -0
- package/dist/core/activity/sqliteActivityStoreTypes.js +5 -0
- package/dist/core/activity/suiFunctionTarget.js +43 -0
- package/dist/core/activity/transactionActivityAccountEffects.js +189 -0
- package/dist/core/activity/transactionActivityAnalysis.js +295 -0
- package/dist/core/activity/transactionActivityClassifier.js +306 -0
- package/dist/core/activity/transactionActivityDetails.js +229 -0
- package/dist/core/activity/transactionActivityProtocolRules.js +218 -0
- package/dist/core/activity/transactionActivityScanPolicy.js +170 -0
- package/dist/core/activity/transactionActivityService.js +379 -0
- package/dist/core/activity/transactionActivityTypes.js +18 -0
- package/dist/core/eventlog/sink.js +35 -0
- package/dist/core/evidence/settlementFamilies.js +87 -0
- package/dist/core/evidence/userAnswerUse.js +1 -0
- package/dist/core/numeric/rawU64.js +63 -0
- package/dist/core/preferences/preferencesStore.js +26 -0
- package/dist/core/preferences/sqlitePreferencesRepository.js +136 -0
- package/dist/core/proposal/externalProposalReview.js +347 -0
- package/dist/core/proposal/schemas.js +208 -0
- package/dist/core/proposal/types.js +35 -0
- package/dist/core/read/amounts.js +14 -0
- package/dist/core/read/coinMetadata.js +60 -0
- package/dist/core/read/deepbookRawQuoteClient.js +86 -0
- package/dist/core/read/deepbookReadHelpers.js +265 -0
- package/dist/core/read/deepbookRegistry.js +133 -0
- package/dist/core/read/flowxQuoteClient.js +117 -0
- package/dist/core/read/flowxReadHelpers.js +145 -0
- package/dist/core/read/flowxRegistry.js +174 -0
- package/dist/core/read/intentEvidenceResponseFormatting.js +228 -0
- package/dist/core/read/readResponseGuidance.js +451 -0
- package/dist/core/read/readService.js +1164 -0
- package/dist/core/read/readServiceTypes.js +59 -0
- package/dist/core/read/settlementParityFormatting.js +82 -0
- package/dist/core/read/walletReadHelpers.js +99 -0
- package/dist/core/review/reviewChecks.js +54 -0
- package/dist/core/review/reviewComputation.js +38 -0
- package/dist/core/review/reviewComputationResult.js +87 -0
- package/dist/core/session/localSession.js +31 -0
- package/dist/core/session/privateReviewArtifacts.js +73 -0
- package/dist/core/session/sessionErrors.js +9 -0
- package/dist/core/session/sessionStore.js +821 -0
- package/dist/core/session/settingsSession.js +1 -0
- package/dist/core/session/settingsSessions.js +43 -0
- package/dist/core/session/status.js +86 -0
- package/dist/core/session/transactionMaterialStore.js +205 -0
- package/dist/core/session/wait.js +102 -0
- package/dist/core/session/walletIdentity.js +103 -0
- package/dist/core/session/walletIdentitySessions.js +189 -0
- package/dist/core/suiAddress.js +18 -0
- package/dist/core/suiEndpoint.js +72 -0
- package/dist/mcp/activeAccountResponse.js +24 -0
- package/dist/mcp/prompts.js +146 -0
- package/dist/mcp/registerTool.js +19 -0
- package/dist/mcp/resources.js +72 -0
- package/dist/mcp/responseGuidance.js +381 -0
- package/dist/mcp/result.js +17 -0
- package/dist/mcp/schemas.js +8 -0
- package/dist/mcp/server.js +30 -0
- package/dist/mcp/serverInfo.js +123 -0
- package/dist/mcp/toolErrors.js +105 -0
- package/dist/mcp/toolNames.js +50 -0
- package/dist/mcp/tools/account/index.js +44 -0
- package/dist/mcp/tools/action/prepareSuiActionReview.js +120 -0
- package/dist/mcp/tools/read/commonSchemas.js +43 -0
- package/dist/mcp/tools/read/deepbookReadTools.js +453 -0
- package/dist/mcp/tools/read/flowxReadTools.js +135 -0
- package/dist/mcp/tools/read/index.js +16 -0
- package/dist/mcp/tools/read/readToolHelpers.js +68 -0
- package/dist/mcp/tools/read/reviewActivityTools.js +176 -0
- package/dist/mcp/tools/read/serverStatusTools.js +103 -0
- package/dist/mcp/tools/read/transactionActivityOutput.js +300 -0
- package/dist/mcp/tools/read/transactionActivityTools.js +544 -0
- package/dist/mcp/tools/read/walletReadTools.js +733 -0
- package/dist/mcp/tools/session/executionResultTools.js +92 -0
- package/dist/mcp/tools/session/index.js +8 -0
- package/dist/mcp/tools/session/shared.js +79 -0
- package/dist/mcp/tools/session/statusTools.js +134 -0
- package/dist/mcp/tools/session/walletIdentityTools.js +119 -0
- package/dist/mcp/tools/settings/index.js +64 -0
- package/dist/review-app/analysis.css +1 -0
- package/dist/review-app/analysis.js +1 -0
- package/dist/review-app/arc-BjIacwQm.js +1 -0
- package/dist/review-app/architecture-U656AL7Q-aSB9x1OK.js +1 -0
- package/dist/review-app/architectureDiagram-VXUJARFQ-C5W6re2I.js +36 -0
- package/dist/review-app/array-BmXUUrU6.js +1 -0
- package/dist/review-app/blockDiagram-VD42YOAC-20MLNcUm.js +122 -0
- package/dist/review-app/c4Diagram-YG6GDRKO-BZXRrcck.js +10 -0
- package/dist/review-app/channel-lk2p_CUu.js +1 -0
- package/dist/review-app/chunk-4BX2VUAB-BPITOdjX.js +1 -0
- package/dist/review-app/chunk-55IACEB6-Dz-pyw5k.js +1 -0
- package/dist/review-app/chunk-76Q3JFCE-cK_X1P_l.js +1 -0
- package/dist/review-app/chunk-ABZYJK2D-Dt4W53JI.js +81 -0
- package/dist/review-app/chunk-ATLVNIR6-fZHLXURb.js +1 -0
- package/dist/review-app/chunk-B4BG7PRW-BbgcjusC.js +165 -0
- package/dist/review-app/chunk-BJD4TVEz.js +1 -0
- package/dist/review-app/chunk-CVBHYZKI-CViawAKX.js +1 -0
- package/dist/review-app/chunk-DI55MBZ5-C5aoul-d.js +220 -0
- package/dist/review-app/chunk-FMBD7UC4-Chxmw62A.js +15 -0
- package/dist/review-app/chunk-FPAJGGOC-DDHjQ09H.js +80 -0
- package/dist/review-app/chunk-FWNWRKHM-CVVQUptk.js +1 -0
- package/dist/review-app/chunk-HN2XXSSU-yzNpjaSZ.js +1 -0
- package/dist/review-app/chunk-JA3XYJ7Z-C5ZJdU01.js +70 -0
- package/dist/review-app/chunk-JZLCHNYA-BBST4Cnk.js +54 -0
- package/dist/review-app/chunk-LBM3YZW2-CdwAPuHr.js +1 -0
- package/dist/review-app/chunk-LHMN2FUI-BtB5uDcp.js +1 -0
- package/dist/review-app/chunk-O7ZBX7Z2-pxdK4Sa3.js +1 -0
- package/dist/review-app/chunk-QN33PNHL-CbVv3uGK.js +1 -0
- package/dist/review-app/chunk-QXUST7PY-DKM2-t2c.js +7 -0
- package/dist/review-app/chunk-QZHKN3VN-C5ni2pN_.js +1 -0
- package/dist/review-app/chunk-S3R3BYOJ-BWvOhDs0.js +2 -0
- package/dist/review-app/chunk-S6J4BHB3-D9Fk0YeD.js +1 -0
- package/dist/review-app/chunk-T53DSG4Q-C1qEyzyV.js +1 -0
- package/dist/review-app/chunk-TZMSLE5B-B--7eU69.js +1 -0
- package/dist/review-app/classDiagram-2ON5EDUG-DlL1m2bp.js +1 -0
- package/dist/review-app/classDiagram-v2-WZHVMYZB-FXRskT1j.js +1 -0
- package/dist/review-app/clone-BZZb7gpZ.js +1 -0
- package/dist/review-app/cose-bilkent-S5V4N54A-CRIb8XEO.js +1 -0
- package/dist/review-app/cytoscape.esm-C7jYqDP5.js +321 -0
- package/dist/review-app/dagre-6UL2VRFP-FNCAXbdE.js +4 -0
- package/dist/review-app/dagre-Be46QtUd.js +1 -0
- package/dist/review-app/defaultLocale-BaWNtAUL.js +1 -0
- package/dist/review-app/diagram-PSM6KHXK-ylLWjiNM.js +24 -0
- package/dist/review-app/diagram-QEK2KX5R-BCDcESxs.js +43 -0
- package/dist/review-app/diagram-S2PKOQOG-Vdrc-vrO.js +24 -0
- package/dist/review-app/dist-WPc74x_f.js +1 -0
- package/dist/review-app/erDiagram-Q2GNP2WA-E5ZsUbDF.js +60 -0
- package/dist/review-app/flatten-DHf9IeNI.js +1 -0
- package/dist/review-app/flowDiagram-NV44I4VS-DBSQuj6x.js +162 -0
- package/dist/review-app/ganttDiagram-LVOFAZNH-CKUOsqwl.js +267 -0
- package/dist/review-app/gitGraph-F6HP7TQM-DsAD6qK1.js +1 -0
- package/dist/review-app/gitGraphDiagram-NY62KEGX-BCeIMWdl.js +65 -0
- package/dist/review-app/graphlib-CiX5CXxR.js +1 -0
- package/dist/review-app/http-DMvwuuFk.js +1 -0
- package/dist/review-app/identity-DY8PXc6t.js +1 -0
- package/dist/review-app/info-NVLQJR56-Dlx1nZic.js +1 -0
- package/dist/review-app/infoDiagram-F6ZHWCRC-CAuANIrz.js +2 -0
- package/dist/review-app/init-BvqephKz.js +1 -0
- package/dist/review-app/journeyDiagram-XKPGCS4Q-C-Z9phnx.js +139 -0
- package/dist/review-app/kanban-definition-3W4ZIXB7-DufgZABq.js +89 -0
- package/dist/review-app/katex-B-Z-NXXN.js +257 -0
- package/dist/review-app/line-DiIv3Jgw.js +1 -0
- package/dist/review-app/linear-Cv-UPvo1.js +1 -0
- package/dist/review-app/math-kmyYrkHL.js +1 -0
- package/dist/review-app/mermaid-parser.core-DkwUYTPl.js +4 -0
- package/dist/review-app/mindmap-definition-VGOIOE7T-TM_CqdmV.js +68 -0
- package/dist/review-app/ordinal-BliTlkoG.js +1 -0
- package/dist/review-app/packet-BFZMPI3H-DqbnU92v.js +1 -0
- package/dist/review-app/path-AEo9W6mQ.js +1 -0
- package/dist/review-app/pie-7BOR55EZ-LJzaLkgr.js +1 -0
- package/dist/review-app/pieDiagram-ADFJNKIX-BAs8OfRS.js +30 -0
- package/dist/review-app/quadrantDiagram-AYHSOK5B-CyUDZP5S.js +7 -0
- package/dist/review-app/radar-NHE76QYJ-DBpHc8_Y.js +1 -0
- package/dist/review-app/reduce-B-HuPpdd.js +1 -0
- package/dist/review-app/requirementDiagram-UZGBJVZJ-BEHix78P.js +64 -0
- package/dist/review-app/review.css +1 -0
- package/dist/review-app/review.js +43 -0
- package/dist/review-app/sankeyDiagram-TZEHDZUN-B2bKbmsm.js +10 -0
- package/dist/review-app/sequenceDiagram-WL72ISMW-DVLOORFJ.js +145 -0
- package/dist/review-app/settings.css +1 -0
- package/dist/review-app/settings.js +1 -0
- package/dist/review-app/src-Buml7cM5.js +1 -0
- package/dist/review-app/stateDiagram-FKZM4ZOC-sFGGp2kV.js +1 -0
- package/dist/review-app/stateDiagram-v2-4FDKWEC3-BHfCF4dX.js +1 -0
- package/dist/review-app/timeline-definition-IT6M3QCI-BESnBijC.js +61 -0
- package/dist/review-app/treemap-KMMF4GRG-wnVLBDeQ.js +1 -0
- package/dist/review-app/walletStatus-CcojOdGy.js +7 -0
- package/dist/review-app/xychartDiagram-PRI3JC2R-BGWVfCx4.js +7 -0
- package/dist/review-server/assets.js +48 -0
- package/dist/review-server/html.js +66 -0
- package/dist/review-server/http.js +47 -0
- package/dist/review-server/middleware/hostOrigin.js +48 -0
- package/dist/review-server/middleware/reviewToken.js +7 -0
- package/dist/review-server/reviewServerPolicy.js +10 -0
- package/dist/review-server/server.js +568 -0
- package/dist/review-server/settingsApi.js +182 -0
- package/dist/review-server/walletIdentityResponse.js +13 -0
- package/dist/runtime/config.js +103 -0
- package/dist/runtime/localSettingsService.js +198 -0
- package/dist/runtime/logger.js +50 -0
- package/dist/runtime/reviewServerAcquire.js +128 -0
- package/dist/runtime/smokeMainnetRead.js +529 -0
- package/dist/runtime/smokeMainnetReadAssertions.js +308 -0
- package/dist/runtime/start.js +295 -0
- package/dist/runtime/suiEndpoint.js +97 -0
- package/dist/runtime/suiTransactionGraphqlMapping.js +200 -0
- package/dist/runtime/suiTransactionGraphqlQueries.js +231 -0
- package/dist/runtime/suiTransactionGraphqlSource.js +148 -0
- package/docs/AGENT_BEHAVIOR.md +1 -1
- package/docs/AGENT_DEVELOPMENT_POLICY.md +20 -0
- package/docs/FRONTEND_POLICY.md +4 -3
- package/docs/MCP_SETUP.md +59 -7
- package/docs/MCP_TOOLS.md +1 -1
- package/docs/SDK_API.md +5 -1
- package/package.json +3 -2
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { actionPlanSchema, executionResultSchema, internalSessionStatusSchema, reviewStateOutputSchema, unknownRecordSchema } from "../../../core/action/schemas.js";
|
|
3
|
+
import { REVIEW_ACTIVITY_LIST_DEFAULT_LIMIT, REVIEW_ACTIVITY_LIST_MAX_LIMIT, REVIEW_ACTIVITY_LOW_SAMPLE_THRESHOLD } from "../../../core/activity/activityStore.js";
|
|
4
|
+
import { successOutputSchema } from "../../schemas.js";
|
|
5
|
+
import { okToolResult } from "../../result.js";
|
|
6
|
+
import { TOOL_NAMES } from "../../toolNames.js";
|
|
7
|
+
import { reviewActivityListUserAnswerUse, reviewFunnelUserAnswerUse, reviewSessionDetailUserAnswerUse } from "../../responseGuidance.js";
|
|
8
|
+
import { fetchedAtSchema, reviewActivityAccountSourceSchema, reviewActivityDataScopeSchema, reviewActivityInputSchema, userAnswerUseSchema } from "./commonSchemas.js";
|
|
9
|
+
import { activityStoreReadError } from "./readToolHelpers.js";
|
|
10
|
+
const reviewActivityCommonOutput = {
|
|
11
|
+
dataScope: reviewActivityDataScopeSchema,
|
|
12
|
+
accountSource: reviewActivityAccountSourceSchema,
|
|
13
|
+
userAnswerUse: userAnswerUseSchema,
|
|
14
|
+
lowSampleWarning: z.boolean(),
|
|
15
|
+
lowSampleThreshold: z.literal(REVIEW_ACTIVITY_LOW_SAMPLE_THRESHOLD),
|
|
16
|
+
truncated: z.object({
|
|
17
|
+
activities: z.boolean(),
|
|
18
|
+
snapshots: z.boolean(),
|
|
19
|
+
transitions: z.boolean()
|
|
20
|
+
})
|
|
21
|
+
};
|
|
22
|
+
const reviewActivityRowSchema = z.object({
|
|
23
|
+
reviewSessionId: z.string(),
|
|
24
|
+
planId: z.string(),
|
|
25
|
+
actionKind: z.string(),
|
|
26
|
+
adapterId: z.string(),
|
|
27
|
+
protocol: z.string(),
|
|
28
|
+
currentStatus: internalSessionStatusSchema,
|
|
29
|
+
account: z.string(),
|
|
30
|
+
createdAt: fetchedAtSchema,
|
|
31
|
+
updatedAt: fetchedAtSchema,
|
|
32
|
+
executionStatus: z.string().optional(),
|
|
33
|
+
txDigest: z.string().optional(),
|
|
34
|
+
snapshotCount: z.number().int().nonnegative(),
|
|
35
|
+
transitionCount: z.number().int().nonnegative()
|
|
36
|
+
});
|
|
37
|
+
export function registerReviewActivityListTool(server, deps) {
|
|
38
|
+
server.registerTool(TOOL_NAMES.readListReviewActivity, {
|
|
39
|
+
title: "List review activity",
|
|
40
|
+
description: "List local Say Ur Intent review-session records for one account. Not wallet transaction history.",
|
|
41
|
+
inputSchema: {
|
|
42
|
+
...reviewActivityInputSchema,
|
|
43
|
+
status: internalSessionStatusSchema.optional(),
|
|
44
|
+
limit: z.number().int().min(1).max(REVIEW_ACTIVITY_LIST_MAX_LIMIT).optional()
|
|
45
|
+
},
|
|
46
|
+
outputSchema: successOutputSchema({
|
|
47
|
+
...reviewActivityCommonOutput,
|
|
48
|
+
activities: z.array(reviewActivityRowSchema)
|
|
49
|
+
}),
|
|
50
|
+
annotations: { readOnlyHint: true, openWorldHint: false }
|
|
51
|
+
}, async ({ account, from, to, status, limit }) => {
|
|
52
|
+
try {
|
|
53
|
+
const result = await deps.activityStore.listReviewActivity({
|
|
54
|
+
account,
|
|
55
|
+
from,
|
|
56
|
+
to,
|
|
57
|
+
status,
|
|
58
|
+
limit: limit ?? REVIEW_ACTIVITY_LIST_DEFAULT_LIMIT
|
|
59
|
+
});
|
|
60
|
+
return okToolResult({
|
|
61
|
+
...result,
|
|
62
|
+
userAnswerUse: reviewActivityListUserAnswerUse()
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
return activityStoreReadError(error, deps);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
export function registerReviewActivitySummaryTools(server, deps) {
|
|
71
|
+
server.registerTool(TOOL_NAMES.readSummarizeReviewFunnel, {
|
|
72
|
+
title: "Summarize review funnel",
|
|
73
|
+
description: "Lifecycle counts for local Say Ur Intent review sessions in one account scope.",
|
|
74
|
+
inputSchema: reviewActivityInputSchema,
|
|
75
|
+
outputSchema: successOutputSchema({
|
|
76
|
+
...reviewActivityCommonOutput,
|
|
77
|
+
summary: z.object({
|
|
78
|
+
total: z.number().int().nonnegative(),
|
|
79
|
+
opened: z.number().int().nonnegative(),
|
|
80
|
+
walletConnected: z.number().int().nonnegative(),
|
|
81
|
+
stateComputed: z.number().int().nonnegative(),
|
|
82
|
+
currentStatusCounts: unknownRecordSchema,
|
|
83
|
+
everReachedReviewStateCounts: z.object({
|
|
84
|
+
ready_for_wallet_review: z.number().int().nonnegative(),
|
|
85
|
+
blocked: z.number().int().nonnegative(),
|
|
86
|
+
refresh_required: z.number().int().nonnegative()
|
|
87
|
+
}),
|
|
88
|
+
signedPending: z.number().int().nonnegative(),
|
|
89
|
+
success: z.number().int().nonnegative(),
|
|
90
|
+
failure: z.number().int().nonnegative(),
|
|
91
|
+
expiredBeforeResult: z.number().int().nonnegative(),
|
|
92
|
+
avgCreatedToSignedSeconds: z.number().nullable(),
|
|
93
|
+
avgOpenedToSignedSeconds: z.number().nullable()
|
|
94
|
+
})
|
|
95
|
+
}),
|
|
96
|
+
annotations: { readOnlyHint: true, openWorldHint: false }
|
|
97
|
+
}, async ({ account, from, to }) => {
|
|
98
|
+
try {
|
|
99
|
+
const result = await deps.activityStore.summarizeReviewFunnel({ account, from, to });
|
|
100
|
+
return okToolResult({
|
|
101
|
+
...result,
|
|
102
|
+
userAnswerUse: reviewFunnelUserAnswerUse()
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
return activityStoreReadError(error, deps);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
server.registerTool(TOOL_NAMES.readGetReviewSessionDetail, {
|
|
110
|
+
title: "Get review session detail",
|
|
111
|
+
description: "Return one stored Say Ur Intent review session with plan, snapshots, transitions, and result.",
|
|
112
|
+
inputSchema: {
|
|
113
|
+
reviewSessionId: z.string().min(1),
|
|
114
|
+
account: z.string().min(1).optional()
|
|
115
|
+
},
|
|
116
|
+
outputSchema: successOutputSchema({
|
|
117
|
+
...reviewActivityCommonOutput,
|
|
118
|
+
session: reviewActivityRowSchema.omit({
|
|
119
|
+
executionStatus: true,
|
|
120
|
+
txDigest: true,
|
|
121
|
+
snapshotCount: true,
|
|
122
|
+
transitionCount: true
|
|
123
|
+
}),
|
|
124
|
+
planJson: actionPlanSchema,
|
|
125
|
+
intentJson: z.unknown().optional(),
|
|
126
|
+
stateSnapshots: z.array(z.object({
|
|
127
|
+
id: z.number().int().positive(),
|
|
128
|
+
planId: z.string(),
|
|
129
|
+
account: z.string(),
|
|
130
|
+
status: z.string(),
|
|
131
|
+
blockedReason: z.string().optional(),
|
|
132
|
+
refreshReason: z.string().optional(),
|
|
133
|
+
stateJson: reviewStateOutputSchema,
|
|
134
|
+
updatedAt: fetchedAtSchema,
|
|
135
|
+
recordedAt: fetchedAtSchema
|
|
136
|
+
})),
|
|
137
|
+
transitions: z.array(z.object({
|
|
138
|
+
id: z.number().int().positive(),
|
|
139
|
+
event: z.string(),
|
|
140
|
+
fromStatus: z.string().optional(),
|
|
141
|
+
toStatus: z.string(),
|
|
142
|
+
isNoOp: z.boolean(),
|
|
143
|
+
account: z.string().optional(),
|
|
144
|
+
reason: z.string().optional(),
|
|
145
|
+
transitionedAt: fetchedAtSchema
|
|
146
|
+
})),
|
|
147
|
+
execution: z
|
|
148
|
+
.object({
|
|
149
|
+
reviewSessionId: z.string(),
|
|
150
|
+
planId: z.string(),
|
|
151
|
+
accountId: z.number().int().positive(),
|
|
152
|
+
account: z.string(),
|
|
153
|
+
status: z.string(),
|
|
154
|
+
txDigest: z.string().optional(),
|
|
155
|
+
explorerUrl: z.string().optional(),
|
|
156
|
+
failureReason: z.string().optional(),
|
|
157
|
+
recordedAt: fetchedAtSchema,
|
|
158
|
+
updatedAt: fetchedAtSchema,
|
|
159
|
+
resultJson: executionResultSchema
|
|
160
|
+
})
|
|
161
|
+
.optional()
|
|
162
|
+
}),
|
|
163
|
+
annotations: { readOnlyHint: true, openWorldHint: false }
|
|
164
|
+
}, async ({ reviewSessionId, account }) => {
|
|
165
|
+
try {
|
|
166
|
+
const result = await deps.activityStore.getReviewSessionDetail({ reviewSessionId, account });
|
|
167
|
+
return okToolResult({
|
|
168
|
+
...result,
|
|
169
|
+
userAnswerUse: reviewSessionDetailUserAnswerUse(result.execution !== undefined)
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
return activityStoreReadError(error, deps);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { noParamsInputSchema, successOutputSchema } from "../../schemas.js";
|
|
3
|
+
import { okToolResult } from "../../result.js";
|
|
4
|
+
import { MCP_PROMPTS } from "../../prompts.js";
|
|
5
|
+
import { MCP_RESOURCES } from "../../resources.js";
|
|
6
|
+
import { EVIDENCE_POLICY, FAIL_CLOSED_TOOLS, IMPLEMENTED_TOOLS, PACKAGE_NAME, SERVER_LIMITATIONS, SERVER_NAME, SERVER_NETWORK, SERVER_RUNTIME, SERVER_TRANSPORT, SERVER_VERSION } from "../../serverInfo.js";
|
|
7
|
+
import { TOOL_NAMES } from "../../toolNames.js";
|
|
8
|
+
// Listed swap-capable DeFi venues first, in selection order (deep, then flowx),
|
|
9
|
+
// so protocol enumeration leads with the venues a user actually picks between.
|
|
10
|
+
// deepbook-margin is protocol-notes-only (no swap surface) and trails them.
|
|
11
|
+
export const SUPPORTED_PROTOCOLS = [
|
|
12
|
+
{ id: "deepbook-v3", status: "mainnet", support: "read_and_local_review" },
|
|
13
|
+
{ id: "flowx-clmm", status: "mainnet", support: "read_and_local_review" },
|
|
14
|
+
{ id: "deepbook-margin", status: "mainnet", support: "protocol_notes_only" }
|
|
15
|
+
];
|
|
16
|
+
export function registerServerStatusTools(server) {
|
|
17
|
+
server.registerTool(TOOL_NAMES.readGetServerStatus, {
|
|
18
|
+
title: "Get server status",
|
|
19
|
+
description: "Return package, runtime, tool, resource, and prompt status.",
|
|
20
|
+
inputSchema: noParamsInputSchema,
|
|
21
|
+
outputSchema: successOutputSchema({
|
|
22
|
+
packageName: z.string(),
|
|
23
|
+
serverName: z.string(),
|
|
24
|
+
version: z.string(),
|
|
25
|
+
evidencePolicy: z.object({
|
|
26
|
+
version: z.string(),
|
|
27
|
+
releaseGate: z.literal("intent_evidence_v1"),
|
|
28
|
+
requiredFirstCheck: z.literal(true),
|
|
29
|
+
requiredStatusFields: z.array(z.string()),
|
|
30
|
+
gates: z.array(z.string())
|
|
31
|
+
}),
|
|
32
|
+
network: z.literal("mainnet"),
|
|
33
|
+
runtime: z.literal("local_stdio"),
|
|
34
|
+
transport: z.literal("grpc_graphql"),
|
|
35
|
+
implementedTools: z.array(z.string()),
|
|
36
|
+
implementedToolsCount: z.number().int().nonnegative(),
|
|
37
|
+
failClosedTools: z.array(z.string()),
|
|
38
|
+
resources: z.object({
|
|
39
|
+
count: z.number().int().nonnegative(),
|
|
40
|
+
uris: z.array(z.string()),
|
|
41
|
+
items: z.array(z.object({
|
|
42
|
+
name: z.string(),
|
|
43
|
+
uri: z.string(),
|
|
44
|
+
title: z.string(),
|
|
45
|
+
description: z.string()
|
|
46
|
+
}))
|
|
47
|
+
}),
|
|
48
|
+
prompts: z.object({
|
|
49
|
+
count: z.number().int().nonnegative(),
|
|
50
|
+
names: z.array(z.string())
|
|
51
|
+
}),
|
|
52
|
+
protocolsTool: z.literal("read.list_supported_protocols"),
|
|
53
|
+
limitations: z.array(z.string())
|
|
54
|
+
}),
|
|
55
|
+
annotations: { readOnlyHint: true, openWorldHint: false }
|
|
56
|
+
}, async () => okToolResult({
|
|
57
|
+
packageName: PACKAGE_NAME,
|
|
58
|
+
serverName: SERVER_NAME,
|
|
59
|
+
version: SERVER_VERSION,
|
|
60
|
+
evidencePolicy: {
|
|
61
|
+
...EVIDENCE_POLICY,
|
|
62
|
+
requiredStatusFields: [...EVIDENCE_POLICY.requiredStatusFields],
|
|
63
|
+
gates: [...EVIDENCE_POLICY.gates]
|
|
64
|
+
},
|
|
65
|
+
network: SERVER_NETWORK,
|
|
66
|
+
runtime: SERVER_RUNTIME,
|
|
67
|
+
transport: SERVER_TRANSPORT,
|
|
68
|
+
implementedTools: [...IMPLEMENTED_TOOLS],
|
|
69
|
+
implementedToolsCount: IMPLEMENTED_TOOLS.length,
|
|
70
|
+
failClosedTools: [...FAIL_CLOSED_TOOLS],
|
|
71
|
+
resources: {
|
|
72
|
+
count: MCP_RESOURCES.length,
|
|
73
|
+
uris: MCP_RESOURCES.map((resource) => resource.uri),
|
|
74
|
+
items: MCP_RESOURCES.map((resource) => ({
|
|
75
|
+
name: resource.name,
|
|
76
|
+
uri: resource.uri,
|
|
77
|
+
title: resource.title,
|
|
78
|
+
description: resource.description
|
|
79
|
+
}))
|
|
80
|
+
},
|
|
81
|
+
prompts: {
|
|
82
|
+
count: MCP_PROMPTS.length,
|
|
83
|
+
names: MCP_PROMPTS.map((prompt) => prompt.name)
|
|
84
|
+
},
|
|
85
|
+
protocolsTool: TOOL_NAMES.readListSupportedProtocols,
|
|
86
|
+
limitations: [...SERVER_LIMITATIONS]
|
|
87
|
+
}));
|
|
88
|
+
server.registerTool(TOOL_NAMES.readListSupportedProtocols, {
|
|
89
|
+
title: "List supported protocols",
|
|
90
|
+
description: "List current mainnet protocol surfaces and support levels.",
|
|
91
|
+
inputSchema: noParamsInputSchema,
|
|
92
|
+
outputSchema: successOutputSchema({
|
|
93
|
+
protocols: z.array(z.object({
|
|
94
|
+
id: z.string(),
|
|
95
|
+
status: z.literal("mainnet"),
|
|
96
|
+
support: z.string()
|
|
97
|
+
}))
|
|
98
|
+
}),
|
|
99
|
+
annotations: { readOnlyHint: true, openWorldHint: false }
|
|
100
|
+
}, async () => okToolResult({
|
|
101
|
+
protocols: [...SUPPORTED_PROTOCOLS]
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import { compactExternalActivityTransactionDetails } from "../../../core/activity/transactionActivityDetails.js";
|
|
2
|
+
import { TOOL_NAMES } from "../../toolNames.js";
|
|
3
|
+
export const SUI_ACTIVITY_QUANTITY_SEMANTICS = {
|
|
4
|
+
kind: "sui_activity_raw_amounts",
|
|
5
|
+
rawAmountsOnly: true,
|
|
6
|
+
displayConversionRequires: "verified_coin_metadata_decimals",
|
|
7
|
+
gasRawUnit: "MIST",
|
|
8
|
+
gasUnitSource: "@mysten/sui MIST_PER_SUI",
|
|
9
|
+
gasDisplayFields: [
|
|
10
|
+
"transaction.compact.gasCost.display",
|
|
11
|
+
"requestedAccountTransactionFacts[].transactionContext.gasCost.display",
|
|
12
|
+
"transactions[].transactionContext.gasCost.display",
|
|
13
|
+
"analysis.gas.netGasCost.display"
|
|
14
|
+
],
|
|
15
|
+
rawAmountFields: [
|
|
16
|
+
"transaction.details.balanceChanges[].amountRaw",
|
|
17
|
+
"transaction.requestedAccountEffect.balanceChanges[].amountRaw",
|
|
18
|
+
"transaction.requestedAccountEffect.coinFlows[].*Raw",
|
|
19
|
+
"requestedAccount.coinFlows[].*Raw",
|
|
20
|
+
"requestedAccountTransactionFacts[].accountBalanceChanges[].amountRaw",
|
|
21
|
+
"requestedAccountTransactionFacts[].accountCoinFlows[].*Raw",
|
|
22
|
+
"requestedAccountTransactionFacts[].requestedAccountEffect.balanceChanges[].amountRaw",
|
|
23
|
+
"requestedAccountTransactionFacts[].requestedAccountEffect.coinFlows[].*Raw",
|
|
24
|
+
"transactions[].requestedAccountEffect.balanceChanges[].amountRaw",
|
|
25
|
+
"transactions[].requestedAccountEffect.coinFlows[].*Raw",
|
|
26
|
+
"transactions[].details.balanceChanges[].amountRaw",
|
|
27
|
+
"transactions[].compact.balanceChanges[].amountRaw",
|
|
28
|
+
"analysis.coinFlows[].*Raw"
|
|
29
|
+
],
|
|
30
|
+
notFor: [
|
|
31
|
+
"display_conversion_without_verified_decimals",
|
|
32
|
+
"fiat_usd_cash_out",
|
|
33
|
+
"profit_or_pnl",
|
|
34
|
+
"position_valuation"
|
|
35
|
+
]
|
|
36
|
+
};
|
|
37
|
+
export function suiActivityQuantitySemantics() {
|
|
38
|
+
return SUI_ACTIVITY_QUANTITY_SEMANTICS;
|
|
39
|
+
}
|
|
40
|
+
export function transactionDetailAvailability(transactions) {
|
|
41
|
+
const totalTransactions = transactions.length;
|
|
42
|
+
const withDetails = transactions.filter((transaction) => transaction.details !== undefined).length;
|
|
43
|
+
const withoutDetails = totalTransactions - withDetails;
|
|
44
|
+
const detailAvailability = withDetails === 0 ? "none" : withoutDetails === 0 ? "all" : "some";
|
|
45
|
+
return {
|
|
46
|
+
totalTransactions,
|
|
47
|
+
withDetails,
|
|
48
|
+
withoutDetails,
|
|
49
|
+
detailAvailability,
|
|
50
|
+
allReturnedTransactionsHaveDetails: detailAvailability === "all"
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function normalizeDetailAvailability(input) {
|
|
54
|
+
if (typeof input !== "string") {
|
|
55
|
+
return input;
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
totalTransactions: input === "some" ? 2 : input === "none" ? 0 : 1,
|
|
59
|
+
withDetails: input === "none" ? 0 : 1,
|
|
60
|
+
withoutDetails: input === "some" ? 1 : 0,
|
|
61
|
+
detailAvailability: input,
|
|
62
|
+
allReturnedTransactionsHaveDetails: input === "all"
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export function inspectSuiTransactionUserAnswerUse(fields = {}) {
|
|
66
|
+
const hasSender = fields.hasSender ?? true;
|
|
67
|
+
const hasRequestedAccountEffect = fields.hasRequestedAccountEffect ?? true;
|
|
68
|
+
const hasDetails = fields.hasDetails ?? true;
|
|
69
|
+
return {
|
|
70
|
+
canAnswer: [
|
|
71
|
+
"one_sui_transaction_digest_status_and_context",
|
|
72
|
+
...(hasRequestedAccountEffect ? ["requested_account_balance_effect_for_this_digest"] : []),
|
|
73
|
+
...(hasDetails ? ["transaction_level_move_call_object_event_gas_and_protocol_label_facts"] : [])
|
|
74
|
+
],
|
|
75
|
+
cannotAnswer: [
|
|
76
|
+
"complete_wallet_history",
|
|
77
|
+
...(hasRequestedAccountEffect ? [] : ["requested_account_balance_effect_without_requestedAccountEffect_field"]),
|
|
78
|
+
...(hasDetails ? [] : ["transaction_level_move_call_object_event_gas_and_protocol_label_facts_without_details_field"]),
|
|
79
|
+
"display_token_amounts_without_verified_decimals",
|
|
80
|
+
"fiat_usd_cash_out",
|
|
81
|
+
"profit_or_pnl",
|
|
82
|
+
"position_valuation",
|
|
83
|
+
"route_recommendation",
|
|
84
|
+
"transaction_building",
|
|
85
|
+
"signing_data_or_readiness"
|
|
86
|
+
],
|
|
87
|
+
answerFields: [
|
|
88
|
+
"transaction.digest",
|
|
89
|
+
"transaction.status",
|
|
90
|
+
...(hasSender ? ["transaction.sender"] : []),
|
|
91
|
+
...(hasRequestedAccountEffect ? ["transaction.requestedAccountEffect"] : []),
|
|
92
|
+
...(hasDetails ? ["transaction.compact", "transaction.details"] : []),
|
|
93
|
+
"fetchedAt"
|
|
94
|
+
],
|
|
95
|
+
diagnosticOnlyFields: ["source", "quantitySemantics", "persistence"]
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export function liveSuiActivityUserAnswerUse(input) {
|
|
99
|
+
const includeAnalysis = typeof input === "boolean" ? input : input.includeAnalysis;
|
|
100
|
+
const detailAvailability = normalizeDetailAvailability(typeof input === "boolean" ? "all" : input.transactionDetailAvailability ?? "all");
|
|
101
|
+
const allTransactionsHaveContext = detailAvailability.allReturnedTransactionsHaveDetails;
|
|
102
|
+
const someTransactionsHaveContext = detailAvailability.withDetails > 0;
|
|
103
|
+
return {
|
|
104
|
+
canAnswer: [
|
|
105
|
+
"bounded_requested_account_activity_page",
|
|
106
|
+
"requested_account_raw_coin_flows_in_returned_rows",
|
|
107
|
+
"transaction_detail_availability_for_returned_rows",
|
|
108
|
+
...(allTransactionsHaveContext ? ["transaction_context_for_all_returned_rows"] : []),
|
|
109
|
+
...(!allTransactionsHaveContext && someTransactionsHaveContext
|
|
110
|
+
? ["transaction_context_for_some_returned_rows"]
|
|
111
|
+
: []),
|
|
112
|
+
...(includeAnalysis ? ["deterministic_summary_over_returned_normalized_rows"] : [])
|
|
113
|
+
],
|
|
114
|
+
cannotAnswer: [
|
|
115
|
+
"complete_wallet_history",
|
|
116
|
+
"complete_dapp_history",
|
|
117
|
+
...(allTransactionsHaveContext ? [] : ["transaction_context_for_all_returned_rows_without_all_details"]),
|
|
118
|
+
"display_token_amounts_without_verified_decimals",
|
|
119
|
+
"fiat_usd_cash_out",
|
|
120
|
+
"profit_or_pnl",
|
|
121
|
+
"position_valuation",
|
|
122
|
+
"route_recommendation",
|
|
123
|
+
"transaction_building",
|
|
124
|
+
"signing_data_or_readiness"
|
|
125
|
+
],
|
|
126
|
+
answerFields: [
|
|
127
|
+
"requestedAccount",
|
|
128
|
+
"requestedAccountTransactionFacts",
|
|
129
|
+
"requestedAccountTransactionFacts[].requestedAccountEffect",
|
|
130
|
+
"requestedAccountTransactionFacts[].accountCoinFlows",
|
|
131
|
+
"transactionDetailAvailability",
|
|
132
|
+
...(allTransactionsHaveContext ? ["transactions[].transactionContext"] : []),
|
|
133
|
+
...(includeAnalysis ? ["analysis"] : []),
|
|
134
|
+
"fetchedAt"
|
|
135
|
+
],
|
|
136
|
+
conclusionRuleFields: ["transactionDetailAvailability"],
|
|
137
|
+
diagnosticOnlyFields: [
|
|
138
|
+
"source",
|
|
139
|
+
"quantitySemantics",
|
|
140
|
+
"persistence",
|
|
141
|
+
"hasMore",
|
|
142
|
+
"continuationCursor",
|
|
143
|
+
"windowComplete",
|
|
144
|
+
"orderingVerified",
|
|
145
|
+
"incompleteReason"
|
|
146
|
+
],
|
|
147
|
+
followUp: {
|
|
148
|
+
tool: TOOL_NAMES.readInspectSuiTransaction,
|
|
149
|
+
inputFields: ["transactions[].detailLookup.digest"],
|
|
150
|
+
answerFields: ["transaction"],
|
|
151
|
+
reason: "Use when the user asks for full normalized details for a returned digest; scan rows intentionally omit full details."
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
export function storedSuiActivityUserAnswerUse(input = "all") {
|
|
156
|
+
const detailAvailability = normalizeDetailAvailability(input);
|
|
157
|
+
const allTransactionsHaveDetails = detailAvailability.allReturnedTransactionsHaveDetails;
|
|
158
|
+
const someTransactionsHaveDetails = detailAvailability.withDetails > 0;
|
|
159
|
+
return {
|
|
160
|
+
canAnswer: [
|
|
161
|
+
"stored_local_normalized_activity_summary_for_the_selected_account",
|
|
162
|
+
"deterministic_summary_over_stored_normalized_rows",
|
|
163
|
+
"stored_transaction_detail_availability_for_returned_rows",
|
|
164
|
+
...(allTransactionsHaveDetails ? ["stored_transaction_context_for_all_returned_rows"] : []),
|
|
165
|
+
...(!allTransactionsHaveDetails && someTransactionsHaveDetails
|
|
166
|
+
? ["stored_transaction_context_for_some_returned_rows"]
|
|
167
|
+
: [])
|
|
168
|
+
],
|
|
169
|
+
cannotAnswer: [
|
|
170
|
+
"live_latest_activity",
|
|
171
|
+
"complete_wallet_history",
|
|
172
|
+
"complete_dapp_history",
|
|
173
|
+
...(allTransactionsHaveDetails ? [] : ["stored_transaction_context_for_all_returned_rows_without_all_details"]),
|
|
174
|
+
"display_token_amounts_without_verified_decimals",
|
|
175
|
+
"fiat_usd_cash_out",
|
|
176
|
+
"profit_or_pnl",
|
|
177
|
+
"position_valuation",
|
|
178
|
+
"route_recommendation",
|
|
179
|
+
"transaction_building",
|
|
180
|
+
"signing_data_or_readiness"
|
|
181
|
+
],
|
|
182
|
+
answerFields: [
|
|
183
|
+
"summary",
|
|
184
|
+
"analysis",
|
|
185
|
+
"transactions",
|
|
186
|
+
"transactionDetailAvailability",
|
|
187
|
+
...(allTransactionsHaveDetails ? ["transactions[].compact", "transactions[].details"] : [])
|
|
188
|
+
],
|
|
189
|
+
conclusionRuleFields: ["transactionDetailAvailability"],
|
|
190
|
+
diagnosticOnlyFields: [
|
|
191
|
+
"dataScope",
|
|
192
|
+
"accountSource",
|
|
193
|
+
"lowSampleWarning",
|
|
194
|
+
"lowSampleThreshold",
|
|
195
|
+
"truncated",
|
|
196
|
+
"source",
|
|
197
|
+
"quantitySemantics"
|
|
198
|
+
],
|
|
199
|
+
followUp: {
|
|
200
|
+
tool: TOOL_NAMES.readSummarizeSuiActivityScan,
|
|
201
|
+
inputFields: ["dataScope.account"],
|
|
202
|
+
answerFields: ["requestedAccountTransactionFacts", "analysis"],
|
|
203
|
+
reason: "Use for recent live requested-account activity; stored summaries are local facts only."
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
export function transactionFactOutput(transaction) {
|
|
208
|
+
const { accountEffects } = transaction;
|
|
209
|
+
return {
|
|
210
|
+
digest: transaction.digest,
|
|
211
|
+
...(transaction.checkpoint === undefined ? {} : { checkpoint: transaction.checkpoint }),
|
|
212
|
+
...(transaction.timestamp === undefined ? {} : { timestamp: transaction.timestamp }),
|
|
213
|
+
status: transaction.status,
|
|
214
|
+
...(transaction.sender === undefined ? {} : { sender: transaction.sender }),
|
|
215
|
+
...(accountEffects === undefined ? {} : { requestedAccountEffect: accountEffects }),
|
|
216
|
+
...(transaction.details === undefined
|
|
217
|
+
? {}
|
|
218
|
+
: { compact: compactExternalActivityTransactionDetails(transaction.details) }),
|
|
219
|
+
...(transaction.details === undefined ? {} : { details: transaction.details })
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
export function transactionFactAuditOutput(transaction) {
|
|
223
|
+
const { accountEffects } = transaction;
|
|
224
|
+
return {
|
|
225
|
+
digest: transaction.digest,
|
|
226
|
+
...(transaction.checkpoint === undefined ? {} : { checkpoint: transaction.checkpoint }),
|
|
227
|
+
...(transaction.timestamp === undefined ? {} : { timestamp: transaction.timestamp }),
|
|
228
|
+
status: transaction.status,
|
|
229
|
+
...(transaction.sender === undefined ? {} : { sender: transaction.sender }),
|
|
230
|
+
...(accountEffects === undefined ? {} : { requestedAccountEffect: accountEffects }),
|
|
231
|
+
...(transaction.details === undefined
|
|
232
|
+
? {}
|
|
233
|
+
: { transactionContext: transactionContextOutput(compactExternalActivityTransactionDetails(transaction.details)) }),
|
|
234
|
+
detailLookup: {
|
|
235
|
+
tool: TOOL_NAMES.readInspectSuiTransaction,
|
|
236
|
+
digest: transaction.digest
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
export function requestedAccountTransactionFactOutput(transaction) {
|
|
241
|
+
if (transaction.accountEffects === undefined) {
|
|
242
|
+
return undefined;
|
|
243
|
+
}
|
|
244
|
+
const compact = transaction.details === undefined
|
|
245
|
+
? undefined
|
|
246
|
+
: compactExternalActivityTransactionDetails(transaction.details);
|
|
247
|
+
const transactionContext = compact === undefined
|
|
248
|
+
? undefined
|
|
249
|
+
: transactionContextOutput(compact);
|
|
250
|
+
return {
|
|
251
|
+
digest: transaction.digest,
|
|
252
|
+
...(transaction.checkpoint === undefined ? {} : { checkpoint: transaction.checkpoint }),
|
|
253
|
+
...(transaction.timestamp === undefined ? {} : { timestamp: transaction.timestamp }),
|
|
254
|
+
status: transaction.status,
|
|
255
|
+
...(transaction.sender === undefined ? {} : { sender: transaction.sender }),
|
|
256
|
+
requestedAccount: transaction.accountEffects.account,
|
|
257
|
+
accountScope: transaction.accountEffects.scope,
|
|
258
|
+
accountRole: transaction.accountEffects.role,
|
|
259
|
+
sentByAccount: transaction.accountEffects.sentByAccount,
|
|
260
|
+
accountBalanceChangeEvidence: transaction.accountEffects.balanceChangeEvidence,
|
|
261
|
+
accountBalanceChangeAbsenceProven: transaction.accountEffects.accountBalanceChangeAbsenceProven,
|
|
262
|
+
accountBalanceChangeInferencePolicy: transaction.accountEffects.accountBalanceChangeInferencePolicy,
|
|
263
|
+
accountBalanceChangeCompleteness: transaction.accountEffects.balanceChangeCompleteness,
|
|
264
|
+
accountBalanceChanges: transaction.accountEffects.balanceChanges,
|
|
265
|
+
accountCoinFlows: transaction.accountEffects.coinFlows,
|
|
266
|
+
accountEffectLimitations: transaction.accountEffects.limitations,
|
|
267
|
+
requestedAccountEffect: transaction.accountEffects,
|
|
268
|
+
...(transactionContext === undefined ? {} : { transactionContext }),
|
|
269
|
+
detailLookup: {
|
|
270
|
+
tool: TOOL_NAMES.readInspectSuiTransaction,
|
|
271
|
+
digest: transaction.digest
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
function transactionContextOutput(compact) {
|
|
276
|
+
return {
|
|
277
|
+
factScope: compact.factScope,
|
|
278
|
+
requestedAccountScoped: compact.requestedAccountScoped,
|
|
279
|
+
moveCallTargets: compact.moveCallTargets,
|
|
280
|
+
objectChangeCounts: compact.objectChangeCounts,
|
|
281
|
+
eventTypes: compact.eventTypes,
|
|
282
|
+
...(compact.gasCost === undefined ? {} : { gasCost: compact.gasCost }),
|
|
283
|
+
...(compact.gasNetCostRaw === undefined ? {} : { gasNetCostRaw: compact.gasNetCostRaw }),
|
|
284
|
+
...(compact.executionError === undefined ? {} : { executionError: compact.executionError }),
|
|
285
|
+
detailTruncated: compact.detailTruncated,
|
|
286
|
+
...(compact.protocolMatches === undefined ? {} : { protocolMatches: compact.protocolMatches })
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
export function externalActivityTransactionRecordOutput(transaction) {
|
|
290
|
+
return {
|
|
291
|
+
...transaction,
|
|
292
|
+
...(transaction.details === undefined
|
|
293
|
+
? {}
|
|
294
|
+
: { compact: compactExternalActivityTransactionDetails(transaction.details) }),
|
|
295
|
+
detailLookup: {
|
|
296
|
+
tool: TOOL_NAMES.readInspectSuiTransaction,
|
|
297
|
+
digest: transaction.digest
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
}
|