@ottochain/sdk 2.2.5 → 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 +89 -46
- package/dist/cjs/apps/contracts/state-machines/contract-escrow.js +152 -45
- package/dist/cjs/apps/contracts/state-machines/contract-universal.js +40 -8
- 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 +85 -43
- package/dist/cjs/apps/governance/state-machines/dao-reputation.js +73 -43
- package/dist/cjs/apps/governance/state-machines/dao-single.js +55 -14
- package/dist/cjs/apps/governance/state-machines/dao-token.js +103 -45
- package/dist/cjs/apps/governance/state-machines/governance-simple.js +129 -65
- package/dist/cjs/apps/governance/state-machines/governance-universal.js +29 -5
- 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 +57 -9
- package/dist/cjs/apps/identity/state-machines/identity-oracle.js +70 -27
- package/dist/cjs/apps/identity/state-machines/identity-registry.js +288 -0
- package/dist/cjs/apps/identity/state-machines/identity-universal.js +30 -6
- 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 +44 -19
- package/dist/cjs/apps/markets/state-machines/market-crowdfund.js +54 -29
- package/dist/cjs/apps/markets/state-machines/market-group-buy.js +53 -31
- package/dist/cjs/apps/markets/state-machines/market-prediction.js +120 -61
- package/dist/cjs/apps/markets/state-machines/market-universal.js +50 -10
- 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 +1722 -1
- package/dist/cjs/generated/ottochain/v1/fiber.js +355 -5
- 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 +45 -7
- package/dist/cjs/openapi.js +2 -0
- package/dist/cjs/ottochain/drop-nulls.js +1 -2
- package/dist/cjs/ottochain/genesis-manifest.js +193 -0
- package/dist/cjs/ottochain/index.js +27 -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 +19 -1
- 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 +89 -46
- package/dist/esm/apps/contracts/state-machines/contract-escrow.js +152 -45
- package/dist/esm/apps/contracts/state-machines/contract-universal.js +40 -8
- 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 +85 -43
- package/dist/esm/apps/governance/state-machines/dao-reputation.js +73 -43
- package/dist/esm/apps/governance/state-machines/dao-single.js +55 -14
- package/dist/esm/apps/governance/state-machines/dao-token.js +103 -45
- package/dist/esm/apps/governance/state-machines/governance-simple.js +129 -65
- package/dist/esm/apps/governance/state-machines/governance-universal.js +29 -5
- 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 +57 -9
- package/dist/esm/apps/identity/state-machines/identity-oracle.js +70 -27
- package/dist/esm/apps/identity/state-machines/identity-registry.js +285 -0
- package/dist/esm/apps/identity/state-machines/identity-universal.js +30 -6
- 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 +44 -19
- package/dist/esm/apps/markets/state-machines/market-crowdfund.js +54 -29
- package/dist/esm/apps/markets/state-machines/market-group-buy.js +53 -31
- package/dist/esm/apps/markets/state-machines/market-prediction.js +120 -61
- package/dist/esm/apps/markets/state-machines/market-universal.js +50 -10
- 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/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 +23 -2
- package/dist/esm/openapi.js +1 -0
- package/dist/esm/ottochain/genesis-manifest.js +189 -0
- package/dist/esm/ottochain/index.js +4 -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 +18 -0
- 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 +159 -227
- package/dist/types/apps/contracts/state-machines/contract-agreement.d.ts +50 -101
- package/dist/types/apps/contracts/state-machines/contract-escrow.d.ts +86 -120
- package/dist/types/apps/contracts/state-machines/contract-universal.d.ts +20 -4
- 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 +396 -417
- package/dist/types/apps/governance/state-machines/dao-multisig.d.ts +92 -95
- package/dist/types/apps/governance/state-machines/dao-reputation.d.ts +57 -69
- package/dist/types/apps/governance/state-machines/dao-single.d.ts +40 -50
- package/dist/types/apps/governance/state-machines/dao-token.d.ts +80 -53
- package/dist/types/apps/governance/state-machines/governance-simple.d.ts +107 -121
- package/dist/types/apps/governance/state-machines/governance-universal.d.ts +17 -5
- package/dist/types/apps/identity/constants.d.ts +32 -4
- package/dist/types/apps/identity/index.d.ts +449 -100
- package/dist/types/apps/identity/state-machines/identity-agent.d.ts +30 -0
- package/dist/types/apps/identity/state-machines/identity-oracle.d.ts +41 -87
- package/dist/types/apps/identity/state-machines/identity-registry.d.ts +379 -0
- package/dist/types/apps/identity/state-machines/identity-universal.d.ts +15 -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 +184 -204
- package/dist/types/apps/markets/state-machines/market-auction.d.ts +25 -37
- package/dist/types/apps/markets/state-machines/market-crowdfund.d.ts +26 -34
- package/dist/types/apps/markets/state-machines/market-group-buy.d.ts +31 -43
- package/dist/types/apps/markets/state-machines/market-prediction.d.ts +67 -72
- package/dist/types/apps/markets/state-machines/market-universal.d.ts +30 -10
- 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/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 +8 -2
- package/dist/types/openapi.d.ts +22 -0
- package/dist/types/ottochain/genesis-manifest.d.ts +130 -0
- package/dist/types/ottochain/index.d.ts +6 -5
- 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 +602 -11
- 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 +41 -3
- 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 +52 -35
- 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 = {
|
|
@@ -46,6 +50,220 @@ export interface StateMachineDefinition {
|
|
|
46
50
|
transitions: unknown[];
|
|
47
51
|
metadata?: JsonLogicValue;
|
|
48
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Semantic version `MAJOR.MINOR.PATCH`.
|
|
55
|
+
* Wire format: plain string (e.g. "1.0.0"). Also used as a JSON map key.
|
|
56
|
+
*
|
|
57
|
+
* @see modules/models/.../schema/registry/SemVer.scala
|
|
58
|
+
*/
|
|
59
|
+
export type SemVer = string;
|
|
60
|
+
/**
|
|
61
|
+
* Lifecycle status of a registered version (npm/Cargo-style).
|
|
62
|
+
* Wire format: uppercase string (enumeratum `Uppercase`).
|
|
63
|
+
*
|
|
64
|
+
* - `ACTIVE` — selectable + recommended.
|
|
65
|
+
* - `DEPRECATED` — still resolvable/runnable, flagged, discouraged for new instances.
|
|
66
|
+
* - `YANKED` — excluded from NEW resolutions; existing pinned fibers keep running.
|
|
67
|
+
*
|
|
68
|
+
* @see modules/models/.../schema/registry/RegistryStatus.scala
|
|
69
|
+
*/
|
|
70
|
+
export type RegistryStatus = 'ACTIVE' | 'DEPRECATED' | 'YANKED';
|
|
71
|
+
/**
|
|
72
|
+
* A caller's version requirement, resolved against a {@link VersionLineage} (Cargo/npm-style).
|
|
73
|
+
* Wire format: single-key wrapper object (sealed-trait encoding).
|
|
74
|
+
*
|
|
75
|
+
* - `Exact` — exactly this version: `{"Exact":{"version":"1.0.0"}}`.
|
|
76
|
+
* - `Caret` — same MAJOR and `>= v` (`^1.2.0`).
|
|
77
|
+
* - `Tilde` — same MAJOR.MINOR and `>= v` (`~1.2.0`).
|
|
78
|
+
* - `Latest` — highest selectable version: `{"Latest":{}}`.
|
|
79
|
+
* - `PinnedHash` — the exact artifact by schema hash, version-agnostic.
|
|
80
|
+
*
|
|
81
|
+
* @see modules/models/.../schema/registry/VersionReq.scala
|
|
82
|
+
*/
|
|
83
|
+
export type VersionReq = {
|
|
84
|
+
Exact: {
|
|
85
|
+
version: SemVer;
|
|
86
|
+
};
|
|
87
|
+
} | {
|
|
88
|
+
Caret: {
|
|
89
|
+
version: SemVer;
|
|
90
|
+
};
|
|
91
|
+
} | {
|
|
92
|
+
Tilde: {
|
|
93
|
+
version: SemVer;
|
|
94
|
+
};
|
|
95
|
+
} | {
|
|
96
|
+
Latest: Record<string, never>;
|
|
97
|
+
} | {
|
|
98
|
+
PinnedHash: {
|
|
99
|
+
schemaHash: string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* A caller's reference to a registered schema/program version, supplied at fiber creation
|
|
104
|
+
* (`CreateStateMachine.schemaRef`). The chain resolves `version` against the registry at create time.
|
|
105
|
+
* Wire format: `{"name":"counter.package","version":{"Exact":{"version":"1.0.0"}}}`.
|
|
106
|
+
*
|
|
107
|
+
* @see modules/models/.../schema/registry/SchemaRef.scala
|
|
108
|
+
*/
|
|
109
|
+
export interface SchemaRef {
|
|
110
|
+
/** Full registry name `labels.tld` (e.g. "counter.package"). */
|
|
111
|
+
name: string;
|
|
112
|
+
version: VersionReq;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* One field of a {@link MessageShape} — mirrors a protobuf `FieldDescriptorProto`
|
|
116
|
+
* at the field level (name + field number + type).
|
|
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).
|
|
120
|
+
*
|
|
121
|
+
* @see modules/models/.../schema/registry/SchemaShape.scala
|
|
122
|
+
*/
|
|
123
|
+
export interface FieldShape {
|
|
124
|
+
name: string;
|
|
125
|
+
number: number;
|
|
126
|
+
typeName: string;
|
|
127
|
+
repeated: boolean;
|
|
128
|
+
optional: boolean;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* A single protobuf message shape: its type name plus its fields.
|
|
132
|
+
*
|
|
133
|
+
* @see modules/models/.../schema/registry/SchemaShape.scala
|
|
134
|
+
*/
|
|
135
|
+
export interface MessageShape {
|
|
136
|
+
typeName: string;
|
|
137
|
+
fields: FieldShape[];
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
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`.)
|
|
143
|
+
*
|
|
144
|
+
* @see modules/models/.../schema/registry/SchemaShape.scala
|
|
145
|
+
*/
|
|
146
|
+
export interface MachineShape {
|
|
147
|
+
stateMessage: MessageShape;
|
|
148
|
+
/** One message per command/event, keyed by event name. */
|
|
149
|
+
commands: Record<string, MessageShape>;
|
|
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
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* The resolved, pinned binding recorded on a fiber: which registry (name, version) it
|
|
181
|
+
* instantiates, with the committed hashes. Resolved once at create, then immutable.
|
|
182
|
+
*
|
|
183
|
+
* @see modules/models/.../schema/registry/SchemaBinding.scala
|
|
184
|
+
*/
|
|
185
|
+
export interface SchemaBinding {
|
|
186
|
+
/** Full registry name `labels.tld`. */
|
|
187
|
+
name: string;
|
|
188
|
+
version: SemVer;
|
|
189
|
+
/** Commitment to the protobuf FileDescriptorSet (descriptor bytes; off-chain). */
|
|
190
|
+
schemaHash: string;
|
|
191
|
+
/** The verified-binding anchor: `StateMachineDefinition.computeDigest` of the logic. */
|
|
192
|
+
logicHash: string;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* One immutable version of a registry entry. The chain commits only the hashes + the
|
|
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).
|
|
199
|
+
*
|
|
200
|
+
* @see modules/models/.../schema/registry/RegisteredVersion.scala
|
|
201
|
+
*/
|
|
202
|
+
export interface RegisteredVersion {
|
|
203
|
+
version: SemVer;
|
|
204
|
+
/** Commitment to the protobuf FileDescriptorSet (descriptor bytes; off-chain). */
|
|
205
|
+
schemaHash: string;
|
|
206
|
+
/** The verified-binding anchor: `StateMachineDefinition.computeDigest` of the logic. */
|
|
207
|
+
logicHash: string;
|
|
208
|
+
/** The kind-correct advisory projection (Machine | Script | AssetPolicy). */
|
|
209
|
+
shape: RegistryShape;
|
|
210
|
+
status: RegistryStatus;
|
|
211
|
+
/** Snapshot ordinal at which this version was registered. */
|
|
212
|
+
registeredAt: number;
|
|
213
|
+
/** Opt-in runtime conformance gate (#33). Required on the wire. */
|
|
214
|
+
strict: boolean;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* The append-only, monotonic version lineage of a single registry entry.
|
|
218
|
+
* Wire format: `versions` is a SemVer-string-keyed map of {@link RegisteredVersion}.
|
|
219
|
+
*
|
|
220
|
+
* @see modules/models/.../schema/registry/VersionLineage.scala
|
|
221
|
+
*/
|
|
222
|
+
export interface VersionLineage {
|
|
223
|
+
/** SemVer-string keyed map of registered versions. */
|
|
224
|
+
versions: Record<string, RegisteredVersion>;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* What a registry entry resolves to, discriminated by the name's TLD.
|
|
228
|
+
* Wire format: single-key wrapper object (sealed-trait encoding).
|
|
229
|
+
*
|
|
230
|
+
* - `SchemaPackage` (`.package`) — a versioned schema/program type (its {@link VersionLineage}).
|
|
231
|
+
* Note the double-nesting: `SchemaPackage.versions` is a {@link VersionLineage} whose
|
|
232
|
+
* own `.versions` is the SemVer-keyed map, e.g.
|
|
233
|
+
* `{"SchemaPackage":{"versions":{"versions":{"1.0.0":{...}}}}}`.
|
|
234
|
+
* - `InstanceAlias` (`.machine` / `.script`) — a nickname for an existing fiber (#29).
|
|
235
|
+
*
|
|
236
|
+
* @see modules/models/.../schema/registry/RegistryTarget.scala
|
|
237
|
+
*/
|
|
238
|
+
export type RegistryTarget = {
|
|
239
|
+
SchemaPackage: {
|
|
240
|
+
versions: VersionLineage;
|
|
241
|
+
};
|
|
242
|
+
} | {
|
|
243
|
+
InstanceAlias: {
|
|
244
|
+
fiberId: string;
|
|
245
|
+
};
|
|
246
|
+
} | {
|
|
247
|
+
AssetPolicyPackage: {
|
|
248
|
+
versions: VersionLineage;
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* A single owned entry in the registry namespace: a name -> a discriminated
|
|
253
|
+
* {@link RegistryTarget}, with the owning addresses and an optional off-chain metadata grab-bag.
|
|
254
|
+
* Wire format: `metadata` defaults to `{}` and is omittable.
|
|
255
|
+
*
|
|
256
|
+
* @see modules/models/.../schema/registry/RegistryEntry.scala
|
|
257
|
+
*/
|
|
258
|
+
export interface RegistryEntry {
|
|
259
|
+
/** Full registry name `labels.tld`. */
|
|
260
|
+
name: string;
|
|
261
|
+
/** Owning DAG addresses (who may publish versions / change status / transfer). */
|
|
262
|
+
owner: string[];
|
|
263
|
+
target: RegistryTarget;
|
|
264
|
+
/** Optional off-chain links grab-bag (e.g. "repo"/"homepage" -> URL). */
|
|
265
|
+
metadata?: Record<string, string>;
|
|
266
|
+
}
|
|
49
267
|
/**
|
|
50
268
|
* Event emitted by a state machine transition trigger.
|
|
51
269
|
*/
|
|
@@ -73,9 +291,9 @@ export interface EventReceipt {
|
|
|
73
291
|
emittedEvents: EmittedEvent[];
|
|
74
292
|
}
|
|
75
293
|
/**
|
|
76
|
-
* Log entry for a script
|
|
294
|
+
* Log entry for a script invocation.
|
|
77
295
|
*/
|
|
78
|
-
export interface
|
|
296
|
+
export interface ScriptInvocation {
|
|
79
297
|
fiberId: string;
|
|
80
298
|
method: string;
|
|
81
299
|
args: JsonLogicValue;
|
|
@@ -84,10 +302,56 @@ export interface OracleInvocation {
|
|
|
84
302
|
invokedAt: number;
|
|
85
303
|
invokedBy: string;
|
|
86
304
|
}
|
|
305
|
+
/**
|
|
306
|
+
* Birth record for a fiber, emitted once at creation. Records the resolved registry
|
|
307
|
+
* binding (name@version + committed hashes) when instantiated from a registered version
|
|
308
|
+
* (#26), or omits it for an ad-hoc fiber. Seeds the audit-trail rendering (#30).
|
|
309
|
+
*
|
|
310
|
+
* @see modules/models/.../schema/fiber/FiberLogEntry.scala
|
|
311
|
+
*/
|
|
312
|
+
export interface CreationReceipt {
|
|
313
|
+
fiberId: string;
|
|
314
|
+
ordinal: number;
|
|
315
|
+
initialState: string;
|
|
316
|
+
owners: string[];
|
|
317
|
+
schemaBinding?: SchemaBinding;
|
|
318
|
+
parentFiberId?: string;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Emitted when a fiber is upgraded to a different registered version (#27). Records the
|
|
322
|
+
* binding change (from -> to) and whether a state migration ran.
|
|
323
|
+
*
|
|
324
|
+
* @see modules/models/.../schema/fiber/FiberLogEntry.scala
|
|
325
|
+
*/
|
|
326
|
+
export interface UpgradeReceipt {
|
|
327
|
+
fiberId: string;
|
|
328
|
+
ordinal: number;
|
|
329
|
+
/** Prior binding; absent for a fiber that had no registry binding before the upgrade. */
|
|
330
|
+
fromBinding?: SchemaBinding;
|
|
331
|
+
toBinding: SchemaBinding;
|
|
332
|
+
gasUsed: number;
|
|
333
|
+
migrated: boolean;
|
|
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
|
+
}
|
|
87
351
|
/**
|
|
88
352
|
* Union type for all fiber log entries.
|
|
89
353
|
*/
|
|
90
|
-
export type FiberLogEntry = EventReceipt |
|
|
354
|
+
export type FiberLogEntry = EventReceipt | ScriptInvocation | CreationReceipt | UpgradeReceipt | RejectionReceipt;
|
|
91
355
|
/**
|
|
92
356
|
* On-chain record for a state machine fiber.
|
|
93
357
|
* Wire format: all ordinals/states/hashes are plain primitives.
|
|
@@ -107,9 +371,13 @@ export interface StateMachineFiberRecord {
|
|
|
107
371
|
lastReceipt?: EventReceipt;
|
|
108
372
|
parentFiberId?: string;
|
|
109
373
|
childFiberIds: string[];
|
|
374
|
+
/** The resolved, pinned registry binding (#26), present when created from a registered version. */
|
|
375
|
+
schemaBinding?: SchemaBinding;
|
|
376
|
+
/** DAG addresses authorized to sign transitions (multi-party); seeded from `CreateStateMachine.participants`. */
|
|
377
|
+
authorizedSigners?: string[];
|
|
110
378
|
}
|
|
111
379
|
/**
|
|
112
|
-
* On-chain record for a script
|
|
380
|
+
* On-chain record for a script fiber.
|
|
113
381
|
*/
|
|
114
382
|
export interface ScriptFiberRecord {
|
|
115
383
|
fiberId: string;
|
|
@@ -122,7 +390,9 @@ export interface ScriptFiberRecord {
|
|
|
122
390
|
sequenceNumber: number;
|
|
123
391
|
owners: string[];
|
|
124
392
|
status: FiberStatus;
|
|
125
|
-
lastInvocation?:
|
|
393
|
+
lastInvocation?: ScriptInvocation;
|
|
394
|
+
/** The resolved, pinned registry binding, present when created from a registered version. */
|
|
395
|
+
schemaBinding?: SchemaBinding;
|
|
126
396
|
}
|
|
127
397
|
/**
|
|
128
398
|
* Union type for all fiber records.
|
|
@@ -142,6 +412,10 @@ export interface FiberCommit {
|
|
|
142
412
|
export interface OnChain {
|
|
143
413
|
fiberCommits: Record<string, FiberCommit>;
|
|
144
414
|
latestLogs: Record<string, FiberLogEntry[]>;
|
|
415
|
+
/** Per-registry-entry commitment hash, keyed by full registry name `labels.tld`. */
|
|
416
|
+
registryCommits: Record<string, string>;
|
|
417
|
+
/** Per-asset L1 fast-path commit (behavior bits + sequence), keyed by asset UUID. */
|
|
418
|
+
assetCommits: Record<string, AssetCommit>;
|
|
145
419
|
}
|
|
146
420
|
/**
|
|
147
421
|
* Full calculated state (served by ML0 /v1/ endpoints).
|
|
@@ -149,6 +423,14 @@ export interface OnChain {
|
|
|
149
423
|
export interface CalculatedState {
|
|
150
424
|
stateMachines: Record<string, StateMachineFiberRecord>;
|
|
151
425
|
scripts: Record<string, ScriptFiberRecord>;
|
|
426
|
+
/** Registry namespace, keyed by full registry name `labels.tld`. */
|
|
427
|
+
registry: Record<string, RegistryEntry>;
|
|
428
|
+
/** Reverse records (#29): fiber UUID -> its canonical registered name. */
|
|
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[]>;
|
|
152
434
|
}
|
|
153
435
|
/**
|
|
154
436
|
* Create a new state machine fiber.
|
|
@@ -160,6 +442,11 @@ export interface CreateStateMachine {
|
|
|
160
442
|
parentFiberId?: string | null;
|
|
161
443
|
/** Optional set of DAG addresses authorized to sign transitions (multi-party signing). */
|
|
162
444
|
participants?: string[] | null;
|
|
445
|
+
/**
|
|
446
|
+
* Optional reference to a registered schema/program version (#26). When present, the chain
|
|
447
|
+
* resolves it against the registry at create time and records the verified {@link SchemaBinding}.
|
|
448
|
+
*/
|
|
449
|
+
schemaRef?: SchemaRef | null;
|
|
163
450
|
}
|
|
164
451
|
/**
|
|
165
452
|
* Trigger a state machine transition.
|
|
@@ -178,7 +465,7 @@ export interface ArchiveStateMachine {
|
|
|
178
465
|
targetSequenceNumber: number;
|
|
179
466
|
}
|
|
180
467
|
/**
|
|
181
|
-
* Create a new script
|
|
468
|
+
* Create a new script fiber.
|
|
182
469
|
*/
|
|
183
470
|
export interface CreateScript {
|
|
184
471
|
fiberId: string;
|
|
@@ -187,7 +474,7 @@ export interface CreateScript {
|
|
|
187
474
|
accessControl: AccessControlPolicy;
|
|
188
475
|
}
|
|
189
476
|
/**
|
|
190
|
-
* Invoke a script
|
|
477
|
+
* Invoke a script method.
|
|
191
478
|
*/
|
|
192
479
|
export interface InvokeScript {
|
|
193
480
|
fiberId: string;
|
|
@@ -195,6 +482,290 @@ export interface InvokeScript {
|
|
|
195
482
|
args: JsonLogicValue;
|
|
196
483
|
targetSequenceNumber: number;
|
|
197
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
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Upgrade an existing fiber to a different registered version of the SAME package (#27).
|
|
500
|
+
* The chain verifies `newDefinition` hashes to the target version's `logicHash`, applies the
|
|
501
|
+
* optional `migration` (a JSON-Logic transform of the prior state data), preserves the current
|
|
502
|
+
* state id, and re-pins the binding.
|
|
503
|
+
*/
|
|
504
|
+
export interface UpgradeFiber {
|
|
505
|
+
fiberId: string;
|
|
506
|
+
targetRef: SchemaRef;
|
|
507
|
+
newDefinition: StateMachineDefinition;
|
|
508
|
+
/** Optional JSON-Logic transform applied to the prior state data during upgrade. */
|
|
509
|
+
migration?: JsonLogicExpression;
|
|
510
|
+
targetSequenceNumber: number;
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
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.
|
|
517
|
+
*
|
|
518
|
+
* Note: `fiberId` is NOT on the wire — the chain derives the routing id from `name`.
|
|
519
|
+
*/
|
|
520
|
+
export interface PublishMachineVersion {
|
|
521
|
+
/** Full registry name `labels.tld` (e.g. "order.package"). */
|
|
522
|
+
name: string;
|
|
523
|
+
version: SemVer;
|
|
524
|
+
/** Base64 of the proto FileDescriptorSet; the chain base64-validates + hashes it, then drops the bytes. */
|
|
525
|
+
schemaB64: string;
|
|
526
|
+
/** The typed proto projection the chain stores for discovery (advisory). */
|
|
527
|
+
machineShape: MachineShape;
|
|
528
|
+
/** The typed JSON-Logic state machine; hashed into `logicHash` for verified binding (#37). */
|
|
529
|
+
definition: StateMachineDefinition;
|
|
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`). */
|
|
554
|
+
metadata?: Record<string, string>;
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Change a registered version's lifecycle status (Active <-> Deprecated -> Yanked). Owner-gated.
|
|
558
|
+
*/
|
|
559
|
+
export interface SetVersionStatus {
|
|
560
|
+
/** Full registry name `labels.tld`. */
|
|
561
|
+
name: string;
|
|
562
|
+
version: SemVer;
|
|
563
|
+
status: RegistryStatus;
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Register a human-readable nickname for an existing fiber (#29). The name's TLD must be
|
|
567
|
+
* `.machine` or `.script` and match the target fiber's kind; the signer must own the target.
|
|
568
|
+
*
|
|
569
|
+
* Note: `fiberId` is NOT on the wire — the chain derives the routing id from `name`.
|
|
570
|
+
*/
|
|
571
|
+
export interface RegisterAlias {
|
|
572
|
+
/** Full registry name `labels.tld` (e.g. "my-escrow.machine"). */
|
|
573
|
+
name: string;
|
|
574
|
+
/** The existing fiber UUID this alias points at. */
|
|
575
|
+
targetFiberId: string;
|
|
576
|
+
/** Optional off-chain links grab-bag; defaults to `{}`, omittable. */
|
|
577
|
+
metadata?: Record<string, string>;
|
|
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
|
+
}
|
|
198
769
|
/**
|
|
199
770
|
* Union type for all ottochain messages.
|
|
200
771
|
* JSON is wrapped as `{ MessageName: { ...fields } }`.
|
|
@@ -205,16 +776,36 @@ export type OttochainMessage = {
|
|
|
205
776
|
TransitionStateMachine: TransitionStateMachine;
|
|
206
777
|
} | {
|
|
207
778
|
ArchiveStateMachine: ArchiveStateMachine;
|
|
779
|
+
} | {
|
|
780
|
+
UpgradeFiber: UpgradeFiber;
|
|
208
781
|
} | {
|
|
209
782
|
CreateScript: CreateScript;
|
|
210
783
|
} | {
|
|
211
784
|
InvokeScript: InvokeScript;
|
|
785
|
+
} | {
|
|
786
|
+
UpgradeScript: UpgradeScript;
|
|
787
|
+
} | {
|
|
788
|
+
PublishMachineVersion: PublishMachineVersion;
|
|
789
|
+
} | {
|
|
790
|
+
PublishScriptVersion: PublishScriptVersion;
|
|
791
|
+
} | {
|
|
792
|
+
SetVersionStatus: SetVersionStatus;
|
|
793
|
+
} | {
|
|
794
|
+
RegisterAlias: RegisterAlias;
|
|
795
|
+
} | {
|
|
796
|
+
CreateAssetPolicy: CreateAssetPolicy;
|
|
797
|
+
} | {
|
|
798
|
+
MintAsset: MintAsset;
|
|
799
|
+
} | {
|
|
800
|
+
ApplyMorphism: ApplyMorphism;
|
|
801
|
+
} | {
|
|
802
|
+
AuthorizeCompose: AuthorizeCompose;
|
|
212
803
|
};
|
|
213
804
|
/**
|
|
214
805
|
* Names of all valid OttochainMessage types.
|
|
215
806
|
* Use this for runtime validation (e.g., in API routes).
|
|
216
807
|
*/
|
|
217
|
-
export declare const OTTOCHAIN_MESSAGE_TYPES: readonly ["CreateStateMachine", "TransitionStateMachine", "ArchiveStateMachine", "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"];
|
|
218
809
|
/**
|
|
219
810
|
* Type representing valid message type names.
|
|
220
811
|
*/
|