@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
@@ -41,9 +41,10 @@ var import_grantValidation = require("../utils/grantValidation");
41
41
  var import_signatureCache = require("../utils/signatureCache");
42
42
  var import_signatureFormatter = require("../utils/signatureFormatter");
43
43
  var import_typedDataConverter = require("../utils/typedDataConverter");
44
- class PermissionsController {
44
+ var import_base = require("./base");
45
+ class PermissionsController extends import_base.BaseController {
45
46
  constructor(context) {
46
- this.context = context;
47
+ super(context);
47
48
  }
48
49
  /**
49
50
  * Grants permission for an application to access user data with gasless transactions.
@@ -80,6 +81,7 @@ class PermissionsController {
80
81
  * ```
81
82
  */
82
83
  async grant(params) {
84
+ this.assertWallet();
83
85
  const { typedData, signature } = await this.createAndSign(params);
84
86
  const result = await this.submitSignedGrantWithEvents(typedData, signature);
85
87
  return result;
@@ -110,6 +112,7 @@ class PermissionsController {
110
112
  * ```
111
113
  */
112
114
  async submitPermissionGrant(params) {
115
+ this.assertWallet();
113
116
  const { typedData, signature } = await this.createAndSign(params);
114
117
  return await this.submitSignedGrant(typedData, signature);
115
118
  }
@@ -139,6 +142,7 @@ class PermissionsController {
139
142
  * ```
140
143
  */
141
144
  async prepareGrant(params) {
145
+ this.assertWallet();
142
146
  try {
143
147
  const grantFile = (0, import_grantFiles.createGrantFile)(params);
144
148
  (0, import_grantValidation.validateGrant)(grantFile);
@@ -179,7 +183,7 @@ class PermissionsController {
179
183
  */
180
184
  async confirmGrantInternal(params, grantFile) {
181
185
  try {
182
- let grantUrl = params.grantUrl;
186
+ let { grantUrl } = params;
183
187
  console.debug("\u{1F50D} Debug - Grant URL from params:", grantUrl);
184
188
  if (!grantUrl) {
185
189
  if (!this.context.relayerCallbacks?.storeGrantFile && !this.context.storageManager) {
@@ -269,10 +273,11 @@ class PermissionsController {
269
273
  * ```
270
274
  */
271
275
  async createAndSign(params) {
276
+ this.assertWallet();
272
277
  try {
273
278
  const grantFile = (0, import_grantFiles.createGrantFile)(params);
274
279
  (0, import_grantValidation.validateGrant)(grantFile);
275
- let grantUrl = params.grantUrl;
280
+ let { grantUrl } = params;
276
281
  console.debug("\u{1F50D} Debug - Grant URL from params:", grantUrl);
277
282
  if (!grantUrl) {
278
283
  if (!this.context.relayerCallbacks?.storeGrantFile && !this.context.storageManager) {
@@ -360,7 +365,7 @@ class PermissionsController {
360
365
  "\u{1F50D} Debug - submitSignedGrant called with typed data:",
361
366
  JSON.stringify(
362
367
  typedData,
363
- (key, value) => typeof value === "bigint" ? value.toString() : value,
368
+ (_key, value) => typeof value === "bigint" ? value.toString() : value,
364
369
  2
365
370
  )
366
371
  );
@@ -369,7 +374,7 @@ class PermissionsController {
369
374
  typedData,
370
375
  signature
371
376
  );
372
- const account = this.context.walletClient.account || await this.getUserAddress();
377
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
373
378
  const { tx } = await import("../utils/transactionHelpers");
374
379
  return tx({
375
380
  hash,
@@ -421,11 +426,11 @@ class PermissionsController {
421
426
  trustServerInput,
422
427
  signature
423
428
  );
424
- const account = this.context.walletClient.account || await this.getUserAddress();
429
+ const account = this.context.userAddress;
425
430
  const { tx } = await import("../utils/transactionHelpers");
426
431
  return tx({
427
432
  hash,
428
- from: typeof account === "string" ? account : account.address,
433
+ from: account,
429
434
  contract: "DataPortabilityServers",
430
435
  fn: "trustServerWithSignature"
431
436
  });
@@ -486,7 +491,7 @@ class PermissionsController {
486
491
  addAndTrustServerInput,
487
492
  signature
488
493
  );
489
- const account = this.context.walletClient.account || await this.getUserAddress();
494
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
490
495
  const { tx } = await import("../utils/transactionHelpers");
491
496
  return tx({
492
497
  hash,
@@ -506,7 +511,7 @@ class PermissionsController {
506
511
  }
507
512
  /**
508
513
  * Internal method to submit a signed grant and wait for events.
509
- *
514
+ *
510
515
  * @internal
511
516
  * @param typedData - The EIP-712 typed data for the permission grant
512
517
  * @param signature - The user's signature authorizing the transaction
@@ -520,7 +525,9 @@ class PermissionsController {
520
525
  const result = await this.context.waitForTransactionEvents(txResult);
521
526
  const event = result.expectedEvents.PermissionAdded;
522
527
  if (!event) {
523
- throw new import_errors.BlockchainError("PermissionAdded event not found in transaction");
528
+ throw new import_errors.BlockchainError(
529
+ "PermissionAdded event not found in transaction"
530
+ );
524
531
  }
525
532
  const receipt = await this.context.publicClient.getTransactionReceipt({
526
533
  hash: result.hash
@@ -537,7 +544,7 @@ class PermissionsController {
537
544
  }
538
545
  /**
539
546
  * Internal method for confirm grant with events.
540
- *
547
+ *
541
548
  * @internal
542
549
  * @param params - The permission grant parameters
543
550
  * @param grantFile - The pre-created grant file object
@@ -551,7 +558,9 @@ class PermissionsController {
551
558
  const result = await this.context.waitForTransactionEvents(txResult);
552
559
  const event = result.expectedEvents.PermissionAdded;
553
560
  if (!event) {
554
- throw new import_errors.BlockchainError("PermissionAdded event not found in transaction");
561
+ throw new import_errors.BlockchainError(
562
+ "PermissionAdded event not found in transaction"
563
+ );
555
564
  }
556
565
  const receipt = await this.context.publicClient.getTransactionReceipt({
557
566
  hash: result.hash
@@ -566,34 +575,6 @@ class PermissionsController {
566
575
  fileIds: event.fileIds
567
576
  };
568
577
  }
569
- /**
570
- * Internal method to submit a signed revoke and wait for events.
571
- *
572
- * @internal
573
- * @param typedData - The EIP-712 typed data for the permission revoke
574
- * @param signature - The user's signature authorizing the transaction
575
- * @returns Promise resolving to PermissionRevokeResult with parsed events
576
- */
577
- async submitSignedRevokeWithEvents(typedData, signature) {
578
- const txResult = await this.submitSignedRevoke(typedData, signature);
579
- if (!this.context.waitForTransactionEvents) {
580
- throw new import_errors.BlockchainError("waitForTransactionEvents not configured");
581
- }
582
- const result = await this.context.waitForTransactionEvents(txResult);
583
- const event = result.expectedEvents.PermissionRevoked;
584
- if (!event) {
585
- throw new import_errors.BlockchainError("PermissionRevoked event not found in transaction");
586
- }
587
- const receipt = await this.context.publicClient.getTransactionReceipt({
588
- hash: result.hash
589
- });
590
- return {
591
- transactionHash: result.hash,
592
- blockNumber: receipt.blockNumber,
593
- gasUsed: receipt.gasUsed,
594
- permissionId: event.permissionId
595
- };
596
- }
597
578
  /**
598
579
  * Submits an already-signed permission revoke transaction to the blockchain.
599
580
  *
@@ -624,9 +605,12 @@ class PermissionsController {
624
605
  signature
625
606
  );
626
607
  } else {
627
- hash = await this.submitDirectRevokeTransaction(typedData, signature);
608
+ hash = await this.submitDirectRevokeTransaction(
609
+ typedData,
610
+ signature
611
+ );
628
612
  }
629
- const account = this.context.walletClient.account || await this.getUserAddress();
613
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
630
614
  const { tx } = await import("../utils/transactionHelpers");
631
615
  return tx({
632
616
  hash,
@@ -674,9 +658,12 @@ class PermissionsController {
674
658
  signature
675
659
  );
676
660
  } else {
677
- hash = await this.submitSignedUntrustTransaction(typedData, signature);
661
+ hash = await this.submitSignedUntrustTransaction(
662
+ typedData,
663
+ signature
664
+ );
678
665
  }
679
- const account = this.context.walletClient.account || await this.getUserAddress();
666
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
680
667
  const { tx } = await import("../utils/transactionHelpers");
681
668
  return tx({
682
669
  hash,
@@ -707,7 +694,8 @@ class PermissionsController {
707
694
  * @throws {BlockchainError} When contract submission fails
708
695
  */
709
696
  async submitDirectTransaction(typedData, signature) {
710
- const chainId = await this.context.walletClient.getChainId();
697
+ this.assertWallet();
698
+ const chainId = await this.context.publicClient.getChainId();
711
699
  const DataPortabilityPermissionsAddress = (0, import_addresses.getContractAddress)(
712
700
  chainId,
713
701
  "DataPortabilityPermissions"
@@ -727,17 +715,17 @@ class PermissionsController {
727
715
  console.debug("\u{1F50D} Debug - Grant field value:", typedData.message.grant);
728
716
  console.debug(
729
717
  "\u{1F50D} Debug - Grant field length:",
730
- typedData.message.grant?.length || 0
718
+ typedData.message.grant?.length ?? 0
731
719
  );
732
720
  const formattedSignature = (0, import_signatureFormatter.formatSignatureForContract)(signature);
733
- const account = this.context.walletClient.account || await this.getUserAddress();
721
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
734
722
  const txHash = await this.context.walletClient.writeContract({
735
723
  address: DataPortabilityPermissionsAddress,
736
724
  abi: DataPortabilityPermissionsAbi,
737
725
  functionName: "addPermission",
738
726
  args: [permissionInput, formattedSignature],
739
727
  account,
740
- chain: this.context.walletClient.chain || null
728
+ chain: this.context.walletClient?.chain ?? null
741
729
  });
742
730
  const { tx } = await import("../utils/transactionHelpers");
743
731
  return tx({
@@ -772,6 +760,7 @@ class PermissionsController {
772
760
  * ```
773
761
  */
774
762
  async revoke(params) {
763
+ this.assertWallet();
775
764
  const txResult = await this.submitPermissionRevoke(params);
776
765
  if (!this.context.waitForTransactionEvents) {
777
766
  throw new import_errors.BlockchainError("waitForTransactionEvents not configured");
@@ -779,7 +768,9 @@ class PermissionsController {
779
768
  const result = await this.context.waitForTransactionEvents(txResult);
780
769
  const event = result.expectedEvents.PermissionRevoked;
781
770
  if (!event) {
782
- throw new import_errors.BlockchainError("PermissionRevoked event not found in transaction");
771
+ throw new import_errors.BlockchainError(
772
+ "PermissionRevoked event not found in transaction"
773
+ );
783
774
  }
784
775
  const receipt = await this.context.publicClient.getTransactionReceipt({
785
776
  hash: result.hash
@@ -811,11 +802,12 @@ class PermissionsController {
811
802
  * ```
812
803
  */
813
804
  async submitPermissionRevoke(params) {
805
+ this.assertWallet();
814
806
  try {
815
- if (!this.context.walletClient.chain?.id) {
807
+ if (!this.context.walletClient?.chain?.id) {
816
808
  throw new import_errors.BlockchainError("Chain ID not available");
817
809
  }
818
- const chainId = await this.context.walletClient.getChainId();
810
+ const chainId = await this.context.publicClient.getChainId();
819
811
  const DataPortabilityPermissionsAddress = (0, import_addresses.getContractAddress)(
820
812
  chainId,
821
813
  "DataPortabilityPermissions"
@@ -823,14 +815,14 @@ class PermissionsController {
823
815
  const DataPortabilityPermissionsAbi = (0, import_abi.getAbi)(
824
816
  "DataPortabilityPermissions"
825
817
  );
826
- const account = this.context.walletClient.account || await this.getUserAddress();
818
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
827
819
  const txHash = await this.context.walletClient.writeContract({
828
820
  address: DataPortabilityPermissionsAddress,
829
821
  abi: DataPortabilityPermissionsAbi,
830
822
  functionName: "revokePermission",
831
823
  args: [params.permissionId],
832
824
  account,
833
- chain: this.context.walletClient.chain || null
825
+ chain: this.context.walletClient?.chain ?? null
834
826
  });
835
827
  const { tx } = await import("../utils/transactionHelpers");
836
828
  return tx({
@@ -878,8 +870,9 @@ class PermissionsController {
878
870
  * ```
879
871
  */
880
872
  async submitRevokeWithSignature(params) {
873
+ this.assertWallet();
881
874
  try {
882
- if (!this.context.walletClient.chain?.id) {
875
+ if (!this.context.walletClient?.chain?.id) {
883
876
  throw new import_errors.BlockchainError("Chain ID not available");
884
877
  }
885
878
  const nonce = await this.getPermissionsUserNonce();
@@ -906,9 +899,12 @@ class PermissionsController {
906
899
  signature
907
900
  );
908
901
  } else {
909
- hash = await this.submitDirectRevokeTransaction(typedData, signature);
902
+ hash = await this.submitDirectRevokeTransaction(
903
+ typedData,
904
+ signature
905
+ );
910
906
  }
911
- const account = this.context.walletClient.account || await this.getUserAddress();
907
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
912
908
  const { tx } = await import("../utils/transactionHelpers");
913
909
  return tx({
914
910
  hash,
@@ -923,64 +919,6 @@ class PermissionsController {
923
919
  );
924
920
  }
925
921
  }
926
- /**
927
- * @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
928
- *
929
- * Retrieves the user's current nonce from the DataPortabilityServers contract.
930
- * This method is deprecated in favor of more specific nonce methods.
931
- *
932
- * The nonce is used to prevent replay attacks in signed transactions and must
933
- * be incremented with each transaction to maintain security.
934
- *
935
- * @returns Promise resolving to the user's current nonce value as a bigint
936
- * @throws {Error} When wallet account is not available
937
- * @throws {Error} When chain ID is not available
938
- * @throws {NonceError} When reading nonce from contract fails
939
- * @private
940
- * @example
941
- * ```typescript
942
- * // Deprecated - use specific methods instead
943
- * const nonce = await this.getUserNonce();
944
- *
945
- * // Use these instead:
946
- * const permissionsNonce = await this.getPermissionsUserNonce();
947
- * const serversNonce = await this.getServersUserNonce();
948
- * ```
949
- */
950
- /**
951
- * @deprecated Use getPermissionsUserNonce() for permission operations or getServersUserNonce() for server operations
952
- *
953
- * Retrieves the user's current nonce from the DataPortabilityServers contract.
954
- *
955
- * @remarks
956
- * This method is deprecated in favor of more specific nonce methods that target
957
- * the appropriate contract for the operation being performed.
958
- *
959
- * @returns Promise resolving to the user's current nonce as a bigint
960
- * @throws {NonceError} When retrieving the nonce fails
961
- */
962
- async getUserNonce() {
963
- try {
964
- const userAddress = await this.getUserAddress();
965
- const chainId = await this.context.walletClient.getChainId();
966
- const DataPortabilityServersAddress = (0, import_addresses.getContractAddress)(
967
- chainId,
968
- "DataPortabilityServers"
969
- );
970
- const DataPortabilityServersAbi = (0, import_abi.getAbi)("DataPortabilityServers");
971
- const nonce = await this.context.publicClient.readContract({
972
- address: DataPortabilityServersAddress,
973
- abi: DataPortabilityServersAbi,
974
- functionName: "userNonce",
975
- args: [userAddress]
976
- });
977
- return nonce;
978
- } catch (error) {
979
- throw new import_errors.NonceError(
980
- `Failed to retrieve user nonce: ${error instanceof Error ? error.message : "Unknown error"}`
981
- );
982
- }
983
- }
984
922
  /**
985
923
  * Retrieves the user's current nonce from the DataPortabilityServers contract.
986
924
  * This nonce is used for server-related operations (AddAndTrustServer, TrustServer, UntrustServer).
@@ -1007,8 +945,8 @@ class PermissionsController {
1007
945
  */
1008
946
  async getServersUserNonce() {
1009
947
  try {
1010
- const userAddress = await this.getUserAddress();
1011
- const chainId = await this.context.walletClient.getChainId();
948
+ const userAddress = this.context.userAddress;
949
+ const chainId = await this.context.publicClient.getChainId();
1012
950
  const DataPortabilityServersAddress = (0, import_addresses.getContractAddress)(
1013
951
  chainId,
1014
952
  "DataPortabilityServers"
@@ -1053,8 +991,8 @@ class PermissionsController {
1053
991
  */
1054
992
  async getPermissionsUserNonce() {
1055
993
  try {
1056
- const userAddress = await this.getUserAddress();
1057
- const chainId = await this.context.walletClient.getChainId();
994
+ const userAddress = this.context.userAddress;
995
+ const chainId = await this.context.publicClient.getChainId();
1058
996
  const DataPortabilityPermissionsAddress = (0, import_addresses.getContractAddress)(
1059
997
  chainId,
1060
998
  "DataPortabilityPermissions"
@@ -1093,7 +1031,7 @@ class PermissionsController {
1093
1031
  "\u{1F50D} Debug - Composing permission message with grantUrl:",
1094
1032
  params.grantUrl
1095
1033
  );
1096
- const chainId = await this.context.walletClient.getChainId();
1034
+ const chainId = await this.context.publicClient.getChainId();
1097
1035
  const DataPortabilityGranteesAddress = (0, import_addresses.getContractAddress)(
1098
1036
  chainId,
1099
1037
  "DataPortabilityGrantees"
@@ -1202,7 +1140,7 @@ class PermissionsController {
1202
1140
  * @returns Promise resolving to the EIP-712 domain configuration
1203
1141
  */
1204
1142
  async getPermissionDomain() {
1205
- const chainId = await this.context.walletClient.getChainId();
1143
+ const chainId = await this.context.publicClient.getChainId();
1206
1144
  const DataPortabilityPermissionsAddress = (0, import_addresses.getContractAddress)(
1207
1145
  chainId,
1208
1146
  "DataPortabilityPermissions"
@@ -1221,8 +1159,9 @@ class PermissionsController {
1221
1159
  * @returns Promise resolving to the cryptographic signature
1222
1160
  */
1223
1161
  async signTypedData(typedData) {
1162
+ this.assertWallet();
1224
1163
  try {
1225
- const walletAddress = this.context.walletClient.account?.address || await this.getUserAddress();
1164
+ const walletAddress = this.context.walletClient.account?.address ?? this.context.userAddress;
1226
1165
  return await (0, import_signatureCache.withSignatureCache)(
1227
1166
  this.context.platform.cache,
1228
1167
  walletAddress,
@@ -1231,9 +1170,9 @@ class PermissionsController {
1231
1170
  const viemCompatibleTypedData = (0, import_typedDataConverter.toViemTypedDataDefinition)(typedData);
1232
1171
  return await this.context.walletClient.signTypedData({
1233
1172
  ...viemCompatibleTypedData,
1234
- // Non-null assertion is safe here because getUserAddress() above ensures account exists
1235
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1236
- account: this.context.walletClient.account
1173
+ // Use the account if available, otherwise use the wallet address
1174
+ // This follows the same pattern used throughout this file
1175
+ account: this.context.walletClient.account ?? walletAddress
1237
1176
  });
1238
1177
  }
1239
1178
  );
@@ -1248,17 +1187,10 @@ class PermissionsController {
1248
1187
  }
1249
1188
  }
1250
1189
  /**
1251
- * Gets the user's address from the wallet client.
1190
+ * Gets the user's address from the context.
1252
1191
  *
1253
- * @returns Promise resolving to the user's wallet address
1192
+ * @returns The user's address
1254
1193
  */
1255
- async getUserAddress() {
1256
- const addresses = await this.context.walletClient.getAddresses();
1257
- if (addresses.length === 0) {
1258
- throw new import_errors.BlockchainError("No addresses available in wallet client");
1259
- }
1260
- return addresses[0];
1261
- }
1262
1194
  /**
1263
1195
  * Gets on-chain permission grant data without expensive off-chain resolution.
1264
1196
  *
@@ -1297,8 +1229,8 @@ class PermissionsController {
1297
1229
  async getUserPermissionGrantsOnChain(options = {}) {
1298
1230
  const { limit = 50, subgraphUrl } = options;
1299
1231
  try {
1300
- const userAddress = await this.getUserAddress();
1301
- const graphqlEndpoint = subgraphUrl || this.context.subgraphUrl;
1232
+ const userAddress = this.context.userAddress;
1233
+ const graphqlEndpoint = subgraphUrl ?? this.context.subgraphUrl;
1302
1234
  if (!graphqlEndpoint) {
1303
1235
  throw new import_errors.BlockchainError(
1304
1236
  "subgraphUrl is required. Please provide a valid subgraph endpoint or configure it in Vana constructor."
@@ -1350,7 +1282,7 @@ class PermissionsController {
1350
1282
  );
1351
1283
  }
1352
1284
  const userData = result.data?.user;
1353
- if (!userData || !userData.permissions?.length) {
1285
+ if (!userData?.permissions?.length) {
1354
1286
  return [];
1355
1287
  }
1356
1288
  const onChainGrants = userData.permissions.slice(0, limit).map(
@@ -1361,8 +1293,8 @@ class PermissionsController {
1361
1293
  nonce: BigInt(permission.nonce),
1362
1294
  startBlock: BigInt(permission.startBlock),
1363
1295
  addedAtBlock: BigInt(permission.addedAtBlock),
1364
- addedAtTimestamp: BigInt(permission.addedAtTimestamp || "0"),
1365
- transactionHash: permission.transactionHash || "",
1296
+ addedAtTimestamp: BigInt(permission.addedAtTimestamp ?? "0"),
1297
+ transactionHash: permission.transactionHash ?? "",
1366
1298
  grantor: userAddress,
1367
1299
  grantee: permission.grantee,
1368
1300
  active: !permission.endBlock || BigInt(permission.endBlock) === 0n
@@ -1383,26 +1315,6 @@ class PermissionsController {
1383
1315
  );
1384
1316
  }
1385
1317
  }
1386
- /**
1387
- * Normalizes grant ID to hex format.
1388
- * Handles conversion from permission ID (bigint/number/string) to proper hex hash format.
1389
- *
1390
- * @param grantId - Permission ID or grant hash in various formats
1391
- * @returns Normalized hex hash
1392
- */
1393
- normalizeGrantId(grantId) {
1394
- if (typeof grantId === "string" && grantId.startsWith("0x") && grantId.length === 66) {
1395
- return grantId;
1396
- }
1397
- try {
1398
- const bigIntId = BigInt(grantId);
1399
- return `0x${bigIntId.toString(16).padStart(64, "0")}`;
1400
- } catch {
1401
- throw new Error(
1402
- `Invalid grant ID format: ${grantId}. Must be a permission ID (number/bigint/string) or a 32-byte hex hash.`
1403
- );
1404
- }
1405
- }
1406
1318
  /**
1407
1319
  * Registers a new server and immediately trusts it in the DataPortabilityServers contract.
1408
1320
  *
@@ -1411,7 +1323,6 @@ class PermissionsController {
1411
1323
  * Trusted servers can handle data export and portability requests from the user.
1412
1324
  *
1413
1325
  * @param params - Parameters for adding and trusting the server
1414
- * @param params.owner - Ethereum address that will own this server registration
1415
1326
  * @param params.serverAddress - Ethereum address of the server
1416
1327
  * @param params.serverUrl - HTTPS URL where the server can be reached
1417
1328
  * @param params.publicKey - Server's public key for encryption (hex string)
@@ -1438,6 +1349,7 @@ class PermissionsController {
1438
1349
  * ```
1439
1350
  */
1440
1351
  async addAndTrustServer(params) {
1352
+ this.assertWallet();
1441
1353
  try {
1442
1354
  const chainId = await this.context.walletClient.getChainId();
1443
1355
  const DataPortabilityServersAddress = (0, import_addresses.getContractAddress)(
@@ -1445,7 +1357,7 @@ class PermissionsController {
1445
1357
  "DataPortabilityServers"
1446
1358
  );
1447
1359
  const DataPortabilityServersAbi = (0, import_abi.getAbi)("DataPortabilityServers");
1448
- const account = this.context.walletClient.account || await this.getUserAddress();
1360
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
1449
1361
  const userAddress = typeof account === "string" ? account : account.address;
1450
1362
  const normalizedUserAddress = (0, import_viem.getAddress)(userAddress);
1451
1363
  const normalizedServerAddress = (0, import_viem.getAddress)(params.serverAddress);
@@ -1462,7 +1374,7 @@ class PermissionsController {
1462
1374
  }
1463
1375
  ],
1464
1376
  account,
1465
- chain: this.context.walletClient.chain || null
1377
+ chain: this.context.walletClient?.chain ?? null
1466
1378
  });
1467
1379
  const { tx } = await import("../utils/transactionHelpers");
1468
1380
  const txResult = tx({
@@ -1477,9 +1389,13 @@ class PermissionsController {
1477
1389
  const result = await this.context.waitForTransactionEvents(txResult);
1478
1390
  const event = result.expectedEvents.ServerTrusted;
1479
1391
  if (!event) {
1480
- throw new import_errors.BlockchainError("ServerTrusted event not found in transaction");
1392
+ throw new import_errors.BlockchainError(
1393
+ "ServerTrusted event not found in transaction"
1394
+ );
1481
1395
  }
1482
- const receipt = await this.context.publicClient.getTransactionReceipt({ hash: txHash });
1396
+ const receipt = await this.context.publicClient.getTransactionReceipt({
1397
+ hash: txHash
1398
+ });
1483
1399
  return {
1484
1400
  transactionHash: txHash,
1485
1401
  blockNumber: receipt.blockNumber,
@@ -1510,6 +1426,7 @@ class PermissionsController {
1510
1426
  * @deprecated Use addAndTrustServer instead
1511
1427
  */
1512
1428
  async submitTrustServer(params) {
1429
+ this.assertWallet();
1513
1430
  try {
1514
1431
  const chainId = await this.context.walletClient.getChainId();
1515
1432
  const DataPortabilityServersAddress = (0, import_addresses.getContractAddress)(
@@ -1517,14 +1434,14 @@ class PermissionsController {
1517
1434
  "DataPortabilityServers"
1518
1435
  );
1519
1436
  const DataPortabilityServersAbi = (0, import_abi.getAbi)("DataPortabilityServers");
1520
- const account = this.context.walletClient.account || await this.getUserAddress();
1437
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
1521
1438
  const txHash = await this.context.walletClient.writeContract({
1522
1439
  address: DataPortabilityServersAddress,
1523
1440
  abi: DataPortabilityServersAbi,
1524
1441
  functionName: "trustServer",
1525
1442
  args: [BigInt(params.serverId)],
1526
1443
  account,
1527
- chain: this.context.walletClient.chain || null
1444
+ chain: this.context.walletClient?.chain ?? null
1528
1445
  });
1529
1446
  const { tx } = await import("../utils/transactionHelpers");
1530
1447
  return tx({
@@ -1550,6 +1467,7 @@ class PermissionsController {
1550
1467
  * @returns Promise resolving to TransactionResult with ServerTrustResult event data
1551
1468
  */
1552
1469
  async submitAddAndTrustServerWithSignature(params) {
1470
+ this.assertWallet();
1553
1471
  try {
1554
1472
  const nonce = await this.getServersUserNonce();
1555
1473
  const serverAddress = (0, import_viem.getAddress)(params.serverAddress);
@@ -1584,7 +1502,7 @@ class PermissionsController {
1584
1502
  signature
1585
1503
  );
1586
1504
  }
1587
- const account = this.context.walletClient.account || await this.getUserAddress();
1505
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
1588
1506
  const { tx } = await import("../utils/transactionHelpers");
1589
1507
  return tx({
1590
1508
  hash,
@@ -1621,6 +1539,7 @@ class PermissionsController {
1621
1539
  * @throws {BlockchainError} When trust operation fails for any other reason
1622
1540
  */
1623
1541
  async submitTrustServerWithSignature(params) {
1542
+ this.assertWallet();
1624
1543
  try {
1625
1544
  const nonce = await this.getServersUserNonce();
1626
1545
  const trustServerInput = {
@@ -1641,7 +1560,7 @@ class PermissionsController {
1641
1560
  signature
1642
1561
  );
1643
1562
  }
1644
- const account = this.context.walletClient.account || await this.getUserAddress();
1563
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
1645
1564
  const { tx } = await import("../utils/transactionHelpers");
1646
1565
  return tx({
1647
1566
  hash,
@@ -1680,6 +1599,7 @@ class PermissionsController {
1680
1599
  * @throws {BlockchainError} When contract submission fails
1681
1600
  */
1682
1601
  async submitDirectUntrustTransaction(params) {
1602
+ this.assertWallet();
1683
1603
  try {
1684
1604
  const chainId = await this.context.walletClient.getChainId();
1685
1605
  const DataPortabilityServersAddress = (0, import_addresses.getContractAddress)(
@@ -1687,14 +1607,14 @@ class PermissionsController {
1687
1607
  "DataPortabilityServers"
1688
1608
  );
1689
1609
  const DataPortabilityServersAbi = (0, import_abi.getAbi)("DataPortabilityServers");
1690
- const account = this.context.walletClient.account || await this.getUserAddress();
1610
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
1691
1611
  const txHash = await this.context.walletClient.writeContract({
1692
1612
  address: DataPortabilityServersAddress,
1693
1613
  abi: DataPortabilityServersAbi,
1694
1614
  functionName: "untrustServer",
1695
1615
  args: [BigInt(params.serverId)],
1696
1616
  account,
1697
- chain: this.context.walletClient.chain || null
1617
+ chain: this.context.walletClient?.chain ?? null
1698
1618
  });
1699
1619
  const { tx } = await import("../utils/transactionHelpers");
1700
1620
  return tx({
@@ -1742,6 +1662,7 @@ class PermissionsController {
1742
1662
  * ```
1743
1663
  */
1744
1664
  async submitUntrustServer(params) {
1665
+ this.assertWallet();
1745
1666
  const nonce = await this.getServersUserNonce();
1746
1667
  const untrustServerInput = {
1747
1668
  nonce,
@@ -1762,6 +1683,7 @@ class PermissionsController {
1762
1683
  * @throws {BlockchainError} When untrust transaction fails
1763
1684
  */
1764
1685
  async submitUntrustServerWithSignature(params) {
1686
+ this.assertWallet();
1765
1687
  try {
1766
1688
  const nonce = await this.getServersUserNonce();
1767
1689
  const untrustServerInput = {
@@ -1779,7 +1701,7 @@ class PermissionsController {
1779
1701
  } else {
1780
1702
  hash = await this.submitSignedUntrustTransaction(typedData, signature);
1781
1703
  }
1782
- const account = this.context.walletClient.account || await this.getUserAddress();
1704
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
1783
1705
  const { tx } = await import("../utils/transactionHelpers");
1784
1706
  return tx({
1785
1707
  hash,
@@ -1824,8 +1746,8 @@ class PermissionsController {
1824
1746
  */
1825
1747
  async getTrustedServers(userAddress) {
1826
1748
  try {
1827
- const user = userAddress || await this.getUserAddress();
1828
- const chainId = await this.context.walletClient.getChainId();
1749
+ const user = userAddress ?? this.context.userAddress;
1750
+ const chainId = await this.context.publicClient.getChainId();
1829
1751
  const DataPortabilityServersAddress = (0, import_addresses.getContractAddress)(
1830
1752
  chainId,
1831
1753
  "DataPortabilityServers"
@@ -1854,8 +1776,8 @@ class PermissionsController {
1854
1776
  */
1855
1777
  async getTrustedServersCount(userAddress) {
1856
1778
  try {
1857
- const user = userAddress || await this.getUserAddress();
1858
- const chainId = await this.context.walletClient.getChainId();
1779
+ const user = userAddress ?? this.context.userAddress;
1780
+ const chainId = await this.context.publicClient.getChainId();
1859
1781
  const DataPortabilityServersAddress = (0, import_addresses.getContractAddress)(
1860
1782
  chainId,
1861
1783
  "DataPortabilityServers"
@@ -1884,10 +1806,10 @@ class PermissionsController {
1884
1806
  */
1885
1807
  async getTrustedServersPaginated(options = {}) {
1886
1808
  try {
1887
- const user = options.userAddress || await this.getUserAddress();
1888
- const limit = options.limit || 50;
1889
- const offset = options.offset || 0;
1890
- const chainId = await this.context.walletClient.getChainId();
1809
+ const user = options.userAddress ?? this.context.userAddress;
1810
+ const limit = options.limit ?? 50;
1811
+ const offset = options.offset ?? 0;
1812
+ const chainId = await this.context.publicClient.getChainId();
1891
1813
  const DataPortabilityServersAddress = (0, import_addresses.getContractAddress)(
1892
1814
  chainId,
1893
1815
  "DataPortabilityServers"
@@ -2033,7 +1955,7 @@ class PermissionsController {
2033
1955
  };
2034
1956
  }
2035
1957
  try {
2036
- const chainId = await this.context.walletClient.getChainId();
1958
+ const chainId = await this.context.publicClient.getChainId();
2037
1959
  const DataPortabilityServersAddress = (0, import_addresses.getContractAddress)(
2038
1960
  chainId,
2039
1961
  "DataPortabilityServers"
@@ -2108,7 +2030,7 @@ class PermissionsController {
2108
2030
  */
2109
2031
  async checkServerTrustStatus(serverId, userAddress) {
2110
2032
  try {
2111
- const user = userAddress || await this.getUserAddress();
2033
+ const user = userAddress ?? this.context.userAddress;
2112
2034
  const trustedServers = await this.getTrustedServers(user);
2113
2035
  const trustIndex = trustedServers.findIndex(
2114
2036
  (server) => server === serverId
@@ -2198,7 +2120,7 @@ class PermissionsController {
2198
2120
  * @returns Promise resolving to the EIP-712 domain configuration
2199
2121
  */
2200
2122
  async getServersDomain() {
2201
- const chainId = await this.context.walletClient.getChainId();
2123
+ const chainId = await this.context.publicClient.getChainId();
2202
2124
  const DataPortabilityServersAddress = (0, import_addresses.getContractAddress)(
2203
2125
  chainId,
2204
2126
  "DataPortabilityServers"
@@ -2218,6 +2140,7 @@ class PermissionsController {
2218
2140
  * @returns Promise resolving to the transaction hash
2219
2141
  */
2220
2142
  async submitAddAndTrustServerTransaction(addAndTrustServerInput, signature) {
2143
+ this.assertWallet();
2221
2144
  const chainId = await this.context.walletClient.getChainId();
2222
2145
  const DataPortabilityServersAddress = (0, import_addresses.getContractAddress)(
2223
2146
  chainId,
@@ -2249,8 +2172,8 @@ class PermissionsController {
2249
2172
  },
2250
2173
  formattedSignature
2251
2174
  ],
2252
- account: this.context.walletClient.account || await this.getUserAddress(),
2253
- chain: this.context.walletClient.chain || null
2175
+ account: this.context.walletClient?.account ?? this.context.userAddress,
2176
+ chain: this.context.walletClient?.chain ?? null
2254
2177
  });
2255
2178
  return txHash;
2256
2179
  }
@@ -2262,6 +2185,7 @@ class PermissionsController {
2262
2185
  * @returns Promise resolving to the transaction hash
2263
2186
  */
2264
2187
  async submitTrustServerTransaction(trustServerInput, signature) {
2188
+ this.assertWallet();
2265
2189
  const chainId = await this.context.walletClient.getChainId();
2266
2190
  const DataPortabilityServersAddress = (0, import_addresses.getContractAddress)(
2267
2191
  chainId,
@@ -2280,8 +2204,8 @@ class PermissionsController {
2280
2204
  },
2281
2205
  formattedSignature
2282
2206
  ],
2283
- account: this.context.walletClient.account || await this.getUserAddress(),
2284
- chain: this.context.walletClient.chain || null
2207
+ account: this.context.walletClient?.account ?? this.context.userAddress,
2208
+ chain: this.context.walletClient?.chain ?? null
2285
2209
  });
2286
2210
  return txHash;
2287
2211
  }
@@ -2293,6 +2217,7 @@ class PermissionsController {
2293
2217
  * @returns Promise resolving to the transaction hash
2294
2218
  */
2295
2219
  async submitDirectRevokeTransaction(typedData, signature) {
2220
+ this.assertWallet();
2296
2221
  const chainId = await this.context.walletClient.getChainId();
2297
2222
  const DataPortabilityPermissionsAddress = (0, import_addresses.getContractAddress)(
2298
2223
  chainId,
@@ -2304,10 +2229,9 @@ class PermissionsController {
2304
2229
  address: DataPortabilityPermissionsAddress,
2305
2230
  abi: DataPortabilityPermissionsAbi,
2306
2231
  functionName: "revokePermissionWithSignature",
2307
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2308
2232
  args: [typedData.message, formattedSignature],
2309
- account: this.context.walletClient.account || await this.getUserAddress(),
2310
- chain: this.context.walletClient.chain || null
2233
+ account: this.context.walletClient?.account ?? this.context.userAddress,
2234
+ chain: this.context.walletClient?.chain ?? null
2311
2235
  });
2312
2236
  return txHash;
2313
2237
  }
@@ -2319,6 +2243,7 @@ class PermissionsController {
2319
2243
  * @returns Promise resolving to the transaction hash
2320
2244
  */
2321
2245
  async submitSignedUntrustTransaction(typedData, signature) {
2246
+ this.assertWallet();
2322
2247
  const chainId = await this.context.walletClient.getChainId();
2323
2248
  const DataPortabilityServersAddress = (0, import_addresses.getContractAddress)(
2324
2249
  chainId,
@@ -2326,14 +2251,17 @@ class PermissionsController {
2326
2251
  );
2327
2252
  const DataPortabilityServersAbi = (0, import_abi.getAbi)("DataPortabilityServers");
2328
2253
  const formattedSignature = (0, import_signatureFormatter.formatSignatureForContract)(signature);
2254
+ const contractMessage = {
2255
+ nonce: typedData.message.nonce,
2256
+ serverId: BigInt(typedData.message.serverId)
2257
+ };
2329
2258
  const txHash = await this.context.walletClient.writeContract({
2330
2259
  address: DataPortabilityServersAddress,
2331
2260
  abi: DataPortabilityServersAbi,
2332
2261
  functionName: "untrustServerWithSignature",
2333
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2334
- args: [typedData.message, formattedSignature],
2335
- account: this.context.walletClient.account || await this.getUserAddress(),
2336
- chain: this.context.walletClient.chain || null
2262
+ args: [contractMessage, formattedSignature],
2263
+ account: this.context.walletClient?.account ?? this.context.userAddress,
2264
+ chain: this.context.walletClient?.chain ?? null
2337
2265
  });
2338
2266
  return txHash;
2339
2267
  }
@@ -2366,6 +2294,7 @@ class PermissionsController {
2366
2294
  * ```
2367
2295
  */
2368
2296
  async submitRegisterGrantee(params) {
2297
+ this.assertWallet();
2369
2298
  const chainId = await this.context.walletClient.getChainId();
2370
2299
  const DataPortabilityGranteesAddress = (0, import_addresses.getContractAddress)(
2371
2300
  chainId,
@@ -2374,14 +2303,14 @@ class PermissionsController {
2374
2303
  const DataPortabilityGranteesAbi = (0, import_abi.getAbi)("DataPortabilityGrantees");
2375
2304
  const ownerAddress = (0, import_viem.getAddress)(params.owner);
2376
2305
  const granteeAddress = (0, import_viem.getAddress)(params.granteeAddress);
2377
- const account = this.context.walletClient.account || await this.getUserAddress();
2306
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
2378
2307
  const txHash = await this.context.walletClient.writeContract({
2379
2308
  address: DataPortabilityGranteesAddress,
2380
2309
  abi: DataPortabilityGranteesAbi,
2381
2310
  functionName: "registerGrantee",
2382
2311
  args: [ownerAddress, granteeAddress, params.publicKey],
2383
2312
  account,
2384
- chain: this.context.walletClient.chain || null
2313
+ chain: this.context.walletClient?.chain ?? null
2385
2314
  });
2386
2315
  const { tx } = await import("../utils/transactionHelpers");
2387
2316
  return tx({
@@ -2407,6 +2336,7 @@ class PermissionsController {
2407
2336
  * ```
2408
2337
  */
2409
2338
  async submitRegisterGranteeWithSignature(params) {
2339
+ this.assertWallet();
2410
2340
  const nonce = await this.getServersUserNonce();
2411
2341
  const owner = (0, import_viem.getAddress)(params.owner);
2412
2342
  const granteeAddress = (0, import_viem.getAddress)(params.granteeAddress);
@@ -2422,7 +2352,7 @@ class PermissionsController {
2422
2352
  typedData,
2423
2353
  signature
2424
2354
  );
2425
- const account = this.context.walletClient.account || await this.getUserAddress();
2355
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
2426
2356
  const { tx } = await import("../utils/transactionHelpers");
2427
2357
  return tx({
2428
2358
  hash,
@@ -2448,7 +2378,7 @@ class PermissionsController {
2448
2378
  typedData,
2449
2379
  signature
2450
2380
  );
2451
- const account = this.context.walletClient.account || await this.getUserAddress();
2381
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
2452
2382
  const { tx } = await import("../utils/transactionHelpers");
2453
2383
  return tx({
2454
2384
  hash,
@@ -2502,8 +2432,8 @@ class PermissionsController {
2502
2432
  functionName: "granteesCount"
2503
2433
  });
2504
2434
  const total = Number(totalCount);
2505
- const limit = options.limit || 50;
2506
- const offset = options.offset || 0;
2435
+ const limit = options.limit ?? 50;
2436
+ const offset = options.offset ?? 0;
2507
2437
  const grantees = [];
2508
2438
  const endIndex = Math.min(offset + limit, total);
2509
2439
  for (let i = offset; i < endIndex; i++) {
@@ -2651,7 +2581,7 @@ class PermissionsController {
2651
2581
  * @private
2652
2582
  */
2653
2583
  async buildRegisterGranteeTypedData(input) {
2654
- const chainId = await this.context.walletClient.getChainId();
2584
+ const chainId = await this.context.publicClient.getChainId();
2655
2585
  const verifyingContract = (0, import_addresses.getContractAddress)(
2656
2586
  chainId,
2657
2587
  "DataPortabilityGrantees"
@@ -2684,6 +2614,7 @@ class PermissionsController {
2684
2614
  * @private
2685
2615
  */
2686
2616
  async submitSignedRegisterGranteeTransaction(typedData, _signature) {
2617
+ this.assertWallet();
2687
2618
  const chainId = await this.context.walletClient.getChainId();
2688
2619
  const DataPortabilityGranteesAddress = (0, import_addresses.getContractAddress)(
2689
2620
  chainId,
@@ -2699,8 +2630,8 @@ class PermissionsController {
2699
2630
  typedData.message.granteeAddress,
2700
2631
  typedData.message.publicKey
2701
2632
  ],
2702
- account: this.context.walletClient.account || await this.getUserAddress(),
2703
- chain: this.context.walletClient.chain || null
2633
+ account: this.context.walletClient?.account ?? this.context.userAddress,
2634
+ chain: this.context.walletClient?.chain ?? null
2704
2635
  });
2705
2636
  return txHash;
2706
2637
  }
@@ -2715,7 +2646,7 @@ class PermissionsController {
2715
2646
  */
2716
2647
  async getUserServerIds(userAddress) {
2717
2648
  try {
2718
- const targetAddress = userAddress || await this.getUserAddress();
2649
+ const targetAddress = userAddress ?? this.context.userAddress;
2719
2650
  const chainId = await this.context.publicClient.getChainId();
2720
2651
  const DataPortabilityServersAddress = (0, import_addresses.getContractAddress)(
2721
2652
  chainId,
@@ -2773,7 +2704,7 @@ class PermissionsController {
2773
2704
  */
2774
2705
  async getUserServerCount(userAddress) {
2775
2706
  try {
2776
- const targetAddress = userAddress || await this.getUserAddress();
2707
+ const targetAddress = userAddress ?? this.context.userAddress;
2777
2708
  const chainId = await this.context.publicClient.getChainId();
2778
2709
  const DataPortabilityServersAddress = (0, import_addresses.getContractAddress)(
2779
2710
  chainId,
@@ -2802,7 +2733,7 @@ class PermissionsController {
2802
2733
  */
2803
2734
  async getUserTrustedServers(userAddress) {
2804
2735
  try {
2805
- const targetAddress = userAddress || await this.getUserAddress();
2736
+ const targetAddress = userAddress ?? this.context.userAddress;
2806
2737
  const chainId = await this.context.publicClient.getChainId();
2807
2738
  const DataPortabilityServersAddress = (0, import_addresses.getContractAddress)(
2808
2739
  chainId,
@@ -2919,7 +2850,7 @@ class PermissionsController {
2919
2850
  */
2920
2851
  async getUserPermissionIds(userAddress) {
2921
2852
  try {
2922
- const targetAddress = userAddress || await this.getUserAddress();
2853
+ const targetAddress = userAddress ?? this.context.userAddress;
2923
2854
  const chainId = await this.context.publicClient.getChainId();
2924
2855
  const DataPortabilityPermissionsAddress = (0, import_addresses.getContractAddress)(
2925
2856
  chainId,
@@ -2981,7 +2912,7 @@ class PermissionsController {
2981
2912
  */
2982
2913
  async getUserPermissionCount(userAddress) {
2983
2914
  try {
2984
- const targetAddress = userAddress || await this.getUserAddress();
2915
+ const targetAddress = userAddress ?? this.context.userAddress;
2985
2916
  const chainId = await this.context.publicClient.getChainId();
2986
2917
  const DataPortabilityPermissionsAddress = (0, import_addresses.getContractAddress)(
2987
2918
  chainId,
@@ -3426,6 +3357,7 @@ class PermissionsController {
3426
3357
  * @returns Promise resolving to transaction hash
3427
3358
  */
3428
3359
  async submitUpdateServer(serverId, url) {
3360
+ this.assertWallet();
3429
3361
  try {
3430
3362
  const chainId = await this.context.walletClient.getChainId();
3431
3363
  const DataPortabilityServersAddress = (0, import_addresses.getContractAddress)(
@@ -3433,13 +3365,13 @@ class PermissionsController {
3433
3365
  "DataPortabilityServers"
3434
3366
  );
3435
3367
  const DataPortabilityServersAbi = (0, import_abi.getAbi)("DataPortabilityServers");
3436
- const account = this.context.walletClient.account || await this.getUserAddress();
3368
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
3437
3369
  const hash = await this.context.walletClient.writeContract({
3438
3370
  address: DataPortabilityServersAddress,
3439
3371
  abi: DataPortabilityServersAbi,
3440
3372
  functionName: "updateServer",
3441
3373
  args: [serverId, url],
3442
- chain: this.context.walletClient.chain,
3374
+ chain: this.context.walletClient?.chain,
3443
3375
  account
3444
3376
  });
3445
3377
  const { tx } = await import("../utils/transactionHelpers");
@@ -3598,6 +3530,7 @@ class PermissionsController {
3598
3530
  * @throws {NetworkError} When network communication fails
3599
3531
  */
3600
3532
  async submitAddPermission(params) {
3533
+ this.assertWallet();
3601
3534
  try {
3602
3535
  const nonce = await this.getPermissionsUserNonce();
3603
3536
  const addPermissionInput = {
@@ -3636,6 +3569,7 @@ class PermissionsController {
3636
3569
  * @throws {NetworkError} When network communication fails
3637
3570
  */
3638
3571
  async submitSignedAddPermission(typedData, signature) {
3572
+ this.assertWallet();
3639
3573
  try {
3640
3574
  let hash;
3641
3575
  if (this.context.relayerCallbacks?.submitAddPermission) {
@@ -3649,7 +3583,7 @@ class PermissionsController {
3649
3583
  signature
3650
3584
  );
3651
3585
  }
3652
- const account = this.context.walletClient.account || await this.getUserAddress();
3586
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
3653
3587
  const { tx } = await import("../utils/transactionHelpers");
3654
3588
  return tx({
3655
3589
  hash,
@@ -3685,7 +3619,7 @@ class PermissionsController {
3685
3619
  * @param params.serverAddress - Server wallet address for decryption permissions
3686
3620
  * @param params.serverUrl - Server endpoint URL
3687
3621
  * @param params.serverPublicKey - Server's public key for encryption.
3688
- * Obtain via `vana.server.getIdentity(userAddress).public_key`.
3622
+ * Obtain via `vana.server.getIdentity(userAddress).publicKey`.
3689
3623
  * @param params.filePermissions - Nested array of permissions for each file
3690
3624
  * @returns TransactionResult with immediate hash access and optional event data
3691
3625
  * @throws {Error} When schemaIds array length doesn't match fileUrls array length
@@ -3707,7 +3641,7 @@ class PermissionsController {
3707
3641
  * schemaIds: [123], // LinkedIn profile schema ID
3708
3642
  * serverAddress: "0x742d35Cc6634C0532925a3b844Bc9e7595f0b0Bb",
3709
3643
  * serverUrl: "https://server.example.com",
3710
- * serverPublicKey: serverInfo.public_key,
3644
+ * serverPublicKey: serverInfo.publicKey,
3711
3645
  * filePermissions: [[{
3712
3646
  * account: "0x742d35Cc6634C0532925a3b844Bc9e7595f0b0Bb",
3713
3647
  * key: encryptedKey
@@ -3718,6 +3652,7 @@ class PermissionsController {
3718
3652
  * ```
3719
3653
  */
3720
3654
  async submitAddServerFilesAndPermissions(params) {
3655
+ this.assertWallet();
3721
3656
  try {
3722
3657
  if (params.schemaIds.length !== params.fileUrls.length) {
3723
3658
  throw new Error(
@@ -3782,6 +3717,7 @@ class PermissionsController {
3782
3717
  * ```
3783
3718
  */
3784
3719
  async submitSignedAddServerFilesAndPermissions(typedData, signature) {
3720
+ this.assertWallet();
3785
3721
  try {
3786
3722
  console.debug("\u{1F50D} submitSignedAddServerFilesAndPermissions Debug Info:", {
3787
3723
  hasRelayerCallbacks: !!this.context.relayerCallbacks,
@@ -3796,7 +3732,7 @@ class PermissionsController {
3796
3732
  typedData,
3797
3733
  signature
3798
3734
  );
3799
- const account = this.context.walletClient.account || await this.getUserAddress();
3735
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
3800
3736
  const { tx } = await import("../utils/transactionHelpers");
3801
3737
  return tx({
3802
3738
  hash,
@@ -3812,11 +3748,11 @@ class PermissionsController {
3812
3748
  typedData,
3813
3749
  signature
3814
3750
  );
3815
- const account = this.context.walletClient.account || await this.getUserAddress();
3751
+ const account = this.context.userAddress;
3816
3752
  const { tx } = await import("../utils/transactionHelpers");
3817
3753
  return tx({
3818
3754
  hash,
3819
- from: typeof account === "string" ? account : account.address,
3755
+ from: account,
3820
3756
  contract: "DataPortabilityPermissions",
3821
3757
  fn: "addServerFilesAndPermissions"
3822
3758
  });
@@ -3838,6 +3774,7 @@ class PermissionsController {
3838
3774
  * @returns Promise resolving to transaction hash
3839
3775
  */
3840
3776
  async submitRevokePermission(permissionId) {
3777
+ this.assertWallet();
3841
3778
  try {
3842
3779
  const chainId = await this.context.walletClient.getChainId();
3843
3780
  const DataPortabilityPermissionsAddress = (0, import_addresses.getContractAddress)(
@@ -3847,7 +3784,7 @@ class PermissionsController {
3847
3784
  const DataPortabilityPermissionsAbi = (0, import_abi.getAbi)(
3848
3785
  "DataPortabilityPermissions"
3849
3786
  );
3850
- const account = this.context.walletClient.account;
3787
+ const { account } = this.context.walletClient;
3851
3788
  if (!account) {
3852
3789
  throw new Error("No wallet account connected");
3853
3790
  }
@@ -3856,7 +3793,7 @@ class PermissionsController {
3856
3793
  abi: DataPortabilityPermissionsAbi,
3857
3794
  functionName: "revokePermission",
3858
3795
  args: [permissionId],
3859
- chain: this.context.walletClient.chain,
3796
+ chain: this.context.walletClient?.chain,
3860
3797
  account
3861
3798
  });
3862
3799
  const { tx } = await import("../utils/transactionHelpers");
@@ -3881,6 +3818,7 @@ class PermissionsController {
3881
3818
  * @returns Promise resolving to the transaction hash
3882
3819
  */
3883
3820
  async submitDirectAddPermissionTransaction(typedData, signature) {
3821
+ this.assertWallet();
3884
3822
  const chainId = await this.context.walletClient.getChainId();
3885
3823
  const DataPortabilityPermissionsAddress = (0, import_addresses.getContractAddress)(
3886
3824
  chainId,
@@ -3891,7 +3829,7 @@ class PermissionsController {
3891
3829
  nonce: typedData.message.nonce,
3892
3830
  granteeId: typedData.message.granteeId,
3893
3831
  grant: typedData.message.grant,
3894
- fileIds: typedData.message.fileIds || []
3832
+ fileIds: typedData.message.fileIds ?? []
3895
3833
  };
3896
3834
  const formattedSignature = (0, import_signatureFormatter.formatSignatureForContract)(signature);
3897
3835
  const hash = await this.context.walletClient.writeContract({
@@ -3899,8 +3837,8 @@ class PermissionsController {
3899
3837
  abi: DataPortabilityPermissionsAbi,
3900
3838
  functionName: "addPermission",
3901
3839
  args: [permissionInput, formattedSignature],
3902
- account: this.context.walletClient.account || await this.getUserAddress(),
3903
- chain: this.context.walletClient.chain || null
3840
+ account: this.context.walletClient?.account ?? this.context.userAddress,
3841
+ chain: this.context.walletClient?.chain ?? null
3904
3842
  });
3905
3843
  return hash;
3906
3844
  }
@@ -3912,7 +3850,8 @@ class PermissionsController {
3912
3850
  * @returns Promise resolving to the transaction hash
3913
3851
  */
3914
3852
  async submitDirectAddServerFilesAndPermissionsTransaction(typedData, signature) {
3915
- const chainId = await this.context.walletClient.getChainId();
3853
+ this.assertWallet();
3854
+ const chainId = await this.context.publicClient.getChainId();
3916
3855
  const DataPortabilityPermissionsAddress = (0, import_addresses.getContractAddress)(
3917
3856
  chainId,
3918
3857
  "DataPortabilityPermissions"
@@ -3936,8 +3875,8 @@ class PermissionsController {
3936
3875
  functionName: "addServerFilesAndPermissions",
3937
3876
  // @ts-expect-error - Viem's type inference for nested Permission[][] arrays is incompatible with our Permission type
3938
3877
  args: [serverFilesAndPermissionInput, formattedSignature],
3939
- account: this.context.walletClient.account || await this.getUserAddress(),
3940
- chain: this.context.walletClient.chain || null
3878
+ account: this.context.userAddress,
3879
+ chain: this.context.walletClient?.chain ?? null
3941
3880
  });
3942
3881
  return hash;
3943
3882
  }