@ottochain/sdk 2.3.0 → 2.4.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/index.js +15 -8
- package/dist/cjs/apps/contracts/state-machines/contract-agreement.js +35 -40
- package/dist/cjs/apps/contracts/state-machines/contract-escrow.js +80 -37
- package/dist/cjs/apps/contracts/state-machines/contract-universal.js +4 -4
- package/dist/cjs/apps/corporate/index.js +2 -2
- package/dist/cjs/apps/corporate/state-machines/corp-board.js +169 -59
- package/dist/cjs/apps/corporate/state-machines/corp-entity.js +245 -47
- package/dist/cjs/apps/corporate/state-machines/corp-securities.js +407 -99
- package/dist/cjs/apps/corporate/state-machines/corp-shareholders.js +151 -37
- package/dist/cjs/apps/governance/index.js +14 -14
- package/dist/cjs/apps/governance/state-machines/dao-multisig.js +58 -40
- package/dist/cjs/apps/governance/state-machines/dao-reputation.js +46 -40
- package/dist/cjs/apps/governance/state-machines/dao-single.js +28 -11
- package/dist/cjs/apps/governance/state-machines/dao-token.js +67 -41
- package/dist/cjs/apps/governance/state-machines/governance-simple.js +93 -61
- package/dist/cjs/apps/governance/state-machines/governance-universal.js +2 -2
- package/dist/cjs/apps/identity/constants.js +55 -14
- package/dist/cjs/apps/identity/index.js +27 -11
- package/dist/cjs/apps/identity/state-machines/identity-agent.js +3 -3
- package/dist/cjs/apps/identity/state-machines/identity-oracle.js +25 -22
- package/dist/cjs/apps/identity/state-machines/identity-registry.js +288 -0
- package/dist/cjs/apps/identity/state-machines/identity-universal.js +3 -3
- package/dist/cjs/apps/identity/state-machines/index.js +3 -1
- package/dist/cjs/apps/index.js +19 -8
- package/dist/cjs/apps/lending/assets.js +223 -0
- package/dist/cjs/apps/lending/credit-scoring.js +87 -0
- package/dist/cjs/apps/lending/eligibility.js +121 -0
- package/dist/cjs/apps/lending/index.js +91 -0
- package/dist/cjs/apps/lending/state-machines/index.js +9 -0
- package/dist/cjs/apps/lending/state-machines/lending-zk-loan.js +412 -0
- package/dist/cjs/apps/markets/index.js +21 -11
- package/dist/cjs/apps/markets/state-machines/market-auction.js +14 -13
- package/dist/cjs/apps/markets/state-machines/market-crowdfund.js +29 -24
- package/dist/cjs/apps/markets/state-machines/market-group-buy.js +24 -26
- package/dist/cjs/apps/markets/state-machines/market-prediction.js +80 -53
- package/dist/cjs/apps/markets/state-machines/market-universal.js +5 -5
- package/dist/cjs/apps/oracles/index.js +2 -2
- package/dist/cjs/errors.js +3 -3
- package/dist/cjs/generated/google/protobuf/struct.js +4 -4
- package/dist/cjs/generated/index.js +11 -7
- package/dist/cjs/generated/openapi.js +6 -0
- package/dist/cjs/generated/ottochain/apps/contracts/v1/contract.js +50 -50
- package/dist/cjs/generated/ottochain/apps/corporate/v1/corporate.js +19 -20
- package/dist/cjs/generated/ottochain/apps/governance/v1/governance.js +13 -13
- package/dist/cjs/generated/ottochain/apps/identity/v1/attestation.js +4 -4
- package/dist/cjs/generated/ottochain/apps/identity/v1/identity.js +124 -130
- package/dist/cjs/generated/ottochain/apps/markets/v1/market.js +107 -107
- package/dist/cjs/generated/ottochain/v1/common.js +4 -4
- package/dist/cjs/generated/ottochain/v1/fiber.js +4 -4
- package/dist/cjs/index.js +41 -7
- package/dist/cjs/openapi.js +2 -0
- package/dist/cjs/ottochain/drop-nulls.js +1 -2
- package/dist/cjs/ottochain/genesis-manifest.js +11 -11
- package/dist/cjs/ottochain/index.js +23 -13
- package/dist/cjs/ottochain/metagraph-client.js +65 -8
- package/dist/cjs/ottochain/snapshot.js +11 -12
- package/dist/cjs/ottochain/transaction.js +57 -14
- package/dist/cjs/ottochain/types.js +16 -2
- package/dist/cjs/privacy/index.js +14 -0
- package/dist/cjs/privacy/sealed-bid.js +210 -0
- package/dist/cjs/privacy/shield-app.js +131 -0
- package/dist/cjs/schema/effects.js +40 -0
- package/dist/cjs/schema/fiber-app.js +19 -13
- package/dist/cjs/schema/guard-lint.js +352 -0
- package/dist/cjs/schema/guards.js +246 -0
- package/dist/cjs/signing.js +80 -0
- package/dist/cjs/types.js +2 -3
- package/dist/cjs/validation.js +8 -8
- package/dist/cjs/verify.js +9 -4
- package/dist/cjs/zk/commit.js +53 -0
- package/dist/cjs/zk/guard.js +107 -0
- package/dist/cjs/zk/index.js +48 -0
- package/dist/cjs/zk/preimage.js +37 -0
- package/dist/cjs/zk/prover.js +87 -0
- package/dist/cjs/zk/registry.js +62 -0
- package/dist/cjs/zk/types.js +28 -0
- package/dist/cjs/zk/witness.js +19 -0
- package/dist/esm/apps/contracts/index.js +7 -3
- package/dist/esm/apps/contracts/state-machines/contract-agreement.js +35 -40
- package/dist/esm/apps/contracts/state-machines/contract-escrow.js +80 -37
- package/dist/esm/apps/contracts/state-machines/contract-universal.js +4 -4
- package/dist/esm/apps/corporate/state-machines/corp-board.js +169 -59
- package/dist/esm/apps/corporate/state-machines/corp-entity.js +245 -47
- package/dist/esm/apps/corporate/state-machines/corp-securities.js +407 -99
- package/dist/esm/apps/corporate/state-machines/corp-shareholders.js +151 -37
- package/dist/esm/apps/governance/state-machines/dao-multisig.js +58 -40
- package/dist/esm/apps/governance/state-machines/dao-reputation.js +46 -40
- package/dist/esm/apps/governance/state-machines/dao-single.js +28 -11
- package/dist/esm/apps/governance/state-machines/dao-token.js +67 -41
- package/dist/esm/apps/governance/state-machines/governance-simple.js +93 -61
- package/dist/esm/apps/governance/state-machines/governance-universal.js +2 -2
- package/dist/esm/apps/identity/constants.js +51 -12
- package/dist/esm/apps/identity/index.js +12 -7
- package/dist/esm/apps/identity/state-machines/identity-agent.js +3 -3
- package/dist/esm/apps/identity/state-machines/identity-oracle.js +25 -22
- package/dist/esm/apps/identity/state-machines/identity-registry.js +285 -0
- package/dist/esm/apps/identity/state-machines/identity-universal.js +3 -3
- package/dist/esm/apps/identity/state-machines/index.js +1 -0
- package/dist/esm/apps/index.js +1 -0
- package/dist/esm/apps/lending/assets.js +207 -0
- package/dist/esm/apps/lending/credit-scoring.js +81 -0
- package/dist/esm/apps/lending/eligibility.js +115 -0
- package/dist/esm/apps/lending/index.js +69 -0
- package/dist/esm/apps/lending/state-machines/index.js +5 -0
- package/dist/esm/apps/lending/state-machines/lending-zk-loan.js +409 -0
- package/dist/esm/apps/markets/index.js +8 -4
- package/dist/esm/apps/markets/state-machines/market-auction.js +14 -13
- package/dist/esm/apps/markets/state-machines/market-crowdfund.js +29 -24
- package/dist/esm/apps/markets/state-machines/market-group-buy.js +24 -26
- package/dist/esm/apps/markets/state-machines/market-prediction.js +80 -53
- package/dist/esm/apps/markets/state-machines/market-universal.js +5 -5
- package/dist/esm/generated/index.js +9 -5
- package/dist/esm/generated/openapi.js +5 -0
- package/dist/esm/generated/ottochain/apps/contracts/v1/contract.js +46 -46
- package/dist/esm/generated/ottochain/apps/identity/v1/identity.js +114 -120
- package/dist/esm/generated/ottochain/apps/markets/v1/market.js +100 -100
- package/dist/esm/index.js +21 -2
- package/dist/esm/openapi.js +1 -0
- package/dist/esm/ottochain/genesis-manifest.js +9 -9
- package/dist/esm/ottochain/index.js +2 -3
- package/dist/esm/ottochain/metagraph-client.js +65 -8
- package/dist/esm/ottochain/snapshot.js +4 -4
- package/dist/esm/ottochain/transaction.js +43 -3
- package/dist/esm/ottochain/types.js +15 -1
- package/dist/esm/privacy/index.js +6 -0
- package/dist/esm/privacy/sealed-bid.js +206 -0
- package/dist/esm/privacy/shield-app.js +127 -0
- package/dist/esm/schema/effects.js +35 -0
- package/dist/esm/schema/fiber-app.js +13 -6
- package/dist/esm/schema/guard-lint.js +346 -0
- package/dist/esm/schema/guards.js +229 -0
- package/dist/esm/signing.js +74 -0
- package/dist/esm/verify.js +8 -2
- package/dist/esm/zk/commit.js +44 -0
- package/dist/esm/zk/guard.js +99 -0
- package/dist/esm/zk/index.js +19 -0
- package/dist/esm/zk/preimage.js +30 -0
- package/dist/esm/zk/prover.js +82 -0
- package/dist/esm/zk/registry.js +55 -0
- package/dist/esm/zk/types.js +25 -0
- package/dist/esm/zk/witness.js +15 -0
- package/dist/types/apps/contracts/index.d.ts +69 -209
- package/dist/types/apps/contracts/state-machines/contract-agreement.d.ts +20 -95
- package/dist/types/apps/contracts/state-machines/contract-escrow.d.ts +46 -112
- package/dist/types/apps/corporate/index.d.ts +1040 -304
- package/dist/types/apps/corporate/state-machines/corp-board.d.ts +188 -52
- package/dist/types/apps/corporate/state-machines/corp-entity.d.ts +267 -62
- package/dist/types/apps/corporate/state-machines/corp-securities.d.ts +355 -131
- package/dist/types/apps/corporate/state-machines/corp-shareholders.d.ts +225 -53
- package/dist/types/apps/governance/index.d.ts +296 -398
- package/dist/types/apps/governance/state-machines/dao-multisig.d.ts +77 -92
- package/dist/types/apps/governance/state-machines/dao-reputation.d.ts +42 -66
- package/dist/types/apps/governance/state-machines/dao-single.d.ts +25 -47
- package/dist/types/apps/governance/state-machines/dao-token.d.ts +60 -49
- package/dist/types/apps/governance/state-machines/governance-simple.d.ts +87 -117
- package/dist/types/apps/governance/state-machines/governance-universal.d.ts +2 -2
- package/dist/types/apps/identity/constants.d.ts +32 -4
- package/dist/types/apps/identity/index.d.ts +378 -94
- package/dist/types/apps/identity/state-machines/identity-oracle.d.ts +16 -87
- package/dist/types/apps/identity/state-machines/identity-registry.d.ts +379 -0
- package/dist/types/apps/identity/state-machines/index.d.ts +1 -0
- package/dist/types/apps/index.d.ts +1 -0
- package/dist/types/apps/lending/assets.d.ts +258 -0
- package/dist/types/apps/lending/credit-scoring.d.ts +80 -0
- package/dist/types/apps/lending/eligibility.d.ts +83 -0
- package/dist/types/apps/lending/index.d.ts +548 -0
- package/dist/types/apps/lending/state-machines/index.d.ts +5 -0
- package/dist/types/apps/lending/state-machines/lending-zk-loan.d.ts +528 -0
- package/dist/types/apps/markets/index.d.ts +108 -203
- package/dist/types/apps/markets/state-machines/market-auction.d.ts +13 -37
- package/dist/types/apps/markets/state-machines/market-crowdfund.d.ts +16 -34
- package/dist/types/apps/markets/state-machines/market-group-buy.d.ts +17 -43
- package/dist/types/apps/markets/state-machines/market-prediction.d.ts +51 -72
- package/dist/types/apps/markets/state-machines/market-universal.d.ts +5 -5
- package/dist/types/generated/index.d.ts +5 -5
- package/dist/types/generated/openapi.d.ts +1257 -0
- package/dist/types/generated/ottochain/apps/contracts/v1/contract.d.ts +5 -5
- package/dist/types/generated/ottochain/apps/identity/v1/identity.d.ts +12 -12
- package/dist/types/generated/ottochain/apps/markets/v1/market.d.ts +11 -11
- package/dist/types/index.d.ts +6 -2
- package/dist/types/openapi.d.ts +22 -0
- package/dist/types/ottochain/genesis-manifest.d.ts +5 -5
- package/dist/types/ottochain/index.d.ts +5 -6
- package/dist/types/ottochain/metagraph-client.d.ts +49 -7
- package/dist/types/ottochain/snapshot.d.ts +6 -6
- package/dist/types/ottochain/transaction.d.ts +33 -1
- package/dist/types/ottochain/types.d.ts +335 -30
- package/dist/types/privacy/index.d.ts +6 -0
- package/dist/types/privacy/sealed-bid.d.ts +348 -0
- package/dist/types/privacy/shield-app.d.ts +48 -0
- package/dist/types/schema/effects.d.ts +34 -0
- package/dist/types/schema/fiber-app.d.ts +1 -2
- package/dist/types/schema/guard-lint.d.ts +111 -0
- package/dist/types/schema/guards.d.ts +134 -0
- package/dist/types/signing.d.ts +45 -0
- package/dist/types/validation.d.ts +22 -217
- package/dist/types/verify.d.ts +4 -0
- package/dist/types/zk/commit.d.ts +28 -0
- package/dist/types/zk/guard.d.ts +46 -0
- package/dist/types/zk/index.d.ts +19 -0
- package/dist/types/zk/preimage.d.ts +10 -0
- package/dist/types/zk/prover.d.ts +34 -0
- package/dist/types/zk/registry.d.ts +34 -0
- package/dist/types/zk/types.d.ts +33 -0
- package/dist/types/zk/witness.d.ts +40 -0
- package/package.json +27 -13
- package/dist/cjs/ottochain/normalize.js +0 -186
- package/dist/esm/ottochain/normalize.js +0 -179
- package/dist/types/ottochain/normalize.d.ts +0 -79
|
@@ -18,11 +18,15 @@ export type JsonLogicValue = unknown;
|
|
|
18
18
|
export type JsonLogicExpression = unknown;
|
|
19
19
|
/**
|
|
20
20
|
* Lifecycle status of a fiber.
|
|
21
|
-
* Wire format:
|
|
21
|
+
* Wire format: UPPERCASE string (chain `FiberStatus` is enumeratum `Uppercase`):
|
|
22
|
+
* `ACTIVE` | `ARCHIVED` | `FAILED`. Used both as the `record.status` value and as
|
|
23
|
+
* the `?status=` query filter on the ML0 fiber endpoints.
|
|
24
|
+
*
|
|
25
|
+
* @see modules/models/.../schema/fiber/FiberStatus.scala
|
|
22
26
|
*/
|
|
23
|
-
export type FiberStatus = '
|
|
27
|
+
export type FiberStatus = 'ACTIVE' | 'ARCHIVED' | 'FAILED';
|
|
24
28
|
/**
|
|
25
|
-
* Access control policy for
|
|
29
|
+
* Access control policy for scripts.
|
|
26
30
|
* Wire format: discriminated union with type key.
|
|
27
31
|
*/
|
|
28
32
|
export type AccessControlPolicy = {
|
|
@@ -110,7 +114,9 @@ export interface SchemaRef {
|
|
|
110
114
|
/**
|
|
111
115
|
* One field of a {@link MessageShape} — mirrors a protobuf `FieldDescriptorProto`
|
|
112
116
|
* at the field level (name + field number + type).
|
|
113
|
-
* Wire format: `repeated`/`optional`
|
|
117
|
+
* Wire format: `repeated`/`optional` are REQUIRED Booleans with NO chain default. The
|
|
118
|
+
* SDK MUST send them — they ride inside the signed `MachineShape`/`ScriptShape` payload,
|
|
119
|
+
* and omitting a no-default field diverges the canonical (decode failure / InvalidSignature).
|
|
114
120
|
*
|
|
115
121
|
* @see modules/models/.../schema/registry/SchemaShape.scala
|
|
116
122
|
*/
|
|
@@ -118,8 +124,8 @@ export interface FieldShape {
|
|
|
118
124
|
name: string;
|
|
119
125
|
number: number;
|
|
120
126
|
typeName: string;
|
|
121
|
-
repeated
|
|
122
|
-
optional
|
|
127
|
+
repeated: boolean;
|
|
128
|
+
optional: boolean;
|
|
123
129
|
}
|
|
124
130
|
/**
|
|
125
131
|
* A single protobuf message shape: its type name plus its fields.
|
|
@@ -131,16 +137,45 @@ export interface MessageShape {
|
|
|
131
137
|
fields: FieldShape[];
|
|
132
138
|
}
|
|
133
139
|
/**
|
|
134
|
-
* The on-chain projection of a version's proto schema: the State message
|
|
135
|
-
* message per command/event (keyed by event name). Publisher-claimed and advisory.
|
|
140
|
+
* The on-chain projection of a STATE-MACHINE version's proto schema: the State message
|
|
141
|
+
* plus one message per command/event (keyed by event name). Publisher-claimed and advisory.
|
|
142
|
+
* (Chain `MachineShape`; supersedes the old loose `SchemaShape`.)
|
|
136
143
|
*
|
|
137
144
|
* @see modules/models/.../schema/registry/SchemaShape.scala
|
|
138
145
|
*/
|
|
139
|
-
export interface
|
|
146
|
+
export interface MachineShape {
|
|
140
147
|
stateMessage: MessageShape;
|
|
141
148
|
/** One message per command/event, keyed by event name. */
|
|
142
149
|
commands: Record<string, MessageShape>;
|
|
143
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* The on-chain projection of a SCRIPT version's surface. Chain `ScriptShape` is a sealed
|
|
153
|
+
* ADT with one variant today, `MethodDispatch`, encoded directly as `{ methods: {...} }`
|
|
154
|
+
* (the `methods` key discriminates from future variants).
|
|
155
|
+
*
|
|
156
|
+
* @see modules/models/.../schema/registry/SchemaShape.scala
|
|
157
|
+
*/
|
|
158
|
+
export interface ScriptShape {
|
|
159
|
+
/** One {@link MessageShape} per callable method, keyed by method name. */
|
|
160
|
+
methods: Record<string, MessageShape>;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* The advisory schema projection stored in a {@link RegisteredVersion}, discriminated by
|
|
164
|
+
* inner field names (no explicit tag): `machineShape` (state-machine package), `scriptShape`
|
|
165
|
+
* (script package), or the AssetPolicy fields (`behavior`/`supply`/`morphisms`/`stateShape`).
|
|
166
|
+
*
|
|
167
|
+
* @see modules/models/.../schema/registry/SchemaShape.scala (RegistryShape ADT)
|
|
168
|
+
*/
|
|
169
|
+
export type RegistryShape = {
|
|
170
|
+
machineShape: MachineShape;
|
|
171
|
+
} | {
|
|
172
|
+
scriptShape: ScriptShape;
|
|
173
|
+
} | {
|
|
174
|
+
behavior: TokenBehavior;
|
|
175
|
+
supply: SupplyPolicy;
|
|
176
|
+
morphisms: Record<string, MorphismSpec>;
|
|
177
|
+
stateShape: MessageShape;
|
|
178
|
+
};
|
|
144
179
|
/**
|
|
145
180
|
* The resolved, pinned binding recorded on a fiber: which registry (name, version) it
|
|
146
181
|
* instantiates, with the committed hashes. Resolved once at create, then immutable.
|
|
@@ -158,8 +193,9 @@ export interface SchemaBinding {
|
|
|
158
193
|
}
|
|
159
194
|
/**
|
|
160
195
|
* One immutable version of a registry entry. The chain commits only the hashes + the
|
|
161
|
-
* typed {@link
|
|
162
|
-
* Wire format: `strict`
|
|
196
|
+
* typed {@link RegistryShape} projection (never the descriptor or definition bytes).
|
|
197
|
+
* Wire format: `strict` is a REQUIRED Boolean (the chain has no default — read responses
|
|
198
|
+
* always carry it, and signed publish messages MUST send it).
|
|
163
199
|
*
|
|
164
200
|
* @see modules/models/.../schema/registry/RegisteredVersion.scala
|
|
165
201
|
*/
|
|
@@ -169,12 +205,13 @@ export interface RegisteredVersion {
|
|
|
169
205
|
schemaHash: string;
|
|
170
206
|
/** The verified-binding anchor: `StateMachineDefinition.computeDigest` of the logic. */
|
|
171
207
|
logicHash: string;
|
|
172
|
-
|
|
208
|
+
/** The kind-correct advisory projection (Machine | Script | AssetPolicy). */
|
|
209
|
+
shape: RegistryShape;
|
|
173
210
|
status: RegistryStatus;
|
|
174
211
|
/** Snapshot ordinal at which this version was registered. */
|
|
175
212
|
registeredAt: number;
|
|
176
|
-
/** Opt-in runtime conformance gate (#33)
|
|
177
|
-
strict
|
|
213
|
+
/** Opt-in runtime conformance gate (#33). Required on the wire. */
|
|
214
|
+
strict: boolean;
|
|
178
215
|
}
|
|
179
216
|
/**
|
|
180
217
|
* The append-only, monotonic version lineage of a single registry entry.
|
|
@@ -206,6 +243,10 @@ export type RegistryTarget = {
|
|
|
206
243
|
InstanceAlias: {
|
|
207
244
|
fiberId: string;
|
|
208
245
|
};
|
|
246
|
+
} | {
|
|
247
|
+
AssetPolicyPackage: {
|
|
248
|
+
versions: VersionLineage;
|
|
249
|
+
};
|
|
209
250
|
};
|
|
210
251
|
/**
|
|
211
252
|
* A single owned entry in the registry namespace: a name -> a discriminated
|
|
@@ -250,9 +291,9 @@ export interface EventReceipt {
|
|
|
250
291
|
emittedEvents: EmittedEvent[];
|
|
251
292
|
}
|
|
252
293
|
/**
|
|
253
|
-
* Log entry for a script
|
|
294
|
+
* Log entry for a script invocation.
|
|
254
295
|
*/
|
|
255
|
-
export interface
|
|
296
|
+
export interface ScriptInvocation {
|
|
256
297
|
fiberId: string;
|
|
257
298
|
method: string;
|
|
258
299
|
args: JsonLogicValue;
|
|
@@ -291,10 +332,26 @@ export interface UpgradeReceipt {
|
|
|
291
332
|
gasUsed: number;
|
|
292
333
|
migrated: boolean;
|
|
293
334
|
}
|
|
335
|
+
/**
|
|
336
|
+
* Emitted when an update that reached `combine` is rejected by a deterministic business rule
|
|
337
|
+
* (unauthorized, non-monotonic, sequence-number mismatch, conformance violation, reserved label).
|
|
338
|
+
* The update does NOT mutate state — this is the on-chain, auditable record that it was processed
|
|
339
|
+
* and rejected, and the ONLY signal distinguishing "submitted-but-rejected" from "not-yet-processed".
|
|
340
|
+
* `fiberId` is the update's routing id (target fiber, or the registry routing id for registry ops).
|
|
341
|
+
*
|
|
342
|
+
* @see modules/models/.../schema/fiber/FiberLogEntry.scala
|
|
343
|
+
*/
|
|
344
|
+
export interface RejectionReceipt {
|
|
345
|
+
fiberId: string;
|
|
346
|
+
ordinal: number;
|
|
347
|
+
/** The rejected update's message name (e.g. "TransitionStateMachine"). */
|
|
348
|
+
updateType: string;
|
|
349
|
+
reason: string;
|
|
350
|
+
}
|
|
294
351
|
/**
|
|
295
352
|
* Union type for all fiber log entries.
|
|
296
353
|
*/
|
|
297
|
-
export type FiberLogEntry = EventReceipt |
|
|
354
|
+
export type FiberLogEntry = EventReceipt | ScriptInvocation | CreationReceipt | UpgradeReceipt | RejectionReceipt;
|
|
298
355
|
/**
|
|
299
356
|
* On-chain record for a state machine fiber.
|
|
300
357
|
* Wire format: all ordinals/states/hashes are plain primitives.
|
|
@@ -316,9 +373,11 @@ export interface StateMachineFiberRecord {
|
|
|
316
373
|
childFiberIds: string[];
|
|
317
374
|
/** The resolved, pinned registry binding (#26), present when created from a registered version. */
|
|
318
375
|
schemaBinding?: SchemaBinding;
|
|
376
|
+
/** DAG addresses authorized to sign transitions (multi-party); seeded from `CreateStateMachine.participants`. */
|
|
377
|
+
authorizedSigners?: string[];
|
|
319
378
|
}
|
|
320
379
|
/**
|
|
321
|
-
* On-chain record for a script
|
|
380
|
+
* On-chain record for a script fiber.
|
|
322
381
|
*/
|
|
323
382
|
export interface ScriptFiberRecord {
|
|
324
383
|
fiberId: string;
|
|
@@ -331,7 +390,9 @@ export interface ScriptFiberRecord {
|
|
|
331
390
|
sequenceNumber: number;
|
|
332
391
|
owners: string[];
|
|
333
392
|
status: FiberStatus;
|
|
334
|
-
lastInvocation?:
|
|
393
|
+
lastInvocation?: ScriptInvocation;
|
|
394
|
+
/** The resolved, pinned registry binding, present when created from a registered version. */
|
|
395
|
+
schemaBinding?: SchemaBinding;
|
|
335
396
|
}
|
|
336
397
|
/**
|
|
337
398
|
* Union type for all fiber records.
|
|
@@ -353,6 +414,8 @@ export interface OnChain {
|
|
|
353
414
|
latestLogs: Record<string, FiberLogEntry[]>;
|
|
354
415
|
/** Per-registry-entry commitment hash, keyed by full registry name `labels.tld`. */
|
|
355
416
|
registryCommits: Record<string, string>;
|
|
417
|
+
/** Per-asset L1 fast-path commit (behavior bits + sequence), keyed by asset UUID. */
|
|
418
|
+
assetCommits: Record<string, AssetCommit>;
|
|
356
419
|
}
|
|
357
420
|
/**
|
|
358
421
|
* Full calculated state (served by ML0 /v1/ endpoints).
|
|
@@ -364,6 +427,10 @@ export interface CalculatedState {
|
|
|
364
427
|
registry: Record<string, RegistryEntry>;
|
|
365
428
|
/** Reverse records (#29): fiber UUID -> its canonical registered name. */
|
|
366
429
|
reverseNames: Record<string, string>;
|
|
430
|
+
/** Asset instances (asset-model §5b): asset UUID -> AssetRecord (a dedicated record, not a fiber). */
|
|
431
|
+
assets: Record<string, AssetRecord>;
|
|
432
|
+
/** Used commit-reveal nonces per asset UUID; bounded (pruned past expiresAt in combine). */
|
|
433
|
+
usedNonces: Record<string, number[]>;
|
|
367
434
|
}
|
|
368
435
|
/**
|
|
369
436
|
* Create a new state machine fiber.
|
|
@@ -398,7 +465,7 @@ export interface ArchiveStateMachine {
|
|
|
398
465
|
targetSequenceNumber: number;
|
|
399
466
|
}
|
|
400
467
|
/**
|
|
401
|
-
* Create a new script
|
|
468
|
+
* Create a new script fiber.
|
|
402
469
|
*/
|
|
403
470
|
export interface CreateScript {
|
|
404
471
|
fiberId: string;
|
|
@@ -407,7 +474,7 @@ export interface CreateScript {
|
|
|
407
474
|
accessControl: AccessControlPolicy;
|
|
408
475
|
}
|
|
409
476
|
/**
|
|
410
|
-
* Invoke a script
|
|
477
|
+
* Invoke a script method.
|
|
411
478
|
*/
|
|
412
479
|
export interface InvokeScript {
|
|
413
480
|
fiberId: string;
|
|
@@ -415,6 +482,19 @@ export interface InvokeScript {
|
|
|
415
482
|
args: JsonLogicValue;
|
|
416
483
|
targetSequenceNumber: number;
|
|
417
484
|
}
|
|
485
|
+
/**
|
|
486
|
+
* Upgrade an existing script fiber to a different registered version of the SAME package.
|
|
487
|
+
* The chain verifies `newProgram` hashes to the target version's `logicHash`, applies the
|
|
488
|
+
* optional `migration` (a JSON-Logic transform of the prior state data), and re-pins the binding.
|
|
489
|
+
*/
|
|
490
|
+
export interface UpgradeScript {
|
|
491
|
+
fiberId: string;
|
|
492
|
+
targetRef: SchemaRef;
|
|
493
|
+
newProgram: JsonLogicExpression;
|
|
494
|
+
/** Optional JSON-Logic transform applied to the prior state data during upgrade. */
|
|
495
|
+
migration?: JsonLogicExpression;
|
|
496
|
+
targetSequenceNumber: number;
|
|
497
|
+
}
|
|
418
498
|
/**
|
|
419
499
|
* Upgrade an existing fiber to a different registered version of the SAME package (#27).
|
|
420
500
|
* The chain verifies `newDefinition` hashes to the target version's `logicHash`, applies the
|
|
@@ -430,24 +510,47 @@ export interface UpgradeFiber {
|
|
|
430
510
|
targetSequenceNumber: number;
|
|
431
511
|
}
|
|
432
512
|
/**
|
|
433
|
-
* Create-or-append a registry
|
|
434
|
-
* for a name claims it and makes the signer the owner; later publishes require an
|
|
513
|
+
* Create-or-append a registry version for a STATE-MACHINE package (npm-publish semantics): the
|
|
514
|
+
* first publish for a name claims it and makes the signer the owner; later publishes require an
|
|
515
|
+
* existing owner. The chain split the old `PublishVersion` into machine/script variants — this is
|
|
516
|
+
* the machine half.
|
|
435
517
|
*
|
|
436
518
|
* Note: `fiberId` is NOT on the wire — the chain derives the routing id from `name`.
|
|
437
519
|
*/
|
|
438
|
-
export interface
|
|
520
|
+
export interface PublishMachineVersion {
|
|
439
521
|
/** Full registry name `labels.tld` (e.g. "order.package"). */
|
|
440
522
|
name: string;
|
|
441
523
|
version: SemVer;
|
|
442
524
|
/** Base64 of the proto FileDescriptorSet; the chain base64-validates + hashes it, then drops the bytes. */
|
|
443
525
|
schemaB64: string;
|
|
444
526
|
/** The typed proto projection the chain stores for discovery (advisory). */
|
|
445
|
-
|
|
527
|
+
machineShape: MachineShape;
|
|
446
528
|
/** The typed JSON-Logic state machine; hashed into `logicHash` for verified binding (#37). */
|
|
447
529
|
definition: StateMachineDefinition;
|
|
448
|
-
/** Opt-in runtime conformance gate (#33);
|
|
449
|
-
strict
|
|
450
|
-
/** Optional off-chain links grab-bag set on the entry at first publish;
|
|
530
|
+
/** Opt-in runtime conformance gate (#33). REQUIRED — the chain has no default; omitting it diverges the signed canonical. */
|
|
531
|
+
strict: boolean;
|
|
532
|
+
/** Optional off-chain links grab-bag set on the entry at first publish; omittable (`None`). */
|
|
533
|
+
metadata?: Record<string, string>;
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Create-or-append a registry version for a SCRIPT package — parallel to {@link PublishMachineVersion}
|
|
537
|
+
* but carrying a `scriptProgram` (JSON-Logic) instead of a state-machine `definition`.
|
|
538
|
+
*
|
|
539
|
+
* Note: `fiberId` is NOT on the wire — the chain derives the routing id from `name`.
|
|
540
|
+
*/
|
|
541
|
+
export interface PublishScriptVersion {
|
|
542
|
+
/** Full registry name `labels.tld`. */
|
|
543
|
+
name: string;
|
|
544
|
+
version: SemVer;
|
|
545
|
+
/** Base64 of the proto FileDescriptorSet; the chain base64-validates + hashes it, then drops the bytes. */
|
|
546
|
+
schemaB64: string;
|
|
547
|
+
/** The typed method-surface projection the chain stores for discovery (advisory). */
|
|
548
|
+
scriptShape: ScriptShape;
|
|
549
|
+
/** The typed JSON-Logic script; hashed into `logicHash` for verified binding (#37). */
|
|
550
|
+
scriptProgram: JsonLogicExpression;
|
|
551
|
+
/** Opt-in runtime conformance gate (#33). REQUIRED — omitting it diverges the signed canonical. */
|
|
552
|
+
strict: boolean;
|
|
553
|
+
/** Optional off-chain links grab-bag; omittable (`None`). */
|
|
451
554
|
metadata?: Record<string, string>;
|
|
452
555
|
}
|
|
453
556
|
/**
|
|
@@ -473,6 +576,196 @@ export interface RegisterAlias {
|
|
|
473
576
|
/** Optional off-chain links grab-bag; defaults to `{}`, omittable. */
|
|
474
577
|
metadata?: Record<string, string>;
|
|
475
578
|
}
|
|
579
|
+
/**
|
|
580
|
+
* Typed asset morphism verb. Wire form: the UPPERCASE entry name (also used as a `morphisms` map key).
|
|
581
|
+
* @see modules/models/.../schema/asset/MorphismKind.scala
|
|
582
|
+
*/
|
|
583
|
+
export type MorphismKind = 'TRANSFER' | 'BURN' | 'FRACTIONALIZE' | 'COMPOSE' | 'DECOMPOSE' | 'POOL' | 'WRAP' | 'STAKE';
|
|
584
|
+
/**
|
|
585
|
+
* Access-control level of one morphism on an asset policy. Wire form: UPPERCASE entry name.
|
|
586
|
+
* @see modules/models/.../schema/asset/MorphismVisibility.scala
|
|
587
|
+
*/
|
|
588
|
+
export type MorphismVisibility = 'PUBLIC' | 'GOVERNED' | 'DISABLED';
|
|
589
|
+
/**
|
|
590
|
+
* A token's 5-bit behavioral capability surface, packed into a single Int (the wire form):
|
|
591
|
+
* `T=16` transferable, `S=8` splittable, `C=4` combinable, `E=2` expirable, `G=1` governable
|
|
592
|
+
* (e.g. NFT=16, Fungible=28, FullFeatured=31). Matches `AssetCommit.behavior`.
|
|
593
|
+
* @see modules/models/.../schema/asset/TokenBehavior.scala
|
|
594
|
+
*/
|
|
595
|
+
export type TokenBehavior = number;
|
|
596
|
+
/** Bit weights for {@link TokenBehavior} (T=16, S=8, C=4, E=2, G=1). */
|
|
597
|
+
export declare const TOKEN_BEHAVIOR_BITS: {
|
|
598
|
+
readonly transferable: 16;
|
|
599
|
+
readonly splittable: 8;
|
|
600
|
+
readonly combinable: 4;
|
|
601
|
+
readonly expirable: 2;
|
|
602
|
+
readonly governable: 1;
|
|
603
|
+
};
|
|
604
|
+
/**
|
|
605
|
+
* Supply authority for an asset policy version (orthogonal to instance {@link TokenBehavior}).
|
|
606
|
+
* All fields omittable (`None`).
|
|
607
|
+
* @see modules/models/.../schema/asset/SupplyPolicy.scala
|
|
608
|
+
*/
|
|
609
|
+
export interface SupplyPolicy {
|
|
610
|
+
/** Hard cap on derived total supply; omit = uncapped. */
|
|
611
|
+
maxSupply?: number;
|
|
612
|
+
/** JSON-Logic predicate gating new supply; omit = minting closed after genesis. */
|
|
613
|
+
mintPolicy?: JsonLogicExpression;
|
|
614
|
+
/** JSON-Logic predicate gating destruction; omit = no burning. */
|
|
615
|
+
burnPolicy?: JsonLogicExpression;
|
|
616
|
+
/** Fractional precision for splittable fungibles; omit/0 for NFTs. */
|
|
617
|
+
decimals?: number;
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* Per-morphism policy spec, layered on the morphism's fixed structural domain guard.
|
|
621
|
+
* `visibility` is REQUIRED; the allowlist/guard refinements are omittable.
|
|
622
|
+
* @see modules/models/.../schema/asset/MorphismSpec.scala
|
|
623
|
+
*/
|
|
624
|
+
export interface MorphismSpec {
|
|
625
|
+
visibility: MorphismVisibility;
|
|
626
|
+
/** Counter-party policy allowlist (registry names); omit = any. */
|
|
627
|
+
allowedPolicies?: string[];
|
|
628
|
+
/** Counter-party behavior-bitmask allowlist (packed {@link TokenBehavior} ints); omit = any. */
|
|
629
|
+
allowedTypes?: number[];
|
|
630
|
+
/** Optional extra JSON-Logic predicate — the `witness`-gated guard lives here. */
|
|
631
|
+
guard?: JsonLogicExpression;
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* Who holds an asset instance: an ordinary wallet, or a live fiber (escrow / pool / vault).
|
|
635
|
+
* Wire form: single-key variant `{"Wallet":{"address":..}}` / `{"Fiber":{"fiberId":..}}`.
|
|
636
|
+
* @see modules/models/.../schema/asset/AssetHolder.scala
|
|
637
|
+
*/
|
|
638
|
+
export type AssetHolder = {
|
|
639
|
+
Wallet: {
|
|
640
|
+
address: string;
|
|
641
|
+
};
|
|
642
|
+
} | {
|
|
643
|
+
Fiber: {
|
|
644
|
+
fiberId: string;
|
|
645
|
+
};
|
|
646
|
+
};
|
|
647
|
+
/**
|
|
648
|
+
* Cross-chain provenance for a bridged-in (wrapped) asset (the IBC denom-trace analogue).
|
|
649
|
+
* @see modules/models/.../schema/asset/OriginProvenance.scala
|
|
650
|
+
*/
|
|
651
|
+
export interface OriginProvenance {
|
|
652
|
+
originChainId: string;
|
|
653
|
+
originAssetRef: string;
|
|
654
|
+
fullPath: string[];
|
|
655
|
+
attestationHash: string;
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* The committed snapshot of ONE component consumed into a composite at `Compose` — the reveal
|
|
659
|
+
* witness that makes `Decompose` a faithful retraction (rides `ApplyMorphism.priorComponents`).
|
|
660
|
+
* @see modules/models/.../schema/asset/ComponentWitness.scala
|
|
661
|
+
*/
|
|
662
|
+
export interface ComponentWitness {
|
|
663
|
+
assetId: string;
|
|
664
|
+
schemaBinding: SchemaBinding;
|
|
665
|
+
behavior: TokenBehavior;
|
|
666
|
+
holder: AssetHolder;
|
|
667
|
+
amount: number;
|
|
668
|
+
expiresAt?: number;
|
|
669
|
+
componentFiberIds?: string[];
|
|
670
|
+
componentsCommitment?: string;
|
|
671
|
+
provenance?: OriginProvenance;
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* An asset INSTANCE record (NOT a fiber). Lives in {@link CalculatedState} `assets`; its behavior
|
|
675
|
+
* lives in the bound policy version, pinned via {@link SchemaBinding}.
|
|
676
|
+
* @see modules/models/.../schema/Records.scala (AssetRecord)
|
|
677
|
+
*/
|
|
678
|
+
export interface AssetRecord {
|
|
679
|
+
assetId: string;
|
|
680
|
+
schemaBinding: SchemaBinding;
|
|
681
|
+
behavior: TokenBehavior;
|
|
682
|
+
holder: AssetHolder;
|
|
683
|
+
amount: number;
|
|
684
|
+
sequenceNumber: number;
|
|
685
|
+
creationOrdinal: number;
|
|
686
|
+
latestUpdateOrdinal: number;
|
|
687
|
+
expiresAt?: number;
|
|
688
|
+
/** Present iff this is a composite (stored verbatim for retraction). */
|
|
689
|
+
componentFiberIds?: string[];
|
|
690
|
+
/** Digest of the canonical component-witness list; present iff composite. */
|
|
691
|
+
componentsCommitment?: string;
|
|
692
|
+
/** Set on a component folded into a composite. */
|
|
693
|
+
parentCompositeId?: string;
|
|
694
|
+
provenance?: OriginProvenance;
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* The on-chain L1 fast-path commit for an asset instance — a safe subset (packed behavior bits +
|
|
698
|
+
* sequence) so L1 can structurally reject impossible morphisms without a `CalculatedState`
|
|
699
|
+
* round-trip. `behavior` is advisory/stale; the combiner re-derives from `CalculatedState.assets`.
|
|
700
|
+
* @see modules/models/.../schema/OnChain.scala (AssetCommit)
|
|
701
|
+
*/
|
|
702
|
+
export interface AssetCommit {
|
|
703
|
+
/** Packed {@link TokenBehavior} bits (advisory). */
|
|
704
|
+
behavior: TokenBehavior;
|
|
705
|
+
sequenceNumber: number;
|
|
706
|
+
recordHash: string;
|
|
707
|
+
/** Phase-6 interop double-wrap fast-reject discriminator. */
|
|
708
|
+
origin?: string;
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* Publish an asset-policy PACKAGE version (npm-publish semantics, parallel to {@link PublishMachineVersion}).
|
|
712
|
+
* `morphisms` is REQUIRED (presence required; emptiness is meaningful, never decoder-defaulted).
|
|
713
|
+
* Note: `fiberId` is NOT on the wire — the chain derives the routing id from `name`.
|
|
714
|
+
*/
|
|
715
|
+
export interface CreateAssetPolicy {
|
|
716
|
+
name: string;
|
|
717
|
+
version: SemVer;
|
|
718
|
+
behavior: TokenBehavior;
|
|
719
|
+
supply: SupplyPolicy;
|
|
720
|
+
/** Per-kind morphism specs, keyed by the UPPERCASE {@link MorphismKind}. Required (may be empty). */
|
|
721
|
+
morphisms: Record<string, MorphismSpec>;
|
|
722
|
+
stateShape: MessageShape;
|
|
723
|
+
metadata?: Record<string, string>;
|
|
724
|
+
}
|
|
725
|
+
/** Mint a new asset INSTANCE against a resolved policy version. */
|
|
726
|
+
export interface MintAsset {
|
|
727
|
+
assetId: string;
|
|
728
|
+
policyRef: SchemaRef;
|
|
729
|
+
holder: AssetHolder;
|
|
730
|
+
amount: number;
|
|
731
|
+
expiresAt?: number;
|
|
732
|
+
provenance?: OriginProvenance;
|
|
733
|
+
/**
|
|
734
|
+
* ZkVerify-gated mint: optional proof / Merkle-membership witness the policy's `mintPolicy` guard
|
|
735
|
+
* reads under the reserved `witness` context key (e.g. `groth16_verify` / `pmt_verify`).
|
|
736
|
+
*/
|
|
737
|
+
witness?: JsonLogicValue;
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Apply a typed morphism to an asset instance. Sequenced by `(assetId, targetSequenceNumber)`.
|
|
741
|
+
* Optional fields carry per-kind directives (recipient for Transfer/Wrap; otherAssetIds + compositeId
|
|
742
|
+
* for Compose; shardIds for Fractionalize; nonce for a commit-reveal symmetric Compose;
|
|
743
|
+
* priorComponents is the Decompose reveal witness).
|
|
744
|
+
*/
|
|
745
|
+
export interface ApplyMorphism {
|
|
746
|
+
assetId: string;
|
|
747
|
+
kind: MorphismKind;
|
|
748
|
+
targetSequenceNumber: number;
|
|
749
|
+
recipient?: AssetHolder;
|
|
750
|
+
otherAssetIds?: string[];
|
|
751
|
+
compositeId?: string;
|
|
752
|
+
shardIds?: string[];
|
|
753
|
+
nonce?: number;
|
|
754
|
+
priorComponents?: ComponentWitness[];
|
|
755
|
+
/** ZkVerify-gated morphism: optional witness a `Governed` morphism's guard reads (see {@link MorphismSpec}). */
|
|
756
|
+
witness?: JsonLogicValue;
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* Authorize a counter-party policy to Compose with this asset (the commit half of the commit-reveal
|
|
760
|
+
* symmetric-compose handshake). `nonce` and `expiresAt` are REQUIRED (no sentinel defaults).
|
|
761
|
+
*/
|
|
762
|
+
export interface AuthorizeCompose {
|
|
763
|
+
assetId: string;
|
|
764
|
+
partnerPolicyId: string;
|
|
765
|
+
nonce: number;
|
|
766
|
+
expiresAt: number;
|
|
767
|
+
targetSequenceNumber: number;
|
|
768
|
+
}
|
|
476
769
|
/**
|
|
477
770
|
* Union type for all ottochain messages.
|
|
478
771
|
* JSON is wrapped as `{ MessageName: { ...fields } }`.
|
|
@@ -490,17 +783,29 @@ export type OttochainMessage = {
|
|
|
490
783
|
} | {
|
|
491
784
|
InvokeScript: InvokeScript;
|
|
492
785
|
} | {
|
|
493
|
-
|
|
786
|
+
UpgradeScript: UpgradeScript;
|
|
787
|
+
} | {
|
|
788
|
+
PublishMachineVersion: PublishMachineVersion;
|
|
789
|
+
} | {
|
|
790
|
+
PublishScriptVersion: PublishScriptVersion;
|
|
494
791
|
} | {
|
|
495
792
|
SetVersionStatus: SetVersionStatus;
|
|
496
793
|
} | {
|
|
497
794
|
RegisterAlias: RegisterAlias;
|
|
795
|
+
} | {
|
|
796
|
+
CreateAssetPolicy: CreateAssetPolicy;
|
|
797
|
+
} | {
|
|
798
|
+
MintAsset: MintAsset;
|
|
799
|
+
} | {
|
|
800
|
+
ApplyMorphism: ApplyMorphism;
|
|
801
|
+
} | {
|
|
802
|
+
AuthorizeCompose: AuthorizeCompose;
|
|
498
803
|
};
|
|
499
804
|
/**
|
|
500
805
|
* Names of all valid OttochainMessage types.
|
|
501
806
|
* Use this for runtime validation (e.g., in API routes).
|
|
502
807
|
*/
|
|
503
|
-
export declare const OTTOCHAIN_MESSAGE_TYPES: readonly ["CreateStateMachine", "TransitionStateMachine", "ArchiveStateMachine", "UpgradeFiber", "CreateScript", "InvokeScript", "
|
|
808
|
+
export declare const OTTOCHAIN_MESSAGE_TYPES: readonly ["CreateStateMachine", "TransitionStateMachine", "ArchiveStateMachine", "UpgradeFiber", "CreateScript", "InvokeScript", "UpgradeScript", "PublishMachineVersion", "PublishScriptVersion", "SetVersionStatus", "RegisterAlias", "CreateAssetPolicy", "MintAsset", "ApplyMorphism", "AuthorizeCompose"];
|
|
504
809
|
/**
|
|
505
810
|
* Type representing valid message type names.
|
|
506
811
|
*/
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Privacy: shield any fiber app into a zk-jlvm-shielded private-state pool.
|
|
3
|
+
* See docs/design/zk-private-contract-state-rfc.md.
|
|
4
|
+
*/
|
|
5
|
+
export { shieldApp, SHIELDED_POOL_STATE, type ShieldOptions } from "./shield-app.js";
|
|
6
|
+
export { sealedBidAccountDef, shieldedSealedBidDef, vickreyAuctionDef } from "./sealed-bid.js";
|