otto-intel-mcp 0.1.2 → 0.1.4

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 (239) hide show
  1. package/README.md +76 -18
  2. package/dist/account-userop-policy-definition.d.ts +14 -0
  3. package/dist/account-userop-policy-definition.js +12 -0
  4. package/dist/account-userop-policy-relation.d.ts +371 -0
  5. package/dist/account-userop-policy-relation.js +87 -0
  6. package/dist/adapter/cdp-signer.d.ts +76 -9
  7. package/dist/adapter/cdp-signer.js +274 -33
  8. package/dist/adapter/evm-call-failure.d.ts +29 -0
  9. package/dist/adapter/evm-call-failure.js +109 -0
  10. package/dist/adapter/refusal.d.ts +1 -1
  11. package/dist/adapter/refusal.js +13 -0
  12. package/dist/adapter/route-simulator.d.ts +91 -0
  13. package/dist/adapter/route-simulator.js +143 -0
  14. package/dist/adapter-cdp-index.d.ts +1 -1
  15. package/dist/executable-equities.d.ts +55 -0
  16. package/dist/executable-equities.js +116 -0
  17. package/dist/executable-yield-markets.d.ts +261 -0
  18. package/dist/executable-yield-markets.js +154 -0
  19. package/dist/execution-account-gas-quote.d.ts +141 -0
  20. package/dist/execution-account-gas-quote.js +443 -0
  21. package/dist/execution-account-gas-review.d.ts +123 -0
  22. package/dist/execution-account-gas-review.js +104 -0
  23. package/dist/execution-account-gas-runtime.d.ts +33 -0
  24. package/dist/execution-account-gas-runtime.js +131 -0
  25. package/dist/execution-account-gas-view.d.ts +936 -0
  26. package/dist/execution-account-gas-view.js +56 -0
  27. package/dist/execution-config.d.ts +3 -0
  28. package/dist/execution-config.js +4 -0
  29. package/dist/execution-delegated-definition.d.ts +7 -6
  30. package/dist/execution-delegated-definition.js +13 -2
  31. package/dist/execution-delegation-admin-definition.d.ts +127 -5
  32. package/dist/execution-delegation-admin-definition.js +155 -5
  33. package/dist/execution-delegation-admin.d.ts +48 -2
  34. package/dist/execution-delegation-admin.js +422 -12
  35. package/dist/execution-delegation-cap-store.d.ts +386 -0
  36. package/dist/execution-delegation-cap-store.js +1150 -0
  37. package/dist/execution-delegation-exit-definition.d.ts +309 -0
  38. package/dist/execution-delegation-exit-definition.js +204 -0
  39. package/dist/execution-delegation-exit-store.d.ts +114 -0
  40. package/dist/execution-delegation-exit-store.js +671 -0
  41. package/dist/execution-delegation-exit.d.ts +4 -0
  42. package/dist/execution-delegation-exit.js +614 -0
  43. package/dist/execution-delegation-finality.d.ts +22 -0
  44. package/dist/execution-delegation-finality.js +90 -0
  45. package/dist/execution-delegation-operation-store.d.ts +129 -0
  46. package/dist/execution-delegation-operation-store.js +1107 -0
  47. package/dist/execution-delegation-operations-definition.d.ts +282 -0
  48. package/dist/execution-delegation-operations-definition.js +117 -0
  49. package/dist/execution-delegation-operations.d.ts +6 -0
  50. package/dist/execution-delegation-operations.js +282 -0
  51. package/dist/execution-delegation-policy.d.ts +154 -8
  52. package/dist/execution-delegation-policy.js +273 -40
  53. package/dist/execution-delegation.d.ts +51 -0
  54. package/dist/execution-delegation.js +441 -31
  55. package/dist/execution-errors.d.ts +1 -1
  56. package/dist/execution-errors.js +122 -0
  57. package/dist/execution-index.d.ts +7 -2
  58. package/dist/execution-index.js +7 -2
  59. package/dist/execution-journal-schema.d.ts +96 -0
  60. package/dist/execution-journal-schema.js +368 -0
  61. package/dist/execution-journal-tables.d.ts +14 -0
  62. package/dist/execution-journal-tables.js +227 -0
  63. package/dist/execution-policy-compatibility.d.ts +34 -0
  64. package/dist/execution-policy-compatibility.js +76 -0
  65. package/dist/execution-registration.d.ts +54 -2
  66. package/dist/execution-registration.js +151 -5
  67. package/dist/execution-sponsored-account-profile.d.ts +32 -0
  68. package/dist/execution-sponsored-account-profile.js +59 -0
  69. package/dist/execution-sponsored-account.d.ts +1519 -0
  70. package/dist/execution-sponsored-account.js +222 -0
  71. package/dist/execution-sponsored-definition.d.ts +1713 -0
  72. package/dist/execution-sponsored-definition.js +185 -0
  73. package/dist/execution-sponsored-gas-policy.d.ts +27 -0
  74. package/dist/execution-sponsored-gas-policy.js +110 -0
  75. package/dist/execution-sponsored-hosted.d.ts +3 -0
  76. package/dist/execution-sponsored-hosted.js +71 -0
  77. package/dist/execution-sponsored-index.d.ts +1322 -0
  78. package/dist/execution-sponsored-index.js +102 -0
  79. package/dist/execution-sponsored-mcp-definition.d.ts +1662 -0
  80. package/dist/execution-sponsored-mcp-definition.js +94 -0
  81. package/dist/execution-sponsored-receipt.d.ts +47 -0
  82. package/dist/execution-sponsored-receipt.js +74 -0
  83. package/dist/execution-sponsored-registration.d.ts +14 -0
  84. package/dist/execution-sponsored-registration.js +77 -0
  85. package/dist/execution-sponsored-runtime.d.ts +84 -0
  86. package/dist/execution-sponsored-runtime.js +149 -0
  87. package/dist/execution-sponsored-settlement.d.ts +15 -0
  88. package/dist/execution-sponsored-settlement.js +88 -0
  89. package/dist/execution-sponsored-store.d.ts +67 -0
  90. package/dist/execution-sponsored-store.js +517 -0
  91. package/dist/execution-sponsored-transport.d.ts +90 -0
  92. package/dist/execution-sponsored-transport.js +180 -0
  93. package/dist/execution-tool-definitions.d.ts +21 -21
  94. package/dist/execution-tool-definitions.js +0 -7
  95. package/dist/execution-tools.d.ts +53 -1
  96. package/dist/execution-tools.js +171 -13
  97. package/dist/execution-worker-guard.d.ts +28 -0
  98. package/dist/execution-worker-guard.js +124 -0
  99. package/dist/hybrid-yield-index.d.ts +10 -0
  100. package/dist/hybrid-yield-index.js +11 -0
  101. package/dist/hybrid-yield-markets.d.ts +96 -0
  102. package/dist/hybrid-yield-markets.js +124 -0
  103. package/dist/hybrid-yield.d.ts +411 -0
  104. package/dist/hybrid-yield.js +155 -0
  105. package/dist/hyperliquid-order-builder.js +4 -0
  106. package/dist/lifi-execution-client.d.ts +6 -0
  107. package/dist/lifi-execution-client.js +3 -0
  108. package/dist/lp-userop-account.d.ts +461 -0
  109. package/dist/lp-userop-account.js +417 -0
  110. package/dist/lp-userop-authority.d.ts +49 -0
  111. package/dist/lp-userop-authority.js +211 -0
  112. package/dist/lp-userop-definition.d.ts +233 -0
  113. package/dist/lp-userop-definition.js +85 -0
  114. package/dist/lp-userop-hosted.d.ts +3 -0
  115. package/dist/lp-userop-hosted.js +73 -0
  116. package/dist/lp-userop-index.d.ts +1569 -0
  117. package/dist/lp-userop-index.js +112 -0
  118. package/dist/lp-userop-mcp-definition.d.ts +1220 -0
  119. package/dist/lp-userop-mcp-definition.js +46 -0
  120. package/dist/lp-userop-operation.d.ts +1230 -0
  121. package/dist/lp-userop-operation.js +140 -0
  122. package/dist/lp-userop-registration.d.ts +14 -0
  123. package/dist/lp-userop-registration.js +70 -0
  124. package/dist/lp-userop-settlement.d.ts +89 -0
  125. package/dist/lp-userop-settlement.js +184 -0
  126. package/dist/lp-userop.d.ts +643 -0
  127. package/dist/lp-userop.js +343 -0
  128. package/dist/native-yield-account-definition.d.ts +1192 -0
  129. package/dist/native-yield-account-definition.js +232 -0
  130. package/dist/native-yield-account-gas.d.ts +58 -0
  131. package/dist/native-yield-account-gas.js +228 -0
  132. package/dist/native-yield-account-index.d.ts +23 -0
  133. package/dist/native-yield-account-index.js +28 -0
  134. package/dist/native-yield-account-policy.d.ts +168 -0
  135. package/dist/native-yield-account-policy.js +525 -0
  136. package/dist/native-yield-account-rpc.d.ts +8 -0
  137. package/dist/native-yield-account-rpc.js +128 -0
  138. package/dist/native-yield-account-runtime.d.ts +71 -0
  139. package/dist/native-yield-account-runtime.js +125 -0
  140. package/dist/native-yield-account-store.d.ts +40 -0
  141. package/dist/native-yield-account-store.js +307 -0
  142. package/dist/native-yield-account.d.ts +662 -0
  143. package/dist/native-yield-account.js +371 -0
  144. package/dist/native-yield-consent-store.d.ts +20 -0
  145. package/dist/native-yield-consent-store.js +317 -0
  146. package/dist/native-yield-definition.d.ts +288 -0
  147. package/dist/native-yield-definition.js +105 -0
  148. package/dist/native-yield-reader.d.ts +4 -0
  149. package/dist/native-yield-reader.js +137 -0
  150. package/dist/native-yield-settlement.d.ts +48 -0
  151. package/dist/native-yield-settlement.js +167 -0
  152. package/dist/native-yield-simulation.d.ts +18 -0
  153. package/dist/native-yield-simulation.js +45 -0
  154. package/dist/native-yield-userop-account.d.ts +675 -0
  155. package/dist/native-yield-userop-account.js +357 -0
  156. package/dist/native-yield-userop-authority.d.ts +214 -0
  157. package/dist/native-yield-userop-authority.js +296 -0
  158. package/dist/native-yield-userop-definition.d.ts +331 -0
  159. package/dist/native-yield-userop-definition.js +105 -0
  160. package/dist/native-yield-userop-hosted.d.ts +3 -0
  161. package/dist/native-yield-userop-hosted.js +71 -0
  162. package/dist/native-yield-userop-index.d.ts +1522 -0
  163. package/dist/native-yield-userop-index.js +142 -0
  164. package/dist/native-yield-userop-mcp-definition.d.ts +1356 -0
  165. package/dist/native-yield-userop-mcp-definition.js +50 -0
  166. package/dist/native-yield-userop-operation.d.ts +845 -0
  167. package/dist/native-yield-userop-operation.js +127 -0
  168. package/dist/native-yield-userop-policy.d.ts +23 -0
  169. package/dist/native-yield-userop-policy.js +25 -0
  170. package/dist/native-yield-userop-registration.d.ts +17 -0
  171. package/dist/native-yield-userop-registration.js +76 -0
  172. package/dist/native-yield-userop-settlement.d.ts +8 -0
  173. package/dist/native-yield-userop-settlement.js +79 -0
  174. package/dist/native-yield-userop-simulation.d.ts +18 -0
  175. package/dist/native-yield-userop-simulation.js +34 -0
  176. package/dist/native-yield-userop.d.ts +35 -0
  177. package/dist/native-yield-userop.js +156 -0
  178. package/dist/native-yield-verify.d.ts +30 -0
  179. package/dist/native-yield-verify.js +141 -0
  180. package/dist/native-yield.d.ts +17 -0
  181. package/dist/native-yield.js +119 -0
  182. package/dist/stdio-main.js +0 -0
  183. package/dist/stock-buy-definition.d.ts +338 -0
  184. package/dist/stock-buy-definition.js +127 -0
  185. package/dist/stock-buy-oracle.d.ts +8 -0
  186. package/dist/stock-buy-oracle.js +22 -0
  187. package/dist/stock-buy.d.ts +17 -0
  188. package/dist/stock-buy.js +164 -0
  189. package/dist/tool-definitions.d.ts +3 -1
  190. package/dist/tool-definitions.js +55 -2
  191. package/dist/vendor/lp-v3/lp-v3-atomic-contract.d.ts +445 -0
  192. package/dist/vendor/lp-v3/lp-v3-atomic-contract.js +90 -0
  193. package/dist/vendor/lp-v3/lp-v3-atomic-evidence.d.ts +14 -0
  194. package/dist/vendor/lp-v3/lp-v3-atomic-evidence.js +82 -0
  195. package/dist/vendor/lp-v3/lp-v3-atomic-index.d.ts +80 -0
  196. package/dist/vendor/lp-v3/lp-v3-atomic-index.js +19 -0
  197. package/dist/vendor/lp-v3/lp-v3-atomic-plan.d.ts +43 -0
  198. package/dist/vendor/lp-v3/lp-v3-atomic-plan.js +112 -0
  199. package/dist/vendor/lp-v3/lp-v3-atomic-read-contract.d.ts +312 -0
  200. package/dist/vendor/lp-v3/lp-v3-atomic-read-contract.js +41 -0
  201. package/dist/vendor/lp-v3/lp-v3-atomic-read-index.d.ts +3 -0
  202. package/dist/vendor/lp-v3/lp-v3-atomic-read-index.js +3 -0
  203. package/dist/vendor/lp-v3/lp-v3-atomic-read-rpc.d.ts +49 -0
  204. package/dist/vendor/lp-v3/lp-v3-atomic-read-rpc.js +88 -0
  205. package/dist/vendor/lp-v3/lp-v3-atomic-read.d.ts +17 -0
  206. package/dist/vendor/lp-v3/lp-v3-atomic-read.js +232 -0
  207. package/dist/vendor/lp-v3/lp-v3-atomic-settlement.d.ts +105 -0
  208. package/dist/vendor/lp-v3/lp-v3-atomic-settlement.js +162 -0
  209. package/dist/vendor/lp-v3/lp-v3-collect-protocol-contract.d.ts +606 -0
  210. package/dist/vendor/lp-v3/lp-v3-collect-protocol-contract.js +59 -0
  211. package/dist/vendor/lp-v3/lp-v3-collect-protocol-index.d.ts +168 -0
  212. package/dist/vendor/lp-v3/lp-v3-collect-protocol-index.js +23 -0
  213. package/dist/vendor/lp-v3/lp-v3-collect-protocol-observation.d.ts +32 -0
  214. package/dist/vendor/lp-v3/lp-v3-collect-protocol-observation.js +228 -0
  215. package/dist/vendor/lp-v3/lp-v3-collect-protocol-plan.d.ts +11 -0
  216. package/dist/vendor/lp-v3/lp-v3-collect-protocol-plan.js +91 -0
  217. package/dist/vendor/lp-v3/lp-v3-collect-protocol-reconcile.d.ts +9 -0
  218. package/dist/vendor/lp-v3/lp-v3-collect-protocol-reconcile.js +124 -0
  219. package/dist/vendor/lp-v3/lp-v3-contract.d.ts +538 -0
  220. package/dist/vendor/lp-v3/lp-v3-contract.js +137 -0
  221. package/dist/vendor/lp-v3/lp-v3-evidence.d.ts +25 -0
  222. package/dist/vendor/lp-v3/lp-v3-evidence.js +168 -0
  223. package/dist/vendor/lp-v3/lp-v3-plan.d.ts +22 -0
  224. package/dist/vendor/lp-v3/lp-v3-plan.js +135 -0
  225. package/dist/vendor/lp-v3/types.d.ts +131 -0
  226. package/dist/vendor/lp-v3/types.js +6 -0
  227. package/dist/vendor/lp-v3/v4-math.d.ts +18 -0
  228. package/dist/vendor/lp-v3/v4-math.js +90 -0
  229. package/dist/yield-deposit-definition.d.ts +374 -0
  230. package/dist/yield-deposit-definition.js +123 -0
  231. package/dist/yield-deposit.d.ts +16 -0
  232. package/dist/yield-deposit.js +149 -0
  233. package/dist/yield-route-semantics.d.ts +27 -0
  234. package/dist/yield-route-semantics.js +71 -0
  235. package/dist/yield-withdraw-definition.d.ts +357 -0
  236. package/dist/yield-withdraw-definition.js +90 -0
  237. package/dist/yield-withdraw.d.ts +11 -0
  238. package/dist/yield-withdraw.js +122 -0
  239. package/package.json +239 -7
@@ -0,0 +1,445 @@
1
+ import { z } from 'zod';
2
+ import { type LpV3Intent, type LpV3ChainEvidence } from './lp-v3-contract.js';
3
+ export declare const LP_V3_COLLECT_GUARD_ID = "base-weth-usdc-collect-v1";
4
+ export declare const LP_V3_COLLECT_CONFIGURATION_HASH: `0x${string}`;
5
+ export declare const lpV3GuardDeploymentSchema: z.ZodObject<{
6
+ id: z.ZodLiteral<"base-weth-usdc-collect-v1">;
7
+ chainId: z.ZodLiteral<8453>;
8
+ address: z.ZodString;
9
+ runtimeCodeHash: z.ZodString;
10
+ configurationHash: z.ZodLiteral<`0x${string}`>;
11
+ codeVersion: z.ZodLiteral<"OttoV3CollectGuard-v1">;
12
+ deploymentBlock: z.ZodString;
13
+ reviewReference: z.ZodString;
14
+ }, z.core.$strict>;
15
+ export type LpV3GuardDeployment = z.infer<typeof lpV3GuardDeploymentSchema>;
16
+ /** No guard is deployed/activated by this library. A host may supply a separately
17
+ * reviewed manifest at startup. Never deserialize this policy from an agent/API plan.
18
+ */
19
+ export declare const DEFAULT_LP_V3_COLLECT_GUARDS: readonly LpV3GuardDeployment[];
20
+ export declare function reviewedGuardPolicy(input?: readonly LpV3GuardDeployment[]): readonly LpV3GuardDeployment[];
21
+ export declare const lpV3AtomicIntentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
22
+ action: z.ZodLiteral<"increase">;
23
+ tokenId: z.ZodString;
24
+ amountDesired: z.ZodTuple<[z.ZodString, z.ZodString], null>;
25
+ amountMin: z.ZodTuple<[z.ZodString, z.ZodString], null>;
26
+ protocol: z.ZodLiteral<"uniswap-v3">;
27
+ chainId: z.ZodLiteral<8453>;
28
+ operationId: z.ZodString;
29
+ account: z.ZodString;
30
+ recipient: z.ZodString;
31
+ manager: z.ZodLiteral<"0x03a520b32c04bf3beef7beb72e919cf822ed34f1">;
32
+ factory: z.ZodLiteral<"0x33128a8fc17869897dce68ed026d694621f6fdfd">;
33
+ pool: z.ZodString;
34
+ token0: z.ZodLiteral<"0x4200000000000000000000000000000000000006">;
35
+ token1: z.ZodLiteral<"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913">;
36
+ fee: z.ZodUnion<readonly [z.ZodLiteral<100>, z.ZodLiteral<500>, z.ZodLiteral<3000>, z.ZodLiteral<10000>]>;
37
+ tickLower: z.ZodNumber;
38
+ tickUpper: z.ZodNumber;
39
+ deadline: z.ZodNumber;
40
+ schemaVersion: z.ZodLiteral<2>;
41
+ nftApprovalPolicy: z.ZodLiteral<"zero-before-and-after">;
42
+ }, z.core.$strict>, z.ZodObject<{
43
+ action: z.ZodLiteral<"collect">;
44
+ tokenId: z.ZodString;
45
+ amountMax: z.ZodTuple<[z.ZodString, z.ZodString], null>;
46
+ amountMin: z.ZodTuple<[z.ZodString, z.ZodString], null>;
47
+ protocol: z.ZodLiteral<"uniswap-v3">;
48
+ chainId: z.ZodLiteral<8453>;
49
+ operationId: z.ZodString;
50
+ account: z.ZodString;
51
+ recipient: z.ZodString;
52
+ manager: z.ZodLiteral<"0x03a520b32c04bf3beef7beb72e919cf822ed34f1">;
53
+ factory: z.ZodLiteral<"0x33128a8fc17869897dce68ed026d694621f6fdfd">;
54
+ pool: z.ZodString;
55
+ token0: z.ZodLiteral<"0x4200000000000000000000000000000000000006">;
56
+ token1: z.ZodLiteral<"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913">;
57
+ fee: z.ZodUnion<readonly [z.ZodLiteral<100>, z.ZodLiteral<500>, z.ZodLiteral<3000>, z.ZodLiteral<10000>]>;
58
+ tickLower: z.ZodNumber;
59
+ tickUpper: z.ZodNumber;
60
+ deadline: z.ZodNumber;
61
+ schemaVersion: z.ZodLiteral<2>;
62
+ nftApprovalPolicy: z.ZodLiteral<"zero-before-and-after">;
63
+ guardDeploymentId: z.ZodLiteral<"base-weth-usdc-collect-v1">;
64
+ }, z.core.$strict>], "action">;
65
+ export type LpV3AtomicIntent = z.infer<typeof lpV3AtomicIntentSchema>;
66
+ export declare const lpV3AtomicPositionSchema: z.ZodObject<{
67
+ tokenId: z.ZodString;
68
+ owner: z.ZodString;
69
+ token0: z.ZodString;
70
+ token1: z.ZodString;
71
+ fee: z.ZodNumber;
72
+ tickLower: z.ZodNumber;
73
+ tickUpper: z.ZodNumber;
74
+ liquidity: z.ZodString;
75
+ tokensOwed: z.ZodTuple<[z.ZodString, z.ZodString], null>;
76
+ approved: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"0x0000000000000000000000000000000000000000">]>;
77
+ }, z.core.$strict>;
78
+ export declare const lpV3AtomicGuardEvidenceSchema: z.ZodObject<{
79
+ address: z.ZodString;
80
+ runtimeCodeHash: z.ZodString;
81
+ configurationHash: z.ZodString;
82
+ deploymentChainId: z.ZodLiteral<8453>;
83
+ ownerApprovalForAll: z.ZodLiteral<false>;
84
+ guardBlacklisted: z.ZodLiteral<false>;
85
+ poolBlacklisted: z.ZodLiteral<false>;
86
+ tokenAllowances: z.ZodTuple<[z.ZodLiteral<"0">, z.ZodLiteral<"0">], null>;
87
+ tokenBalances: z.ZodTuple<[z.ZodString, z.ZodString], null>;
88
+ }, z.core.$strict>;
89
+ export declare const lpV3AtomicChainEvidenceSchema: z.ZodObject<{
90
+ chainId: z.ZodLiteral<8453>;
91
+ blockNumber: z.ZodString;
92
+ blockHash: z.ZodString;
93
+ blockTimestamp: z.ZodNumber;
94
+ observedAt: z.ZodNumber;
95
+ canonical: z.ZodLiteral<true>;
96
+ account: z.ZodString;
97
+ accountCode: z.ZodLiteral<"0x">;
98
+ balances: z.ZodTuple<[z.ZodString, z.ZodString], null>;
99
+ allowances: z.ZodTuple<[z.ZodString, z.ZodString], null>;
100
+ manager: z.ZodLiteral<"0x03a520b32c04bf3beef7beb72e919cf822ed34f1">;
101
+ managerFactory: z.ZodLiteral<"0x33128a8fc17869897dce68ed026d694621f6fdfd">;
102
+ factory: z.ZodLiteral<"0x33128a8fc17869897dce68ed026d694621f6fdfd">;
103
+ factoryPool: z.ZodString;
104
+ factoryCodeHash: z.ZodLiteral<`0x${string}`>;
105
+ managerCodeHash: z.ZodLiteral<`0x${string}`>;
106
+ token0CodeHash: z.ZodLiteral<`0x${string}`>;
107
+ token1CodeHash: z.ZodLiteral<`0x${string}`>;
108
+ usdcImplementation: z.ZodLiteral<"0x2ce6311ddae708829bc0784c967b7d77d19fd779">;
109
+ usdcImplementationCodeHash: z.ZodLiteral<`0x${string}`>;
110
+ usdcPaused: z.ZodLiteral<false>;
111
+ accountBlacklisted: z.ZodLiteral<false>;
112
+ managerBlacklisted: z.ZodLiteral<false>;
113
+ pool: z.ZodString;
114
+ poolFactory: z.ZodLiteral<"0x33128a8fc17869897dce68ed026d694621f6fdfd">;
115
+ token0: z.ZodLiteral<"0x4200000000000000000000000000000000000006">;
116
+ token1: z.ZodLiteral<"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913">;
117
+ fee: z.ZodNumber;
118
+ tickSpacing: z.ZodNumber;
119
+ tick: z.ZodNumber;
120
+ sqrtPriceX96: z.ZodString;
121
+ unlocked: z.ZodLiteral<true>;
122
+ schemaVersion: z.ZodLiteral<2>;
123
+ position: z.ZodObject<{
124
+ tokenId: z.ZodString;
125
+ owner: z.ZodString;
126
+ token0: z.ZodString;
127
+ token1: z.ZodString;
128
+ fee: z.ZodNumber;
129
+ tickLower: z.ZodNumber;
130
+ tickUpper: z.ZodNumber;
131
+ liquidity: z.ZodString;
132
+ tokensOwed: z.ZodTuple<[z.ZodString, z.ZodString], null>;
133
+ approved: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"0x0000000000000000000000000000000000000000">]>;
134
+ }, z.core.$strict>;
135
+ managerNativeBalance: z.ZodString;
136
+ guard: z.ZodNullable<z.ZodObject<{
137
+ address: z.ZodString;
138
+ runtimeCodeHash: z.ZodString;
139
+ configurationHash: z.ZodString;
140
+ deploymentChainId: z.ZodLiteral<8453>;
141
+ ownerApprovalForAll: z.ZodLiteral<false>;
142
+ guardBlacklisted: z.ZodLiteral<false>;
143
+ poolBlacklisted: z.ZodLiteral<false>;
144
+ tokenAllowances: z.ZodTuple<[z.ZodLiteral<"0">, z.ZodLiteral<"0">], null>;
145
+ tokenBalances: z.ZodTuple<[z.ZodString, z.ZodString], null>;
146
+ }, z.core.$strict>>;
147
+ }, z.core.$strict>;
148
+ export type LpV3AtomicChainEvidence = z.infer<typeof lpV3AtomicChainEvidenceSchema>;
149
+ export declare const lpV3AtomicCallSchema: z.ZodObject<{
150
+ step: z.ZodEnum<{
151
+ mutation: "mutation";
152
+ "erc20-approve": "erc20-approve";
153
+ "erc20-cleanup": "erc20-cleanup";
154
+ "nft-approve": "nft-approve";
155
+ "nft-clear": "nft-clear";
156
+ }>;
157
+ tokenIndex: z.ZodNullable<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
158
+ chainId: z.ZodLiteral<8453>;
159
+ from: z.ZodString;
160
+ to: z.ZodString;
161
+ value: z.ZodLiteral<"0">;
162
+ data: z.ZodString;
163
+ }, z.core.$strict>;
164
+ export type LpV3AtomicCall = z.infer<typeof lpV3AtomicCallSchema>;
165
+ export declare const lpV3AtomicPlanSchema: z.ZodObject<{
166
+ schemaVersion: z.ZodLiteral<2>;
167
+ kind: z.ZodLiteral<"lp-v3-atomic">;
168
+ intent: z.ZodDiscriminatedUnion<[z.ZodObject<{
169
+ action: z.ZodLiteral<"increase">;
170
+ tokenId: z.ZodString;
171
+ amountDesired: z.ZodTuple<[z.ZodString, z.ZodString], null>;
172
+ amountMin: z.ZodTuple<[z.ZodString, z.ZodString], null>;
173
+ protocol: z.ZodLiteral<"uniswap-v3">;
174
+ chainId: z.ZodLiteral<8453>;
175
+ operationId: z.ZodString;
176
+ account: z.ZodString;
177
+ recipient: z.ZodString;
178
+ manager: z.ZodLiteral<"0x03a520b32c04bf3beef7beb72e919cf822ed34f1">;
179
+ factory: z.ZodLiteral<"0x33128a8fc17869897dce68ed026d694621f6fdfd">;
180
+ pool: z.ZodString;
181
+ token0: z.ZodLiteral<"0x4200000000000000000000000000000000000006">;
182
+ token1: z.ZodLiteral<"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913">;
183
+ fee: z.ZodUnion<readonly [z.ZodLiteral<100>, z.ZodLiteral<500>, z.ZodLiteral<3000>, z.ZodLiteral<10000>]>;
184
+ tickLower: z.ZodNumber;
185
+ tickUpper: z.ZodNumber;
186
+ deadline: z.ZodNumber;
187
+ schemaVersion: z.ZodLiteral<2>;
188
+ nftApprovalPolicy: z.ZodLiteral<"zero-before-and-after">;
189
+ }, z.core.$strict>, z.ZodObject<{
190
+ action: z.ZodLiteral<"collect">;
191
+ tokenId: z.ZodString;
192
+ amountMax: z.ZodTuple<[z.ZodString, z.ZodString], null>;
193
+ amountMin: z.ZodTuple<[z.ZodString, z.ZodString], null>;
194
+ protocol: z.ZodLiteral<"uniswap-v3">;
195
+ chainId: z.ZodLiteral<8453>;
196
+ operationId: z.ZodString;
197
+ account: z.ZodString;
198
+ recipient: z.ZodString;
199
+ manager: z.ZodLiteral<"0x03a520b32c04bf3beef7beb72e919cf822ed34f1">;
200
+ factory: z.ZodLiteral<"0x33128a8fc17869897dce68ed026d694621f6fdfd">;
201
+ pool: z.ZodString;
202
+ token0: z.ZodLiteral<"0x4200000000000000000000000000000000000006">;
203
+ token1: z.ZodLiteral<"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913">;
204
+ fee: z.ZodUnion<readonly [z.ZodLiteral<100>, z.ZodLiteral<500>, z.ZodLiteral<3000>, z.ZodLiteral<10000>]>;
205
+ tickLower: z.ZodNumber;
206
+ tickUpper: z.ZodNumber;
207
+ deadline: z.ZodNumber;
208
+ schemaVersion: z.ZodLiteral<2>;
209
+ nftApprovalPolicy: z.ZodLiteral<"zero-before-and-after">;
210
+ guardDeploymentId: z.ZodLiteral<"base-weth-usdc-collect-v1">;
211
+ }, z.core.$strict>], "action">;
212
+ signingSupport: z.ZodLiteral<"HOST_GATES_REQUIRED">;
213
+ intentCommitment: z.ZodString;
214
+ calls: z.ZodArray<z.ZodObject<{
215
+ step: z.ZodEnum<{
216
+ mutation: "mutation";
217
+ "erc20-approve": "erc20-approve";
218
+ "erc20-cleanup": "erc20-cleanup";
219
+ "nft-approve": "nft-approve";
220
+ "nft-clear": "nft-clear";
221
+ }>;
222
+ tokenIndex: z.ZodNullable<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
223
+ chainId: z.ZodLiteral<8453>;
224
+ from: z.ZodString;
225
+ to: z.ZodString;
226
+ value: z.ZodLiteral<"0">;
227
+ data: z.ZodString;
228
+ }, z.core.$strict>>;
229
+ recoveryCalls: z.ZodArray<z.ZodObject<{
230
+ step: z.ZodEnum<{
231
+ mutation: "mutation";
232
+ "erc20-approve": "erc20-approve";
233
+ "erc20-cleanup": "erc20-cleanup";
234
+ "nft-approve": "nft-approve";
235
+ "nft-clear": "nft-clear";
236
+ }>;
237
+ tokenIndex: z.ZodNullable<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
238
+ chainId: z.ZodLiteral<8453>;
239
+ from: z.ZodString;
240
+ to: z.ZodString;
241
+ value: z.ZodLiteral<"0">;
242
+ data: z.ZodString;
243
+ }, z.core.$strict>>;
244
+ guardDeployment: z.ZodNullable<z.ZodObject<{
245
+ id: z.ZodLiteral<"base-weth-usdc-collect-v1">;
246
+ chainId: z.ZodLiteral<8453>;
247
+ address: z.ZodString;
248
+ runtimeCodeHash: z.ZodString;
249
+ configurationHash: z.ZodLiteral<`0x${string}`>;
250
+ codeVersion: z.ZodLiteral<"OttoV3CollectGuard-v1">;
251
+ deploymentBlock: z.ZodString;
252
+ reviewReference: z.ZodString;
253
+ }, z.core.$strict>>;
254
+ preparedBlock: z.ZodObject<{
255
+ number: z.ZodString;
256
+ hash: z.ZodString;
257
+ }, z.core.$strict>;
258
+ planCommitment: z.ZodString;
259
+ }, z.core.$strict>;
260
+ export type LpV3AtomicPlan = z.infer<typeof lpV3AtomicPlanSchema>;
261
+ export declare const LP_V3_ATOMIC_NPM_ABI: readonly [{
262
+ readonly name: "multicall";
263
+ readonly type: "function";
264
+ readonly stateMutability: "payable";
265
+ readonly inputs: readonly [{
266
+ readonly type: "bytes[]";
267
+ readonly name: "data";
268
+ }];
269
+ readonly outputs: readonly [{
270
+ readonly type: "bytes[]";
271
+ readonly name: "results";
272
+ }];
273
+ }, {
274
+ readonly name: "transferFrom";
275
+ readonly type: "function";
276
+ readonly stateMutability: "nonpayable";
277
+ readonly inputs: readonly [{
278
+ readonly type: "address";
279
+ readonly name: "from";
280
+ }, {
281
+ readonly type: "address";
282
+ readonly name: "to";
283
+ }, {
284
+ readonly type: "uint256";
285
+ readonly name: "tokenId";
286
+ }];
287
+ readonly outputs: readonly [];
288
+ }, {
289
+ readonly name: "approve";
290
+ readonly type: "function";
291
+ readonly stateMutability: "nonpayable";
292
+ readonly inputs: readonly [{
293
+ readonly type: "address";
294
+ readonly name: "to";
295
+ }, {
296
+ readonly type: "uint256";
297
+ readonly name: "tokenId";
298
+ }];
299
+ readonly outputs: readonly [];
300
+ }, {
301
+ readonly name: "getApproved";
302
+ readonly type: "function";
303
+ readonly stateMutability: "view";
304
+ readonly inputs: readonly [{
305
+ readonly type: "uint256";
306
+ readonly name: "tokenId";
307
+ }];
308
+ readonly outputs: readonly [{
309
+ readonly type: "address";
310
+ }];
311
+ }, {
312
+ readonly name: "isApprovedForAll";
313
+ readonly type: "function";
314
+ readonly stateMutability: "view";
315
+ readonly inputs: readonly [{
316
+ readonly type: "address";
317
+ readonly name: "owner";
318
+ }, {
319
+ readonly type: "address";
320
+ readonly name: "operator";
321
+ }];
322
+ readonly outputs: readonly [{
323
+ readonly type: "bool";
324
+ }];
325
+ }, {
326
+ readonly name: "Approval";
327
+ readonly type: "event";
328
+ readonly inputs: readonly [{
329
+ readonly type: "address";
330
+ readonly name: "owner";
331
+ readonly indexed: true;
332
+ }, {
333
+ readonly type: "address";
334
+ readonly name: "approved";
335
+ readonly indexed: true;
336
+ }, {
337
+ readonly type: "uint256";
338
+ readonly name: "tokenId";
339
+ readonly indexed: true;
340
+ }];
341
+ }, {
342
+ readonly name: "Transfer";
343
+ readonly type: "event";
344
+ readonly inputs: readonly [{
345
+ readonly type: "address";
346
+ readonly name: "from";
347
+ readonly indexed: true;
348
+ }, {
349
+ readonly type: "address";
350
+ readonly name: "to";
351
+ readonly indexed: true;
352
+ }, {
353
+ readonly type: "uint256";
354
+ readonly name: "tokenId";
355
+ readonly indexed: true;
356
+ }];
357
+ }];
358
+ export declare const LP_V3_COLLECT_GUARD_ABI: readonly [{
359
+ readonly name: "collect";
360
+ readonly type: "function";
361
+ readonly stateMutability: "nonpayable";
362
+ readonly inputs: readonly [{
363
+ readonly type: "tuple";
364
+ readonly components: readonly [{
365
+ readonly type: "address";
366
+ readonly name: "owner";
367
+ }, {
368
+ readonly type: "address";
369
+ readonly name: "pool";
370
+ }, {
371
+ readonly type: "uint256";
372
+ readonly name: "tokenId";
373
+ }, {
374
+ readonly type: "int24";
375
+ readonly name: "tickLower";
376
+ }, {
377
+ readonly type: "int24";
378
+ readonly name: "tickUpper";
379
+ }, {
380
+ readonly type: "uint128";
381
+ readonly name: "amount0Max";
382
+ }, {
383
+ readonly type: "uint128";
384
+ readonly name: "amount1Max";
385
+ }, {
386
+ readonly type: "uint256";
387
+ readonly name: "amount0Min";
388
+ }, {
389
+ readonly type: "uint256";
390
+ readonly name: "amount1Min";
391
+ }, {
392
+ readonly type: "uint256";
393
+ readonly name: "deadline";
394
+ }];
395
+ readonly name: "params";
396
+ }];
397
+ readonly outputs: readonly [{
398
+ readonly type: "uint256";
399
+ readonly name: "amount0";
400
+ }, {
401
+ readonly type: "uint256";
402
+ readonly name: "amount1";
403
+ }];
404
+ }, {
405
+ readonly name: "configurationHash";
406
+ readonly type: "function";
407
+ readonly stateMutability: "view";
408
+ readonly inputs: readonly [];
409
+ readonly outputs: readonly [{
410
+ readonly type: "bytes32";
411
+ }];
412
+ }, {
413
+ readonly name: "deploymentChainId";
414
+ readonly type: "function";
415
+ readonly stateMutability: "view";
416
+ readonly inputs: readonly [];
417
+ readonly outputs: readonly [{
418
+ readonly type: "uint256";
419
+ }];
420
+ }, {
421
+ readonly name: "Collected";
422
+ readonly type: "event";
423
+ readonly inputs: readonly [{
424
+ readonly type: "address";
425
+ readonly name: "owner";
426
+ readonly indexed: true;
427
+ }, {
428
+ readonly type: "address";
429
+ readonly name: "pool";
430
+ readonly indexed: true;
431
+ }, {
432
+ readonly type: "uint256";
433
+ readonly name: "tokenId";
434
+ readonly indexed: true;
435
+ }, {
436
+ readonly type: "uint256";
437
+ readonly name: "amount0";
438
+ }, {
439
+ readonly type: "uint256";
440
+ readonly name: "amount1";
441
+ }];
442
+ }];
443
+ export declare function legacyIntent(intent: LpV3AtomicIntent): LpV3Intent;
444
+ export declare function legacyEvidence(evidence: LpV3AtomicChainEvidence): LpV3ChainEvidence;
445
+ export declare function resolveCollectGuard(intent: LpV3AtomicIntent, policy: readonly LpV3GuardDeployment[]): LpV3GuardDeployment | null;
@@ -0,0 +1,90 @@
1
+ import { encodeAbiParameters, keccak256, parseAbi, parseAbiParameters } from 'viem';
2
+ import { z } from 'zod';
3
+ import { LP_V3_BASE as B, lpAddress, lpHash, lpUint, lpV3IntentSchema, lpV3ChainEvidenceSchema, lpV3PositionSchema, deepFreeze, } from './lp-v3-contract.js';
4
+ const zero = '0x0000000000000000000000000000000000000000';
5
+ export const LP_V3_COLLECT_GUARD_ID = 'base-weth-usdc-collect-v1';
6
+ export const LP_V3_COLLECT_CONFIGURATION_HASH = keccak256(encodeAbiParameters(parseAbiParameters('uint256,address,address,address,address,address,bytes32,bytes32,bytes32,bytes32,bytes32'), [8453n, B.manager, B.factory, B.token0, B.token1, B.usdcImplementation, B.factoryCodeHash, B.managerCodeHash, B.token0CodeHash, B.token1CodeHash, B.usdcImplementationCodeHash]));
7
+ export const lpV3GuardDeploymentSchema = z.object({
8
+ id: z.literal(LP_V3_COLLECT_GUARD_ID), chainId: z.literal(8453),
9
+ address: lpAddress.refine(v => ![B.manager, B.factory, B.token0, B.token1].some(a => a === v)),
10
+ runtimeCodeHash: lpHash, configurationHash: z.literal(LP_V3_COLLECT_CONFIGURATION_HASH),
11
+ codeVersion: z.literal('OttoV3CollectGuard-v1'),
12
+ deploymentBlock: lpUint(), reviewReference: z.string().min(16).max(200),
13
+ }).strict();
14
+ /** No guard is deployed/activated by this library. A host may supply a separately
15
+ * reviewed manifest at startup. Never deserialize this policy from an agent/API plan.
16
+ */
17
+ export const DEFAULT_LP_V3_COLLECT_GUARDS = Object.freeze([]);
18
+ export function reviewedGuardPolicy(input = DEFAULT_LP_V3_COLLECT_GUARDS) {
19
+ const policy = z.array(lpV3GuardDeploymentSchema).max(1).parse(input);
20
+ return deepFreeze(policy);
21
+ }
22
+ const approvalPolicy = z.literal('zero-before-and-after');
23
+ export const lpV3AtomicIntentSchema = z.discriminatedUnion('action', [
24
+ lpV3IntentSchema.options[1].extend({ schemaVersion: z.literal(2), nftApprovalPolicy: approvalPolicy }).strict(),
25
+ lpV3IntentSchema.options[3].extend({ schemaVersion: z.literal(2), nftApprovalPolicy: approvalPolicy, guardDeploymentId: z.literal(LP_V3_COLLECT_GUARD_ID) }).strict(),
26
+ ]);
27
+ export const lpV3AtomicPositionSchema = lpV3PositionSchema.extend({ approved: z.union([lpAddress, z.literal(zero)]) }).strict();
28
+ export const lpV3AtomicGuardEvidenceSchema = z.object({
29
+ address: lpAddress, runtimeCodeHash: lpHash, configurationHash: lpHash,
30
+ deploymentChainId: z.literal(8453), ownerApprovalForAll: z.literal(false),
31
+ guardBlacklisted: z.literal(false), poolBlacklisted: z.literal(false),
32
+ tokenAllowances: z.tuple([z.literal('0'), z.literal('0')]),
33
+ tokenBalances: z.tuple([lpUint(), lpUint()]),
34
+ }).strict();
35
+ export const lpV3AtomicChainEvidenceSchema = lpV3ChainEvidenceSchema.extend({
36
+ schemaVersion: z.literal(2), position: lpV3AtomicPositionSchema,
37
+ managerNativeBalance: lpUint(),
38
+ guard: lpV3AtomicGuardEvidenceSchema.nullable(),
39
+ }).strict();
40
+ export const lpV3AtomicCallSchema = z.object({
41
+ step: z.enum(['erc20-approve', 'mutation', 'erc20-cleanup', 'nft-approve', 'nft-clear']),
42
+ tokenIndex: z.union([z.literal(0), z.literal(1)]).nullable(),
43
+ chainId: z.literal(8453), from: lpAddress, to: lpAddress, value: z.literal('0'),
44
+ data: z.string().regex(/^0x[0-9a-f]+$/),
45
+ }).strict();
46
+ export const lpV3AtomicPlanSchema = z.object({
47
+ schemaVersion: z.literal(2), kind: z.literal('lp-v3-atomic'), intent: lpV3AtomicIntentSchema,
48
+ signingSupport: z.literal('HOST_GATES_REQUIRED'), intentCommitment: lpHash,
49
+ calls: z.array(lpV3AtomicCallSchema).min(2).max(5),
50
+ // Recovery is permission cleanup only, and belongs to the ORIGINAL durable claim.
51
+ // These are not an additional normal execution sequence or a retry authorization.
52
+ recoveryCalls: z.array(lpV3AtomicCallSchema).max(2),
53
+ guardDeployment: lpV3GuardDeploymentSchema.nullable(),
54
+ preparedBlock: z.object({ number: lpUint(), hash: lpHash }).strict(), planCommitment: lpHash,
55
+ }).strict();
56
+ export const LP_V3_ATOMIC_NPM_ABI = parseAbi([
57
+ 'function multicall(bytes[] data) payable returns (bytes[] results)',
58
+ 'function transferFrom(address from,address to,uint256 tokenId)',
59
+ 'function approve(address to,uint256 tokenId)',
60
+ 'function getApproved(uint256 tokenId) view returns (address)',
61
+ 'function isApprovedForAll(address owner,address operator) view returns (bool)',
62
+ 'event Approval(address indexed owner,address indexed approved,uint256 indexed tokenId)',
63
+ 'event Transfer(address indexed from,address indexed to,uint256 indexed tokenId)',
64
+ ]);
65
+ export const LP_V3_COLLECT_GUARD_ABI = parseAbi([
66
+ 'function collect((address owner,address pool,uint256 tokenId,int24 tickLower,int24 tickUpper,uint128 amount0Max,uint128 amount1Max,uint256 amount0Min,uint256 amount1Min,uint256 deadline) params) returns (uint256 amount0,uint256 amount1)',
67
+ 'function configurationHash() view returns (bytes32)',
68
+ 'function deploymentChainId() view returns (uint256)',
69
+ 'event Collected(address indexed owner,address indexed pool,uint256 indexed tokenId,uint256 amount0,uint256 amount1)',
70
+ ]);
71
+ export function legacyIntent(intent) {
72
+ const { nftApprovalPolicy: _, schemaVersion: __, ...body } = intent;
73
+ const raw = { ...body, schemaVersion: 1 };
74
+ delete raw.guardDeploymentId;
75
+ return lpV3IntentSchema.parse(raw);
76
+ }
77
+ export function legacyEvidence(evidence) {
78
+ const { guard: _, schemaVersion: __, position, managerNativeBalance: ____, ...body } = evidence;
79
+ const { approved: ___, ...p } = position;
80
+ return lpV3ChainEvidenceSchema.parse({ ...body, schemaVersion: 1, position: p });
81
+ }
82
+ export function resolveCollectGuard(intent, policy) {
83
+ if (intent.action === 'increase')
84
+ return null;
85
+ const deployment = policy.find(d => d.id === intent.guardDeploymentId);
86
+ if (!deployment)
87
+ throw new Error('LP_ATOMIC_COLLECT_GUARD_NOT_DEPLOYED');
88
+ return deployment;
89
+ }
90
+ //# sourceMappingURL=lp-v3-atomic-contract.js.map
@@ -0,0 +1,14 @@
1
+ import { type LpV3EvidenceOptions, type LpV3ReadRequest } from './lp-v3-evidence.js';
2
+ import { type LpV3AtomicIntent, type LpV3AtomicChainEvidence, type LpV3GuardDeployment } from './lp-v3-atomic-contract.js';
3
+ export interface LpV3AtomicReadClient {
4
+ request(request: Omit<LpV3ReadRequest, 'method'> & {
5
+ method: LpV3ReadRequest['method'] | 'eth_getBalance';
6
+ }): Promise<unknown>;
7
+ }
8
+ export interface LpV3AtomicEvidenceOptions extends Omit<LpV3EvidenceOptions, 'client'> {
9
+ client?: LpV3AtomicReadClient;
10
+ }
11
+ /** The policy comes from the enclosing library's frozen host configuration.
12
+ * No additional token/NFT/guard read is allowed to escape the base evidence hash.
13
+ */
14
+ export declare function collectLpV3AtomicEvidence(input: LpV3AtomicIntent, policy: readonly LpV3GuardDeployment[], options?: LpV3AtomicEvidenceOptions): Promise<LpV3AtomicChainEvidence>;
@@ -0,0 +1,82 @@
1
+ import { createPublicClient, decodeFunctionResult, encodeFunctionData, http, keccak256, parseAbi } from 'viem';
2
+ import { base } from 'viem/chains';
3
+ import { LP_V3_BASE as B } from './lp-v3-contract.js';
4
+ import { collectLpV3ChainEvidence } from './lp-v3-evidence.js';
5
+ import { legacyIntent, lpV3AtomicIntentSchema, lpV3AtomicChainEvidenceSchema, lpV3AtomicGuardEvidenceSchema, resolveCollectGuard, } from './lp-v3-atomic-contract.js';
6
+ const ABI = parseAbi([
7
+ 'function positions(uint256 tokenId) view returns (uint96 nonce,address operator,address token0,address token1,uint24 fee,int24 tickLower,int24 tickUpper,uint128 liquidity,uint256 feeGrowthInside0LastX128,uint256 feeGrowthInside1LastX128,uint128 tokensOwed0,uint128 tokensOwed1)',
8
+ 'function configurationHash() view returns (bytes32)', 'function deploymentChainId() view returns (uint256)',
9
+ 'function isApprovedForAll(address owner,address operator) view returns (bool)',
10
+ 'function isBlacklisted(address account) view returns (bool)',
11
+ 'function balanceOf(address account) view returns (uint256)',
12
+ 'function allowance(address owner,address spender) view returns (uint256)',
13
+ ]);
14
+ const validHex = (v) => typeof v === 'string' && /^0x(?:[0-9a-fA-F]{2})*$/.test(v);
15
+ /** The policy comes from the enclosing library's frozen host configuration.
16
+ * No additional token/NFT/guard read is allowed to escape the base evidence hash.
17
+ */
18
+ export async function collectLpV3AtomicEvidence(input, policy, options = {}) {
19
+ try {
20
+ const intent = lpV3AtomicIntentSchema.parse(input), deployment = resolveCollectGuard(intent, policy);
21
+ const original = options.client ?? createPublicClient({ chain: base, transport: http('https://mainnet.base.org', { timeout: 15_000, retryCount: 1 }) });
22
+ const positionCall = encodeFunctionData({ abi: ABI, functionName: 'positions', args: [BigInt(intent.tokenId)] });
23
+ let approved;
24
+ let queue = Promise.resolve();
25
+ const client = { request(request) {
26
+ const next = queue.then(async () => {
27
+ const result = await original.request(request);
28
+ const call = request.params?.[0];
29
+ if (request.method === 'eth_call' && call?.to === B.manager && call.data === positionCall) {
30
+ if (!validHex(result))
31
+ throw new Error('LP_ATOMIC_NFT_APPROVAL_UNAVAILABLE');
32
+ approved = decodeFunctionResult({ abi: ABI, functionName: 'positions', data: result })[1].toLowerCase();
33
+ }
34
+ return result;
35
+ });
36
+ queue = next.then(() => undefined, () => undefined);
37
+ return next;
38
+ } };
39
+ const evidence = await collectLpV3ChainEvidence(legacyIntent(intent), { ...options, client });
40
+ if (!evidence.position || approved === undefined)
41
+ throw new Error('LP_ATOMIC_NFT_APPROVAL_UNAVAILABLE');
42
+ const reference = { blockHash: evidence.blockHash, requireCanonical: true };
43
+ const managerNative = await client.request({ method: 'eth_getBalance', params: [B.manager, reference] });
44
+ if (typeof managerNative !== 'string' || !/^0x(?:0|[1-9a-fA-F][0-9a-fA-F]*)$/.test(managerNative))
45
+ throw new Error('LP_ATOMIC_NATIVE_BALANCE_UNAVAILABLE');
46
+ const managerNativeBalance = BigInt(managerNative).toString();
47
+ const read = async (target, functionName, args) => {
48
+ const data = encodeFunctionData({ abi: ABI, functionName, args });
49
+ const result = await client.request({ method: 'eth_call', params: [{ to: target, data }, reference] });
50
+ if (!validHex(result))
51
+ throw new Error('LP_ATOMIC_GUARD_STATE_UNAVAILABLE');
52
+ return decodeFunctionResult({ abi: ABI, functionName, data: result });
53
+ };
54
+ let guard = null;
55
+ if (deployment) {
56
+ const [code, configurationHash, deploymentChainId, ownerApprovalForAll, tokenAllowances, tokenBalances, guardBlacklisted, poolBlacklisted] = await Promise.all([
57
+ client.request({ method: 'eth_getCode', params: [deployment.address, reference] }),
58
+ read(deployment.address, 'configurationHash'), read(deployment.address, 'deploymentChainId'),
59
+ read(B.manager, 'isApprovedForAll', [intent.account, deployment.address]),
60
+ Promise.all([B.token0, B.token1].map(token => read(token, 'allowance', [deployment.address, B.manager]))),
61
+ Promise.all([B.token0, B.token1].map(token => read(token, 'balanceOf', [deployment.address]))),
62
+ read(B.token1, 'isBlacklisted', [deployment.address]), read(B.token1, 'isBlacklisted', [intent.pool]),
63
+ ]);
64
+ if (!validHex(code) || code === '0x' || typeof deploymentChainId !== 'bigint' || deploymentChainId !== 8453n || keccak256(code) !== deployment.runtimeCodeHash || configurationHash !== deployment.configurationHash)
65
+ throw new Error('LP_ATOMIC_GUARD_PIN_MISMATCH');
66
+ guard = lpV3AtomicGuardEvidenceSchema.parse({ address: deployment.address, runtimeCodeHash: keccak256(code), configurationHash, deploymentChainId: 8453, ownerApprovalForAll, tokenAllowances: tokenAllowances.map(String), tokenBalances: tokenBalances.map(String), guardBlacklisted, poolBlacklisted });
67
+ }
68
+ const anchor = await client.request({ method: 'eth_getBlockByNumber', params: [`0x${BigInt(evidence.blockNumber).toString(16)}`, false] });
69
+ const chain = await client.request({ method: 'eth_chainId' });
70
+ if (!anchor || anchor.hash !== evidence.blockHash || typeof anchor.number !== 'string' || BigInt(anchor.number) !== BigInt(evidence.blockNumber) || typeof anchor.timestamp !== 'string' || BigInt(anchor.timestamp) !== BigInt(evidence.blockTimestamp) || typeof chain !== 'string' || BigInt(chain) !== 8453n)
71
+ throw new Error('LP_ATOMIC_BLOCK_REORG');
72
+ const observedAt = (options.nowSeconds ?? (() => Math.floor(Date.now() / 1000)))();
73
+ if (!Number.isSafeInteger(observedAt) || observedAt < evidence.observedAt || evidence.blockTimestamp > observedAt || observedAt - evidence.blockTimestamp > (options.maxBlockAgeSeconds ?? 60))
74
+ throw new Error('LP_ATOMIC_STALE_EVIDENCE');
75
+ return lpV3AtomicChainEvidenceSchema.parse({ ...evidence, schemaVersion: 2, observedAt, position: { ...evidence.position, approved }, managerNativeBalance, guard });
76
+ }
77
+ catch {
78
+ // The RPC adapter may contain endpoint credentials; expose a bounded error only.
79
+ throw new Error('LP_ATOMIC_REQUIRED_CHAIN_STATE_UNAVAILABLE');
80
+ }
81
+ }
82
+ //# sourceMappingURL=lp-v3-atomic-evidence.js.map