@ottochain/sdk 2.2.1 → 2.2.3
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/index.js +8 -1016
- package/dist/cjs/apps/corporate/state-machines/index.js +7 -17
- package/dist/cjs/apps/governance/state-machines/index.js +11 -12
- package/dist/cjs/apps/identity/state-machines/index.js +3 -10
- package/dist/cjs/apps/markets/state-machines/index.js +7 -8
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/ottochain/normalize.js +17 -1
- package/dist/cjs/schema/fiber-app.js +4 -3
- package/dist/esm/apps/contracts/state-machines/index.js +5 -1016
- package/dist/esm/apps/corporate/state-machines/index.js +6 -16
- package/dist/esm/apps/governance/state-machines/index.js +8 -9
- package/dist/esm/apps/identity/state-machines/index.js +5 -12
- package/dist/esm/apps/markets/state-machines/index.js +7 -8
- package/dist/esm/index.js +1 -1
- package/dist/esm/ottochain/normalize.js +17 -1
- package/dist/esm/schema/fiber-app.js +4 -3
- package/dist/types/apps/contracts/index.d.ts +1058 -743
- package/dist/types/apps/contracts/state-machines/index.d.ts +5 -799
- package/dist/types/apps/corporate/index.d.ts +5 -6
- package/dist/types/apps/corporate/state-machines/index.d.ts +6 -5447
- package/dist/types/apps/governance/index.d.ts +30 -36
- package/dist/types/apps/governance/state-machines/index.d.ts +8 -9
- package/dist/types/apps/identity/index.d.ts +3 -1
- package/dist/types/apps/identity/state-machines/index.d.ts +5 -1096
- package/dist/types/apps/markets/index.d.ts +8 -6
- package/dist/types/apps/markets/state-machines/index.d.ts +7 -8
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Corporate
|
|
3
|
-
*
|
|
4
|
-
* TypeScript definitions using defineFiberApp() pattern.
|
|
5
|
-
* Converted from JSON state machine definitions.
|
|
2
|
+
* Corporate state machine definitions.
|
|
3
|
+
* Re-exports from TypeScript definition files.
|
|
6
4
|
*/
|
|
7
|
-
|
|
8
|
-
export { corpEntityDef
|
|
9
|
-
export {
|
|
10
|
-
export { corpShareholdersDef
|
|
11
|
-
export { corpSecuritiesDef, } from "./corp-securities.js";
|
|
12
|
-
// Re-export all definitions as a collection
|
|
13
|
-
export const corporateStateMachines = {
|
|
14
|
-
corpEntity: () => import("./corp-entity.js").then((m) => m.corpEntityDef),
|
|
15
|
-
corpBoard: () => import("./corp-board.js").then((m) => m.corpBoardDef),
|
|
16
|
-
corpShareholders: () => import("./corp-shareholders.js").then((m) => m.corpShareholdersDef),
|
|
17
|
-
corpSecurities: () => import("./corp-securities.js").then((m) => m.corpSecuritiesDef),
|
|
18
|
-
};
|
|
5
|
+
export { corpBoardDef } from './corp-board.js';
|
|
6
|
+
export { corpEntityDef } from './corp-entity.js';
|
|
7
|
+
export { corpSecuritiesDef } from './corp-securities.js';
|
|
8
|
+
export { corpShareholdersDef } from './corp-shareholders.js';
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Governance
|
|
3
|
-
*
|
|
4
|
-
* TypeScript-first definitions using defineFiberApp() - no JSON, no code generation.
|
|
2
|
+
* Governance state machine definitions.
|
|
3
|
+
* Re-exports from TypeScript definition files.
|
|
5
4
|
*/
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export { daoSingleDef } from
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
5
|
+
export { daoMultisigDef } from './dao-multisig.js';
|
|
6
|
+
export { daoReputationDef } from './dao-reputation.js';
|
|
7
|
+
export { daoSingleDef } from './dao-single.js';
|
|
8
|
+
export { daoTokenDef } from './dao-token.js';
|
|
9
|
+
export { govSimpleDef } from './governance-simple.js';
|
|
10
|
+
export { govUniversalDef } from './governance-universal.js';
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Identity
|
|
3
|
-
*
|
|
4
|
-
* TypeScript-first definitions - no JSON, no code generation.
|
|
2
|
+
* Identity state machine definitions.
|
|
3
|
+
* Re-exports from TypeScript definition files.
|
|
5
4
|
*/
|
|
6
|
-
export { identityAgentDef
|
|
7
|
-
export { identityOracleDef
|
|
8
|
-
export { identityUniversalDef
|
|
9
|
-
// Re-export all definitions as a record for iteration
|
|
10
|
-
export const IDENTITY_DEFINITIONS = {
|
|
11
|
-
agent: () => import("./identity-agent.js").then((m) => m.identityAgentDef),
|
|
12
|
-
oracle: () => import("./identity-oracle.js").then((m) => m.identityOracleDef),
|
|
13
|
-
universal: () => import("./identity-universal.js").then((m) => m.identityUniversalDef),
|
|
14
|
-
};
|
|
5
|
+
export { identityAgentDef } from './identity-agent.js';
|
|
6
|
+
export { identityOracleDef } from './identity-oracle.js';
|
|
7
|
+
export { identityUniversalDef } from './identity-universal.js';
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Markets
|
|
3
|
-
*
|
|
4
|
-
* TypeScript-first definitions using defineFiberApp() - no JSON, no code generation.
|
|
2
|
+
* Markets state machine definitions.
|
|
3
|
+
* Re-exports from TypeScript definition files.
|
|
5
4
|
*/
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
5
|
+
export { marketAuctionDef } from './market-auction.js';
|
|
6
|
+
export { marketCrowdfundDef } from './market-crowdfund.js';
|
|
7
|
+
export { marketGroupBuyDef } from './market-group-buy.js';
|
|
8
|
+
export { marketPredictionDef } from './market-prediction.js';
|
|
9
|
+
export { marketUniversalDef } from './market-universal.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -43,4 +43,4 @@ validate, validatePrivateKey, validatePublicKey, validateAddress, validateKeyPai
|
|
|
43
43
|
// ─── OttoChain metagraph client ───────────────────────────────────────────────
|
|
44
44
|
export { MetagraphClient as OttoMetagraphClient } from './ottochain/metagraph-client.js';
|
|
45
45
|
// Proto definition helper
|
|
46
|
-
export { toProtoDefinition } from './schema/fiber-app.js';
|
|
46
|
+
export { toProtoDefinition, defineFiberApp, } from './schema/fiber-app.js';
|
|
@@ -51,8 +51,21 @@ function normalizeTransition(t) {
|
|
|
51
51
|
dependencies: t.dependencies ?? [],
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Check if a value looks like FiberAppMetadata (has 'name' and 'app' fields).
|
|
56
|
+
* These TypeScript-only fields should be stripped before sending to metagraph.
|
|
57
|
+
*/
|
|
58
|
+
function isFiberAppMetadata(value) {
|
|
59
|
+
return (typeof value === 'object' &&
|
|
60
|
+
value !== null &&
|
|
61
|
+
'name' in value &&
|
|
62
|
+
'app' in value);
|
|
63
|
+
}
|
|
54
64
|
/**
|
|
55
65
|
* Normalize a StateMachineDefinition for wire format
|
|
66
|
+
*
|
|
67
|
+
* Strips FiberAppMetadata from the definition — the Scala schema expects
|
|
68
|
+
* `metadata: Option[Json] = None`, not the TypeScript app metadata object.
|
|
56
69
|
*/
|
|
57
70
|
function normalizeDefinition(def) {
|
|
58
71
|
const states = def.states;
|
|
@@ -63,11 +76,14 @@ function normalizeDefinition(def) {
|
|
|
63
76
|
}
|
|
64
77
|
}
|
|
65
78
|
const transitions = def.transitions ?? [];
|
|
79
|
+
// Strip FiberAppMetadata if present — it's TypeScript-only, not part of wire format.
|
|
80
|
+
// The Scala schema has `metadata: Option[Json] = None`, so use null for wire format.
|
|
81
|
+
const wireMetadata = isFiberAppMetadata(def.metadata) ? null : (def.metadata ?? null);
|
|
66
82
|
return {
|
|
67
83
|
states: normalizedStates,
|
|
68
84
|
initialState: def.initialState,
|
|
69
85
|
transitions: transitions.map(normalizeTransition),
|
|
70
|
-
metadata:
|
|
86
|
+
metadata: wireMetadata,
|
|
71
87
|
};
|
|
72
88
|
}
|
|
73
89
|
/**
|
|
@@ -58,6 +58,7 @@ export function toJSON(def) {
|
|
|
58
58
|
*/
|
|
59
59
|
export function toProtoDefinition(def) {
|
|
60
60
|
// Extract only the proto-compatible fields
|
|
61
|
+
// NOTE: guard and effect are REQUIRED by the Scala Transition case class (no defaults)
|
|
61
62
|
const protoDef = {
|
|
62
63
|
states: {},
|
|
63
64
|
initialState: def.initialState,
|
|
@@ -65,10 +66,10 @@ export function toProtoDefinition(def) {
|
|
|
65
66
|
from: t.from,
|
|
66
67
|
to: t.to,
|
|
67
68
|
eventName: t.eventName,
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
guard: t.guard, // Required - Scala has no default
|
|
70
|
+
effect: t.effect, // Required - Scala has no default
|
|
71
|
+
// dependencies has default Set.empty in Scala, so omit if empty
|
|
70
72
|
...(t.dependencies?.length && { dependencies: [...t.dependencies] }),
|
|
71
|
-
...(t.emits?.length && { emits: [...t.emits] }),
|
|
72
73
|
})),
|
|
73
74
|
};
|
|
74
75
|
// Copy states (only id and isFinal)
|