@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,218 @@
|
|
|
1
|
+
import { parseSuiAddress } from "../suiAddress.js";
|
|
2
|
+
export const protocolActivityPrimaryActions = [
|
|
3
|
+
"order",
|
|
4
|
+
"swap",
|
|
5
|
+
"liquidity",
|
|
6
|
+
"lending",
|
|
7
|
+
"fee_or_reward",
|
|
8
|
+
"admin_or_versioning",
|
|
9
|
+
"unknown"
|
|
10
|
+
];
|
|
11
|
+
const DEEPBOOK_PINNED_SDK_PACKAGE = "0xf48222c4e057fa468baf136bff8e12504209d43850c5778f76159292a96f621e";
|
|
12
|
+
const DEEPBOOK_DOCS_SNAPSHOT_PACKAGE = "0x337f4f4f6567fcd778d5454f27c16c70e2f274cc6377ea6249ddf491482ef497";
|
|
13
|
+
const DEEPTRADE_CORE_PACKAGE = "0xc10d536b6580d809711b9bb8eee3945d5e96f92a346c84d74ff7a0697e664695";
|
|
14
|
+
const CETUS_CLMM_PACKAGE = "0x25ebb9a7c50eb17b3fa9c5a30fb8b5ad8f97caaf4928943acbcff7153dfee5e3";
|
|
15
|
+
const SUILEND_MVR_CORE_PACKAGE = "0xe53906c2c058d1e369763114418f3c144d1b74960d29b2785718a782fec09b61";
|
|
16
|
+
const SUILEND_MAIN_MARKET_TYPE_PACKAGE = "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf";
|
|
17
|
+
const AFTERMATH_AFSUI_EVENTS_PACKAGE = "0x7f6ce7ade63857c4fd16ef7783fed2dfc4d7fb7e40615abdb653030b76aef0c6";
|
|
18
|
+
const AFTERMATH_AFSUI_PACKAGE = "0x1575034d2729907aefca1ac757d6ccfcd3fc7e9e77927523c06007d8353ad836";
|
|
19
|
+
export const SUI_DEFI_ACTIVITY_PROTOCOL_RULES = [
|
|
20
|
+
{
|
|
21
|
+
protocolId: "deepbook-v3",
|
|
22
|
+
displayName: "DeepBook V3",
|
|
23
|
+
activityCategory: "CLOB / order book",
|
|
24
|
+
packages: normalizePackageMap({
|
|
25
|
+
[DEEPBOOK_PINNED_SDK_PACKAGE]: {
|
|
26
|
+
source: "mvr_current_mainnet_resolution_and_pinned_sdk_local_registry",
|
|
27
|
+
mvrName: "@deepbook/core"
|
|
28
|
+
},
|
|
29
|
+
[DEEPBOOK_DOCS_SNAPSHOT_PACKAGE]: {
|
|
30
|
+
source: "sui_docs_research_snapshot",
|
|
31
|
+
limitation: "deepbook_package_conflict_open"
|
|
32
|
+
}
|
|
33
|
+
}),
|
|
34
|
+
sharedObjects: normalizeObjectMap({
|
|
35
|
+
"0xaf16199a2dff736e9f07a845f23c5da6df6f756eddb631aed9d24a93efc4549d": "deepbook_registry"
|
|
36
|
+
}),
|
|
37
|
+
actionForMoveCall: deepbookActionForMoveCall
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
protocolId: "deeptrade-core",
|
|
41
|
+
displayName: "DeepTrade Core",
|
|
42
|
+
activityCategory: "DeepBook wrapper and fee system",
|
|
43
|
+
packages: normalizePackageMap({
|
|
44
|
+
[DEEPTRADE_CORE_PACKAGE]: {
|
|
45
|
+
source: "mvr_current_mainnet_resolution_and_deeptrade_research_snapshot",
|
|
46
|
+
mvrName: "@deeptrade/deeptrade-core"
|
|
47
|
+
}
|
|
48
|
+
}),
|
|
49
|
+
sharedObjects: normalizeObjectMap({
|
|
50
|
+
"0xb90e2d3de41817016b7d39f49c724c5b0616bd30f1d5e6383048efafabe6232b": "deeptrade_treasury",
|
|
51
|
+
"0xe6a7158cbbee252f2ef9488663d91b42d84b3933609c3f891937240f4be65086": "deeptrade_pool_creation_config",
|
|
52
|
+
"0xcb757e55db3a502dc826c40b8ced507d017b41d926c5bf554e69855510bb855e": "deeptrade_trading_fee_config",
|
|
53
|
+
"0x6a06100001533356fb2e9f68ee299c15565777dfb28c741ec440cb08b168cbff": "deeptrade_loyalty_program"
|
|
54
|
+
}),
|
|
55
|
+
actionForMoveCall: deeptradeActionForMoveCall
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
protocolId: "cetus-clmm",
|
|
59
|
+
displayName: "Cetus CLMM",
|
|
60
|
+
activityCategory: "CLMM / AMM",
|
|
61
|
+
packages: normalizePackageMap({
|
|
62
|
+
[CETUS_CLMM_PACKAGE]: {
|
|
63
|
+
source: "mvr_current_mainnet_resolution_and_cetus_research_snapshot",
|
|
64
|
+
mvrName: "@cetuspackages/clmm"
|
|
65
|
+
}
|
|
66
|
+
}),
|
|
67
|
+
sharedObjects: normalizeObjectMap({
|
|
68
|
+
"0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f": "cetus_global_config",
|
|
69
|
+
"0xf699e7f2276f5c9a75944b37a0c5b5d9ddfd2471bf6242483b03ab2887d198d0": "cetus_pools_table"
|
|
70
|
+
}),
|
|
71
|
+
actionForMoveCall: clmmActionForMoveCall
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
protocolId: "suilend-lending",
|
|
75
|
+
displayName: "Suilend Lending",
|
|
76
|
+
activityCategory: "Lending market",
|
|
77
|
+
packages: normalizePackageMap({
|
|
78
|
+
[SUILEND_MVR_CORE_PACKAGE]: {
|
|
79
|
+
source: "mvr_current_mainnet_resolution",
|
|
80
|
+
mvrName: "@suilend/core"
|
|
81
|
+
},
|
|
82
|
+
[SUILEND_MAIN_MARKET_TYPE_PACKAGE]: {
|
|
83
|
+
source: "suilend_research_snapshot_market_type",
|
|
84
|
+
matchKinds: ["eventType", "objectType"]
|
|
85
|
+
}
|
|
86
|
+
}),
|
|
87
|
+
sharedObjects: normalizeObjectMap({
|
|
88
|
+
"0x84030d26d85eaa7035084a057f2f11f701b7e2e4eda87551becbc7c97505ece1": "suilend_main_market",
|
|
89
|
+
"0xf7a4defe0b6566b6a2674a02a0c61c9f99bd012eed21bc741a069eaa82d35927": "suilend_main_market_owner_cap"
|
|
90
|
+
}),
|
|
91
|
+
actionForMoveCall: lendingActionForMoveCall
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
protocolId: "aftermath-afsui",
|
|
95
|
+
displayName: "Aftermath afSUI",
|
|
96
|
+
activityCategory: "Liquid staking",
|
|
97
|
+
packages: normalizePackageMap({
|
|
98
|
+
[AFTERMATH_AFSUI_EVENTS_PACKAGE]: {
|
|
99
|
+
source: "aftermath_research_snapshot",
|
|
100
|
+
matchKinds: ["eventType", "objectType"]
|
|
101
|
+
},
|
|
102
|
+
[AFTERMATH_AFSUI_PACKAGE]: {
|
|
103
|
+
source: "aftermath_research_snapshot",
|
|
104
|
+
matchKinds: ["eventType", "objectType"]
|
|
105
|
+
}
|
|
106
|
+
}),
|
|
107
|
+
sharedObjects: normalizeObjectMap({
|
|
108
|
+
"0x2f8f6d5da7f13ea37daa397724280483ed062769813b6f31e9788e59cc88994d": "aftermath_staked_sui_vault",
|
|
109
|
+
"0x55486449e41d89cfbdb20e005c1c5c1007858ad5b4d5d7c047d2b3b592fe8791": "aftermath_staked_sui_vault_state",
|
|
110
|
+
"0xd2b95022244757b0ab9f74e2ee2fb2c3bf29dce5590fa6993a85d64bd219d7e8": "aftermath_afsui_treasury"
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
];
|
|
114
|
+
function deepbookActionForMoveCall(call) {
|
|
115
|
+
if (call.module === "balance_manager") {
|
|
116
|
+
if (/^(deposit|withdraw|withdraw_all|mint_trade_cap|mint_deposit_cap|mint_withdraw_cap)/.test(call.function)) {
|
|
117
|
+
return "liquidity";
|
|
118
|
+
}
|
|
119
|
+
return "unknown";
|
|
120
|
+
}
|
|
121
|
+
if (call.module !== "pool") {
|
|
122
|
+
return "unknown";
|
|
123
|
+
}
|
|
124
|
+
if (/^(place_|modify_order|cancel_|withdraw_settled)/.test(call.function)) {
|
|
125
|
+
return "order";
|
|
126
|
+
}
|
|
127
|
+
if (/^swap_/.test(call.function)) {
|
|
128
|
+
return "swap";
|
|
129
|
+
}
|
|
130
|
+
if (/^(claim_|mint_referral|update_.*referral|burn_deep)/.test(call.function)) {
|
|
131
|
+
return "fee_or_reward";
|
|
132
|
+
}
|
|
133
|
+
if (/^(stake|unstake|submit_proposal|vote|create_|update_|adjust_|enable_|set_)/.test(call.function)) {
|
|
134
|
+
return "admin_or_versioning";
|
|
135
|
+
}
|
|
136
|
+
if (/^borrow_flashloan|^return_flashloan/.test(call.function)) {
|
|
137
|
+
return "liquidity";
|
|
138
|
+
}
|
|
139
|
+
return "unknown";
|
|
140
|
+
}
|
|
141
|
+
function deeptradeActionForMoveCall(call) {
|
|
142
|
+
if (call.module === "dt_order") {
|
|
143
|
+
return "order";
|
|
144
|
+
}
|
|
145
|
+
const combined = `${call.module}_${call.function}`;
|
|
146
|
+
if (isAdminOrVersioningCall(combined) || /multisig|dt_pool/.test(call.module) || /create_permissionless_pool/.test(call.function)) {
|
|
147
|
+
return "admin_or_versioning";
|
|
148
|
+
}
|
|
149
|
+
if (call.module === "swap") {
|
|
150
|
+
return "swap";
|
|
151
|
+
}
|
|
152
|
+
if (/fee|treasury|loyalty/.test(call.module) || /fee|loyalty|reserve/.test(call.function)) {
|
|
153
|
+
return "fee_or_reward";
|
|
154
|
+
}
|
|
155
|
+
return "unknown";
|
|
156
|
+
}
|
|
157
|
+
function clmmActionForMoveCall(call) {
|
|
158
|
+
const combined = `${call.module}_${call.function}`;
|
|
159
|
+
if (isAdminOrVersioningCall(combined)) {
|
|
160
|
+
return "admin_or_versioning";
|
|
161
|
+
}
|
|
162
|
+
if (/swap|exchange/.test(combined)) {
|
|
163
|
+
return "swap";
|
|
164
|
+
}
|
|
165
|
+
if (/fee|reward|collect|claim/.test(combined)) {
|
|
166
|
+
return "fee_or_reward";
|
|
167
|
+
}
|
|
168
|
+
if (/liquidity|position|mint|burn|open|close|increase|decrease/.test(combined)) {
|
|
169
|
+
return "liquidity";
|
|
170
|
+
}
|
|
171
|
+
return "unknown";
|
|
172
|
+
}
|
|
173
|
+
function lendingActionForMoveCall(call) {
|
|
174
|
+
const combined = `${call.module}_${call.function}`;
|
|
175
|
+
if (isAdminOrVersioningCall(combined) || /config|owner|risk|isolated|oracle/.test(combined)) {
|
|
176
|
+
return "admin_or_versioning";
|
|
177
|
+
}
|
|
178
|
+
if (/deposit|withdraw|borrow|repay|liquidat|redeem|mint|supply/.test(combined)) {
|
|
179
|
+
return "lending";
|
|
180
|
+
}
|
|
181
|
+
if (/reward|fee|claim/.test(combined)) {
|
|
182
|
+
return "fee_or_reward";
|
|
183
|
+
}
|
|
184
|
+
return "unknown";
|
|
185
|
+
}
|
|
186
|
+
export function protocolPackageRuleAllows(rule, kind) {
|
|
187
|
+
return rule.matchKinds === undefined || rule.matchKinds.includes(kind);
|
|
188
|
+
}
|
|
189
|
+
function isAdminOrVersioningCall(value) {
|
|
190
|
+
const tokens = value.split("_").filter((token) => token.length > 0);
|
|
191
|
+
return tokens.some((token) => [
|
|
192
|
+
"admin",
|
|
193
|
+
"config",
|
|
194
|
+
"owner",
|
|
195
|
+
"risk",
|
|
196
|
+
"oracle",
|
|
197
|
+
"version",
|
|
198
|
+
"registry",
|
|
199
|
+
"govern",
|
|
200
|
+
"pause",
|
|
201
|
+
"upgrade",
|
|
202
|
+
"set",
|
|
203
|
+
"update",
|
|
204
|
+
"allowed"
|
|
205
|
+
].includes(token));
|
|
206
|
+
}
|
|
207
|
+
function normalizePackageMap(packages) {
|
|
208
|
+
return Object.fromEntries(Object.entries(packages).flatMap(([address, value]) => {
|
|
209
|
+
const normalized = parseSuiAddress(address);
|
|
210
|
+
return normalized === undefined ? [] : [[normalized, value]];
|
|
211
|
+
}));
|
|
212
|
+
}
|
|
213
|
+
function normalizeObjectMap(objects) {
|
|
214
|
+
return Object.fromEntries(Object.entries(objects).flatMap(([address, label]) => {
|
|
215
|
+
const normalized = parseSuiAddress(address);
|
|
216
|
+
return normalized === undefined ? [] : [[normalized, label]];
|
|
217
|
+
}));
|
|
218
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { EXTERNAL_ACTIVITY_SCAN_DEFAULT_LIMIT, EXTERNAL_ACTIVITY_SCAN_MAX_LIMIT } from "./activityStore.js";
|
|
2
|
+
import { externalActivityTransactionTouchesAccount } from "./transactionActivityDetails.js";
|
|
3
|
+
import { TransactionActivityError } from "./transactionActivityTypes.js";
|
|
4
|
+
export function normalizeActivityLimit(limit) {
|
|
5
|
+
if (limit === undefined) {
|
|
6
|
+
return EXTERNAL_ACTIVITY_SCAN_DEFAULT_LIMIT;
|
|
7
|
+
}
|
|
8
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > EXTERNAL_ACTIVITY_SCAN_MAX_LIMIT) {
|
|
9
|
+
throw new TransactionActivityError("input_invalid", "limit must be an integer from 1 to 100", {
|
|
10
|
+
limit,
|
|
11
|
+
min: 1,
|
|
12
|
+
max: EXTERNAL_ACTIVITY_SCAN_MAX_LIMIT
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return limit;
|
|
16
|
+
}
|
|
17
|
+
export function normalizeCheckpointBound(value, field) {
|
|
18
|
+
if (value === undefined) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
if (!/^\d+$/.test(value)) {
|
|
22
|
+
throw new TransactionActivityError("input_invalid", "checkpoint bounds must be unsigned integer strings", { field });
|
|
23
|
+
}
|
|
24
|
+
if (BigInt(value) > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
25
|
+
throw new TransactionActivityError("input_invalid", "checkpoint bounds exceed the current GraphQL numeric filter range", {
|
|
26
|
+
field,
|
|
27
|
+
max: String(Number.MAX_SAFE_INTEGER)
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
export function assertCheckpointRange(fromCheckpoint, toCheckpoint) {
|
|
33
|
+
if (fromCheckpoint !== undefined && toCheckpoint !== undefined && BigInt(fromCheckpoint) > BigInt(toCheckpoint)) {
|
|
34
|
+
throw new TransactionActivityError("input_invalid", "fromCheckpoint must be less than or equal to toCheckpoint", {
|
|
35
|
+
fromCheckpoint,
|
|
36
|
+
toCheckpoint
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export function normalizeTimestampBound(value, field) {
|
|
41
|
+
if (value === undefined) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
const parsed = new Date(value);
|
|
45
|
+
if (Number.isNaN(parsed.getTime()) || parsed.toISOString() !== value) {
|
|
46
|
+
throw new TransactionActivityError("input_invalid", "timestamp bounds must be ISO 8601 UTC timestamps", { field });
|
|
47
|
+
}
|
|
48
|
+
return value;
|
|
49
|
+
}
|
|
50
|
+
export function assertTimestampRange(fromTimestamp, toTimestamp) {
|
|
51
|
+
if (fromTimestamp !== undefined && toTimestamp !== undefined && fromTimestamp > toTimestamp) {
|
|
52
|
+
throw new TransactionActivityError("input_invalid", "fromTimestamp must be less than or equal to toTimestamp", {
|
|
53
|
+
fromTimestamp,
|
|
54
|
+
toTimestamp
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export function isMonotonicActivityOrder(transactions) {
|
|
59
|
+
let direction;
|
|
60
|
+
for (let index = 1; index < transactions.length; index += 1) {
|
|
61
|
+
const previous = transactions[index - 1];
|
|
62
|
+
const current = transactions[index];
|
|
63
|
+
const comparison = compareActivityFactTimeAscending(previous, current);
|
|
64
|
+
if (comparison === 0) {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const pairDirection = comparison < 0 ? "ascending" : "descending";
|
|
68
|
+
if (direction === undefined) {
|
|
69
|
+
direction = pairDirection;
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (direction !== pairDirection) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
export function compareActivityFactsDescending(a, b) {
|
|
79
|
+
return -compareActivityFactsAscending(a, b);
|
|
80
|
+
}
|
|
81
|
+
export function windowCompletion(input, page, orderingVerified) {
|
|
82
|
+
const hasLowerBound = input.fromCheckpoint !== undefined || input.fromTimestamp !== undefined;
|
|
83
|
+
const hasAnyWindowBound = hasLowerBound || input.toCheckpoint !== undefined || input.toTimestamp !== undefined;
|
|
84
|
+
if (!hasAnyWindowBound) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
if (!page.hasMore) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
if (!orderingVerified) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
const reachedCheckpoint = input.fromCheckpoint === undefined
|
|
94
|
+
? false
|
|
95
|
+
: page.transactions.some((transaction) => transaction.checkpoint !== undefined && BigInt(transaction.checkpoint) <= BigInt(input.fromCheckpoint));
|
|
96
|
+
const reachedTimestamp = input.fromTimestamp === undefined
|
|
97
|
+
? false
|
|
98
|
+
: page.transactions.some((transaction) => transaction.timestamp !== undefined && transaction.timestamp <= input.fromTimestamp);
|
|
99
|
+
return reachedCheckpoint || reachedTimestamp;
|
|
100
|
+
}
|
|
101
|
+
export function incompleteReasonForScan(input) {
|
|
102
|
+
if (!input.orderingVerified) {
|
|
103
|
+
return "ordering_unverified";
|
|
104
|
+
}
|
|
105
|
+
return input.windowComplete === false ? "limit_reached" : undefined;
|
|
106
|
+
}
|
|
107
|
+
export function filterTransactionsForRequestedWindow(transactions, input) {
|
|
108
|
+
return transactions.filter((transaction) => {
|
|
109
|
+
if (input.relationship === "sent" && transaction.sender !== input.account) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
if (input.fromCheckpoint !== undefined && (transaction.checkpoint === undefined || BigInt(transaction.checkpoint) < BigInt(input.fromCheckpoint))) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
if (input.toCheckpoint !== undefined && (transaction.checkpoint === undefined || BigInt(transaction.checkpoint) > BigInt(input.toCheckpoint))) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
if (input.fromTimestamp !== undefined && (transaction.timestamp === undefined || transaction.timestamp < input.fromTimestamp)) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
if (input.toTimestamp !== undefined && (transaction.timestamp === undefined || transaction.timestamp > input.toTimestamp)) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
return true;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
export function transactionMatchesKnownStorageAccount(transaction, account, relationship) {
|
|
128
|
+
if (relationship === "sent") {
|
|
129
|
+
return transaction.sender === account;
|
|
130
|
+
}
|
|
131
|
+
return transaction.sender === account || externalActivityTransactionTouchesAccount(transaction, account);
|
|
132
|
+
}
|
|
133
|
+
function compareActivityFactsAscending(a, b) {
|
|
134
|
+
const timeComparison = compareActivityFactTimeAscending(a, b);
|
|
135
|
+
return timeComparison === 0 ? compareStringsAscending(a.digest, b.digest) : timeComparison;
|
|
136
|
+
}
|
|
137
|
+
function compareActivityFactTimeAscending(a, b) {
|
|
138
|
+
if (a.checkpoint !== undefined && b.checkpoint !== undefined) {
|
|
139
|
+
const checkpointDelta = BigInt(a.checkpoint) - BigInt(b.checkpoint);
|
|
140
|
+
if (checkpointDelta < 0n)
|
|
141
|
+
return -1;
|
|
142
|
+
if (checkpointDelta > 0n)
|
|
143
|
+
return 1;
|
|
144
|
+
}
|
|
145
|
+
else if (a.checkpoint !== undefined) {
|
|
146
|
+
return 1;
|
|
147
|
+
}
|
|
148
|
+
else if (b.checkpoint !== undefined) {
|
|
149
|
+
return -1;
|
|
150
|
+
}
|
|
151
|
+
if (a.timestamp !== undefined && b.timestamp !== undefined) {
|
|
152
|
+
const timestampDelta = compareStringsAscending(a.timestamp, b.timestamp);
|
|
153
|
+
if (timestampDelta !== 0)
|
|
154
|
+
return timestampDelta;
|
|
155
|
+
}
|
|
156
|
+
else if (a.timestamp !== undefined) {
|
|
157
|
+
return 1;
|
|
158
|
+
}
|
|
159
|
+
else if (b.timestamp !== undefined) {
|
|
160
|
+
return -1;
|
|
161
|
+
}
|
|
162
|
+
return 0;
|
|
163
|
+
}
|
|
164
|
+
function compareStringsAscending(a, b) {
|
|
165
|
+
if (a < b)
|
|
166
|
+
return -1;
|
|
167
|
+
if (a > b)
|
|
168
|
+
return 1;
|
|
169
|
+
return 0;
|
|
170
|
+
}
|