@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.
Files changed (287) hide show
  1. package/dist/cjs/apps/compute/index.js +33 -0
  2. package/dist/cjs/apps/compute/state-machines/compute-rule110.js +164 -0
  3. package/dist/cjs/apps/compute/state-machines/index.js +9 -0
  4. package/dist/cjs/apps/contracts/index.js +16 -9
  5. package/dist/cjs/apps/contracts/state-machines/contract-agreement.js +134 -161
  6. package/dist/cjs/apps/contracts/state-machines/contract-escrow.js +192 -170
  7. package/dist/cjs/apps/contracts/state-machines/contract-universal.js +46 -58
  8. package/dist/cjs/apps/corporate/index.js +2 -2
  9. package/dist/cjs/apps/corporate/state-machines/corp-board.js +500 -456
  10. package/dist/cjs/apps/corporate/state-machines/corp-entity.js +487 -361
  11. package/dist/cjs/apps/corporate/state-machines/corp-securities.js +769 -576
  12. package/dist/cjs/apps/corporate/state-machines/corp-shareholders.js +567 -557
  13. package/dist/cjs/apps/governance/index.js +21 -21
  14. package/dist/cjs/apps/governance/state-machines/dao-multisig.js +188 -209
  15. package/dist/cjs/apps/governance/state-machines/dao-reputation.js +181 -228
  16. package/dist/cjs/apps/governance/state-machines/dao-single.js +105 -88
  17. package/dist/cjs/apps/governance/state-machines/dao-token.js +199 -227
  18. package/dist/cjs/apps/governance/state-machines/governance-simple.js +231 -231
  19. package/dist/cjs/apps/governance/state-machines/governance-universal.js +64 -64
  20. package/dist/cjs/apps/identity/constants.js +55 -22
  21. package/dist/cjs/apps/identity/index.js +28 -12
  22. package/dist/cjs/apps/identity/state-machines/identity-agent.js +124 -158
  23. package/dist/cjs/apps/identity/state-machines/identity-oracle.js +158 -173
  24. package/dist/cjs/apps/identity/state-machines/identity-registry.js +262 -0
  25. package/dist/cjs/apps/identity/state-machines/identity-universal.js +51 -57
  26. package/dist/cjs/apps/identity/state-machines/index.js +3 -1
  27. package/dist/cjs/apps/index.js +22 -8
  28. package/dist/cjs/apps/lending/assets.js +247 -0
  29. package/dist/cjs/apps/lending/credit-scoring.js +87 -0
  30. package/dist/cjs/apps/lending/eligibility.js +105 -0
  31. package/dist/cjs/apps/lending/index.js +91 -0
  32. package/dist/cjs/apps/lending/state-machines/index.js +9 -0
  33. package/dist/cjs/apps/lending/state-machines/lending-zk-loan.js +433 -0
  34. package/dist/cjs/apps/markets/index.js +22 -12
  35. package/dist/cjs/apps/markets/state-machines/market-auction.js +116 -134
  36. package/dist/cjs/apps/markets/state-machines/market-crowdfund.js +131 -141
  37. package/dist/cjs/apps/markets/state-machines/market-group-buy.js +163 -184
  38. package/dist/cjs/apps/markets/state-machines/market-prediction.js +226 -233
  39. package/dist/cjs/apps/markets/state-machines/market-universal.js +65 -80
  40. package/dist/cjs/apps/oracles/index.js +3 -3
  41. package/dist/cjs/apps/privacy/index.js +67 -0
  42. package/dist/cjs/apps/privacy/state-machines/index.js +17 -0
  43. package/dist/cjs/apps/privacy/state-machines/mixer-ddhRing.js +286 -0
  44. package/dist/cjs/apps/privacy/state-machines/note-pool.js +476 -0
  45. package/dist/cjs/apps/staked-pool/assets.js +103 -0
  46. package/dist/cjs/apps/staked-pool/base.js +498 -0
  47. package/dist/cjs/apps/staked-pool/consumer.js +55 -0
  48. package/dist/cjs/apps/staked-pool/index.js +83 -0
  49. package/dist/cjs/apps/staked-pool/state-machines/index.js +12 -0
  50. package/dist/cjs/apps/staked-pool/state-machines/staked-pool-base.js +49 -0
  51. package/dist/cjs/apps/staked-pool/state-machines/staked-pool-oracle.js +131 -0
  52. package/dist/cjs/errors.js +3 -3
  53. package/dist/cjs/generated/google/protobuf/struct.js +5 -5
  54. package/dist/cjs/generated/google/protobuf/timestamp.js +1 -1
  55. package/dist/cjs/generated/index.js +11 -7
  56. package/dist/cjs/generated/openapi.js +6 -0
  57. package/dist/cjs/generated/ottochain/apps/contracts/v1/contract.js +51 -51
  58. package/dist/cjs/generated/ottochain/apps/corporate/v1/corporate.js +20 -21
  59. package/dist/cjs/generated/ottochain/apps/governance/v1/governance.js +14 -14
  60. package/dist/cjs/generated/ottochain/apps/identity/v1/attestation.js +5 -5
  61. package/dist/cjs/generated/ottochain/apps/identity/v1/identity.js +125 -131
  62. package/dist/cjs/generated/ottochain/apps/markets/v1/market.js +108 -108
  63. package/dist/cjs/generated/ottochain/v1/common.js +5 -5
  64. package/dist/cjs/generated/ottochain/v1/fiber.js +44 -6
  65. package/dist/cjs/generated/ottochain/v1/messages.js +1 -1
  66. package/dist/cjs/generated/ottochain/v1/records.js +1 -1
  67. package/dist/cjs/index.js +58 -7
  68. package/dist/cjs/openapi.js +2 -0
  69. package/dist/cjs/ottochain/drop-nulls.js +1 -2
  70. package/dist/cjs/ottochain/genesis-manifest.js +17 -11
  71. package/dist/cjs/ottochain/index.js +23 -13
  72. package/dist/cjs/ottochain/metagraph-client.js +81 -16
  73. package/dist/cjs/ottochain/snapshot.js +13 -16
  74. package/dist/cjs/ottochain/transaction.js +67 -14
  75. package/dist/cjs/ottochain/types.js +16 -2
  76. package/dist/cjs/privacy/index.js +14 -0
  77. package/dist/cjs/privacy/sealed-bid.js +213 -0
  78. package/dist/cjs/privacy/shield-app.js +131 -0
  79. package/dist/cjs/schema/effects.js +156 -0
  80. package/dist/cjs/schema/fiber-app.js +150 -15
  81. package/dist/cjs/schema/guard-lint.js +343 -0
  82. package/dist/cjs/schema/guards.js +246 -0
  83. package/dist/cjs/signing.js +80 -0
  84. package/dist/cjs/templates/asset-policy.js +190 -0
  85. package/dist/cjs/templates/index.js +86 -0
  86. package/dist/cjs/templates/machine.js +130 -0
  87. package/dist/cjs/templates/migration.js +39 -0
  88. package/dist/cjs/templates/state-shape.js +38 -0
  89. package/dist/cjs/types.js +2 -3
  90. package/dist/cjs/validation.js +9 -11
  91. package/dist/cjs/verify.js +9 -4
  92. package/dist/cjs/zk/commit.js +53 -0
  93. package/dist/cjs/zk/guard.js +107 -0
  94. package/dist/cjs/zk/index.js +48 -0
  95. package/dist/cjs/zk/preimage.js +37 -0
  96. package/dist/cjs/zk/prover.js +87 -0
  97. package/dist/cjs/zk/registry.js +62 -0
  98. package/dist/cjs/zk/types.js +28 -0
  99. package/dist/cjs/zk/witness.js +19 -0
  100. package/dist/esm/apps/compute/index.js +29 -0
  101. package/dist/esm/apps/compute/state-machines/compute-rule110.js +161 -0
  102. package/dist/esm/apps/compute/state-machines/index.js +5 -0
  103. package/dist/esm/apps/contracts/index.js +9 -5
  104. package/dist/esm/apps/contracts/state-machines/contract-agreement.js +135 -162
  105. package/dist/esm/apps/contracts/state-machines/contract-escrow.js +193 -171
  106. package/dist/esm/apps/contracts/state-machines/contract-universal.js +47 -59
  107. package/dist/esm/apps/corporate/index.js +2 -2
  108. package/dist/esm/apps/corporate/state-machines/corp-board.js +501 -457
  109. package/dist/esm/apps/corporate/state-machines/corp-entity.js +488 -362
  110. package/dist/esm/apps/corporate/state-machines/corp-securities.js +770 -577
  111. package/dist/esm/apps/corporate/state-machines/corp-shareholders.js +568 -558
  112. package/dist/esm/apps/governance/index.js +10 -10
  113. package/dist/esm/apps/governance/state-machines/dao-multisig.js +189 -210
  114. package/dist/esm/apps/governance/state-machines/dao-reputation.js +182 -229
  115. package/dist/esm/apps/governance/state-machines/dao-single.js +106 -89
  116. package/dist/esm/apps/governance/state-machines/dao-token.js +200 -228
  117. package/dist/esm/apps/governance/state-machines/governance-simple.js +232 -232
  118. package/dist/esm/apps/governance/state-machines/governance-universal.js +65 -65
  119. package/dist/esm/apps/identity/constants.js +52 -21
  120. package/dist/esm/apps/identity/index.js +14 -9
  121. package/dist/esm/apps/identity/state-machines/identity-agent.js +125 -159
  122. package/dist/esm/apps/identity/state-machines/identity-oracle.js +159 -174
  123. package/dist/esm/apps/identity/state-machines/identity-registry.js +259 -0
  124. package/dist/esm/apps/identity/state-machines/identity-universal.js +52 -58
  125. package/dist/esm/apps/identity/state-machines/index.js +1 -0
  126. package/dist/esm/apps/index.js +9 -5
  127. package/dist/esm/apps/lending/assets.js +231 -0
  128. package/dist/esm/apps/lending/credit-scoring.js +81 -0
  129. package/dist/esm/apps/lending/eligibility.js +99 -0
  130. package/dist/esm/apps/lending/index.js +69 -0
  131. package/dist/esm/apps/lending/state-machines/index.js +5 -0
  132. package/dist/esm/apps/lending/state-machines/lending-zk-loan.js +430 -0
  133. package/dist/esm/apps/markets/index.js +11 -7
  134. package/dist/esm/apps/markets/state-machines/market-auction.js +117 -135
  135. package/dist/esm/apps/markets/state-machines/market-crowdfund.js +132 -142
  136. package/dist/esm/apps/markets/state-machines/market-group-buy.js +164 -185
  137. package/dist/esm/apps/markets/state-machines/market-prediction.js +227 -234
  138. package/dist/esm/apps/markets/state-machines/market-universal.js +66 -81
  139. package/dist/esm/apps/oracles/index.js +3 -3
  140. package/dist/esm/apps/privacy/index.js +56 -0
  141. package/dist/esm/apps/privacy/state-machines/index.js +6 -0
  142. package/dist/esm/apps/privacy/state-machines/mixer-ddhRing.js +282 -0
  143. package/dist/esm/apps/privacy/state-machines/note-pool.js +470 -0
  144. package/dist/esm/apps/staked-pool/assets.js +91 -0
  145. package/dist/esm/apps/staked-pool/base.js +493 -0
  146. package/dist/esm/apps/staked-pool/consumer.js +49 -0
  147. package/dist/esm/apps/staked-pool/index.js +60 -0
  148. package/dist/esm/apps/staked-pool/state-machines/index.js +6 -0
  149. package/dist/esm/apps/staked-pool/state-machines/staked-pool-base.js +46 -0
  150. package/dist/esm/apps/staked-pool/state-machines/staked-pool-oracle.js +127 -0
  151. package/dist/esm/generated/google/protobuf/struct.js +1 -1
  152. package/dist/esm/generated/google/protobuf/timestamp.js +1 -1
  153. package/dist/esm/generated/index.js +9 -5
  154. package/dist/esm/generated/openapi.js +5 -0
  155. package/dist/esm/generated/ottochain/apps/contracts/v1/contract.js +47 -47
  156. package/dist/esm/generated/ottochain/apps/corporate/v1/corporate.js +1 -1
  157. package/dist/esm/generated/ottochain/apps/governance/v1/governance.js +1 -1
  158. package/dist/esm/generated/ottochain/apps/identity/v1/attestation.js +1 -1
  159. package/dist/esm/generated/ottochain/apps/identity/v1/identity.js +115 -121
  160. package/dist/esm/generated/ottochain/apps/markets/v1/market.js +101 -101
  161. package/dist/esm/generated/ottochain/v1/common.js +1 -1
  162. package/dist/esm/generated/ottochain/v1/fiber.js +40 -2
  163. package/dist/esm/generated/ottochain/v1/messages.js +1 -1
  164. package/dist/esm/generated/ottochain/v1/records.js +1 -1
  165. package/dist/esm/index.js +28 -3
  166. package/dist/esm/openapi.js +1 -0
  167. package/dist/esm/ottochain/genesis-manifest.js +15 -9
  168. package/dist/esm/ottochain/index.js +2 -3
  169. package/dist/esm/ottochain/metagraph-client.js +81 -16
  170. package/dist/esm/ottochain/snapshot.js +6 -8
  171. package/dist/esm/ottochain/transaction.js +51 -3
  172. package/dist/esm/ottochain/types.js +15 -1
  173. package/dist/esm/privacy/index.js +6 -0
  174. package/dist/esm/privacy/sealed-bid.js +209 -0
  175. package/dist/esm/privacy/shield-app.js +127 -0
  176. package/dist/esm/schema/effects.js +145 -0
  177. package/dist/esm/schema/fiber-app.js +139 -8
  178. package/dist/esm/schema/guard-lint.js +337 -0
  179. package/dist/esm/schema/guards.js +228 -0
  180. package/dist/esm/signing.js +74 -0
  181. package/dist/esm/templates/asset-policy.js +182 -0
  182. package/dist/esm/templates/index.js +41 -0
  183. package/dist/esm/templates/machine.js +125 -0
  184. package/dist/esm/templates/migration.js +34 -0
  185. package/dist/esm/templates/state-shape.js +34 -0
  186. package/dist/esm/validation.js +1 -3
  187. package/dist/esm/verify.js +8 -2
  188. package/dist/esm/zk/commit.js +44 -0
  189. package/dist/esm/zk/guard.js +99 -0
  190. package/dist/esm/zk/index.js +19 -0
  191. package/dist/esm/zk/preimage.js +30 -0
  192. package/dist/esm/zk/prover.js +82 -0
  193. package/dist/esm/zk/registry.js +55 -0
  194. package/dist/esm/zk/types.js +25 -0
  195. package/dist/esm/zk/witness.js +15 -0
  196. package/dist/types/apps/compute/index.d.ts +176 -0
  197. package/dist/types/apps/compute/state-machines/compute-rule110.d.ts +157 -0
  198. package/dist/types/apps/compute/state-machines/index.d.ts +5 -0
  199. package/dist/types/apps/contracts/index.d.ts +81 -221
  200. package/dist/types/apps/contracts/state-machines/contract-agreement.d.ts +23 -98
  201. package/dist/types/apps/contracts/state-machines/contract-escrow.d.ts +49 -115
  202. package/dist/types/apps/contracts/state-machines/contract-universal.d.ts +4 -4
  203. package/dist/types/apps/corporate/index.d.ts +1176 -440
  204. package/dist/types/apps/corporate/state-machines/corp-board.d.ts +271 -135
  205. package/dist/types/apps/corporate/state-machines/corp-entity.d.ts +279 -74
  206. package/dist/types/apps/corporate/state-machines/corp-securities.d.ts +373 -149
  207. package/dist/types/apps/corporate/state-machines/corp-shareholders.d.ts +252 -80
  208. package/dist/types/apps/governance/index.d.ts +368 -470
  209. package/dist/types/apps/governance/state-machines/dao-multisig.d.ts +92 -107
  210. package/dist/types/apps/governance/state-machines/dao-reputation.d.ts +61 -85
  211. package/dist/types/apps/governance/state-machines/dao-single.d.ts +25 -47
  212. package/dist/types/apps/governance/state-machines/dao-token.d.ts +79 -68
  213. package/dist/types/apps/governance/state-machines/governance-simple.d.ts +95 -125
  214. package/dist/types/apps/governance/state-machines/governance-universal.d.ts +6 -6
  215. package/dist/types/apps/identity/constants.d.ts +33 -5
  216. package/dist/types/apps/identity/index.d.ts +415 -131
  217. package/dist/types/apps/identity/state-machines/identity-agent.d.ts +23 -23
  218. package/dist/types/apps/identity/state-machines/identity-oracle.d.ts +27 -98
  219. package/dist/types/apps/identity/state-machines/identity-registry.d.ts +379 -0
  220. package/dist/types/apps/identity/state-machines/identity-universal.d.ts +4 -4
  221. package/dist/types/apps/identity/state-machines/index.d.ts +1 -0
  222. package/dist/types/apps/index.d.ts +9 -5
  223. package/dist/types/apps/lending/assets.d.ts +258 -0
  224. package/dist/types/apps/lending/credit-scoring.d.ts +80 -0
  225. package/dist/types/apps/lending/eligibility.d.ts +83 -0
  226. package/dist/types/apps/lending/index.d.ts +556 -0
  227. package/dist/types/apps/lending/state-machines/index.d.ts +5 -0
  228. package/dist/types/apps/lending/state-machines/lending-zk-loan.d.ts +536 -0
  229. package/dist/types/apps/markets/index.d.ts +181 -276
  230. package/dist/types/apps/markets/state-machines/market-auction.d.ts +25 -49
  231. package/dist/types/apps/markets/state-machines/market-crowdfund.d.ts +35 -53
  232. package/dist/types/apps/markets/state-machines/market-group-buy.d.ts +35 -61
  233. package/dist/types/apps/markets/state-machines/market-prediction.d.ts +65 -86
  234. package/dist/types/apps/markets/state-machines/market-universal.d.ts +12 -12
  235. package/dist/types/apps/oracles/index.d.ts +1 -1
  236. package/dist/types/apps/privacy/index.d.ts +328 -0
  237. package/dist/types/apps/privacy/state-machines/index.d.ts +6 -0
  238. package/dist/types/apps/privacy/state-machines/mixer-ddhRing.d.ts +337 -0
  239. package/dist/types/apps/privacy/state-machines/note-pool.d.ts +196 -0
  240. package/dist/types/apps/staked-pool/assets.d.ts +53 -0
  241. package/dist/types/apps/staked-pool/base.d.ts +80 -0
  242. package/dist/types/apps/staked-pool/consumer.d.ts +29 -0
  243. package/dist/types/apps/staked-pool/index.d.ts +51 -0
  244. package/dist/types/apps/staked-pool/state-machines/index.d.ts +6 -0
  245. package/dist/types/apps/staked-pool/state-machines/staked-pool-base.d.ts +8 -0
  246. package/dist/types/apps/staked-pool/state-machines/staked-pool-oracle.d.ts +34 -0
  247. package/dist/types/generated/index.d.ts +5 -5
  248. package/dist/types/generated/openapi.d.ts +1270 -0
  249. package/dist/types/generated/ottochain/apps/contracts/v1/contract.d.ts +5 -5
  250. package/dist/types/generated/ottochain/apps/identity/v1/identity.d.ts +12 -12
  251. package/dist/types/generated/ottochain/apps/markets/v1/market.d.ts +11 -11
  252. package/dist/types/generated/ottochain/v1/fiber.d.ts +7 -0
  253. package/dist/types/index.d.ts +7 -3
  254. package/dist/types/openapi.d.ts +24 -0
  255. package/dist/types/ottochain/genesis-manifest.d.ts +11 -5
  256. package/dist/types/ottochain/index.d.ts +5 -6
  257. package/dist/types/ottochain/metagraph-client.d.ts +49 -7
  258. package/dist/types/ottochain/snapshot.d.ts +6 -6
  259. package/dist/types/ottochain/transaction.d.ts +41 -1
  260. package/dist/types/ottochain/types.d.ts +336 -31
  261. package/dist/types/privacy/index.d.ts +6 -0
  262. package/dist/types/privacy/sealed-bid.d.ts +348 -0
  263. package/dist/types/privacy/shield-app.d.ts +48 -0
  264. package/dist/types/schema/effects.d.ts +141 -0
  265. package/dist/types/schema/fiber-app.d.ts +282 -2
  266. package/dist/types/schema/guard-lint.d.ts +111 -0
  267. package/dist/types/schema/guards.d.ts +146 -0
  268. package/dist/types/signing.d.ts +45 -0
  269. package/dist/types/templates/asset-policy.d.ts +119 -0
  270. package/dist/types/templates/index.d.ts +26 -0
  271. package/dist/types/templates/machine.d.ts +139 -0
  272. package/dist/types/templates/migration.d.ts +34 -0
  273. package/dist/types/templates/state-shape.d.ts +30 -0
  274. package/dist/types/validation.d.ts +22 -217
  275. package/dist/types/verify.d.ts +4 -0
  276. package/dist/types/zk/commit.d.ts +28 -0
  277. package/dist/types/zk/guard.d.ts +46 -0
  278. package/dist/types/zk/index.d.ts +19 -0
  279. package/dist/types/zk/preimage.d.ts +10 -0
  280. package/dist/types/zk/prover.d.ts +34 -0
  281. package/dist/types/zk/registry.d.ts +34 -0
  282. package/dist/types/zk/types.d.ts +33 -0
  283. package/dist/types/zk/witness.d.ts +40 -0
  284. package/package.json +47 -15
  285. package/dist/cjs/ottochain/normalize.js +0 -186
  286. package/dist/esm/ottochain/normalize.js +0 -179
  287. package/dist/types/ottochain/normalize.d.ts +0 -79
@@ -2,552 +2,627 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.corpEntityDef = void 0;
4
4
  const fiber_app_js_1 = require("../../../schema/fiber-app.js");
5
+ const guards_js_1 = require("../../../schema/guards.js");
6
+ const effects_js_1 = require("../../../schema/effects.js");
5
7
  /**
6
8
  * Master corporate record tracking the lifecycle of a business entity from incorporation through dissolution.
7
9
  * Manages legal identity, share structure, and corporate status.
8
10
  */
9
11
  exports.corpEntityDef = (0, fiber_app_js_1.defineFiberApp)({
10
12
  metadata: {
11
- name: "CorpEntity",
12
- app: "corporate",
13
- type: "entity",
14
- version: "1.0.0",
15
- description: "Master corporate record tracking the lifecycle of a business entity from incorporation through dissolution. Manages legal identity, share structure, and corporate status.",
13
+ name: 'CorpEntity',
14
+ app: 'corporate',
15
+ type: 'entity',
16
+ version: '1.0.0',
17
+ description: 'Master corporate record tracking the lifecycle of a business entity from incorporation through dissolution. Manages legal identity, share structure, and corporate status.',
16
18
  crossReferences: {
17
19
  board: {
18
- machine: "corporate-board",
19
- description: "Board of directors for this entity",
20
- foreignKey: "entityId",
20
+ machine: 'corporate-board',
21
+ description: 'Board of directors for this entity',
22
+ foreignKey: 'entityId',
21
23
  },
22
24
  officers: {
23
- machine: "corporate-officers",
24
- description: "Executive officers for this entity",
25
- foreignKey: "entityId",
25
+ machine: 'corporate-officers',
26
+ description: 'Executive officers for this entity',
27
+ foreignKey: 'entityId',
26
28
  },
27
29
  bylaws: {
28
- machine: "corporate-bylaws",
29
- description: "Governing bylaws for this entity",
30
- foreignKey: "entityId",
30
+ machine: 'corporate-bylaws',
31
+ description: 'Governing bylaws for this entity',
32
+ foreignKey: 'entityId',
31
33
  },
32
34
  shareholders: {
33
- machine: "corporate-shareholders",
34
- description: "Shareholder meeting instances",
35
- foreignKey: "entityId",
35
+ machine: 'corporate-shareholders',
36
+ description: 'Shareholder meeting instances',
37
+ foreignKey: 'entityId',
36
38
  },
37
39
  securities: {
38
- machine: "corporate-securities",
39
- description: "Stock issuance records",
40
- foreignKey: "entityId",
40
+ machine: 'corporate-securities',
41
+ description: 'Stock issuance records',
42
+ foreignKey: 'entityId',
41
43
  },
42
44
  compliance: {
43
- machine: "corporate-compliance",
44
- description: "Regulatory compliance tracking",
45
- foreignKey: "entityId",
45
+ machine: 'corporate-compliance',
46
+ description: 'Regulatory compliance tracking',
47
+ foreignKey: 'entityId',
46
48
  },
47
49
  },
48
50
  },
49
51
  createSchema: {
50
- required: ["entityId", "legalName", "entityType", "jurisdiction"],
52
+ required: [
53
+ 'entityId',
54
+ 'legalName',
55
+ 'entityType',
56
+ 'jurisdiction',
57
+ 'charterAuthority',
58
+ 'boardAuthority',
59
+ 'shareholderAuthority',
60
+ 'stateAuthority',
61
+ ],
51
62
  properties: {
52
63
  entityId: {
53
- type: "string",
54
- description: "Unique identifier for this corporate entity",
64
+ type: 'string',
65
+ description: 'Unique identifier for this corporate entity',
66
+ immutable: true,
67
+ },
68
+ charterAuthority: {
69
+ type: 'address',
70
+ description: 'State-pinned DAG address authorized to amend the charter (legal identity). Verified against proofs[].address.',
71
+ immutable: true,
72
+ },
73
+ boardAuthority: {
74
+ type: 'address',
75
+ description: 'State-pinned DAG address of the board authority (governs registered-agent changes, suspension/reinstatement, and the board half of voluntary dissolution). Verified against proofs[].address.',
76
+ immutable: true,
77
+ },
78
+ shareholderAuthority: {
79
+ type: 'address',
80
+ description: 'State-pinned DAG address of the shareholder authority (the shareholder half of voluntary dissolution). Verified against proofs[].address.',
81
+ immutable: true,
82
+ },
83
+ stateAuthority: {
84
+ type: 'address',
85
+ description: 'State-pinned DAG address of the chartering jurisdiction/registrar that may administratively dissolve a suspended entity. Verified against proofs[].address.',
55
86
  immutable: true,
56
87
  },
57
88
  legalName: {
58
- type: "string",
59
- description: "Full legal name of the corporation",
89
+ type: 'string',
90
+ description: 'Full legal name of the corporation',
60
91
  },
61
92
  tradeName: {
62
- type: "string",
93
+ type: 'string',
63
94
  nullable: true,
64
- description: "DBA or trade name if different",
95
+ description: 'DBA or trade name if different',
65
96
  },
66
97
  entityType: {
67
- type: "string",
68
- enum: ["C_CORP", "S_CORP", "B_CORP", "LLC", "LP", "LLP"],
69
- description: "Legal entity type",
98
+ type: 'string',
99
+ enum: ['C_CORP', 'S_CORP', 'B_CORP', 'LLC', 'LP', 'LLP'],
100
+ description: 'Legal entity type',
70
101
  },
71
102
  jurisdiction: {
72
- type: "object",
103
+ type: 'object',
73
104
  properties: {
74
105
  state: {
75
- type: "string",
76
- description: "State of incorporation (e.g., DE, NV, WY)",
106
+ type: 'string',
107
+ description: 'State of incorporation (e.g., DE, NV, WY)',
77
108
  },
78
- country: { type: "string", default: "USA" },
109
+ country: { type: 'string', default: 'USA' },
79
110
  foreignQualifications: {
80
- type: "array",
81
- items: { type: "string" },
82
- description: "States where foreign qualified to do business",
111
+ type: 'array',
112
+ items: { type: 'string' },
113
+ description: 'States where foreign qualified to do business',
83
114
  },
84
115
  },
85
116
  },
86
117
  fiscalYearEnd: {
87
- type: "string",
88
- description: "Fiscal year end (MM-DD format)",
118
+ type: 'string',
119
+ description: 'Fiscal year end (MM-DD format)',
89
120
  },
90
121
  registeredAgent: {
91
- type: "object",
122
+ type: 'object',
92
123
  properties: {
93
- name: { type: "string" },
94
- address: { type: "object" },
95
- phone: { type: "string" },
96
- email: { type: "string" },
97
- effectiveDate: { type: "string", format: "date" },
124
+ name: { type: 'string' },
125
+ address: { type: 'object' },
126
+ phone: { type: 'string' },
127
+ email: { type: 'string' },
128
+ effectiveDate: { type: 'string', format: 'date' },
98
129
  },
99
130
  },
100
131
  principalOffice: {
101
- type: "object",
132
+ type: 'object',
102
133
  properties: {
103
- street: { type: "string" },
104
- city: { type: "string" },
105
- state: { type: "string" },
106
- zip: { type: "string" },
107
- country: { type: "string", default: "USA" },
134
+ street: { type: 'string' },
135
+ city: { type: 'string' },
136
+ state: { type: 'string' },
137
+ zip: { type: 'string' },
138
+ country: { type: 'string', default: 'USA' },
108
139
  },
109
140
  },
110
141
  shareStructure: {
111
- type: "object",
142
+ type: 'object',
112
143
  properties: {
113
144
  classes: {
114
- type: "array",
115
- items: { $ref: "#/definitions/ShareClass" },
145
+ type: 'array',
146
+ items: { $ref: '#/definitions/ShareClass' },
116
147
  },
117
148
  totalAuthorized: {
118
- type: "integer",
119
- description: "Sum of all authorized shares",
149
+ type: 'integer',
150
+ description: 'Sum of all authorized shares',
120
151
  },
121
- totalIssued: { type: "integer" },
122
- totalOutstanding: { type: "integer" },
152
+ totalIssued: { type: 'integer' },
153
+ totalOutstanding: { type: 'integer' },
123
154
  },
124
155
  },
125
156
  incorporators: {
126
- type: "array",
127
- items: { $ref: "#/definitions/Incorporator" },
157
+ type: 'array',
158
+ items: { $ref: '#/definitions/Incorporator' },
128
159
  },
129
160
  ein: {
130
- type: "string",
161
+ type: 'string',
131
162
  nullable: true,
132
- description: "Federal EIN",
163
+ description: 'Federal EIN',
133
164
  },
134
165
  stateIds: {
135
- type: "object",
136
- additionalProperties: { type: "string" },
137
- description: "State-specific entity IDs keyed by state code",
166
+ type: 'object',
167
+ additionalProperties: { type: 'string' },
168
+ description: 'State-specific entity IDs keyed by state code',
138
169
  },
139
170
  },
140
171
  },
141
172
  stateSchema: {
142
173
  properties: {
143
- entityId: { type: "string", immutable: true },
144
- legalName: { type: "string" },
145
- tradeName: { type: "string", nullable: true },
146
- entityType: { type: "string" },
147
- jurisdiction: { type: "object" },
148
- formationDate: { type: "string", format: "date", computed: true },
149
- fiscalYearEnd: { type: "string" },
150
- registeredAgent: { type: "object" },
151
- principalOffice: { type: "object" },
152
- shareStructure: { type: "object" },
153
- incorporators: { type: "array" },
154
- ein: { type: "string", nullable: true },
155
- stateIds: { type: "object" },
174
+ entityId: { type: 'string', immutable: true },
175
+ charterAuthority: { type: 'address', immutable: true },
176
+ boardAuthority: { type: 'address', immutable: true },
177
+ shareholderAuthority: { type: 'address', immutable: true },
178
+ stateAuthority: { type: 'address', immutable: true },
179
+ legalName: { type: 'string' },
180
+ tradeName: { type: 'string', nullable: true },
181
+ entityType: { type: 'string' },
182
+ jurisdiction: { type: 'object' },
183
+ formationDate: { type: 'string', format: 'date', computed: true },
184
+ fiscalYearEnd: { type: 'string' },
185
+ registeredAgent: { type: 'object' },
186
+ principalOffice: { type: 'object' },
187
+ shareStructure: { type: 'object' },
188
+ incorporators: { type: 'array' },
189
+ ein: { type: 'string', nullable: true },
190
+ stateIds: { type: 'object' },
156
191
  status: {
157
- type: "string",
158
- enum: ["INCORPORATING", "ACTIVE", "SUSPENDED", "DISSOLVED"],
192
+ type: 'string',
193
+ enum: ['INCORPORATING', 'ACTIVE', 'SUSPENDED', 'DISSOLVED'],
159
194
  computed: true,
160
195
  },
161
- suspensionReason: { type: "string", nullable: true, computed: true },
196
+ suspensionReason: { type: 'string', nullable: true, computed: true },
162
197
  suspensionDate: {
163
- type: "string",
164
- format: "date",
198
+ type: 'string',
199
+ format: 'date',
165
200
  nullable: true,
166
201
  computed: true,
167
202
  },
168
203
  dissolutionDate: {
169
- type: "string",
170
- format: "date",
204
+ type: 'string',
205
+ format: 'date',
171
206
  nullable: true,
172
207
  computed: true,
173
208
  },
174
- dissolutionReason: { type: "string", nullable: true, computed: true },
209
+ dissolutionReason: { type: 'string', nullable: true, computed: true },
175
210
  charterAmendments: {
176
- type: "array",
177
- items: { $ref: "#/definitions/CharterAmendment" },
211
+ type: 'array',
212
+ items: { $ref: '#/definitions/CharterAmendment' },
178
213
  computed: true,
179
214
  },
180
- createdAt: { type: "timestamp", computed: true },
181
- updatedAt: { type: "timestamp", computed: true },
215
+ createdAt: { type: 'timestamp', computed: true },
216
+ updatedAt: { type: 'timestamp', computed: true },
217
+ // Two-phase amendment (#24): propose_amend_charter binds the resolution fiber + records the
218
+ // pending amendment here; amend_charter asserts the bound resolution is EXECUTED, then clears this.
219
+ pendingAmendCharter: { type: 'object', nullable: true, computed: true },
220
+ // Two-phase voluntary dissolution (#24): propose_dissolve_voluntary binds the board + shareholder
221
+ // resolution fibers + records the pending dissolution here; dissolve_voluntary asserts both bound
222
+ // resolutions are EXECUTED, then clears this.
223
+ pendingDissolveVoluntary: { type: 'object', nullable: true, computed: true },
182
224
  },
183
225
  },
184
226
  eventSchemas: {
185
227
  incorporate: {
186
- description: "State approves articles of incorporation, corporation comes into existence",
187
- required: ["approvalDate", "stateFileNumber"],
228
+ description: 'State approves articles of incorporation, corporation comes into existence',
229
+ required: ['approvalDate', 'stateFileNumber'],
188
230
  properties: {
189
- approvalDate: { type: "string", format: "date" },
190
- stateFileNumber: { type: "string" },
231
+ approvalDate: { type: 'string', format: 'date' },
232
+ stateFileNumber: { type: 'string' },
191
233
  certificateOfIncorporation: {
192
- type: "string",
193
- description: "Document reference",
234
+ type: 'string',
235
+ description: 'Document reference',
194
236
  },
195
237
  },
196
238
  },
197
- amend_charter: {
198
- description: "Amend the certificate/articles of incorporation (requires shareholder approval for most amendments)",
199
- required: [
200
- "amendmentId",
201
- "description",
202
- "amendmentType",
203
- "resolutionRef",
204
- "effectiveDate",
205
- "filedDate",
206
- ],
239
+ propose_amend_charter: {
240
+ description: 'Phase 1 of a charter amendment: bind the approving resolution fiber (#24 _addDependency) and record the pending amendment',
241
+ required: ['amendmentId', 'description', 'amendmentType', 'resolutionRef', 'effectiveDate', 'filedDate'],
207
242
  properties: {
208
- amendmentId: { type: "string" },
209
- description: { type: "string" },
243
+ amendmentId: { type: 'string' },
244
+ description: { type: 'string' },
210
245
  amendmentType: {
211
- type: "string",
212
- enum: [
213
- "NAME_CHANGE",
214
- "SHARE_AUTHORIZATION",
215
- "PURPOSE_CHANGE",
216
- "OTHER",
217
- ],
246
+ type: 'string',
247
+ enum: ['NAME_CHANGE', 'SHARE_AUTHORIZATION', 'PURPOSE_CHANGE', 'OTHER'],
218
248
  },
219
249
  resolutionRef: {
220
- type: "string",
221
- description: "Reference to board/shareholder resolution",
250
+ type: 'string',
251
+ description: 'Reference to board/shareholder resolution',
222
252
  },
223
- effectiveDate: { type: "string", format: "date" },
224
- filedDate: { type: "string", format: "date" },
253
+ effectiveDate: { type: 'string', format: 'date' },
254
+ filedDate: { type: 'string', format: 'date' },
225
255
  newShareAuthorization: {
226
- type: "object",
256
+ type: 'object',
227
257
  nullable: true,
228
- description: "If increasing/changing authorized shares",
258
+ description: 'If increasing/changing authorized shares',
229
259
  },
230
- newLegalName: { type: "string", nullable: true },
260
+ newLegalName: { type: 'string', nullable: true },
261
+ },
262
+ },
263
+ amend_charter: {
264
+ description: 'Phase 2 of a charter amendment: apply once the bound approving resolution is EXECUTED',
265
+ required: ['amendmentId', 'description', 'amendmentType', 'effectiveDate', 'filedDate'],
266
+ properties: {
267
+ amendmentId: { type: 'string' },
268
+ description: { type: 'string' },
269
+ amendmentType: {
270
+ type: 'string',
271
+ enum: ['NAME_CHANGE', 'SHARE_AUTHORIZATION', 'PURPOSE_CHANGE', 'OTHER'],
272
+ },
273
+ effectiveDate: { type: 'string', format: 'date' },
274
+ filedDate: { type: 'string', format: 'date' },
275
+ newShareAuthorization: {
276
+ type: 'object',
277
+ nullable: true,
278
+ description: 'If increasing/changing authorized shares',
279
+ },
280
+ newLegalName: { type: 'string', nullable: true },
231
281
  },
232
282
  },
233
283
  update_share_class: {
234
- description: "Update authorized shares for an existing class or add new class (requires charter amendment)",
235
- required: [
236
- "classId",
237
- "className",
238
- "authorized",
239
- "parValue",
240
- "votingRights",
241
- "charterAmendmentRef",
242
- ],
284
+ description: 'Update authorized shares for an existing class or add new class (requires charter amendment)',
285
+ required: ['classId', 'className', 'authorized', 'parValue', 'votingRights', 'charterAmendmentRef'],
243
286
  properties: {
244
- classId: { type: "string" },
245
- className: { type: "string" },
246
- authorized: { type: "integer" },
247
- parValue: { type: "number" },
248
- votingRights: { type: "boolean" },
249
- votesPerShare: { type: "number", default: 1 },
250
- liquidationPreference: { type: "number", nullable: true },
251
- dividendRate: { type: "number", nullable: true },
252
- convertible: { type: "boolean", default: false },
253
- charterAmendmentRef: { type: "string" },
287
+ classId: { type: 'string' },
288
+ className: { type: 'string' },
289
+ authorized: { type: 'integer' },
290
+ parValue: { type: 'number' },
291
+ votingRights: { type: 'boolean' },
292
+ votesPerShare: { type: 'number', default: 1 },
293
+ liquidationPreference: { type: 'number', nullable: true },
294
+ dividendRate: { type: 'number', nullable: true },
295
+ convertible: { type: 'boolean', default: false },
296
+ charterAmendmentRef: { type: 'string' },
254
297
  },
255
298
  },
256
299
  update_registered_agent: {
257
- description: "Change the registered agent on file with the state",
258
- required: ["name", "address", "effectiveDate"],
300
+ description: 'Change the registered agent on file with the state',
301
+ required: ['name', 'address', 'effectiveDate'],
259
302
  properties: {
260
- name: { type: "string" },
261
- address: { type: "object" },
262
- phone: { type: "string" },
263
- email: { type: "string" },
264
- effectiveDate: { type: "string", format: "date" },
303
+ name: { type: 'string' },
304
+ address: { type: 'object' },
305
+ phone: { type: 'string' },
306
+ email: { type: 'string' },
307
+ effectiveDate: { type: 'string', format: 'date' },
265
308
  filingConfirmation: {
266
- type: "string",
267
- description: "State filing confirmation number",
309
+ type: 'string',
310
+ description: 'State filing confirmation number',
268
311
  },
269
312
  },
270
313
  },
271
314
  suspend: {
272
- description: "State suspends corporate powers (typically for tax/filing noncompliance)",
273
- required: ["reason", "suspensionDate"],
315
+ description: 'State suspends corporate powers (typically for tax/filing noncompliance)',
316
+ required: ['reason', 'suspensionDate'],
274
317
  properties: {
275
318
  reason: {
276
- type: "string",
319
+ type: 'string',
277
320
  enum: [
278
- "FRANCHISE_TAX_DELINQUENT",
279
- "ANNUAL_REPORT_MISSING",
280
- "REGISTERED_AGENT_LAPSE",
281
- "ADMINISTRATIVE",
282
- "OTHER",
321
+ 'FRANCHISE_TAX_DELINQUENT',
322
+ 'ANNUAL_REPORT_MISSING',
323
+ 'REGISTERED_AGENT_LAPSE',
324
+ 'ADMINISTRATIVE',
325
+ 'OTHER',
283
326
  ],
284
327
  },
285
- suspensionDate: { type: "string", format: "date" },
328
+ suspensionDate: { type: 'string', format: 'date' },
286
329
  stateNotice: {
287
- type: "string",
288
- description: "Reference to state notice",
330
+ type: 'string',
331
+ description: 'Reference to state notice',
289
332
  },
290
- cureDeadline: { type: "string", format: "date", nullable: true },
333
+ cureDeadline: { type: 'string', format: 'date', nullable: true },
291
334
  },
292
335
  },
293
336
  reinstate: {
294
- description: "Cure deficiencies and reinstate corporate powers",
295
- required: [
296
- "reinstatementDate",
297
- "curativeActions",
298
- "stateConfirmation",
299
- ],
337
+ description: 'Cure deficiencies and reinstate corporate powers',
338
+ required: ['reinstatementDate', 'curativeActions', 'stateConfirmation'],
300
339
  properties: {
301
- reinstatementDate: { type: "string", format: "date" },
340
+ reinstatementDate: { type: 'string', format: 'date' },
302
341
  curativeActions: {
303
- type: "array",
304
- items: { type: "string" },
305
- description: "List of actions taken to cure",
342
+ type: 'array',
343
+ items: { type: 'string' },
344
+ description: 'List of actions taken to cure',
306
345
  },
307
- stateConfirmation: { type: "string" },
308
- penaltiesPaid: { type: "number", nullable: true },
346
+ stateConfirmation: { type: 'string' },
347
+ penaltiesPaid: { type: 'number', nullable: true },
348
+ },
349
+ },
350
+ propose_dissolve_voluntary: {
351
+ description: 'Phase 1 of voluntary dissolution: bind the executing board + shareholder resolution fibers (#24 _addDependency) and record the pending dissolution',
352
+ required: ['dissolutionDate', 'boardResolutionRef', 'shareholderResolutionRef'],
353
+ properties: {
354
+ dissolutionDate: { type: 'string', format: 'date' },
355
+ boardResolutionRef: { type: 'string' },
356
+ shareholderResolutionRef: { type: 'string' },
357
+ windingUpPlan: {
358
+ type: 'string',
359
+ description: 'Reference to winding up plan',
360
+ },
361
+ certificateOfDissolution: { type: 'string' },
309
362
  },
310
363
  },
311
364
  dissolve_voluntary: {
312
- description: "Voluntary dissolution approved by board and shareholders",
313
- required: [
314
- "dissolutionDate",
315
- "boardResolutionRef",
316
- "shareholderResolutionRef",
317
- ],
365
+ description: 'Phase 2 of voluntary dissolution: execute once both bound resolutions are EXECUTED',
366
+ required: ['dissolutionDate'],
318
367
  properties: {
319
- dissolutionDate: { type: "string", format: "date" },
320
- boardResolutionRef: { type: "string" },
321
- shareholderResolutionRef: { type: "string" },
368
+ dissolutionDate: { type: 'string', format: 'date' },
322
369
  windingUpPlan: {
323
- type: "string",
324
- description: "Reference to winding up plan",
370
+ type: 'string',
371
+ description: 'Reference to winding up plan',
325
372
  },
326
- certificateOfDissolution: { type: "string" },
373
+ certificateOfDissolution: { type: 'string' },
327
374
  },
328
375
  },
329
376
  dissolve_administrative: {
330
- description: "Administrative dissolution by state after prolonged suspension",
331
- required: ["dissolutionDate", "stateOrder", "reason"],
377
+ description: 'Administrative dissolution by state after prolonged suspension',
378
+ required: ['dissolutionDate', 'stateOrder', 'reason'],
332
379
  properties: {
333
- dissolutionDate: { type: "string", format: "date" },
334
- stateOrder: { type: "string" },
335
- reason: { type: "string" },
380
+ dissolutionDate: { type: 'string', format: 'date' },
381
+ stateOrder: { type: 'string' },
382
+ reason: { type: 'string' },
336
383
  },
337
384
  },
338
385
  },
339
386
  definitions: {
340
387
  ShareClass: {
341
- type: "object",
388
+ type: 'object',
342
389
  properties: {
343
390
  className: {
344
- type: "string",
345
- description: "e.g., Common, Series A Preferred",
391
+ type: 'string',
392
+ description: 'e.g., Common, Series A Preferred',
346
393
  },
347
- classId: { type: "string" },
348
- authorized: { type: "integer", description: "Total shares authorized" },
349
- issued: { type: "integer", description: "Shares currently issued" },
350
- outstanding: { type: "integer", description: "Issued minus treasury" },
351
- treasury: { type: "integer", description: "Shares held by company" },
352
- parValue: { type: "number", description: "Par value per share" },
394
+ classId: { type: 'string' },
395
+ authorized: { type: 'integer', description: 'Total shares authorized' },
396
+ issued: { type: 'integer', description: 'Shares currently issued' },
397
+ outstanding: { type: 'integer', description: 'Issued minus treasury' },
398
+ treasury: { type: 'integer', description: 'Shares held by company' },
399
+ parValue: { type: 'number', description: 'Par value per share' },
353
400
  votingRights: {
354
- type: "boolean",
355
- description: "Whether class has voting rights",
401
+ type: 'boolean',
402
+ description: 'Whether class has voting rights',
356
403
  },
357
- votesPerShare: { type: "number", default: 1 },
404
+ votesPerShare: { type: 'number', default: 1 },
358
405
  liquidationPreference: {
359
- type: "number",
406
+ type: 'number',
360
407
  nullable: true,
361
- description: "Liquidation preference multiple",
408
+ description: 'Liquidation preference multiple',
362
409
  },
363
410
  dividendRate: {
364
- type: "number",
411
+ type: 'number',
365
412
  nullable: true,
366
- description: "Annual dividend rate %",
413
+ description: 'Annual dividend rate %',
367
414
  },
368
- convertible: { type: "boolean", default: false },
369
- conversionRatio: { type: "number", nullable: true },
415
+ convertible: { type: 'boolean', default: false },
416
+ conversionRatio: { type: 'number', nullable: true },
370
417
  antidilution: {
371
- type: "string",
372
- enum: [
373
- "NONE",
374
- "BROAD_BASED",
375
- "NARROW_BASED",
376
- "FULL_RATCHET",
377
- ],
418
+ type: 'string',
419
+ enum: ['NONE', 'BROAD_BASED', 'NARROW_BASED', 'FULL_RATCHET'],
378
420
  nullable: true,
379
421
  },
380
422
  },
381
423
  },
382
424
  Incorporator: {
383
- type: "object",
425
+ type: 'object',
384
426
  properties: {
385
- name: { type: "string" },
386
- address: { type: "object" },
387
- signatureDate: { type: "string", format: "date" },
427
+ name: { type: 'string' },
428
+ address: { type: 'object' },
429
+ signatureDate: { type: 'string', format: 'date' },
388
430
  },
389
431
  },
390
432
  CharterAmendment: {
391
- type: "object",
433
+ type: 'object',
392
434
  properties: {
393
- amendmentId: { type: "string" },
394
- description: { type: "string" },
395
- effectiveDate: { type: "string", format: "date" },
435
+ amendmentId: { type: 'string' },
436
+ description: { type: 'string' },
437
+ effectiveDate: { type: 'string', format: 'date' },
396
438
  resolutionRef: {
397
- type: "string",
398
- description: "Reference to approving resolution",
439
+ type: 'string',
440
+ description: 'Reference to approving resolution',
399
441
  },
400
- filedDate: { type: "string", format: "date" },
442
+ filedDate: { type: 'string', format: 'date' },
401
443
  },
402
444
  },
403
445
  },
404
446
  states: {
405
447
  INCORPORATING: {
406
- id: "INCORPORATING",
448
+ id: 'INCORPORATING',
407
449
  isFinal: false,
408
- description: "Initial state during formation process. Articles filed but not yet approved by state.",
450
+ description: 'Initial state during formation process. Articles filed but not yet approved by state.',
409
451
  },
410
452
  ACTIVE: {
411
- id: "ACTIVE",
453
+ id: 'ACTIVE',
412
454
  isFinal: false,
413
- description: "Corporation is in good standing and authorized to conduct business.",
455
+ description: 'Corporation is in good standing and authorized to conduct business.',
414
456
  },
415
457
  SUSPENDED: {
416
- id: "SUSPENDED",
458
+ id: 'SUSPENDED',
417
459
  isFinal: false,
418
- description: "Corporate powers suspended due to compliance failure (tax, filings, etc). Can be reinstated.",
460
+ description: 'Corporate powers suspended due to compliance failure (tax, filings, etc). Can be reinstated.',
419
461
  },
420
462
  DISSOLVED: {
421
- id: "DISSOLVED",
463
+ id: 'DISSOLVED',
422
464
  isFinal: true,
423
- description: "Corporation has been legally dissolved. Terminal state.",
465
+ description: 'Corporation has been legally dissolved. Terminal state.',
424
466
  },
425
467
  },
426
- initialState: "INCORPORATING",
468
+ initialState: 'INCORPORATING',
427
469
  transitions: [
428
470
  // INCORPORATING -> ACTIVE
429
471
  {
430
- from: "INCORPORATING",
431
- to: "ACTIVE",
432
- eventName: "incorporate",
472
+ from: 'INCORPORATING',
473
+ to: 'ACTIVE',
474
+ eventName: 'incorporate',
433
475
  guard: {
434
476
  and: [
435
- { "!=": [{ var: "state.legalName" }, null] },
436
- { "!=": [{ var: "state.jurisdiction.state" }, null] },
437
- { "!=": [{ var: "state.registeredAgent" }, null] },
438
- { ">": [{ var: "state.incorporators.length" }, 0] },
439
- { ">": [{ var: "state.shareStructure.classes.length" }, 0] },
440
- { ">": [{ var: "state.shareStructure.totalAuthorized" }, 0] },
477
+ { '!=': [{ var: 'state.legalName' }, null] },
478
+ { '!=': [{ var: 'state.jurisdiction.state' }, null] },
479
+ { '!=': [{ var: 'state.registeredAgent' }, null] },
480
+ { '>': [{ length: [{ var: 'state.incorporators' }] }, 0] },
481
+ { '>': [{ length: [{ var: 'state.shareStructure.classes' }] }, 0] },
482
+ { '>': [{ var: 'state.shareStructure.totalAuthorized' }, 0] },
441
483
  ],
442
484
  },
443
485
  effect: {
444
486
  merge: [
445
- { var: "state" },
487
+ { var: 'state' },
488
+ {
489
+ status: 'ACTIVE',
490
+ formationDate: { var: 'event.approvalDate' },
491
+ updatedAt: { var: '$ordinal' },
492
+ },
446
493
  {
447
- status: "ACTIVE",
448
- formationDate: { var: "event.approvalDate" },
449
- updatedAt: { var: "$timestamp" },
494
+ _emit: [{ name: 'CORPORATION_FORMED', data: { var: 'event' }, destination: 'external' }],
450
495
  },
451
496
  ],
452
497
  },
453
- emits: ["CORPORATION_FORMED"],
454
498
  },
455
- // ACTIVE -> ACTIVE (amend_charter)
499
+ // ACTIVE -> ACTIVE (propose_amend_charter) — phase 1 (#24): bind the approving resolution fiber and
500
+ // record the pending amendment, so amend_charter can read the resolution's state next transition.
456
501
  {
457
- from: "ACTIVE",
458
- to: "ACTIVE",
459
- eventName: "amend_charter",
460
- guard: { "!=": [{ var: "event.resolutionRef" }, null] },
461
- dependencies: [
462
- {
463
- machine: "corporate-resolution",
464
- instanceRef: { var: "event.resolutionRef" },
465
- requiredState: "EXECUTED",
466
- },
467
- ],
502
+ from: 'ACTIVE',
503
+ to: 'ACTIVE',
504
+ eventName: 'propose_amend_charter',
505
+ // authority gate an identity role attestation (ISSUER/BOARD_MEMBER/...) layers on additively when the identity registry lands (docs/design/app-hardening-identity-integration.md §4.2)
506
+ guard: (0, guards_js_1.signerIsParty)('state.charterAuthority'),
468
507
  effect: {
469
508
  merge: [
470
- { var: "state" },
509
+ { var: 'state' },
510
+ {
511
+ pendingAmendCharter: {
512
+ amendmentId: { var: 'event.amendmentId' },
513
+ description: { var: 'event.description' },
514
+ effectiveDate: { var: 'event.effectiveDate' },
515
+ filedDate: { var: 'event.filedDate' },
516
+ newLegalName: { var: 'event.newLegalName' },
517
+ ref: { var: 'event.resolutionRef' },
518
+ proposedAt: { var: '$ordinal' },
519
+ },
520
+ },
521
+ // bind the resolution fiber so amend_charter can assert its state next transition
522
+ (0, effects_js_1.addDependency)({ var: 'event.resolutionRef' }),
523
+ ],
524
+ },
525
+ dependencies: [],
526
+ },
527
+ // ACTIVE -> ACTIVE (amend_charter) — phase 2 (#24): apply once the bound approving resolution is
528
+ // EXECUTED. depInState replaces the dropped object-form dependency (which silently never gated).
529
+ {
530
+ from: 'ACTIVE',
531
+ to: 'ACTIVE',
532
+ eventName: 'amend_charter',
533
+ // authority gate — an identity role attestation (ISSUER/BOARD_MEMBER/...) layers on additively when the identity registry lands (docs/design/app-hardening-identity-integration.md §4.2)
534
+ guard: {
535
+ and: [
536
+ (0, guards_js_1.signerIsParty)('state.charterAuthority'),
537
+ // the proposal must target this amendment, and its bound resolution must be EXECUTED
538
+ {
539
+ '==': [{ var: 'state.pendingAmendCharter.amendmentId' }, { var: 'event.amendmentId' }],
540
+ },
541
+ (0, guards_js_1.depInState)('state.pendingAmendCharter.ref', 'EXECUTED'),
542
+ ],
543
+ },
544
+ effect: {
545
+ merge: [
546
+ { var: 'state' },
471
547
  {
472
548
  charterAmendments: {
473
- cat: [
474
- { var: "state.charterAmendments" },
549
+ merge: [
550
+ { var: 'state.charterAmendments' },
475
551
  [
476
552
  {
477
- amendmentId: { var: "event.amendmentId" },
478
- description: { var: "event.description" },
479
- effectiveDate: { var: "event.effectiveDate" },
480
- resolutionRef: { var: "event.resolutionRef" },
481
- filedDate: { var: "event.filedDate" },
553
+ amendmentId: { var: 'event.amendmentId' },
554
+ description: { var: 'event.description' },
555
+ effectiveDate: { var: 'event.effectiveDate' },
556
+ resolutionRef: { var: 'state.pendingAmendCharter.ref' },
557
+ filedDate: { var: 'event.filedDate' },
482
558
  },
483
559
  ],
484
560
  ],
485
561
  },
486
562
  legalName: {
487
563
  if: [
488
- { "!=": [{ var: "event.newLegalName" }, null] },
489
- { var: "event.newLegalName" },
490
- { var: "state.legalName" },
564
+ { '!=': [{ var: 'event.newLegalName' }, null] },
565
+ { var: 'event.newLegalName' },
566
+ { var: 'state.legalName' },
491
567
  ],
492
568
  },
493
- updatedAt: { var: "$timestamp" },
569
+ updatedAt: { var: '$ordinal' },
570
+ // clear the consumed proposal
571
+ pendingAmendCharter: null,
572
+ },
573
+ {
574
+ _emit: [{ name: 'CHARTER_AMENDED', data: { var: 'event' }, destination: 'external' }],
494
575
  },
495
576
  ],
496
577
  },
497
- emits: ["CHARTER_AMENDED"],
578
+ dependencies: [],
498
579
  },
499
580
  // ACTIVE -> ACTIVE (update_share_class)
500
581
  {
501
- from: "ACTIVE",
502
- to: "ACTIVE",
503
- eventName: "update_share_class",
582
+ from: 'ACTIVE',
583
+ to: 'ACTIVE',
584
+ eventName: 'update_share_class',
504
585
  guard: {
505
586
  some: [
506
- { var: "state.charterAmendments" },
587
+ { var: 'state.charterAmendments' },
507
588
  {
508
- "==": [
509
- { var: ".amendmentId" },
510
- { var: "event.charterAmendmentRef" },
511
- ],
589
+ '==': [{ var: 'amendmentId' }, { var: 'event.charterAmendmentRef' }],
512
590
  },
513
591
  ],
514
592
  },
515
593
  effect: {
516
594
  merge: [
517
- { var: "state" },
595
+ { var: 'state' },
518
596
  {
519
597
  shareStructure: {
520
598
  merge: [
521
- { var: "state.shareStructure" },
599
+ { var: 'state.shareStructure' },
522
600
  {
523
601
  classes: {
524
602
  map: [
525
- { var: "state.shareStructure.classes" },
603
+ { var: 'state.shareStructure.classes' },
526
604
  {
527
605
  if: [
528
606
  {
529
- "==": [
530
- { var: ".classId" },
531
- { var: "event.classId" },
532
- ],
607
+ '==': [{ var: 'classId' }, { var: 'event.classId' }],
533
608
  },
534
609
  {
535
- classId: { var: "event.classId" },
536
- className: { var: "event.className" },
537
- authorized: { var: "event.authorized" },
610
+ classId: { var: 'event.classId' },
611
+ className: { var: 'event.className' },
612
+ authorized: { var: 'event.authorized' },
538
613
  issued: 0,
539
614
  outstanding: 0,
540
615
  treasury: 0,
541
- parValue: { var: "event.parValue" },
542
- votingRights: { var: "event.votingRights" },
543
- votesPerShare: { var: "event.votesPerShare" },
616
+ parValue: { var: 'event.parValue' },
617
+ votingRights: { var: 'event.votingRights' },
618
+ votesPerShare: { var: 'event.votesPerShare' },
544
619
  liquidationPreference: {
545
- var: "event.liquidationPreference",
620
+ var: 'event.liquidationPreference',
546
621
  },
547
- dividendRate: { var: "event.dividendRate" },
548
- convertible: { var: "event.convertible" },
622
+ dividendRate: { var: 'event.dividendRate' },
623
+ convertible: { var: 'event.convertible' },
549
624
  },
550
- { var: "" },
625
+ { var: '' },
551
626
  ],
552
627
  },
553
628
  ],
@@ -561,111 +636,162 @@ exports.corpEntityDef = (0, fiber_app_js_1.defineFiberApp)({
561
636
  },
562
637
  // ACTIVE -> ACTIVE (update_registered_agent)
563
638
  {
564
- from: "ACTIVE",
565
- to: "ACTIVE",
566
- eventName: "update_registered_agent",
567
- guard: { "==": [1, 1] },
639
+ from: 'ACTIVE',
640
+ to: 'ACTIVE',
641
+ eventName: 'update_registered_agent',
642
+ // authority gate an identity role attestation (ISSUER/BOARD_MEMBER/...) layers on additively when the identity registry lands (docs/design/app-hardening-identity-integration.md §4.2)
643
+ guard: (0, guards_js_1.signerIsParty)('state.boardAuthority'),
568
644
  effect: {
569
645
  merge: [
570
- { var: "state" },
646
+ { var: 'state' },
571
647
  {
572
648
  registeredAgent: {
573
- name: { var: "event.name" },
574
- address: { var: "event.address" },
575
- phone: { var: "event.phone" },
576
- email: { var: "event.email" },
577
- effectiveDate: { var: "event.effectiveDate" },
649
+ name: { var: 'event.name' },
650
+ address: { var: 'event.address' },
651
+ phone: { var: 'event.phone' },
652
+ email: { var: 'event.email' },
653
+ effectiveDate: { var: 'event.effectiveDate' },
578
654
  },
579
655
  },
656
+ {
657
+ _emit: [{ name: 'REGISTERED_AGENT_CHANGED', data: { var: 'event' }, destination: 'external' }],
658
+ },
580
659
  ],
581
660
  },
582
- emits: ["REGISTERED_AGENT_CHANGED"],
583
661
  },
584
662
  // ACTIVE -> SUSPENDED
585
663
  {
586
- from: "ACTIVE",
587
- to: "SUSPENDED",
588
- eventName: "suspend",
589
- guard: { "==": [1, 1] },
664
+ from: 'ACTIVE',
665
+ to: 'SUSPENDED',
666
+ eventName: 'suspend',
667
+ // authority gate state-initiated enforcement; an identity role attestation (ISSUER/BOARD_MEMBER/...) layers on additively when the identity registry lands (docs/design/app-hardening-identity-integration.md §4.2)
668
+ guard: (0, guards_js_1.signerIsParty)('state.stateAuthority'),
590
669
  effect: {
591
670
  merge: [
592
- { var: "state" },
671
+ { var: 'state' },
593
672
  {
594
- status: "SUSPENDED",
595
- suspensionReason: { var: "event.reason" },
596
- suspensionDate: { var: "event.suspensionDate" },
673
+ status: 'SUSPENDED',
674
+ suspensionReason: { var: 'event.reason' },
675
+ suspensionDate: { var: 'event.suspensionDate' },
676
+ },
677
+ {
678
+ _emit: [{ name: 'CORPORATION_SUSPENDED', data: { var: 'event' }, destination: 'external' }],
597
679
  },
598
680
  ],
599
681
  },
600
- emits: ["CORPORATION_SUSPENDED"],
601
682
  },
602
683
  // SUSPENDED -> ACTIVE
603
684
  {
604
- from: "SUSPENDED",
605
- to: "ACTIVE",
606
- eventName: "reinstate",
607
- guard: { "==": [1, 1] },
685
+ from: 'SUSPENDED',
686
+ to: 'ACTIVE',
687
+ eventName: 'reinstate',
688
+ // authority gate an identity role attestation (ISSUER/BOARD_MEMBER/...) layers on additively when the identity registry lands (docs/design/app-hardening-identity-integration.md §4.2)
689
+ guard: (0, guards_js_1.signerIsParty)('state.boardAuthority'),
608
690
  effect: {
609
691
  merge: [
610
- { var: "state" },
692
+ { var: 'state' },
611
693
  {
612
- status: "ACTIVE",
694
+ status: 'ACTIVE',
613
695
  suspensionReason: null,
614
696
  suspensionDate: null,
615
697
  },
698
+ {
699
+ _emit: [{ name: 'CORPORATION_REINSTATED', data: { var: 'event' }, destination: 'external' }],
700
+ },
616
701
  ],
617
702
  },
618
- emits: ["CORPORATION_REINSTATED"],
619
703
  },
620
- // ACTIVE -> DISSOLVED (voluntary)
704
+ // ACTIVE -> ACTIVE (propose_dissolve_voluntary) — phase 1 (#24): bind BOTH executing resolution
705
+ // fibers (board + shareholder) and record the pending dissolution, so dissolve_voluntary can read
706
+ // both resolutions' states next transition.
621
707
  {
622
- from: "ACTIVE",
623
- to: "DISSOLVED",
624
- eventName: "dissolve_voluntary",
625
- guard: { "==": [1, 1] },
626
- dependencies: [
627
- {
628
- machine: "corporate-resolution",
629
- instanceRef: { var: "event.boardResolutionRef" },
630
- requiredState: "EXECUTED",
631
- },
632
- {
633
- machine: "corporate-resolution",
634
- instanceRef: { var: "event.shareholderResolutionRef" },
635
- requiredState: "EXECUTED",
636
- },
637
- ],
708
+ from: 'ACTIVE',
709
+ to: 'ACTIVE',
710
+ eventName: 'propose_dissolve_voluntary',
711
+ // authority gate both the board and shareholder authorities must sign; identity role attestations (BOARD_MEMBER/...) layer on additively when the identity registry lands (docs/design/app-hardening-identity-integration.md §4.2)
712
+ guard: {
713
+ and: [(0, guards_js_1.signerIsParty)('state.boardAuthority'), (0, guards_js_1.signerIsParty)('state.shareholderAuthority')],
714
+ },
715
+ effect: {
716
+ merge: [
717
+ { var: 'state' },
718
+ {
719
+ pendingDissolveVoluntary: {
720
+ dissolutionDate: { var: 'event.dissolutionDate' },
721
+ boardRef: { var: 'event.boardResolutionRef' },
722
+ shareholderRef: { var: 'event.shareholderResolutionRef' },
723
+ proposedAt: { var: '$ordinal' },
724
+ },
725
+ },
726
+ // bind both resolution fibers so dissolve_voluntary can assert their states next transition
727
+ {
728
+ _addDependency: [
729
+ { fiberId: { var: 'event.boardResolutionRef' } },
730
+ { fiberId: { var: 'event.shareholderResolutionRef' } },
731
+ ],
732
+ },
733
+ ],
734
+ },
735
+ dependencies: [],
736
+ },
737
+ // ACTIVE -> DISSOLVED (dissolve_voluntary) — phase 2 (#24): execute once BOTH bound resolutions are
738
+ // EXECUTED. depInState replaces the dropped object-form dependencies (which silently never gated).
739
+ {
740
+ from: 'ACTIVE',
741
+ to: 'DISSOLVED',
742
+ eventName: 'dissolve_voluntary',
743
+ // authority gate — both the board and shareholder authorities must sign; identity role attestations (BOARD_MEMBER/...) layer on additively when the identity registry lands (docs/design/app-hardening-identity-integration.md §4.2)
744
+ guard: {
745
+ and: [
746
+ (0, guards_js_1.signerIsParty)('state.boardAuthority'),
747
+ (0, guards_js_1.signerIsParty)('state.shareholderAuthority'),
748
+ // the proposal must target this dissolution, and its bound resolutions must both be EXECUTED
749
+ {
750
+ '==': [{ var: 'state.pendingDissolveVoluntary.dissolutionDate' }, { var: 'event.dissolutionDate' }],
751
+ },
752
+ (0, guards_js_1.depInState)('state.pendingDissolveVoluntary.boardRef', 'EXECUTED'),
753
+ (0, guards_js_1.depInState)('state.pendingDissolveVoluntary.shareholderRef', 'EXECUTED'),
754
+ ],
755
+ },
638
756
  effect: {
639
757
  merge: [
640
- { var: "state" },
758
+ { var: 'state' },
759
+ {
760
+ status: 'DISSOLVED',
761
+ dissolutionDate: { var: 'event.dissolutionDate' },
762
+ dissolutionReason: 'VOLUNTARY',
763
+ // clear the consumed proposal
764
+ pendingDissolveVoluntary: null,
765
+ },
641
766
  {
642
- status: "DISSOLVED",
643
- dissolutionDate: { var: "event.dissolutionDate" },
644
- dissolutionReason: "VOLUNTARY",
767
+ _emit: [{ name: 'CORPORATION_DISSOLVED', data: { var: 'event' }, destination: 'external' }],
645
768
  },
646
769
  ],
647
770
  },
648
- emits: ["CORPORATION_DISSOLVED"],
771
+ dependencies: [],
649
772
  },
650
773
  // SUSPENDED -> DISSOLVED (administrative)
651
774
  {
652
- from: "SUSPENDED",
653
- to: "DISSOLVED",
654
- eventName: "dissolve_administrative",
655
- guard: { "==": [1, 1] },
775
+ from: 'SUSPENDED',
776
+ to: 'DISSOLVED',
777
+ eventName: 'dissolve_administrative',
778
+ // authority gate state-initiated dissolution; an identity role attestation (ISSUER/BOARD_MEMBER/...) layers on additively when the identity registry lands (docs/design/app-hardening-identity-integration.md §4.2)
779
+ guard: (0, guards_js_1.signerIsParty)('state.stateAuthority'),
656
780
  effect: {
657
781
  merge: [
658
- { var: "state" },
782
+ { var: 'state' },
659
783
  {
660
- status: "DISSOLVED",
661
- dissolutionDate: { var: "event.dissolutionDate" },
784
+ status: 'DISSOLVED',
785
+ dissolutionDate: { var: 'event.dissolutionDate' },
662
786
  dissolutionReason: {
663
- cat: ["ADMINISTRATIVE: ", { var: "event.reason" }],
787
+ cat: ['ADMINISTRATIVE: ', { var: 'event.reason' }],
664
788
  },
665
789
  },
790
+ {
791
+ _emit: [{ name: 'CORPORATION_DISSOLVED', data: { var: 'event' }, destination: 'external' }],
792
+ },
666
793
  ],
667
794
  },
668
- emits: ["CORPORATION_DISSOLVED"],
669
795
  },
670
796
  ],
671
797
  });