@wowok/agent-mcp 2.3.12 → 2.3.14
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/harness/checkpoint.d.ts +8 -0
- package/dist/harness/checkpoint.js +129 -0
- package/dist/harness/index.d.ts +33 -0
- package/dist/harness/index.js +75 -0
- package/dist/harness/plan.d.ts +18 -0
- package/dist/harness/plan.js +252 -0
- package/dist/harness/recover.d.ts +17 -0
- package/dist/harness/recover.js +139 -0
- package/dist/harness/types.d.ts +137 -0
- package/dist/harness/types.js +1 -0
- package/dist/harness/verify.d.ts +42 -0
- package/dist/harness/verify.js +237 -0
- package/dist/index.js +134 -52
- package/dist/loop-engineering/aggregate.d.ts +50 -0
- package/dist/loop-engineering/aggregate.js +132 -0
- package/dist/loop-engineering/diagnose.d.ts +21 -0
- package/dist/loop-engineering/diagnose.js +179 -0
- package/dist/loop-engineering/improve.d.ts +26 -0
- package/dist/loop-engineering/improve.js +178 -0
- package/dist/loop-engineering/index.d.ts +4 -0
- package/dist/loop-engineering/index.js +4 -0
- package/dist/loop-engineering/pipeline.d.ts +17 -0
- package/dist/loop-engineering/pipeline.js +56 -0
- package/dist/mode-market/index.d.ts +3 -0
- package/dist/mode-market/index.js +3 -0
- package/dist/mode-market/registry.d.ts +53 -0
- package/dist/mode-market/registry.js +124 -0
- package/dist/mode-market/review.d.ts +27 -0
- package/dist/mode-market/review.js +214 -0
- package/dist/mode-market/submission.d.ts +25 -0
- package/dist/mode-market/submission.js +85 -0
- package/dist/schema/call/allocation.d.ts +40 -40
- package/dist/schema/call/arbitration.d.ts +90 -90
- package/dist/schema/call/base.d.ts +1054 -0
- package/dist/schema/call/base.js +100 -22
- package/dist/schema/call/bridge-handler.js +36 -18
- package/dist/schema/call/bridge.d.ts +115 -115
- package/dist/schema/call/handler.d.ts +2 -1
- package/dist/schema/call/handler.js +94 -3
- package/dist/schema/call/index.d.ts +1 -0
- package/dist/schema/call/index.js +1 -0
- package/dist/schema/call/machine.d.ts +144 -144
- package/dist/schema/call/order.d.ts +12 -12
- package/dist/schema/call/progress.d.ts +6 -6
- package/dist/schema/call/proof.js +7 -6
- package/dist/schema/call/reward.d.ts +6 -6
- package/dist/schema/call/semantic.d.ts +23 -0
- package/dist/schema/call/semantic.js +764 -0
- package/dist/schema/call/service.d.ts +142 -142
- package/dist/schema/call/treasury.d.ts +204 -204
- package/dist/schema/local/index.d.ts +113 -2
- package/dist/schema/local/index.js +11 -1
- package/dist/schema/messenger/index.d.ts +435 -95
- package/dist/schema/messenger/index.js +20 -8
- package/dist/schema/operations.d.ts +988 -495
- package/dist/schema/operations.js +14 -3
- package/dist/schema/query/index.d.ts +346 -342
- package/dist/schema/query/index.js +4 -1
- package/dist/schemas/account_operation.output.json +3 -0
- package/dist/schemas/account_operation.schema.json +1 -1
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/local_info_operation.output.json +3 -0
- package/dist/schemas/local_mark_operation.output.json +3 -0
- package/dist/schemas/messenger_operation.output.json +21 -0
- package/dist/schemas/messenger_operation.schema.json +43 -8
- package/dist/schemas/onchain_events.output.json +3 -0
- package/dist/schemas/onchain_operations.output.json +464 -21
- package/dist/schemas/onchain_operations.schema.json +21 -17
- package/dist/schemas/onchain_operations_allocation.schema.json +11 -9
- package/dist/schemas/onchain_operations_arbitration.schema.json +11 -9
- package/dist/schemas/onchain_operations_contact.schema.json +11 -9
- package/dist/schemas/onchain_operations_demand.schema.json +11 -9
- package/dist/schemas/onchain_operations_gen_passport.schema.json +21 -17
- package/dist/schemas/onchain_operations_guard.schema.json +11 -9
- package/dist/schemas/onchain_operations_machine.schema.json +11 -9
- package/dist/schemas/onchain_operations_order.schema.json +11 -9
- package/dist/schemas/onchain_operations_payment.schema.json +11 -9
- package/dist/schemas/onchain_operations_permission.schema.json +11 -9
- package/dist/schemas/onchain_operations_personal.schema.json +11 -9
- package/dist/schemas/onchain_operations_progress.schema.json +11 -9
- package/dist/schemas/onchain_operations_repository.schema.json +11 -9
- package/dist/schemas/onchain_operations_reward.schema.json +11 -9
- package/dist/schemas/onchain_operations_service.schema.json +11 -9
- package/dist/schemas/onchain_operations_treasury.schema.json +11 -9
- package/dist/schemas/onchain_table_data.output.json +3 -0
- package/dist/schemas/query_toolkit.schema.json +5 -1
- package/dist/telemetry/index.d.ts +19 -0
- package/dist/telemetry/index.js +112 -0
- package/dist/telemetry/redact.d.ts +2 -0
- package/dist/telemetry/redact.js +23 -0
- package/dist/telemetry/storage.d.ts +8 -0
- package/dist/telemetry/storage.js +80 -0
- package/package.json +6 -3
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
export type ObjectType = "Permission" | "Service" | "Machine" | "Guard" | "Allocation" | "Progress" | "Repository" | "Treasury" | "Reward" | "Demand" | "Order" | "Arbitration" | "Contact" | "Personal" | "Payment";
|
|
2
|
+
export type ObjectStatus = "not_created" | "created_unpublished" | "published" | "failed";
|
|
3
|
+
export interface ODGNode {
|
|
4
|
+
id: string;
|
|
5
|
+
type: ObjectType;
|
|
6
|
+
status: ObjectStatus;
|
|
7
|
+
reversible: boolean;
|
|
8
|
+
dependencies: string[];
|
|
9
|
+
user_decisions?: string[];
|
|
10
|
+
risk_flags?: string[];
|
|
11
|
+
estimated_time?: string;
|
|
12
|
+
address?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ODGPhase {
|
|
15
|
+
name: string;
|
|
16
|
+
objects: string[];
|
|
17
|
+
description?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ODG {
|
|
20
|
+
task_id: string;
|
|
21
|
+
scenario: string;
|
|
22
|
+
objects: ODGNode[];
|
|
23
|
+
phases: ODGPhase[];
|
|
24
|
+
}
|
|
25
|
+
export interface ExpectedObject {
|
|
26
|
+
role: string;
|
|
27
|
+
expect_fields?: Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
export interface ExpectedFundFlow {
|
|
30
|
+
role: string;
|
|
31
|
+
amount?: string;
|
|
32
|
+
coinType?: string;
|
|
33
|
+
from?: string | null;
|
|
34
|
+
to?: string | null;
|
|
35
|
+
}
|
|
36
|
+
export interface ExpectedEvent {
|
|
37
|
+
type: string;
|
|
38
|
+
expect_count?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface ExpectedResult {
|
|
41
|
+
operation: string;
|
|
42
|
+
intent: string;
|
|
43
|
+
pre_conditions: Array<{
|
|
44
|
+
check: string;
|
|
45
|
+
error: string;
|
|
46
|
+
}>;
|
|
47
|
+
expected: {
|
|
48
|
+
result_type: "transaction" | "submission" | "error" | "data" | "null";
|
|
49
|
+
semantic_created?: ExpectedObject[];
|
|
50
|
+
semantic_modified?: ExpectedObject[];
|
|
51
|
+
semantic_released?: ExpectedFundFlow[];
|
|
52
|
+
events?: ExpectedEvent[];
|
|
53
|
+
state_transition?: {
|
|
54
|
+
from: string;
|
|
55
|
+
to: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
post_verification?: Array<{
|
|
59
|
+
tool: string;
|
|
60
|
+
params: Record<string, unknown>;
|
|
61
|
+
assert: string;
|
|
62
|
+
}>;
|
|
63
|
+
}
|
|
64
|
+
export type VerifyStatus = "pass" | "warn" | "fail";
|
|
65
|
+
export interface VerifyMismatch {
|
|
66
|
+
dimension: "created" | "modified" | "released" | "state" | "event";
|
|
67
|
+
expected: string;
|
|
68
|
+
actual: string;
|
|
69
|
+
severity: VerifyStatus;
|
|
70
|
+
detail: string;
|
|
71
|
+
}
|
|
72
|
+
export interface VerifyReport {
|
|
73
|
+
status: VerifyStatus;
|
|
74
|
+
mismatches: VerifyMismatch[];
|
|
75
|
+
summary: string;
|
|
76
|
+
timestamp: string;
|
|
77
|
+
}
|
|
78
|
+
export type RecoveryStrategy = "retry" | "claim_faucet" | "fill_submission" | "recreate" | "switch_account" | "query_and_retry" | "adjust_params" | "escalate_human" | "stop";
|
|
79
|
+
export interface RecoveryAction {
|
|
80
|
+
strategy: RecoveryStrategy;
|
|
81
|
+
should_retry: boolean;
|
|
82
|
+
adjusted_params?: Record<string, unknown>;
|
|
83
|
+
user_prompt?: string;
|
|
84
|
+
max_attempts: number;
|
|
85
|
+
current_attempt: number;
|
|
86
|
+
detail: string;
|
|
87
|
+
}
|
|
88
|
+
export type PhaseStatus = "in_progress" | "completed" | "failed";
|
|
89
|
+
export interface Checkpoint {
|
|
90
|
+
checkpoint_id: string;
|
|
91
|
+
task_id: string;
|
|
92
|
+
timestamp: string;
|
|
93
|
+
phase: string;
|
|
94
|
+
phase_status: PhaseStatus;
|
|
95
|
+
odg_snapshot: Record<string, {
|
|
96
|
+
status: ObjectStatus;
|
|
97
|
+
address?: string;
|
|
98
|
+
reversible: boolean;
|
|
99
|
+
tested?: boolean;
|
|
100
|
+
}>;
|
|
101
|
+
user_decisions: Record<string, unknown>;
|
|
102
|
+
operation_log: Array<{
|
|
103
|
+
op_id: string;
|
|
104
|
+
tool: string;
|
|
105
|
+
params?: Record<string, unknown>;
|
|
106
|
+
result_digest?: string;
|
|
107
|
+
status: VerifyStatus;
|
|
108
|
+
}>;
|
|
109
|
+
next_phase: string;
|
|
110
|
+
semantic_summary: {
|
|
111
|
+
total_ops: number;
|
|
112
|
+
success_ops: number;
|
|
113
|
+
failed_ops: number;
|
|
114
|
+
recoveries: number;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export interface ScenarioTemplate {
|
|
118
|
+
name: string;
|
|
119
|
+
keywords: string[];
|
|
120
|
+
objects: Array<Omit<ODGNode, "id" | "status" | "address">>;
|
|
121
|
+
phases: Array<{
|
|
122
|
+
name: string;
|
|
123
|
+
object_types: ObjectType[];
|
|
124
|
+
}>;
|
|
125
|
+
default_permissions: {
|
|
126
|
+
provider?: number;
|
|
127
|
+
customer?: "namedOperator";
|
|
128
|
+
arbiter?: number;
|
|
129
|
+
};
|
|
130
|
+
description: string;
|
|
131
|
+
}
|
|
132
|
+
export interface HarnessContext {
|
|
133
|
+
odg?: ODG;
|
|
134
|
+
current_phase?: string;
|
|
135
|
+
checkpoint?: Checkpoint;
|
|
136
|
+
user_decisions?: Record<string, unknown>;
|
|
137
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ExpectedResult, VerifyReport } from "./types.js";
|
|
2
|
+
export interface VerifyInput {
|
|
3
|
+
expected: ExpectedResult;
|
|
4
|
+
actual: {
|
|
5
|
+
result_type?: string;
|
|
6
|
+
semantic?: {
|
|
7
|
+
intent?: string;
|
|
8
|
+
status?: string;
|
|
9
|
+
summary?: string;
|
|
10
|
+
created?: Array<{
|
|
11
|
+
id: string;
|
|
12
|
+
role: string;
|
|
13
|
+
immutable?: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
modified?: Array<{
|
|
16
|
+
id: string;
|
|
17
|
+
role: string;
|
|
18
|
+
}>;
|
|
19
|
+
released?: Array<{
|
|
20
|
+
amount: string;
|
|
21
|
+
coinType: string;
|
|
22
|
+
role: string;
|
|
23
|
+
from?: string | null;
|
|
24
|
+
to?: string | null;
|
|
25
|
+
}>;
|
|
26
|
+
events?: Array<{
|
|
27
|
+
event_type: string;
|
|
28
|
+
business_meaning: string;
|
|
29
|
+
category: string;
|
|
30
|
+
}>;
|
|
31
|
+
next_actions?: Array<{
|
|
32
|
+
action: string;
|
|
33
|
+
priority: string;
|
|
34
|
+
}>;
|
|
35
|
+
warnings?: string[];
|
|
36
|
+
};
|
|
37
|
+
error_code?: string;
|
|
38
|
+
error?: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export declare function verify(input: VerifyInput): VerifyReport;
|
|
42
|
+
export declare function generateExpected(operation: string, intent: string, operationType: string, data?: Record<string, unknown>): ExpectedResult;
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
function verifyCreated(expected, actual) {
|
|
2
|
+
const mismatches = [];
|
|
3
|
+
const expectedCreated = expected.expected.semantic_created ?? [];
|
|
4
|
+
const actualCreated = actual.semantic?.created ?? [];
|
|
5
|
+
for (const exp of expectedCreated) {
|
|
6
|
+
const found = actualCreated.find((a) => a.role === exp.role);
|
|
7
|
+
if (!found) {
|
|
8
|
+
mismatches.push({
|
|
9
|
+
dimension: "created",
|
|
10
|
+
expected: `role=${exp.role}`,
|
|
11
|
+
actual: "not found",
|
|
12
|
+
severity: "fail",
|
|
13
|
+
detail: `Expected to create object with role '${exp.role}', but none was created`,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
for (const act of actualCreated) {
|
|
18
|
+
const expected_role = expectedCreated.find((e) => e.role === act.role);
|
|
19
|
+
if (!expected_role) {
|
|
20
|
+
mismatches.push({
|
|
21
|
+
dimension: "created",
|
|
22
|
+
expected: `no object with role=${act.role}`,
|
|
23
|
+
actual: `role=${act.role}`,
|
|
24
|
+
severity: "warn",
|
|
25
|
+
detail: `Unexpected object created with role '${act.role}' — may indicate rule table gap`,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return mismatches;
|
|
30
|
+
}
|
|
31
|
+
function verifyModified(expected, actual) {
|
|
32
|
+
const mismatches = [];
|
|
33
|
+
const expectedModified = expected.expected.semantic_modified ?? [];
|
|
34
|
+
const actualModified = actual.semantic?.modified ?? [];
|
|
35
|
+
for (const exp of expectedModified) {
|
|
36
|
+
const found = actualModified.find((a) => a.role === exp.role);
|
|
37
|
+
if (!found) {
|
|
38
|
+
mismatches.push({
|
|
39
|
+
dimension: "modified",
|
|
40
|
+
expected: `role=${exp.role} fields=${JSON.stringify(exp.expect_fields ?? {})}`,
|
|
41
|
+
actual: "not modified",
|
|
42
|
+
severity: "fail",
|
|
43
|
+
detail: `Expected to modify object with role '${exp.role}', but it was not modified`,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return mismatches;
|
|
48
|
+
}
|
|
49
|
+
function verifyReleased(expected, actual) {
|
|
50
|
+
const mismatches = [];
|
|
51
|
+
const expectedReleased = expected.expected.semantic_released ?? [];
|
|
52
|
+
const actualReleased = actual.semantic?.released ?? [];
|
|
53
|
+
for (const exp of expectedReleased) {
|
|
54
|
+
const found = actualReleased.find((a) => a.role === exp.role);
|
|
55
|
+
if (!found) {
|
|
56
|
+
mismatches.push({
|
|
57
|
+
dimension: "released",
|
|
58
|
+
expected: `role=${exp.role} amount=${exp.amount ?? "?"} from=${exp.from ?? "?"} to=${exp.to ?? "?"}`,
|
|
59
|
+
actual: "no fund movement",
|
|
60
|
+
severity: "fail",
|
|
61
|
+
detail: `Expected fund movement with role '${exp.role}', but none occurred — fund flow risk`,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
if (exp.amount && exp.amount !== found.amount) {
|
|
66
|
+
mismatches.push({
|
|
67
|
+
dimension: "released",
|
|
68
|
+
expected: `amount=${exp.amount}`,
|
|
69
|
+
actual: `amount=${found.amount}`,
|
|
70
|
+
severity: "fail",
|
|
71
|
+
detail: `Fund amount mismatch for role '${exp.role}' — fund flow risk`,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (exp.from && found.from && exp.from !== found.from) {
|
|
75
|
+
mismatches.push({
|
|
76
|
+
dimension: "released",
|
|
77
|
+
expected: `from=${exp.from}`,
|
|
78
|
+
actual: `from=${found.from}`,
|
|
79
|
+
severity: "fail",
|
|
80
|
+
detail: `Fund source mismatch for role '${exp.role}' — fund flow direction risk`,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
if (exp.to && found.to && exp.to !== found.to) {
|
|
84
|
+
mismatches.push({
|
|
85
|
+
dimension: "released",
|
|
86
|
+
expected: `to=${exp.to}`,
|
|
87
|
+
actual: `to=${found.to}`,
|
|
88
|
+
severity: "fail",
|
|
89
|
+
detail: `Fund destination mismatch for role '${exp.role}' — fund flow direction risk`,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return mismatches;
|
|
95
|
+
}
|
|
96
|
+
function verifyEvents(expected, actual) {
|
|
97
|
+
const mismatches = [];
|
|
98
|
+
const expectedEvents = expected.expected.events ?? [];
|
|
99
|
+
const actualEvents = actual.semantic?.events ?? [];
|
|
100
|
+
for (const exp of expectedEvents) {
|
|
101
|
+
const found = actualEvents.find((a) => a.event_type.includes(exp.type) || a.business_meaning.toLowerCase().includes(exp.type.toLowerCase()));
|
|
102
|
+
if (!found) {
|
|
103
|
+
mismatches.push({
|
|
104
|
+
dimension: "event",
|
|
105
|
+
expected: `event_type contains '${exp.type}'`,
|
|
106
|
+
actual: "event not found",
|
|
107
|
+
severity: "warn",
|
|
108
|
+
detail: `Expected event '${exp.type}' was not found — may indicate semantic layer gap or operation didn't trigger it`,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return mismatches;
|
|
113
|
+
}
|
|
114
|
+
function verifyStateTransition(expected, actual) {
|
|
115
|
+
const mismatches = [];
|
|
116
|
+
const transition = expected.expected.state_transition;
|
|
117
|
+
if (!transition)
|
|
118
|
+
return mismatches;
|
|
119
|
+
if (actual.semantic?.status === "success") {
|
|
120
|
+
return mismatches;
|
|
121
|
+
}
|
|
122
|
+
if (actual.semantic?.status === "failed") {
|
|
123
|
+
mismatches.push({
|
|
124
|
+
dimension: "state",
|
|
125
|
+
expected: `${transition.from} → ${transition.to}`,
|
|
126
|
+
actual: "operation failed",
|
|
127
|
+
severity: "fail",
|
|
128
|
+
detail: `Expected state transition '${transition.from} → ${transition.to}' failed — operation did not succeed`,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return mismatches;
|
|
132
|
+
}
|
|
133
|
+
export function verify(input) {
|
|
134
|
+
const mismatches = [
|
|
135
|
+
...verifyCreated(input.expected, input.actual),
|
|
136
|
+
...verifyModified(input.expected, input.actual),
|
|
137
|
+
...verifyReleased(input.expected, input.actual),
|
|
138
|
+
...verifyEvents(input.expected, input.actual),
|
|
139
|
+
...verifyStateTransition(input.expected, input.actual),
|
|
140
|
+
];
|
|
141
|
+
const hasFail = mismatches.some((m) => m.severity === "fail");
|
|
142
|
+
const hasWarn = mismatches.some((m) => m.severity === "warn");
|
|
143
|
+
const status = hasFail ? "fail" : hasWarn ? "warn" : "pass";
|
|
144
|
+
const failCount = mismatches.filter((m) => m.severity === "fail").length;
|
|
145
|
+
const warnCount = mismatches.filter((m) => m.severity === "warn").length;
|
|
146
|
+
let summary;
|
|
147
|
+
if (status === "pass") {
|
|
148
|
+
summary = "All verifications passed — expected results match actual results";
|
|
149
|
+
}
|
|
150
|
+
else if (status === "warn") {
|
|
151
|
+
summary = `${warnCount} warning(s) — operation succeeded with minor discrepancies`;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
summary = `${failCount} failure(s), ${warnCount} warning(s) — expected results do not match actual results`;
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
status,
|
|
158
|
+
mismatches,
|
|
159
|
+
summary,
|
|
160
|
+
timestamp: new Date().toISOString(),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
export function generateExpected(operation, intent, operationType, data) {
|
|
164
|
+
const expected = {
|
|
165
|
+
result_type: "transaction",
|
|
166
|
+
};
|
|
167
|
+
switch (operationType) {
|
|
168
|
+
case "service":
|
|
169
|
+
if (data?.publish === true || data?.bPublished === true) {
|
|
170
|
+
expected.semantic_modified = [{ role: "Service", expect_fields: { bPublished: true } }];
|
|
171
|
+
expected.state_transition = { from: "unpublished", to: "published" };
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
expected.semantic_created = [{ role: "Service" }];
|
|
175
|
+
}
|
|
176
|
+
break;
|
|
177
|
+
case "machine":
|
|
178
|
+
expected.semantic_created = [{ role: "Machine" }];
|
|
179
|
+
break;
|
|
180
|
+
case "guard":
|
|
181
|
+
expected.semantic_created = [{ role: "Guard" }];
|
|
182
|
+
expected.events = [{ type: "GuardCreated", expect_count: ">=1" }];
|
|
183
|
+
break;
|
|
184
|
+
case "permission":
|
|
185
|
+
expected.semantic_created = [{ role: "Permission" }];
|
|
186
|
+
break;
|
|
187
|
+
case "order":
|
|
188
|
+
if (data?.arb !== undefined) {
|
|
189
|
+
expected.state_transition = { from: "ordered", to: "arbitration" };
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
expected.semantic_created = [{ role: "Order" }];
|
|
193
|
+
expected.semantic_released = [{ role: "payment" }];
|
|
194
|
+
expected.events = [{ type: "OrderPaid", expect_count: ">=1" }];
|
|
195
|
+
}
|
|
196
|
+
break;
|
|
197
|
+
case "payment":
|
|
198
|
+
expected.semantic_released = [{ role: "payment" }];
|
|
199
|
+
break;
|
|
200
|
+
case "treasury":
|
|
201
|
+
if (data?.deposit !== undefined) {
|
|
202
|
+
expected.semantic_released = [{ role: "deposit" }];
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
expected.semantic_released = [{ role: "release" }];
|
|
206
|
+
}
|
|
207
|
+
break;
|
|
208
|
+
case "reward":
|
|
209
|
+
if (data?.claim !== undefined || data?.withdraw !== undefined) {
|
|
210
|
+
expected.semantic_released = [{ role: "reward" }];
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
expected.semantic_created = [{ role: "Reward" }];
|
|
214
|
+
}
|
|
215
|
+
break;
|
|
216
|
+
case "allocation":
|
|
217
|
+
expected.semantic_released = [{ role: "release" }];
|
|
218
|
+
expected.events = [{ type: "Allocation", expect_count: ">=1" }];
|
|
219
|
+
break;
|
|
220
|
+
case "demand":
|
|
221
|
+
if (data?.submit !== undefined) {
|
|
222
|
+
expected.semantic_modified = [{ role: "Demand" }];
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
expected.semantic_created = [{ role: "Demand" }];
|
|
226
|
+
}
|
|
227
|
+
break;
|
|
228
|
+
default:
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
return {
|
|
232
|
+
operation,
|
|
233
|
+
intent,
|
|
234
|
+
pre_conditions: [],
|
|
235
|
+
expected,
|
|
236
|
+
};
|
|
237
|
+
}
|