@opendatalabs/vana-sdk 0.1.0-alpha.9b6ddbc → 0.1.0-alpha.9bbda27

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 (432) hide show
  1. package/README.md +67 -351
  2. package/dist/client/__tests__/enhancedResponse.test.d.ts +1 -0
  3. package/dist/client/enhancedResponse.cjs +164 -0
  4. package/dist/client/enhancedResponse.cjs.map +1 -0
  5. package/dist/client/enhancedResponse.d.ts +120 -0
  6. package/dist/client/enhancedResponse.js +138 -0
  7. package/dist/client/enhancedResponse.js.map +1 -0
  8. package/dist/config/contracts.config.cjs +403 -0
  9. package/dist/config/contracts.config.cjs.map +1 -0
  10. package/dist/config/contracts.config.d.ts +84 -0
  11. package/dist/config/contracts.config.js +378 -0
  12. package/dist/config/contracts.config.js.map +1 -0
  13. package/dist/contracts/contractController.cjs +1 -1
  14. package/dist/contracts/contractController.cjs.map +1 -1
  15. package/dist/contracts/contractController.js +1 -1
  16. package/dist/contracts/contractController.js.map +1 -1
  17. package/dist/controllers/__tests__/data-consistency-integration.test.d.ts +7 -0
  18. package/dist/controllers/__tests__/operations.processQueue.test.d.ts +1 -0
  19. package/dist/controllers/accessSettlement.cjs +289 -0
  20. package/dist/controllers/accessSettlement.cjs.map +1 -0
  21. package/dist/controllers/accessSettlement.d.ts +157 -0
  22. package/dist/controllers/accessSettlement.js +265 -0
  23. package/dist/controllers/accessSettlement.js.map +1 -0
  24. package/dist/controllers/accessSettlement.test.d.ts +1 -0
  25. package/dist/controllers/base.cjs +33 -0
  26. package/dist/controllers/base.cjs.map +1 -1
  27. package/dist/controllers/base.d.ts +10 -0
  28. package/dist/controllers/base.js +33 -0
  29. package/dist/controllers/base.js.map +1 -1
  30. package/dist/controllers/data.cjs +279 -160
  31. package/dist/controllers/data.cjs.map +1 -1
  32. package/dist/controllers/data.d.ts +34 -19
  33. package/dist/controllers/data.js +292 -163
  34. package/dist/controllers/data.js.map +1 -1
  35. package/dist/controllers/dataset.cjs +357 -0
  36. package/dist/controllers/dataset.cjs.map +1 -0
  37. package/dist/controllers/dataset.d.ts +178 -0
  38. package/dist/controllers/dataset.js +333 -0
  39. package/dist/controllers/dataset.js.map +1 -0
  40. package/dist/controllers/dataset.test.d.ts +1 -0
  41. package/dist/controllers/operations.cjs +430 -0
  42. package/dist/controllers/operations.cjs.map +1 -0
  43. package/dist/controllers/operations.d.ts +229 -0
  44. package/dist/controllers/operations.js +406 -0
  45. package/dist/controllers/operations.js.map +1 -0
  46. package/dist/controllers/permissions.cjs +606 -214
  47. package/dist/controllers/permissions.cjs.map +1 -1
  48. package/dist/controllers/permissions.d.ts +141 -34
  49. package/dist/controllers/permissions.js +606 -214
  50. package/dist/controllers/permissions.js.map +1 -1
  51. package/dist/controllers/runtimePermissions.cjs +285 -0
  52. package/dist/controllers/runtimePermissions.cjs.map +1 -0
  53. package/dist/controllers/runtimePermissions.d.ts +152 -0
  54. package/dist/controllers/runtimePermissions.js +264 -0
  55. package/dist/controllers/runtimePermissions.js.map +1 -0
  56. package/dist/controllers/runtimePermissions.test.d.ts +1 -0
  57. package/dist/controllers/schemas.cjs +82 -5
  58. package/dist/controllers/schemas.cjs.map +1 -1
  59. package/dist/controllers/schemas.d.ts +41 -0
  60. package/dist/controllers/schemas.js +82 -5
  61. package/dist/controllers/schemas.js.map +1 -1
  62. package/dist/controllers/server.cjs +184 -49
  63. package/dist/controllers/server.cjs.map +1 -1
  64. package/dist/controllers/server.d.ts +74 -13
  65. package/dist/controllers/server.js +184 -49
  66. package/dist/controllers/server.js.map +1 -1
  67. package/dist/core/__tests__/health.test.d.ts +1 -0
  68. package/dist/core/__tests__/inMemoryNonceManager.test.d.ts +1 -0
  69. package/dist/core/__tests__/nonceManager.test.d.ts +1 -0
  70. package/dist/core/__tests__/pollingManager.test.d.ts +4 -0
  71. package/dist/core/health.cjs +289 -0
  72. package/dist/core/health.cjs.map +1 -0
  73. package/dist/core/health.d.ts +143 -0
  74. package/dist/core/health.js +265 -0
  75. package/dist/core/health.js.map +1 -0
  76. package/dist/core/inMemoryNonceManager.cjs +138 -0
  77. package/dist/core/inMemoryNonceManager.cjs.map +1 -0
  78. package/dist/core/inMemoryNonceManager.d.ts +69 -0
  79. package/dist/core/inMemoryNonceManager.js +114 -0
  80. package/dist/core/inMemoryNonceManager.js.map +1 -0
  81. package/dist/core/nonceManager.cjs +304 -0
  82. package/dist/core/nonceManager.cjs.map +1 -0
  83. package/dist/core/nonceManager.d.ts +116 -0
  84. package/dist/core/nonceManager.js +280 -0
  85. package/dist/core/nonceManager.js.map +1 -0
  86. package/dist/core/pollingManager.cjs +292 -0
  87. package/dist/core/pollingManager.cjs.map +1 -0
  88. package/dist/core/pollingManager.d.ts +120 -0
  89. package/dist/core/pollingManager.js +268 -0
  90. package/dist/core/pollingManager.js.map +1 -0
  91. package/dist/core.cjs +67 -1
  92. package/dist/core.cjs.map +1 -1
  93. package/dist/core.d.ts +63 -3
  94. package/dist/core.js +67 -1
  95. package/dist/core.js.map +1 -1
  96. package/dist/crypto/ecies/__tests__/constants.test.d.ts +1 -1
  97. package/dist/crypto/ecies/__tests__/interface.test.d.ts +1 -0
  98. package/dist/crypto/ecies/__tests__/serialization.test.d.ts +8 -0
  99. package/dist/crypto/ecies/__tests__/utils.test.d.ts +1 -0
  100. package/dist/crypto/ecies/base.cjs +59 -23
  101. package/dist/crypto/ecies/base.cjs.map +1 -1
  102. package/dist/crypto/ecies/base.js +59 -23
  103. package/dist/crypto/ecies/base.js.map +1 -1
  104. package/dist/crypto/ecies/constants.cjs +2 -10
  105. package/dist/crypto/ecies/constants.cjs.map +1 -1
  106. package/dist/crypto/ecies/constants.d.ts +0 -9
  107. package/dist/crypto/ecies/constants.js +1 -8
  108. package/dist/crypto/ecies/constants.js.map +1 -1
  109. package/dist/crypto/ecies/index.cjs.map +1 -1
  110. package/dist/crypto/ecies/index.d.ts +10 -2
  111. package/dist/crypto/ecies/index.js.map +1 -1
  112. package/dist/crypto/ecies/interface.cjs +19 -2
  113. package/dist/crypto/ecies/interface.cjs.map +1 -1
  114. package/dist/crypto/ecies/interface.js +19 -2
  115. package/dist/crypto/ecies/interface.js.map +1 -1
  116. package/dist/errors.cjs +29 -0
  117. package/dist/errors.cjs.map +1 -1
  118. package/dist/errors.d.ts +64 -0
  119. package/dist/errors.js +28 -0
  120. package/dist/errors.js.map +1 -1
  121. package/dist/generated/abi/AccessSettlementImplementation.cjs +635 -0
  122. package/dist/generated/abi/AccessSettlementImplementation.cjs.map +1 -0
  123. package/dist/generated/abi/AccessSettlementImplementation.d.ts +468 -0
  124. package/dist/generated/abi/AccessSettlementImplementation.js +611 -0
  125. package/dist/generated/abi/AccessSettlementImplementation.js.map +1 -0
  126. package/dist/generated/abi/AttestationPolicyImplementation.cjs +614 -0
  127. package/dist/generated/abi/AttestationPolicyImplementation.cjs.map +1 -0
  128. package/dist/generated/abi/AttestationPolicyImplementation.d.ts +449 -0
  129. package/dist/generated/abi/AttestationPolicyImplementation.js +590 -0
  130. package/dist/generated/abi/AttestationPolicyImplementation.js.map +1 -0
  131. package/dist/generated/abi/ComputeEngineImplementation.cjs.map +1 -1
  132. package/dist/generated/abi/ComputeEngineImplementation.js.map +1 -1
  133. package/dist/generated/abi/{DLPTreasuryImplementation.cjs → ComputeEngineTreasuryImplementation.cjs} +16 -92
  134. package/dist/generated/abi/ComputeEngineTreasuryImplementation.cjs.map +1 -0
  135. package/dist/generated/abi/{DLPTreasuryImplementation.d.ts → ComputeEngineTreasuryImplementation.d.ts} +9 -67
  136. package/dist/generated/abi/{DLPTreasuryImplementation.js → ComputeEngineTreasuryImplementation.js} +12 -88
  137. package/dist/generated/abi/ComputeEngineTreasuryImplementation.js.map +1 -0
  138. package/dist/generated/abi/ComputeInstructionRegistryImplementation.cjs.map +1 -1
  139. package/dist/generated/abi/ComputeInstructionRegistryImplementation.js.map +1 -1
  140. package/dist/generated/abi/DATFactoryImplementation.cjs.map +1 -1
  141. package/dist/generated/abi/DATFactoryImplementation.js.map +1 -1
  142. package/dist/generated/abi/DATImplementation.cjs.map +1 -1
  143. package/dist/generated/abi/DATImplementation.js.map +1 -1
  144. package/dist/generated/abi/DATPausableImplementation.cjs.map +1 -1
  145. package/dist/generated/abi/DATPausableImplementation.js.map +1 -1
  146. package/dist/generated/abi/DATVotesImplementation.cjs.map +1 -1
  147. package/dist/generated/abi/DATVotesImplementation.js.map +1 -1
  148. package/dist/generated/abi/DLPPerformanceImplementation.cjs +42 -0
  149. package/dist/generated/abi/DLPPerformanceImplementation.cjs.map +1 -1
  150. package/dist/generated/abi/DLPPerformanceImplementation.d.ts +32 -0
  151. package/dist/generated/abi/DLPPerformanceImplementation.js +42 -0
  152. package/dist/generated/abi/DLPPerformanceImplementation.js.map +1 -1
  153. package/dist/generated/abi/DLPRegistryImplementation.cjs +5 -5
  154. package/dist/generated/abi/DLPRegistryImplementation.cjs.map +1 -1
  155. package/dist/generated/abi/DLPRegistryImplementation.d.ts +4 -4
  156. package/dist/generated/abi/DLPRegistryImplementation.js +5 -5
  157. package/dist/generated/abi/DLPRegistryImplementation.js.map +1 -1
  158. package/dist/generated/abi/DLPRegistryTreasuryImplementation.cjs.map +1 -1
  159. package/dist/generated/abi/DLPRegistryTreasuryImplementation.js.map +1 -1
  160. package/dist/generated/abi/DLPRewardDeployerImplementation.cjs +166 -2
  161. package/dist/generated/abi/DLPRewardDeployerImplementation.cjs.map +1 -1
  162. package/dist/generated/abi/DLPRewardDeployerImplementation.d.ts +129 -2
  163. package/dist/generated/abi/DLPRewardDeployerImplementation.js +166 -2
  164. package/dist/generated/abi/DLPRewardDeployerImplementation.js.map +1 -1
  165. package/dist/generated/abi/DLPRewardSwapImplementation.cjs.map +1 -1
  166. package/dist/generated/abi/DLPRewardSwapImplementation.js.map +1 -1
  167. package/dist/generated/abi/DataLiquidityPoolImplementation.cjs +282 -100
  168. package/dist/generated/abi/DataLiquidityPoolImplementation.cjs.map +1 -1
  169. package/dist/generated/abi/DataLiquidityPoolImplementation.d.ts +218 -79
  170. package/dist/generated/abi/DataLiquidityPoolImplementation.js +281 -99
  171. package/dist/generated/abi/DataLiquidityPoolImplementation.js.map +1 -1
  172. package/dist/generated/abi/DataPortabilityGranteesImplementation.cjs +167 -19
  173. package/dist/generated/abi/DataPortabilityGranteesImplementation.cjs.map +1 -1
  174. package/dist/generated/abi/DataPortabilityGranteesImplementation.d.ts +127 -14
  175. package/dist/generated/abi/DataPortabilityGranteesImplementation.js +167 -19
  176. package/dist/generated/abi/DataPortabilityGranteesImplementation.js.map +1 -1
  177. package/dist/generated/abi/DataPortabilityPermissionsImplementation.cjs +0 -19
  178. package/dist/generated/abi/DataPortabilityPermissionsImplementation.cjs.map +1 -1
  179. package/dist/generated/abi/DataPortabilityPermissionsImplementation.d.ts +0 -14
  180. package/dist/generated/abi/DataPortabilityPermissionsImplementation.js +0 -19
  181. package/dist/generated/abi/DataPortabilityPermissionsImplementation.js.map +1 -1
  182. package/dist/generated/abi/DataPortabilityServersImplementation.cjs +0 -19
  183. package/dist/generated/abi/DataPortabilityServersImplementation.cjs.map +1 -1
  184. package/dist/generated/abi/DataPortabilityServersImplementation.d.ts +0 -14
  185. package/dist/generated/abi/DataPortabilityServersImplementation.js +0 -19
  186. package/dist/generated/abi/DataPortabilityServersImplementation.js.map +1 -1
  187. package/dist/generated/abi/DataRefinerRegistryImplementation.cjs.map +1 -1
  188. package/dist/generated/abi/DataRefinerRegistryImplementation.js.map +1 -1
  189. package/dist/generated/abi/DataRegistryImplementation.cjs +0 -13
  190. package/dist/generated/abi/DataRegistryImplementation.cjs.map +1 -1
  191. package/dist/generated/abi/DataRegistryImplementation.d.ts +0 -10
  192. package/dist/generated/abi/DataRegistryImplementation.js +0 -13
  193. package/dist/generated/abi/DataRegistryImplementation.js.map +1 -1
  194. package/dist/generated/abi/DatasetRegistryImplementation.cjs +751 -0
  195. package/dist/generated/abi/DatasetRegistryImplementation.cjs.map +1 -0
  196. package/dist/generated/abi/DatasetRegistryImplementation.d.ts +557 -0
  197. package/dist/generated/abi/DatasetRegistryImplementation.js +727 -0
  198. package/dist/generated/abi/DatasetRegistryImplementation.js.map +1 -0
  199. package/dist/generated/abi/ProtocolConfigImplementation.cjs +578 -0
  200. package/dist/generated/abi/ProtocolConfigImplementation.cjs.map +1 -0
  201. package/dist/generated/abi/ProtocolConfigImplementation.d.ts +423 -0
  202. package/dist/generated/abi/ProtocolConfigImplementation.js +554 -0
  203. package/dist/generated/abi/ProtocolConfigImplementation.js.map +1 -0
  204. package/dist/generated/abi/QueryEngineImplementation.cjs.map +1 -1
  205. package/dist/generated/abi/QueryEngineImplementation.js.map +1 -1
  206. package/dist/generated/abi/SwapHelperImplementation.cjs +0 -43
  207. package/dist/generated/abi/SwapHelperImplementation.cjs.map +1 -1
  208. package/dist/generated/abi/SwapHelperImplementation.d.ts +0 -35
  209. package/dist/generated/abi/SwapHelperImplementation.js +0 -43
  210. package/dist/generated/abi/SwapHelperImplementation.js.map +1 -1
  211. package/dist/generated/abi/TeePoolDedicatedGpuImplementation.cjs.map +1 -1
  212. package/dist/generated/abi/TeePoolDedicatedGpuImplementation.js.map +1 -1
  213. package/dist/generated/abi/TeePoolDedicatedStandardImplementation.cjs.map +1 -1
  214. package/dist/generated/abi/TeePoolDedicatedStandardImplementation.js.map +1 -1
  215. package/dist/generated/abi/TeePoolEphemeralStandardImplementation.cjs.map +1 -1
  216. package/dist/generated/abi/TeePoolEphemeralStandardImplementation.js.map +1 -1
  217. package/dist/generated/abi/TeePoolPersistentGpuImplementation.cjs.map +1 -1
  218. package/dist/generated/abi/TeePoolPersistentGpuImplementation.js.map +1 -1
  219. package/dist/generated/abi/TeePoolPersistentStandardImplementation.cjs.map +1 -1
  220. package/dist/generated/abi/TeePoolPersistentStandardImplementation.js.map +1 -1
  221. package/dist/generated/abi/TeePoolPhalaImplementation.cjs.map +1 -1
  222. package/dist/generated/abi/TeePoolPhalaImplementation.js.map +1 -1
  223. package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.cjs +1251 -0
  224. package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.cjs.map +1 -0
  225. package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.d.ts +948 -0
  226. package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.js +1227 -0
  227. package/dist/generated/abi/UniswapV3NonfungiblePositionManagerImplementation.js.map +1 -0
  228. package/dist/generated/abi/UniswapV3QuoterV2Implementation.cjs +297 -0
  229. package/dist/generated/abi/UniswapV3QuoterV2Implementation.cjs.map +1 -0
  230. package/dist/generated/abi/UniswapV3QuoterV2Implementation.d.ts +206 -0
  231. package/dist/generated/abi/UniswapV3QuoterV2Implementation.js +273 -0
  232. package/dist/generated/abi/UniswapV3QuoterV2Implementation.js.map +1 -0
  233. package/dist/generated/abi/VanaEpochImplementation.cjs +195 -0
  234. package/dist/generated/abi/VanaEpochImplementation.cjs.map +1 -1
  235. package/dist/generated/abi/VanaEpochImplementation.d.ts +151 -0
  236. package/dist/generated/abi/VanaEpochImplementation.js +195 -0
  237. package/dist/generated/abi/VanaEpochImplementation.js.map +1 -1
  238. package/dist/generated/abi/VanaPoolEntityImplementation.cjs +22 -65
  239. package/dist/generated/abi/VanaPoolEntityImplementation.cjs.map +1 -1
  240. package/dist/generated/abi/VanaPoolEntityImplementation.d.ts +17 -51
  241. package/dist/generated/abi/VanaPoolEntityImplementation.js +22 -65
  242. package/dist/generated/abi/VanaPoolEntityImplementation.js.map +1 -1
  243. package/dist/generated/abi/VanaPoolStakingImplementation.cjs +113 -1
  244. package/dist/generated/abi/VanaPoolStakingImplementation.cjs.map +1 -1
  245. package/dist/generated/abi/VanaPoolStakingImplementation.d.ts +85 -1
  246. package/dist/generated/abi/VanaPoolStakingImplementation.js +113 -1
  247. package/dist/generated/abi/VanaPoolStakingImplementation.js.map +1 -1
  248. package/dist/generated/abi/VanaPoolTreasuryImplementation.cjs.map +1 -1
  249. package/dist/generated/abi/VanaPoolTreasuryImplementation.js.map +1 -1
  250. package/dist/generated/abi/VanaRuntimePermissionsImplementation.cjs +759 -0
  251. package/dist/generated/abi/VanaRuntimePermissionsImplementation.cjs.map +1 -0
  252. package/dist/generated/abi/VanaRuntimePermissionsImplementation.d.ts +563 -0
  253. package/dist/generated/abi/VanaRuntimePermissionsImplementation.js +735 -0
  254. package/dist/generated/abi/VanaRuntimePermissionsImplementation.js.map +1 -0
  255. package/dist/generated/abi/VanaRuntimeServersImplementation.cjs +820 -0
  256. package/dist/generated/abi/VanaRuntimeServersImplementation.cjs.map +1 -0
  257. package/dist/generated/abi/VanaRuntimeServersImplementation.d.ts +609 -0
  258. package/dist/generated/abi/VanaRuntimeServersImplementation.js +796 -0
  259. package/dist/generated/abi/VanaRuntimeServersImplementation.js.map +1 -0
  260. package/dist/generated/abi/VanaTreasuryImplementation.cjs +536 -0
  261. package/dist/generated/abi/VanaTreasuryImplementation.cjs.map +1 -0
  262. package/dist/generated/abi/VanaTreasuryImplementation.d.ts +393 -0
  263. package/dist/generated/abi/VanaTreasuryImplementation.js +512 -0
  264. package/dist/generated/abi/VanaTreasuryImplementation.js.map +1 -0
  265. package/dist/generated/abi/WVANAImplementation.cjs +339 -0
  266. package/dist/generated/abi/WVANAImplementation.cjs.map +1 -0
  267. package/dist/generated/abi/WVANAImplementation.d.ts +244 -0
  268. package/dist/generated/abi/WVANAImplementation.js +315 -0
  269. package/dist/generated/abi/WVANAImplementation.js.map +1 -0
  270. package/dist/generated/abi/index.cjs +79 -47
  271. package/dist/generated/abi/index.cjs.map +1 -1
  272. package/dist/generated/abi/index.d.ts +15783 -10449
  273. package/dist/generated/abi/index.js +65 -43
  274. package/dist/generated/abi/index.js.map +1 -1
  275. package/dist/{config → generated}/addresses.cjs +174 -75
  276. package/dist/generated/addresses.cjs.map +1 -0
  277. package/dist/{config → generated}/addresses.d.ts +174 -165
  278. package/dist/{config → generated}/addresses.js +174 -75
  279. package/dist/generated/addresses.js.map +1 -0
  280. package/dist/generated/event-types.cjs.map +1 -1
  281. package/dist/generated/event-types.d.ts +482 -399
  282. package/dist/generated/eventRegistry.cjs +2601 -724
  283. package/dist/generated/eventRegistry.cjs.map +1 -1
  284. package/dist/generated/eventRegistry.d.ts +2 -2
  285. package/dist/generated/eventRegistry.js +2601 -724
  286. package/dist/generated/eventRegistry.js.map +1 -1
  287. package/dist/generated/server/server-exports.cjs +22 -0
  288. package/dist/generated/server/server-exports.cjs.map +1 -1
  289. package/dist/generated/server/server-exports.d.ts +31 -11
  290. package/dist/generated/server/server-exports.js +17 -0
  291. package/dist/generated/server/server-exports.js.map +1 -1
  292. package/dist/generated/server/server.cjs.map +1 -1
  293. package/dist/generated/server/server.d.ts +771 -402
  294. package/dist/generated/subgraph.cjs +797 -32
  295. package/dist/generated/subgraph.cjs.map +1 -1
  296. package/dist/generated/subgraph.d.ts +135 -0
  297. package/dist/generated/subgraph.js +792 -32
  298. package/dist/generated/subgraph.js.map +1 -1
  299. package/dist/index.browser.d.ts +7 -1
  300. package/dist/index.browser.js +26 -1
  301. package/dist/index.browser.js.map +1 -1
  302. package/dist/index.node.cjs +47 -1
  303. package/dist/index.node.cjs.map +1 -1
  304. package/dist/index.node.d.ts +55 -6
  305. package/dist/index.node.js +43 -2
  306. package/dist/index.node.js.map +1 -1
  307. package/dist/lib/__tests__/redisAtomicStore.test.d.ts +1 -0
  308. package/dist/lib/redisAtomicStore.cjs +201 -0
  309. package/dist/lib/redisAtomicStore.cjs.map +1 -0
  310. package/dist/lib/redisAtomicStore.d.ts +120 -0
  311. package/dist/lib/redisAtomicStore.js +177 -0
  312. package/dist/lib/redisAtomicStore.js.map +1 -0
  313. package/dist/server/relayerHandler.cjs +313 -75
  314. package/dist/server/relayerHandler.cjs.map +1 -1
  315. package/dist/server/relayerHandler.d.ts +35 -2
  316. package/dist/server/relayerHandler.js +313 -75
  317. package/dist/server/relayerHandler.js.map +1 -1
  318. package/dist/storage/index.cjs +3 -0
  319. package/dist/storage/index.cjs.map +1 -1
  320. package/dist/storage/index.d.ts +1 -0
  321. package/dist/storage/index.js +2 -0
  322. package/dist/storage/index.js.map +1 -1
  323. package/dist/storage/providers/dropbox.cjs +237 -0
  324. package/dist/storage/providers/dropbox.cjs.map +1 -0
  325. package/dist/storage/providers/dropbox.d.ts +39 -0
  326. package/dist/storage/providers/dropbox.js +215 -0
  327. package/dist/storage/providers/dropbox.js.map +1 -0
  328. package/dist/storage/providers/dropbox.test.d.ts +1 -0
  329. package/dist/tests/data-upload-owner-validation.test.d.ts +1 -0
  330. package/dist/types/accessSettlement.cjs +17 -0
  331. package/dist/types/accessSettlement.cjs.map +1 -0
  332. package/dist/types/accessSettlement.d.ts +66 -0
  333. package/dist/types/accessSettlement.js +1 -0
  334. package/dist/types/accessSettlement.js.map +1 -0
  335. package/dist/types/atomicStore.cjs +31 -0
  336. package/dist/types/atomicStore.cjs.map +1 -0
  337. package/dist/types/atomicStore.d.ts +236 -0
  338. package/dist/types/atomicStore.js +7 -0
  339. package/dist/types/atomicStore.js.map +1 -0
  340. package/dist/types/config.cjs.map +1 -1
  341. package/dist/types/config.d.ts +32 -0
  342. package/dist/types/config.js.map +1 -1
  343. package/dist/types/controller-context.cjs.map +1 -1
  344. package/dist/types/controller-context.d.ts +4 -1
  345. package/dist/types/data.cjs.map +1 -1
  346. package/dist/types/data.d.ts +7 -4
  347. package/dist/types/dataset.cjs +17 -0
  348. package/dist/types/dataset.cjs.map +1 -0
  349. package/dist/types/dataset.d.ts +51 -0
  350. package/dist/types/dataset.js +1 -0
  351. package/dist/types/dataset.js.map +1 -0
  352. package/dist/types/generics.cjs.map +1 -1
  353. package/dist/types/generics.d.ts +1 -1
  354. package/dist/types/index.cjs.map +1 -1
  355. package/dist/types/index.d.ts +7 -2
  356. package/dist/types/index.js.map +1 -1
  357. package/dist/types/operationStore.cjs +17 -0
  358. package/dist/types/operationStore.cjs.map +1 -0
  359. package/dist/types/operationStore.d.ts +171 -0
  360. package/dist/types/operationStore.js +1 -0
  361. package/dist/types/operationStore.js.map +1 -0
  362. package/dist/types/operations.cjs +3 -15
  363. package/dist/types/operations.cjs.map +1 -1
  364. package/dist/types/operations.d.ts +8 -52
  365. package/dist/types/operations.js +2 -13
  366. package/dist/types/operations.js.map +1 -1
  367. package/dist/types/options.cjs +17 -0
  368. package/dist/types/options.cjs.map +1 -0
  369. package/dist/types/options.d.ts +308 -0
  370. package/dist/types/options.js +1 -0
  371. package/dist/types/options.js.map +1 -0
  372. package/dist/types/permissions.cjs.map +1 -1
  373. package/dist/types/permissions.d.ts +4 -0
  374. package/dist/types/relayer.cjs.map +1 -1
  375. package/dist/types/relayer.d.ts +55 -10
  376. package/dist/types/runtimePermissions.cjs +17 -0
  377. package/dist/types/runtimePermissions.cjs.map +1 -0
  378. package/dist/types/runtimePermissions.d.ts +122 -0
  379. package/dist/types/runtimePermissions.js +1 -0
  380. package/dist/types/runtimePermissions.js.map +1 -0
  381. package/dist/types/utils.cjs.map +1 -1
  382. package/dist/types/utils.d.ts +0 -49
  383. package/dist/utils/__tests__/chainQuery.test.d.ts +1 -0
  384. package/dist/utils/__tests__/subgraphConsistency.test.d.ts +4 -0
  385. package/dist/utils/__tests__/subgraphPagination.test.d.ts +4 -0
  386. package/dist/utils/blockchain/registry.cjs +1 -1
  387. package/dist/utils/blockchain/registry.cjs.map +1 -1
  388. package/dist/utils/blockchain/registry.js +1 -1
  389. package/dist/utils/blockchain/registry.js.map +1 -1
  390. package/dist/utils/chainQuery.cjs +107 -0
  391. package/dist/utils/chainQuery.cjs.map +1 -0
  392. package/dist/utils/chainQuery.d.ts +31 -0
  393. package/dist/utils/chainQuery.js +82 -0
  394. package/dist/utils/chainQuery.js.map +1 -0
  395. package/dist/utils/grantFiles.cjs +4 -1
  396. package/dist/utils/grantFiles.cjs.map +1 -1
  397. package/dist/utils/grantFiles.js +4 -1
  398. package/dist/utils/grantFiles.js.map +1 -1
  399. package/dist/utils/ipfs.cjs +1 -3
  400. package/dist/utils/ipfs.cjs.map +1 -1
  401. package/dist/utils/ipfs.d.ts +4 -4
  402. package/dist/utils/ipfs.js +1 -3
  403. package/dist/utils/ipfs.js.map +1 -1
  404. package/dist/utils/multicall.cjs +1 -1
  405. package/dist/utils/multicall.cjs.map +1 -1
  406. package/dist/utils/multicall.js +1 -1
  407. package/dist/utils/multicall.js.map +1 -1
  408. package/dist/utils/runtimeGrantFiles.cjs +84 -0
  409. package/dist/utils/runtimeGrantFiles.cjs.map +1 -0
  410. package/dist/utils/runtimeGrantFiles.d.ts +66 -0
  411. package/dist/utils/runtimeGrantFiles.js +58 -0
  412. package/dist/utils/runtimeGrantFiles.js.map +1 -0
  413. package/dist/utils/subgraphConsistency.cjs +184 -0
  414. package/dist/utils/subgraphConsistency.cjs.map +1 -0
  415. package/dist/utils/subgraphConsistency.d.ts +65 -0
  416. package/dist/utils/subgraphConsistency.js +155 -0
  417. package/dist/utils/subgraphConsistency.js.map +1 -0
  418. package/dist/utils/subgraphMetaCache.cjs +101 -0
  419. package/dist/utils/subgraphMetaCache.cjs.map +1 -0
  420. package/dist/utils/subgraphMetaCache.d.ts +56 -0
  421. package/dist/utils/subgraphMetaCache.js +76 -0
  422. package/dist/utils/subgraphMetaCache.js.map +1 -0
  423. package/dist/utils/subgraphPagination.cjs +104 -0
  424. package/dist/utils/subgraphPagination.cjs.map +1 -0
  425. package/dist/utils/subgraphPagination.d.ts +78 -0
  426. package/dist/utils/subgraphPagination.js +78 -0
  427. package/dist/utils/subgraphPagination.js.map +1 -0
  428. package/package.json +7 -2
  429. package/dist/config/addresses.cjs.map +0 -1
  430. package/dist/config/addresses.js.map +0 -1
  431. package/dist/generated/abi/DLPTreasuryImplementation.cjs.map +0 -1
  432. package/dist/generated/abi/DLPTreasuryImplementation.js.map +0 -1
@@ -0,0 +1,289 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var accessSettlement_exports = {};
20
+ __export(accessSettlement_exports, {
21
+ AccessSettlementController: () => AccessSettlementController
22
+ });
23
+ module.exports = __toCommonJS(accessSettlement_exports);
24
+ var import_viem = require("viem");
25
+ var import_base = require("./base");
26
+ var import_errors = require("../errors");
27
+ var import_addresses = require("../generated/addresses");
28
+ var import_abi = require("../generated/abi");
29
+ class AccessSettlementController extends import_base.BaseController {
30
+ /**
31
+ * Get invoice details for an operation
32
+ *
33
+ * @remarks
34
+ * Retrieves the payment invoice created by the runtime after an operation completes.
35
+ * The invoice contains the final price, payment token, and settlement status.
36
+ *
37
+ * @param operationId - Operation identifier (from runtime API)
38
+ * @returns Invoice details including price and settlement status
39
+ * @throws {BlockchainError} When invoice retrieval fails
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * const invoice = await sdk.accessSettlement.getOperationInvoice("op_abc123");
44
+ * console.log(`Price: ${invoice.price} wei`);
45
+ * console.log(`Issuer: ${invoice.issuer}`);
46
+ * console.log(`Settled: ${invoice.isSettled}`);
47
+ *
48
+ * // Convert price to VANA for display
49
+ * const priceInVana = Number(invoice.price) / 10**18;
50
+ * console.log(`Price: ${priceInVana} VANA`);
51
+ * ```
52
+ */
53
+ async getOperationInvoice(operationId) {
54
+ try {
55
+ const chainId = await this.context.publicClient.getChainId();
56
+ const contractAddress = (0, import_addresses.getContractAddress)(chainId, "AccessSettlement");
57
+ const abi = (0, import_abi.getAbi)("AccessSettlement");
58
+ const contract = (0, import_viem.getContract)({
59
+ address: contractAddress,
60
+ abi,
61
+ client: this.context.publicClient
62
+ });
63
+ const operationIdBytes = this.stringToBytes(operationId);
64
+ const result = await contract.read.getOperationInvoice([
65
+ operationIdBytes
66
+ ]);
67
+ const invoice = result;
68
+ return {
69
+ issuer: invoice.issuer ?? invoice[0],
70
+ grantee: invoice.grantee ?? invoice[1],
71
+ price: invoice.price ?? invoice[2],
72
+ tokenAddress: invoice.tokenAddress ?? invoice[3],
73
+ isSettled: invoice.isSettled !== void 0 ? invoice.isSettled : invoice[4]
74
+ };
75
+ } catch (error) {
76
+ if (error instanceof Error) {
77
+ throw new import_errors.BlockchainError(
78
+ `Failed to get operation invoice: ${error.message}`,
79
+ error
80
+ );
81
+ }
82
+ throw new import_errors.BlockchainError(
83
+ "Failed to get operation invoice with unknown error"
84
+ );
85
+ }
86
+ }
87
+ /**
88
+ * Check if an operation's payment has been settled
89
+ *
90
+ * @remarks
91
+ * Quick check to determine if payment has been completed for an operation.
92
+ * Returns true if settlePaymentWithNative() or settlePaymentWithToken() was called.
93
+ *
94
+ * @param operationId - Operation identifier
95
+ * @returns Whether the payment has been settled
96
+ *
97
+ * @example
98
+ * ```typescript
99
+ * const isSettled = await sdk.accessSettlement.isOperationSettled("op_123");
100
+ * if (isSettled) {
101
+ * console.log("Payment already settled, artifacts should be available");
102
+ * } else {
103
+ * console.log("Payment pending");
104
+ * }
105
+ * ```
106
+ */
107
+ async isOperationSettled(operationId) {
108
+ try {
109
+ const chainId = await this.context.publicClient.getChainId();
110
+ const contractAddress = (0, import_addresses.getContractAddress)(chainId, "AccessSettlement");
111
+ const abi = (0, import_abi.getAbi)("AccessSettlement");
112
+ const contract = (0, import_viem.getContract)({
113
+ address: contractAddress,
114
+ abi,
115
+ client: this.context.publicClient
116
+ });
117
+ const operationIdBytes = this.stringToBytes(operationId);
118
+ return await contract.read.isOperationSettled([
119
+ operationIdBytes
120
+ ]);
121
+ } catch (error) {
122
+ if (error instanceof Error) {
123
+ throw new import_errors.BlockchainError(
124
+ `Failed to check settlement status: ${error.message}`,
125
+ error
126
+ );
127
+ }
128
+ throw new import_errors.BlockchainError(
129
+ "Failed to check settlement status with unknown error"
130
+ );
131
+ }
132
+ }
133
+ /**
134
+ * Settle payment for an operation using native VANA
135
+ *
136
+ * @remarks
137
+ * Pays for a completed operation using native VANA tokens. The amount must match
138
+ * the invoice price exactly. Upon successful payment:
139
+ * - Funds are transferred to the issuer (dataset owner)
140
+ * - PaymentSettled event is emitted
141
+ * - Runtime unlocks operation artifacts for download
142
+ *
143
+ * IMPORTANT: You must send the exact value specified in the invoice.
144
+ * Check the invoice first using getOperationInvoice().
145
+ *
146
+ * @param operationId - Operation identifier to settle payment for
147
+ * @param value - Amount to pay in wei (must match invoice.price)
148
+ * @returns Transaction hash and operation ID
149
+ * @throws {BlockchainError} When payment settlement fails
150
+ * @throws {Error} When wallet is not configured (read-only mode)
151
+ *
152
+ * @example
153
+ * ```typescript
154
+ * // Get invoice to find the exact price
155
+ * const invoice = await sdk.accessSettlement.getOperationInvoice("op_123");
156
+ *
157
+ * // Settle with native VANA
158
+ * const result = await sdk.accessSettlement.settlePaymentWithNative(
159
+ * "op_123",
160
+ * invoice.price // Must match exactly
161
+ * );
162
+ *
163
+ * // Wait for confirmation
164
+ * await sdk.waitForTransactionReceipt(result.hash);
165
+ * console.log("Payment confirmed, artifacts now available");
166
+ * ```
167
+ */
168
+ async settlePaymentWithNative(operationId, value) {
169
+ this.assertWallet();
170
+ try {
171
+ const chainId = await this.context.publicClient.getChainId();
172
+ const contractAddress = (0, import_addresses.getContractAddress)(chainId, "AccessSettlement");
173
+ const abi = (0, import_abi.getAbi)("AccessSettlement");
174
+ const operationIdBytes = this.stringToBytes(operationId);
175
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
176
+ const hash = await this.context.walletClient.writeContract({
177
+ address: contractAddress,
178
+ abi,
179
+ functionName: "settlePaymentWithNative",
180
+ args: [operationIdBytes],
181
+ value,
182
+ account,
183
+ chain: this.context.walletClient?.chain ?? null
184
+ });
185
+ return {
186
+ hash,
187
+ operationId
188
+ };
189
+ } catch (error) {
190
+ if (error instanceof Error) {
191
+ throw new import_errors.BlockchainError(
192
+ `Failed to settle payment with native VANA: ${error.message}`,
193
+ error
194
+ );
195
+ }
196
+ throw new import_errors.BlockchainError(
197
+ "Failed to settle payment with native VANA with unknown error"
198
+ );
199
+ }
200
+ }
201
+ /**
202
+ * Settle payment for an operation using an ERC20 token
203
+ *
204
+ * @remarks
205
+ * Pays for a completed operation using an ERC20 token. Before calling this method:
206
+ * 1. Check the invoice to get tokenAddress and price
207
+ * 2. Approve the AccessSettlement contract to spend the token amount
208
+ * 3. Call this method to complete the payment
209
+ *
210
+ * The token address and amount must match the invoice exactly.
211
+ *
212
+ * @param operationId - Operation identifier to settle payment for
213
+ * @param tokenAddress - ERC20 token contract address (must match invoice)
214
+ * @returns Transaction hash and operation ID
215
+ * @throws {BlockchainError} When payment settlement fails
216
+ * @throws {Error} When wallet is not configured (read-only mode)
217
+ *
218
+ * @example
219
+ * ```typescript
220
+ * // Get invoice
221
+ * const invoice = await sdk.accessSettlement.getOperationInvoice("op_123");
222
+ *
223
+ * // Approve token spending (if not already approved)
224
+ * const tokenContract = sdk.protocol.createContract("ERC20" as const);
225
+ * await tokenContract.write.approve([
226
+ * accessSettlementAddress,
227
+ * invoice.price
228
+ * ]);
229
+ *
230
+ * // Settle with token
231
+ * const result = await sdk.accessSettlement.settlePaymentWithToken(
232
+ * "op_123",
233
+ * invoice.tokenAddress
234
+ * );
235
+ *
236
+ * await sdk.waitForTransactionReceipt(result.hash);
237
+ * ```
238
+ */
239
+ async settlePaymentWithToken(operationId, tokenAddress) {
240
+ this.assertWallet();
241
+ try {
242
+ const chainId = await this.context.publicClient.getChainId();
243
+ const contractAddress = (0, import_addresses.getContractAddress)(chainId, "AccessSettlement");
244
+ const abi = (0, import_abi.getAbi)("AccessSettlement");
245
+ const operationIdBytes = this.stringToBytes(operationId);
246
+ const account = this.context.walletClient?.account ?? this.context.userAddress;
247
+ const hash = await this.context.walletClient.writeContract({
248
+ address: contractAddress,
249
+ abi,
250
+ functionName: "settlePaymentWithToken",
251
+ args: [operationIdBytes, tokenAddress],
252
+ account,
253
+ chain: this.context.walletClient?.chain ?? null
254
+ });
255
+ return {
256
+ hash,
257
+ operationId
258
+ };
259
+ } catch (error) {
260
+ if (error instanceof Error) {
261
+ throw new import_errors.BlockchainError(
262
+ `Failed to settle payment with token: ${error.message}`,
263
+ error
264
+ );
265
+ }
266
+ throw new import_errors.BlockchainError(
267
+ "Failed to settle payment with token with unknown error"
268
+ );
269
+ }
270
+ }
271
+ /**
272
+ * Helper method to convert operation ID string to bytes
273
+ * @internal
274
+ */
275
+ stringToBytes(str) {
276
+ if (str.startsWith("0x")) {
277
+ return str;
278
+ }
279
+ const encoder = new TextEncoder();
280
+ const bytes = encoder.encode(str);
281
+ const hexString = Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
282
+ return `0x${hexString}`;
283
+ }
284
+ }
285
+ // Annotate the CommonJS export names for ESM import in node:
286
+ 0 && (module.exports = {
287
+ AccessSettlementController
288
+ });
289
+ //# sourceMappingURL=accessSettlement.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/controllers/accessSettlement.ts"],"sourcesContent":["import { getContract } from \"viem\";\nimport { BaseController } from \"./base\";\nimport type {\n OperationInvoice,\n PaymentSettlementResult,\n} from \"../types/accessSettlement\";\nimport { BlockchainError } from \"../errors\";\nimport { getContractAddress } from \"../generated/addresses\";\nimport { getAbi } from \"../generated/abi\";\n\n/**\n * Controller for AccessSettlement contract\n *\n * @remarks\n * Manages payment settlement for runtime operations. Allows data consumers\n * to pay for completed operations using native VANA or ERC20 tokens.\n *\n * The AccessSettlement contract acts as an escrow system:\n * 1. Runtime completes an operation and logs the final price\n * 2. Consumer calls settlePaymentWithNative() or settlePaymentWithToken()\n * 3. Funds are transferred to the issuer (dataset owner)\n * 4. Runtime unlocks the operation artifacts for download\n *\n * @category Controllers\n * @example\n * ```typescript\n * // Consumer pays for a completed operation\n * const invoice = await sdk.accessSettlement.getOperationInvoice(\"op_123\");\n *\n * if (!invoice.isSettled) {\n * const result = await sdk.accessSettlement.settlePaymentWithNative(\n * \"op_123\",\n * invoice.price\n * );\n * console.log(`Payment settled: ${result.hash}`);\n * }\n * ```\n */\nexport class AccessSettlementController extends BaseController {\n /**\n * Get invoice details for an operation\n *\n * @remarks\n * Retrieves the payment invoice created by the runtime after an operation completes.\n * The invoice contains the final price, payment token, and settlement status.\n *\n * @param operationId - Operation identifier (from runtime API)\n * @returns Invoice details including price and settlement status\n * @throws {BlockchainError} When invoice retrieval fails\n *\n * @example\n * ```typescript\n * const invoice = await sdk.accessSettlement.getOperationInvoice(\"op_abc123\");\n * console.log(`Price: ${invoice.price} wei`);\n * console.log(`Issuer: ${invoice.issuer}`);\n * console.log(`Settled: ${invoice.isSettled}`);\n *\n * // Convert price to VANA for display\n * const priceInVana = Number(invoice.price) / 10**18;\n * console.log(`Price: ${priceInVana} VANA`);\n * ```\n */\n async getOperationInvoice(operationId: string): Promise<OperationInvoice> {\n try {\n const chainId = await this.context.publicClient.getChainId();\n const contractAddress = getContractAddress(chainId, \"AccessSettlement\");\n const abi = getAbi(\"AccessSettlement\");\n\n const contract = getContract({\n address: contractAddress,\n abi,\n client: this.context.publicClient,\n });\n\n // Convert operationId string to bytes\n const operationIdBytes = this.stringToBytes(operationId);\n\n const result = await contract.read.getOperationInvoice([\n operationIdBytes,\n ]);\n\n // Parse tuple result into OperationInvoice object\n // The contract returns a struct which viem converts to an array-like object\n const invoice = result as any;\n return {\n issuer: invoice.issuer ?? invoice[0],\n grantee: invoice.grantee ?? invoice[1],\n price: invoice.price ?? invoice[2],\n tokenAddress: invoice.tokenAddress ?? invoice[3],\n isSettled:\n invoice.isSettled !== undefined ? invoice.isSettled : invoice[4],\n } as OperationInvoice;\n } catch (error) {\n if (error instanceof Error) {\n throw new BlockchainError(\n `Failed to get operation invoice: ${error.message}`,\n error,\n );\n }\n throw new BlockchainError(\n \"Failed to get operation invoice with unknown error\",\n );\n }\n }\n\n /**\n * Check if an operation's payment has been settled\n *\n * @remarks\n * Quick check to determine if payment has been completed for an operation.\n * Returns true if settlePaymentWithNative() or settlePaymentWithToken() was called.\n *\n * @param operationId - Operation identifier\n * @returns Whether the payment has been settled\n *\n * @example\n * ```typescript\n * const isSettled = await sdk.accessSettlement.isOperationSettled(\"op_123\");\n * if (isSettled) {\n * console.log(\"Payment already settled, artifacts should be available\");\n * } else {\n * console.log(\"Payment pending\");\n * }\n * ```\n */\n async isOperationSettled(operationId: string): Promise<boolean> {\n try {\n const chainId = await this.context.publicClient.getChainId();\n const contractAddress = getContractAddress(chainId, \"AccessSettlement\");\n const abi = getAbi(\"AccessSettlement\");\n\n const contract = getContract({\n address: contractAddress,\n abi,\n client: this.context.publicClient,\n });\n\n const operationIdBytes = this.stringToBytes(operationId);\n\n return (await contract.read.isOperationSettled([\n operationIdBytes,\n ])) as boolean;\n } catch (error) {\n if (error instanceof Error) {\n throw new BlockchainError(\n `Failed to check settlement status: ${error.message}`,\n error,\n );\n }\n throw new BlockchainError(\n \"Failed to check settlement status with unknown error\",\n );\n }\n }\n\n /**\n * Settle payment for an operation using native VANA\n *\n * @remarks\n * Pays for a completed operation using native VANA tokens. The amount must match\n * the invoice price exactly. Upon successful payment:\n * - Funds are transferred to the issuer (dataset owner)\n * - PaymentSettled event is emitted\n * - Runtime unlocks operation artifacts for download\n *\n * IMPORTANT: You must send the exact value specified in the invoice.\n * Check the invoice first using getOperationInvoice().\n *\n * @param operationId - Operation identifier to settle payment for\n * @param value - Amount to pay in wei (must match invoice.price)\n * @returns Transaction hash and operation ID\n * @throws {BlockchainError} When payment settlement fails\n * @throws {Error} When wallet is not configured (read-only mode)\n *\n * @example\n * ```typescript\n * // Get invoice to find the exact price\n * const invoice = await sdk.accessSettlement.getOperationInvoice(\"op_123\");\n *\n * // Settle with native VANA\n * const result = await sdk.accessSettlement.settlePaymentWithNative(\n * \"op_123\",\n * invoice.price // Must match exactly\n * );\n *\n * // Wait for confirmation\n * await sdk.waitForTransactionReceipt(result.hash);\n * console.log(\"Payment confirmed, artifacts now available\");\n * ```\n */\n async settlePaymentWithNative(\n operationId: string,\n value: bigint,\n ): Promise<PaymentSettlementResult> {\n this.assertWallet();\n\n try {\n const chainId = await this.context.publicClient.getChainId();\n const contractAddress = getContractAddress(chainId, \"AccessSettlement\");\n const abi = getAbi(\"AccessSettlement\");\n\n const operationIdBytes = this.stringToBytes(operationId);\n\n const account =\n this.context.walletClient?.account ?? this.context.userAddress;\n\n const hash = await this.context.walletClient.writeContract({\n address: contractAddress,\n abi,\n functionName: \"settlePaymentWithNative\",\n args: [operationIdBytes],\n value,\n account,\n chain: this.context.walletClient?.chain ?? null,\n });\n\n return {\n hash,\n operationId,\n };\n } catch (error) {\n if (error instanceof Error) {\n throw new BlockchainError(\n `Failed to settle payment with native VANA: ${error.message}`,\n error,\n );\n }\n throw new BlockchainError(\n \"Failed to settle payment with native VANA with unknown error\",\n );\n }\n }\n\n /**\n * Settle payment for an operation using an ERC20 token\n *\n * @remarks\n * Pays for a completed operation using an ERC20 token. Before calling this method:\n * 1. Check the invoice to get tokenAddress and price\n * 2. Approve the AccessSettlement contract to spend the token amount\n * 3. Call this method to complete the payment\n *\n * The token address and amount must match the invoice exactly.\n *\n * @param operationId - Operation identifier to settle payment for\n * @param tokenAddress - ERC20 token contract address (must match invoice)\n * @returns Transaction hash and operation ID\n * @throws {BlockchainError} When payment settlement fails\n * @throws {Error} When wallet is not configured (read-only mode)\n *\n * @example\n * ```typescript\n * // Get invoice\n * const invoice = await sdk.accessSettlement.getOperationInvoice(\"op_123\");\n *\n * // Approve token spending (if not already approved)\n * const tokenContract = sdk.protocol.createContract(\"ERC20\" as const);\n * await tokenContract.write.approve([\n * accessSettlementAddress,\n * invoice.price\n * ]);\n *\n * // Settle with token\n * const result = await sdk.accessSettlement.settlePaymentWithToken(\n * \"op_123\",\n * invoice.tokenAddress\n * );\n *\n * await sdk.waitForTransactionReceipt(result.hash);\n * ```\n */\n async settlePaymentWithToken(\n operationId: string,\n tokenAddress: `0x${string}`,\n ): Promise<PaymentSettlementResult> {\n this.assertWallet();\n\n try {\n const chainId = await this.context.publicClient.getChainId();\n const contractAddress = getContractAddress(chainId, \"AccessSettlement\");\n const abi = getAbi(\"AccessSettlement\");\n\n const operationIdBytes = this.stringToBytes(operationId);\n\n const account =\n this.context.walletClient?.account ?? this.context.userAddress;\n\n const hash = await this.context.walletClient.writeContract({\n address: contractAddress,\n abi,\n functionName: \"settlePaymentWithToken\",\n args: [operationIdBytes, tokenAddress],\n account,\n chain: this.context.walletClient?.chain ?? null,\n });\n\n return {\n hash,\n operationId,\n };\n } catch (error) {\n if (error instanceof Error) {\n throw new BlockchainError(\n `Failed to settle payment with token: ${error.message}`,\n error,\n );\n }\n throw new BlockchainError(\n \"Failed to settle payment with token with unknown error\",\n );\n }\n }\n\n /**\n * Helper method to convert operation ID string to bytes\n * @internal\n */\n private stringToBytes(str: string): `0x${string}` {\n // If already hex string, return as-is\n if (str.startsWith(\"0x\")) {\n return str as `0x${string}`;\n }\n\n // Convert string to hex bytes\n const encoder = new TextEncoder();\n const bytes = encoder.encode(str);\n const hexString = Array.from(bytes)\n .map((b) => b.toString(16).padStart(2, \"0\"))\n .join(\"\");\n\n return `0x${hexString}` as `0x${string}`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA4B;AAC5B,kBAA+B;AAK/B,oBAAgC;AAChC,uBAAmC;AACnC,iBAAuB;AA8BhB,MAAM,mCAAmC,2BAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAwB7D,MAAM,oBAAoB,aAAgD;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AAE,EAAE,SAAS,GAAG,GAAG,CAAC,EAC1C,KAAK,EAAE;AAEV,WAAO,KAAK,SAAS;AAAA,EACvB;AACF;","names":[]}
@@ -0,0 +1,157 @@
1
+ import { BaseController } from "./base";
2
+ import type { OperationInvoice, PaymentSettlementResult } from "../types/accessSettlement";
3
+ /**
4
+ * Controller for AccessSettlement contract
5
+ *
6
+ * @remarks
7
+ * Manages payment settlement for runtime operations. Allows data consumers
8
+ * to pay for completed operations using native VANA or ERC20 tokens.
9
+ *
10
+ * The AccessSettlement contract acts as an escrow system:
11
+ * 1. Runtime completes an operation and logs the final price
12
+ * 2. Consumer calls settlePaymentWithNative() or settlePaymentWithToken()
13
+ * 3. Funds are transferred to the issuer (dataset owner)
14
+ * 4. Runtime unlocks the operation artifacts for download
15
+ *
16
+ * @category Controllers
17
+ * @example
18
+ * ```typescript
19
+ * // Consumer pays for a completed operation
20
+ * const invoice = await sdk.accessSettlement.getOperationInvoice("op_123");
21
+ *
22
+ * if (!invoice.isSettled) {
23
+ * const result = await sdk.accessSettlement.settlePaymentWithNative(
24
+ * "op_123",
25
+ * invoice.price
26
+ * );
27
+ * console.log(`Payment settled: ${result.hash}`);
28
+ * }
29
+ * ```
30
+ */
31
+ export declare class AccessSettlementController extends BaseController {
32
+ /**
33
+ * Get invoice details for an operation
34
+ *
35
+ * @remarks
36
+ * Retrieves the payment invoice created by the runtime after an operation completes.
37
+ * The invoice contains the final price, payment token, and settlement status.
38
+ *
39
+ * @param operationId - Operation identifier (from runtime API)
40
+ * @returns Invoice details including price and settlement status
41
+ * @throws {BlockchainError} When invoice retrieval fails
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const invoice = await sdk.accessSettlement.getOperationInvoice("op_abc123");
46
+ * console.log(`Price: ${invoice.price} wei`);
47
+ * console.log(`Issuer: ${invoice.issuer}`);
48
+ * console.log(`Settled: ${invoice.isSettled}`);
49
+ *
50
+ * // Convert price to VANA for display
51
+ * const priceInVana = Number(invoice.price) / 10**18;
52
+ * console.log(`Price: ${priceInVana} VANA`);
53
+ * ```
54
+ */
55
+ getOperationInvoice(operationId: string): Promise<OperationInvoice>;
56
+ /**
57
+ * Check if an operation's payment has been settled
58
+ *
59
+ * @remarks
60
+ * Quick check to determine if payment has been completed for an operation.
61
+ * Returns true if settlePaymentWithNative() or settlePaymentWithToken() was called.
62
+ *
63
+ * @param operationId - Operation identifier
64
+ * @returns Whether the payment has been settled
65
+ *
66
+ * @example
67
+ * ```typescript
68
+ * const isSettled = await sdk.accessSettlement.isOperationSettled("op_123");
69
+ * if (isSettled) {
70
+ * console.log("Payment already settled, artifacts should be available");
71
+ * } else {
72
+ * console.log("Payment pending");
73
+ * }
74
+ * ```
75
+ */
76
+ isOperationSettled(operationId: string): Promise<boolean>;
77
+ /**
78
+ * Settle payment for an operation using native VANA
79
+ *
80
+ * @remarks
81
+ * Pays for a completed operation using native VANA tokens. The amount must match
82
+ * the invoice price exactly. Upon successful payment:
83
+ * - Funds are transferred to the issuer (dataset owner)
84
+ * - PaymentSettled event is emitted
85
+ * - Runtime unlocks operation artifacts for download
86
+ *
87
+ * IMPORTANT: You must send the exact value specified in the invoice.
88
+ * Check the invoice first using getOperationInvoice().
89
+ *
90
+ * @param operationId - Operation identifier to settle payment for
91
+ * @param value - Amount to pay in wei (must match invoice.price)
92
+ * @returns Transaction hash and operation ID
93
+ * @throws {BlockchainError} When payment settlement fails
94
+ * @throws {Error} When wallet is not configured (read-only mode)
95
+ *
96
+ * @example
97
+ * ```typescript
98
+ * // Get invoice to find the exact price
99
+ * const invoice = await sdk.accessSettlement.getOperationInvoice("op_123");
100
+ *
101
+ * // Settle with native VANA
102
+ * const result = await sdk.accessSettlement.settlePaymentWithNative(
103
+ * "op_123",
104
+ * invoice.price // Must match exactly
105
+ * );
106
+ *
107
+ * // Wait for confirmation
108
+ * await sdk.waitForTransactionReceipt(result.hash);
109
+ * console.log("Payment confirmed, artifacts now available");
110
+ * ```
111
+ */
112
+ settlePaymentWithNative(operationId: string, value: bigint): Promise<PaymentSettlementResult>;
113
+ /**
114
+ * Settle payment for an operation using an ERC20 token
115
+ *
116
+ * @remarks
117
+ * Pays for a completed operation using an ERC20 token. Before calling this method:
118
+ * 1. Check the invoice to get tokenAddress and price
119
+ * 2. Approve the AccessSettlement contract to spend the token amount
120
+ * 3. Call this method to complete the payment
121
+ *
122
+ * The token address and amount must match the invoice exactly.
123
+ *
124
+ * @param operationId - Operation identifier to settle payment for
125
+ * @param tokenAddress - ERC20 token contract address (must match invoice)
126
+ * @returns Transaction hash and operation ID
127
+ * @throws {BlockchainError} When payment settlement fails
128
+ * @throws {Error} When wallet is not configured (read-only mode)
129
+ *
130
+ * @example
131
+ * ```typescript
132
+ * // Get invoice
133
+ * const invoice = await sdk.accessSettlement.getOperationInvoice("op_123");
134
+ *
135
+ * // Approve token spending (if not already approved)
136
+ * const tokenContract = sdk.protocol.createContract("ERC20" as const);
137
+ * await tokenContract.write.approve([
138
+ * accessSettlementAddress,
139
+ * invoice.price
140
+ * ]);
141
+ *
142
+ * // Settle with token
143
+ * const result = await sdk.accessSettlement.settlePaymentWithToken(
144
+ * "op_123",
145
+ * invoice.tokenAddress
146
+ * );
147
+ *
148
+ * await sdk.waitForTransactionReceipt(result.hash);
149
+ * ```
150
+ */
151
+ settlePaymentWithToken(operationId: string, tokenAddress: `0x${string}`): Promise<PaymentSettlementResult>;
152
+ /**
153
+ * Helper method to convert operation ID string to bytes
154
+ * @internal
155
+ */
156
+ private stringToBytes;
157
+ }