@opendatalabs/vana-sdk 2.3.0 → 3.0.0

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 (618) hide show
  1. package/README.md +76 -92
  2. package/dist/auth/errors.cjs +54 -0
  3. package/dist/auth/errors.cjs.map +1 -0
  4. package/dist/auth/errors.d.ts +26 -0
  5. package/dist/auth/errors.js +28 -0
  6. package/dist/auth/errors.js.map +1 -0
  7. package/dist/auth/pkce.cjs +100 -0
  8. package/dist/auth/pkce.cjs.map +1 -0
  9. package/dist/auth/pkce.d.ts +55 -0
  10. package/dist/auth/pkce.js +71 -0
  11. package/dist/auth/pkce.js.map +1 -0
  12. package/dist/auth/token-store.cjs +59 -0
  13. package/dist/auth/token-store.cjs.map +1 -0
  14. package/dist/auth/token-store.d.ts +61 -0
  15. package/dist/auth/token-store.js +35 -0
  16. package/dist/auth/token-store.js.map +1 -0
  17. package/dist/auth/web3-signed-builder.cjs +70 -0
  18. package/dist/auth/web3-signed-builder.cjs.map +1 -0
  19. package/dist/auth/web3-signed-builder.d.ts +47 -0
  20. package/dist/auth/web3-signed-builder.js +45 -0
  21. package/dist/auth/web3-signed-builder.js.map +1 -0
  22. package/dist/auth/web3-signed.cjs +125 -0
  23. package/dist/auth/web3-signed.cjs.map +1 -0
  24. package/dist/auth/web3-signed.d.ts +59 -0
  25. package/dist/auth/web3-signed.js +104 -0
  26. package/dist/auth/web3-signed.js.map +1 -0
  27. package/dist/chains/definitions.cjs +2 -6
  28. package/dist/chains/definitions.cjs.map +1 -1
  29. package/dist/chains/definitions.d.ts +1 -7
  30. package/dist/chains/definitions.js +2 -6
  31. package/dist/chains/definitions.js.map +1 -1
  32. package/dist/config/chains.d.ts +18 -0
  33. package/dist/config/contracts.config.cjs +7 -95
  34. package/dist/config/contracts.config.cjs.map +1 -1
  35. package/dist/config/contracts.config.d.ts +0 -54
  36. package/dist/config/contracts.config.js +6 -93
  37. package/dist/config/contracts.config.js.map +1 -1
  38. package/dist/config/default-services.cjs +0 -10
  39. package/dist/config/default-services.cjs.map +1 -1
  40. package/dist/config/default-services.d.ts +1 -20
  41. package/dist/config/default-services.js +0 -9
  42. package/dist/config/default-services.js.map +1 -1
  43. package/dist/crypto/ecies/interface.cjs +2 -0
  44. package/dist/crypto/ecies/interface.cjs.map +1 -1
  45. package/dist/crypto/ecies/interface.js +2 -0
  46. package/dist/crypto/ecies/interface.js.map +1 -1
  47. package/dist/crypto/envelope/openpgp.cjs +59 -0
  48. package/dist/crypto/envelope/openpgp.cjs.map +1 -0
  49. package/dist/crypto/envelope/openpgp.d.ts +28 -0
  50. package/dist/crypto/envelope/openpgp.js +24 -0
  51. package/dist/crypto/envelope/openpgp.js.map +1 -0
  52. package/dist/crypto/keys/derive.cjs +65 -0
  53. package/dist/crypto/keys/derive.cjs.map +1 -0
  54. package/dist/crypto/keys/derive.d.ts +45 -0
  55. package/dist/crypto/keys/derive.js +38 -0
  56. package/dist/crypto/keys/derive.js.map +1 -0
  57. package/dist/errors.cjs +10 -0
  58. package/dist/errors.cjs.map +1 -1
  59. package/dist/errors.js +10 -0
  60. package/dist/errors.js.map +1 -1
  61. package/dist/generated/abi/index.cjs +2 -37
  62. package/dist/generated/abi/index.cjs.map +1 -1
  63. package/dist/generated/abi/index.d.ts +2683 -9296
  64. package/dist/generated/abi/index.js +2 -29
  65. package/dist/generated/abi/index.js.map +1 -1
  66. package/dist/generated/addresses.cjs +5 -107
  67. package/dist/generated/addresses.cjs.map +1 -1
  68. package/dist/generated/addresses.d.ts +5 -99
  69. package/dist/generated/addresses.js +5 -105
  70. package/dist/generated/addresses.js.map +1 -1
  71. package/dist/index.browser.d.ts +23 -140
  72. package/dist/index.browser.js +32090 -114
  73. package/dist/index.browser.js.map +7 -1
  74. package/dist/index.node.cjs +32809 -160
  75. package/dist/index.node.cjs.map +7 -1
  76. package/dist/index.node.d.ts +22 -210
  77. package/dist/index.node.js +32716 -133
  78. package/dist/index.node.js.map +7 -1
  79. package/dist/protocol/data-file.cjs +56 -0
  80. package/dist/protocol/data-file.cjs.map +1 -0
  81. package/dist/protocol/data-file.d.ts +20 -0
  82. package/dist/protocol/data-file.js +30 -0
  83. package/dist/protocol/data-file.js.map +1 -0
  84. package/dist/protocol/eip712.cjs +123 -0
  85. package/dist/protocol/eip712.cjs.map +1 -0
  86. package/dist/protocol/eip712.d.ts +117 -0
  87. package/dist/protocol/eip712.js +90 -0
  88. package/dist/protocol/eip712.js.map +1 -0
  89. package/dist/protocol/gateway.cjs +226 -0
  90. package/dist/protocol/gateway.cjs.map +1 -0
  91. package/dist/protocol/gateway.d.ts +120 -0
  92. package/dist/protocol/gateway.js +202 -0
  93. package/dist/protocol/gateway.js.map +1 -0
  94. package/dist/protocol/scopes.cjs +78 -0
  95. package/dist/protocol/scopes.cjs.map +1 -0
  96. package/dist/protocol/scopes.d.ts +13 -0
  97. package/dist/protocol/scopes.js +50 -0
  98. package/dist/protocol/scopes.js.map +1 -0
  99. package/dist/{types/atomicStore.cjs → storage/default.cjs} +9 -8
  100. package/dist/storage/default.cjs.map +1 -0
  101. package/dist/storage/default.d.ts +4 -0
  102. package/dist/storage/default.js +8 -0
  103. package/dist/storage/default.js.map +1 -0
  104. package/dist/storage/index.cjs +11 -2
  105. package/dist/storage/index.cjs.map +1 -1
  106. package/dist/storage/index.d.ts +9 -0
  107. package/dist/storage/index.js +7 -1
  108. package/dist/storage/index.js.map +1 -1
  109. package/dist/storage/providers/callback-storage.cjs +1 -0
  110. package/dist/storage/providers/callback-storage.cjs.map +1 -1
  111. package/dist/storage/providers/callback-storage.js +1 -0
  112. package/dist/storage/providers/callback-storage.js.map +1 -1
  113. package/dist/storage/providers/dropbox.cjs +1 -0
  114. package/dist/storage/providers/dropbox.cjs.map +1 -1
  115. package/dist/storage/providers/dropbox.js +1 -0
  116. package/dist/storage/providers/dropbox.js.map +1 -1
  117. package/dist/storage/providers/google-drive.cjs +1 -0
  118. package/dist/storage/providers/google-drive.cjs.map +1 -1
  119. package/dist/storage/providers/google-drive.js +1 -0
  120. package/dist/storage/providers/google-drive.js.map +1 -1
  121. package/dist/storage/providers/ipfs.cjs +1 -0
  122. package/dist/storage/providers/ipfs.cjs.map +1 -1
  123. package/dist/storage/providers/ipfs.js +1 -0
  124. package/dist/storage/providers/ipfs.js.map +1 -1
  125. package/dist/storage/providers/pinata.cjs +1 -0
  126. package/dist/storage/providers/pinata.cjs.map +1 -1
  127. package/dist/storage/providers/pinata.js +1 -0
  128. package/dist/storage/providers/pinata.js.map +1 -1
  129. package/dist/storage/providers/r2.cjs +376 -0
  130. package/dist/storage/providers/r2.cjs.map +1 -0
  131. package/dist/storage/providers/r2.d.ts +91 -0
  132. package/dist/storage/providers/r2.js +354 -0
  133. package/dist/storage/providers/r2.js.map +1 -0
  134. package/dist/storage/providers/vana-storage.cjs +251 -0
  135. package/dist/storage/providers/vana-storage.cjs.map +1 -0
  136. package/dist/storage/providers/vana-storage.d.ts +100 -0
  137. package/dist/storage/providers/vana-storage.js +231 -0
  138. package/dist/storage/providers/vana-storage.js.map +1 -0
  139. package/dist/types/config.cjs +0 -34
  140. package/dist/types/config.cjs.map +1 -1
  141. package/dist/types/config.d.ts +1 -607
  142. package/dist/types/config.js +0 -22
  143. package/dist/types/config.js.map +1 -1
  144. package/dist/types/contracts.cjs.map +1 -1
  145. package/dist/types/contracts.d.ts +1 -1
  146. package/dist/types/index.cjs +2 -33
  147. package/dist/types/index.cjs.map +1 -1
  148. package/dist/types/index.d.ts +2 -33
  149. package/dist/types/index.js +1 -35
  150. package/dist/types/index.js.map +1 -1
  151. package/dist/types/ps-errors.cjs +66 -0
  152. package/dist/types/ps-errors.cjs.map +1 -0
  153. package/dist/types/ps-errors.d.ts +25 -0
  154. package/dist/types/ps-errors.js +41 -0
  155. package/dist/types/ps-errors.js.map +1 -0
  156. package/dist/types.cjs.map +1 -1
  157. package/dist/types.d.ts +0 -29
  158. package/dist/types.js.map +1 -1
  159. package/package.json +7 -25
  160. package/dist/client/enhancedResponse.cjs +0 -164
  161. package/dist/client/enhancedResponse.cjs.map +0 -1
  162. package/dist/client/enhancedResponse.d.ts +0 -120
  163. package/dist/client/enhancedResponse.js +0 -138
  164. package/dist/client/enhancedResponse.js.map +0 -1
  165. package/dist/controllers/__tests__/data-consistency-integration.test.d.ts +0 -7
  166. package/dist/controllers/base.cjs +0 -116
  167. package/dist/controllers/base.cjs.map +0 -1
  168. package/dist/controllers/base.d.ts +0 -94
  169. package/dist/controllers/base.js +0 -92
  170. package/dist/controllers/base.js.map +0 -1
  171. package/dist/controllers/data.cjs +0 -2633
  172. package/dist/controllers/data.cjs.map +0 -1
  173. package/dist/controllers/data.d.ts +0 -1067
  174. package/dist/controllers/data.js +0 -2626
  175. package/dist/controllers/data.js.map +0 -1
  176. package/dist/controllers/operations.cjs +0 -430
  177. package/dist/controllers/operations.cjs.map +0 -1
  178. package/dist/controllers/operations.d.ts +0 -229
  179. package/dist/controllers/operations.js +0 -406
  180. package/dist/controllers/operations.js.map +0 -1
  181. package/dist/controllers/permissions.cjs +0 -4368
  182. package/dist/controllers/permissions.cjs.map +0 -1
  183. package/dist/controllers/permissions.d.ts +0 -1411
  184. package/dist/controllers/permissions.js +0 -4344
  185. package/dist/controllers/permissions.js.map +0 -1
  186. package/dist/controllers/protocol.cjs +0 -183
  187. package/dist/controllers/protocol.cjs.map +0 -1
  188. package/dist/controllers/protocol.d.ts +0 -138
  189. package/dist/controllers/protocol.js +0 -163
  190. package/dist/controllers/protocol.js.map +0 -1
  191. package/dist/controllers/schemas.cjs +0 -678
  192. package/dist/controllers/schemas.cjs.map +0 -1
  193. package/dist/controllers/schemas.d.ts +0 -293
  194. package/dist/controllers/schemas.js +0 -654
  195. package/dist/controllers/schemas.js.map +0 -1
  196. package/dist/controllers/server.cjs +0 -643
  197. package/dist/controllers/server.cjs.map +0 -1
  198. package/dist/controllers/server.d.ts +0 -322
  199. package/dist/controllers/server.js +0 -624
  200. package/dist/controllers/server.js.map +0 -1
  201. package/dist/controllers/staking.cjs +0 -626
  202. package/dist/controllers/staking.cjs.map +0 -1
  203. package/dist/controllers/staking.d.ts +0 -457
  204. package/dist/controllers/staking.js +0 -602
  205. package/dist/controllers/staking.js.map +0 -1
  206. package/dist/core/__tests__/pollingManager.test.d.ts +0 -4
  207. package/dist/core/apiClient.cjs +0 -378
  208. package/dist/core/apiClient.cjs.map +0 -1
  209. package/dist/core/apiClient.d.ts +0 -286
  210. package/dist/core/apiClient.js +0 -359
  211. package/dist/core/apiClient.js.map +0 -1
  212. package/dist/core/generics.cjs +0 -417
  213. package/dist/core/generics.cjs.map +0 -1
  214. package/dist/core/generics.d.ts +0 -205
  215. package/dist/core/generics.js +0 -386
  216. package/dist/core/generics.js.map +0 -1
  217. package/dist/core/health.cjs +0 -289
  218. package/dist/core/health.cjs.map +0 -1
  219. package/dist/core/health.d.ts +0 -143
  220. package/dist/core/health.js +0 -265
  221. package/dist/core/health.js.map +0 -1
  222. package/dist/core/inMemoryNonceManager.cjs +0 -138
  223. package/dist/core/inMemoryNonceManager.cjs.map +0 -1
  224. package/dist/core/inMemoryNonceManager.d.ts +0 -69
  225. package/dist/core/inMemoryNonceManager.js +0 -114
  226. package/dist/core/inMemoryNonceManager.js.map +0 -1
  227. package/dist/core/nonceManager.cjs +0 -304
  228. package/dist/core/nonceManager.cjs.map +0 -1
  229. package/dist/core/nonceManager.d.ts +0 -116
  230. package/dist/core/nonceManager.js +0 -280
  231. package/dist/core/nonceManager.js.map +0 -1
  232. package/dist/core/pollingManager.cjs +0 -292
  233. package/dist/core/pollingManager.cjs.map +0 -1
  234. package/dist/core/pollingManager.d.ts +0 -120
  235. package/dist/core/pollingManager.js +0 -268
  236. package/dist/core/pollingManager.js.map +0 -1
  237. package/dist/core.cjs +0 -781
  238. package/dist/core.cjs.map +0 -1
  239. package/dist/core.d.ts +0 -496
  240. package/dist/core.js +0 -756
  241. package/dist/core.js.map +0 -1
  242. package/dist/diagnostics.cjs +0 -37
  243. package/dist/diagnostics.cjs.map +0 -1
  244. package/dist/diagnostics.d.ts +0 -24
  245. package/dist/diagnostics.js +0 -13
  246. package/dist/diagnostics.js.map +0 -1
  247. package/dist/diagnostics.test.d.ts +0 -1
  248. package/dist/generated/abi/DLPPerformanceImplementation.cjs +0 -1202
  249. package/dist/generated/abi/DLPPerformanceImplementation.cjs.map +0 -1
  250. package/dist/generated/abi/DLPPerformanceImplementation.d.ts +0 -914
  251. package/dist/generated/abi/DLPPerformanceImplementation.js +0 -1178
  252. package/dist/generated/abi/DLPPerformanceImplementation.js.map +0 -1
  253. package/dist/generated/abi/DLPRewardDeployerImplementation.cjs +0 -1112
  254. package/dist/generated/abi/DLPRewardDeployerImplementation.cjs.map +0 -1
  255. package/dist/generated/abi/DLPRewardDeployerImplementation.d.ts +0 -840
  256. package/dist/generated/abi/DLPRewardDeployerImplementation.js +0 -1088
  257. package/dist/generated/abi/DLPRewardDeployerImplementation.js.map +0 -1
  258. package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.cjs +0 -612
  259. package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.cjs.map +0 -1
  260. package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.d.ts +0 -451
  261. package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.js +0 -588
  262. package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.js.map +0 -1
  263. package/dist/generated/abi/DLPRewardSwapImplementation.cjs +0 -939
  264. package/dist/generated/abi/DLPRewardSwapImplementation.cjs.map +0 -1
  265. package/dist/generated/abi/DLPRewardSwapImplementation.d.ts +0 -705
  266. package/dist/generated/abi/DLPRewardSwapImplementation.js +0 -915
  267. package/dist/generated/abi/DLPRewardSwapImplementation.js.map +0 -1
  268. package/dist/generated/abi/DLPRootImplementation.cjs +0 -1644
  269. package/dist/generated/abi/DLPRootImplementation.cjs.map +0 -1
  270. package/dist/generated/abi/DLPRootImplementation.d.ts +0 -1246
  271. package/dist/generated/abi/DLPRootImplementation.js +0 -1620
  272. package/dist/generated/abi/DLPRootImplementation.js.map +0 -1
  273. package/dist/generated/abi/DataLiquidityPoolImplementation.cjs +0 -985
  274. package/dist/generated/abi/DataLiquidityPoolImplementation.cjs.map +0 -1
  275. package/dist/generated/abi/DataLiquidityPoolImplementation.d.ts +0 -735
  276. package/dist/generated/abi/DataLiquidityPoolImplementation.js +0 -961
  277. package/dist/generated/abi/DataLiquidityPoolImplementation.js.map +0 -1
  278. package/dist/generated/abi/SwapHelperImplementation.cjs +0 -976
  279. package/dist/generated/abi/SwapHelperImplementation.cjs.map +0 -1
  280. package/dist/generated/abi/SwapHelperImplementation.d.ts +0 -728
  281. package/dist/generated/abi/SwapHelperImplementation.js +0 -952
  282. package/dist/generated/abi/SwapHelperImplementation.js.map +0 -1
  283. package/dist/generated/abi/TeePoolImplementation.cjs +0 -1313
  284. package/dist/generated/abi/TeePoolImplementation.cjs.map +0 -1
  285. package/dist/generated/abi/TeePoolImplementation.d.ts +0 -992
  286. package/dist/generated/abi/TeePoolImplementation.js +0 -1289
  287. package/dist/generated/abi/TeePoolImplementation.js.map +0 -1
  288. package/dist/generated/event-types.cjs +0 -17
  289. package/dist/generated/event-types.cjs.map +0 -1
  290. package/dist/generated/event-types.d.ts +0 -816
  291. package/dist/generated/event-types.js +0 -1
  292. package/dist/generated/event-types.js.map +0 -1
  293. package/dist/generated/eventRegistry.cjs +0 -4512
  294. package/dist/generated/eventRegistry.cjs.map +0 -1
  295. package/dist/generated/eventRegistry.d.ts +0 -14
  296. package/dist/generated/eventRegistry.js +0 -4487
  297. package/dist/generated/eventRegistry.js.map +0 -1
  298. package/dist/generated/server/server-exports.cjs +0 -45
  299. package/dist/generated/server/server-exports.cjs.map +0 -1
  300. package/dist/generated/server/server-exports.d.ts +0 -36
  301. package/dist/generated/server/server-exports.js +0 -19
  302. package/dist/generated/server/server-exports.js.map +0 -1
  303. package/dist/generated/server/server.cjs +0 -17
  304. package/dist/generated/server/server.cjs.map +0 -1
  305. package/dist/generated/server/server.d.ts +0 -907
  306. package/dist/generated/server/server.js +0 -1
  307. package/dist/generated/server/server.js.map +0 -1
  308. package/dist/generated/subgraph.cjs +0 -1440
  309. package/dist/generated/subgraph.cjs.map +0 -1
  310. package/dist/generated/subgraph.d.ts +0 -6113
  311. package/dist/generated/subgraph.js +0 -1404
  312. package/dist/generated/subgraph.js.map +0 -1
  313. package/dist/lib/__tests__/redisAtomicStore.test.d.ts +0 -1
  314. package/dist/lib/redisAtomicStore.cjs +0 -201
  315. package/dist/lib/redisAtomicStore.cjs.map +0 -1
  316. package/dist/lib/redisAtomicStore.d.ts +0 -120
  317. package/dist/lib/redisAtomicStore.js +0 -177
  318. package/dist/lib/redisAtomicStore.js.map +0 -1
  319. package/dist/server/relayerHandler.cjs +0 -452
  320. package/dist/server/relayerHandler.cjs.map +0 -1
  321. package/dist/server/relayerHandler.d.ts +0 -69
  322. package/dist/server/relayerHandler.js +0 -428
  323. package/dist/server/relayerHandler.js.map +0 -1
  324. package/dist/tests/abi.test.d.ts +0 -1
  325. package/dist/tests/chains-definitions.test.d.ts +0 -1
  326. package/dist/tests/core-encryption.test.d.ts +0 -1
  327. package/dist/tests/core-extended.test.d.ts +0 -1
  328. package/dist/tests/core-generics-coverage.test.d.ts +0 -1
  329. package/dist/tests/coverage-boost.test.d.ts +0 -1
  330. package/dist/tests/crypto-cross-platform-compatibility.test.d.ts +0 -1
  331. package/dist/tests/data-addfile-permissions-schema.test.d.ts +0 -1
  332. package/dist/tests/data-additional-methods.test.d.ts +0 -1
  333. package/dist/tests/data-controller-edge-cases.test.d.ts +0 -1
  334. package/dist/tests/data-ipfs-gateways.test.d.ts +0 -1
  335. package/dist/tests/data-relayer.test.d.ts +0 -1
  336. package/dist/tests/data-schema-validation.test.d.ts +0 -1
  337. package/dist/tests/data-simple-methods.test.d.ts +0 -1
  338. package/dist/tests/data-upload-owner-validation.test.d.ts +0 -1
  339. package/dist/tests/data.test.d.ts +0 -1
  340. package/dist/tests/demo-integration.test.d.ts +0 -1
  341. package/dist/tests/demo-trusted-server-integration.test.d.ts +0 -1
  342. package/dist/tests/download-relayer.test.d.ts +0 -1
  343. package/dist/tests/dual-mode-permissions.test.d.ts +0 -1
  344. package/dist/tests/dual-mode-trusted-servers.test.d.ts +0 -1
  345. package/dist/tests/encryption-correct-implementation.test.d.ts +0 -1
  346. package/dist/tests/encryption-coverage.test.d.ts +0 -1
  347. package/dist/tests/encryption-edge-cases.test.d.ts +0 -1
  348. package/dist/tests/encryption-utils-updated.test.d.ts +0 -1
  349. package/dist/tests/errors-coverage.test.d.ts +0 -1
  350. package/dist/tests/factories/mockFactory.d.ts +0 -316
  351. package/dist/tests/fakes/FakeStorageManager.d.ts +0 -200
  352. package/dist/tests/fakes/FakeStorageManager.test.d.ts +0 -1
  353. package/dist/tests/fakes/FakeWaitForTransactionEvents.d.ts +0 -170
  354. package/dist/tests/fakes/FakeWaitForTransactionEvents.test.d.ts +0 -1
  355. package/dist/tests/fakes/fake-pgp-port.d.ts +0 -13
  356. package/dist/tests/grantValidation-edge-cases.test.d.ts +0 -1
  357. package/dist/tests/grantValidation-unreachable-branch.test.d.ts +0 -1
  358. package/dist/tests/helper-methods.test.d.ts +0 -1
  359. package/dist/tests/helpers/typedMocks.d.ts +0 -64
  360. package/dist/tests/index-browser.test.d.ts +0 -1
  361. package/dist/tests/index-node.test.d.ts +0 -1
  362. package/dist/tests/index.test.d.ts +0 -1
  363. package/dist/tests/mocks/platformAdapter.d.ts +0 -12
  364. package/dist/tests/new-permissions-methods.test.d.ts +0 -1
  365. package/dist/tests/no-buffer-browser.test.d.ts +0 -1
  366. package/dist/tests/permissions-grantee.test.d.ts +0 -1
  367. package/dist/tests/permissions-revoke-relayer.test.d.ts +0 -1
  368. package/dist/tests/permissions-schema-validation.test.d.ts +0 -1
  369. package/dist/tests/permissions-server-files.test.d.ts +0 -1
  370. package/dist/tests/permissions-transaction-options.test.d.ts +0 -1
  371. package/dist/tests/permissions-trust-servers.test.d.ts +0 -1
  372. package/dist/tests/permissions.test.d.ts +0 -1
  373. package/dist/tests/personal.test.d.ts +0 -1
  374. package/dist/tests/platform-browser.test.d.ts +0 -1
  375. package/dist/tests/platform-crypto-expanded.test.d.ts +0 -1
  376. package/dist/tests/platform-crypto.test.d.ts +0 -1
  377. package/dist/tests/platform-index.test.d.ts +0 -1
  378. package/dist/tests/platform-node.test.d.ts +0 -1
  379. package/dist/tests/platform-shared-utils.test.d.ts +0 -1
  380. package/dist/tests/platform-updated.test.d.ts +0 -1
  381. package/dist/tests/protocol-additional-methods.test.d.ts +0 -1
  382. package/dist/tests/protocol.test.d.ts +0 -1
  383. package/dist/tests/read-only-mode.test.d.ts +0 -1
  384. package/dist/tests/relayer-integration.test.d.ts +0 -1
  385. package/dist/tests/relayer-unified.test.d.ts +0 -1
  386. package/dist/tests/schemas.test.d.ts +0 -1
  387. package/dist/tests/server-relayer-handler.test.d.ts +0 -1
  388. package/dist/tests/signatureFormatter.test.d.ts +0 -1
  389. package/dist/tests/staking.test.d.ts +0 -1
  390. package/dist/tests/trusted-server-queries.test.d.ts +0 -1
  391. package/dist/tests/typedDataConverter.test.d.ts +0 -1
  392. package/dist/tests/types-contracts.test.d.ts +0 -1
  393. package/dist/tests/types-data.test.d.ts +0 -1
  394. package/dist/tests/types-external-apis.test.d.ts +0 -1
  395. package/dist/tests/types-generics.test.d.ts +0 -1
  396. package/dist/tests/types-permissions.test.d.ts +0 -1
  397. package/dist/tests/types-upload-params.test.d.ts +0 -1
  398. package/dist/tests/types.test.d.ts +0 -1
  399. package/dist/tests/utils-formatters.test.d.ts +0 -1
  400. package/dist/tests/utils-grantFiles-edge-cases.test.d.ts +0 -1
  401. package/dist/tests/utils-grantFiles-validation.test.d.ts +0 -1
  402. package/dist/tests/utils-grantFiles.test.d.ts +0 -1
  403. package/dist/tests/utils-grantValidation-consolidated.test.d.ts +0 -1
  404. package/dist/tests/utils-grants.test.d.ts +0 -1
  405. package/dist/tests/utils-ipfs-additional.test.d.ts +0 -1
  406. package/dist/tests/utils-ipfs.test.d.ts +0 -4
  407. package/dist/tests/utils-schemaValidation.test.d.ts +0 -1
  408. package/dist/tests/vana.test.d.ts +0 -1
  409. package/dist/tests/wallet-crypto-compatibility.test.d.ts +0 -1
  410. package/dist/types/atomicStore.cjs.map +0 -1
  411. package/dist/types/atomicStore.d.ts +0 -236
  412. package/dist/types/atomicStore.js +0 -7
  413. package/dist/types/atomicStore.js.map +0 -1
  414. package/dist/types/blockchain.cjs +0 -17
  415. package/dist/types/blockchain.cjs.map +0 -1
  416. package/dist/types/blockchain.d.ts +0 -85
  417. package/dist/types/blockchain.js +0 -1
  418. package/dist/types/blockchain.js.map +0 -1
  419. package/dist/types/controller-context.cjs +0 -17
  420. package/dist/types/controller-context.cjs.map +0 -1
  421. package/dist/types/controller-context.d.ts +0 -68
  422. package/dist/types/controller-context.js +0 -1
  423. package/dist/types/controller-context.js.map +0 -1
  424. package/dist/types/data.cjs +0 -17
  425. package/dist/types/data.cjs.map +0 -1
  426. package/dist/types/data.d.ts +0 -763
  427. package/dist/types/data.js +0 -1
  428. package/dist/types/data.js.map +0 -1
  429. package/dist/types/external-apis.cjs +0 -61
  430. package/dist/types/external-apis.cjs.map +0 -1
  431. package/dist/types/external-apis.d.ts +0 -184
  432. package/dist/types/external-apis.js +0 -34
  433. package/dist/types/external-apis.js.map +0 -1
  434. package/dist/types/generics.cjs +0 -17
  435. package/dist/types/generics.cjs.map +0 -1
  436. package/dist/types/generics.d.ts +0 -518
  437. package/dist/types/generics.js +0 -1
  438. package/dist/types/generics.js.map +0 -1
  439. package/dist/types/operationStore.cjs +0 -17
  440. package/dist/types/operationStore.cjs.map +0 -1
  441. package/dist/types/operationStore.d.ts +0 -171
  442. package/dist/types/operationStore.js +0 -1
  443. package/dist/types/operationStore.js.map +0 -1
  444. package/dist/types/operations.cjs +0 -53
  445. package/dist/types/operations.cjs.map +0 -1
  446. package/dist/types/operations.d.ts +0 -204
  447. package/dist/types/operations.js +0 -26
  448. package/dist/types/operations.js.map +0 -1
  449. package/dist/types/options.cjs +0 -17
  450. package/dist/types/options.cjs.map +0 -1
  451. package/dist/types/options.d.ts +0 -308
  452. package/dist/types/options.js +0 -1
  453. package/dist/types/options.js.map +0 -1
  454. package/dist/types/permissions.cjs +0 -17
  455. package/dist/types/permissions.cjs.map +0 -1
  456. package/dist/types/permissions.d.ts +0 -955
  457. package/dist/types/permissions.js +0 -1
  458. package/dist/types/permissions.js.map +0 -1
  459. package/dist/types/personal.cjs +0 -17
  460. package/dist/types/personal.cjs.map +0 -1
  461. package/dist/types/personal.d.ts +0 -174
  462. package/dist/types/personal.js +0 -1
  463. package/dist/types/personal.js.map +0 -1
  464. package/dist/types/relayer.cjs +0 -17
  465. package/dist/types/relayer.cjs.map +0 -1
  466. package/dist/types/relayer.d.ts +0 -552
  467. package/dist/types/relayer.js +0 -1
  468. package/dist/types/relayer.js.map +0 -1
  469. package/dist/types/transactionResults.cjs +0 -17
  470. package/dist/types/transactionResults.cjs.map +0 -1
  471. package/dist/types/transactionResults.d.ts +0 -193
  472. package/dist/types/transactionResults.js +0 -1
  473. package/dist/types/transactionResults.js.map +0 -1
  474. package/dist/types/utils.cjs +0 -17
  475. package/dist/types/utils.cjs.map +0 -1
  476. package/dist/types/utils.d.ts +0 -771
  477. package/dist/types/utils.js +0 -1
  478. package/dist/types/utils.js.map +0 -1
  479. package/dist/utils/__tests__/chainQuery.test.d.ts +0 -1
  480. package/dist/utils/__tests__/parseTransaction.test.d.ts +0 -1
  481. package/dist/utils/__tests__/pojo-serialization.test.d.ts +0 -1
  482. package/dist/utils/__tests__/signatureCache.test.d.ts +0 -1
  483. package/dist/utils/__tests__/subgraphConsistency.test.d.ts +0 -4
  484. package/dist/utils/__tests__/subgraphPagination.test.d.ts +0 -4
  485. package/dist/utils/__tests__/transaction-edge-cases.test.d.ts +0 -1
  486. package/dist/utils/__tests__/transactionHelpers.test.d.ts +0 -1
  487. package/dist/utils/__tests__/urlResolver.test.d.ts +0 -4
  488. package/dist/utils/blockchain/registry.cjs +0 -81
  489. package/dist/utils/blockchain/registry.cjs.map +0 -1
  490. package/dist/utils/blockchain/registry.d.ts +0 -32
  491. package/dist/utils/blockchain/registry.js +0 -56
  492. package/dist/utils/blockchain/registry.js.map +0 -1
  493. package/dist/utils/blockchain/registry.test.d.ts +0 -1
  494. package/dist/utils/chainQuery.cjs +0 -107
  495. package/dist/utils/chainQuery.cjs.map +0 -1
  496. package/dist/utils/chainQuery.d.ts +0 -31
  497. package/dist/utils/chainQuery.js +0 -82
  498. package/dist/utils/chainQuery.js.map +0 -1
  499. package/dist/utils/download.cjs +0 -69
  500. package/dist/utils/download.cjs.map +0 -1
  501. package/dist/utils/download.d.ts +0 -40
  502. package/dist/utils/download.js +0 -45
  503. package/dist/utils/download.js.map +0 -1
  504. package/dist/utils/encryption.cjs +0 -176
  505. package/dist/utils/encryption.cjs.map +0 -1
  506. package/dist/utils/encryption.d.ts +0 -271
  507. package/dist/utils/encryption.js +0 -142
  508. package/dist/utils/encryption.js.map +0 -1
  509. package/dist/utils/formatters.cjs +0 -55
  510. package/dist/utils/formatters.cjs.map +0 -1
  511. package/dist/utils/formatters.d.ts +0 -118
  512. package/dist/utils/formatters.js +0 -28
  513. package/dist/utils/formatters.js.map +0 -1
  514. package/dist/utils/grantFiles.cjs +0 -181
  515. package/dist/utils/grantFiles.cjs.map +0 -1
  516. package/dist/utils/grantFiles.d.ts +0 -172
  517. package/dist/utils/grantFiles.js +0 -143
  518. package/dist/utils/grantFiles.js.map +0 -1
  519. package/dist/utils/grantValidation.cjs +0 -243
  520. package/dist/utils/grantValidation.cjs.map +0 -1
  521. package/dist/utils/grantValidation.d.ts +0 -226
  522. package/dist/utils/grantValidation.js +0 -201
  523. package/dist/utils/grantValidation.js.map +0 -1
  524. package/dist/utils/grants.cjs +0 -108
  525. package/dist/utils/grants.cjs.map +0 -1
  526. package/dist/utils/grants.d.ts +0 -148
  527. package/dist/utils/grants.js +0 -82
  528. package/dist/utils/grants.js.map +0 -1
  529. package/dist/utils/ipfs.cjs +0 -128
  530. package/dist/utils/ipfs.cjs.map +0 -1
  531. package/dist/utils/ipfs.d.ts +0 -88
  532. package/dist/utils/ipfs.js +0 -97
  533. package/dist/utils/ipfs.js.map +0 -1
  534. package/dist/utils/multicall.cjs +0 -233
  535. package/dist/utils/multicall.cjs.map +0 -1
  536. package/dist/utils/multicall.d.ts +0 -126
  537. package/dist/utils/multicall.js +0 -208
  538. package/dist/utils/multicall.js.map +0 -1
  539. package/dist/utils/parseTransactionPojo.cjs +0 -87
  540. package/dist/utils/parseTransactionPojo.cjs.map +0 -1
  541. package/dist/utils/parseTransactionPojo.d.ts +0 -31
  542. package/dist/utils/parseTransactionPojo.js +0 -63
  543. package/dist/utils/parseTransactionPojo.js.map +0 -1
  544. package/dist/utils/schemaValidation.cjs +0 -258
  545. package/dist/utils/schemaValidation.cjs.map +0 -1
  546. package/dist/utils/schemaValidation.d.ts +0 -168
  547. package/dist/utils/schemaValidation.js +0 -219
  548. package/dist/utils/schemaValidation.js.map +0 -1
  549. package/dist/utils/signatureCache.cjs +0 -192
  550. package/dist/utils/signatureCache.cjs.map +0 -1
  551. package/dist/utils/signatureCache.d.ts +0 -172
  552. package/dist/utils/signatureCache.js +0 -167
  553. package/dist/utils/signatureCache.js.map +0 -1
  554. package/dist/utils/signatureFormatter.cjs +0 -42
  555. package/dist/utils/signatureFormatter.cjs.map +0 -1
  556. package/dist/utils/signatureFormatter.d.ts +0 -36
  557. package/dist/utils/signatureFormatter.js +0 -18
  558. package/dist/utils/signatureFormatter.js.map +0 -1
  559. package/dist/utils/subgraphConsistency.cjs +0 -184
  560. package/dist/utils/subgraphConsistency.cjs.map +0 -1
  561. package/dist/utils/subgraphConsistency.d.ts +0 -65
  562. package/dist/utils/subgraphConsistency.js +0 -155
  563. package/dist/utils/subgraphConsistency.js.map +0 -1
  564. package/dist/utils/subgraphMetaCache.cjs +0 -101
  565. package/dist/utils/subgraphMetaCache.cjs.map +0 -1
  566. package/dist/utils/subgraphMetaCache.d.ts +0 -56
  567. package/dist/utils/subgraphMetaCache.js +0 -76
  568. package/dist/utils/subgraphMetaCache.js.map +0 -1
  569. package/dist/utils/subgraphPagination.cjs +0 -104
  570. package/dist/utils/subgraphPagination.cjs.map +0 -1
  571. package/dist/utils/subgraphPagination.d.ts +0 -78
  572. package/dist/utils/subgraphPagination.js +0 -78
  573. package/dist/utils/subgraphPagination.js.map +0 -1
  574. package/dist/utils/tests/multicall.test.d.ts +0 -1
  575. package/dist/utils/transactionHelpers.cjs +0 -54
  576. package/dist/utils/transactionHelpers.cjs.map +0 -1
  577. package/dist/utils/transactionHelpers.d.ts +0 -80
  578. package/dist/utils/transactionHelpers.js +0 -29
  579. package/dist/utils/transactionHelpers.js.map +0 -1
  580. package/dist/utils/typeGuards.cjs +0 -109
  581. package/dist/utils/typeGuards.cjs.map +0 -1
  582. package/dist/utils/typeGuards.d.ts +0 -138
  583. package/dist/utils/typeGuards.js +0 -74
  584. package/dist/utils/typeGuards.js.map +0 -1
  585. package/dist/utils/typedDataConverter.cjs +0 -43
  586. package/dist/utils/typedDataConverter.cjs.map +0 -1
  587. package/dist/utils/typedDataConverter.d.ts +0 -46
  588. package/dist/utils/typedDataConverter.js +0 -19
  589. package/dist/utils/typedDataConverter.js.map +0 -1
  590. package/dist/utils/urlResolver.cjs +0 -62
  591. package/dist/utils/urlResolver.cjs.map +0 -1
  592. package/dist/utils/urlResolver.d.ts +0 -56
  593. package/dist/utils/urlResolver.js +0 -37
  594. package/dist/utils/urlResolver.js.map +0 -1
  595. package/dist/utils/wallet.cjs +0 -63
  596. package/dist/utils/wallet.cjs.map +0 -1
  597. package/dist/utils/wallet.d.ts +0 -94
  598. package/dist/utils/wallet.js +0 -37
  599. package/dist/utils/wallet.js.map +0 -1
  600. package/dist/utils/withEvents.cjs +0 -44
  601. package/dist/utils/withEvents.cjs.map +0 -1
  602. package/dist/utils/withEvents.d.ts +0 -56
  603. package/dist/utils/withEvents.js +0 -18
  604. package/dist/utils/withEvents.js.map +0 -1
  605. /package/dist/{__tests__/waitForTransactionEvents.test.d.ts → auth/pkce.test.d.ts} +0 -0
  606. /package/dist/{client/__tests__/enhancedResponse.test.d.ts → auth/token-store.test.d.ts} +0 -0
  607. /package/dist/{controllers/__tests__/operations.processQueue.test.d.ts → auth/web3-signed.test.d.ts} +0 -0
  608. /package/dist/{controllers/__tests__/schemas-edge-cases.test.d.ts → crypto/envelope/openpgp.test.d.ts} +0 -0
  609. /package/dist/{controllers/data-error-handling.test.d.ts → crypto/keys/derive.test.d.ts} +0 -0
  610. /package/dist/{tests/errors.test.d.ts → errors.test.d.ts} +0 -0
  611. /package/dist/{controllers/server-additional.test.d.ts → protocol/data-file.test.d.ts} +0 -0
  612. /package/dist/{core/__tests__/health.test.d.ts → protocol/eip712.test.d.ts} +0 -0
  613. /package/dist/{core/__tests__/inMemoryNonceManager.test.d.ts → protocol/gateway.test.d.ts} +0 -0
  614. /package/dist/{core/__tests__/nonceManager.test.d.ts → protocol/scopes.test.d.ts} +0 -0
  615. /package/dist/{core/core.test.d.ts → storage/tests/defaultStorage.test.d.ts} +0 -0
  616. /package/dist/{core/tests/apiClient.test.d.ts → storage/tests/r2Storage.test.d.ts} +0 -0
  617. /package/dist/{core/tests/client.test.d.ts → storage/tests/vanaStorage.test.d.ts} +0 -0
  618. /package/dist/{core/tests/generics.test.d.ts → types/ps-errors.test.d.ts} +0 -0
@@ -1,316 +0,0 @@
1
- /**
2
- * Provides type-safe mock factories for testing Vana SDK components.
3
- *
4
- * @remarks
5
- * This module contains factory functions that create properly typed mock objects
6
- * for testing. These factories eliminate the need for `as any` assertions in tests
7
- * by providing complete implementations with sensible defaults.
8
- *
9
- * ## Usage Patterns
10
- *
11
- * ### Basic Usage
12
- * ```typescript
13
- * const context = createMockControllerContext();
14
- * const controller = new MyController(context);
15
- * ```
16
- *
17
- * ### Direct Transaction Testing (No Relayer/Storage)
18
- * ```typescript
19
- * const context = createMockControllerContextForDirectTransaction();
20
- * ```
21
- *
22
- * ### With Relayer Callbacks
23
- * ```typescript
24
- * const context = createMockControllerContextWithRelayer();
25
- * ```
26
- *
27
- * ### Accessing Mock Methods
28
- * When you need to access mock methods like `mockImplementation`, wrap with `vi.mocked()`:
29
- * ```typescript
30
- * vi.mocked(context.walletClient.signTypedData).mockImplementation(...);
31
- * ```
32
- *
33
- * @category Testing
34
- * @module mockFactory
35
- * @internal
36
- */
37
- import { vi } from "vitest";
38
- import type { WalletClient, PublicClient, Account, Chain, Hash, Address } from "../../types";
39
- import type { ControllerContext } from "../../types/controller-context";
40
- import type { VanaPlatformAdapter } from "../../platform/interface";
41
- import type { StorageManager } from "../../storage/manager";
42
- /**
43
- * Represents a deeply partial version of type T.
44
- *
45
- * @remarks
46
- * This utility type allows for partial overrides at any depth of an object structure,
47
- * making it easy to specify only the properties you want to customize in mocks.
48
- */
49
- export type DeepPartial<T> = {
50
- [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
51
- };
52
- /**
53
- * Creates a mock Viem account for testing.
54
- *
55
- * @param overrides - Optional account properties to override the defaults
56
- * @returns A complete Account object with mock implementations
57
- *
58
- * @example
59
- * ```typescript
60
- * const account = createMockAccount({
61
- * address: "0xCustomAddress"
62
- * });
63
- * ```
64
- */
65
- export declare function createMockAccount(overrides?: Partial<Account>): Account;
66
- /**
67
- * Creates a mock blockchain chain configuration.
68
- *
69
- * @param overrides - Optional chain properties to override the defaults
70
- * @returns A complete Chain object configured for Moksha Testnet by default
71
- *
72
- * @example
73
- * ```typescript
74
- * const chain = createMockChain({
75
- * id: 1480,
76
- * name: "Vana Mainnet"
77
- * });
78
- * ```
79
- */
80
- export declare function createMockChain(overrides?: Partial<Chain>): Chain;
81
- /**
82
- * Creates a fully mocked Viem WalletClient for testing.
83
- *
84
- * @param overrides - Optional nested properties to override the defaults
85
- * @returns A complete WalletClient with all methods mocked
86
- *
87
- * @remarks
88
- * This factory creates a WalletClient with all required methods stubbed.
89
- * The client is configured with a local test account and Moksha Testnet by default.
90
- * All async methods return sensible default values.
91
- *
92
- * @example
93
- * ```typescript
94
- * const wallet = createTypedMockWalletClient({
95
- * account: { address: "0xCustom" },
96
- * chain: { id: 1480 }
97
- * });
98
- * ```
99
- */
100
- export declare function createTypedMockWalletClient(overrides?: DeepPartial<WalletClient>): WalletClient;
101
- /**
102
- * Creates a fully mocked Viem PublicClient for testing.
103
- *
104
- * @param overrides - Optional nested properties to override the defaults
105
- * @returns A complete PublicClient with all methods mocked
106
- *
107
- * @remarks
108
- * This factory creates a PublicClient with all required RPC methods stubbed.
109
- * The client returns sensible default values for blockchain queries.
110
- * Transaction receipts are configured to return success by default.
111
- *
112
- * @example
113
- * ```typescript
114
- * const client = createTypedMockPublicClient({
115
- * chain: { id: 1480 }
116
- * });
117
- * ```
118
- */
119
- export declare function createTypedMockPublicClient(overrides?: DeepPartial<PublicClient>): PublicClient;
120
- /**
121
- * Creates a mock StorageManager using the FakeStorageManager implementation.
122
- *
123
- * @param overrides - Optional properties to override on the fake instance
124
- * @returns A complete StorageManager implementation for testing
125
- *
126
- * @remarks
127
- * This factory uses the FakeStorageManager class instead of complex mocking,
128
- * providing a simpler and more maintainable testing approach.
129
- * The fake maintains in-memory state and tracks method calls.
130
- *
131
- * @example
132
- * ```typescript
133
- * const storage = createTypedMockStorageManager();
134
- * const result = await storage.upload(blob, "test.txt");
135
- * ```
136
- */
137
- export declare function createTypedMockStorageManager(overrides?: Partial<StorageManager>): StorageManager;
138
- /**
139
- * Creates a complete mock ControllerContext for testing controllers.
140
- *
141
- * @param overrides - Optional nested properties to override the defaults
142
- * @returns A ControllerContext with guaranteed waitForTransactionEvents method
143
- *
144
- * @remarks
145
- * This factory creates a complete context object with all required dependencies:
146
- * - WalletClient and PublicClient for blockchain interactions
147
- * - StorageManager for file operations
148
- * - Platform adapter for encryption
149
- * - waitForTransactionEvents using FakeWaitForTransactionEvents
150
- *
151
- * The returned context guarantees that waitForTransactionEvents is always present,
152
- * eliminating the need for conditional checks in tests.
153
- *
154
- * @example
155
- * ```typescript
156
- * const context = createMockControllerContext({
157
- * walletClient: { account: { address: "0xCustom" } }
158
- * });
159
- * const controller = new DataController(context);
160
- * ```
161
- */
162
- export declare function createMockControllerContext(overrides?: DeepPartial<ControllerContext>): ControllerContext & Required<Pick<ControllerContext, "waitForTransactionEvents">>;
163
- /**
164
- * Creates a mock VanaPlatformAdapter for testing.
165
- *
166
- * @param overrides - Optional properties to override the default mock adapter
167
- * @returns A complete VanaPlatformAdapter with encryption and key management methods
168
- *
169
- * @example
170
- * ```typescript
171
- * const platform = createMockPlatform({
172
- * generateKeyPair: vi.fn().mockResolvedValue({ publicKey: "test", privateKey: "test" })
173
- * });
174
- * ```
175
- */
176
- export declare function createMockPlatform(overrides?: Partial<VanaPlatformAdapter>): VanaPlatformAdapter;
177
- /**
178
- * Creates a typed mock function compatible with vitest.
179
- *
180
- * @returns A vi.fn() mock with proper typing
181
- *
182
- * @example
183
- * ```typescript
184
- * const mockCallback = createMockFn<(value: string) => void>();
185
- * mockCallback.mockImplementation((value) => console.log(value));
186
- * ```
187
- */
188
- export declare function createMockFn<T extends (...args: unknown[]) => unknown>(): ReturnType<typeof vi.fn<T>>;
189
- /**
190
- * Safely casts a partial mock to the full type.
191
- *
192
- * @param value - Partial object to cast to full type
193
- * @returns The value cast to type T
194
- *
195
- * @remarks
196
- * Use this as a last resort when the mock factory doesn't cover all properties.
197
- * This is a type assertion helper that should be used sparingly.
198
- *
199
- * @example
200
- * ```typescript
201
- * const partialMock = { someProperty: 'value' };
202
- * const fullMock = safeCast<CompleteType>(partialMock);
203
- * ```
204
- */
205
- export declare function safeCast<T>(value: DeepPartial<T>): T;
206
- /**
207
- * Creates a mock viem Log object for testing.
208
- *
209
- * @param eventName - The name of the event
210
- * @param args - The event arguments
211
- * @returns A complete Log object with all required properties
212
- *
213
- * @remarks
214
- * This factory creates a complete viem Log object with all required blockchain
215
- * metadata. Use this when mocking parseEventLogs return values.
216
- *
217
- * @example
218
- * ```typescript
219
- * const mockLog = createMockLog("PermissionGranted", {
220
- * permissionId: 123n,
221
- * user: "0xUserAddress",
222
- * grant: "grant-data"
223
- * });
224
- * ```
225
- */
226
- export declare function createMockLog(eventName: string, args: Record<string, unknown>): {
227
- eventName: string;
228
- args: Record<string, unknown>;
229
- address: Address;
230
- blockHash: Hash;
231
- blockNumber: bigint;
232
- data: Hash;
233
- logIndex: number;
234
- removed: boolean;
235
- transactionHash: Hash;
236
- transactionIndex: number;
237
- topics: readonly Hash[];
238
- };
239
- /**
240
- * Creates a type-safe mock that only requires specified properties.
241
- *
242
- * @param partial - Partial object with only the properties you need
243
- * @returns The partial object cast to the full type T
244
- *
245
- * @remarks
246
- * This is useful for mocking interfaces where you only care about certain methods.
247
- * The unspecified properties will be undefined at runtime.
248
- *
249
- * @example
250
- * ```typescript
251
- * const mock = createPartialMock<MyInterface>({
252
- * methodICareAbout: vi.fn().mockReturnValue('result'),
253
- * });
254
- * ```
255
- */
256
- export declare function createPartialMock<T>(partial: Partial<T>): T;
257
- /**
258
- * Creates a mock ControllerContext specifically configured for direct transaction testing.
259
- *
260
- * @param overrides - Optional nested properties to override the defaults
261
- * @returns A ControllerContext with no relayer callbacks or storage manager
262
- *
263
- * @remarks
264
- * This factory variant is optimized for testing direct blockchain transactions
265
- * without gasless relayer support. It sets both `relayer` and
266
- * `storageManager` to `undefined`, forcing the controller to use direct transactions.
267
- *
268
- * @example
269
- * ```typescript
270
- * const context = createMockControllerContextForDirectTransaction();
271
- * const controller = new PermissionsController(context);
272
- * // Test will throw "No storage available" error as expected
273
- * await expect(controller.grant(params)).rejects.toThrow("No storage available");
274
- * ```
275
- */
276
- export declare function createMockControllerContextForDirectTransaction(overrides?: DeepPartial<ControllerContext>): ControllerContext & Required<Pick<ControllerContext, "waitForTransactionEvents">>;
277
- /**
278
- * Creates a mock ControllerContext with relayer callbacks configured.
279
- *
280
- * @param overrides - Optional nested properties to override the defaults
281
- * @returns A ControllerContext with default relayer callbacks for gasless transactions
282
- *
283
- * @remarks
284
- * This factory variant provides sensible defaults for testing gasless transactions
285
- * with relayer support. It includes mock implementations for `storeGrantFile` and
286
- * `submitPermissionGrant` that return successful responses.
287
- *
288
- * @example
289
- * ```typescript
290
- * const context = createMockControllerContextWithRelayer();
291
- * const controller = new PermissionsController(context);
292
- * const result = await controller.grant(params);
293
- * expect(context.relayer?.storeGrantFile).toHaveBeenCalled();
294
- * ```
295
- */
296
- export declare function createMockControllerContextWithRelayer(overrides?: DeepPartial<ControllerContext>): ControllerContext & Required<Pick<ControllerContext, "waitForTransactionEvents">>;
297
- /**
298
- * Helper to properly type a mocked client for TypeScript.
299
- *
300
- * @param client - The client to type as mocked
301
- * @returns The client typed with vitest mock methods
302
- *
303
- * @remarks
304
- * Use this when you need TypeScript to recognize mock methods on factory-created clients.
305
- * This is a convenience wrapper around `vi.mocked()`.
306
- *
307
- * @example
308
- * ```typescript
309
- * const context = createMockControllerContext();
310
- * const mockedWallet = asMocked(context.walletClient);
311
- * mockedWallet.signTypedData.mockImplementation((data) => {
312
- * // Custom implementation
313
- * });
314
- * ```
315
- */
316
- export declare function asMocked<T>(client: T): ReturnType<typeof vi.mocked<T>>;
@@ -1,200 +0,0 @@
1
- /**
2
- * Provides a controllable fake implementation of StorageManager for testing.
3
- *
4
- * @remarks
5
- * This test fake replaces complex storage mocking with a simple, in-memory implementation
6
- * that allows tests to configure upload/download behavior without external dependencies.
7
- * Use this when testing controllers that depend on StorageManager functionality.
8
- *
9
- * The fake maintains in-memory maps for uploads and downloads, tracks call counts,
10
- * and supports multiple storage providers for comprehensive testing scenarios.
11
- *
12
- * @category Testing
13
- * @internal
14
- */
15
- import type { StorageProvider, StorageUploadResult, StorageFile, StorageListOptions } from "../../types/storage";
16
- export declare class FakeStorageManager {
17
- private uploads;
18
- private downloads;
19
- private storageProviders;
20
- private defaultProvider;
21
- private uploadCallCount;
22
- private downloadCallCount;
23
- constructor();
24
- /**
25
- * Creates a fake storage provider with basic functionality.
26
- *
27
- * @param name - The name identifier for this provider
28
- * @returns A StorageProvider implementation for testing
29
- */
30
- private createFakeProvider;
31
- /**
32
- * Simulates uploading a file to storage.
33
- *
34
- * @param data - The Blob data to upload
35
- * @param filename - Optional filename for the upload
36
- * @param providerName - Optional storage provider to use (defaults to defaultProvider)
37
- * @returns A promise resolving to the upload result with URL and metadata
38
- *
39
- * @example
40
- * ```typescript
41
- * const fake = new FakeStorageManager();
42
- * const blob = new Blob(["test data"], { type: "text/plain" });
43
- * const result = await fake.upload(blob, "test.txt");
44
- * console.log(result.url); // "https://ipfs.io/ipfs/QmTest1"
45
- * ```
46
- */
47
- upload(data: Blob, _filename?: string, providerName?: string): Promise<StorageUploadResult>;
48
- /**
49
- * Simulates downloading a file from storage.
50
- *
51
- * @param url - The URL to download from
52
- * @returns A promise resolving to the Blob content
53
- *
54
- * @example
55
- * ```typescript
56
- * const fake = new FakeStorageManager();
57
- * const content = new Blob(["hello world"]);
58
- * fake.setDownloadResult("https://test.url", content);
59
- * const downloaded = await fake.download("https://test.url");
60
- * ```
61
- */
62
- download(url: string): Promise<Blob>;
63
- /**
64
- * Lists files in storage, optionally filtered by prefix.
65
- *
66
- * @param options - Optional filtering and pagination options
67
- * @param _providerName - Optional provider name (unused in fake implementation)
68
- * @returns A promise resolving to an array of file objects
69
- *
70
- * @example
71
- * ```typescript
72
- * const fake = new FakeStorageManager();
73
- * await fake.upload(new Blob(["data"]), "file1.txt");
74
- * await fake.upload(new Blob(["data"]), "file2.txt");
75
- * const files = await fake.list();
76
- * // Returns ["https://ipfs.io/ipfs/QmTest1", "https://ipfs.io/ipfs/QmTest2"]
77
- * ```
78
- */
79
- list(options?: StorageListOptions, _providerName?: string): Promise<StorageFile[]>;
80
- /**
81
- * Simulates deleting a file from storage.
82
- *
83
- * @param url - The URL of the file to delete
84
- * @returns A promise resolving to true if deleted, false if not found
85
- */
86
- delete(url: string): Promise<boolean>;
87
- /**
88
- * Registers a custom storage provider.
89
- *
90
- * @param name - The unique name for this provider
91
- * @param provider - The StorageProvider implementation
92
- *
93
- * @example
94
- * ```typescript
95
- * const fake = new FakeStorageManager();
96
- * const customProvider: StorageProvider = {
97
- * upload: async (data) => ({ url: "https://custom.com/file" }),
98
- * download: async (url) => new Blob(["custom"]),
99
- * list: async () => [],
100
- * delete: async () => true,
101
- * getConfig: () => ({})
102
- * };
103
- * fake.register("custom", customProvider);
104
- * ```
105
- */
106
- register(name: string, provider: StorageProvider): void;
107
- /**
108
- * Retrieves a registered storage provider by name.
109
- *
110
- * @param name - The name of the provider to retrieve
111
- * @returns The StorageProvider if found, undefined otherwise
112
- */
113
- getProvider(name?: string): StorageProvider;
114
- /**
115
- * Sets the default storage provider to use.
116
- *
117
- * @param name - The name of a registered provider
118
- * @throws Error if the provider name is not registered
119
- */
120
- setDefaultProvider(name: string): void;
121
- /**
122
- * Lists all registered storage provider names.
123
- *
124
- * @returns Array of provider name strings
125
- */
126
- listProviders(): string[];
127
- /**
128
- * Gets the name of the current default storage provider.
129
- *
130
- * @returns The default provider name
131
- */
132
- getDefaultProvider(): string;
133
- /**
134
- * Gets all registered storage provider names (alias for listProviders).
135
- *
136
- * @returns Array of provider name strings
137
- */
138
- getStorageProviders(): string[];
139
- /**
140
- * Gets the name of the default storage provider (alias for getDefaultProvider).
141
- *
142
- * @returns The default provider name
143
- */
144
- getDefaultStorageProvider(): string;
145
- /**
146
- * Configures a specific upload result for testing.
147
- *
148
- * @param url - The URL to configure
149
- * @param result - The upload result to return for this URL
150
- *
151
- * @example
152
- * ```typescript
153
- * const fake = new FakeStorageManager();
154
- * fake.setUploadResult("https://test.url", {
155
- * url: "https://test.url",
156
- * size: 1024,
157
- * contentType: "application/json"
158
- * });
159
- * ```
160
- */
161
- setUploadResult(url: string, result: StorageUploadResult): void;
162
- /**
163
- * Configures specific download content for a URL.
164
- *
165
- * @param url - The URL to configure
166
- * @param content - The Blob content to return when this URL is downloaded
167
- *
168
- * @example
169
- * ```typescript
170
- * const fake = new FakeStorageManager();
171
- * const testContent = new Blob(["test data"], { type: "text/plain" });
172
- * fake.setDownloadResult("https://test.url", testContent);
173
- * ```
174
- */
175
- setDownloadResult(url: string, content: Blob): void;
176
- /**
177
- * Gets the number of times upload() has been called.
178
- *
179
- * @returns The upload call count
180
- */
181
- getUploadCallCount(): number;
182
- /**
183
- * Gets the number of times download() has been called.
184
- *
185
- * @returns The download call count
186
- */
187
- getDownloadCallCount(): number;
188
- /**
189
- * Resets all state, clearing uploads, downloads, and counters.
190
- *
191
- * @example
192
- * ```typescript
193
- * const fake = new FakeStorageManager();
194
- * await fake.upload(new Blob(["data"]), "file.txt");
195
- * fake.reset();
196
- * const files = await fake.list(); // Returns []
197
- * ```
198
- */
199
- reset(): void;
200
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,170 +0,0 @@
1
- /**
2
- * Provides a controllable fake implementation of transaction event waiting for testing.
3
- *
4
- * @remarks
5
- * This test fake replaces complex mocking with a simple, predictable implementation
6
- * that allows tests to configure specific responses for transaction hashes.
7
- * Use this when testing controllers that depend on waitForTransactionEvents functionality.
8
- *
9
- * The fake maintains separate maps for responses and errors, allowing tests to
10
- * simulate both successful and failing transaction scenarios.
11
- *
12
- * @category Testing
13
- * @internal
14
- */
15
- import type { Hash, Address } from "viem";
16
- /**
17
- * Minimal TransactionResult interface to avoid circular dependencies.
18
- * Mirrors the actual TransactionResult from types/operations.
19
- */
20
- interface TransactionResultLike {
21
- hash: Hash;
22
- from?: Address;
23
- contract?: string;
24
- fn?: string;
25
- }
26
- /**
27
- * Represents the result of waiting for transaction events.
28
- */
29
- export interface TransactionEventResult {
30
- /** The transaction hash that was monitored */
31
- hash: Hash;
32
- /** The address that initiated the transaction */
33
- from: Address;
34
- /** The name of the contract that was called */
35
- contract: string;
36
- /** The function name that was invoked */
37
- fn: string;
38
- /** Map of expected events that were emitted, keyed by event name */
39
- expectedEvents: Record<string, unknown>;
40
- /** Array of all events emitted by the transaction */
41
- allEvents: unknown[];
42
- /** Whether all expected events were found in the transaction */
43
- hasExpectedEvents: boolean;
44
- }
45
- export declare class FakeWaitForTransactionEvents {
46
- private responses;
47
- private errors;
48
- private defaultResponse;
49
- /**
50
- * Configures a specific response for a given transaction hash.
51
- *
52
- * @param hash - The transaction hash to configure a response for
53
- * @param response - The response object to return when this hash is queried
54
- *
55
- * @example
56
- * ```typescript
57
- * const fake = new FakeWaitForTransactionEvents();
58
- * fake.setResponse("0xabc123", {
59
- * hash: "0xabc123" as Hash,
60
- * from: "0xuser",
61
- * contract: "DataRegistry",
62
- * fn: "addFile",
63
- * expectedEvents: { FileAdded: { fileId: 1n } },
64
- * allEvents: [],
65
- * hasExpectedEvents: true
66
- * });
67
- * ```
68
- */
69
- setResponse(hash: string, response: TransactionEventResult): void;
70
- /**
71
- * Configures an error to be thrown for a specific transaction hash.
72
- *
73
- * @param hash - The transaction hash that should trigger an error
74
- * @param error - The error to throw when this hash is queried
75
- *
76
- * @example
77
- * ```typescript
78
- * const fake = new FakeWaitForTransactionEvents();
79
- * fake.setError("0xfailed", new Error("Transaction timeout"));
80
- * ```
81
- */
82
- setError(hash: string, error: Error): void;
83
- /**
84
- * Sets the default response returned for any unconfigured transaction hash.
85
- *
86
- * @param response - The default response object to use
87
- *
88
- * @example
89
- * ```typescript
90
- * const fake = new FakeWaitForTransactionEvents();
91
- * fake.setDefaultResponse({
92
- * hash: "0xdefault" as Hash,
93
- * from: "0xdefault",
94
- * contract: "TestContract",
95
- * fn: "testFunction",
96
- * expectedEvents: {},
97
- * allEvents: [],
98
- * hasExpectedEvents: false
99
- * });
100
- * ```
101
- */
102
- setDefaultResponse(response: TransactionEventResult): void;
103
- /**
104
- * Simulates waiting for transaction events, returning configured responses or throwing configured errors.
105
- *
106
- * @param txOrHash - A TransactionResult-like object or raw transaction hash string
107
- * @returns A promise that resolves with the configured response for this hash
108
- * @throws The configured error for this hash, if one was set
109
- */
110
- wait(txOrHash: TransactionResultLike | Hash | string): Promise<TransactionEventResult>;
111
- /**
112
- * Clears all configured responses and errors, resetting the fake to its initial state.
113
- */
114
- reset(): void;
115
- /**
116
- * Gets all transaction hashes that have configured responses.
117
- *
118
- * @returns Array of transaction hash strings
119
- */
120
- getConfiguredHashes(): string[];
121
- /**
122
- * Creates a function that can be used as a mock implementation in vitest.
123
- *
124
- * @returns A function compatible with vi.fn().mockImplementation()
125
- *
126
- * @example
127
- * ```typescript
128
- * const fake = new FakeWaitForTransactionEvents();
129
- * const mockWaitForTransactionEvents = vi.fn()
130
- * .mockImplementation(fake.asMockFunction());
131
- * ```
132
- */
133
- asMockFunction(): (txOrHash: TransactionResultLike | Hash | string) => Promise<TransactionEventResult>;
134
- /**
135
- * Creates a pre-configured response object for a successful SchemaAdded event.
136
- *
137
- * @param schemaId - The ID of the schema that was added
138
- * @param name - The name of the schema
139
- * @param dialect - The dialect/format of the schema (e.g., "json", "jsonschema")
140
- * @param definitionUrl - The URL where the schema definition is stored
141
- * @param hash - The transaction hash (defaults to "0xtxhash")
142
- * @returns A complete TransactionEventResult object for a SchemaAdded event
143
- *
144
- * @example
145
- * ```typescript
146
- * const response = FakeWaitForTransactionEvents.createSchemaAddedResponse(
147
- * 123n,
148
- * "UserProfile",
149
- * "jsonschema",
150
- * "https://ipfs.io/ipfs/QmHash"
151
- * );
152
- * fake.setResponse("0xtxhash", response);
153
- * ```
154
- */
155
- static createSchemaAddedResponse(schemaId: bigint, name: string, dialect: string, definitionUrl: string, hash?: Hash): TransactionEventResult;
156
- /**
157
- * Creates a response object representing a transaction with no expected events.
158
- *
159
- * @param hash - The transaction hash (defaults to "0xtxhash")
160
- * @returns A TransactionEventResult with hasExpectedEvents set to false
161
- *
162
- * @example
163
- * ```typescript
164
- * const emptyResponse = FakeWaitForTransactionEvents.createEmptyResponse();
165
- * fake.setResponse("0xempty", emptyResponse);
166
- * ```
167
- */
168
- static createEmptyResponse(hash?: Hash): TransactionEventResult;
169
- }
170
- export {};