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,411 @@
1
+ /**
2
+ * One hybrid decision/prepare contract. A routed funding leg is never described
3
+ * as a completed yield position, and a gated native choice never silently falls
4
+ * back to a more expensive routed share purchase.
5
+ */
6
+ import { z } from 'zod';
7
+ import { type ExecutionToolRuntime } from './execution-tools.js';
8
+ import { type NativeYieldRuntime } from './native-yield.js';
9
+ export declare const PREPARE_HYBRID_YIELD_INPUT_SCHEMA: z.ZodObject<{
10
+ accountProfile: z.ZodObject<{
11
+ kind: z.ZodLiteral<"eoa">;
12
+ address: z.ZodString;
13
+ chainId: z.ZodUnion<readonly [z.ZodLiteral<8453>, z.ZodLiteral<42161>]>;
14
+ }, z.core.$strict>;
15
+ marketId: z.ZodString;
16
+ registryCommitment: z.ZodString;
17
+ action: z.ZodEnum<{
18
+ deposit: "deposit";
19
+ withdraw: "withdraw";
20
+ }>;
21
+ amount: z.ZodString;
22
+ sourceToken: z.ZodString;
23
+ transport: z.ZodDefault<z.ZodEnum<{
24
+ auto: "auto";
25
+ lifi: "lifi";
26
+ native: "native";
27
+ }>>;
28
+ slippage: z.ZodObject<{
29
+ maxBps: z.ZodNumber;
30
+ minOutput: z.ZodOptional<z.ZodString>;
31
+ }, z.core.$strict>;
32
+ fundingMinimumOutput: z.ZodOptional<z.ZodString>;
33
+ clientRef: z.ZodOptional<z.ZodString>;
34
+ }, z.core.$strict>;
35
+ export type PrepareHybridYieldInput = z.infer<typeof PREPARE_HYBRID_YIELD_INPUT_SCHEMA>;
36
+ export interface HybridYieldRuntime {
37
+ readonly lifi: ExecutionToolRuntime;
38
+ readonly native: NativeYieldRuntime;
39
+ }
40
+ export declare function selectHybridYieldTransport(rawInput: unknown): {
41
+ input: {
42
+ accountProfile: {
43
+ kind: "eoa";
44
+ address: string;
45
+ chainId: 8453 | 42161;
46
+ };
47
+ marketId: string;
48
+ registryCommitment: string;
49
+ action: "deposit" | "withdraw";
50
+ amount: string;
51
+ sourceToken: string;
52
+ transport: "auto" | "lifi" | "native";
53
+ slippage: {
54
+ maxBps: number;
55
+ minOutput?: string | undefined;
56
+ };
57
+ fundingMinimumOutput?: string | undefined;
58
+ clientRef?: string | undefined;
59
+ };
60
+ market: import("./hybrid-yield-markets.js").HybridYieldMarket;
61
+ source: `0x${string}`;
62
+ transport: "lifi" | "native";
63
+ stage: string;
64
+ };
65
+ export declare function prepareHybridYield(runtime: HybridYieldRuntime, rawInput: unknown, signal?: AbortSignal): Promise<{
66
+ stage: string;
67
+ binding: {
68
+ marketId: string;
69
+ registryCommitment: string;
70
+ requestCommitment: `sha256:${string}`;
71
+ owner: `0x${string}`;
72
+ positionChainId: import("./hybrid-yield-markets.js").HybridYieldChainId;
73
+ positionToken: `0x${string}`;
74
+ };
75
+ plan: {
76
+ schemaVersion: "1";
77
+ kind: "native-yield-plan";
78
+ transport: "native-protocol";
79
+ marketId: string;
80
+ registryCommitment: string;
81
+ owner: string;
82
+ chainId: 8453 | 42161;
83
+ action: "deposit" | "withdraw";
84
+ amount: string;
85
+ inputToken: string;
86
+ outputToken: string;
87
+ expectedOutput: string;
88
+ minimumOutput: string;
89
+ protocolOutput: string;
90
+ fee: {
91
+ bps: 10;
92
+ recipient: string;
93
+ token: string;
94
+ amount: string;
95
+ version: "native-yield-10bps-floor-v1";
96
+ rounding: "floor";
97
+ };
98
+ nonce: string;
99
+ deadline: number;
100
+ preparedAtMs: number;
101
+ snapshot: {
102
+ blockNumber: string;
103
+ blockHash: string;
104
+ observedAtMs: number;
105
+ };
106
+ deployment: {
107
+ chainId: 8453 | 42161;
108
+ address: string;
109
+ runtimeCodeHash: string;
110
+ version: "native-yield-router-v1";
111
+ reviewId: string;
112
+ };
113
+ steps: {
114
+ kind: "approve" | "approve_reset" | "call";
115
+ to: string;
116
+ value: "0";
117
+ data: string;
118
+ }[];
119
+ authorization: "requires-separate-account-authority";
120
+ allowanceRecovery: "approval-is-separate-and-may-remain-after-failure";
121
+ intentCommitment: string;
122
+ planCommitment: string;
123
+ };
124
+ completionRequirement: "canonical-protocol-event-and-owner-receipt";
125
+ } | {
126
+ stage: string;
127
+ binding: {
128
+ marketId: string;
129
+ registryCommitment: string;
130
+ requestCommitment: `sha256:${string}`;
131
+ owner: `0x${string}`;
132
+ positionChainId: import("./hybrid-yield-markets.js").HybridYieldChainId;
133
+ positionToken: `0x${string}`;
134
+ };
135
+ prepared: {
136
+ envelope: {
137
+ schema_version: "1";
138
+ artifact_id: string;
139
+ rail: "lifi";
140
+ operation: "swap";
141
+ intent_digest: string;
142
+ account_binding: {
143
+ kind: "eoa" | "safe";
144
+ address: string;
145
+ chainId: number;
146
+ protocol_roles: {
147
+ lifi: {
148
+ sender: string;
149
+ receiver: string;
150
+ };
151
+ };
152
+ };
153
+ required_capabilities: ("send_evm_transaction" | "submit_evm_batch")[];
154
+ payload: {
155
+ kind: "evm_execution_plan";
156
+ chain_id: number;
157
+ steps: {
158
+ to: string;
159
+ value: string;
160
+ data: string;
161
+ kind: "approve" | "approve_reset" | "call";
162
+ }[];
163
+ };
164
+ fee_attribution: {
165
+ mechanism: "lifi_integrator_fee";
166
+ config_version: string;
167
+ };
168
+ replay_disclosure: {
169
+ artifact_role: "construction_aid";
170
+ freshness_boundary: "valid_until";
171
+ onchain_replay_boundary: "signer_account_nonce";
172
+ tool_guarantees_single_execution: false;
173
+ };
174
+ assertions: {
175
+ id: string;
176
+ result: "passed";
177
+ }[];
178
+ valid_until: string;
179
+ submission: {
180
+ method: "send_evm_transaction" | "submit_evm_batch";
181
+ chain_id: number;
182
+ artifact_id: string;
183
+ payload_digest: string;
184
+ artifact_digest: string;
185
+ adapter_owned_fields: ["nonce", "gas", "serialization"];
186
+ client_ref?: string | undefined;
187
+ };
188
+ };
189
+ prepareInput: {
190
+ accountProfile: {
191
+ kind: "eoa" | "safe";
192
+ address: string;
193
+ chainId: number;
194
+ };
195
+ chainId: number;
196
+ fromToken: string;
197
+ toToken: string;
198
+ fromAmount: string;
199
+ slippage: {
200
+ maxBps: number;
201
+ minAmountOut?: string | undefined;
202
+ };
203
+ client_ref?: string | undefined;
204
+ };
205
+ preview: {
206
+ market_id: string;
207
+ venue: string;
208
+ protocol: "MORPHO";
209
+ chain_id: 8453;
210
+ vault: string;
211
+ asset: string;
212
+ shares: string;
213
+ expected_assets: string;
214
+ min_assets: string;
215
+ preview_redeem_assets: string;
216
+ parity_shortfall_bps: number;
217
+ parity_tolerance_bps: 30;
218
+ quoted_fees: {
219
+ name: string;
220
+ amount_usd: string;
221
+ }[];
222
+ route_semantics: {
223
+ transport: "lifi";
224
+ action: "deposit" | "withdraw";
225
+ classification: "share-purchase" | "share-sale" | "protocol-composition" | "mixed" | "unclassified";
226
+ evidence: "provider-quote-steps";
227
+ protocol_action_verified: false;
228
+ tools: string[];
229
+ };
230
+ quoted_gas_usd?: string | undefined;
231
+ };
232
+ registry_commitment: string;
233
+ } | {
234
+ envelope: {
235
+ schema_version: "1";
236
+ artifact_id: string;
237
+ rail: "lifi";
238
+ operation: "swap";
239
+ intent_digest: string;
240
+ account_binding: {
241
+ kind: "eoa" | "safe";
242
+ address: string;
243
+ chainId: number;
244
+ protocol_roles: {
245
+ lifi: {
246
+ sender: string;
247
+ receiver: string;
248
+ };
249
+ };
250
+ };
251
+ required_capabilities: ("send_evm_transaction" | "submit_evm_batch")[];
252
+ payload: {
253
+ kind: "evm_execution_plan";
254
+ chain_id: number;
255
+ steps: {
256
+ to: string;
257
+ value: string;
258
+ data: string;
259
+ kind: "approve" | "approve_reset" | "call";
260
+ }[];
261
+ };
262
+ fee_attribution: {
263
+ mechanism: "lifi_integrator_fee";
264
+ config_version: string;
265
+ };
266
+ replay_disclosure: {
267
+ artifact_role: "construction_aid";
268
+ freshness_boundary: "valid_until";
269
+ onchain_replay_boundary: "signer_account_nonce";
270
+ tool_guarantees_single_execution: false;
271
+ };
272
+ assertions: {
273
+ id: string;
274
+ result: "passed";
275
+ }[];
276
+ valid_until: string;
277
+ submission: {
278
+ method: "send_evm_transaction" | "submit_evm_batch";
279
+ chain_id: number;
280
+ artifact_id: string;
281
+ payload_digest: string;
282
+ artifact_digest: string;
283
+ adapter_owned_fields: ["nonce", "gas", "serialization"];
284
+ client_ref?: string | undefined;
285
+ };
286
+ };
287
+ prepareInput: {
288
+ accountProfile: {
289
+ kind: "eoa" | "safe";
290
+ address: string;
291
+ chainId: number;
292
+ };
293
+ chainId: number;
294
+ fromToken: string;
295
+ toToken: string;
296
+ fromAmount: string;
297
+ slippage: {
298
+ maxBps: number;
299
+ minAmountOut?: string | undefined;
300
+ };
301
+ client_ref?: string | undefined;
302
+ };
303
+ preview: {
304
+ market_id: string;
305
+ venue: string;
306
+ protocol: "MORPHO";
307
+ chain_id: 8453;
308
+ vault: string;
309
+ asset: string;
310
+ amount: string;
311
+ expected_shares: string;
312
+ min_shares: string;
313
+ preview_deposit_shares: string;
314
+ parity_shortfall_bps: number;
315
+ parity_tolerance_bps: 30;
316
+ quoted_fees: {
317
+ name: string;
318
+ amount_usd: string;
319
+ }[];
320
+ route_semantics: {
321
+ transport: "lifi";
322
+ action: "deposit" | "withdraw";
323
+ classification: "share-purchase" | "share-sale" | "protocol-composition" | "mixed" | "unclassified";
324
+ evidence: "provider-quote-steps";
325
+ protocol_action_verified: false;
326
+ tools: string[];
327
+ };
328
+ quoted_gas_usd?: string | undefined;
329
+ };
330
+ registry_commitment: string;
331
+ };
332
+ completionRequirement: "canonical-owner-token-receipt-protocol-action-unproven-until-verified";
333
+ } | {
334
+ stage: string;
335
+ binding: {
336
+ marketId: string;
337
+ registryCommitment: string;
338
+ requestCommitment: `sha256:${string}`;
339
+ owner: `0x${string}`;
340
+ positionChainId: import("./hybrid-yield-markets.js").HybridYieldChainId;
341
+ positionToken: `0x${string}`;
342
+ };
343
+ prepareInput: {
344
+ accountProfile: {
345
+ kind: "eoa" | "safe";
346
+ address: string;
347
+ chainId: number;
348
+ };
349
+ chainId: number;
350
+ fromToken: string;
351
+ toToken: string;
352
+ fromAmount: string;
353
+ slippage: {
354
+ maxBps: number;
355
+ minAmountOut?: string | undefined;
356
+ };
357
+ client_ref?: string | undefined;
358
+ };
359
+ envelope: import("./execution-types.js").ExecutionEnvelope;
360
+ continuation: {
361
+ action: "prepare-new-native-deposit-after-settlement";
362
+ automatic: false;
363
+ marketId: string;
364
+ registryCommitment: string;
365
+ chainId: import("./hybrid-yield-markets.js").HybridYieldChainId;
366
+ asset: `0x${string}`;
367
+ owner: `0x${string}`;
368
+ };
369
+ completionRequirement: "underlying-receipt-only-not-yield-allocation";
370
+ } | {
371
+ stage: string;
372
+ binding: {
373
+ marketId: string;
374
+ registryCommitment: string;
375
+ requestCommitment: `sha256:${string}`;
376
+ owner: `0x${string}`;
377
+ positionChainId: import("./hybrid-yield-markets.js").HybridYieldChainId;
378
+ positionToken: `0x${string}`;
379
+ };
380
+ prepareInput: {
381
+ accountProfile: {
382
+ kind: "eoa" | "safe";
383
+ address: string;
384
+ chainId: number;
385
+ };
386
+ fromChainId: number;
387
+ toChainId: number;
388
+ fromToken: string;
389
+ toToken: string;
390
+ fromAmount: string;
391
+ slippage: {
392
+ maxBps: number;
393
+ minAmountOut?: string | undefined;
394
+ };
395
+ destinationRecipient?: string | undefined;
396
+ client_ref?: string | undefined;
397
+ };
398
+ envelope: import("./execution-types.js").BridgeExecutionEnvelope;
399
+ continuation: {
400
+ action: "prepare-new-native-deposit-after-settlement";
401
+ automatic: false;
402
+ marketId: string;
403
+ registryCommitment: string;
404
+ chainId: import("./hybrid-yield-markets.js").HybridYieldChainId;
405
+ asset: `0x${string}`;
406
+ owner: `0x${string}`;
407
+ };
408
+ completionRequirement: "completed-bridge-and-actual-underlying-receipt-not-yield-allocation";
409
+ }>;
410
+ /** LI.FI status labels alone never establish an earning position or actual amount. */
411
+ export declare function hybridFundingOutcome(status: string, substatus: string | undefined): "needs-attention" | "verify-destination-underlying" | "funds-on-destination-needs-attention" | "verify-refund-no-allocation" | "pending-or-unknown-do-not-resubmit";
@@ -0,0 +1,155 @@
1
+ /**
2
+ * One hybrid decision/prepare contract. A routed funding leg is never described
3
+ * as a completed yield position, and a gated native choice never silently falls
4
+ * back to a more expensive routed share purchase.
5
+ */
6
+ import { z } from 'zod';
7
+ import { getAddress } from 'viem';
8
+ import { HYBRID_YIELD_MARKETS, freezeHybridValue, getHybridYieldMarket, hybridYieldCommitment } from './hybrid-yield-markets.js';
9
+ import { PREPARE_BRIDGE_INPUT_SCHEMA, PREPARE_SWAP_INPUT_SCHEMA } from './execution-tool-definitions.js';
10
+ import { prepareBridge, prepareSwapFromQuote, quoteSwap } from './execution-tools.js';
11
+ import { prepareYieldDeposit } from './yield-deposit.js';
12
+ import { prepareYieldWithdraw } from './yield-withdraw.js';
13
+ import { prepareNativeYield } from './native-yield.js';
14
+ import { refuseNative } from './native-yield-definition.js';
15
+ const positive = z.string().regex(/^[1-9]\d*$/).refine((v) => BigInt(v) < (1n << 256n));
16
+ export const PREPARE_HYBRID_YIELD_INPUT_SCHEMA = z.object({
17
+ accountProfile: z.object({
18
+ kind: z.literal('eoa'), address: z.string().regex(/^0x[0-9a-fA-F]{40}$/),
19
+ chainId: z.union([z.literal(8453), z.literal(42161)]),
20
+ }).strict(),
21
+ marketId: z.string().min(1).max(120),
22
+ registryCommitment: z.string().regex(/^sha256:[0-9a-f]{64}$/),
23
+ action: z.enum(['deposit', 'withdraw']),
24
+ amount: positive,
25
+ sourceToken: z.string().regex(/^0x[0-9a-fA-F]{40}$/),
26
+ transport: z.enum(['auto', 'native', 'lifi']).default('auto'),
27
+ slippage: z.object({ maxBps: z.number().int().min(1).max(100), minOutput: positive.optional() }).strict(),
28
+ /** Underlying units at destination, only for a separate swap/bridge funding leg. */
29
+ fundingMinimumOutput: positive.optional(),
30
+ clientRef: z.string().trim().min(1).max(128).optional(),
31
+ }).strict();
32
+ export function selectHybridYieldTransport(rawInput) {
33
+ const input = PREPARE_HYBRID_YIELD_INPUT_SCHEMA.parse(rawInput);
34
+ const market = getHybridYieldMarket(input.marketId);
35
+ if (!market || hybridYieldCommitment(market) !== input.registryCommitment) {
36
+ return refuseNative('HYBRID_MARKET_MISMATCH', 'Re-read the exact current hybrid market');
37
+ }
38
+ const source = getAddress(input.sourceToken);
39
+ const sameChain = input.accountProfile.chainId === market.chainId;
40
+ if (input.action === 'withdraw') {
41
+ if (!sameChain || source !== market.position.tokenAddress) {
42
+ return refuseNative('HYBRID_EXIT_BINDING', 'Exit the exact position token on its owning chain');
43
+ }
44
+ }
45
+ else {
46
+ if (market.curation.status === 'legacy-exit-only') {
47
+ return refuseNative('HYBRID_LEGACY_DEPOSIT', 'This legacy vault is retained for exit; select a current candidate for new allocation');
48
+ }
49
+ if (!HYBRID_YIELD_MARKETS.some((m) => m.chainId === input.accountProfile.chainId && m.asset.address === source)) {
50
+ return refuseNative('HYBRID_SOURCE_UNSUPPORTED', 'Source must be exact reviewed USDC or WETH on Base or Arbitrum');
51
+ }
52
+ }
53
+ const exactAsset = sameChain && source === market.asset.address;
54
+ const nativeEligible = input.action === 'withdraw' || exactAsset;
55
+ if (input.transport === 'native' && !nativeEligible) {
56
+ return refuseNative('HYBRID_NATIVE_REQUIRES_EXACT_ASSET', 'Swap or bridge into the exact deposit asset first');
57
+ }
58
+ const transport = input.transport === 'auto' ? (nativeEligible ? 'native' : 'lifi') : input.transport;
59
+ const stage = transport === 'native' ? 'native-position'
60
+ : market.legacyRegistryCommitment && sameChain && (input.action === 'withdraw' || exactAsset)
61
+ ? 'routed-position' : 'routed-funding';
62
+ if (stage === 'routed-funding' && (input.action !== 'deposit' || exactAsset)) {
63
+ return refuseNative('HYBRID_ROUTE_UNAVAILABLE', 'No reviewed LI.FI position route exists for this market; use its native capability after activation');
64
+ }
65
+ return freezeHybridValue({ input, market, source, transport, stage });
66
+ }
67
+ export async function prepareHybridYield(runtime, rawInput, signal) {
68
+ const selected = selectHybridYieldTransport(rawInput);
69
+ const { input, market, source, stage } = selected;
70
+ const binding = {
71
+ marketId: market.id, registryCommitment: input.registryCommitment,
72
+ requestCommitment: hybridYieldCommitment(input), owner: getAddress(input.accountProfile.address),
73
+ positionChainId: market.chainId, positionToken: market.position.tokenAddress,
74
+ };
75
+ if (stage === 'native-position') {
76
+ const plan = await prepareNativeYield(runtime.native, {
77
+ accountProfile: input.accountProfile, marketId: input.marketId,
78
+ registryCommitment: input.registryCommitment, action: input.action, amount: input.amount,
79
+ slippage: input.slippage, ...(input.clientRef ? { clientRef: input.clientRef } : {}),
80
+ });
81
+ return freezeHybridValue({
82
+ stage, binding, plan,
83
+ completionRequirement: 'canonical-protocol-event-and-owner-receipt',
84
+ });
85
+ }
86
+ if (stage === 'routed-position') {
87
+ const shared = {
88
+ accountProfile: input.accountProfile, executableMarketId: market.id,
89
+ registryCommitment: market.legacyRegistryCommitment,
90
+ slippage: { maxBps: input.slippage.maxBps },
91
+ ...(input.clientRef ? { client_ref: input.clientRef } : {}),
92
+ };
93
+ const prepared = input.action === 'deposit'
94
+ ? await prepareYieldDeposit(runtime.lifi, { ...shared, amount: input.amount }, signal)
95
+ : await prepareYieldWithdraw(runtime.lifi, { ...shared, shares: input.amount }, signal);
96
+ const quotedFloor = BigInt(prepared.prepareInput.slippage.minAmountOut);
97
+ if (input.slippage.minOutput && quotedFloor < BigInt(input.slippage.minOutput)) {
98
+ return refuseNative('HYBRID_MINIMUM_INVALID', 'Route minimum is below the reviewed position/exit floor');
99
+ }
100
+ return freezeHybridValue({
101
+ stage, binding, prepared,
102
+ completionRequirement: 'canonical-owner-token-receipt-protocol-action-unproven-until-verified',
103
+ });
104
+ }
105
+ // The existing bridge verifier explicitly forbids destination calls. Preserve it:
106
+ // fund the exact underlying, settle, then request a fresh native deposit review.
107
+ if (!input.fundingMinimumOutput) {
108
+ return refuseNative('HYBRID_FUNDING_FLOOR_REQUIRED', 'Review a separate minimum in destination underlying units for this funding leg');
109
+ }
110
+ const continuation = {
111
+ action: 'prepare-new-native-deposit-after-settlement',
112
+ automatic: false, marketId: market.id, registryCommitment: input.registryCommitment,
113
+ chainId: market.chainId, asset: market.asset.address, owner: binding.owner,
114
+ };
115
+ const common = {
116
+ accountProfile: input.accountProfile, fromToken: source, toToken: market.asset.address,
117
+ fromAmount: input.amount,
118
+ slippage: { maxBps: input.slippage.maxBps, minAmountOut: input.fundingMinimumOutput },
119
+ ...(input.clientRef ? { client_ref: input.clientRef } : {}),
120
+ };
121
+ if (input.accountProfile.chainId === market.chainId) {
122
+ const prepareInput = PREPARE_SWAP_INPUT_SCHEMA.parse({ ...common, chainId: market.chainId });
123
+ const quote = await quoteSwap(runtime.lifi, prepareInput, signal);
124
+ const envelope = prepareSwapFromQuote(runtime.lifi, prepareInput, quote);
125
+ return freezeHybridValue({
126
+ stage, binding, prepareInput, envelope, continuation,
127
+ completionRequirement: 'underlying-receipt-only-not-yield-allocation',
128
+ });
129
+ }
130
+ if (market.asset.symbol !== 'USDC') {
131
+ return refuseNative('HYBRID_CROSS_CHAIN_ASSET_UNSUPPORTED', 'Existing reviewed bridge is native-USDC only; cross-chain WETH is not enabled');
132
+ }
133
+ const prepareInput = PREPARE_BRIDGE_INPUT_SCHEMA.parse({
134
+ ...common, fromChainId: input.accountProfile.chainId, toChainId: market.chainId,
135
+ destinationRecipient: binding.owner,
136
+ });
137
+ const envelope = await prepareBridge(runtime.lifi, prepareInput, signal);
138
+ return freezeHybridValue({
139
+ stage, binding, prepareInput, envelope, continuation,
140
+ completionRequirement: 'completed-bridge-and-actual-underlying-receipt-not-yield-allocation',
141
+ });
142
+ }
143
+ /** LI.FI status labels alone never establish an earning position or actual amount. */
144
+ export function hybridFundingOutcome(status, substatus) {
145
+ if (status === 'DONE' && substatus === 'COMPLETED')
146
+ return 'verify-destination-underlying';
147
+ if (status === 'DONE' && substatus === 'PARTIAL')
148
+ return 'funds-on-destination-needs-attention';
149
+ if (status === 'DONE' && substatus === 'REFUNDED')
150
+ return 'verify-refund-no-allocation';
151
+ if (status === 'FAILED')
152
+ return 'needs-attention';
153
+ return 'pending-or-unknown-do-not-resubmit';
154
+ }
155
+ //# sourceMappingURL=hybrid-yield.js.map
@@ -27,6 +27,10 @@ const HYPERLIQUID_ORDER_PARAMETERS = v.omit(v.object(OrderRequest.entries.action
27
27
  * action layer: whatever this function returns contains only fields the venue itself declares.
28
28
  */
29
29
  export function buildUnsignedHyperliquidOrderAction(request) {
30
+ // A direct SDK import must not bypass the retired high-level constructor.
31
+ if (request.legs.some((leg) => leg.reduceOnly !== true)) {
32
+ return refuse('HYPERLIQUID_RETIRED', 'New Hyperliquid trading is retired; every recovery order leg must be reduce-only');
33
+ }
30
34
  if (request.legs.length === 0) {
31
35
  return refuse('HYPERLIQUID_ORDER_INVALID', 'Hyperliquid action must carry at least one order leg');
32
36
  }
@@ -39,6 +39,12 @@ export interface SameChainSwapQuoteRequest {
39
39
  readonly sender: string;
40
40
  readonly receiver: string;
41
41
  readonly maxSlippageBps: number;
42
+ /**
43
+ * LI.FI exchange tools the quote must NOT route through. Set by the constructor when a tool's
44
+ * calldata failed the prepare-time simulation (2026-09-03: KyberSwap reverted from the diamond while
45
+ * SushiSwap executed); never a caller seam.
46
+ */
47
+ readonly denyExchanges?: readonly string[];
42
48
  }
43
49
  export interface CrossChainBridgeQuoteRequest {
44
50
  readonly fromChainId: number;
@@ -65,6 +65,9 @@ export function buildLiFiQuoteUrl(request, config) {
65
65
  ];
66
66
  for (const [name, value] of semanticFields)
67
67
  url.searchParams.append(name, value);
68
+ if (request.denyExchanges && request.denyExchanges.length > 0) {
69
+ url.searchParams.append('denyExchanges', request.denyExchanges.join(','));
70
+ }
68
71
  url.searchParams.append('integrator', LIFI_INTEGRATOR);
69
72
  url.searchParams.append('fee', config.lifiFee.decimal);
70
73
  return url;