@ottochain/sdk 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/dist/cjs/apps/contracts/index.js +15 -8
  2. package/dist/cjs/apps/contracts/state-machines/contract-agreement.js +35 -40
  3. package/dist/cjs/apps/contracts/state-machines/contract-escrow.js +80 -37
  4. package/dist/cjs/apps/contracts/state-machines/contract-universal.js +4 -4
  5. package/dist/cjs/apps/corporate/index.js +2 -2
  6. package/dist/cjs/apps/corporate/state-machines/corp-board.js +169 -59
  7. package/dist/cjs/apps/corporate/state-machines/corp-entity.js +245 -47
  8. package/dist/cjs/apps/corporate/state-machines/corp-securities.js +407 -99
  9. package/dist/cjs/apps/corporate/state-machines/corp-shareholders.js +151 -37
  10. package/dist/cjs/apps/governance/index.js +14 -14
  11. package/dist/cjs/apps/governance/state-machines/dao-multisig.js +58 -40
  12. package/dist/cjs/apps/governance/state-machines/dao-reputation.js +46 -40
  13. package/dist/cjs/apps/governance/state-machines/dao-single.js +28 -11
  14. package/dist/cjs/apps/governance/state-machines/dao-token.js +67 -41
  15. package/dist/cjs/apps/governance/state-machines/governance-simple.js +93 -61
  16. package/dist/cjs/apps/governance/state-machines/governance-universal.js +2 -2
  17. package/dist/cjs/apps/identity/constants.js +55 -14
  18. package/dist/cjs/apps/identity/index.js +27 -11
  19. package/dist/cjs/apps/identity/state-machines/identity-agent.js +3 -3
  20. package/dist/cjs/apps/identity/state-machines/identity-oracle.js +25 -22
  21. package/dist/cjs/apps/identity/state-machines/identity-registry.js +288 -0
  22. package/dist/cjs/apps/identity/state-machines/identity-universal.js +3 -3
  23. package/dist/cjs/apps/identity/state-machines/index.js +3 -1
  24. package/dist/cjs/apps/index.js +19 -8
  25. package/dist/cjs/apps/lending/assets.js +223 -0
  26. package/dist/cjs/apps/lending/credit-scoring.js +87 -0
  27. package/dist/cjs/apps/lending/eligibility.js +121 -0
  28. package/dist/cjs/apps/lending/index.js +91 -0
  29. package/dist/cjs/apps/lending/state-machines/index.js +9 -0
  30. package/dist/cjs/apps/lending/state-machines/lending-zk-loan.js +412 -0
  31. package/dist/cjs/apps/markets/index.js +21 -11
  32. package/dist/cjs/apps/markets/state-machines/market-auction.js +14 -13
  33. package/dist/cjs/apps/markets/state-machines/market-crowdfund.js +29 -24
  34. package/dist/cjs/apps/markets/state-machines/market-group-buy.js +24 -26
  35. package/dist/cjs/apps/markets/state-machines/market-prediction.js +80 -53
  36. package/dist/cjs/apps/markets/state-machines/market-universal.js +5 -5
  37. package/dist/cjs/apps/oracles/index.js +2 -2
  38. package/dist/cjs/errors.js +3 -3
  39. package/dist/cjs/generated/google/protobuf/struct.js +4 -4
  40. package/dist/cjs/generated/index.js +11 -7
  41. package/dist/cjs/generated/openapi.js +6 -0
  42. package/dist/cjs/generated/ottochain/apps/contracts/v1/contract.js +50 -50
  43. package/dist/cjs/generated/ottochain/apps/corporate/v1/corporate.js +19 -20
  44. package/dist/cjs/generated/ottochain/apps/governance/v1/governance.js +13 -13
  45. package/dist/cjs/generated/ottochain/apps/identity/v1/attestation.js +4 -4
  46. package/dist/cjs/generated/ottochain/apps/identity/v1/identity.js +124 -130
  47. package/dist/cjs/generated/ottochain/apps/markets/v1/market.js +107 -107
  48. package/dist/cjs/generated/ottochain/v1/common.js +4 -4
  49. package/dist/cjs/generated/ottochain/v1/fiber.js +4 -4
  50. package/dist/cjs/index.js +41 -7
  51. package/dist/cjs/openapi.js +2 -0
  52. package/dist/cjs/ottochain/drop-nulls.js +1 -2
  53. package/dist/cjs/ottochain/genesis-manifest.js +11 -11
  54. package/dist/cjs/ottochain/index.js +23 -13
  55. package/dist/cjs/ottochain/metagraph-client.js +65 -8
  56. package/dist/cjs/ottochain/snapshot.js +11 -12
  57. package/dist/cjs/ottochain/transaction.js +57 -14
  58. package/dist/cjs/ottochain/types.js +16 -2
  59. package/dist/cjs/privacy/index.js +14 -0
  60. package/dist/cjs/privacy/sealed-bid.js +210 -0
  61. package/dist/cjs/privacy/shield-app.js +131 -0
  62. package/dist/cjs/schema/effects.js +40 -0
  63. package/dist/cjs/schema/fiber-app.js +19 -13
  64. package/dist/cjs/schema/guard-lint.js +352 -0
  65. package/dist/cjs/schema/guards.js +246 -0
  66. package/dist/cjs/signing.js +80 -0
  67. package/dist/cjs/types.js +2 -3
  68. package/dist/cjs/validation.js +8 -8
  69. package/dist/cjs/verify.js +9 -4
  70. package/dist/cjs/zk/commit.js +53 -0
  71. package/dist/cjs/zk/guard.js +107 -0
  72. package/dist/cjs/zk/index.js +48 -0
  73. package/dist/cjs/zk/preimage.js +37 -0
  74. package/dist/cjs/zk/prover.js +87 -0
  75. package/dist/cjs/zk/registry.js +62 -0
  76. package/dist/cjs/zk/types.js +28 -0
  77. package/dist/cjs/zk/witness.js +19 -0
  78. package/dist/esm/apps/contracts/index.js +7 -3
  79. package/dist/esm/apps/contracts/state-machines/contract-agreement.js +35 -40
  80. package/dist/esm/apps/contracts/state-machines/contract-escrow.js +80 -37
  81. package/dist/esm/apps/contracts/state-machines/contract-universal.js +4 -4
  82. package/dist/esm/apps/corporate/state-machines/corp-board.js +169 -59
  83. package/dist/esm/apps/corporate/state-machines/corp-entity.js +245 -47
  84. package/dist/esm/apps/corporate/state-machines/corp-securities.js +407 -99
  85. package/dist/esm/apps/corporate/state-machines/corp-shareholders.js +151 -37
  86. package/dist/esm/apps/governance/state-machines/dao-multisig.js +58 -40
  87. package/dist/esm/apps/governance/state-machines/dao-reputation.js +46 -40
  88. package/dist/esm/apps/governance/state-machines/dao-single.js +28 -11
  89. package/dist/esm/apps/governance/state-machines/dao-token.js +67 -41
  90. package/dist/esm/apps/governance/state-machines/governance-simple.js +93 -61
  91. package/dist/esm/apps/governance/state-machines/governance-universal.js +2 -2
  92. package/dist/esm/apps/identity/constants.js +51 -12
  93. package/dist/esm/apps/identity/index.js +12 -7
  94. package/dist/esm/apps/identity/state-machines/identity-agent.js +3 -3
  95. package/dist/esm/apps/identity/state-machines/identity-oracle.js +25 -22
  96. package/dist/esm/apps/identity/state-machines/identity-registry.js +285 -0
  97. package/dist/esm/apps/identity/state-machines/identity-universal.js +3 -3
  98. package/dist/esm/apps/identity/state-machines/index.js +1 -0
  99. package/dist/esm/apps/index.js +1 -0
  100. package/dist/esm/apps/lending/assets.js +207 -0
  101. package/dist/esm/apps/lending/credit-scoring.js +81 -0
  102. package/dist/esm/apps/lending/eligibility.js +115 -0
  103. package/dist/esm/apps/lending/index.js +69 -0
  104. package/dist/esm/apps/lending/state-machines/index.js +5 -0
  105. package/dist/esm/apps/lending/state-machines/lending-zk-loan.js +409 -0
  106. package/dist/esm/apps/markets/index.js +8 -4
  107. package/dist/esm/apps/markets/state-machines/market-auction.js +14 -13
  108. package/dist/esm/apps/markets/state-machines/market-crowdfund.js +29 -24
  109. package/dist/esm/apps/markets/state-machines/market-group-buy.js +24 -26
  110. package/dist/esm/apps/markets/state-machines/market-prediction.js +80 -53
  111. package/dist/esm/apps/markets/state-machines/market-universal.js +5 -5
  112. package/dist/esm/generated/index.js +9 -5
  113. package/dist/esm/generated/openapi.js +5 -0
  114. package/dist/esm/generated/ottochain/apps/contracts/v1/contract.js +46 -46
  115. package/dist/esm/generated/ottochain/apps/identity/v1/identity.js +114 -120
  116. package/dist/esm/generated/ottochain/apps/markets/v1/market.js +100 -100
  117. package/dist/esm/index.js +21 -2
  118. package/dist/esm/openapi.js +1 -0
  119. package/dist/esm/ottochain/genesis-manifest.js +9 -9
  120. package/dist/esm/ottochain/index.js +2 -3
  121. package/dist/esm/ottochain/metagraph-client.js +65 -8
  122. package/dist/esm/ottochain/snapshot.js +4 -4
  123. package/dist/esm/ottochain/transaction.js +43 -3
  124. package/dist/esm/ottochain/types.js +15 -1
  125. package/dist/esm/privacy/index.js +6 -0
  126. package/dist/esm/privacy/sealed-bid.js +206 -0
  127. package/dist/esm/privacy/shield-app.js +127 -0
  128. package/dist/esm/schema/effects.js +35 -0
  129. package/dist/esm/schema/fiber-app.js +13 -6
  130. package/dist/esm/schema/guard-lint.js +346 -0
  131. package/dist/esm/schema/guards.js +229 -0
  132. package/dist/esm/signing.js +74 -0
  133. package/dist/esm/verify.js +8 -2
  134. package/dist/esm/zk/commit.js +44 -0
  135. package/dist/esm/zk/guard.js +99 -0
  136. package/dist/esm/zk/index.js +19 -0
  137. package/dist/esm/zk/preimage.js +30 -0
  138. package/dist/esm/zk/prover.js +82 -0
  139. package/dist/esm/zk/registry.js +55 -0
  140. package/dist/esm/zk/types.js +25 -0
  141. package/dist/esm/zk/witness.js +15 -0
  142. package/dist/types/apps/contracts/index.d.ts +69 -209
  143. package/dist/types/apps/contracts/state-machines/contract-agreement.d.ts +20 -95
  144. package/dist/types/apps/contracts/state-machines/contract-escrow.d.ts +46 -112
  145. package/dist/types/apps/corporate/index.d.ts +1040 -304
  146. package/dist/types/apps/corporate/state-machines/corp-board.d.ts +188 -52
  147. package/dist/types/apps/corporate/state-machines/corp-entity.d.ts +267 -62
  148. package/dist/types/apps/corporate/state-machines/corp-securities.d.ts +355 -131
  149. package/dist/types/apps/corporate/state-machines/corp-shareholders.d.ts +225 -53
  150. package/dist/types/apps/governance/index.d.ts +296 -398
  151. package/dist/types/apps/governance/state-machines/dao-multisig.d.ts +77 -92
  152. package/dist/types/apps/governance/state-machines/dao-reputation.d.ts +42 -66
  153. package/dist/types/apps/governance/state-machines/dao-single.d.ts +25 -47
  154. package/dist/types/apps/governance/state-machines/dao-token.d.ts +60 -49
  155. package/dist/types/apps/governance/state-machines/governance-simple.d.ts +87 -117
  156. package/dist/types/apps/governance/state-machines/governance-universal.d.ts +2 -2
  157. package/dist/types/apps/identity/constants.d.ts +32 -4
  158. package/dist/types/apps/identity/index.d.ts +378 -94
  159. package/dist/types/apps/identity/state-machines/identity-oracle.d.ts +16 -87
  160. package/dist/types/apps/identity/state-machines/identity-registry.d.ts +379 -0
  161. package/dist/types/apps/identity/state-machines/index.d.ts +1 -0
  162. package/dist/types/apps/index.d.ts +1 -0
  163. package/dist/types/apps/lending/assets.d.ts +258 -0
  164. package/dist/types/apps/lending/credit-scoring.d.ts +80 -0
  165. package/dist/types/apps/lending/eligibility.d.ts +83 -0
  166. package/dist/types/apps/lending/index.d.ts +548 -0
  167. package/dist/types/apps/lending/state-machines/index.d.ts +5 -0
  168. package/dist/types/apps/lending/state-machines/lending-zk-loan.d.ts +528 -0
  169. package/dist/types/apps/markets/index.d.ts +108 -203
  170. package/dist/types/apps/markets/state-machines/market-auction.d.ts +13 -37
  171. package/dist/types/apps/markets/state-machines/market-crowdfund.d.ts +16 -34
  172. package/dist/types/apps/markets/state-machines/market-group-buy.d.ts +17 -43
  173. package/dist/types/apps/markets/state-machines/market-prediction.d.ts +51 -72
  174. package/dist/types/apps/markets/state-machines/market-universal.d.ts +5 -5
  175. package/dist/types/generated/index.d.ts +5 -5
  176. package/dist/types/generated/openapi.d.ts +1257 -0
  177. package/dist/types/generated/ottochain/apps/contracts/v1/contract.d.ts +5 -5
  178. package/dist/types/generated/ottochain/apps/identity/v1/identity.d.ts +12 -12
  179. package/dist/types/generated/ottochain/apps/markets/v1/market.d.ts +11 -11
  180. package/dist/types/index.d.ts +6 -2
  181. package/dist/types/openapi.d.ts +22 -0
  182. package/dist/types/ottochain/genesis-manifest.d.ts +5 -5
  183. package/dist/types/ottochain/index.d.ts +5 -6
  184. package/dist/types/ottochain/metagraph-client.d.ts +49 -7
  185. package/dist/types/ottochain/snapshot.d.ts +6 -6
  186. package/dist/types/ottochain/transaction.d.ts +33 -1
  187. package/dist/types/ottochain/types.d.ts +335 -30
  188. package/dist/types/privacy/index.d.ts +6 -0
  189. package/dist/types/privacy/sealed-bid.d.ts +348 -0
  190. package/dist/types/privacy/shield-app.d.ts +48 -0
  191. package/dist/types/schema/effects.d.ts +34 -0
  192. package/dist/types/schema/fiber-app.d.ts +1 -2
  193. package/dist/types/schema/guard-lint.d.ts +111 -0
  194. package/dist/types/schema/guards.d.ts +134 -0
  195. package/dist/types/signing.d.ts +45 -0
  196. package/dist/types/validation.d.ts +22 -217
  197. package/dist/types/verify.d.ts +4 -0
  198. package/dist/types/zk/commit.d.ts +28 -0
  199. package/dist/types/zk/guard.d.ts +46 -0
  200. package/dist/types/zk/index.d.ts +19 -0
  201. package/dist/types/zk/preimage.d.ts +10 -0
  202. package/dist/types/zk/prover.d.ts +34 -0
  203. package/dist/types/zk/registry.d.ts +34 -0
  204. package/dist/types/zk/types.d.ts +33 -0
  205. package/dist/types/zk/witness.d.ts +40 -0
  206. package/package.json +27 -13
  207. package/dist/cjs/ottochain/normalize.js +0 -186
  208. package/dist/esm/ottochain/normalize.js +0 -179
  209. package/dist/types/ottochain/normalize.d.ts +0 -79
@@ -10,7 +10,7 @@
10
10
  * package at genesis.
11
11
  *
12
12
  * DESIGN — content, not consensus hashes:
13
- * The manifest ships CONTENT only: the `schemaShape` (the typed, proto-faithful
13
+ * The manifest ships CONTENT only: the `machineShape` (the typed, proto-faithful
14
14
  * projection of the app's state message) and the `definition` (the JSON-Logic
15
15
  * `StateMachineDefinition`, verbatim — the same object the chain decodes for any
16
16
  * fiber). The CHAIN computes the consensus values itself from this content:
@@ -38,13 +38,14 @@
38
38
  * payloads. Deriving per-event command shapes is a flagged follow-up.
39
39
  *
40
40
  * The JSON shape emitted here is built to deserialize against the chain's circe
41
- * codecs (`SchemaShape` / `FieldShape` / `MessageShape` and
41
+ * codecs (`MachineShape` / `FieldShape` / `MessageShape` and
42
42
  * `StateMachineDefinition`), whose magnolia config is camelCase with defaults.
43
43
  *
44
44
  * @packageDocumentation
45
45
  */
46
46
  Object.defineProperty(exports, "__esModule", { value: true });
47
- exports.buildGenesisManifest = exports.GENESIS_MANIFEST_VERSION = void 0;
47
+ exports.GENESIS_MANIFEST_VERSION = void 0;
48
+ exports.buildGenesisManifest = buildGenesisManifest;
48
49
  const identity_universal_js_1 = require("../apps/identity/state-machines/identity-universal.js");
49
50
  const governance_universal_js_1 = require("../apps/governance/state-machines/governance-universal.js");
50
51
  const market_universal_js_1 = require("../apps/markets/state-machines/market-universal.js");
@@ -68,8 +69,8 @@ const identityStateMessage = {
68
69
  field('address', 2, 'string'),
69
70
  field('public_key', 3, 'string'),
70
71
  field('display_name', 4, 'string'),
71
- field('identity_type', 5, 'ottochain.apps.identity.v1.IdentityType'),
72
- field('state', 6, 'ottochain.apps.identity.v1.IdentityState'),
72
+ field('identity_type', 5, 'ottochain.apps.identity.v1.Type'),
73
+ field('state', 6, 'ottochain.apps.identity.v1.State'),
73
74
  field('reputation', 7, 'ottochain.apps.identity.v1.Reputation'),
74
75
  field('stake', 8, 'int64'),
75
76
  field('domains', 9, 'string', true),
@@ -100,7 +101,7 @@ const marketStateMessage = {
100
101
  typeName: 'ottochain.apps.markets.v1.Market',
101
102
  fields: [
102
103
  field('id', 1, 'string'),
103
- field('market_type', 2, 'ottochain.apps.markets.v1.MarketType'),
104
+ field('market_type', 2, 'ottochain.apps.markets.v1.Type'),
104
105
  field('creator', 3, 'string'),
105
106
  field('title', 4, 'string'),
106
107
  field('terms', 5, 'google.protobuf.Struct'),
@@ -110,7 +111,7 @@ const marketStateMessage = {
110
111
  field('oracles', 9, 'string', true),
111
112
  field('quorum', 10, 'int32'),
112
113
  field('resolutions', 11, 'ottochain.apps.markets.v1.Resolution', true),
113
- field('status', 12, 'ottochain.apps.markets.v1.MarketState'),
114
+ field('status', 12, 'ottochain.apps.markets.v1.State'),
114
115
  field('created_at', 13, 'google.protobuf.Timestamp'),
115
116
  field('updated_at', 14, 'google.protobuf.Timestamp'),
116
117
  ],
@@ -168,7 +169,7 @@ function buildGenesisManifest() {
168
169
  semver: '1.0.0',
169
170
  strict: false,
170
171
  metadata: {},
171
- schemaShape: { stateMessage: identityStateMessage, commands: {} },
172
+ machineShape: { stateMessage: identityStateMessage, commands: {} },
172
173
  definition: toWireDefinition(identity_universal_js_1.identityUniversalDef),
173
174
  },
174
175
  {
@@ -176,7 +177,7 @@ function buildGenesisManifest() {
176
177
  semver: '1.0.0',
177
178
  strict: false,
178
179
  metadata: {},
179
- schemaShape: { stateMessage: governanceStateMessage, commands: {} },
180
+ machineShape: { stateMessage: governanceStateMessage, commands: {} },
180
181
  definition: toWireDefinition(governance_universal_js_1.govUniversalDef),
181
182
  },
182
183
  {
@@ -184,10 +185,9 @@ function buildGenesisManifest() {
184
185
  semver: '1.0.0',
185
186
  strict: false,
186
187
  metadata: {},
187
- schemaShape: { stateMessage: marketStateMessage, commands: {} },
188
+ machineShape: { stateMessage: marketStateMessage, commands: {} },
188
189
  definition: toWireDefinition(market_universal_js_1.marketUniversalDef),
189
190
  },
190
191
  ];
191
192
  return { version: exports.GENESIS_MANIFEST_VERSION, packages };
192
193
  }
193
- exports.buildGenesisManifest = buildGenesisManifest;
@@ -22,20 +22,31 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
22
22
  }) : function(o, v) {
23
23
  o["default"] = v;
24
24
  });
25
- var __importStar = (this && this.__importStar) || function (mod) {
26
- if (mod && mod.__esModule) return mod;
27
- var result = {};
28
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
- __setModuleDefault(result, mod);
30
- return result;
31
- };
25
+ var __importStar = (this && this.__importStar) || (function () {
26
+ var ownKeys = function(o) {
27
+ ownKeys = Object.getOwnPropertyNames || function (o) {
28
+ var ar = [];
29
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
30
+ return ar;
31
+ };
32
+ return ownKeys(o);
33
+ };
34
+ return function (mod) {
35
+ if (mod && mod.__esModule) return mod;
36
+ var result = {};
37
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
38
+ __setModuleDefault(result, mod);
39
+ return result;
40
+ };
41
+ })();
32
42
  Object.defineProperty(exports, "__esModule", { value: true });
33
- exports.GENESIS_MANIFEST_VERSION = exports.buildGenesisManifest = exports.dropNulls = exports.normalizeMessage = exports.normalizeArchiveStateMachine = exports.normalizeTransitionStateMachine = exports.normalizeCreateStateMachine = exports.createDataTransactionRequest = exports.createScriptPayload = exports.createStateMachinePayload = exports.getPublicKeyForRegistration = exports.addTransactionSignature = exports.signTransaction = exports.createInvokeScriptPayload = exports.createArchivePayload = exports.createTransitionPayload = exports.MetagraphClient = exports.extractOnChainState = exports.getScriptInvocations = exports.getEventReceipts = exports.getLogsForFiber = exports.getLatestOnChainState = exports.getSnapshotOnChainState = exports.decodeOnChainState = exports.OTTOCHAIN_MESSAGE_TYPES = exports.proto = void 0;
43
+ exports.GENESIS_MANIFEST_VERSION = exports.buildGenesisManifest = exports.dropNulls = exports.createAuthorizeComposePayload = exports.createApplyMorphismPayload = exports.createMintAssetPayload = exports.createAssetPolicyPayload = exports.createDataTransactionRequest = exports.createScriptPayload = exports.createStateMachinePayload = exports.getPublicKeyForRegistration = exports.addTransactionSignature = exports.signTransaction = exports.createInvokeScriptPayload = exports.createArchivePayload = exports.createTransitionPayload = exports.MetagraphClient = exports.extractOnChainState = exports.getScriptInvocations = exports.getEventReceipts = exports.getLogsForFiber = exports.getLatestOnChainState = exports.getSnapshotOnChainState = exports.decodeOnChainState = exports.TOKEN_BEHAVIOR_BITS = exports.OTTOCHAIN_MESSAGE_TYPES = exports.proto = void 0;
34
44
  // Re-export generated protobuf types (for binary encoding)
35
45
  exports.proto = __importStar(require("../generated/index.js"));
36
46
  // Runtime message type validation
37
47
  var types_js_1 = require("./types.js");
38
48
  Object.defineProperty(exports, "OTTOCHAIN_MESSAGE_TYPES", { enumerable: true, get: function () { return types_js_1.OTTOCHAIN_MESSAGE_TYPES; } });
49
+ Object.defineProperty(exports, "TOKEN_BEHAVIOR_BITS", { enumerable: true, get: function () { return types_js_1.TOKEN_BEHAVIOR_BITS; } });
39
50
  var snapshot_js_1 = require("./snapshot.js");
40
51
  Object.defineProperty(exports, "decodeOnChainState", { enumerable: true, get: function () { return snapshot_js_1.decodeOnChainState; } });
41
52
  Object.defineProperty(exports, "getSnapshotOnChainState", { enumerable: true, get: function () { return snapshot_js_1.getSnapshotOnChainState; } });
@@ -57,12 +68,11 @@ Object.defineProperty(exports, "getPublicKeyForRegistration", { enumerable: true
57
68
  Object.defineProperty(exports, "createStateMachinePayload", { enumerable: true, get: function () { return transaction_js_1.createStateMachinePayload; } });
58
69
  Object.defineProperty(exports, "createScriptPayload", { enumerable: true, get: function () { return transaction_js_1.createScriptPayload; } });
59
70
  Object.defineProperty(exports, "createDataTransactionRequest", { enumerable: true, get: function () { return transaction_js_1.createDataTransactionRequest; } });
71
+ Object.defineProperty(exports, "createAssetPolicyPayload", { enumerable: true, get: function () { return transaction_js_1.createAssetPolicyPayload; } });
72
+ Object.defineProperty(exports, "createMintAssetPayload", { enumerable: true, get: function () { return transaction_js_1.createMintAssetPayload; } });
73
+ Object.defineProperty(exports, "createApplyMorphismPayload", { enumerable: true, get: function () { return transaction_js_1.createApplyMorphismPayload; } });
74
+ Object.defineProperty(exports, "createAuthorizeComposePayload", { enumerable: true, get: function () { return transaction_js_1.createAuthorizeComposePayload; } });
60
75
  // Data utilities
61
- var normalize_js_1 = require("./normalize.js");
62
- Object.defineProperty(exports, "normalizeCreateStateMachine", { enumerable: true, get: function () { return normalize_js_1.normalizeCreateStateMachine; } });
63
- Object.defineProperty(exports, "normalizeTransitionStateMachine", { enumerable: true, get: function () { return normalize_js_1.normalizeTransitionStateMachine; } });
64
- Object.defineProperty(exports, "normalizeArchiveStateMachine", { enumerable: true, get: function () { return normalize_js_1.normalizeArchiveStateMachine; } });
65
- Object.defineProperty(exports, "normalizeMessage", { enumerable: true, get: function () { return normalize_js_1.normalizeMessage; } });
66
76
  var drop_nulls_js_1 = require("./drop-nulls.js");
67
77
  Object.defineProperty(exports, "dropNulls", { enumerable: true, get: function () { return drop_nulls_js_1.dropNulls; } });
68
78
  // Genesis manifest exporter (std-app pre-registration content)
@@ -5,7 +5,7 @@
5
5
  * Client for interacting with ottochain ML0 custom routes (/v1 prefix)
6
6
  * and framework snapshot endpoints.
7
7
  *
8
- * @see modules/l0/src/main/scala/xyz/kd5ujc/metagraph_l0/ML0CustomRoutes.scala
8
+ * @see modules/l0/src/main/scala/xyz/kd5ujc/metagraph_l0/ML0Routes.scala
9
9
  * @see modules/data_l1/src/main/scala/xyz/kd5ujc/data_l1/DataL1CustomRoutes.scala
10
10
  * @packageDocumentation
11
11
  */
@@ -31,7 +31,7 @@ const snapshot_js_1 = require("./snapshot.js");
31
31
  * const onChain = await client.getOnChain();
32
32
  *
33
33
  * // Get all active state machines
34
- * const machines = await client.getStateMachines('Active');
34
+ * const machines = await client.getStateMachines('ACTIVE');
35
35
  *
36
36
  * // Get event receipts for a fiber
37
37
  * const events = await client.getStateMachineEvents(fiberId);
@@ -90,18 +90,18 @@ class MetagraphClient {
90
90
  return this.ml0.get(`/data-application/v1/state-machines/${fiberId}/events`);
91
91
  }
92
92
  /**
93
- * Get all script oracles, optionally filtered by status.
93
+ * Get all scripts, optionally filtered by status.
94
94
  */
95
95
  async getScripts(status) {
96
96
  const query = status ? `?status=${status}` : '';
97
- return this.ml0.get(`/data-application/v1/oracles${query}`);
97
+ return this.ml0.get(`/data-application/v1/scripts${query}`);
98
98
  }
99
99
  /**
100
- * Get a single script oracle by fiber ID.
100
+ * Get a single script by fiber ID.
101
101
  */
102
102
  async getScript(scriptId) {
103
103
  try {
104
- return await this.ml0.get(`/data-application/v1/oracles/${scriptId}`);
104
+ return await this.ml0.get(`/data-application/v1/scripts/${scriptId}`);
105
105
  }
106
106
  catch (error) {
107
107
  if (error instanceof network_1.NetworkError && error.statusCode === 404) {
@@ -111,10 +111,67 @@ class MetagraphClient {
111
111
  }
112
112
  }
113
113
  /**
114
- * Get oracle invocations from the current ordinal's logs.
114
+ * Get script invocations from the current ordinal's logs.
115
115
  */
116
116
  async getScriptInvocations(scriptId) {
117
- return this.ml0.get(`/data-application/v1/oracles/${scriptId}/invocations`);
117
+ return this.ml0.get(`/data-application/v1/scripts/${scriptId}/invocations`);
118
+ }
119
+ // -------------------------------------------------------------------------
120
+ // Registry, audit, state-proofs, fee estimates (ML0 /data-application/v1/*)
121
+ // -------------------------------------------------------------------------
122
+ /** Get the metagraph version string. */
123
+ async getVersion() {
124
+ return this.ml0.get('/data-application/v1/version');
125
+ }
126
+ /** Get the full registry namespace, keyed by full registry name `labels.tld`. */
127
+ async getRegistry() {
128
+ return this.ml0.get('/data-application/v1/registry');
129
+ }
130
+ /** Resolve a single registry entry by full name (`labels.tld`), or null if unregistered. */
131
+ async getRegistryEntry(name) {
132
+ try {
133
+ return await this.ml0.get(`/data-application/v1/registry/${encodeURIComponent(name)}`);
134
+ }
135
+ catch (error) {
136
+ if (error instanceof network_1.NetworkError && error.statusCode === 404)
137
+ return null;
138
+ throw error;
139
+ }
140
+ }
141
+ /** Reverse-resolve a fiber UUID to its canonical registered name (#29), or null. */
142
+ async getReverseName(fiberId) {
143
+ try {
144
+ return await this.ml0.get(`/data-application/v1/registry/reverse/${fiberId}`);
145
+ }
146
+ catch (error) {
147
+ if (error instanceof network_1.NetworkError && error.statusCode === 404)
148
+ return null;
149
+ throw error;
150
+ }
151
+ }
152
+ /** Get the rendered audit-trail lines for a state-machine fiber. */
153
+ async getStateMachineAudit(fiberId) {
154
+ return this.ml0.get(`/data-application/v1/state-machines/${fiberId}/audit`);
155
+ }
156
+ /** Light-client state proof for a field of a state-machine fiber, against the committed root. */
157
+ async getStateMachineStateProof(fiberId, field) {
158
+ return this.ml0.get(`/data-application/v1/state-machines/${fiberId}/state-proof?field=${encodeURIComponent(field)}`);
159
+ }
160
+ /** Light-client state proof for a field of a script fiber. */
161
+ async getScriptStateProof(fiberId, field) {
162
+ return this.ml0.get(`/data-application/v1/scripts/${fiberId}/state-proof?field=${encodeURIComponent(field)}`);
163
+ }
164
+ /** Light-client state proof for a field of an asset instance. */
165
+ async getAssetStateProof(assetId, field) {
166
+ return this.ml0.get(`/data-application/v1/assets/${assetId}/state-proof?field=${encodeURIComponent(field)}`);
167
+ }
168
+ /** Estimate the fee/gas for a transition event on a state-machine fiber. */
169
+ async estimateTransitionFee(fiberId, eventName) {
170
+ return this.ml0.get(`/data-application/v1/state-machines/${fiberId}/estimate-fee?event=${encodeURIComponent(eventName)}`);
171
+ }
172
+ /** Estimate the fee/gas for invoking a script fiber. */
173
+ async estimateScriptFee(fiberId) {
174
+ return this.ml0.get(`/data-application/v1/scripts/${fiberId}/estimate-fee`);
118
175
  }
119
176
  // -------------------------------------------------------------------------
120
177
  // Framework snapshot endpoints (ML0 /snapshots/*)
@@ -11,7 +11,13 @@
11
11
  * @packageDocumentation
12
12
  */
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.getScriptInvocations = exports.getEventReceipts = exports.getLogsForFiber = exports.extractOnChainState = exports.getLatestOnChainState = exports.getSnapshotOnChainState = exports.decodeOnChainState = void 0;
14
+ exports.decodeOnChainState = decodeOnChainState;
15
+ exports.getSnapshotOnChainState = getSnapshotOnChainState;
16
+ exports.getLatestOnChainState = getLatestOnChainState;
17
+ exports.extractOnChainState = extractOnChainState;
18
+ exports.getLogsForFiber = getLogsForFiber;
19
+ exports.getEventReceipts = getEventReceipts;
20
+ exports.getScriptInvocations = getScriptInvocations;
15
21
  const network_1 = require("@constellation-network/metagraph-sdk/network");
16
22
  /**
17
23
  * Decode on-chain state from binary (JsonBinaryCodec format).
@@ -26,7 +32,6 @@ function decodeOnChainState(bytes) {
26
32
  const json = new TextDecoder().decode(bytes);
27
33
  return JSON.parse(json);
28
34
  }
29
- exports.decodeOnChainState = decodeOnChainState;
30
35
  /**
31
36
  * Fetch and decode the on-chain state from a specific snapshot ordinal.
32
37
  *
@@ -39,7 +44,6 @@ async function getSnapshotOnChainState(ml0BaseUrl, ordinal) {
39
44
  const snapshot = await client.get(`/snapshots/${ordinal}`);
40
45
  return extractOnChainState(snapshot);
41
46
  }
42
- exports.getSnapshotOnChainState = getSnapshotOnChainState;
43
47
  /**
44
48
  * Fetch and decode the on-chain state from the latest snapshot.
45
49
  *
@@ -51,7 +55,6 @@ async function getLatestOnChainState(ml0BaseUrl) {
51
55
  const snapshot = await client.get('/snapshots/latest');
52
56
  return extractOnChainState(snapshot);
53
57
  }
54
- exports.getLatestOnChainState = getLatestOnChainState;
55
58
  /**
56
59
  * Extract and decode on-chain state from a snapshot response.
57
60
  */
@@ -63,7 +66,6 @@ function extractOnChainState(snapshot) {
63
66
  const bytes = new Uint8Array(dataPart.onChainState);
64
67
  return decodeOnChainState(bytes);
65
68
  }
66
- exports.extractOnChainState = extractOnChainState;
67
69
  // ---------------------------------------------------------------------------
68
70
  // Log filtering helpers
69
71
  // ---------------------------------------------------------------------------
@@ -77,11 +79,10 @@ exports.extractOnChainState = extractOnChainState;
77
79
  function getLogsForFiber(onChain, fiberId) {
78
80
  return onChain.latestLogs[fiberId] ?? [];
79
81
  }
80
- exports.getLogsForFiber = getLogsForFiber;
81
82
  /**
82
83
  * Get EventReceipt log entries for a specific fiber.
83
84
  *
84
- * EventReceipts are distinguished from OracleInvocations by the presence
85
+ * EventReceipts are distinguished from ScriptInvocations by the presence
85
86
  * of the `eventName` field.
86
87
  *
87
88
  * @param onChain - Decoded on-chain state
@@ -92,19 +93,17 @@ function getEventReceipts(onChain, fiberId) {
92
93
  return getLogsForFiber(onChain, fiberId)
93
94
  .filter((entry) => 'eventName' in entry && 'success' in entry);
94
95
  }
95
- exports.getEventReceipts = getEventReceipts;
96
96
  /**
97
- * Get OracleInvocation log entries for a specific fiber.
97
+ * Get ScriptInvocation log entries for a specific fiber.
98
98
  *
99
- * OracleInvocations are distinguished from EventReceipts by the presence
99
+ * ScriptInvocations are distinguished from EventReceipts by the presence
100
100
  * of the `method` field.
101
101
  *
102
102
  * @param onChain - Decoded on-chain state
103
103
  * @param fiberId - Fiber UUID to filter by
104
- * @returns Array of OracleInvocation entries
104
+ * @returns Array of ScriptInvocation entries
105
105
  */
106
106
  function getScriptInvocations(onChain, fiberId) {
107
107
  return getLogsForFiber(onChain, fiberId)
108
108
  .filter((entry) => 'method' in entry && 'result' in entry);
109
109
  }
110
- exports.getScriptInvocations = getScriptInvocations;
@@ -6,11 +6,31 @@
6
6
  * self-signed mode, where clients sign their own transactions.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.getPublicKeyForRegistration = exports.addTransactionSignature = exports.createDataTransactionRequest = exports.signTransaction = exports.createInvokeScriptPayload = exports.createScriptPayload = exports.createArchivePayload = exports.createTransitionPayload = exports.createStateMachinePayload = void 0;
9
+ exports.createStateMachinePayload = createStateMachinePayload;
10
+ exports.createTransitionPayload = createTransitionPayload;
11
+ exports.createArchivePayload = createArchivePayload;
12
+ exports.createScriptPayload = createScriptPayload;
13
+ exports.createInvokeScriptPayload = createInvokeScriptPayload;
14
+ exports.createAssetPolicyPayload = createAssetPolicyPayload;
15
+ exports.createMintAssetPayload = createMintAssetPayload;
16
+ exports.createApplyMorphismPayload = createApplyMorphismPayload;
17
+ exports.createAuthorizeComposePayload = createAuthorizeComposePayload;
18
+ exports.signTransaction = signTransaction;
19
+ exports.createDataTransactionRequest = createDataTransactionRequest;
20
+ exports.addTransactionSignature = addTransactionSignature;
21
+ exports.getPublicKeyForRegistration = getPublicKeyForRegistration;
10
22
  const metagraph_sdk_1 = require("@constellation-network/metagraph-sdk");
23
+ const signing_js_1 = require("../signing.js");
11
24
  /**
12
25
  * Create a new state machine fiber payload.
13
26
  *
27
+ * @remarks
28
+ * `params.definition` is signed VERBATIM. Pass the output of `toProtoDefinition(def)` (the
29
+ * allowlisted wire shape) — NOT a raw `FiberAppDefinition`: extra authoring fields
30
+ * (`createSchema` / `stateSchema` / `eventSchemas` / per-transition `emits`) would be signed
31
+ * but re-encoded away by the chain, diverging the canonical → opaque `InvalidSignature`.
32
+ * See `tests/ottochain/signing-parity.test.ts`.
33
+ *
14
34
  * @param params - State machine creation parameters
15
35
  * @returns A CreateStateMachine message ready for signing
16
36
  *
@@ -37,7 +57,6 @@ function createStateMachinePayload(params) {
37
57
  },
38
58
  };
39
59
  }
40
- exports.createStateMachinePayload = createStateMachinePayload;
41
60
  /**
42
61
  * Create a transition payload ready for signing.
43
62
  *
@@ -66,7 +85,6 @@ function createTransitionPayload(params) {
66
85
  },
67
86
  };
68
87
  }
69
- exports.createTransitionPayload = createTransitionPayload;
70
88
  /**
71
89
  * Create an archive payload ready for signing.
72
90
  *
@@ -81,7 +99,6 @@ function createArchivePayload(params) {
81
99
  },
82
100
  };
83
101
  }
84
- exports.createArchivePayload = createArchivePayload;
85
102
  /**
86
103
  * Create a new script fiber payload.
87
104
  *
@@ -100,7 +117,7 @@ exports.createArchivePayload = createArchivePayload;
100
117
  * },
101
118
  * },
102
119
  * initialState: { value: 0 },
103
- * accessControl: { type: 'open' },
120
+ * accessControl: { Public: {} },
104
121
  * });
105
122
  * const signed = await signTransaction(script, privateKey);
106
123
  * ```
@@ -111,11 +128,10 @@ function createScriptPayload(params) {
111
128
  fiberId: params.fiberId,
112
129
  scriptProgram: params.scriptProgram,
113
130
  initialState: params.initialState ?? null,
114
- accessControl: params.accessControl ?? { type: 'open' },
131
+ accessControl: params.accessControl ?? { Public: {} },
115
132
  },
116
133
  };
117
134
  }
118
- exports.createScriptPayload = createScriptPayload;
119
135
  /**
120
136
  * Create an invoke script payload ready for signing.
121
137
  *
@@ -132,13 +148,41 @@ function createInvokeScriptPayload(params) {
132
148
  },
133
149
  };
134
150
  }
135
- exports.createInvokeScriptPayload = createInvokeScriptPayload;
151
+ // ============================================================================
152
+ // Asset Operations (asset-model.md §7)
153
+ // ============================================================================
154
+ //
155
+ // Thin typed wrappers: the chain message types ({@link CreateAssetPolicy}, etc.) already model
156
+ // every field (required vs `Option`), so these builders just apply the `{ MessageName: ... }`
157
+ // envelope, for API parity with the state-machine/script `create*Payload` helpers. Sign the result
158
+ // with {@link signTransaction} (the canonical `JCS(dropNulls)` path drops any omitted optionals).
159
+ /** Wrap a {@link CreateAssetPolicy} (publish an asset-policy package version). */
160
+ function createAssetPolicyPayload(params) {
161
+ return { CreateAssetPolicy: params };
162
+ }
163
+ /** Wrap a {@link MintAsset} (mint a new asset instance against a resolved policy version). */
164
+ function createMintAssetPayload(params) {
165
+ return { MintAsset: params };
166
+ }
167
+ /** Wrap an {@link ApplyMorphism} (apply a typed morphism to an asset instance). */
168
+ function createApplyMorphismPayload(params) {
169
+ return { ApplyMorphism: params };
170
+ }
171
+ /** Wrap an {@link AuthorizeCompose} (commit half of the symmetric-compose handshake). */
172
+ function createAuthorizeComposePayload(params) {
173
+ return { AuthorizeCompose: params };
174
+ }
136
175
  /**
137
176
  * Sign a transaction payload for self-signed mode.
138
177
  *
139
178
  * This creates a Signed<T> object with the exact format expected by the bridge's
140
179
  * `/agent/transition` endpoint when using self-signed mode.
141
180
  *
181
+ * The signature is computed over the null-dropped canonical bytes (null
182
+ * object fields removed recursively, array nulls preserved, then RFC 8785),
183
+ * matching metakit's content-hash rule. Explicit-null and absent optional
184
+ * fields therefore produce identical signatures.
185
+ *
142
186
  * @param message - The message to sign (e.g., from createTransitionPayload)
143
187
  * @param privateKey - The private key in hex format (64 characters)
144
188
  * @returns A signed object ready for submission to the bridge
@@ -171,13 +215,12 @@ exports.createInvokeScriptPayload = createInvokeScriptPayload;
171
215
  * ```
172
216
  */
173
217
  async function signTransaction(message, privateKey) {
174
- const proof = await (0, metagraph_sdk_1.signDataUpdate)(message, privateKey);
218
+ const proof = await (0, signing_js_1.signDataUpdate)(message, privateKey);
175
219
  return {
176
220
  value: message,
177
221
  proofs: [proof],
178
222
  };
179
223
  }
180
- exports.signTransaction = signTransaction;
181
224
  /**
182
225
  * Wrap a signed transaction in the DataTransactionRequest format
183
226
  * expected by tessellation's DL1 `/data` endpoint.
@@ -202,25 +245,26 @@ exports.signTransaction = signTransaction;
202
245
  function createDataTransactionRequest(signed) {
203
246
  return { data: signed, fee: null };
204
247
  }
205
- exports.createDataTransactionRequest = createDataTransactionRequest;
206
248
  /**
207
249
  * Add an additional signature to a signed transaction.
208
250
  *
209
251
  * Use this for multi-signature scenarios where multiple parties
210
252
  * need to sign the same transaction.
211
253
  *
254
+ * The new signature is computed over the null-dropped canonical bytes,
255
+ * matching metakit's content-hash rule (see {@link signTransaction}).
256
+ *
212
257
  * @param signed - The already-signed transaction
213
258
  * @param privateKey - Additional signer's private key
214
259
  * @returns Transaction with additional signature
215
260
  */
216
261
  async function addTransactionSignature(signed, privateKey) {
217
- const newProof = await (0, metagraph_sdk_1.signDataUpdate)(signed.value, privateKey);
262
+ const newProof = await (0, signing_js_1.signDataUpdate)(signed.value, privateKey);
218
263
  return {
219
264
  value: signed.value,
220
265
  proofs: [...signed.proofs, newProof],
221
266
  };
222
267
  }
223
- exports.addTransactionSignature = addTransactionSignature;
224
268
  /**
225
269
  * Get the public key ID from a private key in the format expected by registration.
226
270
  *
@@ -248,4 +292,3 @@ exports.addTransactionSignature = addTransactionSignature;
248
292
  function getPublicKeyForRegistration(privateKey) {
249
293
  return (0, metagraph_sdk_1.getPublicKeyId)(privateKey);
250
294
  }
251
- exports.getPublicKeyForRegistration = getPublicKeyForRegistration;
@@ -9,7 +9,15 @@
9
9
  * @packageDocumentation
10
10
  */
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.OTTOCHAIN_MESSAGE_TYPES = void 0;
12
+ exports.OTTOCHAIN_MESSAGE_TYPES = exports.TOKEN_BEHAVIOR_BITS = void 0;
13
+ /** Bit weights for {@link TokenBehavior} (T=16, S=8, C=4, E=2, G=1). */
14
+ exports.TOKEN_BEHAVIOR_BITS = {
15
+ transferable: 16,
16
+ splittable: 8,
17
+ combinable: 4,
18
+ expirable: 2,
19
+ governable: 1,
20
+ };
13
21
  /**
14
22
  * Names of all valid OttochainMessage types.
15
23
  * Use this for runtime validation (e.g., in API routes).
@@ -21,7 +29,13 @@ exports.OTTOCHAIN_MESSAGE_TYPES = [
21
29
  'UpgradeFiber',
22
30
  'CreateScript',
23
31
  'InvokeScript',
24
- 'PublishVersion',
32
+ 'UpgradeScript',
33
+ 'PublishMachineVersion',
34
+ 'PublishScriptVersion',
25
35
  'SetVersionStatus',
26
36
  'RegisterAlias',
37
+ 'CreateAssetPolicy',
38
+ 'MintAsset',
39
+ 'ApplyMorphism',
40
+ 'AuthorizeCompose',
27
41
  ];
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.vickreyAuctionDef = exports.shieldedSealedBidDef = exports.sealedBidAccountDef = exports.SHIELDED_POOL_STATE = exports.shieldApp = void 0;
4
+ /**
5
+ * Privacy: shield any fiber app into a zk-jlvm-shielded private-state pool.
6
+ * See docs/design/zk-private-contract-state-rfc.md.
7
+ */
8
+ var shield_app_js_1 = require("./shield-app.js");
9
+ Object.defineProperty(exports, "shieldApp", { enumerable: true, get: function () { return shield_app_js_1.shieldApp; } });
10
+ Object.defineProperty(exports, "SHIELDED_POOL_STATE", { enumerable: true, get: function () { return shield_app_js_1.SHIELDED_POOL_STATE; } });
11
+ var sealed_bid_js_1 = require("./sealed-bid.js");
12
+ Object.defineProperty(exports, "sealedBidAccountDef", { enumerable: true, get: function () { return sealed_bid_js_1.sealedBidAccountDef; } });
13
+ Object.defineProperty(exports, "shieldedSealedBidDef", { enumerable: true, get: function () { return sealed_bid_js_1.shieldedSealedBidDef; } });
14
+ Object.defineProperty(exports, "vickreyAuctionDef", { enumerable: true, get: function () { return sealed_bid_js_1.vickreyAuctionDef; } });