@wowok/agent-mcp 3.3.1 → 3.3.3
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/chain-semantics/field-capability.js +1 -1
- package/dist/chain-semantics/freeze-map.js +1 -1
- package/dist/chain-semantics/fund-flow.js +1 -1
- package/dist/chain-semantics/guard-verbs.js +1 -1
- package/dist/chain-semantics/object-graph.js +1 -1
- package/dist/composition/audit.d.ts +5 -0
- package/dist/composition/audit.js +1 -1
- package/dist/composition/blueprint-view.d.ts +0 -1
- package/dist/composition/blueprint-view.js +1 -1
- package/dist/composition/compile.d.ts +5 -3
- package/dist/composition/compile.js +1 -1
- package/dist/composition/inflight.d.ts +32 -4
- package/dist/composition/inflight.js +1 -1
- package/dist/config/judgment.d.ts +111 -1
- package/dist/config/judgment.js +1 -1
- package/dist/customer/industry-risks.js +1 -1
- package/dist/customer/user-preferences.js +1 -1
- package/dist/evaluation/arbitration-game.d.ts +4 -0
- package/dist/evaluation/arbitration-game.js +1 -1
- package/dist/evaluation/builtins/graph-service.js +1 -1
- package/dist/evaluation/builtins/graph-service.spec.js +1 -1
- package/dist/evaluation/game-strategy.d.ts +6 -0
- package/dist/evaluation/game-strategy.js +1 -1
- package/dist/evaluation/node-game.d.ts +4 -0
- package/dist/evaluation/node-game.js +1 -1
- package/dist/evaluation/value-risk.d.ts +8 -0
- package/dist/evaluation/value-risk.js +1 -0
- package/dist/experience/realtime-feedback.js +1 -1
- package/dist/extensions/business-modules.d.ts +7 -2
- package/dist/extensions/business-modules.js +1 -1
- package/dist/extensions/industry-audit.spec.js +1 -1
- package/dist/extensions/industry-pack.d.ts +3 -2
- package/dist/extensions/industry-pack.js +1 -1
- package/dist/extensions/modes.js +1 -1
- package/dist/graph/onchain/analyze.js +1 -1
- package/dist/graph/onchain/analyze.spec.js +1 -1
- package/dist/graph/onchain/expand.js +1 -1
- package/dist/graph/onchain/exposure.js +1 -1
- package/dist/graph/onchain/facet-projection.js +1 -1
- package/dist/graph/onchain/facet-projection.spec.js +1 -1
- package/dist/graph/onchain/facts.d.ts +20 -0
- package/dist/graph/onchain/facts.js +1 -1
- package/dist/graph/onchain/facts.spec.js +1 -1
- package/dist/graph/onchain/object-held-receipts.d.ts +20 -0
- package/dist/graph/onchain/object-held-receipts.js +1 -0
- package/dist/graph/onchain/object-held-receipts.spec.d.ts +1 -0
- package/dist/graph/onchain/object-held-receipts.spec.js +1 -0
- package/dist/graph/onchain/project-relationship.js +1 -1
- package/dist/graph/onchain/sdk-batch.d.ts +1 -0
- package/dist/graph/onchain/sdk-batch.js +1 -1
- package/dist/harness/index.d.ts +1 -0
- package/dist/harness/recover.d.ts +2 -1
- package/dist/harness/recover.js +1 -1
- package/dist/knowledge/acquisition-flywheel.js +1 -1
- package/dist/knowledge/allocation-ledger.d.ts +3 -1
- package/dist/knowledge/allocation-ledger.js +1 -1
- package/dist/knowledge/allocation-puzzle.d.ts +1 -0
- package/dist/knowledge/allocation-puzzle.js +1 -1
- package/dist/knowledge/allocation-risk.d.ts +1 -1
- package/dist/knowledge/allocation-risk.js +1 -1
- package/dist/knowledge/arb-fund-facts.d.ts +12 -0
- package/dist/knowledge/arb-fund-facts.js +1 -1
- package/dist/knowledge/audit-rules.d.ts +4 -3
- package/dist/knowledge/audit-rules.js +1 -1
- package/dist/knowledge/baselines/judgment-baselines.json +502 -81
- package/dist/knowledge/baselines/rules/allocation.json +0 -14
- package/dist/knowledge/baselines/rules/graph.json +4 -4
- package/dist/knowledge/baselines/rules/plan.json +81 -5
- package/dist/knowledge/baselines/rules/reward.json +1 -1
- package/dist/knowledge/builtin-templates.d.ts +9 -1
- package/dist/knowledge/builtin-templates.js +1 -1
- package/dist/knowledge/discount-threshold.js +1 -1
- package/dist/knowledge/event-semantics.js +1 -1
- package/dist/knowledge/game-scenarios.d.ts +21 -0
- package/dist/knowledge/game-scenarios.js +1 -0
- package/dist/knowledge/getting-started.js +1 -1
- package/dist/knowledge/guard-bindings.js +1 -1
- package/dist/knowledge/guard-design-patterns.d.ts +1 -1
- package/dist/knowledge/guard-design-patterns.js +1 -1
- package/dist/knowledge/guard-field-cognition.js +1 -1
- package/dist/knowledge/guard-leg-map.d.ts +5 -0
- package/dist/knowledge/guard-leg-map.js +1 -0
- package/dist/knowledge/guard-lint.js +1 -1
- package/dist/knowledge/guard-puzzle.js +1 -1
- package/dist/knowledge/guard-render.js +1 -1
- package/dist/knowledge/guard-risk.js +1 -1
- package/dist/knowledge/guard-submission-brief.d.ts +5 -0
- package/dist/knowledge/guard-submission-brief.js +1 -1
- package/dist/knowledge/guard-submission-prompt.d.ts +2 -1
- package/dist/knowledge/guard-submission-prompt.js +1 -1
- package/dist/knowledge/guard-templates.d.ts +1 -1
- package/dist/knowledge/guard-templates.js +1 -1
- package/dist/knowledge/guard-translation.js +1 -1
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-generalizer.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/industry-strategy.js +1 -1
- package/dist/knowledge/jsonrpc-enum.js +1 -1
- package/dist/knowledge/onchain-constants.d.ts +4 -2
- package/dist/knowledge/onchain-constants.js +1 -1
- package/dist/knowledge/order-ledger.d.ts +1 -1
- package/dist/knowledge/order-ledger.js +1 -1
- package/dist/knowledge/order-puzzle.d.ts +3 -0
- package/dist/knowledge/order-risk.d.ts +1 -1
- package/dist/knowledge/passport-ledger.d.ts +12 -0
- package/dist/knowledge/passport-ledger.js +1 -1
- package/dist/knowledge/payment-tracker.js +1 -1
- package/dist/knowledge/protocol-facts.d.ts +1 -0
- package/dist/knowledge/protocol-facts.js +1 -1
- package/dist/knowledge/repository-write-semantics.d.ts +1 -1
- package/dist/knowledge/repository-write-semantics.js +1 -1
- package/dist/knowledge/reward-ledger.js +1 -1
- package/dist/knowledge/reward-puzzle.d.ts +1 -1
- package/dist/knowledge/reward-risk.d.ts +1 -1
- package/dist/knowledge/scenario-modes.d.ts +2 -2
- package/dist/knowledge/scenario-modes.js +1 -1
- package/dist/knowledge/scenario-topology.js +1 -1
- package/dist/knowledge/service-ledger.d.ts +14 -0
- package/dist/knowledge/service-ledger.js +1 -1
- package/dist/knowledge/strategy-manuals.js +1 -1
- package/dist/knowledge/template-index.d.ts +19 -0
- package/dist/knowledge/template-index.js +1 -0
- package/dist/knowledge/template-loader.d.ts +36 -0
- package/dist/knowledge/template-loader.js +1 -1
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/template-scanner.d.ts +11 -0
- package/dist/knowledge/template-scanner.js +1 -1
- package/dist/knowledge/tool-constraints.js +1 -1
- package/dist/knowledge/workflow-guidance.d.ts +2 -0
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/participation/allocation-advice.d.ts +8 -1
- package/dist/participation/allocation-advice.js +1 -1
- package/dist/participation/game-context.d.ts +25 -0
- package/dist/participation/game-context.js +1 -0
- package/dist/participation/node-action-advisor.d.ts +64 -0
- package/dist/participation/node-action-advisor.js +1 -0
- package/dist/participation/radar-core.d.ts +1 -0
- package/dist/participation/radar-core.js +1 -1
- package/dist/persona/defaults.js +1 -1
- package/dist/persona/topology-focus.js +1 -1
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/game-theory.d.ts +4 -1
- package/dist/playbooks/service-build/game-theory.js +1 -1
- package/dist/playbooks/service-build/machine-panorama.js +1 -1
- package/dist/playbooks/service-build/merchant-guide.d.ts +26 -1
- package/dist/playbooks/service-build/merchant-guide.js +1 -1
- package/dist/playbooks/service-build/migration-planner.d.ts +2 -2
- package/dist/playbooks/service-build/migration-planner.js +1 -1
- package/dist/playbooks/service-build/object-panorama.d.ts +13 -1
- package/dist/playbooks/service-build/object-panorama.js +1 -1
- package/dist/playbooks/service-build/participation-radar.js +1 -1
- package/dist/playbooks/service-build/pipeline-actions.d.ts +4 -1
- package/dist/playbooks/service-build/pipeline-actions.js +1 -1
- package/dist/playbooks/service-build/relationship-profile.js +1 -1
- package/dist/playbooks/service-build/service-panorama.d.ts +12 -0
- package/dist/playbooks/service-build/service-panorama.js +1 -1
- package/dist/playbooks/service-build/service-quote.js +1 -1
- package/dist/playbooks/service-build/service-quote.spec.js +1 -1
- package/dist/relationship/derivation.d.ts +1 -1
- package/dist/review/index.js +1 -1
- package/dist/review/repository.js +1 -1
- package/dist/role/intent.d.ts +23 -0
- package/dist/role/intent.js +1 -0
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/benchmark-migration/index.d.ts +39 -0
- package/dist/schema/benchmark-migration/index.js +1 -1
- package/dist/schema/call/allocation.d.ts +49 -3
- package/dist/schema/call/allocation.js +1 -1
- package/dist/schema/call/arbitration.js +1 -1
- package/dist/schema/call/base.d.ts +52 -0
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/bridge.d.ts +3 -0
- package/dist/schema/call/contact.js +1 -1
- package/dist/schema/call/error-codes.d.ts +1 -1
- package/dist/schema/call/error-codes.js +1 -1
- package/dist/schema/call/guard.js +1 -1
- package/dist/schema/call/handler.js +1 -1
- package/dist/schema/call/machine.d.ts +10 -0
- package/dist/schema/call/machine.js +1 -1
- package/dist/schema/call/order.d.ts +2 -0
- package/dist/schema/call/order.js +1 -1
- package/dist/schema/call/progress.d.ts +6 -3
- package/dist/schema/call/progress.js +1 -1
- package/dist/schema/call/repository.d.ts +4 -0
- package/dist/schema/call/repository.js +1 -1
- package/dist/schema/call/reward.d.ts +2 -2
- package/dist/schema/call/reward.js +1 -1
- package/dist/schema/call/semantic.d.ts +6 -0
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +42 -4
- package/dist/schema/call/service.js +1 -1
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/goal/index.d.ts +54 -0
- package/dist/schema/goal/planning.d.ts +86 -0
- package/dist/schema/goal/planning.js +1 -1
- package/dist/schema/keeper/index.d.ts +2 -0
- package/dist/schema/local/index.d.ts +72 -0
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/messenger/index.d.ts +2 -0
- package/dist/schema/operations.d.ts +46 -5
- package/dist/schema/operations.js +1 -1
- package/dist/schema/persona/index.d.ts +484 -0
- package/dist/schema/query/bi.d.ts +4 -0
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +84 -60
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-version.d.ts +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/account_operation.output.json +41 -10
- package/dist/schemas/account_operation.schema.json +1 -1
- package/dist/schemas/benchmark_migration_operation.output.json +8 -5
- package/dist/schemas/benchmark_migration_operation.schema.json +91 -3
- package/dist/schemas/bridge_operation.output.json +13 -7
- package/dist/schemas/goal_operation.schema.json +94 -0
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/keeper_operation.output.json +12 -7
- package/dist/schemas/local_cache_operation.output.json +34 -7
- package/dist/schemas/local_cache_operation.schema.json +16 -1
- package/dist/schemas/local_history_operation.output.json +13 -7
- package/dist/schemas/local_info_operation.output.json +13 -7
- package/dist/schemas/local_info_operation.schema.json +5 -1
- package/dist/schemas/local_mark_operation.output.json +13 -7
- package/dist/schemas/messenger_operation.output.json +12 -7
- package/dist/schemas/monitor_events.output.json +12 -7
- package/dist/schemas/monitor_subscription.output.json +12 -7
- package/dist/schemas/onchain_events.output.json +67 -18
- package/dist/schemas/onchain_events.schema.json +4 -0
- package/dist/schemas/onchain_operations.output.json +81 -24
- package/dist/schemas/onchain_operations.schema.json +531 -126
- package/dist/schemas/onchain_operations_allocation.schema.json +294 -6
- package/dist/schemas/onchain_operations_arbitration.schema.json +3 -3
- package/dist/schemas/onchain_operations_contact.schema.json +2 -2
- package/dist/schemas/onchain_operations_demand.schema.json +3 -3
- package/dist/schemas/onchain_operations_gen_passport.schema.json +1 -1
- package/dist/schemas/onchain_operations_guard.schema.json +99 -63
- package/dist/schemas/onchain_operations_machine.schema.json +10 -1
- package/dist/schemas/onchain_operations_order.schema.json +8 -4
- package/dist/schemas/onchain_operations_progress.schema.json +8 -4
- package/dist/schemas/onchain_operations_proof.schema.json +1 -1
- package/dist/schemas/onchain_operations_repository.schema.json +6 -2
- package/dist/schemas/onchain_operations_reward.schema.json +8 -8
- package/dist/schemas/onchain_operations_service.schema.json +81 -21
- package/dist/schemas/onchain_operations_treasury.schema.json +7 -7
- package/dist/schemas/onchain_table_data.output.json +16 -7
- package/dist/schemas/persona_operation.output.json +1387 -0
- package/dist/schemas/persona_operation.schema.json +219 -0
- package/dist/schemas/query_toolkit.output.json +115 -64
- package/dist/schemas/query_toolkit.schema.json +8 -0
- package/dist/schemas/workflow_operation.schema.json +1 -1
- package/dist/tools/handlers/benchmark-migration.js +1 -1
- package/dist/tools/handlers/bridge.js +1 -1
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/dispatch-expectations.js +1 -1
- package/dist/tools/handlers/file-export.js +1 -1
- package/dist/tools/handlers/industry-pack.d.ts +1 -0
- package/dist/tools/handlers/industry-pack.js +1 -1
- package/dist/tools/handlers/local.js +1 -1
- package/dist/tools/handlers/messenger.js +1 -1
- package/dist/tools/handlers/onchain-name-registration.d.ts +11 -0
- package/dist/tools/handlers/onchain-name-registration.js +1 -1
- package/dist/tools/handlers/onchain.d.ts +28 -0
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/query.js +1 -1
- package/dist/tools/handlers/review-chain.d.ts +1 -1
- package/dist/tools/handlers/review-chain.js +1 -1
- package/dist/tools/handlers/schema-query.js +1 -1
- package/dist/tools/handlers/workflow.js +1 -1
- package/dist/tools/move-fn-index.gen.js +1 -1
- package/dist/tools/registry/agent.js +1 -1
- package/dist/tools/registry/local.js +1 -1
- package/dist/tools/registry/onchain.js +1 -1
- package/dist/tools/registry/query.js +1 -1
- package/dist/tools/wip-deploy-assist.js +1 -1
- package/dist/tools/wrap.js +1 -1
- package/package.json +3 -3
|
@@ -30,7 +30,7 @@ export interface OrderRiskCheckContext {
|
|
|
30
30
|
current_dispute_count?: number;
|
|
31
31
|
claimed_by_set?: boolean;
|
|
32
32
|
progress_bound?: boolean;
|
|
33
|
-
operation?: "set_agent_list" | "update_required_info" | "progress_advance" | "arb_confirm" | "arb_objection" | "arb_claim_compensation" | "receive" | "transfer_to" | "service_buy";
|
|
33
|
+
operation?: "set_agent_list" | "update_required_info" | "progress_advance" | "arb_confirm" | "arb_objection" | "arb_case_conclude" | "arb_claim_compensation" | "receive" | "transfer_to" | "service_buy";
|
|
34
34
|
items?: {
|
|
35
35
|
name: string;
|
|
36
36
|
price: string;
|
|
@@ -32,6 +32,18 @@ export declare const PASSPORT_ERROR_CODES: {
|
|
|
32
32
|
readonly E_SUBMISSION_NOT_FOUND: 10;
|
|
33
33
|
readonly E_DIGEST_NOT_MATCH: 11;
|
|
34
34
|
};
|
|
35
|
+
export declare const PASSPORT_VERIFY_MODES: {
|
|
36
|
+
readonly verify: {
|
|
37
|
+
readonly sdk_entry: "verify (passport.ts)";
|
|
38
|
+
readonly on_false: "returns false — no abort; the evidence card is still minted and the result recorded";
|
|
39
|
+
readonly use_when: "the false branch is handled downstream (guard rails read the recorded result)";
|
|
40
|
+
};
|
|
41
|
+
readonly verify_strict: {
|
|
42
|
+
readonly sdk_entry: "verify_strict (SDK public API)";
|
|
43
|
+
readonly on_false: "aborts E_VERIFY_FAILED = 7 and the transaction rolls back";
|
|
44
|
+
readonly use_when: "the transaction must NOT succeed on a failed verification";
|
|
45
|
+
};
|
|
46
|
+
};
|
|
35
47
|
export declare const PASSPORT_SCENARIOS: PassportScenario[];
|
|
36
48
|
export declare const PASSPORT_LEDGER_VERSION = "1.0.0";
|
|
37
49
|
export declare function getAllScenarios(): PassportScenario[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MAX_GUARD_COUNT_PASSPORT,MAX_SUBMISSION_SIZE_PASSPORT}from'@wowok/wowok';export{MAX_GUARD_COUNT_PASSPORT};export{MAX_SUBMISSION_SIZE_PASSPORT};export const PASSPORT_ERROR_CODES={'E_GUARD_COUNT_EXCEEDED':0x1,'E_RELIES_GUARD_NOT_ADDED':0x2,'E_SUBMISSION_SIZE_EXCEEDED':0x3,'E_HAS_VERIFIED':0x4,'E_NOT_VERIFIED':0x5,'E_NOT_IMPACK_GUARD':0x6,'E_VERIFY_FAILED':0x7,'E_TX_NOT_MATCH':0x8,'E_IMPACK_GUARD_NOT_FOUND':0x9,'E_SUBMISSION_NOT_FOUND':0xa,'E_DIGEST_NOT_MATCH':0xb};export const PASSPORT_SCENARIOS=[{'id':'passport_service_buy','name':'Service\x20buy\x20with\x20Passport\x20(verify\x20buy_guard)','consumer_object':'Service','sdk_entry':'passport-verified\x20buy','passport_purpose':'Verify\x20customer\x27s\x20eligibility\x20to\x20buy\x20(buy_guard)','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer','merchant'],'risk_notes':['tx_hash\x20binding\x20requires\x20Passport\x20creation\x20+\x20buy\x20in\x20the\x20same\x20transaction','Service.buy_guard\x20is\x20typically\x20configured\x20as\x20impack=true'],'dependencies':['Service','Guard']},{'id':'passport_arbitration_compensation','name':'Order\x20arbitration\x20compensation\x20(verify\x20arb\x20permission)','consumer_object':'Order','sdk_entry':'arb_claim_compensation_with_passport','passport_purpose':'Verify\x20customer\x27s\x20right\x20to\x20claim\x20arbitration\x20compensation','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer','arbitrator'],'risk_notes':['Compensation\x20is\x20one-shot\x20—\x20Passport.tx_hash\x20prevents\x20replay','The\x20impack\x20Guard\x20is\x20hard-verified\x20(E_VERIFY_FAILED\x20if\x20mismatch)'],'dependencies':['Order','Arbitration','Guard']},{'id':'passport_progress_next','name':'Progress\x20advance\x20(verify\x20Forward.guard)','consumer_object':'Progress','sdk_entry':'passport-verified\x20node\x20advance','passport_purpose':'Verify\x20that\x20the\x20next\x20node\x27s\x20Forward.guard\x20passes\x20before\x20advancing','typical_impack':'impack','uses_relies':!![],'lifecycle_stage':'use','participants':['customer','merchant'],'risk_notes':['Forward.guard\x20may\x20have\x20relies\x20on\x20previous\x20node\x20Guards\x20(AND/OR\x20logic)','Relies\x20Guards\x20MUST\x20be\x20added\x20in\x20topological\x20order\x20(E_RELIES_GUARD_NOT_ADDED)'],'dependencies':['Progress','Machine','Guard']},{'id':'passport_arbitration_dispute','name':'Arbitration\x20dispute\x20(verify\x20usage_guard)','consumer_object':'Arbitration','sdk_entry':'passport-verified\x20dispute','passport_purpose':'Verify\x20usage_guard\x20before\x20opening\x20a\x20dispute\x20case','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer','arbitrator'],'risk_notes':['Arbitration.usage_guard\x20determines\x20who\x20may\x20open\x20disputes','Dispute\x20must\x20be\x20filed\x20within\x20the\x20same\x20transaction\x20that\x20created\x20the\x20Passport'],'dependencies':['Arbitration','Guard']},{'id':'passport_arbitration_vote','name':'Arbitration\x20vote\x20(resolve\x20VoteValue::GuardIdentifier\x20weight)','consumer_object':'Arbitration','sdk_entry':'passport-verified\x20vote','passport_purpose':'Resolve\x20voting\x20weight\x20from\x20Passport\x20submission\x20(GuardIdentifier)','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['arbitrator'],'risk_notes':['Voting\x20weight\x20is\x20read\x20from\x20the\x20Passport\x20submission\x20for\x20the\x20(guard,\x20identifier)\x20pair','Identifier\x20type\x20must\x20match\x20the\x20voting_guard\x27s\x20expected\x20type'],'dependencies':['Arbitration','Guard']},{'id':'passport_reward_claim','name':'Reward\x20claim\x20(verify\x20Guard\x20+\x20resolve\x20recipient/amount)','consumer_object':'Reward','sdk_entry':'claim_with_passport','passport_purpose':'Verify\x20claim\x20eligibility\x20and\x20resolve\x20dynamic\x20recipient/amount\x20from\x20submission','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer'],'risk_notes':['Guard\x20may\x20use\x20GuardIdentifier\x20to\x20dynamically\x20resolve\x20recipient\x20address','Claim\x20is\x20one-shot\x20per\x20Passport\x20(tx_hash\x20binding\x20prevents\x20replay)'],'dependencies':['Reward','Guard']},{'id':'passport_permission_assert','name':'Permission\x20assert\x20(Guard\x20verification\x20replaces\x20owner\x20check)','consumer_object':'Permission','sdk_entry':'passport-verified\x20assert','passport_purpose':'Use\x20Guard\x20verification\x20as\x20a\x20dynamic\x20substitute\x20for\x20static\x20owner/admin\x20check','typical_impack':'impack','uses_relies':!![],'lifecycle_stage':'use','participants':['customer','platform'],'risk_notes':['Allows\x20composing\x20multi-factor\x20authorization\x20via\x20relies\x20logic','Permission\x20assert\x20bypass\x20requires\x20the\x20Passport\x20to\x20be\x20verified\x20in\x20the\x20same\x20tx'],'dependencies':['Permission','Guard']},{'id':'passport_allocation_alloc','name':'Allocation\x20distribute\x20(verify\x20alloc\x20permission\x20via\x20Guard)','consumer_object':'Allocation','sdk_entry':'alloc_with_passport','passport_purpose':'Verify\x20the\x20caller\x27s\x20right\x20to\x20trigger\x20allocation\x20distribution','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer','merchant'],'risk_notes':['Caller-specified\x20guard:\x20Passport\x20must\x20contain\x20the\x20specific\x20Guard\x20referenced\x20by\x20alloc_by_guard','Hard\x20verification\x20applies\x20(E_VERIFY_FAILED\x20if\x20the\x20impack\x20Guard\x20fails)'],'dependencies':['Allocation','Guard']},{'id':'passport_treasury_withdraw','name':'Treasury\x20withdraw\x20(verify\x20withdraw\x20permission)','consumer_object':'Treasury','sdk_entry':'passport-verified\x20withdraw','passport_purpose':'Verify\x20the\x20caller\x27s\x20right\x20to\x20withdraw\x20funds\x20from\x20Treasury','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer','platform'],'risk_notes':['Treasury\x20withdraw\x20is\x20high-value\x20—\x20strongly\x20recommend\x20multi-Guard\x20relies\x20(AND)','Guard\x20should\x20bind\x20Signer\x20to\x20prevent\x20unauthorized\x20withdraw'],'dependencies':['Treasury','Guard']},{'id':'passport_repository_query','name':'Repository\x20query\x20(verify\x20read\x20permission\x20+\x20extract\x20data)','consumer_object':'Repository','sdk_entry':'query_with_passport','passport_purpose':'Verify\x20read\x20permission\x20and\x20extract\x20submission\x20data\x20for\x20repository\x20write','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer','merchant'],'risk_notes':['Repository\x20policies\x20may\x20extract\x20data\x20from\x20Passport\x20submission\x20(quote_guard\x20pattern)','Submitted\x20data\x20must\x20be\x20≤\x20256\x20bytes\x20per\x20submission\x20entry'],'dependencies':['Repository','Guard']},{'id':'passport_demand_submit','name':'Demand\x20submit\x20(verify\x20demand\x20permission)','consumer_object':'Demand','sdk_entry':'demand_with_passport','passport_purpose':'Verify\x20the\x20caller\x27s\x20right\x20to\x20submit\x20or\x20match\x20a\x20Demand','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer','merchant'],'risk_notes':['Demand.guard\x20may\x20filter\x20which\x20submissions\x20are\x20eligible\x20for\x20matching','Demand\x20uses\x20MAX_GUARD_COUNT_DEMAND=20\x20(separate\x20constant,\x20do\x20not\x20confuse)'],'dependencies':['Demand','Guard']}];export const PASSPORT_LEDGER_VERSION='1.0.0';export function getAllScenarios(){return[...PASSPORT_SCENARIOS];}export function getScenariosCount(){return PASSPORT_SCENARIOS['length'];}export function findScenarioById(a){return PASSPORT_SCENARIOS['find'](b=>b['id']===a);}export function getScenariosByConsumer(a){return PASSPORT_SCENARIOS['filter'](b=>b['consumer_object']===a);}export function getScenariosUsingRelies(){return PASSPORT_SCENARIOS['filter'](a=>a['uses_relies']);}export function inferScenarioFromIntent(a){const b=a['toLowerCase']();if(b['includes']('buy')||b['includes']('purchase')||b['includes']('service'))return findScenarioById('passport_service_buy');if(b['includes']('compensation')||b['includes']('compensate')||b['includes']('arb_claim'))return findScenarioById('passport_arbitration_compensation');if(b['includes']('progress')||b['includes']('advance')||b['includes']('next'))return findScenarioById('passport_progress_next');if(b['includes']('dispute')||b['includes']('grievance'))return findScenarioById('passport_arbitration_dispute');if(b['includes']('vote')||b['includes']('ballot')||b['includes']('voting'))return findScenarioById('passport_arbitration_vote');if(b['includes']('reward')||b['includes']('claim')||b['includes']('redeem')||b['includes']('bonus'))return findScenarioById('passport_reward_claim');if(b['includes']('permission')||b['includes']('assert')||b['includes']('authorize'))return findScenarioById('passport_permission_assert');if(b['includes']('alloc')||b['includes']('distribute')||b['includes']('distribution'))return findScenarioById('passport_allocation_alloc');if(b['includes']('withdraw')||b['includes']('extract')||b['includes']('treasury'))return findScenarioById('passport_treasury_withdraw');if(b['includes']('repository')||b['includes']('query')||b['includes']('lookup'))return findScenarioById('passport_repository_query');if(b['includes']('demand')||b['includes']('requirement'))return findScenarioById('passport_demand_submit');return undefined;}export function impackRoleFromBoolean(a){return a?'impack':'non_impack';}export function impackRoleToBoolean(a){return a==='impack';}export function reliesLogicFromBoolean(a){return a?'AND':'OR';}export function reliesLogicToBoolean(a){return a==='AND';}export function getErrorName(a){for(const [b,d]of Object['entries'](PASSPORT_ERROR_CODES)){if(d===a)return b;}return undefined;}export function getErrorDescription(a){const b={0x1:'Guard\x20count\x20exceeds\x20MAX_GUARD_COUNT_PASSPORT\x20(20)',0x2:'Relied\x20Guard\x20not\x20yet\x20added\x20to\x20Passport\x20(topological\x20order\x20required)',0x3:'Submission\x20serialized\x20size\x20exceeds\x20MAX_SUBMISSION_SIZE_PASSPORT\x20(256\x20bytes)',0x4:'Passport\x20already\x20verified\x20—\x20verify\x20is\x20one-time,\x20configuration\x20is\x20now\x20immutable',0x5:'result()\x20called\x20before\x20verify()\x20—\x20Passport\x20has\x20not\x20been\x20verified\x20yet',0x6:'Hard\x20verification\x20called\x20on\x20a\x20non-impack\x20Guard\x20—\x20only\x20impack\x20Guards\x20can\x20be\x20hard-verified',0x7:'Guard\x20/\x20Permission\x20hard-verification\x20called\x20when\x20the\x20overall\x20result=false',0x8:'result()\x20called\x20from\x20a\x20different\x20transaction\x20—\x20tx_hash\x20does\x20not\x20match\x20current\x20tx',0x9:'verify()\x20found\x20no\x20impack\x20Guard\x20—\x20at\x20least\x201\x20impack=true\x20Guard\x20is\x20required',0xa:'No\x20submission\x20entry\x20found\x20for\x20the\x20(guard,\x20identifier)\x20pair',0xb:'Guard\x20add\x20/\x20verify\x20/\x20Guard\x20clear\x20called\x20from\x20a\x20different\x20transaction\x20—\x20tx_hash\x20mismatch'};return b[a];}
|
|
1
|
+
import{MAX_GUARD_COUNT_PASSPORT,MAX_SUBMISSION_SIZE_PASSPORT}from'@wowok/wowok';export{MAX_GUARD_COUNT_PASSPORT};export{MAX_SUBMISSION_SIZE_PASSPORT};export const PASSPORT_ERROR_CODES={'E_GUARD_COUNT_EXCEEDED':0x1,'E_RELIES_GUARD_NOT_ADDED':0x2,'E_SUBMISSION_SIZE_EXCEEDED':0x3,'E_HAS_VERIFIED':0x4,'E_NOT_VERIFIED':0x5,'E_NOT_IMPACK_GUARD':0x6,'E_VERIFY_FAILED':0x7,'E_TX_NOT_MATCH':0x8,'E_IMPACK_GUARD_NOT_FOUND':0x9,'E_SUBMISSION_NOT_FOUND':0xa,'E_DIGEST_NOT_MATCH':0xb};export const PASSPORT_VERIFY_MODES={'verify':{'sdk_entry':'verify\x20(passport.ts)','on_false':'returns\x20false\x20—\x20no\x20abort;\x20the\x20evidence\x20card\x20is\x20still\x20minted\x20and\x20the\x20result\x20recorded','use_when':'the\x20false\x20branch\x20is\x20handled\x20downstream\x20(guard\x20rails\x20read\x20the\x20recorded\x20result)'},'verify_strict':{'sdk_entry':'verify_strict\x20(SDK\x20public\x20API)','on_false':'aborts\x20E_VERIFY_FAILED\x20=\x207\x20and\x20the\x20transaction\x20rolls\x20back','use_when':'the\x20transaction\x20must\x20NOT\x20succeed\x20on\x20a\x20failed\x20verification'}};export const PASSPORT_SCENARIOS=[{'id':'passport_service_buy','name':'Service\x20buy\x20with\x20Passport\x20(verify\x20buy_guard)','consumer_object':'Service','sdk_entry':'passport-verified\x20buy','passport_purpose':'Verify\x20customer\x27s\x20eligibility\x20to\x20buy\x20(buy_guard)','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer','merchant'],'risk_notes':['tx_hash\x20binding\x20requires\x20Passport\x20creation\x20+\x20buy\x20in\x20the\x20same\x20transaction','Service.buy_guard\x20is\x20typically\x20configured\x20as\x20impack=true'],'dependencies':['Service','Guard']},{'id':'passport_arbitration_compensation','name':'Order\x20arbitration\x20compensation\x20(verify\x20arb\x20permission)','consumer_object':'Order','sdk_entry':'arb_claim_compensation_with_passport','passport_purpose':'Verify\x20customer\x27s\x20right\x20to\x20claim\x20arbitration\x20compensation','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer','arbitrator'],'risk_notes':['Compensation\x20is\x20one-shot\x20—\x20Passport.tx_hash\x20prevents\x20replay','The\x20impack\x20Guard\x20is\x20hard-verified\x20(E_VERIFY_FAILED\x20if\x20mismatch)'],'dependencies':['Order','Arbitration','Guard']},{'id':'passport_progress_next','name':'Progress\x20advance\x20(verify\x20Forward.guard)','consumer_object':'Progress','sdk_entry':'passport-verified\x20node\x20advance','passport_purpose':'Verify\x20that\x20the\x20next\x20node\x27s\x20Forward.guard\x20passes\x20before\x20advancing','typical_impack':'impack','uses_relies':!![],'lifecycle_stage':'use','participants':['customer','merchant'],'risk_notes':['Forward.guard\x20may\x20have\x20relies\x20on\x20previous\x20node\x20Guards\x20(AND/OR\x20logic)','Relies\x20Guards\x20MUST\x20be\x20added\x20in\x20topological\x20order\x20(E_RELIES_GUARD_NOT_ADDED)'],'dependencies':['Progress','Machine','Guard']},{'id':'passport_arbitration_dispute','name':'Arbitration\x20dispute\x20(verify\x20usage_guard)','consumer_object':'Arbitration','sdk_entry':'passport-verified\x20dispute','passport_purpose':'Verify\x20usage_guard\x20before\x20opening\x20a\x20dispute\x20case','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer','arbitrator'],'risk_notes':['Arbitration.usage_guard\x20determines\x20who\x20may\x20open\x20disputes','Dispute\x20must\x20be\x20filed\x20within\x20the\x20same\x20transaction\x20that\x20created\x20the\x20Passport'],'dependencies':['Arbitration','Guard']},{'id':'passport_arbitration_vote','name':'Arbitration\x20vote\x20(resolve\x20VoteValue::GuardIdentifier\x20weight)','consumer_object':'Arbitration','sdk_entry':'passport-verified\x20vote','passport_purpose':'Resolve\x20voting\x20weight\x20from\x20Passport\x20submission\x20(GuardIdentifier)','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['arbitrator'],'risk_notes':['Voting\x20weight\x20is\x20read\x20from\x20the\x20Passport\x20submission\x20for\x20the\x20(guard,\x20identifier)\x20pair','Identifier\x20type\x20must\x20match\x20the\x20voting_guard\x27s\x20expected\x20type'],'dependencies':['Arbitration','Guard']},{'id':'passport_reward_claim','name':'Reward\x20claim\x20(verify\x20Guard\x20+\x20resolve\x20recipient/amount)','consumer_object':'Reward','sdk_entry':'claim_with_passport','passport_purpose':'Verify\x20claim\x20eligibility\x20and\x20resolve\x20dynamic\x20recipient/amount\x20from\x20submission','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer'],'risk_notes':['Guard\x20may\x20use\x20GuardIdentifier\x20to\x20dynamically\x20resolve\x20recipient\x20address','Claim\x20is\x20one-shot\x20per\x20Passport\x20(tx_hash\x20binding\x20prevents\x20replay)'],'dependencies':['Reward','Guard']},{'id':'passport_permission_assert','name':'Permission\x20assert\x20(Guard\x20verification\x20replaces\x20owner\x20check)','consumer_object':'Permission','sdk_entry':'passport-verified\x20assert','passport_purpose':'Use\x20Guard\x20verification\x20as\x20a\x20dynamic\x20substitute\x20for\x20static\x20owner/admin\x20check','typical_impack':'impack','uses_relies':!![],'lifecycle_stage':'use','participants':['customer','platform'],'risk_notes':['Allows\x20composing\x20multi-factor\x20authorization\x20via\x20relies\x20logic','Permission\x20assert\x20bypass\x20requires\x20the\x20Passport\x20to\x20be\x20verified\x20in\x20the\x20same\x20tx'],'dependencies':['Permission','Guard']},{'id':'passport_allocation_alloc','name':'Allocation\x20distribute\x20(verify\x20alloc\x20permission\x20via\x20Guard)','consumer_object':'Allocation','sdk_entry':'alloc_with_passport','passport_purpose':'Verify\x20the\x20caller\x27s\x20right\x20to\x20trigger\x20allocation\x20distribution','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer','merchant'],'risk_notes':['Caller-specified\x20guard:\x20Passport\x20must\x20contain\x20the\x20specific\x20Guard\x20referenced\x20by\x20alloc_by_guard','Hard\x20verification\x20applies\x20(E_VERIFY_FAILED\x20if\x20the\x20impack\x20Guard\x20fails)'],'dependencies':['Allocation','Guard']},{'id':'passport_treasury_withdraw','name':'Treasury\x20withdraw\x20(verify\x20withdraw\x20permission)','consumer_object':'Treasury','sdk_entry':'passport-verified\x20withdraw','passport_purpose':'Verify\x20the\x20caller\x27s\x20right\x20to\x20withdraw\x20funds\x20from\x20Treasury','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer','platform'],'risk_notes':['Treasury\x20withdraw\x20is\x20high-value\x20—\x20strongly\x20recommend\x20multi-Guard\x20relies\x20(AND)','Guard\x20should\x20bind\x20Signer\x20to\x20prevent\x20unauthorized\x20withdraw'],'dependencies':['Treasury','Guard']},{'id':'passport_repository_query','name':'Repository\x20query\x20(verify\x20read\x20permission\x20+\x20extract\x20data)','consumer_object':'Repository','sdk_entry':'query_with_passport','passport_purpose':'Verify\x20read\x20permission\x20and\x20extract\x20submission\x20data\x20for\x20repository\x20write','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer','merchant'],'risk_notes':['Repository\x20policies\x20may\x20extract\x20data\x20from\x20Passport\x20submission\x20(quote_guard\x20pattern)','Submitted\x20data\x20must\x20be\x20≤\x20256\x20bytes\x20per\x20submission\x20entry'],'dependencies':['Repository','Guard']},{'id':'passport_demand_submit','name':'Demand\x20submit\x20(verify\x20demand\x20permission)','consumer_object':'Demand','sdk_entry':'demand_with_passport','passport_purpose':'Verify\x20the\x20caller\x27s\x20right\x20to\x20submit\x20or\x20match\x20a\x20Demand','typical_impack':'impack','uses_relies':![],'lifecycle_stage':'use','participants':['customer','merchant'],'risk_notes':['Demand.guard\x20may\x20filter\x20which\x20submissions\x20are\x20eligible\x20for\x20matching','Demand\x20uses\x20MAX_GUARD_COUNT_DEMAND=20\x20(separate\x20constant,\x20do\x20not\x20confuse)'],'dependencies':['Demand','Guard']}];export const PASSPORT_LEDGER_VERSION='1.0.0';export function getAllScenarios(){return[...PASSPORT_SCENARIOS];}export function getScenariosCount(){return PASSPORT_SCENARIOS['length'];}export function findScenarioById(a){return PASSPORT_SCENARIOS['find'](b=>b['id']===a);}export function getScenariosByConsumer(a){return PASSPORT_SCENARIOS['filter'](b=>b['consumer_object']===a);}export function getScenariosUsingRelies(){return PASSPORT_SCENARIOS['filter'](a=>a['uses_relies']);}export function inferScenarioFromIntent(a){const b=a['toLowerCase']();if(b['includes']('buy')||b['includes']('purchase')||b['includes']('service'))return findScenarioById('passport_service_buy');if(b['includes']('compensation')||b['includes']('compensate')||b['includes']('arb_claim'))return findScenarioById('passport_arbitration_compensation');if(b['includes']('progress')||b['includes']('advance')||b['includes']('next'))return findScenarioById('passport_progress_next');if(b['includes']('dispute')||b['includes']('grievance'))return findScenarioById('passport_arbitration_dispute');if(b['includes']('vote')||b['includes']('ballot')||b['includes']('voting'))return findScenarioById('passport_arbitration_vote');if(b['includes']('reward')||b['includes']('claim')||b['includes']('redeem')||b['includes']('bonus'))return findScenarioById('passport_reward_claim');if(b['includes']('permission')||b['includes']('assert')||b['includes']('authorize'))return findScenarioById('passport_permission_assert');if(b['includes']('alloc')||b['includes']('distribute')||b['includes']('distribution'))return findScenarioById('passport_allocation_alloc');if(b['includes']('withdraw')||b['includes']('extract')||b['includes']('treasury'))return findScenarioById('passport_treasury_withdraw');if(b['includes']('repository')||b['includes']('query')||b['includes']('lookup'))return findScenarioById('passport_repository_query');if(b['includes']('demand')||b['includes']('requirement'))return findScenarioById('passport_demand_submit');return undefined;}export function impackRoleFromBoolean(a){return a?'impack':'non_impack';}export function impackRoleToBoolean(a){return a==='impack';}export function reliesLogicFromBoolean(a){return a?'AND':'OR';}export function reliesLogicToBoolean(a){return a==='AND';}export function getErrorName(a){for(const [b,d]of Object['entries'](PASSPORT_ERROR_CODES)){if(d===a)return b;}return undefined;}export function getErrorDescription(a){const b={0x1:'Guard\x20count\x20exceeds\x20MAX_GUARD_COUNT_PASSPORT\x20(20)',0x2:'Relied\x20Guard\x20not\x20yet\x20added\x20to\x20Passport\x20(topological\x20order\x20required)',0x3:'Submission\x20serialized\x20size\x20exceeds\x20MAX_SUBMISSION_SIZE_PASSPORT\x20(256\x20bytes)',0x4:'Passport\x20already\x20verified\x20—\x20verify\x20is\x20one-time,\x20configuration\x20is\x20now\x20immutable',0x5:'result()\x20called\x20before\x20verify()\x20—\x20Passport\x20has\x20not\x20been\x20verified\x20yet',0x6:'Hard\x20verification\x20called\x20on\x20a\x20non-impack\x20Guard\x20—\x20only\x20impack\x20Guards\x20can\x20be\x20hard-verified',0x7:'Guard\x20/\x20Permission\x20hard-verification\x20called\x20when\x20the\x20overall\x20result=false',0x8:'result()\x20called\x20from\x20a\x20different\x20transaction\x20—\x20tx_hash\x20does\x20not\x20match\x20current\x20tx',0x9:'verify()\x20found\x20no\x20impack\x20Guard\x20—\x20at\x20least\x201\x20impack=true\x20Guard\x20is\x20required',0xa:'No\x20submission\x20entry\x20found\x20for\x20the\x20(guard,\x20identifier)\x20pair',0xb:'Guard\x20add\x20/\x20verify\x20/\x20Guard\x20clear\x20called\x20from\x20a\x20different\x20transaction\x20—\x20tx_hash\x20mismatch'};return b[a];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{query_events,query_received,query_objects,objectTypeFromAddress,ObjectType}from'@wowok/wowok';import{driveabilityOf}from'./recipient-constraint.js';const OBJECT_BATCH=0x32,EVENT_PAGE=0x32;export function paymentRelations(b,c){const d=c['toLowerCase'](),e=[];if((b['record']??[])['some'](f=>String(f['recipient'])['toLowerCase']()===d))e['push']('incoming');if(String(b['sender']??'')['toLowerCase']()===d)e['push']('creator');if(String(b['info']?.['for_object']??'')['toLowerCase']()===d)e['push']('for_object');if(String(b['info']?.['for_guard']??'')['toLowerCase']()===d)e['push']('for_guard');if(String(b['from_object']??'')['toLowerCase']()===d)e['push']('from_pool');return e;}export async function scanRecentPaymentEvents(a){const b=a['max_events']??0x64,c=[];let d,e=![];while(c['length']<b&&!e){const f=await query_events({'type':'NewPaymentEvent','order':'descending','limit':Math['min'](EVENT_PAGE,b-c['length']),'cursor':d,'network':a['network'],'no_cache':a['no_cache']}),g=f?.['data']??[];if(g['length']===0x0)break;for(const h of g){c['push'](h);if(a['since_ms']!=null&&Number(h['time']??0x0)<a['since_ms']){e=!![];break;}if(c['length']>=b)break;}if(!f?.['hasNextPage']||!f['nextCursor'])break;d=f['nextCursor'];}return c;}function isUserAddress(b){return b['startsWith']('0x00');}async function fetchObjectsInChunks(a,b){const c=[];for(let d=0x0;d<a['length'];d+=OBJECT_BATCH){const e=await query_objects({'objects':a['slice'](d,d+OBJECT_BATCH),'network':b['network'],'no_cache':b['no_cache']});c['push'](...e['objects']??[]);}return c;}export async function resolveBeneficialOwners(b,c){const d=new Map(),e=[],f=new Set();for(const n of b){const q=String(n??'')['toLowerCase']();if(!q)continue;if(isUserAddress(q)){d['set'](q,q);continue;}if(objectTypeFromAddress(q)===undefined)continue;!f['has'](q)&&(f['add'](q),e['push'](q));}if(e['length']===0x0)return d;const g=await fetchObjectsInChunks(e,c),h=new Map(),i=new Map();for(const r of g){const s=r['object']['toLowerCase']();if(r['type']===ObjectType['Order']||r['type']===ObjectType['Permission']){const t=String(r['builder']??'')['toLowerCase']();if(t)d['set'](s,t);}else{if(r['type']===ObjectType['Progress']){const u=String(r['machine']??'')['toLowerCase']();if(u)h['set'](s,u);}else{const v=String(r['permission']??'')['toLowerCase']();if(v)i['set'](s,v);}}}const j=new Map(),k=[...new Set(h['values']())];if(k['length']>0x0){const w=await fetchObjectsInChunks(k,c);for(const x of w){const y=String(x['permission']??'')['toLowerCase']();if(y)j['set'](x['object']['toLowerCase'](),y);}}const l=new Set(i['values']());for(const z of j['values']())l['add'](z);if(l['size']>0x0){const A=await fetchObjectsInChunks([...l],c),B=new Map();for(const C of A){const D=String(C['builder']??'')['toLowerCase']();if(D)B['set'](C['object']['toLowerCase'](),D);}for(const [E,F]of i){const G=B['get'](F);if(G)d['set'](E,G);}for(const [H,I]of h){const J=j['get'](I);if(!J)continue;const K=B['get'](J);if(K)d['set'](H,K);}}return d;}export function extractionPlanForHolder(a,b){const c=a['toLowerCase']();if(isUserAddress(c))return{'holder':c,'holder_kind':'user','operation':'unwrap\x20the\x20delivered\x20payment\x20wrapper\x20to\x20your\x20own\x20account','anyone_can_submit':![],'settles_to':c,'steps':['Unwrap\x20the\x20delivered\x20payment\x20wrapper\x20with\x20the\x20holder\x20account\x27s\x20signature.','The\x20bare\x20Coin<T>\x20is\x20transferred\x20back\x20to\x20the\x20same\x20account,\x20ready\x20to\x20spend.']};const e=objectTypeFromAddress(c),f=e?driveabilityOf(e):undefined,g=f?.['receive_entries'][0x0]??'owner-side\x20coin\x20extraction\x20from\x20the\x20'+String(e??'object'),i=b??f?.['funds_settle_to']??'the\x20object\x27s\x20owner';if(f?.['anyone_drivable'])return{'holder':c,'holder_kind':'business_object','operation':g,'anyone_can_submit':!![],'settles_to':i,'steps':['Obtain\x20the\x20Receiving<CoinWrapper<T>>\x20argument\x20from\x20the\x20wrapper\x27s\x20current\x20version\x20and\x20digest\x20returned\x20by\x20query_received.','Build\x20a\x20PTB\x20for\x20the\x20'+g+':\x20arguments\x20(…,\x20wrapper,\x20payment);\x20no\x20permission\x20witness\x20is\x20required.','Anyone\x20may\x20submit;\x20the\x20bare\x20Coin\x20settles\x20to\x20'+i+'.']};return{'holder':c,'holder_kind':'business_object','operation':g,'anyone_can_submit':![],...f?.['permission_index']!=null?{'permission_index':f['permission_index']}:{},'settles_to':i,'steps':['Obtain\x20the\x20Receiving<CoinWrapper<T>>\x20argument\x20from\x20the\x20wrapper\x27s\x20current\x20version\x20and\x20digest\x20returned\x20by\x20query_received.','Build\x20a\x20PTB\x20for\x20the\x20'+g+':\x20arguments\x20(…,\x20permission,\x20wrapper,\x20payment),\x20as\x20a\x20member\x20holding\x20permission\x20index\x20'+(f?.['permission_index']??'?')+',\x20or\x20its\x20passport-gated\x20variant.','The\x20bare\x20Coin\x20settles\x20to\x20'+i+'.']};}export async function pendingWrappersAt(a,b){const c=a['toLowerCase'](),d=await query_received({'name_or_address':{'name_or_address':c},'type':'CoinWrapper','network':b['network'],'no_cache':b['no_cache']});
|
|
1
|
+
import{query_events,query_received,query_objects,objectTypeFromAddress,ObjectType}from'@wowok/wowok';import{driveabilityOf}from'./recipient-constraint.js';import{recoverObjectHeldReceipts}from'../graph/onchain/object-held-receipts.js';const OBJECT_BATCH=0x32,EVENT_PAGE=0x32;export function paymentRelations(b,c){const d=c['toLowerCase'](),e=[];if((b['record']??[])['some'](f=>String(f['recipient'])['toLowerCase']()===d))e['push']('incoming');if(String(b['sender']??'')['toLowerCase']()===d)e['push']('creator');if(String(b['info']?.['for_object']??'')['toLowerCase']()===d)e['push']('for_object');if(String(b['info']?.['for_guard']??'')['toLowerCase']()===d)e['push']('for_guard');if(String(b['from_object']??'')['toLowerCase']()===d)e['push']('from_pool');return e;}export async function scanRecentPaymentEvents(a){const b=a['max_events']??0x64,c=[];let d,e=![];while(c['length']<b&&!e){const f=await query_events({'type':'NewPaymentEvent','order':'descending','limit':Math['min'](EVENT_PAGE,b-c['length']),'cursor':d,'network':a['network'],'no_cache':a['no_cache']}),g=f?.['data']??[];if(g['length']===0x0)break;for(const h of g){c['push'](h);if(a['since_ms']!=null&&Number(h['time']??0x0)<a['since_ms']){e=!![];break;}if(c['length']>=b)break;}if(!f?.['hasNextPage']||!f['nextCursor'])break;d=f['nextCursor'];}return c;}function isUserAddress(b){return b['startsWith']('0x00');}async function fetchObjectsInChunks(a,b){const c=[];for(let d=0x0;d<a['length'];d+=OBJECT_BATCH){const e=await query_objects({'objects':a['slice'](d,d+OBJECT_BATCH),'network':b['network'],'no_cache':b['no_cache']});c['push'](...e['objects']??[]);}return c;}export async function resolveBeneficialOwners(b,c){const d=new Map(),e=[],f=new Set();for(const n of b){const q=String(n??'')['toLowerCase']();if(!q)continue;if(isUserAddress(q)){d['set'](q,q);continue;}if(objectTypeFromAddress(q)===undefined)continue;!f['has'](q)&&(f['add'](q),e['push'](q));}if(e['length']===0x0)return d;const g=await fetchObjectsInChunks(e,c),h=new Map(),i=new Map();for(const r of g){const s=r['object']['toLowerCase']();if(r['type']===ObjectType['Order']||r['type']===ObjectType['Permission']){const t=String(r['builder']??'')['toLowerCase']();if(t)d['set'](s,t);}else{if(r['type']===ObjectType['Progress']){const u=String(r['machine']??'')['toLowerCase']();if(u)h['set'](s,u);}else{const v=String(r['permission']??'')['toLowerCase']();if(v)i['set'](s,v);}}}const j=new Map(),k=[...new Set(h['values']())];if(k['length']>0x0){const w=await fetchObjectsInChunks(k,c);for(const x of w){const y=String(x['permission']??'')['toLowerCase']();if(y)j['set'](x['object']['toLowerCase'](),y);}}const l=new Set(i['values']());for(const z of j['values']())l['add'](z);if(l['size']>0x0){const A=await fetchObjectsInChunks([...l],c),B=new Map();for(const C of A){const D=String(C['builder']??'')['toLowerCase']();if(D)B['set'](C['object']['toLowerCase'](),D);}for(const [E,F]of i){const G=B['get'](F);if(G)d['set'](E,G);}for(const [H,I]of h){const J=j['get'](I);if(!J)continue;const K=B['get'](J);if(K)d['set'](H,K);}}return d;}export function extractionPlanForHolder(a,b){const c=a['toLowerCase']();if(isUserAddress(c))return{'holder':c,'holder_kind':'user','operation':'unwrap\x20the\x20delivered\x20payment\x20wrapper\x20to\x20your\x20own\x20account','anyone_can_submit':![],'settles_to':c,'steps':['Unwrap\x20the\x20delivered\x20payment\x20wrapper\x20with\x20the\x20holder\x20account\x27s\x20signature.','The\x20bare\x20Coin<T>\x20is\x20transferred\x20back\x20to\x20the\x20same\x20account,\x20ready\x20to\x20spend.']};const e=objectTypeFromAddress(c),f=e?driveabilityOf(e):undefined,g=f?.['receive_entries'][0x0]??'owner-side\x20coin\x20extraction\x20from\x20the\x20'+String(e??'object'),i=b??f?.['funds_settle_to']??'the\x20object\x27s\x20owner';if(f?.['anyone_drivable'])return{'holder':c,'holder_kind':'business_object','operation':g,'anyone_can_submit':!![],'settles_to':i,'steps':['Obtain\x20the\x20Receiving<CoinWrapper<T>>\x20argument\x20from\x20the\x20wrapper\x27s\x20current\x20version\x20and\x20digest\x20returned\x20by\x20query_received.','Build\x20a\x20PTB\x20for\x20the\x20'+g+':\x20arguments\x20(…,\x20wrapper,\x20payment);\x20no\x20permission\x20witness\x20is\x20required.','Anyone\x20may\x20submit;\x20the\x20bare\x20Coin\x20settles\x20to\x20'+i+'.']};return{'holder':c,'holder_kind':'business_object','operation':g,'anyone_can_submit':![],...f?.['permission_index']!=null?{'permission_index':f['permission_index']}:{},'settles_to':i,'steps':['Obtain\x20the\x20Receiving<CoinWrapper<T>>\x20argument\x20from\x20the\x20wrapper\x27s\x20current\x20version\x20and\x20digest\x20returned\x20by\x20query_received.','Build\x20a\x20PTB\x20for\x20the\x20'+g+':\x20arguments\x20(…,\x20permission,\x20wrapper,\x20payment),\x20as\x20a\x20member\x20holding\x20permission\x20index\x20'+(f?.['permission_index']??'?')+',\x20or\x20its\x20passport-gated\x20variant.','The\x20bare\x20Coin\x20settles\x20to\x20'+i+'.']};}export async function pendingWrappersAt(a,b){const c=a['toLowerCase'](),d=await query_received({'name_or_address':{'name_or_address':c},'type':'CoinWrapper','network':b['network'],'no_cache':b['no_cache']});let e=[];d&&!Array['isArray'](d)&&'received'in d&&(e=(d['received']??[])['map'](f=>({'id':f['id'],'payment':f['payment'],'balance':f['balance'],'version':f['version'],'digest':f['digest']})));if(e['length']===0x0&&!isUserAddress(c)){const f=await recoverObjectHeldReceipts(c,{'network':b['network'],'no_cache':b['no_cache']});f&&(e=f['receipts']['map'](g=>({'id':g['id'],'payment':g['payment'],'balance':g['amount'],'version':g['version'],'digest':g['digest']})));}return e['map'](g=>({'wrapper_id':String(g['id'])['toLowerCase'](),'payment':String(g['payment'])['toLowerCase'](),'amount':String(g['balance']??'0'),'version':g['version'],'digest':g['digest'],'holder':c,'plan':extractionPlanForHolder(c,b['concreteOwner'])}));}export async function trackAccountPayments(a){const b=a['account']['toLowerCase'](),c=await scanRecentPaymentEvents({'network':a['network'],'no_cache':a['no_cache'],'max_events':a['max_events']??0x64}),d=new Set();for(const i of c)for(const j of i['record']??[])d['add'](String(j['recipient'])['toLowerCase']());const e=await resolveBeneficialOwners([...d],{'network':a['network'],'no_cache':a['no_cache']}),f=[];for(const k of c){const l=paymentRelations(k,b),m=(k['record']??[])['some'](n=>e['get'](String(n['recipient'])['toLowerCase']())===b);if(l['length']===0x0&&!m)continue;if(!m&&!a['include_related']&&(l['length']===0x0||!l['includes']('incoming')))continue;f['push']({'ev':k,'relations':l,'beneficial':m});}const g=new Set();for(const {ev:n}of f)for(const o of n['record']??[]){const p=String(o['recipient'])['toLowerCase']();if(p===b||e['get'](p)===b)g['add'](p);}const h=new Map();return await Promise['all']([...g]['map'](async q=>{try{h['set'](q,await pendingWrappersAt(q,{'network':a['network'],'no_cache':a['no_cache'],'concreteOwner':e['get'](q)}));}catch{h['set'](q,[]);}})),f['map'](({ev:q,relations:s,beneficial:t})=>{const u=q['object']['toLowerCase'](),v=[];for(const x of q['record']??[]){const y=String(x['recipient'])['toLowerCase']();if(y!==b&&e['get'](y)!==b)continue;for(const z of h['get'](y)??[]){if(z['payment']===u)v['push'](z);}}return{'payment':u,'tx_digest':String(q['id']?.['txDigest']??''),'time':Number(q['time']??0x0),'amount':String(q['amount']??'0'),'creator':String(q['sender']??'')['toLowerCase'](),'from_object':q['from_object']??null,'info':q['info'],'legs':(q['record']??[])['map'](A=>{const B=String(A['recipient'])['toLowerCase']();return{'recipient':B,'amount':String(A['amount']??'0'),'recipient_kind':isUserAddress(B)?'user':'business_object',...e['has'](B)?{'beneficial_owner':e['get'](B)}:{}};}),'relations':s,'beneficial':t,'pending':v};});}
|
|
@@ -12,5 +12,6 @@ export interface ProtocolFact {
|
|
|
12
12
|
export declare const PROTOCOL_FACTS: readonly ProtocolFact[];
|
|
13
13
|
export declare const SV2_REPLAY_GATE_CLAUSE = "REPLAY GATE (SV-2, azx7-mn-261014 live T8 \u2014 supersedes the ofn-mn-261012 storeFromId retraction, which live A/B testing disproved): scope the claim-records query BY THE ORDER \u2014 logic_not({type:'query_reward_record_exists', object:<reward slot>, where:{storeFromId:<order slot>}}); a recipient-only EMPTY where:{} makes the pre-check once-per-buyer-FOR-LIFE and silently kills the buyer's second order (upw-mn-261014 F-48); a RAW query with an empty VecU8 parameter is an uncoded VM error ('Query bytes is empty', klk-mn-261013 F-05). The guard ENTRY stamp is what makes the scope REAL: the reward guard_add ENTRY MUST pin store_from_id = the table slot whose submitted value is the per-order stamp (slot 0 \u2014 the submitted Order address) whenever the guard consumes claim records \u2014 the MCP guard_add stamp gate hard-REJECTS record-consuming guards that omit it (upw F-13 \u2192 UPW-K7, crs-mn-261014 F-17); the chain itself accepts an unstamped entry but never stamps its claim records, silently killing the per-order replay scope (ofn-mn-261012 F-01), and re-adding the same guard overwrites its slot in place (live pools repairable). SCOPE SPLIT (SV-2): entry-stamped + order-scoped where = ONCE PER BUYER PER ORDER \u2014 the native RewardClaimKey is (recipient, guard, bcs(store_from)), so the same buyer on a DIFFERENT order claims again and only a same-order replay is refused natively (LIVE-CONFIRMED); entry-stamped + empty where = once per buyer for life \u2014 choose it DELIBERATELY for one-bounty-per-buyer designs.";
|
|
14
14
|
export declare const SV2_UNARMED_PRESCRIPTION: string;
|
|
15
|
+
export declare const TWO_TX_RENEW_RECIPE: string;
|
|
15
16
|
export declare const SV2_PRIMARY_FORM_CLAUSE: string;
|
|
16
17
|
export declare const SV2_DELIBERATE_ALTERNATIVE_CLAUSE = "DELIBERATE ALTERNATIVE: entry-stamped + EMPTY where ({}) = once per buyer FOR LIFE \u2014 the SDK encodes empty where-conditions as [VecU8 marker][all-None RecordQueryConditions], recipient defaults to the Signer, so the gate reads 'this recipient has never claimed this Reward' (klk-mn-261014 live: the replay aborts at the passport layer, E_VERIFY_FAILED=7). NEVER pair it with per-order bounty wording \u2014 it silently kills the buyer's second order (upw-mn-261014 F-48). ";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PROTOCOL_FACTS_VERSION=0x1;export const PROTOCOL_FACTS=[{'id':'sv2-replay-scope','kind':'settled','title':'Reward\x20replay\x20scope\x20split\x20(SV-2):\x20entry-stamped\x20+\x20order-scoped\x20where\x20is\x20the\x20primary\x20once-per-buyer-per-order\x20form','statement':'On\x20a\x20stamped\x20reward\x20guard\x20the\x20order-scoped\x20record\x20query\x20(where:{storeFromId:{identifier:<order\x20slot>}})\x20is\x20live:\x20entry-stamped\x20+\x20order-scoped\x20where\x20=\x20once\x20per\x20buyer\x20per\x20order\x20(the\x20native\x20claim\x20key\x20is\x20recipient+guard+stamp,\x20so\x20the\x20same\x20buyer\x20on\x20a\x20DIFFERENT\x20order\x20claims\x20again);\x20entry-stamped\x20+\x20empty\x20where\x20=\x20once\x20per\x20buyer\x20for\x20life\x20(a\x20deliberate\x20choice,\x20never\x20a\x20default).\x20The\x20blanket\x20\x27storeFromId\x20filter\x20is\x20inert\x27\x20verdict\x20described\x20unstamped/legacy\x20rewards\x20only.','chain_ref':'Reward\x20claim\x20records\x20key\x20on\x20(recipient,\x20guard,\x20store_from)\x20once\x20the\x20guard_add\x20entry\x20carries\x20the\x20store_from_id\x20stamp;\x20the\x20claim\x27s\x20native\x20once-slot\x20is\x20the\x20second\x20line\x20of\x20defense\x20behind\x20the\x20guard\x27s\x20record\x20gate.','verified_on':'azx7-mn-261014\x20live\x20T8\x20(A/B-verified);\x20klk-mn-261014\x20live\x20(empty-where\x20passport\x20abort)','superseded_by':'the\x20ofn-mn-261012\x20F-01\x20blanket\x20\x27storeFromId\x20filter\x20is\x20a\x20silent\x20no-op\x27\x20retraction','enforced_by':['REVIEW_REWARD_UNARMED','R-REWARD-REPLAY','guard-risk\x20R-X1-14']},{'id':'reward-entry-stamp','kind':'settled','title':'The\x20guard_add\x20store_from_id\x20stamp\x20is\x20REQUIRED\x20only\x20behind\x20a\x20storeFromId\x20record\x20predicate;\x20recipient-only\x20(predicateless)\x20record\x20gates\x20are\x20valid\x20unstamped','statement':'Reward.claim\x20keys\x20every\x20payout\x20on\x20RewardClaimKey\x20{recipient,\x20guard,\x20store_from}\x20(native\x20once-slot,\x20live\x20in\x20the\x20deployed\x20framework\x20—\x20claim-key\x20dynamic\x20fields\x20observed\x20on\x20the\x20crs9\x20mainnet\x20reward\x20object),\x20so\x20an\x20unstamped\x20entry\x20degrades\x20to\x20once-per-recipient-for-life,\x20never\x20a\x20drain.\x20The\x20MCP\x20guard_add\x20stamp\x20gate\x20therefore\x20rejects\x20ONLY\x20the\x20mismatch\x20where\x20the\x20tree\x20pins\x20a\x20storeFromId\x20predicate\x20(order-scoped\x20where)\x20while\x20the\x20entry\x20omits\x20the\x20stamp\x20—\x20unstamped\x20records\x20match\x20no\x20store_from\x20predicate,\x20silently\x20killing\x20the\x20declared\x20once-per-order\x20economics.\x20The\x20recipient-only\x20form\x20is\x20admitted\x20with\x20a\x20loud\x20advisory\x20(keep\x20the\x20order.owner\x20identity\x20leg\x20—\x20it\x20decides\x20who\x20may\x20claim).\x20Re-adding\x20the\x20same\x20guard\x20overwrites\x20its\x20slot\x20in\x20place\x20(live\x20pools\x20repairable).','chain_ref':'guard_add\x20store_from_id\x20entry\x20field;\x20claim\x20records\x20write\x20store_from\x20only\x20when\x20stamped;\x20claim\x20key\x20{recipient,\x20guard,\x20bcs(stamp)|[]}','verified_on':'crs-mn-261015\x20F-11\x20(gate\x20corrected);\x20azx7-mn-261014\x20live\x20T8\x20(stamped\x20forms);\x20crs9\x20mainnet\x20claim-key\x20dynamic\x20fields;\x20upw\x20F-13\x20→\x20UPW-K7\x20origin','enforced_by':['MCP\x20guard_add\x20stamp\x20gate\x20(predicate/stamp\x20mismatch\x20only)','REVIEW_REWARD_UNARMED','R-REWARD-REPLAY','guard-risk\x20R-X1-14']},{'id':'reward-recipient-signer','kind':'settled','title':'The\x20reward\x20guard_add\x20ENTRY\x20recipient\x20must\x20be\x20the\x20signer\x20(or\x20an\x20Entity)\x20—\x20never\x20a\x20GuardIdentifier','statement':'The\x20claim\x20entry\x20requires\x20recipient\x20==\x20tx\x20sender;\x20a\x20GuardIdentifier\x20recipient\x20resolves\x20from\x20the\x20passport\x20submission\x20(conventionally\x20the\x20submitted\x20Order\x20address)\x20and\x20can\x20never\x20equal\x20the\x20sender,\x20so\x20every\x20claim\x20aborts\x20with\x20the\x20recipient-mismatch\x20error\x20and\x20the\x20pool\x20is\x20structurally\x20unpayable.\x20The\x20order-anchor\x20GuardIdentifier\x20idiom\x20is\x20an\x20Allocation\x20push\x20rail,\x20never\x20a\x20reward\x20pull\x20rail.\x20An\x20Entity\x20recipient\x20passes\x20(replaced\x20by\x20the\x20claimant\x27s\x20local\x20account\x20at\x20claim\x20time).','chain_ref':'Reward\x20claim\x20pays\x20the\x20tx-context\x20sender;\x20recipient\x20is\x20asserted\x20equal\x20to\x20it','verified_on':'crs-mn-261015\x20F-12\x20(live\x20mainnet,\x20funded\x20pool\x20aborting\x20on\x20every\x20claim)','enforced_by':['MCP\x20guard_add\x20recipient\x20gate']},{'id':'reward-positive-amount','kind':'settled','title':'A\x20resolved\x20reward\x20claim\x20root\x20must\x20carry\x20the\x20positive-amount\x20leg\x20(order\x20amount\x20>=\x201)','statement':'A\x20zero-total\x20order\x20(zeroing-coupon\x20buy)\x20holds\x20an\x20empty\x20escrow\x20and\x20must\x20never\x20claim\x20—\x20the\x20claim\x20root\x20carries\x20an\x20explicit\x20order.amount\x20>=\x201\x20comparison\x20leg.','chain_ref':'order.amount\x20comparison\x20leg\x20in\x20the\x20guard\x20root','verified_on':'BKN-P2\x20(bkng-mn-261014\x20batch)','enforced_by':['R-REWARD-ZERO-ORDER']},{'id':'reward-identity-leg','kind':'settled','title':'The\x20reward\x20claim\x20identity\x20leg\x20(signer\x20==\x20order\x20owner)\x20is\x20mandatory\x20—\x20the\x20claim\x20entry\x20is\x20permissionless','statement':'claim()\x20pays\x20whatever\x20address\x20presents\x20a\x20qualifying\x20order;\x20without\x20the\x20identity\x20leg\x20any\x20address\x20holding\x20any\x20order\x20at\x20the\x20required\x20node\x20drains\x20the\x20pool.\x20The\x20identity\x20leg\x20stays\x20mandatory\x20until\x20a\x20chain-side\x20claim\x20permission\x20primitive\x20exists.','chain_ref':'claim\x20entry\x20has\x20no\x20protocol-level\x20order\x20binding\x20of\x20its\x20own','verified_on':'audit-261012\x20B5'},{'id':'claimed-by-polarity-pair','kind':'settled','title':'Refund\x20and\x20merchant-recovery\x20rails\x20are\x20claimed_by\x20polarity\x20twins\x20—\x20refund\x20asserts\x20some\x20==\x20false,\x20recovery\x20asserts\x20some\x20==\x20true','statement':'A\x20refund-rail\x20guard\x20MUST\x20read\x20claimed_by\x20(false\x20=\x20no\x20award\x20has\x20paid)\x20and\x20its\x20merchant-recovery\x20twin\x20asserts\x20claimed_by\x20some\x20==\x20true\x20(an\x20award\x20has\x20paid).\x20Shipping\x20only\x20the\x20refund\x20polarity\x20strands\x20the\x20awarded\x20escrow\x20once\x20arbitration\x20has\x20paid;\x20the\x20pairing\x20is\x20structural,\x20not\x20a\x20documentation\x20choice.','chain_ref':'the\x20claimed_by\x20Bool\x20axis\x20on\x20the\x20order\x20(award-paid\x20marker)','verified_on':'az-mn-261007\x20(awarded\x20escrow\x20stranded),\x20run75747\x20F-06/F-32','enforced_by':['DUAL-RAIL-01']},{'id':'allocator-rows-authoritative','kind':'settled','title':'allocator.rows\x20are\x20the\x20authoritative\x20money\x20shape\x20—\x20prose\x20must\x20not\x20restate\x20the\x20economics','statement':'The\x20shipped\x20rows\x20ARE\x20the\x20split;\x20any\x20prose\x20restatement\x20of\x20percentages,\x20surplus\x20behavior\x20or\x20recipient\x20structure\x20is\x20a\x20drift\x20hazard\x20and\x20must\x20defer\x20to\x20the\x20rows.\x20A\x20prose/rows\x20contradiction\x20is\x20always\x20a\x20prose\x20bug.','chain_ref':'the\x20allocator\x20configure\x20step\x20carries\x20the\x20rows\x20verbatim','verified_on':'run75747\x20F-09\x20(trust_mechanisms\x20R6\x20contradicted\x20the\x20rows)','enforced_by':['R-PLAN-01..07','template_allocator_rows\x20plan\x20passthrough']},{'id':'inv-guard-node-literals-resolve','kind':'invariant','title':'Every\x20node\x20literal\x20named\x20in\x20guard\x20prose\x20must\x20resolve\x20to\x20the\x20template\x27s\x20own\x20machine\x20node\x20names','statement':'A\x20node\x20set\x20like\x20{reviewed,\x20closed}\x20is\x20dead\x20prose\x20when\x20`closed`\x20is\x20not\x20a\x20machine\x20node\x20—\x20the\x20template\x27s\x20machine\x20shape\x20is\x20the\x20truth\x20and\x20the\x20prose\x20follows.\x20Sync\x20test:\x20reward/guard\x20prose\x20node\x20sets\x20⊆\x20machine\x20node\x20names.','chain_ref':'guard\x20roots\x20compare\x20progress.current\x20against\x20machine\x20node\x20name\x20constants','verified_on':'run75747\x20F-10\x20(reward\x20prose\x20named\x20`closed`;\x20the\x20terminal\x20is\x20`completed`)','enforced_by':['protocol-facts-sync\x20catalog\x20lint']},{'id':'inv-guard-keys-bind','kind':'invariant','title':'Every\x20executable\x20guard\x20key\x20must\x20have\x20at\x20least\x20one\x20binding\x20site;\x20advisory\x20designs\x20must\x20say\x20so;\x20omit\x20is\x20the\x20sanctioned\x20does-not-apply','statement':'A\x20guards[]\x20entry\x20with\x20no\x20binding\x20site\x20(machine\x20forward,\x20allocator\x20guard_key,\x20spec\x20policy,\x20service/buy\x20mount)\x20is\x20either\x20advisory\x20by\x20declaration\x20or\x20a\x20defect\x20—\x20it\x20must\x20never\x20silently\x20enter\x20the\x20creation\x20plan.\x20`guard_resolutions[k]\x20=\x20{kind:\x27omit\x27}`\x20is\x20the\x20sanctioned\x20way\x20to\x20say\x20a\x20design\x20does\x20not\x20apply\x20to\x20this\x20shop.','chain_ref':'guards\x20materialize\x20only\x20through\x20their\x20binding\x20site','verified_on':'run75747\x20F-25\x20(dead\x20duplicate\x20guard)\x20/\x20F-38\x20(unresolvable\x20advisory)','enforced_by':['HOST-GRAPH-01','UNRESOLVED-GUARD-01','GUARD_RESOLUTION_UNKNOWN']},{'id':'inv-fee-param-names-resolve','kind':'invariant','title':'Every\x20*_days\x20/\x20*_hours\x20/\x20*_bps\x20name\x20used\x20in\x20template\x20prose\x20must\x20exist\x20in\x20that\x20template\x27s\x20fee_params','statement':'Time\x20and\x20bps\x20parameters\x20are\x20fee\x20params,\x20never\x20hand-written\x20constants\x20(KLM-A\x20/\x20R-TIME-PROFILE):\x20a\x20token\x20named\x20in\x20a\x20guard\x20purpose\x20is\x20a\x20landing\x20commitment,\x20so\x20it\x20must\x20be\x20a\x20declared\x20fee\x20param.\x20Pseudo-params\x20in\x20prose\x20are\x20renamed\x20to\x20descriptive\x20wording\x20or\x20promoted\x20to\x20real\x20fee\x20params.','chain_ref':'fee_params\x20feed\x20the\x20parameter\x20->\x20landing-site\x20table\x20and\x20override\x20merging','verified_on':'run75747\x20F-23\x20(review_window_days\x20referenced,\x20never\x20declared)','enforced_by':['protocol-facts-sync\x20catalog\x20lint']},{'id':'inv-no-platform-zero-leg','kind':'invariant','title':'No\x20zero-share\x20platform\x20allocation\x20leg\x20may\x20be\x20emitted','statement':'A\x20`platform`\x20recipient\x20at\x200%\x20is\x20a\x20no-op\x20leg\x20that\x20can\x20only\x20mislead\x20—\x20explicit\x20zeros\x20belong\x20in\x20fee_params\x20(machine-checkable),\x20never\x20in\x20allocator\x20rows\x20or\x20emitted\x20plans.','chain_ref':'allocator\x20rows\x20mint\x20real\x20per-track\x20legs','verified_on':'run75747\x20F-28\x20(plan\x20emitted\x20the\x20shape\x20the\x20playbook\x20forbids)'},{'id':'current-time-anchor-drift','kind':'settled','title':'progress\x20current_time\x20drifts\x20on\x20every\x20migration\x20—\x20purchase-anchored\x20windows\x20pin\x20order.time,\x20delivery-anchored\x20windows\x20need\x20a\x20witness\x20anchor','statement':'Anchoring\x20a\x20window\x20on\x20the\x20order\x27s\x20purchase\x20time\x20uses\x20order.time\x20(path-independent).\x20Anchoring\x20on\x20a\x20delivery/progress\x20timestamp\x20needs\x20a\x20witness-anchored\x20entry;\x20a\x20native\x20history-timestamp\x20query\x20is\x20the\x20pending\x20gap\x20(move\x20approval\x20R75-F-17).\x20Until\x20then\x20a\x20Repository\x20time-oracle\x20row\x20serves\x20delivery-anchored\x20windows.','chain_ref':'order.time\x20query\x20vs\x20progress\x20entry\x20timestamps','verified_on':'run75747\x20F-04/F-17;\x20ETSY-C\x20current_time\x20drift\x20rationale'}];export const SV2_REPLAY_GATE_CLAUSE='REPLAY\x20GATE\x20(SV-2,\x20azx7-mn-261014\x20live\x20T8\x20—\x20supersedes\x20the\x20ofn-mn-261012\x20storeFromId\x20retraction,\x20which\x20live\x20A/B\x20testing\x20disproved):\x20scope\x20the\x20claim-records\x20query\x20BY\x20THE\x20ORDER\x20—\x20logic_not({type:\x27query_reward_record_exists\x27,\x20object:<reward\x20slot>,\x20where:{storeFromId:<order\x20slot>}});\x20a\x20recipient-only\x20EMPTY\x20where:{}\x20makes\x20the\x20pre-check\x20once-per-buyer-FOR-LIFE\x20and\x20silently\x20kills\x20the\x20buyer\x27s\x20second\x20order\x20(upw-mn-261014\x20F-48);\x20a\x20RAW\x20query\x20with\x20an\x20empty\x20VecU8\x20parameter\x20is\x20an\x20uncoded\x20VM\x20error\x20(\x27Query\x20bytes\x20is\x20empty\x27,\x20klk-mn-261013\x20F-05).\x20The\x20guard\x20ENTRY\x20stamp\x20is\x20what\x20makes\x20the\x20scope\x20REAL:\x20the\x20reward\x20guard_add\x20ENTRY\x20MUST\x20pin\x20store_from_id\x20=\x20the\x20table\x20slot\x20whose\x20submitted\x20value\x20is\x20the\x20per-order\x20stamp\x20(slot\x200\x20—\x20the\x20submitted\x20Order\x20address)\x20whenever\x20the\x20guard\x20consumes\x20claim\x20records\x20—\x20the\x20MCP\x20guard_add\x20stamp\x20gate\x20hard-REJECTS\x20record-consuming\x20guards\x20that\x20omit\x20it\x20(upw\x20F-13\x20→\x20UPW-K7,\x20crs-mn-261014\x20F-17);\x20the\x20chain\x20itself\x20accepts\x20an\x20unstamped\x20entry\x20but\x20never\x20stamps\x20its\x20claim\x20records,\x20silently\x20killing\x20the\x20per-order\x20replay\x20scope\x20(ofn-mn-261012\x20F-01),\x20and\x20re-adding\x20the\x20same\x20guard\x20overwrites\x20its\x20slot\x20in\x20place\x20(live\x20pools\x20repairable).\x20SCOPE\x20SPLIT\x20(SV-2):\x20entry-stamped\x20+\x20order-scoped\x20where\x20=\x20ONCE\x20PER\x20BUYER\x20PER\x20ORDER\x20—\x20the\x20native\x20RewardClaimKey\x20is\x20(recipient,\x20guard,\x20bcs(store_from)),\x20so\x20the\x20same\x20buyer\x20on\x20a\x20DIFFERENT\x20order\x20claims\x20again\x20and\x20only\x20a\x20same-order\x20replay\x20is\x20refused\x20natively\x20(LIVE-CONFIRMED);\x20entry-stamped\x20+\x20empty\x20where\x20=\x20once\x20per\x20buyer\x20for\x20life\x20—\x20choose\x20it\x20DELIBERATELY\x20for\x20one-bounty-per-buyer\x20designs.';export const SV2_UNARMED_PRESCRIPTION='Add\x20logic_not(query_reward_record_exists(object=<reward>,\x20where:{storeFromId:{identifier:<order\x20slot>}}))\x20—\x20the\x20'+'SV-2\x20ORDER-SCOPED\x20form,\x20once\x20per\x20buyer\x20per\x20order\x20(azx7-mn-261014\x20live\x20T8;\x20the\x20EMPTY-where\x20recipient-only\x20variant\x20'+'is\x20a\x20deliberate\x20once-per-buyer-FOR-LIFE\x20choice\x20and\x20must\x20never\x20back\x20per-order\x20bounty\x20wording,\x20upw\x20F-48)';export const SV2_PRIMARY_FORM_CLAUSE='PRIMARY\x20FORM\x20(SV-2,\x20azx7-mn-261014\x20live\x20T8\x20—\x20supersedes\x20the\x20ofn-mn-261012\x20storeFromId\x20retraction):\x20ENTRY-STAMPED\x20+\x20ORDER-SCOPED\x20—\x20pin\x20the\x20reward\x20guard_add\x20store_from_id\x20to\x20the\x20table\x20slot\x20whose\x20submitted\x20value\x20is\x20the\x20per-order\x20stamp\x20(slot\x200\x20—\x20the\x20submitted\x20Order\x20address)\x20and\x20scope\x20the\x20record\x20query\x20by\x20the\x20SAME\x20slot:\x20'+'logic_not({type:\x27query_reward_record_exists\x27,\x20object:<reward\x20identifier>,\x20where:{storeFromId:{identifier:0}}})\x20=\x20once\x20per\x20BUYER\x20per\x20ORDER\x20(the\x20same\x20buyer\x27s\x20next\x20order\x20still\x20claims).\x20The\x20ofn\x20F-01\x20\x27storeFromId\x20filter\x20is\x20a\x20silent\x20no-op\x27\x20verdict\x20described\x20UNSTAMPED/legacy\x20rewards\x20only:\x20a\x20guard\x20added\x20without\x20the\x20entry\x20stamp\x20writes\x20claim\x20records\x20with\x20store_from\x20=\x20none,\x20which\x20matches\x20no\x20storeFromId\x20predicate\x20—\x20on\x20stamped\x20guards\x20the\x20filter\x20is\x20live\x20and\x20A/B-verified.\x20';export const SV2_DELIBERATE_ALTERNATIVE_CLAUSE='DELIBERATE\x20ALTERNATIVE:\x20entry-stamped\x20+\x20EMPTY\x20where\x20({})\x20=\x20once\x20per\x20buyer\x20FOR\x20LIFE\x20—\x20the\x20SDK\x20encodes\x20empty\x20where-conditions\x20as\x20[VecU8\x20marker][all-None\x20RecordQueryConditions],\x20recipient\x20defaults\x20to\x20the\x20Signer,\x20so\x20the\x20gate\x20reads\x20\x27this\x20recipient\x20has\x20never\x20claimed\x20this\x20Reward\x27\x20(klk-mn-261014\x20live:\x20the\x20replay\x20aborts\x20at\x20the\x20passport\x20layer,\x20E_VERIFY_FAILED=7).\x20NEVER\x20pair\x20it\x20with\x20per-order\x20bounty\x20wording\x20—\x20it\x20silently\x20kills\x20the\x20buyer\x27s\x20second\x20order\x20(upw-mn-261014\x20F-48).\x20';
|
|
1
|
+
export const PROTOCOL_FACTS_VERSION=0x1;export const PROTOCOL_FACTS=[{'id':'sv2-replay-scope','kind':'settled','title':'Reward\x20replay\x20scope\x20split\x20(SV-2):\x20entry-stamped\x20+\x20order-scoped\x20where\x20is\x20the\x20primary\x20once-per-buyer-per-order\x20form','statement':'On\x20a\x20stamped\x20reward\x20guard\x20the\x20order-scoped\x20record\x20query\x20(where:{storeFromId:{identifier:<order\x20slot>}})\x20is\x20live:\x20entry-stamped\x20+\x20order-scoped\x20where\x20=\x20once\x20per\x20buyer\x20per\x20order\x20(the\x20native\x20claim\x20key\x20is\x20recipient+guard+stamp,\x20so\x20the\x20same\x20buyer\x20on\x20a\x20DIFFERENT\x20order\x20claims\x20again);\x20entry-stamped\x20+\x20empty\x20where\x20=\x20once\x20per\x20buyer\x20for\x20life\x20(a\x20deliberate\x20choice,\x20never\x20a\x20default).\x20The\x20blanket\x20\x27storeFromId\x20filter\x20is\x20inert\x27\x20verdict\x20described\x20unstamped/legacy\x20rewards\x20only.','chain_ref':'Reward\x20claim\x20records\x20key\x20on\x20(recipient,\x20guard,\x20store_from)\x20once\x20the\x20guard_add\x20entry\x20carries\x20the\x20store_from_id\x20stamp;\x20the\x20claim\x27s\x20native\x20once-slot\x20is\x20the\x20second\x20line\x20of\x20defense\x20behind\x20the\x20guard\x27s\x20record\x20gate.','verified_on':'azx7-mn-261014\x20live\x20T8\x20(A/B-verified);\x20klk-mn-261014\x20live\x20(empty-where\x20passport\x20abort)','superseded_by':'the\x20ofn-mn-261012\x20F-01\x20blanket\x20\x27storeFromId\x20filter\x20is\x20a\x20silent\x20no-op\x27\x20retraction','enforced_by':['REVIEW_REWARD_UNARMED','R-REWARD-REPLAY','guard-risk\x20R-X1-14']},{'id':'reward-entry-stamp','kind':'settled','title':'The\x20guard_add\x20store_from_id\x20stamp\x20is\x20REQUIRED\x20only\x20behind\x20a\x20storeFromId\x20record\x20predicate;\x20recipient-only\x20(predicateless)\x20record\x20gates\x20are\x20valid\x20unstamped','statement':'Reward.claim\x20keys\x20every\x20payout\x20on\x20RewardClaimKey\x20{recipient,\x20guard,\x20store_from}\x20(native\x20once-slot,\x20live\x20in\x20the\x20deployed\x20framework\x20—\x20claim-key\x20dynamic\x20fields\x20observed\x20on\x20the\x20crs9\x20mainnet\x20reward\x20object),\x20so\x20an\x20unstamped\x20entry\x20degrades\x20to\x20once-per-recipient-for-life,\x20never\x20a\x20drain.\x20The\x20MCP\x20guard_add\x20stamp\x20gate\x20therefore\x20rejects\x20ONLY\x20the\x20mismatch\x20where\x20the\x20tree\x20pins\x20a\x20storeFromId\x20predicate\x20(order-scoped\x20where)\x20while\x20the\x20entry\x20omits\x20the\x20stamp\x20—\x20unstamped\x20records\x20match\x20no\x20store_from\x20predicate,\x20silently\x20killing\x20the\x20declared\x20once-per-order\x20economics.\x20The\x20recipient-only\x20form\x20is\x20admitted\x20with\x20a\x20loud\x20advisory\x20(keep\x20the\x20order.owner\x20identity\x20leg\x20—\x20it\x20decides\x20who\x20may\x20claim).\x20Re-adding\x20the\x20same\x20guard\x20overwrites\x20its\x20slot\x20in\x20place\x20(live\x20pools\x20repairable).','chain_ref':'guard_add\x20store_from_id\x20entry\x20field;\x20claim\x20records\x20write\x20store_from\x20only\x20when\x20stamped;\x20claim\x20key\x20{recipient,\x20guard,\x20bcs(stamp)|[]}','verified_on':'crs-mn-261015\x20F-11\x20(gate\x20corrected);\x20azx7-mn-261014\x20live\x20T8\x20(stamped\x20forms);\x20crs9\x20mainnet\x20claim-key\x20dynamic\x20fields;\x20upw\x20F-13\x20→\x20UPW-K7\x20origin','enforced_by':['MCP\x20guard_add\x20stamp\x20gate\x20(predicate/stamp\x20mismatch\x20only)','REVIEW_REWARD_UNARMED','R-REWARD-REPLAY','guard-risk\x20R-X1-14']},{'id':'reward-recipient-signer','kind':'settled','title':'The\x20reward\x20guard_add\x20ENTRY\x20recipient\x20must\x20be\x20the\x20signer\x20(or\x20an\x20Entity)\x20—\x20never\x20a\x20GuardIdentifier','statement':'The\x20claim\x20entry\x20requires\x20recipient\x20==\x20tx\x20sender;\x20a\x20GuardIdentifier\x20recipient\x20resolves\x20from\x20the\x20passport\x20submission\x20(conventionally\x20the\x20submitted\x20Order\x20address)\x20and\x20can\x20never\x20equal\x20the\x20sender,\x20so\x20every\x20claim\x20aborts\x20with\x20the\x20recipient-mismatch\x20error\x20and\x20the\x20pool\x20is\x20structurally\x20unpayable.\x20The\x20order-anchor\x20GuardIdentifier\x20idiom\x20is\x20an\x20Allocation\x20push\x20rail,\x20never\x20a\x20reward\x20pull\x20rail.\x20An\x20Entity\x20recipient\x20passes\x20(replaced\x20by\x20the\x20claimant\x27s\x20local\x20account\x20at\x20claim\x20time).','chain_ref':'Reward\x20claim\x20pays\x20the\x20tx-context\x20sender;\x20recipient\x20is\x20asserted\x20equal\x20to\x20it','verified_on':'crs-mn-261015\x20F-12\x20(live\x20mainnet,\x20funded\x20pool\x20aborting\x20on\x20every\x20claim)','enforced_by':['MCP\x20guard_add\x20recipient\x20gate']},{'id':'reward-positive-amount','kind':'settled','title':'A\x20resolved\x20reward\x20claim\x20root\x20must\x20carry\x20the\x20positive-amount\x20leg\x20(order\x20amount\x20>=\x201)','statement':'A\x20zero-total\x20order\x20(zeroing-coupon\x20buy)\x20holds\x20an\x20empty\x20escrow\x20and\x20must\x20never\x20claim\x20—\x20the\x20claim\x20root\x20carries\x20an\x20explicit\x20order.amount\x20>=\x201\x20comparison\x20leg.','chain_ref':'order.amount\x20comparison\x20leg\x20in\x20the\x20guard\x20root','verified_on':'BKN-P2\x20(bkng-mn-261014\x20batch)','enforced_by':['R-REWARD-ZERO-ORDER']},{'id':'reward-identity-leg','kind':'settled','title':'The\x20reward\x20claim\x20identity\x20leg\x20(signer\x20==\x20order\x20owner)\x20is\x20mandatory\x20—\x20the\x20claim\x20entry\x20is\x20permissionless','statement':'claim()\x20pays\x20whatever\x20address\x20presents\x20a\x20qualifying\x20order;\x20without\x20the\x20identity\x20leg\x20any\x20address\x20holding\x20any\x20order\x20at\x20the\x20required\x20node\x20drains\x20the\x20pool.\x20The\x20identity\x20leg\x20stays\x20mandatory\x20until\x20a\x20chain-side\x20claim\x20permission\x20primitive\x20exists.','chain_ref':'claim\x20entry\x20has\x20no\x20protocol-level\x20order\x20binding\x20of\x20its\x20own','verified_on':'audit-261012\x20B5'},{'id':'claimed-by-polarity-pair','kind':'settled','title':'Refund\x20and\x20merchant-recovery\x20rails\x20are\x20claimed_by\x20polarity\x20twins\x20—\x20refund\x20asserts\x20some\x20==\x20false,\x20recovery\x20asserts\x20some\x20==\x20true','statement':'A\x20refund-rail\x20guard\x20MUST\x20read\x20claimed_by\x20(false\x20=\x20no\x20award\x20has\x20paid)\x20and\x20its\x20merchant-recovery\x20twin\x20asserts\x20claimed_by\x20some\x20==\x20true\x20(an\x20award\x20has\x20paid).\x20Shipping\x20only\x20the\x20refund\x20polarity\x20strands\x20the\x20awarded\x20escrow\x20once\x20arbitration\x20has\x20paid;\x20the\x20pairing\x20is\x20structural,\x20not\x20a\x20documentation\x20choice.','chain_ref':'the\x20claimed_by\x20Bool\x20axis\x20on\x20the\x20order\x20(award-paid\x20marker)','verified_on':'az-mn-261007\x20(awarded\x20escrow\x20stranded),\x20run75747\x20F-06/F-32','enforced_by':['DUAL-RAIL-01']},{'id':'allocator-rows-authoritative','kind':'settled','title':'allocator.rows\x20are\x20the\x20authoritative\x20money\x20shape\x20—\x20prose\x20must\x20not\x20restate\x20the\x20economics','statement':'The\x20shipped\x20rows\x20ARE\x20the\x20split;\x20any\x20prose\x20restatement\x20of\x20percentages,\x20surplus\x20behavior\x20or\x20recipient\x20structure\x20is\x20a\x20drift\x20hazard\x20and\x20must\x20defer\x20to\x20the\x20rows.\x20A\x20prose/rows\x20contradiction\x20is\x20always\x20a\x20prose\x20bug.','chain_ref':'the\x20allocator\x20configure\x20step\x20carries\x20the\x20rows\x20verbatim','verified_on':'run75747\x20F-09\x20(trust_mechanisms\x20R6\x20contradicted\x20the\x20rows)','enforced_by':['R-PLAN-01..07','template_allocator_rows\x20plan\x20passthrough']},{'id':'inv-guard-node-literals-resolve','kind':'invariant','title':'Every\x20node\x20literal\x20named\x20in\x20guard\x20prose\x20must\x20resolve\x20to\x20the\x20template\x27s\x20own\x20machine\x20node\x20names','statement':'A\x20node\x20set\x20like\x20{reviewed,\x20closed}\x20is\x20dead\x20prose\x20when\x20`closed`\x20is\x20not\x20a\x20machine\x20node\x20—\x20the\x20template\x27s\x20machine\x20shape\x20is\x20the\x20truth\x20and\x20the\x20prose\x20follows.\x20Sync\x20test:\x20reward/guard\x20prose\x20node\x20sets\x20⊆\x20machine\x20node\x20names.','chain_ref':'guard\x20roots\x20compare\x20progress.current\x20against\x20machine\x20node\x20name\x20constants','verified_on':'run75747\x20F-10\x20(reward\x20prose\x20named\x20`closed`;\x20the\x20terminal\x20is\x20`completed`)','enforced_by':['protocol-facts-sync\x20catalog\x20lint']},{'id':'inv-guard-keys-bind','kind':'invariant','title':'Every\x20executable\x20guard\x20key\x20must\x20have\x20at\x20least\x20one\x20binding\x20site;\x20advisory\x20designs\x20must\x20say\x20so;\x20omit\x20is\x20the\x20sanctioned\x20does-not-apply','statement':'A\x20guards[]\x20entry\x20with\x20no\x20binding\x20site\x20(machine\x20forward,\x20allocator\x20guard_key,\x20spec\x20policy,\x20service/buy\x20mount)\x20is\x20either\x20advisory\x20by\x20declaration\x20or\x20a\x20defect\x20—\x20it\x20must\x20never\x20silently\x20enter\x20the\x20creation\x20plan.\x20`guard_resolutions[k]\x20=\x20{kind:\x27omit\x27}`\x20is\x20the\x20sanctioned\x20way\x20to\x20say\x20a\x20design\x20does\x20not\x20apply\x20to\x20this\x20shop.','chain_ref':'guards\x20materialize\x20only\x20through\x20their\x20binding\x20site','verified_on':'run75747\x20F-25\x20(dead\x20duplicate\x20guard)\x20/\x20F-38\x20(unresolvable\x20advisory)','enforced_by':['HOST-GRAPH-01','UNRESOLVED-GUARD-01','GUARD_RESOLUTION_UNKNOWN']},{'id':'inv-fee-param-names-resolve','kind':'invariant','title':'Every\x20*_days\x20/\x20*_hours\x20/\x20*_bps\x20name\x20used\x20in\x20template\x20prose\x20must\x20exist\x20in\x20that\x20template\x27s\x20fee_params','statement':'Time\x20and\x20bps\x20parameters\x20are\x20fee\x20params,\x20never\x20hand-written\x20constants\x20(KLM-A\x20/\x20R-TIME-PROFILE):\x20a\x20token\x20named\x20in\x20a\x20guard\x20purpose\x20is\x20a\x20landing\x20commitment,\x20so\x20it\x20must\x20be\x20a\x20declared\x20fee\x20param.\x20Pseudo-params\x20in\x20prose\x20are\x20renamed\x20to\x20descriptive\x20wording\x20or\x20promoted\x20to\x20real\x20fee\x20params.','chain_ref':'fee_params\x20feed\x20the\x20parameter\x20->\x20landing-site\x20table\x20and\x20override\x20merging','verified_on':'run75747\x20F-23\x20(review_window_days\x20referenced,\x20never\x20declared)','enforced_by':['protocol-facts-sync\x20catalog\x20lint']},{'id':'inv-no-platform-zero-leg','kind':'invariant','title':'No\x20zero-share\x20platform\x20allocation\x20leg\x20may\x20be\x20emitted','statement':'A\x20`platform`\x20recipient\x20at\x200%\x20is\x20a\x20no-op\x20leg\x20that\x20can\x20only\x20mislead\x20—\x20explicit\x20zeros\x20belong\x20in\x20fee_params\x20(machine-checkable),\x20never\x20in\x20allocator\x20rows\x20or\x20emitted\x20plans.','chain_ref':'allocator\x20rows\x20mint\x20real\x20per-track\x20legs','verified_on':'run75747\x20F-28\x20(plan\x20emitted\x20the\x20shape\x20the\x20playbook\x20forbids)'},{'id':'current-time-anchor-drift','kind':'settled','title':'progress\x20current_time\x20drifts\x20on\x20every\x20migration\x20—\x20purchase-anchored\x20windows\x20pin\x20order.time,\x20delivery-anchored\x20windows\x20need\x20a\x20witness\x20anchor','statement':'Anchoring\x20a\x20window\x20on\x20the\x20order\x27s\x20purchase\x20time\x20uses\x20order.time\x20(path-independent).\x20Anchoring\x20on\x20a\x20delivery/progress\x20timestamp\x20needs\x20a\x20witness-anchored\x20entry;\x20a\x20native\x20history-timestamp\x20query\x20is\x20the\x20pending\x20gap\x20(move\x20approval\x20R75-F-17).\x20Until\x20then\x20a\x20Repository\x20time-oracle\x20row\x20serves\x20delivery-anchored\x20windows.','chain_ref':'order.time\x20query\x20vs\x20progress\x20entry\x20timestamps','verified_on':'run75747\x20F-04/F-17;\x20ETSY-C\x20current_time\x20drift\x20rationale'}];export const SV2_REPLAY_GATE_CLAUSE='REPLAY\x20GATE\x20(SV-2,\x20azx7-mn-261014\x20live\x20T8\x20—\x20supersedes\x20the\x20ofn-mn-261012\x20storeFromId\x20retraction,\x20which\x20live\x20A/B\x20testing\x20disproved):\x20scope\x20the\x20claim-records\x20query\x20BY\x20THE\x20ORDER\x20—\x20logic_not({type:\x27query_reward_record_exists\x27,\x20object:<reward\x20slot>,\x20where:{storeFromId:<order\x20slot>}});\x20a\x20recipient-only\x20EMPTY\x20where:{}\x20makes\x20the\x20pre-check\x20once-per-buyer-FOR-LIFE\x20and\x20silently\x20kills\x20the\x20buyer\x27s\x20second\x20order\x20(upw-mn-261014\x20F-48);\x20a\x20RAW\x20query\x20with\x20an\x20empty\x20VecU8\x20parameter\x20is\x20an\x20uncoded\x20VM\x20error\x20(\x27Query\x20bytes\x20is\x20empty\x27,\x20klk-mn-261013\x20F-05).\x20The\x20guard\x20ENTRY\x20stamp\x20is\x20what\x20makes\x20the\x20scope\x20REAL:\x20the\x20reward\x20guard_add\x20ENTRY\x20MUST\x20pin\x20store_from_id\x20=\x20the\x20table\x20slot\x20whose\x20submitted\x20value\x20is\x20the\x20per-order\x20stamp\x20(slot\x200\x20—\x20the\x20submitted\x20Order\x20address)\x20whenever\x20the\x20guard\x20consumes\x20claim\x20records\x20—\x20the\x20MCP\x20guard_add\x20stamp\x20gate\x20hard-REJECTS\x20record-consuming\x20guards\x20that\x20omit\x20it\x20(upw\x20F-13\x20→\x20UPW-K7,\x20crs-mn-261014\x20F-17);\x20the\x20chain\x20itself\x20accepts\x20an\x20unstamped\x20entry\x20but\x20never\x20stamps\x20its\x20claim\x20records,\x20silently\x20killing\x20the\x20per-order\x20replay\x20scope\x20(ofn-mn-261012\x20F-01),\x20and\x20re-adding\x20the\x20same\x20guard\x20overwrites\x20its\x20slot\x20in\x20place\x20(live\x20pools\x20repairable).\x20SCOPE\x20SPLIT\x20(SV-2):\x20entry-stamped\x20+\x20order-scoped\x20where\x20=\x20ONCE\x20PER\x20BUYER\x20PER\x20ORDER\x20—\x20the\x20native\x20RewardClaimKey\x20is\x20(recipient,\x20guard,\x20bcs(store_from)),\x20so\x20the\x20same\x20buyer\x20on\x20a\x20DIFFERENT\x20order\x20claims\x20again\x20and\x20only\x20a\x20same-order\x20replay\x20is\x20refused\x20natively\x20(LIVE-CONFIRMED);\x20entry-stamped\x20+\x20empty\x20where\x20=\x20once\x20per\x20buyer\x20for\x20life\x20—\x20choose\x20it\x20DELIBERATELY\x20for\x20one-bounty-per-buyer\x20designs.';export const SV2_UNARMED_PRESCRIPTION='Add\x20logic_not(query_reward_record_exists(object=<reward>,\x20where:{storeFromId:{identifier:<order\x20slot>}}))\x20—\x20the\x20'+'SV-2\x20ORDER-SCOPED\x20form,\x20once\x20per\x20buyer\x20per\x20order\x20(azx7-mn-261014\x20live\x20T8;\x20the\x20EMPTY-where\x20recipient-only\x20variant\x20'+'is\x20a\x20deliberate\x20once-per-buyer-FOR-LIFE\x20choice\x20and\x20must\x20never\x20back\x20per-order\x20bounty\x20wording,\x20upw\x20F-48)';export const TWO_TX_RENEW_RECIPE='TWO-TX\x20RENEW\x20RECIPE\x20(esound2-mn-261022\x20R2-1):\x20a\x20balance/fund-gated\x20renew\x20or\x20capture\x20forward\x20is\x20satisfiable\x20only\x20'+'when\x20the\x20capture\x20funds\x20were\x20committed\x20in\x20a\x20PRIOR\x20transaction\x20—\x20split\x20the\x20coupled\x20one-PTB\x20call\x20into\x20TWO\x20transactions:\x20'+'TX1\x20commits\x20the\x20period/capture\x20funds\x20into\x20the\x20order\x27s\x20Allocation\x20(create\x20the\x20escrowed\x20payment\x20record,\x20then\x20have\x20'+'the\x20allocation\x20receive\x20it;\x20a\x20hand-built\x20PTB\x20until\x20the\x20allocation\x20top-up\x20primitive\x20ships\x20on\x20the\x20package\x20face),\x20WAIT\x20for\x20its\x20success,\x20then\x20TX2\x20'+'advances\x20the\x20forward\x20with\x20the\x20plain\x20order-holder\x20progress\x20call\x20—\x20the\x20gate\x20now\x20reads\x20the\x20committed\x20balance\x20and\x20'+'passes.\x20The\x20ONE-PTB\x20data.order_renew\x20stays\x20the\x20route\x20for\x20GATE-LESS\x20renew\x20forwards\x20only.\x20NEVER\x20retry\x20the\x20same-PTB\x20'+'shape\x20after\x20the\x20abort:\x20the\x20guard\x20verdict\x20is\x20structural\x20(guards\x20read\x20the\x20pre-transaction\x20snapshot,\x20esound-mn-261021\x20'+'B-1),\x20not\x20a\x20transient\x20balance\x20shortfall.\x20Structural\x20alternatives\x20that\x20avoid\x20the\x20second\x20transaction:\x20prepaid-full\x20'+'at\x20buy\x20(staged-RELEASE\x20semantics)\x20or\x20per-period\x20NEW\x20Orders.';export const SV2_PRIMARY_FORM_CLAUSE='PRIMARY\x20FORM\x20(SV-2,\x20azx7-mn-261014\x20live\x20T8\x20—\x20supersedes\x20the\x20ofn-mn-261012\x20storeFromId\x20retraction):\x20ENTRY-STAMPED\x20+\x20ORDER-SCOPED\x20—\x20pin\x20the\x20reward\x20guard_add\x20store_from_id\x20to\x20the\x20table\x20slot\x20whose\x20submitted\x20value\x20is\x20the\x20per-order\x20stamp\x20(slot\x200\x20—\x20the\x20submitted\x20Order\x20address)\x20and\x20scope\x20the\x20record\x20query\x20by\x20the\x20SAME\x20slot:\x20'+'logic_not({type:\x27query_reward_record_exists\x27,\x20object:<reward\x20identifier>,\x20where:{storeFromId:{identifier:0}}})\x20=\x20once\x20per\x20BUYER\x20per\x20ORDER\x20(the\x20same\x20buyer\x27s\x20next\x20order\x20still\x20claims).\x20The\x20ofn\x20F-01\x20\x27storeFromId\x20filter\x20is\x20a\x20silent\x20no-op\x27\x20verdict\x20described\x20UNSTAMPED/legacy\x20rewards\x20only:\x20a\x20guard\x20added\x20without\x20the\x20entry\x20stamp\x20writes\x20claim\x20records\x20with\x20store_from\x20=\x20none,\x20which\x20matches\x20no\x20storeFromId\x20predicate\x20—\x20on\x20stamped\x20guards\x20the\x20filter\x20is\x20live\x20and\x20A/B-verified.\x20';export const SV2_DELIBERATE_ALTERNATIVE_CLAUSE='DELIBERATE\x20ALTERNATIVE:\x20entry-stamped\x20+\x20EMPTY\x20where\x20({})\x20=\x20once\x20per\x20buyer\x20FOR\x20LIFE\x20—\x20the\x20SDK\x20encodes\x20empty\x20where-conditions\x20as\x20[VecU8\x20marker][all-None\x20RecordQueryConditions],\x20recipient\x20defaults\x20to\x20the\x20Signer,\x20so\x20the\x20gate\x20reads\x20\x27this\x20recipient\x20has\x20never\x20claimed\x20this\x20Reward\x27\x20(klk-mn-261014\x20live:\x20the\x20replay\x20aborts\x20at\x20the\x20passport\x20layer,\x20E_VERIFY_FAILED=7).\x20NEVER\x20pair\x20it\x20with\x20per-order\x20bounty\x20wording\x20—\x20it\x20silently\x20kills\x20the\x20buyer\x27s\x20second\x20order\x20(upw-mn-261014\x20F-48).\x20';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TopoNode, Viewport } from "../graph/onchain/index.js";
|
|
2
2
|
export declare const REPOSITORY_WRITE_SEMANTICS_NODE_ANALYZER_ID = "RP2";
|
|
3
|
-
export type RepositoryWriteRuleId = "R-REP-W-01" | "R-REP-W-02" | "R-REP-W-03" | "R-REP-W-04" | "R-REP-W-05" | "R-REP-W-06" | "R-REP-W-07" | "R-REP-W-08";
|
|
3
|
+
export type RepositoryWriteRuleId = "R-REP-W-01" | "R-REP-W-02" | "R-REP-W-03" | "R-REP-W-04" | "R-REP-W-05" | "R-REP-W-06" | "R-REP-W-07" | "R-REP-W-08" | "R-REP-W-09" | "R-REP-W-10";
|
|
4
4
|
export interface RepositoryWriteRisk {
|
|
5
5
|
id: RepositoryWriteRuleId;
|
|
6
6
|
level: "info" | "low" | "medium" | "high" | "critical";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const REPOSITORY_WRITE_SEMANTICS_NODE_ANALYZER_ID='RP2';function asRecord(a){return a!=null&&typeof a==='object'&&!Array['isArray'](a)?a:undefined;}function idFromOf(a){if(typeof a==='number')return a;if(typeof a==='string'){const b=a['toLowerCase']();if(b==='none')return 0x0;if(b==='clock')return 0x1;if(b==='signer')return 0x2;const c=Number(a);return Number['isNaN'](c)?undefined:c;}return undefined;}function addrOf(a){return typeof a==='string'&&a['length']>0x0?a['toLowerCase']():undefined;}function optAddr(a){if(a==null)return undefined;return addrOf(a);}function hasSubmission(a){if(a==null)return![];if(typeof a==='boolean')return a;return!![];}function normalizePolicies(a){const b=a['policies'];if(!Array['isArray'](b))return[];const c=[];for(const d of b){const e=asRecord(d);if(!e)continue;const f=typeof e['name']==='string'?e['name']:'(unnamed)',h=[];if(Array['isArray'](e['write_guard']))for(const j of e['write_guard']){const k=asRecord(j);if(!k)continue;h['push']({...addrOf(k['guard'])!==undefined?{'guard':addrOf(k['guard'])}:{},'idFromSubmission':k['id_from_submission']??k['idFromSubmission'],'dataFromSubmission':k['data_from_submission']??k['dataFromSubmission']});}else{if(typeof e['write_guard_count']==='number'&&e['write_guard_count']>0x0)for(let l=0x0;l<e['write_guard_count'];l++){h['push']({'idFromSubmission':e['has_id_from_submission'],'dataFromSubmission':e['has_data_from_submission']});}}c['push']({'name':f,'idFrom':idFromOf(e['id_from']??e['idFrom']),'guards':h,...optAddr(e['quote_guard']??e['quoteGuard'])!==undefined?{'quoteGuard':optAddr(e['quote_guard']??e['quoteGuard'])}:{}});}return c;}export function resolveInViewport(a,b){const c=a['toLowerCase']();if(b['maskedNodes']['has'](c))return{'status':'masked'};const d=b['graph']['nodes']['get'](c);if(d){if(d['state']==='fetched')return{'status':'fetched'};return{'status':'unfetched','state':d['state']};}return{'status':'absent','depthCapped':b['graph']['budgetExhausted']['depth']===!![]};}function depthAdvisory(a){return a['graph']['budgetExhausted']['depth']===!![]?'The\x20expansion\x20depth\x20budget\x20was\x20exhausted\x20(default\x20depth\x20is\x204);\x20request\x20a\x20deeper\x20topology\x20read\x20(a\x20larger\x20exploration\x20depth)\x20to\x20resolve\x20it.':'Request\x20a\x20deeper\x20or\x20wider\x20topology\x20read\x20(raise\x20the\x20exploration\x20depth\x20beyond\x20the\x20default\x204,\x20or\x20widen\x20the\x20expanded\x20edge\x20set)\x20to\x20resolve\x20it.';}function guardList(a){const b=a['guards']['map'](c=>c['guard'])['filter'](Boolean);return b['length']>0x0?b['join'](',\x20'):a['guards']['length']+'\x20guard(s)';}const isPlain=a=>!hasSubmission(a['idFromSubmission'])&&!hasSubmission(a['dataFromSubmission']);function classificationFindings(a){const b=[],c=a['guards']['length']>0x0;if(a['idFrom']===0x1||a['idFrom']===0x2){const d=a['idFrom']===0x1?'rows\x20are\x20clock-sequenced\x20(row\x20id\x20generated\x20from\x20the\x20clock)\x20—\x20an\x20append-only\x20ledger\x20channel':'rows\x20are\x20keyed\x20by\x20writer\x20address\x20(row\x20id\x20=\x20signer)\x20—\x20one\x20controllable\x20row\x20per\x20writer';return b['push']({'id':'R-REP-W-01','level':'info','title':'Policy\x20\x22'+a['name']+'\x22:\x20'+(a['idFrom']===0x1?'clock-append':'signer-keyed')+'\x20write\x20path','description':d+'.\x20Submission-extracted\x20row\x20ids\x20are\x20forbidden\x20here\x20by\x20construction\x20(routing\x20conflict).\x20'+(c?'Writes\x20are\x20additionally\x20gated\x20by\x20guard(s):\x20'+guardList(a)+'.':'NO\x20write\x20guard\x20is\x20configured\x20—\x20the\x20write\x20action\x20itself\x20is\x20open\x20to\x20anyone\x20(anyone\x20may\x20append'+(a['idFrom']===0x2?'\x20their\x20own\x20row':'')+').'),'mitigation':c?undefined:'Add\x20a\x20write\x20guard\x20to\x20the\x20policy\x20if\x20the\x20write\x20channel\x20must\x20be\x20permissioned.','evidence':'policy=\x22'+a['name']+'\x22\x20id_from='+a['idFrom']+'\x20write_guards='+a['guards']['length'],'affected_stakeholders':['owner','system'],'confidence':'exact'}),b;}if(a['idFrom']===0x0&&c){const e=a['guards']['filter'](f=>!isPlain(f))['length'];b['push']({'id':'R-REP-W-01','level':'info','title':'Policy\x20\x22'+a['name']+'\x22:\x20guard-gated\x20write\x20path','description':'Row\x20ids\x20are\x20caller-\x20or\x20submission-supplied;\x20every\x20write\x20must\x20unlock\x20guard(s):\x20'+guardList(a)+',\x20through\x20a\x20passport.\x20'+(e>0x0?e+'\x20guard(s)\x20extract\x20the\x20row\x20id\x20and/or\x20data\x20from\x20their\x20submission\x20values\x20(mixed\x20entry\x20—\x20ALL\x20guards\x20must\x20unlock).\x20':'')+'A\x20single-guard\x20batch\x20entry\x20also\x20exists:\x20for\x20guards\x20WITHOUT\x20submission\x20extraction,\x20unlocking\x20ANY\x20ONE\x20configured\x20guard\x20authorizes\x20the\x20write.','evidence':'policy=\x22'+a['name']+'\x22\x20id_from=0\x20write_guards='+a['guards']['length'],'affected_stakeholders':['owner','customer'],'confidence':'exact'});}return b;}function chainIllegalFindings(a){if(a['idFrom']!==0x0){const b=a['guards']['filter'](c=>hasSubmission(c['idFromSubmission']));if(b['length']===0x0)return[];return[{'id':'R-REP-W-07','level':'high','title':'Policy\x20\x22'+a['name']+'\x22:\x20submission-extracted\x20row\x20id\x20on\x20an\x20auto-id\x20policy','description':'id_from='+a['idFrom']+'\x20generates\x20row\x20ids\x20from\x20the\x20'+(a['idFrom']===0x1?'clock':'signer')+',\x20but\x20'+b['length']+'\x20guard(s)\x20declare\x20id_from_submission\x20—\x20publishing\x20aborts\x20(routing\x20conflict,\x20chain\x20error\x2023).\x20Remove\x20the\x20submission-id\x20setting\x20from\x20every\x20guard\x20of\x20this\x20policy.','evidence':'policy=\x22'+a['name']+'\x22\x20id_from='+a['idFrom']+'\x20guards_with_id_submission='+b['length'],'affected_stakeholders':['owner'],'confidence':'exact'}];}if(a['guards']['length']>0x0)return[];return[{'id':'R-REP-W-07','level':'high','title':'Policy\x20\x22'+a['name']+'\x22:\x20unguarded\x20caller-keyed\x20writes','description':'id_from=0\x20with\x20an\x20EMPTY\x20write\x20guard\x20resurrects\x20the\x20fully\x20open\x20write\x20channel\x20(anyone\x20writes\x20and\x20REMOVES\x20arbitrary\x20rows\x20under\x20this\x20policy\x20name).\x20Publishing\x20aborts\x20by\x20design\x20(chain\x20error\x2022)\x20—\x20configure\x20at\x20least\x20one\x20write\x20guard.','evidence':'policy=\x22'+a['name']+'\x22\x20id_from=0\x20write_guards=0','affected_stakeholders':['owner','customer'],'confidence':'exact'}];}function orUnlockFindings(a){if(a['guards']['length']<0x2)return[];const b=a['guards']['filter'](isPlain);if(b['length']===0x0)return[];return[{'id':'R-REP-W-08','level':'medium','title':'Policy\x20\x22'+a['name']+'\x22:\x20single-guard\x20unlock\x20path\x20lowers\x20the\x20write\x20floor','description':a['guards']['length']+'\x20guards\x20are\x20configured,\x20but\x20the\x20plain\x20batch\x20entry\x20unlocks\x20writes\x20with\x20ANY\x20ONE\x20submission-free\x20guard\x20—\x20the\x20WEAKEST\x20of\x20['+b['map'](c=>c['guard']??'(proposal\x20guard)')['join'](',\x20')+']\x20defines\x20the\x20effective\x20write\x20floor,\x20not\x20the\x20full\x20committee.\x20Tighten\x20or\x20remove\x20the\x20weakest\x20guard,\x20or\x20give\x20every\x20guard\x20submission\x20extraction\x20(which\x20forces\x20the\x20all-guards\x20mixed\x20entry).','evidence':'policy=\x22'+a['name']+'\x22\x20guards='+a['guards']['length']+'\x20plain='+b['length'],'affected_stakeholders':['owner','customer'],'confidence':'exact'}];}function resolutionFinding(a,b,c,d,e,f,g,h){if(e['status']==='fetched')return undefined;const i=e['status']==='masked'?c+'\x20'+d+'\x20is\x20present\x20in\x20the\x20graph\x20but\x20ACCESS-GATED\x20for\x20the\x20current\x20viewer\x20—\x20'+f+'\x20cannot\x20be\x20witnessed\x20without\x20access\x20to\x20it.':e['status']==='unfetched'?c+'\x20'+d+'\x20is\x20in\x20the\x20graph\x20but\x20its\x20state\x20is\x20\x22'+e['state']+'\x22\x20—\x20'+f+'\x20cannot\x20be\x20witnessed\x20from\x20an\x20unfetched\x20object.':c+'\x20'+d+'\x20is\x20OUTSIDE\x20the\x20witnessed\x20topology\x20—\x20'+f+'\x20cannot\x20be\x20assessed.\x20'+depthAdvisory(h);return{'id':a,'level':b,'title':c+'\x20unresolved\x20—\x20write-permission\x20semantics\x20incomplete','description':i,'mitigation':e['status']==='absent'?'Re-run\x20the\x20analysis\x20with\x20a\x20deeper\x20exploration,\x20or\x20resolve\x20the\x20object\x20explicitly\x20and\x20re-analyze.':e['status']==='masked'?'Widen\x20viewer\x20access\x20and\x20re-analyze.':'Retry\x20once\x20the\x20object\x20fetch\x20succeeds.','evidence':c+'='+d+'\x20resolution='+e['status'],'affected_stakeholders':g,'confidence':'bounded'};}export function repositoryWritePayloadOf(a){if(a['proposal']){const e=a['raw'],f=e?.['data']??e;return f!=null&&typeof f==='object'&&!Array['isArray'](f)?f:undefined;}const b=a['raw'],c=b?.['data']??b;return c!=null&&typeof c==='object'&&!Array['isArray'](c)?c:undefined;}export function analyzeRepositoryWriteSemantics(a,b,c){const d=[],h=normalizePolicies(a),i=optAddr(a['permission']);if(i){const k=resolutionFinding('R-REP-W-04','medium','Repository\x20permission\x20(control\x20plane,\x20perm\x20100-105)',i,resolveInViewport(i,c),'who\x20holds\x20the\x20administrative\x20surface\x20(policy\x20add/remove,\x20messenger\x20binding,\x20owner\x20fund\x20recovery\x20and\x20the\x20rest\x20of\x20the\x20control\x20indices)',['owner','system'],c);if(k)d['push'](k);}if(h['length']===0x0)return d['push']({'id':'R-REP-W-01','level':'info','title':'Repository\x20has\x20no\x20write\x20policies','description':'No\x20PolicyRule\x20is\x20configured\x20—\x20the\x20repository\x20exposes\x20NO\x20data-write\x20surface\x20at\x20all\x20(writes\x20abort\x20with\x20an\x20unknown-policy\x20error).\x20Configure\x20a\x20policy\x20to\x20open\x20an\x20evidence\x20channel.','evidence':'policies=0','affected_stakeholders':['owner'],'confidence':'exact'}),d;for(const l of h){d['push'](...classificationFindings(l)),d['push'](...chainIllegalFindings(l)),d['push'](...orUnlockFindings(l));for(const m of l['guards']){if(!m['guard'])continue;const n=resolutionFinding('R-REP-W-02','medium','Write\x20guard\x20of\x20policy\x20\x22'+l['name']+'\x22',m['guard'],resolveInViewport(m['guard'],c),'what\x20the\x20guard\x20demands\x20before\x20a\x20row\x20lands\x20under\x20\x22'+l['name']+'\x22',['owner','customer'],c);if(n)d['push'](n);if(resolveInViewport(m['guard'],c)['status']==='fetched'){const o=c['graph']['out']['get'](m['guard'])??[];for(const p of o){if(p['schema']!=='guard.relies')continue;const q=resolutionFinding('R-REP-W-03','medium','Sub-guard\x20relied\x20on\x20by\x20the\x20write\x20guard\x20of\x20policy\x20\x22'+l['name']+'\x22',p['to'],resolveInViewport(p['to'],c),'the\x20sub-condition\x20that\x20participates\x20in\x20the\x20write\x20decision',['owner','customer'],c);if(q)d['push'](q);}}}if(l['quoteGuard']){const r=resolveInViewport(l['quoteGuard'],c),s=resolutionFinding('R-REP-W-05','medium','Quote\x20(read)\x20guard\x20of\x20policy\x20\x22'+l['name']+'\x22',l['quoteGuard'],r,'who\x20may\x20read\x20rows\x20under\x20this\x20policy\x20(subscription\x20gate)',['owner','customer','buyer'],c);if(s)d['push'](s);if(r['status']==='fetched'){const t=(c['graph']['out']['get'](l['quoteGuard'])??[])['filter'](u=>u['schema']==='guard.relies');t['length']>0x0&&d['push']({'id':'R-REP-W-05','level':'high','title':'Quote\x20guard\x20of\x20policy\x20\x22'+l['name']+'\x22\x20still\x20relies\x20on\x20sub-guards','description':'The\x20read\x20gate\x20must\x20be\x20a\x20DEPENDED\x20guard\x20(immutable,\x20no\x20relies)\x20—\x20this\x20one\x20carries\x20'+t['length']+'\x20reliance\x20edge(s),\x20so\x20the\x20configuration\x20cannot\x20exist\x20on-chain\x20and\x20the\x20payload\x20has\x20drifted\x20from\x20chain\x20truth.','evidence':'quote_guard='+l['quoteGuard']+'\x20relies='+t['length'],'affected_stakeholders':['owner','customer'],'confidence':'bounded'});}}}const j=optAddr(a['um']);if(j){const u=resolutionFinding('R-REP-W-06','low','Repository\x20membership\x20book\x20(um)',j,resolveInViewport(j,c),'which\x20members\x20may\x20read\x20or\x20write\x20under\x20member-scoped\x20policies',['owner','customer'],c);if(u)d['push'](u);}return d;}
|
|
1
|
+
export const REPOSITORY_WRITE_SEMANTICS_NODE_ANALYZER_ID='RP2';function asRecord(a){return a!=null&&typeof a==='object'&&!Array['isArray'](a)?a:undefined;}function idFromOf(a){if(typeof a==='number')return a;if(typeof a==='string'){const b=a['toLowerCase']();if(b==='none')return 0x0;if(b==='clock')return 0x1;if(b==='signer')return 0x2;const c=Number(a);return Number['isNaN'](c)?undefined:c;}return undefined;}function addrOf(a){return typeof a==='string'&&a['length']>0x0?a['toLowerCase']():undefined;}function optAddr(a){if(a==null)return undefined;return addrOf(a);}function hasSubmission(a){if(a==null)return![];if(typeof a==='boolean')return a;return!![];}function normalizePolicies(a){const b=a['policies'];if(!Array['isArray'](b))return[];const c=[];for(const d of b){const e=asRecord(d);if(!e)continue;const f=typeof e['name']==='string'?e['name']:'(unnamed)',h=[];if(Array['isArray'](e['write_guard']))for(const j of e['write_guard']){const k=asRecord(j);if(!k)continue;h['push']({...addrOf(k['guard'])!==undefined?{'guard':addrOf(k['guard'])}:{},'idFromSubmission':k['id_from_submission']??k['idFromSubmission'],'dataFromSubmission':k['data_from_submission']??k['dataFromSubmission']});}else{if(typeof e['write_guard_count']==='number'&&e['write_guard_count']>0x0)for(let l=0x0;l<e['write_guard_count'];l++){h['push']({'idFromSubmission':e['has_id_from_submission'],'dataFromSubmission':e['has_data_from_submission']});}}c['push']({'name':f,'idFrom':idFromOf(e['id_from']??e['idFrom']),'guards':h,'writeOnce':e['write_once']===!![]||e['writeOnce']===!![],...optAddr(e['quote_guard']??e['quoteGuard'])!==undefined?{'quoteGuard':optAddr(e['quote_guard']??e['quoteGuard'])}:{}});}return c;}export function resolveInViewport(a,b){const c=a['toLowerCase']();if(b['maskedNodes']['has'](c))return{'status':'masked'};const d=b['graph']['nodes']['get'](c);if(d){if(d['state']==='fetched')return{'status':'fetched'};return{'status':'unfetched','state':d['state']};}return{'status':'absent','depthCapped':b['graph']['budgetExhausted']['depth']===!![]};}function depthAdvisory(a){return a['graph']['budgetExhausted']['depth']===!![]?'The\x20expansion\x20depth\x20budget\x20was\x20exhausted\x20(default\x20depth\x20is\x204);\x20request\x20a\x20deeper\x20topology\x20read\x20(a\x20larger\x20exploration\x20depth)\x20to\x20resolve\x20it.':'Request\x20a\x20deeper\x20or\x20wider\x20topology\x20read\x20(raise\x20the\x20exploration\x20depth\x20beyond\x20the\x20default\x204,\x20or\x20widen\x20the\x20expanded\x20edge\x20set)\x20to\x20resolve\x20it.';}function guardList(a){const b=a['guards']['map'](c=>c['guard'])['filter'](Boolean);return b['length']>0x0?b['join'](',\x20'):a['guards']['length']+'\x20guard(s)';}const isPlain=a=>!hasSubmission(a['idFromSubmission'])&&!hasSubmission(a['dataFromSubmission']);function classificationFindings(a){const b=[],c=a['guards']['length']>0x0;if(a['idFrom']===0x1||a['idFrom']===0x2){const d=a['idFrom']===0x1?'rows\x20are\x20clock-sequenced\x20(row\x20id\x20generated\x20from\x20the\x20clock)\x20—\x20an\x20append-only\x20ledger\x20channel':'rows\x20are\x20keyed\x20by\x20writer\x20address\x20(row\x20id\x20=\x20signer)\x20—\x20one\x20controllable\x20row\x20per\x20writer';return b['push']({'id':'R-REP-W-01','level':'info','title':'Policy\x20\x22'+a['name']+'\x22:\x20'+(a['idFrom']===0x1?'clock-append':'signer-keyed')+'\x20write\x20path','description':d+'.\x20Submission-extracted\x20row\x20ids\x20are\x20forbidden\x20here\x20by\x20construction\x20(routing\x20conflict).\x20'+(c?'Writes\x20are\x20additionally\x20gated\x20by\x20guard(s):\x20'+guardList(a)+'.':'NO\x20write\x20guard\x20is\x20configured\x20—\x20the\x20write\x20action\x20itself\x20is\x20open\x20to\x20anyone\x20(anyone\x20may\x20append'+(a['idFrom']===0x2?'\x20their\x20own\x20row':'')+').'),'mitigation':c?undefined:'Add\x20a\x20write\x20guard\x20to\x20the\x20policy\x20if\x20the\x20write\x20channel\x20must\x20be\x20permissioned.','evidence':'policy=\x22'+a['name']+'\x22\x20id_from='+a['idFrom']+'\x20write_guards='+a['guards']['length'],'affected_stakeholders':['owner','system'],'confidence':'exact'}),b;}if(a['idFrom']===0x0&&c){const e=a['guards']['filter'](f=>!isPlain(f))['length'];b['push']({'id':'R-REP-W-01','level':'info','title':'Policy\x20\x22'+a['name']+'\x22:\x20guard-gated\x20write\x20path','description':'Row\x20ids\x20are\x20caller-\x20or\x20submission-supplied;\x20every\x20write\x20must\x20unlock\x20guard(s):\x20'+guardList(a)+',\x20through\x20a\x20passport.\x20'+(e>0x0?e+'\x20guard(s)\x20extract\x20the\x20row\x20id\x20and/or\x20data\x20from\x20their\x20submission\x20values\x20(mixed\x20entry\x20—\x20ALL\x20guards\x20must\x20unlock).\x20':'')+'A\x20single-guard\x20batch\x20entry\x20also\x20exists:\x20for\x20guards\x20WITHOUT\x20submission\x20extraction,\x20unlocking\x20ANY\x20ONE\x20configured\x20guard\x20authorizes\x20the\x20write.','evidence':'policy=\x22'+a['name']+'\x22\x20id_from=0\x20write_guards='+a['guards']['length'],'affected_stakeholders':['owner','customer'],'confidence':'exact'});}return b;}function chainIllegalFindings(a){if(a['idFrom']!==0x0){const b=a['guards']['filter'](c=>hasSubmission(c['idFromSubmission']));if(b['length']===0x0)return[];return[{'id':'R-REP-W-07','level':'high','title':'Policy\x20\x22'+a['name']+'\x22:\x20submission-extracted\x20row\x20id\x20on\x20an\x20auto-id\x20policy','description':'id_from='+a['idFrom']+'\x20generates\x20row\x20ids\x20from\x20the\x20'+(a['idFrom']===0x1?'clock':'signer')+',\x20but\x20'+b['length']+'\x20guard(s)\x20declare\x20id_from_submission\x20—\x20publishing\x20aborts\x20(routing\x20conflict,\x20chain\x20error\x2023).\x20Remove\x20the\x20submission-id\x20setting\x20from\x20every\x20guard\x20of\x20this\x20policy.','evidence':'policy=\x22'+a['name']+'\x22\x20id_from='+a['idFrom']+'\x20guards_with_id_submission='+b['length'],'affected_stakeholders':['owner'],'confidence':'exact'}];}if(a['guards']['length']>0x0)return[];return[{'id':'R-REP-W-07','level':'high','title':'Policy\x20\x22'+a['name']+'\x22:\x20unguarded\x20caller-keyed\x20writes','description':'id_from=0\x20with\x20an\x20EMPTY\x20write\x20guard\x20resurrects\x20the\x20fully\x20open\x20write\x20channel\x20(anyone\x20writes\x20and\x20REMOVES\x20arbitrary\x20rows\x20under\x20this\x20policy\x20name).\x20Publishing\x20aborts\x20by\x20design\x20(chain\x20error\x2022)\x20—\x20configure\x20at\x20least\x20one\x20write\x20guard.','evidence':'policy=\x22'+a['name']+'\x22\x20id_from=0\x20write_guards=0','affected_stakeholders':['owner','customer'],'confidence':'exact'}];}function writeOnceFindings(a){if(!a['writeOnce'])return[];const b=[];a['idFrom']===0x1&&b['push']({'id':'R-REP-W-09','level':'low','title':'Policy\x20\x22'+a['name']+'\x22:\x20write-once\x20is\x20a\x20silent\x20no-op\x20on\x20a\x20clock-append\x20policy','description':'Rows\x20under\x20an\x20id_from=Clock\x20policy\x20take\x20a\x20fresh\x20timestamp\x20id\x20on\x20every\x20write,\x20so\x20an\x20existing\x20id\x20is\x20never\x20addressed\x20again\x20and\x20the\x20write-once\x20check\x20can\x20never\x20reject\x20anything.\x20The\x20flag\x20is\x20stored\x20on-chain\x20but\x20changes\x20nothing:\x20it\x20neither\x20seals\x20a\x20record\x20nor\x20restricts\x20who\x20may\x20write.\x20If\x20the\x20intent\x20is\x20one\x20permanent\x20record\x20per\x20account,\x20key\x20rows\x20by\x20signer\x20(id_from=Signer);\x20if\x20it\x20is\x20a\x20sealed\x20caller-chosen\x20row,\x20use\x20id_from=None\x20(0)\x20with\x20a\x20write\x20guard.','mitigation':'Drop\x20write_once\x20on\x20this\x20policy,\x20or\x20switch\x20id_from\x20to\x20Signer\x20for\x20one\x20immutable\x20row\x20per\x20account.','evidence':'policy=\x22'+a['name']+'\x22\x20id_from=clock\x20write_once=true','affected_stakeholders':['owner','system'],'confidence':'exact'});if(a['guards']['length']===0x0){const c=a['idFrom']===0x2?'each\x20address\x20may\x20mint\x20its\x20own\x20signer-keyed\x20row\x20once':'any\x20address\x20may\x20mint\x20a\x20row';b['push']({'id':'R-REP-W-10','level':'high','title':'Policy\x20\x22'+a['name']+'\x22:\x20write-once\x20with\x20no\x20write\x20guard\x20—\x20the\x20first\x20write\x20is\x20open\x20to\x20anyone','description':'Write-once\x20only\x20rejects\x20OVERWRITING\x20an\x20existing\x20record;\x20it\x20never\x20decides\x20WHO\x20may\x20write\x20the\x20first\x20one.\x20This\x20policy\x20configures\x20no\x20write\x20guard,\x20so\x20the\x20write\x20channel\x20is\x20open\x20to\x20any\x20address:\x20'+c+',\x20and\x20every\x20later\x20write\x20to\x20that\x20id\x20is\x20rejected\x20by\x20the\x20write-once\x20check,\x20so\x20whoever\x20writes\x20first\x20keeps\x20the\x20row\x20permanently\x20sealed.\x20A\x20caller-supplied\x20id\x20(id_from=None)\x20cannot\x20even\x20be\x20configured\x20this\x20way\x20on-chain\x20(error\x2022)\x20—\x20publishing\x20this\x20payload\x20would\x20abort.','mitigation':'Add\x20at\x20least\x20one\x20write\x20guard\x20to\x20the\x20policy,\x20or\x20drop\x20write_once\x20if\x20open\x20one-shot\x20writes\x20are\x20intended.','evidence':'policy=\x22'+a['name']+'\x22\x20id_from='+(a['idFrom']??'absent')+'\x20write_guards=0\x20write_once=true','affected_stakeholders':['owner','customer'],'confidence':'exact'});}return b;}function orUnlockFindings(a){if(a['guards']['length']<0x2)return[];const b=a['guards']['filter'](isPlain);if(b['length']===0x0)return[];return[{'id':'R-REP-W-08','level':'medium','title':'Policy\x20\x22'+a['name']+'\x22:\x20single-guard\x20unlock\x20path\x20lowers\x20the\x20write\x20floor','description':a['guards']['length']+'\x20guards\x20are\x20configured,\x20but\x20the\x20plain\x20batch\x20entry\x20unlocks\x20writes\x20with\x20ANY\x20ONE\x20submission-free\x20guard\x20—\x20the\x20WEAKEST\x20of\x20['+b['map'](c=>c['guard']??'(proposal\x20guard)')['join'](',\x20')+']\x20defines\x20the\x20effective\x20write\x20floor,\x20not\x20the\x20full\x20committee.\x20Tighten\x20or\x20remove\x20the\x20weakest\x20guard,\x20or\x20give\x20every\x20guard\x20submission\x20extraction\x20(which\x20forces\x20the\x20all-guards\x20mixed\x20entry).','evidence':'policy=\x22'+a['name']+'\x22\x20guards='+a['guards']['length']+'\x20plain='+b['length'],'affected_stakeholders':['owner','customer'],'confidence':'exact'}];}function resolutionFinding(a,b,c,d,e,f,g,h){if(e['status']==='fetched')return undefined;const i=e['status']==='masked'?c+'\x20'+d+'\x20is\x20present\x20in\x20the\x20graph\x20but\x20ACCESS-GATED\x20for\x20the\x20current\x20viewer\x20—\x20'+f+'\x20cannot\x20be\x20witnessed\x20without\x20access\x20to\x20it.':e['status']==='unfetched'?c+'\x20'+d+'\x20is\x20in\x20the\x20graph\x20but\x20its\x20state\x20is\x20\x22'+e['state']+'\x22\x20—\x20'+f+'\x20cannot\x20be\x20witnessed\x20from\x20an\x20unfetched\x20object.':c+'\x20'+d+'\x20is\x20OUTSIDE\x20the\x20witnessed\x20topology\x20—\x20'+f+'\x20cannot\x20be\x20assessed.\x20'+depthAdvisory(h);return{'id':a,'level':b,'title':c+'\x20unresolved\x20—\x20write-permission\x20semantics\x20incomplete','description':i,'mitigation':e['status']==='absent'?'Re-run\x20the\x20analysis\x20with\x20a\x20deeper\x20exploration,\x20or\x20resolve\x20the\x20object\x20explicitly\x20and\x20re-analyze.':e['status']==='masked'?'Widen\x20viewer\x20access\x20and\x20re-analyze.':'Retry\x20once\x20the\x20object\x20fetch\x20succeeds.','evidence':c+'='+d+'\x20resolution='+e['status'],'affected_stakeholders':g,'confidence':'bounded'};}export function repositoryWritePayloadOf(a){if(a['proposal']){const e=a['raw'],f=e?.['data']??e;return f!=null&&typeof f==='object'&&!Array['isArray'](f)?f:undefined;}const b=a['raw'],c=b?.['data']??b;return c!=null&&typeof c==='object'&&!Array['isArray'](c)?c:undefined;}export function analyzeRepositoryWriteSemantics(a,b,c){const d=[],h=normalizePolicies(a),i=optAddr(a['permission']);if(i){const k=resolutionFinding('R-REP-W-04','medium','Repository\x20permission\x20(control\x20plane,\x20perm\x20100-105)',i,resolveInViewport(i,c),'who\x20holds\x20the\x20administrative\x20surface\x20(policy\x20add/remove,\x20messenger\x20binding,\x20owner\x20fund\x20recovery\x20and\x20the\x20rest\x20of\x20the\x20control\x20indices)',['owner','system'],c);if(k)d['push'](k);}if(h['length']===0x0)return d['push']({'id':'R-REP-W-01','level':'info','title':'Repository\x20has\x20no\x20write\x20policies','description':'No\x20PolicyRule\x20is\x20configured\x20—\x20the\x20repository\x20exposes\x20NO\x20data-write\x20surface\x20at\x20all\x20(writes\x20abort\x20with\x20an\x20unknown-policy\x20error).\x20Configure\x20a\x20policy\x20to\x20open\x20an\x20evidence\x20channel.','evidence':'policies=0','affected_stakeholders':['owner'],'confidence':'exact'}),d;for(const l of h){d['push'](...classificationFindings(l)),d['push'](...chainIllegalFindings(l)),d['push'](...orUnlockFindings(l)),d['push'](...writeOnceFindings(l));for(const m of l['guards']){if(!m['guard'])continue;const n=resolutionFinding('R-REP-W-02','medium','Write\x20guard\x20of\x20policy\x20\x22'+l['name']+'\x22',m['guard'],resolveInViewport(m['guard'],c),'what\x20the\x20guard\x20demands\x20before\x20a\x20row\x20lands\x20under\x20\x22'+l['name']+'\x22',['owner','customer'],c);if(n)d['push'](n);if(resolveInViewport(m['guard'],c)['status']==='fetched'){const o=c['graph']['out']['get'](m['guard'])??[];for(const p of o){if(p['schema']!=='guard.relies')continue;const q=resolutionFinding('R-REP-W-03','medium','Sub-guard\x20relied\x20on\x20by\x20the\x20write\x20guard\x20of\x20policy\x20\x22'+l['name']+'\x22',p['to'],resolveInViewport(p['to'],c),'the\x20sub-condition\x20that\x20participates\x20in\x20the\x20write\x20decision',['owner','customer'],c);if(q)d['push'](q);}}}if(l['quoteGuard']){const r=resolveInViewport(l['quoteGuard'],c),s=resolutionFinding('R-REP-W-05','medium','Quote\x20(read)\x20guard\x20of\x20policy\x20\x22'+l['name']+'\x22',l['quoteGuard'],r,'who\x20may\x20read\x20rows\x20under\x20this\x20policy\x20(subscription\x20gate)',['owner','customer','buyer'],c);if(s)d['push'](s);if(r['status']==='fetched'){const t=(c['graph']['out']['get'](l['quoteGuard'])??[])['filter'](u=>u['schema']==='guard.relies');t['length']>0x0&&d['push']({'id':'R-REP-W-05','level':'high','title':'Quote\x20guard\x20of\x20policy\x20\x22'+l['name']+'\x22\x20still\x20relies\x20on\x20sub-guards','description':'The\x20read\x20gate\x20must\x20be\x20a\x20DEPENDED\x20guard\x20(immutable,\x20no\x20relies)\x20—\x20this\x20one\x20carries\x20'+t['length']+'\x20reliance\x20edge(s),\x20so\x20the\x20configuration\x20cannot\x20exist\x20on-chain\x20and\x20the\x20payload\x20has\x20drifted\x20from\x20chain\x20truth.','evidence':'quote_guard='+l['quoteGuard']+'\x20relies='+t['length'],'affected_stakeholders':['owner','customer'],'confidence':'bounded'});}}}const j=optAddr(a['um']);if(j){const u=resolutionFinding('R-REP-W-06','low','Repository\x20membership\x20book\x20(um)',j,resolveInViewport(j,c),'which\x20members\x20may\x20read\x20or\x20write\x20under\x20member-scoped\x20policies',['owner','customer'],c);if(u)d['push'](u);}return d;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MAX_GUARD_COUNT_REWARD,MAX_RECORD_COUNT_REWARD}from'./onchain-constants.js';export{MAX_GUARD_COUNT_REWARD,MAX_RECORD_COUNT_REWARD};export const REWARD_NEW={'index':0x96,'name':'REWARD_NEW','description':'Create\x20new\x20Reward<T>','governed_operations':['create\x20a\x20new\x20Reward\x20pool'],'sdk_exposed':!![]};export const REWARD_DESCRIPTION={'index':0x97,'name':'REWARD_DESCRIPTION','description':'Update\x20description','governed_operations':['update\x20the\x20Reward\x20description'],'sdk_exposed':!![]};export const REWARD_GUARD={'index':0x98,'name':'REWARD_GUARD','description':'Add\x20/\x20remove\x20expired\x20guards\x20(≤\x20MAX_GUARD_COUNT_REWARD=200)','governed_operations':['add\x20a\x20claim\x20guard\x20to\x20the\x20Reward','remove\x20expired\x20claim\x20guards'],'sdk_exposed':!![]};export const REWARD_COIN_ADD={'index':0x99,'name':'REWARD_COIN_ADD','description':'Deposit\x20Coin<T>\x20directly\x20into\x20Reward\x20balance\x20(joins\x20Balance<T>)','governed_operations':['deposit\x20Coin<T>\x20into\x20the\x20Reward\x20balance'],'sdk_exposed':!![]};export const REWARD_RECEIVE={'index':0x9a,'name':'REWARD_RECEIVE','description':'Receive\x20CoinWrapper<T>\x20into\x20the\x20balance\x20(unwrapped\x20with\x20balance\x20check)','governed_operations':['receive\x20a\x20CoinWrapper<T>\x20payment\x20into\x20the\x20balance'],'sdk_exposed':!![]};export const REWARD_GUARD_EXPIRATION_TIME_ADD={'index':0x9b,'name':'REWARD_GUARD_EXPIRATION_TIME_ADD','description':'Set\x20/\x20cancel\x20guard_not_added_expiration_time\x20(time-lock\x20on\x20new\x20guard\x20additions)','governed_operations':['set\x20or\x20cancel\x20the\x20time-lock\x20on\x20adding\x20new\x20guards'],'sdk_exposed':!![]};export const REWARD_OWNER_RECEIVE={'index':0x9c,'name':'REWARD_OWNER_RECEIVE','description':'Owner\x20receives\x20Receiving<K>\x20/\x20CoinWrapper<K>\x20at\x20terminal\x20state\x20(unwrap\x20→\x20owner)','governed_operations':['owner\x20receipt\x20of\x20payments\x20at\x20terminal\x20state\x20(unwrapped\x20to\x20the\x20owner)','owner\x20receipt\x20of\x20whole\x20objects\x20at\x20terminal\x20state'],'sdk_exposed':!![]};export const REWARD_UM={'index':0x9d,'name':'REWARD_UM','description':'Bind\x20/\x20unbind\x20Contact\x20(UM)\x20for\x20off-chain\x20coordination','governed_operations':['bind\x20a\x20Contact\x20as\x20the\x20UM\x20coordinator','unbind\x20the\x20UM\x20Contact'],'sdk_exposed':!![]};export const REWARD_WITHDRAW={'index':0x9e,'name':'REWARD_WITHDRAW','description':'Withdraw\x20balance\x20from\x20the\x20Reward\x20to\x20the\x20tx\x20sender\x20inside\x20a\x20Payment\x20object\x20receipt\x20(ETS-B,\x20the\x20only\x20non-claim\x20exit;\x20blocked\x20while\x20the\x20declared\x20no-guard\x20window\x20guard_not_added_expiration_time\x20is\x20in\x20the\x20future)','governed_operations':['withdraw\x20an\x20amount\x20from\x20the\x20Reward\x20balance,\x20delivered\x20to\x20the\x20executing\x20account\x20inside\x20a\x20Payment\x20object\x20(the\x20on-chain\x20receipt;\x20unwrap\x20mode\x20pays\x20the\x20coin\x20out\x20in\x20the\x20same\x20transaction)\x20(fails\x20with\x20E_GUARD_LOCKED_TIME\x20while\x20guard_not_added_expiration_time\x20is\x20in\x20the\x20future)'],'sdk_exposed':!![]};export const REWARD_PERMISSIONS=[REWARD_NEW,REWARD_DESCRIPTION,REWARD_GUARD,REWARD_COIN_ADD,REWARD_RECEIVE,REWARD_GUARD_EXPIRATION_TIME_ADD,REWARD_OWNER_RECEIVE,REWARD_UM,REWARD_WITHDRAW];export const REWARD_FIELDS=[{'name':'id','move_type':'UID','mutability':'immutable','set_at_creation':!![],'constraint':'Object\x20UID;\x20assigned\x20at\x20creation.\x20Never\x20changes.'},{'name':'description','move_type':'String','mutability':'admin_mutable','set_at_creation':!![],'permission_index':0x97,'constraint':'Must\x20satisfy\x20common::DESCRIPTION.\x20Updated\x20via\x20permission\x20151.'},{'name':'guards','move_type':'vector<RewardGuard>','mutability':'admin_mutable','set_at_creation':!![],'permission_index':0x98,'constraint':'vector::length\x20<\x20MAX_GUARD_COUNT\x20(200);\x20E_GUARD_COUNT_EXCEEDED\x20on\x20overflow.','related_errors':['E_GUARD_COUNT_EXCEEDED']},{'name':'balance','move_type':'Balance<T>','mutability':'runtime','set_at_creation':!![],'constraint':'Zero\x20at\x20creation\x20(balance::zero());\x20grows\x20via\x20coin_add/receive;\x20shrinks\x20via\x20claim\x20(split)\x20and\x20via\x20withdraw\x20(ETS-B,\x20funds\x20leave\x20inside\x20a\x20Payment\x20object\x20receipt,\x20only\x20when\x20the\x20no-guard\x20window\x20has\x20elapsed).','related_errors':['E_INSUFFICIENT_BALANCE','E_GUARD_LOCKED_TIME']},{'name':'guard_not_added_expiration_time','move_type':'Option<u64>','mutability':'admin_mutable','set_at_creation':!![],'permission_index':0x9b,'constraint':'Option<timestamp_ms>.\x20When\x20Some(t):\x20guard_add\x20AND\x20withdraw\x20require\x20clock\x20>\x20t\x20(E_GUARD_LOCKED_TIME).\x20When\x20None\x20or\x20t\x20<\x20now:\x20guards\x20can\x20be\x20added\x20and\x20balance\x20withdrawn.','related_errors':['E_GUARD_LOCKED_TIME','E_GUARD_LOCKED_TIME_NOT_INCREASING','E_GUARD_LOCKED_TIME_INVALID']},{'name':'record','move_type':'ParentTable<address,\x20RecipientRecord>','mutability':'runtime','set_at_creation':!![],'constraint':'Per-recipient\x20claim\x20history.\x20Each\x20RecipientRecord.amount\x20vector\x20has\x20length\x20<\x20MAX_RECORD_COUNT\x20(5200);\x20E_RECORD_COUNT_EXCEEDED\x20on\x20overflow.','related_errors':['E_RECORD_COUNT_EXCEEDED']},{'name':'um','move_type':'Option<address>','mutability':'admin_mutable','set_at_creation':!![],'permission_index':0x9d,'constraint':'Option<Contact\x20address>.\x20Binding\x20creates\x20an\x20object-linker\x20core\x20binding;\x20unbinding\x20disaffiliates.'},{'name':'permission','move_type':'address','mutability':'admin_mutable','set_at_creation':!![],'constraint':'Permission\x20object\x20address.\x20Updated\x20owner-only\x20(asserts\x20old.owner\x20==\x20sender);\x20the\x20change\x20is\x20registered\x20as\x20an\x20object-linker\x20affiliation\x20change.'}];export const REWARD_GUARD_CONSTRUCTORS=[{'constructor':'dynamic_recipient_dynamic_amount','recipient_type':'GuardIdentifier','amount_type':'GuardU64Identifier','params':{'recipient_param':'u8','amount_param':'u8','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['recipient\x20identifier\x20must\x20resolve\x20to\x20an\x20address\x20in\x20the\x20Passport\x20table\x20—\x20E_RECIPIENT_IDENTIFIER_NOT_ADDRESS\x20(4)','amount\x20identifier\x20must\x20resolve\x20to\x20a\x20u64\x20Passport\x20value\x20—\x20E_AMOUNT_NOT_U64\x20(5)','if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Dynamic\x20recipient\x20+\x20dynamic\x20amount\x20—\x20both\x20extracted\x20from\x20Passport\x20at\x20claim\x20time\x20(e.g.\x20referral\x20rewards\x20where\x20referrer\x20and\x20amount\x20vary\x20per\x20claim).'},{'constructor':'dynamic_recipient_fixed_amount','recipient_type':'GuardIdentifier','amount_type':'Fixed','params':{'recipient_param':'u8','amount_param':'u64','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['recipient\x20identifier\x20must\x20resolve\x20to\x20an\x20address\x20in\x20the\x20Passport\x20table\x20—\x20E_RECIPIENT_IDENTIFIER_NOT_ADDRESS\x20(4)','if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Dynamic\x20recipient\x20+\x20fixed\x20amount\x20—\x20e.g.\x20first-order\x20reward\x20where\x20any\x20new\x20customer\x20claims\x20a\x20fixed\x201\x20WOW.'},{'constructor':'entity_recipient_dynamic_amount','recipient_type':'Entity','amount_type':'GuardU64Identifier','params':{'recipient_param':'address','amount_param':'u8','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['amount\x20identifier\x20must\x20resolve\x20to\x20a\x20u64\x20Passport\x20value\x20—\x20E_AMOUNT_NOT_U64\x20(5)','if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Fixed\x20recipient\x20+\x20dynamic\x20amount\x20—\x20e.g.\x20tiered\x20loyalty\x20reward\x20where\x20amount\x20depends\x20on\x20Passport\x20submission\x20(tier\x20level).'},{'constructor':'entity_recipient_fixed_amount','recipient_type':'Entity','amount_type':'Fixed','params':{'recipient_param':'address','amount_param':'u64','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Fully\x20fixed\x20recipient\x20+\x20amount\x20—\x20simplest\x20configuration\x20(e.g.\x20specific\x20partner\x20bounty).'},{'constructor':'caller_recipient_dynamic_amount','recipient_type':'Signer','amount_type':'GuardU64Identifier','params':{'amount_param':'u8','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['amount\x20identifier\x20must\x20resolve\x20to\x20a\x20u64\x20Passport\x20value\x20—\x20E_AMOUNT_NOT_U64\x20(5)','if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Caller\x20is\x20recipient\x20+\x20dynamic\x20amount\x20—\x20e.g.\x20self-service\x20claim\x20where\x20amount\x20depends\x20on\x20Passport\x20submission\x20(e.g.\x20cashback\x20rate).'},{'constructor':'caller_recipient_fixed_amount','recipient_type':'Signer','amount_type':'Fixed','params':{'amount_param':'u64','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Caller\x20is\x20recipient\x20+\x20fixed\x20amount\x20—\x20e.g.\x20flash\x20sale\x20where\x20any\x20eligible\x20caller\x20claims\x20a\x20fixed\x20reward.'}];export const REWARD_ERROR_CODES=[{'code':0x1,'name':'E_GUARD_LOCKED_TIME_NOT_INCREASING','description':'guard-lock\x20time\x20update:\x20new\x20time\x20<\x20current\x20clock\x20(must\x20be\x20≥\x20now)','trigger_operation':'guard-lock\x20time\x20update\x20(155)'},{'code':0x2,'name':'E_GUARD_EXPIRED','description':'guard_add\x20on\x20guard\x20with\x20expiration_time\x20<\x20now,\x20OR\x20claim\x20on\x20guard\x20with\x20expiration_time\x20<\x20now','trigger_operation':'guard_add\x20/\x20claim'},{'code':0x3,'name':'E_GUARD_COUNT_EXCEEDED','description':'guard_add\x20would\x20exceed\x20MAX_GUARD_COUNT=200\x20(only\x20on\x20NEW\x20guard,\x20not\x20on\x20update\x20of\x20existing)','trigger_operation':'guard_add'},{'code':0x4,'name':'E_RECIPIENT_IDENTIFIER_NOT_ADDRESS','description':'RewardGuard\x20constructor:\x20recipient\x20identifier\x20type\x20is\x20not\x20address\x20(GuardIdentifier\x20variant\x20only)','trigger_operation':'claim-guard\x20construction'},{'code':0x5,'name':'E_AMOUNT_NOT_U64','description':'RewardGuard\x20constructor:\x20amount\x20identifier\x20type\x20is\x20not\x20u64\x20(GuardU64Identifier\x20variant\x20only)','trigger_operation':'claim-guard\x20construction'},{'code':0x6,'name':'E_INSUFFICIENT_BALANCE','description':'claim:\x20balance\x20<\x20amount\x20(cannot\x20split\x20more\x20than\x20held)','trigger_operation':'claim'},{'code':0x7,'name':'E_GUARD_NOT_FOUND','description':'claim:\x20no\x20guard\x20in\x20self.guards\x20matches\x20the\x20supplied\x20guard\x20address','trigger_operation':'claim'},{'code':0x8,'name':'E_RECORD_COUNT_EXCEEDED','description':'claim:\x20recipient\x20already\x20has\x20MAX_RECORD_COUNT=5200\x20entries\x20(E_RECORD_COUNT_EXCEEDED)','trigger_operation':'claim'},{'code':0xa,'name':'E_GUARD_LOCKED_TIME','description':'guard_add\x20/\x20withdraw\x20while\x20guard_not_added_expiration_time\x20is\x20Some\x20and\x20clock\x20≤\x20expiration_time','trigger_operation':'guard_add\x20/\x20withdraw'},{'code':0xb,'name':'E_GUARD_LOCKED_TIME_INVALID','description':'guard-lock\x20time\x20update:\x20new\x20Some(t)\x20where\x20t\x20≤\x20now\x20(must\x20be\x20future)','trigger_operation':'guard-lock\x20time\x20update\x20(155)'},{'code':0xc,'name':'E_STORE_FROM_ID_NOT_COMPATIBLE','description':'RewardGuard\x20constructor:\x20store_from_id\x20identifier\x20type\x20is\x20not\x20number\x20or\x20address','trigger_operation':'claim-guard\x20construction'},{'code':0xd,'name':'E_CLAIM_ALREADY_MADE','description':'claim:\x20the\x20(recipient,\x20guard,\x20store_from\x20value)\x20once-slot\x20is\x20already\x20consumed\x20(MOV-PROTOCOL-1212\x20F-01\x20fix\x20—\x20replay\x20aborts,\x20the\x20pool\x20keeps\x20its\x20balance).\x20Empty\x20store_from\x20slot\x20=\x20once\x20per\x20(recipient,\x20guard);\x20a\x20store_from\x20value\x20pins\x20a\x20per-value\x20slot\x20(per-order\x20bounty)','trigger_operation':'claim'},{'code':0xe,'name':'E_CLAIM_RECIPIENT_NOT_SIGNER','description':'claim:\x20the\x20resolved\x20recipient\x20(from\x20guard\x20submissions\x20or\x20the\x20Entity\x20binding)\x20is\x20not\x20the\x20transaction\x20sender\x20(MOV-PROTOCOL-1212\x20B5\x20fix\x20—\x20an\x20attacker\x20cannot\x20route\x20a\x20reward\x20to\x20a\x20third\x20address).\x20Entity\x20flows\x20pass\x20because\x20the\x20SDK\x20replaces\x20the\x20sender\x20with\x20the\x20entity\x20account','trigger_operation':'claim'}];export const REWARD_SCENES=[{'id':'reward_first_order','name':'First-order\x20reward','industry':['universal','ecommerce','service','freelance'],'scenario':'New\x20customers\x20receive\x20a\x20fixed\x20reward\x20after\x20their\x20first\x20order.\x20Guard\x20verifies\x20order\x20ownership\x20+\x20first-time\x20status;\x20'+'Recipient=Signer\x20(caller\x20is\x20the\x20new\x20customer);\x20Amount=Fixed\x20(e.g.\x201\x20WOW).','phases':['creation','guard_addition','funds_replenish','claim'],'coin_type_note':'T\x20=\x20project\x20reward\x20coin\x20(e.g.\x200x2::wow::WOW\x20or\x20a\x20custom\x20token)','typical_guard_count':0x1,'recipient_types_used':['Signer'],'amount_types_used':['Fixed'],'uses_expiration_time':!![],'uses_store_from_id':![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD],'common_patterns':['Signer\x20recipient\x20+\x20Fixed\x20amount\x20—\x20caller\x20claims\x20a\x20fixed\x20amount\x20(e.g.\x201\x20WOW)','Guard\x20verifies:\x20order_address.holder\x20==\x20signer\x20AND\x20order\x20is\x20the\x20first\x20order\x20(Repository\x20query)','expiration_time\x20bounds\x20the\x20campaign\x20window\x20(e.g.\x2030\x20days)','coin_add\x20deposits\x20the\x20campaign\x20budget\x20upfront\x20(e.g.\x20100\x20WOW\x20for\x20100\x20claims)'],'recommended_templates':['first_order']},{'id':'reward_referral','name':'Referral\x20viral\x20reward','industry':['universal','ecommerce','service','content'],'scenario':'Both\x20referrer\x20and\x20referee\x20receive\x20a\x20reward\x20when\x20the\x20referee\x20completes\x20a\x20first\x20order.\x20Two\x20guards:\x20one\x20for\x20referrer\x20(Entity),\x20one\x20for\x20referee\x20(Signer).','phases':['creation','guard_addition','funds_replenish','claim'],'coin_type_note':'T\x20=\x20project\x20reward\x20coin','typical_guard_count':0x2,'recipient_types_used':['Entity','Signer'],'amount_types_used':['Fixed'],'uses_expiration_time':!![],'uses_store_from_id':!![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD],'common_patterns':['Entity\x20recipient\x20+\x20Fixed\x20amount\x20for\x20the\x20referrer\x20(recipient\x20=\x20referrer\x20address)','Signer\x20recipient\x20+\x20Fixed\x20amount\x20for\x20the\x20referee\x20(caller\x20is\x20recipient)','Guard\x20verifies:\x20referrer\x20marked\x20in\x20Repository\x20AND\x20referee\x27s\x20order\x20completed','store_from_id\x20may\x20record\x20the\x20order\x20address\x20for\x20audit\x20trail'],'recommended_templates':['referral']},{'id':'reward_loyalty','name':'Loyalty\x20tiered\x20reward','industry':['universal','ecommerce','subscription','content'],'scenario':'Customers\x20unlock\x20higher\x20rewards\x20after\x20reaching\x20cumulative\x20spending\x20tiers.\x20Recipient=Signer;\x20Amount=GuardU64Identifier\x20(tier-dependent\x20amount\x20extracted\x20from\x20Passport).','phases':['creation','guard_addition','funds_replenish','claim'],'coin_type_note':'T\x20=\x20project\x20reward\x20coin','typical_guard_count':0x1,'recipient_types_used':['Signer'],'amount_types_used':['GuardU64Identifier'],'uses_expiration_time':![],'uses_store_from_id':![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD],'common_patterns':['Signer\x20recipient\x20+\x20identifier\x20amount\x20—\x20amount\x20is\x20dynamic,\x20extracted\x20from\x20Passport\x20submission\x20(tier\x20level\x20→\x20reward\x20amount)','Guard\x20verifies:\x20cumulative\x20spend\x20≥\x20tier\x20threshold\x20(Repository\x20query)','No\x20expiration_time\x20—\x20loyalty\x20is\x20perpetual\x20(until\x20deactivated\x20via\x20guard_remove_expired)','Guard\x20submission\x20value\x20type\x20MUST\x20be\x20u64\x20(E_AMOUNT_NOT_U64\x20otherwise)'],'recommended_templates':['loyalty']},{'id':'reward_flash_sale','name':'Limited-time\x20flash\x20sale\x20reward','industry':['universal','ecommerce','retail'],'scenario':'Time-bounded\x20reward\x20for\x20the\x20first\x20N\x20callers.\x20Recipient=Signer;\x20Amount=Fixed.\x20Guard\x20verifies\x20time\x20window\x20+\x20claim\x20count.','phases':['creation','guard_addition','funds_replenish','claim','guard_lock_mgmt'],'coin_type_note':'T\x20=\x20project\x20reward\x20coin','typical_guard_count':0x1,'recipient_types_used':['Signer'],'amount_types_used':['Fixed'],'uses_expiration_time':!![],'uses_store_from_id':![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD,REWARD_GUARD_EXPIRATION_TIME_ADD],'common_patterns':['Signer\x20recipient\x20+\x20Fixed\x20amount\x20—\x20fixed\x20amount\x20per\x20claim\x20(e.g.\x202\x20WOW)','expiration_time\x20bounds\x20the\x20flash\x20sale\x20window\x20(e.g.\x2048\x20hours)','the\x20guard-addition\x20time-lock\x20(155)\x20may\x20lock\x20further\x20guard\x20additions\x20during\x20the\x20sale','Budget\x20=\x20max_claims\x20×\x20amount;\x20coin_add\x20deposits\x20this\x20upfront'],'recommended_templates':['flash_sale']},{'id':'reward_bulk_discount','name':'Bulk\x20discount\x20/\x20cashback\x20reward','industry':['universal','ecommerce','wholesale','service'],'scenario':'Customer\x20receives\x20cashback\x20proportional\x20to\x20order\x20size.\x20Recipient=Signer\x20or\x20Entity\x20(order\x20holder);\x20Amount=GuardU64Identifier\x20(cashback\x20rate\x20from\x20Passport).','phases':['creation','guard_addition','funds_replenish','claim'],'coin_type_note':'T\x20=\x20payment\x20coin\x20type\x20(must\x20match\x20order\x20payment\x20for\x20clean\x20cashback)','typical_guard_count':0x1,'recipient_types_used':['Signer','Entity'],'amount_types_used':['GuardU64Identifier'],'uses_expiration_time':![],'uses_store_from_id':!![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD,REWARD_RECEIVE],'common_patterns':['Signer\x20recipient\x20+\x20identifier\x20amount\x20—\x20caller\x20claims\x20dynamic\x20amount\x20(cashback\x20=\x20order_amount\x20×\x20rate)','store_from_id\x20records\x20the\x20order\x20address\x20for\x20cross-reference\x20(audit\x20trail)','receive\x20(154)\x20may\x20be\x20used\x20to\x20accept\x20CoinWrapper<T>\x20refunds\x20that\x20replenish\x20the\x20balance','Guard\x20verifies:\x20order.completed\x20AND\x20order.service\x20==\x20this\x20Service'],'recommended_templates':['cashback']},{'id':'reward_milestone','name':'Service\x20milestone\x20reward','industry':['universal','ecommerce','content','subscription'],'scenario':'When\x20a\x20Service\x20reaches\x20a\x20milestone\x20(e.g.\x20100\x20orders),\x20early\x20supporters\x20receive\x20extra\x20rewards.\x20Recipient=Entity\x20(early\x20customer);\x20Amount=Fixed.','phases':['creation','guard_addition','funds_replenish','claim','guard_lock_mgmt'],'coin_type_note':'T\x20=\x20project\x20reward\x20coin','typical_guard_count':0x32,'recipient_types_used':['Entity'],'amount_types_used':['Fixed'],'uses_expiration_time':!![],'uses_store_from_id':![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD,REWARD_GUARD_EXPIRATION_TIME_ADD],'common_patterns':['Entity\x20recipient\x20+\x20Fixed\x20amount\x20for\x20each\x20early\x20customer\x20(recipient\x20=\x20customer\x20address)','Multiple\x20guards\x20(up\x20to\x2050\x20for\x2050\x20early\x20supporters)\x20—\x20well\x20within\x20MAX_GUARD_COUNT=200','Guard\x20verifies:\x20Service\x20order_count\x20>=\x20milestone\x20AND\x20claimer\x20is\x20in\x20early-customer\x20list','the\x20guard-addition\x20time-lock\x20(155)\x20may\x20lock\x20the\x20guard\x20list\x20after\x20milestone\x20setup'],'recommended_templates':['milestone']}];export const REWARD_LEDGER_VERSION='1.0.0';export function getScenesByPhase(a){return REWARD_SCENES['filter'](b=>b['phases']['includes'](a));}export function findSceneById(a){return REWARD_SCENES['find'](b=>b['id']===a);}export function getScenesByIndustry(a){return REWARD_SCENES['filter'](b=>b['industry']['includes'](a)||b['industry']['includes']('universal'));}export function getBuiltinPermissionByIndex(a){return REWARD_PERMISSIONS['find'](b=>b['index']===a);}export function isRewardBuiltinPermission(a){return getBuiltinPermissionByIndex(a)!==undefined;}export function getAllBuiltinPermissions(){return[...REWARD_PERMISSIONS];}export function getRewardScenesCount(){return REWARD_SCENES['length'];}export function getGuardConstructorSpec(a){return REWARD_GUARD_CONSTRUCTORS['find'](b=>b['constructor']===a);}export function resolveGuardConstructor(a,b){const c={'GuardIdentifier|GuardU64Identifier':'dynamic_recipient_dynamic_amount','GuardIdentifier|Fixed':'dynamic_recipient_fixed_amount','Entity|GuardU64Identifier':'entity_recipient_dynamic_amount','Entity|Fixed':'entity_recipient_fixed_amount','Signer|GuardU64Identifier':'caller_recipient_dynamic_amount','Signer|Fixed':'caller_recipient_fixed_amount'};return c[a+'|'+b];}export function getRewardErrorByCode(a){return REWARD_ERROR_CODES['find'](b=>b['code']===a);}export function getRewardErrorByName(a){return REWARD_ERROR_CODES['find'](b=>b['name']===a);}export function validateGuardCount(a){if(a>=MAX_GUARD_COUNT_REWARD)return{'ok':![],'violation':'Guard\x20count\x20'+a+'\x20would\x20exceed\x20MAX_GUARD_COUNT_REWARD\x20'+MAX_GUARD_COUNT_REWARD};return{'ok':!![]};}export function validateRecordCount(a){if(a>=MAX_RECORD_COUNT_REWARD)return{'ok':![],'violation':'Record\x20count\x20'+a+'\x20would\x20exceed\x20MAX_RECORD_COUNT_REWARD\x20'+MAX_RECORD_COUNT_REWARD+'\x20—\x20recipient\x20can\x20no\x20longer\x20claim'};return{'ok':!![]};}export function inferSceneFromIntent(a){const b=a['toLowerCase'](),c=[['flash\x20sale','reward_flash_sale'],['flash_sale','reward_flash_sale'],['limited-time','reward_flash_sale'],['limited\x20time','reward_flash_sale'],['referral','reward_referral'],['viral','reward_referral'],['refer\x20a\x20friend','reward_referral'],['invite','reward_referral'],['loyalty','reward_loyalty'],['tiered','reward_loyalty'],['tier','reward_loyalty'],['repeat','reward_loyalty'],['cashback','reward_bulk_discount'],['bulk\x20discount','reward_bulk_discount'],['bulk_discount','reward_bulk_discount'],['wholesale','reward_bulk_discount'],['milestone','reward_milestone'],['early\x20supporter','reward_milestone'],['early\x20customer','reward_milestone'],['first\x20order','reward_first_order'],['first_order','reward_first_order'],['new\x20customer','reward_first_order'],['first-time','reward_first_order']];for(const [d,e]of c){if(b['includes'](d)){const f=findSceneById(e);if(f)return f;}}return undefined;}export const REWARD_CROSS_OBJECT_REFS=[{'object':'Permission','phase':'universal','relationship':'Reward.permission\x20(address;\x20borrowed\x20for\x20all\x20150-157\x20assertions)'},{'object':'Permission','phase':'permission_update','relationship':'permission\x20update:\x20owner-only\x20(asserts\x20old.owner\x20==\x20sender);\x20registered\x20as\x20an\x20object-linker\x20affiliation\x20change'},{'object':'Guard','phase':'guard_addition','relationship':'RewardGuard.guard\x20=\x20guard.id_address\x20(each\x20guard\x20registered\x20via\x20object-linker\x20core\x20binding)'},{'object':'Guard','phase':'claim','relationship':'claim:\x20iterates\x20self.guards\x20looking\x20for\x20guard.id_address\x20match;\x20E_GUARD_NOT_FOUND\x20if\x20no\x20match'},{'object':'Guard','phase':'claim','relationship':'claim:\x20the\x20guard\x20verification\x20result\x20validates\x20the\x20Passport\x20submission\x20data'},{'object':'Passport','phase':'claim','relationship':'claim:\x20the\x20claimant\x27s\x20Passport\x20submission\x20supplies\x20the\x20recipient\x20(address)\x20and/or\x20amount\x20(u64)\x20per\x20RewardGuard\x20variant'},{'object':'Passport','phase':'claim','relationship':'claim:\x20if\x20store_from_id\x20is\x20Some,\x20extracts\x20store-from\x20address\x20from\x20Passport\x20submission'},{'object':'Payment','phase':'funds_replenish','relationship':'receive\x20(154):\x20unwraps\x20Coin<T>\x20from\x20CoinWrapper<T>\x20(with\x20check)\x20and\x20joins\x20the\x20balance'},{'object':'Payment','phase':'owner_receive','relationship':'owner\x20receipt\x20(156):\x20unwraps\x20CoinWrapper<K>\x20and\x20forwards\x20it\x20to\x20the\x20Permission\x20owner'},{'object':'Repository','phase':'claim','relationship':'Guard\x20may\x20query\x20Repository\x20(e.g.\x20order\x20history\x20for\x20first-order\x20/\x20loyalty\x20verification)'},{'object':'Service','phase':'claim','relationship':'Guard\x20may\x20verify\x20order.service\x20==\x20this\x20Service\x20(cashback\x20/\x20first-order\x20scenarios)'},{'object':'Demand','phase':'guard_addition','relationship':'Guard\x20may\x20be\x20shared\x20with\x20Demand\x20(recommendation\x20filtering);\x20same\x20Guard\x20object\x20address\x20space'},{'object':'Allocation','phase':'owner_receive','relationship':'Terminal\x20Allocation\x20alloc\x20may\x20route\x20funds\x20back\x20to\x20Reward\x20(replenishment\x20loop)'},{'object':'Contact','phase':'um_mgmt','relationship':'UM\x20binding\x20(157):\x20binds\x20Contact\x20(UM)\x20for\x20off-chain\x20coordination;\x20creates\x20object-linker\x20core\x20binding'},{'object':'Coin','phase':'universal','relationship':'Reward<phantom\x20T>:\x20T\x20is\x20the\x20coin\x20type;\x20balance:\x20Balance<T>;\x20coin_add\x20expects\x20Coin<T>'}];
|
|
1
|
+
import{MAX_GUARD_COUNT_REWARD,MAX_RECORD_COUNT_REWARD}from'./onchain-constants.js';export{MAX_GUARD_COUNT_REWARD,MAX_RECORD_COUNT_REWARD};export const REWARD_NEW={'index':0x96,'name':'REWARD_NEW','description':'Create\x20new\x20Reward<T>','governed_operations':['create\x20a\x20new\x20Reward\x20pool'],'sdk_exposed':!![]};export const REWARD_DESCRIPTION={'index':0x97,'name':'REWARD_DESCRIPTION','description':'Update\x20description','governed_operations':['update\x20the\x20Reward\x20description'],'sdk_exposed':!![]};export const REWARD_GUARD={'index':0x98,'name':'REWARD_GUARD','description':'Add\x20/\x20remove\x20expired\x20guards\x20(≤\x20MAX_GUARD_COUNT_REWARD=200)','governed_operations':['add\x20a\x20claim\x20guard\x20to\x20the\x20Reward','remove\x20expired\x20claim\x20guards'],'sdk_exposed':!![]};export const REWARD_COIN_ADD={'index':0x99,'name':'REWARD_COIN_ADD','description':'Deposit\x20Coin<T>\x20directly\x20into\x20Reward\x20balance\x20(joins\x20Balance<T>)','governed_operations':['deposit\x20Coin<T>\x20into\x20the\x20Reward\x20balance'],'sdk_exposed':!![]};export const REWARD_RECEIVE={'index':0x9a,'name':'REWARD_RECEIVE','description':'Receive\x20CoinWrapper<T>\x20into\x20the\x20balance\x20(unwrapped\x20with\x20balance\x20check)','governed_operations':['receive\x20a\x20CoinWrapper<T>\x20payment\x20into\x20the\x20balance'],'sdk_exposed':!![]};export const REWARD_GUARD_EXPIRATION_TIME_ADD={'index':0x9b,'name':'REWARD_GUARD_EXPIRATION_TIME_ADD','description':'Set\x20/\x20cancel\x20guard_not_added_expiration_time\x20(time-lock\x20on\x20new\x20guard\x20additions)','governed_operations':['set\x20or\x20cancel\x20the\x20time-lock\x20on\x20adding\x20new\x20guards'],'sdk_exposed':!![]};export const REWARD_OWNER_RECEIVE={'index':0x9c,'name':'REWARD_OWNER_RECEIVE','description':'Owner\x20receives\x20Receiving<K>\x20/\x20CoinWrapper<K>\x20at\x20terminal\x20state\x20(unwrap\x20→\x20owner)','governed_operations':['owner\x20receipt\x20of\x20payments\x20at\x20terminal\x20state\x20(unwrapped\x20to\x20the\x20owner)','owner\x20receipt\x20of\x20whole\x20objects\x20at\x20terminal\x20state'],'sdk_exposed':!![]};export const REWARD_UM={'index':0x9d,'name':'REWARD_UM','description':'Bind\x20/\x20unbind\x20Contact\x20(UM)\x20for\x20off-chain\x20coordination','governed_operations':['bind\x20a\x20Contact\x20as\x20the\x20UM\x20coordinator','unbind\x20the\x20UM\x20Contact'],'sdk_exposed':!![]};export const REWARD_WITHDRAW={'index':0x9e,'name':'REWARD_WITHDRAW','description':'Withdraw\x20balance\x20from\x20the\x20Reward\x20to\x20the\x20tx\x20sender\x20inside\x20a\x20Payment\x20object\x20receipt\x20(ETS-B,\x20the\x20only\x20non-claim\x20exit;\x20blocked\x20while\x20the\x20declared\x20no-guard\x20window\x20guard_not_added_expiration_time\x20is\x20in\x20the\x20future)','governed_operations':['withdraw\x20an\x20amount\x20from\x20the\x20Reward\x20balance,\x20delivered\x20to\x20the\x20executing\x20account\x20inside\x20a\x20Payment\x20object\x20(the\x20on-chain\x20receipt;\x20unwrap\x20mode\x20pays\x20the\x20coin\x20out\x20in\x20the\x20same\x20transaction)\x20(fails\x20with\x20E_GUARD_LOCKED_TIME\x20while\x20guard_not_added_expiration_time\x20is\x20in\x20the\x20future)'],'sdk_exposed':!![]};export const REWARD_PERMISSIONS=[REWARD_NEW,REWARD_DESCRIPTION,REWARD_GUARD,REWARD_COIN_ADD,REWARD_RECEIVE,REWARD_GUARD_EXPIRATION_TIME_ADD,REWARD_OWNER_RECEIVE,REWARD_UM,REWARD_WITHDRAW];export const REWARD_FIELDS=[{'name':'id','move_type':'UID','mutability':'immutable','set_at_creation':!![],'constraint':'Object\x20UID;\x20assigned\x20at\x20creation.\x20Never\x20changes.'},{'name':'description','move_type':'String','mutability':'admin_mutable','set_at_creation':!![],'permission_index':0x97,'constraint':'Must\x20satisfy\x20common::DESCRIPTION.\x20Updated\x20via\x20permission\x20151.'},{'name':'guards','move_type':'vector<RewardGuard>','mutability':'admin_mutable','set_at_creation':!![],'permission_index':0x98,'constraint':'vector::length\x20<\x20MAX_GUARD_COUNT\x20(200);\x20E_GUARD_COUNT_EXCEEDED\x20on\x20overflow.','related_errors':['E_GUARD_COUNT_EXCEEDED']},{'name':'balance','move_type':'Balance<T>','mutability':'runtime','set_at_creation':!![],'constraint':'Zero\x20at\x20creation\x20(balance::zero());\x20grows\x20via\x20coin_add/receive;\x20shrinks\x20via\x20claim\x20(split)\x20and\x20via\x20withdraw\x20(ETS-B,\x20funds\x20leave\x20inside\x20a\x20Payment\x20object\x20receipt,\x20only\x20when\x20the\x20no-guard\x20window\x20has\x20elapsed).','related_errors':['E_INSUFFICIENT_BALANCE','E_GUARD_LOCKED_TIME']},{'name':'guard_not_added_expiration_time','move_type':'Option<u64>','mutability':'admin_mutable','set_at_creation':!![],'permission_index':0x9b,'constraint':'Option<timestamp_ms>.\x20When\x20Some(t):\x20guard_add\x20AND\x20withdraw\x20require\x20clock\x20>\x20t\x20(E_GUARD_LOCKED_TIME).\x20When\x20None\x20or\x20t\x20<\x20now:\x20guards\x20can\x20be\x20added\x20and\x20balance\x20withdrawn.','related_errors':['E_GUARD_LOCKED_TIME','E_GUARD_LOCKED_TIME_NOT_INCREASING','E_GUARD_LOCKED_TIME_INVALID']},{'name':'record','move_type':'ParentTable<address,\x20RecipientRecord>','mutability':'runtime','set_at_creation':!![],'constraint':'Per-recipient\x20claim\x20history.\x20Each\x20RecipientRecord.amount\x20vector\x20has\x20length\x20<\x20MAX_RECORD_COUNT\x20(5200);\x20E_RECORD_COUNT_EXCEEDED\x20on\x20overflow.','related_errors':['E_RECORD_COUNT_EXCEEDED']},{'name':'um','move_type':'Option<address>','mutability':'admin_mutable','set_at_creation':!![],'permission_index':0x9d,'constraint':'Option<Contact\x20address>.\x20Binding\x20creates\x20an\x20object-linker\x20core\x20binding;\x20unbinding\x20disaffiliates.'},{'name':'permission','move_type':'address','mutability':'admin_mutable','set_at_creation':!![],'constraint':'Permission\x20object\x20address.\x20Updated\x20owner-only\x20(asserts\x20old.owner\x20==\x20sender);\x20the\x20change\x20is\x20registered\x20as\x20an\x20object-linker\x20affiliation\x20change.'}];export const REWARD_GUARD_CONSTRUCTORS=[{'constructor':'dynamic_recipient_dynamic_amount','recipient_type':'GuardIdentifier','amount_type':'GuardU64Identifier','params':{'recipient_param':'u8','amount_param':'u8','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['recipient\x20identifier\x20must\x20resolve\x20to\x20an\x20address\x20in\x20the\x20Passport\x20table\x20—\x20E_RECIPIENT_IDENTIFIER_NOT_ADDRESS\x20(4)','amount\x20identifier\x20must\x20resolve\x20to\x20a\x20u64\x20Passport\x20value\x20—\x20E_AMOUNT_NOT_U64\x20(5)','if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Dynamic\x20recipient\x20+\x20dynamic\x20amount\x20—\x20both\x20extracted\x20from\x20Passport\x20at\x20claim\x20time\x20(e.g.\x20referral\x20rewards\x20where\x20referrer\x20and\x20amount\x20vary\x20per\x20claim).'},{'constructor':'dynamic_recipient_fixed_amount','recipient_type':'GuardIdentifier','amount_type':'Fixed','params':{'recipient_param':'u8','amount_param':'u64','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['recipient\x20identifier\x20must\x20resolve\x20to\x20an\x20address\x20in\x20the\x20Passport\x20table\x20—\x20E_RECIPIENT_IDENTIFIER_NOT_ADDRESS\x20(4)','if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Dynamic\x20recipient\x20+\x20fixed\x20amount\x20—\x20e.g.\x20first-order\x20reward\x20where\x20any\x20new\x20customer\x20claims\x20a\x20fixed\x201\x20WOW.'},{'constructor':'entity_recipient_dynamic_amount','recipient_type':'Entity','amount_type':'GuardU64Identifier','params':{'recipient_param':'address','amount_param':'u8','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['amount\x20identifier\x20must\x20resolve\x20to\x20a\x20u64\x20Passport\x20value\x20—\x20E_AMOUNT_NOT_U64\x20(5)','if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Fixed\x20recipient\x20+\x20dynamic\x20amount\x20—\x20e.g.\x20tiered\x20loyalty\x20reward\x20where\x20amount\x20depends\x20on\x20Passport\x20submission\x20(tier\x20level).'},{'constructor':'entity_recipient_fixed_amount','recipient_type':'Entity','amount_type':'Fixed','params':{'recipient_param':'address','amount_param':'u64','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Fully\x20fixed\x20recipient\x20+\x20amount\x20—\x20simplest\x20configuration\x20(e.g.\x20specific\x20partner\x20bounty).'},{'constructor':'caller_recipient_dynamic_amount','recipient_type':'Signer','amount_type':'GuardU64Identifier','params':{'amount_param':'u8','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['amount\x20identifier\x20must\x20resolve\x20to\x20a\x20u64\x20Passport\x20value\x20—\x20E_AMOUNT_NOT_U64\x20(5)','if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Caller\x20is\x20recipient\x20+\x20dynamic\x20amount\x20—\x20e.g.\x20self-service\x20claim\x20where\x20amount\x20depends\x20on\x20Passport\x20submission\x20(e.g.\x20cashback\x20rate).'},{'constructor':'caller_recipient_fixed_amount','recipient_type':'Signer','amount_type':'Fixed','params':{'amount_param':'u64','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Caller\x20is\x20recipient\x20+\x20fixed\x20amount\x20—\x20e.g.\x20flash\x20sale\x20where\x20any\x20eligible\x20caller\x20claims\x20a\x20fixed\x20reward.'}];export const REWARD_ERROR_CODES=[{'code':0x1,'name':'E_GUARD_LOCKED_TIME_NOT_INCREASING','description':'guard-lock\x20time\x20update:\x20new\x20time\x20<\x20current\x20clock\x20(must\x20be\x20≥\x20now)','trigger_operation':'guard-lock\x20time\x20update\x20(155)'},{'code':0x2,'name':'E_GUARD_EXPIRED','description':'guard_add\x20on\x20guard\x20with\x20expiration_time\x20<\x20now,\x20OR\x20claim\x20on\x20guard\x20with\x20expiration_time\x20<\x20now','trigger_operation':'guard_add\x20/\x20claim'},{'code':0x3,'name':'E_GUARD_COUNT_EXCEEDED','description':'guard_add\x20would\x20exceed\x20MAX_GUARD_COUNT=200\x20(only\x20on\x20NEW\x20guard,\x20not\x20on\x20update\x20of\x20existing)','trigger_operation':'guard_add'},{'code':0x4,'name':'E_RECIPIENT_IDENTIFIER_NOT_ADDRESS','description':'RewardGuard\x20constructor:\x20recipient\x20identifier\x20type\x20is\x20not\x20address\x20(GuardIdentifier\x20variant\x20only)','trigger_operation':'claim-guard\x20construction'},{'code':0x5,'name':'E_AMOUNT_NOT_U64','description':'RewardGuard\x20constructor:\x20amount\x20identifier\x20type\x20is\x20not\x20u64\x20(GuardU64Identifier\x20variant\x20only)','trigger_operation':'claim-guard\x20construction'},{'code':0x6,'name':'E_INSUFFICIENT_BALANCE','description':'claim:\x20balance\x20<\x20amount\x20(cannot\x20split\x20more\x20than\x20held)','trigger_operation':'claim'},{'code':0x7,'name':'E_GUARD_NOT_FOUND','description':'claim:\x20no\x20guard\x20in\x20self.guards\x20matches\x20the\x20supplied\x20guard\x20address','trigger_operation':'claim'},{'code':0x8,'name':'E_RECORD_COUNT_EXCEEDED','description':'claim:\x20recipient\x20already\x20has\x20MAX_RECORD_COUNT=5200\x20entries\x20(E_RECORD_COUNT_EXCEEDED)','trigger_operation':'claim'},{'code':0xa,'name':'E_GUARD_LOCKED_TIME','description':'guard_add\x20/\x20withdraw\x20while\x20guard_not_added_expiration_time\x20is\x20Some\x20and\x20clock\x20≤\x20expiration_time','trigger_operation':'guard_add\x20/\x20withdraw'},{'code':0xb,'name':'E_GUARD_LOCKED_TIME_INVALID','description':'guard-lock\x20time\x20update:\x20new\x20Some(t)\x20where\x20t\x20≤\x20now\x20(must\x20be\x20future)','trigger_operation':'guard-lock\x20time\x20update\x20(155)'},{'code':0xc,'name':'E_STORE_FROM_ID_NOT_COMPATIBLE','description':'RewardGuard\x20constructor:\x20store_from_id\x20identifier\x20type\x20is\x20not\x20number\x20or\x20address','trigger_operation':'claim-guard\x20construction'},{'code':0xd,'name':'E_CLAIM_ALREADY_MADE','description':'claim:\x20the\x20(recipient,\x20guard,\x20store_from\x20value)\x20once-slot\x20is\x20already\x20consumed\x20(MOV-PROTOCOL-1212\x20F-01\x20fix\x20—\x20replay\x20aborts,\x20the\x20pool\x20keeps\x20its\x20balance).\x20Empty\x20store_from\x20slot\x20=\x20once\x20per\x20(recipient,\x20guard);\x20a\x20store_from\x20value\x20pins\x20a\x20per-value\x20slot\x20(per-order\x20bounty)','trigger_operation':'claim'},{'code':0xe,'name':'E_CLAIM_RECIPIENT_NOT_SIGNER','description':'claim:\x20the\x20resolved\x20recipient\x20(from\x20guard\x20submissions\x20or\x20the\x20Entity\x20binding)\x20is\x20not\x20the\x20transaction\x20sender\x20(MOV-PROTOCOL-1212\x20B5\x20fix\x20—\x20an\x20attacker\x20cannot\x20route\x20a\x20reward\x20to\x20a\x20third\x20address).\x20Entity\x20flows\x20pass\x20because\x20the\x20SDK\x20replaces\x20the\x20sender\x20with\x20the\x20entity\x20account','trigger_operation':'claim'}];export const REWARD_SCENES=[{'id':'reward_first_order','name':'First-order\x20reward','industry':['universal','ecommerce','service','freelance'],'scenario':'New\x20customers\x20receive\x20a\x20fixed\x20reward\x20after\x20their\x20first\x20order.\x20Guard\x20verifies\x20order\x20ownership\x20+\x20first-time\x20status;\x20'+'Recipient=Signer\x20(caller\x20is\x20the\x20new\x20customer);\x20Amount=Fixed\x20(e.g.\x201\x20WOW).','phases':['creation','guard_addition','funds_replenish','claim'],'coin_type_note':'T\x20=\x20project\x20reward\x20coin\x20(e.g.\x200x2::wow::WOW\x20or\x20a\x20custom\x20token)','typical_guard_count':0x1,'recipient_types_used':['Signer'],'amount_types_used':['Fixed'],'uses_expiration_time':!![],'uses_store_from_id':![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD],'common_patterns':['Signer\x20recipient\x20+\x20Fixed\x20amount\x20—\x20caller\x20claims\x20a\x20fixed\x20amount\x20(e.g.\x201\x20WOW)','Guard\x20verifies:\x20order_address.holder\x20==\x20signer\x20AND\x20order\x20is\x20the\x20first\x20order\x20(Repository\x20query)','expiration_time\x20bounds\x20the\x20campaign\x20window\x20(e.g.\x2030\x20days)','coin_add\x20deposits\x20the\x20campaign\x20budget\x20upfront\x20(e.g.\x20100\x20WOW\x20for\x20100\x20claims)'],'recommended_templates':['first_order']},{'id':'reward_referral','name':'Referral\x20viral\x20reward','industry':['universal','ecommerce','service','content'],'scenario':'Both\x20referrer\x20and\x20referee\x20receive\x20a\x20reward\x20when\x20the\x20referee\x20completes\x20a\x20first\x20order.\x20Two\x20guards:\x20one\x20for\x20referrer\x20(Entity),\x20one\x20for\x20referee\x20(Signer).','phases':['creation','guard_addition','funds_replenish','claim'],'coin_type_note':'T\x20=\x20project\x20reward\x20coin','typical_guard_count':0x2,'recipient_types_used':['Entity','Signer'],'amount_types_used':['Fixed'],'uses_expiration_time':!![],'uses_store_from_id':!![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD],'common_patterns':['Entity\x20recipient\x20+\x20Fixed\x20amount\x20for\x20the\x20referrer\x20(recipient\x20=\x20referrer\x20address)','Signer\x20recipient\x20+\x20Fixed\x20amount\x20for\x20the\x20referee\x20(caller\x20is\x20recipient)','Guard\x20verifies:\x20referrer\x20marked\x20in\x20Repository\x20AND\x20referee\x27s\x20order\x20completed','store_from_id\x20may\x20record\x20the\x20order\x20address\x20for\x20audit\x20trail'],'recommended_templates':['referral']},{'id':'reward_loyalty','name':'Loyalty\x20tiered\x20reward','industry':['universal','ecommerce','subscription','content'],'scenario':'Customers\x20unlock\x20higher\x20rewards\x20after\x20reaching\x20cumulative\x20spending\x20tiers.\x20Recipient=Signer;\x20Amount=GuardU64Identifier\x20(tier-dependent\x20amount\x20extracted\x20from\x20Passport).','phases':['creation','guard_addition','funds_replenish','claim'],'coin_type_note':'T\x20=\x20project\x20reward\x20coin','typical_guard_count':0x1,'recipient_types_used':['Signer'],'amount_types_used':['GuardU64Identifier'],'uses_expiration_time':![],'uses_store_from_id':![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD],'common_patterns':['Signer\x20recipient\x20+\x20identifier\x20amount\x20—\x20amount\x20is\x20dynamic,\x20extracted\x20from\x20Passport\x20submission\x20(tier\x20level\x20→\x20reward\x20amount)','Guard\x20verifies:\x20cumulative\x20spend\x20≥\x20tier\x20threshold\x20(Repository\x20query)','No\x20expiration_time\x20—\x20loyalty\x20is\x20perpetual\x20(until\x20deactivated\x20via\x20guard_remove)','Guard\x20submission\x20value\x20type\x20MUST\x20be\x20u64\x20(E_AMOUNT_NOT_U64\x20otherwise)'],'recommended_templates':['loyalty']},{'id':'reward_flash_sale','name':'Limited-time\x20flash\x20sale\x20reward','industry':['universal','ecommerce','retail'],'scenario':'Time-bounded\x20reward\x20for\x20the\x20first\x20N\x20callers.\x20Recipient=Signer;\x20Amount=Fixed.\x20Guard\x20verifies\x20time\x20window\x20+\x20claim\x20count.','phases':['creation','guard_addition','funds_replenish','claim','guard_lock_mgmt'],'coin_type_note':'T\x20=\x20project\x20reward\x20coin','typical_guard_count':0x1,'recipient_types_used':['Signer'],'amount_types_used':['Fixed'],'uses_expiration_time':!![],'uses_store_from_id':![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD,REWARD_GUARD_EXPIRATION_TIME_ADD],'common_patterns':['Signer\x20recipient\x20+\x20Fixed\x20amount\x20—\x20fixed\x20amount\x20per\x20claim\x20(e.g.\x202\x20WOW)','expiration_time\x20bounds\x20the\x20flash\x20sale\x20window\x20(e.g.\x2048\x20hours)','the\x20guard-addition\x20time-lock\x20(155)\x20may\x20lock\x20further\x20guard\x20additions\x20during\x20the\x20sale','Budget\x20=\x20max_claims\x20×\x20amount;\x20coin_add\x20deposits\x20this\x20upfront'],'recommended_templates':['flash_sale']},{'id':'reward_bulk_discount','name':'Bulk\x20discount\x20/\x20cashback\x20reward','industry':['universal','ecommerce','wholesale','service'],'scenario':'Customer\x20receives\x20cashback\x20proportional\x20to\x20order\x20size.\x20Recipient=Signer\x20or\x20Entity\x20(order\x20holder);\x20Amount=GuardU64Identifier\x20(cashback\x20rate\x20from\x20Passport).','phases':['creation','guard_addition','funds_replenish','claim'],'coin_type_note':'T\x20=\x20payment\x20coin\x20type\x20(must\x20match\x20order\x20payment\x20for\x20clean\x20cashback)','typical_guard_count':0x1,'recipient_types_used':['Signer','Entity'],'amount_types_used':['GuardU64Identifier'],'uses_expiration_time':![],'uses_store_from_id':!![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD,REWARD_RECEIVE],'common_patterns':['Signer\x20recipient\x20+\x20identifier\x20amount\x20—\x20caller\x20claims\x20dynamic\x20amount\x20(cashback\x20=\x20order_amount\x20×\x20rate)','store_from_id\x20records\x20the\x20order\x20address\x20for\x20cross-reference\x20(audit\x20trail)','receive\x20(154)\x20may\x20be\x20used\x20to\x20accept\x20CoinWrapper<T>\x20refunds\x20that\x20replenish\x20the\x20balance','Guard\x20verifies:\x20order.completed\x20AND\x20order.service\x20==\x20this\x20Service'],'recommended_templates':['cashback']},{'id':'reward_milestone','name':'Service\x20milestone\x20reward','industry':['universal','ecommerce','content','subscription'],'scenario':'When\x20a\x20Service\x20reaches\x20a\x20milestone\x20(e.g.\x20100\x20orders),\x20early\x20supporters\x20receive\x20extra\x20rewards.\x20Recipient=Entity\x20(early\x20customer);\x20Amount=Fixed.','phases':['creation','guard_addition','funds_replenish','claim','guard_lock_mgmt'],'coin_type_note':'T\x20=\x20project\x20reward\x20coin','typical_guard_count':0x32,'recipient_types_used':['Entity'],'amount_types_used':['Fixed'],'uses_expiration_time':!![],'uses_store_from_id':![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD,REWARD_GUARD_EXPIRATION_TIME_ADD],'common_patterns':['Entity\x20recipient\x20+\x20Fixed\x20amount\x20for\x20each\x20early\x20customer\x20(recipient\x20=\x20customer\x20address)','Multiple\x20guards\x20(up\x20to\x2050\x20for\x2050\x20early\x20supporters)\x20—\x20well\x20within\x20MAX_GUARD_COUNT=200','Guard\x20verifies:\x20Service\x20order_count\x20>=\x20milestone\x20AND\x20claimer\x20is\x20in\x20early-customer\x20list','the\x20guard-addition\x20time-lock\x20(155)\x20may\x20lock\x20the\x20guard\x20list\x20after\x20milestone\x20setup'],'recommended_templates':['milestone']}];export const REWARD_LEDGER_VERSION='1.0.0';export function getScenesByPhase(a){return REWARD_SCENES['filter'](b=>b['phases']['includes'](a));}export function findSceneById(a){return REWARD_SCENES['find'](b=>b['id']===a);}export function getScenesByIndustry(a){return REWARD_SCENES['filter'](b=>b['industry']['includes'](a)||b['industry']['includes']('universal'));}export function getBuiltinPermissionByIndex(a){return REWARD_PERMISSIONS['find'](b=>b['index']===a);}export function isRewardBuiltinPermission(a){return getBuiltinPermissionByIndex(a)!==undefined;}export function getAllBuiltinPermissions(){return[...REWARD_PERMISSIONS];}export function getRewardScenesCount(){return REWARD_SCENES['length'];}export function getGuardConstructorSpec(a){return REWARD_GUARD_CONSTRUCTORS['find'](b=>b['constructor']===a);}export function resolveGuardConstructor(a,b){const c={'GuardIdentifier|GuardU64Identifier':'dynamic_recipient_dynamic_amount','GuardIdentifier|Fixed':'dynamic_recipient_fixed_amount','Entity|GuardU64Identifier':'entity_recipient_dynamic_amount','Entity|Fixed':'entity_recipient_fixed_amount','Signer|GuardU64Identifier':'caller_recipient_dynamic_amount','Signer|Fixed':'caller_recipient_fixed_amount'};return c[a+'|'+b];}export function getRewardErrorByCode(a){return REWARD_ERROR_CODES['find'](b=>b['code']===a);}export function getRewardErrorByName(a){return REWARD_ERROR_CODES['find'](b=>b['name']===a);}export function validateGuardCount(a){if(a>=MAX_GUARD_COUNT_REWARD)return{'ok':![],'violation':'Guard\x20count\x20'+a+'\x20would\x20exceed\x20MAX_GUARD_COUNT_REWARD\x20'+MAX_GUARD_COUNT_REWARD};return{'ok':!![]};}export function validateRecordCount(a){if(a>=MAX_RECORD_COUNT_REWARD)return{'ok':![],'violation':'Record\x20count\x20'+a+'\x20would\x20exceed\x20MAX_RECORD_COUNT_REWARD\x20'+MAX_RECORD_COUNT_REWARD+'\x20—\x20recipient\x20can\x20no\x20longer\x20claim'};return{'ok':!![]};}export function inferSceneFromIntent(a){const b=a['toLowerCase'](),c=[['flash\x20sale','reward_flash_sale'],['flash_sale','reward_flash_sale'],['limited-time','reward_flash_sale'],['limited\x20time','reward_flash_sale'],['referral','reward_referral'],['viral','reward_referral'],['refer\x20a\x20friend','reward_referral'],['invite','reward_referral'],['loyalty','reward_loyalty'],['tiered','reward_loyalty'],['tier','reward_loyalty'],['repeat','reward_loyalty'],['cashback','reward_bulk_discount'],['bulk\x20discount','reward_bulk_discount'],['bulk_discount','reward_bulk_discount'],['wholesale','reward_bulk_discount'],['milestone','reward_milestone'],['early\x20supporter','reward_milestone'],['early\x20customer','reward_milestone'],['first\x20order','reward_first_order'],['first_order','reward_first_order'],['new\x20customer','reward_first_order'],['first-time','reward_first_order']];for(const [d,e]of c){if(b['includes'](d)){const f=findSceneById(e);if(f)return f;}}return undefined;}export const REWARD_CROSS_OBJECT_REFS=[{'object':'Permission','phase':'universal','relationship':'Reward.permission\x20(address;\x20borrowed\x20for\x20all\x20150-157\x20assertions)'},{'object':'Permission','phase':'permission_update','relationship':'permission\x20update:\x20owner-only\x20(asserts\x20old.owner\x20==\x20sender);\x20registered\x20as\x20an\x20object-linker\x20affiliation\x20change'},{'object':'Guard','phase':'guard_addition','relationship':'RewardGuard.guard\x20=\x20guard.id_address\x20(each\x20guard\x20registered\x20via\x20object-linker\x20core\x20binding)'},{'object':'Guard','phase':'claim','relationship':'claim:\x20iterates\x20self.guards\x20looking\x20for\x20guard.id_address\x20match;\x20E_GUARD_NOT_FOUND\x20if\x20no\x20match'},{'object':'Guard','phase':'claim','relationship':'claim:\x20the\x20guard\x20verification\x20result\x20validates\x20the\x20Passport\x20submission\x20data'},{'object':'Passport','phase':'claim','relationship':'claim:\x20the\x20claimant\x27s\x20Passport\x20submission\x20supplies\x20the\x20recipient\x20(address)\x20and/or\x20amount\x20(u64)\x20per\x20RewardGuard\x20variant'},{'object':'Passport','phase':'claim','relationship':'claim:\x20if\x20store_from_id\x20is\x20Some,\x20extracts\x20store-from\x20address\x20from\x20Passport\x20submission'},{'object':'Payment','phase':'funds_replenish','relationship':'receive\x20(154):\x20unwraps\x20Coin<T>\x20from\x20CoinWrapper<T>\x20(with\x20check)\x20and\x20joins\x20the\x20balance'},{'object':'Payment','phase':'owner_receive','relationship':'owner\x20receipt\x20(156):\x20unwraps\x20CoinWrapper<K>\x20and\x20forwards\x20it\x20to\x20the\x20Permission\x20owner'},{'object':'Repository','phase':'claim','relationship':'Guard\x20may\x20query\x20Repository\x20(e.g.\x20order\x20history\x20for\x20first-order\x20/\x20loyalty\x20verification)'},{'object':'Service','phase':'claim','relationship':'Guard\x20may\x20verify\x20order.service\x20==\x20this\x20Service\x20(cashback\x20/\x20first-order\x20scenarios)'},{'object':'Demand','phase':'guard_addition','relationship':'Guard\x20may\x20be\x20shared\x20with\x20Demand\x20(recommendation\x20filtering);\x20same\x20Guard\x20object\x20address\x20space'},{'object':'Allocation','phase':'owner_receive','relationship':'Terminal\x20Allocation\x20alloc\x20may\x20route\x20funds\x20back\x20to\x20Reward\x20(replenishment\x20loop)'},{'object':'Contact','phase':'um_mgmt','relationship':'UM\x20binding\x20(157):\x20binds\x20Contact\x20(UM)\x20for\x20off-chain\x20coordination;\x20creates\x20object-linker\x20core\x20binding'},{'object':'Coin','phase':'universal','relationship':'Reward<phantom\x20T>:\x20T\x20is\x20the\x20coin\x20type;\x20balance:\x20Balance<T>;\x20coin_add\x20expects\x20Coin<T>'}];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MAX_GUARD_COUNT_REWARD, MAX_RECORD_COUNT_REWARD } from "./onchain-constants.js";
|
|
2
2
|
import { resolveGuardConstructor, getGuardConstructorSpec, type RewardBuiltinPermissionEntry, type RewardGuardConstructor, type RewardRecipientType, type RewardAmountType } from "./reward-ledger.js";
|
|
3
3
|
export interface RewardIntentPuzzle {
|
|
4
|
-
action: "create" | "claim" | "guard_add" | "
|
|
4
|
+
action: "create" | "claim" | "guard_add" | "guard_remove" | "add guard expiration time" | "coin_add" | "receive" | "owner_receive" | "set um" | "clear um" | "set description" | "set permission" | "query";
|
|
5
5
|
target_reward?: string;
|
|
6
6
|
rule_sentence: string;
|
|
7
7
|
failure_conditions: string[];
|
|
@@ -51,7 +51,7 @@ export interface RewardRiskCheckContext {
|
|
|
51
51
|
token_type: string;
|
|
52
52
|
};
|
|
53
53
|
guard_add?: RewardGuardAddEntry[];
|
|
54
|
-
|
|
54
|
+
guard_remove?: string;
|
|
55
55
|
guard_expiration_time?: number | null;
|
|
56
56
|
owner_receive?: unknown;
|
|
57
57
|
um?: string | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type IndustryModeName = "freelance" | "rental" | "education" | "travel" | "subscription" | "retail" | "general";
|
|
1
|
+
export type IndustryModeName = "freelance" | "rental" | "education" | "travel" | "subscription" | "retail" | "licensing" | "crowdfunding" | "general";
|
|
2
2
|
export interface ScenarioTraits {
|
|
3
3
|
has_logistics: boolean;
|
|
4
4
|
communication_heavy: boolean;
|
|
@@ -88,4 +88,4 @@ export declare function getScenarioMode(name: IndustryModeName): ScenarioMode |
|
|
|
88
88
|
export declare function listScenarioModes(): ScenarioMode[];
|
|
89
89
|
export declare function getShippedModes(): ScenarioMode[];
|
|
90
90
|
export declare function getModeCompositions(name: IndustryModeName): ModeComposition[];
|
|
91
|
-
export declare const SCENARIO_MODES_VERSION =
|
|
91
|
+
export declare const SCENARIO_MODES_VERSION = 9;
|