@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
package/src/main.jsx ADDED
@@ -0,0 +1,160 @@
1
+ import './polyfills'; // <--- WAJIB DI BARIS 1
2
+ import React from 'react'
3
+ import ReactDOM from 'react-dom/client'
4
+ import App from './App.jsx'
5
+ import './index.css'
6
+ import { BrowserRouter } from 'react-router-dom'; // Tambahkan ini
7
+
8
+ ReactDOM.createRoot(document.getElementById('root')).render(
9
+ <React.StrictMode>
10
+ <BrowserRouter>
11
+ <App />
12
+ </BrowserRouter>
13
+ </React.StrictMode>,
14
+ )
15
+ // update 2 at Sel 31 Mar 2026 09:22:34 WIB
16
+ // update 26 at Sel 31 Mar 2026 10:57:01 WIB
17
+ // update 66 at Sel 31 Mar 2026 13:34:10 WIB
18
+ // update 76 at Sel 31 Mar 2026 14:14:00 WIB
19
+ // update 55 at Sel 31 Mar 2026 18:59:49 WIB
20
+ // update 72 at Sel 31 Mar 2026 20:07:58 WIB
21
+ // update 105 at Sel 31 Mar 2026 22:22:35 WIB
22
+ // update 140 at Rab 01 Apr 2026 00:53:07 WIB
23
+ // update 12 at Sab 04 Apr 2026 10:06:46 WIB
24
+ // update 30 at Sab 04 Apr 2026 12:30:29 WIB
25
+ // update 34 at Sab 04 Apr 2026 12:55:48 WIB
26
+ // update 72 at Sab 04 Apr 2026 17:39:19 WIB
27
+ // update 101 at Sab 04 Apr 2026 21:34:38 WIB
28
+ // update 111 at Sab 04 Apr 2026 22:47:21 WIB
29
+ // update 113 at Sab 04 Apr 2026 23:00:45 WIB
30
+ // update 128 at Min 05 Apr 2026 00:56:00 WIB
31
+ // update 149 at Min 05 Apr 2026 03:34:52 WIB
32
+ // update 60 at Min 05 Apr 2026 20:34:01 WIB
33
+ // update 133 at Sen 06 Apr 2026 05:26:40 WIB
34
+ // update 150 at Sen 06 Apr 2026 07:47:23 WIB
35
+ // update 33 at Sen 06 Apr 2026 22:07:31 WIB
36
+ // update 45 at Sen 06 Apr 2026 23:47:12 WIB
37
+ // update 64 at Sel 07 Apr 2026 02:03:49 WIB
38
+ // update 89 at Sel 07 Apr 2026 05:11:38 WIB
39
+ // update 96 at Sel 07 Apr 2026 05:55:31 WIB
40
+ // update 14 at Rab 08 Apr 2026 12:28:13 WIB
41
+ // update 34 at Rab 08 Apr 2026 14:56:19 WIB
42
+ // update 70 at Rab 08 Apr 2026 19:21:57 WIB
43
+ // update 15 at Kam 09 Apr 2026 10:31:30 WIB
44
+ // update 26 at Jum 10 Apr 2026 14:28:55 WIB
45
+ // update 8 at Sab 11 Apr 2026 15:06:06 WIB
46
+ // update 60 at Sab 11 Apr 2026 21:35:27 WIB
47
+ // update 105 at Min 12 Apr 2026 03:27:33 WIB
48
+ // update 111 at Min 12 Apr 2026 04:12:44 WIB
49
+ // update 135 at Min 12 Apr 2026 07:15:48 WIB
50
+ // update 144 at Min 12 Apr 2026 08:24:09 WIB
51
+ // update 150 at Min 12 Apr 2026 09:16:37 WIB
52
+ // update 11 at Sen 13 Apr 2026 10:04:13 WIB
53
+ // update 12 at Sen 13 Apr 2026 10:11:39 WIB
54
+ // update 48 at Sen 13 Apr 2026 13:48:39 WIB
55
+ // update 88 at Sen 13 Apr 2026 17:44:27 WIB
56
+ // update 45 at Kam 16 Apr 2026 03:28:12 WIB
57
+ // update 70 at Kam 16 Apr 2026 06:01:44 WIB
58
+ // update 101 at Kam 16 Apr 2026 09:00:53 WIB
59
+ // update 13 at Kam 16 Apr 2026 19:34:03 WIB
60
+ // update 113 at Jum 17 Apr 2026 05:42:04 WIB
61
+ // update 124 at Jum 17 Apr 2026 06:50:39 WIB
62
+ // update 8 at Sab 18 Apr 2026 10:27:05 WIB
63
+ // update 32 at Sab 18 Apr 2026 13:03:10 WIB
64
+ // update 51 at Sab 18 Apr 2026 15:11:02 WIB
65
+ // update 59 at Sab 18 Apr 2026 16:04:34 WIB
66
+ // update 61 at Sab 18 Apr 2026 16:15:33 WIB
67
+ // update 88 at Sab 18 Apr 2026 19:09:08 WIB
68
+ // update 135 at Min 19 Apr 2026 00:16:20 WIB
69
+ // update 207 at Min 19 Apr 2026 07:54:20 WIB
70
+ // update 215 at Min 19 Apr 2026 08:46:20 WIB
71
+ // update 225 at Min 19 Apr 2026 09:46:25 WIB
72
+ // update 255 at Min 19 Apr 2026 12:51:41 WIB
73
+ // update 25 at Min 19 Apr 2026 19:08:20 WIB
74
+ // update 66 at Min 19 Apr 2026 23:48:15 WIB
75
+ // update 74 at Sen 20 Apr 2026 00:37:16 WIB
76
+ // update 121 at Sen 20 Apr 2026 05:38:54 WIB
77
+ // update 122 at Sen 20 Apr 2026 05:44:46 WIB
78
+ // update 153 at Sen 20 Apr 2026 09:00:38 WIB
79
+ // update 157 at Sen 20 Apr 2026 09:25:01 WIB
80
+ // update 192 at Sen 20 Apr 2026 13:02:08 WIB
81
+ // update 2 at Sen 20 Apr 2026 14:40:52 WIB
82
+ // update 8 at Sen 20 Apr 2026 15:22:54 WIB
83
+ // update 34 at Sen 20 Apr 2026 18:13:59 WIB
84
+ // update 46 at Sen 20 Apr 2026 19:39:16 WIB
85
+ // update 70 at Sen 20 Apr 2026 22:25:35 WIB
86
+ // update 170 at Sel 21 Apr 2026 08:49:28 WIB
87
+ // update 177 at Sel 21 Apr 2026 09:38:41 WIB
88
+ // update 12 at Sel 21 Apr 2026 14:48:38 WIB
89
+ // update 17 at Sel 21 Apr 2026 15:20:30 WIB
90
+ // update 32 at Sel 21 Apr 2026 16:55:32 WIB
91
+ // update 75 at Sel 21 Apr 2026 21:21:15 WIB
92
+ // update 107 at Rab 22 Apr 2026 00:56:49 WIB
93
+ // update 135 at Rab 22 Apr 2026 04:06:04 WIB
94
+ // update 140 at Rab 22 Apr 2026 04:42:56 WIB
95
+ // update 161 at Rab 22 Apr 2026 06:59:16 WIB
96
+ // update 173 at Rab 22 Apr 2026 08:14:10 WIB
97
+ // update 175 at Rab 22 Apr 2026 08:27:52 WIB
98
+ // update 63 at Rab 22 Apr 2026 21:26:27 WIB
99
+ // update 26 at Kam 23 Apr 2026 01:51:44 WIB
100
+ // update 35 at Kam 23 Apr 2026 02:46:39 WIB
101
+ // update 60 at Kam 23 Apr 2026 05:28:56 WIB
102
+ // update 24 at Kam 23 Apr 2026 10:33:34 WIB
103
+ // update 45 at Kam 23 Apr 2026 12:13:00 WIB
104
+ // update 2 at Kam 23 Apr 2026 13:11:10 WIB
105
+ // update 25 at Kam 23 Apr 2026 15:17:28 WIB
106
+ // update 32 at Kam 23 Apr 2026 15:52:33 WIB
107
+ // update 35 at Kam 23 Apr 2026 16:09:16 WIB
108
+ // update 66 at Kam 23 Apr 2026 18:47:24 WIB
109
+ // update 156 at Jum 24 Apr 2026 02:10:17 WIB
110
+ // update 206 at Jum 24 Apr 2026 06:29:41 WIB
111
+ // update 72 at Jum 24 Apr 2026 21:50:31 WIB
112
+ // update 76 at Jum 24 Apr 2026 22:07:03 WIB
113
+ // update 97 at Jum 24 Apr 2026 23:52:38 WIB
114
+ // update 143 at Sab 25 Apr 2026 03:40:53 WIB
115
+ // update 148 at Sab 25 Apr 2026 04:05:43 WIB
116
+ // update 155 at Sab 25 Apr 2026 04:46:46 WIB
117
+ // update 169 at Sab 25 Apr 2026 05:55:10 WIB
118
+ // update 193 at Sab 25 Apr 2026 08:00:30 WIB
119
+ // update 50 at Sab 25 Apr 2026 14:48:01 WIB
120
+ // update 182 at Min 26 Apr 2026 02:03:11 WIB
121
+ // update 184 at Min 26 Apr 2026 02:11:38 WIB
122
+ // update 12 at Sen 27 Apr 2026 13:32:12 WIB
123
+ // update 55 at Sen 27 Apr 2026 17:04:43 WIB
124
+ // update 70 at Sen 27 Apr 2026 18:21:18 WIB
125
+ // update 92 at Sen 27 Apr 2026 20:17:08 WIB
126
+ // update 137 at Sen 27 Apr 2026 23:58:17 WIB
127
+ // update 34 at Sel 28 Apr 2026 03:01:32 WIB
128
+ // update 60 at Sel 28 Apr 2026 05:13:27 WIB
129
+ // update 82 at Sel 28 Apr 2026 07:01:33 WIB
130
+ // update 144 at Sel 28 Apr 2026 12:19:11 WIB
131
+ // update 213 at Sel 28 Apr 2026 18:16:59 WIB
132
+ // update 278 at Sel 28 Apr 2026 23:45:05 WIB
133
+ // update 285 at Rab 29 Apr 2026 00:23:26 WIB
134
+ // update 291 at Rab 29 Apr 2026 00:51:38 WIB
135
+ // update 11 at Rab 29 Apr 2026 10:45:07 WIB
136
+ // update 8 at Rab 29 Apr 2026 13:47:45 WIB
137
+ // update 13 at Rab 29 Apr 2026 14:14:47 WIB
138
+ // update 27 at Rab 29 Apr 2026 15:27:35 WIB
139
+ // update 6 at Rab 29 Apr 2026 23:56:11 WIB
140
+ // update 91 at Kam 30 Apr 2026 09:10:31 WIB
141
+ // update 163 at Kam 30 Apr 2026 15:12:11 WIB
142
+ // update 193 at Kam 30 Apr 2026 17:39:05 WIB
143
+ // update 59 at Jum 01 Mei 2026 07:22:19 WIB
144
+ // update 83 at Jum 01 Mei 2026 09:27:47 WIB
145
+ // update 102 at Jum 01 Mei 2026 11:07:28 WIB
146
+ // update 13 at Jum 01 Mei 2026 15:02:04 WIB
147
+ // update 73 at Jum 01 Mei 2026 20:17:16 WIB
148
+ // update 182 at Sab 02 Mei 2026 05:21:30 WIB
149
+ // update 188 at Sab 02 Mei 2026 05:51:08 WIB
150
+ // update 227 at Sab 02 Mei 2026 09:20:34 WIB
151
+ // update 240 at Sab 02 Mei 2026 10:25:50 WIB
152
+ // update 286 at Sab 02 Mei 2026 14:11:38 WIB
153
+ // update 6 at Min 03 Mei 2026 17:45:08 WIB
154
+ // update 30 at Min 03 Mei 2026 19:44:08 WIB
155
+ // update 32 at Min 03 Mei 2026 19:53:33 WIB
156
+ // update 36 at Min 03 Mei 2026 20:15:11 WIB
157
+ // update 67 at Min 03 Mei 2026 22:56:47 WIB
158
+ // update 93 at Sen 04 Mei 2026 01:03:11 WIB
159
+ // update 118 at Sen 04 Mei 2026 03:02:36 WIB
160
+ // update 165 at Sen 04 Mei 2026 07:01:31 WIB
@@ -0,0 +1,177 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { openContractCall } from '@stacks/connect';
3
+ import { StacksMainnet } from '@stacks/network';
4
+ import {
5
+ callReadOnlyFunction,
6
+ standardPrincipalCV,
7
+ cvToValue
8
+ } from '@stacks/transactions';
9
+
10
+ // Ganti dengan alamat deployer dari kontrak chaintap kamu
11
+ const CONTRACT_ADDRESS = 'SP3GHKMV4GSYNA8WGBX83DACG80K1RRVQZAZMB9J3';
12
+ const CONTRACT_NAME = 'chaintap';
13
+
14
+ const network = new StacksMainnet();
15
+
16
+ const Gaming = ({ userData }) => {
17
+ const [userTaps, setUserTaps] = useState(0);
18
+ const [totalTaps, setTotalTaps] = useState(0);
19
+ const [leaderboard, setLeaderboard] = useState([]);
20
+ const [isTapping, setIsTapping] = useState(false);
21
+
22
+ const wallet = userData?.profile?.stxAddress?.mainnet;
23
+
24
+ useEffect(() => {
25
+ if (wallet) {
26
+ fetchGamingStats();
27
+ }
28
+ }, [wallet]);
29
+
30
+ const fetchGamingStats = async () => {
31
+ try {
32
+ // 1. Ambil poin/taps dari user saat ini
33
+ const userRes = await callReadOnlyFunction({
34
+ contractAddress: CONTRACT_ADDRESS,
35
+ contractName: CONTRACT_NAME,
36
+ functionName: 'get-user-taps',
37
+ functionArgs: [standardPrincipalCV(wallet)],
38
+ network,
39
+ senderAddress: wallet
40
+ });
41
+ setUserTaps(Number(cvToValue(userRes)));
42
+
43
+ // 2. Ambil total keseluruhan taps di chain
44
+ const totalRes = await callReadOnlyFunction({
45
+ contractAddress: CONTRACT_ADDRESS,
46
+ contractName: CONTRACT_NAME,
47
+ functionName: 'get-total-taps',
48
+ functionArgs: [],
49
+ network,
50
+ senderAddress: wallet
51
+ });
52
+ setTotalTaps(Number(cvToValue(totalRes)));
53
+
54
+ // 3. Ambil leaderboard top 10
55
+ const leadRes = await callReadOnlyFunction({
56
+ contractAddress: CONTRACT_ADDRESS,
57
+ contractName: CONTRACT_NAME,
58
+ functionName: 'get-leaderboard',
59
+ functionArgs: [],
60
+ network,
61
+ senderAddress: wallet
62
+ });
63
+
64
+ const rawLeaderboard = cvToValue(leadRes);
65
+ // Format array agar lebih mudah di-render (mengubah BigInt ke Number jika ada)
66
+ const formattedLeaderboard = rawLeaderboard.map((item) => ({
67
+ who: item.who.value || item.who,
68
+ taps: Number(item.taps.value !== undefined ? item.taps.value : item.taps)
69
+ }));
70
+
71
+ setLeaderboard(formattedLeaderboard);
72
+ } catch (error) {
73
+ console.error("Gagal mengambil data dari contract chaintap:", error);
74
+ }
75
+ };
76
+
77
+ const handleTap = async () => {
78
+ if (!userData) {
79
+ alert("Silakan hubungkan wallet (Connect) terlebih dahulu!");
80
+ return;
81
+ }
82
+
83
+ setIsTapping(true);
84
+
85
+ await openContractCall({
86
+ network,
87
+ contractAddress: CONTRACT_ADDRESS,
88
+ contractName: CONTRACT_NAME,
89
+ functionName: 'tap',
90
+ functionArgs: [],
91
+ onFinish: (data) => {
92
+ console.log("Tap berhasil dikirim! Tx ID:", data.txId);
93
+ setIsTapping(false);
94
+ // Bisa tambahkan toast/notifikasi di sini
95
+ },
96
+ onCancel: () => {
97
+ setIsTapping(false);
98
+ console.log("Tap dibatalkan oleh user");
99
+ }
100
+ });
101
+ };
102
+
103
+ return (
104
+ <div className="max-w-4xl mx-auto p-4 space-y-8 text-white">
105
+ {/* Header Info */}
106
+ <div className="bg-slate-800 p-6 rounded-xl text-center space-y-2 border border-slate-700 shadow-lg">
107
+ <h1 className="text-3xl font-bold text-indigo-400">ChainTap Gaming</h1>
108
+ <p className="text-slate-400">Unlimited on-chain tapping game!</p>
109
+ <div className="flex justify-center gap-8 pt-4">
110
+ <div className="bg-slate-900 px-6 py-3 rounded-lg">
111
+ <p className="text-sm text-slate-500 font-mono">Poin Kamu</p>
112
+ <p className="text-2xl font-bold text-green-400">{userTaps} Taps</p>
113
+ </div>
114
+ <div className="bg-slate-900 px-6 py-3 rounded-lg">
115
+ <p className="text-sm text-slate-500 font-mono">Total Global</p>
116
+ <p className="text-2xl font-bold text-blue-400">{totalTaps} Taps</p>
117
+ </div>
118
+ </div>
119
+ </div>
120
+
121
+ {/* Main Action - Tap Button */}
122
+ <div className="flex justify-center py-10">
123
+ <button
124
+ onClick={handleTap}
125
+ disabled={isTapping || !userData}
126
+ className={`
127
+ w-48 h-48 rounded-full shadow-[0_0_40px_rgba(99,102,241,0.4)]
128
+ flex flex-col items-center justify-center border-4 border-indigo-500
129
+ transition-transform duration-100 ease-in-out active:scale-95
130
+ ${!userData ? 'opacity-50 cursor-not-allowed border-slate-500 shadow-none bg-slate-800' : 'bg-indigo-600 hover:bg-indigo-500'}
131
+ `}
132
+ >
133
+ <span className="text-4xl font-bold">{isTapping ? "..." : "TAP!"}</span>
134
+ <span className="text-sm opacity-70 mt-2 font-mono">Tx Normal</span>
135
+ </button>
136
+ </div>
137
+
138
+ {/* Leaderboard Table */}
139
+ <div className="bg-slate-800 rounded-xl overflow-hidden border border-slate-700">
140
+ <div className="bg-slate-900 p-4 border-b border-slate-700">
141
+ <h2 className="text-xl font-bold text-center">🏆 Top 10 Leaderboard 🏆</h2>
142
+ </div>
143
+ <div className="p-4">
144
+ <table className="w-full text-left font-mono text-sm">
145
+ <thead>
146
+ <tr className="text-slate-400 border-b border-slate-700">
147
+ <th className="py-3 px-2">Rank</th>
148
+ <th className="py-3 px-2">Address</th>
149
+ <th className="py-3 px-2 text-right">Score/Taps</th>
150
+ </tr>
151
+ </thead>
152
+ <tbody>
153
+ {leaderboard.map((item, index) => {
154
+ // Hanya tampilkan jika poinnya > 0 agar bersih
155
+ if (item.taps === 0) return null;
156
+ return (
157
+ <tr key={index} className="border-b border-slate-700/50 hover:bg-slate-700/30">
158
+ <td className="py-3 px-2">#{index + 1}</td>
159
+ <td className="py-3 px-2">
160
+ {item.who === wallet ? <span className="text-green-400">{item.who} (Kamu)</span> : item.who}
161
+ </td>
162
+ <td className="py-3 px-2 text-right font-bold text-indigo-300">{item.taps}</td>
163
+ </tr>
164
+ );
165
+ })}
166
+ </tbody>
167
+ </table>
168
+ {leaderboard.every(item => item.taps === 0) && (
169
+ <p className="text-center py-6 text-slate-500">Belum ada pemain. Jadilah yang pertama!</p>
170
+ )}
171
+ </div>
172
+ </div>
173
+ </div>
174
+ );
175
+ };
176
+
177
+ export default Gaming;
@@ -0,0 +1,153 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { tupleCV, standardPrincipalCV, stringAsciiCV, cvToHex, hexToCV, cvToValue } from '@stacks/transactions';
3
+ import { StacksMainnet } from '@stacks/network';
4
+ import { userSession } from '../supabaseClient';
5
+
6
+ const CONTRACT_ADDRESS = 'SP3GHKMV4GSYNA8WGBX83DACG80K1RRVQZAZMB9J3';
7
+ const CONTRACT_NAME = 'genesis-core-v10';
8
+
9
+ const BadgeCard = ({ id, title, subtitle, reqText, isLocked, isMinted, onMint, icon, isLoading }) => {
10
+ return (
11
+ <div className={`relative group flex flex-col justify-between p-6 rounded-xl border bg-app-card transition-all duration-300 animate-slide-up hover:-translate-y-1 ${
12
+ isLocked ? "border-app-border opacity-60" : isMinted ? "border-green-500/30" : "border-app-border hover:border-app-accent hover:shadow-lg hover:shadow-app-accent/5"
13
+ }`}>
14
+
15
+ <div>
16
+ <div className="flex justify-between items-start mb-5">
17
+ <div className={`w-10 h-10 rounded-lg flex items-center justify-center text-lg border ${
18
+ isMinted ? "bg-green-500/10 border-green-500/20 text-green-400" : "bg-zinc-800 border-zinc-700 text-zinc-300"
19
+ }`}>
20
+ {isMinted ? "✓" : icon}
21
+ </div>
22
+ {isMinted && <span className="bg-green-500/10 text-green-400 border border-green-500/20 text-[10px] font-bold px-2 py-1 rounded uppercase tracking-wider">Owned</span>}
23
+ {isLocked && <span className="bg-zinc-800 text-zinc-500 border border-zinc-700 text-[10px] font-bold px-2 py-1 rounded uppercase tracking-wider">Locked</span>}
24
+ </div>
25
+
26
+ <h3 className="text-lg font-semibold text-white mb-1">{title}</h3>
27
+ <p className="text-[11px] font-medium tracking-widest uppercase mb-4 text-app-accent">{subtitle}</p>
28
+ <p className="text-zinc-400 text-sm leading-relaxed mb-6">{reqText}</p>
29
+ </div>
30
+
31
+ <button
32
+ onClick={() => onMint(id)}
33
+ disabled={isLocked || isMinted || isLoading}
34
+ className={`w-full py-2.5 rounded-md text-sm font-medium transition-all ${
35
+ isMinted
36
+ ? "bg-zinc-800/50 text-zinc-500 cursor-default"
37
+ : isLocked
38
+ ? "bg-zinc-800/50 text-zinc-600 cursor-not-allowed"
39
+ : "bg-white text-black hover:bg-zinc-200 active:scale-95"
40
+ } ${isLoading && !isMinted ? "opacity-50 cursor-wait" : ""}`}
41
+ >
42
+ {isMinted ? "Badge Secured" : isLoading ? "Syncing..." : isLocked ? "Requirements Not Met" : "Mint Badge"}
43
+ </button>
44
+ </div>
45
+ );
46
+ };
47
+
48
+ const Home = ({ userData, userXP, userLevel, handleMint }) => {
49
+ const [loadingBadges, setLoadingBadges] = useState(false);
50
+ const network = new StacksMainnet();
51
+
52
+ const [badges, setBadges] = useState([
53
+ { id: 'genesis', title: "Genesis Pioneer", subtitle: "Phase 1 Access", reqText: "Awarded to early protocol adopters. Requires Level 1.", icon: "✧", minLevel: 1, minXP: 0, isMinted: false },
54
+ { id: 'node', title: "Node Operator", subtitle: "Consistency Tier", reqText: "Requires Level 2 and 500 XP. Validate your commitment via protocol synchronization.", icon: "⎈", minLevel: 2, minXP: 500, isMinted: false },
55
+ { id: 'guardian', title: "Protocol Guardian", subtitle: "Elite Status", reqText: "Requires Level 5 and 2000 XP. The highest honor for users who have secured the genesis protocol.", icon: "⛨", minLevel: 5, minXP: 2000, isMinted: false }
56
+ ]);
57
+
58
+ useEffect(() => {
59
+ if (userSession.isUserSignedIn() && userData) {
60
+ syncBadgeStatusFromBlockchain();
61
+ }
62
+ }, [userData]);
63
+
64
+ const syncBadgeStatusFromBlockchain = async () => {
65
+ setLoadingBadges(true);
66
+ const userAddress = userData.profile.stxAddress.mainnet;
67
+
68
+ try {
69
+ const updatedBadges = await Promise.all(
70
+ badges.map(async (badge) => {
71
+ try {
72
+ const keyCV = tupleCV({
73
+ 'user': standardPrincipalCV(userAddress),
74
+ 'badge-name': stringAsciiCV(badge.id)
75
+ });
76
+
77
+ const url = `${network.coreApiUrl}/v2/map_entry/${CONTRACT_ADDRESS}/${CONTRACT_NAME}/wallet-has-badge`;
78
+ const response = await fetch(url, {
79
+ method: 'POST',
80
+ headers: { 'Content-Type': 'application/json' },
81
+ body: JSON.stringify(cvToHex(keyCV)),
82
+ });
83
+
84
+ if (!response.ok) return { ...badge, isMinted: false };
85
+
86
+ const data = await response.json();
87
+ const resultCV = hexToCV(data.data);
88
+ const val = cvToValue(resultCV);
89
+
90
+ const isCompleted = val !== null && (val === true || val.value === true);
91
+ return { ...badge, isMinted: isCompleted };
92
+ } catch (err) {
93
+ return badge;
94
+ }
95
+ })
96
+ );
97
+ setBadges(updatedBadges);
98
+ } catch (error) {
99
+ console.error("Error syncing badges:", error);
100
+ } finally {
101
+ setLoadingBadges(false);
102
+ }
103
+ };
104
+
105
+ const onMintClick = async (badgeId) => {
106
+ const txSucceeded = await handleMint(badgeId);
107
+ if (txSucceeded !== false) {
108
+ setBadges(prevBadges => prevBadges.map(b => b.id === badgeId ? { ...b, isMinted: true } : b));
109
+ setTimeout(() => syncBadgeStatusFromBlockchain(), 10000);
110
+ }
111
+ };
112
+
113
+ return (
114
+ <div className="space-y-8 animate-fade-in relative">
115
+ {loadingBadges && (
116
+ <div className="absolute -top-6 right-0 flex items-center text-xs text-app-muted animate-pulse-subtle">
117
+ Syncing records...
118
+ </div>
119
+ )}
120
+
121
+ {userData && (
122
+ <div className="flex flex-col md:flex-row gap-4 mb-8">
123
+ <div className="flex-1 bg-app-card border border-app-border p-5 rounded-xl">
124
+ <p className="text-zinc-500 text-[10px] font-bold uppercase tracking-wider mb-1">Accumulated XP</p>
125
+ <p className="text-3xl font-medium text-white tracking-tight">{userXP.toLocaleString()}</p>
126
+ </div>
127
+ <div className="flex-1 bg-app-card border border-app-border p-5 rounded-xl">
128
+ <p className="text-zinc-500 text-[10px] font-bold uppercase tracking-wider mb-1">Current Level</p>
129
+ <div className="flex items-baseline gap-2">
130
+ <p className="text-3xl font-medium text-white tracking-tight">{userLevel}</p>
131
+ </div>
132
+ </div>
133
+ </div>
134
+ )}
135
+
136
+ <div>
137
+ <h2 className="text-xl font-semibold mb-4 text-white">Identity Badges</h2>
138
+ <div className="grid grid-cols-1 md:grid-cols-3 gap-5">
139
+ {badges.map((badge, index) => {
140
+ const isLocked = !userData || userLevel < badge.minLevel || userXP < badge.minXP;
141
+ return (
142
+ <div key={badge.id} style={{ animationDelay: `${index * 100}ms` }}>
143
+ <BadgeCard {...badge} isLocked={isLocked} isLoading={loadingBadges} onMint={onMintClick} />
144
+ </div>
145
+ );
146
+ })}
147
+ </div>
148
+ </div>
149
+ </div>
150
+ );
151
+ };
152
+
153
+ export default Home;
@@ -0,0 +1,93 @@
1
+ "use client";
2
+
3
+ import { useState } from "react";
4
+ import {
5
+ callReadOnlyFunction,
6
+ makeContractCall,
7
+ AnchorMode,
8
+ PostConditionMode,
9
+ uintCV,
10
+ standardPrincipalCV
11
+ } from "@stacks/transactions";
12
+ import { StacksMainnet } from "@stacks/network";
13
+
14
+ const CONTRACT_ADDRESS = "PASTE_YOUR_MAINNET_ADDRESS";
15
+ const CONTRACT_NAME = "genesis-leaderboard-v1";
16
+
17
+ const network = new StacksMainnet();
18
+
19
+ export default function LeaderboardCard({ userAddress }: { userAddress: string }) {
20
+ const [score, setScore] = useState<number | null>(null);
21
+ const [tier, setTier] = useState<number | null>(null);
22
+ const [loading, setLoading] = useState(false);
23
+
24
+ async function fetchScore() {
25
+ setLoading(true);
26
+
27
+ const result = await callReadOnlyFunction({
28
+ contractAddress: CONTRACT_ADDRESS,
29
+ contractName: CONTRACT_NAME,
30
+ functionName: "get-score",
31
+ functionArgs: [standardPrincipalCV(userAddress)],
32
+ network,
33
+ senderAddress: userAddress,
34
+ });
35
+
36
+ const tierResult = await callReadOnlyFunction({
37
+ contractAddress: CONTRACT_ADDRESS,
38
+ contractName: CONTRACT_NAME,
39
+ functionName: "get-rank-tier",
40
+ functionArgs: [standardPrincipalCV(userAddress)],
41
+ network,
42
+ senderAddress: userAddress,
43
+ });
44
+
45
+ // @ts-ignore
46
+ setScore(Number(result.value.data.score.value));
47
+ // @ts-ignore
48
+ setTier(Number(tierResult.value));
49
+
50
+ setLoading(false);
51
+ }
52
+
53
+ async function addScore() {
54
+ const txOptions = {
55
+ contractAddress: CONTRACT_ADDRESS,
56
+ contractName: CONTRACT_NAME,
57
+ functionName: "add-score",
58
+ functionArgs: [uintCV(10)],
59
+ anchorMode: AnchorMode.Any,
60
+ postConditionMode: PostConditionMode.Allow,
61
+ network,
62
+ };
63
+
64
+ await makeContractCall(txOptions);
65
+ }
66
+
67
+ return (
68
+ <div className="p-4 border rounded-xl shadow-lg">
69
+ <h2 className="text-xl font-bold mb-4">Genesis Leaderboard</h2>
70
+
71
+ <button
72
+ onClick={fetchScore}
73
+ className="px-4 py-2 bg-blue-500 text-white rounded-lg mb-2"
74
+ >
75
+ {loading ? "Loading..." : "Fetch My Score"}
76
+ </button>
77
+
78
+ <button
79
+ onClick={addScore}
80
+ className="px-4 py-2 bg-green-500 text-white rounded-lg mb-4"
81
+ >
82
+ Add +10 Score
83
+ </button>
84
+
85
+ {score !== null && (
86
+ <div>
87
+ <p><strong>Score:</strong> {score}</p>
88
+ <p><strong>Rank Tier:</strong> {tier}</p>
89
+ </div>
90
+ )}
91
+ </div>
92
+ );
93
+ }