@opendatalabs/vana-sdk 0.1.0-alpha.9b6ddbc → 0.1.0-alpha.9bbda27

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 (432) hide show
  1. package/README.md +67 -351
  2. package/dist/client/__tests__/enhancedResponse.test.d.ts +1 -0
  3. package/dist/client/enhancedResponse.cjs +164 -0
  4. package/dist/client/enhancedResponse.cjs.map +1 -0
  5. package/dist/client/enhancedResponse.d.ts +120 -0
  6. package/dist/client/enhancedResponse.js +138 -0
  7. package/dist/client/enhancedResponse.js.map +1 -0
  8. package/dist/config/contracts.config.cjs +403 -0
  9. package/dist/config/contracts.config.cjs.map +1 -0
  10. package/dist/config/contracts.config.d.ts +84 -0
  11. package/dist/config/contracts.config.js +378 -0
  12. package/dist/config/contracts.config.js.map +1 -0
  13. package/dist/contracts/contractController.cjs +1 -1
  14. package/dist/contracts/contractController.cjs.map +1 -1
  15. package/dist/contracts/contractController.js +1 -1
  16. package/dist/contracts/contractController.js.map +1 -1
  17. package/dist/controllers/__tests__/data-consistency-integration.test.d.ts +7 -0
  18. package/dist/controllers/__tests__/operations.processQueue.test.d.ts +1 -0
  19. package/dist/controllers/accessSettlement.cjs +289 -0
  20. package/dist/controllers/accessSettlement.cjs.map +1 -0
  21. package/dist/controllers/accessSettlement.d.ts +157 -0
  22. package/dist/controllers/accessSettlement.js +265 -0
  23. package/dist/controllers/accessSettlement.js.map +1 -0
  24. package/dist/controllers/accessSettlement.test.d.ts +1 -0
  25. package/dist/controllers/base.cjs +33 -0
  26. package/dist/controllers/base.cjs.map +1 -1
  27. package/dist/controllers/base.d.ts +10 -0
  28. package/dist/controllers/base.js +33 -0
  29. package/dist/controllers/base.js.map +1 -1
  30. package/dist/controllers/data.cjs +279 -160
  31. package/dist/controllers/data.cjs.map +1 -1
  32. package/dist/controllers/data.d.ts +34 -19
  33. package/dist/controllers/data.js +292 -163
  34. package/dist/controllers/data.js.map +1 -1
  35. package/dist/controllers/dataset.cjs +357 -0
  36. package/dist/controllers/dataset.cjs.map +1 -0
  37. package/dist/controllers/dataset.d.ts +178 -0
  38. package/dist/controllers/dataset.js +333 -0
  39. package/dist/controllers/dataset.js.map +1 -0
  40. package/dist/controllers/dataset.test.d.ts +1 -0
  41. package/dist/controllers/operations.cjs +430 -0
  42. package/dist/controllers/operations.cjs.map +1 -0
  43. package/dist/controllers/operations.d.ts +229 -0
  44. package/dist/controllers/operations.js +406 -0
  45. package/dist/controllers/operations.js.map +1 -0
  46. package/dist/controllers/permissions.cjs +606 -214
  47. package/dist/controllers/permissions.cjs.map +1 -1
  48. package/dist/controllers/permissions.d.ts +141 -34
  49. package/dist/controllers/permissions.js +606 -214
  50. package/dist/controllers/permissions.js.map +1 -1
  51. package/dist/controllers/runtimePermissions.cjs +285 -0
  52. package/dist/controllers/runtimePermissions.cjs.map +1 -0
  53. package/dist/controllers/runtimePermissions.d.ts +152 -0
  54. package/dist/controllers/runtimePermissions.js +264 -0
  55. package/dist/controllers/runtimePermissions.js.map +1 -0
  56. package/dist/controllers/runtimePermissions.test.d.ts +1 -0
  57. package/dist/controllers/schemas.cjs +82 -5
  58. package/dist/controllers/schemas.cjs.map +1 -1
  59. package/dist/controllers/schemas.d.ts +41 -0
  60. package/dist/controllers/schemas.js +82 -5
  61. package/dist/controllers/schemas.js.map +1 -1
  62. package/dist/controllers/server.cjs +184 -49
  63. package/dist/controllers/server.cjs.map +1 -1
  64. package/dist/controllers/server.d.ts +74 -13
  65. package/dist/controllers/server.js +184 -49
  66. package/dist/controllers/server.js.map +1 -1
  67. package/dist/core/__tests__/health.test.d.ts +1 -0
  68. package/dist/core/__tests__/inMemoryNonceManager.test.d.ts +1 -0
  69. package/dist/core/__tests__/nonceManager.test.d.ts +1 -0
  70. package/dist/core/__tests__/pollingManager.test.d.ts +4 -0
  71. package/dist/core/health.cjs +289 -0
  72. package/dist/core/health.cjs.map +1 -0
  73. package/dist/core/health.d.ts +143 -0
  74. package/dist/core/health.js +265 -0
  75. package/dist/core/health.js.map +1 -0
  76. package/dist/core/inMemoryNonceManager.cjs +138 -0
  77. package/dist/core/inMemoryNonceManager.cjs.map +1 -0
  78. package/dist/core/inMemoryNonceManager.d.ts +69 -0
  79. package/dist/core/inMemoryNonceManager.js +114 -0
  80. package/dist/core/inMemoryNonceManager.js.map +1 -0
  81. package/dist/core/nonceManager.cjs +304 -0
  82. package/dist/core/nonceManager.cjs.map +1 -0
  83. package/dist/core/nonceManager.d.ts +116 -0
  84. package/dist/core/nonceManager.js +280 -0
  85. package/dist/core/nonceManager.js.map +1 -0
  86. package/dist/core/pollingManager.cjs +292 -0
  87. package/dist/core/pollingManager.cjs.map +1 -0
  88. package/dist/core/pollingManager.d.ts +120 -0
  89. package/dist/core/pollingManager.js +268 -0
  90. package/dist/core/pollingManager.js.map +1 -0
  91. package/dist/core.cjs +67 -1
  92. package/dist/core.cjs.map +1 -1
  93. package/dist/core.d.ts +63 -3
  94. package/dist/core.js +67 -1
  95. package/dist/core.js.map +1 -1
  96. package/dist/crypto/ecies/__tests__/constants.test.d.ts +1 -1
  97. package/dist/crypto/ecies/__tests__/interface.test.d.ts +1 -0
  98. package/dist/crypto/ecies/__tests__/serialization.test.d.ts +8 -0
  99. package/dist/crypto/ecies/__tests__/utils.test.d.ts +1 -0
  100. package/dist/crypto/ecies/base.cjs +59 -23
  101. package/dist/crypto/ecies/base.cjs.map +1 -1
  102. package/dist/crypto/ecies/base.js +59 -23
  103. package/dist/crypto/ecies/base.js.map +1 -1
  104. package/dist/crypto/ecies/constants.cjs +2 -10
  105. package/dist/crypto/ecies/constants.cjs.map +1 -1
  106. package/dist/crypto/ecies/constants.d.ts +0 -9
  107. package/dist/crypto/ecies/constants.js +1 -8
  108. package/dist/crypto/ecies/constants.js.map +1 -1
  109. package/dist/crypto/ecies/index.cjs.map +1 -1
  110. package/dist/crypto/ecies/index.d.ts +10 -2
  111. package/dist/crypto/ecies/index.js.map +1 -1
  112. package/dist/crypto/ecies/interface.cjs +19 -2
  113. package/dist/crypto/ecies/interface.cjs.map +1 -1
  114. package/dist/crypto/ecies/interface.js +19 -2
  115. package/dist/crypto/ecies/interface.js.map +1 -1
  116. package/dist/errors.cjs +29 -0
  117. package/dist/errors.cjs.map +1 -1
  118. package/dist/errors.d.ts +64 -0
  119. package/dist/errors.js +28 -0
  120. package/dist/errors.js.map +1 -1
  121. package/dist/generated/abi/AccessSettlementImplementation.cjs +635 -0
  122. package/dist/generated/abi/AccessSettlementImplementation.cjs.map +1 -0
  123. package/dist/generated/abi/AccessSettlementImplementation.d.ts +468 -0
  124. package/dist/generated/abi/AccessSettlementImplementation.js +611 -0
  125. package/dist/generated/abi/AccessSettlementImplementation.js.map +1 -0
  126. package/dist/generated/abi/AttestationPolicyImplementation.cjs +614 -0
  127. package/dist/generated/abi/AttestationPolicyImplementation.cjs.map +1 -0
  128. package/dist/generated/abi/AttestationPolicyImplementation.d.ts +449 -0
  129. package/dist/generated/abi/AttestationPolicyImplementation.js +590 -0
  130. package/dist/generated/abi/AttestationPolicyImplementation.js.map +1 -0
  131. package/dist/generated/abi/ComputeEngineImplementation.cjs.map +1 -1
  132. package/dist/generated/abi/ComputeEngineImplementation.js.map +1 -1
  133. package/dist/generated/abi/{DLPTreasuryImplementation.cjs → ComputeEngineTreasuryImplementation.cjs} +16 -92
  134. package/dist/generated/abi/ComputeEngineTreasuryImplementation.cjs.map +1 -0
  135. package/dist/generated/abi/{DLPTreasuryImplementation.d.ts → ComputeEngineTreasuryImplementation.d.ts} +9 -67
  136. package/dist/generated/abi/{DLPTreasuryImplementation.js → ComputeEngineTreasuryImplementation.js} +12 -88
  137. package/dist/generated/abi/ComputeEngineTreasuryImplementation.js.map +1 -0
  138. package/dist/generated/abi/ComputeInstructionRegistryImplementation.cjs.map +1 -1
  139. package/dist/generated/abi/ComputeInstructionRegistryImplementation.js.map +1 -1
  140. package/dist/generated/abi/DATFactoryImplementation.cjs.map +1 -1
  141. package/dist/generated/abi/DATFactoryImplementation.js.map +1 -1
  142. package/dist/generated/abi/DATImplementation.cjs.map +1 -1
  143. package/dist/generated/abi/DATImplementation.js.map +1 -1
  144. package/dist/generated/abi/DATPausableImplementation.cjs.map +1 -1
  145. package/dist/generated/abi/DATPausableImplementation.js.map +1 -1
  146. package/dist/generated/abi/DATVotesImplementation.cjs.map +1 -1
  147. package/dist/generated/abi/DATVotesImplementation.js.map +1 -1
  148. package/dist/generated/abi/DLPPerformanceImplementation.cjs +42 -0
  149. package/dist/generated/abi/DLPPerformanceImplementation.cjs.map +1 -1
  150. package/dist/generated/abi/DLPPerformanceImplementation.d.ts +32 -0
  151. package/dist/generated/abi/DLPPerformanceImplementation.js +42 -0
  152. package/dist/generated/abi/DLPPerformanceImplementation.js.map +1 -1
  153. package/dist/generated/abi/DLPRegistryImplementation.cjs +5 -5
  154. package/dist/generated/abi/DLPRegistryImplementation.cjs.map +1 -1
  155. package/dist/generated/abi/DLPRegistryImplementation.d.ts +4 -4
  156. package/dist/generated/abi/DLPRegistryImplementation.js +5 -5
  157. package/dist/generated/abi/DLPRegistryImplementation.js.map +1 -1
  158. package/dist/generated/abi/DLPRegistryTreasuryImplementation.cjs.map +1 -1
  159. package/dist/generated/abi/DLPRegistryTreasuryImplementation.js.map +1 -1
  160. package/dist/generated/abi/DLPRewardDeployerImplementation.cjs +166 -2
  161. package/dist/generated/abi/DLPRewardDeployerImplementation.cjs.map +1 -1
  162. package/dist/generated/abi/DLPRewardDeployerImplementation.d.ts +129 -2
  163. package/dist/generated/abi/DLPRewardDeployerImplementation.js +166 -2
  164. package/dist/generated/abi/DLPRewardDeployerImplementation.js.map +1 -1
  165. package/dist/generated/abi/DLPRewardSwapImplementation.cjs.map +1 -1
  166. package/dist/generated/abi/DLPRewardSwapImplementation.js.map +1 -1
  167. package/dist/generated/abi/DataLiquidityPoolImplementation.cjs +282 -100
  168. package/dist/generated/abi/DataLiquidityPoolImplementation.cjs.map +1 -1
  169. package/dist/generated/abi/DataLiquidityPoolImplementation.d.ts +218 -79
  170. package/dist/generated/abi/DataLiquidityPoolImplementation.js +281 -99
  171. package/dist/generated/abi/DataLiquidityPoolImplementation.js.map +1 -1
  172. package/dist/generated/abi/DataPortabilityGranteesImplementation.cjs +167 -19
  173. package/dist/generated/abi/DataPortabilityGranteesImplementation.cjs.map +1 -1
  174. package/dist/generated/abi/DataPortabilityGranteesImplementation.d.ts +127 -14
  175. package/dist/generated/abi/DataPortabilityGranteesImplementation.js +167 -19
  176. package/dist/generated/abi/DataPortabilityGranteesImplementation.js.map +1 -1
  177. package/dist/generated/abi/DataPortabilityPermissionsImplementation.cjs +0 -19
  178. package/dist/generated/abi/DataPortabilityPermissionsImplementation.cjs.map +1 -1
  179. package/dist/generated/abi/DataPortabilityPermissionsImplementation.d.ts +0 -14
  180. package/dist/generated/abi/DataPortabilityPermissionsImplementation.js +0 -19
  181. package/dist/generated/abi/DataPortabilityPermissionsImplementation.js.map +1 -1
  182. package/dist/generated/abi/DataPortabilityServersImplementation.cjs +0 -19
  183. package/dist/generated/abi/DataPortabilityServersImplementation.cjs.map +1 -1
  184. package/dist/generated/abi/DataPortabilityServersImplementation.d.ts +0 -14
  185. package/dist/generated/abi/DataPortabilityServersImplementation.js +0 -19
  186. package/dist/generated/abi/DataPortabilityServersImplementation.js.map +1 -1
  187. package/dist/generated/abi/DataRefinerRegistryImplementation.cjs.map +1 -1
  188. package/dist/generated/abi/DataRefinerRegistryImplementation.js.map +1 -1
  189. package/dist/generated/abi/DataRegistryImplementation.cjs +0 -13
  190. package/dist/generated/abi/DataRegistryImplementation.cjs.map +1 -1
  191. package/dist/generated/abi/DataRegistryImplementation.d.ts +0 -10
  192. package/dist/generated/abi/DataRegistryImplementation.js +0 -13
  193. package/dist/generated/abi/DataRegistryImplementation.js.map +1 -1
  194. package/dist/generated/abi/DatasetRegistryImplementation.cjs +751 -0
  195. package/dist/generated/abi/DatasetRegistryImplementation.cjs.map +1 -0
  196. package/dist/generated/abi/DatasetRegistryImplementation.d.ts +557 -0
  197. package/dist/generated/abi/DatasetRegistryImplementation.js +727 -0
  198. package/dist/generated/abi/DatasetRegistryImplementation.js.map +1 -0
  199. package/dist/generated/abi/ProtocolConfigImplementation.cjs +578 -0
  200. package/dist/generated/abi/ProtocolConfigImplementation.cjs.map +1 -0
  201. package/dist/generated/abi/ProtocolConfigImplementation.d.ts +423 -0
  202. package/dist/generated/abi/ProtocolConfigImplementation.js +554 -0
  203. package/dist/generated/abi/ProtocolConfigImplementation.js.map +1 -0
  204. package/dist/generated/abi/QueryEngineImplementation.cjs.map +1 -1
  205. package/dist/generated/abi/QueryEngineImplementation.js.map +1 -1
  206. package/dist/generated/abi/SwapHelperImplementation.cjs +0 -43
  207. package/dist/generated/abi/SwapHelperImplementation.cjs.map +1 -1
  208. package/dist/generated/abi/SwapHelperImplementation.d.ts +0 -35
  209. package/dist/generated/abi/SwapHelperImplementation.js +0 -43
  210. package/dist/generated/abi/SwapHelperImplementation.js.map +1 -1
  211. package/dist/generated/abi/TeePoolDedicatedGpuImplementation.cjs.map +1 -1
  212. package/dist/generated/abi/TeePoolDedicatedGpuImplementation.js.map +1 -1
  213. package/dist/generated/abi/TeePoolDedicatedStandardImplementation.cjs.map +1 -1
  214. package/dist/generated/abi/TeePoolDedicatedStandardImplementation.js.map +1 -1
  215. package/dist/generated/abi/TeePoolEphemeralStandardImplementation.cjs.map +1 -1
  216. package/dist/generated/abi/TeePoolEphemeralStandardImplementation.js.map +1 -1
  217. package/dist/generated/abi/TeePoolPersistentGpuImplementation.cjs.map +1 -1
  218. package/dist/generated/abi/TeePoolPersistentGpuImplementation.js.map +1 -1
  219. package/dist/generated/abi/TeePoolPersistentStandardImplementation.cjs.map +1 -1
  220. package/dist/generated/abi/TeePoolPersistentStandardImplementation.js.map +1 -1
  221. package/dist/generated/abi/TeePoolPhalaImplementation.cjs.map +1 -1
  222. package/dist/generated/abi/TeePoolPhalaImplementation.js.map +1 -1
  223. package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.cjs +1251 -0
  224. package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.cjs.map +1 -0
  225. package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.d.ts +948 -0
  226. package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.js +1227 -0
  227. package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.js.map +1 -0
  228. package/dist/generated/abi/UniswapV3QuoterV2Implementation.cjs +297 -0
  229. package/dist/generated/abi/UniswapV3QuoterV2Implementation.cjs.map +1 -0
  230. package/dist/generated/abi/UniswapV3QuoterV2Implementation.d.ts +206 -0
  231. package/dist/generated/abi/UniswapV3QuoterV2Implementation.js +273 -0
  232. package/dist/generated/abi/UniswapV3QuoterV2Implementation.js.map +1 -0
  233. package/dist/generated/abi/VanaEpochImplementation.cjs +195 -0
  234. package/dist/generated/abi/VanaEpochImplementation.cjs.map +1 -1
  235. package/dist/generated/abi/VanaEpochImplementation.d.ts +151 -0
  236. package/dist/generated/abi/VanaEpochImplementation.js +195 -0
  237. package/dist/generated/abi/VanaEpochImplementation.js.map +1 -1
  238. package/dist/generated/abi/VanaPoolEntityImplementation.cjs +22 -65
  239. package/dist/generated/abi/VanaPoolEntityImplementation.cjs.map +1 -1
  240. package/dist/generated/abi/VanaPoolEntityImplementation.d.ts +17 -51
  241. package/dist/generated/abi/VanaPoolEntityImplementation.js +22 -65
  242. package/dist/generated/abi/VanaPoolEntityImplementation.js.map +1 -1
  243. package/dist/generated/abi/VanaPoolStakingImplementation.cjs +113 -1
  244. package/dist/generated/abi/VanaPoolStakingImplementation.cjs.map +1 -1
  245. package/dist/generated/abi/VanaPoolStakingImplementation.d.ts +85 -1
  246. package/dist/generated/abi/VanaPoolStakingImplementation.js +113 -1
  247. package/dist/generated/abi/VanaPoolStakingImplementation.js.map +1 -1
  248. package/dist/generated/abi/VanaPoolTreasuryImplementation.cjs.map +1 -1
  249. package/dist/generated/abi/VanaPoolTreasuryImplementation.js.map +1 -1
  250. package/dist/generated/abi/VanaRuntimePermissionsImplementation.cjs +759 -0
  251. package/dist/generated/abi/VanaRuntimePermissionsImplementation.cjs.map +1 -0
  252. package/dist/generated/abi/VanaRuntimePermissionsImplementation.d.ts +563 -0
  253. package/dist/generated/abi/VanaRuntimePermissionsImplementation.js +735 -0
  254. package/dist/generated/abi/VanaRuntimePermissionsImplementation.js.map +1 -0
  255. package/dist/generated/abi/VanaRuntimeServersImplementation.cjs +820 -0
  256. package/dist/generated/abi/VanaRuntimeServersImplementation.cjs.map +1 -0
  257. package/dist/generated/abi/VanaRuntimeServersImplementation.d.ts +609 -0
  258. package/dist/generated/abi/VanaRuntimeServersImplementation.js +796 -0
  259. package/dist/generated/abi/VanaRuntimeServersImplementation.js.map +1 -0
  260. package/dist/generated/abi/VanaTreasuryImplementation.cjs +536 -0
  261. package/dist/generated/abi/VanaTreasuryImplementation.cjs.map +1 -0
  262. package/dist/generated/abi/VanaTreasuryImplementation.d.ts +393 -0
  263. package/dist/generated/abi/VanaTreasuryImplementation.js +512 -0
  264. package/dist/generated/abi/VanaTreasuryImplementation.js.map +1 -0
  265. package/dist/generated/abi/WVANAImplementation.cjs +339 -0
  266. package/dist/generated/abi/WVANAImplementation.cjs.map +1 -0
  267. package/dist/generated/abi/WVANAImplementation.d.ts +244 -0
  268. package/dist/generated/abi/WVANAImplementation.js +315 -0
  269. package/dist/generated/abi/WVANAImplementation.js.map +1 -0
  270. package/dist/generated/abi/index.cjs +79 -47
  271. package/dist/generated/abi/index.cjs.map +1 -1
  272. package/dist/generated/abi/index.d.ts +15783 -10449
  273. package/dist/generated/abi/index.js +65 -43
  274. package/dist/generated/abi/index.js.map +1 -1
  275. package/dist/{config → generated}/addresses.cjs +174 -75
  276. package/dist/generated/addresses.cjs.map +1 -0
  277. package/dist/{config → generated}/addresses.d.ts +174 -165
  278. package/dist/{config → generated}/addresses.js +174 -75
  279. package/dist/generated/addresses.js.map +1 -0
  280. package/dist/generated/event-types.cjs.map +1 -1
  281. package/dist/generated/event-types.d.ts +482 -399
  282. package/dist/generated/eventRegistry.cjs +2601 -724
  283. package/dist/generated/eventRegistry.cjs.map +1 -1
  284. package/dist/generated/eventRegistry.d.ts +2 -2
  285. package/dist/generated/eventRegistry.js +2601 -724
  286. package/dist/generated/eventRegistry.js.map +1 -1
  287. package/dist/generated/server/server-exports.cjs +22 -0
  288. package/dist/generated/server/server-exports.cjs.map +1 -1
  289. package/dist/generated/server/server-exports.d.ts +31 -11
  290. package/dist/generated/server/server-exports.js +17 -0
  291. package/dist/generated/server/server-exports.js.map +1 -1
  292. package/dist/generated/server/server.cjs.map +1 -1
  293. package/dist/generated/server/server.d.ts +771 -402
  294. package/dist/generated/subgraph.cjs +797 -32
  295. package/dist/generated/subgraph.cjs.map +1 -1
  296. package/dist/generated/subgraph.d.ts +135 -0
  297. package/dist/generated/subgraph.js +792 -32
  298. package/dist/generated/subgraph.js.map +1 -1
  299. package/dist/index.browser.d.ts +7 -1
  300. package/dist/index.browser.js +26 -1
  301. package/dist/index.browser.js.map +1 -1
  302. package/dist/index.node.cjs +47 -1
  303. package/dist/index.node.cjs.map +1 -1
  304. package/dist/index.node.d.ts +55 -6
  305. package/dist/index.node.js +43 -2
  306. package/dist/index.node.js.map +1 -1
  307. package/dist/lib/__tests__/redisAtomicStore.test.d.ts +1 -0
  308. package/dist/lib/redisAtomicStore.cjs +201 -0
  309. package/dist/lib/redisAtomicStore.cjs.map +1 -0
  310. package/dist/lib/redisAtomicStore.d.ts +120 -0
  311. package/dist/lib/redisAtomicStore.js +177 -0
  312. package/dist/lib/redisAtomicStore.js.map +1 -0
  313. package/dist/server/relayerHandler.cjs +313 -75
  314. package/dist/server/relayerHandler.cjs.map +1 -1
  315. package/dist/server/relayerHandler.d.ts +35 -2
  316. package/dist/server/relayerHandler.js +313 -75
  317. package/dist/server/relayerHandler.js.map +1 -1
  318. package/dist/storage/index.cjs +3 -0
  319. package/dist/storage/index.cjs.map +1 -1
  320. package/dist/storage/index.d.ts +1 -0
  321. package/dist/storage/index.js +2 -0
  322. package/dist/storage/index.js.map +1 -1
  323. package/dist/storage/providers/dropbox.cjs +237 -0
  324. package/dist/storage/providers/dropbox.cjs.map +1 -0
  325. package/dist/storage/providers/dropbox.d.ts +39 -0
  326. package/dist/storage/providers/dropbox.js +215 -0
  327. package/dist/storage/providers/dropbox.js.map +1 -0
  328. package/dist/storage/providers/dropbox.test.d.ts +1 -0
  329. package/dist/tests/data-upload-owner-validation.test.d.ts +1 -0
  330. package/dist/types/accessSettlement.cjs +17 -0
  331. package/dist/types/accessSettlement.cjs.map +1 -0
  332. package/dist/types/accessSettlement.d.ts +66 -0
  333. package/dist/types/accessSettlement.js +1 -0
  334. package/dist/types/accessSettlement.js.map +1 -0
  335. package/dist/types/atomicStore.cjs +31 -0
  336. package/dist/types/atomicStore.cjs.map +1 -0
  337. package/dist/types/atomicStore.d.ts +236 -0
  338. package/dist/types/atomicStore.js +7 -0
  339. package/dist/types/atomicStore.js.map +1 -0
  340. package/dist/types/config.cjs.map +1 -1
  341. package/dist/types/config.d.ts +32 -0
  342. package/dist/types/config.js.map +1 -1
  343. package/dist/types/controller-context.cjs.map +1 -1
  344. package/dist/types/controller-context.d.ts +4 -1
  345. package/dist/types/data.cjs.map +1 -1
  346. package/dist/types/data.d.ts +7 -4
  347. package/dist/types/dataset.cjs +17 -0
  348. package/dist/types/dataset.cjs.map +1 -0
  349. package/dist/types/dataset.d.ts +51 -0
  350. package/dist/types/dataset.js +1 -0
  351. package/dist/types/dataset.js.map +1 -0
  352. package/dist/types/generics.cjs.map +1 -1
  353. package/dist/types/generics.d.ts +1 -1
  354. package/dist/types/index.cjs.map +1 -1
  355. package/dist/types/index.d.ts +7 -2
  356. package/dist/types/index.js.map +1 -1
  357. package/dist/types/operationStore.cjs +17 -0
  358. package/dist/types/operationStore.cjs.map +1 -0
  359. package/dist/types/operationStore.d.ts +171 -0
  360. package/dist/types/operationStore.js +1 -0
  361. package/dist/types/operationStore.js.map +1 -0
  362. package/dist/types/operations.cjs +3 -15
  363. package/dist/types/operations.cjs.map +1 -1
  364. package/dist/types/operations.d.ts +8 -52
  365. package/dist/types/operations.js +2 -13
  366. package/dist/types/operations.js.map +1 -1
  367. package/dist/types/options.cjs +17 -0
  368. package/dist/types/options.cjs.map +1 -0
  369. package/dist/types/options.d.ts +308 -0
  370. package/dist/types/options.js +1 -0
  371. package/dist/types/options.js.map +1 -0
  372. package/dist/types/permissions.cjs.map +1 -1
  373. package/dist/types/permissions.d.ts +4 -0
  374. package/dist/types/relayer.cjs.map +1 -1
  375. package/dist/types/relayer.d.ts +55 -10
  376. package/dist/types/runtimePermissions.cjs +17 -0
  377. package/dist/types/runtimePermissions.cjs.map +1 -0
  378. package/dist/types/runtimePermissions.d.ts +122 -0
  379. package/dist/types/runtimePermissions.js +1 -0
  380. package/dist/types/runtimePermissions.js.map +1 -0
  381. package/dist/types/utils.cjs.map +1 -1
  382. package/dist/types/utils.d.ts +0 -49
  383. package/dist/utils/__tests__/chainQuery.test.d.ts +1 -0
  384. package/dist/utils/__tests__/subgraphConsistency.test.d.ts +4 -0
  385. package/dist/utils/__tests__/subgraphPagination.test.d.ts +4 -0
  386. package/dist/utils/blockchain/registry.cjs +1 -1
  387. package/dist/utils/blockchain/registry.cjs.map +1 -1
  388. package/dist/utils/blockchain/registry.js +1 -1
  389. package/dist/utils/blockchain/registry.js.map +1 -1
  390. package/dist/utils/chainQuery.cjs +107 -0
  391. package/dist/utils/chainQuery.cjs.map +1 -0
  392. package/dist/utils/chainQuery.d.ts +31 -0
  393. package/dist/utils/chainQuery.js +82 -0
  394. package/dist/utils/chainQuery.js.map +1 -0
  395. package/dist/utils/grantFiles.cjs +4 -1
  396. package/dist/utils/grantFiles.cjs.map +1 -1
  397. package/dist/utils/grantFiles.js +4 -1
  398. package/dist/utils/grantFiles.js.map +1 -1
  399. package/dist/utils/ipfs.cjs +1 -3
  400. package/dist/utils/ipfs.cjs.map +1 -1
  401. package/dist/utils/ipfs.d.ts +4 -4
  402. package/dist/utils/ipfs.js +1 -3
  403. package/dist/utils/ipfs.js.map +1 -1
  404. package/dist/utils/multicall.cjs +1 -1
  405. package/dist/utils/multicall.cjs.map +1 -1
  406. package/dist/utils/multicall.js +1 -1
  407. package/dist/utils/multicall.js.map +1 -1
  408. package/dist/utils/runtimeGrantFiles.cjs +84 -0
  409. package/dist/utils/runtimeGrantFiles.cjs.map +1 -0
  410. package/dist/utils/runtimeGrantFiles.d.ts +66 -0
  411. package/dist/utils/runtimeGrantFiles.js +58 -0
  412. package/dist/utils/runtimeGrantFiles.js.map +1 -0
  413. package/dist/utils/subgraphConsistency.cjs +184 -0
  414. package/dist/utils/subgraphConsistency.cjs.map +1 -0
  415. package/dist/utils/subgraphConsistency.d.ts +65 -0
  416. package/dist/utils/subgraphConsistency.js +155 -0
  417. package/dist/utils/subgraphConsistency.js.map +1 -0
  418. package/dist/utils/subgraphMetaCache.cjs +101 -0
  419. package/dist/utils/subgraphMetaCache.cjs.map +1 -0
  420. package/dist/utils/subgraphMetaCache.d.ts +56 -0
  421. package/dist/utils/subgraphMetaCache.js +76 -0
  422. package/dist/utils/subgraphMetaCache.js.map +1 -0
  423. package/dist/utils/subgraphPagination.cjs +104 -0
  424. package/dist/utils/subgraphPagination.cjs.map +1 -0
  425. package/dist/utils/subgraphPagination.d.ts +78 -0
  426. package/dist/utils/subgraphPagination.js +78 -0
  427. package/dist/utils/subgraphPagination.js.map +1 -0
  428. package/package.json +7 -2
  429. package/dist/config/addresses.cjs.map +0 -1
  430. package/dist/config/addresses.js.map +0 -1
  431. package/dist/generated/abi/DLPTreasuryImplementation.cjs.map +0 -1
  432. package/dist/generated/abi/DLPTreasuryImplementation.js.map +0 -1
@@ -0,0 +1,308 @@
1
+ /**
2
+ * @file Standard option types for Vana SDK methods
3
+ * @module vana-sdk/types/options
4
+ */
5
+ /**
6
+ * Transaction options for blockchain write operations.
7
+ *
8
+ * @remarks
9
+ * Aligned with viem's transaction parameters for consistency.
10
+ * These options control gas pricing, limits, polling behavior, and other transaction-specific settings.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * // Basic usage with gas options
15
+ * await vana.data.upload(params, {
16
+ * gas: 1000000n,
17
+ * maxFeePerGas: 20000000000n
18
+ * });
19
+ *
20
+ * // With status updates for long-running operations
21
+ * await vana.permissions.grant({ grantee: '0x...' }, {
22
+ * onStatusUpdate: (status) => {
23
+ * if (status.type === 'queued') {
24
+ * console.log(`Position in queue: ${status.position}`);
25
+ * }
26
+ * }
27
+ * });
28
+ *
29
+ * // With cancellation support
30
+ * const controller = new AbortController();
31
+ * const promise = vana.permissions.grant({ grantee: '0x...' }, {
32
+ * signal: controller.signal
33
+ * });
34
+ * // Cancel after 30 seconds
35
+ * setTimeout(() => controller.abort(), 30000);
36
+ * ```
37
+ *
38
+ * @category Options
39
+ */
40
+ export interface TransactionOptions {
41
+ /** Gas limit for the transaction */
42
+ gas?: bigint;
43
+ /** Gas price in wei (for legacy transactions) */
44
+ gasPrice?: bigint;
45
+ /** Maximum fee per gas in wei (EIP-1559) */
46
+ maxFeePerGas?: bigint;
47
+ /** Maximum priority fee per gas in wei (EIP-1559) */
48
+ maxPriorityFeePerGas?: bigint;
49
+ /** Transaction nonce override */
50
+ nonce?: number;
51
+ /** ETH value to send with transaction */
52
+ value?: bigint;
53
+ /**
54
+ * AbortSignal for cancelling long-running operations.
55
+ *
56
+ * @remarks
57
+ * Useful for cancelling pending transactions or polling operations.
58
+ * When aborted, the operation will throw an error immediately.
59
+ */
60
+ signal?: AbortSignal;
61
+ /**
62
+ * Callback for receiving status updates during long-running operations.
63
+ *
64
+ * @remarks
65
+ * Called whenever the operation status changes (e.g., from pending to queued).
66
+ * Useful for showing progress in UI during multi-minute operations.
67
+ *
68
+ * @param status - The current operation status
69
+ */
70
+ onStatusUpdate?: (status: OperationStatus) => void;
71
+ /**
72
+ * Custom polling options for long-running operations.
73
+ *
74
+ * @remarks
75
+ * Overrides default polling behavior for operations that use the relayer.
76
+ * Generally not needed unless you have specific timing requirements.
77
+ */
78
+ pollingOptions?: {
79
+ /** Total timeout in milliseconds (default: 300000 = 5 min) */
80
+ timeout?: number;
81
+ /** Initial polling interval in milliseconds (default: 1000) */
82
+ initialInterval?: number;
83
+ /** Maximum polling interval in milliseconds (default: 10000) */
84
+ maxInterval?: number;
85
+ };
86
+ }
87
+ /**
88
+ * Represents the current status of a blockchain operation.
89
+ *
90
+ * @remarks
91
+ * Used for status updates during long-running operations via the onStatusUpdate callback.
92
+ * Provides detailed information about the operation's progress through its lifecycle.
93
+ *
94
+ * @category Options
95
+ */
96
+ export type OperationStatus = {
97
+ /** Operation is pending, not yet processed */
98
+ type: "pending";
99
+ /** The operation ID for tracking */
100
+ operationId: string;
101
+ } | {
102
+ /** Operation is queued for processing */
103
+ type: "queued";
104
+ /** Position in the processing queue */
105
+ position?: number;
106
+ /** Estimated wait time in seconds */
107
+ estimatedWait?: number;
108
+ } | {
109
+ /** Operation is actively being processed */
110
+ type: "processing";
111
+ } | {
112
+ /** Transaction has been submitted to blockchain */
113
+ type: "submitted";
114
+ /** The transaction hash */
115
+ hash: `0x${string}`;
116
+ } | {
117
+ /** Transaction has been confirmed on-chain */
118
+ type: "confirmed";
119
+ /** The transaction hash */
120
+ hash: `0x${string}`;
121
+ /** The transaction receipt if available */
122
+ receipt?: unknown;
123
+ } | {
124
+ /** Operation failed with an error */
125
+ type: "failed";
126
+ /** Error message describing the failure */
127
+ error: string;
128
+ /** Operation ID if available for recovery */
129
+ operationId?: string;
130
+ };
131
+ /**
132
+ * Source selection for data queries.
133
+ *
134
+ * @remarks
135
+ * - `chain`: Query directly from blockchain (immediate consistency)
136
+ * - `subgraph`: Query from indexed subgraph (may lag 15-60s)
137
+ * - `auto`: SDK chooses optimal source (default)
138
+ *
139
+ * @category Options
140
+ */
141
+ export type DataSource = "chain" | "subgraph" | "auto";
142
+ /**
143
+ * Consistency options for read operations.
144
+ *
145
+ * @remarks
146
+ * Controls data freshness requirements and source selection.
147
+ * Essential for read-after-write consistency when data must reflect recent transactions.
148
+ *
149
+ * @example
150
+ * ```typescript
151
+ * // Ensure data includes a recent transaction
152
+ * const files = await vana.data.getUserFiles({ owner }, {
153
+ * minBlock: receipt.blockNumber,
154
+ * waitForSync: 30000 // Wait up to 30s
155
+ * });
156
+ * ```
157
+ *
158
+ * @category Options
159
+ */
160
+ export interface ConsistencyOptions {
161
+ /**
162
+ * Minimum block number the data source must have indexed.
163
+ *
164
+ * @remarks
165
+ * Operation will fail or wait (if waitForSync set) until source reaches this block.
166
+ * Critical for ensuring recently created data is visible.
167
+ */
168
+ minBlock?: number;
169
+ /**
170
+ * Maximum milliseconds to wait for data source to sync to minBlock.
171
+ *
172
+ * @remarks
173
+ * If not set, operation fails immediately when source is behind.
174
+ * Useful for critical operations where waiting is preferable to failure.
175
+ *
176
+ * @default undefined (no waiting)
177
+ */
178
+ waitForSync?: number;
179
+ /**
180
+ * Explicitly select data source.
181
+ *
182
+ * @remarks
183
+ * Useful for debugging or when specific consistency guarantees are needed.
184
+ * Not all methods support all sources - unsupported selections will error.
185
+ *
186
+ * @default 'auto'
187
+ */
188
+ source?: DataSource;
189
+ /**
190
+ * AbortSignal for cancelling long-running operations.
191
+ *
192
+ * @remarks
193
+ * Particularly useful with waitForSync to cancel polling operations.
194
+ * Properly cleans up timers and pending requests when aborted.
195
+ *
196
+ * @example
197
+ * ```typescript
198
+ * const controller = new AbortController();
199
+ * const promise = vana.data.getUserFiles(
200
+ * { owner },
201
+ * { waitForSync: 30000, signal: controller.signal }
202
+ * );
203
+ *
204
+ * // Cancel after 5 seconds
205
+ * setTimeout(() => controller.abort(), 5000);
206
+ * ```
207
+ */
208
+ signal?: AbortSignal;
209
+ }
210
+ /**
211
+ * Pagination options for list operations.
212
+ *
213
+ * @remarks
214
+ * Controls result set size, ordering, and pagination.
215
+ * By default returns first 100 items to prevent accidental large fetches.
216
+ *
217
+ * @example
218
+ * ```typescript
219
+ * // Get all files (explicit opt-in)
220
+ * const allFiles = await vana.data.getUserFiles({ owner }, {
221
+ * fetchAll: true
222
+ * });
223
+ *
224
+ * // Get 10 most recent files
225
+ * const recentFiles = await vana.data.getUserFiles({ owner }, {
226
+ * limit: 10,
227
+ * orderBy: 'addedAtBlock',
228
+ * orderDirection: 'desc'
229
+ * });
230
+ * ```
231
+ *
232
+ * @category Options
233
+ */
234
+ export interface PaginationOptions {
235
+ /**
236
+ * Maximum number of items to return.
237
+ *
238
+ * @remarks
239
+ * Prevents accidental large fetches. Use fetchAll: true for unlimited.
240
+ *
241
+ * @default 100
242
+ */
243
+ limit?: number;
244
+ /**
245
+ * Number of items to skip (for manual pagination).
246
+ *
247
+ * @default 0
248
+ */
249
+ offset?: number;
250
+ /**
251
+ * Field to order results by.
252
+ *
253
+ * @remarks
254
+ * Field names depend on the entity type.
255
+ * Common: 'id', 'addedAtBlock', 'addedAtTimestamp'
256
+ */
257
+ orderBy?: string;
258
+ /**
259
+ * Sort direction for orderBy field.
260
+ *
261
+ * @default 'desc' for timestamp/block fields, 'asc' for others
262
+ */
263
+ orderDirection?: "asc" | "desc";
264
+ /**
265
+ * Explicitly fetch all available items.
266
+ *
267
+ * @remarks
268
+ * Override safety limit. SDK will paginate internally to fetch all results.
269
+ * Use with caution - can result in many API calls and large memory usage.
270
+ *
271
+ * @default false
272
+ */
273
+ fetchAll?: boolean;
274
+ }
275
+ /**
276
+ * Combined options for read operations that return lists.
277
+ *
278
+ * @remarks
279
+ * Convenience type combining consistency and pagination controls.
280
+ *
281
+ * @category Options
282
+ */
283
+ export type ListOptions = ConsistencyOptions & PaginationOptions;
284
+ /**
285
+ * Combined options for write operations that may read data.
286
+ *
287
+ * @remarks
288
+ * Some write operations need to read data (e.g., schema validation).
289
+ * This type combines transaction and consistency options.
290
+ *
291
+ * @category Options
292
+ */
293
+ export type WriteOptions = TransactionOptions & ConsistencyOptions;
294
+ /**
295
+ * Legacy transaction options type for backwards compatibility.
296
+ *
297
+ * @deprecated Use TransactionOptions instead. Will be removed in next major version.
298
+ * @category Options
299
+ */
300
+ export interface LegacyTransactionOptions {
301
+ /** @deprecated Use `gas` instead */
302
+ gasLimit?: bigint;
303
+ gasPrice?: bigint;
304
+ maxFeePerGas?: bigint;
305
+ maxPriorityFeePerGas?: bigint;
306
+ nonce?: number;
307
+ value?: bigint;
308
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/permissions.ts"],"sourcesContent":["import type { Address, Hash } from \"viem\";\n\n/**\n * Base interface for types that need to be compatible with Record<string, unknown>\n *\n * @category Permissions\n */\nexport interface RecordCompatible {\n [key: string]: unknown;\n}\n\n/**\n * Contains on-chain permission data for efficient retrieval.\n *\n * @remarks\n * Provides fast access to permission metadata from subgraph without\n * IPFS calls. For detailed parameters, resolve `grantUrl` separately.\n *\n * @category Permissions\n * @example\n * ```typescript\n * const grants = await vana.permissions.getUserPermissionGrantsOnChain();\n *\n * // Resolve details when needed\n * const details = await retrieveGrantFile(grants[0].grantUrl);\n * console.log(`Operation: ${details.operation}`);\n * ```\n */\nexport interface OnChainPermissionGrant {\n /** Unique identifier for the permission */\n id: bigint;\n /** The grant URL containing detailed permission parameters (IPFS link) */\n grantUrl: string;\n /** Cryptographic signature that authorized this permission */\n grantSignature: string;\n /** Nonce used when granting the permission */\n nonce: bigint;\n /** Block number when permission started */\n startBlock: bigint;\n /** Block number when permission was granted */\n addedAtBlock: bigint;\n /** Timestamp when permission was added */\n addedAtTimestamp: bigint;\n /** Transaction hash of the grant transaction */\n transactionHash: string;\n /** Address that granted the permission */\n grantor: Address;\n /** Grantee information */\n grantee: {\n /** Grantee ID */\n id: string;\n /** Grantee address */\n address: string;\n };\n /** Whether the permission is still active (not revoked) */\n active: boolean;\n}\n\n/**\n * Options for retrieving user permissions\n *\n * @category Permissions\n */\nexport interface GetUserPermissionsOptions {\n /** Maximum number of permissions to retrieve */\n limit?: number;\n /** Custom subgraph URL to use for querying */\n subgraphUrl?: string;\n}\n\n/**\n * Defines parameters for granting file access permissions.\n *\n * @remarks\n * Specifies application, operation, files, and parameters for\n * permission grants via `vana.permissions.grant()`.\n *\n * @category Permissions\n * @example\n * ```typescript\n * const params: GrantPermissionParams = {\n * grantee: '0x1234...',\n * operation: 'llm_inference',\n * files: [1, 2, 3],\n * parameters: { model: 'gpt-4', maxTokens: 1000 }\n * };\n * const result = await vana.permissions.grant(params);\n * ```\n */\nexport interface GrantPermissionParams {\n /** The on-chain identity of the application */\n grantee: Address;\n /** The class of computation, e.g., \"llm_inference\" */\n operation: string;\n /**\n * Array of file IDs to grant permission for.\n * Obtain file IDs from `vana.data.getUserFiles()` or from upload results via `vana.data.upload().fileId`.\n */\n files: number[];\n /** The full, off-chain parameters (e.g., LLM prompt) */\n parameters: Record<string, unknown>;\n /** Optional pre-stored grant URL to avoid duplicate IPFS storage */\n grantUrl?: string;\n /** Optional nonce for the permission */\n nonce?: bigint;\n /** Optional expiration time for the permission */\n expiresAt?: number;\n}\n\n/**\n * Parameters for revoking a previously granted data access permission.\n *\n * Used with `PermissionsController.revoke()` to remove an application's access\n * to user data. Once revoked, the application can no longer use the permission\n * to access the specified files.\n *\n * @category Permissions\n * @example\n * ```typescript\n * const revokeParams: RevokePermissionParams = {\n * permissionId: 123n // Permission ID to revoke\n * };\n *\n * await vana.permissions.revoke(revokeParams);\n * ```\n */\nexport interface RevokePermissionParams {\n /** The permission ID to revoke */\n permissionId: bigint;\n}\n\n/**\n * Parameters for checking if a specific permission exists and is valid.\n *\n * Used to verify whether an application has active permission to access\n * specific user files for a particular operation before attempting to use the data.\n *\n * @category Permissions\n * @example\n * ```typescript\n * const checkParams: CheckPermissionParams = {\n * application: '0x1234...', // App address\n * operation: 'llm_inference',\n * files: [1, 2, 3], // File IDs to check\n * parameters: { model: 'gpt-4' }, // Operation parameters\n * user: '0xabcd...' // Optional specific user\n * };\n *\n * const hasPermission = await vana.permissions.check(checkParams);\n * ```\n */\nexport interface CheckPermissionParams {\n /** The application address */\n application: Address;\n /** The operation type */\n operation: string;\n /** The file IDs */\n files: number[];\n /** The grant parameters */\n parameters: Record<string, unknown>;\n /** The user address */\n user?: Address;\n}\n\n/**\n * Permission check result\n *\n * @category Permissions\n */\nexport interface PermissionCheckResult {\n /** Whether the permission exists and is valid */\n exists: boolean;\n /** The permission details if it exists */\n permission?: GrantedPermission;\n /** Reason why permission is invalid (if applicable) */\n reason?: string;\n}\n\n/**\n * EIP-712 domain definition for PermissionGrant signatures\n *\n * @category Permissions\n */\nexport interface PermissionGrantDomain {\n /** Domain name */\n name: string;\n /** Domain version */\n version: string;\n /** Chain ID */\n chainId: number;\n /** Verifying contract address */\n verifyingContract: Address;\n}\n\n/**\n * EIP-712 Permission message structure (current contract format)\n *\n * @category Permissions\n */\nexport interface PermissionGrantMessage {\n /** Application address */\n application: Address;\n /** File IDs */\n files: number[];\n /** Operation type */\n operation: string;\n /** Grant URL */\n grant: string;\n /** Parameters as JSON string */\n parameters: string;\n /** Nonce */\n nonce: bigint;\n}\n\n/**\n * EIP-712 PermissionInput message structure (new simplified format)\n *\n * @category Permissions\n */\nexport interface PermissionInputMessage extends RecordCompatible {\n /** Nonce */\n nonce: bigint;\n /** Grantee ID */\n granteeId: bigint;\n /** Grant URL */\n grant: string;\n /** File IDs */\n fileIds: bigint[];\n}\n\n/**\n * Contract PermissionInput structure\n *\n * @category Permissions\n */\nexport interface PermissionInput {\n /** Nonce */\n nonce: bigint;\n /** Grantee ID */\n granteeId: bigint;\n /** Grant URL */\n grant: string;\n /** File IDs to grant permission for */\n fileIds: bigint[];\n}\n\n/**\n * Contract RevokePermissionInput structure\n *\n * @category Permissions\n */\nexport interface RevokePermissionInput extends RecordCompatible {\n /** Nonce */\n nonce: bigint;\n /** Permission ID to revoke */\n permissionId: bigint;\n}\n\n/**\n * Contract Permission Info structure returned from the contract\n *\n * @category Permissions\n */\nexport interface PermissionInfo {\n /** Permission ID */\n id: bigint;\n /** Address that granted the permission */\n grantor: Address;\n /** Nonce used when creating */\n nonce: bigint;\n /** Grantee ID */\n granteeId: bigint;\n /** Grant URL */\n grant: string;\n /** Signature bytes (removed in newer contract versions) */\n signature?: `0x${string}`;\n /** Start block */\n startBlock: bigint;\n /** End block */\n endBlock: bigint;\n /** File IDs associated with this permission */\n fileIds: readonly bigint[];\n}\n\n/**\n * EIP-712 Permission message structure (simplified future format)\n *\n * @category Permissions\n */\nexport interface SimplifiedPermissionMessage {\n /** Application address */\n application: Address;\n /** Grant URL */\n grant: string;\n /** Nonce */\n nonce: bigint;\n}\n\n/**\n * Grant file structure containing permission details.\n *\n * Grant files contain the complete specification of what an application is permitted\n * to do with user data, including operation parameters and file access rights.\n *\n * @category Permissions\n * @example\n * ```typescript\n * const grantFile: GrantFile = {\n * grantee: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',\n * operation: 'llm_inference',\n * parameters: {\n * prompt: 'Analyze this data: {{data}}',\n * model: 'gpt-4',\n * maxTokens: 2000,\n * temperature: 0.7\n * },\n * expires: 1736467579\n * };\n * ```\n */\nexport interface GrantFile {\n /** EVM address of the application authorized to use this grant */\n grantee: Address;\n /** Operation the grantee is authorized to perform */\n operation: string;\n /** Operation-specific parameters */\n parameters: Record<string, unknown>;\n /** Optional Unix timestamp when grant expires (seconds since epoch per POSIX.1-2008) */\n expires?: number;\n}\n\n/**\n * EIP-712 typed data structure for Permission\n *\n * @category Permissions\n */\nexport interface PermissionGrantTypedData extends GenericTypedData {\n /** EIP-712 types */\n types: {\n Permission: Array<{\n name: string;\n type: string;\n }>;\n };\n /** Primary type */\n primaryType: \"Permission\";\n /** Message to sign */\n message: PermissionInputMessage;\n}\n\n/**\n * Generic EIP-712 typed data structure\n *\n * @category Permissions\n */\nexport interface GenericTypedData extends RecordCompatible {\n /** EIP-712 domain */\n domain: PermissionGrantDomain;\n /** EIP-712 types */\n types: Record<string, Array<{ name: string; type: string }>>;\n /** Primary type */\n primaryType: string;\n /** Message to sign */\n message: Record<string, unknown>;\n}\n\n/**\n * Represents EIP-712 typed data for permission revocation.\n *\n * @remarks\n * Used when revoking previously granted permissions through gasless transactions.\n * The message contains a nonce and the permission ID to revoke.\n *\n * @category Permissions\n */\nexport interface RevokePermissionTypedData extends GenericTypedData {\n /** EIP-712 type definitions for the RevokePermission structure */\n types: {\n RevokePermission: Array<{\n name: string;\n type: string;\n }>;\n };\n /** The primary type identifier for revocation operations */\n primaryType: \"RevokePermission\";\n /** The structured message containing revocation parameters */\n message: RevokePermissionInput;\n}\n\n/**\n * Defines all valid primary types for EIP-712 typed data in the Vana SDK.\n *\n * @remarks\n * These literal types ensure compile-time safety when handling typed data operations.\n * Each corresponds to a specific blockchain operation type.\n *\n * @category Permissions\n */\nexport type TypedDataPrimaryType =\n | \"Permission\"\n | \"RevokePermission\"\n | \"TrustServer\"\n | \"UntrustServer\"\n | \"AddServer\"\n | \"RegisterGrantee\"\n | \"ServerFilesAndPermission\";\n\n/**\n * Represents the union of all specific typed data interfaces.\n *\n * @remarks\n * Enables type-safe handling of any typed data structure in the SDK.\n * Used internally by relayer handlers and signature verification.\n *\n * @category Permissions\n */\nexport type SpecificTypedData =\n | PermissionGrantTypedData\n | RevokePermissionTypedData\n | TrustServerTypedData\n | UntrustServerTypedData\n | AddAndTrustServerTypedData\n | RegisterGranteeTypedData\n | ServerFilesAndPermissionTypedData;\n\n/**\n * Permission operation types\n *\n * @category Permissions\n */\nexport type PermissionOperation =\n | \"llm_inference\"\n | \"data_analysis\"\n | \"model_training\"\n | \"data_sharing\"\n | \"compute_task\"\n | string;\n\n/**\n * Permission status\n *\n * @category Permissions\n */\nexport type PermissionStatus = \"active\" | \"revoked\" | \"expired\" | \"pending\";\n\n/**\n * Parameters for querying permissions\n *\n * @category Permissions\n */\nexport interface QueryPermissionsParams {\n /** Filter by grantor address */\n grantor?: Address;\n /** Filter by grantee address */\n grantee?: Address;\n /** Filter by operation type */\n operation?: PermissionOperation;\n /** Filter by file IDs */\n files?: number[];\n /** Filter by status */\n status?: PermissionStatus;\n /** Starting block number */\n fromBlock?: bigint;\n /** Ending block number */\n toBlock?: bigint;\n /** Maximum number of results */\n limit?: number;\n /** Offset for pagination */\n offset?: number;\n}\n\n/**\n * Granted permission details\n *\n * @category Permissions\n */\nexport interface GrantedPermission {\n /** Unique identifier for the permission */\n id: bigint;\n /** Array of file IDs that the permission applies to */\n files: number[];\n /** The type of operation being granted permission for */\n operation: string;\n /** Grant file reference (IPFS hash or URL) */\n grant: string;\n /** Address of the application granted permission */\n grantee: Address;\n /** Address of the user who granted permission */\n grantor: Address;\n /** Custom parameters for the operation */\n parameters: Record<string, unknown>;\n /** Whether the permission is still active */\n active: boolean;\n /** Data status for the permission */\n dataStatus?: string;\n /** Nonce used for the permission */\n nonce?: number;\n /** Timestamp when permission was granted */\n grantedAt?: number;\n /** Optional expiration timestamp */\n expiresAt?: number;\n /** Transaction hash of the grant transaction */\n transactionHash?: string;\n /** Block number when permission was granted */\n blockNumber?: bigint;\n}\n\n/**\n * Permission query result\n *\n * @category Permissions\n */\nexport interface PermissionQueryResult {\n /** Array of permissions matching the query */\n permissions: GrantedPermission[];\n /** Total number of permissions (for pagination) */\n total: number;\n /** Whether there are more results available */\n hasMore: boolean;\n}\n\n/**\n * Permission analytics data\n *\n * @category Permissions\n */\nexport interface PermissionAnalytics {\n /** Total number of permissions granted */\n totalPermissions: number;\n /** Number of active permissions */\n activePermissions: number;\n /** Number of revoked permissions */\n revokedPermissions: number;\n /** Number of expired permissions */\n expiredPermissions: number;\n /** Most common operation types */\n topOperations: Array<{\n operation: PermissionOperation;\n count: number;\n }>;\n /** Most active applications */\n topApplications: Array<{\n application: Address;\n count: number;\n }>;\n}\n\n/**\n * Server information\n *\n * @category Permissions\n */\nexport interface Server {\n /** Server ID (numeric) */\n id: number;\n /** Server owner address */\n owner: Address;\n /** Server URL */\n url: string;\n /** Server address */\n serverAddress: Address;\n /** Server public key */\n publicKey: string;\n}\n\n/**\n * Contract ServerInfo structure returned from the contract\n *\n * @category Permissions\n */\nexport interface ServerInfo {\n /** Server ID */\n id: bigint;\n /** Server owner address */\n owner: Address;\n /** Server address */\n serverAddress: Address;\n /** Server public key */\n publicKey: string;\n /** Server URL */\n url: string;\n}\n\n/**\n * Parameters for adding and trusting a server\n *\n * @category Permissions\n */\nexport interface AddAndTrustServerParams {\n /** Server address */\n serverAddress: Address;\n /** Server URL */\n serverUrl: string;\n /** Server public key */\n publicKey: string;\n}\n\n/**\n * Parameters for trusting a server (legacy)\n *\n * @category Permissions\n * @deprecated Use AddAndTrustServerParams instead\n */\nexport interface TrustServerParams {\n /** Server ID (numeric) */\n serverId: number;\n}\n\n/**\n * Parameters for untrusting a server\n *\n * @category Permissions\n */\nexport interface UntrustServerParams {\n /** Server ID (numeric) */\n serverId: number;\n}\n\n/**\n * Input for adding and trusting a server with signature (gasless)\n *\n * @category Permissions\n */\nexport interface AddAndTrustServerInput extends RecordCompatible {\n /** User nonce */\n nonce: bigint;\n /** Server address */\n serverAddress: Address;\n /** Server URL */\n serverUrl: string;\n /** Server public key */\n publicKey: string;\n}\n\n/**\n * Input for trusting a server with signature (gasless)\n *\n * @category Permissions\n * @deprecated Use AddAndTrustServerInput instead\n */\nexport interface TrustServerInput extends RecordCompatible {\n /** User nonce */\n nonce: bigint;\n /** Server ID (numeric) */\n serverId: number;\n}\n\n/**\n * Input for untrusting a server with signature (gasless)\n *\n * @category Permissions\n */\nexport interface UntrustServerInput extends RecordCompatible {\n /** User nonce */\n nonce: bigint;\n /** Server ID (numeric) */\n serverId: number;\n}\n\n/**\n * EIP-712 typed data for AddAndTrustServer\n *\n * @category Permissions\n */\nexport interface AddAndTrustServerTypedData extends GenericTypedData {\n /** EIP-712 types */\n types: {\n AddServer: Array<{\n name: string;\n type: string;\n }>;\n };\n /** Primary type */\n primaryType: \"AddServer\";\n /** Message to sign */\n message: AddAndTrustServerInput;\n}\n\n/**\n * EIP-712 typed data for TrustServer\n *\n * @category Permissions\n * @deprecated Use AddAndTrustServerTypedData instead\n */\nexport interface TrustServerTypedData extends GenericTypedData {\n /** EIP-712 types */\n types: {\n TrustServer: Array<{\n name: string;\n type: string;\n }>;\n };\n /** Primary type */\n primaryType: \"TrustServer\";\n /** Message to sign */\n message: TrustServerInput;\n}\n\n/**\n * EIP-712 typed data for UntrustServer\n *\n * @category Permissions\n */\nexport interface UntrustServerTypedData extends GenericTypedData {\n /** EIP-712 types */\n types: {\n UntrustServer: Array<{\n name: string;\n type: string;\n }>;\n };\n /** Primary type */\n primaryType: \"UntrustServer\";\n /** Message to sign */\n message: UntrustServerInput;\n}\n\n/**\n * Permission event data\n *\n * @category Permissions\n */\nexport interface PermissionEvent {\n /** Event type */\n type: \"granted\" | \"revoked\" | \"expired\";\n /** Permission details */\n permission: GrantedPermission;\n /** Block number where event occurred */\n blockNumber: bigint;\n /** Transaction hash */\n transactionHash: Hash;\n /** Event timestamp */\n timestamp: number;\n}\n\n/**\n * Enhanced trusted server information with trust status\n *\n * @category Permissions\n */\nexport interface TrustedServerInfo {\n /** Server ID */\n id: bigint;\n /** Server owner address */\n owner: Address;\n /** Server address */\n serverAddress: Address;\n /** Server public key */\n publicKey: string;\n /** Server URL */\n url: string;\n /** Start block when trust relationship began */\n startBlock: bigint;\n /** End block when trust relationship ended (0 if still active) */\n endBlock: bigint;\n}\n\n/**\n * Paginated result for trusted server queries\n *\n * @category Permissions\n */\nexport interface PaginatedTrustedServers {\n /** Array of server IDs (numeric) */\n servers: number[];\n /** Total number of trusted servers */\n total: number;\n /** Offset used for this query */\n offset: number;\n /** Limit used for this query */\n limit: number;\n /** Whether there are more servers beyond this page */\n hasMore: boolean;\n}\n\n/**\n * Options for querying trusted servers\n *\n * @category Permissions\n */\nexport interface TrustedServerQueryOptions {\n /** User address to query (defaults to current user) */\n userAddress?: Address;\n /** Maximum number of servers to return */\n limit?: number;\n /** Offset for pagination */\n offset?: number;\n /** Whether to include full server info or just IDs */\n includeServerInfo?: boolean;\n}\n\n/**\n * Result of batch server info requests\n *\n * @category Permissions\n */\nexport interface BatchServerInfoResult {\n /** Successfully retrieved server info */\n servers: Map<number, Server>;\n /** Server IDs that failed to retrieve */\n failed: number[];\n}\n\n/**\n * Server trust status information\n *\n * @category Permissions\n */\nexport interface ServerTrustStatus {\n /** Server ID being checked (numeric) */\n serverId: number;\n /** Whether the server is trusted by the user */\n isTrusted: boolean;\n /** Index in user's trusted server list (if trusted) */\n trustIndex?: number;\n}\n\n/**\n * Grantee information\n *\n * @category Permissions\n */\nexport interface Grantee {\n /** Grantee ID (numeric) */\n id: number;\n /** Grantee owner address */\n owner: Address;\n /** Grantee address */\n address: Address;\n /** Grantee public key */\n publicKey: string;\n /** Permission IDs associated with this grantee */\n permissionIds: number[];\n}\n\n/**\n * Contract GranteeInfo structure returned from the contract\n *\n * @category Permissions\n */\nexport interface GranteeInfo {\n /** Grantee owner address */\n owner: Address;\n /** Grantee address */\n granteeAddress: Address;\n /** Grantee public key */\n publicKey: string;\n /** Permission IDs associated with this grantee */\n permissionIds: readonly bigint[];\n}\n\n/**\n * Parameters for registering a grantee\n *\n * @category Permissions\n */\nexport interface RegisterGranteeParams {\n /** Grantee owner address */\n owner: Address;\n /** Grantee address */\n granteeAddress: Address;\n /** Grantee public key */\n publicKey: string;\n}\n\n/**\n * Input for registering a grantee with signature (gasless)\n *\n * @category Permissions\n */\nexport interface RegisterGranteeInput extends RecordCompatible {\n /** User nonce */\n nonce: bigint;\n /** Grantee owner address */\n owner: Address;\n /** Grantee address */\n granteeAddress: Address;\n /** Grantee public key */\n publicKey: string;\n}\n\n/**\n * EIP-712 typed data for RegisterGrantee\n *\n * @category Permissions\n */\nexport interface RegisterGranteeTypedData extends GenericTypedData {\n /** EIP-712 types */\n types: {\n RegisterGrantee: Array<{\n name: string;\n type: string;\n }>;\n };\n /** Primary type */\n primaryType: \"RegisterGrantee\";\n /** Message to sign */\n message: RegisterGranteeInput;\n}\n\n/**\n * Options for querying grantees\n *\n * @category Permissions\n */\nexport interface GranteeQueryOptions {\n /** Maximum number of grantees to return */\n limit?: number;\n /** Offset for pagination */\n offset?: number;\n /** Whether to include permission info or just basic info */\n includePermissions?: boolean;\n}\n\n/**\n * Paginated result for grantee queries\n *\n * @category Permissions\n */\nexport interface PaginatedGrantees {\n /** Array of grantees */\n grantees: Grantee[];\n /** Total number of grantees */\n total: number;\n /** Offset used for this query */\n offset: number;\n /** Limit used for this query */\n limit: number;\n /** Whether there are more grantees beyond this page */\n hasMore: boolean;\n}\n\n/**\n * Contract Permission structure as used in ServerFilesAndPermissionInput\n *\n * @category Permissions\n */\nexport interface Permission {\n /** Account address for the permission */\n account: Address;\n /** Permission key */\n key: string;\n}\n\n/**\n * Contract ServerFilesAndPermissionInput structure\n *\n * @category Permissions\n */\nexport interface ServerFilesAndPermissionInput {\n /** User nonce */\n nonce: bigint;\n /** Grantee ID */\n granteeId: bigint;\n /** Grant URL */\n grant: string;\n /** File URLs */\n fileUrls: string[];\n /** Server address */\n serverAddress: Address;\n /** Server URL */\n serverUrl: string;\n /** Server public key */\n serverPublicKey: string;\n /** File permissions array - permissions for each file */\n filePermissions: Permission[][];\n}\n\n/**\n * Parameters for server files and permissions operations\n *\n * @category Permissions\n */\nexport interface ServerFilesAndPermissionParams {\n /** Grantee ID */\n granteeId: bigint;\n /** Grant URL or grant data */\n grant: string;\n /** File URLs */\n fileUrls: string[];\n /** Schema IDs for each file - use 0 for files without schema validation */\n schemaIds: number[];\n /** Server address */\n serverAddress: Address;\n /** Server URL */\n serverUrl: string;\n /** Server public key */\n serverPublicKey: string;\n /** File permissions array - permissions for each file */\n filePermissions: Permission[][];\n}\n\n/**\n * EIP-712 typed data for server files and permissions messages\n *\n * @category Permissions\n */\nexport interface ServerFilesAndPermissionTypedData extends GenericTypedData {\n /** Message data structure */\n message: {\n /** User nonce */\n nonce: bigint;\n /** Grantee ID */\n granteeId: bigint;\n /** Grant URL */\n grant: string;\n /** File URLs */\n fileUrls: string[];\n /** Schema IDs for each file - use 0 for files without schema validation */\n schemaIds: bigint[];\n /** Server address */\n serverAddress: Address;\n /** Server URL */\n serverUrl: string;\n /** Server public key */\n serverPublicKey: string;\n /** File permissions array - permissions for each file */\n filePermissions: Permission[][];\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/types/permissions.ts"],"sourcesContent":["import type { Address, Hash } from \"viem\";\n\n/**\n * Base interface for types that need to be compatible with Record<string, unknown>\n *\n * @category Permissions\n */\nexport interface RecordCompatible {\n [key: string]: unknown;\n}\n\n/**\n * Contains on-chain permission data for efficient retrieval.\n *\n * @remarks\n * Provides fast access to permission metadata from subgraph without\n * IPFS calls. For detailed parameters, resolve `grantUrl` separately.\n *\n * @category Permissions\n * @example\n * ```typescript\n * const grants = await vana.permissions.getUserPermissionGrantsOnChain();\n *\n * // Resolve details when needed\n * const details = await retrieveGrantFile(grants[0].grantUrl);\n * console.log(`Operation: ${details.operation}`);\n * ```\n */\nexport interface OnChainPermissionGrant {\n /** Unique identifier for the permission */\n id: bigint;\n /** The grant URL containing detailed permission parameters (IPFS link) */\n grantUrl: string;\n /** Cryptographic signature that authorized this permission */\n grantSignature: string;\n /** Nonce used when granting the permission */\n nonce: bigint;\n /** Block number when permission started */\n startBlock: bigint;\n /** Block number when permission was granted */\n addedAtBlock: bigint;\n /** Timestamp when permission was added */\n addedAtTimestamp: bigint;\n /** Transaction hash of the grant transaction */\n transactionHash: string;\n /** Address that granted the permission */\n grantor: Address;\n /** Grantee information */\n grantee: {\n /** Grantee ID */\n id: string;\n /** Grantee address */\n address: string;\n };\n /** Whether the permission is still active (not revoked) */\n active: boolean;\n}\n\n/**\n * Options for retrieving user permissions\n *\n * @category Permissions\n */\nexport interface GetUserPermissionsOptions {\n /** Maximum number of permissions to retrieve */\n limit?: number;\n /** Whether to fetch all permissions (ignores limit) */\n fetchAll?: boolean;\n /** Custom subgraph URL to use for querying */\n subgraphUrl?: string;\n}\n\n/**\n * Defines parameters for granting file access permissions.\n *\n * @remarks\n * Specifies application, operation, files, and parameters for\n * permission grants via `vana.permissions.grant()`.\n *\n * @category Permissions\n * @example\n * ```typescript\n * const params: GrantPermissionParams = {\n * grantee: '0x1234...',\n * operation: 'llm_inference',\n * files: [1, 2, 3],\n * parameters: { model: 'gpt-4', maxTokens: 1000 }\n * };\n * const result = await vana.permissions.grant(params);\n * ```\n */\nexport interface GrantPermissionParams {\n /** The on-chain identity of the application */\n grantee: Address;\n /** The class of computation, e.g., \"llm_inference\" */\n operation: string;\n /**\n * Array of file IDs to grant permission for.\n * Obtain file IDs from `vana.data.getUserFiles()` or from upload results via `vana.data.upload().fileId`.\n */\n files: number[];\n /** The full, off-chain parameters (e.g., LLM prompt) */\n parameters: Record<string, unknown>;\n /** Optional JSONPath filters to apply to files, keyed by file ID */\n filters?: Record<string, string>;\n /** Optional pre-stored grant URL to avoid duplicate IPFS storage */\n grantUrl?: string;\n /** Optional nonce for the permission */\n nonce?: bigint;\n /** Optional expiration time for the permission */\n expiresAt?: number;\n}\n\n/**\n * Parameters for revoking a previously granted data access permission.\n *\n * Used with `PermissionsController.revoke()` to remove an application's access\n * to user data. Once revoked, the application can no longer use the permission\n * to access the specified files.\n *\n * @category Permissions\n * @example\n * ```typescript\n * const revokeParams: RevokePermissionParams = {\n * permissionId: 123n // Permission ID to revoke\n * };\n *\n * await vana.permissions.revoke(revokeParams);\n * ```\n */\nexport interface RevokePermissionParams {\n /** The permission ID to revoke */\n permissionId: bigint;\n}\n\n/**\n * Parameters for checking if a specific permission exists and is valid.\n *\n * Used to verify whether an application has active permission to access\n * specific user files for a particular operation before attempting to use the data.\n *\n * @category Permissions\n * @example\n * ```typescript\n * const checkParams: CheckPermissionParams = {\n * application: '0x1234...', // App address\n * operation: 'llm_inference',\n * files: [1, 2, 3], // File IDs to check\n * parameters: { model: 'gpt-4' }, // Operation parameters\n * user: '0xabcd...' // Optional specific user\n * };\n *\n * const hasPermission = await vana.permissions.check(checkParams);\n * ```\n */\nexport interface CheckPermissionParams {\n /** The application address */\n application: Address;\n /** The operation type */\n operation: string;\n /** The file IDs */\n files: number[];\n /** The grant parameters */\n parameters: Record<string, unknown>;\n /** The user address */\n user?: Address;\n}\n\n/**\n * Permission check result\n *\n * @category Permissions\n */\nexport interface PermissionCheckResult {\n /** Whether the permission exists and is valid */\n exists: boolean;\n /** The permission details if it exists */\n permission?: GrantedPermission;\n /** Reason why permission is invalid (if applicable) */\n reason?: string;\n}\n\n/**\n * EIP-712 domain definition for PermissionGrant signatures\n *\n * @category Permissions\n */\nexport interface PermissionGrantDomain {\n /** Domain name */\n name: string;\n /** Domain version */\n version: string;\n /** Chain ID */\n chainId: number;\n /** Verifying contract address */\n verifyingContract: Address;\n}\n\n/**\n * EIP-712 Permission message structure (current contract format)\n *\n * @category Permissions\n */\nexport interface PermissionGrantMessage {\n /** Application address */\n application: Address;\n /** File IDs */\n files: number[];\n /** Operation type */\n operation: string;\n /** Grant URL */\n grant: string;\n /** Parameters as JSON string */\n parameters: string;\n /** Nonce */\n nonce: bigint;\n}\n\n/**\n * EIP-712 PermissionInput message structure (new simplified format)\n *\n * @category Permissions\n */\nexport interface PermissionInputMessage extends RecordCompatible {\n /** Nonce */\n nonce: bigint;\n /** Grantee ID */\n granteeId: bigint;\n /** Grant URL */\n grant: string;\n /** File IDs */\n fileIds: bigint[];\n}\n\n/**\n * Contract PermissionInput structure\n *\n * @category Permissions\n */\nexport interface PermissionInput {\n /** Nonce */\n nonce: bigint;\n /** Grantee ID */\n granteeId: bigint;\n /** Grant URL */\n grant: string;\n /** File IDs to grant permission for */\n fileIds: bigint[];\n}\n\n/**\n * Contract RevokePermissionInput structure\n *\n * @category Permissions\n */\nexport interface RevokePermissionInput extends RecordCompatible {\n /** Nonce */\n nonce: bigint;\n /** Permission ID to revoke */\n permissionId: bigint;\n}\n\n/**\n * Contract Permission Info structure returned from the contract\n *\n * @category Permissions\n */\nexport interface PermissionInfo {\n /** Permission ID */\n id: bigint;\n /** Address that granted the permission */\n grantor: Address;\n /** Nonce used when creating */\n nonce: bigint;\n /** Grantee ID */\n granteeId: bigint;\n /** Grant URL */\n grant: string;\n /** Signature bytes (removed in newer contract versions) */\n signature?: `0x${string}`;\n /** Start block */\n startBlock: bigint;\n /** End block */\n endBlock: bigint;\n /** File IDs associated with this permission */\n fileIds: readonly bigint[];\n}\n\n/**\n * EIP-712 Permission message structure (simplified future format)\n *\n * @category Permissions\n */\nexport interface SimplifiedPermissionMessage {\n /** Application address */\n application: Address;\n /** Grant URL */\n grant: string;\n /** Nonce */\n nonce: bigint;\n}\n\n/**\n * Grant file structure containing permission details.\n *\n * Grant files contain the complete specification of what an application is permitted\n * to do with user data, including operation parameters and file access rights.\n *\n * @category Permissions\n * @example\n * ```typescript\n * const grantFile: GrantFile = {\n * grantee: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',\n * operation: 'llm_inference',\n * parameters: {\n * prompt: 'Analyze this data: {{data}}',\n * model: 'gpt-4',\n * maxTokens: 2000,\n * temperature: 0.7\n * },\n * expires: 1736467579\n * };\n * ```\n */\nexport interface GrantFile {\n /** EVM address of the application authorized to use this grant */\n grantee: Address;\n /** Operation the grantee is authorized to perform */\n operation: string;\n /** Operation-specific parameters */\n parameters: Record<string, unknown>;\n /** Optional Unix timestamp when grant expires (seconds since epoch per POSIX.1-2008) */\n expires?: number;\n}\n\n/**\n * EIP-712 typed data structure for Permission\n *\n * @category Permissions\n */\nexport interface PermissionGrantTypedData extends GenericTypedData {\n /** EIP-712 types */\n types: {\n Permission: Array<{\n name: string;\n type: string;\n }>;\n };\n /** Primary type */\n primaryType: \"Permission\";\n /** Message to sign */\n message: PermissionInputMessage;\n}\n\n/**\n * Generic EIP-712 typed data structure\n *\n * @category Permissions\n */\nexport interface GenericTypedData extends RecordCompatible {\n /** EIP-712 domain */\n domain: PermissionGrantDomain;\n /** EIP-712 types */\n types: Record<string, Array<{ name: string; type: string }>>;\n /** Primary type */\n primaryType: string;\n /** Message to sign */\n message: Record<string, unknown>;\n}\n\n/**\n * Represents EIP-712 typed data for permission revocation.\n *\n * @remarks\n * Used when revoking previously granted permissions through gasless transactions.\n * The message contains a nonce and the permission ID to revoke.\n *\n * @category Permissions\n */\nexport interface RevokePermissionTypedData extends GenericTypedData {\n /** EIP-712 type definitions for the RevokePermission structure */\n types: {\n RevokePermission: Array<{\n name: string;\n type: string;\n }>;\n };\n /** The primary type identifier for revocation operations */\n primaryType: \"RevokePermission\";\n /** The structured message containing revocation parameters */\n message: RevokePermissionInput;\n}\n\n/**\n * Defines all valid primary types for EIP-712 typed data in the Vana SDK.\n *\n * @remarks\n * These literal types ensure compile-time safety when handling typed data operations.\n * Each corresponds to a specific blockchain operation type.\n *\n * @category Permissions\n */\nexport type TypedDataPrimaryType =\n | \"Permission\"\n | \"RevokePermission\"\n | \"TrustServer\"\n | \"UntrustServer\"\n | \"AddServer\"\n | \"RegisterGrantee\"\n | \"ServerFilesAndPermission\";\n\n/**\n * Represents the union of all specific typed data interfaces.\n *\n * @remarks\n * Enables type-safe handling of any typed data structure in the SDK.\n * Used internally by relayer handlers and signature verification.\n *\n * @category Permissions\n */\nexport type SpecificTypedData =\n | PermissionGrantTypedData\n | RevokePermissionTypedData\n | TrustServerTypedData\n | UntrustServerTypedData\n | AddAndTrustServerTypedData\n | RegisterGranteeTypedData\n | ServerFilesAndPermissionTypedData;\n\n/**\n * Permission operation types\n *\n * @category Permissions\n */\nexport type PermissionOperation =\n | \"llm_inference\"\n | \"data_analysis\"\n | \"model_training\"\n | \"data_sharing\"\n | \"compute_task\"\n | string;\n\n/**\n * Permission status\n *\n * @category Permissions\n */\nexport type PermissionStatus = \"active\" | \"revoked\" | \"expired\" | \"pending\";\n\n/**\n * Parameters for querying permissions\n *\n * @category Permissions\n */\nexport interface QueryPermissionsParams {\n /** Filter by grantor address */\n grantor?: Address;\n /** Filter by grantee address */\n grantee?: Address;\n /** Filter by operation type */\n operation?: PermissionOperation;\n /** Filter by file IDs */\n files?: number[];\n /** Filter by status */\n status?: PermissionStatus;\n /** Starting block number */\n fromBlock?: bigint;\n /** Ending block number */\n toBlock?: bigint;\n /** Maximum number of results */\n limit?: number;\n /** Offset for pagination */\n offset?: number;\n}\n\n/**\n * Granted permission details\n *\n * @category Permissions\n */\nexport interface GrantedPermission {\n /** Unique identifier for the permission */\n id: bigint;\n /** Array of file IDs that the permission applies to */\n files: number[];\n /** The type of operation being granted permission for */\n operation: string;\n /** Grant file reference (IPFS hash or URL) */\n grant: string;\n /** Address of the application granted permission */\n grantee: Address;\n /** Address of the user who granted permission */\n grantor: Address;\n /** Custom parameters for the operation */\n parameters: Record<string, unknown>;\n /** Whether the permission is still active */\n active: boolean;\n /** Data status for the permission */\n dataStatus?: string;\n /** Nonce used for the permission */\n nonce?: number;\n /** Timestamp when permission was granted */\n grantedAt?: number;\n /** Optional expiration timestamp */\n expiresAt?: number;\n /** Transaction hash of the grant transaction */\n transactionHash?: string;\n /** Block number when permission was granted */\n blockNumber?: bigint;\n}\n\n/**\n * Permission query result\n *\n * @category Permissions\n */\nexport interface PermissionQueryResult {\n /** Array of permissions matching the query */\n permissions: GrantedPermission[];\n /** Total number of permissions (for pagination) */\n total: number;\n /** Whether there are more results available */\n hasMore: boolean;\n}\n\n/**\n * Permission analytics data\n *\n * @category Permissions\n */\nexport interface PermissionAnalytics {\n /** Total number of permissions granted */\n totalPermissions: number;\n /** Number of active permissions */\n activePermissions: number;\n /** Number of revoked permissions */\n revokedPermissions: number;\n /** Number of expired permissions */\n expiredPermissions: number;\n /** Most common operation types */\n topOperations: Array<{\n operation: PermissionOperation;\n count: number;\n }>;\n /** Most active applications */\n topApplications: Array<{\n application: Address;\n count: number;\n }>;\n}\n\n/**\n * Server information\n *\n * @category Permissions\n */\nexport interface Server {\n /** Server ID (numeric) */\n id: number;\n /** Server owner address */\n owner: Address;\n /** Server URL */\n url: string;\n /** Server address */\n serverAddress: Address;\n /** Server public key */\n publicKey: string;\n}\n\n/**\n * Contract ServerInfo structure returned from the contract\n *\n * @category Permissions\n */\nexport interface ServerInfo {\n /** Server ID */\n id: bigint;\n /** Server owner address */\n owner: Address;\n /** Server address */\n serverAddress: Address;\n /** Server public key */\n publicKey: string;\n /** Server URL */\n url: string;\n}\n\n/**\n * Parameters for adding and trusting a server\n *\n * @category Permissions\n */\nexport interface AddAndTrustServerParams {\n /** Server address */\n serverAddress: Address;\n /** Server URL */\n serverUrl: string;\n /** Server public key */\n publicKey: string;\n}\n\n/**\n * Parameters for trusting a server (legacy)\n *\n * @category Permissions\n * @deprecated Use AddAndTrustServerParams instead\n */\nexport interface TrustServerParams {\n /** Server ID (numeric) */\n serverId: number;\n}\n\n/**\n * Parameters for untrusting a server\n *\n * @category Permissions\n */\nexport interface UntrustServerParams {\n /** Server ID (numeric) */\n serverId: number;\n}\n\n/**\n * Input for adding and trusting a server with signature (gasless)\n *\n * @category Permissions\n */\nexport interface AddAndTrustServerInput extends RecordCompatible {\n /** User nonce */\n nonce: bigint;\n /** Server address */\n serverAddress: Address;\n /** Server URL */\n serverUrl: string;\n /** Server public key */\n publicKey: string;\n}\n\n/**\n * Input for trusting a server with signature (gasless)\n *\n * @category Permissions\n * @deprecated Use AddAndTrustServerInput instead\n */\nexport interface TrustServerInput extends RecordCompatible {\n /** User nonce */\n nonce: bigint;\n /** Server ID (numeric) */\n serverId: number;\n}\n\n/**\n * Input for untrusting a server with signature (gasless)\n *\n * @category Permissions\n */\nexport interface UntrustServerInput extends RecordCompatible {\n /** User nonce */\n nonce: bigint;\n /** Server ID (numeric) */\n serverId: number;\n}\n\n/**\n * EIP-712 typed data for AddAndTrustServer\n *\n * @category Permissions\n */\nexport interface AddAndTrustServerTypedData extends GenericTypedData {\n /** EIP-712 types */\n types: {\n AddServer: Array<{\n name: string;\n type: string;\n }>;\n };\n /** Primary type */\n primaryType: \"AddServer\";\n /** Message to sign */\n message: AddAndTrustServerInput;\n}\n\n/**\n * EIP-712 typed data for TrustServer\n *\n * @category Permissions\n * @deprecated Use AddAndTrustServerTypedData instead\n */\nexport interface TrustServerTypedData extends GenericTypedData {\n /** EIP-712 types */\n types: {\n TrustServer: Array<{\n name: string;\n type: string;\n }>;\n };\n /** Primary type */\n primaryType: \"TrustServer\";\n /** Message to sign */\n message: TrustServerInput;\n}\n\n/**\n * EIP-712 typed data for UntrustServer\n *\n * @category Permissions\n */\nexport interface UntrustServerTypedData extends GenericTypedData {\n /** EIP-712 types */\n types: {\n UntrustServer: Array<{\n name: string;\n type: string;\n }>;\n };\n /** Primary type */\n primaryType: \"UntrustServer\";\n /** Message to sign */\n message: UntrustServerInput;\n}\n\n/**\n * Permission event data\n *\n * @category Permissions\n */\nexport interface PermissionEvent {\n /** Event type */\n type: \"granted\" | \"revoked\" | \"expired\";\n /** Permission details */\n permission: GrantedPermission;\n /** Block number where event occurred */\n blockNumber: bigint;\n /** Transaction hash */\n transactionHash: Hash;\n /** Event timestamp */\n timestamp: number;\n}\n\n/**\n * Enhanced trusted server information with trust status\n *\n * @category Permissions\n */\nexport interface TrustedServerInfo {\n /** Server ID */\n id: bigint;\n /** Server owner address */\n owner: Address;\n /** Server address */\n serverAddress: Address;\n /** Server public key */\n publicKey: string;\n /** Server URL */\n url: string;\n /** Start block when trust relationship began */\n startBlock: bigint;\n /** End block when trust relationship ended (0 if still active) */\n endBlock: bigint;\n}\n\n/**\n * Paginated result for trusted server queries\n *\n * @category Permissions\n */\nexport interface PaginatedTrustedServers {\n /** Array of server IDs (numeric) */\n servers: number[];\n /** Total number of trusted servers */\n total: number;\n /** Offset used for this query */\n offset: number;\n /** Limit used for this query */\n limit: number;\n /** Whether there are more servers beyond this page */\n hasMore: boolean;\n}\n\n/**\n * Options for querying trusted servers\n *\n * @category Permissions\n */\nexport interface TrustedServerQueryOptions {\n /** User address to query (defaults to current user) */\n userAddress?: Address;\n /** Maximum number of servers to return */\n limit?: number;\n /** Offset for pagination */\n offset?: number;\n /** Whether to include full server info or just IDs */\n includeServerInfo?: boolean;\n}\n\n/**\n * Result of batch server info requests\n *\n * @category Permissions\n */\nexport interface BatchServerInfoResult {\n /** Successfully retrieved server info */\n servers: Map<number, Server>;\n /** Server IDs that failed to retrieve */\n failed: number[];\n}\n\n/**\n * Server trust status information\n *\n * @category Permissions\n */\nexport interface ServerTrustStatus {\n /** Server ID being checked (numeric) */\n serverId: number;\n /** Whether the server is trusted by the user */\n isTrusted: boolean;\n /** Index in user's trusted server list (if trusted) */\n trustIndex?: number;\n}\n\n/**\n * Grantee information\n *\n * @category Permissions\n */\nexport interface Grantee {\n /** Grantee ID (numeric) */\n id: number;\n /** Grantee owner address */\n owner: Address;\n /** Grantee address */\n address: Address;\n /** Grantee public key */\n publicKey: string;\n /** Permission IDs associated with this grantee */\n permissionIds: number[];\n}\n\n/**\n * Contract GranteeInfo structure returned from the contract\n *\n * @category Permissions\n */\nexport interface GranteeInfo {\n /** Grantee owner address */\n owner: Address;\n /** Grantee address */\n granteeAddress: Address;\n /** Grantee public key */\n publicKey: string;\n /** Permission IDs associated with this grantee */\n permissionIds: readonly bigint[];\n}\n\n/**\n * Parameters for registering a grantee\n *\n * @category Permissions\n */\nexport interface RegisterGranteeParams {\n /** Grantee owner address */\n owner: Address;\n /** Grantee address */\n granteeAddress: Address;\n /** Grantee public key */\n publicKey: string;\n}\n\n/**\n * Input for registering a grantee with signature (gasless)\n *\n * @category Permissions\n */\nexport interface RegisterGranteeInput extends RecordCompatible {\n /** User nonce */\n nonce: bigint;\n /** Grantee owner address */\n owner: Address;\n /** Grantee address */\n granteeAddress: Address;\n /** Grantee public key */\n publicKey: string;\n}\n\n/**\n * EIP-712 typed data for RegisterGrantee\n *\n * @category Permissions\n */\nexport interface RegisterGranteeTypedData extends GenericTypedData {\n /** EIP-712 types */\n types: {\n RegisterGrantee: Array<{\n name: string;\n type: string;\n }>;\n };\n /** Primary type */\n primaryType: \"RegisterGrantee\";\n /** Message to sign */\n message: RegisterGranteeInput;\n}\n\n/**\n * Options for querying grantees\n *\n * @category Permissions\n */\nexport interface GranteeQueryOptions {\n /** Maximum number of grantees to return */\n limit?: number;\n /** Offset for pagination */\n offset?: number;\n /** Whether to include permission info or just basic info */\n includePermissions?: boolean;\n}\n\n/**\n * Paginated result for grantee queries\n *\n * @category Permissions\n */\nexport interface PaginatedGrantees {\n /** Array of grantees */\n grantees: Grantee[];\n /** Total number of grantees */\n total: number;\n /** Offset used for this query */\n offset: number;\n /** Limit used for this query */\n limit: number;\n /** Whether there are more grantees beyond this page */\n hasMore: boolean;\n}\n\n/**\n * Contract Permission structure as used in ServerFilesAndPermissionInput\n *\n * @category Permissions\n */\nexport interface Permission {\n /** Account address for the permission */\n account: Address;\n /** Permission key */\n key: string;\n}\n\n/**\n * Contract ServerFilesAndPermissionInput structure\n *\n * @category Permissions\n */\nexport interface ServerFilesAndPermissionInput {\n /** User nonce */\n nonce: bigint;\n /** Grantee ID */\n granteeId: bigint;\n /** Grant URL */\n grant: string;\n /** File URLs */\n fileUrls: string[];\n /** Server address */\n serverAddress: Address;\n /** Server URL */\n serverUrl: string;\n /** Server public key */\n serverPublicKey: string;\n /** File permissions array - permissions for each file */\n filePermissions: Permission[][];\n}\n\n/**\n * Parameters for server files and permissions operations\n *\n * @category Permissions\n */\nexport interface ServerFilesAndPermissionParams {\n /** Grantee ID */\n granteeId: bigint;\n /** Grant URL or grant data */\n grant: string;\n /** File URLs */\n fileUrls: string[];\n /** Schema IDs for each file - use 0 for files without schema validation */\n schemaIds: number[];\n /** Server address */\n serverAddress: Address;\n /** Server URL */\n serverUrl: string;\n /** Server public key */\n serverPublicKey: string;\n /** File permissions array - permissions for each file */\n filePermissions: Permission[][];\n}\n\n/**\n * EIP-712 typed data for server files and permissions messages\n *\n * @category Permissions\n */\nexport interface ServerFilesAndPermissionTypedData extends GenericTypedData {\n /** Message data structure */\n message: {\n /** User nonce */\n nonce: bigint;\n /** Grantee ID */\n granteeId: bigint;\n /** Grant URL */\n grant: string;\n /** File URLs */\n fileUrls: string[];\n /** Schema IDs for each file - use 0 for files without schema validation */\n schemaIds: bigint[];\n /** Server address */\n serverAddress: Address;\n /** Server URL */\n serverUrl: string;\n /** Server public key */\n serverPublicKey: string;\n /** File permissions array - permissions for each file */\n filePermissions: Permission[][];\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -61,6 +61,8 @@ export interface OnChainPermissionGrant {
61
61
  export interface GetUserPermissionsOptions {
62
62
  /** Maximum number of permissions to retrieve */
63
63
  limit?: number;
64
+ /** Whether to fetch all permissions (ignores limit) */
65
+ fetchAll?: boolean;
64
66
  /** Custom subgraph URL to use for querying */
65
67
  subgraphUrl?: string;
66
68
  }
@@ -95,6 +97,8 @@ export interface GrantPermissionParams {
95
97
  files: number[];
96
98
  /** The full, off-chain parameters (e.g., LLM prompt) */
97
99
  parameters: Record<string, unknown>;
100
+ /** Optional JSONPath filters to apply to files, keyed by file ID */
101
+ filters?: Record<string, string>;
98
102
  /** Optional pre-stored grant URL to avoid duplicate IPFS storage */
99
103
  grantUrl?: string;
100
104
  /** Optional nonce for the permission */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/relayer.ts"],"sourcesContent":["/**\n * Defines types for gasless transaction relayers and server operations.\n *\n * @remarks\n * This module provides comprehensive type definitions for interacting with\n * relayer services that enable gasless transactions and auxiliary operations.\n * It includes both legacy v1 types and the simplified v2 unified interface.\n *\n * @category Types\n * @module types/relayer\n */\n\nimport type { Hash, Address } from \"viem\";\nimport type {\n GrantFile,\n PermissionGrantTypedData,\n GenericTypedData,\n} from \"./permissions\";\n\n/**\n * Represents the response from storing grant files via relayer.\n *\n * @remarks\n * Contains storage location, metadata, and error information for\n * grant file upload operations.\n *\n * @category Advanced\n */\nexport interface RelayerStorageResponse {\n /** The IPFS URL where the grant file is stored */\n grantUrl: string;\n /** Success status */\n success: boolean;\n /** Optional error message */\n error?: string;\n /** Storage metadata */\n metadata?: {\n /** IPFS hash */\n ipfsHash: string;\n /** File size in bytes */\n size: number;\n /** Upload timestamp */\n timestamp: number;\n };\n}\n\n/**\n * Represents the response from submitting transactions via relayer.\n *\n * @remarks\n * Contains transaction hash, status, and metadata for gasless\n * transaction submissions.\n *\n * @category Advanced\n */\nexport interface RelayerTransactionResponse {\n /** The transaction hash of the submitted transaction */\n transactionHash: Hash;\n /** Success status */\n success: boolean;\n /** Optional error message */\n error?: string;\n /** Transaction metadata */\n metadata?: {\n /** Gas used */\n gasUsed?: bigint;\n /** Gas price */\n gasPrice?: bigint;\n /** Block number */\n blockNumber?: bigint;\n /** Transaction status */\n status?: \"pending\" | \"confirmed\" | \"failed\";\n };\n}\n\n/**\n * Specifies parameters for storing grant files via relayer.\n *\n * @remarks\n * Includes the grant file and optional storage configuration\n * such as encryption and pinning duration.\n *\n * @category Advanced\n */\nexport interface RelayerStoreParams {\n /** The grant file to store */\n grantFile: GrantFile;\n /** Optional storage options */\n options?: {\n /** IPFS pin duration in seconds */\n pinDuration?: number;\n /** Whether to use encryption */\n encrypt?: boolean;\n /** Custom metadata */\n metadata?: Record<string, unknown>;\n };\n}\n\n/**\n * Specifies parameters for submitting gasless transactions.\n *\n * @remarks\n * Contains signed typed data and transaction configuration options\n * for relayer submission.\n *\n * @category Advanced\n */\nexport interface RelayerSubmitParams {\n /** The signed typed data */\n typedData: PermissionGrantTypedData;\n /** The signature */\n signature: string;\n /** Optional transaction options */\n options?: {\n /** Gas limit */\n gasLimit?: bigint;\n /** Priority level */\n priority?: \"low\" | \"medium\" | \"high\";\n /** Whether to wait for confirmation */\n waitForConfirmation?: boolean;\n };\n}\n\n/**\n * Represents the current status and capabilities of a relayer service.\n *\n * @remarks\n * Provides information about supported chains, rate limits, and\n * current operational status for monitoring and decision-making.\n *\n * @category Advanced\n */\nexport interface RelayerStatus {\n /** Whether the relayer is online */\n online: boolean;\n /** Service version */\n version: string;\n /** Supported chains */\n supportedChains: number[];\n /** Current chain status */\n chainStatus: Record<\n number,\n {\n /** Whether the chain is supported */\n supported: boolean;\n /** Current block number */\n currentBlock: bigint;\n /** Gas price estimation */\n gasPrice: bigint;\n /** Queue size */\n queueSize: number;\n }\n >;\n /** Rate limit information */\n rateLimits: {\n /** Requests per minute */\n requestsPerMinute: number;\n /** Storage requests per hour */\n storageRequestsPerHour: number;\n /** Transaction requests per hour */\n transactionRequestsPerHour: number;\n };\n}\n\n/**\n * Configures behavior for relayer requests.\n *\n * @remarks\n * Controls timeout, retry logic, headers, and priority for\n * relayer operation requests.\n *\n * @category Advanced\n */\nexport interface RelayerRequestOptions {\n /** Request timeout in milliseconds */\n timeout?: number;\n /** Whether to retry on failure */\n retry?: boolean;\n /** Custom headers */\n headers?: Record<string, string>;\n /** Request priority */\n priority?: \"low\" | \"medium\" | \"high\";\n}\n\n/**\n * Represents an error response from the relayer service.\n *\n * @remarks\n * Provides structured error information including codes, messages,\n * and debugging details for error handling and recovery.\n *\n * @category Advanced\n */\nexport interface RelayerErrorResponse {\n /** Error code */\n code: string;\n /** Error message */\n message: string;\n /** Additional error details */\n details?: Record<string, unknown>;\n /** Request ID for debugging */\n requestId?: string;\n /** Timestamp of error */\n timestamp: number;\n}\n\n/**\n * Provides information about the relayer's processing queue.\n *\n * @remarks\n * Includes queue size, position, estimated processing time, and\n * performance statistics for queue monitoring.\n *\n * @category Advanced\n */\nexport interface RelayerQueueInfo {\n /** Current queue size */\n size: number;\n /** Estimated processing time in seconds */\n estimatedProcessingTime: number;\n /** Queue position for a specific request */\n position?: number;\n /** Processing statistics */\n stats: {\n /** Average processing time in seconds */\n averageProcessingTime: number;\n /** Requests processed in last hour */\n requestsProcessedHour: number;\n /** Success rate percentage */\n successRate: number;\n };\n}\n\n/**\n * Tracks the status of a transaction submitted via relayer.\n *\n * @remarks\n * Provides detailed tracking information including confirmation status,\n * gas usage, and historical status checks.\n *\n * @category Advanced\n */\nexport interface RelayerTransactionStatus {\n /** Transaction hash */\n transactionHash: Hash;\n /** Current status */\n status: \"pending\" | \"confirmed\" | \"failed\";\n /** Block number if confirmed */\n blockNumber?: bigint;\n /** Gas used */\n gasUsed?: bigint;\n /** Error message if failed */\n error?: string;\n /** Status checks performed */\n checks: Array<{\n /** Check timestamp */\n timestamp: number;\n /** Status at time of check */\n status: string;\n /** Block number at time of check */\n blockNumber: bigint;\n }>;\n}\n\n/**\n * Provides performance metrics for the relayer service.\n *\n * @remarks\n * Includes transaction statistics, success rates, processing times,\n * and uptime information for monitoring and optimization.\n *\n * @category Advanced\n */\nexport interface RelayerMetrics {\n /** Total transactions processed */\n totalTransactions: number;\n /** Successful transactions */\n successfulTransactions: number;\n /** Failed transactions */\n failedTransactions: number;\n /** Average processing time in seconds */\n averageProcessingTime: number;\n /** Current queue size */\n queueSize: number;\n /** Uptime percentage */\n uptime: number;\n /** Last 24 hour statistics */\n last24Hours: {\n /** Transactions processed */\n transactions: number;\n /** Success rate */\n successRate: number;\n /** Average response time */\n averageResponseTime: number;\n };\n}\n\n/**\n * Configures webhook notifications for relayer events.\n *\n * @remarks\n * Enables asynchronous notifications for transaction confirmations,\n * failures, and storage completions.\n *\n * @category Advanced\n */\nexport interface RelayerWebhookConfig {\n /** Webhook URL */\n url: string;\n /** Events to subscribe to */\n events: Array<\n \"transaction_confirmed\" | \"transaction_failed\" | \"storage_complete\"\n >;\n /** Webhook secret for signature verification */\n secret?: string;\n /** Whether webhook is active */\n active: boolean;\n}\n\n/**\n * Represents a webhook event payload from the relayer.\n *\n * @remarks\n * Contains event data, timestamp, and signature for verification\n * of webhook authenticity.\n *\n * @category Advanced\n */\nexport interface RelayerWebhookPayload {\n /** Event type */\n event: string;\n /** Event data */\n data: Record<string, unknown>;\n /** Timestamp */\n timestamp: number;\n /** Webhook ID */\n webhookId: string;\n /** Signature for verification */\n signature: string;\n}\n\n// ===== NEW SIMPLIFIED RELAYER TYPES (v2) =====\n\n/**\n * Handles both EIP-712 signed operations and direct server operations through a single interface.\n *\n * @remarks\n * This discriminated union provides type safety through TypeScript's narrowing.\n * The `type` field determines which operation variant is being used.\n * Signed operations require blockchain transactions, while direct operations\n * handle auxiliary tasks like file storage.\n *\n * @category Relayer\n * @see {@link https://docs.vana.org/docs/gasless-transactions | Gasless Transactions Guide}\n */\nexport type UnifiedRelayerRequest = SignedRelayerRequest | DirectRelayerRequest;\n\n/**\n * Represents an EIP-712 signed operation for gasless transaction submission.\n *\n * @remarks\n * Signed requests contain typed data and signatures that are verified\n * on-chain by smart contracts. The relayer pays gas fees on behalf of users.\n *\n * @category Relayer\n */\nexport interface SignedRelayerRequest {\n /** Discriminator field identifying this as a signed operation */\n type: \"signed\";\n /** Operation identifier for routing (e.g., 'submitAddPermission') */\n operation: SignedOperationType;\n /** EIP-712 typed data structure for the operation */\n typedData: GenericTypedData;\n /** User's signature of the typed data */\n signature: Hash;\n /** Optional address for additional signer verification */\n expectedUserAddress?: Address;\n}\n\n/**\n * Enumerates supported EIP-712 signed operation types.\n *\n * @remarks\n * Each operation type corresponds to a specific smart contract\n * function that accepts gasless transactions.\n *\n * @category Relayer\n */\nexport type SignedOperationType =\n | \"submitAddPermission\"\n | \"submitPermissionRevoke\"\n | \"submitTrustServer\"\n | \"submitAddAndTrustServer\"\n | \"submitUntrustServer\"\n | \"submitAddServerFilesAndPermissions\"\n | \"submitRegisterGrantee\";\n\n/**\n * Represents direct server operations that don't require blockchain signatures.\n *\n * @remarks\n * Direct requests handle auxiliary operations like file uploads and grant storage.\n * These operations may still result in blockchain transactions but don't require\n * user signatures for gasless submission.\n *\n * @category Relayer\n */\nexport type DirectRelayerRequest =\n | {\n type: \"direct\";\n operation: \"submitFileAddition\";\n params: {\n url: string;\n userAddress: Address;\n };\n }\n | {\n type: \"direct\";\n operation: \"submitFileAdditionWithPermissions\";\n params: {\n url: string;\n userAddress: Address;\n permissions: Array<{ account: Address; key: string }>;\n };\n }\n | {\n type: \"direct\";\n operation: \"submitFileAdditionComplete\";\n params: {\n url: string;\n userAddress: Address;\n permissions: Array<{ account: Address; key: string }>;\n schemaId: number;\n ownerAddress?: Address;\n };\n }\n | {\n type: \"direct\";\n operation: \"storeGrantFile\";\n params: GrantFile;\n };\n\n/**\n * Provides type-safe responses for all relayer operations.\n *\n * @remarks\n * The discriminated union ensures proper error handling and result typing.\n * Check the `type` field to determine success or failure before accessing results.\n *\n * @category Relayer\n */\nexport type UnifiedRelayerResponse =\n | {\n type: \"signed\";\n hash: Hash;\n }\n | {\n type: \"direct\";\n result: { fileId: number; transactionHash: Hash } | { url: string } | any;\n }\n | {\n type: \"error\";\n error: string;\n };\n\n/**\n * Simplified relayer configuration.\n * Can be a URL string for convenience, or a callback for full control.\n *\n * @category Configuration\n * @example\n * ```typescript\n * // Option 1: Simple URL (SDK handles the transport)\n * const vana = Vana({\n * walletClient,\n * relayer: '/api/relay'\n * });\n *\n * // Option 2: Full control with callback\n * const vana = Vana({\n * walletClient,\n * relayer: async (request) => {\n * const response = await fetch('/api/relay', {\n * method: 'POST',\n * body: JSON.stringify(request)\n * });\n * return response.json();\n * }\n * });\n * ```\n */\nexport type RelayerConfig =\n | string\n | ((request: UnifiedRelayerRequest) => Promise<UnifiedRelayerResponse>);\n\n/**\n * Simplified relayer callbacks interface (v2).\n * A single callback handles all relayer operations.\n *\n * @category Configuration\n * @example\n * ```typescript\n * const relayerCallbacks: RelayerCallbacksV2 = {\n * submit: async (request) => {\n * // Send to your server endpoint\n * const response = await fetch('/api/relay', {\n * method: 'POST',\n * headers: { 'Content-Type': 'application/json' },\n * body: JSON.stringify(request)\n * });\n * return response.json();\n * }\n * };\n * ```\n */\nexport interface RelayerCallbacksV2 {\n /**\n * Submits any relayer operation to the server.\n *\n * @remarks\n * This single callback handles all operations:\n * - EIP-712 signed operations (permissions, server trust, etc.)\n * - Direct operations (file additions, grant storage)\n *\n * On your server, pass the entire request object to the SDK's\n * `handleRelayerOperation` helper function.\n *\n * @param request - The unified request object.\n * Check `type` field to determine operation variant.\n * @returns Promise resolving to operation-specific response\n *\n * @example\n * ```typescript\n * async submit(request) {\n * const response = await fetch('/api/relay', {\n * method: 'POST',\n * body: JSON.stringify(request)\n * });\n * return response.json();\n * }\n * ```\n */\n submit: (request: UnifiedRelayerRequest) => Promise<UnifiedRelayerResponse>;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/types/relayer.ts"],"sourcesContent":["/**\n * Defines types for gasless transaction relayers and server operations.\n *\n * @remarks\n * This module provides comprehensive type definitions for interacting with\n * relayer services that enable gasless transactions and auxiliary operations.\n * It includes both legacy v1 types and the simplified v2 unified interface.\n *\n * @category Types\n * @module types/relayer\n */\n\nimport type { Hash, Address, TransactionReceipt } from \"viem\";\nimport type {\n GrantFile,\n PermissionGrantTypedData,\n GenericTypedData,\n} from \"./permissions\";\nimport type { RuntimeGrantFile } from \"./runtimePermissions\";\nimport type { Contract, Fn } from \"../generated/event-types\";\n\n/**\n * Represents the response from storing grant files via relayer.\n *\n * @remarks\n * Contains storage location, metadata, and error information for\n * grant file upload operations.\n *\n * @category Advanced\n */\nexport interface RelayerStorageResponse {\n /** The IPFS URL where the grant file is stored */\n grantUrl: string;\n /** Success status */\n success: boolean;\n /** Optional error message */\n error?: string;\n /** Storage metadata */\n metadata?: {\n /** IPFS hash */\n ipfsHash: string;\n /** File size in bytes */\n size: number;\n /** Upload timestamp */\n timestamp: number;\n };\n}\n\n/**\n * Represents the response from submitting transactions via relayer.\n *\n * @remarks\n * Contains transaction hash, status, and metadata for gasless\n * transaction submissions.\n *\n * @category Advanced\n */\nexport interface RelayerTransactionResponse {\n /** The transaction hash of the submitted transaction */\n transactionHash: Hash;\n /** Success status */\n success: boolean;\n /** Optional error message */\n error?: string;\n /** Transaction metadata */\n metadata?: {\n /** Gas used */\n gasUsed?: bigint;\n /** Gas price */\n gasPrice?: bigint;\n /** Block number */\n blockNumber?: bigint;\n /** Transaction status */\n status?: \"pending\" | \"confirmed\" | \"failed\";\n };\n}\n\n/**\n * Specifies parameters for storing grant files via relayer.\n *\n * @remarks\n * Includes the grant file and optional storage configuration\n * such as encryption and pinning duration.\n *\n * @category Advanced\n */\nexport interface RelayerStoreParams {\n /** The grant file to store */\n grantFile: GrantFile;\n /** Optional storage options */\n options?: {\n /** IPFS pin duration in seconds */\n pinDuration?: number;\n /** Whether to use encryption */\n encrypt?: boolean;\n /** Custom metadata */\n metadata?: Record<string, unknown>;\n };\n}\n\n/**\n * Specifies parameters for submitting gasless transactions.\n *\n * @remarks\n * Contains signed typed data and transaction configuration options\n * for relayer submission.\n *\n * @category Advanced\n */\nexport interface RelayerSubmitParams {\n /** The signed typed data */\n typedData: PermissionGrantTypedData;\n /** The signature */\n signature: string;\n /** Optional transaction options */\n options?: {\n /** Gas limit */\n gasLimit?: bigint;\n /** Priority level */\n priority?: \"low\" | \"medium\" | \"high\";\n /** Whether to wait for confirmation */\n waitForConfirmation?: boolean;\n };\n}\n\n/**\n * Represents the current status and capabilities of a relayer service.\n *\n * @remarks\n * Provides information about supported chains, rate limits, and\n * current operational status for monitoring and decision-making.\n *\n * @category Advanced\n */\nexport interface RelayerStatus {\n /** Whether the relayer is online */\n online: boolean;\n /** Service version */\n version: string;\n /** Supported chains */\n supportedChains: number[];\n /** Current chain status */\n chainStatus: Record<\n number,\n {\n /** Whether the chain is supported */\n supported: boolean;\n /** Current block number */\n currentBlock: bigint;\n /** Gas price estimation */\n gasPrice: bigint;\n /** Queue size */\n queueSize: number;\n }\n >;\n /** Rate limit information */\n rateLimits: {\n /** Requests per minute */\n requestsPerMinute: number;\n /** Storage requests per hour */\n storageRequestsPerHour: number;\n /** Transaction requests per hour */\n transactionRequestsPerHour: number;\n };\n}\n\n/**\n * Configures behavior for relayer requests.\n *\n * @remarks\n * Controls timeout, retry logic, headers, and priority for\n * relayer operation requests.\n *\n * @category Advanced\n */\nexport interface RelayerRequestOptions {\n /** Request timeout in milliseconds */\n timeout?: number;\n /** Whether to retry on failure */\n retry?: boolean;\n /** Custom headers */\n headers?: Record<string, string>;\n /** Request priority */\n priority?: \"low\" | \"medium\" | \"high\";\n}\n\n/**\n * Represents an error response from the relayer service.\n *\n * @remarks\n * Provides structured error information including codes, messages,\n * and debugging details for error handling and recovery.\n *\n * @category Advanced\n */\nexport interface RelayerErrorResponse {\n /** Error code */\n code: string;\n /** Error message */\n message: string;\n /** Additional error details */\n details?: Record<string, unknown>;\n /** Request ID for debugging */\n requestId?: string;\n /** Timestamp of error */\n timestamp: number;\n}\n\n/**\n * Provides information about the relayer's processing queue.\n *\n * @remarks\n * Includes queue size, position, estimated processing time, and\n * performance statistics for queue monitoring.\n *\n * @category Advanced\n */\nexport interface RelayerQueueInfo {\n /** Current queue size */\n size: number;\n /** Estimated processing time in seconds */\n estimatedProcessingTime: number;\n /** Queue position for a specific request */\n position?: number;\n /** Processing statistics */\n stats: {\n /** Average processing time in seconds */\n averageProcessingTime: number;\n /** Requests processed in last hour */\n requestsProcessedHour: number;\n /** Success rate percentage */\n successRate: number;\n };\n}\n\n/**\n * Tracks the status of a transaction submitted via relayer.\n *\n * @remarks\n * Provides detailed tracking information including confirmation status,\n * gas usage, and historical status checks.\n *\n * @category Advanced\n */\nexport interface RelayerTransactionStatus {\n /** Transaction hash */\n transactionHash: Hash;\n /** Current status */\n status: \"pending\" | \"confirmed\" | \"failed\";\n /** Block number if confirmed */\n blockNumber?: bigint;\n /** Gas used */\n gasUsed?: bigint;\n /** Error message if failed */\n error?: string;\n /** Status checks performed */\n checks: Array<{\n /** Check timestamp */\n timestamp: number;\n /** Status at time of check */\n status: string;\n /** Block number at time of check */\n blockNumber: bigint;\n }>;\n}\n\n/**\n * Provides performance metrics for the relayer service.\n *\n * @remarks\n * Includes transaction statistics, success rates, processing times,\n * and uptime information for monitoring and optimization.\n *\n * @category Advanced\n */\nexport interface RelayerMetrics {\n /** Total transactions processed */\n totalTransactions: number;\n /** Successful transactions */\n successfulTransactions: number;\n /** Failed transactions */\n failedTransactions: number;\n /** Average processing time in seconds */\n averageProcessingTime: number;\n /** Current queue size */\n queueSize: number;\n /** Uptime percentage */\n uptime: number;\n /** Last 24 hour statistics */\n last24Hours: {\n /** Transactions processed */\n transactions: number;\n /** Success rate */\n successRate: number;\n /** Average response time */\n averageResponseTime: number;\n };\n}\n\n/**\n * Configures webhook notifications for relayer events.\n *\n * @remarks\n * Enables asynchronous notifications for transaction confirmations,\n * failures, and storage completions.\n *\n * @category Advanced\n */\nexport interface RelayerWebhookConfig {\n /** Webhook URL */\n url: string;\n /** Events to subscribe to */\n events: Array<\n \"transaction_confirmed\" | \"transaction_failed\" | \"storage_complete\"\n >;\n /** Webhook secret for signature verification */\n secret?: string;\n /** Whether webhook is active */\n active: boolean;\n}\n\n/**\n * Represents a webhook event payload from the relayer.\n *\n * @remarks\n * Contains event data, timestamp, and signature for verification\n * of webhook authenticity.\n *\n * @category Advanced\n */\nexport interface RelayerWebhookPayload {\n /** Event type */\n event: string;\n /** Event data */\n data: Record<string, unknown>;\n /** Timestamp */\n timestamp: number;\n /** Webhook ID */\n webhookId: string;\n /** Signature for verification */\n signature: string;\n}\n\n// ===== NEW SIMPLIFIED RELAYER TYPES (v2) =====\n\n/**\n * Handles both EIP-712 signed operations and direct server operations through a single interface.\n *\n * @remarks\n * This discriminated union provides type safety through TypeScript's narrowing.\n * The `type` field determines which operation variant is being used.\n * Signed operations require blockchain transactions, while direct operations\n * handle auxiliary tasks like file storage.\n *\n * @category Relayer\n * @see {@link https://docs.vana.org/docs/gasless-transactions | Gasless Transactions Guide}\n */\nexport type UnifiedRelayerRequest =\n | SignedRelayerRequest\n | DirectRelayerRequest\n | {\n type: \"status_check\";\n operationId: string;\n };\n\n/**\n * Represents an EIP-712 signed operation for gasless transaction submission.\n *\n * @remarks\n * Signed requests contain typed data and signatures that are verified\n * on-chain by smart contracts. The relayer pays gas fees on behalf of users.\n *\n * @category Relayer\n */\nexport interface SignedRelayerRequest {\n /** Discriminator field identifying this as a signed operation */\n type: \"signed\";\n /** Operation identifier for routing (e.g., 'submitAddPermission') */\n operation: SignedOperationType;\n /** EIP-712 typed data structure for the operation */\n typedData: GenericTypedData;\n /** User's signature of the typed data */\n signature: Hash;\n /** Optional address for additional signer verification */\n expectedUserAddress?: Address;\n}\n\n/**\n * Enumerates supported EIP-712 signed operation types.\n *\n * @remarks\n * Each operation type corresponds to a specific smart contract\n * function that accepts gasless transactions.\n *\n * @category Relayer\n */\nexport type SignedOperationType =\n | \"submitAddPermission\"\n | \"submitPermissionRevoke\"\n | \"submitTrustServer\"\n | \"submitAddAndTrustServer\"\n | \"submitUntrustServer\"\n | \"submitAddServerFilesAndPermissions\";\n// | \"submitRegisterGrantee\"; // TODO: Add when contract supports registerGranteeWithSignature\n\n/**\n * Represents direct server operations that don't require blockchain signatures.\n *\n * @remarks\n * Direct requests handle auxiliary operations like file uploads and grant storage.\n * These operations may still result in blockchain transactions but don't require\n * user signatures for gasless submission.\n *\n * @category Relayer\n */\nexport type DirectRelayerRequest =\n | {\n type: \"direct\";\n operation: \"submitFileAddition\";\n params: {\n url: string;\n userAddress: Address;\n };\n }\n | {\n type: \"direct\";\n operation: \"submitFileAdditionWithPermissions\";\n params: {\n url: string;\n userAddress: Address;\n permissions: Array<{ account: Address; key: string }>;\n };\n }\n | {\n type: \"direct\";\n operation: \"submitFileAdditionComplete\";\n params: {\n url: string;\n userAddress: Address;\n permissions: Array<{ account: Address; key: string }>;\n schemaId: number;\n ownerAddress?: Address;\n };\n }\n | {\n type: \"direct\";\n operation: \"storeGrantFile\";\n params: GrantFile | RuntimeGrantFile;\n }\n | {\n type: \"direct\";\n operation: \"submitRegisterGrantee\";\n params: {\n owner: Address;\n granteeAddress: Address;\n publicKey: string;\n };\n };\n\n/**\n * Context for transaction operations to enable proper event parsing.\n *\n * @remarks\n * This context is preserved in relayer responses to enable client-side\n * event parsing without requiring manual reconstruction of transaction details.\n *\n * @category Relayer\n */\nexport interface TransactionContext {\n /** The contract that was called */\n contract: Contract;\n /** The function that was called on the contract */\n fn: Fn<Contract>;\n /** The address that initiated the transaction */\n from: Address;\n}\n\n/**\n * Provides type-safe responses for all relayer operations.\n *\n * @remarks\n * The discriminated union ensures proper error handling and result typing.\n * Check the `type` field to determine success or failure before accessing results.\n * The new async pattern returns pending operations with operationIds for polling.\n *\n * Transaction responses include optional context to enable client-side event parsing\n * through the enhanced response pattern.\n *\n * @category Relayer\n */\nexport type UnifiedRelayerResponse =\n | {\n type: \"pending\";\n operationId: string;\n }\n | {\n type: \"submitted\";\n hash: Hash;\n /** Optional context for client-side event parsing and enhanced responses */\n context?: TransactionContext;\n }\n | {\n type: \"confirmed\";\n hash: Hash;\n // Receipt is optional; a performance hint for the client SDK's polling logic.\n receipt?: TransactionReceipt;\n }\n | {\n type: \"signed\";\n hash: Hash;\n /** Optional context for client-side event parsing and enhanced responses */\n context?: TransactionContext;\n }\n | {\n /** Non-transactional operations that complete immediately (e.g., IPFS uploads, file info) */\n type: \"direct\";\n /** The result data from the operation, structure depends on the specific operation */\n result: unknown;\n }\n | {\n type: \"error\";\n error: string;\n };\n\n/**\n * Simplified relayer configuration.\n * Can be a URL string for convenience, or a callback for full control.\n *\n * @category Configuration\n * @example\n * ```typescript\n * // Option 1: Simple URL (SDK handles the transport)\n * const vana = Vana({\n * walletClient,\n * relayer: '/api/relay'\n * });\n *\n * // Option 2: Full control with callback\n * const vana = Vana({\n * walletClient,\n * relayer: async (request) => {\n * const response = await fetch('/api/relay', {\n * method: 'POST',\n * body: JSON.stringify(request)\n * });\n * return response.json();\n * }\n * });\n * ```\n */\nexport type RelayerConfig =\n | string\n | ((request: UnifiedRelayerRequest) => Promise<UnifiedRelayerResponse>);\n\n/**\n * Simplified relayer callbacks interface (v2).\n * A single callback handles all relayer operations.\n *\n * @category Configuration\n * @example\n * ```typescript\n * const relayerCallbacks: RelayerCallbacksV2 = {\n * submit: async (request) => {\n * // Send to your server endpoint\n * const response = await fetch('/api/relay', {\n * method: 'POST',\n * headers: { 'Content-Type': 'application/json' },\n * body: JSON.stringify(request)\n * });\n * return response.json();\n * }\n * };\n * ```\n */\nexport interface RelayerCallbacksV2 {\n /**\n * Submits any relayer operation to the server.\n *\n * @remarks\n * This single callback handles all operations:\n * - EIP-712 signed operations (permissions, server trust, etc.)\n * - Direct operations (file additions, grant storage)\n *\n * On your server, pass the entire request object to the SDK's\n * `handleRelayerOperation` helper function.\n *\n * @param request - The unified request object.\n * Check `type` field to determine operation variant.\n * @returns Promise resolving to operation-specific response\n *\n * @example\n * ```typescript\n * async submit(request) {\n * const response = await fetch('/api/relay', {\n * method: 'POST',\n * body: JSON.stringify(request)\n * });\n * return response.json();\n * }\n * ```\n */\n submit: (request: UnifiedRelayerRequest) => Promise<UnifiedRelayerResponse>;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -9,8 +9,10 @@
9
9
  * @category Types
10
10
  * @module types/relayer
11
11
  */
12
- import type { Hash, Address } from "viem";
12
+ import type { Hash, Address, TransactionReceipt } from "viem";
13
13
  import type { GrantFile, PermissionGrantTypedData, GenericTypedData } from "./permissions";
14
+ import type { RuntimeGrantFile } from "./runtimePermissions";
15
+ import type { Contract, Fn } from "../generated/event-types";
14
16
  /**
15
17
  * Represents the response from storing grant files via relayer.
16
18
  *
@@ -328,7 +330,10 @@ export interface RelayerWebhookPayload {
328
330
  * @category Relayer
329
331
  * @see {@link https://docs.vana.org/docs/gasless-transactions | Gasless Transactions Guide}
330
332
  */
331
- export type UnifiedRelayerRequest = SignedRelayerRequest | DirectRelayerRequest;
333
+ export type UnifiedRelayerRequest = SignedRelayerRequest | DirectRelayerRequest | {
334
+ type: "status_check";
335
+ operationId: string;
336
+ };
332
337
  /**
333
338
  * Represents an EIP-712 signed operation for gasless transaction submission.
334
339
  *
@@ -359,7 +364,7 @@ export interface SignedRelayerRequest {
359
364
  *
360
365
  * @category Relayer
361
366
  */
362
- export type SignedOperationType = "submitAddPermission" | "submitPermissionRevoke" | "submitTrustServer" | "submitAddAndTrustServer" | "submitUntrustServer" | "submitAddServerFilesAndPermissions" | "submitRegisterGrantee";
367
+ export type SignedOperationType = "submitAddPermission" | "submitPermissionRevoke" | "submitTrustServer" | "submitAddAndTrustServer" | "submitUntrustServer" | "submitAddServerFilesAndPermissions";
363
368
  /**
364
369
  * Represents direct server operations that don't require blockchain signatures.
365
370
  *
@@ -404,28 +409,68 @@ export type DirectRelayerRequest = {
404
409
  } | {
405
410
  type: "direct";
406
411
  operation: "storeGrantFile";
407
- params: GrantFile;
412
+ params: GrantFile | RuntimeGrantFile;
413
+ } | {
414
+ type: "direct";
415
+ operation: "submitRegisterGrantee";
416
+ params: {
417
+ owner: Address;
418
+ granteeAddress: Address;
419
+ publicKey: string;
420
+ };
408
421
  };
422
+ /**
423
+ * Context for transaction operations to enable proper event parsing.
424
+ *
425
+ * @remarks
426
+ * This context is preserved in relayer responses to enable client-side
427
+ * event parsing without requiring manual reconstruction of transaction details.
428
+ *
429
+ * @category Relayer
430
+ */
431
+ export interface TransactionContext {
432
+ /** The contract that was called */
433
+ contract: Contract;
434
+ /** The function that was called on the contract */
435
+ fn: Fn<Contract>;
436
+ /** The address that initiated the transaction */
437
+ from: Address;
438
+ }
409
439
  /**
410
440
  * Provides type-safe responses for all relayer operations.
411
441
  *
412
442
  * @remarks
413
443
  * The discriminated union ensures proper error handling and result typing.
414
444
  * Check the `type` field to determine success or failure before accessing results.
445
+ * The new async pattern returns pending operations with operationIds for polling.
446
+ *
447
+ * Transaction responses include optional context to enable client-side event parsing
448
+ * through the enhanced response pattern.
415
449
  *
416
450
  * @category Relayer
417
451
  */
418
452
  export type UnifiedRelayerResponse = {
453
+ type: "pending";
454
+ operationId: string;
455
+ } | {
456
+ type: "submitted";
457
+ hash: Hash;
458
+ /** Optional context for client-side event parsing and enhanced responses */
459
+ context?: TransactionContext;
460
+ } | {
461
+ type: "confirmed";
462
+ hash: Hash;
463
+ receipt?: TransactionReceipt;
464
+ } | {
419
465
  type: "signed";
420
466
  hash: Hash;
467
+ /** Optional context for client-side event parsing and enhanced responses */
468
+ context?: TransactionContext;
421
469
  } | {
470
+ /** Non-transactional operations that complete immediately (e.g., IPFS uploads, file info) */
422
471
  type: "direct";
423
- result: {
424
- fileId: number;
425
- transactionHash: Hash;
426
- } | {
427
- url: string;
428
- } | any;
472
+ /** The result data from the operation, structure depends on the specific operation */
473
+ result: unknown;
429
474
  } | {
430
475
  type: "error";
431
476
  error: string;