@ottochain/sdk 2.2.5 → 2.3.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.
- package/dist/cjs/apps/contracts/state-machines/contract-agreement.js +54 -6
- package/dist/cjs/apps/contracts/state-machines/contract-escrow.js +72 -8
- package/dist/cjs/apps/contracts/state-machines/contract-universal.js +36 -4
- package/dist/cjs/apps/governance/state-machines/dao-multisig.js +27 -3
- package/dist/cjs/apps/governance/state-machines/dao-reputation.js +27 -3
- package/dist/cjs/apps/governance/state-machines/dao-single.js +27 -3
- package/dist/cjs/apps/governance/state-machines/dao-token.js +36 -4
- package/dist/cjs/apps/governance/state-machines/governance-simple.js +36 -4
- package/dist/cjs/apps/governance/state-machines/governance-universal.js +27 -3
- package/dist/cjs/apps/identity/state-machines/identity-agent.js +54 -6
- package/dist/cjs/apps/identity/state-machines/identity-oracle.js +45 -5
- package/dist/cjs/apps/identity/state-machines/identity-universal.js +27 -3
- package/dist/cjs/apps/markets/state-machines/market-auction.js +30 -6
- package/dist/cjs/apps/markets/state-machines/market-crowdfund.js +25 -5
- package/dist/cjs/apps/markets/state-machines/market-group-buy.js +29 -5
- package/dist/cjs/apps/markets/state-machines/market-prediction.js +40 -8
- package/dist/cjs/apps/markets/state-machines/market-universal.js +45 -5
- package/dist/cjs/generated/ottochain/v1/common.js +1722 -1
- package/dist/cjs/generated/ottochain/v1/fiber.js +352 -2
- package/dist/cjs/generated/ottochain/v1/messages.js +775 -3
- package/dist/cjs/generated/ottochain/v1/records.js +350 -3
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/ottochain/genesis-manifest.js +193 -0
- package/dist/cjs/ottochain/index.js +5 -1
- package/dist/cjs/ottochain/types.js +4 -0
- package/dist/esm/apps/contracts/state-machines/contract-agreement.js +54 -6
- package/dist/esm/apps/contracts/state-machines/contract-escrow.js +72 -8
- package/dist/esm/apps/contracts/state-machines/contract-universal.js +36 -4
- package/dist/esm/apps/governance/state-machines/dao-multisig.js +27 -3
- package/dist/esm/apps/governance/state-machines/dao-reputation.js +27 -3
- package/dist/esm/apps/governance/state-machines/dao-single.js +27 -3
- package/dist/esm/apps/governance/state-machines/dao-token.js +36 -4
- package/dist/esm/apps/governance/state-machines/governance-simple.js +36 -4
- package/dist/esm/apps/governance/state-machines/governance-universal.js +27 -3
- package/dist/esm/apps/identity/state-machines/identity-agent.js +54 -6
- package/dist/esm/apps/identity/state-machines/identity-oracle.js +45 -5
- package/dist/esm/apps/identity/state-machines/identity-universal.js +27 -3
- package/dist/esm/apps/markets/state-machines/market-auction.js +30 -6
- package/dist/esm/apps/markets/state-machines/market-crowdfund.js +25 -5
- package/dist/esm/apps/markets/state-machines/market-group-buy.js +29 -5
- package/dist/esm/apps/markets/state-machines/market-prediction.js +40 -8
- package/dist/esm/apps/markets/state-machines/market-universal.js +45 -5
- package/dist/esm/generated/ottochain/v1/common.js +1718 -0
- package/dist/esm/generated/ottochain/v1/fiber.js +351 -1
- package/dist/esm/generated/ottochain/v1/messages.js +774 -2
- package/dist/esm/generated/ottochain/v1/records.js +349 -2
- package/dist/esm/index.js +2 -0
- package/dist/esm/ottochain/genesis-manifest.js +189 -0
- package/dist/esm/ottochain/index.js +2 -0
- package/dist/esm/ottochain/types.js +4 -0
- package/dist/types/apps/contracts/index.d.ts +90 -18
- package/dist/types/apps/contracts/state-machines/contract-agreement.d.ts +30 -6
- package/dist/types/apps/contracts/state-machines/contract-escrow.d.ts +40 -8
- package/dist/types/apps/contracts/state-machines/contract-universal.d.ts +20 -4
- package/dist/types/apps/governance/index.d.ts +114 -33
- package/dist/types/apps/governance/state-machines/dao-multisig.d.ts +15 -3
- package/dist/types/apps/governance/state-machines/dao-reputation.d.ts +15 -3
- package/dist/types/apps/governance/state-machines/dao-single.d.ts +15 -3
- package/dist/types/apps/governance/state-machines/dao-token.d.ts +20 -4
- package/dist/types/apps/governance/state-machines/governance-simple.d.ts +20 -4
- package/dist/types/apps/governance/state-machines/governance-universal.d.ts +15 -3
- package/dist/types/apps/identity/index.d.ts +71 -6
- package/dist/types/apps/identity/state-machines/identity-agent.d.ts +30 -0
- package/dist/types/apps/identity/state-machines/identity-oracle.d.ts +25 -0
- package/dist/types/apps/identity/state-machines/identity-universal.d.ts +15 -0
- package/dist/types/apps/markets/index.d.ts +80 -5
- package/dist/types/apps/markets/state-machines/market-auction.d.ts +12 -0
- package/dist/types/apps/markets/state-machines/market-crowdfund.d.ts +10 -0
- package/dist/types/apps/markets/state-machines/market-group-buy.d.ts +14 -0
- package/dist/types/apps/markets/state-machines/market-prediction.d.ts +16 -0
- package/dist/types/apps/markets/state-machines/market-universal.d.ts +25 -5
- package/dist/types/generated/ottochain/v1/common.d.ts +228 -0
- package/dist/types/generated/ottochain/v1/fiber.d.ts +32 -1
- package/dist/types/generated/ottochain/v1/messages.d.ts +84 -0
- package/dist/types/generated/ottochain/v1/records.d.ts +34 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/ottochain/genesis-manifest.d.ts +130 -0
- package/dist/types/ottochain/index.d.ts +3 -1
- package/dist/types/ottochain/types.d.ts +288 -2
- package/dist/types/schema/fiber-app.d.ts +40 -1
- package/dist/types/validation.d.ts +17 -17
- package/package.json +30 -27
|
@@ -46,6 +46,183 @@ export interface StateMachineDefinition {
|
|
|
46
46
|
transitions: unknown[];
|
|
47
47
|
metadata?: JsonLogicValue;
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Semantic version `MAJOR.MINOR.PATCH`.
|
|
51
|
+
* Wire format: plain string (e.g. "1.0.0"). Also used as a JSON map key.
|
|
52
|
+
*
|
|
53
|
+
* @see modules/models/.../schema/registry/SemVer.scala
|
|
54
|
+
*/
|
|
55
|
+
export type SemVer = string;
|
|
56
|
+
/**
|
|
57
|
+
* Lifecycle status of a registered version (npm/Cargo-style).
|
|
58
|
+
* Wire format: uppercase string (enumeratum `Uppercase`).
|
|
59
|
+
*
|
|
60
|
+
* - `ACTIVE` — selectable + recommended.
|
|
61
|
+
* - `DEPRECATED` — still resolvable/runnable, flagged, discouraged for new instances.
|
|
62
|
+
* - `YANKED` — excluded from NEW resolutions; existing pinned fibers keep running.
|
|
63
|
+
*
|
|
64
|
+
* @see modules/models/.../schema/registry/RegistryStatus.scala
|
|
65
|
+
*/
|
|
66
|
+
export type RegistryStatus = 'ACTIVE' | 'DEPRECATED' | 'YANKED';
|
|
67
|
+
/**
|
|
68
|
+
* A caller's version requirement, resolved against a {@link VersionLineage} (Cargo/npm-style).
|
|
69
|
+
* Wire format: single-key wrapper object (sealed-trait encoding).
|
|
70
|
+
*
|
|
71
|
+
* - `Exact` — exactly this version: `{"Exact":{"version":"1.0.0"}}`.
|
|
72
|
+
* - `Caret` — same MAJOR and `>= v` (`^1.2.0`).
|
|
73
|
+
* - `Tilde` — same MAJOR.MINOR and `>= v` (`~1.2.0`).
|
|
74
|
+
* - `Latest` — highest selectable version: `{"Latest":{}}`.
|
|
75
|
+
* - `PinnedHash` — the exact artifact by schema hash, version-agnostic.
|
|
76
|
+
*
|
|
77
|
+
* @see modules/models/.../schema/registry/VersionReq.scala
|
|
78
|
+
*/
|
|
79
|
+
export type VersionReq = {
|
|
80
|
+
Exact: {
|
|
81
|
+
version: SemVer;
|
|
82
|
+
};
|
|
83
|
+
} | {
|
|
84
|
+
Caret: {
|
|
85
|
+
version: SemVer;
|
|
86
|
+
};
|
|
87
|
+
} | {
|
|
88
|
+
Tilde: {
|
|
89
|
+
version: SemVer;
|
|
90
|
+
};
|
|
91
|
+
} | {
|
|
92
|
+
Latest: Record<string, never>;
|
|
93
|
+
} | {
|
|
94
|
+
PinnedHash: {
|
|
95
|
+
schemaHash: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* A caller's reference to a registered schema/program version, supplied at fiber creation
|
|
100
|
+
* (`CreateStateMachine.schemaRef`). The chain resolves `version` against the registry at create time.
|
|
101
|
+
* Wire format: `{"name":"counter.package","version":{"Exact":{"version":"1.0.0"}}}`.
|
|
102
|
+
*
|
|
103
|
+
* @see modules/models/.../schema/registry/SchemaRef.scala
|
|
104
|
+
*/
|
|
105
|
+
export interface SchemaRef {
|
|
106
|
+
/** Full registry name `labels.tld` (e.g. "counter.package"). */
|
|
107
|
+
name: string;
|
|
108
|
+
version: VersionReq;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* One field of a {@link MessageShape} — mirrors a protobuf `FieldDescriptorProto`
|
|
112
|
+
* at the field level (name + field number + type).
|
|
113
|
+
* Wire format: `repeated`/`optional` default to `false` and are omittable.
|
|
114
|
+
*
|
|
115
|
+
* @see modules/models/.../schema/registry/SchemaShape.scala
|
|
116
|
+
*/
|
|
117
|
+
export interface FieldShape {
|
|
118
|
+
name: string;
|
|
119
|
+
number: number;
|
|
120
|
+
typeName: string;
|
|
121
|
+
repeated?: boolean;
|
|
122
|
+
optional?: boolean;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* A single protobuf message shape: its type name plus its fields.
|
|
126
|
+
*
|
|
127
|
+
* @see modules/models/.../schema/registry/SchemaShape.scala
|
|
128
|
+
*/
|
|
129
|
+
export interface MessageShape {
|
|
130
|
+
typeName: string;
|
|
131
|
+
fields: FieldShape[];
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The on-chain projection of a version's proto schema: the State message plus one
|
|
135
|
+
* message per command/event (keyed by event name). Publisher-claimed and advisory.
|
|
136
|
+
*
|
|
137
|
+
* @see modules/models/.../schema/registry/SchemaShape.scala
|
|
138
|
+
*/
|
|
139
|
+
export interface SchemaShape {
|
|
140
|
+
stateMessage: MessageShape;
|
|
141
|
+
/** One message per command/event, keyed by event name. */
|
|
142
|
+
commands: Record<string, MessageShape>;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* The resolved, pinned binding recorded on a fiber: which registry (name, version) it
|
|
146
|
+
* instantiates, with the committed hashes. Resolved once at create, then immutable.
|
|
147
|
+
*
|
|
148
|
+
* @see modules/models/.../schema/registry/SchemaBinding.scala
|
|
149
|
+
*/
|
|
150
|
+
export interface SchemaBinding {
|
|
151
|
+
/** Full registry name `labels.tld`. */
|
|
152
|
+
name: string;
|
|
153
|
+
version: SemVer;
|
|
154
|
+
/** Commitment to the protobuf FileDescriptorSet (descriptor bytes; off-chain). */
|
|
155
|
+
schemaHash: string;
|
|
156
|
+
/** The verified-binding anchor: `StateMachineDefinition.computeDigest` of the logic. */
|
|
157
|
+
logicHash: string;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* One immutable version of a registry entry. The chain commits only the hashes + the
|
|
161
|
+
* typed {@link SchemaShape} projection (never the descriptor or definition bytes).
|
|
162
|
+
* Wire format: `strict` defaults to `false` and is omittable.
|
|
163
|
+
*
|
|
164
|
+
* @see modules/models/.../schema/registry/RegisteredVersion.scala
|
|
165
|
+
*/
|
|
166
|
+
export interface RegisteredVersion {
|
|
167
|
+
version: SemVer;
|
|
168
|
+
/** Commitment to the protobuf FileDescriptorSet (descriptor bytes; off-chain). */
|
|
169
|
+
schemaHash: string;
|
|
170
|
+
/** The verified-binding anchor: `StateMachineDefinition.computeDigest` of the logic. */
|
|
171
|
+
logicHash: string;
|
|
172
|
+
schemaShape: SchemaShape;
|
|
173
|
+
status: RegistryStatus;
|
|
174
|
+
/** Snapshot ordinal at which this version was registered. */
|
|
175
|
+
registeredAt: number;
|
|
176
|
+
/** Opt-in runtime conformance gate (#33); defaults to `false`. */
|
|
177
|
+
strict?: boolean;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* The append-only, monotonic version lineage of a single registry entry.
|
|
181
|
+
* Wire format: `versions` is a SemVer-string-keyed map of {@link RegisteredVersion}.
|
|
182
|
+
*
|
|
183
|
+
* @see modules/models/.../schema/registry/VersionLineage.scala
|
|
184
|
+
*/
|
|
185
|
+
export interface VersionLineage {
|
|
186
|
+
/** SemVer-string keyed map of registered versions. */
|
|
187
|
+
versions: Record<string, RegisteredVersion>;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* What a registry entry resolves to, discriminated by the name's TLD.
|
|
191
|
+
* Wire format: single-key wrapper object (sealed-trait encoding).
|
|
192
|
+
*
|
|
193
|
+
* - `SchemaPackage` (`.package`) — a versioned schema/program type (its {@link VersionLineage}).
|
|
194
|
+
* Note the double-nesting: `SchemaPackage.versions` is a {@link VersionLineage} whose
|
|
195
|
+
* own `.versions` is the SemVer-keyed map, e.g.
|
|
196
|
+
* `{"SchemaPackage":{"versions":{"versions":{"1.0.0":{...}}}}}`.
|
|
197
|
+
* - `InstanceAlias` (`.machine` / `.script`) — a nickname for an existing fiber (#29).
|
|
198
|
+
*
|
|
199
|
+
* @see modules/models/.../schema/registry/RegistryTarget.scala
|
|
200
|
+
*/
|
|
201
|
+
export type RegistryTarget = {
|
|
202
|
+
SchemaPackage: {
|
|
203
|
+
versions: VersionLineage;
|
|
204
|
+
};
|
|
205
|
+
} | {
|
|
206
|
+
InstanceAlias: {
|
|
207
|
+
fiberId: string;
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* A single owned entry in the registry namespace: a name -> a discriminated
|
|
212
|
+
* {@link RegistryTarget}, with the owning addresses and an optional off-chain metadata grab-bag.
|
|
213
|
+
* Wire format: `metadata` defaults to `{}` and is omittable.
|
|
214
|
+
*
|
|
215
|
+
* @see modules/models/.../schema/registry/RegistryEntry.scala
|
|
216
|
+
*/
|
|
217
|
+
export interface RegistryEntry {
|
|
218
|
+
/** Full registry name `labels.tld`. */
|
|
219
|
+
name: string;
|
|
220
|
+
/** Owning DAG addresses (who may publish versions / change status / transfer). */
|
|
221
|
+
owner: string[];
|
|
222
|
+
target: RegistryTarget;
|
|
223
|
+
/** Optional off-chain links grab-bag (e.g. "repo"/"homepage" -> URL). */
|
|
224
|
+
metadata?: Record<string, string>;
|
|
225
|
+
}
|
|
49
226
|
/**
|
|
50
227
|
* Event emitted by a state machine transition trigger.
|
|
51
228
|
*/
|
|
@@ -84,10 +261,40 @@ export interface OracleInvocation {
|
|
|
84
261
|
invokedAt: number;
|
|
85
262
|
invokedBy: string;
|
|
86
263
|
}
|
|
264
|
+
/**
|
|
265
|
+
* Birth record for a fiber, emitted once at creation. Records the resolved registry
|
|
266
|
+
* binding (name@version + committed hashes) when instantiated from a registered version
|
|
267
|
+
* (#26), or omits it for an ad-hoc fiber. Seeds the audit-trail rendering (#30).
|
|
268
|
+
*
|
|
269
|
+
* @see modules/models/.../schema/fiber/FiberLogEntry.scala
|
|
270
|
+
*/
|
|
271
|
+
export interface CreationReceipt {
|
|
272
|
+
fiberId: string;
|
|
273
|
+
ordinal: number;
|
|
274
|
+
initialState: string;
|
|
275
|
+
owners: string[];
|
|
276
|
+
schemaBinding?: SchemaBinding;
|
|
277
|
+
parentFiberId?: string;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Emitted when a fiber is upgraded to a different registered version (#27). Records the
|
|
281
|
+
* binding change (from -> to) and whether a state migration ran.
|
|
282
|
+
*
|
|
283
|
+
* @see modules/models/.../schema/fiber/FiberLogEntry.scala
|
|
284
|
+
*/
|
|
285
|
+
export interface UpgradeReceipt {
|
|
286
|
+
fiberId: string;
|
|
287
|
+
ordinal: number;
|
|
288
|
+
/** Prior binding; absent for a fiber that had no registry binding before the upgrade. */
|
|
289
|
+
fromBinding?: SchemaBinding;
|
|
290
|
+
toBinding: SchemaBinding;
|
|
291
|
+
gasUsed: number;
|
|
292
|
+
migrated: boolean;
|
|
293
|
+
}
|
|
87
294
|
/**
|
|
88
295
|
* Union type for all fiber log entries.
|
|
89
296
|
*/
|
|
90
|
-
export type FiberLogEntry = EventReceipt | OracleInvocation;
|
|
297
|
+
export type FiberLogEntry = EventReceipt | OracleInvocation | CreationReceipt | UpgradeReceipt;
|
|
91
298
|
/**
|
|
92
299
|
* On-chain record for a state machine fiber.
|
|
93
300
|
* Wire format: all ordinals/states/hashes are plain primitives.
|
|
@@ -107,6 +314,8 @@ export interface StateMachineFiberRecord {
|
|
|
107
314
|
lastReceipt?: EventReceipt;
|
|
108
315
|
parentFiberId?: string;
|
|
109
316
|
childFiberIds: string[];
|
|
317
|
+
/** The resolved, pinned registry binding (#26), present when created from a registered version. */
|
|
318
|
+
schemaBinding?: SchemaBinding;
|
|
110
319
|
}
|
|
111
320
|
/**
|
|
112
321
|
* On-chain record for a script oracle fiber.
|
|
@@ -142,6 +351,8 @@ export interface FiberCommit {
|
|
|
142
351
|
export interface OnChain {
|
|
143
352
|
fiberCommits: Record<string, FiberCommit>;
|
|
144
353
|
latestLogs: Record<string, FiberLogEntry[]>;
|
|
354
|
+
/** Per-registry-entry commitment hash, keyed by full registry name `labels.tld`. */
|
|
355
|
+
registryCommits: Record<string, string>;
|
|
145
356
|
}
|
|
146
357
|
/**
|
|
147
358
|
* Full calculated state (served by ML0 /v1/ endpoints).
|
|
@@ -149,6 +360,10 @@ export interface OnChain {
|
|
|
149
360
|
export interface CalculatedState {
|
|
150
361
|
stateMachines: Record<string, StateMachineFiberRecord>;
|
|
151
362
|
scripts: Record<string, ScriptFiberRecord>;
|
|
363
|
+
/** Registry namespace, keyed by full registry name `labels.tld`. */
|
|
364
|
+
registry: Record<string, RegistryEntry>;
|
|
365
|
+
/** Reverse records (#29): fiber UUID -> its canonical registered name. */
|
|
366
|
+
reverseNames: Record<string, string>;
|
|
152
367
|
}
|
|
153
368
|
/**
|
|
154
369
|
* Create a new state machine fiber.
|
|
@@ -160,6 +375,11 @@ export interface CreateStateMachine {
|
|
|
160
375
|
parentFiberId?: string | null;
|
|
161
376
|
/** Optional set of DAG addresses authorized to sign transitions (multi-party signing). */
|
|
162
377
|
participants?: string[] | null;
|
|
378
|
+
/**
|
|
379
|
+
* Optional reference to a registered schema/program version (#26). When present, the chain
|
|
380
|
+
* resolves it against the registry at create time and records the verified {@link SchemaBinding}.
|
|
381
|
+
*/
|
|
382
|
+
schemaRef?: SchemaRef | null;
|
|
163
383
|
}
|
|
164
384
|
/**
|
|
165
385
|
* Trigger a state machine transition.
|
|
@@ -195,6 +415,64 @@ export interface InvokeScript {
|
|
|
195
415
|
args: JsonLogicValue;
|
|
196
416
|
targetSequenceNumber: number;
|
|
197
417
|
}
|
|
418
|
+
/**
|
|
419
|
+
* Upgrade an existing fiber to a different registered version of the SAME package (#27).
|
|
420
|
+
* The chain verifies `newDefinition` hashes to the target version's `logicHash`, applies the
|
|
421
|
+
* optional `migration` (a JSON-Logic transform of the prior state data), preserves the current
|
|
422
|
+
* state id, and re-pins the binding.
|
|
423
|
+
*/
|
|
424
|
+
export interface UpgradeFiber {
|
|
425
|
+
fiberId: string;
|
|
426
|
+
targetRef: SchemaRef;
|
|
427
|
+
newDefinition: StateMachineDefinition;
|
|
428
|
+
/** Optional JSON-Logic transform applied to the prior state data during upgrade. */
|
|
429
|
+
migration?: JsonLogicExpression;
|
|
430
|
+
targetSequenceNumber: number;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Create-or-append a registry schema-package version (npm-publish semantics): the first publish
|
|
434
|
+
* for a name claims it and makes the signer the owner; later publishes require an existing owner.
|
|
435
|
+
*
|
|
436
|
+
* Note: `fiberId` is NOT on the wire — the chain derives the routing id from `name`.
|
|
437
|
+
*/
|
|
438
|
+
export interface PublishVersion {
|
|
439
|
+
/** Full registry name `labels.tld` (e.g. "order.package"). */
|
|
440
|
+
name: string;
|
|
441
|
+
version: SemVer;
|
|
442
|
+
/** Base64 of the proto FileDescriptorSet; the chain base64-validates + hashes it, then drops the bytes. */
|
|
443
|
+
schemaB64: string;
|
|
444
|
+
/** The typed proto projection the chain stores for discovery (advisory). */
|
|
445
|
+
schemaShape: SchemaShape;
|
|
446
|
+
/** The typed JSON-Logic state machine; hashed into `logicHash` for verified binding (#37). */
|
|
447
|
+
definition: StateMachineDefinition;
|
|
448
|
+
/** Opt-in runtime conformance gate (#33); defaults to `false`, omittable. */
|
|
449
|
+
strict?: boolean;
|
|
450
|
+
/** Optional off-chain links grab-bag set on the entry at first publish; defaults to `{}`, omittable. */
|
|
451
|
+
metadata?: Record<string, string>;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Change a registered version's lifecycle status (Active <-> Deprecated -> Yanked). Owner-gated.
|
|
455
|
+
*/
|
|
456
|
+
export interface SetVersionStatus {
|
|
457
|
+
/** Full registry name `labels.tld`. */
|
|
458
|
+
name: string;
|
|
459
|
+
version: SemVer;
|
|
460
|
+
status: RegistryStatus;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Register a human-readable nickname for an existing fiber (#29). The name's TLD must be
|
|
464
|
+
* `.machine` or `.script` and match the target fiber's kind; the signer must own the target.
|
|
465
|
+
*
|
|
466
|
+
* Note: `fiberId` is NOT on the wire — the chain derives the routing id from `name`.
|
|
467
|
+
*/
|
|
468
|
+
export interface RegisterAlias {
|
|
469
|
+
/** Full registry name `labels.tld` (e.g. "my-escrow.machine"). */
|
|
470
|
+
name: string;
|
|
471
|
+
/** The existing fiber UUID this alias points at. */
|
|
472
|
+
targetFiberId: string;
|
|
473
|
+
/** Optional off-chain links grab-bag; defaults to `{}`, omittable. */
|
|
474
|
+
metadata?: Record<string, string>;
|
|
475
|
+
}
|
|
198
476
|
/**
|
|
199
477
|
* Union type for all ottochain messages.
|
|
200
478
|
* JSON is wrapped as `{ MessageName: { ...fields } }`.
|
|
@@ -205,16 +483,24 @@ export type OttochainMessage = {
|
|
|
205
483
|
TransitionStateMachine: TransitionStateMachine;
|
|
206
484
|
} | {
|
|
207
485
|
ArchiveStateMachine: ArchiveStateMachine;
|
|
486
|
+
} | {
|
|
487
|
+
UpgradeFiber: UpgradeFiber;
|
|
208
488
|
} | {
|
|
209
489
|
CreateScript: CreateScript;
|
|
210
490
|
} | {
|
|
211
491
|
InvokeScript: InvokeScript;
|
|
492
|
+
} | {
|
|
493
|
+
PublishVersion: PublishVersion;
|
|
494
|
+
} | {
|
|
495
|
+
SetVersionStatus: SetVersionStatus;
|
|
496
|
+
} | {
|
|
497
|
+
RegisterAlias: RegisterAlias;
|
|
212
498
|
};
|
|
213
499
|
/**
|
|
214
500
|
* Names of all valid OttochainMessage types.
|
|
215
501
|
* Use this for runtime validation (e.g., in API routes).
|
|
216
502
|
*/
|
|
217
|
-
export declare const OTTOCHAIN_MESSAGE_TYPES: readonly ["CreateStateMachine", "TransitionStateMachine", "ArchiveStateMachine", "CreateScript", "InvokeScript"];
|
|
503
|
+
export declare const OTTOCHAIN_MESSAGE_TYPES: readonly ["CreateStateMachine", "TransitionStateMachine", "ArchiveStateMachine", "UpgradeFiber", "CreateScript", "InvokeScript", "PublishVersion", "SetVersionStatus", "RegisterAlias"];
|
|
218
504
|
/**
|
|
219
505
|
* Type representing valid message type names.
|
|
220
506
|
*/
|
|
@@ -40,11 +40,50 @@ export interface EventSchema {
|
|
|
40
40
|
required?: readonly string[];
|
|
41
41
|
properties?: Record<string, SchemaField>;
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Lifecycle category for a state — a small fixed vocabulary that lets UIs group
|
|
45
|
+
* and color states and lets analytics bucket fibers without app-specific logic.
|
|
46
|
+
*
|
|
47
|
+
* - `initial` — the machine's `initialState` (entry point)
|
|
48
|
+
* - `active` — a normal, operational, non-terminal state
|
|
49
|
+
* - `pending` — a transient state awaiting an action/condition/timeout
|
|
50
|
+
* - `terminal` — a final state (`isFinal: true`); the machine ends here
|
|
51
|
+
*/
|
|
52
|
+
export type StateCategory = 'initial' | 'active' | 'pending' | 'terminal';
|
|
53
|
+
/**
|
|
54
|
+
* Standard per-state metadata convention for OttoChain std apps.
|
|
55
|
+
*
|
|
56
|
+
* This is the minimal, high-value block we attach to every standard state
|
|
57
|
+
* definition (instead of `metadata: null`). It is plain JSON, so it survives
|
|
58
|
+
* the client/server null-dropping canonicalization (only NULL fields are
|
|
59
|
+
* dropped; a populated object is kept and signed/verified identically on both
|
|
60
|
+
* sides). Custom apps may extend `StateDefinition.metadata` with extra keys.
|
|
61
|
+
*
|
|
62
|
+
* Fields:
|
|
63
|
+
* - `label` — short human-readable title for the state (e.g. "Active")
|
|
64
|
+
* - `description` — one-line explanation of what the state means
|
|
65
|
+
* - `category` — optional lifecycle hint (see {@link StateCategory})
|
|
66
|
+
*/
|
|
67
|
+
export interface StdStateMetadata {
|
|
68
|
+
/** Short human-readable title, e.g. "Voting". */
|
|
69
|
+
label: string;
|
|
70
|
+
/** One-line description of what this state represents. */
|
|
71
|
+
description: string;
|
|
72
|
+
/** Optional lifecycle category hint for UIs / analytics. */
|
|
73
|
+
category?: StateCategory;
|
|
74
|
+
}
|
|
43
75
|
export interface StateDefinition {
|
|
44
76
|
id: string;
|
|
45
77
|
isFinal: boolean;
|
|
46
78
|
description?: string;
|
|
47
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Optional per-state metadata. Std apps populate the {@link StdStateMetadata}
|
|
81
|
+
* convention (`label` / `description` / `category`); custom apps may use any
|
|
82
|
+
* JSON object or `null`. NOTE: a `null` here is stripped from the signed wire
|
|
83
|
+
* form (the chain drops null object-fields), so prefer populated metadata or
|
|
84
|
+
* omit the field entirely.
|
|
85
|
+
*/
|
|
86
|
+
metadata?: StdStateMetadata | Record<string, unknown> | null;
|
|
48
87
|
}
|
|
49
88
|
export type JsonLogicRule = Record<string, unknown>;
|
|
50
89
|
export interface EmitSpec {
|
|
@@ -142,11 +142,11 @@ export declare const TransactionReferenceSchema: z.ZodObject<{
|
|
|
142
142
|
ordinal: z.ZodNumber;
|
|
143
143
|
hash: z.ZodString;
|
|
144
144
|
}, "strip", z.ZodTypeAny, {
|
|
145
|
-
ordinal: number;
|
|
146
145
|
hash: string;
|
|
147
|
-
}, {
|
|
148
146
|
ordinal: number;
|
|
147
|
+
}, {
|
|
149
148
|
hash: string;
|
|
149
|
+
ordinal: number;
|
|
150
150
|
}>;
|
|
151
151
|
/**
|
|
152
152
|
* Schema for CurrencyTransactionValue
|
|
@@ -157,13 +157,13 @@ export declare const CurrencyTransactionValueSchema: z.ZodObject<{
|
|
|
157
157
|
amount: z.ZodNumber;
|
|
158
158
|
fee: z.ZodDefault<z.ZodNumber>;
|
|
159
159
|
}, "strip", z.ZodTypeAny, {
|
|
160
|
-
destination: string;
|
|
161
160
|
amount: number;
|
|
161
|
+
destination: string;
|
|
162
162
|
source: string;
|
|
163
163
|
fee: number;
|
|
164
164
|
}, {
|
|
165
|
-
destination: string;
|
|
166
165
|
amount: number;
|
|
166
|
+
destination: string;
|
|
167
167
|
source: string;
|
|
168
168
|
fee?: number | undefined;
|
|
169
169
|
}>;
|
|
@@ -177,13 +177,13 @@ export declare const CurrencyTransactionSchema: z.ZodObject<{
|
|
|
177
177
|
amount: z.ZodNumber;
|
|
178
178
|
fee: z.ZodDefault<z.ZodNumber>;
|
|
179
179
|
}, "strip", z.ZodTypeAny, {
|
|
180
|
-
destination: string;
|
|
181
180
|
amount: number;
|
|
181
|
+
destination: string;
|
|
182
182
|
source: string;
|
|
183
183
|
fee: number;
|
|
184
184
|
}, {
|
|
185
|
-
destination: string;
|
|
186
185
|
amount: number;
|
|
186
|
+
destination: string;
|
|
187
187
|
source: string;
|
|
188
188
|
fee?: number | undefined;
|
|
189
189
|
}>;
|
|
@@ -191,33 +191,33 @@ export declare const CurrencyTransactionSchema: z.ZodObject<{
|
|
|
191
191
|
ordinal: z.ZodNumber;
|
|
192
192
|
hash: z.ZodString;
|
|
193
193
|
}, "strip", z.ZodTypeAny, {
|
|
194
|
-
ordinal: number;
|
|
195
194
|
hash: string;
|
|
196
|
-
}, {
|
|
197
195
|
ordinal: number;
|
|
196
|
+
}, {
|
|
198
197
|
hash: string;
|
|
198
|
+
ordinal: number;
|
|
199
199
|
}>;
|
|
200
200
|
}, "strip", z.ZodTypeAny, {
|
|
201
201
|
value: {
|
|
202
|
-
destination: string;
|
|
203
202
|
amount: number;
|
|
203
|
+
destination: string;
|
|
204
204
|
source: string;
|
|
205
205
|
fee: number;
|
|
206
206
|
};
|
|
207
207
|
parent: {
|
|
208
|
-
ordinal: number;
|
|
209
208
|
hash: string;
|
|
209
|
+
ordinal: number;
|
|
210
210
|
};
|
|
211
211
|
}, {
|
|
212
212
|
value: {
|
|
213
|
-
destination: string;
|
|
214
213
|
amount: number;
|
|
214
|
+
destination: string;
|
|
215
215
|
source: string;
|
|
216
216
|
fee?: number | undefined;
|
|
217
217
|
};
|
|
218
218
|
parent: {
|
|
219
|
-
ordinal: number;
|
|
220
219
|
hash: string;
|
|
220
|
+
ordinal: number;
|
|
221
221
|
};
|
|
222
222
|
}>;
|
|
223
223
|
/**
|
|
@@ -258,9 +258,9 @@ export declare const AgentIdentityRegistrationSchema: z.ZodObject<{
|
|
|
258
258
|
/** Initial reputation (default: 10) */
|
|
259
259
|
reputation: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
260
260
|
}, "strip", z.ZodTypeAny, {
|
|
261
|
+
reputation: number;
|
|
261
262
|
publicKey: string;
|
|
262
263
|
displayName: string;
|
|
263
|
-
reputation: number;
|
|
264
264
|
}, {
|
|
265
265
|
publicKey: string;
|
|
266
266
|
displayName: string;
|
|
@@ -310,15 +310,15 @@ export declare const ProposeContractRequestSchema: z.ZodObject<{
|
|
|
310
310
|
/** Human-readable description */
|
|
311
311
|
description: z.ZodString;
|
|
312
312
|
}, "strip", z.ZodTypeAny, {
|
|
313
|
+
description: string;
|
|
313
314
|
proposer: string;
|
|
314
|
-
counterparty: string;
|
|
315
315
|
terms: Record<string, unknown>;
|
|
316
|
-
|
|
316
|
+
counterparty: string;
|
|
317
317
|
}, {
|
|
318
|
+
description: string;
|
|
318
319
|
proposer: string;
|
|
319
|
-
counterparty: string;
|
|
320
320
|
terms: Record<string, unknown>;
|
|
321
|
-
|
|
321
|
+
counterparty: string;
|
|
322
322
|
}>;
|
|
323
323
|
/**
|
|
324
324
|
* Type for validated ProposeContractRequest
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ottochain/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "TypeScript SDK for ottochain metagraph operations - signing, encoding, and network interactions",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -66,6 +66,24 @@
|
|
|
66
66
|
"dist",
|
|
67
67
|
"README.md"
|
|
68
68
|
],
|
|
69
|
+
"scripts": {
|
|
70
|
+
"build": "npm run prebuild && npm run build:cjs && npm run build:esm && npm run build:types && npm run build:fixup",
|
|
71
|
+
"build:fixup": "echo '{\"type\":\"module\"}' > dist/esm/package.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
|
|
72
|
+
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
73
|
+
"build:esm": "tsc -p tsconfig.esm.json",
|
|
74
|
+
"build:types": "tsc -p tsconfig.types.json",
|
|
75
|
+
"test": "jest",
|
|
76
|
+
"test:coverage": "jest --coverage",
|
|
77
|
+
"lint": "eslint src tests",
|
|
78
|
+
"format": "prettier --write src tests",
|
|
79
|
+
"generate": "buf generate",
|
|
80
|
+
"lint:proto": "buf lint",
|
|
81
|
+
"docs": "typedoc",
|
|
82
|
+
"docs:watch": "typedoc --watch",
|
|
83
|
+
"genesis:manifest": "npm run build && node scripts/emit-genesis-manifest.mjs genesis/std-manifest.json",
|
|
84
|
+
"prepare": "npm run build",
|
|
85
|
+
"prebuild": "node scripts/inline-json.mjs"
|
|
86
|
+
},
|
|
69
87
|
"keywords": [
|
|
70
88
|
"ottochain",
|
|
71
89
|
"constellation",
|
|
@@ -88,31 +106,31 @@
|
|
|
88
106
|
"url": "https://github.com/ottobot-ai/ottochain-sdk/issues"
|
|
89
107
|
},
|
|
90
108
|
"dependencies": {
|
|
91
|
-
"@bufbuild/protobuf": "^2.
|
|
109
|
+
"@bufbuild/protobuf": "^2.12.0",
|
|
92
110
|
"@constellation-network/metagraph-sdk": "^0.2.0",
|
|
93
111
|
"@stardust-collective/dag4": "^2.6.0",
|
|
94
112
|
"@stardust-collective/dag4-keystore": "^2.6.0",
|
|
95
|
-
"canonicalize": "^
|
|
113
|
+
"canonicalize": "^3.0.0",
|
|
96
114
|
"js-sha256": "^0.11.1",
|
|
97
115
|
"js-sha512": "^0.9.0",
|
|
98
116
|
"zod": "^3.22.0"
|
|
99
117
|
},
|
|
100
118
|
"devDependencies": {
|
|
101
119
|
"@babel/preset-env": "^7.29.0",
|
|
102
|
-
"@commitlint/cli": "^20.
|
|
120
|
+
"@commitlint/cli": "^20.5.2",
|
|
103
121
|
"@commitlint/config-conventional": "^20.5.0",
|
|
104
122
|
"@eslint/js": "^9.39.4",
|
|
105
123
|
"@jest/globals": "^30.3.0",
|
|
106
124
|
"@types/jest": "^30.0.0",
|
|
107
|
-
"@types/node": "^25.
|
|
125
|
+
"@types/node": "^25.6.0",
|
|
108
126
|
"@typescript-eslint/eslint-plugin": "^8.56.1",
|
|
109
|
-
"@typescript-eslint/parser": "^8.
|
|
127
|
+
"@typescript-eslint/parser": "^8.59.0",
|
|
110
128
|
"eslint": "^9.39.3",
|
|
111
129
|
"jest": "^30.3.0",
|
|
112
|
-
"prettier": "^3.
|
|
113
|
-
"ts-jest": "
|
|
114
|
-
"ts-proto": "^2.11.
|
|
115
|
-
"typedoc": "^0.28.
|
|
130
|
+
"prettier": "^3.8.3",
|
|
131
|
+
"ts-jest": "29.4.9",
|
|
132
|
+
"ts-proto": "^2.11.6",
|
|
133
|
+
"typedoc": "^0.28.19",
|
|
116
134
|
"typescript": "^5.0.0"
|
|
117
135
|
},
|
|
118
136
|
"peerDependencies": {
|
|
@@ -124,20 +142,5 @@
|
|
|
124
142
|
"publishConfig": {
|
|
125
143
|
"registry": "https://registry.npmjs.org"
|
|
126
144
|
},
|
|
127
|
-
"
|
|
128
|
-
|
|
129
|
-
"build:fixup": "echo '{\"type\":\"module\"}' > dist/esm/package.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
|
|
130
|
-
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
131
|
-
"build:esm": "tsc -p tsconfig.esm.json",
|
|
132
|
-
"build:types": "tsc -p tsconfig.types.json",
|
|
133
|
-
"test": "jest",
|
|
134
|
-
"test:coverage": "jest --coverage",
|
|
135
|
-
"lint": "eslint src tests",
|
|
136
|
-
"format": "prettier --write src tests",
|
|
137
|
-
"generate": "buf generate",
|
|
138
|
-
"lint:proto": "buf lint",
|
|
139
|
-
"docs": "typedoc",
|
|
140
|
-
"docs:watch": "typedoc --watch",
|
|
141
|
-
"prebuild": "node scripts/inline-json.mjs"
|
|
142
|
-
}
|
|
143
|
-
}
|
|
145
|
+
"packageManager": "pnpm@10.30.0"
|
|
146
|
+
}
|