@peeramid-labs/sdk 3.15.0 → 3.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (335) hide show
  1. package/README.md +34 -0
  2. package/cli/abis/ArguableVotingTournament.js +10 -0
  3. package/cli/abis/ArguableVotingTournament.js.map +1 -1
  4. package/cli/abis/MAODistribution.js +16 -0
  5. package/cli/abis/MAODistribution.js.map +1 -1
  6. package/cli/abis/MockShortStrings.js +37 -0
  7. package/cli/abis/MockShortStrings.js.map +1 -0
  8. package/cli/abis/Multipass.js +7 -1
  9. package/cli/abis/Multipass.js.map +1 -1
  10. package/cli/abis/PausableUpgradeable.js +79 -0
  11. package/cli/abis/PausableUpgradeable.js.map +1 -0
  12. package/cli/abis/RankToken.js +38 -0
  13. package/cli/abis/RankToken.js.map +1 -1
  14. package/cli/abis/RankifyDiamondInstance.js +1987 -756
  15. package/cli/abis/RankifyDiamondInstance.js.map +1 -1
  16. package/cli/abis/RankifyInstanceInit.js +190 -0
  17. package/cli/abis/RankifyInstanceInit.js.map +1 -1
  18. package/cli/abis/RankifyInstanceMainFacet.js +38 -0
  19. package/cli/abis/RankifyInstanceMainFacet.js.map +1 -1
  20. package/cli/abis/RankifyOwnersFacet.js +78 -0
  21. package/cli/abis/RankifyOwnersFacet.js.map +1 -0
  22. package/cli/abis/UBI.js +775 -0
  23. package/cli/abis/UBI.js.map +1 -0
  24. package/cli/abis/index.js +19 -1
  25. package/cli/abis/index.js.map +1 -1
  26. package/cli/abis/superinterface.js +3049 -0
  27. package/cli/abis/superinterface.js.map +1 -0
  28. package/cli/cli/commands/blockchain/mine.js +0 -2
  29. package/cli/cli/commands/blockchain/mine.js.map +1 -1
  30. package/cli/cli/commands/fellowship/game/create.js +45 -1
  31. package/cli/cli/commands/fellowship/game/create.js.map +1 -1
  32. package/cli/cli/commands/fellowship/game/end-proposing.js +2 -2
  33. package/cli/cli/commands/fellowship/game/end-proposing.js.map +1 -1
  34. package/cli/cli/commands/fellowship/game/end-voting.js +2 -2
  35. package/cli/cli/commands/fellowship/game/end-voting.js.map +1 -1
  36. package/cli/cli/commands/fellowship/game/join.js +2 -1
  37. package/cli/cli/commands/fellowship/game/join.js.map +1 -1
  38. package/cli/cli/commands/fellowship/game/start.js +0 -17
  39. package/cli/cli/commands/fellowship/game/start.js.map +1 -1
  40. package/cli/cli/commands/fellowship/game/vote.js +2 -1
  41. package/cli/cli/commands/fellowship/game/vote.js.map +1 -1
  42. package/cli/cli/commands/fellowship/gameMaster/add.js +52 -0
  43. package/cli/cli/commands/fellowship/gameMaster/add.js.map +1 -0
  44. package/cli/cli/commands/fellowship/gameMaster/index.js +7 -0
  45. package/cli/cli/commands/fellowship/gameMaster/index.js.map +1 -0
  46. package/cli/cli/commands/fellowship/index.js +3 -1
  47. package/cli/cli/commands/fellowship/index.js.map +1 -1
  48. package/cli/cli/commands/instances/list.js +6 -0
  49. package/cli/cli/commands/instances/list.js.map +1 -1
  50. package/cli/cli/commands/multipass/contract.js +26 -0
  51. package/cli/cli/commands/multipass/contract.js.map +1 -1
  52. package/cli/cli/commands/multipass/domain.js +44 -1
  53. package/cli/cli/commands/multipass/domain.js.map +1 -1
  54. package/cli/cli/commands/multipass/domains.js +16 -2
  55. package/cli/cli/commands/multipass/domains.js.map +1 -1
  56. package/cli/cli/playbooks/demo-script.js +192 -0
  57. package/cli/cli/playbooks/demo-script.js.map +1 -0
  58. package/cli/cli/playbooks/demoScript.js +190 -0
  59. package/cli/cli/playbooks/demoScript.js.map +1 -0
  60. package/cli/cli/playbooks/initGameMaster.js +50 -0
  61. package/cli/cli/playbooks/initGameMaster.js.map +1 -0
  62. package/cli/cli/playbooks/playbookRunner.js +80 -0
  63. package/cli/cli/playbooks/playbookRunner.js.map +1 -0
  64. package/cli/cli/playbooks/push-game-to-next-phase.js +162 -0
  65. package/cli/cli/playbooks/push-game-to-next-phase.js.map +1 -0
  66. package/cli/cli/playbooks/utils.js +210 -0
  67. package/cli/cli/playbooks/utils.js.map +1 -0
  68. package/cli/multipass/MultipassBase.js +38 -70
  69. package/cli/multipass/MultipassBase.js.map +1 -1
  70. package/cli/multipass/Owner.js +34 -16
  71. package/cli/multipass/Owner.js.map +1 -1
  72. package/cli/rankify/GameMaster.js.map +1 -1
  73. package/cli/rankify/InstanceAdmininstrative.js +70 -0
  74. package/cli/rankify/InstanceAdmininstrative.js.map +1 -0
  75. package/cli/rankify/InstanceBase.js +14 -0
  76. package/cli/rankify/InstanceBase.js.map +1 -1
  77. package/cli/rankify/Player.js +24 -1
  78. package/cli/rankify/Player.js.map +1 -1
  79. package/cli/types.js +7 -1
  80. package/cli/types.js.map +1 -1
  81. package/cli/utils/EnvioGraphQLClient.js +468 -0
  82. package/cli/utils/EnvioGraphQLClient.js.map +1 -1
  83. package/cli/utils/artifacts.js +15 -3
  84. package/cli/utils/artifacts.js.map +1 -1
  85. package/cli/utils/chainMapping.js +0 -1
  86. package/cli/utils/chainMapping.js.map +1 -1
  87. package/docs/classes/EnvioGraphQLClient.md +368 -0
  88. package/docs/classes/GameMaster.md +19 -0
  89. package/docs/classes/InstanceBase.md +19 -0
  90. package/docs/classes/InstancePlayer.md +22 -8
  91. package/docs/classes/InstanceUBI.md +1591 -0
  92. package/docs/classes/Multipass.md +31 -4
  93. package/docs/classes/MultipassBase.md +26 -3
  94. package/docs/docs/classes/EnvioGraphQLClient.md +368 -0
  95. package/docs/docs/classes/GameMaster.md +19 -0
  96. package/docs/docs/classes/InstanceBase.md +19 -0
  97. package/docs/docs/classes/InstancePlayer.md +22 -8
  98. package/docs/docs/classes/InstanceUBI.md +1591 -0
  99. package/docs/docs/classes/Multipass.md +31 -4
  100. package/docs/docs/classes/MultipassBase.md +26 -3
  101. package/docs/docs/enums/ContractTypes.md +27 -0
  102. package/docs/docs/index.md +24 -8
  103. package/docs/docs/interfaces/ContractCondition.md +41 -0
  104. package/docs/docs/interfaces/DailyProposal.md +36 -0
  105. package/docs/docs/interfaces/JoinRequirementsInput.md +20 -0
  106. package/docs/docs/interfaces/ProposalGlobalStats.md +29 -0
  107. package/docs/docs/interfaces/TransactionProperties.md +20 -0
  108. package/docs/docs/interfaces/UBIParams.md +29 -0
  109. package/docs/docs/interfaces/UserState.md +22 -0
  110. package/docs/docs/interfaces/VoteElement.md +22 -0
  111. package/docs/docs/interfaces/configSmartRequirement.md +34 -0
  112. package/docs/docs/interfaces/numericConditon.md +41 -0
  113. package/docs/enums/ContractTypes.md +27 -0
  114. package/docs/index.md +24 -8
  115. package/docs/interfaces/ContractCondition.md +41 -0
  116. package/docs/interfaces/DailyProposal.md +36 -0
  117. package/docs/interfaces/JoinRequirementsInput.md +20 -0
  118. package/docs/interfaces/ProposalGlobalStats.md +29 -0
  119. package/docs/interfaces/TransactionProperties.md +20 -0
  120. package/docs/interfaces/UBIParams.md +29 -0
  121. package/docs/interfaces/UserState.md +22 -0
  122. package/docs/interfaces/VoteElement.md +22 -0
  123. package/docs/interfaces/configSmartRequirement.md +34 -0
  124. package/docs/interfaces/numericConditon.md +41 -0
  125. package/lib.commonjs/abis/ArguableVotingTournament.d.ts +8 -0
  126. package/lib.commonjs/abis/ArguableVotingTournament.d.ts.map +1 -1
  127. package/lib.commonjs/abis/ArguableVotingTournament.js +10 -0
  128. package/lib.commonjs/abis/ArguableVotingTournament.js.map +1 -1
  129. package/lib.commonjs/abis/MAODistribution.d.ts +12 -0
  130. package/lib.commonjs/abis/MAODistribution.d.ts.map +1 -1
  131. package/lib.commonjs/abis/MAODistribution.js +16 -0
  132. package/lib.commonjs/abis/MAODistribution.js.map +1 -1
  133. package/lib.commonjs/abis/MockShortStrings.d.ts +25 -0
  134. package/lib.commonjs/abis/MockShortStrings.d.ts.map +1 -0
  135. package/lib.commonjs/abis/MockShortStrings.js +37 -0
  136. package/lib.commonjs/abis/MockShortStrings.js.map +1 -0
  137. package/lib.commonjs/abis/Multipass.d.ts +5 -1
  138. package/lib.commonjs/abis/Multipass.d.ts.map +1 -1
  139. package/lib.commonjs/abis/Multipass.js +7 -1
  140. package/lib.commonjs/abis/Multipass.js.map +1 -1
  141. package/lib.commonjs/abis/PausableUpgradeable.d.ts +59 -0
  142. package/lib.commonjs/abis/PausableUpgradeable.d.ts.map +1 -0
  143. package/lib.commonjs/abis/PausableUpgradeable.js +79 -0
  144. package/lib.commonjs/abis/PausableUpgradeable.js.map +1 -0
  145. package/lib.commonjs/abis/RankToken.d.ts +30 -0
  146. package/lib.commonjs/abis/RankToken.d.ts.map +1 -1
  147. package/lib.commonjs/abis/RankToken.js +38 -0
  148. package/lib.commonjs/abis/RankToken.js.map +1 -1
  149. package/lib.commonjs/abis/RankifyDiamondInstance.d.ts +970 -9
  150. package/lib.commonjs/abis/RankifyDiamondInstance.d.ts.map +1 -1
  151. package/lib.commonjs/abis/RankifyDiamondInstance.js +1987 -756
  152. package/lib.commonjs/abis/RankifyDiamondInstance.js.map +1 -1
  153. package/lib.commonjs/abis/RankifyInstanceInit.d.ts +150 -0
  154. package/lib.commonjs/abis/RankifyInstanceInit.d.ts.map +1 -1
  155. package/lib.commonjs/abis/RankifyInstanceInit.js +190 -0
  156. package/lib.commonjs/abis/RankifyInstanceInit.js.map +1 -1
  157. package/lib.commonjs/abis/RankifyInstanceMainFacet.d.ts +30 -0
  158. package/lib.commonjs/abis/RankifyInstanceMainFacet.d.ts.map +1 -1
  159. package/lib.commonjs/abis/RankifyInstanceMainFacet.js +38 -0
  160. package/lib.commonjs/abis/RankifyInstanceMainFacet.js.map +1 -1
  161. package/lib.commonjs/abis/RankifyOwnersFacet.d.ts +57 -0
  162. package/lib.commonjs/abis/RankifyOwnersFacet.d.ts.map +1 -0
  163. package/lib.commonjs/abis/RankifyOwnersFacet.js +78 -0
  164. package/lib.commonjs/abis/RankifyOwnersFacet.js.map +1 -0
  165. package/lib.commonjs/abis/UBI.d.ts +601 -0
  166. package/lib.commonjs/abis/UBI.d.ts.map +1 -0
  167. package/lib.commonjs/abis/UBI.js +775 -0
  168. package/lib.commonjs/abis/UBI.js.map +1 -0
  169. package/lib.commonjs/abis/index.d.ts +1935 -1
  170. package/lib.commonjs/abis/index.d.ts.map +1 -1
  171. package/lib.commonjs/abis/index.js +19 -1
  172. package/lib.commonjs/abis/index.js.map +1 -1
  173. package/lib.commonjs/abis/superinterface.d.ts +3 -0
  174. package/lib.commonjs/abis/superinterface.d.ts.map +1 -0
  175. package/lib.commonjs/abis/superinterface.js +3049 -0
  176. package/lib.commonjs/abis/superinterface.js.map +1 -0
  177. package/lib.commonjs/index.d.ts +2 -0
  178. package/lib.commonjs/index.d.ts.map +1 -1
  179. package/lib.commonjs/index.js +3 -1
  180. package/lib.commonjs/index.js.map +1 -1
  181. package/lib.commonjs/multipass/MultipassBase.d.ts +18 -4
  182. package/lib.commonjs/multipass/MultipassBase.d.ts.map +1 -1
  183. package/lib.commonjs/multipass/MultipassBase.js +39 -71
  184. package/lib.commonjs/multipass/MultipassBase.js.map +1 -1
  185. package/lib.commonjs/multipass/Owner.d.ts +22 -8
  186. package/lib.commonjs/multipass/Owner.d.ts.map +1 -1
  187. package/lib.commonjs/multipass/Owner.js +34 -16
  188. package/lib.commonjs/multipass/Owner.js.map +1 -1
  189. package/lib.commonjs/multipass/Registrar.d.ts +3 -1
  190. package/lib.commonjs/multipass/Registrar.d.ts.map +1 -1
  191. package/lib.commonjs/multipass/Registrar.js +2 -2
  192. package/lib.commonjs/multipass/Registrar.js.map +1 -1
  193. package/lib.commonjs/rankify/GameMaster.d.ts +5 -1
  194. package/lib.commonjs/rankify/GameMaster.d.ts.map +1 -1
  195. package/lib.commonjs/rankify/GameMaster.js.map +1 -1
  196. package/lib.commonjs/rankify/InstanceAdmininstrative.d.ts +34 -0
  197. package/lib.commonjs/rankify/InstanceAdmininstrative.d.ts.map +1 -0
  198. package/lib.commonjs/rankify/InstanceAdmininstrative.js +74 -0
  199. package/lib.commonjs/rankify/InstanceAdmininstrative.js.map +1 -0
  200. package/lib.commonjs/rankify/InstanceBase.d.ts +1 -0
  201. package/lib.commonjs/rankify/InstanceBase.d.ts.map +1 -1
  202. package/lib.commonjs/rankify/InstanceBase.js +14 -0
  203. package/lib.commonjs/rankify/InstanceBase.js.map +1 -1
  204. package/lib.commonjs/rankify/Player.d.ts +2 -36
  205. package/lib.commonjs/rankify/Player.d.ts.map +1 -1
  206. package/lib.commonjs/rankify/Player.js +24 -1
  207. package/lib.commonjs/rankify/Player.js.map +1 -1
  208. package/lib.commonjs/types.d.ts +33 -0
  209. package/lib.commonjs/types.d.ts.map +1 -1
  210. package/lib.commonjs/types.js +7 -1
  211. package/lib.commonjs/types.js.map +1 -1
  212. package/lib.commonjs/ubi/InstanceUBI.d.ts +548 -0
  213. package/lib.commonjs/ubi/InstanceUBI.d.ts.map +1 -0
  214. package/lib.commonjs/ubi/InstanceUBI.js +728 -0
  215. package/lib.commonjs/ubi/InstanceUBI.js.map +1 -0
  216. package/lib.commonjs/utils/EnvioGraphQLClient.d.ts +279 -0
  217. package/lib.commonjs/utils/EnvioGraphQLClient.d.ts.map +1 -1
  218. package/lib.commonjs/utils/EnvioGraphQLClient.js +468 -0
  219. package/lib.commonjs/utils/EnvioGraphQLClient.js.map +1 -1
  220. package/lib.commonjs/utils/artifacts.d.ts.map +1 -1
  221. package/lib.commonjs/utils/artifacts.js +15 -3
  222. package/lib.commonjs/utils/artifacts.js.map +1 -1
  223. package/lib.commonjs/utils/chainMapping.d.ts.map +1 -1
  224. package/lib.commonjs/utils/chainMapping.js +0 -1
  225. package/lib.commonjs/utils/chainMapping.js.map +1 -1
  226. package/lib.commonjs/utils/mockUtils.d.ts +3 -0
  227. package/lib.commonjs/utils/mockUtils.d.ts.map +1 -1
  228. package/lib.commonjs/utils/mockUtils.js +3 -0
  229. package/lib.commonjs/utils/mockUtils.js.map +1 -1
  230. package/lib.esm/abis/ArguableVotingTournament.d.ts +8 -0
  231. package/lib.esm/abis/ArguableVotingTournament.d.ts.map +1 -1
  232. package/lib.esm/abis/ArguableVotingTournament.js +10 -0
  233. package/lib.esm/abis/ArguableVotingTournament.js.map +1 -1
  234. package/lib.esm/abis/MAODistribution.d.ts +12 -0
  235. package/lib.esm/abis/MAODistribution.d.ts.map +1 -1
  236. package/lib.esm/abis/MAODistribution.js +16 -0
  237. package/lib.esm/abis/MAODistribution.js.map +1 -1
  238. package/lib.esm/abis/MockShortStrings.d.ts +25 -0
  239. package/lib.esm/abis/MockShortStrings.d.ts.map +1 -0
  240. package/lib.esm/abis/MockShortStrings.js +34 -0
  241. package/lib.esm/abis/MockShortStrings.js.map +1 -0
  242. package/lib.esm/abis/Multipass.d.ts +5 -1
  243. package/lib.esm/abis/Multipass.d.ts.map +1 -1
  244. package/lib.esm/abis/Multipass.js +7 -1
  245. package/lib.esm/abis/Multipass.js.map +1 -1
  246. package/lib.esm/abis/PausableUpgradeable.d.ts +59 -0
  247. package/lib.esm/abis/PausableUpgradeable.d.ts.map +1 -0
  248. package/lib.esm/abis/PausableUpgradeable.js +76 -0
  249. package/lib.esm/abis/PausableUpgradeable.js.map +1 -0
  250. package/lib.esm/abis/RankToken.d.ts +30 -0
  251. package/lib.esm/abis/RankToken.d.ts.map +1 -1
  252. package/lib.esm/abis/RankToken.js +38 -0
  253. package/lib.esm/abis/RankToken.js.map +1 -1
  254. package/lib.esm/abis/RankifyDiamondInstance.d.ts +970 -9
  255. package/lib.esm/abis/RankifyDiamondInstance.d.ts.map +1 -1
  256. package/lib.esm/abis/RankifyDiamondInstance.js +1987 -756
  257. package/lib.esm/abis/RankifyDiamondInstance.js.map +1 -1
  258. package/lib.esm/abis/RankifyInstanceInit.d.ts +150 -0
  259. package/lib.esm/abis/RankifyInstanceInit.d.ts.map +1 -1
  260. package/lib.esm/abis/RankifyInstanceInit.js +190 -0
  261. package/lib.esm/abis/RankifyInstanceInit.js.map +1 -1
  262. package/lib.esm/abis/RankifyInstanceMainFacet.d.ts +30 -0
  263. package/lib.esm/abis/RankifyInstanceMainFacet.d.ts.map +1 -1
  264. package/lib.esm/abis/RankifyInstanceMainFacet.js +38 -0
  265. package/lib.esm/abis/RankifyInstanceMainFacet.js.map +1 -1
  266. package/lib.esm/abis/RankifyOwnersFacet.d.ts +57 -0
  267. package/lib.esm/abis/RankifyOwnersFacet.d.ts.map +1 -0
  268. package/lib.esm/abis/RankifyOwnersFacet.js +75 -0
  269. package/lib.esm/abis/RankifyOwnersFacet.js.map +1 -0
  270. package/lib.esm/abis/UBI.d.ts +601 -0
  271. package/lib.esm/abis/UBI.d.ts.map +1 -0
  272. package/lib.esm/abis/UBI.js +772 -0
  273. package/lib.esm/abis/UBI.js.map +1 -0
  274. package/lib.esm/abis/index.d.ts +1935 -1
  275. package/lib.esm/abis/index.d.ts.map +1 -1
  276. package/lib.esm/abis/index.js +13 -0
  277. package/lib.esm/abis/index.js.map +1 -1
  278. package/lib.esm/abis/superinterface.d.ts +3 -0
  279. package/lib.esm/abis/superinterface.d.ts.map +1 -0
  280. package/lib.esm/abis/superinterface.js +3046 -0
  281. package/lib.esm/abis/superinterface.js.map +1 -0
  282. package/lib.esm/index.d.ts +2 -0
  283. package/lib.esm/index.d.ts.map +1 -1
  284. package/lib.esm/index.js +1 -0
  285. package/lib.esm/index.js.map +1 -1
  286. package/lib.esm/multipass/MultipassBase.d.ts +18 -4
  287. package/lib.esm/multipass/MultipassBase.d.ts.map +1 -1
  288. package/lib.esm/multipass/MultipassBase.js +40 -72
  289. package/lib.esm/multipass/MultipassBase.js.map +1 -1
  290. package/lib.esm/multipass/Owner.d.ts +22 -8
  291. package/lib.esm/multipass/Owner.d.ts.map +1 -1
  292. package/lib.esm/multipass/Owner.js +34 -16
  293. package/lib.esm/multipass/Owner.js.map +1 -1
  294. package/lib.esm/multipass/Registrar.d.ts +3 -1
  295. package/lib.esm/multipass/Registrar.d.ts.map +1 -1
  296. package/lib.esm/multipass/Registrar.js +2 -2
  297. package/lib.esm/multipass/Registrar.js.map +1 -1
  298. package/lib.esm/rankify/GameMaster.d.ts +5 -1
  299. package/lib.esm/rankify/GameMaster.d.ts.map +1 -1
  300. package/lib.esm/rankify/GameMaster.js.map +1 -1
  301. package/lib.esm/rankify/InstanceAdmininstrative.d.ts +34 -0
  302. package/lib.esm/rankify/InstanceAdmininstrative.d.ts.map +1 -0
  303. package/lib.esm/rankify/InstanceAdmininstrative.js +70 -0
  304. package/lib.esm/rankify/InstanceAdmininstrative.js.map +1 -0
  305. package/lib.esm/rankify/InstanceBase.d.ts +1 -0
  306. package/lib.esm/rankify/InstanceBase.d.ts.map +1 -1
  307. package/lib.esm/rankify/InstanceBase.js +14 -0
  308. package/lib.esm/rankify/InstanceBase.js.map +1 -1
  309. package/lib.esm/rankify/Player.d.ts +2 -36
  310. package/lib.esm/rankify/Player.d.ts.map +1 -1
  311. package/lib.esm/rankify/Player.js +24 -1
  312. package/lib.esm/rankify/Player.js.map +1 -1
  313. package/lib.esm/types.d.ts +33 -0
  314. package/lib.esm/types.d.ts.map +1 -1
  315. package/lib.esm/types.js +6 -0
  316. package/lib.esm/types.js.map +1 -1
  317. package/lib.esm/ubi/InstanceUBI.d.ts +548 -0
  318. package/lib.esm/ubi/InstanceUBI.d.ts.map +1 -0
  319. package/lib.esm/ubi/InstanceUBI.js +722 -0
  320. package/lib.esm/ubi/InstanceUBI.js.map +1 -0
  321. package/lib.esm/utils/EnvioGraphQLClient.d.ts +279 -0
  322. package/lib.esm/utils/EnvioGraphQLClient.d.ts.map +1 -1
  323. package/lib.esm/utils/EnvioGraphQLClient.js +468 -0
  324. package/lib.esm/utils/EnvioGraphQLClient.js.map +1 -1
  325. package/lib.esm/utils/artifacts.d.ts.map +1 -1
  326. package/lib.esm/utils/artifacts.js +15 -3
  327. package/lib.esm/utils/artifacts.js.map +1 -1
  328. package/lib.esm/utils/chainMapping.d.ts.map +1 -1
  329. package/lib.esm/utils/chainMapping.js +0 -1
  330. package/lib.esm/utils/chainMapping.js.map +1 -1
  331. package/lib.esm/utils/mockUtils.d.ts +3 -0
  332. package/lib.esm/utils/mockUtils.d.ts.map +1 -1
  333. package/lib.esm/utils/mockUtils.js +3 -0
  334. package/lib.esm/utils/mockUtils.js.map +1 -1
  335. package/package.json +6 -6
@@ -0,0 +1,728 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const index_1 = require("../utils/index");
7
+ const abis_1 = __importDefault(require("../abis"));
8
+ const { UBIAbi } = abis_1.default;
9
+ const InstanceBase_1 = __importDefault(require("../rankify/InstanceBase"));
10
+ /**
11
+ * Class for interacting with UBI facet of a Rankify instance
12
+ * Extends InstanceBase and provides UBI-specific functionality
13
+ */
14
+ class InstanceUBI extends InstanceBase_1.default {
15
+ /** Wallet client for write operations (optional) */
16
+ walletClient;
17
+ /** Account address for write operations */
18
+ account;
19
+ /**
20
+ * Creates a new InstanceUBI
21
+ * @param {Object} params - Constructor parameters
22
+ * @param {PublicClient} params.publicClient - Public client for blockchain interactions
23
+ * @param {WalletClient} params.walletClient - Optional wallet client for write operations
24
+ * @param {number} params.chainId - Chain ID of the network
25
+ * @param {Address} params.instanceAddress - Address of the Rankify instance with UBI facet
26
+ * @param {Address} params.account - Optional account address for write operations
27
+ * @param {EnvioGraphQLClient} params.envioClient - Envio GraphQL client for event queries
28
+ */
29
+ constructor({ publicClient, walletClient, chainId, instanceAddress, account, envioClient, }) {
30
+ super({
31
+ publicClient,
32
+ chainId,
33
+ instanceAddress,
34
+ envioClient,
35
+ });
36
+ this.walletClient = walletClient;
37
+ this.account = account || walletClient?.account?.address;
38
+ }
39
+ /**
40
+ * Gets the current day number based on block timestamp
41
+ * @returns The current day number (block.timestamp / 1 days)
42
+ */
43
+ getCurrentDay = async () => {
44
+ try {
45
+ return await this.publicClient.readContract({
46
+ address: this.instanceAddress,
47
+ abi: UBIAbi,
48
+ functionName: "getCurrentDay",
49
+ });
50
+ }
51
+ catch (e) {
52
+ throw await (0, index_1.handleRPCError)(e);
53
+ }
54
+ };
55
+ /**
56
+ * Gets the current day number (alias for getCurrentDay)
57
+ * @returns The current day number
58
+ */
59
+ currentDay = async () => {
60
+ try {
61
+ return await this.publicClient.readContract({
62
+ address: this.instanceAddress,
63
+ abi: UBIAbi,
64
+ functionName: "currentDay",
65
+ });
66
+ }
67
+ catch (e) {
68
+ throw await (0, index_1.handleRPCError)(e);
69
+ }
70
+ };
71
+ /**
72
+ * Gets the UBI system parameters
73
+ * @returns Object containing dailyClaimAmount, dailySupportAmount, and domainName
74
+ */
75
+ getUBIParams = async () => {
76
+ try {
77
+ const [dailyClaimAmount, dailySupportAmount, domainName] = await this.publicClient.readContract({
78
+ address: this.instanceAddress,
79
+ abi: UBIAbi,
80
+ functionName: "getUBIParams",
81
+ });
82
+ console.log("dailyClaimAmount", dailyClaimAmount);
83
+ console.log("dailySupportAmount", dailySupportAmount);
84
+ console.log("domainName", domainName);
85
+ return {
86
+ dailyClaimAmount,
87
+ dailySupportAmount,
88
+ domainName,
89
+ };
90
+ }
91
+ catch (e) {
92
+ throw await (0, index_1.handleRPCError)(e);
93
+ }
94
+ };
95
+ /**
96
+ * Gets the lifetime statistics for a proposal
97
+ * @param proposalHash - The hash of the proposal
98
+ * @returns Object containing aggregateScore, proposedTimes, and repostedTimes
99
+ */
100
+ getProposalLifetimeStats = async (proposalHash) => {
101
+ try {
102
+ const result = await this.publicClient.readContract({
103
+ address: this.instanceAddress,
104
+ abi: UBIAbi,
105
+ functionName: "proposalLifetimeStats",
106
+ args: [proposalHash],
107
+ });
108
+ return {
109
+ aggregateScore: result.aggregateScore,
110
+ proposedTimes: result.proposedTimes,
111
+ repostedTimes: result.repostedTimes,
112
+ };
113
+ }
114
+ catch (e) {
115
+ throw await (0, index_1.handleRPCError)(e);
116
+ }
117
+ };
118
+ /**
119
+ * Gets the daily score for a proposal on a specific day
120
+ * @param proposalHash - The hash of the proposal
121
+ * @param day - The day number to query
122
+ * @returns DailyProposal object with proposal details for that day
123
+ */
124
+ getProposalDailyScore = async (proposalHash, day) => {
125
+ try {
126
+ const result = await this.publicClient.readContract({
127
+ address: this.instanceAddress,
128
+ abi: UBIAbi,
129
+ functionName: "getProposalDailyScore",
130
+ args: [proposalHash, day],
131
+ });
132
+ return {
133
+ proposal: result.proposal,
134
+ score: result.score,
135
+ proposer: result.proposer,
136
+ exists: result.exists,
137
+ };
138
+ }
139
+ catch (e) {
140
+ throw await (0, index_1.handleRPCError)(e);
141
+ }
142
+ };
143
+ /**
144
+ * Gets the total number of proposals for a specific day
145
+ * @param day - The day number to query
146
+ * @returns The count of proposals for that day
147
+ */
148
+ getProposalsCnt = async (day) => {
149
+ try {
150
+ return await this.publicClient.readContract({
151
+ address: this.instanceAddress,
152
+ abi: UBIAbi,
153
+ functionName: "getProposalsCnt",
154
+ args: [day],
155
+ });
156
+ }
157
+ catch (e) {
158
+ throw await (0, index_1.handleRPCError)(e);
159
+ }
160
+ };
161
+ /**
162
+ * Gets the day a user last claimed their tokens
163
+ * @param user - The address of the user
164
+ * @returns The day number of the last claim (0 if never claimed)
165
+ */
166
+ getLastClaimedAt = async (user) => {
167
+ try {
168
+ return await this.publicClient.readContract({
169
+ address: this.instanceAddress,
170
+ abi: UBIAbi,
171
+ functionName: "lastClaimedAt",
172
+ args: [user],
173
+ });
174
+ }
175
+ catch (e) {
176
+ throw await (0, index_1.handleRPCError)(e);
177
+ }
178
+ };
179
+ /**
180
+ * Gets the current state for a user
181
+ * @param user - The address of the user
182
+ * @returns Object containing claimedToday and supportSpent
183
+ */
184
+ getUserState = async (user) => {
185
+ try {
186
+ const [claimedToday, supportSpent] = await this.publicClient.readContract({
187
+ address: this.instanceAddress,
188
+ abi: UBIAbi,
189
+ functionName: "getUserState",
190
+ args: [user],
191
+ });
192
+ return {
193
+ claimedToday,
194
+ supportSpent,
195
+ };
196
+ }
197
+ catch (e) {
198
+ throw await (0, index_1.handleRPCError)(e);
199
+ }
200
+ };
201
+ /**
202
+ * Gets the address of the pauser
203
+ * @returns The address with pausing/unpausing permissions
204
+ */
205
+ getPauser = async () => {
206
+ try {
207
+ return await this.publicClient.readContract({
208
+ address: this.instanceAddress,
209
+ abi: UBIAbi,
210
+ functionName: "pauser",
211
+ });
212
+ }
213
+ catch (e) {
214
+ throw await (0, index_1.handleRPCError)(e);
215
+ }
216
+ };
217
+ /**
218
+ * Gets the Multipass contract address
219
+ * @returns The address of the Multipass contract
220
+ */
221
+ getMultipass = async () => {
222
+ try {
223
+ return await this.publicClient.readContract({
224
+ address: this.instanceAddress,
225
+ abi: UBIAbi,
226
+ functionName: "multipass",
227
+ });
228
+ }
229
+ catch (e) {
230
+ throw await (0, index_1.handleRPCError)(e);
231
+ }
232
+ };
233
+ /**
234
+ * Gets the governance token contract address
235
+ * @returns The address of the DistributableGovernanceERC20 token
236
+ */
237
+ getToken = async () => {
238
+ try {
239
+ return await this.publicClient.readContract({
240
+ address: this.instanceAddress,
241
+ abi: UBIAbi,
242
+ functionName: "token",
243
+ });
244
+ }
245
+ catch (e) {
246
+ throw await (0, index_1.handleRPCError)(e);
247
+ }
248
+ };
249
+ /**
250
+ * Checks if the contract is currently paused
251
+ * @returns True if paused, false otherwise
252
+ */
253
+ isPaused = async () => {
254
+ try {
255
+ return await this.publicClient.readContract({
256
+ address: this.instanceAddress,
257
+ abi: UBIAbi,
258
+ functionName: "paused",
259
+ });
260
+ }
261
+ catch (e) {
262
+ throw await (0, index_1.handleRPCError)(e);
263
+ }
264
+ };
265
+ /**
266
+ * Gets comprehensive information about a user's current status
267
+ * @param user - The address of the user
268
+ * @returns Object containing user state, last claimed day, and current day
269
+ */
270
+ getUserInfo = async (user) => {
271
+ try {
272
+ const [userState, lastClaimedAt, currentDay] = await Promise.all([
273
+ this.getUserState(user),
274
+ this.getLastClaimedAt(user),
275
+ this.getCurrentDay(),
276
+ ]);
277
+ return {
278
+ userState,
279
+ lastClaimedAt,
280
+ currentDay,
281
+ canClaim: lastClaimedAt < currentDay,
282
+ };
283
+ }
284
+ catch (e) {
285
+ throw await (0, index_1.handleRPCError)(e);
286
+ }
287
+ };
288
+ /**
289
+ * Gets comprehensive information about a proposal
290
+ * @param proposalHash - The hash of the proposal
291
+ * @param day - Optional day to get daily score (defaults to current day - 1)
292
+ * @returns Object containing lifetime stats and daily score
293
+ */
294
+ getProposalInfo = async (proposalHash, day) => {
295
+ try {
296
+ const queryDay = day ?? (await this.getCurrentDay()) - 1n;
297
+ const [lifetimeStats, dailyScore] = await Promise.all([
298
+ this.getProposalLifetimeStats(proposalHash),
299
+ this.getProposalDailyScore(proposalHash, queryDay),
300
+ ]);
301
+ return {
302
+ lifetimeStats,
303
+ dailyScore,
304
+ day: queryDay,
305
+ };
306
+ }
307
+ catch (e) {
308
+ throw await (0, index_1.handleRPCError)(e);
309
+ }
310
+ };
311
+ /**
312
+ * Gets all proposals for a specific day (requires querying events or off-chain indexer)
313
+ * This is a helper method that would typically use an indexer/subgraph
314
+ * @param day - The day to query
315
+ * @returns The count of proposals for that day
316
+ */
317
+ getDayProposals = async (day) => {
318
+ try {
319
+ const count = await this.getProposalsCnt(day);
320
+ return {
321
+ count,
322
+ day,
323
+ };
324
+ }
325
+ catch (e) {
326
+ throw await (0, index_1.handleRPCError)(e);
327
+ }
328
+ };
329
+ // ==================== WRITE OPERATIONS ====================
330
+ /**
331
+ * Claims daily UBI tokens and optionally submits a proposal
332
+ * @param proposalText - The proposal text (empty string for no proposal)
333
+ * @returns Transaction hash
334
+ * @throws Error if wallet client is not configured
335
+ */
336
+ claim = async (proposalText = "") => {
337
+ if (!this.walletClient) {
338
+ throw new Error("Wallet client required for write operations");
339
+ }
340
+ if (!this.account) {
341
+ throw new Error("Account required for write operations");
342
+ }
343
+ try {
344
+ const { request } = await this.publicClient.simulateContract({
345
+ address: this.instanceAddress,
346
+ abi: UBIAbi,
347
+ functionName: "claim",
348
+ args: [proposalText],
349
+ account: this.account,
350
+ });
351
+ const hash = await this.walletClient.writeContract(request);
352
+ return hash;
353
+ }
354
+ catch (e) {
355
+ throw await (0, index_1.handleRPCError)(e);
356
+ }
357
+ };
358
+ /**
359
+ * Supports one or more proposals from the previous day using quadratic voting
360
+ * @param votes - Array of vote elements (proposal hash and amount)
361
+ * @returns Transaction hash
362
+ * @throws Error if wallet client is not configured
363
+ */
364
+ support = async (votes) => {
365
+ if (!this.walletClient) {
366
+ throw new Error("Wallet client required for write operations");
367
+ }
368
+ if (!this.account) {
369
+ throw new Error("Account required for write operations");
370
+ }
371
+ try {
372
+ const formattedVotes = votes.map((v) => ({
373
+ proposal: v.proposal,
374
+ amount: v.amount,
375
+ }));
376
+ const { request } = await this.publicClient.simulateContract({
377
+ address: this.instanceAddress,
378
+ abi: UBIAbi,
379
+ functionName: "support",
380
+ args: [formattedVotes],
381
+ account: this.account,
382
+ });
383
+ const hash = await this.walletClient.writeContract(request);
384
+ return hash;
385
+ }
386
+ catch (e) {
387
+ throw await (0, index_1.handleRPCError)(e);
388
+ }
389
+ };
390
+ /**
391
+ * Pauses the UBI contract (only callable by pauser)
392
+ * @returns Transaction hash
393
+ * @throws Error if wallet client is not configured or caller is not pauser
394
+ */
395
+ pause = async () => {
396
+ if (!this.walletClient) {
397
+ throw new Error("Wallet client required for write operations");
398
+ }
399
+ if (!this.account) {
400
+ throw new Error("Account required for write operations");
401
+ }
402
+ try {
403
+ const { request } = await this.publicClient.simulateContract({
404
+ address: this.instanceAddress,
405
+ abi: UBIAbi,
406
+ functionName: "pause",
407
+ account: this.account,
408
+ });
409
+ const hash = await this.walletClient.writeContract(request);
410
+ return hash;
411
+ }
412
+ catch (e) {
413
+ throw await (0, index_1.handleRPCError)(e);
414
+ }
415
+ };
416
+ /**
417
+ * Unpauses the UBI contract (only callable by pauser)
418
+ * @returns Transaction hash
419
+ * @throws Error if wallet client is not configured or caller is not pauser
420
+ */
421
+ unpause = async () => {
422
+ if (!this.walletClient) {
423
+ throw new Error("Wallet client required for write operations");
424
+ }
425
+ if (!this.account) {
426
+ throw new Error("Account required for write operations");
427
+ }
428
+ try {
429
+ const { request } = await this.publicClient.simulateContract({
430
+ address: this.instanceAddress,
431
+ abi: UBIAbi,
432
+ functionName: "unpause",
433
+ account: this.account,
434
+ });
435
+ const hash = await this.walletClient.writeContract(request);
436
+ return hash;
437
+ }
438
+ catch (e) {
439
+ throw await (0, index_1.handleRPCError)(e);
440
+ }
441
+ };
442
+ // ==================== INDEXER QUERY METHODS ====================
443
+ /**
444
+ * Gets proposals submitted by a specific address
445
+ * @param proposer - Optional address to filter by proposer
446
+ * @param day - Optional day to filter proposals
447
+ * @param limit - Maximum number of results to return
448
+ * @param offset - Number of results to skip
449
+ * @returns Array of proposal events
450
+ */
451
+ getProposalsByAddress = async ({ proposer, day, limit = 100, offset = 0, } = {}) => {
452
+ try {
453
+ return await this.envioClient.getUBIProposingByAddressEvents({
454
+ instanceAddress: this.instanceAddress,
455
+ proposer,
456
+ day,
457
+ limit,
458
+ offset,
459
+ });
460
+ }
461
+ catch (e) {
462
+ throw await (0, index_1.handleRPCError)(e);
463
+ }
464
+ };
465
+ /**
466
+ * Gets all proposals for a specific day
467
+ * @param day - Optional day to filter proposals (defaults to current day - 1)
468
+ * @param limit - Maximum number of results to return
469
+ * @param offset - Number of results to skip
470
+ * @returns Array of proposal events for the day
471
+ */
472
+ getDailyProposals = async ({ day, limit = 100, offset = 0, } = {}) => {
473
+ try {
474
+ const queryDay = day ?? (await this.getCurrentDay()) - 1n;
475
+ return await this.envioClient.getUBIProposingByAddressEvents({
476
+ instanceAddress: this.instanceAddress,
477
+ day: queryDay,
478
+ limit,
479
+ offset,
480
+ });
481
+ }
482
+ catch (e) {
483
+ throw await (0, index_1.handleRPCError)(e);
484
+ }
485
+ };
486
+ /**
487
+ * Gets proposal score updates for a specific proposal
488
+ * @param proposal - Proposal hash to query
489
+ * @param day - Optional day to filter results
490
+ * @param limit - Maximum number of results to return
491
+ * @param offset - Number of results to skip
492
+ * @returns Array of proposal score update events
493
+ */
494
+ getProposalScoreHistory = async ({ proposal, day, limit = 100, offset = 0, } = {}) => {
495
+ try {
496
+ return await this.envioClient.getUBIProposalScoreUpdatedByProposalEvents({
497
+ instanceAddress: this.instanceAddress,
498
+ proposal,
499
+ day,
500
+ limit,
501
+ offset,
502
+ });
503
+ }
504
+ catch (e) {
505
+ throw await (0, index_1.handleRPCError)(e);
506
+ }
507
+ };
508
+ /**
509
+ * Gets voting events for a specific participant
510
+ * @param participant - Address to filter by participant
511
+ * @param day - Optional day to filter votes
512
+ * @param limit - Maximum number of results to return
513
+ * @param offset - Number of results to skip
514
+ * @returns Array of voting events
515
+ */
516
+ getVotesByAddress = async ({ participant, day, limit = 100, offset = 0, } = {}) => {
517
+ try {
518
+ return await this.envioClient.getUBIVotingByAddressEvents({
519
+ instanceAddress: this.instanceAddress,
520
+ participant,
521
+ day,
522
+ limit,
523
+ offset,
524
+ });
525
+ }
526
+ catch (e) {
527
+ throw await (0, index_1.handleRPCError)(e);
528
+ }
529
+ };
530
+ /**
531
+ * Gets all votes for a specific day
532
+ * @param day - Optional day to filter votes (defaults to current day - 1)
533
+ * @param limit - Maximum number of results to return
534
+ * @param offset - Number of results to skip
535
+ * @returns Array of voting events for the day
536
+ */
537
+ getDailyVotes = async ({ day, limit = 100, offset = 0, } = {}) => {
538
+ try {
539
+ const queryDay = day ?? (await this.getCurrentDay()) - 1n;
540
+ return await this.envioClient.getUBIVotingByAddressEvents({
541
+ instanceAddress: this.instanceAddress,
542
+ day: queryDay,
543
+ limit,
544
+ offset,
545
+ });
546
+ }
547
+ catch (e) {
548
+ throw await (0, index_1.handleRPCError)(e);
549
+ }
550
+ };
551
+ /**
552
+ * Gets claim history
553
+ * @param user - Optional user address to filter claims
554
+ * @param limit - Maximum number of results to return
555
+ * @param offset - Number of results to skip
556
+ * @returns Array of claim events
557
+ */
558
+ getClaimHistory = async ({ user, limit = 100, offset = 0, } = {}) => {
559
+ try {
560
+ return await this.envioClient.getUBIClaimedEvents({
561
+ instanceAddress: this.instanceAddress,
562
+ user,
563
+ limit,
564
+ offset,
565
+ });
566
+ }
567
+ catch (e) {
568
+ throw await (0, index_1.handleRPCError)(e);
569
+ }
570
+ };
571
+ /**
572
+ * Gets repost events by reposter
573
+ * @param reposter - Optional address to filter by reposter
574
+ * @param day - Optional day to filter reposts
575
+ * @param limit - Maximum number of results to return
576
+ * @param offset - Number of results to skip
577
+ * @returns Array of repost events
578
+ */
579
+ getRepostsByAddress = async ({ reposter, day, limit = 100, offset = 0, } = {}) => {
580
+ try {
581
+ return await this.envioClient.getUBIRepostByReposterEvents({
582
+ instanceAddress: this.instanceAddress,
583
+ reposter,
584
+ day,
585
+ limit,
586
+ offset,
587
+ });
588
+ }
589
+ catch (e) {
590
+ throw await (0, index_1.handleRPCError)(e);
591
+ }
592
+ };
593
+ /**
594
+ * Gets lifetime scores for all proposals
595
+ * @param limit - Maximum number of results to return
596
+ * @param offset - Number of results to skip
597
+ * @returns Array of proposal lifetime score events
598
+ */
599
+ getProposalLifetimeScores = async ({ limit = 100, offset = 0, } = {}) => {
600
+ try {
601
+ return await this.envioClient.getUBIProposalLifetimeScoreEvents({
602
+ instanceAddress: this.instanceAddress,
603
+ limit,
604
+ offset,
605
+ });
606
+ }
607
+ catch (e) {
608
+ throw await (0, index_1.handleRPCError)(e);
609
+ }
610
+ };
611
+ /**
612
+ * Gets comprehensive proposal data including proposals, scores, and votes for a specific day
613
+ * @param day - Optional day to query (defaults to current day - 1)
614
+ * @param limit - Maximum number of results per query
615
+ * @returns Object containing proposals, scores, and votes for the day
616
+ */
617
+ getDayActivity = async ({ day, limit = 100, } = {}) => {
618
+ try {
619
+ const queryDay = day ?? (await this.getCurrentDay()) - 1n;
620
+ const [proposals, votes, reposts] = await Promise.all([
621
+ this.getDailyProposals({ day: queryDay, limit }),
622
+ this.getDailyVotes({ day: queryDay, limit }),
623
+ this.getRepostsByAddress({ day: queryDay, limit }),
624
+ ]);
625
+ return {
626
+ day: queryDay,
627
+ proposals,
628
+ votes,
629
+ reposts,
630
+ proposalCount: proposals.length,
631
+ voteCount: votes.length,
632
+ repostCount: reposts.length,
633
+ };
634
+ }
635
+ catch (e) {
636
+ throw await (0, index_1.handleRPCError)(e);
637
+ }
638
+ };
639
+ /**
640
+ * Gets comprehensive user activity data
641
+ * @param user - User address to query
642
+ * @param limit - Maximum number of results per query
643
+ * @returns Object containing user's proposals, votes, reposts, and claims
644
+ */
645
+ getUserActivity = async ({ user, limit = 100 }) => {
646
+ try {
647
+ const [proposals, votes, reposts, claims, userInfo] = await Promise.all([
648
+ this.getProposalsByAddress({ proposer: user, limit }),
649
+ this.getVotesByAddress({ participant: user, limit }),
650
+ this.getRepostsByAddress({ reposter: user, limit }),
651
+ this.getClaimHistory({ user, limit }),
652
+ this.getUserInfo(user),
653
+ ]);
654
+ return {
655
+ user,
656
+ userInfo,
657
+ proposals,
658
+ votes,
659
+ reposts,
660
+ claims,
661
+ proposalCount: proposals.length,
662
+ voteCount: votes.length,
663
+ repostCount: reposts.length,
664
+ claimCount: claims.length,
665
+ };
666
+ }
667
+ catch (e) {
668
+ throw await (0, index_1.handleRPCError)(e);
669
+ }
670
+ };
671
+ /**
672
+ * Gets aggregated proposal scores from voting events
673
+ * @param day - Optional day to filter votes
674
+ * @param limit - Maximum number of voting events to fetch
675
+ * @returns Map of proposal hashes to their total support scores
676
+ */
677
+ getProposalScores = async ({ day, limit = 1000, } = {}) => {
678
+ try {
679
+ const votes = await this.getVotesByAddress({
680
+ day,
681
+ limit,
682
+ });
683
+ // Aggregate votes by proposal
684
+ const proposalScores = new Map();
685
+ votes.forEach((vote) => {
686
+ // Each vote event has proposal and amount directly
687
+ const proposalHash = vote.proposal;
688
+ const amount = vote.amount || BigInt(0);
689
+ const currentScore = proposalScores.get(proposalHash) || BigInt(0);
690
+ proposalScores.set(proposalHash, currentScore + amount);
691
+ });
692
+ // Convert to array and sort by score
693
+ const sortedScores = Array.from(proposalScores.entries())
694
+ .map(([proposal, score]) => ({
695
+ proposal,
696
+ score,
697
+ stars: Math.floor(Number(score)), // Direct token count as stars
698
+ }))
699
+ .sort((a, b) => Number(b.score - a.score));
700
+ return sortedScores;
701
+ }
702
+ catch (e) {
703
+ throw await (0, index_1.handleRPCError)(e);
704
+ }
705
+ };
706
+ /**
707
+ * Gets the score for a specific proposal
708
+ * @param proposalHash - The hash of the proposal
709
+ * @param day - Optional day to filter votes
710
+ * @returns Total support score for the proposal
711
+ */
712
+ getProposalScore = async (proposalHash, day) => {
713
+ try {
714
+ const scores = await this.getProposalScores({ day });
715
+ const proposalScore = scores.find((s) => s.proposal === proposalHash);
716
+ return {
717
+ proposal: proposalHash,
718
+ score: proposalScore?.score || BigInt(0),
719
+ stars: proposalScore?.stars || 0,
720
+ };
721
+ }
722
+ catch (e) {
723
+ throw await (0, index_1.handleRPCError)(e);
724
+ }
725
+ };
726
+ }
727
+ exports.default = InstanceUBI;
728
+ //# sourceMappingURL=InstanceUBI.js.map