@opendatalabs/vana-sdk 0.1.0-alpha.eebb656 → 0.1.0-alpha.ef15099

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 (545) hide show
  1. package/README.md +67 -351
  2. package/dist/browser.cjs.map +1 -1
  3. package/dist/browser.d.ts +33 -1
  4. package/dist/browser.js.map +1 -1
  5. package/dist/chains/definitions.cjs +9 -6
  6. package/dist/chains/definitions.cjs.map +1 -1
  7. package/dist/chains/definitions.d.ts +2 -0
  8. package/dist/chains/definitions.js +9 -6
  9. package/dist/chains/definitions.js.map +1 -1
  10. package/dist/chains/index.cjs.map +1 -1
  11. package/dist/chains/index.d.ts +30 -1
  12. package/dist/chains/index.js.map +1 -1
  13. package/dist/client/enhancedResponse.cjs +164 -0
  14. package/dist/client/enhancedResponse.cjs.map +1 -0
  15. package/dist/client/enhancedResponse.d.ts +120 -0
  16. package/dist/client/enhancedResponse.js +138 -0
  17. package/dist/client/enhancedResponse.js.map +1 -0
  18. package/dist/config/chains.cjs.map +1 -1
  19. package/dist/config/chains.d.ts +99 -0
  20. package/dist/config/chains.js.map +1 -1
  21. package/dist/config/contracts.config.cjs +400 -0
  22. package/dist/config/contracts.config.cjs.map +1 -0
  23. package/dist/config/contracts.config.d.ts +84 -0
  24. package/dist/config/contracts.config.js +375 -0
  25. package/dist/config/contracts.config.js.map +1 -0
  26. package/dist/config/default-services.cjs +60 -0
  27. package/dist/config/default-services.cjs.map +1 -0
  28. package/dist/config/default-services.d.ts +46 -0
  29. package/dist/config/default-services.js +33 -0
  30. package/dist/config/default-services.js.map +1 -0
  31. package/dist/config/default-services.test.d.ts +1 -0
  32. package/dist/contracts/contractController.cjs +1 -1
  33. package/dist/contracts/contractController.cjs.map +1 -1
  34. package/dist/contracts/contractController.d.ts +66 -10
  35. package/dist/contracts/contractController.js +1 -1
  36. package/dist/contracts/contractController.js.map +1 -1
  37. package/dist/controllers/__tests__/data-consistency-integration.test.d.ts +7 -0
  38. package/dist/controllers/__tests__/operations.processQueue.test.d.ts +1 -0
  39. package/dist/controllers/accessSettlement.cjs +289 -0
  40. package/dist/controllers/accessSettlement.cjs.map +1 -0
  41. package/dist/controllers/accessSettlement.d.ts +157 -0
  42. package/dist/controllers/accessSettlement.js +265 -0
  43. package/dist/controllers/accessSettlement.js.map +1 -0
  44. package/dist/controllers/accessSettlement.test.d.ts +1 -0
  45. package/dist/controllers/base.cjs +116 -0
  46. package/dist/controllers/base.cjs.map +1 -0
  47. package/dist/controllers/base.d.ts +94 -0
  48. package/dist/controllers/base.js +92 -0
  49. package/dist/controllers/base.js.map +1 -0
  50. package/dist/controllers/data.cjs +634 -352
  51. package/dist/controllers/data.cjs.map +1 -1
  52. package/dist/controllers/data.d.ts +348 -213
  53. package/dist/controllers/data.js +647 -355
  54. package/dist/controllers/data.js.map +1 -1
  55. package/dist/controllers/operations.cjs +430 -0
  56. package/dist/controllers/operations.cjs.map +1 -0
  57. package/dist/controllers/operations.d.ts +229 -0
  58. package/dist/controllers/operations.js +406 -0
  59. package/dist/controllers/operations.js.map +1 -0
  60. package/dist/controllers/permissions.cjs +943 -443
  61. package/dist/controllers/permissions.cjs.map +1 -1
  62. package/dist/controllers/permissions.d.ts +201 -120
  63. package/dist/controllers/permissions.js +943 -443
  64. package/dist/controllers/permissions.js.map +1 -1
  65. package/dist/controllers/protocol.cjs +14 -10
  66. package/dist/controllers/protocol.cjs.map +1 -1
  67. package/dist/controllers/protocol.d.ts +30 -31
  68. package/dist/controllers/protocol.js +14 -10
  69. package/dist/controllers/protocol.js.map +1 -1
  70. package/dist/controllers/runtimePermissions.cjs +272 -0
  71. package/dist/controllers/runtimePermissions.cjs.map +1 -0
  72. package/dist/controllers/runtimePermissions.d.ts +152 -0
  73. package/dist/controllers/runtimePermissions.js +251 -0
  74. package/dist/controllers/runtimePermissions.js.map +1 -0
  75. package/dist/controllers/runtimePermissions.test.d.ts +1 -0
  76. package/dist/controllers/schemas.cjs +113 -43
  77. package/dist/controllers/schemas.cjs.map +1 -1
  78. package/dist/controllers/schemas.d.ts +90 -43
  79. package/dist/controllers/schemas.js +113 -43
  80. package/dist/controllers/schemas.js.map +1 -1
  81. package/dist/controllers/server.cjs +276 -60
  82. package/dist/controllers/server.cjs.map +1 -1
  83. package/dist/controllers/server.d.ts +159 -54
  84. package/dist/controllers/server.js +276 -60
  85. package/dist/controllers/server.js.map +1 -1
  86. package/dist/core/__tests__/health.test.d.ts +1 -0
  87. package/dist/core/__tests__/inMemoryNonceManager.test.d.ts +1 -0
  88. package/dist/core/__tests__/nonceManager.test.d.ts +1 -0
  89. package/dist/core/__tests__/pollingManager.test.d.ts +4 -0
  90. package/dist/core/apiClient.cjs +53 -3
  91. package/dist/core/apiClient.cjs.map +1 -1
  92. package/dist/core/apiClient.d.ts +132 -7
  93. package/dist/core/apiClient.js +53 -3
  94. package/dist/core/apiClient.js.map +1 -1
  95. package/dist/core/generics.cjs +30 -3
  96. package/dist/core/generics.cjs.map +1 -1
  97. package/dist/core/generics.d.ts +95 -6
  98. package/dist/core/generics.js +30 -3
  99. package/dist/core/generics.js.map +1 -1
  100. package/dist/core/health.cjs +289 -0
  101. package/dist/core/health.cjs.map +1 -0
  102. package/dist/core/health.d.ts +143 -0
  103. package/dist/core/health.js +265 -0
  104. package/dist/core/health.js.map +1 -0
  105. package/dist/core/inMemoryNonceManager.cjs +138 -0
  106. package/dist/core/inMemoryNonceManager.cjs.map +1 -0
  107. package/dist/core/inMemoryNonceManager.d.ts +69 -0
  108. package/dist/core/inMemoryNonceManager.js +114 -0
  109. package/dist/core/inMemoryNonceManager.js.map +1 -0
  110. package/dist/core/nonceManager.cjs +304 -0
  111. package/dist/core/nonceManager.cjs.map +1 -0
  112. package/dist/core/nonceManager.d.ts +116 -0
  113. package/dist/core/nonceManager.js +280 -0
  114. package/dist/core/nonceManager.js.map +1 -0
  115. package/dist/core/pollingManager.cjs +292 -0
  116. package/dist/core/pollingManager.cjs.map +1 -0
  117. package/dist/core/pollingManager.d.ts +120 -0
  118. package/dist/core/pollingManager.js +268 -0
  119. package/dist/core/pollingManager.js.map +1 -0
  120. package/dist/core.cjs +164 -36
  121. package/dist/core.cjs.map +1 -1
  122. package/dist/core.d.ts +69 -10
  123. package/dist/core.js +167 -37
  124. package/dist/core.js.map +1 -1
  125. package/dist/crypto/ecies/__tests__/constants.test.d.ts +1 -1
  126. package/dist/crypto/ecies/__tests__/interface.test.d.ts +1 -0
  127. package/dist/crypto/ecies/__tests__/serialization.test.d.ts +8 -0
  128. package/dist/crypto/ecies/__tests__/utils.test.d.ts +1 -0
  129. package/dist/crypto/ecies/base.cjs +59 -23
  130. package/dist/crypto/ecies/base.cjs.map +1 -1
  131. package/dist/crypto/ecies/base.js +59 -23
  132. package/dist/crypto/ecies/base.js.map +1 -1
  133. package/dist/crypto/ecies/constants.cjs +2 -10
  134. package/dist/crypto/ecies/constants.cjs.map +1 -1
  135. package/dist/crypto/ecies/constants.d.ts +0 -9
  136. package/dist/crypto/ecies/constants.js +1 -8
  137. package/dist/crypto/ecies/constants.js.map +1 -1
  138. package/dist/crypto/ecies/interface.cjs +19 -2
  139. package/dist/crypto/ecies/interface.cjs.map +1 -1
  140. package/dist/crypto/ecies/interface.js +19 -2
  141. package/dist/crypto/ecies/interface.js.map +1 -1
  142. package/dist/errors.cjs +45 -0
  143. package/dist/errors.cjs.map +1 -1
  144. package/dist/errors.d.ts +104 -0
  145. package/dist/errors.js +43 -0
  146. package/dist/errors.js.map +1 -1
  147. package/dist/generated/abi/AccessSettlementImplementation.cjs +635 -0
  148. package/dist/generated/abi/AccessSettlementImplementation.cjs.map +1 -0
  149. package/dist/generated/abi/AccessSettlementImplementation.d.ts +468 -0
  150. package/dist/generated/abi/AccessSettlementImplementation.js +611 -0
  151. package/dist/generated/abi/AccessSettlementImplementation.js.map +1 -0
  152. package/dist/generated/abi/AttestationPolicyImplementation.cjs +614 -0
  153. package/dist/generated/abi/AttestationPolicyImplementation.cjs.map +1 -0
  154. package/dist/generated/abi/AttestationPolicyImplementation.d.ts +449 -0
  155. package/dist/generated/abi/AttestationPolicyImplementation.js +590 -0
  156. package/dist/generated/abi/AttestationPolicyImplementation.js.map +1 -0
  157. package/dist/generated/abi/ComputeEngineImplementation.cjs.map +1 -1
  158. package/dist/generated/abi/ComputeEngineImplementation.js.map +1 -1
  159. package/dist/generated/abi/{DLPTreasuryImplementation.cjs → ComputeEngineTreasuryImplementation.cjs} +16 -92
  160. package/dist/generated/abi/ComputeEngineTreasuryImplementation.cjs.map +1 -0
  161. package/dist/generated/abi/{DLPTreasuryImplementation.d.ts → ComputeEngineTreasuryImplementation.d.ts} +9 -67
  162. package/dist/generated/abi/{DLPTreasuryImplementation.js → ComputeEngineTreasuryImplementation.js} +12 -88
  163. package/dist/generated/abi/ComputeEngineTreasuryImplementation.js.map +1 -0
  164. package/dist/generated/abi/ComputeInstructionRegistryImplementation.cjs.map +1 -1
  165. package/dist/generated/abi/ComputeInstructionRegistryImplementation.js.map +1 -1
  166. package/dist/generated/abi/DATFactoryImplementation.cjs.map +1 -1
  167. package/dist/generated/abi/DATFactoryImplementation.js.map +1 -1
  168. package/dist/generated/abi/DATImplementation.cjs.map +1 -1
  169. package/dist/generated/abi/DATImplementation.js.map +1 -1
  170. package/dist/generated/abi/DATPausableImplementation.cjs.map +1 -1
  171. package/dist/generated/abi/DATPausableImplementation.js.map +1 -1
  172. package/dist/generated/abi/DATVotesImplementation.cjs.map +1 -1
  173. package/dist/generated/abi/DATVotesImplementation.js.map +1 -1
  174. package/dist/generated/abi/DLPPerformanceImplementation.cjs +42 -0
  175. package/dist/generated/abi/DLPPerformanceImplementation.cjs.map +1 -1
  176. package/dist/generated/abi/DLPPerformanceImplementation.d.ts +32 -0
  177. package/dist/generated/abi/DLPPerformanceImplementation.js +42 -0
  178. package/dist/generated/abi/DLPPerformanceImplementation.js.map +1 -1
  179. package/dist/generated/abi/DLPRegistryImplementation.cjs +5 -5
  180. package/dist/generated/abi/DLPRegistryImplementation.cjs.map +1 -1
  181. package/dist/generated/abi/DLPRegistryImplementation.d.ts +4 -4
  182. package/dist/generated/abi/DLPRegistryImplementation.js +5 -5
  183. package/dist/generated/abi/DLPRegistryImplementation.js.map +1 -1
  184. package/dist/generated/abi/DLPRegistryTreasuryImplementation.cjs.map +1 -1
  185. package/dist/generated/abi/DLPRegistryTreasuryImplementation.js.map +1 -1
  186. package/dist/generated/abi/DLPRewardDeployerImplementation.cjs +166 -2
  187. package/dist/generated/abi/DLPRewardDeployerImplementation.cjs.map +1 -1
  188. package/dist/generated/abi/DLPRewardDeployerImplementation.d.ts +129 -2
  189. package/dist/generated/abi/DLPRewardDeployerImplementation.js +166 -2
  190. package/dist/generated/abi/DLPRewardDeployerImplementation.js.map +1 -1
  191. package/dist/generated/abi/DLPRewardSwapImplementation.cjs.map +1 -1
  192. package/dist/generated/abi/DLPRewardSwapImplementation.js.map +1 -1
  193. package/dist/generated/abi/DataLiquidityPoolImplementation.cjs +282 -100
  194. package/dist/generated/abi/DataLiquidityPoolImplementation.cjs.map +1 -1
  195. package/dist/generated/abi/DataLiquidityPoolImplementation.d.ts +218 -79
  196. package/dist/generated/abi/DataLiquidityPoolImplementation.js +281 -99
  197. package/dist/generated/abi/DataLiquidityPoolImplementation.js.map +1 -1
  198. package/dist/generated/abi/DataPortabilityGranteesImplementation.cjs +167 -19
  199. package/dist/generated/abi/DataPortabilityGranteesImplementation.cjs.map +1 -1
  200. package/dist/generated/abi/DataPortabilityGranteesImplementation.d.ts +127 -14
  201. package/dist/generated/abi/DataPortabilityGranteesImplementation.js +167 -19
  202. package/dist/generated/abi/DataPortabilityGranteesImplementation.js.map +1 -1
  203. package/dist/generated/abi/DataPortabilityPermissionsImplementation.cjs +0 -19
  204. package/dist/generated/abi/DataPortabilityPermissionsImplementation.cjs.map +1 -1
  205. package/dist/generated/abi/DataPortabilityPermissionsImplementation.d.ts +0 -14
  206. package/dist/generated/abi/DataPortabilityPermissionsImplementation.js +0 -19
  207. package/dist/generated/abi/DataPortabilityPermissionsImplementation.js.map +1 -1
  208. package/dist/generated/abi/DataPortabilityServersImplementation.cjs +0 -19
  209. package/dist/generated/abi/DataPortabilityServersImplementation.cjs.map +1 -1
  210. package/dist/generated/abi/DataPortabilityServersImplementation.d.ts +0 -14
  211. package/dist/generated/abi/DataPortabilityServersImplementation.js +0 -19
  212. package/dist/generated/abi/DataPortabilityServersImplementation.js.map +1 -1
  213. package/dist/generated/abi/DataRefinerRegistryImplementation.cjs.map +1 -1
  214. package/dist/generated/abi/DataRefinerRegistryImplementation.js.map +1 -1
  215. package/dist/generated/abi/DataRegistryImplementation.cjs +0 -13
  216. package/dist/generated/abi/DataRegistryImplementation.cjs.map +1 -1
  217. package/dist/generated/abi/DataRegistryImplementation.d.ts +0 -10
  218. package/dist/generated/abi/DataRegistryImplementation.js +0 -13
  219. package/dist/generated/abi/DataRegistryImplementation.js.map +1 -1
  220. package/dist/generated/abi/DatasetRegistryImplementation.cjs +751 -0
  221. package/dist/generated/abi/DatasetRegistryImplementation.cjs.map +1 -0
  222. package/dist/generated/abi/DatasetRegistryImplementation.d.ts +557 -0
  223. package/dist/generated/abi/DatasetRegistryImplementation.js +727 -0
  224. package/dist/generated/abi/DatasetRegistryImplementation.js.map +1 -0
  225. package/dist/generated/abi/ProtocolConfigImplementation.cjs +578 -0
  226. package/dist/generated/abi/ProtocolConfigImplementation.cjs.map +1 -0
  227. package/dist/generated/abi/ProtocolConfigImplementation.d.ts +423 -0
  228. package/dist/generated/abi/ProtocolConfigImplementation.js +554 -0
  229. package/dist/generated/abi/ProtocolConfigImplementation.js.map +1 -0
  230. package/dist/generated/abi/QueryEngineImplementation.cjs.map +1 -1
  231. package/dist/generated/abi/QueryEngineImplementation.js.map +1 -1
  232. package/dist/generated/abi/SwapHelperImplementation.cjs +0 -43
  233. package/dist/generated/abi/SwapHelperImplementation.cjs.map +1 -1
  234. package/dist/generated/abi/SwapHelperImplementation.d.ts +0 -35
  235. package/dist/generated/abi/SwapHelperImplementation.js +0 -43
  236. package/dist/generated/abi/SwapHelperImplementation.js.map +1 -1
  237. package/dist/generated/abi/TeePoolDedicatedGpuImplementation.cjs.map +1 -1
  238. package/dist/generated/abi/TeePoolDedicatedGpuImplementation.js.map +1 -1
  239. package/dist/generated/abi/TeePoolDedicatedStandardImplementation.cjs.map +1 -1
  240. package/dist/generated/abi/TeePoolDedicatedStandardImplementation.js.map +1 -1
  241. package/dist/generated/abi/TeePoolEphemeralStandardImplementation.cjs.map +1 -1
  242. package/dist/generated/abi/TeePoolEphemeralStandardImplementation.js.map +1 -1
  243. package/dist/generated/abi/TeePoolPersistentGpuImplementation.cjs.map +1 -1
  244. package/dist/generated/abi/TeePoolPersistentGpuImplementation.js.map +1 -1
  245. package/dist/generated/abi/TeePoolPersistentStandardImplementation.cjs.map +1 -1
  246. package/dist/generated/abi/TeePoolPersistentStandardImplementation.js.map +1 -1
  247. package/dist/generated/abi/TeePoolPhalaImplementation.cjs.map +1 -1
  248. package/dist/generated/abi/TeePoolPhalaImplementation.js.map +1 -1
  249. package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.cjs +1251 -0
  250. package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.cjs.map +1 -0
  251. package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.d.ts +948 -0
  252. package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.js +1227 -0
  253. package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.js.map +1 -0
  254. package/dist/generated/abi/UniswapV3QuoterV2Implementation.cjs +297 -0
  255. package/dist/generated/abi/UniswapV3QuoterV2Implementation.cjs.map +1 -0
  256. package/dist/generated/abi/UniswapV3QuoterV2Implementation.d.ts +206 -0
  257. package/dist/generated/abi/UniswapV3QuoterV2Implementation.js +273 -0
  258. package/dist/generated/abi/UniswapV3QuoterV2Implementation.js.map +1 -0
  259. package/dist/generated/abi/VanaEpochImplementation.cjs +195 -0
  260. package/dist/generated/abi/VanaEpochImplementation.cjs.map +1 -1
  261. package/dist/generated/abi/VanaEpochImplementation.d.ts +151 -0
  262. package/dist/generated/abi/VanaEpochImplementation.js +195 -0
  263. package/dist/generated/abi/VanaEpochImplementation.js.map +1 -1
  264. package/dist/generated/abi/VanaPoolEntityImplementation.cjs +22 -65
  265. package/dist/generated/abi/VanaPoolEntityImplementation.cjs.map +1 -1
  266. package/dist/generated/abi/VanaPoolEntityImplementation.d.ts +17 -51
  267. package/dist/generated/abi/VanaPoolEntityImplementation.js +22 -65
  268. package/dist/generated/abi/VanaPoolEntityImplementation.js.map +1 -1
  269. package/dist/generated/abi/VanaPoolStakingImplementation.cjs +113 -1
  270. package/dist/generated/abi/VanaPoolStakingImplementation.cjs.map +1 -1
  271. package/dist/generated/abi/VanaPoolStakingImplementation.d.ts +85 -1
  272. package/dist/generated/abi/VanaPoolStakingImplementation.js +113 -1
  273. package/dist/generated/abi/VanaPoolStakingImplementation.js.map +1 -1
  274. package/dist/generated/abi/VanaPoolTreasuryImplementation.cjs.map +1 -1
  275. package/dist/generated/abi/VanaPoolTreasuryImplementation.js.map +1 -1
  276. package/dist/generated/abi/VanaRuntimePermissionsImplementation.cjs +759 -0
  277. package/dist/generated/abi/VanaRuntimePermissionsImplementation.cjs.map +1 -0
  278. package/dist/generated/abi/VanaRuntimePermissionsImplementation.d.ts +563 -0
  279. package/dist/generated/abi/VanaRuntimePermissionsImplementation.js +735 -0
  280. package/dist/generated/abi/VanaRuntimePermissionsImplementation.js.map +1 -0
  281. package/dist/generated/abi/VanaRuntimeServersImplementation.cjs +820 -0
  282. package/dist/generated/abi/VanaRuntimeServersImplementation.cjs.map +1 -0
  283. package/dist/generated/abi/VanaRuntimeServersImplementation.d.ts +609 -0
  284. package/dist/generated/abi/VanaRuntimeServersImplementation.js +796 -0
  285. package/dist/generated/abi/VanaRuntimeServersImplementation.js.map +1 -0
  286. package/dist/generated/abi/VanaTreasuryImplementation.cjs +536 -0
  287. package/dist/generated/abi/VanaTreasuryImplementation.cjs.map +1 -0
  288. package/dist/generated/abi/VanaTreasuryImplementation.d.ts +393 -0
  289. package/dist/generated/abi/VanaTreasuryImplementation.js +512 -0
  290. package/dist/generated/abi/VanaTreasuryImplementation.js.map +1 -0
  291. package/dist/generated/abi/WVANAImplementation.cjs +339 -0
  292. package/dist/generated/abi/WVANAImplementation.cjs.map +1 -0
  293. package/dist/generated/abi/WVANAImplementation.d.ts +244 -0
  294. package/dist/generated/abi/WVANAImplementation.js +315 -0
  295. package/dist/generated/abi/WVANAImplementation.js.map +1 -0
  296. package/dist/generated/abi/index.cjs +79 -47
  297. package/dist/generated/abi/index.cjs.map +1 -1
  298. package/dist/generated/abi/index.d.ts +15783 -10449
  299. package/dist/generated/abi/index.js +65 -43
  300. package/dist/generated/abi/index.js.map +1 -1
  301. package/dist/{config → generated}/addresses.cjs +174 -75
  302. package/dist/generated/addresses.cjs.map +1 -0
  303. package/dist/{config → generated}/addresses.d.ts +174 -165
  304. package/dist/{config → generated}/addresses.js +174 -75
  305. package/dist/generated/addresses.js.map +1 -0
  306. package/dist/generated/event-types.cjs.map +1 -1
  307. package/dist/generated/event-types.d.ts +482 -399
  308. package/dist/generated/eventRegistry.cjs +2601 -724
  309. package/dist/generated/eventRegistry.cjs.map +1 -1
  310. package/dist/generated/eventRegistry.d.ts +2 -2
  311. package/dist/generated/eventRegistry.js +2601 -724
  312. package/dist/generated/eventRegistry.js.map +1 -1
  313. package/dist/generated/server/server-exports.cjs +22 -0
  314. package/dist/generated/server/server-exports.cjs.map +1 -1
  315. package/dist/generated/server/server-exports.d.ts +31 -11
  316. package/dist/generated/server/server-exports.js +17 -0
  317. package/dist/generated/server/server-exports.js.map +1 -1
  318. package/dist/generated/server/server.cjs.map +1 -1
  319. package/dist/generated/server/server.d.ts +771 -402
  320. package/dist/generated/subgraph.cjs +797 -32
  321. package/dist/generated/subgraph.cjs.map +1 -1
  322. package/dist/generated/subgraph.d.ts +135 -0
  323. package/dist/generated/subgraph.js +792 -32
  324. package/dist/generated/subgraph.js.map +1 -1
  325. package/dist/index.browser.d.ts +6 -1
  326. package/dist/index.browser.js +26 -1
  327. package/dist/index.browser.js.map +1 -1
  328. package/dist/index.cjs.map +1 -1
  329. package/dist/index.js.map +1 -1
  330. package/dist/index.node.cjs +47 -4
  331. package/dist/index.node.cjs.map +1 -1
  332. package/dist/index.node.d.ts +60 -14
  333. package/dist/index.node.js +42 -3
  334. package/dist/index.node.js.map +1 -1
  335. package/dist/lib/__tests__/redisAtomicStore.test.d.ts +1 -0
  336. package/dist/lib/redisAtomicStore.cjs +201 -0
  337. package/dist/lib/redisAtomicStore.cjs.map +1 -0
  338. package/dist/lib/redisAtomicStore.d.ts +120 -0
  339. package/dist/lib/redisAtomicStore.js +177 -0
  340. package/dist/lib/redisAtomicStore.js.map +1 -0
  341. package/dist/node.cjs.map +1 -1
  342. package/dist/node.d.ts +39 -1
  343. package/dist/node.js.map +1 -1
  344. package/dist/platform/browser.cjs +160 -2
  345. package/dist/platform/browser.cjs.map +1 -1
  346. package/dist/platform/browser.d.ts +232 -12
  347. package/dist/platform/browser.js +160 -2
  348. package/dist/platform/browser.js.map +1 -1
  349. package/dist/platform/interface.cjs.map +1 -1
  350. package/dist/platform/interface.d.ts +283 -90
  351. package/dist/platform/node.cjs +163 -2
  352. package/dist/platform/node.cjs.map +1 -1
  353. package/dist/platform/node.d.ts +69 -6
  354. package/dist/platform/node.js +163 -2
  355. package/dist/platform/node.js.map +1 -1
  356. package/dist/server/relayerHandler.cjs +452 -0
  357. package/dist/server/relayerHandler.cjs.map +1 -0
  358. package/dist/server/relayerHandler.d.ts +69 -0
  359. package/dist/server/relayerHandler.js +428 -0
  360. package/dist/server/relayerHandler.js.map +1 -0
  361. package/dist/storage/index.cjs +3 -0
  362. package/dist/storage/index.cjs.map +1 -1
  363. package/dist/storage/index.d.ts +1 -0
  364. package/dist/storage/index.js +2 -0
  365. package/dist/storage/index.js.map +1 -1
  366. package/dist/storage/manager.cjs +108 -25
  367. package/dist/storage/manager.cjs.map +1 -1
  368. package/dist/storage/manager.d.ts +119 -25
  369. package/dist/storage/manager.js +108 -25
  370. package/dist/storage/manager.js.map +1 -1
  371. package/dist/storage/providers/callback-storage.cjs +86 -15
  372. package/dist/storage/providers/callback-storage.cjs.map +1 -1
  373. package/dist/storage/providers/callback-storage.d.ts +109 -20
  374. package/dist/storage/providers/callback-storage.js +86 -15
  375. package/dist/storage/providers/callback-storage.js.map +1 -1
  376. package/dist/storage/providers/dropbox.cjs +237 -0
  377. package/dist/storage/providers/dropbox.cjs.map +1 -0
  378. package/dist/storage/providers/dropbox.d.ts +39 -0
  379. package/dist/storage/providers/dropbox.js +215 -0
  380. package/dist/storage/providers/dropbox.js.map +1 -0
  381. package/dist/storage/providers/dropbox.test.d.ts +1 -0
  382. package/dist/storage/providers/pinata.cjs.map +1 -1
  383. package/dist/storage/providers/pinata.d.ts +12 -14
  384. package/dist/storage/providers/pinata.js.map +1 -1
  385. package/dist/tests/data-upload-owner-validation.test.d.ts +1 -0
  386. package/dist/tests/factories/mockFactory.d.ts +6 -6
  387. package/dist/tests/fakes/FakeWaitForTransactionEvents.d.ts +2 -2
  388. package/dist/tests/permissions-revoke-relayer.test.d.ts +1 -0
  389. package/dist/tests/permissions-transaction-options.test.d.ts +1 -0
  390. package/dist/tests/read-only-mode.test.d.ts +1 -0
  391. package/dist/tests/relayer-integration.test.d.ts +1 -0
  392. package/dist/tests/relayer-unified.test.d.ts +1 -0
  393. package/dist/tests/server-relayer-handler.test.d.ts +1 -0
  394. package/dist/types/accessSettlement.cjs +17 -0
  395. package/dist/types/accessSettlement.cjs.map +1 -0
  396. package/dist/types/accessSettlement.d.ts +66 -0
  397. package/dist/types/accessSettlement.js +1 -0
  398. package/dist/types/accessSettlement.js.map +1 -0
  399. package/dist/types/atomicStore.cjs +31 -0
  400. package/dist/types/atomicStore.cjs.map +1 -0
  401. package/dist/types/atomicStore.d.ts +236 -0
  402. package/dist/types/atomicStore.js +7 -0
  403. package/dist/types/atomicStore.js.map +1 -0
  404. package/dist/types/blockchain.cjs.map +1 -1
  405. package/dist/types/blockchain.d.ts +39 -11
  406. package/dist/types/chains.cjs.map +1 -1
  407. package/dist/types/chains.d.ts +74 -7
  408. package/dist/types/chains.js.map +1 -1
  409. package/dist/types/config.cjs +10 -0
  410. package/dist/types/config.cjs.map +1 -1
  411. package/dist/types/config.d.ts +217 -220
  412. package/dist/types/config.js +8 -0
  413. package/dist/types/config.js.map +1 -1
  414. package/dist/types/contracts.cjs.map +1 -1
  415. package/dist/types/contracts.d.ts +71 -7
  416. package/dist/types/controller-context.cjs.map +1 -1
  417. package/dist/types/controller-context.d.ts +12 -6
  418. package/dist/types/data.cjs.map +1 -1
  419. package/dist/types/data.d.ts +82 -10
  420. package/dist/types/generics.cjs.map +1 -1
  421. package/dist/types/generics.d.ts +81 -10
  422. package/dist/types/index.cjs +4 -0
  423. package/dist/types/index.cjs.map +1 -1
  424. package/dist/types/index.d.ts +36 -6
  425. package/dist/types/index.js +9 -1
  426. package/dist/types/index.js.map +1 -1
  427. package/dist/types/operationStore.cjs +17 -0
  428. package/dist/types/operationStore.cjs.map +1 -0
  429. package/dist/types/operationStore.d.ts +171 -0
  430. package/dist/types/operationStore.js +1 -0
  431. package/dist/types/operationStore.js.map +1 -0
  432. package/dist/types/operations.cjs +3 -15
  433. package/dist/types/operations.cjs.map +1 -1
  434. package/dist/types/operations.d.ts +131 -39
  435. package/dist/types/operations.js +2 -13
  436. package/dist/types/operations.js.map +1 -1
  437. package/dist/types/options.cjs +17 -0
  438. package/dist/types/options.cjs.map +1 -0
  439. package/dist/types/options.d.ts +308 -0
  440. package/dist/types/options.js +1 -0
  441. package/dist/types/options.js.map +1 -0
  442. package/dist/types/permissions.cjs.map +1 -1
  443. package/dist/types/permissions.d.ts +19 -20
  444. package/dist/types/personal.cjs.map +1 -1
  445. package/dist/types/personal.d.ts +150 -14
  446. package/dist/types/relayer.cjs.map +1 -1
  447. package/dist/types/relayer.d.ts +307 -35
  448. package/dist/types/runtimePermissions.cjs +17 -0
  449. package/dist/types/runtimePermissions.cjs.map +1 -0
  450. package/dist/types/runtimePermissions.d.ts +122 -0
  451. package/dist/types/runtimePermissions.js +1 -0
  452. package/dist/types/runtimePermissions.js.map +1 -0
  453. package/dist/types/storage.cjs.map +1 -1
  454. package/dist/types/storage.d.ts +9 -21
  455. package/dist/types/storage.js.map +1 -1
  456. package/dist/types/utils.cjs.map +1 -1
  457. package/dist/types/utils.d.ts +0 -45
  458. package/dist/utils/__tests__/chainQuery.test.d.ts +1 -0
  459. package/dist/utils/__tests__/subgraphConsistency.test.d.ts +4 -0
  460. package/dist/utils/__tests__/subgraphPagination.test.d.ts +4 -0
  461. package/dist/utils/blockchain/registry.cjs +3 -3
  462. package/dist/utils/blockchain/registry.cjs.map +1 -1
  463. package/dist/utils/blockchain/registry.d.ts +1 -1
  464. package/dist/utils/blockchain/registry.js +3 -3
  465. package/dist/utils/blockchain/registry.js.map +1 -1
  466. package/dist/utils/chainQuery.cjs +107 -0
  467. package/dist/utils/chainQuery.cjs.map +1 -0
  468. package/dist/utils/chainQuery.d.ts +31 -0
  469. package/dist/utils/chainQuery.js +82 -0
  470. package/dist/utils/chainQuery.js.map +1 -0
  471. package/dist/utils/grantFiles.cjs +4 -1
  472. package/dist/utils/grantFiles.cjs.map +1 -1
  473. package/dist/utils/grantFiles.d.ts +10 -20
  474. package/dist/utils/grantFiles.js +4 -1
  475. package/dist/utils/grantFiles.js.map +1 -1
  476. package/dist/utils/grantValidation.cjs.map +1 -1
  477. package/dist/utils/grantValidation.d.ts +95 -16
  478. package/dist/utils/grantValidation.js.map +1 -1
  479. package/dist/utils/grants.cjs.map +1 -1
  480. package/dist/utils/grants.d.ts +93 -12
  481. package/dist/utils/grants.js.map +1 -1
  482. package/dist/utils/ipfs.cjs +2 -4
  483. package/dist/utils/ipfs.cjs.map +1 -1
  484. package/dist/utils/ipfs.d.ts +1 -1
  485. package/dist/utils/ipfs.js +2 -4
  486. package/dist/utils/ipfs.js.map +1 -1
  487. package/dist/utils/lazy-import.cjs.map +1 -1
  488. package/dist/utils/lazy-import.d.ts +32 -7
  489. package/dist/utils/lazy-import.js.map +1 -1
  490. package/dist/utils/multicall.cjs +1 -1
  491. package/dist/utils/multicall.cjs.map +1 -1
  492. package/dist/utils/multicall.js +1 -1
  493. package/dist/utils/multicall.js.map +1 -1
  494. package/dist/utils/runtimeGrantFiles.cjs +84 -0
  495. package/dist/utils/runtimeGrantFiles.cjs.map +1 -0
  496. package/dist/utils/runtimeGrantFiles.d.ts +66 -0
  497. package/dist/utils/runtimeGrantFiles.js +58 -0
  498. package/dist/utils/runtimeGrantFiles.js.map +1 -0
  499. package/dist/utils/signatureCache.cjs +8 -2
  500. package/dist/utils/signatureCache.cjs.map +1 -1
  501. package/dist/utils/signatureCache.d.ts +49 -8
  502. package/dist/utils/signatureCache.js +8 -2
  503. package/dist/utils/signatureCache.js.map +1 -1
  504. package/dist/utils/subgraphConsistency.cjs +184 -0
  505. package/dist/utils/subgraphConsistency.cjs.map +1 -0
  506. package/dist/utils/subgraphConsistency.d.ts +65 -0
  507. package/dist/utils/subgraphConsistency.js +155 -0
  508. package/dist/utils/subgraphConsistency.js.map +1 -0
  509. package/dist/utils/subgraphMetaCache.cjs +101 -0
  510. package/dist/utils/subgraphMetaCache.cjs.map +1 -0
  511. package/dist/utils/subgraphMetaCache.d.ts +56 -0
  512. package/dist/utils/subgraphMetaCache.js +76 -0
  513. package/dist/utils/subgraphMetaCache.js.map +1 -0
  514. package/dist/utils/subgraphPagination.cjs +104 -0
  515. package/dist/utils/subgraphPagination.cjs.map +1 -0
  516. package/dist/utils/subgraphPagination.d.ts +78 -0
  517. package/dist/utils/subgraphPagination.js +78 -0
  518. package/dist/utils/subgraphPagination.js.map +1 -0
  519. package/dist/utils/transactionHelpers.cjs.map +1 -1
  520. package/dist/utils/transactionHelpers.d.ts +12 -12
  521. package/dist/utils/transactionHelpers.js.map +1 -1
  522. package/dist/utils/typedDataConverter.cjs.map +1 -1
  523. package/dist/utils/typedDataConverter.d.ts +39 -3
  524. package/dist/utils/typedDataConverter.js.map +1 -1
  525. package/dist/utils/urlResolver.cjs +7 -0
  526. package/dist/utils/urlResolver.cjs.map +1 -1
  527. package/dist/utils/urlResolver.d.ts +22 -4
  528. package/dist/utils/urlResolver.js +7 -0
  529. package/dist/utils/urlResolver.js.map +1 -1
  530. package/dist/utils/wallet.cjs +63 -0
  531. package/dist/utils/wallet.cjs.map +1 -0
  532. package/dist/utils/wallet.d.ts +94 -0
  533. package/dist/utils/wallet.js +37 -0
  534. package/dist/utils/wallet.js.map +1 -0
  535. package/package.json +7 -2
  536. package/dist/config/addresses.cjs.map +0 -1
  537. package/dist/config/addresses.js.map +0 -1
  538. package/dist/generated/abi/DLPTreasuryImplementation.cjs.map +0 -1
  539. package/dist/generated/abi/DLPTreasuryImplementation.js.map +0 -1
  540. package/dist/server/handler.cjs +0 -101
  541. package/dist/server/handler.cjs.map +0 -1
  542. package/dist/server/handler.d.ts +0 -87
  543. package/dist/server/handler.js +0 -77
  544. package/dist/server/handler.js.map +0 -1
  545. /package/dist/{tests/server-handler.test.d.ts → client/__tests__/enhancedResponse.test.d.ts} +0 -0
@@ -23,12 +23,15 @@ __export(protocol_exports, {
23
23
  module.exports = __toCommonJS(protocol_exports);
24
24
  var import_errors = require("../errors");
25
25
  var import_contractController = require("../contracts/contractController");
26
- class ProtocolController {
26
+ var import_base = require("./base");
27
+ class ProtocolController extends import_base.BaseController {
28
+ contractFactory;
27
29
  constructor(context) {
28
- this.context = context;
29
- this.contractFactory = new import_contractController.ContractFactory(context.walletClient);
30
+ super(context);
31
+ this.contractFactory = new import_contractController.ContractFactory(
32
+ context.walletClient ?? context.publicClient
33
+ );
30
34
  }
31
- contractFactory;
32
35
  /**
33
36
  * Retrieves the address and ABI for a specific Vana protocol contract.
34
37
  *
@@ -53,7 +56,7 @@ class ProtocolController {
53
56
  */
54
57
  getContract(contractName) {
55
58
  try {
56
- const chainId = this.context.walletClient.chain?.id;
59
+ const chainId = this.context.walletClient?.chain?.id ?? this.context.publicClient.chain?.id;
57
60
  if (!chainId) {
58
61
  throw new import_errors.ContractNotFoundError(contractName, 0);
59
62
  }
@@ -66,7 +69,7 @@ class ProtocolController {
66
69
  if (error.message.includes("Contract address not found")) {
67
70
  let chainId = 0;
68
71
  try {
69
- chainId = this.context.walletClient.chain?.id ?? 0;
72
+ chainId = this.context.walletClient?.chain?.id ?? this.context.publicClient.chain?.id ?? 0;
70
73
  } catch {
71
74
  chainId = 0;
72
75
  }
@@ -102,6 +105,7 @@ class ProtocolController {
102
105
  * ```
103
106
  */
104
107
  createContract(contractName) {
108
+ this.assertWallet();
105
109
  try {
106
110
  return (0, import_contractController.getContractController)(contractName, this.context.walletClient);
107
111
  } catch (error) {
@@ -152,9 +156,9 @@ class ProtocolController {
152
156
  * @throws {Error} When chain ID is not available from wallet client
153
157
  */
154
158
  getChainId() {
155
- const chainId = this.context.walletClient.chain?.id;
159
+ const chainId = this.context.walletClient?.chain?.id ?? this.context.publicClient.chain?.id;
156
160
  if (!chainId) {
157
- throw new Error("Chain ID not available from wallet client");
161
+ throw new Error("Chain ID not available from client");
158
162
  }
159
163
  return chainId;
160
164
  }
@@ -165,9 +169,9 @@ class ProtocolController {
165
169
  * @throws {Error} When chain name is not available from wallet client
166
170
  */
167
171
  getChainName() {
168
- const chainName = this.context.walletClient.chain?.name;
172
+ const chainName = this.context.walletClient?.chain?.name ?? this.context.publicClient.chain?.name;
169
173
  if (!chainName) {
170
- throw new Error("Chain name not available from wallet client");
174
+ throw new Error("Chain name not available from client");
171
175
  }
172
176
  return chainName;
173
177
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/controllers/protocol.ts"],"sourcesContent":["import type { ContractInfo, VanaChainId } from \"../types/index\";\nimport type { VanaContract, ContractAbis } from \"../generated/abi\";\nimport { ContractNotFoundError } from \"../errors\";\nimport {\n getContractController,\n getContractInfo,\n ContractFactory,\n} from \"../contracts/contractController\";\nimport type { ControllerContext } from \"./permissions\";\nimport type { GetContractReturnType } from \"viem\";\n\n/**\n * Provides direct, low-level access to all Vana protocol smart contracts.\n *\n * @remarks\n * This controller serves as the designated \"escape hatch\" for advanced developers who need\n * to interact directly with the underlying blockchain contracts. It provides access to\n * contract addresses, ABIs, and factory methods for creating typed contract instances.\n * Most developers should use the higher-level DataController and PermissionsController\n * instead of this advanced API.\n *\n * **Contract Selection:**\n * The controller automatically handles chain detection and provides only contracts that\n * are deployed on the current network. All contract instances are fully typed for\n * enhanced developer experience and type safety.\n *\n * **Method Selection:**\n * - `getContract()` retrieves contract address and ABI for manual interaction\n * - `createContract()` returns fully typed contract instance with read/write methods\n * - `getAvailableContracts()` lists all contracts deployed on current chain\n * - `isContractAvailable()` checks if specific contract exists on current chain\n * - `getChainId()` and `getChainName()` provide current network information\n *\n * **Usage Guidelines:**\n * Use this controller when high-level controllers don't provide needed functionality.\n * Most developers should use `vana.data.*` for files and `vana.permissions.*` for access control.\n *\n * **Type Safety:**\n * Use `as const` assertion with contract names for full TypeScript type inference.\n * Contract instances provide complete typing for all methods, parameters, and return values.\n *\n * @example\n * ```typescript\n * // Get contract info for direct interaction\n * const registry = vana.protocol.getContract(\"DataRegistry\" as const);\n *\n * // Access contract address and ABI with full typing\n * console.log(registry.address); // Contract address on current chain\n * console.log(registry.abi); // Fully typed contract ABI\n *\n * // Create a typed contract instance\n * const contract = vana.protocol.createContract(\"DataRegistry\" as const);\n * const fileCount = await contract.read.filesCount();\n * ```\n * @category Advanced\n * @see {@link https://docs.vana.com/developer/protocol/contracts | Vana Protocol Contracts} for contract specifications\n */\nexport class ProtocolController {\n private readonly contractFactory: ContractFactory;\n\n constructor(private readonly context: ControllerContext) {\n this.contractFactory = new ContractFactory(context.walletClient);\n }\n\n /**\n * Retrieves the address and ABI for a specific Vana protocol contract.\n *\n * @remarks\n * This method provides direct access to contract addresses and ABIs for the current\n * chain. It includes full TypeScript type inference when using const assertions,\n * enabling type-safe contract interactions. The method only returns contracts that\n * are actually deployed on the current network.\n * @param contractName - The name of the Vana contract to retrieve (use const assertion for full typing)\n * @returns An object containing the contract's address and fully typed ABI\n * @throws {ContractNotFoundError} When the contract is not deployed on the current chain.\n * Verify contract name spelling and check current network with `getChainId()`.\n * @example\n * ```typescript\n * // Get contract info with full type inference\n * const dataRegistry = vana.protocol.getContract(\"DataRegistry\" as const);\n *\n * // Now dataRegistry.abi is fully typed for the DataRegistry contract\n * console.log(dataRegistry.address); // \"0x123...\"\n * console.log(dataRegistry.abi.length); // Full ABI array\n * ```\n */\n getContract<T extends VanaContract>(\n contractName: T,\n ): ContractInfo<ContractAbis[T]> {\n try {\n const chainId = this.context.walletClient.chain?.id;\n\n if (!chainId) {\n throw new ContractNotFoundError(contractName, 0);\n }\n\n return getContractInfo(contractName, chainId as VanaChainId);\n } catch (error) {\n if (error instanceof ContractNotFoundError) {\n throw error;\n }\n if (error instanceof Error) {\n if (error.message.includes(\"Contract address not found\")) {\n let chainId = 0;\n try {\n chainId = this.context.walletClient.chain?.id ?? 0;\n } catch {\n // Use 0 as fallback if chain ID access fails\n chainId = 0;\n }\n throw new ContractNotFoundError(contractName, chainId);\n }\n throw error;\n }\n throw new Error(`Failed to get contract ${contractName}: Unknown error`);\n }\n }\n\n /**\n * Creates a fully typed contract instance ready for blockchain interaction.\n *\n * @remarks\n * This method creates a contract instance with complete type safety for all contract\n * methods including read operations, write operations, and event handling. The instance\n * is pre-configured with the correct address, ABI, and wallet client for immediate use.\n * All method parameters and return types are fully typed based on the contract ABI.\n * @param contractName - The name of the Vana contract (use const assertion for full typing)\n * @returns A fully typed contract instance with read/write methods and event handling\n * @throws {ContractNotFoundError} When the contract is not deployed on the current chain\n * @example\n * ```typescript\n * // Create typed contract instance\n * const dataRegistry = vana.protocol.createContract(\"DataRegistry\" as const);\n *\n * // Full type safety for all operations\n * const fileCount = await dataRegistry.read.filesCount(); // Type: bigint\n * const txHash = await dataRegistry.write.addFile([\"ipfs://...\"]); // Typed parameters\n *\n * // Listen to events with full typing\n * const logs = await dataRegistry.getEvents.FileAdded();\n * ```\n */\n createContract<T extends VanaContract>(\n contractName: T,\n ): GetContractReturnType<ContractAbis[T]> {\n try {\n return getContractController(contractName, this.context.walletClient);\n } catch (error) {\n if (error instanceof Error) {\n if (error.message.includes(\"Contract address not found\")) {\n const chainId = this.context.walletClient.chain?.id ?? 0;\n throw new ContractNotFoundError(contractName, chainId);\n }\n throw error;\n }\n throw new Error(\n `Failed to create contract ${contractName}: Unknown error`,\n );\n }\n }\n\n /**\n * Gets all available contract names that can be used with getContract().\n * Returns only contracts that are actually deployed on the current chain.\n *\n * @returns Array of all available contract names for the current chain\n */\n getAvailableContracts(): VanaContract[] {\n return this.contractFactory.getAvailableContracts();\n }\n\n /**\n * Checks if a specific contract is available on the current chain.\n *\n * @param contractName - The contract name to check\n * @returns Whether the contract is deployed on the current chain\n */\n isContractAvailable(contractName: VanaContract): boolean {\n const availableContracts = this.getAvailableContracts();\n return availableContracts.includes(contractName);\n }\n\n /**\n * Gets the contract factory instance for advanced usage.\n * This provides access to additional contract management methods.\n *\n * @returns The contract factory instance\n */\n getContractFactory(): ContractFactory {\n return this.contractFactory;\n }\n\n /**\n * Gets the current chain ID from the wallet client.\n *\n * @returns The chain ID\n * @throws {Error} When chain ID is not available from wallet client\n */\n getChainId(): number {\n const chainId = this.context.walletClient.chain?.id;\n if (!chainId) {\n throw new Error(\"Chain ID not available from wallet client\");\n }\n return chainId;\n }\n\n /**\n * Gets the current chain name from the wallet client.\n *\n * @returns The chain name\n * @throws {Error} When chain name is not available from wallet client\n */\n getChainName(): string {\n const chainName = this.context.walletClient.chain?.name;\n if (!chainName) {\n throw new Error(\"Chain name not available from wallet client\");\n }\n return chainName;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAAsC;AACtC,gCAIO;AAkDA,MAAM,mBAAmB;AAAA,EAG9B,YAA6B,SAA4B;AAA5B;AAC3B,SAAK,kB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MACR;AACA,YAAM,IAAI;AAAA,QACR,6BAA6B,YAAY;AAAA,MAC3C;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,wBAAwC;AACtC,WAAO,KAAK,gBAAgB,sBAAsB;AAAA,EACpD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,oBAAoB,cAAqC;AACvD,UAAM,qBAAqB,KAAK,sBAAsB;AACtD,WAAO,mBAAmB,SAAS,YAAY;AAAA,EACjD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,qBAAsC;AACpC,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,aAAqB;AACnB,UAAM,UAAU,KAAK,QAAQ,aAAa,OAAO;AACjD,QAAI,CAAC,SAAS;AACZ,YAAM,IAAI,MAAM,2CAA2C;AAAA,IAC7D;AACA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,eAAuB;AACrB,UAAM,YAAY,KAAK,QAAQ,aAAa,OAAO;AACnD,QAAI,CAAC,WAAW;AACd,YAAM,IAAI,MAAM,6CAA6C;AAAA,IAC/D;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/controllers/protocol.ts"],"sourcesContent":["import type { ContractInfo, VanaChainId } from \"../types/index\";\nimport type { VanaContract, ContractAbis } from \"../generated/abi\";\nimport { ContractNotFoundError } from \"../errors\";\nimport {\n getContractController,\n getContractInfo,\n ContractFactory,\n} from \"../contracts/contractController\";\nimport type { ControllerContext } from \"../types/controller-context\";\nimport type { GetContractReturnType } from \"viem\";\nimport { BaseController } from \"./base\";\n\n/**\n * Provides low-level access to Vana protocol smart contracts.\n *\n * @remarks\n * Advanced API for direct contract interaction. Most developers should use\n * higher-level controllers (DataController, PermissionsController) instead.\n * This controller serves as an escape hatch when high-level APIs lack needed\n * functionality.\n *\n * **Architecture:**\n * Automatically detects current chain and provides only deployed contracts.\n * Full TypeScript type safety through contract ABIs and const assertions.\n *\n * **Method Selection:**\n * - `getContract()` - Retrieve address and ABI for manual interaction\n * - `createContract()` - Get typed contract instance with read/write methods\n * - `getAvailableContracts()` - List all contracts on current chain\n * - `isContractAvailable()` - Check contract deployment status\n * - `getChainId()`/`getChainName()` - Current network information\n *\n * **When to Use:**\n * - Custom contract interactions not covered by high-level APIs\n * - Direct contract event listening\n * - Advanced protocol operations\n *\n * **Type Safety:**\n * Always use `as const` with contract names for full type inference.\n *\n * @example\n * ```typescript\n * // Get contract info with typed ABI\n * const registry = vana.protocol.getContract(\"DataRegistry\" as const);\n * console.log(`Contract at ${registry.address}`);\n *\n * // Create typed contract instance\n * const contract = vana.protocol.createContract(\"DataRegistry\" as const);\n * const count = await contract.read.filesCount(); // Returns: bigint\n *\n * // Write operations with full typing\n * const hash = await contract.write.addFile([\"ipfs://...\"]);\n * ```\n *\n * @category Advanced\n * @see For contract specifications, visit {@link https://docs.vana.org/docs/protocol-contracts}\n */\nexport class ProtocolController extends BaseController {\n private readonly contractFactory: ContractFactory;\n\n constructor(context: ControllerContext) {\n super(context);\n this.contractFactory = new ContractFactory(\n context.walletClient ?? context.publicClient,\n );\n }\n\n /**\n * Retrieves the address and ABI for a specific Vana protocol contract.\n *\n * @remarks\n * This method provides direct access to contract addresses and ABIs for the current\n * chain. It includes full TypeScript type inference when using const assertions,\n * enabling type-safe contract interactions. The method only returns contracts that\n * are actually deployed on the current network.\n * @param contractName - The name of the Vana contract to retrieve (use const assertion for full typing)\n * @returns An object containing the contract's address and fully typed ABI\n * @throws {ContractNotFoundError} When the contract is not deployed on the current chain.\n * Verify contract name spelling and check current network with `getChainId()`.\n * @example\n * ```typescript\n * // Get contract info with full type inference\n * const dataRegistry = vana.protocol.getContract(\"DataRegistry\" as const);\n *\n * // Now dataRegistry.abi is fully typed for the DataRegistry contract\n * console.log(dataRegistry.address); // \"0x123...\"\n * console.log(dataRegistry.abi.length); // Full ABI array\n * ```\n */\n getContract<T extends VanaContract>(\n contractName: T,\n ): ContractInfo<ContractAbis[T]> {\n try {\n const chainId =\n this.context.walletClient?.chain?.id ??\n this.context.publicClient.chain?.id;\n\n if (!chainId) {\n throw new ContractNotFoundError(contractName, 0);\n }\n\n return getContractInfo(contractName, chainId as VanaChainId);\n } catch (error) {\n if (error instanceof ContractNotFoundError) {\n throw error;\n }\n if (error instanceof Error) {\n if (error.message.includes(\"Contract address not found\")) {\n let chainId = 0;\n try {\n chainId =\n this.context.walletClient?.chain?.id ??\n this.context.publicClient.chain?.id ??\n 0;\n } catch {\n // Use 0 as fallback if chain ID access fails\n chainId = 0;\n }\n throw new ContractNotFoundError(contractName, chainId);\n }\n throw error;\n }\n throw new Error(`Failed to get contract ${contractName}: Unknown error`);\n }\n }\n\n /**\n * Creates a fully typed contract instance ready for blockchain interaction.\n *\n * @remarks\n * This method creates a contract instance with complete type safety for all contract\n * methods including read operations, write operations, and event handling. The instance\n * is pre-configured with the correct address, ABI, and wallet client for immediate use.\n * All method parameters and return types are fully typed based on the contract ABI.\n * @param contractName - The name of the Vana contract (use const assertion for full typing)\n * @returns A fully typed contract instance with read/write methods and event handling\n * @throws {ContractNotFoundError} When the contract is not deployed on the current chain\n * @example\n * ```typescript\n * // Create typed contract instance\n * const dataRegistry = vana.protocol.createContract(\"DataRegistry\" as const);\n *\n * // Full type safety for all operations\n * const fileCount = await dataRegistry.read.filesCount(); // Type: bigint\n * const txHash = await dataRegistry.write.addFile([\"ipfs://...\"]); // Typed parameters\n *\n * // Listen to events with full typing\n * const logs = await dataRegistry.getEvents.FileAdded();\n * ```\n */\n createContract<T extends VanaContract>(\n contractName: T,\n ): GetContractReturnType<ContractAbis[T]> {\n this.assertWallet();\n try {\n return getContractController(contractName, this.context.walletClient);\n } catch (error) {\n if (error instanceof Error) {\n if (error.message.includes(\"Contract address not found\")) {\n const chainId = this.context.walletClient.chain?.id ?? 0;\n throw new ContractNotFoundError(contractName, chainId);\n }\n throw error;\n }\n throw new Error(\n `Failed to create contract ${contractName}: Unknown error`,\n );\n }\n }\n\n /**\n * Gets all available contract names that can be used with getContract().\n * Returns only contracts that are actually deployed on the current chain.\n *\n * @returns Array of all available contract names for the current chain\n */\n getAvailableContracts(): VanaContract[] {\n return this.contractFactory.getAvailableContracts();\n }\n\n /**\n * Checks if a specific contract is available on the current chain.\n *\n * @param contractName - The contract name to check\n * @returns Whether the contract is deployed on the current chain\n */\n isContractAvailable(contractName: VanaContract): boolean {\n const availableContracts = this.getAvailableContracts();\n return availableContracts.includes(contractName);\n }\n\n /**\n * Gets the contract factory instance for advanced usage.\n * This provides access to additional contract management methods.\n *\n * @returns The contract factory instance\n */\n getContractFactory(): ContractFactory {\n return this.contractFactory;\n }\n\n /**\n * Gets the current chain ID from the wallet client.\n *\n * @returns The chain ID\n * @throws {Error} When chain ID is not available from wallet client\n */\n getChainId(): number {\n const chainId =\n this.context.walletClient?.chain?.id ??\n this.context.publicClient.chain?.id;\n if (!chainId) {\n throw new Error(\"Chain ID not available from client\");\n }\n return chainId;\n }\n\n /**\n * Gets the current chain name from the wallet client.\n *\n * @returns The chain name\n * @throws {Error} When chain name is not available from wallet client\n */\n getChainName(): string {\n const chainName =\n this.context.walletClient?.chain?.name ??\n this.context.publicClient.chain?.name;\n if (!chainName) {\n throw new Error(\"Chain name not available from client\");\n }\n return chainName;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAAsC;AACtC,gCAIO;AAGP,kBAA+B;AA+CxB,MAAM,2BAA2B,2BAAe;AAAA,EACpC;AAAA,EAEjB,YAAY,SAA4B;AACtC,UAAM,OAAO;AACb,SAAK,kBAAkB,IAAI;AAAA,MACzB,QAAQ,gBAAgB,QAAQ;AAAA,IAClC;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,wBAAwC;AACtC,WAAO,KAAK,gBAAgB,sBAAsB;AAAA,EACpD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,oBAAoB,cAAqC;AACvD,UAAM,qBAAqB,KAAK,sBAAsB;AACtD,WAAO,mBAAmB,SAAS,YAAY;AAAA,EACjD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,qBAAsC;AACpC,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,aAAqB;AACnB,UAAM,UACJ,KAAK,QAAQ,cAAc,OAAO,MAClC,KAAK,QAAQ,aAAa,OAAO;AACnC,QAAI,CAAC,SAAS;AACZ,YAAM,IAAI,MAAM,oCAAoC;AAAA,IACtD;AACA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,eAAuB;AACrB,UAAM,YACJ,KAAK,QAAQ,cAAc,OAAO,QAClC,KAAK,QAAQ,aAAa,OAAO;AACnC,QAAI,CAAC,WAAW;AACd,YAAM,IAAI,MAAM,sCAAsC;AAAA,IACxD;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -1,56 +1,55 @@
1
1
  import type { ContractInfo } from "../types/index";
2
2
  import type { VanaContract, ContractAbis } from "../generated/abi";
3
3
  import { ContractFactory } from "../contracts/contractController";
4
- import type { ControllerContext } from "./permissions";
4
+ import type { ControllerContext } from "../types/controller-context";
5
5
  import type { GetContractReturnType } from "viem";
6
+ import { BaseController } from "./base";
6
7
  /**
7
- * Provides direct, low-level access to all Vana protocol smart contracts.
8
+ * Provides low-level access to Vana protocol smart contracts.
8
9
  *
9
10
  * @remarks
10
- * This controller serves as the designated "escape hatch" for advanced developers who need
11
- * to interact directly with the underlying blockchain contracts. It provides access to
12
- * contract addresses, ABIs, and factory methods for creating typed contract instances.
13
- * Most developers should use the higher-level DataController and PermissionsController
14
- * instead of this advanced API.
11
+ * Advanced API for direct contract interaction. Most developers should use
12
+ * higher-level controllers (DataController, PermissionsController) instead.
13
+ * This controller serves as an escape hatch when high-level APIs lack needed
14
+ * functionality.
15
15
  *
16
- * **Contract Selection:**
17
- * The controller automatically handles chain detection and provides only contracts that
18
- * are deployed on the current network. All contract instances are fully typed for
19
- * enhanced developer experience and type safety.
16
+ * **Architecture:**
17
+ * Automatically detects current chain and provides only deployed contracts.
18
+ * Full TypeScript type safety through contract ABIs and const assertions.
20
19
  *
21
20
  * **Method Selection:**
22
- * - `getContract()` retrieves contract address and ABI for manual interaction
23
- * - `createContract()` returns fully typed contract instance with read/write methods
24
- * - `getAvailableContracts()` lists all contracts deployed on current chain
25
- * - `isContractAvailable()` checks if specific contract exists on current chain
26
- * - `getChainId()` and `getChainName()` provide current network information
21
+ * - `getContract()` - Retrieve address and ABI for manual interaction
22
+ * - `createContract()` - Get typed contract instance with read/write methods
23
+ * - `getAvailableContracts()` - List all contracts on current chain
24
+ * - `isContractAvailable()` - Check contract deployment status
25
+ * - `getChainId()`/`getChainName()` - Current network information
27
26
  *
28
- * **Usage Guidelines:**
29
- * Use this controller when high-level controllers don't provide needed functionality.
30
- * Most developers should use `vana.data.*` for files and `vana.permissions.*` for access control.
27
+ * **When to Use:**
28
+ * - Custom contract interactions not covered by high-level APIs
29
+ * - Direct contract event listening
30
+ * - Advanced protocol operations
31
31
  *
32
32
  * **Type Safety:**
33
- * Use `as const` assertion with contract names for full TypeScript type inference.
34
- * Contract instances provide complete typing for all methods, parameters, and return values.
33
+ * Always use `as const` with contract names for full type inference.
35
34
  *
36
35
  * @example
37
36
  * ```typescript
38
- * // Get contract info for direct interaction
37
+ * // Get contract info with typed ABI
39
38
  * const registry = vana.protocol.getContract("DataRegistry" as const);
39
+ * console.log(`Contract at ${registry.address}`);
40
40
  *
41
- * // Access contract address and ABI with full typing
42
- * console.log(registry.address); // Contract address on current chain
43
- * console.log(registry.abi); // Fully typed contract ABI
44
- *
45
- * // Create a typed contract instance
41
+ * // Create typed contract instance
46
42
  * const contract = vana.protocol.createContract("DataRegistry" as const);
47
- * const fileCount = await contract.read.filesCount();
43
+ * const count = await contract.read.filesCount(); // Returns: bigint
44
+ *
45
+ * // Write operations with full typing
46
+ * const hash = await contract.write.addFile(["ipfs://..."]);
48
47
  * ```
48
+ *
49
49
  * @category Advanced
50
- * @see {@link https://docs.vana.com/developer/protocol/contracts | Vana Protocol Contracts} for contract specifications
50
+ * @see For contract specifications, visit {@link https://docs.vana.org/docs/protocol-contracts}
51
51
  */
52
- export declare class ProtocolController {
53
- private readonly context;
52
+ export declare class ProtocolController extends BaseController {
54
53
  private readonly contractFactory;
55
54
  constructor(context: ControllerContext);
56
55
  /**
@@ -4,12 +4,15 @@ import {
4
4
  getContractInfo,
5
5
  ContractFactory
6
6
  } from "../contracts/contractController";
7
- class ProtocolController {
7
+ import { BaseController } from "./base";
8
+ class ProtocolController extends BaseController {
9
+ contractFactory;
8
10
  constructor(context) {
9
- this.context = context;
10
- this.contractFactory = new ContractFactory(context.walletClient);
11
+ super(context);
12
+ this.contractFactory = new ContractFactory(
13
+ context.walletClient ?? context.publicClient
14
+ );
11
15
  }
12
- contractFactory;
13
16
  /**
14
17
  * Retrieves the address and ABI for a specific Vana protocol contract.
15
18
  *
@@ -34,7 +37,7 @@ class ProtocolController {
34
37
  */
35
38
  getContract(contractName) {
36
39
  try {
37
- const chainId = this.context.walletClient.chain?.id;
40
+ const chainId = this.context.walletClient?.chain?.id ?? this.context.publicClient.chain?.id;
38
41
  if (!chainId) {
39
42
  throw new ContractNotFoundError(contractName, 0);
40
43
  }
@@ -47,7 +50,7 @@ class ProtocolController {
47
50
  if (error.message.includes("Contract address not found")) {
48
51
  let chainId = 0;
49
52
  try {
50
- chainId = this.context.walletClient.chain?.id ?? 0;
53
+ chainId = this.context.walletClient?.chain?.id ?? this.context.publicClient.chain?.id ?? 0;
51
54
  } catch {
52
55
  chainId = 0;
53
56
  }
@@ -83,6 +86,7 @@ class ProtocolController {
83
86
  * ```
84
87
  */
85
88
  createContract(contractName) {
89
+ this.assertWallet();
86
90
  try {
87
91
  return getContractController(contractName, this.context.walletClient);
88
92
  } catch (error) {
@@ -133,9 +137,9 @@ class ProtocolController {
133
137
  * @throws {Error} When chain ID is not available from wallet client
134
138
  */
135
139
  getChainId() {
136
- const chainId = this.context.walletClient.chain?.id;
140
+ const chainId = this.context.walletClient?.chain?.id ?? this.context.publicClient.chain?.id;
137
141
  if (!chainId) {
138
- throw new Error("Chain ID not available from wallet client");
142
+ throw new Error("Chain ID not available from client");
139
143
  }
140
144
  return chainId;
141
145
  }
@@ -146,9 +150,9 @@ class ProtocolController {
146
150
  * @throws {Error} When chain name is not available from wallet client
147
151
  */
148
152
  getChainName() {
149
- const chainName = this.context.walletClient.chain?.name;
153
+ const chainName = this.context.walletClient?.chain?.name ?? this.context.publicClient.chain?.name;
150
154
  if (!chainName) {
151
- throw new Error("Chain name not available from wallet client");
155
+ throw new Error("Chain name not available from client");
152
156
  }
153
157
  return chainName;
154
158
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/controllers/protocol.ts"],"sourcesContent":["import type { ContractInfo, VanaChainId } from \"../types/index\";\nimport type { VanaContract, ContractAbis } from \"../generated/abi\";\nimport { ContractNotFoundError } from \"../errors\";\nimport {\n getContractController,\n getContractInfo,\n ContractFactory,\n} from \"../contracts/contractController\";\nimport type { ControllerContext } from \"./permissions\";\nimport type { GetContractReturnType } from \"viem\";\n\n/**\n * Provides direct, low-level access to all Vana protocol smart contracts.\n *\n * @remarks\n * This controller serves as the designated \"escape hatch\" for advanced developers who need\n * to interact directly with the underlying blockchain contracts. It provides access to\n * contract addresses, ABIs, and factory methods for creating typed contract instances.\n * Most developers should use the higher-level DataController and PermissionsController\n * instead of this advanced API.\n *\n * **Contract Selection:**\n * The controller automatically handles chain detection and provides only contracts that\n * are deployed on the current network. All contract instances are fully typed for\n * enhanced developer experience and type safety.\n *\n * **Method Selection:**\n * - `getContract()` retrieves contract address and ABI for manual interaction\n * - `createContract()` returns fully typed contract instance with read/write methods\n * - `getAvailableContracts()` lists all contracts deployed on current chain\n * - `isContractAvailable()` checks if specific contract exists on current chain\n * - `getChainId()` and `getChainName()` provide current network information\n *\n * **Usage Guidelines:**\n * Use this controller when high-level controllers don't provide needed functionality.\n * Most developers should use `vana.data.*` for files and `vana.permissions.*` for access control.\n *\n * **Type Safety:**\n * Use `as const` assertion with contract names for full TypeScript type inference.\n * Contract instances provide complete typing for all methods, parameters, and return values.\n *\n * @example\n * ```typescript\n * // Get contract info for direct interaction\n * const registry = vana.protocol.getContract(\"DataRegistry\" as const);\n *\n * // Access contract address and ABI with full typing\n * console.log(registry.address); // Contract address on current chain\n * console.log(registry.abi); // Fully typed contract ABI\n *\n * // Create a typed contract instance\n * const contract = vana.protocol.createContract(\"DataRegistry\" as const);\n * const fileCount = await contract.read.filesCount();\n * ```\n * @category Advanced\n * @see {@link https://docs.vana.com/developer/protocol/contracts | Vana Protocol Contracts} for contract specifications\n */\nexport class ProtocolController {\n private readonly contractFactory: ContractFactory;\n\n constructor(private readonly context: ControllerContext) {\n this.contractFactory = new ContractFactory(context.walletClient);\n }\n\n /**\n * Retrieves the address and ABI for a specific Vana protocol contract.\n *\n * @remarks\n * This method provides direct access to contract addresses and ABIs for the current\n * chain. It includes full TypeScript type inference when using const assertions,\n * enabling type-safe contract interactions. The method only returns contracts that\n * are actually deployed on the current network.\n * @param contractName - The name of the Vana contract to retrieve (use const assertion for full typing)\n * @returns An object containing the contract's address and fully typed ABI\n * @throws {ContractNotFoundError} When the contract is not deployed on the current chain.\n * Verify contract name spelling and check current network with `getChainId()`.\n * @example\n * ```typescript\n * // Get contract info with full type inference\n * const dataRegistry = vana.protocol.getContract(\"DataRegistry\" as const);\n *\n * // Now dataRegistry.abi is fully typed for the DataRegistry contract\n * console.log(dataRegistry.address); // \"0x123...\"\n * console.log(dataRegistry.abi.length); // Full ABI array\n * ```\n */\n getContract<T extends VanaContract>(\n contractName: T,\n ): ContractInfo<ContractAbis[T]> {\n try {\n const chainId = this.context.walletClient.chain?.id;\n\n if (!chainId) {\n throw new ContractNotFoundError(contractName, 0);\n }\n\n return getContractInfo(contractName, chainId as VanaChainId);\n } catch (error) {\n if (error instanceof ContractNotFoundError) {\n throw error;\n }\n if (error instanceof Error) {\n if (error.message.includes(\"Contract address not found\")) {\n let chainId = 0;\n try {\n chainId = this.context.walletClient.chain?.id ?? 0;\n } catch {\n // Use 0 as fallback if chain ID access fails\n chainId = 0;\n }\n throw new ContractNotFoundError(contractName, chainId);\n }\n throw error;\n }\n throw new Error(`Failed to get contract ${contractName}: Unknown error`);\n }\n }\n\n /**\n * Creates a fully typed contract instance ready for blockchain interaction.\n *\n * @remarks\n * This method creates a contract instance with complete type safety for all contract\n * methods including read operations, write operations, and event handling. The instance\n * is pre-configured with the correct address, ABI, and wallet client for immediate use.\n * All method parameters and return types are fully typed based on the contract ABI.\n * @param contractName - The name of the Vana contract (use const assertion for full typing)\n * @returns A fully typed contract instance with read/write methods and event handling\n * @throws {ContractNotFoundError} When the contract is not deployed on the current chain\n * @example\n * ```typescript\n * // Create typed contract instance\n * const dataRegistry = vana.protocol.createContract(\"DataRegistry\" as const);\n *\n * // Full type safety for all operations\n * const fileCount = await dataRegistry.read.filesCount(); // Type: bigint\n * const txHash = await dataRegistry.write.addFile([\"ipfs://...\"]); // Typed parameters\n *\n * // Listen to events with full typing\n * const logs = await dataRegistry.getEvents.FileAdded();\n * ```\n */\n createContract<T extends VanaContract>(\n contractName: T,\n ): GetContractReturnType<ContractAbis[T]> {\n try {\n return getContractController(contractName, this.context.walletClient);\n } catch (error) {\n if (error instanceof Error) {\n if (error.message.includes(\"Contract address not found\")) {\n const chainId = this.context.walletClient.chain?.id ?? 0;\n throw new ContractNotFoundError(contractName, chainId);\n }\n throw error;\n }\n throw new Error(\n `Failed to create contract ${contractName}: Unknown error`,\n );\n }\n }\n\n /**\n * Gets all available contract names that can be used with getContract().\n * Returns only contracts that are actually deployed on the current chain.\n *\n * @returns Array of all available contract names for the current chain\n */\n getAvailableContracts(): VanaContract[] {\n return this.contractFactory.getAvailableContracts();\n }\n\n /**\n * Checks if a specific contract is available on the current chain.\n *\n * @param contractName - The contract name to check\n * @returns Whether the contract is deployed on the current chain\n */\n isContractAvailable(contractName: VanaContract): boolean {\n const availableContracts = this.getAvailableContracts();\n return availableContracts.includes(contractName);\n }\n\n /**\n * Gets the contract factory instance for advanced usage.\n * This provides access to additional contract management methods.\n *\n * @returns The contract factory instance\n */\n getContractFactory(): ContractFactory {\n return this.contractFactory;\n }\n\n /**\n * Gets the current chain ID from the wallet client.\n *\n * @returns The chain ID\n * @throws {Error} When chain ID is not available from wallet client\n */\n getChainId(): number {\n const chainId = this.context.walletClient.chain?.id;\n if (!chainId) {\n throw new Error(\"Chain ID not available from wallet client\");\n }\n return chainId;\n }\n\n /**\n * Gets the current chain name from the wallet client.\n *\n * @returns The chain name\n * @throws {Error} When chain name is not available from wallet client\n */\n getChainName(): string {\n const chainName = this.context.walletClient.chain?.name;\n if (!chainName) {\n throw new Error(\"Chain name not available from wallet client\");\n }\n return chainName;\n }\n}\n"],"mappings":"AAEA,SAAS,6BAA6B;AACtC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAkDA,MAAM,mBAAmB;AAAA,EAG9B,YAA6B,SAA4B;AAA5B;AAC3B,SAAK,kBAAkB,IAAI,gBAAgB,QAAQ,YAAY;AAAA,EACjE;AAAA,EAJiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA4BjB,YACE,cAC+B;AAC/B,QAAI;AACF,YAAM,UAAU,KAAK,QAAQ,aAAa,OAAO;AAEjD,UAAI,CAAC,SAAS;AACZ,cAAM,IAAI,sBAAsB,cAAc,CAAC;AAAA,MACjD;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;AAAA;AAAA;AAAA,EAQA,qBAAsC;AACpC,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,aAAqB;AACnB,UAAM,UAAU,KAAK,QAAQ,aAAa,OAAO;AACjD,QAAI,CAAC,SAAS;AACZ,YAAM,IAAI,MAAM,2CAA2C;AAAA,IAC7D;AACA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,eAAuB;AACrB,UAAM,YAAY,KAAK,QAAQ,aAAa,OAAO;AACnD,QAAI,CAAC,WAAW;AACd,YAAM,IAAI,MAAM,6CAA6C;AAAA,IAC/D;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/controllers/protocol.ts"],"sourcesContent":["import type { ContractInfo, VanaChainId } from \"../types/index\";\nimport type { VanaContract, ContractAbis } from \"../generated/abi\";\nimport { ContractNotFoundError } from \"../errors\";\nimport {\n getContractController,\n getContractInfo,\n ContractFactory,\n} from \"../contracts/contractController\";\nimport type { ControllerContext } from \"../types/controller-context\";\nimport type { GetContractReturnType } from \"viem\";\nimport { BaseController } from \"./base\";\n\n/**\n * Provides low-level access to Vana protocol smart contracts.\n *\n * @remarks\n * Advanced API for direct contract interaction. Most developers should use\n * higher-level controllers (DataController, PermissionsController) instead.\n * This controller serves as an escape hatch when high-level APIs lack needed\n * functionality.\n *\n * **Architecture:**\n * Automatically detects current chain and provides only deployed contracts.\n * Full TypeScript type safety through contract ABIs and const assertions.\n *\n * **Method Selection:**\n * - `getContract()` - Retrieve address and ABI for manual interaction\n * - `createContract()` - Get typed contract instance with read/write methods\n * - `getAvailableContracts()` - List all contracts on current chain\n * - `isContractAvailable()` - Check contract deployment status\n * - `getChainId()`/`getChainName()` - Current network information\n *\n * **When to Use:**\n * - Custom contract interactions not covered by high-level APIs\n * - Direct contract event listening\n * - Advanced protocol operations\n *\n * **Type Safety:**\n * Always use `as const` with contract names for full type inference.\n *\n * @example\n * ```typescript\n * // Get contract info with typed ABI\n * const registry = vana.protocol.getContract(\"DataRegistry\" as const);\n * console.log(`Contract at ${registry.address}`);\n *\n * // Create typed contract instance\n * const contract = vana.protocol.createContract(\"DataRegistry\" as const);\n * const count = await contract.read.filesCount(); // Returns: bigint\n *\n * // Write operations with full typing\n * const hash = await contract.write.addFile([\"ipfs://...\"]);\n * ```\n *\n * @category Advanced\n * @see For contract specifications, visit {@link https://docs.vana.org/docs/protocol-contracts}\n */\nexport class ProtocolController extends BaseController {\n private readonly contractFactory: ContractFactory;\n\n constructor(context: ControllerContext) {\n super(context);\n this.contractFactory = new ContractFactory(\n context.walletClient ?? context.publicClient,\n );\n }\n\n /**\n * Retrieves the address and ABI for a specific Vana protocol contract.\n *\n * @remarks\n * This method provides direct access to contract addresses and ABIs for the current\n * chain. It includes full TypeScript type inference when using const assertions,\n * enabling type-safe contract interactions. The method only returns contracts that\n * are actually deployed on the current network.\n * @param contractName - The name of the Vana contract to retrieve (use const assertion for full typing)\n * @returns An object containing the contract's address and fully typed ABI\n * @throws {ContractNotFoundError} When the contract is not deployed on the current chain.\n * Verify contract name spelling and check current network with `getChainId()`.\n * @example\n * ```typescript\n * // Get contract info with full type inference\n * const dataRegistry = vana.protocol.getContract(\"DataRegistry\" as const);\n *\n * // Now dataRegistry.abi is fully typed for the DataRegistry contract\n * console.log(dataRegistry.address); // \"0x123...\"\n * console.log(dataRegistry.abi.length); // Full ABI array\n * ```\n */\n getContract<T extends VanaContract>(\n contractName: T,\n ): ContractInfo<ContractAbis[T]> {\n try {\n const chainId =\n this.context.walletClient?.chain?.id ??\n this.context.publicClient.chain?.id;\n\n if (!chainId) {\n throw new ContractNotFoundError(contractName, 0);\n }\n\n return getContractInfo(contractName, chainId as VanaChainId);\n } catch (error) {\n if (error instanceof ContractNotFoundError) {\n throw error;\n }\n if (error instanceof Error) {\n if (error.message.includes(\"Contract address not found\")) {\n let chainId = 0;\n try {\n chainId =\n this.context.walletClient?.chain?.id ??\n this.context.publicClient.chain?.id ??\n 0;\n } catch {\n // Use 0 as fallback if chain ID access fails\n chainId = 0;\n }\n throw new ContractNotFoundError(contractName, chainId);\n }\n throw error;\n }\n throw new Error(`Failed to get contract ${contractName}: Unknown error`);\n }\n }\n\n /**\n * Creates a fully typed contract instance ready for blockchain interaction.\n *\n * @remarks\n * This method creates a contract instance with complete type safety for all contract\n * methods including read operations, write operations, and event handling. The instance\n * is pre-configured with the correct address, ABI, and wallet client for immediate use.\n * All method parameters and return types are fully typed based on the contract ABI.\n * @param contractName - The name of the Vana contract (use const assertion for full typing)\n * @returns A fully typed contract instance with read/write methods and event handling\n * @throws {ContractNotFoundError} When the contract is not deployed on the current chain\n * @example\n * ```typescript\n * // Create typed contract instance\n * const dataRegistry = vana.protocol.createContract(\"DataRegistry\" as const);\n *\n * // Full type safety for all operations\n * const fileCount = await dataRegistry.read.filesCount(); // Type: bigint\n * const txHash = await dataRegistry.write.addFile([\"ipfs://...\"]); // Typed parameters\n *\n * // Listen to events with full typing\n * const logs = await dataRegistry.getEvents.FileAdded();\n * ```\n */\n createContract<T extends VanaContract>(\n contractName: T,\n ): GetContractReturnType<ContractAbis[T]> {\n this.assertWallet();\n try {\n return getContractController(contractName, this.context.walletClient);\n } catch (error) {\n if (error instanceof Error) {\n if (error.message.includes(\"Contract address not found\")) {\n const chainId = this.context.walletClient.chain?.id ?? 0;\n throw new ContractNotFoundError(contractName, chainId);\n }\n throw error;\n }\n throw new Error(\n `Failed to create contract ${contractName}: Unknown error`,\n );\n }\n }\n\n /**\n * Gets all available contract names that can be used with getContract().\n * Returns only contracts that are actually deployed on the current chain.\n *\n * @returns Array of all available contract names for the current chain\n */\n getAvailableContracts(): VanaContract[] {\n return this.contractFactory.getAvailableContracts();\n }\n\n /**\n * Checks if a specific contract is available on the current chain.\n *\n * @param contractName - The contract name to check\n * @returns Whether the contract is deployed on the current chain\n */\n isContractAvailable(contractName: VanaContract): boolean {\n const availableContracts = this.getAvailableContracts();\n return availableContracts.includes(contractName);\n }\n\n /**\n * Gets the contract factory instance for advanced usage.\n * This provides access to additional contract management methods.\n *\n * @returns The contract factory instance\n */\n getContractFactory(): ContractFactory {\n return this.contractFactory;\n }\n\n /**\n * Gets the current chain ID from the wallet client.\n *\n * @returns The chain ID\n * @throws {Error} When chain ID is not available from wallet client\n */\n getChainId(): number {\n const chainId =\n this.context.walletClient?.chain?.id ??\n this.context.publicClient.chain?.id;\n if (!chainId) {\n throw new Error(\"Chain ID not available from client\");\n }\n return chainId;\n }\n\n /**\n * Gets the current chain name from the wallet client.\n *\n * @returns The chain name\n * @throws {Error} When chain name is not available from wallet client\n */\n getChainName(): string {\n const chainName =\n this.context.walletClient?.chain?.name ??\n this.context.publicClient.chain?.name;\n if (!chainName) {\n throw new Error(\"Chain name not available from client\");\n }\n return chainName;\n }\n}\n"],"mappings":"AAEA,SAAS,6BAA6B;AACtC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAS,sBAAsB;AA+CxB,MAAM,2BAA2B,eAAe;AAAA,EACpC;AAAA,EAEjB,YAAY,SAA4B;AACtC,UAAM,OAAO;AACb,SAAK,kBAAkB,IAAI;AAAA,MACzB,QAAQ,gBAAgB,QAAQ;AAAA,IAClC;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAwBA,YACE,cAC+B;AAC/B,QAAI;AACF,YAAM,UACJ,KAAK,QAAQ,cAAc,OAAO,MAClC,KAAK,QAAQ,aAAa,OAAO;AAEnC,UAAI,CAAC,SAAS;AACZ,cAAM,IAAI,sBAAsB,cAAc,CAAC;AAAA,MACjD;AAEA,aAAO,gBAAgB,cAAc,OAAsB;AAAA,IAC7D,SAAS,OAAO;AACd,UAAI,iBAAiB,uBAAuB;AAC1C,cAAM;AAAA,MACR;AACA,UAAI,iBA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AA;AAAA;AAAA;AAAA;AAAA,EAQA,aAAqB;AACnB,UAAM,UACJ,KAAK,QAAQ,cAAc,OAAO,MAClC,KAAK,QAAQ,aAAa,OAAO;AACnC,QAAI,CAAC,SAAS;AACZ,YAAM,IAAI,MAAM,oCAAoC;AAAA,IACtD;AACA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,eAAuB;AACrB,UAAM,YACJ,KAAK,QAAQ,cAAc,OAAO,QAClC,KAAK,QAAQ,aAAa,OAAO;AACnC,QAAI,CAAC,WAAW;AACd,YAAM,IAAI,MAAM,sCAAsC;AAAA,IACxD;AACA,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -0,0 +1,272 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var runtimePermissions_exports = {};
20
+ __export(runtimePermissions_exports, {
21
+ RuntimePermissionsController: () => RuntimePermissionsController
22
+ });
23
+ module.exports = __toCommonJS(runtimePermissions_exports);
24
+ var import_viem = require("viem");
25
+ var import_base = require("./base");
26
+ var import_runtimeGrantFiles = require("../utils/runtimeGrantFiles");
27
+ var import_errors = require("../errors");
28
+ var import_addresses = require("../generated/addresses");
29
+ var import_abi = require("../generated/abi");
30
+ class RuntimePermissionsController extends import_base.BaseController {
31
+ /**
32
+ * Create a new runtime permission grant
33
+ *
34
+ * @remarks
35
+ * This method:
36
+ * 1. Creates a grant file with pricing and operation details
37
+ * 2. Uploads the grant to IPFS (via relayer if available)
38
+ * 3. Calls VanaRuntimePermissions.createPermission() on-chain
39
+ * 4. Waits for transaction confirmation
40
+ * 5. Returns the permission ID and grant URL
41
+ *
42
+ * @param params - Permission parameters including dataset, grantee, pricing
43
+ * @returns Permission ID, transaction hash, and grant URL
44
+ * @throws {BlockchainError} When permission creation fails
45
+ * @throws {NetworkError} When IPFS upload fails
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * const result = await sdk.runtimePermissions.createPermission({
50
+ * datasetId: 123n,
51
+ * grantee: "0x742d35Cc...",
52
+ * task: "vanaorg/vana-task-demo:latest",
53
+ * operation: "aggregate_keywords",
54
+ * pricing: {
55
+ * price_per_file_vana: 0.1,
56
+ * minimum_price_vana: 0.01,
57
+ * maximum_price_vana: 100
58
+ * },
59
+ * parameters: {
60
+ * maxFiles: 1000
61
+ * },
62
+ * });
63
+ * ```
64
+ */
65
+ async createPermission(params) {
66
+ this.assertWallet();
67
+ try {
68
+ const grantFile = (0, import_runtimeGrantFiles.createRuntimeGrantFile)(params);
69
+ let grantUrl = params.grantUrl;
70
+ if (!grantUrl) {
71
+ if (!this.context.relayer) {
72
+ throw new import_errors.NetworkError(
73
+ "No relayer configured and no grantUrl provided. Configure relayer or provide grantUrl parameter."
74
+ );
75
+ }
76
+ const request = {
77
+ type: "direct",
78
+ operation: "storeGrantFile",
79
+ params: grantFile
80
+ };
81
+ const response = await this.context.relayer(request);
82
+ if (response.type === "error") {
83
+ throw new import_errors.NetworkError(
84
+ `Failed to store grant file: ${response.error}`
85
+ );
86
+ }
87
+ if (response.type === "direct" && typeof response.result === "object" && response.result !== null && "url" in response.result && typeof response.result.url === "string") {
88
+ grantUrl = response.result.url;
89
+ } else {
90
+ throw new import_errors.NetworkError("Upload succeeded but no URL was returned");
91
+ }
92
+ }
93
+ const chainId = await this.context.publicClient.getChainId();
94
+ const contractAddress = (0, import_addresses.getContractAddress)(
95
+ chainId,
96
+ "VanaRuntimePermissions"
97
+ );
98
+ const abi = (0, import_abi.getAbi)("VanaRuntimePermissions");
99
+ const granteeId = BigInt(params.grantee);
100
+ const startBlock = await this.context.publicClient.getBlockNumber();
101
+ const endBlock = 2n ** 256n - 1n;
102
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
103
+ const hash = await this.context.walletClient.writeContract({
104
+ address: contractAddress,
105
+ abi,
106
+ functionName: "createPermission",
107
+ args: [params.datasetId, granteeId, grantUrl, startBlock, endBlock],
108
+ account,
109
+ chain: this.context.walletClient?.chain ?? null
110
+ });
111
+ await this.context.publicClient.waitForTransactionReceipt({
112
+ hash
113
+ });
114
+ const permissionId = 0n;
115
+ return {
116
+ permissionId,
117
+ hash,
118
+ grantUrl
119
+ };
120
+ } catch (error) {
121
+ if (error instanceof import_errors.NetworkError) {
122
+ throw error;
123
+ }
124
+ if (error instanceof Error) {
125
+ throw new import_errors.BlockchainError(
126
+ `Failed to create runtime permission: ${error.message}`,
127
+ error
128
+ );
129
+ }
130
+ throw new import_errors.BlockchainError(
131
+ "Failed to create runtime permission with unknown error"
132
+ );
133
+ }
134
+ }
135
+ /**
136
+ * Get permission by ID
137
+ *
138
+ * @remarks
139
+ * Fetches permission details from the VanaRuntimePermissions contract.
140
+ * The returned permission contains an IPFS hash in the grant field,
141
+ * which can be resolved using fetchGrant().
142
+ *
143
+ * @param permissionId - Permission identifier
144
+ * @returns Permission details including dataset, grantee, and grant hash
145
+ *
146
+ * @example
147
+ * ```typescript
148
+ * const permission = await sdk.runtimePermissions.getPermission(1024n);
149
+ * console.log(`Dataset: ${permission.datasetId}`);
150
+ * console.log(`Grant: ${permission.grant}`); // IPFS hash
151
+ *
152
+ * // Resolve full grant details
153
+ * const grantFile = await sdk.runtimePermissions.fetchGrant(permission);
154
+ * console.log(`Price: ${grantFile.pricing.price_per_file_vana} VANA`);
155
+ * ```
156
+ */
157
+ async getPermission(permissionId) {
158
+ const chainId = await this.context.publicClient.getChainId();
159
+ const contractAddress = (0, import_addresses.getContractAddress)(
160
+ chainId,
161
+ "VanaRuntimePermissions"
162
+ );
163
+ const abi = (0, import_abi.getAbi)("VanaRuntimePermissions");
164
+ const contract = (0, import_viem.getContract)({
165
+ address: contractAddress,
166
+ abi,
167
+ client: this.context.publicClient
168
+ });
169
+ return await contract.read.getPermission([
170
+ permissionId
171
+ ]);
172
+ }
173
+ /**
174
+ * Check if permission is active (not expired)
175
+ *
176
+ * @remarks
177
+ * Returns true if the current block number is between startBlock and endBlock.
178
+ *
179
+ * @param permissionId - Permission identifier
180
+ * @returns Whether permission is currently active
181
+ *
182
+ * @example
183
+ * ```typescript
184
+ * const isActive = await sdk.runtimePermissions.isPermissionActive(1024n);
185
+ * if (isActive) {
186
+ * console.log("Permission is valid");
187
+ * } else {
188
+ * console.log("Permission has expired");
189
+ * }
190
+ * ```
191
+ */
192
+ async isPermissionActive(permissionId) {
193
+ const chainId = await this.context.publicClient.getChainId();
194
+ const contractAddress = (0, import_addresses.getContractAddress)(
195
+ chainId,
196
+ "VanaRuntimePermissions"
197
+ );
198
+ const abi = (0, import_abi.getAbi)("VanaRuntimePermissions");
199
+ const contract = (0, import_viem.getContract)({
200
+ address: contractAddress,
201
+ abi,
202
+ client: this.context.publicClient
203
+ });
204
+ return await contract.read.isPermissionActive([permissionId]);
205
+ }
206
+ /**
207
+ * Get all permissions for a dataset
208
+ *
209
+ * @remarks
210
+ * Returns an array of permissions that have been granted for the specified dataset.
211
+ * Useful for dataset owners to view all active permissions.
212
+ *
213
+ * @param datasetId - Dataset identifier
214
+ * @returns Array of runtime permissions
215
+ *
216
+ * @example
217
+ * ```typescript
218
+ * const permissions = await sdk.runtimePermissions.getDatasetPermissions(123n);
219
+ * console.log(`Found ${permissions.length} permissions`);
220
+ *
221
+ * // Access each permission directly
222
+ * for (const permission of permissions) {
223
+ * console.log(`Permission ${permission.id}: ${permission.grant}`);
224
+ * }
225
+ * ```
226
+ */
227
+ async getDatasetPermissions(datasetId) {
228
+ const chainId = await this.context.publicClient.getChainId();
229
+ const contractAddress = (0, import_addresses.getContractAddress)(
230
+ chainId,
231
+ "VanaRuntimePermissions"
232
+ );
233
+ const abi = (0, import_abi.getAbi)("VanaRuntimePermissions");
234
+ const contract = (0, import_viem.getContract)({
235
+ address: contractAddress,
236
+ abi,
237
+ client: this.context.publicClient
238
+ });
239
+ return await contract.read.getDatasetPermissions([
240
+ datasetId
241
+ ]);
242
+ }
243
+ /**
244
+ * Fetch and parse grant file from IPFS
245
+ *
246
+ * @remarks
247
+ * Resolves the IPFS hash stored in permission.grant and returns the
248
+ * full grant file with pricing and operation details.
249
+ *
250
+ * @param permission - Permission with grant URL/hash
251
+ * @returns Parsed grant file with pricing and parameters
252
+ * @throws {NetworkError} When IPFS fetch fails
253
+ *
254
+ * @example
255
+ * ```typescript
256
+ * const permission = await sdk.runtimePermissions.getPermission(1024n);
257
+ * const grant = await sdk.runtimePermissions.fetchGrant(permission);
258
+ *
259
+ * console.log(`Task: ${grant.task}`);
260
+ * console.log(`Operation: ${grant.operation}`);
261
+ * console.log(`Price: ${grant.pricing.price_per_file_vana} VANA per file`);
262
+ * ```
263
+ */
264
+ async fetchGrant(permission) {
265
+ return await (0, import_runtimeGrantFiles.retrieveRuntimeGrantFile)(permission.grant);
266
+ }
267
+ }
268
+ // Annotate the CommonJS export names for ESM import in node:
269
+ 0 && (module.exports = {
270
+ RuntimePermissionsController
271
+ });
272
+ //# sourceMappingURL=runtimePermissions.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/controllers/runtimePermissions.ts"],"sourcesContent":["import { getContract } from \"viem\";\nimport { BaseController } from \"./base\";\nimport type {\n RuntimePermissionParams,\n RuntimePermission,\n RuntimeGrantFile,\n RuntimePermissionResult,\n} from \"../types/runtimePermissions\";\nimport type { UnifiedRelayerRequest } from \"../types/relayer\";\nimport {\n createRuntimeGrantFile,\n retrieveRuntimeGrantFile,\n} from \"../utils/runtimeGrantFiles\";\nimport { BlockchainError, NetworkError } from \"../errors\";\nimport { getContractAddress } from \"../generated/addresses\";\nimport { getAbi } from \"../generated/abi\";\n\n/**\n * Controller for VanaRuntimePermissions contract\n *\n * @remarks\n * Manages permissions for data access via Vana Runtime. Allows dataset owners\n * to create monetized access permissions for data consumers to execute operations\n * on their datasets within TEE environments.\n *\n * Follows the same pattern as PermissionsController but for runtime-specific permissions.\n *\n * @category Controllers\n * @example\n * ```typescript\n * // Create a permission for a data consumer\n * const result = await sdk.runtimePermissions.createPermission({\n * datasetId: 123n,\n * grantee: \"0x...\",\n * task: \"vanaorg/vana-task-demo:latest\",\n * operation: \"aggregate_keywords\",\n * pricing: { price_per_file_vana: 0.1 }\n * });\n *\n * console.log(`Permission created with ID: ${result.permissionId}`);\n * console.log(`Grant stored at: ${result.grantUrl}`);\n * ```\n */\nexport class RuntimePermissionsController extends BaseController {\n /**\n * Create a new runtime permission grant\n *\n * @remarks\n * This method:\n * 1. Creates a grant file with pricing and operation details\n * 2. Uploads the grant to IPFS (via relayer if available)\n * 3. Calls VanaRuntimePermissions.createPermission() on-chain\n * 4. Waits for transaction confirmation\n * 5. Returns the permission ID and grant URL\n *\n * @param params - Permission parameters including dataset, grantee, pricing\n * @returns Permission ID, transaction hash, and grant URL\n * @throws {BlockchainError} When permission creation fails\n * @throws {NetworkError} When IPFS upload fails\n *\n * @example\n * ```typescript\n * const result = await sdk.runtimePermissions.createPermission({\n * datasetId: 123n,\n * grantee: \"0x742d35Cc...\",\n * task: \"vanaorg/vana-task-demo:latest\",\n * operation: \"aggregate_keywords\",\n * pricing: {\n * price_per_file_vana: 0.1,\n * minimum_price_vana: 0.01,\n * maximum_price_vana: 100\n * },\n * parameters: {\n * maxFiles: 1000\n * },\n * });\n * ```\n */\n async createPermission(\n params: RuntimePermissionParams,\n ): Promise<RuntimePermissionResult> {\n this.assertWallet();\n\n try {\n // 1. Create grant file\n const grantFile = createRuntimeGrantFile(params);\n\n // 2. Upload to IPFS (via relayer if available, or use provided URL)\n let grantUrl = params.grantUrl;\n if (!grantUrl) {\n if (!this.context.relayer) {\n throw new NetworkError(\n \"No relayer configured and no grantUrl provided. \" +\n \"Configure relayer or provide grantUrl parameter.\",\n );\n }\n\n // Store via relayer\n const request: UnifiedRelayerRequest = {\n type: \"direct\",\n operation: \"storeGrantFile\",\n params: grantFile,\n };\n const response = await this.context.relayer(request);\n if (response.type === \"error\") {\n throw new NetworkError(\n `Failed to store grant file: ${response.error}`,\n );\n }\n if (\n response.type === \"direct\" &&\n typeof response.result === \"object\" &&\n response.result !== null &&\n \"url\" in response.result &&\n typeof response.result.url === \"string\"\n ) {\n grantUrl = response.result.url;\n } else {\n throw new NetworkError(\"Upload succeeded but no URL was returned\");\n }\n }\n\n // 3. Get contract address and ABI\n const chainId = await this.context.publicClient.getChainId();\n const contractAddress = getContractAddress(\n chainId,\n \"VanaRuntimePermissions\",\n );\n const abi = getAbi(\"VanaRuntimePermissions\");\n\n // 4. Convert grantee address to ID\n // NOTE: For MVP, we use address as ID. In production, this should\n // query a grantee registry contract or use a proper ID scheme.\n const granteeId = BigInt(params.grantee);\n\n // 5. Get current block for startBlock\n const startBlock = await this.context.publicClient.getBlockNumber();\n\n // 6. Set endBlock to max uint256 (never expires)\n // Note: Unlike DataPortabilityPermissions which has no on-chain expiration,\n // VanaRuntimePermissions contract requires endBlock. We always set it to\n // max uint256 since we have no way to predict future block numbers from timestamps.\n const endBlock = 2n ** 256n - 1n;\n\n // 7. Call contract to create permission\n const account =\n this.context.walletClient?.account ?? this.context.userAddress;\n\n const hash = await this.context.walletClient.writeContract({\n address: contractAddress,\n abi,\n functionName: \"createPermission\",\n args: [params.datasetId, granteeId, grantUrl, startBlock, endBlock],\n account,\n chain: this.context.walletClient?.chain ?? null,\n });\n\n // 8. Wait for transaction confirmation\n await this.context.publicClient.waitForTransactionReceipt({\n hash,\n });\n\n // 9. Parse PermissionCreated event to get permission ID\n // For MVP, we'll use a placeholder. In production, parse event logs.\n // TODO: Add proper event parsing from receipt.logs\n const permissionId = 0n; // Placeholder\n\n return {\n permissionId,\n hash,\n grantUrl,\n };\n } catch (error) {\n if (error instanceof NetworkError) {\n throw error;\n }\n if (error instanceof Error) {\n throw new BlockchainError(\n `Failed to create runtime permission: ${error.message}`,\n error,\n );\n }\n throw new BlockchainError(\n \"Failed to create runtime permission with unknown error\",\n );\n }\n }\n\n /**\n * Get permission by ID\n *\n * @remarks\n * Fetches permission details from the VanaRuntimePermissions contract.\n * The returned permission contains an IPFS hash in the grant field,\n * which can be resolved using fetchGrant().\n *\n * @param permissionId - Permission identifier\n * @returns Permission details including dataset, grantee, and grant hash\n *\n * @example\n * ```typescript\n * const permission = await sdk.runtimePermissions.getPermission(1024n);\n * console.log(`Dataset: ${permission.datasetId}`);\n * console.log(`Grant: ${permission.grant}`); // IPFS hash\n *\n * // Resolve full grant details\n * const grantFile = await sdk.runtimePermissions.fetchGrant(permission);\n * console.log(`Price: ${grantFile.pricing.price_per_file_vana} VANA`);\n * ```\n */\n async getPermission(permissionId: bigint): Promise<RuntimePermission> {\n const chainId = await this.context.publicClient.getChainId();\n const contractAddress = getContractAddress(\n chainId,\n \"VanaRuntimePermissions\",\n );\n const abi = getAbi(\"VanaRuntimePermissions\");\n\n const contract = getContract({\n address: contractAddress,\n abi,\n client: this.context.publicClient,\n });\n\n return (await contract.read.getPermission([\n permissionId,\n ])) as RuntimePermission;\n }\n\n /**\n * Check if permission is active (not expired)\n *\n * @remarks\n * Returns true if the current block number is between startBlock and endBlock.\n *\n * @param permissionId - Permission identifier\n * @returns Whether permission is currently active\n *\n * @example\n * ```typescript\n * const isActive = await sdk.runtimePermissions.isPermissionActive(1024n);\n * if (isActive) {\n * console.log(\"Permission is valid\");\n * } else {\n * console.log(\"Permission has expired\");\n * }\n * ```\n */\n async isPermissionActive(permissionId: bigint): Promise<boolean> {\n const chainId = await this.context.publicClient.getChainId();\n const contractAddress = getContractAddress(\n chainId,\n \"VanaRuntimePermissions\",\n );\n const abi = getAbi(\"VanaRuntimePermissions\");\n\n const contract = getContract({\n address: contractAddress,\n abi,\n client: this.context.publicClient,\n });\n\n return (await contract.read.isPermissionActive([permissionId])) as boolean;\n }\n\n /**\n * Get all permissions for a dataset\n *\n * @remarks\n * Returns an array of permissions that have been granted for the specified dataset.\n * Useful for dataset owners to view all active permissions.\n *\n * @param datasetId - Dataset identifier\n * @returns Array of runtime permissions\n *\n * @example\n * ```typescript\n * const permissions = await sdk.runtimePermissions.getDatasetPermissions(123n);\n * console.log(`Found ${permissions.length} permissions`);\n *\n * // Access each permission directly\n * for (const permission of permissions) {\n * console.log(`Permission ${permission.id}: ${permission.grant}`);\n * }\n * ```\n */\n async getDatasetPermissions(datasetId: bigint): Promise<RuntimePermission[]> {\n const chainId = await this.context.publicClient.getChainId();\n const contractAddress = getContractAddress(\n chainId,\n \"VanaRuntimePermissions\",\n );\n const abi = getAbi(\"VanaRuntimePermissions\");\n\n const contract = getContract({\n address: contractAddress,\n abi,\n client: this.context.publicClient,\n });\n\n return (await contract.read.getDatasetPermissions([\n datasetId,\n ])) as RuntimePermission[];\n }\n\n /**\n * Fetch and parse grant file from IPFS\n *\n * @remarks\n * Resolves the IPFS hash stored in permission.grant and returns the\n * full grant file with pricing and operation details.\n *\n * @param permission - Permission with grant URL/hash\n * @returns Parsed grant file with pricing and parameters\n * @throws {NetworkError} When IPFS fetch fails\n *\n * @example\n * ```typescript\n * const permission = await sdk.runtimePermissions.getPermission(1024n);\n * const grant = await sdk.runtimePermissions.fetchGrant(permission);\n *\n * console.log(`Task: ${grant.task}`);\n * console.log(`Operation: ${grant.operation}`);\n * console.log(`Price: ${grant.pricing.price_per_file_vana} VANA per file`);\n * ```\n */\n async fetchGrant(permission: RuntimePermission): Promise<RuntimeGrantFile> {\n return await retrieveRuntimeGrantFile(permission.grant);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA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