@ottochain/sdk 1.2.0 → 1.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 (103) hide show
  1. package/LICENSE +190 -0
  2. package/dist/cjs/index.js +34 -15
  3. package/dist/cjs/ottochain/index.js +20 -1
  4. package/dist/cjs/ottochain/metagraph-client.js +7 -8
  5. package/dist/cjs/ottochain/snapshot.js +3 -3
  6. package/dist/cjs/{metakit → ottochain}/transaction.js +4 -5
  7. package/dist/cjs/verify.js +17 -0
  8. package/dist/esm/apps/contracts/index.js +28 -10
  9. package/dist/esm/apps/corporate/index.js +79 -24
  10. package/dist/esm/apps/governance/index.js +85 -36
  11. package/dist/esm/apps/identity/constants.js +27 -22
  12. package/dist/esm/apps/identity/index.js +35 -7
  13. package/dist/esm/apps/index.js +32 -6
  14. package/dist/esm/apps/markets/index.js +27 -6
  15. package/dist/esm/apps/oracles/index.js +27 -7
  16. package/dist/esm/errors.js +19 -9
  17. package/dist/esm/generated/google/protobuf/struct.js +39 -33
  18. package/dist/esm/generated/google/protobuf/timestamp.js +9 -6
  19. package/dist/esm/generated/index.js +134 -10
  20. package/dist/esm/generated/ottochain/apps/contracts/v1/contract.js +54 -48
  21. package/dist/esm/generated/ottochain/apps/corporate/v1/corporate.js +357 -335
  22. package/dist/esm/generated/ottochain/apps/governance/v1/governance.js +299 -284
  23. package/dist/esm/generated/ottochain/apps/identity/v1/agent.js +47 -38
  24. package/dist/esm/generated/ottochain/apps/identity/v1/attestation.js +50 -44
  25. package/dist/esm/generated/ottochain/apps/markets/v1/market.js +86 -77
  26. package/dist/esm/generated/ottochain/apps/oracles/v1/oracle.js +72 -66
  27. package/dist/esm/generated/ottochain/v1/common.js +4 -1
  28. package/dist/esm/generated/ottochain/v1/fiber.js +96 -90
  29. package/dist/esm/generated/ottochain/v1/messages.js +82 -79
  30. package/dist/esm/generated/ottochain/v1/records.js +140 -137
  31. package/dist/esm/index.js +86 -20
  32. package/dist/esm/{metakit → ottochain}/drop-nulls.js +5 -1
  33. package/dist/esm/ottochain/index.js +56 -3
  34. package/dist/esm/ottochain/metagraph-client.js +16 -13
  35. package/dist/esm/{metakit → ottochain}/normalize.js +11 -4
  36. package/dist/esm/ottochain/snapshot.js +20 -10
  37. package/dist/esm/{metakit → ottochain}/transaction.js +25 -14
  38. package/dist/esm/ottochain/types.js +2 -1
  39. package/dist/esm/types.js +7 -2
  40. package/dist/esm/validation.js +76 -65
  41. package/dist/esm/verify.js +17 -0
  42. package/dist/types/index.d.ts +14 -7
  43. package/dist/types/ottochain/index.d.ts +4 -0
  44. package/dist/types/ottochain/metagraph-client.d.ts +1 -1
  45. package/dist/types/{metakit → ottochain}/transaction.d.ts +1 -1
  46. package/dist/types/validation.d.ts +8 -8
  47. package/dist/types/verify.d.ts +9 -0
  48. package/package.json +5 -3
  49. package/dist/cjs/metakit/binary.js +0 -58
  50. package/dist/cjs/metakit/canonicalize.js +0 -40
  51. package/dist/cjs/metakit/codec.js +0 -45
  52. package/dist/cjs/metakit/currency-transaction.js +0 -319
  53. package/dist/cjs/metakit/currency-types.js +0 -13
  54. package/dist/cjs/metakit/hash.js +0 -84
  55. package/dist/cjs/metakit/index.js +0 -86
  56. package/dist/cjs/metakit/network/client.js +0 -78
  57. package/dist/cjs/metakit/network/currency-l1-client.js +0 -101
  58. package/dist/cjs/metakit/network/data-l1-client.js +0 -76
  59. package/dist/cjs/metakit/network/index.js +0 -16
  60. package/dist/cjs/metakit/network/types.js +0 -20
  61. package/dist/cjs/metakit/sign.js +0 -120
  62. package/dist/cjs/metakit/signed-object.js +0 -100
  63. package/dist/cjs/metakit/types.js +0 -14
  64. package/dist/cjs/metakit/verify.js +0 -217
  65. package/dist/cjs/metakit/wallet.js +0 -127
  66. package/dist/esm/metakit/binary.js +0 -53
  67. package/dist/esm/metakit/canonicalize.js +0 -33
  68. package/dist/esm/metakit/codec.js +0 -38
  69. package/dist/esm/metakit/currency-transaction.js +0 -306
  70. package/dist/esm/metakit/currency-types.js +0 -10
  71. package/dist/esm/metakit/hash.js +0 -77
  72. package/dist/esm/metakit/index.js +0 -33
  73. package/dist/esm/metakit/network/client.js +0 -74
  74. package/dist/esm/metakit/network/currency-l1-client.js +0 -97
  75. package/dist/esm/metakit/network/data-l1-client.js +0 -72
  76. package/dist/esm/metakit/network/index.js +0 -9
  77. package/dist/esm/metakit/network/types.js +0 -16
  78. package/dist/esm/metakit/sign.js +0 -114
  79. package/dist/esm/metakit/signed-object.js +0 -94
  80. package/dist/esm/metakit/types.js +0 -11
  81. package/dist/esm/metakit/verify.js +0 -210
  82. package/dist/esm/metakit/wallet.js +0 -117
  83. package/dist/types/metakit/binary.d.ts +0 -38
  84. package/dist/types/metakit/canonicalize.d.ts +0 -26
  85. package/dist/types/metakit/codec.d.ts +0 -16
  86. package/dist/types/metakit/currency-transaction.d.ts +0 -157
  87. package/dist/types/metakit/currency-types.d.ts +0 -55
  88. package/dist/types/metakit/hash.d.ts +0 -50
  89. package/dist/types/metakit/index.d.ts +0 -26
  90. package/dist/types/metakit/network/client.d.ts +0 -23
  91. package/dist/types/metakit/network/currency-l1-client.d.ts +0 -71
  92. package/dist/types/metakit/network/data-l1-client.d.ts +0 -57
  93. package/dist/types/metakit/network/index.d.ts +0 -10
  94. package/dist/types/metakit/network/types.d.ts +0 -74
  95. package/dist/types/metakit/sign.d.ts +0 -65
  96. package/dist/types/metakit/signed-object.d.ts +0 -66
  97. package/dist/types/metakit/types.d.ts +0 -67
  98. package/dist/types/metakit/verify.d.ts +0 -55
  99. package/dist/types/metakit/wallet.d.ts +0 -70
  100. /package/dist/cjs/{metakit → ottochain}/drop-nulls.js +0 -0
  101. /package/dist/cjs/{metakit → ottochain}/normalize.js +0 -0
  102. /package/dist/types/{metakit → ottochain}/drop-nulls.d.ts +0 -0
  103. /package/dist/types/{metakit → ottochain}/normalize.d.ts +0 -0
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 KD5UJC.XYZ LLC and OttoChain Contributors
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/dist/cjs/index.js CHANGED
@@ -2,10 +2,12 @@
2
2
  /**
3
3
  * Ottochain SDK
4
4
  *
5
- * Unified SDK combining metakit framework operations with ottochain domain types.
5
+ * Unified SDK combining @constellation-network/metagraph-sdk with OttoChain domain types.
6
6
  *
7
7
  * Structure:
8
- * - `metakit`Signing, encoding, hashing, and network clients for Constellation metagraphs
8
+ * - `@constellation-network/metagraph-sdk` — Core signing, hashing, encoding, wallet, currency transactions
9
+ * - `@constellation-network/metagraph-sdk/network` — HttpClient, MetagraphClient, NetworkError
10
+ * - `ottochain` — OttoChain-specific transaction helpers, types, snapshot, and client
9
11
  * - `generated` — Protobuf-generated types (source of truth)
10
12
  * - `apps/identity` — Agent Identity application types
11
13
  * - `apps/contracts` — Contract application types
@@ -29,14 +31,35 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
29
31
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
30
32
  };
31
33
  Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.MetagraphClient = exports.assert = exports.safeParse = exports.validateKeyPair = exports.validateAddress = exports.validatePublicKey = exports.validatePrivateKey = exports.validate = exports.CompleteContractRequestSchema = exports.AcceptContractRequestSchema = exports.ProposeContractRequestSchema = exports.ContractTermsSchema = exports.PlatformLinkSchema = exports.AgentIdentityRegistrationSchema = exports.TransferParamsSchema = exports.CurrencyTransactionSchema = exports.CurrencyTransactionValueSchema = exports.TransactionReferenceSchema = exports.SignedSchema = exports.SignatureProofSchema = exports.KeyPairSchema = exports.PublicKeySchema = exports.PrivateKeySchema = exports.DagAddressSchema = exports.wrapError = exports.isErrorCode = exports.ErrorCode = exports.TransactionError = exports.SigningError = exports.ValidationError = exports.NetworkError = exports.OttoChainError = void 0;
33
- // Type aliases for semantic clarity (matches wire format)
34
+ exports.OttoMetagraphClient = exports.assert = exports.safeParse = exports.validateKeyPair = exports.validateAddress = exports.validatePublicKey = exports.validatePrivateKey = exports.validate = exports.CompleteContractRequestSchema = exports.AcceptContractRequestSchema = exports.ProposeContractRequestSchema = exports.ContractTermsSchema = exports.PlatformLinkSchema = exports.AgentIdentityRegistrationSchema = exports.TransferParamsSchema = exports.CurrencyTransactionSchema = exports.CurrencyTransactionValueSchema = exports.TransactionReferenceSchema = exports.SignedSchema = exports.SignatureProofSchema = exports.KeyPairSchema = exports.PublicKeySchema = exports.PrivateKeySchema = exports.DagAddressSchema = exports.wrapError = exports.isErrorCode = exports.ErrorCode = exports.TransactionError = exports.SigningError = exports.ValidationError = exports.NetworkError = exports.OttoChainError = exports.dropNulls = exports.normalizeMessage = exports.normalizeArchiveStateMachine = exports.normalizeTransitionStateMachine = exports.normalizeCreateStateMachine = exports.MetagraphNetworkError = exports.HttpClient = exports.createMetagraphClient = exports.MetagraphClient = exports.verify = void 0;
35
+ // ─── Core metagraph SDK ───────────────────────────────────────────────────────
36
+ // Consumers can also import directly from '@constellation-network/metagraph-sdk'
37
+ __exportStar(require("@constellation-network/metagraph-sdk"), exports);
38
+ // Override verify — package embeds `mode` in signed objects and ignores isDataUpdate
39
+ // when mode is present. Our wrapper strips mode so isDataUpdate always wins.
40
+ var verify_js_1 = require("./verify.js");
41
+ Object.defineProperty(exports, "verify", { enumerable: true, get: function () { return verify_js_1.verify; } });
42
+ // ─── Network clients ──────────────────────────────────────────────────────────
43
+ // Re-export from package network subpath
44
+ var network_1 = require("@constellation-network/metagraph-sdk/network");
45
+ Object.defineProperty(exports, "MetagraphClient", { enumerable: true, get: function () { return network_1.MetagraphClient; } });
46
+ Object.defineProperty(exports, "createMetagraphClient", { enumerable: true, get: function () { return network_1.createMetagraphClient; } });
47
+ Object.defineProperty(exports, "HttpClient", { enumerable: true, get: function () { return network_1.HttpClient; } });
48
+ Object.defineProperty(exports, "MetagraphNetworkError", { enumerable: true, get: function () { return network_1.NetworkError; } });
49
+ // ─── Type aliases for semantic clarity (matches wire format) ──────────────────
34
50
  __exportStar(require("./types.js"), exports);
35
- // Metakit utilities (signing, hashing, HTTP client)
36
- __exportStar(require("./metakit/index.js"), exports);
37
- // Generated protobuf types (canonical definitions)
51
+ // ─── OttoChain-specific transaction helpers ───────────────────────────────────
52
+ __exportStar(require("./ottochain/transaction.js"), exports);
53
+ var normalize_js_1 = require("./ottochain/normalize.js");
54
+ Object.defineProperty(exports, "normalizeCreateStateMachine", { enumerable: true, get: function () { return normalize_js_1.normalizeCreateStateMachine; } });
55
+ Object.defineProperty(exports, "normalizeTransitionStateMachine", { enumerable: true, get: function () { return normalize_js_1.normalizeTransitionStateMachine; } });
56
+ Object.defineProperty(exports, "normalizeArchiveStateMachine", { enumerable: true, get: function () { return normalize_js_1.normalizeArchiveStateMachine; } });
57
+ Object.defineProperty(exports, "normalizeMessage", { enumerable: true, get: function () { return normalize_js_1.normalizeMessage; } });
58
+ var drop_nulls_js_1 = require("./ottochain/drop-nulls.js");
59
+ Object.defineProperty(exports, "dropNulls", { enumerable: true, get: function () { return drop_nulls_js_1.dropNulls; } });
60
+ // ─── Generated protobuf types (canonical definitions) ────────────────────────
38
61
  __exportStar(require("./generated/index.js"), exports);
39
- // Custom error classes
62
+ // ─── Custom error classes ─────────────────────────────────────────────────────
40
63
  var errors_js_1 = require("./errors.js");
41
64
  Object.defineProperty(exports, "OttoChainError", { enumerable: true, get: function () { return errors_js_1.OttoChainError; } });
42
65
  Object.defineProperty(exports, "NetworkError", { enumerable: true, get: function () { return errors_js_1.NetworkError; } });
@@ -46,7 +69,7 @@ Object.defineProperty(exports, "TransactionError", { enumerable: true, get: func
46
69
  Object.defineProperty(exports, "ErrorCode", { enumerable: true, get: function () { return errors_js_1.ErrorCode; } });
47
70
  Object.defineProperty(exports, "isErrorCode", { enumerable: true, get: function () { return errors_js_1.isErrorCode; } });
48
71
  Object.defineProperty(exports, "wrapError", { enumerable: true, get: function () { return errors_js_1.wrapError; } });
49
- // Validation schemas and helpers
72
+ // ─── Validation schemas and helpers ──────────────────────────────────────────
50
73
  var validation_js_1 = require("./validation.js");
51
74
  // Schemas
52
75
  Object.defineProperty(exports, "DagAddressSchema", { enumerable: true, get: function () { return validation_js_1.DagAddressSchema; } });
@@ -73,10 +96,6 @@ Object.defineProperty(exports, "validateAddress", { enumerable: true, get: funct
73
96
  Object.defineProperty(exports, "validateKeyPair", { enumerable: true, get: function () { return validation_js_1.validateKeyPair; } });
74
97
  Object.defineProperty(exports, "safeParse", { enumerable: true, get: function () { return validation_js_1.safeParse; } });
75
98
  Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return validation_js_1.assert; } });
76
- // Error classes
77
- __exportStar(require("./errors.js"), exports);
78
- // Validation schemas and helpers
79
- __exportStar(require("./validation.js"), exports);
80
- // Ottochain metagraph client
99
+ // ─── OttoChain metagraph client ───────────────────────────────────────────────
81
100
  var metagraph_client_js_1 = require("./ottochain/metagraph-client.js");
82
- Object.defineProperty(exports, "MetagraphClient", { enumerable: true, get: function () { return metagraph_client_js_1.MetagraphClient; } });
101
+ Object.defineProperty(exports, "OttoMetagraphClient", { enumerable: true, get: function () { return metagraph_client_js_1.MetagraphClient; } });
@@ -30,7 +30,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
30
30
  return result;
31
31
  };
32
32
  Object.defineProperty(exports, "__esModule", { value: true });
33
- exports.MetagraphClient = exports.extractOnChainState = exports.getScriptInvocations = exports.getEventReceipts = exports.getLogsForFiber = exports.getLatestOnChainState = exports.getSnapshotOnChainState = exports.decodeOnChainState = exports.proto = void 0;
33
+ 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.proto = void 0;
34
34
  // Re-export generated protobuf types (for binary encoding)
35
35
  exports.proto = __importStar(require("../generated/index.js"));
36
36
  var snapshot_js_1 = require("./snapshot.js");
@@ -43,5 +43,24 @@ Object.defineProperty(exports, "getScriptInvocations", { enumerable: true, get:
43
43
  Object.defineProperty(exports, "extractOnChainState", { enumerable: true, get: function () { return snapshot_js_1.extractOnChainState; } });
44
44
  var metagraph_client_js_1 = require("./metagraph-client.js");
45
45
  Object.defineProperty(exports, "MetagraphClient", { enumerable: true, get: function () { return metagraph_client_js_1.MetagraphClient; } });
46
+ // Transaction helpers (state machine payloads, signing)
47
+ var transaction_js_1 = require("./transaction.js");
48
+ Object.defineProperty(exports, "createTransitionPayload", { enumerable: true, get: function () { return transaction_js_1.createTransitionPayload; } });
49
+ Object.defineProperty(exports, "createArchivePayload", { enumerable: true, get: function () { return transaction_js_1.createArchivePayload; } });
50
+ Object.defineProperty(exports, "createInvokeScriptPayload", { enumerable: true, get: function () { return transaction_js_1.createInvokeScriptPayload; } });
51
+ Object.defineProperty(exports, "signTransaction", { enumerable: true, get: function () { return transaction_js_1.signTransaction; } });
52
+ Object.defineProperty(exports, "addTransactionSignature", { enumerable: true, get: function () { return transaction_js_1.addTransactionSignature; } });
53
+ Object.defineProperty(exports, "getPublicKeyForRegistration", { enumerable: true, get: function () { return transaction_js_1.getPublicKeyForRegistration; } });
54
+ Object.defineProperty(exports, "createStateMachinePayload", { enumerable: true, get: function () { return transaction_js_1.createStateMachinePayload; } });
55
+ Object.defineProperty(exports, "createScriptPayload", { enumerable: true, get: function () { return transaction_js_1.createScriptPayload; } });
56
+ Object.defineProperty(exports, "createDataTransactionRequest", { enumerable: true, get: function () { return transaction_js_1.createDataTransactionRequest; } });
57
+ // Data utilities
58
+ var normalize_js_1 = require("./normalize.js");
59
+ Object.defineProperty(exports, "normalizeCreateStateMachine", { enumerable: true, get: function () { return normalize_js_1.normalizeCreateStateMachine; } });
60
+ Object.defineProperty(exports, "normalizeTransitionStateMachine", { enumerable: true, get: function () { return normalize_js_1.normalizeTransitionStateMachine; } });
61
+ Object.defineProperty(exports, "normalizeArchiveStateMachine", { enumerable: true, get: function () { return normalize_js_1.normalizeArchiveStateMachine; } });
62
+ Object.defineProperty(exports, "normalizeMessage", { enumerable: true, get: function () { return normalize_js_1.normalizeMessage; } });
63
+ var drop_nulls_js_1 = require("./drop-nulls.js");
64
+ Object.defineProperty(exports, "dropNulls", { enumerable: true, get: function () { return drop_nulls_js_1.dropNulls; } });
46
65
  // Note: Governance and Corporate types are now in src/apps/
47
66
  // Import from '@ottochain/sdk/apps' instead
@@ -11,9 +11,8 @@
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.MetagraphClient = void 0;
14
- const transaction_js_1 = require("../metakit/transaction.js");
15
- const client_js_1 = require("../metakit/network/client.js");
16
- const types_js_1 = require("../metakit/network/types.js");
14
+ const transaction_js_1 = require("./transaction.js");
15
+ const network_1 = require("@constellation-network/metagraph-sdk/network");
17
16
  const snapshot_js_1 = require("./snapshot.js");
18
17
  /**
19
18
  * Client for ottochain metagraph operations.
@@ -40,13 +39,13 @@ const snapshot_js_1 = require("./snapshot.js");
40
39
  */
41
40
  class MetagraphClient {
42
41
  constructor(config) {
43
- this.ml0 = new client_js_1.HttpClient(config.ml0Url, config.timeout);
42
+ this.ml0 = new network_1.HttpClient(config.ml0Url, config.timeout);
44
43
  if (config.dl1Url) {
45
- this.dl1 = new client_js_1.HttpClient(config.dl1Url, config.timeout);
44
+ this.dl1 = new network_1.HttpClient(config.dl1Url, config.timeout);
46
45
  }
47
46
  // Build DL1 client pool from dl1Urls (falls back to dl1Url if provided)
48
47
  const urls = config.dl1Urls ?? (config.dl1Url ? [config.dl1Url] : []);
49
- this.dl1Clients = urls.map((url) => new client_js_1.HttpClient(url, config.timeout));
48
+ this.dl1Clients = urls.map((url) => new network_1.HttpClient(url, config.timeout));
50
49
  }
51
50
  // -------------------------------------------------------------------------
52
51
  // Custom routes (ML0 /data-application/v1/*)
@@ -78,7 +77,7 @@ class MetagraphClient {
78
77
  return await this.ml0.get(`/data-application/v1/state-machines/${fiberId}`);
79
78
  }
80
79
  catch (error) {
81
- if (error instanceof types_js_1.NetworkError && error.statusCode === 404) {
80
+ if (error instanceof network_1.NetworkError && error.statusCode === 404) {
82
81
  return null;
83
82
  }
84
83
  throw error;
@@ -105,7 +104,7 @@ class MetagraphClient {
105
104
  return await this.ml0.get(`/data-application/v1/oracles/${scriptId}`);
106
105
  }
107
106
  catch (error) {
108
- if (error instanceof types_js_1.NetworkError && error.statusCode === 404) {
107
+ if (error instanceof network_1.NetworkError && error.statusCode === 404) {
109
108
  return null;
110
109
  }
111
110
  throw error;
@@ -12,7 +12,7 @@
12
12
  */
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.getScriptInvocations = exports.getEventReceipts = exports.getLogsForFiber = exports.extractOnChainState = exports.getLatestOnChainState = exports.getSnapshotOnChainState = exports.decodeOnChainState = void 0;
15
- const client_js_1 = require("../metakit/network/client.js");
15
+ const network_1 = require("@constellation-network/metagraph-sdk/network");
16
16
  /**
17
17
  * Decode on-chain state from binary (JsonBinaryCodec format).
18
18
  *
@@ -35,7 +35,7 @@ exports.decodeOnChainState = decodeOnChainState;
35
35
  * @returns Decoded OnChain state, or null if no data application part
36
36
  */
37
37
  async function getSnapshotOnChainState(ml0BaseUrl, ordinal) {
38
- const client = new client_js_1.HttpClient(ml0BaseUrl);
38
+ const client = new network_1.HttpClient(ml0BaseUrl);
39
39
  const snapshot = await client.get(`/snapshots/${ordinal}`);
40
40
  return extractOnChainState(snapshot);
41
41
  }
@@ -47,7 +47,7 @@ exports.getSnapshotOnChainState = getSnapshotOnChainState;
47
47
  * @returns Decoded OnChain state, or null if no data application part
48
48
  */
49
49
  async function getLatestOnChainState(ml0BaseUrl) {
50
- const client = new client_js_1.HttpClient(ml0BaseUrl);
50
+ const client = new network_1.HttpClient(ml0BaseUrl);
51
51
  const snapshot = await client.get('/snapshots/latest');
52
52
  return extractOnChainState(snapshot);
53
53
  }
@@ -7,8 +7,7 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.getPublicKeyForRegistration = exports.addTransactionSignature = exports.createDataTransactionRequest = exports.signTransaction = exports.createInvokeScriptPayload = exports.createScriptPayload = exports.createArchivePayload = exports.createTransitionPayload = exports.createStateMachinePayload = void 0;
10
- const sign_js_1 = require("./sign.js");
11
- const wallet_js_1 = require("./wallet.js");
10
+ const metagraph_sdk_1 = require("@constellation-network/metagraph-sdk");
12
11
  /**
13
12
  * Create a new state machine fiber payload.
14
13
  *
@@ -172,7 +171,7 @@ exports.createInvokeScriptPayload = createInvokeScriptPayload;
172
171
  * ```
173
172
  */
174
173
  async function signTransaction(message, privateKey) {
175
- const proof = await (0, sign_js_1.signDataUpdate)(message, privateKey);
174
+ const proof = await (0, metagraph_sdk_1.signDataUpdate)(message, privateKey);
176
175
  return {
177
176
  value: message,
178
177
  proofs: [proof],
@@ -215,7 +214,7 @@ exports.createDataTransactionRequest = createDataTransactionRequest;
215
214
  * @returns Transaction with additional signature
216
215
  */
217
216
  async function addTransactionSignature(signed, privateKey) {
218
- const newProof = await (0, sign_js_1.signDataUpdate)(signed.value, privateKey);
217
+ const newProof = await (0, metagraph_sdk_1.signDataUpdate)(signed.value, privateKey);
219
218
  return {
220
219
  value: signed.value,
221
220
  proofs: [...signed.proofs, newProof],
@@ -247,6 +246,6 @@ exports.addTransactionSignature = addTransactionSignature;
247
246
  * ```
248
247
  */
249
248
  function getPublicKeyForRegistration(privateKey) {
250
- return (0, wallet_js_1.getPublicKeyId)(privateKey);
249
+ return (0, metagraph_sdk_1.getPublicKeyId)(privateKey);
251
250
  }
252
251
  exports.getPublicKeyForRegistration = getPublicKeyForRegistration;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /**
3
+ * Backward-compatible verify wrapper.
4
+ *
5
+ * The package embeds `mode: "standard"|"dataUpdate"` in signed objects and
6
+ * its verify() ignores the `isDataUpdate` parameter when `mode` is present.
7
+ * This wrapper strips `mode` so callers' explicit `isDataUpdate` always wins.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.verify = void 0;
11
+ const metagraph_sdk_1 = require("@constellation-network/metagraph-sdk");
12
+ function verify(signed, isDataUpdate) {
13
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
14
+ const { mode, ...rest } = signed;
15
+ return (0, metagraph_sdk_1.verify)(rest, isDataUpdate);
16
+ }
17
+ exports.verify = verify;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * Contracts Application
3
4
  *
@@ -17,26 +18,43 @@
17
18
  *
18
19
  * @packageDocumentation
19
20
  */
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.getEscrowDefinition = exports.getContractDefinition = exports.CONTRACT_DEFINITIONS = exports.contractStateToJSON = exports.contractStateFromJSON = exports.ContractDefinition = exports.DisputeContractRequest = exports.RejectContractRequest = exports.CompleteContractRequest = exports.AcceptContractRequest = exports.ProposeContractRequest = exports.Contract = exports.ContractState = void 0;
20
26
  // Re-export generated protobuf types (source of truth)
21
- export { ContractState, Contract, ProposeContractRequest, AcceptContractRequest, CompleteContractRequest, RejectContractRequest, DisputeContractRequest, ContractDefinition, contractStateFromJSON, contractStateToJSON, } from '../../generated/ottochain/apps/contracts/v1/contract.js';
27
+ var contract_js_1 = require("../../generated/ottochain/apps/contracts/v1/contract.js");
28
+ Object.defineProperty(exports, "ContractState", { enumerable: true, get: function () { return contract_js_1.ContractState; } });
29
+ Object.defineProperty(exports, "Contract", { enumerable: true, get: function () { return contract_js_1.Contract; } });
30
+ Object.defineProperty(exports, "ProposeContractRequest", { enumerable: true, get: function () { return contract_js_1.ProposeContractRequest; } });
31
+ Object.defineProperty(exports, "AcceptContractRequest", { enumerable: true, get: function () { return contract_js_1.AcceptContractRequest; } });
32
+ Object.defineProperty(exports, "CompleteContractRequest", { enumerable: true, get: function () { return contract_js_1.CompleteContractRequest; } });
33
+ Object.defineProperty(exports, "RejectContractRequest", { enumerable: true, get: function () { return contract_js_1.RejectContractRequest; } });
34
+ Object.defineProperty(exports, "DisputeContractRequest", { enumerable: true, get: function () { return contract_js_1.DisputeContractRequest; } });
35
+ Object.defineProperty(exports, "ContractDefinition", { enumerable: true, get: function () { return contract_js_1.ContractDefinition; } });
36
+ Object.defineProperty(exports, "contractStateFromJSON", { enumerable: true, get: function () { return contract_js_1.contractStateFromJSON; } });
37
+ Object.defineProperty(exports, "contractStateToJSON", { enumerable: true, get: function () { return contract_js_1.contractStateToJSON; } });
22
38
  // ---------------------------------------------------------------------------
23
39
  // State Machine JSON Definitions
24
40
  // ---------------------------------------------------------------------------
25
- import contractDef from './state-machines/contract.json';
26
- import escrowDef from './state-machines/escrow.json';
27
- export const CONTRACT_DEFINITIONS = {
28
- Contract: contractDef,
29
- Escrow: escrowDef,
41
+ const contract_json_1 = __importDefault(require("./state-machines/contract.json"));
42
+ const escrow_json_1 = __importDefault(require("./state-machines/escrow.json"));
43
+ exports.CONTRACT_DEFINITIONS = {
44
+ Contract: contract_json_1.default,
45
+ Escrow: escrow_json_1.default,
30
46
  };
31
47
  /**
32
48
  * Get the contract state machine definition.
33
49
  */
34
- export function getContractDefinition() {
35
- return contractDef;
50
+ function getContractDefinition() {
51
+ return contract_json_1.default;
36
52
  }
53
+ exports.getContractDefinition = getContractDefinition;
37
54
  /**
38
55
  * Get the escrow state machine definition.
39
56
  */
40
- export function getEscrowDefinition() {
41
- return escrowDef;
57
+ function getEscrowDefinition() {
58
+ return escrow_json_1.default;
42
59
  }
60
+ exports.getEscrowDefinition = getEscrowDefinition;