@ottochain/sdk 0.2.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 (330) hide show
  1. package/README.md +305 -0
  2. package/dist/apps/contracts/index.d.ts +21 -0
  3. package/dist/apps/contracts/index.js +39 -0
  4. package/dist/apps/contracts/types.d.ts +24 -0
  5. package/dist/apps/contracts/types.js +48 -0
  6. package/dist/apps/identity/index.d.ts +22 -0
  7. package/dist/apps/identity/index.js +40 -0
  8. package/dist/apps/identity/types.d.ts +30 -0
  9. package/dist/apps/identity/types.js +53 -0
  10. package/dist/apps/index.d.ts +29 -0
  11. package/dist/apps/index.js +60 -0
  12. package/dist/apps/markets/index.d.ts +26 -0
  13. package/dist/apps/markets/index.js +46 -0
  14. package/dist/apps/markets/types.d.ts +185 -0
  15. package/dist/apps/markets/types.js +252 -0
  16. package/dist/apps/oracles/index.d.ts +26 -0
  17. package/dist/apps/oracles/index.js +46 -0
  18. package/dist/apps/oracles/types.d.ts +211 -0
  19. package/dist/apps/oracles/types.js +306 -0
  20. package/dist/cjs/apps/contracts/index.js +60 -0
  21. package/dist/cjs/apps/contracts/state-machines/contract.json +420 -0
  22. package/dist/cjs/apps/contracts/state-machines/escrow.json +426 -0
  23. package/dist/cjs/apps/contracts/types.js +48 -0
  24. package/dist/cjs/apps/corporate/index.js +112 -0
  25. package/dist/cjs/apps/corporate/state-machines/corporate-board.json +1064 -0
  26. package/dist/cjs/apps/corporate/state-machines/corporate-bylaws.json +751 -0
  27. package/dist/cjs/apps/corporate/state-machines/corporate-committee.json +957 -0
  28. package/dist/cjs/apps/corporate/state-machines/corporate-compliance.json +1293 -0
  29. package/dist/cjs/apps/corporate/state-machines/corporate-entity.json +861 -0
  30. package/dist/cjs/apps/corporate/state-machines/corporate-officers.json +843 -0
  31. package/dist/cjs/apps/corporate/state-machines/corporate-proxy.json +783 -0
  32. package/dist/cjs/apps/corporate/state-machines/corporate-resolution.json +1174 -0
  33. package/dist/cjs/apps/corporate/state-machines/corporate-securities.json +1215 -0
  34. package/dist/cjs/apps/corporate/state-machines/corporate-shareholders.json +1298 -0
  35. package/dist/cjs/apps/corporate/types.js +44 -0
  36. package/dist/cjs/apps/governance/index.js +203 -0
  37. package/dist/cjs/apps/governance/state-machines/dao-multisig.json +711 -0
  38. package/dist/cjs/apps/governance/state-machines/dao-single.json +258 -0
  39. package/dist/cjs/apps/governance/state-machines/dao-threshold.json +660 -0
  40. package/dist/cjs/apps/governance/state-machines/dao-token.json +680 -0
  41. package/dist/cjs/apps/governance/state-machines/governance-constitution.json +401 -0
  42. package/dist/cjs/apps/governance/state-machines/governance-executive.json +441 -0
  43. package/dist/cjs/apps/governance/state-machines/governance-judiciary.json +626 -0
  44. package/dist/cjs/apps/governance/state-machines/governance-legislature.json +726 -0
  45. package/dist/cjs/apps/governance/state-machines/governance-simple.json +679 -0
  46. package/dist/cjs/apps/governance/types.js +42 -0
  47. package/dist/cjs/apps/identity/constants.js +58 -0
  48. package/dist/cjs/apps/identity/index.js +78 -0
  49. package/dist/cjs/apps/identity/state-machines/agent-identity.json +320 -0
  50. package/dist/cjs/apps/identity/types.js +53 -0
  51. package/dist/cjs/apps/index.js +58 -0
  52. package/dist/cjs/apps/markets/index.js +55 -0
  53. package/dist/cjs/apps/markets/state-machines/market-universal.json +354 -0
  54. package/dist/cjs/apps/markets/types.js +219 -0
  55. package/dist/cjs/apps/oracles/index.js +62 -0
  56. package/dist/cjs/apps/oracles/state-machines/oracle.json +452 -0
  57. package/dist/cjs/apps/oracles/types.js +282 -0
  58. package/dist/cjs/errors.js +293 -0
  59. package/dist/cjs/generated/google/protobuf/struct.js +514 -0
  60. package/dist/cjs/generated/google/protobuf/timestamp.js +92 -0
  61. package/dist/cjs/generated/index.js +150 -0
  62. package/dist/cjs/generated/ottochain/apps/contracts/v1/contract.js +873 -0
  63. package/dist/cjs/generated/ottochain/apps/contracts/v1/contract_pb.js +100 -0
  64. package/dist/cjs/generated/ottochain/apps/corporate/v1/corporate.js +4515 -0
  65. package/dist/cjs/generated/ottochain/apps/corporate/v1/corporate_pb.js +392 -0
  66. package/dist/cjs/generated/ottochain/apps/governance/v1/governance.js +3255 -0
  67. package/dist/cjs/generated/ottochain/apps/governance/v1/governance_pb.js +235 -0
  68. package/dist/cjs/generated/ottochain/apps/identity/v1/agent.js +619 -0
  69. package/dist/cjs/generated/ottochain/apps/identity/v1/agent_pb.js +116 -0
  70. package/dist/cjs/generated/ottochain/apps/identity/v1/attestation.js +780 -0
  71. package/dist/cjs/generated/ottochain/apps/identity/v1/attestation_pb.js +79 -0
  72. package/dist/cjs/generated/ottochain/apps/markets/v1/market.js +1261 -0
  73. package/dist/cjs/generated/ottochain/apps/markets/v1/market_pb.js +151 -0
  74. package/dist/cjs/generated/ottochain/apps/oracles/v1/oracle.js +1223 -0
  75. package/dist/cjs/generated/ottochain/apps/oracles/v1/oracle_pb.js +109 -0
  76. package/dist/cjs/generated/ottochain/v1/common.js +10 -0
  77. package/dist/cjs/generated/ottochain/v1/common_pb.js +37 -0
  78. package/dist/cjs/generated/ottochain/v1/fiber.js +1057 -0
  79. package/dist/cjs/generated/ottochain/v1/fiber_pb.js +86 -0
  80. package/dist/cjs/generated/ottochain/v1/messages.js +740 -0
  81. package/dist/cjs/generated/ottochain/v1/messages_pb.js +44 -0
  82. package/dist/cjs/generated/ottochain/v1/records.js +1253 -0
  83. package/dist/cjs/generated/ottochain/v1/records_pb.js +44 -0
  84. package/dist/cjs/index.js +79 -0
  85. package/dist/cjs/metakit/binary.js +58 -0
  86. package/dist/cjs/metakit/canonicalize.js +40 -0
  87. package/dist/cjs/metakit/codec.js +45 -0
  88. package/dist/cjs/metakit/currency-transaction.js +319 -0
  89. package/dist/cjs/metakit/currency-types.js +13 -0
  90. package/dist/cjs/metakit/hash.js +84 -0
  91. package/dist/cjs/metakit/index.js +74 -0
  92. package/dist/cjs/metakit/network/client.js +78 -0
  93. package/dist/cjs/metakit/network/currency-l1-client.js +101 -0
  94. package/dist/cjs/metakit/network/data-l1-client.js +76 -0
  95. package/dist/cjs/metakit/network/index.js +16 -0
  96. package/dist/cjs/metakit/network/types.js +20 -0
  97. package/dist/cjs/metakit/sign.js +120 -0
  98. package/dist/cjs/metakit/signed-object.js +100 -0
  99. package/dist/cjs/metakit/types.js +14 -0
  100. package/dist/cjs/metakit/verify.js +217 -0
  101. package/dist/cjs/metakit/wallet.js +127 -0
  102. package/dist/cjs/ottochain/index.js +47 -0
  103. package/dist/cjs/ottochain/metagraph-client.js +157 -0
  104. package/dist/cjs/ottochain/snapshot.js +110 -0
  105. package/dist/cjs/ottochain/types.js +11 -0
  106. package/dist/cjs/package.json +1 -0
  107. package/dist/cjs/types.js +25 -0
  108. package/dist/cjs/validation.js +312 -0
  109. package/dist/errors.d.ts +221 -0
  110. package/dist/errors.js +293 -0
  111. package/dist/esm/apps/contracts/index.js +42 -0
  112. package/dist/esm/apps/contracts/state-machines/contract.json +420 -0
  113. package/dist/esm/apps/contracts/state-machines/escrow.json +426 -0
  114. package/dist/esm/apps/contracts/types.js +44 -0
  115. package/dist/esm/apps/corporate/index.js +57 -0
  116. package/dist/esm/apps/corporate/state-machines/corporate-board.json +1064 -0
  117. package/dist/esm/apps/corporate/state-machines/corporate-bylaws.json +751 -0
  118. package/dist/esm/apps/corporate/state-machines/corporate-committee.json +957 -0
  119. package/dist/esm/apps/corporate/state-machines/corporate-compliance.json +1293 -0
  120. package/dist/esm/apps/corporate/state-machines/corporate-entity.json +861 -0
  121. package/dist/esm/apps/corporate/state-machines/corporate-officers.json +843 -0
  122. package/dist/esm/apps/corporate/state-machines/corporate-proxy.json +783 -0
  123. package/dist/esm/apps/corporate/state-machines/corporate-resolution.json +1174 -0
  124. package/dist/esm/apps/corporate/state-machines/corporate-securities.json +1215 -0
  125. package/dist/esm/apps/corporate/state-machines/corporate-shareholders.json +1298 -0
  126. package/dist/esm/apps/corporate/types.js +38 -0
  127. package/dist/esm/apps/governance/index.js +154 -0
  128. package/dist/esm/apps/governance/state-machines/dao-multisig.json +711 -0
  129. package/dist/esm/apps/governance/state-machines/dao-single.json +258 -0
  130. package/dist/esm/apps/governance/state-machines/dao-threshold.json +660 -0
  131. package/dist/esm/apps/governance/state-machines/dao-token.json +680 -0
  132. package/dist/esm/apps/governance/state-machines/governance-constitution.json +401 -0
  133. package/dist/esm/apps/governance/state-machines/governance-executive.json +441 -0
  134. package/dist/esm/apps/governance/state-machines/governance-judiciary.json +626 -0
  135. package/dist/esm/apps/governance/state-machines/governance-legislature.json +726 -0
  136. package/dist/esm/apps/governance/state-machines/governance-simple.json +679 -0
  137. package/dist/esm/apps/governance/types.js +35 -0
  138. package/dist/esm/apps/identity/constants.js +53 -0
  139. package/dist/esm/apps/identity/index.js +50 -0
  140. package/dist/esm/apps/identity/state-machines/agent-identity.json +320 -0
  141. package/dist/esm/apps/identity/types.js +50 -0
  142. package/dist/esm/apps/index.js +32 -0
  143. package/dist/esm/apps/markets/index.js +34 -0
  144. package/dist/esm/apps/markets/state-machines/market-universal.json +354 -0
  145. package/dist/esm/apps/markets/types.js +206 -0
  146. package/dist/esm/apps/oracles/index.js +42 -0
  147. package/dist/esm/apps/oracles/state-machines/oracle.json +452 -0
  148. package/dist/esm/apps/oracles/types.js +267 -0
  149. package/dist/esm/errors.js +283 -0
  150. package/dist/esm/generated/google/protobuf/struct.js +508 -0
  151. package/dist/esm/generated/google/protobuf/timestamp.js +89 -0
  152. package/dist/esm/generated/index.js +26 -0
  153. package/dist/esm/generated/ottochain/apps/contracts/v1/contract.js +867 -0
  154. package/dist/esm/generated/ottochain/apps/contracts/v1/contract_pb.js +97 -0
  155. package/dist/esm/generated/ottochain/apps/corporate/v1/corporate.js +4493 -0
  156. package/dist/esm/generated/ottochain/apps/corporate/v1/corporate_pb.js +389 -0
  157. package/dist/esm/generated/ottochain/apps/governance/v1/governance.js +3240 -0
  158. package/dist/esm/generated/ottochain/apps/governance/v1/governance_pb.js +232 -0
  159. package/dist/esm/generated/ottochain/apps/identity/v1/agent.js +610 -0
  160. package/dist/esm/generated/ottochain/apps/identity/v1/agent_pb.js +113 -0
  161. package/dist/esm/generated/ottochain/apps/identity/v1/attestation.js +774 -0
  162. package/dist/esm/generated/ottochain/apps/identity/v1/attestation_pb.js +76 -0
  163. package/dist/esm/generated/ottochain/apps/markets/v1/market.js +1252 -0
  164. package/dist/esm/generated/ottochain/apps/markets/v1/market_pb.js +148 -0
  165. package/dist/esm/generated/ottochain/apps/oracles/v1/oracle.js +1217 -0
  166. package/dist/esm/generated/ottochain/apps/oracles/v1/oracle_pb.js +106 -0
  167. package/dist/esm/generated/ottochain/v1/common.js +7 -0
  168. package/dist/esm/generated/ottochain/v1/common_pb.js +34 -0
  169. package/dist/esm/generated/ottochain/v1/fiber.js +1051 -0
  170. package/dist/esm/generated/ottochain/v1/fiber_pb.js +83 -0
  171. package/dist/esm/generated/ottochain/v1/messages.js +737 -0
  172. package/dist/esm/generated/ottochain/v1/messages_pb.js +41 -0
  173. package/dist/esm/generated/ottochain/v1/records.js +1250 -0
  174. package/dist/esm/generated/ottochain/v1/records_pb.js +41 -0
  175. package/dist/esm/index.js +33 -0
  176. package/dist/esm/metakit/binary.js +53 -0
  177. package/dist/esm/metakit/canonicalize.js +33 -0
  178. package/dist/esm/metakit/codec.js +38 -0
  179. package/dist/esm/metakit/currency-transaction.js +306 -0
  180. package/dist/esm/metakit/currency-types.js +10 -0
  181. package/dist/esm/metakit/hash.js +77 -0
  182. package/dist/esm/metakit/index.js +30 -0
  183. package/dist/esm/metakit/network/client.js +74 -0
  184. package/dist/esm/metakit/network/currency-l1-client.js +97 -0
  185. package/dist/esm/metakit/network/data-l1-client.js +72 -0
  186. package/dist/esm/metakit/network/index.js +9 -0
  187. package/dist/esm/metakit/network/types.js +16 -0
  188. package/dist/esm/metakit/sign.js +114 -0
  189. package/dist/esm/metakit/signed-object.js +94 -0
  190. package/dist/esm/metakit/types.js +11 -0
  191. package/dist/esm/metakit/verify.js +210 -0
  192. package/dist/esm/metakit/wallet.js +117 -0
  193. package/dist/esm/ottochain/index.js +13 -0
  194. package/dist/esm/ottochain/metagraph-client.js +153 -0
  195. package/dist/esm/ottochain/snapshot.js +100 -0
  196. package/dist/esm/ottochain/types.js +10 -0
  197. package/dist/esm/package.json +1 -0
  198. package/dist/esm/types.js +20 -0
  199. package/dist/esm/validation.js +301 -0
  200. package/dist/generated/index.d.ts +15 -0
  201. package/dist/generated/index.js +34 -0
  202. package/dist/generated/ottochain/apps/contracts/v1/contract_pb.d.ts +274 -0
  203. package/dist/generated/ottochain/apps/contracts/v1/contract_pb.js +100 -0
  204. package/dist/generated/ottochain/apps/identity/v1/agent_pb.d.ts +211 -0
  205. package/dist/generated/ottochain/apps/identity/v1/agent_pb.js +116 -0
  206. package/dist/generated/ottochain/apps/identity/v1/attestation_pb.d.ts +238 -0
  207. package/dist/generated/ottochain/apps/identity/v1/attestation_pb.js +79 -0
  208. package/dist/generated/ottochain/apps/markets/v1/market_pb.d.ts +436 -0
  209. package/dist/generated/ottochain/apps/markets/v1/market_pb.js +151 -0
  210. package/dist/generated/ottochain/apps/oracles/v1/oracle_pb.d.ts +393 -0
  211. package/dist/generated/ottochain/apps/oracles/v1/oracle_pb.js +109 -0
  212. package/dist/generated/ottochain/v1/common_pb.d.ts +86 -0
  213. package/dist/generated/ottochain/v1/common_pb.js +37 -0
  214. package/dist/generated/ottochain/v1/fiber_pb.d.ts +292 -0
  215. package/dist/generated/ottochain/v1/fiber_pb.js +86 -0
  216. package/dist/generated/ottochain/v1/messages_pb.d.ts +190 -0
  217. package/dist/generated/ottochain/v1/messages_pb.js +44 -0
  218. package/dist/generated/ottochain/v1/records_pb.d.ts +221 -0
  219. package/dist/generated/ottochain/v1/records_pb.js +44 -0
  220. package/dist/index.d.ts +21 -0
  221. package/dist/index.js +77 -0
  222. package/dist/metakit/binary.d.ts +38 -0
  223. package/dist/metakit/binary.js +58 -0
  224. package/dist/metakit/canonicalize.d.ts +26 -0
  225. package/dist/metakit/canonicalize.js +40 -0
  226. package/dist/metakit/codec.d.ts +16 -0
  227. package/dist/metakit/codec.js +45 -0
  228. package/dist/metakit/currency-transaction.d.ts +157 -0
  229. package/dist/metakit/currency-transaction.js +319 -0
  230. package/dist/metakit/currency-types.d.ts +55 -0
  231. package/dist/metakit/currency-types.js +13 -0
  232. package/dist/metakit/hash.d.ts +50 -0
  233. package/dist/metakit/hash.js +84 -0
  234. package/dist/metakit/index.d.ts +23 -0
  235. package/dist/metakit/index.js +74 -0
  236. package/dist/metakit/network/client.d.ts +23 -0
  237. package/dist/metakit/network/client.js +78 -0
  238. package/dist/metakit/network/currency-l1-client.d.ts +71 -0
  239. package/dist/metakit/network/currency-l1-client.js +101 -0
  240. package/dist/metakit/network/data-l1-client.d.ts +57 -0
  241. package/dist/metakit/network/data-l1-client.js +76 -0
  242. package/dist/metakit/network/index.d.ts +10 -0
  243. package/dist/metakit/network/index.js +16 -0
  244. package/dist/metakit/network/types.d.ts +74 -0
  245. package/dist/metakit/network/types.js +20 -0
  246. package/dist/metakit/sign.d.ts +65 -0
  247. package/dist/metakit/sign.js +120 -0
  248. package/dist/metakit/signed-object.d.ts +66 -0
  249. package/dist/metakit/signed-object.js +100 -0
  250. package/dist/metakit/types.d.ts +67 -0
  251. package/dist/metakit/types.js +14 -0
  252. package/dist/metakit/verify.d.ts +55 -0
  253. package/dist/metakit/verify.js +217 -0
  254. package/dist/metakit/wallet.d.ts +70 -0
  255. package/dist/metakit/wallet.js +127 -0
  256. package/dist/ottochain/index.d.ts +13 -0
  257. package/dist/ottochain/index.js +45 -0
  258. package/dist/ottochain/metagraph-client.d.ts +111 -0
  259. package/dist/ottochain/metagraph-client.js +157 -0
  260. package/dist/ottochain/snapshot.d.ts +86 -0
  261. package/dist/ottochain/snapshot.js +110 -0
  262. package/dist/ottochain/types.d.ts +278 -0
  263. package/dist/ottochain/types.js +11 -0
  264. package/dist/types/apps/contracts/index.d.ts +30 -0
  265. package/dist/types/apps/contracts/types.d.ts +24 -0
  266. package/dist/types/apps/corporate/index.d.ts +27 -0
  267. package/dist/types/apps/corporate/types.d.ts +9861 -0
  268. package/dist/types/apps/governance/index.d.ts +77 -0
  269. package/dist/types/apps/governance/types.d.ts +344 -0
  270. package/dist/types/apps/identity/constants.d.ts +27 -0
  271. package/dist/types/apps/identity/index.d.ts +39 -0
  272. package/dist/types/apps/identity/types.d.ts +30 -0
  273. package/dist/types/apps/index.d.ts +31 -0
  274. package/dist/types/apps/markets/index.d.ts +26 -0
  275. package/dist/types/apps/markets/types.d.ts +155 -0
  276. package/dist/types/apps/oracles/index.d.ts +34 -0
  277. package/dist/types/apps/oracles/types.d.ts +193 -0
  278. package/dist/types/errors.d.ts +221 -0
  279. package/dist/types/generated/google/protobuf/struct.d.ts +134 -0
  280. package/dist/types/generated/google/protobuf/timestamp.d.ts +134 -0
  281. package/dist/types/generated/index.d.ts +18 -0
  282. package/dist/types/generated/ottochain/apps/contracts/v1/contract.d.ts +112 -0
  283. package/dist/types/generated/ottochain/apps/contracts/v1/contract_pb.d.ts +274 -0
  284. package/dist/types/generated/ottochain/apps/corporate/v1/corporate.d.ts +376 -0
  285. package/dist/types/generated/ottochain/apps/corporate/v1/corporate_pb.d.ts +1172 -0
  286. package/dist/types/generated/ottochain/apps/governance/v1/governance.d.ts +296 -0
  287. package/dist/types/generated/ottochain/apps/governance/v1/governance_pb.d.ts +772 -0
  288. package/dist/types/generated/ottochain/apps/identity/v1/agent.d.ts +94 -0
  289. package/dist/types/generated/ottochain/apps/identity/v1/agent_pb.d.ts +211 -0
  290. package/dist/types/generated/ottochain/apps/identity/v1/attestation.d.ts +102 -0
  291. package/dist/types/generated/ottochain/apps/identity/v1/attestation_pb.d.ts +238 -0
  292. package/dist/types/generated/ottochain/apps/markets/v1/market.d.ts +174 -0
  293. package/dist/types/generated/ottochain/apps/markets/v1/market_pb.d.ts +436 -0
  294. package/dist/types/generated/ottochain/apps/oracles/v1/oracle.d.ts +150 -0
  295. package/dist/types/generated/ottochain/apps/oracles/v1/oracle_pb.d.ts +393 -0
  296. package/dist/types/generated/ottochain/v1/common.d.ts +1 -0
  297. package/dist/types/generated/ottochain/v1/common_pb.d.ts +86 -0
  298. package/dist/types/generated/ottochain/v1/fiber.d.ts +130 -0
  299. package/dist/types/generated/ottochain/v1/fiber_pb.d.ts +292 -0
  300. package/dist/types/generated/ottochain/v1/messages.d.ts +89 -0
  301. package/dist/types/generated/ottochain/v1/messages_pb.d.ts +190 -0
  302. package/dist/types/generated/ottochain/v1/records.d.ts +128 -0
  303. package/dist/types/generated/ottochain/v1/records_pb.d.ts +221 -0
  304. package/dist/types/index.d.ts +22 -0
  305. package/dist/types/metakit/binary.d.ts +38 -0
  306. package/dist/types/metakit/canonicalize.d.ts +26 -0
  307. package/dist/types/metakit/codec.d.ts +16 -0
  308. package/dist/types/metakit/currency-transaction.d.ts +157 -0
  309. package/dist/types/metakit/currency-types.d.ts +55 -0
  310. package/dist/types/metakit/hash.d.ts +50 -0
  311. package/dist/types/metakit/index.d.ts +23 -0
  312. package/dist/types/metakit/network/client.d.ts +23 -0
  313. package/dist/types/metakit/network/currency-l1-client.d.ts +71 -0
  314. package/dist/types/metakit/network/data-l1-client.d.ts +57 -0
  315. package/dist/types/metakit/network/index.d.ts +10 -0
  316. package/dist/types/metakit/network/types.d.ts +74 -0
  317. package/dist/types/metakit/sign.d.ts +65 -0
  318. package/dist/types/metakit/signed-object.d.ts +66 -0
  319. package/dist/types/metakit/types.d.ts +67 -0
  320. package/dist/types/metakit/verify.d.ts +55 -0
  321. package/dist/types/metakit/wallet.d.ts +70 -0
  322. package/dist/types/ottochain/index.d.ts +13 -0
  323. package/dist/types/ottochain/metagraph-client.d.ts +111 -0
  324. package/dist/types/ottochain/snapshot.d.ts +86 -0
  325. package/dist/types/ottochain/types.d.ts +210 -0
  326. package/dist/types/types.d.ts +51 -0
  327. package/dist/types/validation.d.ts +449 -0
  328. package/dist/validation.d.ts +449 -0
  329. package/dist/validation.js +312 -0
  330. package/package.json +136 -0
@@ -0,0 +1,128 @@
1
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
+ import { AccessControlPolicy, EventReceipt, FiberLogEntry, FiberStatus, ScriptInvocation, StateMachineDefinition } from "./fiber.js";
3
+ export declare const protobufPackage = "ottochain.v1";
4
+ /** State machine fiber record - on-chain representation */
5
+ export interface StateMachineFiberRecord {
6
+ fiberId: string;
7
+ /** Snapshot ordinal */
8
+ creationOrdinal: number;
9
+ /** Snapshot ordinal */
10
+ previousUpdateOrdinal: number;
11
+ /** Snapshot ordinal */
12
+ latestUpdateOrdinal: number;
13
+ definition?: StateMachineDefinition | undefined;
14
+ /** State ID */
15
+ currentState: string;
16
+ stateData?: any | undefined;
17
+ /** Hash value */
18
+ stateDataHash: string;
19
+ /** Fiber ordinal */
20
+ sequenceNumber: number;
21
+ /** DAG addresses */
22
+ owners: string[];
23
+ status: FiberStatus;
24
+ lastReceipt?: EventReceipt | undefined;
25
+ parentFiberId?: string | undefined;
26
+ childFiberIds: string[];
27
+ }
28
+ /** Script fiber record - on-chain representation */
29
+ export interface ScriptFiberRecord {
30
+ fiberId: string;
31
+ /** Snapshot ordinal */
32
+ creationOrdinal: number;
33
+ /** Snapshot ordinal */
34
+ latestUpdateOrdinal: number;
35
+ scriptProgram?: any | undefined;
36
+ stateData?: any | undefined;
37
+ /** Hash value */
38
+ stateDataHash?: string | undefined;
39
+ accessControl?: AccessControlPolicy | undefined;
40
+ /** Fiber ordinal */
41
+ sequenceNumber: number;
42
+ /** DAG addresses */
43
+ owners: string[];
44
+ status: FiberStatus;
45
+ lastInvocation?: ScriptInvocation | undefined;
46
+ }
47
+ /** Fiber commit - lightweight proof in on-chain state */
48
+ export interface FiberCommit {
49
+ /** Hash value */
50
+ recordHash: string;
51
+ /** Hash value */
52
+ stateDataHash?: string | undefined;
53
+ /** Fiber ordinal */
54
+ sequenceNumber: number;
55
+ }
56
+ /** On-chain state */
57
+ export interface OnChainState {
58
+ fiberCommits: {
59
+ [key: string]: FiberCommit;
60
+ };
61
+ latestLogs: {
62
+ [key: string]: FiberLogEntryList;
63
+ };
64
+ }
65
+ export interface OnChainState_FiberCommitsEntry {
66
+ key: string;
67
+ value?: FiberCommit | undefined;
68
+ }
69
+ export interface OnChainState_LatestLogsEntry {
70
+ key: string;
71
+ value?: FiberLogEntryList | undefined;
72
+ }
73
+ /** Helper for map of log entries */
74
+ export interface FiberLogEntryList {
75
+ entries: FiberLogEntry[];
76
+ }
77
+ /** Calculated state - queryable via ML0 endpoints */
78
+ export interface CalculatedState {
79
+ stateMachines: {
80
+ [key: string]: StateMachineFiberRecord;
81
+ };
82
+ scripts: {
83
+ [key: string]: ScriptFiberRecord;
84
+ };
85
+ }
86
+ export interface CalculatedState_StateMachinesEntry {
87
+ key: string;
88
+ value?: StateMachineFiberRecord | undefined;
89
+ }
90
+ export interface CalculatedState_ScriptsEntry {
91
+ key: string;
92
+ value?: ScriptFiberRecord | undefined;
93
+ }
94
+ export declare const StateMachineFiberRecord: MessageFns<StateMachineFiberRecord>;
95
+ export declare const ScriptFiberRecord: MessageFns<ScriptFiberRecord>;
96
+ export declare const FiberCommit: MessageFns<FiberCommit>;
97
+ export declare const OnChainState: MessageFns<OnChainState>;
98
+ export declare const OnChainState_FiberCommitsEntry: MessageFns<OnChainState_FiberCommitsEntry>;
99
+ export declare const OnChainState_LatestLogsEntry: MessageFns<OnChainState_LatestLogsEntry>;
100
+ export declare const FiberLogEntryList: MessageFns<FiberLogEntryList>;
101
+ export declare const CalculatedState: MessageFns<CalculatedState>;
102
+ export declare const CalculatedState_StateMachinesEntry: MessageFns<CalculatedState_StateMachinesEntry>;
103
+ export declare const CalculatedState_ScriptsEntry: MessageFns<CalculatedState_ScriptsEntry>;
104
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
105
+ export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
106
+ $case: string;
107
+ } ? {
108
+ [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
109
+ } & {
110
+ $case: T["$case"];
111
+ } : T extends {} ? {
112
+ [K in keyof T]?: DeepPartial<T[K]>;
113
+ } : Partial<T>;
114
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
115
+ export type Exact<P, I extends P> = P extends Builtin ? P : P & {
116
+ [K in keyof P]: Exact<P[K], I[K]>;
117
+ } & {
118
+ [K in Exclude<keyof I, KeysOfUnion<P>>]: never;
119
+ };
120
+ export interface MessageFns<T> {
121
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
122
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
123
+ fromJSON(object: any): T;
124
+ toJSON(message: T): unknown;
125
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
126
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
127
+ }
128
+ export {};
@@ -0,0 +1,221 @@
1
+ import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv1";
2
+ import type { Address, FiberOrdinal, HashValue, SnapshotOrdinal, StateId } from "./common_pb.js";
3
+ import type { AccessControlPolicy, EventReceipt, FiberLogEntry, FiberStatus, ScriptInvocation, StateMachineDefinition } from "./fiber_pb.js";
4
+ import type { Value } from "@bufbuild/protobuf/wkt";
5
+ import type { Message } from "@bufbuild/protobuf";
6
+ /**
7
+ * Describes the file ottochain/v1/records.proto.
8
+ */
9
+ export declare const file_ottochain_v1_records: GenFile;
10
+ /**
11
+ * State machine fiber record - on-chain representation
12
+ *
13
+ * @generated from message ottochain.v1.StateMachineFiberRecord
14
+ */
15
+ export type StateMachineFiberRecord = Message<"ottochain.v1.StateMachineFiberRecord"> & {
16
+ /**
17
+ * @generated from field: string fiber_id = 1;
18
+ */
19
+ fiberId: string;
20
+ /**
21
+ * @generated from field: ottochain.v1.SnapshotOrdinal creation_ordinal = 2;
22
+ */
23
+ creationOrdinal?: SnapshotOrdinal;
24
+ /**
25
+ * @generated from field: ottochain.v1.SnapshotOrdinal previous_update_ordinal = 3;
26
+ */
27
+ previousUpdateOrdinal?: SnapshotOrdinal;
28
+ /**
29
+ * @generated from field: ottochain.v1.SnapshotOrdinal latest_update_ordinal = 4;
30
+ */
31
+ latestUpdateOrdinal?: SnapshotOrdinal;
32
+ /**
33
+ * @generated from field: ottochain.v1.StateMachineDefinition definition = 5;
34
+ */
35
+ definition?: StateMachineDefinition;
36
+ /**
37
+ * @generated from field: ottochain.v1.StateId current_state = 6;
38
+ */
39
+ currentState?: StateId;
40
+ /**
41
+ * @generated from field: google.protobuf.Value state_data = 7;
42
+ */
43
+ stateData?: Value;
44
+ /**
45
+ * @generated from field: ottochain.v1.HashValue state_data_hash = 8;
46
+ */
47
+ stateDataHash?: HashValue;
48
+ /**
49
+ * @generated from field: ottochain.v1.FiberOrdinal sequence_number = 9;
50
+ */
51
+ sequenceNumber?: FiberOrdinal;
52
+ /**
53
+ * @generated from field: repeated ottochain.v1.Address owners = 10;
54
+ */
55
+ owners: Address[];
56
+ /**
57
+ * @generated from field: ottochain.v1.FiberStatus status = 11;
58
+ */
59
+ status: FiberStatus;
60
+ /**
61
+ * @generated from field: optional ottochain.v1.EventReceipt last_receipt = 12;
62
+ */
63
+ lastReceipt?: EventReceipt;
64
+ /**
65
+ * @generated from field: optional string parent_fiber_id = 13;
66
+ */
67
+ parentFiberId?: string;
68
+ /**
69
+ * @generated from field: repeated string child_fiber_ids = 14;
70
+ */
71
+ childFiberIds: string[];
72
+ };
73
+ /**
74
+ * Describes the message ottochain.v1.StateMachineFiberRecord.
75
+ * Use `create(StateMachineFiberRecordSchema)` to create a new message.
76
+ */
77
+ export declare const StateMachineFiberRecordSchema: GenMessage<StateMachineFiberRecord>;
78
+ /**
79
+ * Script fiber record - on-chain representation
80
+ *
81
+ * @generated from message ottochain.v1.ScriptFiberRecord
82
+ */
83
+ export type ScriptFiberRecord = Message<"ottochain.v1.ScriptFiberRecord"> & {
84
+ /**
85
+ * @generated from field: string fiber_id = 1;
86
+ */
87
+ fiberId: string;
88
+ /**
89
+ * @generated from field: ottochain.v1.SnapshotOrdinal creation_ordinal = 2;
90
+ */
91
+ creationOrdinal?: SnapshotOrdinal;
92
+ /**
93
+ * @generated from field: ottochain.v1.SnapshotOrdinal latest_update_ordinal = 3;
94
+ */
95
+ latestUpdateOrdinal?: SnapshotOrdinal;
96
+ /**
97
+ * @generated from field: google.protobuf.Value script_program = 4;
98
+ */
99
+ scriptProgram?: Value;
100
+ /**
101
+ * @generated from field: optional google.protobuf.Value state_data = 5;
102
+ */
103
+ stateData?: Value;
104
+ /**
105
+ * @generated from field: optional ottochain.v1.HashValue state_data_hash = 6;
106
+ */
107
+ stateDataHash?: HashValue;
108
+ /**
109
+ * @generated from field: ottochain.v1.AccessControlPolicy access_control = 7;
110
+ */
111
+ accessControl?: AccessControlPolicy;
112
+ /**
113
+ * @generated from field: ottochain.v1.FiberOrdinal sequence_number = 8;
114
+ */
115
+ sequenceNumber?: FiberOrdinal;
116
+ /**
117
+ * @generated from field: repeated ottochain.v1.Address owners = 9;
118
+ */
119
+ owners: Address[];
120
+ /**
121
+ * @generated from field: ottochain.v1.FiberStatus status = 10;
122
+ */
123
+ status: FiberStatus;
124
+ /**
125
+ * @generated from field: optional ottochain.v1.ScriptInvocation last_invocation = 11;
126
+ */
127
+ lastInvocation?: ScriptInvocation;
128
+ };
129
+ /**
130
+ * Describes the message ottochain.v1.ScriptFiberRecord.
131
+ * Use `create(ScriptFiberRecordSchema)` to create a new message.
132
+ */
133
+ export declare const ScriptFiberRecordSchema: GenMessage<ScriptFiberRecord>;
134
+ /**
135
+ * Fiber commit - lightweight proof in on-chain state
136
+ *
137
+ * @generated from message ottochain.v1.FiberCommit
138
+ */
139
+ export type FiberCommit = Message<"ottochain.v1.FiberCommit"> & {
140
+ /**
141
+ * @generated from field: ottochain.v1.HashValue record_hash = 1;
142
+ */
143
+ recordHash?: HashValue;
144
+ /**
145
+ * @generated from field: optional ottochain.v1.HashValue state_data_hash = 2;
146
+ */
147
+ stateDataHash?: HashValue;
148
+ /**
149
+ * @generated from field: ottochain.v1.FiberOrdinal sequence_number = 3;
150
+ */
151
+ sequenceNumber?: FiberOrdinal;
152
+ };
153
+ /**
154
+ * Describes the message ottochain.v1.FiberCommit.
155
+ * Use `create(FiberCommitSchema)` to create a new message.
156
+ */
157
+ export declare const FiberCommitSchema: GenMessage<FiberCommit>;
158
+ /**
159
+ * On-chain state
160
+ *
161
+ * @generated from message ottochain.v1.OnChainState
162
+ */
163
+ export type OnChainState = Message<"ottochain.v1.OnChainState"> & {
164
+ /**
165
+ * @generated from field: map<string, ottochain.v1.FiberCommit> fiber_commits = 1;
166
+ */
167
+ fiberCommits: {
168
+ [key: string]: FiberCommit;
169
+ };
170
+ /**
171
+ * @generated from field: map<string, ottochain.v1.FiberLogEntryList> latest_logs = 2;
172
+ */
173
+ latestLogs: {
174
+ [key: string]: FiberLogEntryList;
175
+ };
176
+ };
177
+ /**
178
+ * Describes the message ottochain.v1.OnChainState.
179
+ * Use `create(OnChainStateSchema)` to create a new message.
180
+ */
181
+ export declare const OnChainStateSchema: GenMessage<OnChainState>;
182
+ /**
183
+ * Helper for map of log entries
184
+ *
185
+ * @generated from message ottochain.v1.FiberLogEntryList
186
+ */
187
+ export type FiberLogEntryList = Message<"ottochain.v1.FiberLogEntryList"> & {
188
+ /**
189
+ * @generated from field: repeated ottochain.v1.FiberLogEntry entries = 1;
190
+ */
191
+ entries: FiberLogEntry[];
192
+ };
193
+ /**
194
+ * Describes the message ottochain.v1.FiberLogEntryList.
195
+ * Use `create(FiberLogEntryListSchema)` to create a new message.
196
+ */
197
+ export declare const FiberLogEntryListSchema: GenMessage<FiberLogEntryList>;
198
+ /**
199
+ * Calculated state - queryable via ML0 endpoints
200
+ *
201
+ * @generated from message ottochain.v1.CalculatedState
202
+ */
203
+ export type CalculatedState = Message<"ottochain.v1.CalculatedState"> & {
204
+ /**
205
+ * @generated from field: map<string, ottochain.v1.StateMachineFiberRecord> state_machines = 1;
206
+ */
207
+ stateMachines: {
208
+ [key: string]: StateMachineFiberRecord;
209
+ };
210
+ /**
211
+ * @generated from field: map<string, ottochain.v1.ScriptFiberRecord> scripts = 2;
212
+ */
213
+ scripts: {
214
+ [key: string]: ScriptFiberRecord;
215
+ };
216
+ };
217
+ /**
218
+ * Describes the message ottochain.v1.CalculatedState.
219
+ * Use `create(CalculatedStateSchema)` to create a new message.
220
+ */
221
+ export declare const CalculatedStateSchema: GenMessage<CalculatedState>;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Ottochain SDK
3
+ *
4
+ * Unified SDK combining metakit framework operations with ottochain domain types.
5
+ *
6
+ * Structure:
7
+ * - `metakit` — Signing, encoding, hashing, and network clients for Constellation metagraphs
8
+ * - `generated` — Protobuf-generated types (source of truth)
9
+ * - `apps/identity` — Agent Identity application types
10
+ * - `apps/contracts` — Contract application types
11
+ * - `errors` — Custom error classes for structured error handling
12
+ * - `validation` — Input validation with Zod schemas
13
+ *
14
+ * @packageDocumentation
15
+ */
16
+ export * from './types.js';
17
+ export * from './metakit/index.js';
18
+ export * from './generated/index.js';
19
+ export { OttoChainError, NetworkError, ValidationError, SigningError, TransactionError, ErrorCode, isErrorCode, wrapError, } from './errors.js';
20
+ export { DagAddressSchema, PrivateKeySchema, PublicKeySchema, KeyPairSchema, SignatureProofSchema, SignedSchema, TransactionReferenceSchema, CurrencyTransactionValueSchema, CurrencyTransactionSchema, TransferParamsSchema, AgentIdentityRegistrationSchema, PlatformLinkSchema, ContractTermsSchema, ProposeContractRequestSchema, AcceptContractRequestSchema, CompleteContractRequestSchema, validate, validatePrivateKey, validatePublicKey, validateAddress, validateKeyPair, safeParse, assert, type ValidatedKeyPair, type ValidatedSignatureProof, type ValidatedCurrencyTransaction, type ValidatedTransferParams, type ValidatedAgentIdentityRegistration, type ValidatedPlatformLink, type ValidatedProposeContractRequest, type ValidatedAcceptContractRequest, type ValidatedCompleteContractRequest, } from './validation.js';
21
+ export * from './errors.js';
22
+ export * from './validation.js';
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Binary Encoding
3
+ *
4
+ * Converts JSON data to binary format for cryptographic operations.
5
+ * Supports both regular encoding and DataUpdate encoding with Constellation prefix.
6
+ */
7
+ /**
8
+ * Convert data to binary bytes for signing
9
+ *
10
+ * For regular data:
11
+ * JSON -> RFC 8785 canonicalization -> UTF-8 bytes
12
+ *
13
+ * For DataUpdate (isDataUpdate=true):
14
+ * JSON -> RFC 8785 -> UTF-8 -> Base64 -> prepend Constellation prefix -> UTF-8 bytes
15
+ *
16
+ * @param data - Any JSON-serializable object
17
+ * @param isDataUpdate - If true, applies DataUpdate encoding with Constellation prefix
18
+ * @returns Binary bytes as Uint8Array
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * // Regular encoding
23
+ * const bytes = toBytes({ action: 'test' });
24
+ *
25
+ * // DataUpdate encoding
26
+ * const updateBytes = toBytes({ action: 'test' }, true);
27
+ * ```
28
+ */
29
+ export declare function toBytes<T>(data: T, isDataUpdate?: boolean): Uint8Array;
30
+ /**
31
+ * Encode data as a DataUpdate with Constellation prefix
32
+ *
33
+ * This is equivalent to `toBytes(data, true)`.
34
+ *
35
+ * @param data - Any JSON-serializable object
36
+ * @returns Binary bytes with Constellation prefix
37
+ */
38
+ export declare function encodeDataUpdate<T>(data: T): Uint8Array;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * RFC 8785 JSON Canonicalization
3
+ *
4
+ * Provides deterministic JSON serialization according to RFC 8785.
5
+ * This ensures identical JSON objects always produce identical strings.
6
+ */
7
+ /**
8
+ * Canonicalize JSON data according to RFC 8785
9
+ *
10
+ * Key features:
11
+ * - Object keys sorted by UTF-16BE binary comparison
12
+ * - Numbers serialized in shortest decimal representation
13
+ * - No whitespace
14
+ * - Proper Unicode escaping
15
+ *
16
+ * @param data - Any JSON-serializable object
17
+ * @returns Canonical JSON string
18
+ * @throws Error if data cannot be serialized to JSON
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * const canonical = canonicalize({ b: 2, a: 1 });
23
+ * // Returns: '{"a":1,"b":2}'
24
+ * ```
25
+ */
26
+ export declare function canonicalize<T>(data: T): string;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Codec Utilities
3
+ *
4
+ * Encoding/decoding utilities for the Constellation signature protocol.
5
+ * Re-exports from binary.ts for backwards compatibility and provides additional utilities.
6
+ */
7
+ export { toBytes, encodeDataUpdate } from './binary.js';
8
+ export { CONSTELLATION_PREFIX } from './types.js';
9
+ /**
10
+ * Decode a DataUpdate encoded message back to its original JSON
11
+ *
12
+ * @param bytes - DataUpdate encoded bytes
13
+ * @returns Decoded JSON object
14
+ * @throws Error if bytes are not valid DataUpdate encoding
15
+ */
16
+ export declare function decodeDataUpdate<T>(bytes: Uint8Array): T;
@@ -0,0 +1,157 @@
1
+ /**
2
+ * Currency transaction operations for metagraph token transfers
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ import type { CurrencyTransaction, TransactionReference, TransferParams } from './currency-types.js';
7
+ import type { VerificationResult } from './types.js';
8
+ /**
9
+ * Convert token amount to smallest units
10
+ *
11
+ * @param amount - Amount in token units (e.g., 100.5)
12
+ * @returns Amount in smallest units (1e-8)
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const units = tokenToUnits(100.5); // 10050000000
17
+ * ```
18
+ */
19
+ export declare function tokenToUnits(amount: number): number;
20
+ /**
21
+ * Convert smallest units to token amount
22
+ *
23
+ * @param units - Amount in smallest units
24
+ * @returns Amount in token units
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * const tokens = unitsToToken(10050000000); // 100.5
29
+ * ```
30
+ */
31
+ export declare function unitsToToken(units: number): number;
32
+ /**
33
+ * Validate DAG address format
34
+ *
35
+ * @param address - DAG address to validate
36
+ * @returns True if address is valid
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * const valid = isValidDagAddress('DAG...');
41
+ * ```
42
+ */
43
+ export declare function isValidDagAddress(address: string): boolean;
44
+ /**
45
+ * Create a metagraph token transaction
46
+ *
47
+ * @param params - Transfer parameters
48
+ * @param privateKey - Private key to sign with (hex string)
49
+ * @param lastRef - Reference to last accepted transaction
50
+ * @returns Signed currency transaction
51
+ *
52
+ * @throws If addresses are invalid or amount is too small
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * const tx = await createCurrencyTransaction(
57
+ * { destination: 'DAG...', amount: 100.5, fee: 0 },
58
+ * privateKey,
59
+ * { hash: 'abc123...', ordinal: 5 }
60
+ * );
61
+ * ```
62
+ */
63
+ export declare function createCurrencyTransaction(params: TransferParams, privateKey: string, lastRef: TransactionReference): Promise<CurrencyTransaction>;
64
+ /**
65
+ * Create multiple metagraph token transactions (batch)
66
+ *
67
+ * @param transfers - Array of transfer parameters
68
+ * @param privateKey - Private key to sign with
69
+ * @param lastRef - Reference to last accepted transaction
70
+ * @returns Array of signed currency transactions
71
+ *
72
+ * @throws If any address is invalid or amount is too small
73
+ *
74
+ * @example
75
+ * ```typescript
76
+ * const txns = await createCurrencyTransactionBatch(
77
+ * [
78
+ * { destination: 'DAG...1', amount: 10 },
79
+ * { destination: 'DAG...2', amount: 20 },
80
+ * ],
81
+ * privateKey,
82
+ * { hash: 'abc123...', ordinal: 5 }
83
+ * );
84
+ * ```
85
+ */
86
+ export declare function createCurrencyTransactionBatch(transfers: TransferParams[], privateKey: string, lastRef: TransactionReference): Promise<CurrencyTransaction[]>;
87
+ /**
88
+ * Add a signature to an existing currency transaction (for multi-sig)
89
+ *
90
+ * @param transaction - Transaction to sign
91
+ * @param privateKey - Private key to sign with
92
+ * @returns Transaction with additional signature
93
+ *
94
+ * @throws If sign-verify fails
95
+ *
96
+ * @example
97
+ * ```typescript
98
+ * const signedTx = await signCurrencyTransaction(tx, privateKey2);
99
+ * ```
100
+ */
101
+ export declare function signCurrencyTransaction(transaction: CurrencyTransaction, privateKey: string): Promise<CurrencyTransaction>;
102
+ /**
103
+ * Verify all signatures on a currency transaction
104
+ *
105
+ * @param transaction - Transaction to verify
106
+ * @returns Verification result with valid/invalid proofs
107
+ *
108
+ * @example
109
+ * ```typescript
110
+ * const result = await verifyCurrencyTransaction(tx);
111
+ * console.log('Valid:', result.isValid);
112
+ * ```
113
+ */
114
+ export declare function verifyCurrencyTransaction(transaction: CurrencyTransaction): Promise<VerificationResult>;
115
+ /**
116
+ * Encode a currency transaction for hashing
117
+ *
118
+ * @param transaction - Transaction to encode
119
+ * @returns Hex-encoded string
120
+ *
121
+ * @example
122
+ * ```typescript
123
+ * const encoded = encodeCurrencyTransaction(tx);
124
+ * ```
125
+ */
126
+ export declare function encodeCurrencyTransaction(transaction: CurrencyTransaction): string;
127
+ /**
128
+ * Hash a currency transaction
129
+ *
130
+ * @param transaction - Transaction to hash
131
+ * @returns Hash object with value and bytes
132
+ *
133
+ * @example
134
+ * ```typescript
135
+ * const hash = await hashCurrencyTransaction(tx);
136
+ * console.log('Hash:', hash.value);
137
+ * ```
138
+ */
139
+ export declare function hashCurrencyTransaction(transaction: CurrencyTransaction): Promise<{
140
+ value: string;
141
+ bytes: Uint8Array;
142
+ }>;
143
+ /**
144
+ * Get transaction reference from a currency transaction
145
+ * Useful for chaining transactions
146
+ *
147
+ * @param transaction - Transaction to extract reference from
148
+ * @param ordinal - Ordinal number for this transaction
149
+ * @returns Transaction reference
150
+ *
151
+ * @example
152
+ * ```typescript
153
+ * const ref = await getTransactionReference(tx, 6);
154
+ * // Use ref as lastRef for next transaction
155
+ * ```
156
+ */
157
+ export declare function getTransactionReference(transaction: CurrencyTransaction, ordinal: number): Promise<TransactionReference>;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Currency transaction types for metagraph token transfers
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ import type { Signed } from './types.js';
7
+ /**
8
+ * Reference to a previous transaction for chaining
9
+ */
10
+ export interface TransactionReference {
11
+ /** Transaction hash */
12
+ hash: string;
13
+ /** Transaction ordinal number */
14
+ ordinal: number;
15
+ }
16
+ /**
17
+ * Currency transaction value structure (v2)
18
+ * Contains the actual transaction data before signing
19
+ */
20
+ export interface CurrencyTransactionValue {
21
+ /** Source DAG address */
22
+ source: string;
23
+ /** Destination DAG address */
24
+ destination: string;
25
+ /** Amount in smallest units (1e-8) */
26
+ amount: number;
27
+ /** Fee in smallest units (1e-8) */
28
+ fee: number;
29
+ /** Reference to parent transaction */
30
+ parent: TransactionReference;
31
+ /** Random salt for uniqueness (as string) */
32
+ salt: string;
33
+ }
34
+ /**
35
+ * Currency transaction structure (v2)
36
+ * A signed currency transaction value
37
+ * Used for metagraph token transfers
38
+ */
39
+ export type CurrencyTransaction = Signed<CurrencyTransactionValue>;
40
+ /**
41
+ * Parameters for creating a token transfer
42
+ */
43
+ export interface TransferParams {
44
+ /** Destination DAG address */
45
+ destination: string;
46
+ /** Amount in token units (e.g., 100.5 tokens) */
47
+ amount: number;
48
+ /** Fee in token units (defaults to 0) */
49
+ fee?: number;
50
+ }
51
+ /**
52
+ * Token decimals constant (1e-8)
53
+ * Same as DAG_DECIMALS from dag4.js
54
+ */
55
+ export declare const TOKEN_DECIMALS = 1e-8;