@bayybays/stacksone-sdk 1.0.1

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 (435) hide show
  1. package/.github/workflows/clarinet.yaml +33 -0
  2. package/README.md +444 -0
  3. package/docs/ARCHITECTURE.md +69 -0
  4. package/docs/CONTRACT_REGISTRY.md +11 -0
  5. package/docs/MODULE_OVERVIEW.md +38 -0
  6. package/docs/ROADMAP_Q1_2026.md +21 -0
  7. package/docs/SECURITY.md +47 -0
  8. package/docs/devlog.md +925 -0
  9. package/docs/notes.md +5 -0
  10. package/eslint.config.js +29 -0
  11. package/index.html +24 -0
  12. package/nonce.txt +1 -0
  13. package/nonce_store/nonce_1.txt +1 -0
  14. package/nonce_store/nonce_10.txt +1 -0
  15. package/nonce_store/nonce_2.txt +1 -0
  16. package/nonce_store/nonce_3.txt +1 -0
  17. package/nonce_store/nonce_4.txt +1 -0
  18. package/nonce_store/nonce_5.txt +1 -0
  19. package/nonce_store/nonce_6.txt +1 -0
  20. package/nonce_store/nonce_7.txt +1 -0
  21. package/nonce_store/nonce_8.txt +1 -0
  22. package/nonce_store/nonce_9.txt +1 -0
  23. package/package.json +62 -0
  24. package/package.json.save +60 -0
  25. package/postcss.config.js +6 -0
  26. package/public/logo.png +0 -0
  27. package/public/vite.svg +1 -0
  28. package/smart-contracts/.gitattributes +3 -0
  29. package/smart-contracts/.vscode/settings.json +4 -0
  30. package/smart-contracts/.vscode/tasks.json +19 -0
  31. package/smart-contracts/Clarinet.toml +11 -0
  32. package/smart-contracts/Mainnet.toml +5 -0
  33. package/smart-contracts/contracts/chaintap.clar +200 -0
  34. package/smart-contracts/contracts/contract-0.clar +35 -0
  35. package/smart-contracts/contracts/contract-1.clar +26 -0
  36. package/smart-contracts/contracts/contract-10.clar +31 -0
  37. package/smart-contracts/contracts/contract-12.clar +50 -0
  38. package/smart-contracts/contracts/contract-13.clar +25 -0
  39. package/smart-contracts/contracts/contract-14.clar +14 -0
  40. package/smart-contracts/contracts/contract-15.clar +20 -0
  41. package/smart-contracts/contracts/contract-16.clar +22 -0
  42. package/smart-contracts/contracts/contract-17.clar +23 -0
  43. package/smart-contracts/contracts/contract-18.clar +30 -0
  44. package/smart-contracts/contracts/contract-19.clar +49 -0
  45. package/smart-contracts/contracts/contract-2.clar +34 -0
  46. package/smart-contracts/contracts/contract-20.clar +7 -0
  47. package/smart-contracts/contracts/contract-21.clar +17 -0
  48. package/smart-contracts/contracts/contract-22.clar +23 -0
  49. package/smart-contracts/contracts/contract-23.clar +41 -0
  50. package/smart-contracts/contracts/contract-24.clar +30 -0
  51. package/smart-contracts/contracts/contract-28.clar +34 -0
  52. package/smart-contracts/contracts/contract-3.clar +36 -0
  53. package/smart-contracts/contracts/contract-30.clar +21 -0
  54. package/smart-contracts/contracts/contract-32.clar +26 -0
  55. package/smart-contracts/contracts/contract-33.clar +43 -0
  56. package/smart-contracts/contracts/contract-34.clar +29 -0
  57. package/smart-contracts/contracts/contract-35.clar +17 -0
  58. package/smart-contracts/contracts/contract-36.clar +47 -0
  59. package/smart-contracts/contracts/contract-37.clar +33 -0
  60. package/smart-contracts/contracts/contract-38.clar +26 -0
  61. package/smart-contracts/contracts/contract-4.clar +16 -0
  62. package/smart-contracts/contracts/contract-40.clar +19 -0
  63. package/smart-contracts/contracts/contract-42.clar +26 -0
  64. package/smart-contracts/contracts/contract-43.clar +23 -0
  65. package/smart-contracts/contracts/contract-44.clar +47 -0
  66. package/smart-contracts/contracts/contract-45.clar +32 -0
  67. package/smart-contracts/contracts/contract-46.clar +31 -0
  68. package/smart-contracts/contracts/contract-47.clar +33 -0
  69. package/smart-contracts/contracts/contract-48.clar +16 -0
  70. package/smart-contracts/contracts/contract-49.clar +36 -0
  71. package/smart-contracts/contracts/contract-5.clar +17 -0
  72. package/smart-contracts/contracts/contract-6.clar +52 -0
  73. package/smart-contracts/contracts/contract-7.clar +6 -0
  74. package/smart-contracts/contracts/contract-8.clar +27 -0
  75. package/smart-contracts/contracts/faucet-distributor-v2.clar +133 -0
  76. package/smart-contracts/contracts/faucet-distributor-v3.clar +129 -0
  77. package/smart-contracts/contracts/faucet-distributor-v4.clar +86 -0
  78. package/smart-contracts/contracts/faucet-distributor-v5.clar +90 -0
  79. package/smart-contracts/contracts/faucet-distributor-v6.clar +123 -0
  80. package/smart-contracts/contracts/faucet-distributor-v7.clar +88 -0
  81. package/smart-contracts/contracts/faucet-distributor.clar +64 -0
  82. package/smart-contracts/contracts/genesis-0.clar +297 -0
  83. package/smart-contracts/contracts/genesis-1.clar +342 -0
  84. package/smart-contracts/contracts/genesis-2.clar +297 -0
  85. package/smart-contracts/contracts/genesis-3.clar +282 -0
  86. package/smart-contracts/contracts/genesis-4.clar +291 -0
  87. package/smart-contracts/contracts/genesis-5.clar +276 -0
  88. package/smart-contracts/contracts/genesis-6.clar +273 -0
  89. package/smart-contracts/contracts/genesis-7.clar +261 -0
  90. package/smart-contracts/contracts/genesis-8.clar +279 -0
  91. package/smart-contracts/contracts/genesis-9.clar +288 -0
  92. package/smart-contracts/contracts/genesis-ascension-v1.clar +54 -0
  93. package/smart-contracts/contracts/genesis-badges-v10.clar +72 -0
  94. package/smart-contracts/contracts/genesis-badges-v4.clar +66 -0
  95. package/smart-contracts/contracts/genesis-badges-v5.clar +66 -0
  96. package/smart-contracts/contracts/genesis-badges-v8.clar +88 -0
  97. package/smart-contracts/contracts/genesis-badges-v9.clar +66 -0
  98. package/smart-contracts/contracts/genesis-badges.clar +73 -0
  99. package/smart-contracts/contracts/genesis-boost-v1.clar +58 -0
  100. package/smart-contracts/contracts/genesis-core-v10.clar +87 -0
  101. package/smart-contracts/contracts/genesis-core-v2.clar +86 -0
  102. package/smart-contracts/contracts/genesis-core-v4.clar +80 -0
  103. package/smart-contracts/contracts/genesis-core-v5.clar +86 -0
  104. package/smart-contracts/contracts/genesis-core-v6.clar +98 -0
  105. package/smart-contracts/contracts/genesis-core-v8.clar +106 -0
  106. package/smart-contracts/contracts/genesis-core-v9.clar +80 -0
  107. package/smart-contracts/contracts/genesis-core.clar +93 -0
  108. package/smart-contracts/contracts/genesis-missions-v4.clar +104 -0
  109. package/smart-contracts/contracts/genesis-missions-v5.clar +86 -0
  110. package/smart-contracts/contracts/genesis-missions-v6.clar +80 -0
  111. package/smart-contracts/contracts/genesis-missions-v8.clar +81 -0
  112. package/smart-contracts/contracts/genesis-missions-v9.clar +73 -0
  113. package/smart-contracts/contracts/genesis-missions.clar +68 -0
  114. package/smart-contracts/contracts/mission-mini-001.clar +32 -0
  115. package/smart-contracts/contracts/mission-mini-002.clar +42 -0
  116. package/smart-contracts/contracts/mission-mini-003.clar +39 -0
  117. package/smart-contracts/contracts/mission-mini-004.clar +39 -0
  118. package/smart-contracts/contracts/mission-mini-005.clar +36 -0
  119. package/smart-contracts/contracts/modules/genesis-badge-lite-v1.clar +17 -0
  120. package/smart-contracts/contracts/modules/genesis-counter-v1.clar +21 -0
  121. package/smart-contracts/contracts/modules/genesis-duel-v1.clar +16 -0
  122. package/smart-contracts/contracts/modules/genesis-flag-v1.clar +21 -0
  123. package/smart-contracts/contracts/modules/genesis-leaderboard-v1.clar +88 -0
  124. package/smart-contracts/contracts/modules/genesis-lucky-v1.clar +16 -0
  125. package/smart-contracts/contracts/modules/genesis-points-v1.clar +21 -0
  126. package/smart-contracts/contracts/modules/genesis-predict-v1.clar +14 -0
  127. package/smart-contracts/contracts/modules/genesis-score-lite-v1.clar +21 -0
  128. package/smart-contracts/contracts/modules/module-1.clar +2 -0
  129. package/smart-contracts/contracts/modules/module-10.clar +2 -0
  130. package/smart-contracts/contracts/modules/module-100.clar +2 -0
  131. package/smart-contracts/contracts/modules/module-101.clar +2 -0
  132. package/smart-contracts/contracts/modules/module-102.clar +2 -0
  133. package/smart-contracts/contracts/modules/module-103.clar +2 -0
  134. package/smart-contracts/contracts/modules/module-104.clar +2 -0
  135. package/smart-contracts/contracts/modules/module-105.clar +2 -0
  136. package/smart-contracts/contracts/modules/module-106.clar +2 -0
  137. package/smart-contracts/contracts/modules/module-107.clar +2 -0
  138. package/smart-contracts/contracts/modules/module-108.clar +2 -0
  139. package/smart-contracts/contracts/modules/module-109.clar +2 -0
  140. package/smart-contracts/contracts/modules/module-11.clar +2 -0
  141. package/smart-contracts/contracts/modules/module-110.clar +2 -0
  142. package/smart-contracts/contracts/modules/module-111.clar +2 -0
  143. package/smart-contracts/contracts/modules/module-112.clar +2 -0
  144. package/smart-contracts/contracts/modules/module-113.clar +2 -0
  145. package/smart-contracts/contracts/modules/module-114.clar +2 -0
  146. package/smart-contracts/contracts/modules/module-115.clar +2 -0
  147. package/smart-contracts/contracts/modules/module-116.clar +2 -0
  148. package/smart-contracts/contracts/modules/module-117.clar +2 -0
  149. package/smart-contracts/contracts/modules/module-118.clar +2 -0
  150. package/smart-contracts/contracts/modules/module-119.clar +2 -0
  151. package/smart-contracts/contracts/modules/module-12.clar +2 -0
  152. package/smart-contracts/contracts/modules/module-120.clar +2 -0
  153. package/smart-contracts/contracts/modules/module-121.clar +2 -0
  154. package/smart-contracts/contracts/modules/module-122.clar +2 -0
  155. package/smart-contracts/contracts/modules/module-123.clar +2 -0
  156. package/smart-contracts/contracts/modules/module-124.clar +2 -0
  157. package/smart-contracts/contracts/modules/module-125.clar +2 -0
  158. package/smart-contracts/contracts/modules/module-126.clar +2 -0
  159. package/smart-contracts/contracts/modules/module-127.clar +2 -0
  160. package/smart-contracts/contracts/modules/module-128.clar +2 -0
  161. package/smart-contracts/contracts/modules/module-129.clar +2 -0
  162. package/smart-contracts/contracts/modules/module-13.clar +2 -0
  163. package/smart-contracts/contracts/modules/module-130.clar +2 -0
  164. package/smart-contracts/contracts/modules/module-131.clar +2 -0
  165. package/smart-contracts/contracts/modules/module-132.clar +2 -0
  166. package/smart-contracts/contracts/modules/module-133.clar +2 -0
  167. package/smart-contracts/contracts/modules/module-134.clar +2 -0
  168. package/smart-contracts/contracts/modules/module-135.clar +2 -0
  169. package/smart-contracts/contracts/modules/module-136.clar +2 -0
  170. package/smart-contracts/contracts/modules/module-137.clar +2 -0
  171. package/smart-contracts/contracts/modules/module-138.clar +2 -0
  172. package/smart-contracts/contracts/modules/module-14.clar +2 -0
  173. package/smart-contracts/contracts/modules/module-140.clar +2 -0
  174. package/smart-contracts/contracts/modules/module-141.clar +2 -0
  175. package/smart-contracts/contracts/modules/module-142.clar +2 -0
  176. package/smart-contracts/contracts/modules/module-143.clar +2 -0
  177. package/smart-contracts/contracts/modules/module-144.clar +2 -0
  178. package/smart-contracts/contracts/modules/module-145.clar +2 -0
  179. package/smart-contracts/contracts/modules/module-146.clar +2 -0
  180. package/smart-contracts/contracts/modules/module-147.clar +2 -0
  181. package/smart-contracts/contracts/modules/module-148.clar +2 -0
  182. package/smart-contracts/contracts/modules/module-149.clar +2 -0
  183. package/smart-contracts/contracts/modules/module-15.clar +2 -0
  184. package/smart-contracts/contracts/modules/module-150.clar +2 -0
  185. package/smart-contracts/contracts/modules/module-152.clar +2 -0
  186. package/smart-contracts/contracts/modules/module-153.clar +2 -0
  187. package/smart-contracts/contracts/modules/module-154.clar +2 -0
  188. package/smart-contracts/contracts/modules/module-156.clar +2 -0
  189. package/smart-contracts/contracts/modules/module-157.clar +2 -0
  190. package/smart-contracts/contracts/modules/module-158.clar +2 -0
  191. package/smart-contracts/contracts/modules/module-159.clar +2 -0
  192. package/smart-contracts/contracts/modules/module-16.clar +2 -0
  193. package/smart-contracts/contracts/modules/module-160.clar +2 -0
  194. package/smart-contracts/contracts/modules/module-161.clar +2 -0
  195. package/smart-contracts/contracts/modules/module-162.clar +2 -0
  196. package/smart-contracts/contracts/modules/module-163.clar +2 -0
  197. package/smart-contracts/contracts/modules/module-164.clar +2 -0
  198. package/smart-contracts/contracts/modules/module-165.clar +2 -0
  199. package/smart-contracts/contracts/modules/module-166.clar +2 -0
  200. package/smart-contracts/contracts/modules/module-167.clar +2 -0
  201. package/smart-contracts/contracts/modules/module-168.clar +2 -0
  202. package/smart-contracts/contracts/modules/module-169.clar +2 -0
  203. package/smart-contracts/contracts/modules/module-17.clar +2 -0
  204. package/smart-contracts/contracts/modules/module-171.clar +2 -0
  205. package/smart-contracts/contracts/modules/module-172.clar +2 -0
  206. package/smart-contracts/contracts/modules/module-173.clar +2 -0
  207. package/smart-contracts/contracts/modules/module-174.clar +2 -0
  208. package/smart-contracts/contracts/modules/module-175.clar +2 -0
  209. package/smart-contracts/contracts/modules/module-176.clar +2 -0
  210. package/smart-contracts/contracts/modules/module-178.clar +2 -0
  211. package/smart-contracts/contracts/modules/module-179.clar +2 -0
  212. package/smart-contracts/contracts/modules/module-18.clar +2 -0
  213. package/smart-contracts/contracts/modules/module-180.clar +2 -0
  214. package/smart-contracts/contracts/modules/module-181.clar +2 -0
  215. package/smart-contracts/contracts/modules/module-182.clar +2 -0
  216. package/smart-contracts/contracts/modules/module-183.clar +2 -0
  217. package/smart-contracts/contracts/modules/module-184.clar +2 -0
  218. package/smart-contracts/contracts/modules/module-186.clar +2 -0
  219. package/smart-contracts/contracts/modules/module-188.clar +2 -0
  220. package/smart-contracts/contracts/modules/module-189.clar +2 -0
  221. package/smart-contracts/contracts/modules/module-19.clar +2 -0
  222. package/smart-contracts/contracts/modules/module-190.clar +2 -0
  223. package/smart-contracts/contracts/modules/module-191.clar +2 -0
  224. package/smart-contracts/contracts/modules/module-192.clar +2 -0
  225. package/smart-contracts/contracts/modules/module-193.clar +2 -0
  226. package/smart-contracts/contracts/modules/module-195.clar +2 -0
  227. package/smart-contracts/contracts/modules/module-196.clar +2 -0
  228. package/smart-contracts/contracts/modules/module-197.clar +2 -0
  229. package/smart-contracts/contracts/modules/module-198.clar +2 -0
  230. package/smart-contracts/contracts/modules/module-199.clar +2 -0
  231. package/smart-contracts/contracts/modules/module-2.clar +2 -0
  232. package/smart-contracts/contracts/modules/module-20.clar +2 -0
  233. package/smart-contracts/contracts/modules/module-200.clar +2 -0
  234. package/smart-contracts/contracts/modules/module-201.clar +2 -0
  235. package/smart-contracts/contracts/modules/module-202.clar +2 -0
  236. package/smart-contracts/contracts/modules/module-203.clar +2 -0
  237. package/smart-contracts/contracts/modules/module-204.clar +2 -0
  238. package/smart-contracts/contracts/modules/module-205.clar +2 -0
  239. package/smart-contracts/contracts/modules/module-207.clar +2 -0
  240. package/smart-contracts/contracts/modules/module-209.clar +2 -0
  241. package/smart-contracts/contracts/modules/module-21.clar +2 -0
  242. package/smart-contracts/contracts/modules/module-210.clar +2 -0
  243. package/smart-contracts/contracts/modules/module-212.clar +2 -0
  244. package/smart-contracts/contracts/modules/module-213.clar +2 -0
  245. package/smart-contracts/contracts/modules/module-215.clar +2 -0
  246. package/smart-contracts/contracts/modules/module-216.clar +2 -0
  247. package/smart-contracts/contracts/modules/module-218.clar +2 -0
  248. package/smart-contracts/contracts/modules/module-219.clar +2 -0
  249. package/smart-contracts/contracts/modules/module-22.clar +2 -0
  250. package/smart-contracts/contracts/modules/module-222.clar +2 -0
  251. package/smart-contracts/contracts/modules/module-223.clar +2 -0
  252. package/smart-contracts/contracts/modules/module-224.clar +2 -0
  253. package/smart-contracts/contracts/modules/module-226.clar +2 -0
  254. package/smart-contracts/contracts/modules/module-227.clar +2 -0
  255. package/smart-contracts/contracts/modules/module-228.clar +2 -0
  256. package/smart-contracts/contracts/modules/module-23.clar +2 -0
  257. package/smart-contracts/contracts/modules/module-230.clar +2 -0
  258. package/smart-contracts/contracts/modules/module-231.clar +2 -0
  259. package/smart-contracts/contracts/modules/module-232.clar +2 -0
  260. package/smart-contracts/contracts/modules/module-234.clar +2 -0
  261. package/smart-contracts/contracts/modules/module-235.clar +2 -0
  262. package/smart-contracts/contracts/modules/module-24.clar +2 -0
  263. package/smart-contracts/contracts/modules/module-241.clar +2 -0
  264. package/smart-contracts/contracts/modules/module-243.clar +2 -0
  265. package/smart-contracts/contracts/modules/module-244.clar +2 -0
  266. package/smart-contracts/contracts/modules/module-245.clar +2 -0
  267. package/smart-contracts/contracts/modules/module-246.clar +2 -0
  268. package/smart-contracts/contracts/modules/module-247.clar +2 -0
  269. package/smart-contracts/contracts/modules/module-25.clar +2 -0
  270. package/smart-contracts/contracts/modules/module-251.clar +2 -0
  271. package/smart-contracts/contracts/modules/module-252.clar +2 -0
  272. package/smart-contracts/contracts/modules/module-253.clar +2 -0
  273. package/smart-contracts/contracts/modules/module-254.clar +2 -0
  274. package/smart-contracts/contracts/modules/module-256.clar +2 -0
  275. package/smart-contracts/contracts/modules/module-257.clar +2 -0
  276. package/smart-contracts/contracts/modules/module-258.clar +2 -0
  277. package/smart-contracts/contracts/modules/module-26.clar +2 -0
  278. package/smart-contracts/contracts/modules/module-260.clar +2 -0
  279. package/smart-contracts/contracts/modules/module-262.clar +2 -0
  280. package/smart-contracts/contracts/modules/module-266.clar +2 -0
  281. package/smart-contracts/contracts/modules/module-267.clar +2 -0
  282. package/smart-contracts/contracts/modules/module-269.clar +2 -0
  283. package/smart-contracts/contracts/modules/module-27.clar +2 -0
  284. package/smart-contracts/contracts/modules/module-272.clar +2 -0
  285. package/smart-contracts/contracts/modules/module-275.clar +2 -0
  286. package/smart-contracts/contracts/modules/module-276.clar +2 -0
  287. package/smart-contracts/contracts/modules/module-277.clar +2 -0
  288. package/smart-contracts/contracts/modules/module-279.clar +2 -0
  289. package/smart-contracts/contracts/modules/module-28.clar +2 -0
  290. package/smart-contracts/contracts/modules/module-280.clar +2 -0
  291. package/smart-contracts/contracts/modules/module-282.clar +2 -0
  292. package/smart-contracts/contracts/modules/module-283.clar +2 -0
  293. package/smart-contracts/contracts/modules/module-286.clar +2 -0
  294. package/smart-contracts/contracts/modules/module-29.clar +2 -0
  295. package/smart-contracts/contracts/modules/module-291.clar +2 -0
  296. package/smart-contracts/contracts/modules/module-295.clar +2 -0
  297. package/smart-contracts/contracts/modules/module-296.clar +2 -0
  298. package/smart-contracts/contracts/modules/module-3.clar +2 -0
  299. package/smart-contracts/contracts/modules/module-30.clar +2 -0
  300. package/smart-contracts/contracts/modules/module-31.clar +2 -0
  301. package/smart-contracts/contracts/modules/module-32.clar +2 -0
  302. package/smart-contracts/contracts/modules/module-33.clar +2 -0
  303. package/smart-contracts/contracts/modules/module-34.clar +2 -0
  304. package/smart-contracts/contracts/modules/module-35.clar +2 -0
  305. package/smart-contracts/contracts/modules/module-36.clar +2 -0
  306. package/smart-contracts/contracts/modules/module-37.clar +2 -0
  307. package/smart-contracts/contracts/modules/module-38.clar +2 -0
  308. package/smart-contracts/contracts/modules/module-39.clar +2 -0
  309. package/smart-contracts/contracts/modules/module-4.clar +2 -0
  310. package/smart-contracts/contracts/modules/module-40.clar +2 -0
  311. package/smart-contracts/contracts/modules/module-41.clar +2 -0
  312. package/smart-contracts/contracts/modules/module-42.clar +2 -0
  313. package/smart-contracts/contracts/modules/module-43.clar +2 -0
  314. package/smart-contracts/contracts/modules/module-44.clar +2 -0
  315. package/smart-contracts/contracts/modules/module-45.clar +2 -0
  316. package/smart-contracts/contracts/modules/module-46.clar +2 -0
  317. package/smart-contracts/contracts/modules/module-47.clar +2 -0
  318. package/smart-contracts/contracts/modules/module-48.clar +2 -0
  319. package/smart-contracts/contracts/modules/module-49.clar +2 -0
  320. package/smart-contracts/contracts/modules/module-5.clar +2 -0
  321. package/smart-contracts/contracts/modules/module-50.clar +2 -0
  322. package/smart-contracts/contracts/modules/module-51.clar +2 -0
  323. package/smart-contracts/contracts/modules/module-52.clar +2 -0
  324. package/smart-contracts/contracts/modules/module-53.clar +2 -0
  325. package/smart-contracts/contracts/modules/module-54.clar +2 -0
  326. package/smart-contracts/contracts/modules/module-55.clar +2 -0
  327. package/smart-contracts/contracts/modules/module-56.clar +2 -0
  328. package/smart-contracts/contracts/modules/module-57.clar +2 -0
  329. package/smart-contracts/contracts/modules/module-58.clar +2 -0
  330. package/smart-contracts/contracts/modules/module-59.clar +2 -0
  331. package/smart-contracts/contracts/modules/module-6.clar +2 -0
  332. package/smart-contracts/contracts/modules/module-60.clar +2 -0
  333. package/smart-contracts/contracts/modules/module-61.clar +2 -0
  334. package/smart-contracts/contracts/modules/module-62.clar +2 -0
  335. package/smart-contracts/contracts/modules/module-63.clar +2 -0
  336. package/smart-contracts/contracts/modules/module-64.clar +2 -0
  337. package/smart-contracts/contracts/modules/module-65.clar +2 -0
  338. package/smart-contracts/contracts/modules/module-66.clar +2 -0
  339. package/smart-contracts/contracts/modules/module-67.clar +2 -0
  340. package/smart-contracts/contracts/modules/module-68.clar +2 -0
  341. package/smart-contracts/contracts/modules/module-69.clar +2 -0
  342. package/smart-contracts/contracts/modules/module-7.clar +2 -0
  343. package/smart-contracts/contracts/modules/module-70.clar +2 -0
  344. package/smart-contracts/contracts/modules/module-71.clar +2 -0
  345. package/smart-contracts/contracts/modules/module-72.clar +2 -0
  346. package/smart-contracts/contracts/modules/module-73.clar +2 -0
  347. package/smart-contracts/contracts/modules/module-74.clar +2 -0
  348. package/smart-contracts/contracts/modules/module-75.clar +2 -0
  349. package/smart-contracts/contracts/modules/module-76.clar +2 -0
  350. package/smart-contracts/contracts/modules/module-77.clar +2 -0
  351. package/smart-contracts/contracts/modules/module-78.clar +2 -0
  352. package/smart-contracts/contracts/modules/module-79.clar +2 -0
  353. package/smart-contracts/contracts/modules/module-8.clar +2 -0
  354. package/smart-contracts/contracts/modules/module-80.clar +2 -0
  355. package/smart-contracts/contracts/modules/module-81.clar +2 -0
  356. package/smart-contracts/contracts/modules/module-82.clar +2 -0
  357. package/smart-contracts/contracts/modules/module-83.clar +2 -0
  358. package/smart-contracts/contracts/modules/module-84.clar +2 -0
  359. package/smart-contracts/contracts/modules/module-85.clar +2 -0
  360. package/smart-contracts/contracts/modules/module-86.clar +2 -0
  361. package/smart-contracts/contracts/modules/module-87.clar +2 -0
  362. package/smart-contracts/contracts/modules/module-88.clar +2 -0
  363. package/smart-contracts/contracts/modules/module-89.clar +2 -0
  364. package/smart-contracts/contracts/modules/module-9.clar +2 -0
  365. package/smart-contracts/contracts/modules/module-90.clar +2 -0
  366. package/smart-contracts/contracts/modules/module-91.clar +2 -0
  367. package/smart-contracts/contracts/modules/module-92.clar +2 -0
  368. package/smart-contracts/contracts/modules/module-93.clar +2 -0
  369. package/smart-contracts/contracts/modules/module-94.clar +2 -0
  370. package/smart-contracts/contracts/modules/module-95.clar +2 -0
  371. package/smart-contracts/contracts/modules/module-96.clar +2 -0
  372. package/smart-contracts/contracts/modules/module-97.clar +2 -0
  373. package/smart-contracts/contracts/modules/module-98.clar +2 -0
  374. package/smart-contracts/contracts/modules/module-99.clar +2 -0
  375. package/smart-contracts/contracts/reputation-engine.clar +131 -0
  376. package/smart-contracts/contracts/sip-010-trait.clar +38 -0
  377. package/smart-contracts/contracts/staking-refinery-v3.clar +138 -0
  378. package/smart-contracts/contracts/staking-refinery-v4.clar +125 -0
  379. package/smart-contracts/contracts/staking-refinery-v5.clar +153 -0
  380. package/smart-contracts/contracts/staking-refinery-v6.clar +122 -0
  381. package/smart-contracts/contracts/staking-refinery-v7.clar +144 -0
  382. package/smart-contracts/contracts/staking-refinery.clar +80 -0
  383. package/smart-contracts/contracts/token-one-v3.clar +74 -0
  384. package/smart-contracts/contracts/token-one-v4.clar +51 -0
  385. package/smart-contracts/contracts/token-one-v5.clar +78 -0
  386. package/smart-contracts/contracts/token-one-v6.clar +91 -0
  387. package/smart-contracts/contracts/token-one-v7.clar +79 -0
  388. package/smart-contracts/contracts/token-one.clar +86 -0
  389. package/smart-contracts/contracts/token-poin-trait.clar +35 -0
  390. package/smart-contracts/contracts/token-poin-v3.clar +87 -0
  391. package/smart-contracts/contracts/token-poin-v4.clar +72 -0
  392. package/smart-contracts/contracts/token-poin-v5.clar +68 -0
  393. package/smart-contracts/contracts/token-poin-v6.clar +61 -0
  394. package/smart-contracts/contracts/token-poin-v7.clar +55 -0
  395. package/smart-contracts/contracts/token-poin.clar +85 -0
  396. package/smart-contracts/contracts/utility-gacha.clar +69 -0
  397. package/smart-contracts/deployments/default.mainnet-plan.yaml +18 -0
  398. package/smart-contracts/mission-mini-001.clar +0 -0
  399. package/smart-contracts/mission-mini-002.clar +0 -0
  400. package/smart-contracts/mission-mini-003.clar +0 -0
  401. package/smart-contracts/mission-mini-004.clar +0 -0
  402. package/smart-contracts/mission-mini-005.clar +0 -0
  403. package/smart-contracts/package-lock.json +2990 -0
  404. package/smart-contracts/package.json +24 -0
  405. package/smart-contracts/scripts/interact-modules.ts +1 -0
  406. package/smart-contracts/settings/Devnet.toml +155 -0
  407. package/smart-contracts/tests/genesis-badges.test.ts +21 -0
  408. package/smart-contracts/tests/genesis-core.test.ts +21 -0
  409. package/smart-contracts/tests/genesis-missions.test.ts +21 -0
  410. package/smart-contracts/tests/interact-reputation.ts +8 -0
  411. package/smart-contracts/tests/reputation-engine.test.ts +41 -0
  412. package/smart-contracts/tests/reputation.test.ts +15 -0
  413. package/smart-contracts/tests/token-one.test.ts +102 -0
  414. package/smart-contracts/tsconfig.json +26 -0
  415. package/smart-contracts/vitest.config.js +42 -0
  416. package/src/App.css +42 -0
  417. package/src/App.jsx +357 -0
  418. package/src/assets/react.svg +1 -0
  419. package/src/components/Layout.jsx +114 -0
  420. package/src/helper.js +153 -0
  421. package/src/index.css +21 -0
  422. package/src/main.jsx +160 -0
  423. package/src/pages/Gaming.jsx +177 -0
  424. package/src/pages/Home.jsx +153 -0
  425. package/src/pages/LeaderboardCard.tsx +93 -0
  426. package/src/pages/Profile.jsx +299 -0
  427. package/src/pages/Tasks.jsx +128 -0
  428. package/src/pages/Vault.jsx +524 -0
  429. package/src/polyfills.js +126 -0
  430. package/src/supabaseClient.js +141 -0
  431. package/src/utils.js +166 -0
  432. package/tailwind.config.js +42 -0
  433. package/temp-log.txt +4 -0
  434. package/vercel.json +8 -0
  435. package/vite.config.js +34 -0
@@ -0,0 +1,524 @@
1
+ import React, { useState, useEffect, useCallback, useMemo } from 'react';
2
+ import { openContractCall } from '@stacks/connect';
3
+ import { StacksMainnet } from '@stacks/network';
4
+ import {
5
+ callReadOnlyFunction,
6
+ standardPrincipalCV,
7
+ uintCV,
8
+ cvToHex,
9
+ hexToCV,
10
+ tupleCV,
11
+ PostConditionMode
12
+ } from '@stacks/transactions';
13
+ import { userSession } from '../supabaseClient';
14
+ import { CheckCircle, Clock, Zap, Box, Lock, TrendingUp, RefreshCw, AlertCircle, Unlock } from 'lucide-react';
15
+
16
+ // --- CONFIGURATION V7 ---
17
+ const CONTRACT_ADDRESS = 'SP3GHKMV4GSYNA8WGBX83DACG80K1RRVQZAZMB9J3';
18
+ const BLOCKS_PER_DAY = 144;
19
+ const LOCK_PERIOD_BLOCKS = 1008;
20
+
21
+ const HIRO_API_URL = 'https://api.mainnet.hiro.so';
22
+
23
+ const Vault = () => {
24
+ const [balances, setBalances] = useState({ poin: 0, one: 0 });
25
+ const [currentBlockHeight, setCurrentBlockHeight] = useState(0);
26
+ const [faucetData, setFaucetData] = useState({ blocksLeft: 0, nextClaimBlock: 0, isPending: false });
27
+ const [activeStakes, setActiveStakes] = useState([]);
28
+ const [totalStaked, setTotalStaked] = useState(0);
29
+ const [stakeAmount, setStakeAmount] = useState('');
30
+ const [status, setStatus] = useState(null);
31
+ const [loading, setLoading] = useState(true);
32
+ const [actionLoading, setActionLoading] = useState(false);
33
+ const [now, setNow] = useState(Date.now());
34
+
35
+ const network = new StacksMainnet({ url: HIRO_API_URL });
36
+
37
+ useEffect(() => {
38
+ const interval = setInterval(() => setNow(Date.now()), 1000);
39
+ return () => clearInterval(interval);
40
+ }, []);
41
+
42
+ const elapsedSinceBlock = useMemo(() => {
43
+ return Math.floor((now - Date.now()) / 1000);
44
+ }, [now]);
45
+
46
+ const fetchNetworkStatus = async () => {
47
+ try {
48
+ const response = await fetch(`${HIRO_API_URL}/v2/info`);
49
+ const data = await response.json();
50
+ if (data.burn_block_height) {
51
+ setCurrentBlockHeight(data.burn_block_height);
52
+ }
53
+ } catch (e) {
54
+ console.error("Failed to load block height", e);
55
+ }
56
+ };
57
+
58
+ const fetchData = useCallback(async () => {
59
+ if (!userSession.isUserSignedIn()) {
60
+ setLoading(false);
61
+ return;
62
+ }
63
+ setLoading(true);
64
+ await fetchNetworkStatus();
65
+ await Promise.all([fetchBalances(), fetchFaucetData(), fetchStakingHistory()]);
66
+ setLoading(false);
67
+ }, [currentBlockHeight]);
68
+
69
+ useEffect(() => {
70
+ fetchNetworkStatus();
71
+ const interval = setInterval(fetchNetworkStatus, 10000);
72
+ return () => clearInterval(interval);
73
+ }, []);
74
+
75
+ useEffect(() => {
76
+ if (currentBlockHeight > 0) fetchData();
77
+ }, [currentBlockHeight, fetchData]);
78
+
79
+ // Ekstraksi CV Manual (Anti-NaN)
80
+ const extractUintCV = (cv) => {
81
+ if (!cv) return 0;
82
+ if (cv.type === 7) return Number(cv.value.value); // (ok uX)
83
+ if (cv.type === 1) return Number(cv.value); // uX
84
+ return 0;
85
+ };
86
+
87
+ const fetchBalances = async () => {
88
+ const userData = userSession.loadUserData();
89
+ if (!userData?.profile?.stxAddress) return;
90
+ const userAddress = userData.profile.stxAddress.mainnet;
91
+
92
+ try {
93
+ const [poinData, oneData] = await Promise.all([
94
+ callReadOnlyFunction({ contractAddress: CONTRACT_ADDRESS, contractName: 'token-poin-v7', functionName: 'get-balance', functionArgs: [standardPrincipalCV(userAddress)], network, senderAddress: userAddress }),
95
+ callReadOnlyFunction({ contractAddress: CONTRACT_ADDRESS, contractName: 'token-one-v7', functionName: 'get-balance', functionArgs: [standardPrincipalCV(userAddress)], network, senderAddress: userAddress })
96
+ ]);
97
+
98
+ setBalances({
99
+ poin: extractUintCV(poinData) / 1000000,
100
+ one: extractUintCV(oneData) / 1000000
101
+ });
102
+ } catch (e) { console.error("Failed to load balances", e); }
103
+ };
104
+
105
+ const fetchFaucetData = async () => {
106
+ const userData = userSession.loadUserData();
107
+ if (!userData?.profile?.stxAddress) return;
108
+ const userAddress = userData.profile.stxAddress.mainnet;
109
+
110
+ try {
111
+ const resultCV = await callReadOnlyFunction({
112
+ contractAddress: CONTRACT_ADDRESS,
113
+ contractName: 'faucet-distributor-v7',
114
+ functionName: 'get-user-status',
115
+ functionArgs: [standardPrincipalCV(userAddress)],
116
+ network,
117
+ senderAddress: userAddress
118
+ });
119
+
120
+ let blocksLeft = 0;
121
+ let nextClaimBlock = 0;
122
+ let isPending = false;
123
+
124
+ // PARSING TUPLE SANGAT AMAN
125
+ const tupleData = resultCV?.type === 7 ? resultCV.value.data : resultCV?.data;
126
+
127
+ if (tupleData) {
128
+ if (tupleData['blocks-left']) blocksLeft = Number(tupleData['blocks-left'].value);
129
+ if (tupleData['next-claim-block']) nextClaimBlock = Number(tupleData['next-claim-block'].value);
130
+ }
131
+
132
+ if (isNaN(blocksLeft)) blocksLeft = 0;
133
+ if (isNaN(nextClaimBlock)) nextClaimBlock = 0;
134
+
135
+ // CEK MEMPOOL
136
+ if (blocksLeft === 0) {
137
+ try {
138
+ const mempoolRes = await fetch(`${HIRO_API_URL}/extended/v1/tx/mempool?sender_address=${userAddress}`);
139
+ if (mempoolRes.ok) {
140
+ const mempoolData = await mempoolRes.json();
141
+ const isClaimPending = mempoolData.results?.some(tx =>
142
+ tx.tx_status === "pending" &&
143
+ tx.tx_type === "contract_call" &&
144
+ tx.contract_call.contract_id === `${CONTRACT_ADDRESS}.faucet-distributor-v7` &&
145
+ tx.contract_call.function_name === "claim"
146
+ );
147
+ if (isClaimPending) isPending = true;
148
+ }
149
+ } catch (mempoolErr) { console.warn("Mempool check failed", mempoolErr); }
150
+ }
151
+
152
+ setFaucetData({ blocksLeft, nextClaimBlock, isPending });
153
+ } catch (e) { console.error("Failed to fetch faucet data", e); }
154
+ };
155
+
156
+ const fetchStakingHistory = async () => {
157
+ const userData = userSession.loadUserData();
158
+ if (!userData?.profile?.stxAddress) return;
159
+ const userAddress = userData.profile.stxAddress.mainnet;
160
+
161
+ let fetchedStakes = [];
162
+ let accumulatedTotal = 0;
163
+ let maxId = 0;
164
+
165
+ try {
166
+ const nonceRes = await fetch(`${HIRO_API_URL}/v2/data_var/${CONTRACT_ADDRESS}/staking-refinery-v7/nonce`);
167
+ if (nonceRes.ok) {
168
+ const nonceData = await nonceRes.json();
169
+ const nonceCV = hexToCV(nonceData.data);
170
+ maxId = Number(nonceCV.value);
171
+ if (isNaN(maxId)) maxId = 0;
172
+ }
173
+ } catch (e) { console.warn("Failed to fetch nonce", e); }
174
+
175
+ for (let i = 0; i < maxId; i++) {
176
+ try {
177
+ const keyCV = tupleCV({ user: standardPrincipalCV(userAddress), id: uintCV(i) });
178
+ const res = await fetch(`${HIRO_API_URL}/v2/map_entry/${CONTRACT_ADDRESS}/staking-refinery-v7/stakes`, {
179
+ method: 'POST',
180
+ body: JSON.stringify(cvToHex(keyCV)),
181
+ headers: { 'Content-Type': 'application/json' }
182
+ });
183
+
184
+ if (res.ok) {
185
+ const data = await res.json();
186
+ if (data.data && data.data !== "0x09") { // 0x09 = OptionalNone
187
+ const valCV = hexToCV(data.data);
188
+
189
+ if (valCV.type === 9) { // 9 = OptionalSome
190
+ const tupleData = valCV.value.data;
191
+ const claimed = tupleData.claimed.type === 3; // 3 = True
192
+
193
+ if (!claimed) {
194
+ const amountVal = Number(tupleData.amount.value);
195
+ const startBlock = Number(tupleData.start.value);
196
+ const endBlock = Number(tupleData.end.value);
197
+
198
+ fetchedStakes.push({
199
+ id: i,
200
+ amount: amountVal / 1000000,
201
+ startBlock: startBlock,
202
+ endBlock: endBlock,
203
+ claimed: false
204
+ });
205
+ accumulatedTotal += (amountVal / 1000000);
206
+ }
207
+ }
208
+ }
209
+ }
210
+ } catch (error) { console.error(`Error stake ${i}`, error); }
211
+ }
212
+ setActiveStakes(fetchedStakes);
213
+ setTotalStaked(accumulatedTotal);
214
+ };
215
+
216
+ const handleAction = async (actionType, payload = null) => {
217
+ if (!userSession.isUserSignedIn()) {
218
+ setStatus({ type: 'error', msg: 'Please connect your wallet first.' });
219
+ return;
220
+ }
221
+ setStatus({ type: 'info', msg: 'Awaiting wallet confirmation...' });
222
+ setActionLoading(true);
223
+
224
+ const options = {
225
+ network,
226
+ anchorMode: 1,
227
+ contractAddress: CONTRACT_ADDRESS,
228
+ postConditionMode: PostConditionMode.Allow,
229
+ onFinish: (data) => {
230
+ setStatus({ type: 'success', msg: `Transaction Broadcasted! ID: ${data.txId.slice(0, 8)}...` });
231
+ setActionLoading(false);
232
+
233
+ if (actionType === 'claim') {
234
+ localStorage.setItem('faucet_pending_start', Date.now().toString());
235
+ setFaucetData(prev => ({ ...prev, isPending: true }));
236
+ }
237
+ else if (actionType === 'harvest' && payload) setActiveStakes(prev => prev.filter(s => s.id !== payload.id));
238
+ else if (actionType === 'stake') {
239
+ const amountStaked = parseFloat(stakeAmount);
240
+ if (!isNaN(amountStaked)) setBalances(prev => ({ ...prev, poin: prev.poin - amountStaked }));
241
+ setStakeAmount('');
242
+ }
243
+ },
244
+ onCancel: () => {
245
+ setStatus({ type: 'error', msg: 'Transaction cancelled by user.' });
246
+ setActionLoading(false);
247
+ },
248
+ };
249
+
250
+ try {
251
+ if (actionType === 'stake') await openContractCall({ ...options, contractName: 'staking-refinery-v7', functionName: 'stake', functionArgs: [uintCV(parseFloat(stakeAmount) * 1000000)] });
252
+ else if (actionType === 'harvest') await openContractCall({ ...options, contractName: 'staking-refinery-v7', functionName: 'harvest', functionArgs: [uintCV(payload.id)] });
253
+ else if (actionType === 'claim') await openContractCall({ ...options, contractName: 'faucet-distributor-v7', functionName: 'claim', functionArgs: [] });
254
+ else if (actionType === 'gacha') await openContractCall({ ...options, contractName: 'utility-gacha', functionName: 'spin-gacha', functionArgs: [] });
255
+ } catch (error) {
256
+ console.error("Contract call failed:", error);
257
+ setStatus({ type: 'error', msg: 'Failed to process transaction.' });
258
+ setActionLoading(false);
259
+ }
260
+ };
261
+
262
+ let faucetSecondsLeft = 0;
263
+
264
+ useEffect(() => {
265
+ if (faucetData.isPending) {
266
+ if (!localStorage.getItem('faucet_pending_start')) localStorage.setItem('faucet_pending_start', Date.now().toString());
267
+ } else if (faucetData.blocksLeft > 0) {
268
+ localStorage.removeItem('faucet_pending_start');
269
+ const savedTargetBlock = localStorage.getItem('faucet_target_block');
270
+ if (savedTargetBlock !== faucetData.nextClaimBlock.toString()) {
271
+ const targetDate = Date.now() + (faucetData.blocksLeft * 600 * 1000);
272
+ localStorage.setItem('faucet_target_block', faucetData.nextClaimBlock.toString());
273
+ localStorage.setItem('faucet_target_time', targetDate.toString());
274
+ }
275
+ } else {
276
+ localStorage.removeItem('faucet_target_block');
277
+ localStorage.removeItem('faucet_target_time');
278
+ localStorage.removeItem('faucet_pending_start');
279
+ }
280
+ }, [faucetData.isPending, faucetData.blocksLeft, faucetData.nextClaimBlock]);
281
+
282
+ if (faucetData.isPending) {
283
+ const start = Number(localStorage.getItem('faucet_pending_start')) || Date.now();
284
+ const elapsed = Math.floor((now - start) / 1000);
285
+ faucetSecondsLeft = Math.max(0, (BLOCKS_PER_DAY * 600) - elapsed);
286
+ } else if (faucetData.blocksLeft > 0) {
287
+ const targetTime = Number(localStorage.getItem('faucet_target_time'));
288
+ if (targetTime) {
289
+ faucetSecondsLeft = Math.max(0, Math.floor((targetTime - now) / 1000));
290
+ } else {
291
+ faucetSecondsLeft = faucetData.blocksLeft * 600;
292
+ }
293
+ }
294
+
295
+ const isClaimable = faucetData.blocksLeft === 0 && !faucetData.isPending;
296
+
297
+ const formatTime = (totalSeconds) => {
298
+ if (totalSeconds <= 0) return 'Ready';
299
+ const h = Math.floor(totalSeconds / 3600);
300
+ const m = Math.floor((totalSeconds % 3600) / 60);
301
+ const s = totalSeconds % 60;
302
+ return `${h}h ${m}m ${s}s`;
303
+ };
304
+
305
+ const StatCard = ({ title, value, unit, icon: Icon, color, isLoading }) => (
306
+ <div className="bg-[#1E293B]/50 backdrop-blur-sm border border-slate-700 p-5 rounded-2xl flex items-center justify-between hover:border-slate-500 transition-all">
307
+ <div>
308
+ <p className="text-slate-400 text-xs font-semibold uppercase tracking-wider mb-1">{title}</p>
309
+ <div className="flex items-baseline gap-1">
310
+ {isLoading ? (
311
+ <div className="h-8 w-24 bg-slate-700/50 rounded animate-pulse"></div>
312
+ ) : (
313
+ <>
314
+ <span className="text-2xl font-bold text-white">{isNaN(value) ? '0' : Number(value).toLocaleString()}</span>
315
+ <span className={`text-xs font-bold ${color}`}>{unit}</span>
316
+ </>
317
+ )}
318
+ </div>
319
+ </div>
320
+ <div className={`p-3 rounded-xl bg-slate-800/50 ${color.replace('text-', 'text-opacity-80 ')}`}>
321
+ <Icon size={24} className={color} />
322
+ </div>
323
+ </div>
324
+ );
325
+
326
+ return (
327
+ <div className="min-h-screen bg-[#0B1120] text-slate-200 pb-20 font-sans">
328
+ <div className="bg-gradient-to-r from-indigo-950 to-[#0B1120] border-b border-slate-800 p-6 md:p-10">
329
+ <div className="max-w-6xl mx-auto">
330
+ <div className="flex flex-col md:flex-row justify-between items-start md:items-center gap-4 mb-8">
331
+ <div>
332
+ <h1 className="text-3xl font-bold text-white tracking-tight flex items-center gap-2">
333
+ <Lock className="text-indigo-400" /> Genesis Vault V7
334
+ </h1>
335
+ <p className="text-slate-400 mt-2 flex items-center gap-2 text-sm">
336
+ <span className="w-2 h-2 rounded-full bg-emerald-500 shadow-[0_0_8px_rgba(16,185,129,0.8)] animate-pulse"></span>
337
+ Mainnet Live • Block #{currentBlockHeight || '...'}
338
+ </p>
339
+ </div>
340
+
341
+ {/* INI BAGIAN YANG DIUBAH: Pake window.location.reload() */}
342
+ <button
343
+ onClick={() => window.location.reload()}
344
+ disabled={actionLoading}
345
+ className="flex items-center gap-2 px-5 py-2.5 bg-slate-800/80 hover:bg-slate-700 rounded-xl border border-slate-700 text-sm font-medium transition-all disabled:opacity-50"
346
+ >
347
+ <RefreshCw size={16} />
348
+ Reload Page
349
+ </button>
350
+ </div>
351
+
352
+ <div className="grid grid-cols-1 md:grid-cols-4 gap-4">
353
+ <StatCard title="Total POIN" value={balances.poin} unit="POIN" icon={Zap} color="text-amber-400" isLoading={loading} />
354
+ <StatCard title="Treasury ONE" value={balances.one} unit="ONE" icon={Box} color="text-indigo-400" isLoading={loading} />
355
+ <StatCard title="Total Staked" value={totalStaked} unit="POIN" icon={Lock} color="text-purple-400" isLoading={loading} />
356
+ <StatCard title="Est. APY" value="125" unit="%" icon={TrendingUp} color="text-emerald-400" isLoading={loading} />
357
+ </div>
358
+ </div>
359
+ </div>
360
+
361
+ <div className="max-w-6xl mx-auto p-6 md:p-10">
362
+ {status && (
363
+ <div className={`mb-6 p-4 rounded-xl flex items-center gap-3 relative z-10 ${status.type === 'success' ? 'bg-emerald-500/10 border border-emerald-500/20 text-emerald-400' : status.type === 'error' ? 'bg-rose-500/10 border border-rose-500/20 text-rose-400' : 'bg-blue-500/10 border border-blue-500/20 text-blue-400'}`}>
364
+ {status.type === 'success' ? <CheckCircle size={20} /> : status.type === 'error' ? <AlertCircle size={20} /> : <RefreshCw size={20} className="animate-spin" />}
365
+ <p className="text-sm font-medium">{status.msg}</p>
366
+ <button onClick={() => setStatus(null)} className="ml-auto text-slate-500 hover:text-white">×</button>
367
+ </div>
368
+ )}
369
+
370
+ <div className="grid grid-cols-1 lg:grid-cols-12 gap-6 mb-6">
371
+ <div className="lg:col-span-5 bg-[#1E293B] border border-slate-700 rounded-3xl p-8 flex flex-col justify-between relative overflow-hidden">
372
+ <div className="absolute top-0 right-0 w-32 h-32 bg-indigo-500/10 rounded-full blur-3xl -mr-10 -mt-10 pointer-events-none"></div>
373
+ <div className="mb-8">
374
+ <div className="inline-flex p-3 bg-indigo-500/20 rounded-xl mb-4"><Clock size={28} className="text-indigo-400" /></div>
375
+ <h2 className="text-2xl font-bold text-white mb-2">Daily Faucet</h2>
376
+ <p className="text-slate-400 text-sm leading-relaxed">The protocol distributes free <span className="text-amber-400 font-bold">100 POIN</span> every 144 blocks (approx 24 hours). Claim daily to maintain your protocol streak!</p>
377
+ </div>
378
+
379
+ <div>
380
+ <div className="bg-[#0F172A] border border-slate-700 rounded-2xl p-5 mb-6">
381
+ <div className="flex justify-between items-center mb-3">
382
+ <span className="text-slate-400 text-sm">Status</span>
383
+ <span className={`text-sm font-bold px-2 py-1 rounded-md ${isClaimable ? 'bg-emerald-500/20 text-emerald-400' : faucetData.isPending ? 'bg-blue-500/20 text-blue-400' : 'bg-amber-500/20 text-amber-400'}`}>
384
+ {isClaimable ? 'Ready to Claim' : faucetData.isPending ? 'Pending in Mempool' : 'Cooling Down'}
385
+ </span>
386
+ </div>
387
+ {!isClaimable && (
388
+ <div className="w-full bg-slate-800 h-2 rounded-full mb-3 overflow-hidden">
389
+ <div className="bg-amber-400 h-full rounded-full transition-all duration-1000" style={{ width: `${Math.max(0, 100 - (faucetSecondsLeft / (BLOCKS_PER_DAY * 600) * 100))}%` }}></div>
390
+ </div>
391
+ )}
392
+ <div className="flex justify-between items-center text-xs font-mono text-slate-500">
393
+ <span>Wait: {isClaimable ? 'Now' : formatTime(faucetSecondsLeft)}</span>
394
+ <span>Target Burn Block #{faucetData.nextClaimBlock || '...'}</span>
395
+ </div>
396
+ </div>
397
+
398
+ <button
399
+ onClick={() => handleAction('claim')}
400
+ disabled={loading || actionLoading || !isClaimable}
401
+ className={`w-full py-4 font-bold rounded-xl shadow-lg transition-all flex justify-center items-center gap-2 ${
402
+ isClaimable ? 'bg-indigo-600 hover:bg-indigo-500 text-white cursor-pointer' : 'bg-slate-800 text-slate-500 border-2 border-slate-700 cursor-not-allowed opacity-50'
403
+ }`}
404
+ >
405
+ {actionLoading ? <RefreshCw className="animate-spin" size={18} /> : (isClaimable ? <Zap size={18} /> : <Clock size={18} />)}
406
+ {isClaimable ? 'Claim 100 POIN' : faucetData.isPending ? 'Awaiting Confirmation...' : `Cooldown (${formatTime(faucetSecondsLeft)})`}
407
+ </button>
408
+ </div>
409
+ </div>
410
+
411
+ <div className="lg:col-span-7 bg-[#1E293B] border border-slate-700 rounded-3xl p-8 relative overflow-hidden">
412
+ <div className="absolute bottom-0 right-0 w-40 h-40 bg-purple-500/10 rounded-full blur-3xl -mr-10 -mb-10 pointer-events-none"></div>
413
+ <div className="flex items-center gap-3 mb-6">
414
+ <div className="p-3 bg-purple-500/20 rounded-xl"><Lock size={24} className="text-purple-400" /></div>
415
+ <div><h2 className="text-xl font-bold text-white">Refinery Staking</h2><p className="text-slate-400 text-sm">Lock $POIN to mint $ONE tokens.</p></div>
416
+ </div>
417
+
418
+ <div className="bg-[#0F172A] rounded-2xl p-5 border border-slate-700 mb-6 focus-within:border-purple-500 transition-colors">
419
+ <div className="flex justify-between mb-3">
420
+ <label className="text-xs font-semibold text-slate-400 uppercase">Amount to Stake</label>
421
+ <span className="text-xs text-purple-400 cursor-pointer hover:text-purple-300 font-medium transition" onClick={() => setStakeAmount(balances.poin.toString())}>Max: {balances.poin.toLocaleString()}</span>
422
+ </div>
423
+ <div className="flex items-center gap-4">
424
+ <input type="number" value={stakeAmount} onChange={(e) => setStakeAmount(e.target.value)} placeholder="0.00" className="bg-transparent text-4xl font-bold text-white w-full focus:outline-none placeholder-slate-800" disabled={actionLoading} />
425
+ <div className="bg-slate-800 px-4 py-2 rounded-lg text-sm font-bold text-slate-300 border border-slate-700">POIN</div>
426
+ </div>
427
+ </div>
428
+
429
+ <div className="grid grid-cols-2 gap-4 mb-8">
430
+ <div className="bg-[#0F172A] p-4 rounded-xl border border-slate-700/50">
431
+ <span className="block text-slate-500 text-xs uppercase mb-1">Lock Duration</span>
432
+ <span className="text-slate-200 font-medium text-sm">{LOCK_PERIOD_BLOCKS} Blocks (~7 Days)</span>
433
+ </div>
434
+ <div className="bg-[#0F172A] p-4 rounded-xl border border-emerald-900/30">
435
+ <span className="block text-slate-500 text-xs uppercase mb-1">Yield Estimate</span>
436
+ <span className="text-emerald-400 font-bold text-sm">10% in ONE Token</span>
437
+ </div>
438
+ </div>
439
+
440
+ <button onClick={() => handleAction('stake')} disabled={loading || actionLoading || !stakeAmount || parseFloat(stakeAmount) <= 0 || parseFloat(stakeAmount) > balances.poin} className="w-full py-4 bg-purple-600 hover:bg-purple-500 disabled:bg-slate-800 disabled:text-slate-600 disabled:border-slate-700 text-white font-bold rounded-xl shadow-lg transition-all flex justify-center items-center gap-2">
441
+ {actionLoading ? <RefreshCw className="animate-spin" size={18} /> : <Lock size={18} />}
442
+ {parseFloat(stakeAmount) > balances.poin ? 'Insufficient POIN Balance' : 'Confirm Staking'}
443
+ </button>
444
+ </div>
445
+ </div>
446
+
447
+ <div className="grid grid-cols-1 lg:grid-cols-12 gap-6">
448
+ <div className="lg:col-span-7 bg-[#1E293B]/60 border border-slate-700 rounded-3xl p-6 flex flex-col h-[400px]">
449
+ <div className="flex justify-between items-center mb-6">
450
+ <h2 className="text-lg font-bold text-white flex items-center gap-2"><Clock size={18} className="text-slate-400" /> Active Positions</h2>
451
+ <span className="bg-slate-800 text-slate-300 text-xs px-3 py-1 rounded-full border border-slate-700 font-medium">{activeStakes.length} Positions</span>
452
+ </div>
453
+
454
+ <div className="flex-1 space-y-4 overflow-y-auto pr-2 custom-scrollbar">
455
+ {activeStakes.length === 0 ? (
456
+ <div className="h-full flex flex-col items-center justify-center border-2 border-dashed border-slate-700/50 rounded-2xl">
457
+ <Box size={40} className="text-slate-700 mb-3" />
458
+ <p className="text-slate-500 font-medium text-sm">No active staking positions.</p>
459
+ </div>
460
+ ) : (
461
+ activeStakes.map((stake, idx) => {
462
+ const blocksLeft = Math.max(0, stake.endBlock - currentBlockHeight);
463
+ let stakeSecondsLeft = (blocksLeft * 600) - elapsedSinceBlock;
464
+ if (stakeSecondsLeft < 0) stakeSecondsLeft = 0;
465
+
466
+ const isReady = stakeSecondsLeft <= 0;
467
+ const progress = Math.min(100, ((currentBlockHeight - stake.startBlock) / LOCK_PERIOD_BLOCKS) * 100);
468
+
469
+ return (
470
+ <div key={idx} className="bg-[#0F172A] border border-slate-700/80 p-5 rounded-2xl hover:border-purple-500/50 transition-colors">
471
+ <div className="flex justify-between items-center mb-4">
472
+ <div>
473
+ <p className="text-slate-500 text-[10px] font-bold tracking-widest uppercase mb-1">Receipt #{stake.id}</p>
474
+ <p className="text-xl font-bold text-white">{isNaN(stake.amount) ? '0' : stake.amount.toLocaleString()} <span className="text-sm text-amber-400 font-medium">POIN</span></p>
475
+ </div>
476
+
477
+ <button
478
+ onClick={() => handleAction('harvest', stake)}
479
+ disabled={loading || actionLoading || !isReady}
480
+ className={`px-5 py-2.5 text-sm font-bold rounded-xl transition-all flex items-center gap-2 ${
481
+ isReady ? 'bg-emerald-600 hover:bg-emerald-500 text-white shadow-lg shadow-emerald-900/20 active:scale-95 cursor-pointer' : 'bg-slate-800 text-slate-500 border-2 border-slate-700 cursor-not-allowed opacity-50'
482
+ }`}
483
+ >
484
+ {isReady ? <><Unlock size={16} /> Harvest</> : <><Lock size={14} /> Locked ({formatTime(stakeSecondsLeft)})</>}
485
+ </button>
486
+ </div>
487
+
488
+ <div className="w-full bg-slate-800 h-2 rounded-full overflow-hidden mb-2">
489
+ <div className={`h-full rounded-full transition-all duration-1000 ${isReady ? 'bg-emerald-500 shadow-[0_0_10px_rgba(16,185,129,0.5)]' : 'bg-purple-500 relative overflow-hidden'}`} style={{ width: `${progress}%` }}>
490
+ {!isReady && <div className="absolute top-0 left-0 right-0 bottom-0 bg-white/20 animate-pulse"></div>}
491
+ </div>
492
+ </div>
493
+ <div className="flex justify-between text-[11px] font-mono text-slate-500">
494
+ <span>Start: #{stake.startBlock}</span>
495
+ <span>Unlock: #{stake.endBlock}</span>
496
+ </div>
497
+ </div>
498
+ );
499
+ })
500
+ )}
501
+ </div>
502
+ </div>
503
+
504
+ <div className="lg:col-span-5 bg-gradient-to-br from-[#1E293B] to-[#0F172A] border border-slate-700 rounded-3xl p-6 flex flex-col justify-center text-center">
505
+ <div className="bg-purple-500/10 w-16 h-16 mx-auto rounded-2xl flex items-center justify-center mb-4 border border-purple-500/20"><Zap size={28} className="text-purple-400" /></div>
506
+ <h2 className="text-xl font-bold text-white mb-2">Lucky Burn Module</h2>
507
+ <p className="text-slate-400 text-sm mb-6 max-w-xs mx-auto">Burn your surplus POIN for a 33% random chance to mint valuable $ONE tokens.</p>
508
+ <div className="bg-[#0B1120] border border-slate-700 p-5 rounded-2xl mb-6">
509
+ <p className="text-slate-500 text-xs font-bold uppercase tracking-wider mb-1">Cost per Spin</p>
510
+ <p className="text-3xl font-bold text-white">50 <span className="text-sm text-amber-400">POIN</span></p>
511
+ </div>
512
+ <button onClick={() => handleAction('gacha')} disabled={loading || actionLoading || balances.poin < 50} className="w-full py-4 bg-[#0F172A] hover:bg-slate-800 border border-purple-500/50 disabled:border-slate-700 disabled:opacity-50 text-white font-bold rounded-xl transition-all flex justify-center items-center gap-2">
513
+ {actionLoading ? <RefreshCw className="animate-spin" size={18} /> : '🎲'}
514
+ {balances.poin < 50 ? 'Insufficient Balance' : 'SPIN GACHA'}
515
+ </button>
516
+ <p className="text-[10px] text-slate-500 mt-4 flex items-center justify-center gap-1 uppercase tracking-widest font-bold"><CheckCircle size={10} className="text-emerald-500" /> On-Chain RNG</p>
517
+ </div>
518
+ </div>
519
+ </div>
520
+ </div>
521
+ );
522
+ };
523
+
524
+ export default Vault;
@@ -0,0 +1,126 @@
1
+ import { Buffer } from 'buffer';
2
+
3
+ window.global = window;
4
+ window.Buffer = Buffer;
5
+ // update 88 at Sel 31 Mar 2026 15:03:04 WIB
6
+ // update 38 at Sel 31 Mar 2026 17:52:05 WIB
7
+ // update 73 at Sel 31 Mar 2026 20:11:00 WIB
8
+ // update 137 at Rab 01 Apr 2026 00:40:07 WIB
9
+ // update 3 at Sab 04 Apr 2026 08:54:13 WIB
10
+ // update 5 at Sab 04 Apr 2026 09:08:07 WIB
11
+ // update 41 at Sab 04 Apr 2026 13:51:48 WIB
12
+ // update 112 at Sab 04 Apr 2026 22:53:21 WIB
13
+ // update 137 at Min 05 Apr 2026 01:58:17 WIB
14
+ // update 2 at Min 05 Apr 2026 13:10:15 WIB
15
+ // update 37 at Min 05 Apr 2026 17:45:10 WIB
16
+ // update 42 at Min 05 Apr 2026 18:23:35 WIB
17
+ // update 71 at Min 05 Apr 2026 21:56:04 WIB
18
+ // update 76 at Min 05 Apr 2026 22:37:56 WIB
19
+ // update 78 at Min 05 Apr 2026 22:51:48 WIB
20
+ // update 90 at Sen 06 Apr 2026 00:10:18 WIB
21
+ // update 104 at Sen 06 Apr 2026 01:53:38 WIB
22
+ // update 105 at Sen 06 Apr 2026 02:02:14 WIB
23
+ // update 18 at Sen 06 Apr 2026 20:11:06 WIB
24
+ // update 30 at Sen 06 Apr 2026 21:43:20 WIB
25
+ // update 76 at Sel 07 Apr 2026 03:32:18 WIB
26
+ // update 87 at Sel 07 Apr 2026 04:57:26 WIB
27
+ // update 30 at Rab 08 Apr 2026 14:25:45 WIB
28
+ // update 20 at Kam 09 Apr 2026 11:12:06 WIB
29
+ // update 14 at Jum 10 Apr 2026 12:51:04 WIB
30
+ // update 17 at Jum 10 Apr 2026 13:15:39 WIB
31
+ // update 18 at Jum 10 Apr 2026 13:22:07 WIB
32
+ // update 29 at Jum 10 Apr 2026 14:46:47 WIB
33
+ // update 30 at Sab 11 Apr 2026 17:49:45 WIB
34
+ // update 82 at Min 12 Apr 2026 00:24:05 WIB
35
+ // update 108 at Min 12 Apr 2026 03:51:39 WIB
36
+ // update 113 at Min 12 Apr 2026 04:31:02 WIB
37
+ // update 115 at Min 12 Apr 2026 04:46:02 WIB
38
+ // update 130 at Min 12 Apr 2026 06:37:32 WIB
39
+ // update 5 at Min 12 Apr 2026 18:18:50 WIB
40
+ // update 14 at Min 12 Apr 2026 19:29:31 WIB
41
+ // update 86 at Sen 13 Apr 2026 17:33:49 WIB
42
+ // update 16 at Sel 14 Apr 2026 10:01:13 WIB
43
+ // update 18 at Rab 15 Apr 2026 10:33:52 WIB
44
+ // update 32 at Rab 15 Apr 2026 12:03:19 WIB
45
+ // update 37 at Rab 15 Apr 2026 12:36:40 WIB
46
+ // update 98 at Kam 16 Apr 2026 08:46:35 WIB
47
+ // update 105 at Kam 16 Apr 2026 09:26:50 WIB
48
+ // update 119 at Kam 16 Apr 2026 11:00:19 WIB
49
+ // update 27 at Kam 16 Apr 2026 21:02:56 WIB
50
+ // update 22 at Sab 18 Apr 2026 11:54:12 WIB
51
+ // update 23 at Sab 18 Apr 2026 11:59:50 WIB
52
+ // update 191 at Min 19 Apr 2026 06:12:36 WIB
53
+ // update 46 at Min 19 Apr 2026 21:24:39 WIB
54
+ // update 53 at Min 19 Apr 2026 22:17:03 WIB
55
+ // update 96 at Sen 20 Apr 2026 03:04:23 WIB
56
+ // update 100 at Sen 20 Apr 2026 03:26:57 WIB
57
+ // update 115 at Sen 20 Apr 2026 05:02:54 WIB
58
+ // update 126 at Sen 20 Apr 2026 06:06:49 WIB
59
+ // update 169 at Sen 20 Apr 2026 10:47:06 WIB
60
+ // update 174 at Sen 20 Apr 2026 11:18:26 WIB
61
+ // update 58 at Sen 20 Apr 2026 20:57:42 WIB
62
+ // update 127 at Sel 21 Apr 2026 04:14:41 WIB
63
+ // update 130 at Sel 21 Apr 2026 04:31:24 WIB
64
+ // update 155 at Sel 21 Apr 2026 07:15:28 WIB
65
+ // update 188 at Sel 21 Apr 2026 10:55:24 WIB
66
+ // update 138 at Rab 22 Apr 2026 04:28:21 WIB
67
+ // update 142 at Rab 22 Apr 2026 04:54:01 WIB
68
+ // update 26 at Rab 22 Apr 2026 17:30:02 WIB
69
+ // update 49 at Kam 23 Apr 2026 04:14:41 WIB
70
+ // update 72 at Kam 23 Apr 2026 06:49:50 WIB
71
+ // update 107 at Kam 23 Apr 2026 22:18:21 WIB
72
+ // update 115 at Kam 23 Apr 2026 22:53:35 WIB
73
+ // update 119 at Kam 23 Apr 2026 23:10:41 WIB
74
+ // update 161 at Jum 24 Apr 2026 02:35:05 WIB
75
+ // update 186 at Jum 24 Apr 2026 04:42:12 WIB
76
+ // update 22 at Jum 24 Apr 2026 10:05:08 WIB
77
+ // update 23 at Jum 24 Apr 2026 14:07:57 WIB
78
+ // update 2 at Jum 24 Apr 2026 15:43:14 WIB
79
+ // update 39 at Jum 24 Apr 2026 18:45:13 WIB
80
+ // update 65 at Jum 24 Apr 2026 21:11:19 WIB
81
+ // update 70 at Jum 24 Apr 2026 21:38:14 WIB
82
+ // update 101 at Sab 25 Apr 2026 00:11:09 WIB
83
+ // update 109 at Sab 25 Apr 2026 00:53:01 WIB
84
+ // update 140 at Sab 25 Apr 2026 03:21:43 WIB
85
+ // update 1 at Sab 25 Apr 2026 10:42:19 WIB
86
+ // update 70 at Sab 25 Apr 2026 16:32:55 WIB
87
+ // update 170 at Min 26 Apr 2026 00:59:38 WIB
88
+ // update 245 at Min 26 Apr 2026 07:10:54 WIB
89
+ // update 35 at Sel 28 Apr 2026 03:06:12 WIB
90
+ // update 54 at Sel 28 Apr 2026 04:44:46 WIB
91
+ // update 105 at Sel 28 Apr 2026 09:01:15 WIB
92
+ // update 206 at Sel 28 Apr 2026 17:39:43 WIB
93
+ // update 218 at Sel 28 Apr 2026 18:40:21 WIB
94
+ // update 258 at Sel 28 Apr 2026 22:08:18 WIB
95
+ // update 281 at Rab 29 Apr 2026 00:02:54 WIB
96
+ // update 297 at Rab 29 Apr 2026 01:24:17 WIB
97
+ // update 8 at Rab 29 Apr 2026 10:30:41 WIB
98
+ // update 26 at Rab 29 Apr 2026 12:02:02 WIB
99
+ // update 39 at Rab 29 Apr 2026 16:26:35 WIB
100
+ // update 54 at Rab 29 Apr 2026 17:46:56 WIB
101
+ // update 97 at Rab 29 Apr 2026 21:35:56 WIB
102
+ // update 7 at Kam 30 Apr 2026 00:00:42 WIB
103
+ // update 24 at Kam 30 Apr 2026 01:26:57 WIB
104
+ // update 23 at Kam 30 Apr 2026 03:40:49 WIB
105
+ // update 32 at Kam 30 Apr 2026 04:24:20 WIB
106
+ // update 55 at Kam 30 Apr 2026 06:16:33 WIB
107
+ // update 67 at Kam 30 Apr 2026 07:14:09 WIB
108
+ // update 84 at Kam 30 Apr 2026 08:32:29 WIB
109
+ // update 241 at Kam 30 Apr 2026 21:49:55 WIB
110
+ // update 88 at Jum 01 Mei 2026 09:52:59 WIB
111
+ // update 82 at Jum 01 Mei 2026 20:59:35 WIB
112
+ // update 138 at Sab 02 Mei 2026 01:37:07 WIB
113
+ // update 155 at Sab 02 Mei 2026 03:02:51 WIB
114
+ // update 162 at Sab 02 Mei 2026 03:38:04 WIB
115
+ // update 194 at Sab 02 Mei 2026 06:24:00 WIB
116
+ // update 239 at Sab 02 Mei 2026 10:21:33 WIB
117
+ // update 287 at Sab 02 Mei 2026 14:17:24 WIB
118
+ // update 293 at Sab 02 Mei 2026 14:45:20 WIB
119
+ // update 70 at Min 03 Mei 2026 23:12:39 WIB
120
+ // update 114 at Sen 04 Mei 2026 02:43:37 WIB
121
+ // update 120 at Sen 04 Mei 2026 03:12:52 WIB
122
+ // update 181 at Sen 04 Mei 2026 08:22:55 WIB
123
+ // update 185 at Sen 04 Mei 2026 08:42:22 WIB
124
+ // update 201 at Sen 04 Mei 2026 10:04:43 WIB
125
+ // update 4 at Sen 04 Mei 2026 10:52:18 WIB
126
+ // update 7 at Kam 21 Mei 2026 11:15:26 WIB