@agirails/sdk 2.0.1-beta → 2.0.2

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 (405) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +116 -108
  3. package/bin/actp +10 -0
  4. package/dist/ACTPClient.d.ts +456 -33
  5. package/dist/ACTPClient.d.ts.map +1 -1
  6. package/dist/ACTPClient.js +477 -93
  7. package/dist/ACTPClient.js.map +1 -1
  8. package/dist/abi/AgentRegistry.json +782 -0
  9. package/dist/abi/EscrowVault.json +106 -38
  10. package/dist/abi/IdentityRegistry.json +316 -0
  11. package/dist/adapters/BaseAdapter.d.ts +231 -0
  12. package/dist/adapters/BaseAdapter.d.ts.map +1 -0
  13. package/dist/adapters/BaseAdapter.js +393 -0
  14. package/dist/adapters/BaseAdapter.js.map +1 -0
  15. package/dist/adapters/BeginnerAdapter.d.ts +152 -0
  16. package/dist/adapters/BeginnerAdapter.d.ts.map +1 -0
  17. package/dist/adapters/BeginnerAdapter.js +168 -0
  18. package/dist/adapters/BeginnerAdapter.js.map +1 -0
  19. package/dist/adapters/IntermediateAdapter.d.ts +211 -0
  20. package/dist/adapters/IntermediateAdapter.d.ts.map +1 -0
  21. package/dist/adapters/IntermediateAdapter.js +260 -0
  22. package/dist/adapters/IntermediateAdapter.js.map +1 -0
  23. package/dist/adapters/index.d.ts +15 -0
  24. package/dist/adapters/index.d.ts.map +1 -0
  25. package/dist/adapters/index.js +26 -0
  26. package/dist/adapters/index.js.map +1 -0
  27. package/dist/builders/DeliveryProofBuilder.d.ts +60 -1
  28. package/dist/builders/DeliveryProofBuilder.d.ts.map +1 -1
  29. package/dist/builders/DeliveryProofBuilder.js +81 -5
  30. package/dist/builders/DeliveryProofBuilder.js.map +1 -1
  31. package/dist/builders/QuoteBuilder.d.ts +101 -0
  32. package/dist/builders/QuoteBuilder.d.ts.map +1 -1
  33. package/dist/builders/QuoteBuilder.js +120 -3
  34. package/dist/builders/QuoteBuilder.js.map +1 -1
  35. package/dist/builders/index.d.ts +4 -0
  36. package/dist/builders/index.d.ts.map +1 -1
  37. package/dist/builders/index.js +4 -0
  38. package/dist/builders/index.js.map +1 -1
  39. package/dist/cli/commands/balance.d.ts +13 -0
  40. package/dist/cli/commands/balance.d.ts.map +1 -0
  41. package/dist/cli/commands/balance.js +89 -0
  42. package/dist/cli/commands/balance.js.map +1 -0
  43. package/dist/cli/commands/batch.d.ts +24 -0
  44. package/dist/cli/commands/batch.d.ts.map +1 -0
  45. package/dist/cli/commands/batch.js +424 -0
  46. package/dist/cli/commands/batch.js.map +1 -0
  47. package/dist/cli/commands/config.d.ts +13 -0
  48. package/dist/cli/commands/config.d.ts.map +1 -0
  49. package/dist/cli/commands/config.js +192 -0
  50. package/dist/cli/commands/config.js.map +1 -0
  51. package/dist/cli/commands/init.d.ts +19 -0
  52. package/dist/cli/commands/init.d.ts.map +1 -0
  53. package/dist/cli/commands/init.js +143 -0
  54. package/dist/cli/commands/init.js.map +1 -0
  55. package/dist/cli/commands/mint.d.ts +13 -0
  56. package/dist/cli/commands/mint.d.ts.map +1 -0
  57. package/dist/cli/commands/mint.js +91 -0
  58. package/dist/cli/commands/mint.js.map +1 -0
  59. package/dist/cli/commands/pay.d.ts +18 -0
  60. package/dist/cli/commands/pay.d.ts.map +1 -0
  61. package/dist/cli/commands/pay.js +87 -0
  62. package/dist/cli/commands/pay.js.map +1 -0
  63. package/dist/cli/commands/simulate.d.ts +32 -0
  64. package/dist/cli/commands/simulate.d.ts.map +1 -0
  65. package/dist/cli/commands/simulate.js +290 -0
  66. package/dist/cli/commands/simulate.js.map +1 -0
  67. package/dist/cli/commands/time.d.ts +29 -0
  68. package/dist/cli/commands/time.d.ts.map +1 -0
  69. package/dist/cli/commands/time.js +252 -0
  70. package/dist/cli/commands/time.js.map +1 -0
  71. package/dist/cli/commands/tx.d.ts +16 -0
  72. package/dist/cli/commands/tx.d.ts.map +1 -0
  73. package/dist/cli/commands/tx.js +379 -0
  74. package/dist/cli/commands/tx.js.map +1 -0
  75. package/dist/cli/commands/watch.d.ts +20 -0
  76. package/dist/cli/commands/watch.d.ts.map +1 -0
  77. package/dist/cli/commands/watch.js +160 -0
  78. package/dist/cli/commands/watch.js.map +1 -0
  79. package/dist/cli/index.d.ts +17 -0
  80. package/dist/cli/index.d.ts.map +1 -0
  81. package/dist/cli/index.js +104 -0
  82. package/dist/cli/index.js.map +1 -0
  83. package/dist/cli/utils/client.d.ts +70 -0
  84. package/dist/cli/utils/client.d.ts.map +1 -0
  85. package/dist/cli/utils/client.js +240 -0
  86. package/dist/cli/utils/client.js.map +1 -0
  87. package/dist/cli/utils/config.d.ts +91 -0
  88. package/dist/cli/utils/config.d.ts.map +1 -0
  89. package/dist/cli/utils/config.js +240 -0
  90. package/dist/cli/utils/config.js.map +1 -0
  91. package/dist/cli/utils/output.d.ts +174 -0
  92. package/dist/cli/utils/output.d.ts.map +1 -0
  93. package/dist/cli/utils/output.js +380 -0
  94. package/dist/cli/utils/output.js.map +1 -0
  95. package/dist/config/networks.d.ts +28 -0
  96. package/dist/config/networks.d.ts.map +1 -1
  97. package/dist/config/networks.js +60 -12
  98. package/dist/config/networks.js.map +1 -1
  99. package/dist/errors/index.d.ts +165 -2
  100. package/dist/errors/index.d.ts.map +1 -1
  101. package/dist/errors/index.js +260 -2
  102. package/dist/errors/index.js.map +1 -1
  103. package/dist/index.d.ts +61 -13
  104. package/dist/index.d.ts.map +1 -1
  105. package/dist/index.js +141 -36
  106. package/dist/index.js.map +1 -1
  107. package/dist/level0/Provider.d.ts +106 -0
  108. package/dist/level0/Provider.d.ts.map +1 -0
  109. package/dist/level0/Provider.js +10 -0
  110. package/dist/level0/Provider.js.map +1 -0
  111. package/dist/level0/ServiceDirectory.d.ts +74 -0
  112. package/dist/level0/ServiceDirectory.d.ts.map +1 -0
  113. package/dist/level0/ServiceDirectory.js +122 -0
  114. package/dist/level0/ServiceDirectory.js.map +1 -0
  115. package/dist/level0/index.d.ts +10 -0
  116. package/dist/level0/index.d.ts.map +1 -0
  117. package/dist/level0/index.js +15 -0
  118. package/dist/level0/index.js.map +1 -0
  119. package/dist/level0/provide.d.ts +51 -0
  120. package/dist/level0/provide.d.ts.map +1 -0
  121. package/dist/level0/provide.js +113 -0
  122. package/dist/level0/provide.js.map +1 -0
  123. package/dist/level0/request.d.ts +53 -0
  124. package/dist/level0/request.d.ts.map +1 -0
  125. package/dist/level0/request.js +462 -0
  126. package/dist/level0/request.js.map +1 -0
  127. package/dist/level1/Agent.d.ts +472 -0
  128. package/dist/level1/Agent.d.ts.map +1 -0
  129. package/dist/level1/Agent.js +1091 -0
  130. package/dist/level1/Agent.js.map +1 -0
  131. package/dist/level1/index.d.ts +10 -0
  132. package/dist/level1/index.d.ts.map +1 -0
  133. package/dist/level1/index.js +30 -0
  134. package/dist/level1/index.js.map +1 -0
  135. package/dist/level1/pricing/PriceCalculator.d.ts +62 -0
  136. package/dist/level1/pricing/PriceCalculator.d.ts.map +1 -0
  137. package/dist/level1/pricing/PriceCalculator.js +237 -0
  138. package/dist/level1/pricing/PriceCalculator.js.map +1 -0
  139. package/dist/level1/pricing/PricingStrategy.d.ts +179 -0
  140. package/dist/level1/pricing/PricingStrategy.d.ts.map +1 -0
  141. package/dist/level1/pricing/PricingStrategy.js +11 -0
  142. package/dist/level1/pricing/PricingStrategy.js.map +1 -0
  143. package/dist/level1/types/Job.d.ts +166 -0
  144. package/dist/level1/types/Job.d.ts.map +1 -0
  145. package/dist/level1/types/Job.js +11 -0
  146. package/dist/level1/types/Job.js.map +1 -0
  147. package/dist/level1/types/Options.d.ts +258 -0
  148. package/dist/level1/types/Options.d.ts.map +1 -0
  149. package/dist/level1/types/Options.js +8 -0
  150. package/dist/level1/types/Options.js.map +1 -0
  151. package/dist/level1/types/index.d.ts +8 -0
  152. package/dist/level1/types/index.d.ts.map +1 -0
  153. package/dist/level1/types/index.js +8 -0
  154. package/dist/level1/types/index.js.map +1 -0
  155. package/dist/protocol/ACTPKernel.d.ts +229 -2
  156. package/dist/protocol/ACTPKernel.d.ts.map +1 -1
  157. package/dist/protocol/ACTPKernel.js +367 -33
  158. package/dist/protocol/ACTPKernel.js.map +1 -1
  159. package/dist/protocol/AgentRegistry.d.ts +177 -0
  160. package/dist/protocol/AgentRegistry.d.ts.map +1 -0
  161. package/dist/protocol/AgentRegistry.js +449 -0
  162. package/dist/protocol/AgentRegistry.js.map +1 -0
  163. package/dist/protocol/DIDManager.d.ts +289 -0
  164. package/dist/protocol/DIDManager.d.ts.map +1 -0
  165. package/dist/protocol/DIDManager.js +481 -0
  166. package/dist/protocol/DIDManager.js.map +1 -0
  167. package/dist/protocol/DIDResolver.d.ts +236 -0
  168. package/dist/protocol/DIDResolver.d.ts.map +1 -0
  169. package/dist/protocol/DIDResolver.js +495 -0
  170. package/dist/protocol/DIDResolver.js.map +1 -0
  171. package/dist/protocol/EASHelper.d.ts +57 -2
  172. package/dist/protocol/EASHelper.d.ts.map +1 -1
  173. package/dist/protocol/EASHelper.js +230 -37
  174. package/dist/protocol/EASHelper.js.map +1 -1
  175. package/dist/protocol/EscrowVault.d.ts +93 -2
  176. package/dist/protocol/EscrowVault.d.ts.map +1 -1
  177. package/dist/protocol/EscrowVault.js +122 -33
  178. package/dist/protocol/EscrowVault.js.map +1 -1
  179. package/dist/protocol/EventMonitor.d.ts +45 -1
  180. package/dist/protocol/EventMonitor.d.ts.map +1 -1
  181. package/dist/protocol/EventMonitor.js +64 -8
  182. package/dist/protocol/EventMonitor.js.map +1 -1
  183. package/dist/protocol/MessageSigner.d.ts +116 -2
  184. package/dist/protocol/MessageSigner.d.ts.map +1 -1
  185. package/dist/protocol/MessageSigner.js +215 -9
  186. package/dist/protocol/MessageSigner.js.map +1 -1
  187. package/dist/protocol/ProofGenerator.d.ts +93 -0
  188. package/dist/protocol/ProofGenerator.d.ts.map +1 -1
  189. package/dist/protocol/ProofGenerator.js +194 -9
  190. package/dist/protocol/ProofGenerator.js.map +1 -1
  191. package/dist/protocol/QuoteBuilder.d.ts +8 -0
  192. package/dist/protocol/QuoteBuilder.d.ts.map +1 -1
  193. package/dist/protocol/QuoteBuilder.js +8 -0
  194. package/dist/protocol/QuoteBuilder.js.map +1 -1
  195. package/dist/runtime/BlockchainRuntime.d.ts +360 -0
  196. package/dist/runtime/BlockchainRuntime.d.ts.map +1 -0
  197. package/dist/runtime/BlockchainRuntime.js +767 -0
  198. package/dist/runtime/BlockchainRuntime.js.map +1 -0
  199. package/dist/runtime/IACTPRuntime.d.ts +271 -0
  200. package/dist/runtime/IACTPRuntime.d.ts.map +1 -0
  201. package/dist/runtime/IACTPRuntime.js +15 -0
  202. package/dist/runtime/IACTPRuntime.js.map +1 -0
  203. package/dist/runtime/MockRuntime.d.ts +445 -0
  204. package/dist/runtime/MockRuntime.d.ts.map +1 -0
  205. package/dist/runtime/MockRuntime.js +1065 -0
  206. package/dist/runtime/MockRuntime.js.map +1 -0
  207. package/dist/runtime/MockStateManager.d.ts +233 -0
  208. package/dist/runtime/MockStateManager.d.ts.map +1 -0
  209. package/dist/runtime/MockStateManager.js +533 -0
  210. package/dist/runtime/MockStateManager.js.map +1 -0
  211. package/dist/runtime/index.d.ts +14 -0
  212. package/dist/runtime/index.d.ts.map +1 -0
  213. package/dist/runtime/index.js +42 -0
  214. package/dist/runtime/index.js.map +1 -0
  215. package/dist/runtime/types/MockState.d.ts +167 -0
  216. package/dist/runtime/types/MockState.d.ts.map +1 -0
  217. package/dist/runtime/types/MockState.js +43 -0
  218. package/dist/runtime/types/MockState.js.map +1 -0
  219. package/dist/types/agent.d.ts +76 -0
  220. package/dist/types/agent.d.ts.map +1 -0
  221. package/dist/types/agent.js +8 -0
  222. package/dist/types/agent.js.map +1 -0
  223. package/dist/types/did.d.ts +192 -0
  224. package/dist/types/did.d.ts.map +1 -0
  225. package/dist/types/did.js +38 -0
  226. package/dist/types/did.js.map +1 -0
  227. package/dist/types/eip712.d.ts +34 -0
  228. package/dist/types/eip712.d.ts.map +1 -1
  229. package/dist/types/eip712.js +31 -5
  230. package/dist/types/eip712.js.map +1 -1
  231. package/dist/types/escrow.d.ts +17 -10
  232. package/dist/types/escrow.d.ts.map +1 -1
  233. package/dist/types/index.d.ts +5 -0
  234. package/dist/types/index.d.ts.map +1 -1
  235. package/dist/types/index.js +8 -0
  236. package/dist/types/index.js.map +1 -1
  237. package/dist/types/message.d.ts +32 -0
  238. package/dist/types/message.d.ts.map +1 -1
  239. package/dist/types/message.js +4 -0
  240. package/dist/types/message.js.map +1 -1
  241. package/dist/types/state.d.ts +28 -0
  242. package/dist/types/state.d.ts.map +1 -1
  243. package/dist/types/state.js +37 -6
  244. package/dist/types/state.js.map +1 -1
  245. package/dist/types/transaction.d.ts +17 -0
  246. package/dist/types/transaction.d.ts.map +1 -1
  247. package/dist/utils/ErrorRecoveryGuide.d.ts +125 -0
  248. package/dist/utils/ErrorRecoveryGuide.d.ts.map +1 -0
  249. package/dist/utils/ErrorRecoveryGuide.js +579 -0
  250. package/dist/utils/ErrorRecoveryGuide.js.map +1 -0
  251. package/dist/utils/Helpers.d.ts +453 -0
  252. package/dist/utils/Helpers.d.ts.map +1 -0
  253. package/dist/utils/Helpers.js +623 -0
  254. package/dist/utils/Helpers.js.map +1 -0
  255. package/dist/utils/IPFSClient.d.ts +113 -0
  256. package/dist/utils/IPFSClient.d.ts.map +1 -1
  257. package/dist/utils/IPFSClient.js +128 -7
  258. package/dist/utils/IPFSClient.js.map +1 -1
  259. package/dist/utils/Logger.d.ts +195 -0
  260. package/dist/utils/Logger.d.ts.map +1 -0
  261. package/dist/utils/Logger.js +382 -0
  262. package/dist/utils/Logger.js.map +1 -0
  263. package/dist/utils/NonceManager.d.ts +234 -1
  264. package/dist/utils/NonceManager.d.ts.map +1 -1
  265. package/dist/utils/NonceManager.js +372 -7
  266. package/dist/utils/NonceManager.js.map +1 -1
  267. package/dist/utils/RateLimiter.d.ts +253 -0
  268. package/dist/utils/RateLimiter.d.ts.map +1 -0
  269. package/dist/utils/RateLimiter.js +424 -0
  270. package/dist/utils/RateLimiter.js.map +1 -0
  271. package/dist/utils/ReceivedNonceTracker.d.ts +175 -0
  272. package/dist/utils/ReceivedNonceTracker.d.ts.map +1 -1
  273. package/dist/utils/ReceivedNonceTracker.js +261 -5
  274. package/dist/utils/ReceivedNonceTracker.js.map +1 -1
  275. package/dist/utils/SDKLifecycle.d.ts +156 -0
  276. package/dist/utils/SDKLifecycle.d.ts.map +1 -0
  277. package/dist/utils/SDKLifecycle.js +347 -0
  278. package/dist/utils/SDKLifecycle.js.map +1 -0
  279. package/dist/utils/SecureNonce.d.ts +57 -0
  280. package/dist/utils/SecureNonce.d.ts.map +1 -0
  281. package/dist/utils/SecureNonce.js +80 -0
  282. package/dist/utils/SecureNonce.js.map +1 -0
  283. package/dist/utils/Semaphore.d.ts +123 -0
  284. package/dist/utils/Semaphore.d.ts.map +1 -0
  285. package/dist/utils/Semaphore.js +247 -0
  286. package/dist/utils/Semaphore.js.map +1 -0
  287. package/dist/utils/UsedAttestationTracker.d.ts +167 -0
  288. package/dist/utils/UsedAttestationTracker.d.ts.map +1 -0
  289. package/dist/utils/UsedAttestationTracker.js +309 -0
  290. package/dist/utils/UsedAttestationTracker.js.map +1 -0
  291. package/dist/utils/canonicalJson.d.ts +22 -0
  292. package/dist/utils/canonicalJson.d.ts.map +1 -1
  293. package/dist/utils/canonicalJson.js +26 -3
  294. package/dist/utils/canonicalJson.js.map +1 -1
  295. package/dist/utils/computeTypeHash.d.ts +14 -0
  296. package/dist/utils/computeTypeHash.d.ts.map +1 -1
  297. package/dist/utils/computeTypeHash.js +19 -2
  298. package/dist/utils/computeTypeHash.js.map +1 -1
  299. package/dist/utils/fsSafe.d.ts +14 -0
  300. package/dist/utils/fsSafe.d.ts.map +1 -0
  301. package/dist/utils/fsSafe.js +89 -0
  302. package/dist/utils/fsSafe.js.map +1 -0
  303. package/dist/utils/index.d.ts +15 -0
  304. package/dist/utils/index.d.ts.map +1 -0
  305. package/dist/utils/index.js +51 -0
  306. package/dist/utils/index.js.map +1 -0
  307. package/dist/utils/security.d.ts +147 -0
  308. package/dist/utils/security.d.ts.map +1 -0
  309. package/dist/utils/security.js +391 -0
  310. package/dist/utils/security.js.map +1 -0
  311. package/dist/utils/validation.d.ts +40 -0
  312. package/dist/utils/validation.d.ts.map +1 -1
  313. package/dist/utils/validation.js +184 -7
  314. package/dist/utils/validation.js.map +1 -1
  315. package/package.json +54 -37
  316. package/src/ACTPClient.ts +692 -178
  317. package/src/abi/AgentRegistry.json +782 -0
  318. package/src/abi/EscrowVault.json +106 -38
  319. package/src/abi/IdentityRegistry.json +316 -0
  320. package/src/adapters/BaseAdapter.ts +473 -0
  321. package/src/adapters/BeginnerAdapter.ts +232 -0
  322. package/src/adapters/IntermediateAdapter.ts +316 -0
  323. package/src/adapters/index.ts +25 -0
  324. package/src/builders/DeliveryProofBuilder.ts +3 -2
  325. package/src/cli/commands/balance.ts +110 -0
  326. package/src/cli/commands/batch.ts +487 -0
  327. package/src/cli/commands/config.ts +231 -0
  328. package/src/cli/commands/init.ts +161 -0
  329. package/src/cli/commands/mint.ts +116 -0
  330. package/src/cli/commands/pay.ts +113 -0
  331. package/src/cli/commands/simulate.ts +345 -0
  332. package/src/cli/commands/time.ts +303 -0
  333. package/src/cli/commands/tx.ts +448 -0
  334. package/src/cli/commands/watch.ts +211 -0
  335. package/src/cli/index.ts +116 -0
  336. package/src/cli/utils/client.ts +249 -0
  337. package/src/cli/utils/config.ts +282 -0
  338. package/src/cli/utils/output.ts +465 -0
  339. package/src/config/networks.ts +32 -9
  340. package/src/errors/index.ts +298 -1
  341. package/src/index.ts +207 -71
  342. package/src/level0/Provider.ts +117 -0
  343. package/src/level0/ServiceDirectory.ts +131 -0
  344. package/src/level0/index.ts +10 -0
  345. package/src/level0/provide.ts +131 -0
  346. package/src/level0/request.ts +494 -0
  347. package/src/level1/Agent.ts +1432 -0
  348. package/src/level1/index.ts +10 -0
  349. package/src/level1/pricing/PriceCalculator.ts +255 -0
  350. package/src/level1/pricing/PricingStrategy.ts +198 -0
  351. package/src/level1/types/Job.ts +179 -0
  352. package/src/level1/types/Options.ts +291 -0
  353. package/src/level1/types/index.ts +8 -0
  354. package/src/protocol/ACTPKernel.ts +175 -23
  355. package/src/protocol/AgentRegistry.ts +559 -0
  356. package/src/protocol/DIDManager.ts +629 -0
  357. package/src/protocol/DIDResolver.ts +554 -0
  358. package/src/protocol/EASHelper.ts +230 -46
  359. package/src/protocol/EscrowVault.ts +68 -50
  360. package/src/protocol/EventMonitor.ts +44 -15
  361. package/src/protocol/MessageSigner.ts +193 -13
  362. package/src/protocol/ProofGenerator.ts +223 -4
  363. package/src/runtime/BlockchainRuntime.ts +993 -0
  364. package/src/runtime/IACTPRuntime.ts +284 -0
  365. package/src/runtime/MockRuntime.ts +1244 -0
  366. package/src/runtime/MockStateManager.ts +576 -0
  367. package/src/runtime/index.ts +25 -0
  368. package/src/runtime/types/MockState.ts +227 -0
  369. package/src/types/agent.ts +79 -0
  370. package/src/types/did.ts +223 -0
  371. package/src/types/escrow.ts +12 -11
  372. package/src/types/index.ts +5 -1
  373. package/src/types/state.ts +12 -3
  374. package/src/types/transaction.ts +4 -1
  375. package/src/utils/ErrorRecoveryGuide.ts +675 -0
  376. package/src/utils/Helpers.ts +688 -0
  377. package/src/utils/IPFSClient.ts +122 -5
  378. package/src/utils/Logger.ts +484 -0
  379. package/src/utils/NonceManager.ts +305 -8
  380. package/src/utils/RateLimiter.ts +534 -0
  381. package/src/utils/ReceivedNonceTracker.ts +170 -0
  382. package/src/utils/SDKLifecycle.ts +416 -0
  383. package/src/utils/SecureNonce.ts +78 -0
  384. package/src/utils/Semaphore.ts +276 -0
  385. package/src/utils/UsedAttestationTracker.ts +387 -0
  386. package/src/utils/fsSafe.ts +75 -0
  387. package/src/utils/index.ts +80 -0
  388. package/src/utils/security.ts +418 -0
  389. package/src/utils/validation.ts +164 -0
  390. package/src/__tests__/ProofGenerator.test.ts +0 -124
  391. package/src/__tests__/QuoteBuilder.test.ts +0 -516
  392. package/src/__tests__/StateMachine.test.ts +0 -82
  393. package/src/__tests__/builders/DeliveryProofBuilder.test.ts +0 -581
  394. package/src/__tests__/integration/ACTPClient.test.ts +0 -263
  395. package/src/__tests__/integration.test.ts +0 -289
  396. package/src/__tests__/protocol/EASHelper.test.ts +0 -472
  397. package/src/__tests__/protocol/EventMonitor.test.ts +0 -382
  398. package/src/__tests__/security/ACTPKernel.security.test.ts +0 -1167
  399. package/src/__tests__/security/EscrowVault.security.test.ts +0 -570
  400. package/src/__tests__/security/MessageSigner.security.test.ts +0 -286
  401. package/src/__tests__/security/NonceReplay.security.test.ts +0 -501
  402. package/src/__tests__/security/validation.security.test.ts +0 -376
  403. package/src/__tests__/utils/IPFSClient.test.ts +0 -262
  404. package/src/__tests__/utils/NonceManager.test.ts +0 -205
  405. package/src/__tests__/utils/canonicalJson.test.ts +0 -153
@@ -0,0 +1,291 @@
1
+ /**
2
+ * Options for Basic and Standard APIs
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+
7
+ import { JobHandler, Job } from './Job';
8
+
9
+ /**
10
+ * Wallet configuration options
11
+ */
12
+ export type WalletOption =
13
+ | 'auto' // SDK generates managed wallet
14
+ | 'connect' // Browser wallet popup (future)
15
+ | string // Private key directly
16
+ | { privateKey: string }; // Private key in object form
17
+
18
+ /**
19
+ * Network options
20
+ */
21
+ export type NetworkOption = 'mock' | 'testnet' | 'mainnet';
22
+
23
+ /**
24
+ * Options for provide() function (Basic API)
25
+ */
26
+ export interface ProvideOptions {
27
+ /**
28
+ * Wallet configuration
29
+ *
30
+ * - 'auto': SDK generates and manages a wallet automatically
31
+ * - 'connect': Open browser wallet connection (MetaMask, etc.) - FUTURE
32
+ * - string: Private key (0x-prefixed hex)
33
+ * - object: { privateKey: string }
34
+ *
35
+ * @default 'auto'
36
+ */
37
+ wallet?: WalletOption;
38
+
39
+ /**
40
+ * Job filtering criteria
41
+ *
42
+ * Only accept jobs matching these filters.
43
+ */
44
+ filter?: {
45
+ /**
46
+ * Minimum budget in USDC
47
+ *
48
+ * @example
49
+ * filter: { minBudget: 5 } // Only accept jobs with budget >= $5
50
+ */
51
+ minBudget?: number;
52
+
53
+ /**
54
+ * Maximum budget in USDC
55
+ *
56
+ * @example
57
+ * filter: { maxBudget: 100 } // Only accept jobs with budget <= $100
58
+ */
59
+ maxBudget?: number;
60
+ };
61
+
62
+ /**
63
+ * Auto-accept policy
64
+ *
65
+ * - true: Automatically accept all jobs matching filter
66
+ * - false: Require manual acceptance
67
+ * - function: Custom logic to decide whether to accept
68
+ *
69
+ * @default true
70
+ *
71
+ * @example
72
+ * ```typescript
73
+ * // Auto-accept if budget >= 10
74
+ * autoAccept: (job) => job.budget >= 10
75
+ *
76
+ * // Auto-accept high-priority jobs
77
+ * autoAccept: (job) => job.metadata?.priority === 'high'
78
+ * ```
79
+ */
80
+ autoAccept?: boolean | ((job: Job) => boolean | Promise<boolean>);
81
+
82
+ /**
83
+ * Network to operate on
84
+ *
85
+ * @default 'mock'
86
+ */
87
+ network?: NetworkOption;
88
+
89
+ /**
90
+ * RPC URL for blockchain connection (required for testnet/mainnet)
91
+ *
92
+ * If not provided, defaults to public RPC from network config:
93
+ * - testnet: https://sepolia.base.org
94
+ * - mainnet: https://mainnet.base.org
95
+ *
96
+ * For production, consider using a dedicated RPC provider (Alchemy, Infura, etc.)
97
+ * for better reliability and rate limits.
98
+ *
99
+ * @example
100
+ * rpcUrl: 'https://base-sepolia.g.alchemy.com/v2/YOUR_API_KEY'
101
+ */
102
+ rpcUrl?: string;
103
+
104
+ /**
105
+ * State directory for mock mode
106
+ *
107
+ * Where to store mock state file.
108
+ * Only used when network is 'mock'.
109
+ *
110
+ * @default process.cwd()
111
+ */
112
+ stateDirectory?: string;
113
+ }
114
+
115
+ /**
116
+ * Request status updates
117
+ */
118
+ export interface RequestStatus {
119
+ /**
120
+ * Current state of the request
121
+ */
122
+ state: 'initiated' | 'quoted' | 'committed' | 'in_progress' | 'delivered' | 'settled' | 'disputed' | 'cancelled';
123
+
124
+ /**
125
+ * Progress percentage (0-100) if provider is reporting progress
126
+ */
127
+ progress?: number;
128
+
129
+ /**
130
+ * Progress message if available
131
+ */
132
+ message?: string;
133
+
134
+ /**
135
+ * Estimated time to completion (seconds)
136
+ */
137
+ eta?: number;
138
+ }
139
+
140
+ /**
141
+ * Options for request() function (Basic API)
142
+ */
143
+ export interface RequestOptions {
144
+ /**
145
+ * Input data to send to the service
146
+ */
147
+ input: any;
148
+
149
+ /**
150
+ * Budget in USDC (decimal format)
151
+ *
152
+ * @example
153
+ * budget: 10 // $10.00
154
+ */
155
+ budget: number;
156
+
157
+ /**
158
+ * Wallet configuration (same as ProvideOptions)
159
+ *
160
+ * @default 'auto'
161
+ */
162
+ wallet?: WalletOption;
163
+
164
+ /**
165
+ * Network to operate on
166
+ *
167
+ * @default 'mock'
168
+ */
169
+ network?: NetworkOption;
170
+
171
+ /**
172
+ * Timeout in milliseconds
173
+ *
174
+ * @default 300000 (5 minutes)
175
+ */
176
+ timeout?: number;
177
+
178
+ /**
179
+ * Deadline for job completion
180
+ *
181
+ * Can be a timestamp (seconds) or Date object.
182
+ * If not specified, defaults to now + timeout.
183
+ *
184
+ * @example
185
+ * deadline: Math.floor(Date.now() / 1000) + 3600 // 1 hour from now
186
+ * deadline: new Date('2025-12-14T12:00:00Z')
187
+ */
188
+ deadline?: number | Date;
189
+
190
+ /**
191
+ * Provider selection strategy
192
+ *
193
+ * - string: Specific provider address
194
+ * - 'any': First available provider
195
+ * - 'best': Provider with highest reputation
196
+ * - 'cheapest': Provider with lowest price
197
+ *
198
+ * @default 'any'
199
+ */
200
+ provider?: string | 'any' | 'best' | 'cheapest';
201
+
202
+ /**
203
+ * Progress callback
204
+ *
205
+ * Called when provider reports progress updates.
206
+ *
207
+ * @example
208
+ * ```typescript
209
+ * onProgress: (status) => {
210
+ * console.log(`${status.state}: ${status.progress}% - ${status.message}`);
211
+ * }
212
+ * ```
213
+ */
214
+ onProgress?: (status: RequestStatus) => void;
215
+
216
+ /**
217
+ * State directory for mock mode
218
+ *
219
+ * @default process.cwd()
220
+ */
221
+ stateDirectory?: string;
222
+
223
+ /**
224
+ * RPC URL for blockchain connection (required for testnet/mainnet)
225
+ *
226
+ * If not provided, defaults to public RPC from network config:
227
+ * - testnet: https://sepolia.base.org
228
+ * - mainnet: https://mainnet.base.org
229
+ *
230
+ * For production, consider using a dedicated RPC provider (Alchemy, Infura, etc.)
231
+ * for better reliability and rate limits.
232
+ *
233
+ * @example
234
+ * rpcUrl: 'https://base-sepolia.g.alchemy.com/v2/YOUR_API_KEY'
235
+ */
236
+ rpcUrl?: string;
237
+
238
+ /**
239
+ * Dispute window duration in seconds
240
+ *
241
+ * Time after delivery during which requester can dispute.
242
+ *
243
+ * @default 172800 (2 days)
244
+ */
245
+ disputeWindow?: number;
246
+ }
247
+
248
+ /**
249
+ * Result of request() function
250
+ */
251
+ export interface RequestResult {
252
+ /**
253
+ * The result returned by the provider's handler
254
+ */
255
+ result: any;
256
+
257
+ /**
258
+ * Transaction metadata
259
+ */
260
+ transaction: {
261
+ /**
262
+ * Transaction ID (ACTP protocol)
263
+ */
264
+ id: string;
265
+
266
+ /**
267
+ * Provider address
268
+ */
269
+ provider: string;
270
+
271
+ /**
272
+ * Amount paid (USDC)
273
+ */
274
+ amount: number;
275
+
276
+ /**
277
+ * Platform fee (USDC)
278
+ */
279
+ fee: number;
280
+
281
+ /**
282
+ * Job duration (milliseconds)
283
+ */
284
+ duration: number;
285
+
286
+ /**
287
+ * Delivery proof hash
288
+ */
289
+ proof: string;
290
+ };
291
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Standard API Types - Job, Options, and related interfaces
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+
7
+ export { Job, JobHandler, JobContext } from './Job';
8
+ export { ProvideOptions, RequestOptions, RequestResult, RequestStatus, WalletOption, NetworkOption } from './Options';
@@ -54,6 +54,18 @@ export class ACTPKernel {
54
54
  return this.address;
55
55
  }
56
56
 
57
+ /**
58
+ * Get the underlying ethers Contract instance.
59
+ *
60
+ * SECURITY FIX (C-3): Provides public access to contract for EventMonitor
61
+ * instead of accessing private field via bracket notation.
62
+ *
63
+ * @returns ethers Contract instance
64
+ */
65
+ getContract(): Contract {
66
+ return this.contract;
67
+ }
68
+
57
69
  /**
58
70
  * Get gas buffer multiplier based on operation complexity
59
71
  * V6 Security Enhancement: Operation-specific gas buffers
@@ -76,12 +88,63 @@ export class ACTPKernel {
76
88
  /**
77
89
  * Build transaction options with gas settings and estimated gas
78
90
  * V6 Enhancement: Dynamic buffer based on operation type
91
+ *
92
+ * SECURITY FIX (C-3): Gas estimation manipulation attack protection
93
+ * - Enforces operation-specific minimum gas floors (not global 100k)
94
+ * - Validates gas limit doesn't exceed block gas limit (DoS prevention)
95
+ * - Uses safe BigInt arithmetic with overflow detection
96
+ * - Prevents floating-point arithmetic (uses BPS - basis points)
79
97
  */
80
98
  private buildTxOptions(estimatedGas: bigint, operation: string = 'default'): any {
99
+ // SECURITY FIX (C-3): Operation-specific minimum gas floors
100
+ // Malicious contracts could return artificially low gas estimates to cause txs to fail
101
+ const MIN_GAS_FLOORS: Record<string, bigint> = {
102
+ 'createTransaction': 120000n, // Create + event emission
103
+ 'transitionState': 80000n, // State update + event
104
+ 'releaseEscrow': 220000n, // Multi-recipient disbursement + events
105
+ 'raiseDispute': 100000n, // Large proof data encoding
106
+ 'resolveDispute': 250000n, // Complex multi-party settlement
107
+ 'cancelTransaction': 60000n, // Simple state change
108
+ 'anchorAttestation': 80000n, // Attestation storage
109
+ 'default': 100000n // Conservative fallback
110
+ };
111
+
112
+ const minFloor = MIN_GAS_FLOORS[operation] || MIN_GAS_FLOORS['default'];
113
+ const safeEstimate = estimatedGas > minFloor ? estimatedGas : minFloor;
114
+
81
115
  const bufferMultiplier = this.getGasBufferMultiplier(operation);
82
116
 
117
+ // SECURITY FIX (C-3): Safe BigInt arithmetic using BPS (basis points)
118
+ // Multiply by (bufferMultiplier * 10000) and divide by 10000
119
+ // Example: 1.15x = (115 * 10000) / 10000 = 11500 / 10000
120
+ // This avoids floating-point precision issues entirely
121
+ const bufferNumerator = BigInt(Math.floor(bufferMultiplier * 10000));
122
+ const bufferDenominator = 10000n;
123
+ const gasLimit = (safeEstimate * bufferNumerator) / bufferDenominator;
124
+
125
+ // SECURITY FIX (C-3): Overflow detection
126
+ // After multiplication and division, result MUST be >= original estimate
127
+ if (gasLimit < safeEstimate) {
128
+ throw new Error(
129
+ `Gas calculation overflow detected for operation "${operation}". ` +
130
+ `Estimate: ${safeEstimate}, Buffer: ${bufferMultiplier}x, Result: ${gasLimit}. ` +
131
+ `This indicates an arithmetic overflow - please report this bug.`
132
+ );
133
+ }
134
+
135
+ // SECURITY FIX (C-3): Block gas limit check (Base L2 = 30M gas)
136
+ // Prevents DoS by requesting excessive gas that can never be included
137
+ const MAX_BLOCK_GAS_LIMIT = 30_000_000n;
138
+ if (gasLimit > MAX_BLOCK_GAS_LIMIT) {
139
+ throw new Error(
140
+ `Gas limit ${gasLimit} exceeds maximum block gas limit ${MAX_BLOCK_GAS_LIMIT} for operation "${operation}". ` +
141
+ `This transaction cannot be executed on-chain. ` +
142
+ `Estimated gas: ${estimatedGas}, Min floor: ${minFloor}, Buffer: ${bufferMultiplier}x.`
143
+ );
144
+ }
145
+
83
146
  const options: any = {
84
- gasLimit: (estimatedGas * BigInt(Math.round(bufferMultiplier * 100))) / 100n
147
+ gasLimit
85
148
  };
86
149
 
87
150
  if (this.gasSettings?.maxFeePerGas) {
@@ -153,7 +216,13 @@ export class ACTPKernel {
153
216
  }
154
217
 
155
218
  // Extract transactionId from TransactionCreated event
156
- // Event signature: TransactionCreated(bytes32 indexed transactionId, ...)
219
+ // Event signature: TransactionCreated(bytes32 indexed transactionId, address indexed requester, address indexed provider, ...)
220
+ //
221
+ // DOCUMENTATION (CRITICAL-3): Note parameter order difference:
222
+ // - Function: createTransaction(provider, requester, ...) - provider is first
223
+ // - Event: TransactionCreated(txId, requester, provider, ...) - requester is first after txId
224
+ // This is INTENTIONAL - function names main actor (provider), event logs initiator first (requester)
225
+ // SDK correctly uses named args (parsedLog.args.transactionId) to avoid confusion
157
226
  for (const log of receipt.logs) {
158
227
  try {
159
228
  const parsedLog = this.contract.interface.parseLog({
@@ -162,6 +231,7 @@ export class ACTPKernel {
162
231
  });
163
232
 
164
233
  if (parsedLog && parsedLog.name === 'TransactionCreated') {
234
+ // Use named arg for clarity (avoids index confusion with swapped provider/requester)
165
235
  return parsedLog.args.transactionId || parsedLog.args[0];
166
236
  }
167
237
  } catch (e) {
@@ -336,28 +406,33 @@ export class ACTPKernel {
336
406
 
337
407
  /**
338
408
  * Release milestone payment
409
+ *
410
+ * SECURITY FIX (CRITICAL-2): Contract ABI has only 2 params (txId, amount), not 3.
411
+ * The milestoneId is NOT part of the current ACTPKernel V1 contract.
412
+ * Per ABI: releaseMilestone(bytes32 transactionId, uint256 amount)
413
+ *
414
+ * @param txId - Transaction ID (bytes32)
415
+ * @param amount - Amount to release (uint256)
416
+ * @deprecated milestoneId parameter - removed as contract doesn't support it
339
417
  */
340
418
  async releaseMilestone(
341
419
  txId: string,
342
- milestoneId: number,
343
420
  amount: bigint
344
421
  ): Promise<void> {
345
422
  // Input validation
346
423
  validateTxId(txId, 'txId');
347
424
  validateAmount(amount, 'amount');
348
- if (milestoneId < 0) {
349
- throw new ValidationError('milestoneId', 'Milestone ID cannot be negative');
350
- }
351
425
 
352
426
  try {
353
427
  // ethers v6: use getFunction()
354
428
  const releaseMilestoneFunc = this.contract.getFunction('releaseMilestone');
355
429
 
430
+ // SECURITY FIX (CRITICAL-2): Contract only takes 2 params (txId, amount)
356
431
  // Estimate gas with safety buffer (30% for escrow release operations)
357
- const estimatedGas = await releaseMilestoneFunc.estimateGas(txId, milestoneId, amount);
432
+ const estimatedGas = await releaseMilestoneFunc.estimateGas(txId, amount);
358
433
  const txOptions = this.buildTxOptions(estimatedGas, 'releaseEscrow');
359
434
 
360
- const tx = await releaseMilestoneFunc(txId, milestoneId, amount, txOptions);
435
+ const tx = await releaseMilestoneFunc(txId, amount, txOptions);
361
436
 
362
437
  await tx.wait(2); // Wait for 2 confirmations (Base L2 reorg safety)
363
438
  } catch (error: any) {
@@ -368,19 +443,66 @@ export class ACTPKernel {
368
443
  /**
369
444
  * Release full escrow (settle transaction)
370
445
  *
371
- * SECURITY WARNING (V1): ACTPKernel V1 contract accepts any attestationUID without validation.
372
- * This means a malicious provider could submit attestation from different transaction.
446
+ * ⚠️ CRITICAL SECURITY WARNING (C-2): Attestation UID Validation Bypass
447
+ *
448
+ * **DO NOT call this method directly from your application code!**
449
+ *
450
+ * ACTPKernel V1 contract accepts any attestationUID without validation.
451
+ * A malicious provider can:
452
+ * - Submit an attestation from a different transaction
453
+ * - Re-use an old attestation (replay attack)
454
+ * - Submit a forged attestation with fake delivery proof
455
+ *
456
+ * **REQUIRED: Use secure wrapper methods instead:**
457
+ *
458
+ * 1. **BeginnerAdapter.completePayment()** (recommended for most users)
459
+ * - Automatically verifies attestation before release
460
+ * - Validates attestation belongs to this transaction
461
+ * - Checks attestation hasn't been used before
462
+ * - Handles all state transitions
463
+ *
464
+ * 2. **IntermediateAdapter.releaseEscrow()** (for more control)
465
+ * - Explicitly requires attestation verification
466
+ * - Throws error if attestation invalid or missing
467
+ * - Allows custom verification logic
468
+ *
469
+ * 3. **Manual verification** (advanced users only):
470
+ * ```typescript
471
+ * // Step 1: Get transaction details
472
+ * const tx = await kernel.getTransaction(txId);
473
+ *
474
+ * // Step 2: Verify attestation if EAS is configured
475
+ * if (easHelper && tx.attestationUID && tx.attestationUID !== '0x0...0') {
476
+ * const isValid = await easHelper.verifyDeliveryAttestation(
477
+ * tx.attestationUID,
478
+ * tx.requester
479
+ * );
480
+ * if (!isValid) {
481
+ * throw new Error('Invalid or fraudulent delivery attestation');
482
+ * }
483
+ * }
484
+ *
485
+ * // Step 3: Only now is it safe to release
486
+ * await kernel.releaseEscrow(txId);
487
+ * ```
373
488
  *
374
- * To protect against this, you can either:
375
- * 1. Use ACTPClient's wrapper method that automatically verifies
376
- * 2. Manually verify attestation before calling this method (see EASHelper.verifyDeliveryAttestation)
489
+ * **Why this matters:**
490
+ * - Without verification, you risk paying for work never delivered
491
+ * - Provider can steal funds by re-using attestations from other transactions
492
+ * - No on-chain enforcement (contract V1 limitation, fixed in V2)
377
493
  *
378
- * Note: Attestation verification is OPTIONAL here because some transactions may not use EAS.
379
- * However, for transactions with delivery proofs, consumers SHOULD verify before settling.
494
+ * **For testnet/mainnet deployments:**
495
+ * - MUST configure easConfig in ACTPClient
496
+ * - MUST use wrapper methods (Beginner/Intermediate adapters)
497
+ * - NEVER call this method directly unless attestation verified
380
498
  *
381
499
  * @param txId - Transaction ID to settle
382
500
  * @throws {ValidationError} If txId is invalid
383
501
  * @throws {TransactionRevertedError} If contract reverts
502
+ *
503
+ * @see {@link BeginnerAdapter.completePayment} Recommended method with built-in verification
504
+ * @see {@link IntermediateAdapter.releaseEscrow} Explicit verification method
505
+ * @see {@link EASHelper.verifyDeliveryAttestation} Manual verification helper
384
506
  */
385
507
  async releaseEscrow(txId: string): Promise<void> {
386
508
  // Input validation
@@ -406,7 +528,21 @@ export class ACTPKernel {
406
528
  * Get transaction by ID
407
529
  */
408
530
  async getTransaction(txId: string): Promise<Transaction> {
409
- const txData = await this.contract.getTransaction(txId);
531
+ let txData: any;
532
+ try {
533
+ txData = await this.contract.getTransaction(txId);
534
+ } catch (error: any) {
535
+ const reason = error?.reason || error?.shortMessage || error?.message || '';
536
+
537
+ // Deployed kernel reverts on missing transactions (e.g., "Tx missing")
538
+ if (typeof reason === 'string' && reason.toLowerCase().includes('tx missing')) {
539
+ throw new TransactionNotFoundError(txId);
540
+ }
541
+
542
+ throw new Error(
543
+ `Failed to fetch transaction ${txId}: ${typeof reason === 'string' ? reason : String(reason)}`
544
+ );
545
+ }
410
546
 
411
547
  // Check if transaction exists (createdAt !== 0)
412
548
  if (txData.createdAt === 0 || txData.createdAt === 0n) {
@@ -420,28 +556,44 @@ export class ACTPKernel {
420
556
  amount: txData.amount,
421
557
  state: (typeof txData.state === 'bigint' ? Number(txData.state) : txData.state) as State,
422
558
  createdAt: typeof txData.createdAt === 'bigint' ? Number(txData.createdAt) : txData.createdAt,
559
+ updatedAt: typeof txData.updatedAt === 'bigint' ? Number(txData.updatedAt) : txData.updatedAt,
423
560
  deadline: typeof txData.deadline === 'bigint' ? Number(txData.deadline) : txData.deadline,
424
561
  disputeWindow: typeof txData.disputeWindow === 'bigint' ? Number(txData.disputeWindow) : txData.disputeWindow,
425
562
  escrowContract: txData.escrowContract,
426
563
  escrowId: txData.escrowId,
564
+ serviceHash: txData.serviceHash,
565
+ attestationUID: txData.attestationUID,
427
566
  // Use metadata field (quote hash for QUOTED state) if available, fallback to serviceHash
428
- metadata: txData.metadata || txData.serviceHash
567
+ metadata: txData.metadata || txData.serviceHash,
568
+ platformFeeBpsLocked:
569
+ typeof txData.platformFeeBpsLocked === 'bigint'
570
+ ? Number(txData.platformFeeBpsLocked)
571
+ : txData.platformFeeBpsLocked
429
572
  };
430
573
  }
431
574
 
432
575
  /**
433
576
  * Get economic parameters (fee structure)
434
- * Fixed: Don't hardcode values, read from contract
577
+ *
578
+ * SECURITY FIX (CRITICAL-4): Contract doesn't have getEconomicParams() function.
579
+ * Must call individual getters: platformFeeBps(), requesterPenaltyBps(), feeRecipient()
580
+ * Per ACTPKernel.json ABI lines 576-586, 619-630, 351-361
435
581
  */
436
582
  async getEconomicParams(): Promise<EconomicParams> {
437
- const params = await this.contract.getEconomicParams();
583
+ // SECURITY FIX (CRITICAL-4): Call individual view functions in parallel
584
+ // Contract ABI has: platformFeeBps(), requesterPenaltyBps(), feeRecipient()
585
+ // NOT a combined getEconomicParams() function
586
+ const [platformFeeBps, requesterPenaltyBps, feeRecipient] = await Promise.all([
587
+ this.contract.platformFeeBps(),
588
+ this.contract.requesterPenaltyBps(),
589
+ this.contract.feeRecipient()
590
+ ]);
438
591
 
439
- // Contract returns: (platformFeeBps, requesterPenaltyBps, feeRecipient)
440
592
  return {
441
- baseFeeNumerator: Number(params.platformFeeBps || params[0]),
593
+ baseFeeNumerator: Number(platformFeeBps),
442
594
  baseFeeDenominator: 10000, // BPS is always out of 10000
443
- feeRecipient: params.feeRecipient || params[2],
444
- requesterPenaltyBps: Number(params.requesterPenaltyBps || params[1]),
595
+ feeRecipient: feeRecipient,
596
+ requesterPenaltyBps: Number(requesterPenaltyBps),
445
597
  providerPenaltyBps: 0 // Not in current contract ABI, will be added in future version
446
598
  };
447
599
  }