@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,155 @@
1
+ /**
2
+ * Markets Application Types
3
+ *
4
+ * Constants, types, and utilities for the Markets application on OttoChain.
5
+ *
6
+ * Core types (MarketType, MarketState, Market, Commitment, Resolution) are
7
+ * exported from proto-generated types in index.ts.
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ import { MarketType, MarketState } from '../../generated/ottochain/apps/markets/v1/market_pb.js';
12
+ /**
13
+ * Commitment direction (for prediction markets)
14
+ */
15
+ export declare enum CommitmentSide {
16
+ UNSPECIFIED = 0,
17
+ YES = 1,
18
+ NO = 2
19
+ }
20
+ /**
21
+ * Market configuration type
22
+ */
23
+ export interface MarketConfig {
24
+ /** Platform fee as percentage (0.01 = 1%) */
25
+ platformFeePercent: number;
26
+ /** Market creator fee as percentage */
27
+ creatorFeePercent: number;
28
+ /** Oracle fee as percentage */
29
+ oracleFeePercent: number;
30
+ /** Minimum quorum for market validity (in tokens) */
31
+ minQuorum: bigint;
32
+ /** Default resolution window in epochs */
33
+ resolutionWindowEpochs: number;
34
+ /** Dispute window after resolution in epochs */
35
+ disputeWindowEpochs: number;
36
+ /** Minimum commitment amount */
37
+ minCommitment: bigint;
38
+ /** Maximum slippage for AMM-style markets */
39
+ maxSlippagePercent: number;
40
+ }
41
+ /**
42
+ * Default market configuration
43
+ */
44
+ export declare const DEFAULT_MARKET_CONFIG: MarketConfig;
45
+ /**
46
+ * Type-specific market configurations
47
+ */
48
+ export declare const MARKET_TYPE_CONFIGS: Record<MarketType, Partial<MarketConfig>>;
49
+ /**
50
+ * Valid transitions for each market state (aligned with proto MarketState enum)
51
+ */
52
+ export declare const MARKET_TRANSITIONS: Record<MarketState, readonly string[]>;
53
+ /**
54
+ * Check if a market state is terminal
55
+ */
56
+ export declare function isTerminalMarketState(state: MarketState): boolean;
57
+ /**
58
+ * Calculate effective commitment after fees
59
+ *
60
+ * @param amount - Raw commitment amount
61
+ * @param config - Market configuration (uses defaults if not provided)
62
+ * @returns Net commitment amount after platform fees
63
+ */
64
+ export declare function calculateNetCommitment(amount: bigint, config?: Partial<MarketConfig>): bigint;
65
+ /**
66
+ * Calculate total fees for a commitment
67
+ *
68
+ * @param amount - Commitment amount
69
+ * @param marketType - Type of market for type-specific fees
70
+ * @returns Fee breakdown object
71
+ */
72
+ export declare function calculateFees(amount: bigint, marketType?: MarketType): {
73
+ platform: bigint;
74
+ creator: bigint;
75
+ oracle: bigint;
76
+ total: bigint;
77
+ };
78
+ /**
79
+ * Outcome shares for payout calculation
80
+ */
81
+ export interface OutcomeShares {
82
+ /** Total committed to winning outcome */
83
+ winningPool: bigint;
84
+ /** Total committed to losing outcome(s) */
85
+ losingPool: bigint;
86
+ /** Individual's commitment to winning outcome */
87
+ userCommitment: bigint;
88
+ }
89
+ /**
90
+ * Calculate payout for a winning commitment in a prediction market
91
+ *
92
+ * Winner receives: their original + proportional share of losing pool (minus fees)
93
+ *
94
+ * @param shares - Pool and commitment details
95
+ * @param marketType - Type of market for fee calculation
96
+ * @returns Payout amount
97
+ */
98
+ export declare function calculatePayout(shares: OutcomeShares, marketType?: MarketType): bigint;
99
+ /**
100
+ * Calculate refund for cancelled market
101
+ *
102
+ * @param commitment - Original commitment amount
103
+ * @param refundFeePercent - Optional fee retained on refund (default 0)
104
+ * @returns Refund amount
105
+ */
106
+ export declare function calculateRefund(commitment: bigint, refundFeePercent?: number): bigint;
107
+ /**
108
+ * Validate a commitment meets market requirements
109
+ */
110
+ export interface CommitmentValidation {
111
+ valid: boolean;
112
+ reason?: string;
113
+ }
114
+ /**
115
+ * Validate a commitment against market rules
116
+ */
117
+ export declare function validateCommitment(amount: bigint, marketState: MarketState, config?: Partial<MarketConfig>): CommitmentValidation;
118
+ /**
119
+ * Calculate crowdfund progress
120
+ */
121
+ export interface CrowdfundProgress {
122
+ /** Current total committed */
123
+ current: bigint;
124
+ /** Target goal */
125
+ goal: bigint;
126
+ /** Percentage complete (0-100) */
127
+ percentComplete: number;
128
+ /** Whether goal has been reached */
129
+ goalReached: boolean;
130
+ }
131
+ /**
132
+ * Calculate crowdfund campaign progress
133
+ */
134
+ export declare function calculateCrowdfundProgress(current: bigint, goal: bigint): CrowdfundProgress;
135
+ /**
136
+ * Tier definition for group buys
137
+ */
138
+ export interface GroupBuyTier {
139
+ /** Minimum participants for this tier */
140
+ minParticipants: number;
141
+ /** Discount percentage for this tier */
142
+ discountPercent: number;
143
+ }
144
+ /**
145
+ * Calculate applicable discount based on participant count
146
+ */
147
+ export declare function calculateGroupBuyDiscount(participantCount: number, tiers: GroupBuyTier[]): number;
148
+ /**
149
+ * Check if a value is a valid MarketState
150
+ */
151
+ export declare function isMarketState(value: unknown): value is MarketState;
152
+ /**
153
+ * Check if a value is a valid MarketType
154
+ */
155
+ export declare function isMarketType(value: unknown): value is MarketType;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Oracles Application
3
+ *
4
+ * Types and utilities for oracles on OttoChain.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * import {
9
+ * OracleState,
10
+ * Oracle,
11
+ * getOracleDefinition,
12
+ * DEFAULT_ORACLE_CONFIG
13
+ * } from '@ottochain/sdk/apps/oracles';
14
+ *
15
+ * const oracleDef = getOracleDefinition();
16
+ * ```
17
+ *
18
+ * @packageDocumentation
19
+ */
20
+ export { OracleState, OracleReputation, SlashingEvent, Oracle, RegisterOracleRequest, ActivateOracleRequest, AddStakeRequest, WithdrawStakeRequest, SlashOracleRequest, WithdrawOracleRequest, OracleDefinition, oracleStateFromJSON, oracleStateToJSON, } from '../../generated/ottochain/apps/oracles/v1/oracle.js';
21
+ export type OracleDefinitionType = 'Oracle';
22
+ export declare const ORACLE_DEFINITIONS: Record<OracleDefinitionType, unknown>;
23
+ /**
24
+ * Get the oracle state machine definition.
25
+ */
26
+ export declare function getOracleDefinition(type?: OracleDefinitionType): unknown;
27
+ /**
28
+ * Default oracle configuration.
29
+ */
30
+ export declare const DEFAULT_ORACLE_CONFIG: {
31
+ minStake: number;
32
+ baseReputation: number;
33
+ reputationDecay: number;
34
+ };
@@ -0,0 +1,193 @@
1
+ /**
2
+ * Oracles Application Types
3
+ *
4
+ * Constants, types, and utilities for the Oracle system on OttoChain.
5
+ * Oracles provide truth resolution for markets and disputes.
6
+ *
7
+ * Core types (OracleState, Oracle, etc.) are exported from proto-generated
8
+ * types in index.ts.
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+ import { OracleState } from '../../generated/ottochain/apps/oracles/v1/oracle_pb.js';
13
+ /**
14
+ * Types of oracle resolutions
15
+ */
16
+ export declare enum ResolutionType {
17
+ UNSPECIFIED = 0,
18
+ /** Binary yes/no outcome */
19
+ BINARY = 1,
20
+ /** One of multiple predefined outcomes */
21
+ MULTI_CHOICE = 2,
22
+ /** Numeric value (e.g., price) */
23
+ NUMERIC = 3,
24
+ /** Free-form attestation */
25
+ ATTESTATION = 4
26
+ }
27
+ /**
28
+ * Reasons for slashing oracle stake
29
+ */
30
+ export declare enum SlashingReason {
31
+ UNSPECIFIED = 0,
32
+ /** Failed to submit resolution in time */
33
+ TIMEOUT = 1,
34
+ /** Resolution overturned by dispute */
35
+ INCORRECT_RESOLUTION = 2,
36
+ /** Evidence of collusion or manipulation */
37
+ COLLUSION = 3,
38
+ /** Violation of oracle protocol */
39
+ PROTOCOL_VIOLATION = 4
40
+ }
41
+ /**
42
+ * Oracle configuration type
43
+ */
44
+ export interface OracleConfig {
45
+ /** Minimum stake required to become an oracle (in base units) */
46
+ minStake: bigint;
47
+ /** Stake slashed for timeout (percentage) */
48
+ timeoutSlashPercent: number;
49
+ /** Stake slashed for incorrect resolution (percentage) */
50
+ incorrectSlashPercent: number;
51
+ /** Stake slashed for collusion (percentage) */
52
+ collusionSlashPercent: number;
53
+ /** Stake slashed for protocol violation (percentage) */
54
+ violationSlashPercent: number;
55
+ /** Epochs to wait before withdrawal after unstaking */
56
+ cooldownEpochs: number;
57
+ /** Base reputation for new oracles */
58
+ baseReputation: number;
59
+ /** Minimum reputation to accept high-value markets */
60
+ highValueThreshold: number;
61
+ /** Resolution window in epochs */
62
+ resolutionWindowEpochs: number;
63
+ /** Challenge window after submission in epochs */
64
+ challengeWindowEpochs: number;
65
+ /** Reward percentage from resolved market fees */
66
+ oracleRewardPercent: number;
67
+ }
68
+ /**
69
+ * Default oracle configuration
70
+ */
71
+ export declare const DEFAULT_ORACLE_CONFIG: OracleConfig;
72
+ /**
73
+ * Slashing percentages by reason
74
+ */
75
+ export declare const SLASHING_PERCENTAGES: Record<SlashingReason, number>;
76
+ /**
77
+ * Valid transitions for each oracle state (aligned with proto OracleState enum)
78
+ */
79
+ export declare const ORACLE_TRANSITIONS: Record<OracleState, readonly string[]>;
80
+ /**
81
+ * Check if an oracle state is terminal
82
+ */
83
+ export declare function isTerminalOracleState(state: OracleState): boolean;
84
+ /**
85
+ * Check if an oracle can accept new assignments
86
+ */
87
+ export declare function canAcceptAssignment(state: OracleState): boolean;
88
+ /**
89
+ * Reputation update factors
90
+ */
91
+ export declare const REPUTATION_DELTAS: {
92
+ /** Successfully resolved market without challenge */
93
+ readonly successfulResolution: 5;
94
+ /** Resolution upheld after challenge */
95
+ readonly upheldChallenge: 10;
96
+ /** Resolution overturned (negative) */
97
+ readonly overturnedResolution: -25;
98
+ /** Timeout on assigned market (negative) */
99
+ readonly timeout: -15;
100
+ /** Collusion detected (negative) */
101
+ readonly collusion: -100;
102
+ /** Protocol violation (negative) */
103
+ readonly violation: -20;
104
+ /** Bonus for high-value market resolution */
105
+ readonly highValueBonus: 3;
106
+ };
107
+ /**
108
+ * Calculate new reputation after an event
109
+ *
110
+ * @param currentReputation - Current reputation score
111
+ * @param delta - Reputation change (positive or negative)
112
+ * @param minReputation - Minimum reputation floor (default 0)
113
+ * @returns New reputation score
114
+ */
115
+ export declare function calculateReputation(currentReputation: number, delta: number, minReputation?: number): number;
116
+ /**
117
+ * Calculate weighted reputation considering history
118
+ *
119
+ * @param baseReputation - Current base reputation
120
+ * @param successCount - Number of successful resolutions
121
+ * @param failureCount - Number of failed/overturned resolutions
122
+ * @returns Weighted reputation score
123
+ */
124
+ export declare function calculateWeightedReputation(baseReputation: number, successCount: number, failureCount: number): number;
125
+ /**
126
+ * Check if oracle qualifies for high-value markets
127
+ */
128
+ export declare function qualifiesForHighValue(reputation: number, stake: bigint, threshold?: number, minStakeMultiplier?: number): boolean;
129
+ /**
130
+ * Slashing condition definition
131
+ */
132
+ export interface SlashingCondition {
133
+ reason: SlashingReason;
134
+ slashPercent: number;
135
+ description: string;
136
+ appealable: boolean;
137
+ suspensionEpochs: number;
138
+ }
139
+ /**
140
+ * Predefined slashing conditions
141
+ */
142
+ export declare const SLASHING_CONDITIONS: Record<SlashingReason, SlashingCondition>;
143
+ /**
144
+ * Calculate slash amount for a given stake and reason
145
+ *
146
+ * @param stake - Oracle's current stake
147
+ * @param reason - Reason for slashing
148
+ * @returns Amount to be slashed
149
+ */
150
+ export declare function calculateSlashAmount(stake: bigint, reason: SlashingReason): bigint;
151
+ /**
152
+ * Calculate remaining stake after slashing
153
+ */
154
+ export declare function calculateStakeAfterSlash(stake: bigint, reason: SlashingReason): bigint;
155
+ /**
156
+ * Oracle candidate for selection
157
+ */
158
+ export interface OracleCandidate {
159
+ address: string;
160
+ reputation: number;
161
+ stake: bigint;
162
+ activeAssignments: number;
163
+ successRate: number;
164
+ }
165
+ /**
166
+ * Calculate oracle selection score
167
+ * Higher score = more likely to be selected
168
+ *
169
+ * @param candidate - Oracle candidate details
170
+ * @param marketValue - Value of market to resolve (affects weight for high-value markets)
171
+ * @returns Selection score
172
+ */
173
+ export declare function calculateSelectionScore(candidate: OracleCandidate, marketValue?: bigint): number;
174
+ /**
175
+ * Calculate oracle reward for successful resolution
176
+ *
177
+ * @param marketFees - Total fees collected from market
178
+ * @param rewardPercent - Oracle's reward percentage (default from config)
179
+ * @returns Oracle reward amount
180
+ */
181
+ export declare function calculateOracleReward(marketFees: bigint, rewardPercent?: number): bigint;
182
+ /**
183
+ * Check if a value is a valid OracleState
184
+ */
185
+ export declare function isOracleState(value: unknown): value is OracleState;
186
+ /**
187
+ * Check if a value is a valid SlashingReason
188
+ */
189
+ export declare function isSlashingReason(value: unknown): value is SlashingReason;
190
+ /**
191
+ * Check if a value is a valid ResolutionType
192
+ */
193
+ export declare function isResolutionType(value: unknown): value is ResolutionType;
@@ -0,0 +1,221 @@
1
+ /**
2
+ * Custom Error Classes for OttoChain SDK
3
+ *
4
+ * Provides structured error handling with error codes and causes.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ /**
9
+ * Error codes for OttoChain SDK errors
10
+ */
11
+ export declare enum ErrorCode {
12
+ /** Unknown or unclassified error */
13
+ UNKNOWN = "UNKNOWN",
14
+ /** Network/HTTP connection failure */
15
+ NETWORK_ERROR = "NETWORK_ERROR",
16
+ /** Request timeout */
17
+ NETWORK_TIMEOUT = "NETWORK_TIMEOUT",
18
+ /** Input validation failed */
19
+ VALIDATION_ERROR = "VALIDATION_ERROR",
20
+ /** Invalid private key format */
21
+ INVALID_PRIVATE_KEY = "INVALID_PRIVATE_KEY",
22
+ /** Invalid public key format */
23
+ INVALID_PUBLIC_KEY = "INVALID_PUBLIC_KEY",
24
+ /** Invalid DAG address format */
25
+ INVALID_ADDRESS = "INVALID_ADDRESS",
26
+ /** Signature creation failed */
27
+ SIGNING_ERROR = "SIGNING_ERROR",
28
+ /** Signature verification failed */
29
+ VERIFICATION_ERROR = "VERIFICATION_ERROR",
30
+ /** Transaction rejected by network */
31
+ TRANSACTION_REJECTED = "TRANSACTION_REJECTED",
32
+ /** Transaction not found */
33
+ TRANSACTION_NOT_FOUND = "TRANSACTION_NOT_FOUND",
34
+ /** Invalid transaction format */
35
+ INVALID_TRANSACTION = "INVALID_TRANSACTION"
36
+ }
37
+ /**
38
+ * Base error class for all OttoChain SDK errors
39
+ *
40
+ * Provides consistent error structure with:
41
+ * - Error code for programmatic handling
42
+ * - Human-readable message
43
+ * - Optional cause for error chaining
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * try {
48
+ * await signTransaction(data, invalidKey);
49
+ * } catch (error) {
50
+ * if (error instanceof OttoChainError) {
51
+ * console.log(error.code); // 'INVALID_PRIVATE_KEY'
52
+ * console.log(error.message); // 'Invalid private key format'
53
+ * }
54
+ * }
55
+ * ```
56
+ */
57
+ export declare class OttoChainError extends Error {
58
+ /** Error code for programmatic handling */
59
+ readonly code: ErrorCode;
60
+ /** Original error that caused this error */
61
+ readonly cause?: Error;
62
+ constructor(code: ErrorCode, message: string, cause?: Error);
63
+ /**
64
+ * Create a string representation of the error
65
+ */
66
+ toString(): string;
67
+ /**
68
+ * Convert error to a plain object for logging/serialization
69
+ */
70
+ toJSON(): Record<string, unknown>;
71
+ }
72
+ /**
73
+ * Error thrown when network operations fail
74
+ *
75
+ * Covers HTTP failures, connection errors, and timeouts.
76
+ *
77
+ * @example
78
+ * ```typescript
79
+ * try {
80
+ * await client.postTransaction(signed);
81
+ * } catch (error) {
82
+ * if (error instanceof NetworkError) {
83
+ * console.log(error.statusCode); // 503
84
+ * console.log(error.responseBody); // '{"error": "Service unavailable"}'
85
+ * }
86
+ * }
87
+ * ```
88
+ */
89
+ export declare class NetworkError extends OttoChainError {
90
+ /** HTTP status code if applicable */
91
+ readonly statusCode?: number;
92
+ /** Response body if available */
93
+ readonly responseBody?: string;
94
+ constructor(message: string, statusCode?: number, responseBody?: string, cause?: Error);
95
+ /**
96
+ * Create a timeout error
97
+ */
98
+ static timeout(timeoutMs: number): NetworkError;
99
+ toJSON(): Record<string, unknown>;
100
+ }
101
+ /**
102
+ * Error thrown when input validation fails
103
+ *
104
+ * Used when function parameters don't meet expected format or constraints.
105
+ *
106
+ * @example
107
+ * ```typescript
108
+ * try {
109
+ * const keyPair = keyPairFromPrivateKey('invalid');
110
+ * } catch (error) {
111
+ * if (error instanceof ValidationError) {
112
+ * console.log(error.field); // 'privateKey'
113
+ * console.log(error.value); // 'invalid'
114
+ * }
115
+ * }
116
+ * ```
117
+ */
118
+ export declare class ValidationError extends OttoChainError {
119
+ /** Field that failed validation */
120
+ readonly field?: string;
121
+ /** Value that failed validation (sanitized) */
122
+ readonly value?: unknown;
123
+ /** Validation details/constraints */
124
+ readonly details?: Record<string, unknown>;
125
+ constructor(message: string, options?: {
126
+ field?: string;
127
+ value?: unknown;
128
+ details?: Record<string, unknown>;
129
+ cause?: Error;
130
+ });
131
+ toJSON(): Record<string, unknown>;
132
+ }
133
+ /**
134
+ * Error thrown when cryptographic signing operations fail
135
+ *
136
+ * Covers key derivation, signature creation, and related crypto operations.
137
+ *
138
+ * @example
139
+ * ```typescript
140
+ * try {
141
+ * const signature = await signHash(hash, privateKey);
142
+ * } catch (error) {
143
+ * if (error instanceof SigningError) {
144
+ * console.log(error.operation); // 'sign'
145
+ * }
146
+ * }
147
+ * ```
148
+ */
149
+ export declare class SigningError extends OttoChainError {
150
+ /** The operation that failed */
151
+ readonly operation?: string;
152
+ constructor(message: string, options?: {
153
+ operation?: string;
154
+ cause?: Error;
155
+ });
156
+ toJSON(): Record<string, unknown>;
157
+ }
158
+ /**
159
+ * Error thrown when transaction operations fail
160
+ *
161
+ * Used when transactions are rejected, not found, or invalid.
162
+ *
163
+ * @example
164
+ * ```typescript
165
+ * try {
166
+ * await client.postTransaction(signed);
167
+ * } catch (error) {
168
+ * if (error instanceof TransactionError) {
169
+ * console.log(error.transactionHash); // 'abc123...'
170
+ * console.log(error.rejectionReason); // 'Insufficient balance'
171
+ * }
172
+ * }
173
+ * ```
174
+ */
175
+ export declare class TransactionError extends OttoChainError {
176
+ /** Transaction hash if available */
177
+ readonly transactionHash?: string;
178
+ /** Reason for rejection if available */
179
+ readonly rejectionReason?: string;
180
+ constructor(code: ErrorCode, message: string, options?: {
181
+ transactionHash?: string;
182
+ rejectionReason?: string;
183
+ cause?: Error;
184
+ });
185
+ /**
186
+ * Create a transaction rejected error
187
+ */
188
+ static rejected(reason: string, transactionHash?: string): TransactionError;
189
+ /**
190
+ * Create a transaction not found error
191
+ */
192
+ static notFound(transactionHash: string): TransactionError;
193
+ /**
194
+ * Create an invalid transaction error
195
+ */
196
+ static invalid(message: string, cause?: Error): TransactionError;
197
+ toJSON(): Record<string, unknown>;
198
+ }
199
+ /**
200
+ * Check if an error is an OttoChain error with a specific code
201
+ *
202
+ * @param error - Error to check
203
+ * @param code - Error code to match
204
+ * @returns True if error matches the code
205
+ *
206
+ * @example
207
+ * ```typescript
208
+ * if (isErrorCode(error, ErrorCode.NETWORK_TIMEOUT)) {
209
+ * // Retry the request
210
+ * }
211
+ * ```
212
+ */
213
+ export declare function isErrorCode(error: unknown, code: ErrorCode): boolean;
214
+ /**
215
+ * Wrap an unknown error in an OttoChainError
216
+ *
217
+ * @param error - Error to wrap
218
+ * @param defaultMessage - Default message if error has no message
219
+ * @returns OttoChainError wrapping the original error
220
+ */
221
+ export declare function wrapError(error: unknown, defaultMessage?: string): OttoChainError;