@ottochain/sdk 2.0.0 → 2.2.0

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.
Files changed (142) hide show
  1. package/dist/cjs/apps/contracts/index.js +1 -1
  2. package/dist/cjs/apps/contracts/state-machines/contract-agreement.js +272 -0
  3. package/dist/cjs/apps/contracts/state-machines/contract-escrow.js +284 -0
  4. package/dist/cjs/apps/contracts/state-machines/contract-universal.js +93 -0
  5. package/dist/cjs/apps/contracts/state-machines/index.js +177 -1
  6. package/dist/cjs/apps/corporate/state-machines/corp-board.js +1022 -0
  7. package/dist/cjs/apps/corporate/state-machines/corp-entity.js +671 -0
  8. package/dist/cjs/apps/corporate/state-machines/corp-securities.js +998 -0
  9. package/dist/cjs/apps/corporate/state-machines/corp-shareholders.js +1102 -0
  10. package/dist/cjs/apps/corporate/state-machines/index.js +20 -4440
  11. package/dist/cjs/apps/governance/index.js +7 -7
  12. package/dist/cjs/apps/governance/state-machines/dao-multisig.js +467 -0
  13. package/dist/cjs/apps/governance/state-machines/dao-reputation.js +458 -0
  14. package/dist/cjs/apps/governance/state-machines/dao-single.js +199 -0
  15. package/dist/cjs/apps/governance/state-machines/dao-token.js +503 -0
  16. package/dist/cjs/apps/governance/state-machines/governance-simple.js +482 -0
  17. package/dist/cjs/apps/governance/state-machines/governance-universal.js +138 -0
  18. package/dist/cjs/apps/governance/state-machines/index.js +16 -2934
  19. package/dist/cjs/apps/identity/constants.js +28 -14
  20. package/dist/cjs/apps/identity/index.js +27 -12
  21. package/dist/cjs/apps/identity/state-machines/identity-agent.js +256 -0
  22. package/dist/cjs/apps/identity/state-machines/identity-oracle.js +321 -0
  23. package/dist/cjs/apps/identity/state-machines/identity-universal.js +106 -0
  24. package/dist/cjs/apps/identity/state-machines/index.js +15 -784
  25. package/dist/cjs/apps/markets/index.js +1 -1
  26. package/dist/cjs/apps/markets/state-machines/index.js +14 -2298
  27. package/dist/cjs/apps/markets/state-machines/market-auction.js +283 -0
  28. package/dist/cjs/apps/markets/state-machines/market-crowdfund.js +312 -0
  29. package/dist/cjs/apps/markets/state-machines/market-group-buy.js +407 -0
  30. package/dist/cjs/apps/markets/state-machines/market-prediction.js +485 -0
  31. package/dist/cjs/apps/markets/state-machines/market-universal.js +129 -0
  32. package/dist/cjs/apps/oracles/index.js +36 -0
  33. package/dist/cjs/generated/google/protobuf/struct.js +1 -1
  34. package/dist/cjs/generated/google/protobuf/timestamp.js +1 -1
  35. package/dist/cjs/generated/index.js +26 -22
  36. package/dist/cjs/generated/ottochain/apps/contracts/v1/contract.js +1 -1
  37. package/dist/cjs/generated/ottochain/apps/corporate/v1/corporate.js +1 -1
  38. package/dist/cjs/generated/ottochain/apps/governance/v1/governance.js +1 -1
  39. package/dist/cjs/generated/ottochain/apps/identity/v1/attestation.js +12 -12
  40. package/dist/cjs/generated/ottochain/apps/identity/v1/identity.js +1688 -0
  41. package/dist/cjs/generated/ottochain/apps/markets/v1/market.js +1 -1
  42. package/dist/cjs/generated/ottochain/v1/common.js +1 -1
  43. package/dist/cjs/generated/ottochain/v1/fiber.js +1 -1
  44. package/dist/cjs/generated/ottochain/v1/messages.js +1 -1
  45. package/dist/cjs/generated/ottochain/v1/records.js +1 -1
  46. package/dist/cjs/schema/fiber-app.js +95 -0
  47. package/dist/cjs/schema/index.js +20 -0
  48. package/dist/esm/apps/contracts/index.js +3 -3
  49. package/dist/esm/apps/contracts/state-machines/contract-agreement.js +269 -0
  50. package/dist/esm/apps/contracts/state-machines/contract-escrow.js +281 -0
  51. package/dist/esm/apps/contracts/state-machines/contract-universal.js +90 -0
  52. package/dist/esm/apps/contracts/state-machines/index.js +177 -1
  53. package/dist/esm/apps/corporate/index.js +3 -3
  54. package/dist/esm/apps/corporate/state-machines/corp-board.js +1019 -0
  55. package/dist/esm/apps/corporate/state-machines/corp-entity.js +668 -0
  56. package/dist/esm/apps/corporate/state-machines/corp-securities.js +995 -0
  57. package/dist/esm/apps/corporate/state-machines/corp-shareholders.js +1099 -0
  58. package/dist/esm/apps/corporate/state-machines/index.js +15 -4439
  59. package/dist/esm/apps/governance/index.js +9 -9
  60. package/dist/esm/apps/governance/state-machines/dao-multisig.js +464 -0
  61. package/dist/esm/apps/governance/state-machines/dao-reputation.js +455 -0
  62. package/dist/esm/apps/governance/state-machines/dao-single.js +196 -0
  63. package/dist/esm/apps/governance/state-machines/dao-token.js +500 -0
  64. package/dist/esm/apps/governance/state-machines/governance-simple.js +479 -0
  65. package/dist/esm/apps/governance/state-machines/governance-universal.js +135 -0
  66. package/dist/esm/apps/governance/state-machines/index.js +9 -2933
  67. package/dist/esm/apps/identity/constants.js +28 -14
  68. package/dist/esm/apps/identity/index.js +7 -5
  69. package/dist/esm/apps/identity/state-machines/identity-agent.js +253 -0
  70. package/dist/esm/apps/identity/state-machines/identity-oracle.js +318 -0
  71. package/dist/esm/apps/identity/state-machines/identity-universal.js +103 -0
  72. package/dist/esm/apps/identity/state-machines/index.js +11 -783
  73. package/dist/esm/apps/index.js +5 -5
  74. package/dist/esm/apps/markets/index.js +3 -3
  75. package/dist/esm/apps/markets/state-machines/index.js +8 -2297
  76. package/dist/esm/apps/markets/state-machines/market-auction.js +280 -0
  77. package/dist/esm/apps/markets/state-machines/market-crowdfund.js +309 -0
  78. package/dist/esm/apps/markets/state-machines/market-group-buy.js +404 -0
  79. package/dist/esm/apps/markets/state-machines/market-prediction.js +482 -0
  80. package/dist/esm/apps/markets/state-machines/market-universal.js +126 -0
  81. package/dist/esm/apps/oracles/index.js +21 -0
  82. package/dist/esm/generated/google/protobuf/struct.js +1 -1
  83. package/dist/esm/generated/google/protobuf/timestamp.js +1 -1
  84. package/dist/esm/generated/index.js +8 -4
  85. package/dist/esm/generated/ottochain/apps/contracts/v1/contract.js +1 -1
  86. package/dist/esm/generated/ottochain/apps/corporate/v1/corporate.js +1 -1
  87. package/dist/esm/generated/ottochain/apps/governance/v1/governance.js +1 -1
  88. package/dist/esm/generated/ottochain/apps/identity/v1/attestation.js +2 -2
  89. package/dist/esm/generated/ottochain/apps/identity/v1/identity.js +1676 -0
  90. package/dist/esm/generated/ottochain/apps/markets/v1/market.js +1 -1
  91. package/dist/esm/generated/ottochain/v1/common.js +1 -1
  92. package/dist/esm/generated/ottochain/v1/fiber.js +1 -1
  93. package/dist/esm/generated/ottochain/v1/messages.js +1 -1
  94. package/dist/esm/generated/ottochain/v1/records.js +1 -1
  95. package/dist/esm/schema/fiber-app.js +86 -0
  96. package/dist/esm/schema/index.js +4 -0
  97. package/dist/types/apps/contracts/index.d.ts +151 -2
  98. package/dist/types/apps/contracts/state-machines/contract-agreement.d.ts +462 -0
  99. package/dist/types/apps/contracts/state-machines/contract-escrow.d.ts +511 -0
  100. package/dist/types/apps/contracts/state-machines/contract-universal.d.ts +147 -0
  101. package/dist/types/apps/contracts/state-machines/index.d.ts +149 -0
  102. package/dist/types/apps/corporate/index.d.ts +5263 -3825
  103. package/dist/types/apps/corporate/state-machines/corp-board.d.ts +1479 -0
  104. package/dist/types/apps/corporate/state-machines/corp-entity.d.ts +970 -0
  105. package/dist/types/apps/corporate/state-machines/corp-securities.d.ts +1381 -0
  106. package/dist/types/apps/corporate/state-machines/corp-shareholders.d.ts +1631 -0
  107. package/dist/types/apps/corporate/state-machines/index.d.ts +5245 -3802
  108. package/dist/types/apps/governance/index.d.ts +875 -37
  109. package/dist/types/apps/governance/state-machines/dao-multisig.d.ts +644 -0
  110. package/dist/types/apps/governance/state-machines/dao-reputation.d.ts +610 -0
  111. package/dist/types/apps/governance/state-machines/dao-single.d.ts +276 -0
  112. package/dist/types/apps/governance/state-machines/dao-token.d.ts +601 -0
  113. package/dist/types/apps/governance/state-machines/governance-simple.d.ts +652 -0
  114. package/dist/types/apps/governance/state-machines/governance-universal.d.ts +181 -0
  115. package/dist/types/apps/governance/state-machines/index.d.ts +9 -2136
  116. package/dist/types/apps/identity/constants.d.ts +8 -6
  117. package/dist/types/apps/identity/index.d.ts +1078 -577
  118. package/dist/types/apps/identity/state-machines/identity-agent.d.ts +401 -0
  119. package/dist/types/apps/identity/state-machines/identity-oracle.d.ts +550 -0
  120. package/dist/types/apps/identity/state-machines/identity-universal.d.ts +151 -0
  121. package/dist/types/apps/identity/state-machines/index.d.ts +1069 -567
  122. package/dist/types/apps/index.d.ts +5 -5
  123. package/dist/types/apps/markets/index.d.ts +535 -7
  124. package/dist/types/apps/markets/state-machines/index.d.ts +8 -1678
  125. package/dist/types/apps/markets/state-machines/market-auction.d.ts +392 -0
  126. package/dist/types/apps/markets/state-machines/market-crowdfund.d.ts +443 -0
  127. package/dist/types/apps/markets/state-machines/market-group-buy.d.ts +539 -0
  128. package/dist/types/apps/markets/state-machines/market-prediction.d.ts +651 -0
  129. package/dist/types/apps/markets/state-machines/market-universal.d.ts +191 -0
  130. package/dist/types/apps/oracles/index.d.ts +18 -0
  131. package/dist/types/generated/index.d.ts +3 -2
  132. package/dist/types/generated/ottochain/apps/identity/v1/attestation.d.ts +1 -1
  133. package/dist/types/generated/ottochain/apps/identity/v1/identity.d.ts +187 -0
  134. package/dist/types/schema/fiber-app.d.ts +172 -0
  135. package/dist/types/schema/index.d.ts +4 -0
  136. package/package.json +1 -1
  137. package/dist/cjs/generated/ottochain/apps/identity/v1/agent.js +0 -619
  138. package/dist/cjs/generated/ottochain/apps/oracles/v1/oracle.js +0 -1223
  139. package/dist/esm/generated/ottochain/apps/identity/v1/agent.js +0 -610
  140. package/dist/esm/generated/ottochain/apps/oracles/v1/oracle.js +0 -1217
  141. package/dist/types/generated/ottochain/apps/identity/v1/agent.d.ts +0 -94
  142. package/dist/types/generated/ottochain/apps/oracles/v1/oracle.d.ts +0 -150
@@ -1,596 +1,1098 @@
1
1
  /**
2
- * Auto-generated from JSON state machine definitions.
3
- * DO NOT EDIT - regenerate with: npm run prebuild
2
+ * Identity State Machine Definitions
3
+ *
4
+ * TypeScript-first definitions - no JSON, no code generation.
4
5
  */
5
- export declare const identityAgentDef: {
6
- readonly metadata: {
7
- readonly name: "IdentityAgent";
8
- readonly description: "Standard agent identity with reputation tracking, vouching, and lifecycle management";
9
- readonly version: "1.0.0";
10
- };
11
- readonly states: {
12
- readonly REGISTERED: {
13
- readonly id: "REGISTERED";
14
- readonly isFinal: false;
15
- readonly metadata: null;
6
+ export { identityAgentDef, type AgentState, type AgentEvent, } from "./identity-agent.js";
7
+ export { identityOracleDef, type OracleState, type OracleEvent, } from "./identity-oracle.js";
8
+ export { identityUniversalDef, type UniversalIdentityState, type UniversalIdentityEvent, } from "./identity-universal.js";
9
+ export declare const IDENTITY_DEFINITIONS: {
10
+ readonly agent: () => Promise<{
11
+ metadata: {
12
+ name: string;
13
+ app: string;
14
+ type: string;
15
+ version: string;
16
+ description: string;
16
17
  };
17
- readonly ACTIVE: {
18
- readonly id: "ACTIVE";
19
- readonly isFinal: false;
20
- readonly metadata: null;
21
- };
22
- readonly CHALLENGED: {
23
- readonly id: "CHALLENGED";
24
- readonly isFinal: false;
25
- readonly metadata: null;
26
- };
27
- readonly SUSPENDED: {
28
- readonly id: "SUSPENDED";
29
- readonly isFinal: false;
30
- readonly metadata: null;
31
- };
32
- readonly PROBATION: {
33
- readonly id: "PROBATION";
34
- readonly isFinal: false;
35
- readonly metadata: null;
36
- };
37
- readonly WITHDRAWN: {
38
- readonly id: "WITHDRAWN";
39
- readonly isFinal: true;
40
- readonly metadata: null;
41
- };
42
- };
43
- readonly initialState: "REGISTERED";
44
- readonly transitions: readonly [{
45
- readonly from: "REGISTERED";
46
- readonly to: "ACTIVE";
47
- readonly eventName: "activate";
48
- readonly guard: {
49
- readonly "==": readonly [1, 1];
50
- };
51
- readonly effect: {
52
- readonly merge: readonly [{
53
- readonly var: "state";
54
- }, {
55
- readonly status: "ACTIVE";
56
- readonly activatedAt: {
57
- readonly var: "$timestamp";
58
- };
59
- }];
60
- };
61
- readonly dependencies: readonly [];
62
- }, {
63
- readonly from: "ACTIVE";
64
- readonly to: "ACTIVE";
65
- readonly eventName: "receive_vouch";
66
- readonly guard: {
67
- readonly "!!": readonly [{
68
- readonly var: "event.from";
69
- }];
70
- };
71
- readonly effect: {
72
- readonly merge: readonly [{
73
- readonly var: "state";
74
- }, {
75
- readonly reputation: {
76
- readonly "+": readonly [{
77
- readonly var: "state.reputation";
78
- }, 2];
79
- };
80
- }];
81
- };
82
- readonly dependencies: readonly [];
83
- }, {
84
- readonly from: "ACTIVE";
85
- readonly to: "ACTIVE";
86
- readonly eventName: "receive_completion";
87
- readonly guard: {
88
- readonly "==": readonly [1, 1];
89
- };
90
- readonly effect: {
91
- readonly merge: readonly [{
92
- readonly var: "state";
93
- }, {
94
- readonly reputation: {
95
- readonly "+": readonly [{
96
- readonly var: "state.reputation";
97
- }, 5];
98
- };
99
- }];
100
- };
101
- readonly dependencies: readonly [];
102
- }, {
103
- readonly from: "ACTIVE";
104
- readonly to: "CHALLENGED";
105
- readonly eventName: "challenge";
106
- readonly guard: {
107
- readonly "!!": readonly [{
108
- readonly var: "event.challenger";
109
- }];
110
- };
111
- readonly effect: {
112
- readonly merge: readonly [{
113
- readonly var: "state";
114
- }, {
115
- readonly status: "CHALLENGED";
116
- readonly challengedBy: {
117
- readonly var: "event.challenger";
118
- };
119
- }];
120
- };
121
- readonly dependencies: readonly [];
122
- }, {
123
- readonly from: "CHALLENGED";
124
- readonly to: "ACTIVE";
125
- readonly eventName: "dismiss_challenge";
126
- readonly guard: {
127
- readonly "==": readonly [1, 1];
128
- };
129
- readonly effect: {
130
- readonly merge: readonly [{
131
- readonly var: "state";
132
- }, {
133
- readonly status: "ACTIVE";
134
- readonly challengedBy: null;
135
- }];
136
- };
137
- readonly dependencies: readonly [];
138
- }, {
139
- readonly from: "CHALLENGED";
140
- readonly to: "SUSPENDED";
141
- readonly eventName: "uphold_challenge";
142
- readonly guard: {
143
- readonly "==": readonly [1, 1];
144
- };
145
- readonly effect: {
146
- readonly merge: readonly [{
147
- readonly var: "state";
148
- }, {
149
- readonly status: "SUSPENDED";
150
- readonly suspendedAt: {
151
- readonly var: "$timestamp";
152
- };
153
- }];
154
- };
155
- readonly dependencies: readonly [];
156
- }, {
157
- readonly from: "SUSPENDED";
158
- readonly to: "PROBATION";
159
- readonly eventName: "begin_probation";
160
- readonly guard: {
161
- readonly "==": readonly [1, 1];
162
- };
163
- readonly effect: {
164
- readonly merge: readonly [{
165
- readonly var: "state";
166
- }, {
167
- readonly status: "PROBATION";
168
- readonly probationStartedAt: {
169
- readonly var: "$timestamp";
170
- };
171
- }];
172
- };
173
- readonly dependencies: readonly [];
174
- }, {
175
- readonly from: "PROBATION";
176
- readonly to: "ACTIVE";
177
- readonly eventName: "complete_probation";
178
- readonly guard: {
179
- readonly "==": readonly [1, 1];
180
- };
181
- readonly effect: {
182
- readonly merge: readonly [{
183
- readonly var: "state";
184
- }, {
185
- readonly status: "ACTIVE";
186
- readonly probationStartedAt: null;
187
- }];
188
- };
189
- readonly dependencies: readonly [];
190
- }, {
191
- readonly from: "ACTIVE";
192
- readonly to: "WITHDRAWN";
193
- readonly eventName: "withdraw";
194
- readonly guard: {
195
- readonly "==": readonly [1, 1];
196
- };
197
- readonly effect: {
198
- readonly merge: readonly [{
199
- readonly var: "state";
200
- }, {
201
- readonly status: "WITHDRAWN";
202
- }];
203
- };
204
- readonly dependencies: readonly [];
205
- }];
206
- };
207
- export declare const identityOracleDef: {
208
- readonly metadata: {
209
- readonly name: "IdentityOracle";
210
- readonly description: "Oracle identity with staking, attestations, reputation, and slashing mechanics";
211
- readonly version: "1.0.0";
212
- };
213
- readonly states: {
214
- readonly UNREGISTERED: {
215
- readonly id: "UNREGISTERED";
216
- readonly isFinal: false;
217
- readonly metadata: null;
218
- };
219
- readonly REGISTERED: {
220
- readonly id: "REGISTERED";
221
- readonly isFinal: false;
222
- readonly metadata: null;
223
- };
224
- readonly ACTIVE: {
225
- readonly id: "ACTIVE";
226
- readonly isFinal: false;
227
- readonly metadata: null;
228
- };
229
- readonly SLASHED: {
230
- readonly id: "SLASHED";
231
- readonly isFinal: false;
232
- readonly metadata: null;
233
- };
234
- readonly WITHDRAWN: {
235
- readonly id: "WITHDRAWN";
236
- readonly isFinal: true;
237
- readonly metadata: null;
238
- };
239
- };
240
- readonly initialState: "UNREGISTERED";
241
- readonly transitions: readonly [{
242
- readonly from: "UNREGISTERED";
243
- readonly to: "REGISTERED";
244
- readonly eventName: "register";
245
- readonly guard: {
246
- readonly ">=": readonly [{
247
- readonly var: "event.stake";
248
- }, {
249
- readonly var: "state.minStake";
250
- }];
251
- };
252
- readonly effect: {
253
- readonly merge: readonly [{
254
- readonly var: "state";
255
- }, {
256
- readonly status: "REGISTERED";
257
- readonly address: {
258
- readonly var: "event.agent";
259
- };
260
- readonly stake: {
261
- readonly var: "event.stake";
262
- };
263
- readonly registeredAt: {
264
- readonly var: "$timestamp";
265
- };
266
- readonly reputation: {
267
- readonly accuracy: 100;
268
- readonly totalResolutions: 0;
269
- readonly disputesWon: 0;
270
- readonly disputesLost: 0;
271
- };
272
- readonly domains: {
273
- readonly var: "event.domains";
274
- };
275
- readonly slashingHistory: readonly [];
276
- }];
18
+ createSchema: {
19
+ required: readonly ["owner", "displayName"];
20
+ properties: {
21
+ owner: {
22
+ type: "address";
23
+ description: string;
24
+ immutable: true;
25
+ };
26
+ displayName: {
27
+ type: "string";
28
+ maxLength: number;
29
+ description: string;
30
+ };
31
+ bio: {
32
+ type: "string";
33
+ maxLength: number;
34
+ default: string;
35
+ };
36
+ avatar: {
37
+ type: "uri";
38
+ default: null;
39
+ };
40
+ platforms: {
41
+ type: "array";
42
+ items: {
43
+ $ref: string;
44
+ };
45
+ default: never[];
46
+ };
47
+ };
277
48
  };
278
- readonly dependencies: readonly [];
279
- }, {
280
- readonly from: "REGISTERED";
281
- readonly to: "ACTIVE";
282
- readonly eventName: "activate";
283
- readonly guard: {
284
- readonly or: readonly [{
285
- readonly "===": readonly [{
286
- readonly var: "event.agent";
287
- }, {
288
- readonly var: "state.address";
289
- }];
290
- }, {
291
- readonly var: "event.adminOverride";
292
- }];
49
+ stateSchema: {
50
+ properties: {
51
+ owner: {
52
+ type: "address";
53
+ immutable: true;
54
+ };
55
+ displayName: {
56
+ type: "string";
57
+ };
58
+ bio: {
59
+ type: "string";
60
+ };
61
+ avatar: {
62
+ type: "uri";
63
+ };
64
+ platforms: {
65
+ type: "array";
66
+ items: {
67
+ $ref: string;
68
+ };
69
+ };
70
+ status: {
71
+ type: "string";
72
+ enum: readonly ["REGISTERED", "ACTIVE", "CHALLENGED", "SUSPENDED", "PROBATION", "WITHDRAWN"];
73
+ computed: true;
74
+ };
75
+ reputation: {
76
+ type: "integer";
77
+ default: number;
78
+ computed: true;
79
+ };
80
+ activatedAt: {
81
+ type: "timestamp";
82
+ computed: true;
83
+ };
84
+ suspendedAt: {
85
+ type: "timestamp";
86
+ computed: true;
87
+ };
88
+ probationStartedAt: {
89
+ type: "timestamp";
90
+ computed: true;
91
+ };
92
+ challengedBy: {
93
+ type: "address";
94
+ computed: true;
95
+ };
96
+ };
293
97
  };
294
- readonly effect: {
295
- readonly merge: readonly [{
296
- readonly var: "state";
297
- }, {
298
- readonly status: "ACTIVE";
299
- readonly activatedAt: {
300
- readonly var: "$timestamp";
301
- };
302
- }];
98
+ eventSchemas: {
99
+ activate: {
100
+ description: string;
101
+ };
102
+ receive_vouch: {
103
+ description: string;
104
+ required: readonly ["from"];
105
+ properties: {
106
+ from: {
107
+ type: "address";
108
+ description: string;
109
+ };
110
+ weight: {
111
+ type: "integer";
112
+ minimum: number;
113
+ maximum: number;
114
+ default: number;
115
+ };
116
+ };
117
+ };
118
+ receive_completion: {
119
+ description: string;
120
+ };
121
+ challenge: {
122
+ description: string;
123
+ required: readonly ["challenger", "reason"];
124
+ properties: {
125
+ challenger: {
126
+ type: "address";
127
+ };
128
+ reason: {
129
+ type: "string";
130
+ maxLength: number;
131
+ };
132
+ evidence: {
133
+ type: "array";
134
+ items: {
135
+ type: "uri";
136
+ };
137
+ };
138
+ };
139
+ };
140
+ dismiss_challenge: {
141
+ description: string;
142
+ };
143
+ uphold_challenge: {
144
+ description: string;
145
+ };
146
+ begin_probation: {
147
+ description: string;
148
+ };
149
+ complete_probation: {
150
+ description: string;
151
+ };
152
+ withdraw: {
153
+ description: string;
154
+ };
303
155
  };
304
- readonly dependencies: readonly [];
305
- }, {
306
- readonly from: "ACTIVE";
307
- readonly to: "ACTIVE";
308
- readonly eventName: "add_stake";
309
- readonly guard: {
310
- readonly and: readonly [{
311
- readonly "===": readonly [{
312
- readonly var: "event.agent";
313
- }, {
314
- readonly var: "state.address";
315
- }];
316
- }, {
317
- readonly ">": readonly [{
318
- readonly var: "event.amount";
319
- }, 0];
320
- }];
156
+ definitions: {
157
+ PlatformLink: {
158
+ type: "object";
159
+ required: readonly ["platform", "handle"];
160
+ properties: {
161
+ platform: {
162
+ type: "string";
163
+ enum: readonly ["twitter", "github", "discord", "telegram", "moltbook"];
164
+ };
165
+ handle: {
166
+ type: "string";
167
+ };
168
+ verified: {
169
+ type: "boolean";
170
+ default: boolean;
171
+ };
172
+ };
173
+ };
321
174
  };
322
- readonly effect: {
323
- readonly merge: readonly [{
324
- readonly var: "state";
325
- }, {
326
- readonly stake: {
327
- readonly "+": readonly [{
328
- readonly var: "state.stake";
329
- }, {
330
- readonly var: "event.amount";
331
- }];
332
- };
333
- readonly lastStakeAt: {
334
- readonly var: "$timestamp";
335
- };
336
- }];
175
+ states: {
176
+ REGISTERED: {
177
+ id: string;
178
+ isFinal: false;
179
+ };
180
+ ACTIVE: {
181
+ id: string;
182
+ isFinal: false;
183
+ };
184
+ CHALLENGED: {
185
+ id: string;
186
+ isFinal: false;
187
+ };
188
+ SUSPENDED: {
189
+ id: string;
190
+ isFinal: false;
191
+ };
192
+ PROBATION: {
193
+ id: string;
194
+ isFinal: false;
195
+ };
196
+ WITHDRAWN: {
197
+ id: string;
198
+ isFinal: true;
199
+ };
337
200
  };
338
- readonly dependencies: readonly [];
339
- }, {
340
- readonly from: "ACTIVE";
341
- readonly to: "ACTIVE";
342
- readonly eventName: "record_resolution";
343
- readonly guard: {
344
- readonly var: "event.marketId";
201
+ initialState: "REGISTERED";
202
+ transitions: ({
203
+ from: "REGISTERED";
204
+ to: "ACTIVE";
205
+ eventName: "activate";
206
+ guard: {
207
+ "==": number[];
208
+ "!!"?: undefined;
209
+ };
210
+ effect: {
211
+ merge: ({
212
+ var: string;
213
+ status?: undefined;
214
+ activatedAt?: undefined;
215
+ } | {
216
+ status: string;
217
+ activatedAt: {
218
+ var: string;
219
+ };
220
+ var?: undefined;
221
+ })[];
222
+ };
223
+ } | {
224
+ from: "ACTIVE";
225
+ to: "ACTIVE";
226
+ eventName: "receive_vouch";
227
+ guard: {
228
+ "!!": {
229
+ var: string;
230
+ }[];
231
+ "=="?: undefined;
232
+ };
233
+ effect: {
234
+ merge: ({
235
+ var: string;
236
+ reputation?: undefined;
237
+ } | {
238
+ reputation: {
239
+ "+": (number | {
240
+ var: string;
241
+ })[];
242
+ };
243
+ var?: undefined;
244
+ })[];
245
+ };
246
+ } | {
247
+ from: "ACTIVE";
248
+ to: "ACTIVE";
249
+ eventName: "receive_completion";
250
+ guard: {
251
+ "==": number[];
252
+ "!!"?: undefined;
253
+ };
254
+ effect: {
255
+ merge: ({
256
+ var: string;
257
+ reputation?: undefined;
258
+ } | {
259
+ reputation: {
260
+ "+": (number | {
261
+ var: string;
262
+ })[];
263
+ };
264
+ var?: undefined;
265
+ })[];
266
+ };
267
+ } | {
268
+ from: "ACTIVE";
269
+ to: "CHALLENGED";
270
+ eventName: "challenge";
271
+ guard: {
272
+ "!!": {
273
+ var: string;
274
+ }[];
275
+ "=="?: undefined;
276
+ };
277
+ effect: {
278
+ merge: ({
279
+ var: string;
280
+ status?: undefined;
281
+ challengedBy?: undefined;
282
+ } | {
283
+ status: string;
284
+ challengedBy: {
285
+ var: string;
286
+ };
287
+ var?: undefined;
288
+ })[];
289
+ };
290
+ } | {
291
+ from: "CHALLENGED";
292
+ to: "ACTIVE";
293
+ eventName: "dismiss_challenge";
294
+ guard: {
295
+ "==": number[];
296
+ "!!"?: undefined;
297
+ };
298
+ effect: {
299
+ merge: ({
300
+ var: string;
301
+ status?: undefined;
302
+ challengedBy?: undefined;
303
+ } | {
304
+ status: string;
305
+ challengedBy: null;
306
+ var?: undefined;
307
+ })[];
308
+ };
309
+ } | {
310
+ from: "CHALLENGED";
311
+ to: "SUSPENDED";
312
+ eventName: "uphold_challenge";
313
+ guard: {
314
+ "==": number[];
315
+ "!!"?: undefined;
316
+ };
317
+ effect: {
318
+ merge: ({
319
+ var: string;
320
+ status?: undefined;
321
+ suspendedAt?: undefined;
322
+ } | {
323
+ status: string;
324
+ suspendedAt: {
325
+ var: string;
326
+ };
327
+ var?: undefined;
328
+ })[];
329
+ };
330
+ } | {
331
+ from: "SUSPENDED";
332
+ to: "PROBATION";
333
+ eventName: "begin_probation";
334
+ guard: {
335
+ "==": number[];
336
+ "!!"?: undefined;
337
+ };
338
+ effect: {
339
+ merge: ({
340
+ var: string;
341
+ status?: undefined;
342
+ probationStartedAt?: undefined;
343
+ } | {
344
+ status: string;
345
+ probationStartedAt: {
346
+ var: string;
347
+ };
348
+ var?: undefined;
349
+ })[];
350
+ };
351
+ } | {
352
+ from: "PROBATION";
353
+ to: "ACTIVE";
354
+ eventName: "complete_probation";
355
+ guard: {
356
+ "==": number[];
357
+ "!!"?: undefined;
358
+ };
359
+ effect: {
360
+ merge: ({
361
+ var: string;
362
+ status?: undefined;
363
+ probationStartedAt?: undefined;
364
+ } | {
365
+ status: string;
366
+ probationStartedAt: null;
367
+ var?: undefined;
368
+ })[];
369
+ };
370
+ } | {
371
+ from: "ACTIVE";
372
+ to: "WITHDRAWN";
373
+ eventName: "withdraw";
374
+ guard: {
375
+ "==": number[];
376
+ "!!"?: undefined;
377
+ };
378
+ effect: {
379
+ merge: ({
380
+ var: string;
381
+ status?: undefined;
382
+ } | {
383
+ status: string;
384
+ var?: undefined;
385
+ })[];
386
+ };
387
+ } | {
388
+ from: "REGISTERED";
389
+ to: "WITHDRAWN";
390
+ eventName: "withdraw";
391
+ guard: {
392
+ "==": number[];
393
+ "!!"?: undefined;
394
+ };
395
+ effect: {
396
+ merge: ({
397
+ var: string;
398
+ status?: undefined;
399
+ } | {
400
+ status: string;
401
+ var?: undefined;
402
+ })[];
403
+ };
404
+ })[];
405
+ }>;
406
+ readonly oracle: () => Promise<{
407
+ metadata: {
408
+ name: string;
409
+ app: string;
410
+ type: string;
411
+ version: string;
412
+ description: string;
345
413
  };
346
- readonly effect: {
347
- readonly merge: readonly [{
348
- readonly var: "state";
349
- }, {
350
- readonly reputation: {
351
- readonly merge: readonly [{
352
- readonly var: "state.reputation";
353
- }, {
354
- readonly totalResolutions: {
355
- readonly "+": readonly [{
356
- readonly var: "state.reputation.totalResolutions";
357
- }, 1];
358
- };
359
- readonly accuracy: {
360
- readonly if: readonly [{
361
- readonly var: "event.correct";
362
- }, {
363
- readonly var: "state.reputation.accuracy";
364
- }, {
365
- readonly "-": readonly [{
366
- readonly var: "state.reputation.accuracy";
367
- }, 5];
368
- }];
369
- };
370
- }];
414
+ createSchema: {
415
+ required: readonly ["owner", "stake", "domains"];
416
+ properties: {
417
+ owner: {
418
+ type: "address";
419
+ description: string;
420
+ immutable: true;
371
421
  };
372
- readonly lastResolutionAt: {
373
- readonly var: "$timestamp";
422
+ stake: {
423
+ type: "integer";
424
+ minimum: number;
425
+ description: string;
374
426
  };
375
- }];
376
- };
377
- readonly dependencies: readonly [];
378
- }, {
379
- readonly from: "ACTIVE";
380
- readonly to: "SLASHED";
381
- readonly eventName: "slash";
382
- readonly guard: {
383
- readonly and: readonly [{
384
- readonly var: "event.reason";
385
- }, {
386
- readonly ">": readonly [{
387
- readonly var: "event.amount";
388
- }, 0];
389
- }, {
390
- readonly "<=": readonly [{
391
- readonly var: "event.amount";
392
- }, {
393
- readonly var: "state.stake";
394
- }];
395
- }];
427
+ domains: {
428
+ type: "array";
429
+ items: {
430
+ type: "string";
431
+ };
432
+ description: string;
433
+ };
434
+ minStake: {
435
+ type: "integer";
436
+ default: number;
437
+ description: string;
438
+ };
439
+ };
396
440
  };
397
- readonly effect: {
398
- readonly merge: readonly [{
399
- readonly var: "state";
400
- }, {
401
- readonly status: "SLASHED";
402
- readonly stake: {
403
- readonly "-": readonly [{
404
- readonly var: "state.stake";
405
- }, {
406
- readonly var: "event.amount";
407
- }];
408
- };
409
- readonly slashingHistory: {
410
- readonly cat: readonly [{
411
- readonly var: "state.slashingHistory";
412
- }, readonly [{
413
- readonly reason: {
414
- readonly var: "event.reason";
441
+ stateSchema: {
442
+ properties: {
443
+ owner: {
444
+ type: "address";
445
+ immutable: true;
446
+ };
447
+ address: {
448
+ type: "address";
449
+ computed: true;
450
+ };
451
+ stake: {
452
+ type: "integer";
453
+ computed: true;
454
+ };
455
+ minStake: {
456
+ type: "integer";
457
+ };
458
+ domains: {
459
+ type: "array";
460
+ items: {
461
+ type: "string";
462
+ };
463
+ };
464
+ status: {
465
+ type: "string";
466
+ enum: readonly ["UNREGISTERED", "REGISTERED", "ACTIVE", "SLASHED", "WITHDRAWN"];
467
+ computed: true;
468
+ };
469
+ reputation: {
470
+ type: "object";
471
+ properties: {
472
+ accuracy: {
473
+ type: "integer";
415
474
  };
416
- readonly amount: {
417
- readonly var: "event.amount";
475
+ totalResolutions: {
476
+ type: "integer";
418
477
  };
419
- readonly marketId: {
420
- readonly var: "event.marketId";
478
+ disputesWon: {
479
+ type: "integer";
421
480
  };
422
- readonly slashedAt: {
423
- readonly var: "$timestamp";
481
+ disputesLost: {
482
+ type: "integer";
424
483
  };
425
- }]];
484
+ };
485
+ computed: true;
426
486
  };
427
- readonly slashedAt: {
428
- readonly var: "$timestamp";
487
+ slashingHistory: {
488
+ type: "array";
489
+ computed: true;
429
490
  };
430
- }];
431
- };
432
- readonly dependencies: readonly [];
433
- }, {
434
- readonly from: "SLASHED";
435
- readonly to: "ACTIVE";
436
- readonly eventName: "reactivate";
437
- readonly guard: {
438
- readonly and: readonly [{
439
- readonly "===": readonly [{
440
- readonly var: "event.agent";
441
- }, {
442
- readonly var: "state.address";
443
- }];
444
- }, {
445
- readonly ">=": readonly [{
446
- readonly var: "state.stake";
447
- }, {
448
- readonly var: "state.minStake";
449
- }];
450
- }];
451
- };
452
- readonly effect: {
453
- readonly merge: readonly [{
454
- readonly var: "state";
455
- }, {
456
- readonly status: "ACTIVE";
457
- readonly reactivatedAt: {
458
- readonly var: "$timestamp";
459
- };
460
- }];
461
- };
462
- readonly dependencies: readonly [];
463
- }, {
464
- readonly from: "ACTIVE";
465
- readonly to: "WITHDRAWN";
466
- readonly eventName: "withdraw";
467
- readonly guard: {
468
- readonly "===": readonly [{
469
- readonly var: "event.agent";
470
- }, {
471
- readonly var: "state.address";
472
- }];
473
- };
474
- readonly effect: {
475
- readonly merge: readonly [{
476
- readonly var: "state";
477
- }, {
478
- readonly status: "WITHDRAWN";
479
- readonly withdrawnAt: {
480
- readonly var: "$timestamp";
481
- };
482
- readonly finalStake: {
483
- readonly var: "state.stake";
484
- };
485
- }];
486
- };
487
- readonly dependencies: readonly [];
488
- }, {
489
- readonly from: "SLASHED";
490
- readonly to: "WITHDRAWN";
491
- readonly eventName: "withdraw";
492
- readonly guard: {
493
- readonly "===": readonly [{
494
- readonly var: "event.agent";
495
- }, {
496
- readonly var: "state.address";
497
- }];
498
- };
499
- readonly effect: {
500
- readonly merge: readonly [{
501
- readonly var: "state";
502
- }, {
503
- readonly status: "WITHDRAWN";
504
- readonly withdrawnAt: {
505
- readonly var: "$timestamp";
506
- };
507
- readonly finalStake: {
508
- readonly var: "state.stake";
509
- };
510
- }];
511
- };
512
- readonly dependencies: readonly [];
513
- }];
514
- };
515
- export declare const identityUniversalDef: {
516
- readonly metadata: {
517
- readonly name: "IdentityUniversal";
518
- readonly description: "Minimal identity state machine - extend for custom use cases";
519
- readonly version: "1.0.0";
520
- };
521
- readonly states: {
522
- readonly CREATED: {
523
- readonly id: "CREATED";
524
- readonly isFinal: false;
525
- readonly metadata: null;
526
- };
527
- readonly ACTIVE: {
528
- readonly id: "ACTIVE";
529
- readonly isFinal: false;
530
- readonly metadata: null;
491
+ registeredAt: {
492
+ type: "timestamp";
493
+ computed: true;
494
+ };
495
+ activatedAt: {
496
+ type: "timestamp";
497
+ computed: true;
498
+ };
499
+ slashedAt: {
500
+ type: "timestamp";
501
+ computed: true;
502
+ };
503
+ withdrawnAt: {
504
+ type: "timestamp";
505
+ computed: true;
506
+ };
507
+ };
531
508
  };
532
- readonly INACTIVE: {
533
- readonly id: "INACTIVE";
534
- readonly isFinal: true;
535
- readonly metadata: null;
509
+ eventSchemas: {
510
+ register: {
511
+ description: string;
512
+ required: readonly ["agent", "stake", "domains"];
513
+ properties: {
514
+ agent: {
515
+ type: "address";
516
+ };
517
+ stake: {
518
+ type: "integer";
519
+ minimum: number;
520
+ };
521
+ domains: {
522
+ type: "array";
523
+ items: {
524
+ type: "string";
525
+ };
526
+ };
527
+ };
528
+ };
529
+ activate: {
530
+ description: string;
531
+ required: readonly ["agent"];
532
+ properties: {
533
+ agent: {
534
+ type: "address";
535
+ };
536
+ adminOverride: {
537
+ type: "boolean";
538
+ default: boolean;
539
+ };
540
+ };
541
+ };
542
+ add_stake: {
543
+ description: string;
544
+ required: readonly ["agent", "amount"];
545
+ properties: {
546
+ agent: {
547
+ type: "address";
548
+ };
549
+ amount: {
550
+ type: "integer";
551
+ minimum: number;
552
+ };
553
+ };
554
+ };
555
+ record_resolution: {
556
+ description: string;
557
+ required: readonly ["marketId", "correct"];
558
+ properties: {
559
+ marketId: {
560
+ type: "uuid";
561
+ };
562
+ correct: {
563
+ type: "boolean";
564
+ };
565
+ };
566
+ };
567
+ slash: {
568
+ description: string;
569
+ required: readonly ["reason", "amount"];
570
+ properties: {
571
+ reason: {
572
+ type: "string";
573
+ };
574
+ amount: {
575
+ type: "integer";
576
+ minimum: number;
577
+ };
578
+ marketId: {
579
+ type: "uuid";
580
+ };
581
+ };
582
+ };
583
+ reactivate: {
584
+ description: string;
585
+ required: readonly ["agent"];
586
+ properties: {
587
+ agent: {
588
+ type: "address";
589
+ };
590
+ };
591
+ };
592
+ withdraw: {
593
+ description: string;
594
+ required: readonly ["agent"];
595
+ properties: {
596
+ agent: {
597
+ type: "address";
598
+ };
599
+ };
600
+ };
536
601
  };
537
- };
538
- readonly initialState: "CREATED";
539
- readonly transitions: readonly [{
540
- readonly from: "CREATED";
541
- readonly to: "ACTIVE";
542
- readonly eventName: "activate";
543
- readonly guard: {
544
- readonly "==": readonly [1, 1];
602
+ states: {
603
+ UNREGISTERED: {
604
+ id: string;
605
+ isFinal: false;
606
+ };
607
+ REGISTERED: {
608
+ id: string;
609
+ isFinal: false;
610
+ };
611
+ ACTIVE: {
612
+ id: string;
613
+ isFinal: false;
614
+ };
615
+ SLASHED: {
616
+ id: string;
617
+ isFinal: false;
618
+ };
619
+ WITHDRAWN: {
620
+ id: string;
621
+ isFinal: true;
622
+ };
545
623
  };
546
- readonly effect: {
547
- readonly merge: readonly [{
548
- readonly var: "state";
549
- }, {
550
- readonly status: "ACTIVE";
551
- readonly activatedAt: {
552
- readonly var: "$timestamp";
553
- };
554
- }];
624
+ initialState: "UNREGISTERED";
625
+ transitions: ({
626
+ from: "UNREGISTERED";
627
+ to: "REGISTERED";
628
+ eventName: "register";
629
+ guard: {
630
+ ">=": {
631
+ var: string;
632
+ }[];
633
+ or?: undefined;
634
+ and?: undefined;
635
+ var?: undefined;
636
+ "==="?: undefined;
637
+ };
638
+ effect: {
639
+ merge: ({
640
+ var: string;
641
+ status?: undefined;
642
+ address?: undefined;
643
+ stake?: undefined;
644
+ registeredAt?: undefined;
645
+ reputation?: undefined;
646
+ domains?: undefined;
647
+ slashingHistory?: undefined;
648
+ } | {
649
+ status: string;
650
+ address: {
651
+ var: string;
652
+ };
653
+ stake: {
654
+ var: string;
655
+ };
656
+ registeredAt: {
657
+ var: string;
658
+ };
659
+ reputation: {
660
+ accuracy: number;
661
+ totalResolutions: number;
662
+ disputesWon: number;
663
+ disputesLost: number;
664
+ };
665
+ domains: {
666
+ var: string;
667
+ };
668
+ slashingHistory: never[];
669
+ var?: undefined;
670
+ })[];
671
+ };
672
+ } | {
673
+ from: "REGISTERED";
674
+ to: "ACTIVE";
675
+ eventName: "activate";
676
+ guard: {
677
+ or: ({
678
+ "===": {
679
+ var: string;
680
+ }[];
681
+ var?: undefined;
682
+ } | {
683
+ var: string;
684
+ "==="?: undefined;
685
+ })[];
686
+ ">="?: undefined;
687
+ and?: undefined;
688
+ var?: undefined;
689
+ "==="?: undefined;
690
+ };
691
+ effect: {
692
+ merge: ({
693
+ var: string;
694
+ status?: undefined;
695
+ activatedAt?: undefined;
696
+ } | {
697
+ status: string;
698
+ activatedAt: {
699
+ var: string;
700
+ };
701
+ var?: undefined;
702
+ })[];
703
+ };
704
+ } | {
705
+ from: "ACTIVE";
706
+ to: "ACTIVE";
707
+ eventName: "add_stake";
708
+ guard: {
709
+ and: ({
710
+ "===": {
711
+ var: string;
712
+ }[];
713
+ ">"?: undefined;
714
+ } | {
715
+ ">": (number | {
716
+ var: string;
717
+ })[];
718
+ "==="?: undefined;
719
+ })[];
720
+ ">="?: undefined;
721
+ or?: undefined;
722
+ var?: undefined;
723
+ "==="?: undefined;
724
+ };
725
+ effect: {
726
+ merge: ({
727
+ var: string;
728
+ stake?: undefined;
729
+ lastStakeAt?: undefined;
730
+ } | {
731
+ stake: {
732
+ "+": {
733
+ var: string;
734
+ }[];
735
+ };
736
+ lastStakeAt: {
737
+ var: string;
738
+ };
739
+ var?: undefined;
740
+ })[];
741
+ };
742
+ } | {
743
+ from: "ACTIVE";
744
+ to: "ACTIVE";
745
+ eventName: "record_resolution";
746
+ guard: {
747
+ var: string;
748
+ ">="?: undefined;
749
+ or?: undefined;
750
+ and?: undefined;
751
+ "==="?: undefined;
752
+ };
753
+ effect: {
754
+ merge: ({
755
+ var: string;
756
+ reputation?: undefined;
757
+ lastResolutionAt?: undefined;
758
+ } | {
759
+ reputation: {
760
+ merge: ({
761
+ var: string;
762
+ totalResolutions?: undefined;
763
+ accuracy?: undefined;
764
+ } | {
765
+ totalResolutions: {
766
+ "+": (number | {
767
+ var: string;
768
+ })[];
769
+ };
770
+ accuracy: {
771
+ if: ({
772
+ var: string;
773
+ "-"?: undefined;
774
+ } | {
775
+ "-": (number | {
776
+ var: string;
777
+ })[];
778
+ var?: undefined;
779
+ })[];
780
+ };
781
+ var?: undefined;
782
+ })[];
783
+ };
784
+ lastResolutionAt: {
785
+ var: string;
786
+ };
787
+ var?: undefined;
788
+ })[];
789
+ };
790
+ } | {
791
+ from: "ACTIVE";
792
+ to: "SLASHED";
793
+ eventName: "slash";
794
+ guard: {
795
+ and: ({
796
+ var: string;
797
+ ">"?: undefined;
798
+ "<="?: undefined;
799
+ } | {
800
+ ">": (number | {
801
+ var: string;
802
+ })[];
803
+ var?: undefined;
804
+ "<="?: undefined;
805
+ } | {
806
+ "<=": {
807
+ var: string;
808
+ }[];
809
+ var?: undefined;
810
+ ">"?: undefined;
811
+ })[];
812
+ ">="?: undefined;
813
+ or?: undefined;
814
+ var?: undefined;
815
+ "==="?: undefined;
816
+ };
817
+ effect: {
818
+ merge: ({
819
+ var: string;
820
+ status?: undefined;
821
+ stake?: undefined;
822
+ slashingHistory?: undefined;
823
+ slashedAt?: undefined;
824
+ } | {
825
+ status: string;
826
+ stake: {
827
+ "-": {
828
+ var: string;
829
+ }[];
830
+ };
831
+ slashingHistory: {
832
+ cat: ({
833
+ var: string;
834
+ } | {
835
+ reason: {
836
+ var: string;
837
+ };
838
+ amount: {
839
+ var: string;
840
+ };
841
+ marketId: {
842
+ var: string;
843
+ };
844
+ slashedAt: {
845
+ var: string;
846
+ };
847
+ }[])[];
848
+ };
849
+ slashedAt: {
850
+ var: string;
851
+ };
852
+ var?: undefined;
853
+ })[];
854
+ };
855
+ } | {
856
+ from: "SLASHED";
857
+ to: "ACTIVE";
858
+ eventName: "reactivate";
859
+ guard: {
860
+ and: ({
861
+ "===": {
862
+ var: string;
863
+ }[];
864
+ ">="?: undefined;
865
+ } | {
866
+ ">=": {
867
+ var: string;
868
+ }[];
869
+ "==="?: undefined;
870
+ })[];
871
+ ">="?: undefined;
872
+ or?: undefined;
873
+ var?: undefined;
874
+ "==="?: undefined;
875
+ };
876
+ effect: {
877
+ merge: ({
878
+ var: string;
879
+ status?: undefined;
880
+ reactivatedAt?: undefined;
881
+ } | {
882
+ status: string;
883
+ reactivatedAt: {
884
+ var: string;
885
+ };
886
+ var?: undefined;
887
+ })[];
888
+ };
889
+ } | {
890
+ from: "ACTIVE";
891
+ to: "WITHDRAWN";
892
+ eventName: "withdraw";
893
+ guard: {
894
+ "===": {
895
+ var: string;
896
+ }[];
897
+ ">="?: undefined;
898
+ or?: undefined;
899
+ and?: undefined;
900
+ var?: undefined;
901
+ };
902
+ effect: {
903
+ merge: ({
904
+ var: string;
905
+ status?: undefined;
906
+ withdrawnAt?: undefined;
907
+ finalStake?: undefined;
908
+ } | {
909
+ status: string;
910
+ withdrawnAt: {
911
+ var: string;
912
+ };
913
+ finalStake: {
914
+ var: string;
915
+ };
916
+ var?: undefined;
917
+ })[];
918
+ };
919
+ } | {
920
+ from: "SLASHED";
921
+ to: "WITHDRAWN";
922
+ eventName: "withdraw";
923
+ guard: {
924
+ "===": {
925
+ var: string;
926
+ }[];
927
+ ">="?: undefined;
928
+ or?: undefined;
929
+ and?: undefined;
930
+ var?: undefined;
931
+ };
932
+ effect: {
933
+ merge: ({
934
+ var: string;
935
+ status?: undefined;
936
+ withdrawnAt?: undefined;
937
+ finalStake?: undefined;
938
+ } | {
939
+ status: string;
940
+ withdrawnAt: {
941
+ var: string;
942
+ };
943
+ finalStake: {
944
+ var: string;
945
+ };
946
+ var?: undefined;
947
+ })[];
948
+ };
949
+ })[];
950
+ }>;
951
+ readonly universal: () => Promise<{
952
+ metadata: {
953
+ name: string;
954
+ app: string;
955
+ type: string;
956
+ version: string;
957
+ description: string;
555
958
  };
556
- readonly dependencies: readonly [];
557
- }, {
558
- readonly from: "ACTIVE";
559
- readonly to: "ACTIVE";
560
- readonly eventName: "update";
561
- readonly guard: {
562
- readonly "==": readonly [1, 1];
959
+ createSchema: {
960
+ required: readonly ["owner"];
961
+ properties: {
962
+ owner: {
963
+ type: "address";
964
+ description: string;
965
+ immutable: true;
966
+ };
967
+ metadata: {
968
+ type: "object";
969
+ description: string;
970
+ default: {};
971
+ };
972
+ };
563
973
  };
564
- readonly effect: {
565
- readonly merge: readonly [{
566
- readonly var: "state";
567
- }, {
568
- readonly updatedAt: {
569
- readonly var: "$timestamp";
974
+ stateSchema: {
975
+ properties: {
976
+ owner: {
977
+ type: "address";
978
+ immutable: true;
570
979
  };
571
- readonly metadata: {
572
- readonly var: "event.metadata";
980
+ status: {
981
+ type: "string";
982
+ enum: readonly ["CREATED", "ACTIVE", "INACTIVE"];
983
+ computed: true;
573
984
  };
574
- }];
985
+ metadata: {
986
+ type: "object";
987
+ };
988
+ activatedAt: {
989
+ type: "timestamp";
990
+ computed: true;
991
+ };
992
+ updatedAt: {
993
+ type: "timestamp";
994
+ computed: true;
995
+ };
996
+ deactivatedAt: {
997
+ type: "timestamp";
998
+ computed: true;
999
+ };
1000
+ };
575
1001
  };
576
- readonly dependencies: readonly [];
577
- }, {
578
- readonly from: "ACTIVE";
579
- readonly to: "INACTIVE";
580
- readonly eventName: "deactivate";
581
- readonly guard: {
582
- readonly "==": readonly [1, 1];
1002
+ eventSchemas: {
1003
+ activate: {
1004
+ description: string;
1005
+ };
1006
+ update: {
1007
+ description: string;
1008
+ properties: {
1009
+ metadata: {
1010
+ type: "object";
1011
+ };
1012
+ };
1013
+ };
1014
+ deactivate: {
1015
+ description: string;
1016
+ };
583
1017
  };
584
- readonly effect: {
585
- readonly merge: readonly [{
586
- readonly var: "state";
587
- }, {
588
- readonly status: "INACTIVE";
589
- readonly deactivatedAt: {
590
- readonly var: "$timestamp";
591
- };
592
- }];
1018
+ states: {
1019
+ CREATED: {
1020
+ id: string;
1021
+ isFinal: false;
1022
+ };
1023
+ ACTIVE: {
1024
+ id: string;
1025
+ isFinal: false;
1026
+ };
1027
+ INACTIVE: {
1028
+ id: string;
1029
+ isFinal: true;
1030
+ };
593
1031
  };
594
- readonly dependencies: readonly [];
595
- }];
1032
+ initialState: "CREATED";
1033
+ transitions: ({
1034
+ from: "CREATED";
1035
+ to: "ACTIVE";
1036
+ eventName: "activate";
1037
+ guard: {
1038
+ "==": number[];
1039
+ };
1040
+ effect: {
1041
+ merge: ({
1042
+ var: string;
1043
+ status?: undefined;
1044
+ activatedAt?: undefined;
1045
+ } | {
1046
+ status: string;
1047
+ activatedAt: {
1048
+ var: string;
1049
+ };
1050
+ var?: undefined;
1051
+ })[];
1052
+ };
1053
+ } | {
1054
+ from: "ACTIVE";
1055
+ to: "ACTIVE";
1056
+ eventName: "update";
1057
+ guard: {
1058
+ "==": number[];
1059
+ };
1060
+ effect: {
1061
+ merge: ({
1062
+ var: string;
1063
+ updatedAt?: undefined;
1064
+ metadata?: undefined;
1065
+ } | {
1066
+ updatedAt: {
1067
+ var: string;
1068
+ };
1069
+ metadata: {
1070
+ var: string;
1071
+ };
1072
+ var?: undefined;
1073
+ })[];
1074
+ };
1075
+ } | {
1076
+ from: "ACTIVE";
1077
+ to: "INACTIVE";
1078
+ eventName: "deactivate";
1079
+ guard: {
1080
+ "==": number[];
1081
+ };
1082
+ effect: {
1083
+ merge: ({
1084
+ var: string;
1085
+ status?: undefined;
1086
+ deactivatedAt?: undefined;
1087
+ } | {
1088
+ status: string;
1089
+ deactivatedAt: {
1090
+ var: string;
1091
+ };
1092
+ var?: undefined;
1093
+ })[];
1094
+ };
1095
+ })[];
1096
+ }>;
596
1097
  };
1098
+ export type IdentityType = keyof typeof IDENTITY_DEFINITIONS;