@wowok/agent-mcp 2.7.0 → 2.7.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/dist/config/index.js +1 -1
- package/dist/config/runtime.js +1 -238
- package/dist/customer/customer-advice.js +1 -130
- package/dist/customer/index.js +1 -11
- package/dist/customer/industry-risks.js +1 -438
- package/dist/customer/info-puzzle.js +1 -681
- package/dist/customer/order-monitor.js +1 -328
- package/dist/customer/order-strategy.js +1 -373
- package/dist/customer/post-purchase.js +1 -351
- package/dist/customer/preorder-compare.js +1 -34
- package/dist/customer/reminder-system.js +1 -316
- package/dist/customer/risk-assessment.d.ts +5 -1
- package/dist/customer/risk-assessment.js +1 -397
- package/dist/customer/types.js +1 -13
- package/dist/customer/user-preferences.js +1 -460
- package/dist/evaluation/arbitration-game.d.ts +23 -0
- package/dist/evaluation/arbitration-game.js +1 -0
- package/dist/evaluation/builtins/demand-match.d.ts +15 -0
- package/dist/evaluation/builtins/demand-match.js +1 -0
- package/dist/evaluation/builtins/index.d.ts +3 -0
- package/dist/evaluation/builtins/index.js +1 -0
- package/dist/evaluation/builtins/service-risk.d.ts +6 -0
- package/dist/evaluation/builtins/service-risk.js +1 -0
- package/dist/evaluation/capability.d.ts +50 -0
- package/dist/evaluation/capability.js +1 -0
- package/dist/evaluation/composer.d.ts +13 -0
- package/dist/evaluation/composer.js +1 -0
- package/dist/evaluation/engine.d.ts +18 -0
- package/dist/evaluation/engine.js +1 -0
- package/dist/evaluation/extract.d.ts +30 -0
- package/dist/evaluation/extract.js +1 -0
- package/dist/evaluation/game-strategy.d.ts +27 -0
- package/dist/evaluation/game-strategy.js +1 -0
- package/dist/evaluation/gap.d.ts +2 -0
- package/dist/evaluation/gap.js +1 -0
- package/dist/evaluation/index.d.ts +12 -0
- package/dist/evaluation/index.js +1 -0
- package/dist/evaluation/node-game.d.ts +62 -0
- package/dist/evaluation/node-game.js +1 -0
- package/dist/evaluation/region.d.ts +10 -0
- package/dist/evaluation/region.js +1 -0
- package/dist/evaluation/types.d.ts +77 -0
- package/dist/evaluation/types.js +1 -0
- package/dist/evaluation/user-injection.d.ts +6 -0
- package/dist/evaluation/user-injection.js +1 -0
- package/dist/examples/education-contact-create.json +40 -0
- package/dist/examples/freelance-contact-create.json +40 -0
- package/dist/examples/insurance-machine-create.json +1 -1
- package/dist/examples/insurance-service-allocators.json +1 -1
- package/dist/examples/machine-publish.json +1 -1
- package/dist/examples/rental-ziroom-service-create.json +1 -1
- package/dist/examples/retail-adv-guard-messenger-proof-create.json +1 -1
- package/dist/examples/retail-myshop-service-create.json +1 -1
- package/dist/examples/retail-myshop-service-customer-required.json +1 -1
- package/dist/examples/subscription-contact-create.json +40 -0
- package/dist/examples/threebody-machine-create.json +1 -1
- package/dist/examples/travel-machine-create.json +1 -1
- package/dist/examples/travel-service-create.json +1 -1
- package/dist/experience/experience-reuse.js +1 -103
- package/dist/experience/index.js +1 -5
- package/dist/experience/intent-distill.js +1 -83
- package/dist/experience/realtime-feedback.js +1 -94
- package/dist/experience/types.js +1 -1
- package/dist/experience/user-profile.js +1 -171
- package/dist/extensions/business-modules.js +1 -287
- package/dist/extensions/capability-manifest.js +1 -781
- package/dist/extensions/constraint-registry.js +1 -198
- package/dist/extensions/index.js +1 -6
- package/dist/extensions/metric-registry.js +1 -257
- package/dist/extensions/mode-evaluator.js +1 -170
- package/dist/extensions/modes.js +1 -499
- package/dist/extensions/registry.js +1 -717
- package/dist/extensions/types.js +1 -1
- package/dist/harness/auto-escalation.js +1 -68
- package/dist/harness/checkpoint.js +1 -129
- package/dist/harness/index.js +1 -78
- package/dist/harness/plan.js +1 -276
- package/dist/harness/recover.js +1 -139
- package/dist/harness/types.js +1 -1
- package/dist/harness/verify.js +1 -237
- package/dist/index.js +1 -273
- package/dist/intent/enrich.d.ts +1 -0
- package/dist/intent/enrich.js +1 -0
- package/dist/intent/index.d.ts +23 -0
- package/dist/intent/index.js +1 -0
- package/dist/intent/matcher.d.ts +2 -0
- package/dist/intent/matcher.js +1 -0
- package/dist/intent/store.d.ts +19 -0
- package/dist/intent/store.js +1 -0
- package/dist/intent/types.d.ts +33 -0
- package/dist/intent/types.js +1 -0
- package/dist/knowledge/acquisition-flywheel.js +1 -192
- package/dist/knowledge/allocation-confirm.js +1 -534
- package/dist/knowledge/allocation-context.js +1 -249
- package/dist/knowledge/allocation-ledger.js +1 -463
- package/dist/knowledge/allocation-puzzle.js +1 -298
- package/dist/knowledge/allocation-risk.js +1 -568
- package/dist/knowledge/allocation-templates.js +1 -970
- package/dist/knowledge/allocation-translation.js +1 -585
- package/dist/knowledge/arb-risk.js +1 -210
- package/dist/knowledge/arbitration-confirm.js +1 -559
- package/dist/knowledge/arbitration-context.js +1 -505
- package/dist/knowledge/arbitration-ledger.js +1 -521
- package/dist/knowledge/arbitration-puzzle.js +1 -304
- package/dist/knowledge/arbitration-risk.js +1 -433
- package/dist/knowledge/arbitration-templates.js +1 -276
- package/dist/knowledge/arbitration-translation.js +1 -487
- package/dist/knowledge/arbitration-trust.js +1 -117
- package/dist/knowledge/audit-rules.js +1 -141
- package/dist/knowledge/bridge-risk.js +1 -263
- package/dist/knowledge/contact-risk.js +1 -200
- package/dist/knowledge/contact-templates.d.ts +27 -0
- package/dist/knowledge/contact-templates.js +1 -0
- package/dist/knowledge/demand-confirm.js +1 -206
- package/dist/knowledge/demand-matching.js +1 -132
- package/dist/knowledge/demand-risk.js +1 -240
- package/dist/knowledge/demand-translation.js +1 -354
- package/dist/knowledge/deployment-scanner.js +1 -823
- package/dist/knowledge/dynamic-pricing.js +1 -87
- package/dist/knowledge/examples-scanner-cli.js +1 -26
- package/dist/knowledge/examples-scanner.js +1 -825
- package/dist/knowledge/flywheel-loop.js +1 -404
- package/dist/knowledge/fund-layer.js +1 -973
- package/dist/knowledge/glossary.js +1 -211
- package/dist/knowledge/guard-confirm.js +1 -406
- package/dist/knowledge/guard-context.js +1 -287
- package/dist/knowledge/guard-design-patterns.js +1 -360
- package/dist/knowledge/guard-ledger.js +1 -260
- package/dist/knowledge/guard-lint.js +1 -670
- package/dist/knowledge/guard-migration.js +1 -228
- package/dist/knowledge/guard-puzzle.js +1 -805
- package/dist/knowledge/guard-render.js +1 -700
- package/dist/knowledge/guard-risk.js +1 -1879
- package/dist/knowledge/guard-submission-prompt.js +1 -171
- package/dist/knowledge/guard-templates.js +1 -1105
- package/dist/knowledge/guard-translation.js +1 -1119
- package/dist/knowledge/index.js +1 -436
- package/dist/knowledge/industry-evolution.js +1 -323
- package/dist/knowledge/industry-generalizer.js +1 -381
- package/dist/knowledge/industry-registry.js +1 -174
- package/dist/knowledge/intent-metrics.d.ts +4 -3
- package/dist/knowledge/intent-metrics.js +1 -566
- package/dist/knowledge/machine-confirm.js +1 -559
- package/dist/knowledge/machine-context.js +1 -833
- package/dist/knowledge/machine-ledger.js +1 -338
- package/dist/knowledge/machine-puzzle.js +1 -494
- package/dist/knowledge/machine-render.js +1 -565
- package/dist/knowledge/machine-risk.js +1 -670
- package/dist/knowledge/machine-templates.js +1 -1597
- package/dist/knowledge/machine-topology.js +1 -234
- package/dist/knowledge/machine-translation.js +1 -513
- package/dist/knowledge/mcp-schema-audit-cli.js +1 -45
- package/dist/knowledge/mcp-schema-audit.d.ts +1 -1
- package/dist/knowledge/mcp-schema-audit.js +1 -773
- package/dist/knowledge/onchain-constants.js +1 -35
- package/dist/knowledge/order-confirm.js +1 -573
- package/dist/knowledge/order-context.js +1 -390
- package/dist/knowledge/order-ledger.js +1 -341
- package/dist/knowledge/order-puzzle.js +1 -255
- package/dist/knowledge/order-risk.js +1 -653
- package/dist/knowledge/order-templates.js +1 -368
- package/dist/knowledge/order-translation.js +1 -550
- package/dist/knowledge/overrides-loader.js +1 -65
- package/dist/knowledge/passport-confirm.js +1 -531
- package/dist/knowledge/passport-context.js +1 -306
- package/dist/knowledge/passport-ledger.js +1 -282
- package/dist/knowledge/passport-puzzle.js +1 -333
- package/dist/knowledge/passport-risk.js +1 -450
- package/dist/knowledge/passport-templates.js +1 -568
- package/dist/knowledge/passport-translation.js +1 -516
- package/dist/knowledge/payment-risk.js +1 -249
- package/dist/knowledge/permission-confirm.js +1 -426
- package/dist/knowledge/permission-context.js +1 -224
- package/dist/knowledge/permission-ledger.js +1 -403
- package/dist/knowledge/permission-puzzle.js +1 -173
- package/dist/knowledge/permission-risk.js +1 -411
- package/dist/knowledge/permission-templates.js +1 -234
- package/dist/knowledge/permission-translation.js +1 -350
- package/dist/knowledge/personal-risk.js +1 -212
- package/dist/knowledge/process-model.js +1 -160
- package/dist/knowledge/progress-confirm.js +1 -456
- package/dist/knowledge/progress-context.js +1 -452
- package/dist/knowledge/progress-ledger.js +1 -330
- package/dist/knowledge/progress-puzzle.js +1 -219
- package/dist/knowledge/progress-risk.js +1 -461
- package/dist/knowledge/progress-templates.js +1 -228
- package/dist/knowledge/progress-translation.js +1 -405
- package/dist/knowledge/proof-confirm.js +1 -187
- package/dist/knowledge/proof-risk.js +1 -207
- package/dist/knowledge/proof-translation.js +1 -283
- package/dist/knowledge/registrar-risk.js +1 -217
- package/dist/knowledge/repository-confirm.js +1 -286
- package/dist/knowledge/repository-risk.js +1 -373
- package/dist/knowledge/repository-translation.js +1 -445
- package/dist/knowledge/reputation-rules.js +1 -99
- package/dist/knowledge/resource-risk.js +1 -157
- package/dist/knowledge/reward-confirm.js +1 -526
- package/dist/knowledge/reward-context.js +1 -504
- package/dist/knowledge/reward-ledger.js +1 -502
- package/dist/knowledge/reward-puzzle.js +1 -300
- package/dist/knowledge/reward-risk.js +1 -627
- package/dist/knowledge/reward-templates.js +1 -197
- package/dist/knowledge/reward-translation.js +1 -501
- package/dist/knowledge/safety-rules.js +1 -404
- package/dist/knowledge/scenario-modes.js +1 -321
- package/dist/knowledge/service-confirm.js +1 -807
- package/dist/knowledge/service-context.js +1 -403
- package/dist/knowledge/service-ledger.js +1 -609
- package/dist/knowledge/service-puzzle.js +1 -236
- package/dist/knowledge/service-risk.js +1 -615
- package/dist/knowledge/service-templates.js +1 -456
- package/dist/knowledge/service-translation.js +1 -622
- package/dist/knowledge/template-registry.d.ts +1 -1
- package/dist/knowledge/template-registry.js +1 -341
- package/dist/knowledge/tool-constraints.js +1 -195
- package/dist/knowledge/tools-reference.js +1 -155
- package/dist/knowledge/treasury-confirm.js +1 -512
- package/dist/knowledge/treasury-context.js +1 -363
- package/dist/knowledge/treasury-ledger.js +1 -300
- package/dist/knowledge/treasury-puzzle.js +1 -216
- package/dist/knowledge/treasury-risk.js +1 -440
- package/dist/knowledge/treasury-templates.js +1 -358
- package/dist/knowledge/treasury-translation.js +1 -498
- package/dist/knowledge/trust-metrics.js +1 -198
- package/dist/knowledge/util-risk.js +1 -135
- package/dist/loop-engineering/aggregate.js +1 -132
- package/dist/loop-engineering/context-collect.js +1 -83
- package/dist/loop-engineering/diagnose.js +1 -273
- package/dist/loop-engineering/improve.js +1 -405
- package/dist/loop-engineering/index.js +1 -4
- package/dist/loop-engineering/pipeline.js +1 -56
- package/dist/mode-market/index.js +1 -3
- package/dist/mode-market/registry.js +1 -124
- package/dist/mode-market/review.js +1 -214
- package/dist/mode-market/submission.js +1 -85
- package/dist/participation/collaborator-interest.d.ts +23 -0
- package/dist/participation/collaborator-interest.js +1 -0
- package/dist/participation/customer-interest.d.ts +25 -0
- package/dist/participation/customer-interest.js +1 -0
- package/dist/participation/merchant-interest.js +1 -100
- package/dist/participation/radar-core.d.ts +13 -3
- package/dist/participation/radar-core.js +1 -269
- package/dist/participation/supplier-interest.d.ts +25 -0
- package/dist/participation/supplier-interest.js +1 -0
- package/dist/persona/analyzer.d.ts +16 -0
- package/dist/persona/analyzer.js +1 -0
- package/dist/persona/bridge.d.ts +5 -0
- package/dist/persona/bridge.js +1 -0
- package/dist/persona/defaults.d.ts +4 -0
- package/dist/persona/defaults.js +1 -0
- package/dist/persona/experience-bridge.d.ts +3 -0
- package/dist/persona/experience-bridge.js +1 -0
- package/dist/persona/index.d.ts +18 -0
- package/dist/persona/index.js +1 -0
- package/dist/persona/model.d.ts +7 -0
- package/dist/persona/model.js +1 -0
- package/dist/persona/store.d.ts +19 -0
- package/dist/persona/store.js +1 -0
- package/dist/persona/types.d.ts +45 -0
- package/dist/persona/types.js +1 -0
- package/dist/project/business-puzzle.js +1 -383
- package/dist/project/context-assembly.js +1 -254
- package/dist/project/deployment-bridge.js +1 -120
- package/dist/project/deployment-doc.js +1 -1126
- package/dist/project/edit-planner.js +1 -1342
- package/dist/project/evaluation.js +1 -2011
- package/dist/project/game-theory.js +1 -177
- package/dist/project/graph-builder.js +1 -656
- package/dist/project/graph.js +1 -340
- package/dist/project/handlers.d.ts +5 -0
- package/dist/project/handlers.js +1 -1762
- package/dist/project/index.d.ts +1 -0
- package/dist/project/index.js +1 -301
- package/dist/project/intent-analyzer.js +1 -149
- package/dist/project/machine-nodes.js +1 -36
- package/dist/project/merchant-guide.js +1 -264
- package/dist/project/migration.js +1 -125
- package/dist/project/mode-actions.js +1 -309
- package/dist/project/namespace.js +1 -206
- package/dist/project/participation-radar.js +1 -428
- package/dist/project/pipeline-actions.js +1 -109
- package/dist/project/project-store.js +1 -422
- package/dist/project/query.js +1 -153
- package/dist/project/reverse-mapping.d.ts +34 -0
- package/dist/project/reverse-mapping.js +1 -0
- package/dist/project/risk-aggregator.js +1 -295
- package/dist/project/rollback-policy.js +1 -290
- package/dist/project/semantic-assembler.js +1 -345
- package/dist/project/semantic-graph.js +1 -245
- package/dist/project/stage-gate.js +1 -369
- package/dist/project/substep-trace.js +1 -332
- package/dist/project/task-tracker.js +1 -78
- package/dist/role/derivation.d.ts +18 -0
- package/dist/role/derivation.js +1 -0
- package/dist/role/index.d.ts +5 -0
- package/dist/role/index.js +1 -0
- package/dist/role/model.d.ts +8 -0
- package/dist/role/model.js +1 -0
- package/dist/role/resolution.d.ts +11 -0
- package/dist/role/resolution.js +1 -0
- package/dist/role/types.d.ts +11 -0
- package/dist/role/types.js +1 -0
- package/dist/rules.d.ts +2 -0
- package/dist/rules.js +1 -9
- package/dist/safety/confirm-gate.js +1 -88
- package/dist/safety/index.js +1 -3
- package/dist/safety/preview.js +1 -52
- package/dist/schema/call/allocation.js +1 -34
- package/dist/schema/call/arbitration.js +1 -113
- package/dist/schema/call/base.d.ts +15 -15
- package/dist/schema/call/base.js +1 -370
- package/dist/schema/call/bridge-handler.js +1 -265
- package/dist/schema/call/bridge.d.ts +7 -7
- package/dist/schema/call/bridge.js +1 -458
- package/dist/schema/call/contact.js +1 -37
- package/dist/schema/call/demand.js +1 -47
- package/dist/schema/call/guard.js +1 -161
- package/dist/schema/call/handler.js +1 -322
- package/dist/schema/call/index.js +1 -20
- package/dist/schema/call/machine.js +1 -193
- package/dist/schema/call/order.js +1 -35
- package/dist/schema/call/payment.js +1 -37
- package/dist/schema/call/permission-handler.js +1 -54
- package/dist/schema/call/permission.js +1 -105
- package/dist/schema/call/personal.js +1 -78
- package/dist/schema/call/progress.js +1 -47
- package/dist/schema/call/proof.js +1 -33
- package/dist/schema/call/repository.js +1 -77
- package/dist/schema/call/reward.js +1 -30
- package/dist/schema/call/semantic.js +1 -1657
- package/dist/schema/call/service.js +1 -178
- package/dist/schema/call/treasury.js +1 -71
- package/dist/schema/common/index.js +1 -407
- package/dist/schema/config/index.js +1 -68
- package/dist/schema/evaluation/index.d.ts +4436 -0
- package/dist/schema/evaluation/index.js +1 -0
- package/dist/schema/index.d.ts +4 -0
- package/dist/schema/index.js +1 -13
- package/dist/schema/intent-radar/index.d.ts +284 -0
- package/dist/schema/intent-radar/index.js +1 -0
- package/dist/schema/local/index.d.ts +21 -21
- package/dist/schema/local/index.js +1 -927
- package/dist/schema/local/wip.js +1 -187
- package/dist/schema/messenger/index.d.ts +7 -7
- package/dist/schema/messenger/index.js +1 -475
- package/dist/schema/operations.d.ts +7 -7
- package/dist/schema/operations.js +1 -520
- package/dist/schema/persona/index.d.ts +1985 -0
- package/dist/schema/persona/index.js +1 -0
- package/dist/schema/project/index.d.ts +96 -50
- package/dist/schema/project/index.js +1 -2057
- package/dist/schema/query/index.d.ts +423 -7
- package/dist/schema/query/index.js +1 -1640
- package/dist/schema/schema-query/index.js +1 -104
- package/dist/schema/schema-version.js +1 -76
- package/dist/schema/sync-layer4.d.ts +1 -1
- package/dist/schema/sync-layer4.js +1 -282
- package/dist/schema/task-status.d.ts +168 -0
- package/dist/schema/task-status.js +1 -0
- package/dist/schema/trust/index.js +1 -314
- package/dist/schema/utils/guard-parser.js +1 -419
- package/dist/schema/utils/guard-query-utils.js +1 -46
- package/dist/schema/utils/node-parser.js +1 -369
- package/dist/schema/utils/object-type-utils.js +1 -35
- package/dist/schema/utils/permission-index-utils.js +1 -7
- package/dist/schema/utils/permission-machine-check.js +1 -121
- package/dist/schema/utils/skills-recommendation.js +1 -77
- package/dist/schema-query/index.js +1 -810
- package/dist/schemas/account_operation.output.json +5 -2
- package/dist/schemas/bridge_operation.output.json +5 -2
- package/dist/schemas/evaluation_operation.output.json +782 -0
- package/dist/schemas/evaluation_operation.schema.json +990 -0
- package/dist/schemas/index.json +25 -1
- package/dist/schemas/intent_radar.output.json +232 -0
- package/dist/schemas/intent_radar.schema.json +138 -0
- package/dist/schemas/local_info_operation.output.json +5 -2
- package/dist/schemas/local_mark_operation.output.json +5 -2
- package/dist/schemas/messenger_operation.output.json +5 -2
- package/dist/schemas/onchain_events.output.json +5 -2
- package/dist/schemas/onchain_operations.output.json +5 -2
- package/dist/schemas/onchain_operations.schema.json +6 -6
- package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
- package/dist/schemas/onchain_operations_machine.schema.json +2 -2
- package/dist/schemas/onchain_operations_service.schema.json +3 -3
- package/dist/schemas/onchain_table_data.output.json +6 -3
- package/dist/schemas/persona_operation.output.json +392 -0
- package/dist/schemas/persona_operation.schema.json +250 -0
- package/dist/schemas/project_operation.output.json +28 -8
- package/dist/schemas/query_task_status.output.json +115 -0
- package/dist/schemas/query_task_status.schema.json +24 -0
- package/dist/schemas/query_toolkit.output.json +9 -6
- package/dist/schemas/trust_score.schema.json +1 -1
- package/dist/schemas/wowok_buildin_info.output.json +132 -0
- package/dist/schemas/wowok_buildin_info.schema.json +14 -0
- package/dist/telemetry/index.js +1 -112
- package/dist/telemetry/redact.js +1 -23
- package/dist/telemetry/storage.js +1 -80
- package/dist/tools/handlers/bridge.js +1 -1
- package/dist/tools/handlers/config.js +1 -74
- package/dist/tools/handlers/evaluation.d.ts +2 -0
- package/dist/tools/handlers/evaluation.js +1 -0
- package/dist/tools/handlers/file-export.js +1 -90
- package/dist/tools/handlers/intent-radar.d.ts +2 -0
- package/dist/tools/handlers/intent-radar.js +1 -0
- package/dist/tools/handlers/local.js +1 -53
- package/dist/tools/handlers/messenger.js +1 -188
- package/dist/tools/handlers/onchain.js +1 -1082
- package/dist/tools/handlers/persona.d.ts +4 -0
- package/dist/tools/handlers/persona.js +1 -0
- package/dist/tools/handlers/project.js +1 -211
- package/dist/tools/handlers/query.js +1 -434
- package/dist/tools/handlers/schema-query.js +1 -176
- package/dist/tools/handlers/task-status.d.ts +0 -168
- package/dist/tools/handlers/task-status.js +1 -55
- package/dist/tools/handlers/trust.js +1 -380
- package/dist/tools/handlers/wip.js +1 -90
- package/dist/tools/index.js +1 -1306
- package/dist/tools/retry.js +1 -85
- package/dist/tools/rules-hook.js +1 -23
- package/dist/tools/shared.js +1 -130
- package/dist/tools/types.js +1 -1
- package/dist/tools/upgrade-check.d.ts +19 -0
- package/dist/tools/upgrade-check.js +1 -0
- package/dist/tools/wip-deploy-assist.d.ts +1 -1
- package/dist/tools/wip-deploy-assist.js +1 -278
- package/dist/tools/wrap.js +1 -500
- package/package.json +5 -3
|
@@ -1,501 +1 @@
|
|
|
1
|
-
import { isRewardBuiltinPermission, getBuiltinPermissionByIndex, resolveGuardConstructor, } from "./reward-ledger.js";
|
|
2
|
-
export const REWARD_SEMANTIC_TO_SCHEMA_RULES = [
|
|
3
|
-
{
|
|
4
|
-
id: "P-RW-01",
|
|
5
|
-
pattern_name: "Create new Reward",
|
|
6
|
-
semantic_intent: "Initialize a new Reward<T> object with description, Permission, and coin type T",
|
|
7
|
-
match_keywords: ["create reward", "new reward"],
|
|
8
|
-
schema_fields: ["object (typed, with permission + type_parameter)", "description"],
|
|
9
|
-
example_json: {
|
|
10
|
-
object: {
|
|
11
|
-
permission: "0xPERMISSION_ADDRESS",
|
|
12
|
-
type_parameter: "0x2::wow::WOW",
|
|
13
|
-
},
|
|
14
|
-
description: "First-order cashback reward",
|
|
15
|
-
},
|
|
16
|
-
reverse_explanation: "object with type_parameter triggers reward::new (150). SDK creates Permission if not provided, " +
|
|
17
|
-
"then constructs Reward<T> via new_imp. After create, share_object is called automatically.",
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
id: "P-RW-02",
|
|
21
|
-
pattern_name: "Add RewardGuard (eligible recipient + amount rule)",
|
|
22
|
-
semantic_intent: "Register a Guard that defines who can claim and how much they receive",
|
|
23
|
-
match_keywords: ["guard_add", "add guard", "eligibility"],
|
|
24
|
-
schema_fields: ["object", "guard_add[]"],
|
|
25
|
-
example_json: {
|
|
26
|
-
object: "0xREWARD_ADDRESS",
|
|
27
|
-
guard_add: [
|
|
28
|
-
{
|
|
29
|
-
guard: "0xGUARD_ADDRESS",
|
|
30
|
-
recipient: { Signer: "signer" },
|
|
31
|
-
amount: { type: "Fixed", value: 1000000000 },
|
|
32
|
-
expiration_time: 1735689600000,
|
|
33
|
-
store_from_id: null,
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
},
|
|
37
|
-
reverse_explanation: "guard_add with one entry triggers reward::guard_add (152). SDK reward_guard() picks one of 6 Move constructors " +
|
|
38
|
-
"based on recipient variant (GuardIdentifier/Entity/Signer) × amount.type (GuardU64Identifier/Fixed). " +
|
|
39
|
-
"Move: if guard already in self.guards, UPDATE in place; else push_back (E_GUARD_COUNT_EXCEEDED if > 200).",
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
id: "P-RW-03",
|
|
43
|
-
pattern_name: "Claim reward (passport-driven)",
|
|
44
|
-
semantic_intent: "Claim rewards as an eligible recipient, verified via Guard + Passport",
|
|
45
|
-
match_keywords: ["claim", "receive reward"],
|
|
46
|
-
schema_fields: ["object", "claim (guard address)"],
|
|
47
|
-
example_json: {
|
|
48
|
-
object: "0xREWARD_ADDRESS",
|
|
49
|
-
claim: "0xGUARD_ADDRESS",
|
|
50
|
-
},
|
|
51
|
-
reverse_explanation: "claim field set to a guard address triggers reward::claim (NO permission check). " +
|
|
52
|
-
"Move: iterates self.guards looking for matching guard.id_address; passport::result_for_guard verifies submission; " +
|
|
53
|
-
"recipient/amount resolved from Passport submissions OR fixed values; " +
|
|
54
|
-
"balance::split transfers coin to recipient; record appended to RecipientRecord.amount vector.",
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
id: "P-RW-04",
|
|
58
|
-
pattern_name: "Deposit funds (coin_add)",
|
|
59
|
-
semantic_intent: "Deposit Coin<T> into the Reward balance to fund claims",
|
|
60
|
-
match_keywords: ["coin_add", "deposit", "deposit funds"],
|
|
61
|
-
schema_fields: ["object", "coin_add"],
|
|
62
|
-
example_json: {
|
|
63
|
-
object: "0xREWARD_ADDRESS",
|
|
64
|
-
coin_add: {
|
|
65
|
-
amount: "10000000000",
|
|
66
|
-
coin_type: "0x2::wow::WOW",
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
reverse_explanation: "coin_add triggers reward::coin_add (153). Move: coin::into_balance(coin) → balance::join(self.balance). " +
|
|
70
|
-
"Coin<T> type must match Reward<T> exactly (phantom T). No upper limit on balance.",
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
id: "P-RW-05",
|
|
74
|
-
pattern_name: "Receive CoinWrapper via Payment",
|
|
75
|
-
semantic_intent: "Receive a CoinWrapper<T> envelope via Payment.unwrap_with_check",
|
|
76
|
-
match_keywords: ["receive", "payment", "unwrap"],
|
|
77
|
-
schema_fields: ["object", "receive (payment + received)"],
|
|
78
|
-
example_json: {
|
|
79
|
-
object: "0xREWARD_ADDRESS",
|
|
80
|
-
receive: {
|
|
81
|
-
received: [{ id: "0xRECEIVED_OBJ", payment: "0xPAYMENT_OBJ" }],
|
|
82
|
-
token_type: "0x2::wow::WOW",
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
reverse_explanation: "receive with Receiving<CoinWrapper<T>> + Payment<T> triggers reward::receive (154). " +
|
|
86
|
-
"Move: payment::unwrap_with_check extracts Coin<T> from CoinWrapper<T>, then balance::join. " +
|
|
87
|
-
"token_type must match Reward<T>.",
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
id: "P-RW-06",
|
|
91
|
-
pattern_name: "Owner receive (terminal disbursement)",
|
|
92
|
-
semantic_intent: "Owner unwraps Receiving<K> / CoinWrapper<K> envelopes sent to the Reward",
|
|
93
|
-
match_keywords: ["owner_receive", "unwrap to owner"],
|
|
94
|
-
schema_fields: ["object", "owner_receive"],
|
|
95
|
-
example_json: {
|
|
96
|
-
object: "0xREWARD_ADDRESS",
|
|
97
|
-
owner_receive: {
|
|
98
|
-
received: [{ id: "0xRECEIVED_OBJ", payment: "0xPAYMENT_OBJ" }],
|
|
99
|
-
token_type: "0x2::wow::WOW",
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
reverse_explanation: "owner_receive triggers reward::owner_receive (156). Move: payment::unwrap_with_check extracts Coin<K>, " +
|
|
103
|
-
"then permission::owner_receive_inner forwards to Permission owner (NOT Reward creator). " +
|
|
104
|
-
"Does NOT drain self.balance — only unwraps Receiving<K> envelopes.",
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
id: "P-RW-07",
|
|
108
|
-
pattern_name: "Set UM (Contact binding)",
|
|
109
|
-
semantic_intent: "Bind or unbind a Contact (UM) object for off-chain coordination",
|
|
110
|
-
match_keywords: ["um_set", "um_none", "contact", "UM"],
|
|
111
|
-
schema_fields: ["object", "um (string | null)"],
|
|
112
|
-
example_json: {
|
|
113
|
-
object: "0xREWARD_ADDRESS",
|
|
114
|
-
um: "0xCONTACT_ADDRESS",
|
|
115
|
-
},
|
|
116
|
-
reverse_explanation: "um=<address> triggers reward::um_set (157) — creates Registrar affiliation. " +
|
|
117
|
-
"um=null triggers reward::um_none (157) — disaffiliates and clears self.um.",
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
id: "P-RW-08",
|
|
121
|
-
pattern_name: "Set permission (owner-only)",
|
|
122
|
-
semantic_intent: "Replace the Permission object (owner-only operation)",
|
|
123
|
-
match_keywords: ["permission_set", "change permission"],
|
|
124
|
-
schema_fields: ["(SDK does not expose this in CallReward_Data — direct Move call required)"],
|
|
125
|
-
example_json: {
|
|
126
|
-
_note: "Not exposed in CallReward_Data; direct Move call:",
|
|
127
|
-
target: "reward::permission_set<T>",
|
|
128
|
-
arguments: ["reward", "old_permission", "new_permission", "registrar", "clock"],
|
|
129
|
-
},
|
|
130
|
-
reverse_explanation: "Calls reward::permission_set. Move asserts old.owner == sender (tx_context::sender). " +
|
|
131
|
-
"Updates self.permission = new.id_address; creates Registrar affiliation_change.",
|
|
132
|
-
},
|
|
133
|
-
];
|
|
134
|
-
export const REWARD_SCHEMA_TO_SEMANTIC_RULES = [
|
|
135
|
-
{
|
|
136
|
-
element_type: "field",
|
|
137
|
-
type_name: "object",
|
|
138
|
-
semantic_explanation: "Reward object address. For create: typed object with permission + type_parameter. For operate: existing Reward address.",
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
element_type: "field",
|
|
142
|
-
type_name: "claim",
|
|
143
|
-
semantic_explanation: "Guard address to claim against. NO permission check — eligibility determined by Guard + Passport alone.",
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
element_type: "field",
|
|
147
|
-
type_name: "description",
|
|
148
|
-
semantic_explanation: "Reward description (must satisfy common::DESCRIPTION). Updated via description_set (151).",
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
element_type: "field",
|
|
152
|
-
type_name: "coin_add",
|
|
153
|
-
semantic_explanation: "Deposit Coin<T> into balance. coin_type must match Reward<T> (153 permission).",
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
element_type: "field",
|
|
157
|
-
type_name: "receive",
|
|
158
|
-
semantic_explanation: "Receive CoinWrapper<T> via Payment.unwrap_with_check. token_type must match Reward<T> (154 permission).",
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
element_type: "field",
|
|
162
|
-
type_name: "guard_add",
|
|
163
|
-
semantic_explanation: "Array of RewardGuard configs. Each entry has guard, recipient (GuardIdentifier/Entity/Signer), amount (Fixed/GuardU64Identifier), expiration_time, store_from_id. (152 permission)",
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
element_type: "field",
|
|
167
|
-
type_name: "guard_remove_expired",
|
|
168
|
-
semantic_explanation: "Boolean. If true, removes all guards with expiration_time < now. (152 permission)",
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
element_type: "field",
|
|
172
|
-
type_name: "guard_expiration_time",
|
|
173
|
-
semantic_explanation: "Set/cancel guard_not_added_expiration_time. number = set lock; null = cancel. (155 permission)",
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
element_type: "field",
|
|
177
|
-
type_name: "owner_receive",
|
|
178
|
-
semantic_explanation: "Receive Receiving<K> / CoinWrapper<K> envelopes and forward to Permission owner. (156 permission)",
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
element_type: "field",
|
|
182
|
-
type_name: "um",
|
|
183
|
-
semantic_explanation: "Bind/unbind Contact (UM). string = um_set; null = um_none. (157 permission)",
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
element_type: "op",
|
|
187
|
-
type_name: "new",
|
|
188
|
-
semantic_explanation: "Create Reward<T> (150 permission). Indirect via SDK newReward() → reward::new or new_with_passport.",
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
element_type: "op",
|
|
192
|
-
type_name: "create",
|
|
193
|
-
semantic_explanation: "Share Reward object and return its address. Called automatically after new.",
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
element_type: "op",
|
|
197
|
-
type_name: "claim",
|
|
198
|
-
semantic_explanation: "Claim rewards (NO permission). Passport-driven: Guard verification + recipient/amount resolution from submissions.",
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
element_type: "op",
|
|
202
|
-
type_name: "guard_add",
|
|
203
|
-
semantic_explanation: "Add or update a RewardGuard (152). Existing guard (same address) is updated in place; new guard pushes (E_GUARD_COUNT_EXCEEDED if > 200).",
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
element_type: "op",
|
|
207
|
-
type_name: "guard_remove_expired",
|
|
208
|
-
semantic_explanation: "Remove all guards with expiration_time < now (152). Also disaffiliates from Registrar.",
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
element_type: "op",
|
|
212
|
-
type_name: "coin_add",
|
|
213
|
-
semantic_explanation: "Deposit Coin<T> into balance (153). balance::join(self.balance, coin::into_balance(coin)).",
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
element_type: "op",
|
|
217
|
-
type_name: "receive",
|
|
218
|
-
semantic_explanation: "Receive CoinWrapper<T> via Payment (154). unwrap_with_check → balance::join.",
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
element_type: "op",
|
|
222
|
-
type_name: "guard_expiration_time_add",
|
|
223
|
-
semantic_explanation: "Set/cancel guard_not_added_expiration_time (155). New time must be > now (E_GUARD_LOCKED_TIME_INVALID).",
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
element_type: "op",
|
|
227
|
-
type_name: "owner_receive",
|
|
228
|
-
semantic_explanation: "Owner unwrap Receiving<K>/CoinWrapper<K> (156). Forwards to Permission owner via owner_receive_inner.",
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
element_type: "op",
|
|
232
|
-
type_name: "um_set",
|
|
233
|
-
semantic_explanation: "Bind Contact as UM (157). Creates Registrar affiliation.",
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
element_type: "op",
|
|
237
|
-
type_name: "um_none",
|
|
238
|
-
semantic_explanation: "Unbind UM (157). Disaffiliates from Registrar and sets self.um = none.",
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
element_type: "op",
|
|
242
|
-
type_name: "description_set",
|
|
243
|
-
semantic_explanation: "Update description (151). Must satisfy common::DESCRIPTION.",
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
element_type: "op",
|
|
247
|
-
type_name: "permission_set",
|
|
248
|
-
semantic_explanation: "Replace Permission (owner-only). Asserts old.owner == sender; creates Registrar affiliation_change.",
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
element_type: "phase",
|
|
252
|
-
type_name: "creation",
|
|
253
|
-
semantic_explanation: "new (150) → create → share. Permission object may be created in same tx if not provided.",
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
element_type: "phase",
|
|
257
|
-
type_name: "guard_addition",
|
|
258
|
-
semantic_explanation: "guard_add (152) + guard_remove_expired (152). Guards are added/updated/removed based on expiration.",
|
|
259
|
-
},
|
|
260
|
-
{
|
|
261
|
-
element_type: "phase",
|
|
262
|
-
type_name: "claim",
|
|
263
|
-
semantic_explanation: "claim() — passport-driven, no permission. Iterates guards, verifies Passport, splits balance to recipient.",
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
element_type: "phase",
|
|
267
|
-
type_name: "funds_replenish",
|
|
268
|
-
semantic_explanation: "coin_add (153) OR receive (154). Both join into self.balance.",
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
element_type: "phase",
|
|
272
|
-
type_name: "owner_receive",
|
|
273
|
-
semantic_explanation: "owner_receive / owner_receive_object (156). Unwrap Receiving envelopes → Permission owner.",
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
element_type: "constructor",
|
|
277
|
-
type_name: "guard_u8_u8",
|
|
278
|
-
semantic_explanation: "RewardGuard constructor: GuardIdentifier recipient + GuardU64Identifier amount. Both resolved from Passport at claim time. Asserts is_identifier_address + value_type=u64.",
|
|
279
|
-
},
|
|
280
|
-
{
|
|
281
|
-
element_type: "constructor",
|
|
282
|
-
type_name: "guard_u8_u64",
|
|
283
|
-
semantic_explanation: "RewardGuard constructor: GuardIdentifier recipient + Fixed amount. Recipient from Passport; amount fixed. Asserts is_identifier_address.",
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
element_type: "constructor",
|
|
287
|
-
type_name: "guard_entity_u8",
|
|
288
|
-
semantic_explanation: "RewardGuard constructor: Entity recipient + GuardU64Identifier amount. Recipient fixed; amount from Passport. Asserts value_type=u64.",
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
element_type: "constructor",
|
|
292
|
-
type_name: "guard_entity_u64",
|
|
293
|
-
semantic_explanation: "RewardGuard constructor: Entity recipient + Fixed amount. Both fixed. Simplest configuration.",
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
element_type: "constructor",
|
|
297
|
-
type_name: "guard_signer_u8",
|
|
298
|
-
semantic_explanation: "RewardGuard constructor: Signer recipient + GuardU64Identifier amount. Caller is recipient; amount from Passport. Asserts value_type=u64.",
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
element_type: "constructor",
|
|
302
|
-
type_name: "guard_signer_u64",
|
|
303
|
-
semantic_explanation: "RewardGuard constructor: Signer recipient + Fixed amount. Caller is recipient; amount fixed. Common for first-order/flash sale.",
|
|
304
|
-
},
|
|
305
|
-
];
|
|
306
|
-
export const REWARD_CONSTRAINT_RULES = [
|
|
307
|
-
{
|
|
308
|
-
id: "MC-RW-01",
|
|
309
|
-
category: "structural",
|
|
310
|
-
rule: "guard count < MAX_GUARD_COUNT_REWARD (200); E_GUARD_COUNT_EXCEEDED on overflow (only on NEW guard, not update)",
|
|
311
|
-
applies_to: ["guard_add"],
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
id: "MC-RW-02",
|
|
315
|
-
category: "structural",
|
|
316
|
-
rule: "per-recipient record count < MAX_RECORD_COUNT_REWARD (5200); E_RECORD_COUNT_EXCEEDED on claim",
|
|
317
|
-
applies_to: ["claim"],
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
id: "MC-RW-03",
|
|
321
|
-
category: "structural",
|
|
322
|
-
rule: "guard_add batch size ≤ MAX_GUARD_COUNT_REWARD (200); SDK rejects larger batches in operate()",
|
|
323
|
-
applies_to: ["guard_add (batch)"],
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
id: "MC-RW-04",
|
|
327
|
-
category: "semantic",
|
|
328
|
-
rule: "guard_add: Recipient × Amount must match one of 6 valid constructors (guard_u8_u8 / u8_u64 / entity_u8 / entity_u64 / signer_u8 / signer_u64)",
|
|
329
|
-
applies_to: ["guard_add"],
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
id: "MC-RW-05",
|
|
333
|
-
category: "semantic",
|
|
334
|
-
rule: "RewardGuard constructor: GuardIdentifier recipient requires is_identifier_address(guard, id) — E_RECIPIENT_IDENTIFIER_NOT_ADDRESS",
|
|
335
|
-
applies_to: ["reward_guard (constructor)"],
|
|
336
|
-
},
|
|
337
|
-
{
|
|
338
|
-
id: "MC-RW-06",
|
|
339
|
-
category: "semantic",
|
|
340
|
-
rule: "RewardGuard constructor: GuardU64Identifier amount requires get_submission_value_type(guard, id) == TYPE_U64 — E_AMOUNT_NOT_U64",
|
|
341
|
-
applies_to: ["reward_guard (constructor)"],
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
id: "MC-RW-07",
|
|
345
|
-
category: "semantic",
|
|
346
|
-
rule: "RewardGuard constructor: store_from_id (if Some) requires is_identifier_address_compatible — E_STORE_FROM_ID_NOT_COMPATIBLE",
|
|
347
|
-
applies_to: ["reward_guard (constructor)"],
|
|
348
|
-
},
|
|
349
|
-
{
|
|
350
|
-
id: "MC-RW-08",
|
|
351
|
-
category: "permission",
|
|
352
|
-
rule: "claim is PERMISSION-FREE — anyone with valid Passport + Guard can claim (no 150-157 assertion)",
|
|
353
|
-
applies_to: ["claim"],
|
|
354
|
-
},
|
|
355
|
-
{
|
|
356
|
-
id: "MC-RW-09",
|
|
357
|
-
category: "permission",
|
|
358
|
-
rule: "150-157 builtin indexes are MANAGEMENT-ONLY (new/description/guard/coin_add/receive/guard_exp/owner_receive/um)",
|
|
359
|
-
applies_to: ["all management ops"],
|
|
360
|
-
},
|
|
361
|
-
{
|
|
362
|
-
id: "MC-RW-10",
|
|
363
|
-
category: "permission",
|
|
364
|
-
rule: "owner_receive (156) forwards to Permission owner (NOT Reward creator) — grant 156 only to dedicated addresses",
|
|
365
|
-
applies_to: ["owner_receive"],
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
id: "MC-RW-11",
|
|
369
|
-
category: "lifecycle",
|
|
370
|
-
rule: "guard_add: clock > guard_not_added_expiration_time (if Some) — E_GUARD_LOCKED_TIME",
|
|
371
|
-
applies_to: ["guard_add"],
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
id: "MC-RW-12",
|
|
375
|
-
category: "lifecycle",
|
|
376
|
-
rule: "guard_add / claim: clock ≤ guard.expiration_time (if Some) — E_GUARD_EXPIRED",
|
|
377
|
-
applies_to: ["guard_add", "claim"],
|
|
378
|
-
},
|
|
379
|
-
{
|
|
380
|
-
id: "MC-RW-13",
|
|
381
|
-
category: "lifecycle",
|
|
382
|
-
rule: "guard_expiration_time_add: new Some(t) requires t > now — E_GUARD_LOCKED_TIME_INVALID",
|
|
383
|
-
applies_to: ["guard_expiration_time_add"],
|
|
384
|
-
},
|
|
385
|
-
{
|
|
386
|
-
id: "MC-RW-14",
|
|
387
|
-
category: "lifecycle",
|
|
388
|
-
rule: "claim: balance ≥ amount — E_INSUFFICIENT_BALANCE (balance::split aborts)",
|
|
389
|
-
applies_to: ["claim"],
|
|
390
|
-
},
|
|
391
|
-
{
|
|
392
|
-
id: "MC-RW-15",
|
|
393
|
-
category: "cross_object",
|
|
394
|
-
rule: "claim: supplied guard must be in self.guards — E_GUARD_NOT_FOUND (iterates by id_address match)",
|
|
395
|
-
applies_to: ["claim"],
|
|
396
|
-
},
|
|
397
|
-
{
|
|
398
|
-
id: "MC-RW-16",
|
|
399
|
-
category: "cross_object",
|
|
400
|
-
rule: "coin_add: Coin<T> type must match Reward<T> phantom T (SDK W_ERROR in operate if mismatch)",
|
|
401
|
-
applies_to: ["coin_add"],
|
|
402
|
-
},
|
|
403
|
-
];
|
|
404
|
-
export const REWARD_TRANSLATION_VERSION = "1.0.0";
|
|
405
|
-
export function matchSemanticPattern(userIntent) {
|
|
406
|
-
const lower = userIntent.toLowerCase();
|
|
407
|
-
return REWARD_SEMANTIC_TO_SCHEMA_RULES.filter(rule => rule.match_keywords.some(kw => lower.includes(kw.toLowerCase())));
|
|
408
|
-
}
|
|
409
|
-
export function explainRewardCallData(data) {
|
|
410
|
-
const lines = [];
|
|
411
|
-
if (!data.object) {
|
|
412
|
-
lines.push("Operation: CREATE Reward (new + create + share)");
|
|
413
|
-
}
|
|
414
|
-
else {
|
|
415
|
-
lines.push(`Operation: OPERATE Reward at ${data.object}`);
|
|
416
|
-
}
|
|
417
|
-
if (data.claim) {
|
|
418
|
-
lines.push(`- claim: guard=${data.claim} (passport-driven, NO permission check)`);
|
|
419
|
-
}
|
|
420
|
-
if (data.description != null) {
|
|
421
|
-
lines.push(`- description_set: "${data.description}" (151 permission)`);
|
|
422
|
-
}
|
|
423
|
-
if (data.coin_add) {
|
|
424
|
-
lines.push(`- coin_add: ${data.coin_add.amount} of ${data.coin_add.coin_type} (153 permission)`);
|
|
425
|
-
}
|
|
426
|
-
if (data.receive) {
|
|
427
|
-
lines.push(`- receive: token_type=${data.receive.token_type} (154 permission, requires Payment)`);
|
|
428
|
-
}
|
|
429
|
-
if (data.guard_add) {
|
|
430
|
-
lines.push(`- guard_add: ${data.guard_add.length} guard(s) (152 permission)`);
|
|
431
|
-
for (let i = 0; i < data.guard_add.length; i++) {
|
|
432
|
-
const g = data.guard_add[i];
|
|
433
|
-
const rKey = Object.keys(g.recipient)[0] ?? "(unknown)";
|
|
434
|
-
const constructorName = inferConstructorName(rKey, g.amount.type);
|
|
435
|
-
lines.push(` [${i}] constructor=${constructorName}, guard=${g.guard}`);
|
|
436
|
-
lines.push(` recipient=${rKey}, amount=${g.amount.type}(${g.amount.value})`);
|
|
437
|
-
if (g.expiration_time != null) {
|
|
438
|
-
lines.push(` expiration_time=${g.expiration_time}`);
|
|
439
|
-
}
|
|
440
|
-
if (g.store_from_id != null) {
|
|
441
|
-
lines.push(` store_from_id=${g.store_from_id}`);
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
if (data.guard_remove_expired) {
|
|
446
|
-
lines.push(`- guard_remove_expired: true (152 permission)`);
|
|
447
|
-
}
|
|
448
|
-
if (data.guard_expiration_time !== undefined) {
|
|
449
|
-
const t = data.guard_expiration_time;
|
|
450
|
-
if (t === null) {
|
|
451
|
-
lines.push(`- guard_expiration_time_add: null (cancel lock, 155 permission)`);
|
|
452
|
-
}
|
|
453
|
-
else {
|
|
454
|
-
lines.push(`- guard_expiration_time_add: ${t} (155 permission, must be > now)`);
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
if (data.owner_receive != null) {
|
|
458
|
-
lines.push(`- ⚠️ owner_receive (156 permission): unwrap to Permission owner`);
|
|
459
|
-
}
|
|
460
|
-
if (data.um !== undefined) {
|
|
461
|
-
if (data.um) {
|
|
462
|
-
lines.push(`- um_set: ${data.um} (157 permission, creates Registrar affiliation)`);
|
|
463
|
-
}
|
|
464
|
-
else {
|
|
465
|
-
lines.push(`- um_none: (157 permission, disaffiliates and clears um)`);
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
return lines.join("\n");
|
|
469
|
-
}
|
|
470
|
-
function inferConstructorName(recipientKey, amountType) {
|
|
471
|
-
const recipientMap = {
|
|
472
|
-
GuardIdentifier: "GuardIdentifier",
|
|
473
|
-
Entity: "Entity",
|
|
474
|
-
Signer: "Signer",
|
|
475
|
-
};
|
|
476
|
-
const recipientType = recipientMap[recipientKey];
|
|
477
|
-
if (!recipientType)
|
|
478
|
-
return "(invalid)";
|
|
479
|
-
const amountTypeStr = String(amountType).toUpperCase();
|
|
480
|
-
const amountTypeNorm = amountTypeStr === "FIXED" ? "Fixed" : "GuardU64Identifier";
|
|
481
|
-
return resolveGuardConstructor(recipientType, amountTypeNorm) ?? "(invalid)";
|
|
482
|
-
}
|
|
483
|
-
export function explainField(fieldName) {
|
|
484
|
-
return REWARD_SCHEMA_TO_SEMANTIC_RULES.find(r => r.element_type === "field" && r.type_name === fieldName);
|
|
485
|
-
}
|
|
486
|
-
export function explainOp(opName) {
|
|
487
|
-
return REWARD_SCHEMA_TO_SEMANTIC_RULES.find(r => r.element_type === "op" && r.type_name === opName);
|
|
488
|
-
}
|
|
489
|
-
export function explainConstructor(constructorName) {
|
|
490
|
-
return REWARD_SCHEMA_TO_SEMANTIC_RULES.find(r => r.element_type === "constructor" && r.type_name === constructorName);
|
|
491
|
-
}
|
|
492
|
-
export function getConstraintsByCategory(category) {
|
|
493
|
-
return REWARD_CONSTRAINT_RULES.filter(r => r.category === category);
|
|
494
|
-
}
|
|
495
|
-
export function explainPermissionIndex(index) {
|
|
496
|
-
if (isRewardBuiltinPermission(index)) {
|
|
497
|
-
const entry = getBuiltinPermissionByIndex(index);
|
|
498
|
-
return `${entry.name} (${index}) — ${entry.description}`;
|
|
499
|
-
}
|
|
500
|
-
return `Custom permission index (${index}) — not a Reward builtin (150-157)`;
|
|
501
|
-
}
|
|
1
|
+
import{isRewardBuiltinPermission,getBuiltinPermissionByIndex,resolveGuardConstructor}from'./reward-ledger.js';export const REWARD_SEMANTIC_TO_SCHEMA_RULES=[{'id':'P-RW-01','pattern_name':'Create\x20new\x20Reward','semantic_intent':'Initialize\x20a\x20new\x20Reward<T>\x20object\x20with\x20description,\x20Permission,\x20and\x20coin\x20type\x20T','match_keywords':['create\x20reward','new\x20reward'],'schema_fields':['object\x20(typed,\x20with\x20permission\x20+\x20type_parameter)','description'],'example_json':{'object':{'permission':'0xPERMISSION_ADDRESS','type_parameter':'0x2::wow::WOW'},'description':'First-order\x20cashback\x20reward'},'reverse_explanation':'object\x20with\x20type_parameter\x20triggers\x20reward::new\x20(150).\x20SDK\x20creates\x20Permission\x20if\x20not\x20provided,\x20'+'then\x20constructs\x20Reward<T>\x20via\x20new_imp.\x20After\x20create,\x20share_object\x20is\x20called\x20automatically.'},{'id':'P-RW-02','pattern_name':'Add\x20RewardGuard\x20(eligible\x20recipient\x20+\x20amount\x20rule)','semantic_intent':'Register\x20a\x20Guard\x20that\x20defines\x20who\x20can\x20claim\x20and\x20how\x20much\x20they\x20receive','match_keywords':['guard_add','add\x20guard','eligibility'],'schema_fields':['object','guard_add[]'],'example_json':{'object':'0xREWARD_ADDRESS','guard_add':[{'guard':'0xGUARD_ADDRESS','recipient':{'Signer':'signer'},'amount':{'type':'Fixed','value':0x3b9aca00},'expiration_time':0x1941f297c00,'store_from_id':null}]},'reverse_explanation':'guard_add\x20with\x20one\x20entry\x20triggers\x20reward::guard_add\x20(152).\x20SDK\x20reward_guard()\x20picks\x20one\x20of\x206\x20Move\x20constructors\x20'+'based\x20on\x20recipient\x20variant\x20(GuardIdentifier/Entity/Signer)\x20×\x20amount.type\x20(GuardU64Identifier/Fixed).\x20'+'Move:\x20if\x20guard\x20already\x20in\x20self.guards,\x20UPDATE\x20in\x20place;\x20else\x20push_back\x20(E_GUARD_COUNT_EXCEEDED\x20if\x20>\x20200).'},{'id':'P-RW-03','pattern_name':'Claim\x20reward\x20(passport-driven)','semantic_intent':'Claim\x20rewards\x20as\x20an\x20eligible\x20recipient,\x20verified\x20via\x20Guard\x20+\x20Passport','match_keywords':['claim','receive\x20reward'],'schema_fields':['object','claim\x20(guard\x20address)'],'example_json':{'object':'0xREWARD_ADDRESS','claim':'0xGUARD_ADDRESS'},'reverse_explanation':'claim\x20field\x20set\x20to\x20a\x20guard\x20address\x20triggers\x20reward::claim\x20(NO\x20permission\x20check).\x20'+'Move:\x20iterates\x20self.guards\x20looking\x20for\x20matching\x20guard.id_address;\x20passport::result_for_guard\x20verifies\x20submission;\x20'+'recipient/amount\x20resolved\x20from\x20Passport\x20submissions\x20OR\x20fixed\x20values;\x20'+'balance::split\x20transfers\x20coin\x20to\x20recipient;\x20record\x20appended\x20to\x20RecipientRecord.amount\x20vector.'},{'id':'P-RW-04','pattern_name':'Deposit\x20funds\x20(coin_add)','semantic_intent':'Deposit\x20Coin<T>\x20into\x20the\x20Reward\x20balance\x20to\x20fund\x20claims','match_keywords':['coin_add','deposit','deposit\x20funds'],'schema_fields':['object','coin_add'],'example_json':{'object':'0xREWARD_ADDRESS','coin_add':{'amount':'10000000000','coin_type':'0x2::wow::WOW'}},'reverse_explanation':'coin_add\x20triggers\x20reward::coin_add\x20(153).\x20Move:\x20coin::into_balance(coin)\x20→\x20balance::join(self.balance).\x20'+'Coin<T>\x20type\x20must\x20match\x20Reward<T>\x20exactly\x20(phantom\x20T).\x20No\x20upper\x20limit\x20on\x20balance.'},{'id':'P-RW-05','pattern_name':'Receive\x20CoinWrapper\x20via\x20Payment','semantic_intent':'Receive\x20a\x20CoinWrapper<T>\x20envelope\x20via\x20Payment.unwrap_with_check','match_keywords':['receive','payment','unwrap'],'schema_fields':['object','receive\x20(payment\x20+\x20received)'],'example_json':{'object':'0xREWARD_ADDRESS','receive':{'received':[{'id':'0xRECEIVED_OBJ','payment':'0xPAYMENT_OBJ'}],'token_type':'0x2::wow::WOW'}},'reverse_explanation':'receive\x20with\x20Receiving<CoinWrapper<T>>\x20+\x20Payment<T>\x20triggers\x20reward::receive\x20(154).\x20'+'Move:\x20payment::unwrap_with_check\x20extracts\x20Coin<T>\x20from\x20CoinWrapper<T>,\x20then\x20balance::join.\x20'+'token_type\x20must\x20match\x20Reward<T>.'},{'id':'P-RW-06','pattern_name':'Owner\x20receive\x20(terminal\x20disbursement)','semantic_intent':'Owner\x20unwraps\x20Receiving<K>\x20/\x20CoinWrapper<K>\x20envelopes\x20sent\x20to\x20the\x20Reward','match_keywords':['owner_receive','unwrap\x20to\x20owner'],'schema_fields':['object','owner_receive'],'example_json':{'object':'0xREWARD_ADDRESS','owner_receive':{'received':[{'id':'0xRECEIVED_OBJ','payment':'0xPAYMENT_OBJ'}],'token_type':'0x2::wow::WOW'}},'reverse_explanation':'owner_receive\x20triggers\x20reward::owner_receive\x20(156).\x20Move:\x20payment::unwrap_with_check\x20extracts\x20Coin<K>,\x20'+'then\x20permission::owner_receive_inner\x20forwards\x20to\x20Permission\x20owner\x20(NOT\x20Reward\x20creator).\x20'+'Does\x20NOT\x20drain\x20self.balance\x20—\x20only\x20unwraps\x20Receiving<K>\x20envelopes.'},{'id':'P-RW-07','pattern_name':'Set\x20UM\x20(Contact\x20binding)','semantic_intent':'Bind\x20or\x20unbind\x20a\x20Contact\x20(UM)\x20object\x20for\x20off-chain\x20coordination','match_keywords':['um_set','um_none','contact','UM'],'schema_fields':['object','um\x20(string\x20|\x20null)'],'example_json':{'object':'0xREWARD_ADDRESS','um':'0xCONTACT_ADDRESS'},'reverse_explanation':'um=<address>\x20triggers\x20reward::um_set\x20(157)\x20—\x20creates\x20Registrar\x20affiliation.\x20'+'um=null\x20triggers\x20reward::um_none\x20(157)\x20—\x20disaffiliates\x20and\x20clears\x20self.um.'},{'id':'P-RW-08','pattern_name':'Set\x20permission\x20(owner-only)','semantic_intent':'Replace\x20the\x20Permission\x20object\x20(owner-only\x20operation)','match_keywords':['permission_set','change\x20permission'],'schema_fields':['(SDK\x20does\x20not\x20expose\x20this\x20in\x20CallReward_Data\x20—\x20direct\x20Move\x20call\x20required)'],'example_json':{'_note':'Not\x20exposed\x20in\x20CallReward_Data;\x20direct\x20Move\x20call:','target':'reward::permission_set<T>','arguments':['reward','old_permission','new_permission','registrar','clock']},'reverse_explanation':'Calls\x20reward::permission_set.\x20Move\x20asserts\x20old.owner\x20==\x20sender\x20(tx_context::sender).\x20'+'Updates\x20self.permission\x20=\x20new.id_address;\x20creates\x20Registrar\x20affiliation_change.'}];export const REWARD_SCHEMA_TO_SEMANTIC_RULES=[{'element_type':'field','type_name':'object','semantic_explanation':'Reward\x20object\x20address.\x20For\x20create:\x20typed\x20object\x20with\x20permission\x20+\x20type_parameter.\x20For\x20operate:\x20existing\x20Reward\x20address.'},{'element_type':'field','type_name':'claim','semantic_explanation':'Guard\x20address\x20to\x20claim\x20against.\x20NO\x20permission\x20check\x20—\x20eligibility\x20determined\x20by\x20Guard\x20+\x20Passport\x20alone.'},{'element_type':'field','type_name':'description','semantic_explanation':'Reward\x20description\x20(must\x20satisfy\x20common::DESCRIPTION).\x20Updated\x20via\x20description_set\x20(151).'},{'element_type':'field','type_name':'coin_add','semantic_explanation':'Deposit\x20Coin<T>\x20into\x20balance.\x20coin_type\x20must\x20match\x20Reward<T>\x20(153\x20permission).'},{'element_type':'field','type_name':'receive','semantic_explanation':'Receive\x20CoinWrapper<T>\x20via\x20Payment.unwrap_with_check.\x20token_type\x20must\x20match\x20Reward<T>\x20(154\x20permission).'},{'element_type':'field','type_name':'guard_add','semantic_explanation':'Array\x20of\x20RewardGuard\x20configs.\x20Each\x20entry\x20has\x20guard,\x20recipient\x20(GuardIdentifier/Entity/Signer),\x20amount\x20(Fixed/GuardU64Identifier),\x20expiration_time,\x20store_from_id.\x20(152\x20permission)'},{'element_type':'field','type_name':'guard_remove_expired','semantic_explanation':'Boolean.\x20If\x20true,\x20removes\x20all\x20guards\x20with\x20expiration_time\x20<\x20now.\x20(152\x20permission)'},{'element_type':'field','type_name':'guard_expiration_time','semantic_explanation':'Set/cancel\x20guard_not_added_expiration_time.\x20number\x20=\x20set\x20lock;\x20null\x20=\x20cancel.\x20(155\x20permission)'},{'element_type':'field','type_name':'owner_receive','semantic_explanation':'Receive\x20Receiving<K>\x20/\x20CoinWrapper<K>\x20envelopes\x20and\x20forward\x20to\x20Permission\x20owner.\x20(156\x20permission)'},{'element_type':'field','type_name':'um','semantic_explanation':'Bind/unbind\x20Contact\x20(UM).\x20string\x20=\x20um_set;\x20null\x20=\x20um_none.\x20(157\x20permission)'},{'element_type':'op','type_name':'new','semantic_explanation':'Create\x20Reward<T>\x20(150\x20permission).\x20Indirect\x20via\x20SDK\x20newReward()\x20→\x20reward::new\x20or\x20new_with_passport.'},{'element_type':'op','type_name':'create','semantic_explanation':'Share\x20Reward\x20object\x20and\x20return\x20its\x20address.\x20Called\x20automatically\x20after\x20new.'},{'element_type':'op','type_name':'claim','semantic_explanation':'Claim\x20rewards\x20(NO\x20permission).\x20Passport-driven:\x20Guard\x20verification\x20+\x20recipient/amount\x20resolution\x20from\x20submissions.'},{'element_type':'op','type_name':'guard_add','semantic_explanation':'Add\x20or\x20update\x20a\x20RewardGuard\x20(152).\x20Existing\x20guard\x20(same\x20address)\x20is\x20updated\x20in\x20place;\x20new\x20guard\x20pushes\x20(E_GUARD_COUNT_EXCEEDED\x20if\x20>\x20200).'},{'element_type':'op','type_name':'guard_remove_expired','semantic_explanation':'Remove\x20all\x20guards\x20with\x20expiration_time\x20<\x20now\x20(152).\x20Also\x20disaffiliates\x20from\x20Registrar.'},{'element_type':'op','type_name':'coin_add','semantic_explanation':'Deposit\x20Coin<T>\x20into\x20balance\x20(153).\x20balance::join(self.balance,\x20coin::into_balance(coin)).'},{'element_type':'op','type_name':'receive','semantic_explanation':'Receive\x20CoinWrapper<T>\x20via\x20Payment\x20(154).\x20unwrap_with_check\x20→\x20balance::join.'},{'element_type':'op','type_name':'guard_expiration_time_add','semantic_explanation':'Set/cancel\x20guard_not_added_expiration_time\x20(155).\x20New\x20time\x20must\x20be\x20>\x20now\x20(E_GUARD_LOCKED_TIME_INVALID).'},{'element_type':'op','type_name':'owner_receive','semantic_explanation':'Owner\x20unwrap\x20Receiving<K>/CoinWrapper<K>\x20(156).\x20Forwards\x20to\x20Permission\x20owner\x20via\x20owner_receive_inner.'},{'element_type':'op','type_name':'um_set','semantic_explanation':'Bind\x20Contact\x20as\x20UM\x20(157).\x20Creates\x20Registrar\x20affiliation.'},{'element_type':'op','type_name':'um_none','semantic_explanation':'Unbind\x20UM\x20(157).\x20Disaffiliates\x20from\x20Registrar\x20and\x20sets\x20self.um\x20=\x20none.'},{'element_type':'op','type_name':'description_set','semantic_explanation':'Update\x20description\x20(151).\x20Must\x20satisfy\x20common::DESCRIPTION.'},{'element_type':'op','type_name':'permission_set','semantic_explanation':'Replace\x20Permission\x20(owner-only).\x20Asserts\x20old.owner\x20==\x20sender;\x20creates\x20Registrar\x20affiliation_change.'},{'element_type':'phase','type_name':'creation','semantic_explanation':'new\x20(150)\x20→\x20create\x20→\x20share.\x20Permission\x20object\x20may\x20be\x20created\x20in\x20same\x20tx\x20if\x20not\x20provided.'},{'element_type':'phase','type_name':'guard_addition','semantic_explanation':'guard_add\x20(152)\x20+\x20guard_remove_expired\x20(152).\x20Guards\x20are\x20added/updated/removed\x20based\x20on\x20expiration.'},{'element_type':'phase','type_name':'claim','semantic_explanation':'claim()\x20—\x20passport-driven,\x20no\x20permission.\x20Iterates\x20guards,\x20verifies\x20Passport,\x20splits\x20balance\x20to\x20recipient.'},{'element_type':'phase','type_name':'funds_replenish','semantic_explanation':'coin_add\x20(153)\x20OR\x20receive\x20(154).\x20Both\x20join\x20into\x20self.balance.'},{'element_type':'phase','type_name':'owner_receive','semantic_explanation':'owner_receive\x20/\x20owner_receive_object\x20(156).\x20Unwrap\x20Receiving\x20envelopes\x20→\x20Permission\x20owner.'},{'element_type':'constructor','type_name':'guard_u8_u8','semantic_explanation':'RewardGuard\x20constructor:\x20GuardIdentifier\x20recipient\x20+\x20GuardU64Identifier\x20amount.\x20Both\x20resolved\x20from\x20Passport\x20at\x20claim\x20time.\x20Asserts\x20is_identifier_address\x20+\x20value_type=u64.'},{'element_type':'constructor','type_name':'guard_u8_u64','semantic_explanation':'RewardGuard\x20constructor:\x20GuardIdentifier\x20recipient\x20+\x20Fixed\x20amount.\x20Recipient\x20from\x20Passport;\x20amount\x20fixed.\x20Asserts\x20is_identifier_address.'},{'element_type':'constructor','type_name':'guard_entity_u8','semantic_explanation':'RewardGuard\x20constructor:\x20Entity\x20recipient\x20+\x20GuardU64Identifier\x20amount.\x20Recipient\x20fixed;\x20amount\x20from\x20Passport.\x20Asserts\x20value_type=u64.'},{'element_type':'constructor','type_name':'guard_entity_u64','semantic_explanation':'RewardGuard\x20constructor:\x20Entity\x20recipient\x20+\x20Fixed\x20amount.\x20Both\x20fixed.\x20Simplest\x20configuration.'},{'element_type':'constructor','type_name':'guard_signer_u8','semantic_explanation':'RewardGuard\x20constructor:\x20Signer\x20recipient\x20+\x20GuardU64Identifier\x20amount.\x20Caller\x20is\x20recipient;\x20amount\x20from\x20Passport.\x20Asserts\x20value_type=u64.'},{'element_type':'constructor','type_name':'guard_signer_u64','semantic_explanation':'RewardGuard\x20constructor:\x20Signer\x20recipient\x20+\x20Fixed\x20amount.\x20Caller\x20is\x20recipient;\x20amount\x20fixed.\x20Common\x20for\x20first-order/flash\x20sale.'}];export const REWARD_CONSTRAINT_RULES=[{'id':'MC-RW-01','category':'structural','rule':'guard\x20count\x20<\x20MAX_GUARD_COUNT_REWARD\x20(200);\x20E_GUARD_COUNT_EXCEEDED\x20on\x20overflow\x20(only\x20on\x20NEW\x20guard,\x20not\x20update)','applies_to':['guard_add']},{'id':'MC-RW-02','category':'structural','rule':'per-recipient\x20record\x20count\x20<\x20MAX_RECORD_COUNT_REWARD\x20(5200);\x20E_RECORD_COUNT_EXCEEDED\x20on\x20claim','applies_to':['claim']},{'id':'MC-RW-03','category':'structural','rule':'guard_add\x20batch\x20size\x20≤\x20MAX_GUARD_COUNT_REWARD\x20(200);\x20SDK\x20rejects\x20larger\x20batches\x20in\x20operate()','applies_to':['guard_add\x20(batch)']},{'id':'MC-RW-04','category':'semantic','rule':'guard_add:\x20Recipient\x20×\x20Amount\x20must\x20match\x20one\x20of\x206\x20valid\x20constructors\x20(guard_u8_u8\x20/\x20u8_u64\x20/\x20entity_u8\x20/\x20entity_u64\x20/\x20signer_u8\x20/\x20signer_u64)','applies_to':['guard_add']},{'id':'MC-RW-05','category':'semantic','rule':'RewardGuard\x20constructor:\x20GuardIdentifier\x20recipient\x20requires\x20is_identifier_address(guard,\x20id)\x20—\x20E_RECIPIENT_IDENTIFIER_NOT_ADDRESS','applies_to':['reward_guard\x20(constructor)']},{'id':'MC-RW-06','category':'semantic','rule':'RewardGuard\x20constructor:\x20GuardU64Identifier\x20amount\x20requires\x20get_submission_value_type(guard,\x20id)\x20==\x20TYPE_U64\x20—\x20E_AMOUNT_NOT_U64','applies_to':['reward_guard\x20(constructor)']},{'id':'MC-RW-07','category':'semantic','rule':'RewardGuard\x20constructor:\x20store_from_id\x20(if\x20Some)\x20requires\x20is_identifier_address_compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE','applies_to':['reward_guard\x20(constructor)']},{'id':'MC-RW-08','category':'permission','rule':'claim\x20is\x20PERMISSION-FREE\x20—\x20anyone\x20with\x20valid\x20Passport\x20+\x20Guard\x20can\x20claim\x20(no\x20150-157\x20assertion)','applies_to':['claim']},{'id':'MC-RW-09','category':'permission','rule':'150-157\x20builtin\x20indexes\x20are\x20MANAGEMENT-ONLY\x20(new/description/guard/coin_add/receive/guard_exp/owner_receive/um)','applies_to':['all\x20management\x20ops']},{'id':'MC-RW-10','category':'permission','rule':'owner_receive\x20(156)\x20forwards\x20to\x20Permission\x20owner\x20(NOT\x20Reward\x20creator)\x20—\x20grant\x20156\x20only\x20to\x20dedicated\x20addresses','applies_to':['owner_receive']},{'id':'MC-RW-11','category':'lifecycle','rule':'guard_add:\x20clock\x20>\x20guard_not_added_expiration_time\x20(if\x20Some)\x20—\x20E_GUARD_LOCKED_TIME','applies_to':['guard_add']},{'id':'MC-RW-12','category':'lifecycle','rule':'guard_add\x20/\x20claim:\x20clock\x20≤\x20guard.expiration_time\x20(if\x20Some)\x20—\x20E_GUARD_EXPIRED','applies_to':['guard_add','claim']},{'id':'MC-RW-13','category':'lifecycle','rule':'guard_expiration_time_add:\x20new\x20Some(t)\x20requires\x20t\x20>\x20now\x20—\x20E_GUARD_LOCKED_TIME_INVALID','applies_to':['guard_expiration_time_add']},{'id':'MC-RW-14','category':'lifecycle','rule':'claim:\x20balance\x20≥\x20amount\x20—\x20E_INSUFFICIENT_BALANCE\x20(balance::split\x20aborts)','applies_to':['claim']},{'id':'MC-RW-15','category':'cross_object','rule':'claim:\x20supplied\x20guard\x20must\x20be\x20in\x20self.guards\x20—\x20E_GUARD_NOT_FOUND\x20(iterates\x20by\x20id_address\x20match)','applies_to':['claim']},{'id':'MC-RW-16','category':'cross_object','rule':'coin_add:\x20Coin<T>\x20type\x20must\x20match\x20Reward<T>\x20phantom\x20T\x20(SDK\x20W_ERROR\x20in\x20operate\x20if\x20mismatch)','applies_to':['coin_add']}];export const REWARD_TRANSLATION_VERSION='1.0.0';export function matchSemanticPattern(a){const b=a['toLowerCase']();return REWARD_SEMANTIC_TO_SCHEMA_RULES['filter'](c=>c['match_keywords']['some'](d=>b['includes'](d['toLowerCase']())));}export function explainRewardCallData(a){const b=[];!a['object']?b['push']('Operation:\x20CREATE\x20Reward\x20(new\x20+\x20create\x20+\x20share)'):b['push']('Operation:\x20OPERATE\x20Reward\x20at\x20'+a['object']);a['claim']&&b['push']('-\x20claim:\x20guard='+a['claim']+'\x20(passport-driven,\x20NO\x20permission\x20check)');a['description']!=null&&b['push']('-\x20description_set:\x20\x22'+a['description']+'\x22\x20(151\x20permission)');a['coin_add']&&b['push']('-\x20coin_add:\x20'+a['coin_add']['amount']+'\x20of\x20'+a['coin_add']['coin_type']+'\x20(153\x20permission)');a['receive']&&b['push']('-\x20receive:\x20token_type='+a['receive']['token_type']+'\x20(154\x20permission,\x20requires\x20Payment)');if(a['guard_add']){b['push']('-\x20guard_add:\x20'+a['guard_add']['length']+'\x20guard(s)\x20(152\x20permission)');for(let c=0x0;c<a['guard_add']['length'];c++){const d=a['guard_add'][c],e=Object['keys'](d['recipient'])[0x0]??'(unknown)',f=inferConstructorName(e,d['amount']['type']);b['push']('\x20\x20['+c+']\x20constructor='+f+',\x20guard='+d['guard']),b['push']('\x20\x20\x20\x20\x20\x20recipient='+e+',\x20amount='+d['amount']['type']+'('+d['amount']['value']+')'),d['expiration_time']!=null&&b['push']('\x20\x20\x20\x20\x20\x20expiration_time='+d['expiration_time']),d['store_from_id']!=null&&b['push']('\x20\x20\x20\x20\x20\x20store_from_id='+d['store_from_id']);}}a['guard_remove_expired']&&b['push']('-\x20guard_remove_expired:\x20true\x20(152\x20permission)');if(a['guard_expiration_time']!==undefined){const h=a['guard_expiration_time'];h===null?b['push']('-\x20guard_expiration_time_add:\x20null\x20(cancel\x20lock,\x20155\x20permission)'):b['push']('-\x20guard_expiration_time_add:\x20'+h+'\x20(155\x20permission,\x20must\x20be\x20>\x20now)');}return a['owner_receive']!=null&&b['push']('-\x20⚠️\x20owner_receive\x20(156\x20permission):\x20unwrap\x20to\x20Permission\x20owner'),a['um']!==undefined&&(a['um']?b['push']('-\x20um_set:\x20'+a['um']+'\x20(157\x20permission,\x20creates\x20Registrar\x20affiliation)'):b['push']('-\x20um_none:\x20(157\x20permission,\x20disaffiliates\x20and\x20clears\x20um)')),b['join']('\x0a');}function inferConstructorName(a,b){const c={'GuardIdentifier':'GuardIdentifier','Entity':'Entity','Signer':'Signer'},d=c[a];if(!d)return'(invalid)';const e=String(b)['toUpperCase'](),f=e==='FIXED'?'Fixed':'GuardU64Identifier';return resolveGuardConstructor(d,f)??'(invalid)';}export function explainField(a){return REWARD_SCHEMA_TO_SEMANTIC_RULES['find'](b=>b['element_type']==='field'&&b['type_name']===a);}export function explainOp(a){return REWARD_SCHEMA_TO_SEMANTIC_RULES['find'](b=>b['element_type']==='op'&&b['type_name']===a);}export function explainConstructor(a){return REWARD_SCHEMA_TO_SEMANTIC_RULES['find'](b=>b['element_type']==='constructor'&&b['type_name']===a);}export function getConstraintsByCategory(a){return REWARD_CONSTRAINT_RULES['filter'](b=>b['category']===a);}export function explainPermissionIndex(a){if(isRewardBuiltinPermission(a)){const b=getBuiltinPermissionByIndex(a);return b['name']+'\x20('+a+')\x20—\x20'+b['description'];}return'Custom\x20permission\x20index\x20('+a+')\x20—\x20not\x20a\x20Reward\x20builtin\x20(150-157)';}
|