@opendatalabs/vana-sdk 0.1.0-alpha.7ee7635 → 0.1.0-alpha.80df35f

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 (633) hide show
  1. package/dist/__tests__/waitForTransactionEvents.test.d.ts +1 -0
  2. package/dist/browser.d.ts +4 -2
  3. package/dist/chains/definitions.cjs +9 -6
  4. package/dist/chains/definitions.cjs.map +1 -1
  5. package/dist/chains/definitions.d.ts +9 -11
  6. package/dist/chains/definitions.js +9 -6
  7. package/dist/chains/definitions.js.map +1 -1
  8. package/dist/chains/index.d.ts +5 -2
  9. package/dist/chains.browser.d.ts +8 -2
  10. package/dist/chains.d.ts +8 -2
  11. package/dist/chains.node.d.ts +8 -2
  12. package/dist/config/addresses.d.ts +8 -45
  13. package/dist/config/chains.d.ts +9 -13
  14. package/dist/config/default-services.cjs +60 -0
  15. package/dist/config/default-services.cjs.map +1 -0
  16. package/dist/config/default-services.d.ts +46 -0
  17. package/dist/config/default-services.js +33 -0
  18. package/dist/config/default-services.js.map +1 -0
  19. package/dist/config/default-services.test.d.ts +1 -0
  20. package/dist/config/features.d.ts +1 -3
  21. package/dist/config/tests/addresses.test.d.ts +1 -0
  22. package/dist/contracts/contractController.cjs +3 -3
  23. package/dist/contracts/contractController.cjs.map +1 -1
  24. package/dist/contracts/contractController.d.ts +11 -49
  25. package/dist/contracts/contractController.js +4 -7
  26. package/dist/contracts/contractController.js.map +1 -1
  27. package/dist/contracts/tests/contractController.test.d.ts +1 -0
  28. package/dist/controllers/__tests__/schemas-edge-cases.test.d.ts +1 -0
  29. package/dist/controllers/base.cjs +83 -0
  30. package/dist/controllers/base.cjs.map +1 -0
  31. package/dist/controllers/base.d.ts +84 -0
  32. package/dist/controllers/base.js +59 -0
  33. package/dist/controllers/base.js.map +1 -0
  34. package/dist/controllers/data-error-handling.test.d.ts +1 -0
  35. package/dist/controllers/data.cjs +338 -107
  36. package/dist/controllers/data.cjs.map +1 -1
  37. package/dist/controllers/data.d.ts +145 -46
  38. package/dist/controllers/data.js +338 -107
  39. package/dist/controllers/data.js.map +1 -1
  40. package/dist/controllers/permissions.cjs +162 -223
  41. package/dist/controllers/permissions.cjs.map +1 -1
  42. package/dist/controllers/permissions.d.ts +24 -78
  43. package/dist/controllers/permissions.js +162 -223
  44. package/dist/controllers/permissions.js.map +1 -1
  45. package/dist/controllers/protocol.cjs +15 -11
  46. package/dist/controllers/protocol.cjs.map +1 -1
  47. package/dist/controllers/protocol.d.ts +7 -56
  48. package/dist/controllers/protocol.js +15 -14
  49. package/dist/controllers/protocol.js.map +1 -1
  50. package/dist/controllers/schemas.cjs +29 -36
  51. package/dist/controllers/schemas.cjs.map +1 -1
  52. package/dist/controllers/schemas.d.ts +8 -23
  53. package/dist/controllers/schemas.js +29 -36
  54. package/dist/controllers/schemas.js.map +1 -1
  55. package/dist/controllers/server-additional.test.d.ts +1 -0
  56. package/dist/controllers/server.cjs +15 -10
  57. package/dist/controllers/server.cjs.map +1 -1
  58. package/dist/controllers/server.d.ts +7 -20
  59. package/dist/controllers/server.js +15 -10
  60. package/dist/controllers/server.js.map +1 -1
  61. package/dist/core/apiClient.cjs +15 -12
  62. package/dist/core/apiClient.cjs.map +1 -1
  63. package/dist/core/apiClient.d.ts +5 -9
  64. package/dist/core/apiClient.js +19 -19
  65. package/dist/core/apiClient.js.map +1 -1
  66. package/dist/core/client.cjs +7 -7
  67. package/dist/core/client.cjs.map +1 -1
  68. package/dist/core/client.d.ts +6 -9
  69. package/dist/core/client.js +7 -7
  70. package/dist/core/client.js.map +1 -1
  71. package/dist/core/core.test.d.ts +1 -0
  72. package/dist/core/generics.cjs +11 -9
  73. package/dist/core/generics.cjs.map +1 -1
  74. package/dist/core/generics.d.ts +9 -13
  75. package/dist/core/generics.js +22 -29
  76. package/dist/core/generics.js.map +1 -1
  77. package/dist/core/tests/apiClient.test.d.ts +1 -0
  78. package/dist/core/tests/client.test.d.ts +1 -0
  79. package/dist/core/tests/generics.test.d.ts +1 -0
  80. package/dist/core.cjs +82 -34
  81. package/dist/core.cjs.map +1 -1
  82. package/dist/core.d.ts +21 -73
  83. package/dist/core.js +105 -60
  84. package/dist/core.js.map +1 -1
  85. package/dist/crypto/ecies/__tests__/base.test.d.ts +4 -0
  86. package/dist/crypto/ecies/__tests__/compatibility.test.d.ts +8 -0
  87. package/dist/crypto/ecies/__tests__/constants.test.d.ts +4 -0
  88. package/dist/crypto/ecies/__tests__/native-parity.test.d.ts +7 -0
  89. package/dist/crypto/ecies/__tests__/normalization.test.d.ts +1 -0
  90. package/dist/crypto/ecies/__tests__/test-vectors.d.ts +2 -4
  91. package/dist/crypto/ecies/base.cjs +4 -3
  92. package/dist/crypto/ecies/base.cjs.map +1 -1
  93. package/dist/crypto/ecies/base.d.ts +2 -5
  94. package/dist/crypto/ecies/base.js +12 -15
  95. package/dist/crypto/ecies/base.js.map +1 -1
  96. package/dist/crypto/ecies/browser.cjs +2 -1
  97. package/dist/crypto/ecies/browser.cjs.map +1 -1
  98. package/dist/crypto/ecies/browser.d.ts +2 -7
  99. package/dist/crypto/ecies/browser.js +2 -1
  100. package/dist/crypto/ecies/browser.js.map +1 -1
  101. package/dist/crypto/ecies/constants.d.ts +7 -9
  102. package/dist/crypto/ecies/index.d.ts +8 -1
  103. package/dist/crypto/ecies/interface.cjs +4 -5
  104. package/dist/crypto/ecies/interface.cjs.map +1 -1
  105. package/dist/crypto/ecies/interface.d.ts +9 -11
  106. package/dist/crypto/ecies/interface.js +4 -5
  107. package/dist/crypto/ecies/interface.js.map +1 -1
  108. package/dist/crypto/ecies/node.cjs +3 -2
  109. package/dist/crypto/ecies/node.cjs.map +1 -1
  110. package/dist/crypto/ecies/node.d.ts +2 -7
  111. package/dist/crypto/ecies/node.js +11 -16
  112. package/dist/crypto/ecies/node.js.map +1 -1
  113. package/dist/crypto/ecies/utils.cjs +2 -41
  114. package/dist/crypto/ecies/utils.cjs.map +1 -1
  115. package/dist/crypto/ecies/utils.d.ts +3 -40
  116. package/dist/crypto/ecies/utils.js +1 -35
  117. package/dist/crypto/ecies/utils.js.map +1 -1
  118. package/dist/crypto/services/WalletKeyEncryptionService.cjs +2 -2
  119. package/dist/crypto/services/WalletKeyEncryptionService.cjs.map +1 -1
  120. package/dist/crypto/services/WalletKeyEncryptionService.d.ts +3 -7
  121. package/dist/crypto/services/WalletKeyEncryptionService.js +5 -9
  122. package/dist/crypto/services/WalletKeyEncryptionService.js.map +1 -1
  123. package/dist/crypto/services/WalletKeyEncryptionService.test.d.ts +1 -0
  124. package/dist/diagnostics.d.ts +1 -3
  125. package/dist/diagnostics.test.d.ts +1 -0
  126. package/dist/errors.cjs +16 -0
  127. package/dist/errors.cjs.map +1 -1
  128. package/dist/errors.d.ts +53 -15
  129. package/dist/errors.js +18 -6
  130. package/dist/errors.js.map +1 -1
  131. package/dist/generated/abi/ComputeEngineImplementation.d.ts +2 -3
  132. package/dist/generated/abi/ComputeInstructionRegistryImplementation.cjs.map +1 -1
  133. package/dist/generated/abi/ComputeInstructionRegistryImplementation.d.ts +2 -3
  134. package/dist/generated/abi/ComputeInstructionRegistryImplementation.js.map +1 -1
  135. package/dist/generated/abi/DATFactoryImplementation.d.ts +2 -3
  136. package/dist/generated/abi/DATImplementation.d.ts +2 -3
  137. package/dist/generated/abi/DATPausableImplementation.d.ts +2 -3
  138. package/dist/generated/abi/DATVotesImplementation.d.ts +2 -3
  139. package/dist/generated/abi/DLPPerformanceImplementation.d.ts +2 -3
  140. package/dist/generated/abi/DLPRegistryImplementation.d.ts +2 -3
  141. package/dist/generated/abi/DLPRegistryTreasuryImplementation.d.ts +2 -3
  142. package/dist/generated/abi/DLPRewardDeployerImplementation.d.ts +2 -3
  143. package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.d.ts +2 -3
  144. package/dist/generated/abi/DLPRewardSwapImplementation.d.ts +2 -3
  145. package/dist/generated/abi/DLPRootImplementation.d.ts +1 -3
  146. package/dist/generated/abi/DLPTreasuryImplementation.d.ts +2 -3
  147. package/dist/generated/abi/DataLiquidityPoolImplementation.d.ts +1 -3
  148. package/dist/generated/abi/DataPortabilityGranteesImplementation.d.ts +2 -3
  149. package/dist/generated/abi/DataPortabilityPermissionsImplementation.cjs.map +1 -1
  150. package/dist/generated/abi/DataPortabilityPermissionsImplementation.d.ts +2 -3
  151. package/dist/generated/abi/DataPortabilityPermissionsImplementation.js.map +1 -1
  152. package/dist/generated/abi/DataPortabilityServersImplementation.cjs.map +1 -1
  153. package/dist/generated/abi/DataPortabilityServersImplementation.d.ts +2 -3
  154. package/dist/generated/abi/DataPortabilityServersImplementation.js.map +1 -1
  155. package/dist/generated/abi/DataRefinerRegistryImplementation.d.ts +2 -3
  156. package/dist/generated/abi/DataRegistryImplementation.d.ts +2 -3
  157. package/dist/generated/abi/QueryEngineImplementation.d.ts +2 -3
  158. package/dist/generated/abi/SwapHelperImplementation.d.ts +2 -3
  159. package/dist/generated/abi/TeePoolDedicatedGpuImplementation.d.ts +2 -3
  160. package/dist/generated/abi/TeePoolDedicatedStandardImplementation.d.ts +2 -3
  161. package/dist/generated/abi/TeePoolEphemeralStandardImplementation.d.ts +2 -3
  162. package/dist/generated/abi/TeePoolImplementation.d.ts +2 -3
  163. package/dist/generated/abi/TeePoolPersistentGpuImplementation.d.ts +2 -3
  164. package/dist/generated/abi/TeePoolPersistentStandardImplementation.d.ts +2 -3
  165. package/dist/generated/abi/TeePoolPhalaImplementation.d.ts +2 -3
  166. package/dist/generated/abi/VanaEpochImplementation.d.ts +2 -3
  167. package/dist/generated/abi/VanaPoolEntityImplementation.d.ts +2 -3
  168. package/dist/generated/abi/VanaPoolStakingImplementation.d.ts +2 -3
  169. package/dist/generated/abi/VanaPoolTreasuryImplementation.d.ts +2 -3
  170. package/dist/generated/abi/index.d.ts +37 -39
  171. package/dist/generated/event-types.d.ts +9 -10
  172. package/dist/generated/eventRegistry.d.ts +3 -7
  173. package/dist/generated/server/server-exports.d.ts +19 -21
  174. package/dist/generated/server/server.cjs.map +1 -1
  175. package/dist/generated/server/server.d.ts +113 -87
  176. package/dist/generated/subgraph.d.ts +329 -332
  177. package/dist/index.browser.d.ts +47 -96
  178. package/dist/index.browser.js +12 -0
  179. package/dist/index.browser.js.map +1 -1
  180. package/dist/index.cjs +3 -1
  181. package/dist/index.cjs.map +1 -1
  182. package/dist/index.d.ts +0 -2
  183. package/dist/index.js +3 -1
  184. package/dist/index.js.map +1 -1
  185. package/dist/index.node.cjs +9 -0
  186. package/dist/index.node.cjs.map +1 -1
  187. package/dist/index.node.d.ts +181 -87
  188. package/dist/index.node.js +10 -0
  189. package/dist/index.node.js.map +1 -1
  190. package/dist/node.d.ts +4 -2
  191. package/dist/platform/browser-only.d.ts +5 -8
  192. package/dist/platform/browser-only.test.d.ts +1 -0
  193. package/dist/platform/browser-safe.d.ts +6 -9
  194. package/dist/platform/browser-safe.test.d.ts +1 -0
  195. package/dist/platform/browser.cjs +7 -6
  196. package/dist/platform/browser.cjs.map +1 -1
  197. package/dist/platform/browser.d.ts +3 -6
  198. package/dist/platform/browser.js +19 -27
  199. package/dist/platform/browser.js.map +1 -1
  200. package/dist/platform/browser.test.d.ts +1 -0
  201. package/dist/platform/index.d.ts +11 -5
  202. package/dist/platform/interface.d.ts +6 -8
  203. package/dist/platform/node.d.ts +3 -7
  204. package/dist/platform/node.js +12 -19
  205. package/dist/platform/node.js.map +1 -1
  206. package/dist/platform/ports/openpgp-port.cjs +74 -0
  207. package/dist/platform/ports/openpgp-port.cjs.map +1 -0
  208. package/dist/platform/ports/openpgp-port.d.ts +13 -0
  209. package/dist/platform/ports/openpgp-port.js +59 -0
  210. package/dist/platform/ports/openpgp-port.js.map +1 -0
  211. package/dist/platform/ports/pgp-port.cjs +17 -0
  212. package/dist/platform/ports/pgp-port.cjs.map +1 -0
  213. package/dist/platform/ports/pgp-port.d.ts +35 -0
  214. package/dist/platform/ports/pgp-port.js +1 -0
  215. package/dist/platform/ports/pgp-port.js.map +1 -0
  216. package/dist/platform/shared/error-utils.d.ts +2 -4
  217. package/dist/platform/shared/pgp-utils.cjs +2 -2
  218. package/dist/platform/shared/pgp-utils.cjs.map +1 -1
  219. package/dist/platform/shared/pgp-utils.d.ts +3 -5
  220. package/dist/platform/shared/pgp-utils.js +2 -2
  221. package/dist/platform/shared/pgp-utils.js.map +1 -1
  222. package/dist/platform/shared/stream-utils.d.ts +1 -3
  223. package/dist/platform/utils.d.ts +6 -10
  224. package/dist/platform/utils.test.d.ts +1 -0
  225. package/dist/platform.browser.d.ts +9 -4
  226. package/dist/platform.d.ts +11 -5
  227. package/dist/platform.node.d.ts +10 -5
  228. package/dist/server/handler.cjs.map +1 -1
  229. package/dist/server/handler.d.ts +8 -227
  230. package/dist/server/handler.js.map +1 -1
  231. package/dist/storage/index.d.ts +56 -10
  232. package/dist/storage/manager.cjs +2 -2
  233. package/dist/storage/manager.cjs.map +1 -1
  234. package/dist/storage/manager.d.ts +2 -5
  235. package/dist/storage/manager.js +5 -12
  236. package/dist/storage/manager.js.map +1 -1
  237. package/dist/storage/providers/callback-storage.cjs +3 -3
  238. package/dist/storage/providers/callback-storage.cjs.map +1 -1
  239. package/dist/storage/providers/callback-storage.d.ts +3 -9
  240. package/dist/storage/providers/callback-storage.js +3 -3
  241. package/dist/storage/providers/callback-storage.js.map +1 -1
  242. package/dist/storage/providers/google-drive.cjs +2 -2
  243. package/dist/storage/providers/google-drive.cjs.map +1 -1
  244. package/dist/storage/providers/google-drive.d.ts +3 -7
  245. package/dist/storage/providers/google-drive.js +4 -7
  246. package/dist/storage/providers/google-drive.js.map +1 -1
  247. package/dist/storage/providers/google-drive.test.d.ts +1 -0
  248. package/dist/storage/providers/ipfs.cjs +5 -5
  249. package/dist/storage/providers/ipfs.cjs.map +1 -1
  250. package/dist/storage/providers/ipfs.d.ts +3 -6
  251. package/dist/storage/providers/ipfs.js +7 -10
  252. package/dist/storage/providers/ipfs.js.map +1 -1
  253. package/dist/storage/providers/pinata.cjs +6 -6
  254. package/dist/storage/providers/pinata.cjs.map +1 -1
  255. package/dist/storage/providers/pinata.d.ts +5 -8
  256. package/dist/storage/providers/pinata.js +8 -11
  257. package/dist/storage/providers/pinata.js.map +1 -1
  258. package/dist/storage/tests/callbackStorage.test.d.ts +1 -0
  259. package/dist/storage/tests/googleDriveStorage.test.d.ts +1 -0
  260. package/dist/storage/tests/ipfsStorage.test.d.ts +1 -0
  261. package/dist/storage/tests/pinataStorage.test.d.ts +1 -0
  262. package/dist/storage/tests/storageManager.test.d.ts +1 -0
  263. package/dist/tests/abi.test.d.ts +1 -0
  264. package/dist/tests/chains-definitions.test.d.ts +1 -0
  265. package/dist/tests/core-encryption.test.d.ts +1 -0
  266. package/dist/tests/core-extended.test.d.ts +1 -0
  267. package/dist/tests/core-generics-coverage.test.d.ts +1 -0
  268. package/dist/tests/coverage-boost.test.d.ts +1 -0
  269. package/dist/tests/crypto-cross-platform-compatibility.test.d.ts +1 -0
  270. package/dist/tests/data-addfile-permissions-schema.test.d.ts +1 -0
  271. package/dist/tests/data-additional-methods.test.d.ts +1 -0
  272. package/dist/tests/data-controller-edge-cases.test.d.ts +1 -0
  273. package/dist/tests/data-ipfs-gateways.test.d.ts +1 -0
  274. package/dist/tests/data-relayer.test.d.ts +1 -0
  275. package/dist/tests/data-schema-validation.test.d.ts +1 -0
  276. package/dist/tests/data-simple-methods.test.d.ts +1 -0
  277. package/dist/tests/data.test.d.ts +1 -0
  278. package/dist/tests/demo-integration.test.d.ts +1 -0
  279. package/dist/tests/demo-trusted-server-integration.test.d.ts +1 -0
  280. package/dist/tests/download-relayer.test.d.ts +1 -0
  281. package/dist/tests/dual-mode-permissions.test.d.ts +1 -0
  282. package/dist/tests/dual-mode-trusted-servers.test.d.ts +1 -0
  283. package/dist/tests/encryption-correct-implementation.test.d.ts +1 -0
  284. package/dist/tests/encryption-coverage.test.d.ts +1 -0
  285. package/dist/tests/encryption-edge-cases.test.d.ts +1 -0
  286. package/dist/tests/encryption-utils-updated.test.d.ts +1 -0
  287. package/dist/tests/errors-coverage.test.d.ts +1 -0
  288. package/dist/tests/errors.test.d.ts +1 -0
  289. package/dist/tests/factories/mockFactory.d.ts +316 -0
  290. package/dist/tests/fakes/FakeStorageManager.d.ts +200 -0
  291. package/dist/tests/fakes/FakeStorageManager.test.d.ts +1 -0
  292. package/dist/tests/fakes/FakeWaitForTransactionEvents.d.ts +170 -0
  293. package/dist/tests/fakes/FakeWaitForTransactionEvents.test.d.ts +1 -0
  294. package/dist/tests/fakes/fake-pgp-port.d.ts +13 -0
  295. package/dist/tests/grantValidation-edge-cases.test.d.ts +1 -0
  296. package/dist/tests/grantValidation-unreachable-branch.test.d.ts +1 -0
  297. package/dist/tests/helper-methods.test.d.ts +1 -0
  298. package/dist/tests/helpers/platformTestHelpers.d.ts +106 -0
  299. package/dist/tests/helpers/typedMocks.d.ts +64 -0
  300. package/dist/tests/index-browser.test.d.ts +1 -0
  301. package/dist/tests/index-node.test.d.ts +1 -0
  302. package/dist/tests/index.test.d.ts +1 -0
  303. package/dist/tests/mocks/platformAdapter.d.ts +12 -0
  304. package/dist/tests/new-permissions-methods.test.d.ts +1 -0
  305. package/dist/tests/no-buffer-browser.test.d.ts +1 -0
  306. package/dist/tests/permissions-grantee.test.d.ts +1 -0
  307. package/dist/tests/permissions-schema-validation.test.d.ts +1 -0
  308. package/dist/tests/permissions-server-files.test.d.ts +1 -0
  309. package/dist/tests/permissions-trust-servers.test.d.ts +1 -0
  310. package/dist/tests/permissions.test.d.ts +1 -0
  311. package/dist/tests/personal.test.d.ts +1 -0
  312. package/dist/tests/platform-browser.test.d.ts +1 -0
  313. package/dist/tests/platform-crypto-expanded.test.d.ts +1 -0
  314. package/dist/tests/platform-crypto.test.d.ts +1 -0
  315. package/dist/tests/platform-index.test.d.ts +1 -0
  316. package/dist/tests/platform-node.test.d.ts +1 -0
  317. package/dist/tests/platform-shared-utils.test.d.ts +1 -0
  318. package/dist/tests/platform-updated.test.d.ts +1 -0
  319. package/dist/tests/protocol-additional-methods.test.d.ts +1 -0
  320. package/dist/tests/protocol.test.d.ts +1 -0
  321. package/dist/tests/read-only-mode.test.d.ts +1 -0
  322. package/dist/tests/schemas.test.d.ts +1 -0
  323. package/dist/tests/server-handler.test.d.ts +1 -0
  324. package/dist/tests/setup.d.ts +7 -0
  325. package/dist/tests/signatureFormatter.test.d.ts +1 -0
  326. package/dist/tests/trusted-server-queries.test.d.ts +1 -0
  327. package/dist/tests/typedDataConverter.test.d.ts +1 -0
  328. package/dist/tests/types-contracts.test.d.ts +1 -0
  329. package/dist/tests/types-data.test.d.ts +1 -0
  330. package/dist/tests/types-external-apis.test.d.ts +1 -0
  331. package/dist/tests/types-generics.test.d.ts +1 -0
  332. package/dist/tests/types-permissions.test.d.ts +1 -0
  333. package/dist/tests/types-upload-params.test.d.ts +1 -0
  334. package/dist/tests/types.test.d.ts +1 -0
  335. package/dist/tests/utils-formatters.test.d.ts +1 -0
  336. package/dist/tests/utils-grantFiles-edge-cases.test.d.ts +1 -0
  337. package/dist/tests/utils-grantFiles-validation.test.d.ts +1 -0
  338. package/dist/tests/utils-grantFiles.test.d.ts +1 -0
  339. package/dist/tests/utils-grantValidation-consolidated.test.d.ts +1 -0
  340. package/dist/tests/utils-grants.test.d.ts +1 -0
  341. package/dist/tests/utils-ipfs-additional.test.d.ts +1 -0
  342. package/dist/tests/utils-ipfs.test.d.ts +4 -0
  343. package/dist/tests/utils-schemaValidation.test.d.ts +1 -0
  344. package/dist/tests/vana.test.d.ts +1 -0
  345. package/dist/tests/wallet-crypto-compatibility.test.d.ts +1 -0
  346. package/dist/types/blockchain.cjs.map +1 -1
  347. package/dist/types/blockchain.d.ts +13 -8
  348. package/dist/types/chains-additional.test.d.ts +1 -0
  349. package/dist/types/chains.d.ts +6 -9
  350. package/dist/types/config.cjs +10 -0
  351. package/dist/types/config.cjs.map +1 -1
  352. package/dist/types/config.d.ts +161 -54
  353. package/dist/types/config.js +8 -0
  354. package/dist/types/config.js.map +1 -1
  355. package/dist/types/contracts.cjs.map +1 -1
  356. package/dist/types/contracts.d.ts +8 -11
  357. package/dist/types/controller-context.cjs.map +1 -1
  358. package/dist/types/controller-context.d.ts +13 -20
  359. package/dist/types/data.cjs.map +1 -1
  360. package/dist/types/data.d.ts +107 -39
  361. package/dist/types/external-apis.d.ts +10 -12
  362. package/dist/types/generics.d.ts +35 -38
  363. package/dist/types/index.cjs +5 -4
  364. package/dist/types/index.cjs.map +1 -1
  365. package/dist/types/index.d.ts +20 -22
  366. package/dist/types/index.js +9 -2
  367. package/dist/types/index.js.map +1 -1
  368. package/dist/types/operations.cjs +2 -2
  369. package/dist/types/operations.cjs.map +1 -1
  370. package/dist/types/operations.d.ts +13 -17
  371. package/dist/types/operations.js +2 -2
  372. package/dist/types/operations.js.map +1 -1
  373. package/dist/types/permissions.d.ts +55 -58
  374. package/dist/types/personal.cjs.map +1 -1
  375. package/dist/types/personal.d.ts +6 -8
  376. package/dist/types/relayer.d.ts +15 -18
  377. package/dist/types/storage.d.ts +6 -8
  378. package/dist/types/storage.js +2 -5
  379. package/dist/types/storage.js.map +1 -1
  380. package/dist/types/transactionResults.d.ts +16 -18
  381. package/dist/types/utils.d.ts +21 -24
  382. package/dist/types.d.ts +4 -28
  383. package/dist/utils/__tests__/parseTransaction.test.d.ts +1 -0
  384. package/dist/utils/__tests__/pojo-serialization.test.d.ts +1 -0
  385. package/dist/utils/__tests__/signatureCache.test.d.ts +1 -0
  386. package/dist/utils/__tests__/transaction-edge-cases.test.d.ts +1 -0
  387. package/dist/utils/__tests__/transactionHelpers.test.d.ts +1 -0
  388. package/dist/utils/__tests__/urlResolver.test.d.ts +4 -0
  389. package/dist/utils/blockchain/registry.cjs +2 -2
  390. package/dist/utils/blockchain/registry.cjs.map +1 -1
  391. package/dist/utils/blockchain/registry.d.ts +6 -8
  392. package/dist/utils/blockchain/registry.js +2 -2
  393. package/dist/utils/blockchain/registry.js.map +1 -1
  394. package/dist/utils/blockchain/registry.test.d.ts +1 -0
  395. package/dist/utils/crypto-utils.cjs +0 -12
  396. package/dist/utils/crypto-utils.cjs.map +1 -1
  397. package/dist/utils/crypto-utils.d.ts +9 -27
  398. package/dist/utils/crypto-utils.js +0 -11
  399. package/dist/utils/crypto-utils.js.map +1 -1
  400. package/dist/utils/crypto-utils.test.d.ts +1 -0
  401. package/dist/utils/download.cjs +3 -3
  402. package/dist/utils/download.cjs.map +1 -1
  403. package/dist/utils/download.d.ts +13 -14
  404. package/dist/utils/download.js +2 -2
  405. package/dist/utils/download.js.map +1 -1
  406. package/dist/utils/encoding.cjs +1 -1
  407. package/dist/utils/encoding.cjs.map +1 -1
  408. package/dist/utils/encoding.d.ts +4 -6
  409. package/dist/utils/encoding.js +1 -1
  410. package/dist/utils/encoding.js.map +1 -1
  411. package/dist/utils/encoding.test.d.ts +1 -0
  412. package/dist/utils/encryption.cjs +16 -10
  413. package/dist/utils/encryption.cjs.map +1 -1
  414. package/dist/utils/encryption.d.ts +13 -17
  415. package/dist/utils/encryption.js +16 -10
  416. package/dist/utils/encryption.js.map +1 -1
  417. package/dist/utils/formatters.cjs +4 -2
  418. package/dist/utils/formatters.cjs.map +1 -1
  419. package/dist/utils/formatters.d.ts +4 -6
  420. package/dist/utils/formatters.js +4 -2
  421. package/dist/utils/formatters.js.map +1 -1
  422. package/dist/utils/grantFiles.cjs +7 -4
  423. package/dist/utils/grantFiles.cjs.map +1 -1
  424. package/dist/utils/grantFiles.d.ts +6 -10
  425. package/dist/utils/grantFiles.js +7 -4
  426. package/dist/utils/grantFiles.js.map +1 -1
  427. package/dist/utils/grantValidation.cjs +1 -1
  428. package/dist/utils/grantValidation.cjs.map +1 -1
  429. package/dist/utils/grantValidation.d.ts +14 -17
  430. package/dist/utils/grantValidation.js +1 -1
  431. package/dist/utils/grantValidation.js.map +1 -1
  432. package/dist/utils/grants.cjs +1 -1
  433. package/dist/utils/grants.cjs.map +1 -1
  434. package/dist/utils/grants.d.ts +10 -13
  435. package/dist/utils/grants.js +1 -1
  436. package/dist/utils/grants.js.map +1 -1
  437. package/dist/utils/ipfs.d.ts +8 -10
  438. package/dist/utils/lazy-import.cjs +4 -6
  439. package/dist/utils/lazy-import.cjs.map +1 -1
  440. package/dist/utils/lazy-import.d.ts +1 -3
  441. package/dist/utils/lazy-import.js +4 -6
  442. package/dist/utils/lazy-import.js.map +1 -1
  443. package/dist/utils/multicall.cjs +4 -2
  444. package/dist/utils/multicall.cjs.map +1 -1
  445. package/dist/utils/multicall.d.ts +5 -8
  446. package/dist/utils/multicall.js +4 -2
  447. package/dist/utils/multicall.js.map +1 -1
  448. package/dist/utils/parseTransactionPojo.cjs.map +1 -1
  449. package/dist/utils/parseTransactionPojo.d.ts +4 -10
  450. package/dist/utils/parseTransactionPojo.js.map +1 -1
  451. package/dist/utils/schemaValidation.cjs +5 -5
  452. package/dist/utils/schemaValidation.cjs.map +1 -1
  453. package/dist/utils/schemaValidation.d.ts +8 -12
  454. package/dist/utils/schemaValidation.js +7 -10
  455. package/dist/utils/schemaValidation.js.map +1 -1
  456. package/dist/utils/signatureCache.cjs +1 -2
  457. package/dist/utils/signatureCache.cjs.map +1 -1
  458. package/dist/utils/signatureCache.d.ts +4 -7
  459. package/dist/utils/signatureCache.js +4 -8
  460. package/dist/utils/signatureCache.js.map +1 -1
  461. package/dist/utils/signatureFormatter.cjs +6 -9
  462. package/dist/utils/signatureFormatter.cjs.map +1 -1
  463. package/dist/utils/signatureFormatter.d.ts +2 -5
  464. package/dist/utils/signatureFormatter.js +6 -9
  465. package/dist/utils/signatureFormatter.js.map +1 -1
  466. package/dist/utils/tests/multicall.test.d.ts +1 -0
  467. package/dist/utils/transactionHelpers.cjs.map +1 -1
  468. package/dist/utils/transactionHelpers.d.ts +5 -11
  469. package/dist/utils/transactionHelpers.js.map +1 -1
  470. package/dist/utils/typeGuards.cjs +109 -0
  471. package/dist/utils/typeGuards.cjs.map +1 -0
  472. package/dist/utils/typeGuards.d.ts +138 -0
  473. package/dist/utils/typeGuards.js +74 -0
  474. package/dist/utils/typeGuards.js.map +1 -0
  475. package/dist/utils/typedDataConverter.d.ts +3 -6
  476. package/dist/utils/urlResolver.cjs +1 -1
  477. package/dist/utils/urlResolver.cjs.map +1 -1
  478. package/dist/utils/urlResolver.d.ts +2 -4
  479. package/dist/utils/urlResolver.js +2 -2
  480. package/dist/utils/urlResolver.js.map +1 -1
  481. package/dist/utils/wallet.cjs +62 -0
  482. package/dist/utils/wallet.cjs.map +1 -0
  483. package/dist/utils/wallet.d.ts +32 -0
  484. package/dist/utils/wallet.js +36 -0
  485. package/dist/utils/wallet.js.map +1 -0
  486. package/dist/utils/withEvents.cjs.map +1 -1
  487. package/dist/utils/withEvents.d.ts +5 -12
  488. package/dist/utils/withEvents.js.map +1 -1
  489. package/package.json +22 -16
  490. package/dist/browser.d.cts +0 -2
  491. package/dist/chains/definitions.d.cts +0 -53
  492. package/dist/chains/index.d.cts +0 -2
  493. package/dist/chains.browser.cjs +0 -37
  494. package/dist/chains.browser.cjs.map +0 -1
  495. package/dist/chains.browser.d.cts +0 -2
  496. package/dist/chains.d.cts +0 -2
  497. package/dist/chains.node.d.cts +0 -2
  498. package/dist/config/addresses.d.cts +0 -401
  499. package/dist/config/chains.d.cts +0 -85
  500. package/dist/config/features.d.cts +0 -64
  501. package/dist/contracts/contractController.d.cts +0 -117
  502. package/dist/controllers/data.d.cts +0 -915
  503. package/dist/controllers/permissions.d.cts +0 -1383
  504. package/dist/controllers/protocol.d.cts +0 -188
  505. package/dist/controllers/schemas.d.cts +0 -260
  506. package/dist/controllers/server.d.cts +0 -230
  507. package/dist/core/apiClient.d.cts +0 -165
  508. package/dist/core/client.d.cts +0 -92
  509. package/dist/core/generics.d.cts +0 -120
  510. package/dist/core.d.cts +0 -493
  511. package/dist/crypto/ecies/__tests__/test-vectors.d.cts +0 -40
  512. package/dist/crypto/ecies/base.d.cts +0 -143
  513. package/dist/crypto/ecies/browser.d.cts +0 -48
  514. package/dist/crypto/ecies/constants.d.cts +0 -122
  515. package/dist/crypto/ecies/index.d.cts +0 -1
  516. package/dist/crypto/ecies/interface.d.cts +0 -176
  517. package/dist/crypto/ecies/node.d.cts +0 -50
  518. package/dist/crypto/ecies/test-vectors/eccrypto-vectors.d.cts +0 -76
  519. package/dist/crypto/ecies/test-vectors/eccrypto-vectors.d.ts +0 -76
  520. package/dist/crypto/ecies/utils.d.cts +0 -67
  521. package/dist/crypto/services/WalletKeyEncryptionService.d.cts +0 -92
  522. package/dist/diagnostics.d.cts +0 -26
  523. package/dist/errors.d.cts +0 -350
  524. package/dist/generated/abi/ComputeEngineImplementation.d.cts +0 -996
  525. package/dist/generated/abi/ComputeInstructionRegistryImplementation.d.cts +0 -545
  526. package/dist/generated/abi/DATFactoryImplementation.d.cts +0 -661
  527. package/dist/generated/abi/DATImplementation.d.cts +0 -693
  528. package/dist/generated/abi/DATPausableImplementation.d.cts +0 -1145
  529. package/dist/generated/abi/DATVotesImplementation.d.cts +0 -1095
  530. package/dist/generated/abi/DLPPerformanceImplementation.d.cts +0 -883
  531. package/dist/generated/abi/DLPRegistryImplementation.d.cts +0 -1123
  532. package/dist/generated/abi/DLPRegistryTreasuryImplementation.d.cts +0 -452
  533. package/dist/generated/abi/DLPRewardDeployerImplementation.d.cts +0 -714
  534. package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.d.cts +0 -452
  535. package/dist/generated/abi/DLPRewardSwapImplementation.d.cts +0 -706
  536. package/dist/generated/abi/DLPRootImplementation.d.cts +0 -1248
  537. package/dist/generated/abi/DLPTreasuryImplementation.d.cts +0 -452
  538. package/dist/generated/abi/DataLiquidityPoolImplementation.d.cts +0 -737
  539. package/dist/generated/abi/DataPortabilityGranteesImplementation.d.cts +0 -661
  540. package/dist/generated/abi/DataPortabilityPermissionsImplementation.d.cts +0 -989
  541. package/dist/generated/abi/DataPortabilityServersImplementation.d.cts +0 -1086
  542. package/dist/generated/abi/DataRefinerRegistryImplementation.d.cts +0 -737
  543. package/dist/generated/abi/DataRegistryImplementation.d.cts +0 -1014
  544. package/dist/generated/abi/QueryEngineImplementation.d.cts +0 -1001
  545. package/dist/generated/abi/SwapHelperImplementation.d.cts +0 -764
  546. package/dist/generated/abi/TeePoolDedicatedGpuImplementation.d.cts +0 -701
  547. package/dist/generated/abi/TeePoolDedicatedStandardImplementation.d.cts +0 -701
  548. package/dist/generated/abi/TeePoolEphemeralStandardImplementation.d.cts +0 -701
  549. package/dist/generated/abi/TeePoolImplementation.d.cts +0 -993
  550. package/dist/generated/abi/TeePoolPersistentGpuImplementation.d.cts +0 -701
  551. package/dist/generated/abi/TeePoolPersistentStandardImplementation.d.cts +0 -701
  552. package/dist/generated/abi/TeePoolPhalaImplementation.d.cts +0 -993
  553. package/dist/generated/abi/VanaEpochImplementation.d.cts +0 -900
  554. package/dist/generated/abi/VanaPoolEntityImplementation.d.cts +0 -934
  555. package/dist/generated/abi/VanaPoolStakingImplementation.d.cts +0 -693
  556. package/dist/generated/abi/VanaPoolTreasuryImplementation.d.cts +0 -394
  557. package/dist/generated/abi/index.d.cts +0 -26547
  558. package/dist/generated/event-types.d.cts +0 -855
  559. package/dist/generated/eventRegistry.d.cts +0 -18
  560. package/dist/generated/server/server-exports.d.cts +0 -21
  561. package/dist/generated/server/server.d.cts +0 -512
  562. package/dist/generated/subgraph.d.cts +0 -5981
  563. package/dist/index.browser.cjs +0 -151
  564. package/dist/index.browser.cjs.map +0 -1
  565. package/dist/index.browser.d.cts +0 -201
  566. package/dist/index.d.cts +0 -2
  567. package/dist/index.node.d.cts +0 -87
  568. package/dist/node.d.cts +0 -2
  569. package/dist/platform/browser-only.d.cts +0 -25
  570. package/dist/platform/browser-safe.d.cts +0 -32
  571. package/dist/platform/browser.d.cts +0 -74
  572. package/dist/platform/index.d.cts +0 -5
  573. package/dist/platform/interface.d.cts +0 -218
  574. package/dist/platform/node.d.cts +0 -27
  575. package/dist/platform/shared/error-utils.d.cts +0 -25
  576. package/dist/platform/shared/pgp-utils.d.cts +0 -61
  577. package/dist/platform/shared/stream-utils.d.cts +0 -16
  578. package/dist/platform/utils.d.cts +0 -53
  579. package/dist/platform.browser.cjs +0 -41
  580. package/dist/platform.browser.cjs.map +0 -1
  581. package/dist/platform.browser.d.cts +0 -4
  582. package/dist/platform.d.cts +0 -5
  583. package/dist/platform.node.d.cts +0 -5
  584. package/dist/schemas/dataSchema.schema.d.cts +0 -88
  585. package/dist/schemas/dataSchema.schema.d.ts +0 -88
  586. package/dist/schemas/grantFile.schema.d.cts +0 -57
  587. package/dist/schemas/grantFile.schema.d.ts +0 -57
  588. package/dist/server/handler.d.cts +0 -306
  589. package/dist/storage/index.d.cts +0 -10
  590. package/dist/storage/manager.d.cts +0 -150
  591. package/dist/storage/providers/callback-storage.d.cts +0 -100
  592. package/dist/storage/providers/google-drive.d.cts +0 -156
  593. package/dist/storage/providers/ipfs.d.cts +0 -163
  594. package/dist/storage/providers/pinata.d.cts +0 -173
  595. package/dist/types/blockchain.d.cts +0 -52
  596. package/dist/types/chains.d.cts +0 -34
  597. package/dist/types/config.d.cts +0 -726
  598. package/dist/types/contracts.d.cts +0 -68
  599. package/dist/types/controller-context.d.cts +0 -71
  600. package/dist/types/data.d.cts +0 -694
  601. package/dist/types/eccrypto-js.d.d.cts +0 -13
  602. package/dist/types/eccrypto-js.d.d.ts +0 -13
  603. package/dist/types/external-apis.d.cts +0 -186
  604. package/dist/types/generics.d.cts +0 -450
  605. package/dist/types/index.d.cts +0 -22
  606. package/dist/types/operations.d.cts +0 -116
  607. package/dist/types/permissions.d.cts +0 -957
  608. package/dist/types/personal.d.cts +0 -40
  609. package/dist/types/relayer.d.cts +0 -284
  610. package/dist/types/storage.d.cts +0 -131
  611. package/dist/types/transactionResults.d.cts +0 -195
  612. package/dist/types/utils.d.cts +0 -819
  613. package/dist/types.d.cts +0 -54
  614. package/dist/utils/blockchain/registry.d.cts +0 -34
  615. package/dist/utils/crypto-utils.d.cts +0 -118
  616. package/dist/utils/download.d.cts +0 -41
  617. package/dist/utils/encoding.d.cts +0 -54
  618. package/dist/utils/encryption.d.cts +0 -275
  619. package/dist/utils/formatters.d.cts +0 -120
  620. package/dist/utils/grantFiles.d.cts +0 -186
  621. package/dist/utils/grantValidation.d.cts +0 -150
  622. package/dist/utils/grants.d.cts +0 -70
  623. package/dist/utils/ipfs.d.cts +0 -90
  624. package/dist/utils/lazy-import.d.cts +0 -20
  625. package/dist/utils/multicall.d.cts +0 -129
  626. package/dist/utils/parseTransactionPojo.d.cts +0 -37
  627. package/dist/utils/schemaValidation.d.cts +0 -172
  628. package/dist/utils/signatureCache.d.cts +0 -134
  629. package/dist/utils/signatureFormatter.d.cts +0 -39
  630. package/dist/utils/transactionHelpers.d.cts +0 -86
  631. package/dist/utils/typedDataConverter.d.cts +0 -13
  632. package/dist/utils/urlResolver.d.cts +0 -40
  633. package/dist/utils/withEvents.d.cts +0 -63
@@ -18,9 +18,10 @@ import { validateGrant } from "../utils/grantValidation";
18
18
  import { withSignatureCache } from "../utils/signatureCache";
19
19
  import { formatSignatureForContract } from "../utils/signatureFormatter";
20
20
  import { toViemTypedDataDefinition } from "../utils/typedDataConverter";
21
- class PermissionsController {
21
+ import { BaseController } from "./base";
22
+ class PermissionsController extends BaseController {
22
23
  constructor(context) {
23
- this.context = context;
24
+ super(context);
24
25
  }
25
26
  /**
26
27
  * Grants permission for an application to access user data with gasless transactions.
@@ -57,6 +58,7 @@ class PermissionsController {
57
58
  * ```
58
59
  */
59
60
  async grant(params) {
61
+ this.assertWallet();
60
62
  const { typedData, signature } = await this.createAndSign(params);
61
63
  const result = await this.submitSignedGrantWithEvents(typedData, signature);
62
64
  return result;
@@ -87,6 +89,7 @@ class PermissionsController {
87
89
  * ```
88
90
  */
89
91
  async submitPermissionGrant(params) {
92
+ this.assertWallet();
90
93
  const { typedData, signature } = await this.createAndSign(params);
91
94
  return await this.submitSignedGrant(typedData, signature);
92
95
  }
@@ -116,6 +119,7 @@ class PermissionsController {
116
119
  * ```
117
120
  */
118
121
  async prepareGrant(params) {
122
+ this.assertWallet();
119
123
  try {
120
124
  const grantFile = createGrantFile(params);
121
125
  validateGrant(grantFile);
@@ -156,7 +160,7 @@ class PermissionsController {
156
160
  */
157
161
  async confirmGrantInternal(params, grantFile) {
158
162
  try {
159
- let grantUrl = params.grantUrl;
163
+ let { grantUrl } = params;
160
164
  console.debug("\u{1F50D} Debug - Grant URL from params:", grantUrl);
161
165
  if (!grantUrl) {
162
166
  if (!this.context.relayerCallbacks?.storeGrantFile && !this.context.storageManager) {
@@ -246,10 +250,11 @@ class PermissionsController {
246
250
  * ```
247
251
  */
248
252
  async createAndSign(params) {
253
+ this.assertWallet();
249
254
  try {
250
255
  const grantFile = createGrantFile(params);
251
256
  validateGrant(grantFile);
252
- let grantUrl = params.grantUrl;
257
+ let { grantUrl } = params;
253
258
  console.debug("\u{1F50D} Debug - Grant URL from params:", grantUrl);
254
259
  if (!grantUrl) {
255
260
  if (!this.context.relayerCallbacks?.storeGrantFile && !this.context.storageManager) {
@@ -337,7 +342,7 @@ class PermissionsController {
337
342
  "\u{1F50D} Debug - submitSignedGrant called with typed data:",
338
343
  JSON.stringify(
339
344
  typedData,
340
- (key, value) => typeof value === "bigint" ? value.toString() : value,
345
+ (_key, value) => typeof value === "bigint" ? value.toString() : value,
341
346
  2
342
347
  )
343
348
  );
@@ -346,7 +351,7 @@ class PermissionsController {
346
351
  typedData,
347
352
  signature
348
353
  );
349
- const account = this.context.walletClient.account || await this.getUserAddress();
354
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
350
355
  const { tx } = await import("../utils/transactionHelpers");
351
356
  return tx({
352
357
  hash,
@@ -398,11 +403,11 @@ class PermissionsController {
398
403
  trustServerInput,
399
404
  signature
400
405
  );
401
- const account = this.context.walletClient.account || await this.getUserAddress();
406
+ const account = this.context.userAddress;
402
407
  const { tx } = await import("../utils/transactionHelpers");
403
408
  return tx({
404
409
  hash,
405
- from: typeof account === "string" ? account : account.address,
410
+ from: account,
406
411
  contract: "DataPortabilityServers",
407
412
  fn: "trustServerWithSignature"
408
413
  });
@@ -463,7 +468,7 @@ class PermissionsController {
463
468
  addAndTrustServerInput,
464
469
  signature
465
470
  );
466
- const account = this.context.walletClient.account || await this.getUserAddress();
471
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
467
472
  const { tx } = await import("../utils/transactionHelpers");
468
473
  return tx({
469
474
  hash,
@@ -483,7 +488,7 @@ class PermissionsController {
483
488
  }
484
489
  /**
485
490
  * Internal method to submit a signed grant and wait for events.
486
- *
491
+ *
487
492
  * @internal
488
493
  * @param typedData - The EIP-712 typed data for the permission grant
489
494
  * @param signature - The user's signature authorizing the transaction
@@ -497,7 +502,9 @@ class PermissionsController {
497
502
  const result = await this.context.waitForTransactionEvents(txResult);
498
503
  const event = result.expectedEvents.PermissionAdded;
499
504
  if (!event) {
500
- throw new BlockchainError("PermissionAdded event not found in transaction");
505
+ throw new BlockchainError(
506
+ "PermissionAdded event not found in transaction"
507
+ );
501
508
  }
502
509
  const receipt = await this.context.publicClient.getTransactionReceipt({
503
510
  hash: result.hash
@@ -514,7 +521,7 @@ class PermissionsController {
514
521
  }
515
522
  /**
516
523
  * Internal method for confirm grant with events.
517
- *
524
+ *
518
525
  * @internal
519
526
  * @param params - The permission grant parameters
520
527
  * @param grantFile - The pre-created grant file object
@@ -528,7 +535,9 @@ class PermissionsController {
528
535
  const result = await this.context.waitForTransactionEvents(txResult);
529
536
  const event = result.expectedEvents.PermissionAdded;
530
537
  if (!event) {
531
- throw new BlockchainError("PermissionAdded event not found in transaction");
538
+ throw new BlockchainError(
539
+ "PermissionAdded event not found in transaction"
540
+ );
532
541
  }
533
542
  const receipt = await this.context.publicClient.getTransactionReceipt({
534
543
  hash: result.hash
@@ -543,34 +552,6 @@ class PermissionsController {
543
552
  fileIds: event.fileIds
544
553
  };
545
554
  }
546
- /**
547
- * Internal method to submit a signed revoke and wait for events.
548
- *
549
- * @internal
550
- * @param typedData - The EIP-712 typed data for the permission revoke
551
- * @param signature - The user's signature authorizing the transaction
552
- * @returns Promise resolving to PermissionRevokeResult with parsed events
553
- */
554
- async submitSignedRevokeWithEvents(typedData, signature) {
555
- const txResult = await this.submitSignedRevoke(typedData, signature);
556
- if (!this.context.waitForTransactionEvents) {
557
- throw new BlockchainError("waitForTransactionEvents not configured");
558
- }
559
- const result = await this.context.waitForTransactionEvents(txResult);
560
- const event = result.expectedEvents.PermissionRevoked;
561
- if (!event) {
562
- throw new BlockchainError("PermissionRevoked event not found in transaction");
563
- }
564
- const receipt = await this.context.publicClient.getTransactionReceipt({
565
- hash: result.hash
566
- });
567
- return {
568
- transactionHash: result.hash,
569
- blockNumber: receipt.blockNumber,
570
- gasUsed: receipt.gasUsed,
571
- permissionId: event.permissionId
572
- };
573
- }
574
555
  /**
575
556
  * Submits an already-signed permission revoke transaction to the blockchain.
576
557
  *
@@ -601,9 +582,12 @@ class PermissionsController {
601
582
  signature
602
583
  );
603
584
  } else {
604
- hash = await this.submitDirectRevokeTransaction(typedData, signature);
585
+ hash = await this.submitDirectRevokeTransaction(
586
+ typedData,
587
+ signature
588
+ );
605
589
  }
606
- const account = this.context.walletClient.account || await this.getUserAddress();
590
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
607
591
  const { tx } = await import("../utils/transactionHelpers");
608
592
  return tx({
609
593
  hash,
@@ -651,9 +635,12 @@ class PermissionsController {
651
635
  signature
652
636
  );
653
637
  } else {
654
- hash = await this.submitSignedUntrustTransaction(typedData, signature);
638
+ hash = await this.submitSignedUntrustTransaction(
639
+ typedData,
640
+ signature
641
+ );
655
642
  }
656
- const account = this.context.walletClient.account || await this.getUserAddress();
643
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
657
644
  const { tx } = await import("../utils/transactionHelpers");
658
645
  return tx({
659
646
  hash,
@@ -684,7 +671,8 @@ class PermissionsController {
684
671
  * @throws {BlockchainError} When contract submission fails
685
672
  */
686
673
  async submitDirectTransaction(typedData, signature) {
687
- const chainId = await this.context.walletClient.getChainId();
674
+ this.assertWallet();
675
+ const chainId = await this.context.publicClient.getChainId();
688
676
  const DataPortabilityPermissionsAddress = getContractAddress(
689
677
  chainId,
690
678
  "DataPortabilityPermissions"
@@ -704,17 +692,17 @@ class PermissionsController {
704
692
  console.debug("\u{1F50D} Debug - Grant field value:", typedData.message.grant);
705
693
  console.debug(
706
694
  "\u{1F50D} Debug - Grant field length:",
707
- typedData.message.grant?.length || 0
695
+ typedData.message.grant?.length ?? 0
708
696
  );
709
697
  const formattedSignature = formatSignatureForContract(signature);
710
- const account = this.context.walletClient.account || await this.getUserAddress();
698
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
711
699
  const txHash = await this.context.walletClient.writeContract({
712
700
  address: DataPortabilityPermissionsAddress,
713
701
  abi: DataPortabilityPermissionsAbi,
714
702
  functionName: "addPermission",
715
703
  args: [permissionInput, formattedSignature],
716
704
  account,
717
- chain: this.context.walletClient.chain || null
705
+ chain: this.context.walletClient?.chain ?? null
718
706
  });
719
707
  const { tx } = await import("../utils/transactionHelpers");
720
708
  return tx({
@@ -749,6 +737,7 @@ class PermissionsController {
749
737
  * ```
750
738
  */
751
739
  async revoke(params) {
740
+ this.assertWallet();
752
741
  const txResult = await this.submitPermissionRevoke(params);
753
742
  if (!this.context.waitForTransactionEvents) {
754
743
  throw new BlockchainError("waitForTransactionEvents not configured");
@@ -756,7 +745,9 @@ class PermissionsController {
756
745
  const result = await this.context.waitForTransactionEvents(txResult);
757
746
  const event = result.expectedEvents.PermissionRevoked;
758
747
  if (!event) {
759
- throw new BlockchainError("PermissionRevoked event not found in transaction");
748
+ throw new BlockchainError(
749
+ "PermissionRevoked event not found in transaction"
750
+ );
760
751
  }
761
752
  const receipt = await this.context.publicClient.getTransactionReceipt({
762
753
  hash: result.hash
@@ -788,11 +779,12 @@ class PermissionsController {
788
779
  * ```
789
780
  */
790
781
  async submitPermissionRevoke(params) {
782
+ this.assertWallet();
791
783
  try {
792
- if (!this.context.walletClient.chain?.id) {
784
+ if (!this.context.walletClient?.chain?.id) {
793
785
  throw new BlockchainError("Chain ID not available");
794
786
  }
795
- const chainId = await this.context.walletClient.getChainId();
787
+ const chainId = await this.context.publicClient.getChainId();
796
788
  const DataPortabilityPermissionsAddress = getContractAddress(
797
789
  chainId,
798
790
  "DataPortabilityPermissions"
@@ -800,14 +792,14 @@ class PermissionsController {
800
792
  const DataPortabilityPermissionsAbi = getAbi(
801
793
  "DataPortabilityPermissions"
802
794
  );
803
- const account = this.context.walletClient.account || await this.getUserAddress();
795
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
804
796
  const txHash = await this.context.walletClient.writeContract({
805
797
  address: DataPortabilityPermissionsAddress,
806
798
  abi: DataPortabilityPermissionsAbi,
807
799
  functionName: "revokePermission",
808
800
  args: [params.permissionId],
809
801
  account,
810
- chain: this.context.walletClient.chain || null
802
+ chain: this.context.walletClient?.chain ?? null
811
803
  });
812
804
  const { tx } = await import("../utils/transactionHelpers");
813
805
  return tx({
@@ -855,8 +847,9 @@ class PermissionsController {
855
847
  * ```
856
848
  */
857
849
  async submitRevokeWithSignature(params) {
850
+ this.assertWallet();
858
851
  try {
859
- if (!this.context.walletClient.chain?.id) {
852
+ if (!this.context.walletClient?.chain?.id) {
860
853
  throw new BlockchainError("Chain ID not available");
861
854
  }
862
855
  const nonce = await this.getPermissionsUserNonce();
@@ -883,9 +876,12 @@ class PermissionsController {
883
876
  signature
884
877
  );
885
878
  } else {
886
- hash = await this.submitDirectRevokeTransaction(typedData, signature);
879
+ hash = await this.submitDirectRevokeTransaction(
880
+ typedData,
881
+ signature
882
+ );
887
883
  }
888
- const account = this.context.walletClient.account || await this.getUserAddress();
884
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
889
885
  const { tx } = await import("../utils/transactionHelpers");
890
886
  return tx({
891
887
  hash,
@@ -900,64 +896,6 @@ class PermissionsController {
900
896
  );
901
897
  }
902
898
  }
903
- /**
904
- * @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
905
- *
906
- * Retrieves the user's current nonce from the DataPortabilityServers contract.
907
- * This method is deprecated in favor of more specific nonce methods.
908
- *
909
- * The nonce is used to prevent replay attacks in signed transactions and must
910
- * be incremented with each transaction to maintain security.
911
- *
912
- * @returns Promise resolving to the user's current nonce value as a bigint
913
- * @throws {Error} When wallet account is not available
914
- * @throws {Error} When chain ID is not available
915
- * @throws {NonceError} When reading nonce from contract fails
916
- * @private
917
- * @example
918
- * ```typescript
919
- * // Deprecated - use specific methods instead
920
- * const nonce = await this.getUserNonce();
921
- *
922
- * // Use these instead:
923
- * const permissionsNonce = await this.getPermissionsUserNonce();
924
- * const serversNonce = await this.getServersUserNonce();
925
- * ```
926
- */
927
- /**
928
- * @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
929
- *
930
- * Retrieves the user's current nonce from the DataPortabilityServers contract.
931
- *
932
- * @remarks
933
- * This method is deprecated in favor of more specific nonce methods that target
934
- * the appropriate contract for the operation being performed.
935
- *
936
- * @returns Promise resolving to the user's current nonce as a bigint
937
- * @throws {NonceError} When retrieving the nonce fails
938
- */
939
- async getUserNonce() {
940
- try {
941
- const userAddress = await this.getUserAddress();
942
- const chainId = await this.context.walletClient.getChainId();
943
- const DataPortabilityServersAddress = getContractAddress(
944
- chainId,
945
- "DataPortabilityServers"
946
- );
947
- const DataPortabilityServersAbi = getAbi("DataPortabilityServers");
948
- const nonce = await this.context.publicClient.readContract({
949
- address: DataPortabilityServersAddress,
950
- abi: DataPortabilityServersAbi,
951
- functionName: "userNonce",
952
- args: [userAddress]
953
- });
954
- return nonce;
955
- } catch (error) {
956
- throw new NonceError(
957
- `Failed to retrieve user nonce: ${error instanceof Error ? error.message : "Unknown error"}`
958
- );
959
- }
960
- }
961
899
  /**
962
900
  * Retrieves the user's current nonce from the DataPortabilityServers contract.
963
901
  * This nonce is used for server-related operations (AddAndTrustServer, TrustServer, UntrustServer).
@@ -984,8 +922,8 @@ class PermissionsController {
984
922
  */
985
923
  async getServersUserNonce() {
986
924
  try {
987
- const userAddress = await this.getUserAddress();
988
- const chainId = await this.context.walletClient.getChainId();
925
+ const userAddress = this.context.userAddress;
926
+ const chainId = await this.context.publicClient.getChainId();
989
927
  const DataPortabilityServersAddress = getContractAddress(
990
928
  chainId,
991
929
  "DataPortabilityServers"
@@ -1030,8 +968,8 @@ class PermissionsController {
1030
968
  */
1031
969
  async getPermissionsUserNonce() {
1032
970
  try {
1033
- const userAddress = await this.getUserAddress();
1034
- const chainId = await this.context.walletClient.getChainId();
971
+ const userAddress = this.context.userAddress;
972
+ const chainId = await this.context.publicClient.getChainId();
1035
973
  const DataPortabilityPermissionsAddress = getContractAddress(
1036
974
  chainId,
1037
975
  "DataPortabilityPermissions"
@@ -1070,7 +1008,7 @@ class PermissionsController {
1070
1008
  "\u{1F50D} Debug - Composing permission message with grantUrl:",
1071
1009
  params.grantUrl
1072
1010
  );
1073
- const chainId = await this.context.walletClient.getChainId();
1011
+ const chainId = await this.context.publicClient.getChainId();
1074
1012
  const DataPortabilityGranteesAddress = getContractAddress(
1075
1013
  chainId,
1076
1014
  "DataPortabilityGrantees"
@@ -1179,7 +1117,7 @@ class PermissionsController {
1179
1117
  * @returns Promise resolving to the EIP-712 domain configuration
1180
1118
  */
1181
1119
  async getPermissionDomain() {
1182
- const chainId = await this.context.walletClient.getChainId();
1120
+ const chainId = await this.context.publicClient.getChainId();
1183
1121
  const DataPortabilityPermissionsAddress = getContractAddress(
1184
1122
  chainId,
1185
1123
  "DataPortabilityPermissions"
@@ -1198,8 +1136,9 @@ class PermissionsController {
1198
1136
  * @returns Promise resolving to the cryptographic signature
1199
1137
  */
1200
1138
  async signTypedData(typedData) {
1139
+ this.assertWallet();
1201
1140
  try {
1202
- const walletAddress = this.context.walletClient.account?.address || await this.getUserAddress();
1141
+ const walletAddress = this.context.walletClient.account?.address ?? this.context.userAddress;
1203
1142
  return await withSignatureCache(
1204
1143
  this.context.platform.cache,
1205
1144
  walletAddress,
@@ -1208,9 +1147,9 @@ class PermissionsController {
1208
1147
  const viemCompatibleTypedData = toViemTypedDataDefinition(typedData);
1209
1148
  return await this.context.walletClient.signTypedData({
1210
1149
  ...viemCompatibleTypedData,
1211
- // Non-null assertion is safe here because getUserAddress() above ensures account exists
1212
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1213
- account: this.context.walletClient.account
1150
+ // Use the account if available, otherwise use the wallet address
1151
+ // This follows the same pattern used throughout this file
1152
+ account: this.context.walletClient.account ?? walletAddress
1214
1153
  });
1215
1154
  }
1216
1155
  );
@@ -1225,17 +1164,10 @@ class PermissionsController {
1225
1164
  }
1226
1165
  }
1227
1166
  /**
1228
- * Gets the user's address from the wallet client.
1167
+ * Gets the user's address from the context.
1229
1168
  *
1230
- * @returns Promise resolving to the user's wallet address
1169
+ * @returns The user's address
1231
1170
  */
1232
- async getUserAddress() {
1233
- const addresses = await this.context.walletClient.getAddresses();
1234
- if (addresses.length === 0) {
1235
- throw new BlockchainError("No addresses available in wallet client");
1236
- }
1237
- return addresses[0];
1238
- }
1239
1171
  /**
1240
1172
  * Gets on-chain permission grant data without expensive off-chain resolution.
1241
1173
  *
@@ -1274,8 +1206,8 @@ class PermissionsController {
1274
1206
  async getUserPermissionGrantsOnChain(options = {}) {
1275
1207
  const { limit = 50, subgraphUrl } = options;
1276
1208
  try {
1277
- const userAddress = await this.getUserAddress();
1278
- const graphqlEndpoint = subgraphUrl || this.context.subgraphUrl;
1209
+ const userAddress = this.context.userAddress;
1210
+ const graphqlEndpoint = subgraphUrl ?? this.context.subgraphUrl;
1279
1211
  if (!graphqlEndpoint) {
1280
1212
  throw new BlockchainError(
1281
1213
  "subgraphUrl is required. Please provide a valid subgraph endpoint or configure it in Vana constructor."
@@ -1327,7 +1259,7 @@ class PermissionsController {
1327
1259
  );
1328
1260
  }
1329
1261
  const userData = result.data?.user;
1330
- if (!userData || !userData.permissions?.length) {
1262
+ if (!userData?.permissions?.length) {
1331
1263
  return [];
1332
1264
  }
1333
1265
  const onChainGrants = userData.permissions.slice(0, limit).map(
@@ -1338,8 +1270,8 @@ class PermissionsController {
1338
1270
  nonce: BigInt(permission.nonce),
1339
1271
  startBlock: BigInt(permission.startBlock),
1340
1272
  addedAtBlock: BigInt(permission.addedAtBlock),
1341
- addedAtTimestamp: BigInt(permission.addedAtTimestamp || "0"),
1342
- transactionHash: permission.transactionHash || "",
1273
+ addedAtTimestamp: BigInt(permission.addedAtTimestamp ?? "0"),
1274
+ transactionHash: permission.transactionHash ?? "",
1343
1275
  grantor: userAddress,
1344
1276
  grantee: permission.grantee,
1345
1277
  active: !permission.endBlock || BigInt(permission.endBlock) === 0n
@@ -1360,26 +1292,6 @@ class PermissionsController {
1360
1292
  );
1361
1293
  }
1362
1294
  }
1363
- /**
1364
- * Normalizes grant ID to hex format.
1365
- * Handles conversion from permission ID (bigint/number/string) to proper hex hash format.
1366
- *
1367
- * @param grantId - Permission ID or grant hash in various formats
1368
- * @returns Normalized hex hash
1369
- */
1370
- normalizeGrantId(grantId) {
1371
- if (typeof grantId === "string" && grantId.startsWith("0x") && grantId.length === 66) {
1372
- return grantId;
1373
- }
1374
- try {
1375
- const bigIntId = BigInt(grantId);
1376
- return `0x${bigIntId.toString(16).padStart(64, "0")}`;
1377
- } catch {
1378
- throw new Error(
1379
- `Invalid grant ID format: ${grantId}. Must be a permission ID (number/bigint/string) or a 32-byte hex hash.`
1380
- );
1381
- }
1382
- }
1383
1295
  /**
1384
1296
  * Registers a new server and immediately trusts it in the DataPortabilityServers contract.
1385
1297
  *
@@ -1388,7 +1300,6 @@ class PermissionsController {
1388
1300
  * Trusted servers can handle data export and portability requests from the user.
1389
1301
  *
1390
1302
  * @param params - Parameters for adding and trusting the server
1391
- * @param params.owner - Ethereum address that will own this server registration
1392
1303
  * @param params.serverAddress - Ethereum address of the server
1393
1304
  * @param params.serverUrl - HTTPS URL where the server can be reached
1394
1305
  * @param params.publicKey - Server's public key for encryption (hex string)
@@ -1415,6 +1326,7 @@ class PermissionsController {
1415
1326
  * ```
1416
1327
  */
1417
1328
  async addAndTrustServer(params) {
1329
+ this.assertWallet();
1418
1330
  try {
1419
1331
  const chainId = await this.context.walletClient.getChainId();
1420
1332
  const DataPortabilityServersAddress = getContractAddress(
@@ -1422,7 +1334,7 @@ class PermissionsController {
1422
1334
  "DataPortabilityServers"
1423
1335
  );
1424
1336
  const DataPortabilityServersAbi = getAbi("DataPortabilityServers");
1425
- const account = this.context.walletClient.account || await this.getUserAddress();
1337
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
1426
1338
  const userAddress = typeof account === "string" ? account : account.address;
1427
1339
  const normalizedUserAddress = getAddress(userAddress);
1428
1340
  const normalizedServerAddress = getAddress(params.serverAddress);
@@ -1439,7 +1351,7 @@ class PermissionsController {
1439
1351
  }
1440
1352
  ],
1441
1353
  account,
1442
- chain: this.context.walletClient.chain || null
1354
+ chain: this.context.walletClient?.chain ?? null
1443
1355
  });
1444
1356
  const { tx } = await import("../utils/transactionHelpers");
1445
1357
  const txResult = tx({
@@ -1454,9 +1366,13 @@ class PermissionsController {
1454
1366
  const result = await this.context.waitForTransactionEvents(txResult);
1455
1367
  const event = result.expectedEvents.ServerTrusted;
1456
1368
  if (!event) {
1457
- throw new BlockchainError("ServerTrusted event not found in transaction");
1369
+ throw new BlockchainError(
1370
+ "ServerTrusted event not found in transaction"
1371
+ );
1458
1372
  }
1459
- const receipt = await this.context.publicClient.getTransactionReceipt({ hash: txHash });
1373
+ const receipt = await this.context.publicClient.getTransactionReceipt({
1374
+ hash: txHash
1375
+ });
1460
1376
  return {
1461
1377
  transactionHash: txHash,
1462
1378
  blockNumber: receipt.blockNumber,
@@ -1487,6 +1403,7 @@ class PermissionsController {
1487
1403
  * @deprecated Use addAndTrustServer instead
1488
1404
  */
1489
1405
  async submitTrustServer(params) {
1406
+ this.assertWallet();
1490
1407
  try {
1491
1408
  const chainId = await this.context.walletClient.getChainId();
1492
1409
  const DataPortabilityServersAddress = getContractAddress(
@@ -1494,14 +1411,14 @@ class PermissionsController {
1494
1411
  "DataPortabilityServers"
1495
1412
  );
1496
1413
  const DataPortabilityServersAbi = getAbi("DataPortabilityServers");
1497
- const account = this.context.walletClient.account || await this.getUserAddress();
1414
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
1498
1415
  const txHash = await this.context.walletClient.writeContract({
1499
1416
  address: DataPortabilityServersAddress,
1500
1417
  abi: DataPortabilityServersAbi,
1501
1418
  functionName: "trustServer",
1502
1419
  args: [BigInt(params.serverId)],
1503
1420
  account,
1504
- chain: this.context.walletClient.chain || null
1421
+ chain: this.context.walletClient?.chain ?? null
1505
1422
  });
1506
1423
  const { tx } = await import("../utils/transactionHelpers");
1507
1424
  return tx({
@@ -1527,6 +1444,7 @@ class PermissionsController {
1527
1444
  * @returns Promise resolving to TransactionResult with ServerTrustResult event data
1528
1445
  */
1529
1446
  async submitAddAndTrustServerWithSignature(params) {
1447
+ this.assertWallet();
1530
1448
  try {
1531
1449
  const nonce = await this.getServersUserNonce();
1532
1450
  const serverAddress = getAddress(params.serverAddress);
@@ -1561,7 +1479,7 @@ class PermissionsController {
1561
1479
  signature
1562
1480
  );
1563
1481
  }
1564
- const account = this.context.walletClient.account || await this.getUserAddress();
1482
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
1565
1483
  const { tx } = await import("../utils/transactionHelpers");
1566
1484
  return tx({
1567
1485
  hash,
@@ -1598,6 +1516,7 @@ class PermissionsController {
1598
1516
  * @throws {BlockchainError} When trust operation fails for any other reason
1599
1517
  */
1600
1518
  async submitTrustServerWithSignature(params) {
1519
+ this.assertWallet();
1601
1520
  try {
1602
1521
  const nonce = await this.getServersUserNonce();
1603
1522
  const trustServerInput = {
@@ -1618,7 +1537,7 @@ class PermissionsController {
1618
1537
  signature
1619
1538
  );
1620
1539
  }
1621
- const account = this.context.walletClient.account || await this.getUserAddress();
1540
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
1622
1541
  const { tx } = await import("../utils/transactionHelpers");
1623
1542
  return tx({
1624
1543
  hash,
@@ -1657,6 +1576,7 @@ class PermissionsController {
1657
1576
  * @throws {BlockchainError} When contract submission fails
1658
1577
  */
1659
1578
  async submitDirectUntrustTransaction(params) {
1579
+ this.assertWallet();
1660
1580
  try {
1661
1581
  const chainId = await this.context.walletClient.getChainId();
1662
1582
  const DataPortabilityServersAddress = getContractAddress(
@@ -1664,14 +1584,14 @@ class PermissionsController {
1664
1584
  "DataPortabilityServers"
1665
1585
  );
1666
1586
  const DataPortabilityServersAbi = getAbi("DataPortabilityServers");
1667
- const account = this.context.walletClient.account || await this.getUserAddress();
1587
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
1668
1588
  const txHash = await this.context.walletClient.writeContract({
1669
1589
  address: DataPortabilityServersAddress,
1670
1590
  abi: DataPortabilityServersAbi,
1671
1591
  functionName: "untrustServer",
1672
1592
  args: [BigInt(params.serverId)],
1673
1593
  account,
1674
- chain: this.context.walletClient.chain || null
1594
+ chain: this.context.walletClient?.chain ?? null
1675
1595
  });
1676
1596
  const { tx } = await import("../utils/transactionHelpers");
1677
1597
  return tx({
@@ -1719,6 +1639,7 @@ class PermissionsController {
1719
1639
  * ```
1720
1640
  */
1721
1641
  async submitUntrustServer(params) {
1642
+ this.assertWallet();
1722
1643
  const nonce = await this.getServersUserNonce();
1723
1644
  const untrustServerInput = {
1724
1645
  nonce,
@@ -1739,6 +1660,7 @@ class PermissionsController {
1739
1660
  * @throws {BlockchainError} When untrust transaction fails
1740
1661
  */
1741
1662
  async submitUntrustServerWithSignature(params) {
1663
+ this.assertWallet();
1742
1664
  try {
1743
1665
  const nonce = await this.getServersUserNonce();
1744
1666
  const untrustServerInput = {
@@ -1756,7 +1678,7 @@ class PermissionsController {
1756
1678
  } else {
1757
1679
  hash = await this.submitSignedUntrustTransaction(typedData, signature);
1758
1680
  }
1759
- const account = this.context.walletClient.account || await this.getUserAddress();
1681
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
1760
1682
  const { tx } = await import("../utils/transactionHelpers");
1761
1683
  return tx({
1762
1684
  hash,
@@ -1801,8 +1723,8 @@ class PermissionsController {
1801
1723
  */
1802
1724
  async getTrustedServers(userAddress) {
1803
1725
  try {
1804
- const user = userAddress || await this.getUserAddress();
1805
- const chainId = await this.context.walletClient.getChainId();
1726
+ const user = userAddress ?? this.context.userAddress;
1727
+ const chainId = await this.context.publicClient.getChainId();
1806
1728
  const DataPortabilityServersAddress = getContractAddress(
1807
1729
  chainId,
1808
1730
  "DataPortabilityServers"
@@ -1831,8 +1753,8 @@ class PermissionsController {
1831
1753
  */
1832
1754
  async getTrustedServersCount(userAddress) {
1833
1755
  try {
1834
- const user = userAddress || await this.getUserAddress();
1835
- const chainId = await this.context.walletClient.getChainId();
1756
+ const user = userAddress ?? this.context.userAddress;
1757
+ const chainId = await this.context.publicClient.getChainId();
1836
1758
  const DataPortabilityServersAddress = getContractAddress(
1837
1759
  chainId,
1838
1760
  "DataPortabilityServers"
@@ -1861,10 +1783,10 @@ class PermissionsController {
1861
1783
  */
1862
1784
  async getTrustedServersPaginated(options = {}) {
1863
1785
  try {
1864
- const user = options.userAddress || await this.getUserAddress();
1865
- const limit = options.limit || 50;
1866
- const offset = options.offset || 0;
1867
- const chainId = await this.context.walletClient.getChainId();
1786
+ const user = options.userAddress ?? this.context.userAddress;
1787
+ const limit = options.limit ?? 50;
1788
+ const offset = options.offset ?? 0;
1789
+ const chainId = await this.context.publicClient.getChainId();
1868
1790
  const DataPortabilityServersAddress = getContractAddress(
1869
1791
  chainId,
1870
1792
  "DataPortabilityServers"
@@ -2010,7 +1932,7 @@ class PermissionsController {
2010
1932
  };
2011
1933
  }
2012
1934
  try {
2013
- const chainId = await this.context.walletClient.getChainId();
1935
+ const chainId = await this.context.publicClient.getChainId();
2014
1936
  const DataPortabilityServersAddress = getContractAddress(
2015
1937
  chainId,
2016
1938
  "DataPortabilityServers"
@@ -2085,7 +2007,7 @@ class PermissionsController {
2085
2007
  */
2086
2008
  async checkServerTrustStatus(serverId, userAddress) {
2087
2009
  try {
2088
- const user = userAddress || await this.getUserAddress();
2010
+ const user = userAddress ?? this.context.userAddress;
2089
2011
  const trustedServers = await this.getTrustedServers(user);
2090
2012
  const trustIndex = trustedServers.findIndex(
2091
2013
  (server) => server === serverId
@@ -2175,7 +2097,7 @@ class PermissionsController {
2175
2097
  * @returns Promise resolving to the EIP-712 domain configuration
2176
2098
  */
2177
2099
  async getServersDomain() {
2178
- const chainId = await this.context.walletClient.getChainId();
2100
+ const chainId = await this.context.publicClient.getChainId();
2179
2101
  const DataPortabilityServersAddress = getContractAddress(
2180
2102
  chainId,
2181
2103
  "DataPortabilityServers"
@@ -2195,6 +2117,7 @@ class PermissionsController {
2195
2117
  * @returns Promise resolving to the transaction hash
2196
2118
  */
2197
2119
  async submitAddAndTrustServerTransaction(addAndTrustServerInput, signature) {
2120
+ this.assertWallet();
2198
2121
  const chainId = await this.context.walletClient.getChainId();
2199
2122
  const DataPortabilityServersAddress = getContractAddress(
2200
2123
  chainId,
@@ -2226,8 +2149,8 @@ class PermissionsController {
2226
2149
  },
2227
2150
  formattedSignature
2228
2151
  ],
2229
- account: this.context.walletClient.account || await this.getUserAddress(),
2230
- chain: this.context.walletClient.chain || null
2152
+ account: this.context.walletClient?.account ?? this.context.userAddress,
2153
+ chain: this.context.walletClient?.chain ?? null
2231
2154
  });
2232
2155
  return txHash;
2233
2156
  }
@@ -2239,6 +2162,7 @@ class PermissionsController {
2239
2162
  * @returns Promise resolving to the transaction hash
2240
2163
  */
2241
2164
  async submitTrustServerTransaction(trustServerInput, signature) {
2165
+ this.assertWallet();
2242
2166
  const chainId = await this.context.walletClient.getChainId();
2243
2167
  const DataPortabilityServersAddress = getContractAddress(
2244
2168
  chainId,
@@ -2257,8 +2181,8 @@ class PermissionsController {
2257
2181
  },
2258
2182
  formattedSignature
2259
2183
  ],
2260
- account: this.context.walletClient.account || await this.getUserAddress(),
2261
- chain: this.context.walletClient.chain || null
2184
+ account: this.context.walletClient?.account ?? this.context.userAddress,
2185
+ chain: this.context.walletClient?.chain ?? null
2262
2186
  });
2263
2187
  return txHash;
2264
2188
  }
@@ -2270,6 +2194,7 @@ class PermissionsController {
2270
2194
  * @returns Promise resolving to the transaction hash
2271
2195
  */
2272
2196
  async submitDirectRevokeTransaction(typedData, signature) {
2197
+ this.assertWallet();
2273
2198
  const chainId = await this.context.walletClient.getChainId();
2274
2199
  const DataPortabilityPermissionsAddress = getContractAddress(
2275
2200
  chainId,
@@ -2281,10 +2206,9 @@ class PermissionsController {
2281
2206
  address: DataPortabilityPermissionsAddress,
2282
2207
  abi: DataPortabilityPermissionsAbi,
2283
2208
  functionName: "revokePermissionWithSignature",
2284
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2285
2209
  args: [typedData.message, formattedSignature],
2286
- account: this.context.walletClient.account || await this.getUserAddress(),
2287
- chain: this.context.walletClient.chain || null
2210
+ account: this.context.walletClient?.account ?? this.context.userAddress,
2211
+ chain: this.context.walletClient?.chain ?? null
2288
2212
  });
2289
2213
  return txHash;
2290
2214
  }
@@ -2296,6 +2220,7 @@ class PermissionsController {
2296
2220
  * @returns Promise resolving to the transaction hash
2297
2221
  */
2298
2222
  async submitSignedUntrustTransaction(typedData, signature) {
2223
+ this.assertWallet();
2299
2224
  const chainId = await this.context.walletClient.getChainId();
2300
2225
  const DataPortabilityServersAddress = getContractAddress(
2301
2226
  chainId,
@@ -2303,14 +2228,17 @@ class PermissionsController {
2303
2228
  );
2304
2229
  const DataPortabilityServersAbi = getAbi("DataPortabilityServers");
2305
2230
  const formattedSignature = formatSignatureForContract(signature);
2231
+ const contractMessage = {
2232
+ nonce: typedData.message.nonce,
2233
+ serverId: BigInt(typedData.message.serverId)
2234
+ };
2306
2235
  const txHash = await this.context.walletClient.writeContract({
2307
2236
  address: DataPortabilityServersAddress,
2308
2237
  abi: DataPortabilityServersAbi,
2309
2238
  functionName: "untrustServerWithSignature",
2310
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2311
- args: [typedData.message, formattedSignature],
2312
- account: this.context.walletClient.account || await this.getUserAddress(),
2313
- chain: this.context.walletClient.chain || null
2239
+ args: [contractMessage, formattedSignature],
2240
+ account: this.context.walletClient?.account ?? this.context.userAddress,
2241
+ chain: this.context.walletClient?.chain ?? null
2314
2242
  });
2315
2243
  return txHash;
2316
2244
  }
@@ -2343,6 +2271,7 @@ class PermissionsController {
2343
2271
  * ```
2344
2272
  */
2345
2273
  async submitRegisterGrantee(params) {
2274
+ this.assertWallet();
2346
2275
  const chainId = await this.context.walletClient.getChainId();
2347
2276
  const DataPortabilityGranteesAddress = getContractAddress(
2348
2277
  chainId,
@@ -2351,14 +2280,14 @@ class PermissionsController {
2351
2280
  const DataPortabilityGranteesAbi = getAbi("DataPortabilityGrantees");
2352
2281
  const ownerAddress = getAddress(params.owner);
2353
2282
  const granteeAddress = getAddress(params.granteeAddress);
2354
- const account = this.context.walletClient.account || await this.getUserAddress();
2283
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
2355
2284
  const txHash = await this.context.walletClient.writeContract({
2356
2285
  address: DataPortabilityGranteesAddress,
2357
2286
  abi: DataPortabilityGranteesAbi,
2358
2287
  functionName: "registerGrantee",
2359
2288
  args: [ownerAddress, granteeAddress, params.publicKey],
2360
2289
  account,
2361
- chain: this.context.walletClient.chain || null
2290
+ chain: this.context.walletClient?.chain ?? null
2362
2291
  });
2363
2292
  const { tx } = await import("../utils/transactionHelpers");
2364
2293
  return tx({
@@ -2384,6 +2313,7 @@ class PermissionsController {
2384
2313
  * ```
2385
2314
  */
2386
2315
  async submitRegisterGranteeWithSignature(params) {
2316
+ this.assertWallet();
2387
2317
  const nonce = await this.getServersUserNonce();
2388
2318
  const owner = getAddress(params.owner);
2389
2319
  const granteeAddress = getAddress(params.granteeAddress);
@@ -2399,7 +2329,7 @@ class PermissionsController {
2399
2329
  typedData,
2400
2330
  signature
2401
2331
  );
2402
- const account = this.context.walletClient.account || await this.getUserAddress();
2332
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
2403
2333
  const { tx } = await import("../utils/transactionHelpers");
2404
2334
  return tx({
2405
2335
  hash,
@@ -2425,7 +2355,7 @@ class PermissionsController {
2425
2355
  typedData,
2426
2356
  signature
2427
2357
  );
2428
- const account = this.context.walletClient.account || await this.getUserAddress();
2358
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
2429
2359
  const { tx } = await import("../utils/transactionHelpers");
2430
2360
  return tx({
2431
2361
  hash,
@@ -2479,8 +2409,8 @@ class PermissionsController {
2479
2409
  functionName: "granteesCount"
2480
2410
  });
2481
2411
  const total = Number(totalCount);
2482
- const limit = options.limit || 50;
2483
- const offset = options.offset || 0;
2412
+ const limit = options.limit ?? 50;
2413
+ const offset = options.offset ?? 0;
2484
2414
  const grantees = [];
2485
2415
  const endIndex = Math.min(offset + limit, total);
2486
2416
  for (let i = offset; i < endIndex; i++) {
@@ -2628,7 +2558,7 @@ class PermissionsController {
2628
2558
  * @private
2629
2559
  */
2630
2560
  async buildRegisterGranteeTypedData(input) {
2631
- const chainId = await this.context.walletClient.getChainId();
2561
+ const chainId = await this.context.publicClient.getChainId();
2632
2562
  const verifyingContract = getContractAddress(
2633
2563
  chainId,
2634
2564
  "DataPortabilityGrantees"
@@ -2661,6 +2591,7 @@ class PermissionsController {
2661
2591
  * @private
2662
2592
  */
2663
2593
  async submitSignedRegisterGranteeTransaction(typedData, _signature) {
2594
+ this.assertWallet();
2664
2595
  const chainId = await this.context.walletClient.getChainId();
2665
2596
  const DataPortabilityGranteesAddress = getContractAddress(
2666
2597
  chainId,
@@ -2676,8 +2607,8 @@ class PermissionsController {
2676
2607
  typedData.message.granteeAddress,
2677
2608
  typedData.message.publicKey
2678
2609
  ],
2679
- account: this.context.walletClient.account || await this.getUserAddress(),
2680
- chain: this.context.walletClient.chain || null
2610
+ account: this.context.walletClient?.account ?? this.context.userAddress,
2611
+ chain: this.context.walletClient?.chain ?? null
2681
2612
  });
2682
2613
  return txHash;
2683
2614
  }
@@ -2692,7 +2623,7 @@ class PermissionsController {
2692
2623
  */
2693
2624
  async getUserServerIds(userAddress) {
2694
2625
  try {
2695
- const targetAddress = userAddress || await this.getUserAddress();
2626
+ const targetAddress = userAddress ?? this.context.userAddress;
2696
2627
  const chainId = await this.context.publicClient.getChainId();
2697
2628
  const DataPortabilityServersAddress = getContractAddress(
2698
2629
  chainId,
@@ -2750,7 +2681,7 @@ class PermissionsController {
2750
2681
  */
2751
2682
  async getUserServerCount(userAddress) {
2752
2683
  try {
2753
- const targetAddress = userAddress || await this.getUserAddress();
2684
+ const targetAddress = userAddress ?? this.context.userAddress;
2754
2685
  const chainId = await this.context.publicClient.getChainId();
2755
2686
  const DataPortabilityServersAddress = getContractAddress(
2756
2687
  chainId,
@@ -2779,7 +2710,7 @@ class PermissionsController {
2779
2710
  */
2780
2711
  async getUserTrustedServers(userAddress) {
2781
2712
  try {
2782
- const targetAddress = userAddress || await this.getUserAddress();
2713
+ const targetAddress = userAddress ?? this.context.userAddress;
2783
2714
  const chainId = await this.context.publicClient.getChainId();
2784
2715
  const DataPortabilityServersAddress = getContractAddress(
2785
2716
  chainId,
@@ -2896,7 +2827,7 @@ class PermissionsController {
2896
2827
  */
2897
2828
  async getUserPermissionIds(userAddress) {
2898
2829
  try {
2899
- const targetAddress = userAddress || await this.getUserAddress();
2830
+ const targetAddress = userAddress ?? this.context.userAddress;
2900
2831
  const chainId = await this.context.publicClient.getChainId();
2901
2832
  const DataPortabilityPermissionsAddress = getContractAddress(
2902
2833
  chainId,
@@ -2958,7 +2889,7 @@ class PermissionsController {
2958
2889
  */
2959
2890
  async getUserPermissionCount(userAddress) {
2960
2891
  try {
2961
- const targetAddress = userAddress || await this.getUserAddress();
2892
+ const targetAddress = userAddress ?? this.context.userAddress;
2962
2893
  const chainId = await this.context.publicClient.getChainId();
2963
2894
  const DataPortabilityPermissionsAddress = getContractAddress(
2964
2895
  chainId,
@@ -3403,6 +3334,7 @@ class PermissionsController {
3403
3334
  * @returns Promise resolving to transaction hash
3404
3335
  */
3405
3336
  async submitUpdateServer(serverId, url) {
3337
+ this.assertWallet();
3406
3338
  try {
3407
3339
  const chainId = await this.context.walletClient.getChainId();
3408
3340
  const DataPortabilityServersAddress = getContractAddress(
@@ -3410,13 +3342,13 @@ class PermissionsController {
3410
3342
  "DataPortabilityServers"
3411
3343
  );
3412
3344
  const DataPortabilityServersAbi = getAbi("DataPortabilityServers");
3413
- const account = this.context.walletClient.account || await this.getUserAddress();
3345
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
3414
3346
  const hash = await this.context.walletClient.writeContract({
3415
3347
  address: DataPortabilityServersAddress,
3416
3348
  abi: DataPortabilityServersAbi,
3417
3349
  functionName: "updateServer",
3418
3350
  args: [serverId, url],
3419
- chain: this.context.walletClient.chain,
3351
+ chain: this.context.walletClient?.chain,
3420
3352
  account
3421
3353
  });
3422
3354
  const { tx } = await import("../utils/transactionHelpers");
@@ -3575,6 +3507,7 @@ class PermissionsController {
3575
3507
  * @throws {NetworkError} When network communication fails
3576
3508
  */
3577
3509
  async submitAddPermission(params) {
3510
+ this.assertWallet();
3578
3511
  try {
3579
3512
  const nonce = await this.getPermissionsUserNonce();
3580
3513
  const addPermissionInput = {
@@ -3613,6 +3546,7 @@ class PermissionsController {
3613
3546
  * @throws {NetworkError} When network communication fails
3614
3547
  */
3615
3548
  async submitSignedAddPermission(typedData, signature) {
3549
+ this.assertWallet();
3616
3550
  try {
3617
3551
  let hash;
3618
3552
  if (this.context.relayerCallbacks?.submitAddPermission) {
@@ -3626,7 +3560,7 @@ class PermissionsController {
3626
3560
  signature
3627
3561
  );
3628
3562
  }
3629
- const account = this.context.walletClient.account || await this.getUserAddress();
3563
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
3630
3564
  const { tx } = await import("../utils/transactionHelpers");
3631
3565
  return tx({
3632
3566
  hash,
@@ -3662,7 +3596,7 @@ class PermissionsController {
3662
3596
  * @param params.serverAddress - Server wallet address for decryption permissions
3663
3597
  * @param params.serverUrl - Server endpoint URL
3664
3598
  * @param params.serverPublicKey - Server's public key for encryption.
3665
- * Obtain via `vana.server.getIdentity(userAddress).public_key`.
3599
+ * Obtain via `vana.server.getIdentity(userAddress).publicKey`.
3666
3600
  * @param params.filePermissions - Nested array of permissions for each file
3667
3601
  * @returns TransactionResult with immediate hash access and optional event data
3668
3602
  * @throws {Error} When schemaIds array length doesn't match fileUrls array length
@@ -3684,7 +3618,7 @@ class PermissionsController {
3684
3618
  * schemaIds: [123], // LinkedIn profile schema ID
3685
3619
  * serverAddress: "0x742d35Cc6634C0532925a3b844Bc9e7595f0b0Bb",
3686
3620
  * serverUrl: "https://server.example.com",
3687
- * serverPublicKey: serverInfo.public_key,
3621
+ * serverPublicKey: serverInfo.publicKey,
3688
3622
  * filePermissions: [[{
3689
3623
  * account: "0x742d35Cc6634C0532925a3b844Bc9e7595f0b0Bb",
3690
3624
  * key: encryptedKey
@@ -3695,6 +3629,7 @@ class PermissionsController {
3695
3629
  * ```
3696
3630
  */
3697
3631
  async submitAddServerFilesAndPermissions(params) {
3632
+ this.assertWallet();
3698
3633
  try {
3699
3634
  if (params.schemaIds.length !== params.fileUrls.length) {
3700
3635
  throw new Error(
@@ -3759,6 +3694,7 @@ class PermissionsController {
3759
3694
  * ```
3760
3695
  */
3761
3696
  async submitSignedAddServerFilesAndPermissions(typedData, signature) {
3697
+ this.assertWallet();
3762
3698
  try {
3763
3699
  console.debug("\u{1F50D} submitSignedAddServerFilesAndPermissions Debug Info:", {
3764
3700
  hasRelayerCallbacks: !!this.context.relayerCallbacks,
@@ -3773,7 +3709,7 @@ class PermissionsController {
3773
3709
  typedData,
3774
3710
  signature
3775
3711
  );
3776
- const account = this.context.walletClient.account || await this.getUserAddress();
3712
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
3777
3713
  const { tx } = await import("../utils/transactionHelpers");
3778
3714
  return tx({
3779
3715
  hash,
@@ -3789,11 +3725,11 @@ class PermissionsController {
3789
3725
  typedData,
3790
3726
  signature
3791
3727
  );
3792
- const account = this.context.walletClient.account || await this.getUserAddress();
3728
+ const account = this.context.userAddress;
3793
3729
  const { tx } = await import("../utils/transactionHelpers");
3794
3730
  return tx({
3795
3731
  hash,
3796
- from: typeof account === "string" ? account : account.address,
3732
+ from: account,
3797
3733
  contract: "DataPortabilityPermissions",
3798
3734
  fn: "addServerFilesAndPermissions"
3799
3735
  });
@@ -3815,6 +3751,7 @@ class PermissionsController {
3815
3751
  * @returns Promise resolving to transaction hash
3816
3752
  */
3817
3753
  async submitRevokePermission(permissionId) {
3754
+ this.assertWallet();
3818
3755
  try {
3819
3756
  const chainId = await this.context.walletClient.getChainId();
3820
3757
  const DataPortabilityPermissionsAddress = getContractAddress(
@@ -3824,7 +3761,7 @@ class PermissionsController {
3824
3761
  const DataPortabilityPermissionsAbi = getAbi(
3825
3762
  "DataPortabilityPermissions"
3826
3763
  );
3827
- const account = this.context.walletClient.account;
3764
+ const { account } = this.context.walletClient;
3828
3765
  if (!account) {
3829
3766
  throw new Error("No wallet account connected");
3830
3767
  }
@@ -3833,7 +3770,7 @@ class PermissionsController {
3833
3770
  abi: DataPortabilityPermissionsAbi,
3834
3771
  functionName: "revokePermission",
3835
3772
  args: [permissionId],
3836
- chain: this.context.walletClient.chain,
3773
+ chain: this.context.walletClient?.chain,
3837
3774
  account
3838
3775
  });
3839
3776
  const { tx } = await import("../utils/transactionHelpers");
@@ -3858,6 +3795,7 @@ class PermissionsController {
3858
3795
  * @returns Promise resolving to the transaction hash
3859
3796
  */
3860
3797
  async submitDirectAddPermissionTransaction(typedData, signature) {
3798
+ this.assertWallet();
3861
3799
  const chainId = await this.context.walletClient.getChainId();
3862
3800
  const DataPortabilityPermissionsAddress = getContractAddress(
3863
3801
  chainId,
@@ -3868,7 +3806,7 @@ class PermissionsController {
3868
3806
  nonce: typedData.message.nonce,
3869
3807
  granteeId: typedData.message.granteeId,
3870
3808
  grant: typedData.message.grant,
3871
- fileIds: typedData.message.fileIds || []
3809
+ fileIds: typedData.message.fileIds ?? []
3872
3810
  };
3873
3811
  const formattedSignature = formatSignatureForContract(signature);
3874
3812
  const hash = await this.context.walletClient.writeContract({
@@ -3876,8 +3814,8 @@ class PermissionsController {
3876
3814
  abi: DataPortabilityPermissionsAbi,
3877
3815
  functionName: "addPermission",
3878
3816
  args: [permissionInput, formattedSignature],
3879
- account: this.context.walletClient.account || await this.getUserAddress(),
3880
- chain: this.context.walletClient.chain || null
3817
+ account: this.context.walletClient?.account ?? this.context.userAddress,
3818
+ chain: this.context.walletClient?.chain ?? null
3881
3819
  });
3882
3820
  return hash;
3883
3821
  }
@@ -3889,7 +3827,8 @@ class PermissionsController {
3889
3827
  * @returns Promise resolving to the transaction hash
3890
3828
  */
3891
3829
  async submitDirectAddServerFilesAndPermissionsTransaction(typedData, signature) {
3892
- const chainId = await this.context.walletClient.getChainId();
3830
+ this.assertWallet();
3831
+ const chainId = await this.context.publicClient.getChainId();
3893
3832
  const DataPortabilityPermissionsAddress = getContractAddress(
3894
3833
  chainId,
3895
3834
  "DataPortabilityPermissions"
@@ -3913,8 +3852,8 @@ class PermissionsController {
3913
3852
  functionName: "addServerFilesAndPermissions",
3914
3853
  // @ts-expect-error - Viem's type inference for nested Permission[][] arrays is incompatible with our Permission type
3915
3854
  args: [serverFilesAndPermissionInput, formattedSignature],
3916
- account: this.context.walletClient.account || await this.getUserAddress(),
3917
- chain: this.context.walletClient.chain || null
3855
+ account: this.context.userAddress,
3856
+ chain: this.context.walletClient?.chain ?? null
3918
3857
  });
3919
3858
  return hash;
3920
3859
  }