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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (545) hide show
  1. package/README.md +67 -351
  2. package/dist/browser.cjs.map +1 -1
  3. package/dist/browser.d.ts +33 -1
  4. package/dist/browser.js.map +1 -1
  5. package/dist/chains/definitions.cjs +9 -6
  6. package/dist/chains/definitions.cjs.map +1 -1
  7. package/dist/chains/definitions.d.ts +2 -0
  8. package/dist/chains/definitions.js +9 -6
  9. package/dist/chains/definitions.js.map +1 -1
  10. package/dist/chains/index.cjs.map +1 -1
  11. package/dist/chains/index.d.ts +30 -1
  12. package/dist/chains/index.js.map +1 -1
  13. package/dist/client/enhancedResponse.cjs +164 -0
  14. package/dist/client/enhancedResponse.cjs.map +1 -0
  15. package/dist/client/enhancedResponse.d.ts +120 -0
  16. package/dist/client/enhancedResponse.js +138 -0
  17. package/dist/client/enhancedResponse.js.map +1 -0
  18. package/dist/config/chains.cjs.map +1 -1
  19. package/dist/config/chains.d.ts +99 -0
  20. package/dist/config/chains.js.map +1 -1
  21. package/dist/config/contracts.config.cjs +400 -0
  22. package/dist/config/contracts.config.cjs.map +1 -0
  23. package/dist/config/contracts.config.d.ts +84 -0
  24. package/dist/config/contracts.config.js +375 -0
  25. package/dist/config/contracts.config.js.map +1 -0
  26. package/dist/config/default-services.cjs +60 -0
  27. package/dist/config/default-services.cjs.map +1 -0
  28. package/dist/config/default-services.d.ts +46 -0
  29. package/dist/config/default-services.js +33 -0
  30. package/dist/config/default-services.js.map +1 -0
  31. package/dist/config/default-services.test.d.ts +1 -0
  32. package/dist/contracts/contractController.cjs +1 -1
  33. package/dist/contracts/contractController.cjs.map +1 -1
  34. package/dist/contracts/contractController.d.ts +66 -10
  35. package/dist/contracts/contractController.js +1 -1
  36. package/dist/contracts/contractController.js.map +1 -1
  37. package/dist/controllers/__tests__/data-consistency-integration.test.d.ts +7 -0
  38. package/dist/controllers/__tests__/operations.processQueue.test.d.ts +1 -0
  39. package/dist/controllers/accessSettlement.cjs +289 -0
  40. package/dist/controllers/accessSettlement.cjs.map +1 -0
  41. package/dist/controllers/accessSettlement.d.ts +157 -0
  42. package/dist/controllers/accessSettlement.js +265 -0
  43. package/dist/controllers/accessSettlement.js.map +1 -0
  44. package/dist/controllers/accessSettlement.test.d.ts +1 -0
  45. package/dist/controllers/base.cjs +116 -0
  46. package/dist/controllers/base.cjs.map +1 -0
  47. package/dist/controllers/base.d.ts +94 -0
  48. package/dist/controllers/base.js +92 -0
  49. package/dist/controllers/base.js.map +1 -0
  50. package/dist/controllers/data.cjs +634 -352
  51. package/dist/controllers/data.cjs.map +1 -1
  52. package/dist/controllers/data.d.ts +348 -213
  53. package/dist/controllers/data.js +647 -355
  54. package/dist/controllers/data.js.map +1 -1
  55. package/dist/controllers/operations.cjs +430 -0
  56. package/dist/controllers/operations.cjs.map +1 -0
  57. package/dist/controllers/operations.d.ts +229 -0
  58. package/dist/controllers/operations.js +406 -0
  59. package/dist/controllers/operations.js.map +1 -0
  60. package/dist/controllers/permissions.cjs +943 -443
  61. package/dist/controllers/permissions.cjs.map +1 -1
  62. package/dist/controllers/permissions.d.ts +201 -120
  63. package/dist/controllers/permissions.js +943 -443
  64. package/dist/controllers/permissions.js.map +1 -1
  65. package/dist/controllers/protocol.cjs +14 -10
  66. package/dist/controllers/protocol.cjs.map +1 -1
  67. package/dist/controllers/protocol.d.ts +30 -31
  68. package/dist/controllers/protocol.js +14 -10
  69. package/dist/controllers/protocol.js.map +1 -1
  70. package/dist/controllers/runtimePermissions.cjs +272 -0
  71. package/dist/controllers/runtimePermissions.cjs.map +1 -0
  72. package/dist/controllers/runtimePermissions.d.ts +152 -0
  73. package/dist/controllers/runtimePermissions.js +251 -0
  74. package/dist/controllers/runtimePermissions.js.map +1 -0
  75. package/dist/controllers/runtimePermissions.test.d.ts +1 -0
  76. package/dist/controllers/schemas.cjs +113 -43
  77. package/dist/controllers/schemas.cjs.map +1 -1
  78. package/dist/controllers/schemas.d.ts +90 -43
  79. package/dist/controllers/schemas.js +113 -43
  80. package/dist/controllers/schemas.js.map +1 -1
  81. package/dist/controllers/server.cjs +276 -60
  82. package/dist/controllers/server.cjs.map +1 -1
  83. package/dist/controllers/server.d.ts +159 -54
  84. package/dist/controllers/server.js +276 -60
  85. package/dist/controllers/server.js.map +1 -1
  86. package/dist/core/__tests__/health.test.d.ts +1 -0
  87. package/dist/core/__tests__/inMemoryNonceManager.test.d.ts +1 -0
  88. package/dist/core/__tests__/nonceManager.test.d.ts +1 -0
  89. package/dist/core/__tests__/pollingManager.test.d.ts +4 -0
  90. package/dist/core/apiClient.cjs +53 -3
  91. package/dist/core/apiClient.cjs.map +1 -1
  92. package/dist/core/apiClient.d.ts +132 -7
  93. package/dist/core/apiClient.js +53 -3
  94. package/dist/core/apiClient.js.map +1 -1
  95. package/dist/core/generics.cjs +30 -3
  96. package/dist/core/generics.cjs.map +1 -1
  97. package/dist/core/generics.d.ts +95 -6
  98. package/dist/core/generics.js +30 -3
  99. package/dist/core/generics.js.map +1 -1
  100. package/dist/core/health.cjs +289 -0
  101. package/dist/core/health.cjs.map +1 -0
  102. package/dist/core/health.d.ts +143 -0
  103. package/dist/core/health.js +265 -0
  104. package/dist/core/health.js.map +1 -0
  105. package/dist/core/inMemoryNonceManager.cjs +138 -0
  106. package/dist/core/inMemoryNonceManager.cjs.map +1 -0
  107. package/dist/core/inMemoryNonceManager.d.ts +69 -0
  108. package/dist/core/inMemoryNonceManager.js +114 -0
  109. package/dist/core/inMemoryNonceManager.js.map +1 -0
  110. package/dist/core/nonceManager.cjs +304 -0
  111. package/dist/core/nonceManager.cjs.map +1 -0
  112. package/dist/core/nonceManager.d.ts +116 -0
  113. package/dist/core/nonceManager.js +280 -0
  114. package/dist/core/nonceManager.js.map +1 -0
  115. package/dist/core/pollingManager.cjs +292 -0
  116. package/dist/core/pollingManager.cjs.map +1 -0
  117. package/dist/core/pollingManager.d.ts +120 -0
  118. package/dist/core/pollingManager.js +268 -0
  119. package/dist/core/pollingManager.js.map +1 -0
  120. package/dist/core.cjs +164 -36
  121. package/dist/core.cjs.map +1 -1
  122. package/dist/core.d.ts +69 -10
  123. package/dist/core.js +167 -37
  124. package/dist/core.js.map +1 -1
  125. package/dist/crypto/ecies/__tests__/constants.test.d.ts +1 -1
  126. package/dist/crypto/ecies/__tests__/interface.test.d.ts +1 -0
  127. package/dist/crypto/ecies/__tests__/serialization.test.d.ts +8 -0
  128. package/dist/crypto/ecies/__tests__/utils.test.d.ts +1 -0
  129. package/dist/crypto/ecies/base.cjs +59 -23
  130. package/dist/crypto/ecies/base.cjs.map +1 -1
  131. package/dist/crypto/ecies/base.js +59 -23
  132. package/dist/crypto/ecies/base.js.map +1 -1
  133. package/dist/crypto/ecies/constants.cjs +2 -10
  134. package/dist/crypto/ecies/constants.cjs.map +1 -1
  135. package/dist/crypto/ecies/constants.d.ts +0 -9
  136. package/dist/crypto/ecies/constants.js +1 -8
  137. package/dist/crypto/ecies/constants.js.map +1 -1
  138. package/dist/crypto/ecies/interface.cjs +19 -2
  139. package/dist/crypto/ecies/interface.cjs.map +1 -1
  140. package/dist/crypto/ecies/interface.js +19 -2
  141. package/dist/crypto/ecies/interface.js.map +1 -1
  142. package/dist/errors.cjs +45 -0
  143. package/dist/errors.cjs.map +1 -1
  144. package/dist/errors.d.ts +104 -0
  145. package/dist/errors.js +43 -0
  146. package/dist/errors.js.map +1 -1
  147. package/dist/generated/abi/AccessSettlementImplementation.cjs +635 -0
  148. package/dist/generated/abi/AccessSettlementImplementation.cjs.map +1 -0
  149. package/dist/generated/abi/AccessSettlementImplementation.d.ts +468 -0
  150. package/dist/generated/abi/AccessSettlementImplementation.js +611 -0
  151. package/dist/generated/abi/AccessSettlementImplementation.js.map +1 -0
  152. package/dist/generated/abi/AttestationPolicyImplementation.cjs +614 -0
  153. package/dist/generated/abi/AttestationPolicyImplementation.cjs.map +1 -0
  154. package/dist/generated/abi/AttestationPolicyImplementation.d.ts +449 -0
  155. package/dist/generated/abi/AttestationPolicyImplementation.js +590 -0
  156. package/dist/generated/abi/AttestationPolicyImplementation.js.map +1 -0
  157. package/dist/generated/abi/ComputeEngineImplementation.cjs.map +1 -1
  158. package/dist/generated/abi/ComputeEngineImplementation.js.map +1 -1
  159. package/dist/generated/abi/{DLPTreasuryImplementation.cjs → ComputeEngineTreasuryImplementation.cjs} +16 -92
  160. package/dist/generated/abi/ComputeEngineTreasuryImplementation.cjs.map +1 -0
  161. package/dist/generated/abi/{DLPTreasuryImplementation.d.ts → ComputeEngineTreasuryImplementation.d.ts} +9 -67
  162. package/dist/generated/abi/{DLPTreasuryImplementation.js → ComputeEngineTreasuryImplementation.js} +12 -88
  163. package/dist/generated/abi/ComputeEngineTreasuryImplementation.js.map +1 -0
  164. package/dist/generated/abi/ComputeInstructionRegistryImplementation.cjs.map +1 -1
  165. package/dist/generated/abi/ComputeInstructionRegistryImplementation.js.map +1 -1
  166. package/dist/generated/abi/DATFactoryImplementation.cjs.map +1 -1
  167. package/dist/generated/abi/DATFactoryImplementation.js.map +1 -1
  168. package/dist/generated/abi/DATImplementation.cjs.map +1 -1
  169. package/dist/generated/abi/DATImplementation.js.map +1 -1
  170. package/dist/generated/abi/DATPausableImplementation.cjs.map +1 -1
  171. package/dist/generated/abi/DATPausableImplementation.js.map +1 -1
  172. package/dist/generated/abi/DATVotesImplementation.cjs.map +1 -1
  173. package/dist/generated/abi/DATVotesImplementation.js.map +1 -1
  174. package/dist/generated/abi/DLPPerformanceImplementation.cjs +42 -0
  175. package/dist/generated/abi/DLPPerformanceImplementation.cjs.map +1 -1
  176. package/dist/generated/abi/DLPPerformanceImplementation.d.ts +32 -0
  177. package/dist/generated/abi/DLPPerformanceImplementation.js +42 -0
  178. package/dist/generated/abi/DLPPerformanceImplementation.js.map +1 -1
  179. package/dist/generated/abi/DLPRegistryImplementation.cjs +5 -5
  180. package/dist/generated/abi/DLPRegistryImplementation.cjs.map +1 -1
  181. package/dist/generated/abi/DLPRegistryImplementation.d.ts +4 -4
  182. package/dist/generated/abi/DLPRegistryImplementation.js +5 -5
  183. package/dist/generated/abi/DLPRegistryImplementation.js.map +1 -1
  184. package/dist/generated/abi/DLPRegistryTreasuryImplementation.cjs.map +1 -1
  185. package/dist/generated/abi/DLPRegistryTreasuryImplementation.js.map +1 -1
  186. package/dist/generated/abi/DLPRewardDeployerImplementation.cjs +166 -2
  187. package/dist/generated/abi/DLPRewardDeployerImplementation.cjs.map +1 -1
  188. package/dist/generated/abi/DLPRewardDeployerImplementation.d.ts +129 -2
  189. package/dist/generated/abi/DLPRewardDeployerImplementation.js +166 -2
  190. package/dist/generated/abi/DLPRewardDeployerImplementation.js.map +1 -1
  191. package/dist/generated/abi/DLPRewardSwapImplementation.cjs.map +1 -1
  192. package/dist/generated/abi/DLPRewardSwapImplementation.js.map +1 -1
  193. package/dist/generated/abi/DataLiquidityPoolImplementation.cjs +282 -100
  194. package/dist/generated/abi/DataLiquidityPoolImplementation.cjs.map +1 -1
  195. package/dist/generated/abi/DataLiquidityPoolImplementation.d.ts +218 -79
  196. package/dist/generated/abi/DataLiquidityPoolImplementation.js +281 -99
  197. package/dist/generated/abi/DataLiquidityPoolImplementation.js.map +1 -1
  198. package/dist/generated/abi/DataPortabilityGranteesImplementation.cjs +167 -19
  199. package/dist/generated/abi/DataPortabilityGranteesImplementation.cjs.map +1 -1
  200. package/dist/generated/abi/DataPortabilityGranteesImplementation.d.ts +127 -14
  201. package/dist/generated/abi/DataPortabilityGranteesImplementation.js +167 -19
  202. package/dist/generated/abi/DataPortabilityGranteesImplementation.js.map +1 -1
  203. package/dist/generated/abi/DataPortabilityPermissionsImplementation.cjs +0 -19
  204. package/dist/generated/abi/DataPortabilityPermissionsImplementation.cjs.map +1 -1
  205. package/dist/generated/abi/DataPortabilityPermissionsImplementation.d.ts +0 -14
  206. package/dist/generated/abi/DataPortabilityPermissionsImplementation.js +0 -19
  207. package/dist/generated/abi/DataPortabilityPermissionsImplementation.js.map +1 -1
  208. package/dist/generated/abi/DataPortabilityServersImplementation.cjs +0 -19
  209. package/dist/generated/abi/DataPortabilityServersImplementation.cjs.map +1 -1
  210. package/dist/generated/abi/DataPortabilityServersImplementation.d.ts +0 -14
  211. package/dist/generated/abi/DataPortabilityServersImplementation.js +0 -19
  212. package/dist/generated/abi/DataPortabilityServersImplementation.js.map +1 -1
  213. package/dist/generated/abi/DataRefinerRegistryImplementation.cjs.map +1 -1
  214. package/dist/generated/abi/DataRefinerRegistryImplementation.js.map +1 -1
  215. package/dist/generated/abi/DataRegistryImplementation.cjs +0 -13
  216. package/dist/generated/abi/DataRegistryImplementation.cjs.map +1 -1
  217. package/dist/generated/abi/DataRegistryImplementation.d.ts +0 -10
  218. package/dist/generated/abi/DataRegistryImplementation.js +0 -13
  219. package/dist/generated/abi/DataRegistryImplementation.js.map +1 -1
  220. package/dist/generated/abi/DatasetRegistryImplementation.cjs +751 -0
  221. package/dist/generated/abi/DatasetRegistryImplementation.cjs.map +1 -0
  222. package/dist/generated/abi/DatasetRegistryImplementation.d.ts +557 -0
  223. package/dist/generated/abi/DatasetRegistryImplementation.js +727 -0
  224. package/dist/generated/abi/DatasetRegistryImplementation.js.map +1 -0
  225. package/dist/generated/abi/ProtocolConfigImplementation.cjs +578 -0
  226. package/dist/generated/abi/ProtocolConfigImplementation.cjs.map +1 -0
  227. package/dist/generated/abi/ProtocolConfigImplementation.d.ts +423 -0
  228. package/dist/generated/abi/ProtocolConfigImplementation.js +554 -0
  229. package/dist/generated/abi/ProtocolConfigImplementation.js.map +1 -0
  230. package/dist/generated/abi/QueryEngineImplementation.cjs.map +1 -1
  231. package/dist/generated/abi/QueryEngineImplementation.js.map +1 -1
  232. package/dist/generated/abi/SwapHelperImplementation.cjs +0 -43
  233. package/dist/generated/abi/SwapHelperImplementation.cjs.map +1 -1
  234. package/dist/generated/abi/SwapHelperImplementation.d.ts +0 -35
  235. package/dist/generated/abi/SwapHelperImplementation.js +0 -43
  236. package/dist/generated/abi/SwapHelperImplementation.js.map +1 -1
  237. package/dist/generated/abi/TeePoolDedicatedGpuImplementation.cjs.map +1 -1
  238. package/dist/generated/abi/TeePoolDedicatedGpuImplementation.js.map +1 -1
  239. package/dist/generated/abi/TeePoolDedicatedStandardImplementation.cjs.map +1 -1
  240. package/dist/generated/abi/TeePoolDedicatedStandardImplementation.js.map +1 -1
  241. package/dist/generated/abi/TeePoolEphemeralStandardImplementation.cjs.map +1 -1
  242. package/dist/generated/abi/TeePoolEphemeralStandardImplementation.js.map +1 -1
  243. package/dist/generated/abi/TeePoolPersistentGpuImplementation.cjs.map +1 -1
  244. package/dist/generated/abi/TeePoolPersistentGpuImplementation.js.map +1 -1
  245. package/dist/generated/abi/TeePoolPersistentStandardImplementation.cjs.map +1 -1
  246. package/dist/generated/abi/TeePoolPersistentStandardImplementation.js.map +1 -1
  247. package/dist/generated/abi/TeePoolPhalaImplementation.cjs.map +1 -1
  248. package/dist/generated/abi/TeePoolPhalaImplementation.js.map +1 -1
  249. package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.cjs +1251 -0
  250. package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.cjs.map +1 -0
  251. package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.d.ts +948 -0
  252. package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.js +1227 -0
  253. package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.js.map +1 -0
  254. package/dist/generated/abi/UniswapV3QuoterV2Implementation.cjs +297 -0
  255. package/dist/generated/abi/UniswapV3QuoterV2Implementation.cjs.map +1 -0
  256. package/dist/generated/abi/UniswapV3QuoterV2Implementation.d.ts +206 -0
  257. package/dist/generated/abi/UniswapV3QuoterV2Implementation.js +273 -0
  258. package/dist/generated/abi/UniswapV3QuoterV2Implementation.js.map +1 -0
  259. package/dist/generated/abi/VanaEpochImplementation.cjs +195 -0
  260. package/dist/generated/abi/VanaEpochImplementation.cjs.map +1 -1
  261. package/dist/generated/abi/VanaEpochImplementation.d.ts +151 -0
  262. package/dist/generated/abi/VanaEpochImplementation.js +195 -0
  263. package/dist/generated/abi/VanaEpochImplementation.js.map +1 -1
  264. package/dist/generated/abi/VanaPoolEntityImplementation.cjs +22 -65
  265. package/dist/generated/abi/VanaPoolEntityImplementation.cjs.map +1 -1
  266. package/dist/generated/abi/VanaPoolEntityImplementation.d.ts +17 -51
  267. package/dist/generated/abi/VanaPoolEntityImplementation.js +22 -65
  268. package/dist/generated/abi/VanaPoolEntityImplementation.js.map +1 -1
  269. package/dist/generated/abi/VanaPoolStakingImplementation.cjs +113 -1
  270. package/dist/generated/abi/VanaPoolStakingImplementation.cjs.map +1 -1
  271. package/dist/generated/abi/VanaPoolStakingImplementation.d.ts +85 -1
  272. package/dist/generated/abi/VanaPoolStakingImplementation.js +113 -1
  273. package/dist/generated/abi/VanaPoolStakingImplementation.js.map +1 -1
  274. package/dist/generated/abi/VanaPoolTreasuryImplementation.cjs.map +1 -1
  275. package/dist/generated/abi/VanaPoolTreasuryImplementation.js.map +1 -1
  276. package/dist/generated/abi/VanaRuntimePermissionsImplementation.cjs +759 -0
  277. package/dist/generated/abi/VanaRuntimePermissionsImplementation.cjs.map +1 -0
  278. package/dist/generated/abi/VanaRuntimePermissionsImplementation.d.ts +563 -0
  279. package/dist/generated/abi/VanaRuntimePermissionsImplementation.js +735 -0
  280. package/dist/generated/abi/VanaRuntimePermissionsImplementation.js.map +1 -0
  281. package/dist/generated/abi/VanaRuntimeServersImplementation.cjs +820 -0
  282. package/dist/generated/abi/VanaRuntimeServersImplementation.cjs.map +1 -0
  283. package/dist/generated/abi/VanaRuntimeServersImplementation.d.ts +609 -0
  284. package/dist/generated/abi/VanaRuntimeServersImplementation.js +796 -0
  285. package/dist/generated/abi/VanaRuntimeServersImplementation.js.map +1 -0
  286. package/dist/generated/abi/VanaTreasuryImplementation.cjs +536 -0
  287. package/dist/generated/abi/VanaTreasuryImplementation.cjs.map +1 -0
  288. package/dist/generated/abi/VanaTreasuryImplementation.d.ts +393 -0
  289. package/dist/generated/abi/VanaTreasuryImplementation.js +512 -0
  290. package/dist/generated/abi/VanaTreasuryImplementation.js.map +1 -0
  291. package/dist/generated/abi/WVANAImplementation.cjs +339 -0
  292. package/dist/generated/abi/WVANAImplementation.cjs.map +1 -0
  293. package/dist/generated/abi/WVANAImplementation.d.ts +244 -0
  294. package/dist/generated/abi/WVANAImplementation.js +315 -0
  295. package/dist/generated/abi/WVANAImplementation.js.map +1 -0
  296. package/dist/generated/abi/index.cjs +79 -47
  297. package/dist/generated/abi/index.cjs.map +1 -1
  298. package/dist/generated/abi/index.d.ts +15783 -10449
  299. package/dist/generated/abi/index.js +65 -43
  300. package/dist/generated/abi/index.js.map +1 -1
  301. package/dist/{config → generated}/addresses.cjs +174 -75
  302. package/dist/generated/addresses.cjs.map +1 -0
  303. package/dist/{config → generated}/addresses.d.ts +174 -165
  304. package/dist/{config → generated}/addresses.js +174 -75
  305. package/dist/generated/addresses.js.map +1 -0
  306. package/dist/generated/event-types.cjs.map +1 -1
  307. package/dist/generated/event-types.d.ts +482 -399
  308. package/dist/generated/eventRegistry.cjs +2601 -724
  309. package/dist/generated/eventRegistry.cjs.map +1 -1
  310. package/dist/generated/eventRegistry.d.ts +2 -2
  311. package/dist/generated/eventRegistry.js +2601 -724
  312. package/dist/generated/eventRegistry.js.map +1 -1
  313. package/dist/generated/server/server-exports.cjs +22 -0
  314. package/dist/generated/server/server-exports.cjs.map +1 -1
  315. package/dist/generated/server/server-exports.d.ts +31 -11
  316. package/dist/generated/server/server-exports.js +17 -0
  317. package/dist/generated/server/server-exports.js.map +1 -1
  318. package/dist/generated/server/server.cjs.map +1 -1
  319. package/dist/generated/server/server.d.ts +771 -402
  320. package/dist/generated/subgraph.cjs +797 -32
  321. package/dist/generated/subgraph.cjs.map +1 -1
  322. package/dist/generated/subgraph.d.ts +135 -0
  323. package/dist/generated/subgraph.js +792 -32
  324. package/dist/generated/subgraph.js.map +1 -1
  325. package/dist/index.browser.d.ts +6 -1
  326. package/dist/index.browser.js +26 -1
  327. package/dist/index.browser.js.map +1 -1
  328. package/dist/index.cjs.map +1 -1
  329. package/dist/index.js.map +1 -1
  330. package/dist/index.node.cjs +47 -4
  331. package/dist/index.node.cjs.map +1 -1
  332. package/dist/index.node.d.ts +60 -14
  333. package/dist/index.node.js +42 -3
  334. package/dist/index.node.js.map +1 -1
  335. package/dist/lib/__tests__/redisAtomicStore.test.d.ts +1 -0
  336. package/dist/lib/redisAtomicStore.cjs +201 -0
  337. package/dist/lib/redisAtomicStore.cjs.map +1 -0
  338. package/dist/lib/redisAtomicStore.d.ts +120 -0
  339. package/dist/lib/redisAtomicStore.js +177 -0
  340. package/dist/lib/redisAtomicStore.js.map +1 -0
  341. package/dist/node.cjs.map +1 -1
  342. package/dist/node.d.ts +39 -1
  343. package/dist/node.js.map +1 -1
  344. package/dist/platform/browser.cjs +160 -2
  345. package/dist/platform/browser.cjs.map +1 -1
  346. package/dist/platform/browser.d.ts +232 -12
  347. package/dist/platform/browser.js +160 -2
  348. package/dist/platform/browser.js.map +1 -1
  349. package/dist/platform/interface.cjs.map +1 -1
  350. package/dist/platform/interface.d.ts +283 -90
  351. package/dist/platform/node.cjs +163 -2
  352. package/dist/platform/node.cjs.map +1 -1
  353. package/dist/platform/node.d.ts +69 -6
  354. package/dist/platform/node.js +163 -2
  355. package/dist/platform/node.js.map +1 -1
  356. package/dist/server/relayerHandler.cjs +452 -0
  357. package/dist/server/relayerHandler.cjs.map +1 -0
  358. package/dist/server/relayerHandler.d.ts +69 -0
  359. package/dist/server/relayerHandler.js +428 -0
  360. package/dist/server/relayerHandler.js.map +1 -0
  361. package/dist/storage/index.cjs +3 -0
  362. package/dist/storage/index.cjs.map +1 -1
  363. package/dist/storage/index.d.ts +1 -0
  364. package/dist/storage/index.js +2 -0
  365. package/dist/storage/index.js.map +1 -1
  366. package/dist/storage/manager.cjs +108 -25
  367. package/dist/storage/manager.cjs.map +1 -1
  368. package/dist/storage/manager.d.ts +119 -25
  369. package/dist/storage/manager.js +108 -25
  370. package/dist/storage/manager.js.map +1 -1
  371. package/dist/storage/providers/callback-storage.cjs +86 -15
  372. package/dist/storage/providers/callback-storage.cjs.map +1 -1
  373. package/dist/storage/providers/callback-storage.d.ts +109 -20
  374. package/dist/storage/providers/callback-storage.js +86 -15
  375. package/dist/storage/providers/callback-storage.js.map +1 -1
  376. package/dist/storage/providers/dropbox.cjs +237 -0
  377. package/dist/storage/providers/dropbox.cjs.map +1 -0
  378. package/dist/storage/providers/dropbox.d.ts +39 -0
  379. package/dist/storage/providers/dropbox.js +215 -0
  380. package/dist/storage/providers/dropbox.js.map +1 -0
  381. package/dist/storage/providers/dropbox.test.d.ts +1 -0
  382. package/dist/storage/providers/pinata.cjs.map +1 -1
  383. package/dist/storage/providers/pinata.d.ts +12 -14
  384. package/dist/storage/providers/pinata.js.map +1 -1
  385. package/dist/tests/data-upload-owner-validation.test.d.ts +1 -0
  386. package/dist/tests/factories/mockFactory.d.ts +6 -6
  387. package/dist/tests/fakes/FakeWaitForTransactionEvents.d.ts +2 -2
  388. package/dist/tests/permissions-revoke-relayer.test.d.ts +1 -0
  389. package/dist/tests/permissions-transaction-options.test.d.ts +1 -0
  390. package/dist/tests/read-only-mode.test.d.ts +1 -0
  391. package/dist/tests/relayer-integration.test.d.ts +1 -0
  392. package/dist/tests/relayer-unified.test.d.ts +1 -0
  393. package/dist/tests/server-relayer-handler.test.d.ts +1 -0
  394. package/dist/types/accessSettlement.cjs +17 -0
  395. package/dist/types/accessSettlement.cjs.map +1 -0
  396. package/dist/types/accessSettlement.d.ts +66 -0
  397. package/dist/types/accessSettlement.js +1 -0
  398. package/dist/types/accessSettlement.js.map +1 -0
  399. package/dist/types/atomicStore.cjs +31 -0
  400. package/dist/types/atomicStore.cjs.map +1 -0
  401. package/dist/types/atomicStore.d.ts +236 -0
  402. package/dist/types/atomicStore.js +7 -0
  403. package/dist/types/atomicStore.js.map +1 -0
  404. package/dist/types/blockchain.cjs.map +1 -1
  405. package/dist/types/blockchain.d.ts +39 -11
  406. package/dist/types/chains.cjs.map +1 -1
  407. package/dist/types/chains.d.ts +74 -7
  408. package/dist/types/chains.js.map +1 -1
  409. package/dist/types/config.cjs +10 -0
  410. package/dist/types/config.cjs.map +1 -1
  411. package/dist/types/config.d.ts +217 -220
  412. package/dist/types/config.js +8 -0
  413. package/dist/types/config.js.map +1 -1
  414. package/dist/types/contracts.cjs.map +1 -1
  415. package/dist/types/contracts.d.ts +71 -7
  416. package/dist/types/controller-context.cjs.map +1 -1
  417. package/dist/types/controller-context.d.ts +12 -6
  418. package/dist/types/data.cjs.map +1 -1
  419. package/dist/types/data.d.ts +82 -10
  420. package/dist/types/generics.cjs.map +1 -1
  421. package/dist/types/generics.d.ts +81 -10
  422. package/dist/types/index.cjs +4 -0
  423. package/dist/types/index.cjs.map +1 -1
  424. package/dist/types/index.d.ts +36 -6
  425. package/dist/types/index.js +9 -1
  426. package/dist/types/index.js.map +1 -1
  427. package/dist/types/operationStore.cjs +17 -0
  428. package/dist/types/operationStore.cjs.map +1 -0
  429. package/dist/types/operationStore.d.ts +171 -0
  430. package/dist/types/operationStore.js +1 -0
  431. package/dist/types/operationStore.js.map +1 -0
  432. package/dist/types/operations.cjs +3 -15
  433. package/dist/types/operations.cjs.map +1 -1
  434. package/dist/types/operations.d.ts +131 -39
  435. package/dist/types/operations.js +2 -13
  436. package/dist/types/operations.js.map +1 -1
  437. package/dist/types/options.cjs +17 -0
  438. package/dist/types/options.cjs.map +1 -0
  439. package/dist/types/options.d.ts +308 -0
  440. package/dist/types/options.js +1 -0
  441. package/dist/types/options.js.map +1 -0
  442. package/dist/types/permissions.cjs.map +1 -1
  443. package/dist/types/permissions.d.ts +19 -20
  444. package/dist/types/personal.cjs.map +1 -1
  445. package/dist/types/personal.d.ts +150 -14
  446. package/dist/types/relayer.cjs.map +1 -1
  447. package/dist/types/relayer.d.ts +307 -35
  448. package/dist/types/runtimePermissions.cjs +17 -0
  449. package/dist/types/runtimePermissions.cjs.map +1 -0
  450. package/dist/types/runtimePermissions.d.ts +122 -0
  451. package/dist/types/runtimePermissions.js +1 -0
  452. package/dist/types/runtimePermissions.js.map +1 -0
  453. package/dist/types/storage.cjs.map +1 -1
  454. package/dist/types/storage.d.ts +9 -21
  455. package/dist/types/storage.js.map +1 -1
  456. package/dist/types/utils.cjs.map +1 -1
  457. package/dist/types/utils.d.ts +0 -45
  458. package/dist/utils/__tests__/chainQuery.test.d.ts +1 -0
  459. package/dist/utils/__tests__/subgraphConsistency.test.d.ts +4 -0
  460. package/dist/utils/__tests__/subgraphPagination.test.d.ts +4 -0
  461. package/dist/utils/blockchain/registry.cjs +3 -3
  462. package/dist/utils/blockchain/registry.cjs.map +1 -1
  463. package/dist/utils/blockchain/registry.d.ts +1 -1
  464. package/dist/utils/blockchain/registry.js +3 -3
  465. package/dist/utils/blockchain/registry.js.map +1 -1
  466. package/dist/utils/chainQuery.cjs +107 -0
  467. package/dist/utils/chainQuery.cjs.map +1 -0
  468. package/dist/utils/chainQuery.d.ts +31 -0
  469. package/dist/utils/chainQuery.js +82 -0
  470. package/dist/utils/chainQuery.js.map +1 -0
  471. package/dist/utils/grantFiles.cjs +4 -1
  472. package/dist/utils/grantFiles.cjs.map +1 -1
  473. package/dist/utils/grantFiles.d.ts +10 -20
  474. package/dist/utils/grantFiles.js +4 -1
  475. package/dist/utils/grantFiles.js.map +1 -1
  476. package/dist/utils/grantValidation.cjs.map +1 -1
  477. package/dist/utils/grantValidation.d.ts +95 -16
  478. package/dist/utils/grantValidation.js.map +1 -1
  479. package/dist/utils/grants.cjs.map +1 -1
  480. package/dist/utils/grants.d.ts +93 -12
  481. package/dist/utils/grants.js.map +1 -1
  482. package/dist/utils/ipfs.cjs +2 -4
  483. package/dist/utils/ipfs.cjs.map +1 -1
  484. package/dist/utils/ipfs.d.ts +1 -1
  485. package/dist/utils/ipfs.js +2 -4
  486. package/dist/utils/ipfs.js.map +1 -1
  487. package/dist/utils/lazy-import.cjs.map +1 -1
  488. package/dist/utils/lazy-import.d.ts +32 -7
  489. package/dist/utils/lazy-import.js.map +1 -1
  490. package/dist/utils/multicall.cjs +1 -1
  491. package/dist/utils/multicall.cjs.map +1 -1
  492. package/dist/utils/multicall.js +1 -1
  493. package/dist/utils/multicall.js.map +1 -1
  494. package/dist/utils/runtimeGrantFiles.cjs +84 -0
  495. package/dist/utils/runtimeGrantFiles.cjs.map +1 -0
  496. package/dist/utils/runtimeGrantFiles.d.ts +66 -0
  497. package/dist/utils/runtimeGrantFiles.js +58 -0
  498. package/dist/utils/runtimeGrantFiles.js.map +1 -0
  499. package/dist/utils/signatureCache.cjs +8 -2
  500. package/dist/utils/signatureCache.cjs.map +1 -1
  501. package/dist/utils/signatureCache.d.ts +49 -8
  502. package/dist/utils/signatureCache.js +8 -2
  503. package/dist/utils/signatureCache.js.map +1 -1
  504. package/dist/utils/subgraphConsistency.cjs +184 -0
  505. package/dist/utils/subgraphConsistency.cjs.map +1 -0
  506. package/dist/utils/subgraphConsistency.d.ts +65 -0
  507. package/dist/utils/subgraphConsistency.js +155 -0
  508. package/dist/utils/subgraphConsistency.js.map +1 -0
  509. package/dist/utils/subgraphMetaCache.cjs +101 -0
  510. package/dist/utils/subgraphMetaCache.cjs.map +1 -0
  511. package/dist/utils/subgraphMetaCache.d.ts +56 -0
  512. package/dist/utils/subgraphMetaCache.js +76 -0
  513. package/dist/utils/subgraphMetaCache.js.map +1 -0
  514. package/dist/utils/subgraphPagination.cjs +104 -0
  515. package/dist/utils/subgraphPagination.cjs.map +1 -0
  516. package/dist/utils/subgraphPagination.d.ts +78 -0
  517. package/dist/utils/subgraphPagination.js +78 -0
  518. package/dist/utils/subgraphPagination.js.map +1 -0
  519. package/dist/utils/transactionHelpers.cjs.map +1 -1
  520. package/dist/utils/transactionHelpers.d.ts +12 -12
  521. package/dist/utils/transactionHelpers.js.map +1 -1
  522. package/dist/utils/typedDataConverter.cjs.map +1 -1
  523. package/dist/utils/typedDataConverter.d.ts +39 -3
  524. package/dist/utils/typedDataConverter.js.map +1 -1
  525. package/dist/utils/urlResolver.cjs +7 -0
  526. package/dist/utils/urlResolver.cjs.map +1 -1
  527. package/dist/utils/urlResolver.d.ts +22 -4
  528. package/dist/utils/urlResolver.js +7 -0
  529. package/dist/utils/urlResolver.js.map +1 -1
  530. package/dist/utils/wallet.cjs +63 -0
  531. package/dist/utils/wallet.cjs.map +1 -0
  532. package/dist/utils/wallet.d.ts +94 -0
  533. package/dist/utils/wallet.js +37 -0
  534. package/dist/utils/wallet.js.map +1 -0
  535. package/package.json +7 -2
  536. package/dist/config/addresses.cjs.map +0 -1
  537. package/dist/config/addresses.js.map +0 -1
  538. package/dist/generated/abi/DLPTreasuryImplementation.cjs.map +0 -1
  539. package/dist/generated/abi/DLPTreasuryImplementation.js.map +0 -1
  540. package/dist/server/handler.cjs +0 -101
  541. package/dist/server/handler.cjs.map +0 -1
  542. package/dist/server/handler.d.ts +0 -87
  543. package/dist/server/handler.js +0 -77
  544. package/dist/server/handler.js.map +0 -1
  545. /package/dist/{tests/server-handler.test.d.ts → client/__tests__/enhancedResponse.test.d.ts} +0 -0
@@ -1,38 +1,174 @@
1
1
  /**
2
- * Parameters for the `vana.personal.postRequest` method.
2
+ * Defines parameters for posting data requests to personal servers.
3
+ *
4
+ * @remarks
5
+ * Used to initiate data access requests that require user permission.
6
+ * The permission ID references a previously granted permission that
7
+ * authorizes the requester to access specific user data.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const params: PostRequestParams = {
12
+ * permissionId: 123
13
+ * };
14
+ *
15
+ * const response = await vana.personal.postRequest(params);
16
+ * console.log('Request posted:', response.requestId);
17
+ * ```
18
+ *
19
+ * @category Personal Server
3
20
  */
4
21
  export interface PostRequestParams {
5
- /** The permission ID */
22
+ /**
23
+ * References a granted permission authorizing data access.
24
+ * Obtain via permission granting flow or query existing permissions.
25
+ * @throws {PermissionNotFoundError} If permission ID is invalid.
26
+ */
6
27
  permissionId: number;
7
28
  }
8
29
  /**
9
- * Parameters for the `vana.server.createOperation` method.
30
+ * Defines parameters for creating server-side operations.
31
+ *
32
+ * @remarks
33
+ * Initiates asynchronous operations on the personal server that
34
+ * process user data according to granted permissions. Operations
35
+ * run in the background and can be monitored via their operation ID.
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * const params: CreateOperationParams = {
40
+ * permissionId: 456
41
+ * };
42
+ *
43
+ * const operation = await vana.server.createOperation(params);
44
+ * // Monitor operation status
45
+ * const status = await vana.server.getOperationStatus(operation.id);
46
+ * ```
47
+ *
48
+ * @category Personal Server
10
49
  */
11
50
  export interface CreateOperationParams {
12
- /** The permission ID */
51
+ /**
52
+ * References the permission scope for this operation.
53
+ * Determines what data and actions are allowed.
54
+ * @throws {InsufficientPermissionsError} If permission scope is inadequate.
55
+ */
13
56
  permissionId: number;
14
57
  }
15
58
  /**
16
- * Parameters for personal server operations.
59
+ * Parameters for downloading an artifact from a server operation.
60
+ *
61
+ * @remarks
62
+ * Artifacts are files generated during operations like Gemini agent analysis.
63
+ * The download requires authentication using the application's signature.
64
+ *
65
+ * @category Personal Server
66
+ */
67
+ export interface DownloadArtifactParams {
68
+ /**
69
+ * The operation ID that generated the artifact.
70
+ */
71
+ operationId: string;
72
+ /**
73
+ * The path to the artifact file to download.
74
+ */
75
+ artifactPath: string;
76
+ }
77
+ /**
78
+ * Defines parameters for initializing personal server connections.
79
+ *
80
+ * @remarks
81
+ * Establishes secure communication channels with a user's personal
82
+ * data server. The server manages encrypted user data and enforces
83
+ * permission-based access control. Initialization includes key exchange
84
+ * and session establishment.
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * const params: InitPersonalServerParams = {
89
+ * userAddress: '0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36'
90
+ * };
91
+ *
92
+ * const server = await vana.personal.initServer(params);
93
+ * console.log('Connected to server:', server.baseUrl);
94
+ * ```
95
+ *
96
+ * @category Personal Server
17
97
  */
18
98
  export interface InitPersonalServerParams {
19
- /** The user's wallet address */
99
+ /**
100
+ * Identifies the user whose personal server to connect to.
101
+ * Must be a valid Ethereum address in hex format.
102
+ * @example '0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36'
103
+ */
20
104
  userAddress: string;
21
105
  }
22
106
  /**
23
- * Extended personal server identity information including connection details.
24
- * This combines the base PersonalServerModel with additional metadata
25
- * needed for client connections.
107
+ * Represents comprehensive personal server identity and connection information.
108
+ *
109
+ * @remarks
110
+ * Combines core server identity with connection metadata required for
111
+ * establishing secure communication. Personal servers are user-controlled
112
+ * nodes that store and serve encrypted personal data according to
113
+ * user-defined permissions. This interface provides all necessary
114
+ * information to connect to and interact with a personal server.
115
+ *
116
+ * @example
117
+ * ```typescript
118
+ * const identity: PersonalServerIdentity = {
119
+ * kind: 'PersonalServer',
120
+ * address: '0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36',
121
+ * publicKey: '0x04...', // 65-byte uncompressed public key
122
+ * baseUrl: 'https://ps.user.vana.com',
123
+ * name: 'User Personal Server #1'
124
+ * };
125
+ *
126
+ * // Use identity to establish encrypted connection
127
+ * const encrypted = await crypto.encrypt(data, identity.publicKey);
128
+ * const response = await fetch(`${identity.baseUrl}/api/data`, {
129
+ * method: 'POST',
130
+ * body: encrypted
131
+ * });
132
+ * ```
133
+ *
134
+ * @category Personal Server
26
135
  */
27
136
  export interface PersonalServerIdentity {
28
- /** Resource type identifier */
137
+ /**
138
+ * Identifies the resource type for API disambiguation.
139
+ * Always 'PersonalServer' for personal server instances.
140
+ */
29
141
  kind: string;
30
- /** The server's Ethereum address */
142
+ /**
143
+ * Uniquely identifies the server on the blockchain.
144
+ * Used for permission verification and identity proofs.
145
+ * @example '0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36'
146
+ */
31
147
  address: string;
32
- /** The server's public key for encryption */
148
+ /**
149
+ * Enables end-to-end encryption for data transmission.
150
+ * Must be in uncompressed format (65 bytes with 0x04 prefix).
151
+ * @example '0x04...' (130 hex characters)
152
+ */
33
153
  publicKey: string;
34
- /** The base URL for connecting to this server */
154
+ /**
155
+ * Provides the HTTPS endpoint for server API requests.
156
+ * Should not include trailing slashes or API paths.
157
+ * @example 'https://ps.user.vana.com'
158
+ */
35
159
  baseUrl: string;
36
- /** Human-readable name for this server */
160
+ /**
161
+ * Displays a user-friendly identifier for the server.
162
+ * Used in UI components and logging for clarity.
163
+ * @example 'Primary Data Server'
164
+ */
37
165
  name: string;
38
166
  }
167
+ /**
168
+ * @remarks
169
+ * Additional server response types are auto-generated from the OpenAPI
170
+ * specification and available in the server-exports module. Import those
171
+ * types directly when working with server API responses.
172
+ *
173
+ * @see {@link ../types/server-exports | Server Export Types}
174
+ */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/relayer.ts"],"sourcesContent":["import type { Hash } from \"viem\";\nimport type { GrantFile, PermissionGrantTypedData } from \"./permissions\";\n\n/**\n * Response from the relayer service for grant file storage\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 * Response from the relayer service for transaction submission\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 * Parameters for storing a grant file via relayer\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 * Parameters for submitting a transaction via relayer\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 * Relayer service status\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 * Relayer configuration\n *\n * @category Advanced\n */\nexport interface RelayerConfig {\n /** Relayer service URL */\n url: string;\n /** API key for authentication */\n apiKey?: string;\n /** Timeout for requests in milliseconds */\n timeout?: number;\n /** Retry configuration */\n retry?: {\n /** Number of retry attempts */\n attempts: number;\n /** Delay between retries in milliseconds */\n delay: number;\n };\n /** Whether to use HTTPS */\n useHttps?: boolean;\n}\n\n/**\n * Relayer request options\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 * Relayer error response\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 * Relayer queue information\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 * Relayer transaction status\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 * Relayer metrics\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 * Relayer webhook configuration\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 * Relayer webhook payload\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"],"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":[]}
@@ -1,7 +1,24 @@
1
- import type { Hash } from "viem";
2
- import type { GrantFile, PermissionGrantTypedData } from "./permissions";
3
1
  /**
4
- * Response from the relayer service for grant file storage
2
+ * Defines types for gasless transaction relayers and server operations.
3
+ *
4
+ * @remarks
5
+ * This module provides comprehensive type definitions for interacting with
6
+ * relayer services that enable gasless transactions and auxiliary operations.
7
+ * It includes both legacy v1 types and the simplified v2 unified interface.
8
+ *
9
+ * @category Types
10
+ * @module types/relayer
11
+ */
12
+ import type { Hash, Address, TransactionReceipt } from "viem";
13
+ import type { GrantFile, PermissionGrantTypedData, GenericTypedData } from "./permissions";
14
+ import type { RuntimeGrantFile } from "./runtimePermissions";
15
+ import type { Contract, Fn } from "../generated/event-types";
16
+ /**
17
+ * Represents the response from storing grant files via relayer.
18
+ *
19
+ * @remarks
20
+ * Contains storage location, metadata, and error information for
21
+ * grant file upload operations.
5
22
  *
6
23
  * @category Advanced
7
24
  */
@@ -23,7 +40,11 @@ export interface RelayerStorageResponse {
23
40
  };
24
41
  }
25
42
  /**
26
- * Response from the relayer service for transaction submission
43
+ * Represents the response from submitting transactions via relayer.
44
+ *
45
+ * @remarks
46
+ * Contains transaction hash, status, and metadata for gasless
47
+ * transaction submissions.
27
48
  *
28
49
  * @category Advanced
29
50
  */
@@ -47,7 +68,11 @@ export interface RelayerTransactionResponse {
47
68
  };
48
69
  }
49
70
  /**
50
- * Parameters for storing a grant file via relayer
71
+ * Specifies parameters for storing grant files via relayer.
72
+ *
73
+ * @remarks
74
+ * Includes the grant file and optional storage configuration
75
+ * such as encryption and pinning duration.
51
76
  *
52
77
  * @category Advanced
53
78
  */
@@ -65,7 +90,11 @@ export interface RelayerStoreParams {
65
90
  };
66
91
  }
67
92
  /**
68
- * Parameters for submitting a transaction via relayer
93
+ * Specifies parameters for submitting gasless transactions.
94
+ *
95
+ * @remarks
96
+ * Contains signed typed data and transaction configuration options
97
+ * for relayer submission.
69
98
  *
70
99
  * @category Advanced
71
100
  */
@@ -85,7 +114,11 @@ export interface RelayerSubmitParams {
85
114
  };
86
115
  }
87
116
  /**
88
- * Relayer service status
117
+ * Represents the current status and capabilities of a relayer service.
118
+ *
119
+ * @remarks
120
+ * Provides information about supported chains, rate limits, and
121
+ * current operational status for monitoring and decision-making.
89
122
  *
90
123
  * @category Advanced
91
124
  */
@@ -118,29 +151,11 @@ export interface RelayerStatus {
118
151
  };
119
152
  }
120
153
  /**
121
- * Relayer configuration
154
+ * Configures behavior for relayer requests.
122
155
  *
123
- * @category Advanced
124
- */
125
- export interface RelayerConfig {
126
- /** Relayer service URL */
127
- url: string;
128
- /** API key for authentication */
129
- apiKey?: string;
130
- /** Timeout for requests in milliseconds */
131
- timeout?: number;
132
- /** Retry configuration */
133
- retry?: {
134
- /** Number of retry attempts */
135
- attempts: number;
136
- /** Delay between retries in milliseconds */
137
- delay: number;
138
- };
139
- /** Whether to use HTTPS */
140
- useHttps?: boolean;
141
- }
142
- /**
143
- * Relayer request options
156
+ * @remarks
157
+ * Controls timeout, retry logic, headers, and priority for
158
+ * relayer operation requests.
144
159
  *
145
160
  * @category Advanced
146
161
  */
@@ -155,7 +170,11 @@ export interface RelayerRequestOptions {
155
170
  priority?: "low" | "medium" | "high";
156
171
  }
157
172
  /**
158
- * Relayer error response
173
+ * Represents an error response from the relayer service.
174
+ *
175
+ * @remarks
176
+ * Provides structured error information including codes, messages,
177
+ * and debugging details for error handling and recovery.
159
178
  *
160
179
  * @category Advanced
161
180
  */
@@ -172,7 +191,11 @@ export interface RelayerErrorResponse {
172
191
  timestamp: number;
173
192
  }
174
193
  /**
175
- * Relayer queue information
194
+ * Provides information about the relayer's processing queue.
195
+ *
196
+ * @remarks
197
+ * Includes queue size, position, estimated processing time, and
198
+ * performance statistics for queue monitoring.
176
199
  *
177
200
  * @category Advanced
178
201
  */
@@ -194,7 +217,11 @@ export interface RelayerQueueInfo {
194
217
  };
195
218
  }
196
219
  /**
197
- * Relayer transaction status
220
+ * Tracks the status of a transaction submitted via relayer.
221
+ *
222
+ * @remarks
223
+ * Provides detailed tracking information including confirmation status,
224
+ * gas usage, and historical status checks.
198
225
  *
199
226
  * @category Advanced
200
227
  */
@@ -220,7 +247,11 @@ export interface RelayerTransactionStatus {
220
247
  }>;
221
248
  }
222
249
  /**
223
- * Relayer metrics
250
+ * Provides performance metrics for the relayer service.
251
+ *
252
+ * @remarks
253
+ * Includes transaction statistics, success rates, processing times,
254
+ * and uptime information for monitoring and optimization.
224
255
  *
225
256
  * @category Advanced
226
257
  */
@@ -248,7 +279,11 @@ export interface RelayerMetrics {
248
279
  };
249
280
  }
250
281
  /**
251
- * Relayer webhook configuration
282
+ * Configures webhook notifications for relayer events.
283
+ *
284
+ * @remarks
285
+ * Enables asynchronous notifications for transaction confirmations,
286
+ * failures, and storage completions.
252
287
  *
253
288
  * @category Advanced
254
289
  */
@@ -263,7 +298,11 @@ export interface RelayerWebhookConfig {
263
298
  active: boolean;
264
299
  }
265
300
  /**
266
- * Relayer webhook payload
301
+ * Represents a webhook event payload from the relayer.
302
+ *
303
+ * @remarks
304
+ * Contains event data, timestamp, and signature for verification
305
+ * of webhook authenticity.
267
306
  *
268
307
  * @category Advanced
269
308
  */
@@ -279,3 +318,236 @@ export interface RelayerWebhookPayload {
279
318
  /** Signature for verification */
280
319
  signature: string;
281
320
  }
321
+ /**
322
+ * Handles both EIP-712 signed operations and direct server operations through a single interface.
323
+ *
324
+ * @remarks
325
+ * This discriminated union provides type safety through TypeScript's narrowing.
326
+ * The `type` field determines which operation variant is being used.
327
+ * Signed operations require blockchain transactions, while direct operations
328
+ * handle auxiliary tasks like file storage.
329
+ *
330
+ * @category Relayer
331
+ * @see {@link https://docs.vana.org/docs/gasless-transactions | Gasless Transactions Guide}
332
+ */
333
+ export type UnifiedRelayerRequest = SignedRelayerRequest | DirectRelayerRequest | {
334
+ type: "status_check";
335
+ operationId: string;
336
+ };
337
+ /**
338
+ * Represents an EIP-712 signed operation for gasless transaction submission.
339
+ *
340
+ * @remarks
341
+ * Signed requests contain typed data and signatures that are verified
342
+ * on-chain by smart contracts. The relayer pays gas fees on behalf of users.
343
+ *
344
+ * @category Relayer
345
+ */
346
+ export interface SignedRelayerRequest {
347
+ /** Discriminator field identifying this as a signed operation */
348
+ type: "signed";
349
+ /** Operation identifier for routing (e.g., 'submitAddPermission') */
350
+ operation: SignedOperationType;
351
+ /** EIP-712 typed data structure for the operation */
352
+ typedData: GenericTypedData;
353
+ /** User's signature of the typed data */
354
+ signature: Hash;
355
+ /** Optional address for additional signer verification */
356
+ expectedUserAddress?: Address;
357
+ }
358
+ /**
359
+ * Enumerates supported EIP-712 signed operation types.
360
+ *
361
+ * @remarks
362
+ * Each operation type corresponds to a specific smart contract
363
+ * function that accepts gasless transactions.
364
+ *
365
+ * @category Relayer
366
+ */
367
+ export type SignedOperationType = "submitAddPermission" | "submitPermissionRevoke" | "submitTrustServer" | "submitAddAndTrustServer" | "submitUntrustServer" | "submitAddServerFilesAndPermissions";
368
+ /**
369
+ * Represents direct server operations that don't require blockchain signatures.
370
+ *
371
+ * @remarks
372
+ * Direct requests handle auxiliary operations like file uploads and grant storage.
373
+ * These operations may still result in blockchain transactions but don't require
374
+ * user signatures for gasless submission.
375
+ *
376
+ * @category Relayer
377
+ */
378
+ export type DirectRelayerRequest = {
379
+ type: "direct";
380
+ operation: "submitFileAddition";
381
+ params: {
382
+ url: string;
383
+ userAddress: Address;
384
+ };
385
+ } | {
386
+ type: "direct";
387
+ operation: "submitFileAdditionWithPermissions";
388
+ params: {
389
+ url: string;
390
+ userAddress: Address;
391
+ permissions: Array<{
392
+ account: Address;
393
+ key: string;
394
+ }>;
395
+ };
396
+ } | {
397
+ type: "direct";
398
+ operation: "submitFileAdditionComplete";
399
+ params: {
400
+ url: string;
401
+ userAddress: Address;
402
+ permissions: Array<{
403
+ account: Address;
404
+ key: string;
405
+ }>;
406
+ schemaId: number;
407
+ ownerAddress?: Address;
408
+ };
409
+ } | {
410
+ type: "direct";
411
+ operation: "storeGrantFile";
412
+ params: GrantFile | RuntimeGrantFile;
413
+ } | {
414
+ type: "direct";
415
+ operation: "submitRegisterGrantee";
416
+ params: {
417
+ owner: Address;
418
+ granteeAddress: Address;
419
+ publicKey: string;
420
+ };
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
+ }
439
+ /**
440
+ * Provides type-safe responses for all relayer operations.
441
+ *
442
+ * @remarks
443
+ * The discriminated union ensures proper error handling and result typing.
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.
449
+ *
450
+ * @category Relayer
451
+ */
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
+ } | {
465
+ type: "signed";
466
+ hash: Hash;
467
+ /** Optional context for client-side event parsing and enhanced responses */
468
+ context?: TransactionContext;
469
+ } | {
470
+ /** Non-transactional operations that complete immediately (e.g., IPFS uploads, file info) */
471
+ type: "direct";
472
+ /** The result data from the operation, structure depends on the specific operation */
473
+ result: unknown;
474
+ } | {
475
+ type: "error";
476
+ error: string;
477
+ };
478
+ /**
479
+ * Simplified relayer configuration.
480
+ * Can be a URL string for convenience, or a callback for full control.
481
+ *
482
+ * @category Configuration
483
+ * @example
484
+ * ```typescript
485
+ * // Option 1: Simple URL (SDK handles the transport)
486
+ * const vana = Vana({
487
+ * walletClient,
488
+ * relayer: '/api/relay'
489
+ * });
490
+ *
491
+ * // Option 2: Full control with callback
492
+ * const vana = Vana({
493
+ * walletClient,
494
+ * relayer: async (request) => {
495
+ * const response = await fetch('/api/relay', {
496
+ * method: 'POST',
497
+ * body: JSON.stringify(request)
498
+ * });
499
+ * return response.json();
500
+ * }
501
+ * });
502
+ * ```
503
+ */
504
+ export type RelayerConfig = string | ((request: UnifiedRelayerRequest) => Promise<UnifiedRelayerResponse>);
505
+ /**
506
+ * Simplified relayer callbacks interface (v2).
507
+ * A single callback handles all relayer operations.
508
+ *
509
+ * @category Configuration
510
+ * @example
511
+ * ```typescript
512
+ * const relayerCallbacks: RelayerCallbacksV2 = {
513
+ * submit: async (request) => {
514
+ * // Send to your server endpoint
515
+ * const response = await fetch('/api/relay', {
516
+ * method: 'POST',
517
+ * headers: { 'Content-Type': 'application/json' },
518
+ * body: JSON.stringify(request)
519
+ * });
520
+ * return response.json();
521
+ * }
522
+ * };
523
+ * ```
524
+ */
525
+ export interface RelayerCallbacksV2 {
526
+ /**
527
+ * Submits any relayer operation to the server.
528
+ *
529
+ * @remarks
530
+ * This single callback handles all operations:
531
+ * - EIP-712 signed operations (permissions, server trust, etc.)
532
+ * - Direct operations (file additions, grant storage)
533
+ *
534
+ * On your server, pass the entire request object to the SDK's
535
+ * `handleRelayerOperation` helper function.
536
+ *
537
+ * @param request - The unified request object.
538
+ * Check `type` field to determine operation variant.
539
+ * @returns Promise resolving to operation-specific response
540
+ *
541
+ * @example
542
+ * ```typescript
543
+ * async submit(request) {
544
+ * const response = await fetch('/api/relay', {
545
+ * method: 'POST',
546
+ * body: JSON.stringify(request)
547
+ * });
548
+ * return response.json();
549
+ * }
550
+ * ```
551
+ */
552
+ submit: (request: UnifiedRelayerRequest) => Promise<UnifiedRelayerResponse>;
553
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var runtimePermissions_exports = {};
16
+ module.exports = __toCommonJS(runtimePermissions_exports);
17
+ //# sourceMappingURL=runtimePermissions.cjs.map