@opendatalabs/vana-sdk 2.3.0 → 3.0.1-canary.b068ac6

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 (631) hide show
  1. package/README.md +76 -92
  2. package/dist/auth/errors.cjs +54 -0
  3. package/dist/auth/errors.cjs.map +1 -0
  4. package/dist/auth/errors.d.ts +26 -0
  5. package/dist/auth/errors.js +28 -0
  6. package/dist/auth/errors.js.map +1 -0
  7. package/dist/auth/pkce.cjs +100 -0
  8. package/dist/auth/pkce.cjs.map +1 -0
  9. package/dist/auth/pkce.d.ts +55 -0
  10. package/dist/auth/pkce.js +71 -0
  11. package/dist/auth/pkce.js.map +1 -0
  12. package/dist/auth/token-store.cjs +59 -0
  13. package/dist/auth/token-store.cjs.map +1 -0
  14. package/dist/auth/token-store.d.ts +61 -0
  15. package/dist/auth/token-store.js +35 -0
  16. package/dist/auth/token-store.js.map +1 -0
  17. package/dist/auth/web3-signed-builder.cjs +70 -0
  18. package/dist/auth/web3-signed-builder.cjs.map +1 -0
  19. package/dist/auth/web3-signed-builder.d.ts +47 -0
  20. package/dist/auth/web3-signed-builder.js +45 -0
  21. package/dist/auth/web3-signed-builder.js.map +1 -0
  22. package/dist/auth/web3-signed.cjs +150 -0
  23. package/dist/auth/web3-signed.cjs.map +1 -0
  24. package/dist/auth/web3-signed.d.ts +59 -0
  25. package/dist/auth/web3-signed.js +129 -0
  26. package/dist/auth/web3-signed.js.map +1 -0
  27. package/dist/chains/definitions.cjs +2 -6
  28. package/dist/chains/definitions.cjs.map +1 -1
  29. package/dist/chains/definitions.d.ts +1 -7
  30. package/dist/chains/definitions.js +2 -6
  31. package/dist/chains/definitions.js.map +1 -1
  32. package/dist/config/chains.d.ts +18 -0
  33. package/dist/config/contracts.config.cjs +7 -95
  34. package/dist/config/contracts.config.cjs.map +1 -1
  35. package/dist/config/contracts.config.d.ts +0 -54
  36. package/dist/config/contracts.config.js +6 -93
  37. package/dist/config/contracts.config.js.map +1 -1
  38. package/dist/config/default-services.cjs +0 -10
  39. package/dist/config/default-services.cjs.map +1 -1
  40. package/dist/config/default-services.d.ts +1 -20
  41. package/dist/config/default-services.js +0 -9
  42. package/dist/config/default-services.js.map +1 -1
  43. package/dist/crypto/ecies/interface.cjs +2 -0
  44. package/dist/crypto/ecies/interface.cjs.map +1 -1
  45. package/dist/crypto/ecies/interface.js +2 -0
  46. package/dist/crypto/ecies/interface.js.map +1 -1
  47. package/dist/crypto/ecies/node.cjs +6 -6
  48. package/dist/crypto/ecies/node.cjs.map +1 -1
  49. package/dist/crypto/ecies/node.js +1 -1
  50. package/dist/crypto/ecies/node.js.map +1 -1
  51. package/dist/crypto/envelope/openpgp.cjs +59 -0
  52. package/dist/crypto/envelope/openpgp.cjs.map +1 -0
  53. package/dist/crypto/envelope/openpgp.d.ts +28 -0
  54. package/dist/crypto/envelope/openpgp.js +24 -0
  55. package/dist/crypto/envelope/openpgp.js.map +1 -0
  56. package/dist/crypto/keys/derive.cjs +65 -0
  57. package/dist/crypto/keys/derive.cjs.map +1 -0
  58. package/dist/crypto/keys/derive.d.ts +45 -0
  59. package/dist/crypto/keys/derive.js +38 -0
  60. package/dist/crypto/keys/derive.js.map +1 -0
  61. package/dist/errors.cjs +10 -0
  62. package/dist/errors.cjs.map +1 -1
  63. package/dist/errors.js +10 -0
  64. package/dist/errors.js.map +1 -1
  65. package/dist/generated/abi/index.cjs +2 -37
  66. package/dist/generated/abi/index.cjs.map +1 -1
  67. package/dist/generated/abi/index.d.ts +2683 -9296
  68. package/dist/generated/abi/index.js +2 -29
  69. package/dist/generated/abi/index.js.map +1 -1
  70. package/dist/generated/addresses.cjs +5 -107
  71. package/dist/generated/addresses.cjs.map +1 -1
  72. package/dist/generated/addresses.d.ts +5 -99
  73. package/dist/generated/addresses.js +5 -105
  74. package/dist/generated/addresses.js.map +1 -1
  75. package/dist/index.browser.d.ts +24 -140
  76. package/dist/index.browser.js +32258 -114
  77. package/dist/index.browser.js.map +7 -1
  78. package/dist/index.node.cjs +32980 -160
  79. package/dist/index.node.cjs.map +7 -1
  80. package/dist/index.node.d.ts +23 -210
  81. package/dist/index.node.js +32884 -133
  82. package/dist/index.node.js.map +7 -1
  83. package/dist/platform/node.cjs +2 -2
  84. package/dist/platform/node.cjs.map +1 -1
  85. package/dist/platform/node.js +1 -1
  86. package/dist/platform/node.js.map +1 -1
  87. package/dist/protocol/data-file.cjs +56 -0
  88. package/dist/protocol/data-file.cjs.map +1 -0
  89. package/dist/protocol/data-file.d.ts +20 -0
  90. package/dist/protocol/data-file.js +30 -0
  91. package/dist/protocol/data-file.js.map +1 -0
  92. package/dist/protocol/eip712.cjs +123 -0
  93. package/dist/protocol/eip712.cjs.map +1 -0
  94. package/dist/protocol/eip712.d.ts +117 -0
  95. package/dist/protocol/eip712.js +90 -0
  96. package/dist/protocol/eip712.js.map +1 -0
  97. package/dist/protocol/gateway.cjs +226 -0
  98. package/dist/protocol/gateway.cjs.map +1 -0
  99. package/dist/protocol/gateway.d.ts +120 -0
  100. package/dist/protocol/gateway.js +202 -0
  101. package/dist/protocol/gateway.js.map +1 -0
  102. package/dist/protocol/grants.cjs +146 -0
  103. package/dist/protocol/grants.cjs.map +1 -0
  104. package/dist/protocol/grants.d.ts +31 -0
  105. package/dist/protocol/grants.js +123 -0
  106. package/dist/protocol/grants.js.map +1 -0
  107. package/dist/protocol/scopes.cjs +78 -0
  108. package/dist/protocol/scopes.cjs.map +1 -0
  109. package/dist/protocol/scopes.d.ts +13 -0
  110. package/dist/protocol/scopes.js +50 -0
  111. package/dist/protocol/scopes.js.map +1 -0
  112. package/dist/{types/atomicStore.cjs → storage/default.cjs} +9 -8
  113. package/dist/storage/default.cjs.map +1 -0
  114. package/dist/storage/default.d.ts +4 -0
  115. package/dist/storage/default.js +8 -0
  116. package/dist/storage/default.js.map +1 -0
  117. package/dist/storage/index.cjs +11 -2
  118. package/dist/storage/index.cjs.map +1 -1
  119. package/dist/storage/index.d.ts +9 -0
  120. package/dist/storage/index.js +7 -1
  121. package/dist/storage/index.js.map +1 -1
  122. package/dist/storage/providers/callback-storage.cjs +1 -0
  123. package/dist/storage/providers/callback-storage.cjs.map +1 -1
  124. package/dist/storage/providers/callback-storage.js +1 -0
  125. package/dist/storage/providers/callback-storage.js.map +1 -1
  126. package/dist/storage/providers/dropbox.cjs +1 -0
  127. package/dist/storage/providers/dropbox.cjs.map +1 -1
  128. package/dist/storage/providers/dropbox.js +1 -0
  129. package/dist/storage/providers/dropbox.js.map +1 -1
  130. package/dist/storage/providers/google-drive.cjs +1 -0
  131. package/dist/storage/providers/google-drive.cjs.map +1 -1
  132. package/dist/storage/providers/google-drive.js +1 -0
  133. package/dist/storage/providers/google-drive.js.map +1 -1
  134. package/dist/storage/providers/ipfs.cjs +1 -0
  135. package/dist/storage/providers/ipfs.cjs.map +1 -1
  136. package/dist/storage/providers/ipfs.js +1 -0
  137. package/dist/storage/providers/ipfs.js.map +1 -1
  138. package/dist/storage/providers/pinata.cjs +1 -0
  139. package/dist/storage/providers/pinata.cjs.map +1 -1
  140. package/dist/storage/providers/pinata.js +1 -0
  141. package/dist/storage/providers/pinata.js.map +1 -1
  142. package/dist/storage/providers/r2.cjs +376 -0
  143. package/dist/storage/providers/r2.cjs.map +1 -0
  144. package/dist/storage/providers/r2.d.ts +91 -0
  145. package/dist/storage/providers/r2.js +354 -0
  146. package/dist/storage/providers/r2.js.map +1 -0
  147. package/dist/storage/providers/vana-storage.cjs +251 -0
  148. package/dist/storage/providers/vana-storage.cjs.map +1 -0
  149. package/dist/storage/providers/vana-storage.d.ts +100 -0
  150. package/dist/storage/providers/vana-storage.js +231 -0
  151. package/dist/storage/providers/vana-storage.js.map +1 -0
  152. package/dist/types/config.cjs +0 -34
  153. package/dist/types/config.cjs.map +1 -1
  154. package/dist/types/config.d.ts +1 -607
  155. package/dist/types/config.js +0 -22
  156. package/dist/types/config.js.map +1 -1
  157. package/dist/types/contracts.cjs.map +1 -1
  158. package/dist/types/contracts.d.ts +1 -1
  159. package/dist/types/index.cjs +2 -33
  160. package/dist/types/index.cjs.map +1 -1
  161. package/dist/types/index.d.ts +2 -33
  162. package/dist/types/index.js +1 -35
  163. package/dist/types/index.js.map +1 -1
  164. package/dist/types/ps-errors.cjs +91 -0
  165. package/dist/types/ps-errors.cjs.map +1 -0
  166. package/dist/types/ps-errors.d.ts +26 -0
  167. package/dist/types/ps-errors.js +66 -0
  168. package/dist/types/ps-errors.js.map +1 -0
  169. package/dist/types.cjs.map +1 -1
  170. package/dist/types.d.ts +0 -29
  171. package/dist/types.js.map +1 -1
  172. package/package.json +8 -25
  173. package/dist/client/enhancedResponse.cjs +0 -164
  174. package/dist/client/enhancedResponse.cjs.map +0 -1
  175. package/dist/client/enhancedResponse.d.ts +0 -120
  176. package/dist/client/enhancedResponse.js +0 -138
  177. package/dist/client/enhancedResponse.js.map +0 -1
  178. package/dist/controllers/__tests__/data-consistency-integration.test.d.ts +0 -7
  179. package/dist/controllers/base.cjs +0 -116
  180. package/dist/controllers/base.cjs.map +0 -1
  181. package/dist/controllers/base.d.ts +0 -94
  182. package/dist/controllers/base.js +0 -92
  183. package/dist/controllers/base.js.map +0 -1
  184. package/dist/controllers/data.cjs +0 -2633
  185. package/dist/controllers/data.cjs.map +0 -1
  186. package/dist/controllers/data.d.ts +0 -1067
  187. package/dist/controllers/data.js +0 -2626
  188. package/dist/controllers/data.js.map +0 -1
  189. package/dist/controllers/operations.cjs +0 -430
  190. package/dist/controllers/operations.cjs.map +0 -1
  191. package/dist/controllers/operations.d.ts +0 -229
  192. package/dist/controllers/operations.js +0 -406
  193. package/dist/controllers/operations.js.map +0 -1
  194. package/dist/controllers/permissions.cjs +0 -4368
  195. package/dist/controllers/permissions.cjs.map +0 -1
  196. package/dist/controllers/permissions.d.ts +0 -1411
  197. package/dist/controllers/permissions.js +0 -4344
  198. package/dist/controllers/permissions.js.map +0 -1
  199. package/dist/controllers/protocol.cjs +0 -183
  200. package/dist/controllers/protocol.cjs.map +0 -1
  201. package/dist/controllers/protocol.d.ts +0 -138
  202. package/dist/controllers/protocol.js +0 -163
  203. package/dist/controllers/protocol.js.map +0 -1
  204. package/dist/controllers/schemas.cjs +0 -678
  205. package/dist/controllers/schemas.cjs.map +0 -1
  206. package/dist/controllers/schemas.d.ts +0 -293
  207. package/dist/controllers/schemas.js +0 -654
  208. package/dist/controllers/schemas.js.map +0 -1
  209. package/dist/controllers/server.cjs +0 -643
  210. package/dist/controllers/server.cjs.map +0 -1
  211. package/dist/controllers/server.d.ts +0 -322
  212. package/dist/controllers/server.js +0 -624
  213. package/dist/controllers/server.js.map +0 -1
  214. package/dist/controllers/staking.cjs +0 -626
  215. package/dist/controllers/staking.cjs.map +0 -1
  216. package/dist/controllers/staking.d.ts +0 -457
  217. package/dist/controllers/staking.js +0 -602
  218. package/dist/controllers/staking.js.map +0 -1
  219. package/dist/core/__tests__/pollingManager.test.d.ts +0 -4
  220. package/dist/core/apiClient.cjs +0 -378
  221. package/dist/core/apiClient.cjs.map +0 -1
  222. package/dist/core/apiClient.d.ts +0 -286
  223. package/dist/core/apiClient.js +0 -359
  224. package/dist/core/apiClient.js.map +0 -1
  225. package/dist/core/generics.cjs +0 -417
  226. package/dist/core/generics.cjs.map +0 -1
  227. package/dist/core/generics.d.ts +0 -205
  228. package/dist/core/generics.js +0 -386
  229. package/dist/core/generics.js.map +0 -1
  230. package/dist/core/health.cjs +0 -289
  231. package/dist/core/health.cjs.map +0 -1
  232. package/dist/core/health.d.ts +0 -143
  233. package/dist/core/health.js +0 -265
  234. package/dist/core/health.js.map +0 -1
  235. package/dist/core/inMemoryNonceManager.cjs +0 -138
  236. package/dist/core/inMemoryNonceManager.cjs.map +0 -1
  237. package/dist/core/inMemoryNonceManager.d.ts +0 -69
  238. package/dist/core/inMemoryNonceManager.js +0 -114
  239. package/dist/core/inMemoryNonceManager.js.map +0 -1
  240. package/dist/core/nonceManager.cjs +0 -304
  241. package/dist/core/nonceManager.cjs.map +0 -1
  242. package/dist/core/nonceManager.d.ts +0 -116
  243. package/dist/core/nonceManager.js +0 -280
  244. package/dist/core/nonceManager.js.map +0 -1
  245. package/dist/core/pollingManager.cjs +0 -292
  246. package/dist/core/pollingManager.cjs.map +0 -1
  247. package/dist/core/pollingManager.d.ts +0 -120
  248. package/dist/core/pollingManager.js +0 -268
  249. package/dist/core/pollingManager.js.map +0 -1
  250. package/dist/core.cjs +0 -781
  251. package/dist/core.cjs.map +0 -1
  252. package/dist/core.d.ts +0 -496
  253. package/dist/core.js +0 -756
  254. package/dist/core.js.map +0 -1
  255. package/dist/diagnostics.cjs +0 -37
  256. package/dist/diagnostics.cjs.map +0 -1
  257. package/dist/diagnostics.d.ts +0 -24
  258. package/dist/diagnostics.js +0 -13
  259. package/dist/diagnostics.js.map +0 -1
  260. package/dist/generated/abi/DLPPerformanceImplementation.cjs +0 -1202
  261. package/dist/generated/abi/DLPPerformanceImplementation.cjs.map +0 -1
  262. package/dist/generated/abi/DLPPerformanceImplementation.d.ts +0 -914
  263. package/dist/generated/abi/DLPPerformanceImplementation.js +0 -1178
  264. package/dist/generated/abi/DLPPerformanceImplementation.js.map +0 -1
  265. package/dist/generated/abi/DLPRewardDeployerImplementation.cjs +0 -1112
  266. package/dist/generated/abi/DLPRewardDeployerImplementation.cjs.map +0 -1
  267. package/dist/generated/abi/DLPRewardDeployerImplementation.d.ts +0 -840
  268. package/dist/generated/abi/DLPRewardDeployerImplementation.js +0 -1088
  269. package/dist/generated/abi/DLPRewardDeployerImplementation.js.map +0 -1
  270. package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.cjs +0 -612
  271. package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.cjs.map +0 -1
  272. package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.d.ts +0 -451
  273. package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.js +0 -588
  274. package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.js.map +0 -1
  275. package/dist/generated/abi/DLPRewardSwapImplementation.cjs +0 -939
  276. package/dist/generated/abi/DLPRewardSwapImplementation.cjs.map +0 -1
  277. package/dist/generated/abi/DLPRewardSwapImplementation.d.ts +0 -705
  278. package/dist/generated/abi/DLPRewardSwapImplementation.js +0 -915
  279. package/dist/generated/abi/DLPRewardSwapImplementation.js.map +0 -1
  280. package/dist/generated/abi/DLPRootImplementation.cjs +0 -1644
  281. package/dist/generated/abi/DLPRootImplementation.cjs.map +0 -1
  282. package/dist/generated/abi/DLPRootImplementation.d.ts +0 -1246
  283. package/dist/generated/abi/DLPRootImplementation.js +0 -1620
  284. package/dist/generated/abi/DLPRootImplementation.js.map +0 -1
  285. package/dist/generated/abi/DataLiquidityPoolImplementation.cjs +0 -985
  286. package/dist/generated/abi/DataLiquidityPoolImplementation.cjs.map +0 -1
  287. package/dist/generated/abi/DataLiquidityPoolImplementation.d.ts +0 -735
  288. package/dist/generated/abi/DataLiquidityPoolImplementation.js +0 -961
  289. package/dist/generated/abi/DataLiquidityPoolImplementation.js.map +0 -1
  290. package/dist/generated/abi/SwapHelperImplementation.cjs +0 -976
  291. package/dist/generated/abi/SwapHelperImplementation.cjs.map +0 -1
  292. package/dist/generated/abi/SwapHelperImplementation.d.ts +0 -728
  293. package/dist/generated/abi/SwapHelperImplementation.js +0 -952
  294. package/dist/generated/abi/SwapHelperImplementation.js.map +0 -1
  295. package/dist/generated/abi/TeePoolImplementation.cjs +0 -1313
  296. package/dist/generated/abi/TeePoolImplementation.cjs.map +0 -1
  297. package/dist/generated/abi/TeePoolImplementation.d.ts +0 -992
  298. package/dist/generated/abi/TeePoolImplementation.js +0 -1289
  299. package/dist/generated/abi/TeePoolImplementation.js.map +0 -1
  300. package/dist/generated/event-types.cjs +0 -17
  301. package/dist/generated/event-types.cjs.map +0 -1
  302. package/dist/generated/event-types.d.ts +0 -816
  303. package/dist/generated/event-types.js +0 -1
  304. package/dist/generated/event-types.js.map +0 -1
  305. package/dist/generated/eventRegistry.cjs +0 -4512
  306. package/dist/generated/eventRegistry.cjs.map +0 -1
  307. package/dist/generated/eventRegistry.d.ts +0 -14
  308. package/dist/generated/eventRegistry.js +0 -4487
  309. package/dist/generated/eventRegistry.js.map +0 -1
  310. package/dist/generated/server/server-exports.cjs +0 -45
  311. package/dist/generated/server/server-exports.cjs.map +0 -1
  312. package/dist/generated/server/server-exports.d.ts +0 -36
  313. package/dist/generated/server/server-exports.js +0 -19
  314. package/dist/generated/server/server-exports.js.map +0 -1
  315. package/dist/generated/server/server.cjs +0 -17
  316. package/dist/generated/server/server.cjs.map +0 -1
  317. package/dist/generated/server/server.d.ts +0 -907
  318. package/dist/generated/server/server.js +0 -1
  319. package/dist/generated/server/server.js.map +0 -1
  320. package/dist/generated/subgraph.cjs +0 -1440
  321. package/dist/generated/subgraph.cjs.map +0 -1
  322. package/dist/generated/subgraph.d.ts +0 -6113
  323. package/dist/generated/subgraph.js +0 -1404
  324. package/dist/generated/subgraph.js.map +0 -1
  325. package/dist/lib/__tests__/redisAtomicStore.test.d.ts +0 -1
  326. package/dist/lib/redisAtomicStore.cjs +0 -201
  327. package/dist/lib/redisAtomicStore.cjs.map +0 -1
  328. package/dist/lib/redisAtomicStore.d.ts +0 -120
  329. package/dist/lib/redisAtomicStore.js +0 -177
  330. package/dist/lib/redisAtomicStore.js.map +0 -1
  331. package/dist/server/relayerHandler.cjs +0 -452
  332. package/dist/server/relayerHandler.cjs.map +0 -1
  333. package/dist/server/relayerHandler.d.ts +0 -69
  334. package/dist/server/relayerHandler.js +0 -428
  335. package/dist/server/relayerHandler.js.map +0 -1
  336. package/dist/tests/abi.test.d.ts +0 -1
  337. package/dist/tests/chains-definitions.test.d.ts +0 -1
  338. package/dist/tests/core-encryption.test.d.ts +0 -1
  339. package/dist/tests/core-extended.test.d.ts +0 -1
  340. package/dist/tests/core-generics-coverage.test.d.ts +0 -1
  341. package/dist/tests/coverage-boost.test.d.ts +0 -1
  342. package/dist/tests/crypto-cross-platform-compatibility.test.d.ts +0 -1
  343. package/dist/tests/data-addfile-permissions-schema.test.d.ts +0 -1
  344. package/dist/tests/data-additional-methods.test.d.ts +0 -1
  345. package/dist/tests/data-controller-edge-cases.test.d.ts +0 -1
  346. package/dist/tests/data-ipfs-gateways.test.d.ts +0 -1
  347. package/dist/tests/data-relayer.test.d.ts +0 -1
  348. package/dist/tests/data-schema-validation.test.d.ts +0 -1
  349. package/dist/tests/data-simple-methods.test.d.ts +0 -1
  350. package/dist/tests/data-upload-owner-validation.test.d.ts +0 -1
  351. package/dist/tests/data.test.d.ts +0 -1
  352. package/dist/tests/demo-integration.test.d.ts +0 -1
  353. package/dist/tests/demo-trusted-server-integration.test.d.ts +0 -1
  354. package/dist/tests/download-relayer.test.d.ts +0 -1
  355. package/dist/tests/dual-mode-permissions.test.d.ts +0 -1
  356. package/dist/tests/dual-mode-trusted-servers.test.d.ts +0 -1
  357. package/dist/tests/encryption-correct-implementation.test.d.ts +0 -1
  358. package/dist/tests/encryption-coverage.test.d.ts +0 -1
  359. package/dist/tests/encryption-edge-cases.test.d.ts +0 -1
  360. package/dist/tests/encryption-utils-updated.test.d.ts +0 -1
  361. package/dist/tests/errors-coverage.test.d.ts +0 -1
  362. package/dist/tests/factories/mockFactory.d.ts +0 -316
  363. package/dist/tests/fakes/FakeStorageManager.d.ts +0 -200
  364. package/dist/tests/fakes/FakeStorageManager.test.d.ts +0 -1
  365. package/dist/tests/fakes/FakeWaitForTransactionEvents.d.ts +0 -170
  366. package/dist/tests/fakes/FakeWaitForTransactionEvents.test.d.ts +0 -1
  367. package/dist/tests/fakes/fake-pgp-port.d.ts +0 -13
  368. package/dist/tests/grantValidation-edge-cases.test.d.ts +0 -1
  369. package/dist/tests/grantValidation-unreachable-branch.test.d.ts +0 -1
  370. package/dist/tests/helper-methods.test.d.ts +0 -1
  371. package/dist/tests/helpers/typedMocks.d.ts +0 -64
  372. package/dist/tests/index-browser.test.d.ts +0 -1
  373. package/dist/tests/index-node.test.d.ts +0 -1
  374. package/dist/tests/index.test.d.ts +0 -1
  375. package/dist/tests/mocks/platformAdapter.d.ts +0 -12
  376. package/dist/tests/new-permissions-methods.test.d.ts +0 -1
  377. package/dist/tests/no-buffer-browser.test.d.ts +0 -1
  378. package/dist/tests/permissions-grantee.test.d.ts +0 -1
  379. package/dist/tests/permissions-revoke-relayer.test.d.ts +0 -1
  380. package/dist/tests/permissions-schema-validation.test.d.ts +0 -1
  381. package/dist/tests/permissions-server-files.test.d.ts +0 -1
  382. package/dist/tests/permissions-transaction-options.test.d.ts +0 -1
  383. package/dist/tests/permissions-trust-servers.test.d.ts +0 -1
  384. package/dist/tests/permissions.test.d.ts +0 -1
  385. package/dist/tests/personal.test.d.ts +0 -1
  386. package/dist/tests/platform-browser.test.d.ts +0 -1
  387. package/dist/tests/platform-crypto-expanded.test.d.ts +0 -1
  388. package/dist/tests/platform-crypto.test.d.ts +0 -1
  389. package/dist/tests/platform-index.test.d.ts +0 -1
  390. package/dist/tests/platform-node.test.d.ts +0 -1
  391. package/dist/tests/platform-shared-utils.test.d.ts +0 -1
  392. package/dist/tests/platform-updated.test.d.ts +0 -1
  393. package/dist/tests/protocol-additional-methods.test.d.ts +0 -1
  394. package/dist/tests/protocol.test.d.ts +0 -1
  395. package/dist/tests/read-only-mode.test.d.ts +0 -1
  396. package/dist/tests/relayer-integration.test.d.ts +0 -1
  397. package/dist/tests/relayer-unified.test.d.ts +0 -1
  398. package/dist/tests/schemas.test.d.ts +0 -1
  399. package/dist/tests/server-relayer-handler.test.d.ts +0 -1
  400. package/dist/tests/signatureFormatter.test.d.ts +0 -1
  401. package/dist/tests/staking.test.d.ts +0 -1
  402. package/dist/tests/trusted-server-queries.test.d.ts +0 -1
  403. package/dist/tests/typedDataConverter.test.d.ts +0 -1
  404. package/dist/tests/types-contracts.test.d.ts +0 -1
  405. package/dist/tests/types-data.test.d.ts +0 -1
  406. package/dist/tests/types-external-apis.test.d.ts +0 -1
  407. package/dist/tests/types-generics.test.d.ts +0 -1
  408. package/dist/tests/types-permissions.test.d.ts +0 -1
  409. package/dist/tests/types-upload-params.test.d.ts +0 -1
  410. package/dist/tests/types.test.d.ts +0 -1
  411. package/dist/tests/utils-formatters.test.d.ts +0 -1
  412. package/dist/tests/utils-grantFiles-edge-cases.test.d.ts +0 -1
  413. package/dist/tests/utils-grantFiles-validation.test.d.ts +0 -1
  414. package/dist/tests/utils-grantFiles.test.d.ts +0 -1
  415. package/dist/tests/utils-grantValidation-consolidated.test.d.ts +0 -1
  416. package/dist/tests/utils-grants.test.d.ts +0 -1
  417. package/dist/tests/utils-ipfs-additional.test.d.ts +0 -1
  418. package/dist/tests/utils-ipfs.test.d.ts +0 -4
  419. package/dist/tests/utils-schemaValidation.test.d.ts +0 -1
  420. package/dist/tests/vana.test.d.ts +0 -1
  421. package/dist/tests/wallet-crypto-compatibility.test.d.ts +0 -1
  422. package/dist/types/atomicStore.cjs.map +0 -1
  423. package/dist/types/atomicStore.d.ts +0 -236
  424. package/dist/types/atomicStore.js +0 -7
  425. package/dist/types/atomicStore.js.map +0 -1
  426. package/dist/types/blockchain.cjs +0 -17
  427. package/dist/types/blockchain.cjs.map +0 -1
  428. package/dist/types/blockchain.d.ts +0 -85
  429. package/dist/types/blockchain.js +0 -1
  430. package/dist/types/blockchain.js.map +0 -1
  431. package/dist/types/controller-context.cjs +0 -17
  432. package/dist/types/controller-context.cjs.map +0 -1
  433. package/dist/types/controller-context.d.ts +0 -68
  434. package/dist/types/controller-context.js +0 -1
  435. package/dist/types/controller-context.js.map +0 -1
  436. package/dist/types/data.cjs +0 -17
  437. package/dist/types/data.cjs.map +0 -1
  438. package/dist/types/data.d.ts +0 -763
  439. package/dist/types/data.js +0 -1
  440. package/dist/types/data.js.map +0 -1
  441. package/dist/types/external-apis.cjs +0 -61
  442. package/dist/types/external-apis.cjs.map +0 -1
  443. package/dist/types/external-apis.d.ts +0 -184
  444. package/dist/types/external-apis.js +0 -34
  445. package/dist/types/external-apis.js.map +0 -1
  446. package/dist/types/generics.cjs +0 -17
  447. package/dist/types/generics.cjs.map +0 -1
  448. package/dist/types/generics.d.ts +0 -518
  449. package/dist/types/generics.js +0 -1
  450. package/dist/types/generics.js.map +0 -1
  451. package/dist/types/operationStore.cjs +0 -17
  452. package/dist/types/operationStore.cjs.map +0 -1
  453. package/dist/types/operationStore.d.ts +0 -171
  454. package/dist/types/operationStore.js +0 -1
  455. package/dist/types/operationStore.js.map +0 -1
  456. package/dist/types/operations.cjs +0 -53
  457. package/dist/types/operations.cjs.map +0 -1
  458. package/dist/types/operations.d.ts +0 -204
  459. package/dist/types/operations.js +0 -26
  460. package/dist/types/operations.js.map +0 -1
  461. package/dist/types/options.cjs +0 -17
  462. package/dist/types/options.cjs.map +0 -1
  463. package/dist/types/options.d.ts +0 -308
  464. package/dist/types/options.js +0 -1
  465. package/dist/types/options.js.map +0 -1
  466. package/dist/types/permissions.cjs +0 -17
  467. package/dist/types/permissions.cjs.map +0 -1
  468. package/dist/types/permissions.d.ts +0 -955
  469. package/dist/types/permissions.js +0 -1
  470. package/dist/types/permissions.js.map +0 -1
  471. package/dist/types/personal.cjs +0 -17
  472. package/dist/types/personal.cjs.map +0 -1
  473. package/dist/types/personal.d.ts +0 -174
  474. package/dist/types/personal.js +0 -1
  475. package/dist/types/personal.js.map +0 -1
  476. package/dist/types/relayer.cjs +0 -17
  477. package/dist/types/relayer.cjs.map +0 -1
  478. package/dist/types/relayer.d.ts +0 -552
  479. package/dist/types/relayer.js +0 -1
  480. package/dist/types/relayer.js.map +0 -1
  481. package/dist/types/transactionResults.cjs +0 -17
  482. package/dist/types/transactionResults.cjs.map +0 -1
  483. package/dist/types/transactionResults.d.ts +0 -193
  484. package/dist/types/transactionResults.js +0 -1
  485. package/dist/types/transactionResults.js.map +0 -1
  486. package/dist/types/utils.cjs +0 -17
  487. package/dist/types/utils.cjs.map +0 -1
  488. package/dist/types/utils.d.ts +0 -771
  489. package/dist/types/utils.js +0 -1
  490. package/dist/types/utils.js.map +0 -1
  491. package/dist/utils/__tests__/chainQuery.test.d.ts +0 -1
  492. package/dist/utils/__tests__/parseTransaction.test.d.ts +0 -1
  493. package/dist/utils/__tests__/pojo-serialization.test.d.ts +0 -1
  494. package/dist/utils/__tests__/signatureCache.test.d.ts +0 -1
  495. package/dist/utils/__tests__/subgraphConsistency.test.d.ts +0 -4
  496. package/dist/utils/__tests__/subgraphPagination.test.d.ts +0 -4
  497. package/dist/utils/__tests__/transaction-edge-cases.test.d.ts +0 -1
  498. package/dist/utils/__tests__/transactionHelpers.test.d.ts +0 -1
  499. package/dist/utils/__tests__/urlResolver.test.d.ts +0 -4
  500. package/dist/utils/blockchain/registry.cjs +0 -81
  501. package/dist/utils/blockchain/registry.cjs.map +0 -1
  502. package/dist/utils/blockchain/registry.d.ts +0 -32
  503. package/dist/utils/blockchain/registry.js +0 -56
  504. package/dist/utils/blockchain/registry.js.map +0 -1
  505. package/dist/utils/blockchain/registry.test.d.ts +0 -1
  506. package/dist/utils/chainQuery.cjs +0 -107
  507. package/dist/utils/chainQuery.cjs.map +0 -1
  508. package/dist/utils/chainQuery.d.ts +0 -31
  509. package/dist/utils/chainQuery.js +0 -82
  510. package/dist/utils/chainQuery.js.map +0 -1
  511. package/dist/utils/download.cjs +0 -69
  512. package/dist/utils/download.cjs.map +0 -1
  513. package/dist/utils/download.d.ts +0 -40
  514. package/dist/utils/download.js +0 -45
  515. package/dist/utils/download.js.map +0 -1
  516. package/dist/utils/encryption.cjs +0 -176
  517. package/dist/utils/encryption.cjs.map +0 -1
  518. package/dist/utils/encryption.d.ts +0 -271
  519. package/dist/utils/encryption.js +0 -142
  520. package/dist/utils/encryption.js.map +0 -1
  521. package/dist/utils/formatters.cjs +0 -55
  522. package/dist/utils/formatters.cjs.map +0 -1
  523. package/dist/utils/formatters.d.ts +0 -118
  524. package/dist/utils/formatters.js +0 -28
  525. package/dist/utils/formatters.js.map +0 -1
  526. package/dist/utils/grantFiles.cjs +0 -181
  527. package/dist/utils/grantFiles.cjs.map +0 -1
  528. package/dist/utils/grantFiles.d.ts +0 -172
  529. package/dist/utils/grantFiles.js +0 -143
  530. package/dist/utils/grantFiles.js.map +0 -1
  531. package/dist/utils/grantValidation.cjs +0 -243
  532. package/dist/utils/grantValidation.cjs.map +0 -1
  533. package/dist/utils/grantValidation.d.ts +0 -226
  534. package/dist/utils/grantValidation.js +0 -201
  535. package/dist/utils/grantValidation.js.map +0 -1
  536. package/dist/utils/grants.cjs +0 -108
  537. package/dist/utils/grants.cjs.map +0 -1
  538. package/dist/utils/grants.d.ts +0 -148
  539. package/dist/utils/grants.js +0 -82
  540. package/dist/utils/grants.js.map +0 -1
  541. package/dist/utils/ipfs.cjs +0 -128
  542. package/dist/utils/ipfs.cjs.map +0 -1
  543. package/dist/utils/ipfs.d.ts +0 -88
  544. package/dist/utils/ipfs.js +0 -97
  545. package/dist/utils/ipfs.js.map +0 -1
  546. package/dist/utils/multicall.cjs +0 -233
  547. package/dist/utils/multicall.cjs.map +0 -1
  548. package/dist/utils/multicall.d.ts +0 -126
  549. package/dist/utils/multicall.js +0 -208
  550. package/dist/utils/multicall.js.map +0 -1
  551. package/dist/utils/parseTransactionPojo.cjs +0 -87
  552. package/dist/utils/parseTransactionPojo.cjs.map +0 -1
  553. package/dist/utils/parseTransactionPojo.d.ts +0 -31
  554. package/dist/utils/parseTransactionPojo.js +0 -63
  555. package/dist/utils/parseTransactionPojo.js.map +0 -1
  556. package/dist/utils/schemaValidation.cjs +0 -258
  557. package/dist/utils/schemaValidation.cjs.map +0 -1
  558. package/dist/utils/schemaValidation.d.ts +0 -168
  559. package/dist/utils/schemaValidation.js +0 -219
  560. package/dist/utils/schemaValidation.js.map +0 -1
  561. package/dist/utils/signatureCache.cjs +0 -192
  562. package/dist/utils/signatureCache.cjs.map +0 -1
  563. package/dist/utils/signatureCache.d.ts +0 -172
  564. package/dist/utils/signatureCache.js +0 -167
  565. package/dist/utils/signatureCache.js.map +0 -1
  566. package/dist/utils/signatureFormatter.cjs +0 -42
  567. package/dist/utils/signatureFormatter.cjs.map +0 -1
  568. package/dist/utils/signatureFormatter.d.ts +0 -36
  569. package/dist/utils/signatureFormatter.js +0 -18
  570. package/dist/utils/signatureFormatter.js.map +0 -1
  571. package/dist/utils/subgraphConsistency.cjs +0 -184
  572. package/dist/utils/subgraphConsistency.cjs.map +0 -1
  573. package/dist/utils/subgraphConsistency.d.ts +0 -65
  574. package/dist/utils/subgraphConsistency.js +0 -155
  575. package/dist/utils/subgraphConsistency.js.map +0 -1
  576. package/dist/utils/subgraphMetaCache.cjs +0 -101
  577. package/dist/utils/subgraphMetaCache.cjs.map +0 -1
  578. package/dist/utils/subgraphMetaCache.d.ts +0 -56
  579. package/dist/utils/subgraphMetaCache.js +0 -76
  580. package/dist/utils/subgraphMetaCache.js.map +0 -1
  581. package/dist/utils/subgraphPagination.cjs +0 -104
  582. package/dist/utils/subgraphPagination.cjs.map +0 -1
  583. package/dist/utils/subgraphPagination.d.ts +0 -78
  584. package/dist/utils/subgraphPagination.js +0 -78
  585. package/dist/utils/subgraphPagination.js.map +0 -1
  586. package/dist/utils/tests/multicall.test.d.ts +0 -1
  587. package/dist/utils/transactionHelpers.cjs +0 -54
  588. package/dist/utils/transactionHelpers.cjs.map +0 -1
  589. package/dist/utils/transactionHelpers.d.ts +0 -80
  590. package/dist/utils/transactionHelpers.js +0 -29
  591. package/dist/utils/transactionHelpers.js.map +0 -1
  592. package/dist/utils/typeGuards.cjs +0 -109
  593. package/dist/utils/typeGuards.cjs.map +0 -1
  594. package/dist/utils/typeGuards.d.ts +0 -138
  595. package/dist/utils/typeGuards.js +0 -74
  596. package/dist/utils/typeGuards.js.map +0 -1
  597. package/dist/utils/typedDataConverter.cjs +0 -43
  598. package/dist/utils/typedDataConverter.cjs.map +0 -1
  599. package/dist/utils/typedDataConverter.d.ts +0 -46
  600. package/dist/utils/typedDataConverter.js +0 -19
  601. package/dist/utils/typedDataConverter.js.map +0 -1
  602. package/dist/utils/urlResolver.cjs +0 -62
  603. package/dist/utils/urlResolver.cjs.map +0 -1
  604. package/dist/utils/urlResolver.d.ts +0 -56
  605. package/dist/utils/urlResolver.js +0 -37
  606. package/dist/utils/urlResolver.js.map +0 -1
  607. package/dist/utils/wallet.cjs +0 -63
  608. package/dist/utils/wallet.cjs.map +0 -1
  609. package/dist/utils/wallet.d.ts +0 -94
  610. package/dist/utils/wallet.js +0 -37
  611. package/dist/utils/wallet.js.map +0 -1
  612. package/dist/utils/withEvents.cjs +0 -44
  613. package/dist/utils/withEvents.cjs.map +0 -1
  614. package/dist/utils/withEvents.d.ts +0 -56
  615. package/dist/utils/withEvents.js +0 -18
  616. package/dist/utils/withEvents.js.map +0 -1
  617. /package/dist/{__tests__/waitForTransactionEvents.test.d.ts → auth/pkce.test.d.ts} +0 -0
  618. /package/dist/{client/__tests__/enhancedResponse.test.d.ts → auth/token-store.test.d.ts} +0 -0
  619. /package/dist/{controllers/__tests__/operations.processQueue.test.d.ts → auth/web3-signed.test.d.ts} +0 -0
  620. /package/dist/{controllers/__tests__/schemas-edge-cases.test.d.ts → crypto/envelope/openpgp.test.d.ts} +0 -0
  621. /package/dist/{controllers/data-error-handling.test.d.ts → crypto/keys/derive.test.d.ts} +0 -0
  622. /package/dist/{tests/errors.test.d.ts → errors.test.d.ts} +0 -0
  623. /package/dist/{controllers/server-additional.test.d.ts → protocol/data-file.test.d.ts} +0 -0
  624. /package/dist/{core/__tests__/health.test.d.ts → protocol/eip712.test.d.ts} +0 -0
  625. /package/dist/{core/__tests__/inMemoryNonceManager.test.d.ts → protocol/gateway.test.d.ts} +0 -0
  626. /package/dist/{core/__tests__/nonceManager.test.d.ts → protocol/grants.test.d.ts} +0 -0
  627. /package/dist/{core/core.test.d.ts → protocol/scopes.test.d.ts} +0 -0
  628. /package/dist/{core/tests/apiClient.test.d.ts → storage/tests/defaultStorage.test.d.ts} +0 -0
  629. /package/dist/{core/tests/client.test.d.ts → storage/tests/r2Storage.test.d.ts} +0 -0
  630. /package/dist/{core/tests/generics.test.d.ts → storage/tests/vanaStorage.test.d.ts} +0 -0
  631. /package/dist/{diagnostics.test.d.ts → types/ps-errors.test.d.ts} +0 -0
@@ -1,1411 +0,0 @@
1
- import type { Address, Hash } from "viem";
2
- import type { TransactionOptions, TransactionResult } from "../types/operations";
3
- import type { GrantPermissionParams, RevokePermissionParams, PermissionGrantTypedData, GenericTypedData, OnChainPermissionGrant, GetUserPermissionsOptions, AddAndTrustServerParams, TrustServerParams, UntrustServerParams, AddAndTrustServerTypedData, TrustServerTypedData, TrustedServerInfo, PaginatedTrustedServers, TrustedServerQueryOptions, BatchServerInfoResult, ServerTrustStatus, GrantFile, Grantee, GranteeInfo, RegisterGranteeParams, GranteeQueryOptions, PaginatedGrantees, ServerInfo, ServerFilesAndPermissionParams, ServerFilesAndPermissionTypedData } from "../types/index";
4
- import type { PermissionGrantResult, PermissionRevokeResult, ServerTrustResult } from "../types/transactionResults";
5
- import type { PermissionInfo } from "../types/permissions";
6
- /**
7
- * Provides shared configuration and services for all SDK controllers.
8
- *
9
- * @remarks
10
- * This interface defines the foundational blockchain and storage services that all
11
- * controllers require for operation. The main Vana SDK class automatically creates
12
- * this context during initialization and passes it to each controller. It includes
13
- * wallet clients for transaction signing, storage managers for file operations,
14
- * and platform adapters for environment-specific functionality.
15
- * @category Configuration
16
- */
17
- import type { ControllerContext } from "../types/controller-context";
18
- import { BaseController } from "./base";
19
- export type { ControllerContext };
20
- /**
21
- * Manages data access permissions and trusted server operations with gasless transaction support.
22
- *
23
- * @remarks
24
- * Enables applications to access user data through EIP-712 signatures, eliminating gas fees
25
- * for users. Handles permission lifecycle from creation through revocation, plus trusted
26
- * server management for data processing operations.
27
- *
28
- * **Architecture:**
29
- * Permissions use dual storage: complex parameters on IPFS, references on blockchain.
30
- * This minimizes on-chain data while maintaining decentralization and auditability.
31
- *
32
- * **Method Selection:**
33
- * - `grant()` - Create permissions with automatic IPFS upload and blockchain registration
34
- * - `prepareGrant()` - Preview permission structure before signing
35
- * - `revoke()` - Remove permissions by ID (gasless or direct)
36
- * - `getUserPermissionGrantsOnChain()` - Query active permissions
37
- * - `trustServer()`/`untrustServer()` - Manage server access
38
- *
39
- * **Gasless Support:**
40
- * All permission methods support both gasless (via relayer) and direct transactions.
41
- * Configure relayer callbacks in Vana initialization for gasless operations.
42
- *
43
- * @example
44
- * ```typescript
45
- * // Grant data access permission
46
- * const result = await vana.permissions.grant({
47
- * grantee: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36",
48
- * operation: "llm_inference",
49
- * fileIds: [1, 2, 3],
50
- * parameters: { model: "gpt-4", maxTokens: 1000 }
51
- * });
52
- * console.log(`Permission ${result.permissionId} granted`);
53
- *
54
- * // Trust server for processing
55
- * await vana.permissions.trustServer({
56
- * serverAddress: "0x123...",
57
- * serverUrl: "https://personal-server.vana.org"
58
- * });
59
- *
60
- * // Query active permissions
61
- * const permissions = await vana.permissions.getUserPermissionGrantsOnChain();
62
- * permissions.forEach(p => console.log(`Permission ${p.id}: ${p.grantee}`));
63
- * ```
64
- *
65
- * @category Permissions
66
- * @see For conceptual overview, visit {@link https://docs.vana.org/docs/permissions}
67
- */
68
- export declare class PermissionsController extends BaseController {
69
- constructor(context: ControllerContext);
70
- /**
71
- * Grants permission for an application to access user data with gasless transactions.
72
- *
73
- * This method provides a complete end-to-end permission grant flow that returns
74
- * the permission ID and other relevant data immediately after successful submission.
75
- * For advanced users who need more control over the transaction lifecycle, use
76
- * `submitPermissionGrant()` instead.
77
- *
78
- * @param params - The permission grant configuration object
79
- * @returns Promise resolving to permission data from the PermissionAdded event
80
- * @throws {RelayerError} When gasless transaction submission fails
81
- * @throws {SignatureError} When user rejects the signature request
82
- * @throws {SerializationError} When grant data cannot be serialized
83
- * @throws {BlockchainError} When permission grant fails or event parsing fails
84
- * @throws {NetworkError} When transaction confirmation times out
85
- * @example
86
- * ```typescript
87
- * const result = await vana.permissions.grant({
88
- * grantee: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36",
89
- * operation: "llm_inference",
90
- * parameters: {
91
- * model: "gpt-4",
92
- * maxTokens: 1000,
93
- * temperature: 0.7,
94
- * },
95
- * });
96
- *
97
- * console.log(`Permission ${result.permissionId} granted to ${result.user}`);
98
- * console.log(`Transaction: ${result.transactionHash}`);
99
- *
100
- * // Can immediately use the permission ID for other operations
101
- * await vana.permissions.revoke({ permissionId: result.permissionId });
102
- * ```
103
- */
104
- grant(params: GrantPermissionParams, options?: TransactionOptions): Promise<PermissionGrantResult>;
105
- /**
106
- * Submits a permission grant transaction and returns a handle for flexible result access.
107
- *
108
- * @remarks
109
- * This lower-level method provides maximum control over transaction timing.
110
- * Returns a TransactionResult that can be serialized and passed across API boundaries.
111
- * Use this when handling multiple transactions or when you need granular control.
112
- *
113
- * @param params - The permission grant configuration object
114
- * @returns Promise resolving to TransactionResult with hash and event parsing capabilities
115
- * @throws {RelayerError} When gasless transaction submission fails
116
- * @throws {SignatureError} When user rejects the signature request
117
- * @throws {SerializationError} When grant data cannot be serialized
118
- * @throws {BlockchainError} When permission grant preparation fails
119
- * @example
120
- * ```typescript
121
- * // Submit transaction and get immediate hash access
122
- * const tx = await vana.permissions.submitPermissionGrant(params);
123
- * console.log(`Transaction submitted: ${tx.hash}`);
124
- *
125
- * // To wait for events, use SDK's waitForTransactionEvents
126
- * const eventData = await vana.waitForTransactionEvents(tx.hash);
127
- * console.log(`Permission ID: ${eventData.permissionId}`);
128
- * ```
129
- */
130
- submitPermissionGrant(params: GrantPermissionParams, options?: TransactionOptions): Promise<TransactionResult<"DataPortabilityPermissions", "addPermission">>;
131
- /**
132
- * Prepares a permission grant with preview before signing.
133
- *
134
- * @remarks
135
- * This method implements a two-phase commit workflow that allows applications
136
- * to show users a preview of what they're authorizing before requesting a signature.
137
- * Unlike `createAndSign()`, this method does NOT upload to IPFS or prompt for signatures
138
- * until the returned `confirm()` function is called.
139
- * @param params - The permission grant parameters
140
- * @returns A promise resolving to a preview object and confirm function
141
- * @throws {SerializationError} When grant parameters are invalid or cannot be serialized
142
- * @throws {BlockchainError} When grant validation fails or preparation encounters an error
143
- * @example
144
- * ```typescript
145
- * const { preview, confirm } = await vana.permissions.prepareGrant({
146
- * grantee: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36",
147
- * operation: "llm_inference",
148
- * files: [1, 2, 3],
149
- * parameters: { model: "gpt-4", prompt: "Analyze my social media data" }
150
- * });
151
- *
152
- * console.log(`Granting ${preview.operation} access to ${preview.files?.length} files`);
153
- * const transactionHash = await confirm();
154
- * ```
155
- */
156
- prepareGrant(params: GrantPermissionParams, options?: TransactionOptions): Promise<{
157
- preview: GrantFile;
158
- confirm: () => Promise<PermissionGrantResult>;
159
- }>;
160
- /**
161
- * Completes the grant process after user confirmation.
162
- *
163
- * @remarks
164
- * This internal method is called by the confirm() function returned from prepareGrant().
165
- * It handles IPFS upload, signature creation, and transaction submission.
166
- *
167
- * @param params - The permission grant parameters containing user and operation details
168
- * @param grantFile - The prepared grant file with permissions and metadata
169
- * @returns Promise resolving to TransactionResult for flexible result access
170
- * @throws {BlockchainError} When permission grant confirmation fails
171
- * @throws {NetworkError} When IPFS upload fails
172
- * @throws {SignatureError} When user rejects the signature
173
- */
174
- private confirmGrantInternal;
175
- /**
176
- * Creates typed data and signature for a permission grant without submitting.
177
- *
178
- * @remarks
179
- * This method handles the first phase of permission granting: creating the grant file,
180
- * storing it on IPFS, and generating the user's EIP-712 signature. Use this when you
181
- * want to handle submission separately or batch multiple operations. The method validates
182
- * the grant file against the JSON schema before creating the signature.
183
- *
184
- * For interactive user flows, consider using `prepareGrant()` instead,
185
- * which allows showing a preview before signing.
186
- * @param params - The permission grant configuration object
187
- * @returns A promise resolving to the typed data structure and signature for gasless submission
188
- * @throws {SignatureError} When the user rejects the signature request
189
- * @throws {SerializationError} When grant data cannot be properly formatted
190
- * @throws {BlockchainError} When permission grant preparation fails
191
- * @throws {NetworkError} When storage operations fail
192
- * @example
193
- * ```typescript
194
- * const { typedData, signature } = await vana.permissions.createAndSign({
195
- * grantee: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36",
196
- * operation: "data_analysis",
197
- * parameters: { analysisType: "sentiment" },
198
- * });
199
- *
200
- * const transactionHash = await vana.permissions.submitSignedGrant(typedData, signature);
201
- * ```
202
- */
203
- createAndSign(params: GrantPermissionParams): Promise<{
204
- typedData: PermissionGrantTypedData;
205
- signature: Hash;
206
- }>;
207
- /**
208
- * Submits an already-signed permission grant to the blockchain.
209
- *
210
- * @remarks
211
- * This method supports both relayer-based gasless transactions and direct transactions.
212
- * It automatically converts `bigint` values to JSON-safe strings when using relayer
213
- * callbacks and handles transaction submission with proper error handling and retry logic.
214
- * @param typedData - The EIP-712 typed data structure for the permission grant
215
- * @param signature - The user's signature as a hex string
216
- * @returns A Promise that resolves to the transaction hash
217
- * @throws {RelayerError} When gasless transaction submission fails
218
- * @throws {BlockchainError} When permission submission fails
219
- * @throws {NetworkError} When network communication fails
220
- * @example
221
- * ```typescript
222
- * const txHash = await vana.permissions.submitSignedGrant(
223
- * typedData,
224
- * "0x1234..."
225
- * );
226
- * ```
227
- */
228
- submitSignedGrant(typedData: PermissionGrantTypedData, signature: Hash, options?: TransactionOptions): Promise<TransactionResult<"DataPortabilityPermissions", "addPermission">>;
229
- /**
230
- * Submits an already-signed trust server transaction to the blockchain.
231
- *
232
- * @remarks
233
- * This method extracts the trust server input from typed data and submits it directly.
234
- * Used internally by trust server methods after signature collection.
235
- *
236
- * @param typedData - The EIP-712 typed data for TrustServer
237
- * @param signature - The user's signature obtained via `signTypedData()`
238
- * @returns Promise resolving to TransactionResult for transaction tracking
239
- * @throws {BlockchainError} When contract submission fails
240
- * @throws {NetworkError} When blockchain communication fails
241
- * @example
242
- * ```typescript
243
- * const txHandle = await vana.permissions.submitSignedTrustServer(
244
- * typedData,
245
- * "0x1234..."
246
- * );
247
- * const result = await txHandle.waitForEvents();
248
- * ```
249
- */
250
- submitSignedTrustServer(typedData: TrustServerTypedData, signature: Hash, options?: TransactionOptions): Promise<TransactionResult<"DataPortabilityServers", "trustServerWithSignature">>;
251
- /**
252
- * Submits an already-signed add and trust server transaction to the blockchain.
253
- *
254
- * @remarks
255
- * This method extracts the add and trust server input from typed data and submits it directly.
256
- * Combines server registration and trust operations in a single transaction.
257
- *
258
- * @param typedData - The EIP-712 typed data for AddAndTrustServer
259
- * @param signature - The user's signature obtained via `signTypedData()`
260
- * @returns Promise resolving to TransactionResult for transaction tracking
261
- * @throws {BlockchainError} When contract submission fails
262
- * @throws {NetworkError} When blockchain communication fails
263
- * @example
264
- * ```typescript
265
- * const txHandle = await vana.permissions.submitSignedAddAndTrustServer(
266
- * typedData,
267
- * "0x1234..."
268
- * );
269
- * const result = await txHandle.waitForEvents();
270
- * ```
271
- */
272
- submitSignedAddAndTrustServer(typedData: AddAndTrustServerTypedData, signature: Hash, options?: TransactionOptions): Promise<TransactionResult<"DataPortabilityServers", "addAndTrustServerWithSignature">>;
273
- /**
274
- * Internal method to submit a signed grant and wait for events.
275
- *
276
- * @internal
277
- * @param typedData - The EIP-712 typed data for the permission grant
278
- * @param signature - The user's signature authorizing the transaction
279
- * @returns Promise resolving to PermissionGrantResult with parsed events
280
- */
281
- private submitSignedGrantWithEvents;
282
- /**
283
- * Internal method for confirm grant with events.
284
- *
285
- * @internal
286
- * @param params - The permission grant parameters
287
- * @param grantFile - The pre-created grant file object
288
- * @returns Promise resolving to PermissionGrantResult with parsed events
289
- */
290
- private confirmGrantInternalWithEvents;
291
- /**
292
- * Polls the relayer for confirmation of a pending operation.
293
- *
294
- * @param operationId - The operation ID to poll
295
- * @param options - Polling configuration including status updates and cancellation
296
- * @returns Promise resolving to the confirmed hash and receipt
297
- * @throws {TransactionPendingError} When the operation times out
298
- * @throws {Error} When the operation fails or is cancelled
299
- * @internal
300
- */
301
- private pollRelayerForConfirmation;
302
- /**
303
- * Submits an already-signed permission revoke transaction to the blockchain.
304
- *
305
- * @remarks
306
- * This method handles the revocation of previously granted permissions.
307
- * Used internally by revocation methods after signature collection.
308
- *
309
- * @param typedData - The EIP-712 typed data for PermissionRevoke
310
- * @param signature - The user's signature obtained via `signTypedData()`
311
- * @returns Promise resolving to TransactionResult for transaction tracking
312
- * @throws {BlockchainError} When contract submission fails
313
- * @throws {NetworkError} When blockchain communication fails
314
- * @example
315
- * ```typescript
316
- * const txHandle = await vana.permissions.submitSignedRevoke(
317
- * typedData,
318
- * "0x1234..."
319
- * );
320
- * const result = await txHandle.waitForEvents();
321
- * ```
322
- */
323
- submitSignedRevoke(typedData: GenericTypedData, signature: Hash, options?: TransactionOptions): Promise<TransactionResult<"DataPortabilityPermissions", "revokePermissionWithSignature">>;
324
- /**
325
- * Submits an already-signed untrust server transaction to the blockchain.
326
- *
327
- * @remarks
328
- * This method handles the removal of trusted servers.
329
- * Used internally by untrust server methods after signature collection.
330
- *
331
- * @param typedData - The EIP-712 typed data for UntrustServer
332
- * @param signature - The user's signature obtained via `signTypedData()`
333
- * @returns Promise resolving to TransactionResult for transaction tracking
334
- * @throws {BlockchainError} When contract submission fails
335
- * @throws {NetworkError} When blockchain communication fails
336
- * @example
337
- * ```typescript
338
- * const txHandle = await vana.permissions.submitSignedUntrustServer(
339
- * typedData,
340
- * "0x1234..."
341
- * );
342
- * const result = await txHandle.waitForEvents();
343
- * ```
344
- */
345
- submitSignedUntrustServer(typedData: GenericTypedData, signature: Hash, options?: TransactionOptions): Promise<TransactionResult<"DataPortabilityServers", "untrustServerWithSignature">>;
346
- /**
347
- * Submits a signed transaction directly to the blockchain.
348
- *
349
- * @remarks
350
- * Internal method used when relayer callbacks are not available. Formats the signature
351
- * and submits the permission grant directly to the smart contract.
352
- *
353
- * @param typedData - The typed data structure for the permission grant
354
- * @param signature - The cryptographic signature authorizing the transaction
355
- * @returns Promise resolving to the transaction hash
356
- * @throws {BlockchainError} When contract submission fails
357
- */
358
- private submitDirectTransaction;
359
- /**
360
- * Revokes a previously granted permission.
361
- *
362
- * This method provides complete revocation with automatic event parsing to confirm
363
- * the permission was successfully revoked. For advanced users who need more control,
364
- * use `submitPermissionRevoke()` instead.
365
- *
366
- * @param params - Parameters for revoking the permission
367
- * @param params.permissionId - Permission identifier (accepts bigint, number, or string).
368
- * Obtain from permission grants via `getUserPermissionGrantsOnChain()`.
369
- * @returns Promise resolving to revocation data from PermissionRevoked event
370
- * @throws {BlockchainError} When revocation fails or event parsing fails
371
- * @throws {UserRejectedRequestError} When user rejects the transaction
372
- * @throws {NetworkError} When transaction confirmation times out
373
- * @example
374
- * ```typescript
375
- * // Revoke a permission and get confirmation
376
- * const result = await vana.permissions.revoke({
377
- * permissionId: 123n
378
- * });
379
- * console.log(`Permission ${result.permissionId} revoked in transaction ${result.transactionHash}`);
380
- * console.log(`Revoked in block ${result.blockNumber}`);
381
- * ```
382
- */
383
- revoke(params: RevokePermissionParams): Promise<PermissionRevokeResult>;
384
- /**
385
- * Submits a permission revocation transaction and returns the transaction hash immediately.
386
- *
387
- * This is the lower-level method that provides maximum control over transaction timing.
388
- * Use this when you want to handle transaction confirmation and event parsing separately.
389
- *
390
- * @param params - Parameters for revoking the permission
391
- * @param options - Optional transaction options for gas parameters and timeout
392
- * @returns Promise resolving to the transaction hash when successfully submitted
393
- * @throws {BlockchainError} When revocation transaction fails
394
- * @throws {UserRejectedRequestError} When user rejects the transaction
395
- * @example
396
- * ```typescript
397
- * // Submit revocation and handle confirmation later
398
- * const txHash = await vana.permissions.submitPermissionRevoke({
399
- * permissionId: 123n
400
- * });
401
- * console.log(`Revocation submitted: ${txHash}`);
402
- * ```
403
- */
404
- submitPermissionRevoke(params: RevokePermissionParams, options?: TransactionOptions): Promise<TransactionResult<"DataPortabilityPermissions", "revokePermission">>;
405
- /**
406
- * Revokes a permission with a signature for gasless transactions.
407
- *
408
- * @remarks
409
- * This method creates an EIP-712 signature for permission revocation and submits
410
- * it either through relayer callbacks or directly to the blockchain. Provides
411
- * gasless revocation when relayer is configured.
412
- *
413
- * @param params - Parameters for revoking the permission
414
- * @param params.permissionId - Permission identifier to revoke (accepts bigint, number, or string)
415
- * @returns Promise resolving to TransactionResult for transaction tracking
416
- * @throws {BlockchainError} When chain ID is not available
417
- * @throws {NonceError} When retrieving user nonce fails
418
- * @throws {SignatureError} When user rejects the signature request
419
- * @throws {RelayerError} When gasless submission fails
420
- * @throws {PermissionError} When revocation fails for any other reason
421
- * @example
422
- * ```typescript
423
- * const txHandle = await vana.permissions.submitRevokeWithSignature({
424
- * permissionId: 123n
425
- * });
426
- * const result = await txHandle.waitForEvents();
427
- * console.log(`Permission ${result.permissionId} revoked`);
428
- * ```
429
- */
430
- submitRevokeWithSignature(params: RevokePermissionParams, options?: TransactionOptions): Promise<TransactionResult<"DataPortabilityPermissions", "revokePermissionWithSignature">>;
431
- /**
432
- * Retrieves the user's current nonce from the DataPortabilityServers contract.
433
- * This nonce is used for server-related operations (AddAndTrustServer, TrustServer, UntrustServer).
434
- *
435
- * @returns Promise resolving to the current servers nonce
436
- * @throws {NonceError} When reading nonce from contract fails
437
- * @private
438
- *
439
- * @example
440
- * ```typescript
441
- * const nonce = await this.getServersUserNonce();
442
- * console.log(`Current servers nonce: ${nonce}`);
443
- * ```
444
- */
445
- /**
446
- * Retrieves the user's current nonce from the DataPortabilityServers contract.
447
- *
448
- * @remarks
449
- * Used for server-related operations (trust/untrust) to prevent replay attacks.
450
- * The nonce must be incremented with each server operation.
451
- *
452
- * @returns Promise resolving to the user's current nonce as a bigint
453
- * @throws {NonceError} When retrieving the nonce fails
454
- */
455
- private getServersUserNonce;
456
- /**
457
- * Retrieves the user's current nonce from the DataPortabilityPermissions contract.
458
- * This nonce is used for permission-related operations (addPermission, addServerFilesAndPermissions).
459
- *
460
- * @returns Promise resolving to the current permissions nonce
461
- * @throws {NonceError} When reading nonce from contract fails
462
- * @private
463
- *
464
- * @example
465
- * ```typescript
466
- * const nonce = await this.getPermissionsUserNonce();
467
- * console.log(`Current permissions nonce: ${nonce}`);
468
- * ```
469
- */
470
- /**
471
- * Retrieves the user's current nonce from the DataPortabilityPermissions contract.
472
- *
473
- * @remarks
474
- * Used for permission-related operations (grant/revoke) to prevent replay attacks.
475
- * The nonce must be incremented with each permission operation.
476
- *
477
- * @returns Promise resolving to the user's current nonce as a bigint
478
- * @throws {NonceError} When retrieving the nonce fails
479
- */
480
- private getPermissionsUserNonce;
481
- /**
482
- * Composes the EIP-712 typed data for PermissionGrant (new simplified format).
483
- *
484
- * @param params - The parameters for composing the permission grant message
485
- * @param params.grantee - The recipient address for the permission grant
486
- * @param params.operation - The type of operation being granted permission for
487
- * @param params.files - Array of file IDs that the permission applies to
488
- * @param params.grantUrl - URL where the grant details are stored
489
- * @param params.serializedParameters - Serialized parameters for the operation
490
- * @param params.nonce - Unique number to prevent replay attacks
491
- * @returns Promise resolving to the typed data structure
492
- */
493
- private composePermissionGrantMessage;
494
- /**
495
- * Creates EIP-712 typed data structure for server files and permissions.
496
- *
497
- * @param params - Parameters for the server files and permissions message
498
- * @param params.granteeId - Grantee ID
499
- * @param params.grant - Grant URL or grant data
500
- * @param params.fileUrls - Array of file URLs
501
- * @param params.schemaIds - Schema IDs for each file
502
- * @param params.serverAddress - Server address
503
- * @param params.serverUrl - Server URL
504
- * @param params.serverPublicKey - Server public key
505
- * @param params.filePermissions - File permissions array
506
- * @param params.nonce - Unique number to prevent replay attacks
507
- * @returns Promise resolving to the typed data structure
508
- */
509
- private composeServerFilesAndPermissionMessage;
510
- /**
511
- * Gets the EIP-712 domain for PermissionGrant signatures.
512
- *
513
- * @returns Promise resolving to the EIP-712 domain configuration
514
- */
515
- private getPermissionDomain;
516
- /**
517
- * Signs typed data using the wallet client with signature caching.
518
- *
519
- * @param typedData - The EIP-712 typed data structure to sign
520
- * @returns Promise resolving to the cryptographic signature
521
- */
522
- private signTypedData;
523
- /**
524
- * Gets the user's address from the context.
525
- *
526
- * @returns The user's address
527
- */
528
- /**
529
- * Gets on-chain permission grant data without expensive off-chain resolution.
530
- *
531
- * @remarks
532
- * This method provides a fast, performance-focused way to retrieve permission grants
533
- * by querying only the subgraph without making expensive IPFS or individual contract calls.
534
- * It eliminates the N+1 query problem of the legacy `getUserPermissions()` method.
535
- *
536
- * The returned data contains all on-chain information but does NOT include resolved
537
- * operation details, parameters, or file IDs. Use `retrieveGrantFile()` separately
538
- * for specific grants when detailed data is needed.
539
- *
540
- * **Performance**: Completes in ~100-500ms regardless of permission count.
541
- * **Reliability**: Single point of failure (subgraph) with clear RPC fallback path.
542
- *
543
- * @param options - Options for retrieving permissions (limit, subgraph URL)
544
- * @returns A Promise that resolves to an array of `OnChainPermissionGrant` objects
545
- * @throws {BlockchainError} When subgraph query fails
546
- * @throws {NetworkError} When network requests fail
547
- * @example
548
- * ```typescript
549
- * // Fast: Get all on-chain permission data
550
- * const grants = await vana.permissions.getUserPermissionGrantsOnChain({ limit: 20 });
551
- *
552
- * // Display in UI immediately
553
- * grants.forEach(grant => {
554
- * console.log(`Permission ${grant.id}: ${grant.grantUrl}`);
555
- * });
556
- *
557
- * // Lazy load detailed data for specific permission when user clicks
558
- * const grantFile = await retrieveGrantFile(grants[0].grantUrl);
559
- * console.log(`Operation: ${grantFile.operation}`);
560
- * console.log(`Parameters:`, grantFile.parameters);
561
- * ```
562
- */
563
- getUserPermissionGrantsOnChain(options?: GetUserPermissionsOptions): Promise<OnChainPermissionGrant[]>;
564
- /**
565
- * Registers a new server and immediately trusts it in the DataPortabilityServers contract.
566
- *
567
- * This is a combined operation that both registers a new data portability server
568
- * and adds it to the user's trusted servers list in a single transaction.
569
- * Trusted servers can handle data export and portability requests from the user.
570
- *
571
- * @param params - Parameters for adding and trusting the server
572
- * @param params.serverAddress - Ethereum address of the server
573
- * @param params.serverUrl - HTTPS URL where the server can be reached
574
- * @param params.publicKey - Server's public key for encryption (hex string)
575
- * @returns Promise resolving to transaction hash
576
- * @throws {UserRejectedRequestError} When user rejects the transaction
577
- * @throws {BlockchainError} When chain ID is unavailable or transaction fails
578
- * @throws {ServerAlreadyRegisteredError} When server address is already registered
579
- * @throws {Error} When wallet account is not available
580
- *
581
- * @example
582
- * ```typescript
583
- * // Add and trust a server by providing all required details
584
- * const txHash = await vana.permissions.addAndTrustServer({
585
- * owner: '0x1234567890abcdef1234567890abcdef12345678',
586
- * serverAddress: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
587
- * serverUrl: 'https://myserver.example.com',
588
- * publicKey: '0x456789abcdef456789abcdef456789abcdef456789abcdef'
589
- * });
590
- * console.log('Server added and trusted in transaction:', txHash);
591
- *
592
- * // Verify the server is now trusted
593
- * const trustedServers = await vana.permissions.getTrustedServers();
594
- * console.log('Now trusting servers:', trustedServers);
595
- * ```
596
- */
597
- addAndTrustServer(params: AddAndTrustServerParams): Promise<ServerTrustResult>;
598
- /**
599
- * Trusts a server for data processing (legacy method).
600
- *
601
- * @param params - Parameters for trusting the server
602
- * @returns Promise resolving to transaction hash
603
- * @deprecated Use addAndTrustServer instead
604
- */
605
- submitTrustServer(params: TrustServerParams): Promise<TransactionResult<"DataPortabilityServers", "trustServer">>;
606
- /**
607
- * Adds and trusts a server using a signature (gasless transaction).
608
- *
609
- * @param params - Parameters for adding and trusting the server
610
- * @returns Promise resolving to TransactionResult with ServerTrustResult event data
611
- */
612
- submitAddAndTrustServerWithSignature(params: AddAndTrustServerParams, options?: TransactionOptions): Promise<TransactionResult<"DataPortabilityServers", "addAndTrustServerWithSignature">>;
613
- /**
614
- * Trusts a server using a signature (gasless transaction - legacy method).
615
- *
616
- * @param params - Parameters for trusting the server
617
- * @returns Promise resolving to transaction hash
618
- * @deprecated Use addAndTrustServerWithSignature instead
619
- * @throws {BlockchainError} When chain ID is not available
620
- * @throws {NonceError} When retrieving user nonce fails
621
- * @throws {SignatureError} When user rejects the signature request
622
- * @throws {RelayerError} When gasless submission fails
623
- * @throws {ServerUrlMismatchError} When server URL doesn't match existing registration
624
- * @throws {BlockchainError} When trust operation fails for any other reason
625
- */
626
- submitTrustServerWithSignature(params: TrustServerParams, options?: TransactionOptions): Promise<TransactionResult<"DataPortabilityServers", "trustServerWithSignature">>;
627
- /**
628
- * Submits a direct untrust server transaction (without signature).
629
- *
630
- * @param params - The untrust server parameters containing server details
631
- * @returns Promise resolving to the transaction hash
632
- */
633
- /**
634
- * Submits an untrust server transaction directly to the blockchain.
635
- *
636
- * @remarks
637
- * Internal method used for direct blockchain submission of untrust server operations
638
- * when relayer callbacks are not available.
639
- *
640
- * @param params - The untrust server parameters
641
- * @returns Promise resolving to TransactionResult for transaction tracking
642
- * @throws {BlockchainError} When contract submission fails
643
- */
644
- private submitDirectUntrustTransaction;
645
- /**
646
- * Removes a server from the user's trusted servers list in the DataPortabilityServers contract.
647
- *
648
- * This revokes the server's authorization to handle data portability requests for the user.
649
- * The server remains registered in the system but will no longer be trusted by this user.
650
- *
651
- * @param params - Parameters for untrusting the server
652
- * @param params.serverId - The numeric ID of the server to untrust
653
- * @param options - Optional transaction options for gas parameters and timeout
654
- * @returns Promise resolving to transaction hash
655
- * @throws {Error} When wallet account is not available
656
- * @throws {NonceError} When retrieving user nonce fails
657
- * @throws {UserRejectedRequestError} When user rejects the transaction
658
- * @throws {ServerNotTrustedError} When the server is not currently trusted
659
- * @throws {BlockchainError} When untrust transaction fails
660
- *
661
- * @example
662
- * ```typescript
663
- * // Untrust a specific server
664
- * const txHash = await vana.permissions.untrustServer({
665
- * serverId: 1
666
- * });
667
- * console.log('Server untrusted in transaction:', txHash);
668
- *
669
- * // Verify the server is no longer trusted
670
- * const trustedServers = await vana.permissions.getTrustedServers();
671
- * console.log('Still trusting servers:', trustedServers);
672
- * ```
673
- */
674
- submitUntrustServer(params: UntrustServerParams, options?: TransactionOptions): Promise<TransactionResult<"DataPortabilityServers", "untrustServer">>;
675
- /**
676
- * Untrusts a server using a signature (gasless transaction).
677
- *
678
- * @param params - Parameters for untrusting the server
679
- * @param params.serverId - The server's Ethereum address to untrust
680
- * @returns Promise resolving to transaction hash
681
- * @throws {Error} When wallet account is not available
682
- * @throws {NonceError} When retrieving user nonce fails
683
- * @throws {SignatureError} When user rejects the signature request
684
- * @throws {RelayerError} When gasless submission fails
685
- * @throws {BlockchainError} When untrust transaction fails
686
- */
687
- submitUntrustServerWithSignature(params: UntrustServerParams): Promise<TransactionResult<"DataPortabilityServers", "untrustServerWithSignature">>;
688
- /**
689
- * Retrieves all servers trusted by a user from the DataPortabilityServers contract.
690
- *
691
- * Returns an array of server IDs that the specified user has explicitly trusted.
692
- * Trusted servers are those that users have authorized to handle their data portability requests.
693
- *
694
- * @param userAddress - Optional user address to query (defaults to current wallet user)
695
- * @returns Promise resolving to array of trusted server IDs (numeric)
696
- * @throws {BlockchainError} When reading from contract fails or chain is unavailable
697
- * @throws {NetworkError} When unable to connect to the blockchain network
698
- *
699
- * @example
700
- * ```typescript
701
- * // Get trusted servers for current user
702
- * const myServers = await vana.permissions.getTrustedServers();
703
- * console.log(`I trust ${myServers.length} servers: ${myServers.join(', ')}`);
704
- *
705
- * // Get trusted servers for another user
706
- * const userServers = await vana.permissions.getTrustedServers("0x1234...");
707
- * console.log(`User trusts servers: ${userServers.join(', ')}`);
708
- * ```
709
- */
710
- getTrustedServers(userAddress?: Address): Promise<number[]>;
711
- /**
712
- * Gets the total count of trusted servers for a user.
713
- *
714
- * @param userAddress - Optional user address (defaults to current user)
715
- * @returns Promise resolving to the number of trusted servers
716
- * @throws {BlockchainError} When reading from contract fails or chain is unavailable
717
- */
718
- getTrustedServersCount(userAddress?: Address): Promise<number>;
719
- /**
720
- * Gets trusted servers with pagination support.
721
- *
722
- * @param options - Query options including pagination parameters
723
- * @returns Promise resolving to paginated trusted servers
724
- * @throws {BlockchainError} When reading from contract fails or chain is unavailable
725
- */
726
- getTrustedServersPaginated(options?: TrustedServerQueryOptions): Promise<PaginatedTrustedServers>;
727
- /**
728
- * Gets trusted servers with their complete information.
729
- *
730
- * @param options - Query options
731
- * @returns Promise resolving to array of trusted server info
732
- * @throws {BlockchainError} When reading from contract fails or chain is unavailable
733
- */
734
- getTrustedServersWithInfo(options?: TrustedServerQueryOptions): Promise<TrustedServerInfo[]>;
735
- /**
736
- * Gets server information for multiple servers efficiently.
737
- *
738
- * @remarks
739
- * This method uses multicall to fetch information for multiple servers in a single
740
- * blockchain call, improving performance when querying many servers. Failed lookups
741
- * are returned separately for error handling.
742
- *
743
- * @param serverIds - Array of numeric server IDs to query
744
- * @returns Promise resolving to batch result containing successful lookups and failed IDs
745
- * @throws {BlockchainError} When reading from contract fails or chain is unavailable
746
- * @example
747
- * ```typescript
748
- * const result = await vana.permissions.getServerInfoBatch([1, 2, 3, 999]);
749
- *
750
- * // Process successful lookups
751
- * result.servers.forEach((server, id) => {
752
- * console.log(`Server ${id}: ${server.url}`);
753
- * });
754
- *
755
- * // Handle failed lookups
756
- * if (result.failed.length > 0) {
757
- * console.log(`Failed to fetch: ${result.failed.join(', ')}`);
758
- * }
759
- * ```
760
- */
761
- getServerInfoBatch(serverIds: number[]): Promise<BatchServerInfoResult>;
762
- /**
763
- * Checks whether a specific server is trusted by a user.
764
- *
765
- * @remarks
766
- * This method queries the user's trusted server list and checks if the specified
767
- * server is present. Returns both the trust status and the index in the trust list
768
- * if trusted.
769
- *
770
- * @param serverId - Numeric server ID to check
771
- * @param userAddress - Optional user address (defaults to current user)
772
- * @returns Promise resolving to server trust status with trust index if applicable
773
- * @throws {BlockchainError} When reading from contract fails
774
- * @example
775
- * ```typescript
776
- * const status = await vana.permissions.checkServerTrustStatus(1);
777
- * if (status.isTrusted) {
778
- * console.log(`Server is trusted at index ${status.trustIndex}`);
779
- * } else {
780
- * console.log('Server is not trusted');
781
- * }
782
- * ```
783
- */
784
- checkServerTrustStatus(serverId: number, userAddress?: Address): Promise<ServerTrustStatus>;
785
- /**
786
- * Composes EIP-712 typed data for AddAndTrustServer.
787
- *
788
- * @remarks
789
- * Creates the complete typed data structure required for EIP-712 signature generation
790
- * when adding and trusting a new server in a single transaction.
791
- *
792
- * @param input - The add and trust server input data containing server details
793
- * @returns Promise resolving to the typed data structure for server add and trust
794
- */
795
- private composeAddAndTrustServerMessage;
796
- /**
797
- * Composes EIP-712 typed data for TrustServer.
798
- *
799
- * @param input - The trust server input data containing server details
800
- * @returns Promise resolving to the typed data structure for server trust
801
- */
802
- private composeTrustServerMessage;
803
- /**
804
- * Composes EIP-712 typed data for UntrustServer.
805
- *
806
- * @param input - The untrust server input data containing server details
807
- * @returns Promise resolving to the typed data structure for server untrust
808
- */
809
- private composeUntrustServerMessage;
810
- /**
811
- * Gets the EIP-712 domain for DataPortabilityServers signatures.
812
- *
813
- * @returns Promise resolving to the EIP-712 domain configuration
814
- */
815
- private getServersDomain;
816
- /**
817
- * Submits an add and trust server transaction directly to the blockchain.
818
- *
819
- * @param addAndTrustServerInput - The add and trust server input data containing server details
820
- * @param signature - The cryptographic signature for the transaction
821
- * @returns Promise resolving to the transaction hash
822
- */
823
- private submitAddAndTrustServerTransaction;
824
- /**
825
- * Submits a trust server transaction directly to the blockchain.
826
- *
827
- * @param trustServerInput - The trust server input data containing server details
828
- * @param signature - The cryptographic signature for the transaction
829
- * @returns Promise resolving to the transaction hash
830
- */
831
- private submitTrustServerTransaction;
832
- /**
833
- * Submits a revoke transaction directly to the blockchain with signature.
834
- *
835
- * @param typedData - The EIP-712 typed data structure for the revoke operation
836
- * @param signature - The cryptographic signature authorizing the revoke
837
- * @returns Promise resolving to the transaction hash
838
- */
839
- private submitDirectRevokeTransaction;
840
- /**
841
- * Submits an untrust server transaction with signature.
842
- *
843
- * @param typedData - The EIP-712 typed data structure for the untrust operation
844
- * @param signature - The cryptographic signature authorizing the untrust
845
- * @returns Promise resolving to the transaction hash
846
- */
847
- private submitSignedUntrustTransaction;
848
- /**
849
- * Registers a new grantee in the DataPortabilityGrantees contract.
850
- *
851
- * A grantee is an entity (like an application) that can receive data permissions
852
- * from users. Once registered, users can grant the grantee access to their data.
853
- *
854
- * This method supports gasless transactions via relayer when configured.
855
- * If no relayer is available, it falls back to direct wallet transactions.
856
- *
857
- * @param params - Parameters for registering the grantee
858
- * @param params.owner - The Ethereum address that will own this grantee registration
859
- * @param params.granteeAddress - The Ethereum address of the grantee (application)
860
- * @param params.publicKey - The public key used for data encryption/decryption (hex string)
861
- * @param options - Optional transaction options for gas parameters and timeout
862
- * @returns Promise resolving to the transaction hash
863
- * @throws {BlockchainError} When the grantee registration transaction fails
864
- * @throws {UserRejectedRequestError} When user rejects the transaction
865
- * @throws {RelayerError} When gasless transaction submission fails
866
- *
867
- * @example
868
- * ```typescript
869
- * const txHash = await vana.permissions.registerGrantee({
870
- * owner: "0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36",
871
- * granteeAddress: "0xApp1234567890123456789012345678901234567890",
872
- * publicKey: "0x1234567890abcdef..."
873
- * });
874
- * console.log(`Grantee registered in transaction: ${txHash}`);
875
- * ```
876
- */
877
- submitRegisterGrantee(params: RegisterGranteeParams, options?: TransactionOptions): Promise<TransactionResult<"DataPortabilityGrantees", "registerGrantee">>;
878
- /**
879
- * Retrieves all registered grantees from the DataPortabilityGrantees contract.
880
- *
881
- * Returns a paginated list of all grantees (applications) that have been registered
882
- * in the system and can receive data permissions from users.
883
- *
884
- * @param options - Query options for pagination and filtering
885
- * @param options.limit - Maximum number of grantees to return (default: 50)
886
- * @param options.offset - Number of grantees to skip for pagination (default: 0)
887
- * @returns Promise resolving to paginated grantees with metadata
888
- * @throws {BlockchainError} When contract read operation fails
889
- * @throws {NetworkError} When unable to connect to the blockchain network
890
- *
891
- * @example
892
- * ```typescript
893
- * // Get first 10 grantees
894
- * const result = await vana.permissions.getGrantees({
895
- * limit: 10,
896
- * offset: 0
897
- * });
898
- *
899
- * console.log(`Found ${result.total} total grantees`);
900
- * result.grantees.forEach(grantee => {
901
- * console.log(`Grantee ${grantee.id}: ${grantee.granteeAddress}`);
902
- * });
903
- *
904
- * // Check if there are more results
905
- * if (result.hasMore) {
906
- * console.log('More grantees available');
907
- * }
908
- * ```
909
- */
910
- getGrantees(options?: GranteeQueryOptions): Promise<PaginatedGrantees>;
911
- /**
912
- * Retrieves a specific grantee by their Ethereum wallet address.
913
- *
914
- * @remarks
915
- * Looks up a registered grantee (application) using their Ethereum address
916
- * and returns their complete registration information including all associated permissions.
917
- *
918
- * Returns `null` if the address is not registered as a grantee or if an error occurs.
919
- *
920
- * @param granteeAddress - Ethereum wallet address of the grantee to query
921
- * @returns Grantee information including ID, addresses, public key, and permission IDs, or `null` if not found
922
- *
923
- * @example
924
- * ```typescript
925
- * const granteeAddress = "0xApp1234567890123456789012345678901234567890";
926
- * const grantee = await vana.permissions.getGranteeByAddress(granteeAddress);
927
- *
928
- * if (grantee) {
929
- * console.log(`Found grantee ${grantee.id}`);
930
- * console.log(`Owner: ${grantee.owner}`);
931
- * console.log(`Public Key: ${grantee.publicKey}`);
932
- * console.log(`Permissions: ${grantee.permissionIds.join(', ')}`);
933
- * } else {
934
- * console.log('Grantee not found');
935
- * }
936
- * ```
937
- */
938
- getGranteeByAddress(granteeAddress: Address): Promise<Grantee | null>;
939
- /**
940
- * Retrieves a specific grantee by their unique ID.
941
- *
942
- * @remarks
943
- * Looks up a registered grantee (application) using their numeric ID assigned during
944
- * registration and returns their complete information including all associated permissions.
945
- *
946
- * Returns `null` if the grantee is not found or if an error occurs during fetching.
947
- *
948
- * @param granteeId - Unique numeric ID of the grantee (1-indexed)
949
- * @returns Grantee information including ID, addresses, public key, and permission IDs, or `null` if not found
950
- *
951
- * @example
952
- * ```typescript
953
- * const grantee = await vana.permissions.getGranteeById(1);
954
- *
955
- * if (grantee) {
956
- * console.log(`Grantee ID: ${grantee.id}`);
957
- * console.log(`Address: ${grantee.address}`);
958
- * console.log(`Owner: ${grantee.owner}`);
959
- * console.log(`Total permissions: ${grantee.permissionIds.length}`);
960
- * } else {
961
- * console.log('Grantee with ID 1 not found');
962
- * }
963
- * ```
964
- */
965
- getGranteeById(granteeId: number): Promise<Grantee | null>;
966
- /**
967
- * Get all trusted server IDs for a user
968
- *
969
- * @param userAddress - User address to query (defaults to current user)
970
- * @returns Promise resolving to array of server IDs
971
- */
972
- getUserServerIds(userAddress?: Address): Promise<bigint[]>;
973
- /**
974
- * Get server ID at specific index for a user
975
- *
976
- * @param userAddress - User address to query
977
- * @param serverIndex - Index in the user's server list
978
- * @returns Promise resolving to server ID
979
- */
980
- getUserServerIdAt(userAddress: Address, serverIndex: bigint): Promise<bigint>;
981
- /**
982
- * Get the number of trusted servers for a user
983
- *
984
- * @param userAddress - User address to query (defaults to current user)
985
- * @returns Promise resolving to number of trusted servers
986
- */
987
- getUserServerCount(userAddress?: Address): Promise<bigint>;
988
- /**
989
- * Get detailed information about trusted servers for a user
990
- *
991
- * @param userAddress - User address to query (defaults to current user)
992
- * @returns Promise resolving to array of trusted server info
993
- */
994
- getUserTrustedServers(userAddress?: Address): Promise<TrustedServerInfo[]>;
995
- /**
996
- * Get trusted server info for a specific server ID and user
997
- *
998
- * @param userAddress - User address to query
999
- * @param serverId - Server ID to get info for
1000
- * @returns Promise resolving to trusted server info
1001
- */
1002
- getUserTrustedServer(userAddress: Address, serverId: bigint): Promise<TrustedServerInfo>;
1003
- /**
1004
- * Get server information by server ID
1005
- *
1006
- * @param serverId - Server ID to get info for
1007
- * @returns Promise resolving to server info
1008
- */
1009
- getServerInfo(serverId: bigint): Promise<ServerInfo>;
1010
- /**
1011
- * Get server information by server address
1012
- *
1013
- * @param serverAddress - Server address to get info for
1014
- * @returns Promise resolving to server info
1015
- */
1016
- getServerInfoByAddress(serverAddress: Address): Promise<ServerInfo>;
1017
- /**
1018
- * Get all permission IDs for a user
1019
- *
1020
- * @param userAddress - User address to query (defaults to current user)
1021
- * @returns Promise resolving to array of permission IDs
1022
- */
1023
- getUserPermissionIds(userAddress?: Address): Promise<bigint[]>;
1024
- /**
1025
- * Get permission ID at specific index for a user
1026
- *
1027
- * @param userAddress - User address to query
1028
- * @param permissionIndex - Index in the user's permission list
1029
- * @returns Promise resolving to permission ID
1030
- */
1031
- getUserPermissionIdAt(userAddress: Address, permissionIndex: bigint): Promise<bigint>;
1032
- /**
1033
- * Get the number of permissions for a user
1034
- *
1035
- * @param userAddress - User address to query (defaults to current user)
1036
- * @returns Promise resolving to number of permissions
1037
- */
1038
- getUserPermissionCount(userAddress?: Address): Promise<bigint>;
1039
- /**
1040
- * Get detailed permission information by permission ID
1041
- *
1042
- * @param permissionId - Permission ID to get info for
1043
- * @returns Promise resolving to permission info
1044
- */
1045
- getPermissionInfo(permissionId: bigint): Promise<PermissionInfo>;
1046
- /**
1047
- * Get all permission IDs for a specific file
1048
- *
1049
- * @param fileId - File ID to get permissions for
1050
- * @returns Promise resolving to array of permission IDs
1051
- */
1052
- getFilePermissionIds(fileId: bigint): Promise<bigint[]>;
1053
- /**
1054
- * Get all file IDs for a specific permission
1055
- *
1056
- * @param permissionId - Permission ID to get files for
1057
- * @returns Promise resolving to array of file IDs
1058
- */
1059
- getPermissionFileIds(permissionId: bigint): Promise<bigint[]>;
1060
- /**
1061
- * Retrieves detailed grant file data from IPFS or HTTP storage.
1062
- *
1063
- * @remarks
1064
- * This method automatically uses the SDK's configured downloadRelayer to bypass CORS restrictions.
1065
- * Use this instead of importing the standalone `retrieveGrantFile` utility.
1066
- *
1067
- * @param grantUrl - The grant file URL (from OnChainPermissionGrant.grantUrl)
1068
- * @returns Promise resolving to the complete grant file with operation details
1069
- * @throws {NetworkError} When all retrieval attempts fail
1070
- * @example
1071
- * ```typescript
1072
- * const grants = await vana.permissions.getUserPermissionGrantsOnChain();
1073
- * const grantFile = await vana.permissions.retrieveGrantFile(grants[0].grantUrl);
1074
- * console.log(`Operation: ${grantFile.operation}`);
1075
- * ```
1076
- */
1077
- retrieveGrantFile(grantUrl: string): Promise<GrantFile>;
1078
- /**
1079
- * Get all permissions for a specific file (alias for getFilePermissionIds)
1080
- *
1081
- * @param fileId - File ID to get permissions for
1082
- * @returns Promise resolving to array of permission IDs
1083
- */
1084
- getFilePermissions(fileId: bigint): Promise<bigint[]>;
1085
- /**
1086
- * Retrieves detailed grantee information including all associated permissions.
1087
- *
1088
- * @remarks
1089
- * Returns grantee metadata and associated permission IDs. Uses the newer
1090
- * paginated contract method internally for efficient permission fetching.
1091
- *
1092
- * @param granteeId - Unique grantee identifier as bigint
1093
- * @returns Grantee information containing owner address, grantee address, public key, and permission IDs
1094
- * @throws {BlockchainError} When grantee ID is not found or contract read fails
1095
- *
1096
- * @example
1097
- * ```typescript
1098
- * const granteeInfo = await vana.permissions.getGranteeInfo(BigInt(1));
1099
- * console.log(`Grantee ${granteeInfo.granteeAddress} has ${granteeInfo.permissionIds.length} permissions`);
1100
- * ```
1101
- */
1102
- getGranteeInfo(granteeId: bigint): Promise<GranteeInfo>;
1103
- /**
1104
- * Retrieves detailed grantee information by wallet address.
1105
- *
1106
- * @remarks
1107
- * Looks up the grantee ID from the provided address, then fetches complete
1108
- * grantee information including all associated permissions.
1109
- *
1110
- * @param granteeAddress - Ethereum wallet address of the grantee to query
1111
- * @returns Grantee information containing owner address, grantee address, public key, and permission IDs
1112
- * @throws {BlockchainError} When grantee address is not registered or contract read fails
1113
- *
1114
- * @example
1115
- * ```typescript
1116
- * const granteeInfo = await vana.permissions.getGranteeInfoByAddress("0x742d35Cc6634c0532925a3b844Bc9e8e1ee3b2De");
1117
- * console.log(`Found grantee with ${granteeInfo.permissionIds.length} permissions`);
1118
- * ```
1119
- */
1120
- getGranteeInfoByAddress(granteeAddress: Address): Promise<GranteeInfo>;
1121
- /**
1122
- * Get all permission IDs for a specific grantee
1123
- *
1124
- * @param granteeId - Grantee ID to get permissions for
1125
- * @returns Promise resolving to array of permission IDs
1126
- */
1127
- getGranteePermissionIds(granteeId: bigint): Promise<bigint[]>;
1128
- /**
1129
- * Get all permissions for a specific grantee (alias for getGranteePermissionIds)
1130
- *
1131
- * @param granteeId - Grantee ID to get permissions for
1132
- * @returns Promise resolving to array of permission IDs
1133
- */
1134
- getGranteePermissions(granteeId: bigint): Promise<bigint[]>;
1135
- /**
1136
- * Retrieves permission IDs for a specific grantee with flexible pagination.
1137
- *
1138
- * @remarks
1139
- * **Pagination Behavior:**
1140
- * Returns different types based on parameters:
1141
- * - Without offset/limit: Returns `bigint[]` of all permissions using batched multicall
1142
- * - With offset/limit: Returns paginated object with `permissionIds`, `totalCount`, and `hasMore`
1143
- *
1144
- * Uses gas-aware multicall for efficient batch fetching when retrieving all permissions.
1145
- *
1146
- * @param granteeId - Grantee ID to get permissions for
1147
- * @param options - Optional pagination parameters
1148
- * @param options.offset - Zero-based starting index for pagination. Defaults to 0 when fetching all permissions. Required for single-page requests.
1149
- * @param options.limit - Maximum number of permission IDs to return per page. Defaults to 100 when fetching all permissions. Required for single-page requests.
1150
- * @returns When called without options: Array of all permission IDs as `bigint[]`.
1151
- * When called with offset and limit: Paginated result object containing `permissionIds` array,
1152
- * `totalCount`, and `hasMore` boolean.
1153
- * @throws {BlockchainError} When contract read operation fails
1154
- *
1155
- * @example
1156
- * ```typescript
1157
- * // Fetch all permissions (no pagination params)
1158
- * const allPermissions = await vana.permissions.getGranteePermissionsPaginated(BigInt(1));
1159
- * console.log(`Total permissions: ${allPermissions.length}`);
1160
- *
1161
- * // Fetch a specific page (with pagination params)
1162
- * const page = await vana.permissions.getGranteePermissionsPaginated(BigInt(1), {
1163
- * offset: BigInt(0),
1164
- * limit: BigInt(100)
1165
- * });
1166
- * console.log(`Fetched ${page.permissionIds.length} permissions`);
1167
- * console.log(`Total: ${page.totalCount}, Has more: ${page.hasMore}`);
1168
- *
1169
- * // Fetch next page
1170
- * if (page.hasMore) {
1171
- * const nextPage = await vana.permissions.getGranteePermissionsPaginated(BigInt(1), {
1172
- * offset: BigInt(100),
1173
- * limit: BigInt(100)
1174
- * });
1175
- * }
1176
- * ```
1177
- */
1178
- getGranteePermissionsPaginated(granteeId: bigint, options?: {
1179
- offset?: bigint;
1180
- limit?: bigint;
1181
- }): Promise<bigint[] | {
1182
- permissionIds: bigint[];
1183
- totalCount: bigint;
1184
- hasMore: boolean;
1185
- }>;
1186
- /**
1187
- * Get all server IDs for a user
1188
- *
1189
- * @param userAddress - User address to get server IDs for
1190
- * @returns Promise resolving to array of server IDs
1191
- */
1192
- getUserServerIdsValues(userAddress: Address): Promise<bigint[]>;
1193
- /**
1194
- * Get server ID at specific index for a user
1195
- *
1196
- * @param userAddress - User address
1197
- * @param serverIndex - Index of the server ID
1198
- * @returns Promise resolving to server ID
1199
- */
1200
- getUserServerIdsAt(userAddress: Address, serverIndex: bigint): Promise<bigint>;
1201
- /**
1202
- * Get the number of servers a user has
1203
- *
1204
- * @param userAddress - User address
1205
- * @returns Promise resolving to number of servers
1206
- */
1207
- getUserServerIdsLength(userAddress: Address): Promise<bigint>;
1208
- /**
1209
- * Get trusted server info for a specific user and server ID
1210
- *
1211
- * @param userAddress - User address
1212
- * @param serverId - Server ID
1213
- * @returns Promise resolving to trusted server info
1214
- */
1215
- getUserServers(userAddress: Address, serverId: bigint): Promise<TrustedServerInfo>;
1216
- /**
1217
- * Get server info by server ID
1218
- *
1219
- * @param serverId - Server ID
1220
- * @returns Promise resolving to server info
1221
- */
1222
- getServers(serverId: bigint): Promise<ServerInfo>;
1223
- /**
1224
- * Get user info including nonce and trusted server IDs
1225
- *
1226
- * @param userAddress - User address
1227
- * @returns Promise resolving to user info
1228
- */
1229
- getUsers(userAddress: Address): Promise<{
1230
- nonce: bigint;
1231
- trustedServerIds: bigint[];
1232
- }>;
1233
- /**
1234
- * Update server URL
1235
- *
1236
- * @param serverId - Server ID to update
1237
- * @param url - New URL for the server
1238
- * @param options - Optional transaction options for gas parameters and timeout
1239
- * @returns Promise resolving to transaction hash
1240
- */
1241
- submitUpdateServer(serverId: bigint, url: string, options?: TransactionOptions): Promise<TransactionResult<"DataPortabilityServers", "updateServer">>;
1242
- /**
1243
- * Get all permission IDs for a user
1244
- *
1245
- * @param userAddress - User address to get permission IDs for
1246
- * @returns Promise resolving to array of permission IDs
1247
- */
1248
- getUserPermissionIdsValues(userAddress: Address): Promise<bigint[]>;
1249
- /**
1250
- * Get permission ID at specific index for a user
1251
- *
1252
- * @param userAddress - User address
1253
- * @param permissionIndex - Index of the permission ID
1254
- * @returns Promise resolving to permission ID
1255
- */
1256
- getUserPermissionIdsAt(userAddress: Address, permissionIndex: bigint): Promise<bigint>;
1257
- /**
1258
- * Get the number of permissions a user has
1259
- *
1260
- * @param userAddress - User address
1261
- * @returns Promise resolving to number of permissions
1262
- */
1263
- getUserPermissionIdsLength(userAddress: Address): Promise<bigint>;
1264
- /**
1265
- * Get permission info by permission ID
1266
- *
1267
- * @param permissionId - Permission ID
1268
- * @returns Promise resolving to permission info
1269
- */
1270
- getPermissions(permissionId: bigint): Promise<PermissionInfo>;
1271
- /**
1272
- * Submit permission with signature to the blockchain (supports gasless transactions)
1273
- *
1274
- * @param params - Parameters for adding permission
1275
- * @returns Promise resolving to transaction hash
1276
- * @throws {RelayerError} When gasless transaction submission fails
1277
- * @throws {SignatureError} When user rejects the signature request
1278
- * @throws {BlockchainError} When permission addition fails
1279
- * @throws {NetworkError} When network communication fails
1280
- */
1281
- submitAddPermission(params: ServerFilesAndPermissionParams): Promise<TransactionResult<"DataPortabilityPermissions", "addPermission">>;
1282
- /**
1283
- * Submits an already-signed add permission transaction to the blockchain.
1284
- * This method supports both relayer-based gasless transactions and direct transactions.
1285
- *
1286
- * @param typedData - The EIP-712 typed data for AddPermission
1287
- * @param signature - The user's signature
1288
- * @returns Promise resolving to TransactionResult with PermissionGrantResult event data
1289
- * @throws {RelayerError} When gasless transaction submission fails
1290
- * @throws {BlockchainError} When permission addition fails
1291
- * @throws {NetworkError} When network communication fails
1292
- */
1293
- submitSignedAddPermission(typedData: GenericTypedData, signature: Hash, options?: TransactionOptions): Promise<TransactionResult<"DataPortabilityPermissions", "addPermission">>;
1294
- /**
1295
- * Submits server files and permissions with signature to the blockchain, supporting schema validation and gasless transactions.
1296
- *
1297
- * @remarks
1298
- * This method validates files against their specified schemas before submission.
1299
- * Schema validation ensures data conforms to expected formats before on-chain registration.
1300
- * Files with schemaId = 0 bypass validation. The method supports atomic batch operations
1301
- * where all files and permissions are registered in a single transaction.
1302
- *
1303
- * @param params - Parameters for adding server files and permissions
1304
- * @param params.granteeId - The ID of the permission grantee
1305
- * @param params.grant - Grant URL containing permission parameters (typically IPFS)
1306
- * @param params.fileUrls - Array of file URLs to register
1307
- * @param params.schemaIds - Schema IDs for each file. Use 0 for files without schema validation.
1308
- * Array length must match fileUrls length.
1309
- * @param params.serverAddress - Server wallet address for decryption permissions
1310
- * @param params.serverUrl - Server endpoint URL
1311
- * @param params.serverPublicKey - Server's public key for encryption.
1312
- * Obtain via `vana.server.getIdentity(userAddress).publicKey`.
1313
- * @param params.filePermissions - Nested array of permissions for each file
1314
- * @param options - Optional transaction options for gas parameters and timeout.
1315
- * Note: These options are only applied for direct blockchain transactions.
1316
- * When using relayer callbacks (gasless transactions), these options are ignored.
1317
- * @returns TransactionResult with immediate hash access and optional event data
1318
- * @throws {Error} When schemaIds array length doesn't match fileUrls array length
1319
- * @throws {SchemaValidationError} When file data doesn't match the specified schema.
1320
- * Verify data structure matches schema definition from `vana.schemas.get(schemaId)`.
1321
- * @throws {RelayerError} When gasless transaction submission fails.
1322
- * Retry without relayer configuration to submit direct transaction.
1323
- * @throws {SignatureError} When user rejects the signature request
1324
- * @throws {BlockchainError} When server files and permissions addition fails
1325
- * @throws {NetworkError} When network communication fails.
1326
- * Check network connection or configure alternative gateways.
1327
- *
1328
- * @example
1329
- * ```typescript
1330
- * // Submit with custom gas parameters and timeout
1331
- * const result = await vana.permissions.submitAddServerFilesAndPermissions({
1332
- * granteeId: BigInt(1),
1333
- * grant: "ipfs://QmXxx...",
1334
- * fileUrls: ["https://storage.example.com/data.json"],
1335
- * schemaIds: [123], // LinkedIn profile schema ID
1336
- * serverAddress: "0x742d35Cc6634C0532925a3b844Bc9e7595f0b0Bb",
1337
- * serverUrl: "https://server.example.com",
1338
- * serverPublicKey: serverInfo.publicKey,
1339
- * filePermissions: [[{
1340
- * account: "0x742d35Cc6634C0532925a3b844Bc9e7595f0b0Bb",
1341
- * key: encryptedKey
1342
- * }]]
1343
- * }, {
1344
- * maxFeePerGas: 100n * 10n ** 9n, // 100 gwei
1345
- * maxPriorityFeePerGas: 2n * 10n ** 9n, // 2 gwei tip
1346
- * });
1347
- *
1348
- * // Wait for confirmation with custom timeout
1349
- * const receipt = await vana.waitForTransactionReceipt(result, {
1350
- * timeout: 180000 // 3 minutes
1351
- * });
1352
- * console.log(`Transaction confirmed: ${receipt.transactionHash}`);
1353
- * ```
1354
- */
1355
- submitAddServerFilesAndPermissions(params: ServerFilesAndPermissionParams, options?: TransactionOptions): Promise<TransactionResult<"DataPortabilityPermissions", "addServerFilesAndPermissions">>;
1356
- /**
1357
- * Submits an already-signed add server files and permissions transaction to the blockchain.
1358
- *
1359
- * @remarks
1360
- * This method returns a TransactionResult that provides immediate access to the transaction hash.
1361
- * The eventData field may contain parsed event details after transaction confirmation.
1362
- *
1363
- * @param typedData - The EIP-712 typed data for AddServerFilesAndPermissions
1364
- * @param signature - The user's signature
1365
- * @param options - Optional transaction options for gas parameters and timeout.
1366
- * Note: These options are only applied for direct blockchain transactions.
1367
- * When using relayer callbacks (gasless transactions), these options are ignored.
1368
- * @returns TransactionResult with immediate hash access and optional event data
1369
- * @throws {RelayerError} When gasless transaction submission fails
1370
- * @throws {BlockchainError} When server files and permissions addition fails
1371
- * @throws {NetworkError} When network communication fails
1372
- *
1373
- * @example
1374
- * ```typescript
1375
- * const tx = await vana.permissions.submitSignedAddServerFilesAndPermissions(
1376
- * typedData,
1377
- * signature
1378
- * );
1379
- * console.log(`Transaction submitted: ${tx.hash}`);
1380
- *
1381
- * // Wait for confirmation and get the permission ID
1382
- * const { permissionId } = await tx.waitForEvents();
1383
- * console.log(`Permission created with ID: ${permissionId}`);
1384
- * ```
1385
- */
1386
- submitSignedAddServerFilesAndPermissions(typedData: ServerFilesAndPermissionTypedData, signature: Hash, options?: TransactionOptions): Promise<TransactionResult<"DataPortabilityPermissions", "addServerFilesAndPermissions">>;
1387
- /**
1388
- * Submit permission revocation with signature to the blockchain
1389
- *
1390
- * @param permissionId - Permission ID to revoke
1391
- * @param options - Optional transaction options for gas parameters and timeout
1392
- * @returns Promise resolving to transaction hash
1393
- */
1394
- submitRevokePermission(permissionId: bigint, options?: TransactionOptions): Promise<TransactionResult<"DataPortabilityPermissions", "revokePermission">>;
1395
- /**
1396
- * Submits a signed add permission transaction directly to the blockchain.
1397
- *
1398
- * @param typedData - The typed data structure for the permission addition
1399
- * @param signature - The cryptographic signature authorizing the transaction
1400
- * @returns Promise resolving to the transaction hash
1401
- */
1402
- private submitDirectAddPermissionTransaction;
1403
- /**
1404
- * Submits a signed add server files and permissions transaction directly to the blockchain.
1405
- *
1406
- * @param typedData - The typed data structure for the server files and permissions addition
1407
- * @param signature - The cryptographic signature authorizing the transaction
1408
- * @returns Promise resolving to the transaction hash
1409
- */
1410
- private submitDirectAddServerFilesAndPermissionsTransaction;
1411
- }