@ottochain/sdk 2.3.0 → 2.5.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/compute/index.js +33 -0
- package/dist/cjs/apps/compute/state-machines/compute-rule110.js +164 -0
- package/dist/cjs/apps/compute/state-machines/index.js +9 -0
- package/dist/cjs/apps/contracts/index.js +16 -9
- package/dist/cjs/apps/contracts/state-machines/contract-agreement.js +134 -161
- package/dist/cjs/apps/contracts/state-machines/contract-escrow.js +192 -170
- package/dist/cjs/apps/contracts/state-machines/contract-universal.js +46 -58
- package/dist/cjs/apps/corporate/index.js +2 -2
- package/dist/cjs/apps/corporate/state-machines/corp-board.js +500 -456
- package/dist/cjs/apps/corporate/state-machines/corp-entity.js +487 -361
- package/dist/cjs/apps/corporate/state-machines/corp-securities.js +769 -576
- package/dist/cjs/apps/corporate/state-machines/corp-shareholders.js +567 -557
- package/dist/cjs/apps/governance/index.js +21 -21
- package/dist/cjs/apps/governance/state-machines/dao-multisig.js +188 -209
- package/dist/cjs/apps/governance/state-machines/dao-reputation.js +181 -228
- package/dist/cjs/apps/governance/state-machines/dao-single.js +105 -88
- package/dist/cjs/apps/governance/state-machines/dao-token.js +199 -227
- package/dist/cjs/apps/governance/state-machines/governance-simple.js +231 -231
- package/dist/cjs/apps/governance/state-machines/governance-universal.js +64 -64
- package/dist/cjs/apps/identity/constants.js +55 -22
- package/dist/cjs/apps/identity/index.js +28 -12
- package/dist/cjs/apps/identity/state-machines/identity-agent.js +124 -158
- package/dist/cjs/apps/identity/state-machines/identity-oracle.js +158 -173
- package/dist/cjs/apps/identity/state-machines/identity-registry.js +262 -0
- package/dist/cjs/apps/identity/state-machines/identity-universal.js +51 -57
- package/dist/cjs/apps/identity/state-machines/index.js +3 -1
- package/dist/cjs/apps/index.js +22 -8
- package/dist/cjs/apps/lending/assets.js +247 -0
- package/dist/cjs/apps/lending/credit-scoring.js +87 -0
- package/dist/cjs/apps/lending/eligibility.js +105 -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 +433 -0
- package/dist/cjs/apps/markets/index.js +22 -12
- package/dist/cjs/apps/markets/state-machines/market-auction.js +116 -134
- package/dist/cjs/apps/markets/state-machines/market-crowdfund.js +131 -141
- package/dist/cjs/apps/markets/state-machines/market-group-buy.js +163 -184
- package/dist/cjs/apps/markets/state-machines/market-prediction.js +226 -233
- package/dist/cjs/apps/markets/state-machines/market-universal.js +65 -80
- package/dist/cjs/apps/oracles/index.js +3 -3
- package/dist/cjs/apps/privacy/index.js +67 -0
- package/dist/cjs/apps/privacy/state-machines/index.js +17 -0
- package/dist/cjs/apps/privacy/state-machines/mixer-ddhRing.js +286 -0
- package/dist/cjs/apps/privacy/state-machines/note-pool.js +476 -0
- package/dist/cjs/apps/staked-pool/assets.js +103 -0
- package/dist/cjs/apps/staked-pool/base.js +498 -0
- package/dist/cjs/apps/staked-pool/consumer.js +55 -0
- package/dist/cjs/apps/staked-pool/index.js +83 -0
- package/dist/cjs/apps/staked-pool/state-machines/index.js +12 -0
- package/dist/cjs/apps/staked-pool/state-machines/staked-pool-base.js +49 -0
- package/dist/cjs/apps/staked-pool/state-machines/staked-pool-oracle.js +131 -0
- package/dist/cjs/errors.js +3 -3
- package/dist/cjs/generated/google/protobuf/struct.js +5 -5
- package/dist/cjs/generated/google/protobuf/timestamp.js +1 -1
- 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 +51 -51
- package/dist/cjs/generated/ottochain/apps/corporate/v1/corporate.js +20 -21
- package/dist/cjs/generated/ottochain/apps/governance/v1/governance.js +14 -14
- package/dist/cjs/generated/ottochain/apps/identity/v1/attestation.js +5 -5
- package/dist/cjs/generated/ottochain/apps/identity/v1/identity.js +125 -131
- package/dist/cjs/generated/ottochain/apps/markets/v1/market.js +108 -108
- package/dist/cjs/generated/ottochain/v1/common.js +5 -5
- package/dist/cjs/generated/ottochain/v1/fiber.js +44 -6
- package/dist/cjs/generated/ottochain/v1/messages.js +1 -1
- package/dist/cjs/generated/ottochain/v1/records.js +1 -1
- package/dist/cjs/index.js +58 -7
- package/dist/cjs/openapi.js +2 -0
- package/dist/cjs/ottochain/drop-nulls.js +1 -2
- package/dist/cjs/ottochain/genesis-manifest.js +17 -11
- package/dist/cjs/ottochain/index.js +23 -13
- package/dist/cjs/ottochain/metagraph-client.js +81 -16
- package/dist/cjs/ottochain/snapshot.js +13 -16
- package/dist/cjs/ottochain/transaction.js +67 -14
- package/dist/cjs/ottochain/types.js +16 -2
- package/dist/cjs/privacy/index.js +14 -0
- package/dist/cjs/privacy/sealed-bid.js +213 -0
- package/dist/cjs/privacy/shield-app.js +131 -0
- package/dist/cjs/schema/effects.js +156 -0
- package/dist/cjs/schema/fiber-app.js +150 -15
- package/dist/cjs/schema/guard-lint.js +343 -0
- package/dist/cjs/schema/guards.js +246 -0
- package/dist/cjs/signing.js +80 -0
- package/dist/cjs/templates/asset-policy.js +190 -0
- package/dist/cjs/templates/index.js +86 -0
- package/dist/cjs/templates/machine.js +130 -0
- package/dist/cjs/templates/migration.js +39 -0
- package/dist/cjs/templates/state-shape.js +38 -0
- package/dist/cjs/types.js +2 -3
- package/dist/cjs/validation.js +9 -11
- 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/compute/index.js +29 -0
- package/dist/esm/apps/compute/state-machines/compute-rule110.js +161 -0
- package/dist/esm/apps/compute/state-machines/index.js +5 -0
- package/dist/esm/apps/contracts/index.js +9 -5
- package/dist/esm/apps/contracts/state-machines/contract-agreement.js +135 -162
- package/dist/esm/apps/contracts/state-machines/contract-escrow.js +193 -171
- package/dist/esm/apps/contracts/state-machines/contract-universal.js +47 -59
- package/dist/esm/apps/corporate/index.js +2 -2
- package/dist/esm/apps/corporate/state-machines/corp-board.js +501 -457
- package/dist/esm/apps/corporate/state-machines/corp-entity.js +488 -362
- package/dist/esm/apps/corporate/state-machines/corp-securities.js +770 -577
- package/dist/esm/apps/corporate/state-machines/corp-shareholders.js +568 -558
- package/dist/esm/apps/governance/index.js +10 -10
- package/dist/esm/apps/governance/state-machines/dao-multisig.js +189 -210
- package/dist/esm/apps/governance/state-machines/dao-reputation.js +182 -229
- package/dist/esm/apps/governance/state-machines/dao-single.js +106 -89
- package/dist/esm/apps/governance/state-machines/dao-token.js +200 -228
- package/dist/esm/apps/governance/state-machines/governance-simple.js +232 -232
- package/dist/esm/apps/governance/state-machines/governance-universal.js +65 -65
- package/dist/esm/apps/identity/constants.js +52 -21
- package/dist/esm/apps/identity/index.js +14 -9
- package/dist/esm/apps/identity/state-machines/identity-agent.js +125 -159
- package/dist/esm/apps/identity/state-machines/identity-oracle.js +159 -174
- package/dist/esm/apps/identity/state-machines/identity-registry.js +259 -0
- package/dist/esm/apps/identity/state-machines/identity-universal.js +52 -58
- package/dist/esm/apps/identity/state-machines/index.js +1 -0
- package/dist/esm/apps/index.js +9 -5
- package/dist/esm/apps/lending/assets.js +231 -0
- package/dist/esm/apps/lending/credit-scoring.js +81 -0
- package/dist/esm/apps/lending/eligibility.js +99 -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 +430 -0
- package/dist/esm/apps/markets/index.js +11 -7
- package/dist/esm/apps/markets/state-machines/market-auction.js +117 -135
- package/dist/esm/apps/markets/state-machines/market-crowdfund.js +132 -142
- package/dist/esm/apps/markets/state-machines/market-group-buy.js +164 -185
- package/dist/esm/apps/markets/state-machines/market-prediction.js +227 -234
- package/dist/esm/apps/markets/state-machines/market-universal.js +66 -81
- package/dist/esm/apps/oracles/index.js +3 -3
- package/dist/esm/apps/privacy/index.js +56 -0
- package/dist/esm/apps/privacy/state-machines/index.js +6 -0
- package/dist/esm/apps/privacy/state-machines/mixer-ddhRing.js +282 -0
- package/dist/esm/apps/privacy/state-machines/note-pool.js +470 -0
- package/dist/esm/apps/staked-pool/assets.js +91 -0
- package/dist/esm/apps/staked-pool/base.js +493 -0
- package/dist/esm/apps/staked-pool/consumer.js +49 -0
- package/dist/esm/apps/staked-pool/index.js +60 -0
- package/dist/esm/apps/staked-pool/state-machines/index.js +6 -0
- package/dist/esm/apps/staked-pool/state-machines/staked-pool-base.js +46 -0
- package/dist/esm/apps/staked-pool/state-machines/staked-pool-oracle.js +127 -0
- package/dist/esm/generated/google/protobuf/struct.js +1 -1
- package/dist/esm/generated/google/protobuf/timestamp.js +1 -1
- 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 +47 -47
- package/dist/esm/generated/ottochain/apps/corporate/v1/corporate.js +1 -1
- package/dist/esm/generated/ottochain/apps/governance/v1/governance.js +1 -1
- package/dist/esm/generated/ottochain/apps/identity/v1/attestation.js +1 -1
- package/dist/esm/generated/ottochain/apps/identity/v1/identity.js +115 -121
- package/dist/esm/generated/ottochain/apps/markets/v1/market.js +101 -101
- package/dist/esm/generated/ottochain/v1/common.js +1 -1
- package/dist/esm/generated/ottochain/v1/fiber.js +40 -2
- package/dist/esm/generated/ottochain/v1/messages.js +1 -1
- package/dist/esm/generated/ottochain/v1/records.js +1 -1
- package/dist/esm/index.js +28 -3
- package/dist/esm/openapi.js +1 -0
- package/dist/esm/ottochain/genesis-manifest.js +15 -9
- package/dist/esm/ottochain/index.js +2 -3
- package/dist/esm/ottochain/metagraph-client.js +81 -16
- package/dist/esm/ottochain/snapshot.js +6 -8
- package/dist/esm/ottochain/transaction.js +51 -3
- package/dist/esm/ottochain/types.js +15 -1
- package/dist/esm/privacy/index.js +6 -0
- package/dist/esm/privacy/sealed-bid.js +209 -0
- package/dist/esm/privacy/shield-app.js +127 -0
- package/dist/esm/schema/effects.js +145 -0
- package/dist/esm/schema/fiber-app.js +139 -8
- package/dist/esm/schema/guard-lint.js +337 -0
- package/dist/esm/schema/guards.js +228 -0
- package/dist/esm/signing.js +74 -0
- package/dist/esm/templates/asset-policy.js +182 -0
- package/dist/esm/templates/index.js +41 -0
- package/dist/esm/templates/machine.js +125 -0
- package/dist/esm/templates/migration.js +34 -0
- package/dist/esm/templates/state-shape.js +34 -0
- package/dist/esm/validation.js +1 -3
- 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/compute/index.d.ts +176 -0
- package/dist/types/apps/compute/state-machines/compute-rule110.d.ts +157 -0
- package/dist/types/apps/compute/state-machines/index.d.ts +5 -0
- package/dist/types/apps/contracts/index.d.ts +81 -221
- package/dist/types/apps/contracts/state-machines/contract-agreement.d.ts +23 -98
- package/dist/types/apps/contracts/state-machines/contract-escrow.d.ts +49 -115
- package/dist/types/apps/contracts/state-machines/contract-universal.d.ts +4 -4
- package/dist/types/apps/corporate/index.d.ts +1176 -440
- package/dist/types/apps/corporate/state-machines/corp-board.d.ts +271 -135
- package/dist/types/apps/corporate/state-machines/corp-entity.d.ts +279 -74
- package/dist/types/apps/corporate/state-machines/corp-securities.d.ts +373 -149
- package/dist/types/apps/corporate/state-machines/corp-shareholders.d.ts +252 -80
- package/dist/types/apps/governance/index.d.ts +368 -470
- package/dist/types/apps/governance/state-machines/dao-multisig.d.ts +92 -107
- package/dist/types/apps/governance/state-machines/dao-reputation.d.ts +61 -85
- package/dist/types/apps/governance/state-machines/dao-single.d.ts +25 -47
- package/dist/types/apps/governance/state-machines/dao-token.d.ts +79 -68
- package/dist/types/apps/governance/state-machines/governance-simple.d.ts +95 -125
- package/dist/types/apps/governance/state-machines/governance-universal.d.ts +6 -6
- package/dist/types/apps/identity/constants.d.ts +33 -5
- package/dist/types/apps/identity/index.d.ts +415 -131
- package/dist/types/apps/identity/state-machines/identity-agent.d.ts +23 -23
- package/dist/types/apps/identity/state-machines/identity-oracle.d.ts +27 -98
- package/dist/types/apps/identity/state-machines/identity-registry.d.ts +379 -0
- package/dist/types/apps/identity/state-machines/identity-universal.d.ts +4 -4
- package/dist/types/apps/identity/state-machines/index.d.ts +1 -0
- package/dist/types/apps/index.d.ts +9 -5
- 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 +556 -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 +536 -0
- package/dist/types/apps/markets/index.d.ts +181 -276
- package/dist/types/apps/markets/state-machines/market-auction.d.ts +25 -49
- package/dist/types/apps/markets/state-machines/market-crowdfund.d.ts +35 -53
- package/dist/types/apps/markets/state-machines/market-group-buy.d.ts +35 -61
- package/dist/types/apps/markets/state-machines/market-prediction.d.ts +65 -86
- package/dist/types/apps/markets/state-machines/market-universal.d.ts +12 -12
- package/dist/types/apps/oracles/index.d.ts +1 -1
- package/dist/types/apps/privacy/index.d.ts +328 -0
- package/dist/types/apps/privacy/state-machines/index.d.ts +6 -0
- package/dist/types/apps/privacy/state-machines/mixer-ddhRing.d.ts +337 -0
- package/dist/types/apps/privacy/state-machines/note-pool.d.ts +196 -0
- package/dist/types/apps/staked-pool/assets.d.ts +53 -0
- package/dist/types/apps/staked-pool/base.d.ts +80 -0
- package/dist/types/apps/staked-pool/consumer.d.ts +29 -0
- package/dist/types/apps/staked-pool/index.d.ts +51 -0
- package/dist/types/apps/staked-pool/state-machines/index.d.ts +6 -0
- package/dist/types/apps/staked-pool/state-machines/staked-pool-base.d.ts +8 -0
- package/dist/types/apps/staked-pool/state-machines/staked-pool-oracle.d.ts +34 -0
- package/dist/types/generated/index.d.ts +5 -5
- package/dist/types/generated/openapi.d.ts +1270 -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/fiber.d.ts +7 -0
- package/dist/types/index.d.ts +7 -3
- package/dist/types/openapi.d.ts +24 -0
- package/dist/types/ottochain/genesis-manifest.d.ts +11 -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 +41 -1
- package/dist/types/ottochain/types.d.ts +336 -31
- 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 +141 -0
- package/dist/types/schema/fiber-app.d.ts +282 -2
- package/dist/types/schema/guard-lint.d.ts +111 -0
- package/dist/types/schema/guards.d.ts +146 -0
- package/dist/types/signing.d.ts +45 -0
- package/dist/types/templates/asset-policy.d.ts +119 -0
- package/dist/types/templates/index.d.ts +26 -0
- package/dist/types/templates/machine.d.ts +139 -0
- package/dist/types/templates/migration.d.ts +34 -0
- package/dist/types/templates/state-shape.d.ts +30 -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 +47 -15
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ottochain/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "TypeScript SDK for ottochain metagraph operations - signing, encoding, and network interactions",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -21,6 +21,16 @@
|
|
|
21
21
|
"require": "./dist/cjs/ottochain/index.js",
|
|
22
22
|
"types": "./dist/types/ottochain/index.d.ts"
|
|
23
23
|
},
|
|
24
|
+
"./zk": {
|
|
25
|
+
"import": "./dist/esm/zk/index.js",
|
|
26
|
+
"require": "./dist/cjs/zk/index.js",
|
|
27
|
+
"types": "./dist/types/zk/index.d.ts"
|
|
28
|
+
},
|
|
29
|
+
"./templates": {
|
|
30
|
+
"import": "./dist/esm/templates/index.js",
|
|
31
|
+
"require": "./dist/cjs/templates/index.js",
|
|
32
|
+
"types": "./dist/types/templates/index.d.ts"
|
|
33
|
+
},
|
|
24
34
|
"./apps/identity": {
|
|
25
35
|
"import": "./dist/esm/apps/identity/index.js",
|
|
26
36
|
"require": "./dist/cjs/apps/identity/index.js",
|
|
@@ -36,6 +46,11 @@
|
|
|
36
46
|
"require": "./dist/cjs/apps/markets/index.js",
|
|
37
47
|
"types": "./dist/types/apps/markets/index.d.ts"
|
|
38
48
|
},
|
|
49
|
+
"./apps/lending": {
|
|
50
|
+
"import": "./dist/esm/apps/lending/index.js",
|
|
51
|
+
"require": "./dist/cjs/apps/lending/index.js",
|
|
52
|
+
"types": "./dist/types/apps/lending/index.d.ts"
|
|
53
|
+
},
|
|
39
54
|
"./apps/oracles": {
|
|
40
55
|
"import": "./dist/esm/apps/oracles/index.js",
|
|
41
56
|
"require": "./dist/cjs/apps/oracles/index.js",
|
|
@@ -51,6 +66,16 @@
|
|
|
51
66
|
"require": "./dist/cjs/apps/corporate/index.js",
|
|
52
67
|
"types": "./dist/types/apps/corporate/index.d.ts"
|
|
53
68
|
},
|
|
69
|
+
"./apps/compute": {
|
|
70
|
+
"import": "./dist/esm/apps/compute/index.js",
|
|
71
|
+
"require": "./dist/cjs/apps/compute/index.js",
|
|
72
|
+
"types": "./dist/types/apps/compute/index.d.ts"
|
|
73
|
+
},
|
|
74
|
+
"./apps/staked-pool": {
|
|
75
|
+
"import": "./dist/esm/apps/staked-pool/index.js",
|
|
76
|
+
"require": "./dist/cjs/apps/staked-pool/index.js",
|
|
77
|
+
"types": "./dist/types/apps/staked-pool/index.d.ts"
|
|
78
|
+
},
|
|
54
79
|
"./apps": {
|
|
55
80
|
"import": "./dist/esm/apps/index.js",
|
|
56
81
|
"require": "./dist/cjs/apps/index.js",
|
|
@@ -76,7 +101,11 @@
|
|
|
76
101
|
"test:coverage": "jest --coverage",
|
|
77
102
|
"lint": "eslint src tests",
|
|
78
103
|
"format": "prettier --write src tests",
|
|
104
|
+
"format:check": "prettier --check src tests",
|
|
79
105
|
"generate": "buf generate",
|
|
106
|
+
"fetch:openapi": "node scripts/fetch-openapi.mjs",
|
|
107
|
+
"gen:openapi": "openapi-typescript openapi/ottochain-openapi-ml0.json -o src/generated/openapi.ts",
|
|
108
|
+
"sync:openapi": "npm run fetch:openapi && npm run gen:openapi",
|
|
80
109
|
"lint:proto": "buf lint",
|
|
81
110
|
"docs": "typedoc",
|
|
82
111
|
"docs:watch": "typedoc --watch",
|
|
@@ -106,32 +135,35 @@
|
|
|
106
135
|
"url": "https://github.com/ottobot-ai/ottochain-sdk/issues"
|
|
107
136
|
},
|
|
108
137
|
"dependencies": {
|
|
109
|
-
"@bufbuild/protobuf": "^2.12.
|
|
110
|
-
"@constellation-network/metagraph-sdk": "
|
|
138
|
+
"@bufbuild/protobuf": "^2.12.1",
|
|
139
|
+
"@constellation-network/metagraph-sdk": "1.8.0-rc.7",
|
|
140
|
+
"@constellation-network/metagraph-sdk-jlvm": "1.8.0-rc.7",
|
|
141
|
+
"@noble/hashes": "^1.8.0",
|
|
111
142
|
"@stardust-collective/dag4": "^2.6.0",
|
|
112
143
|
"@stardust-collective/dag4-keystore": "^2.6.0",
|
|
113
144
|
"canonicalize": "^3.0.0",
|
|
114
145
|
"js-sha256": "^0.11.1",
|
|
115
146
|
"js-sha512": "^0.9.0",
|
|
116
|
-
"zod": "^
|
|
147
|
+
"zod": "^4.4.3"
|
|
117
148
|
},
|
|
118
149
|
"devDependencies": {
|
|
119
|
-
"@babel/preset-env": "^7.29.
|
|
120
|
-
"@commitlint/cli": "^
|
|
121
|
-
"@commitlint/config-conventional": "^
|
|
122
|
-
"@eslint/js": "^
|
|
150
|
+
"@babel/preset-env": "^7.29.7",
|
|
151
|
+
"@commitlint/cli": "^21.1.0",
|
|
152
|
+
"@commitlint/config-conventional": "^21.1.0",
|
|
153
|
+
"@eslint/js": "^10.0.1",
|
|
123
154
|
"@jest/globals": "^30.3.0",
|
|
124
155
|
"@types/jest": "^30.0.0",
|
|
125
|
-
"@types/node": "^
|
|
126
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
127
|
-
"@typescript-eslint/parser": "^8.
|
|
128
|
-
"eslint": "^
|
|
156
|
+
"@types/node": "^26.0.1",
|
|
157
|
+
"@typescript-eslint/eslint-plugin": "^8.62.0",
|
|
158
|
+
"@typescript-eslint/parser": "^8.62.0",
|
|
159
|
+
"eslint": "^10.6.0",
|
|
129
160
|
"jest": "^30.3.0",
|
|
130
|
-
"
|
|
161
|
+
"openapi-typescript": "^7.13.0",
|
|
162
|
+
"prettier": "^3.9.1",
|
|
131
163
|
"ts-jest": "29.4.9",
|
|
132
|
-
"ts-proto": "^2.11.
|
|
164
|
+
"ts-proto": "^2.11.9",
|
|
133
165
|
"typedoc": "^0.28.19",
|
|
134
|
-
"typescript": "^
|
|
166
|
+
"typescript": "^6.0.3"
|
|
135
167
|
},
|
|
136
168
|
"peerDependencies": {
|
|
137
169
|
"@stardust-collective/dag4": "^2.6.0"
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Normalize OttoChain Messages for Signing
|
|
4
|
-
*
|
|
5
|
-
* Converts OttoChain message objects to the wire format expected by the
|
|
6
|
-
* Scala metagraph. Specifically, ensures all `Option[A]=None` fields are
|
|
7
|
-
* present as explicit `null` values, matching what circe's magnolia encoder
|
|
8
|
-
* produces on the Scala side.
|
|
9
|
-
*
|
|
10
|
-
* This is necessary because metakit's `JsonBinaryCodec.deriveDataUpdate`
|
|
11
|
-
* (rc.8) canonicalizes the circe-encoded JSON **including null fields**.
|
|
12
|
-
* If the TypeScript client omits optional fields (undefined), the canonical
|
|
13
|
-
* JSON won't match and signature verification will fail.
|
|
14
|
-
*
|
|
15
|
-
* Schema mapping (Scala → TypeScript):
|
|
16
|
-
* - `Option[A] = None` → `null` (must be explicit, not undefined/absent)
|
|
17
|
-
* - `Option[A] = Some(v)` → `v`
|
|
18
|
-
* - `List.empty` → `[]`
|
|
19
|
-
* - `Map.empty` → `{}`
|
|
20
|
-
*/
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.normalizeMessage = exports.normalizeArchiveStateMachine = exports.normalizeTransitionStateMachine = exports.normalizeCreateStateMachine = void 0;
|
|
23
|
-
/**
|
|
24
|
-
* Normalize a State object for wire format
|
|
25
|
-
*/
|
|
26
|
-
function normalizeState(state) {
|
|
27
|
-
return {
|
|
28
|
-
id: state.id,
|
|
29
|
-
isFinal: state.isFinal ?? false,
|
|
30
|
-
metadata: state.metadata ?? null,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Normalize a Transition object for wire format
|
|
35
|
-
*
|
|
36
|
-
* Scala Transition schema:
|
|
37
|
-
* from: StateId (required)
|
|
38
|
-
* to: StateId (required)
|
|
39
|
-
* eventName: String (required)
|
|
40
|
-
* guard: JsonLogicExpression (required)
|
|
41
|
-
* effect: JsonLogicExpression (required)
|
|
42
|
-
* dependencies: Set[UUID] = Set.empty
|
|
43
|
-
*
|
|
44
|
-
* `dependencies` serializes as `[]` when empty (default). Both `guard`
|
|
45
|
-
* and `effect` are required non-optional fields.
|
|
46
|
-
*/
|
|
47
|
-
function normalizeTransition(t) {
|
|
48
|
-
return {
|
|
49
|
-
from: t.from,
|
|
50
|
-
to: t.to,
|
|
51
|
-
eventName: t.eventName,
|
|
52
|
-
guard: t.guard,
|
|
53
|
-
effect: t.effect,
|
|
54
|
-
dependencies: t.dependencies ?? [],
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Check if a value looks like FiberAppMetadata (has 'name' and 'app' fields).
|
|
59
|
-
* These TypeScript-only fields should be stripped before sending to metagraph.
|
|
60
|
-
*/
|
|
61
|
-
function isFiberAppMetadata(value) {
|
|
62
|
-
return (typeof value === 'object' &&
|
|
63
|
-
value !== null &&
|
|
64
|
-
'name' in value &&
|
|
65
|
-
'app' in value);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Normalize a StateMachineDefinition for wire format
|
|
69
|
-
*
|
|
70
|
-
* Strips FiberAppMetadata from the definition — the Scala schema expects
|
|
71
|
-
* `metadata: Option[Json] = None`, not the TypeScript app metadata object.
|
|
72
|
-
*/
|
|
73
|
-
function normalizeDefinition(def) {
|
|
74
|
-
const states = def.states;
|
|
75
|
-
const normalizedStates = {};
|
|
76
|
-
if (states) {
|
|
77
|
-
for (const [key, state] of Object.entries(states)) {
|
|
78
|
-
normalizedStates[key] = normalizeState(state);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
const transitions = def.transitions ?? [];
|
|
82
|
-
// Strip FiberAppMetadata if present — it's TypeScript-only, not part of wire format.
|
|
83
|
-
// The Scala schema has `metadata: Option[Json] = None`, so use null for wire format.
|
|
84
|
-
const wireMetadata = isFiberAppMetadata(def.metadata) ? null : (def.metadata ?? null);
|
|
85
|
-
return {
|
|
86
|
-
states: normalizedStates,
|
|
87
|
-
initialState: def.initialState,
|
|
88
|
-
transitions: transitions.map(normalizeTransition),
|
|
89
|
-
metadata: wireMetadata,
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Normalize a CreateStateMachine message for wire format
|
|
94
|
-
*
|
|
95
|
-
* Ensures all Option/default fields are explicit in wire format:
|
|
96
|
-
* - definition.metadata → null when absent
|
|
97
|
-
* - definition.states[*].metadata → null when absent
|
|
98
|
-
* - definition.transitions[*].dependencies → [] when absent
|
|
99
|
-
* - parentFiberId → null when absent
|
|
100
|
-
*
|
|
101
|
-
* @example
|
|
102
|
-
* ```typescript
|
|
103
|
-
* const message = normalizeCreateStateMachine({
|
|
104
|
-
* fiberId: '...',
|
|
105
|
-
* definition: { states: { INIT: { id: { value: 'INIT' }, isFinal: false } }, ... },
|
|
106
|
-
* initialData: {}
|
|
107
|
-
* });
|
|
108
|
-
* // message now has parentFiberId: null, definition.metadata: null, etc.
|
|
109
|
-
* ```
|
|
110
|
-
*/
|
|
111
|
-
function normalizeCreateStateMachine(msg) {
|
|
112
|
-
return {
|
|
113
|
-
fiberId: msg.fiberId,
|
|
114
|
-
definition: normalizeDefinition(msg.definition),
|
|
115
|
-
initialData: msg.initialData ?? {},
|
|
116
|
-
parentFiberId: msg.parentFiberId ?? null,
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
exports.normalizeCreateStateMachine = normalizeCreateStateMachine;
|
|
120
|
-
/**
|
|
121
|
-
* Normalize a TransitionStateMachine message for wire format
|
|
122
|
-
*
|
|
123
|
-
* Scala TransitionStateMachine schema:
|
|
124
|
-
* fiberId: UUID (required)
|
|
125
|
-
* eventName: String (required)
|
|
126
|
-
* payload: JsonLogicValue (required)
|
|
127
|
-
* targetSequenceNumber: FiberOrdinal (required)
|
|
128
|
-
*
|
|
129
|
-
* All fields are required — no Option types, so no null normalization needed.
|
|
130
|
-
*/
|
|
131
|
-
function normalizeTransitionStateMachine(msg) {
|
|
132
|
-
return {
|
|
133
|
-
fiberId: msg.fiberId,
|
|
134
|
-
eventName: msg.eventName,
|
|
135
|
-
payload: msg.payload,
|
|
136
|
-
targetSequenceNumber: msg.targetSequenceNumber,
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
exports.normalizeTransitionStateMachine = normalizeTransitionStateMachine;
|
|
140
|
-
/**
|
|
141
|
-
* Normalize an ArchiveStateMachine message for wire format
|
|
142
|
-
*
|
|
143
|
-
* Scala ArchiveStateMachine schema:
|
|
144
|
-
* fiberId: UUID (required)
|
|
145
|
-
* targetSequenceNumber: FiberOrdinal (required)
|
|
146
|
-
*
|
|
147
|
-
* All fields are required — no Option types, so no null normalization needed.
|
|
148
|
-
*/
|
|
149
|
-
function normalizeArchiveStateMachine(msg) {
|
|
150
|
-
return {
|
|
151
|
-
fiberId: msg.fiberId,
|
|
152
|
-
targetSequenceNumber: msg.targetSequenceNumber,
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
exports.normalizeArchiveStateMachine = normalizeArchiveStateMachine;
|
|
156
|
-
/**
|
|
157
|
-
* Normalize any OttochainMessage wrapper for wire format.
|
|
158
|
-
*
|
|
159
|
-
* Detects the message type from the wrapper key and applies the
|
|
160
|
-
* appropriate normalization.
|
|
161
|
-
*
|
|
162
|
-
* @param message - OttochainMessage in wrapper format: `{ CreateStateMachine: {...} }`
|
|
163
|
-
* @returns Normalized message with all Option fields as explicit null
|
|
164
|
-
*
|
|
165
|
-
* @example
|
|
166
|
-
* ```typescript
|
|
167
|
-
* const normalized = normalizeMessage({
|
|
168
|
-
* CreateStateMachine: { fiberId: '...', definition: {...}, initialData: {} }
|
|
169
|
-
* });
|
|
170
|
-
* const signed = await signDataUpdate(normalized, privateKey);
|
|
171
|
-
* ```
|
|
172
|
-
*/
|
|
173
|
-
function normalizeMessage(message) {
|
|
174
|
-
if ('CreateStateMachine' in message) {
|
|
175
|
-
return { CreateStateMachine: normalizeCreateStateMachine(message.CreateStateMachine) };
|
|
176
|
-
}
|
|
177
|
-
if ('TransitionStateMachine' in message) {
|
|
178
|
-
return { TransitionStateMachine: normalizeTransitionStateMachine(message.TransitionStateMachine) };
|
|
179
|
-
}
|
|
180
|
-
if ('ArchiveStateMachine' in message) {
|
|
181
|
-
return { ArchiveStateMachine: normalizeArchiveStateMachine(message.ArchiveStateMachine) };
|
|
182
|
-
}
|
|
183
|
-
// CreateScript and InvokeScript — pass through (no optional fields)
|
|
184
|
-
return message;
|
|
185
|
-
}
|
|
186
|
-
exports.normalizeMessage = normalizeMessage;
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Normalize OttoChain Messages for Signing
|
|
3
|
-
*
|
|
4
|
-
* Converts OttoChain message objects to the wire format expected by the
|
|
5
|
-
* Scala metagraph. Specifically, ensures all `Option[A]=None` fields are
|
|
6
|
-
* present as explicit `null` values, matching what circe's magnolia encoder
|
|
7
|
-
* produces on the Scala side.
|
|
8
|
-
*
|
|
9
|
-
* This is necessary because metakit's `JsonBinaryCodec.deriveDataUpdate`
|
|
10
|
-
* (rc.8) canonicalizes the circe-encoded JSON **including null fields**.
|
|
11
|
-
* If the TypeScript client omits optional fields (undefined), the canonical
|
|
12
|
-
* JSON won't match and signature verification will fail.
|
|
13
|
-
*
|
|
14
|
-
* Schema mapping (Scala → TypeScript):
|
|
15
|
-
* - `Option[A] = None` → `null` (must be explicit, not undefined/absent)
|
|
16
|
-
* - `Option[A] = Some(v)` → `v`
|
|
17
|
-
* - `List.empty` → `[]`
|
|
18
|
-
* - `Map.empty` → `{}`
|
|
19
|
-
*/
|
|
20
|
-
/**
|
|
21
|
-
* Normalize a State object for wire format
|
|
22
|
-
*/
|
|
23
|
-
function normalizeState(state) {
|
|
24
|
-
return {
|
|
25
|
-
id: state.id,
|
|
26
|
-
isFinal: state.isFinal ?? false,
|
|
27
|
-
metadata: state.metadata ?? null,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Normalize a Transition object for wire format
|
|
32
|
-
*
|
|
33
|
-
* Scala Transition schema:
|
|
34
|
-
* from: StateId (required)
|
|
35
|
-
* to: StateId (required)
|
|
36
|
-
* eventName: String (required)
|
|
37
|
-
* guard: JsonLogicExpression (required)
|
|
38
|
-
* effect: JsonLogicExpression (required)
|
|
39
|
-
* dependencies: Set[UUID] = Set.empty
|
|
40
|
-
*
|
|
41
|
-
* `dependencies` serializes as `[]` when empty (default). Both `guard`
|
|
42
|
-
* and `effect` are required non-optional fields.
|
|
43
|
-
*/
|
|
44
|
-
function normalizeTransition(t) {
|
|
45
|
-
return {
|
|
46
|
-
from: t.from,
|
|
47
|
-
to: t.to,
|
|
48
|
-
eventName: t.eventName,
|
|
49
|
-
guard: t.guard,
|
|
50
|
-
effect: t.effect,
|
|
51
|
-
dependencies: t.dependencies ?? [],
|
|
52
|
-
};
|
|
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
|
-
}
|
|
64
|
-
/**
|
|
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.
|
|
69
|
-
*/
|
|
70
|
-
function normalizeDefinition(def) {
|
|
71
|
-
const states = def.states;
|
|
72
|
-
const normalizedStates = {};
|
|
73
|
-
if (states) {
|
|
74
|
-
for (const [key, state] of Object.entries(states)) {
|
|
75
|
-
normalizedStates[key] = normalizeState(state);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
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);
|
|
82
|
-
return {
|
|
83
|
-
states: normalizedStates,
|
|
84
|
-
initialState: def.initialState,
|
|
85
|
-
transitions: transitions.map(normalizeTransition),
|
|
86
|
-
metadata: wireMetadata,
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Normalize a CreateStateMachine message for wire format
|
|
91
|
-
*
|
|
92
|
-
* Ensures all Option/default fields are explicit in wire format:
|
|
93
|
-
* - definition.metadata → null when absent
|
|
94
|
-
* - definition.states[*].metadata → null when absent
|
|
95
|
-
* - definition.transitions[*].dependencies → [] when absent
|
|
96
|
-
* - parentFiberId → null when absent
|
|
97
|
-
*
|
|
98
|
-
* @example
|
|
99
|
-
* ```typescript
|
|
100
|
-
* const message = normalizeCreateStateMachine({
|
|
101
|
-
* fiberId: '...',
|
|
102
|
-
* definition: { states: { INIT: { id: { value: 'INIT' }, isFinal: false } }, ... },
|
|
103
|
-
* initialData: {}
|
|
104
|
-
* });
|
|
105
|
-
* // message now has parentFiberId: null, definition.metadata: null, etc.
|
|
106
|
-
* ```
|
|
107
|
-
*/
|
|
108
|
-
export function normalizeCreateStateMachine(msg) {
|
|
109
|
-
return {
|
|
110
|
-
fiberId: msg.fiberId,
|
|
111
|
-
definition: normalizeDefinition(msg.definition),
|
|
112
|
-
initialData: msg.initialData ?? {},
|
|
113
|
-
parentFiberId: msg.parentFiberId ?? null,
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Normalize a TransitionStateMachine message for wire format
|
|
118
|
-
*
|
|
119
|
-
* Scala TransitionStateMachine schema:
|
|
120
|
-
* fiberId: UUID (required)
|
|
121
|
-
* eventName: String (required)
|
|
122
|
-
* payload: JsonLogicValue (required)
|
|
123
|
-
* targetSequenceNumber: FiberOrdinal (required)
|
|
124
|
-
*
|
|
125
|
-
* All fields are required — no Option types, so no null normalization needed.
|
|
126
|
-
*/
|
|
127
|
-
export function normalizeTransitionStateMachine(msg) {
|
|
128
|
-
return {
|
|
129
|
-
fiberId: msg.fiberId,
|
|
130
|
-
eventName: msg.eventName,
|
|
131
|
-
payload: msg.payload,
|
|
132
|
-
targetSequenceNumber: msg.targetSequenceNumber,
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Normalize an ArchiveStateMachine message for wire format
|
|
137
|
-
*
|
|
138
|
-
* Scala ArchiveStateMachine schema:
|
|
139
|
-
* fiberId: UUID (required)
|
|
140
|
-
* targetSequenceNumber: FiberOrdinal (required)
|
|
141
|
-
*
|
|
142
|
-
* All fields are required — no Option types, so no null normalization needed.
|
|
143
|
-
*/
|
|
144
|
-
export function normalizeArchiveStateMachine(msg) {
|
|
145
|
-
return {
|
|
146
|
-
fiberId: msg.fiberId,
|
|
147
|
-
targetSequenceNumber: msg.targetSequenceNumber,
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Normalize any OttochainMessage wrapper for wire format.
|
|
152
|
-
*
|
|
153
|
-
* Detects the message type from the wrapper key and applies the
|
|
154
|
-
* appropriate normalization.
|
|
155
|
-
*
|
|
156
|
-
* @param message - OttochainMessage in wrapper format: `{ CreateStateMachine: {...} }`
|
|
157
|
-
* @returns Normalized message with all Option fields as explicit null
|
|
158
|
-
*
|
|
159
|
-
* @example
|
|
160
|
-
* ```typescript
|
|
161
|
-
* const normalized = normalizeMessage({
|
|
162
|
-
* CreateStateMachine: { fiberId: '...', definition: {...}, initialData: {} }
|
|
163
|
-
* });
|
|
164
|
-
* const signed = await signDataUpdate(normalized, privateKey);
|
|
165
|
-
* ```
|
|
166
|
-
*/
|
|
167
|
-
export function normalizeMessage(message) {
|
|
168
|
-
if ('CreateStateMachine' in message) {
|
|
169
|
-
return { CreateStateMachine: normalizeCreateStateMachine(message.CreateStateMachine) };
|
|
170
|
-
}
|
|
171
|
-
if ('TransitionStateMachine' in message) {
|
|
172
|
-
return { TransitionStateMachine: normalizeTransitionStateMachine(message.TransitionStateMachine) };
|
|
173
|
-
}
|
|
174
|
-
if ('ArchiveStateMachine' in message) {
|
|
175
|
-
return { ArchiveStateMachine: normalizeArchiveStateMachine(message.ArchiveStateMachine) };
|
|
176
|
-
}
|
|
177
|
-
// CreateScript and InvokeScript — pass through (no optional fields)
|
|
178
|
-
return message;
|
|
179
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Normalize OttoChain Messages for Signing
|
|
3
|
-
*
|
|
4
|
-
* Converts OttoChain message objects to the wire format expected by the
|
|
5
|
-
* Scala metagraph. Specifically, ensures all `Option[A]=None` fields are
|
|
6
|
-
* present as explicit `null` values, matching what circe's magnolia encoder
|
|
7
|
-
* produces on the Scala side.
|
|
8
|
-
*
|
|
9
|
-
* This is necessary because metakit's `JsonBinaryCodec.deriveDataUpdate`
|
|
10
|
-
* (rc.8) canonicalizes the circe-encoded JSON **including null fields**.
|
|
11
|
-
* If the TypeScript client omits optional fields (undefined), the canonical
|
|
12
|
-
* JSON won't match and signature verification will fail.
|
|
13
|
-
*
|
|
14
|
-
* Schema mapping (Scala → TypeScript):
|
|
15
|
-
* - `Option[A] = None` → `null` (must be explicit, not undefined/absent)
|
|
16
|
-
* - `Option[A] = Some(v)` → `v`
|
|
17
|
-
* - `List.empty` → `[]`
|
|
18
|
-
* - `Map.empty` → `{}`
|
|
19
|
-
*/
|
|
20
|
-
/**
|
|
21
|
-
* Normalize a CreateStateMachine message for wire format
|
|
22
|
-
*
|
|
23
|
-
* Ensures all Option/default fields are explicit in wire format:
|
|
24
|
-
* - definition.metadata → null when absent
|
|
25
|
-
* - definition.states[*].metadata → null when absent
|
|
26
|
-
* - definition.transitions[*].dependencies → [] when absent
|
|
27
|
-
* - parentFiberId → null when absent
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```typescript
|
|
31
|
-
* const message = normalizeCreateStateMachine({
|
|
32
|
-
* fiberId: '...',
|
|
33
|
-
* definition: { states: { INIT: { id: { value: 'INIT' }, isFinal: false } }, ... },
|
|
34
|
-
* initialData: {}
|
|
35
|
-
* });
|
|
36
|
-
* // message now has parentFiberId: null, definition.metadata: null, etc.
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export declare function normalizeCreateStateMachine(msg: Record<string, unknown>): Record<string, unknown>;
|
|
40
|
-
/**
|
|
41
|
-
* Normalize a TransitionStateMachine message for wire format
|
|
42
|
-
*
|
|
43
|
-
* Scala TransitionStateMachine schema:
|
|
44
|
-
* fiberId: UUID (required)
|
|
45
|
-
* eventName: String (required)
|
|
46
|
-
* payload: JsonLogicValue (required)
|
|
47
|
-
* targetSequenceNumber: FiberOrdinal (required)
|
|
48
|
-
*
|
|
49
|
-
* All fields are required — no Option types, so no null normalization needed.
|
|
50
|
-
*/
|
|
51
|
-
export declare function normalizeTransitionStateMachine(msg: Record<string, unknown>): Record<string, unknown>;
|
|
52
|
-
/**
|
|
53
|
-
* Normalize an ArchiveStateMachine message for wire format
|
|
54
|
-
*
|
|
55
|
-
* Scala ArchiveStateMachine schema:
|
|
56
|
-
* fiberId: UUID (required)
|
|
57
|
-
* targetSequenceNumber: FiberOrdinal (required)
|
|
58
|
-
*
|
|
59
|
-
* All fields are required — no Option types, so no null normalization needed.
|
|
60
|
-
*/
|
|
61
|
-
export declare function normalizeArchiveStateMachine(msg: Record<string, unknown>): Record<string, unknown>;
|
|
62
|
-
/**
|
|
63
|
-
* Normalize any OttochainMessage wrapper for wire format.
|
|
64
|
-
*
|
|
65
|
-
* Detects the message type from the wrapper key and applies the
|
|
66
|
-
* appropriate normalization.
|
|
67
|
-
*
|
|
68
|
-
* @param message - OttochainMessage in wrapper format: `{ CreateStateMachine: {...} }`
|
|
69
|
-
* @returns Normalized message with all Option fields as explicit null
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
* ```typescript
|
|
73
|
-
* const normalized = normalizeMessage({
|
|
74
|
-
* CreateStateMachine: { fiberId: '...', definition: {...}, initialData: {} }
|
|
75
|
-
* });
|
|
76
|
-
* const signed = await signDataUpdate(normalized, privateKey);
|
|
77
|
-
* ```
|
|
78
|
-
*/
|
|
79
|
-
export declare function normalizeMessage(message: Record<string, unknown>): Record<string, unknown>;
|