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.
- package/README.md +76 -18
- package/dist/account-userop-policy-definition.d.ts +14 -0
- package/dist/account-userop-policy-definition.js +12 -0
- package/dist/account-userop-policy-relation.d.ts +371 -0
- package/dist/account-userop-policy-relation.js +87 -0
- package/dist/adapter/cdp-signer.d.ts +76 -9
- package/dist/adapter/cdp-signer.js +274 -33
- package/dist/adapter/evm-call-failure.d.ts +29 -0
- package/dist/adapter/evm-call-failure.js +109 -0
- package/dist/adapter/refusal.d.ts +1 -1
- package/dist/adapter/refusal.js +13 -0
- package/dist/adapter/route-simulator.d.ts +91 -0
- package/dist/adapter/route-simulator.js +143 -0
- package/dist/adapter-cdp-index.d.ts +1 -1
- package/dist/executable-equities.d.ts +55 -0
- package/dist/executable-equities.js +116 -0
- package/dist/executable-yield-markets.d.ts +261 -0
- package/dist/executable-yield-markets.js +154 -0
- package/dist/execution-account-gas-quote.d.ts +141 -0
- package/dist/execution-account-gas-quote.js +443 -0
- package/dist/execution-account-gas-review.d.ts +123 -0
- package/dist/execution-account-gas-review.js +104 -0
- package/dist/execution-account-gas-runtime.d.ts +33 -0
- package/dist/execution-account-gas-runtime.js +131 -0
- package/dist/execution-account-gas-view.d.ts +936 -0
- package/dist/execution-account-gas-view.js +56 -0
- package/dist/execution-config.d.ts +3 -0
- package/dist/execution-config.js +4 -0
- package/dist/execution-delegated-definition.d.ts +7 -6
- package/dist/execution-delegated-definition.js +13 -2
- package/dist/execution-delegation-admin-definition.d.ts +127 -5
- package/dist/execution-delegation-admin-definition.js +155 -5
- package/dist/execution-delegation-admin.d.ts +48 -2
- package/dist/execution-delegation-admin.js +422 -12
- package/dist/execution-delegation-cap-store.d.ts +386 -0
- package/dist/execution-delegation-cap-store.js +1150 -0
- package/dist/execution-delegation-exit-definition.d.ts +309 -0
- package/dist/execution-delegation-exit-definition.js +204 -0
- package/dist/execution-delegation-exit-store.d.ts +114 -0
- package/dist/execution-delegation-exit-store.js +671 -0
- package/dist/execution-delegation-exit.d.ts +4 -0
- package/dist/execution-delegation-exit.js +614 -0
- package/dist/execution-delegation-finality.d.ts +22 -0
- package/dist/execution-delegation-finality.js +90 -0
- package/dist/execution-delegation-operation-store.d.ts +129 -0
- package/dist/execution-delegation-operation-store.js +1107 -0
- package/dist/execution-delegation-operations-definition.d.ts +282 -0
- package/dist/execution-delegation-operations-definition.js +117 -0
- package/dist/execution-delegation-operations.d.ts +6 -0
- package/dist/execution-delegation-operations.js +282 -0
- package/dist/execution-delegation-policy.d.ts +154 -8
- package/dist/execution-delegation-policy.js +273 -40
- package/dist/execution-delegation.d.ts +51 -0
- package/dist/execution-delegation.js +441 -31
- package/dist/execution-errors.d.ts +1 -1
- package/dist/execution-errors.js +122 -0
- package/dist/execution-index.d.ts +7 -2
- package/dist/execution-index.js +7 -2
- package/dist/execution-journal-schema.d.ts +96 -0
- package/dist/execution-journal-schema.js +368 -0
- package/dist/execution-journal-tables.d.ts +14 -0
- package/dist/execution-journal-tables.js +227 -0
- package/dist/execution-policy-compatibility.d.ts +34 -0
- package/dist/execution-policy-compatibility.js +76 -0
- package/dist/execution-registration.d.ts +54 -2
- package/dist/execution-registration.js +151 -5
- package/dist/execution-sponsored-account-profile.d.ts +32 -0
- package/dist/execution-sponsored-account-profile.js +59 -0
- package/dist/execution-sponsored-account.d.ts +1519 -0
- package/dist/execution-sponsored-account.js +222 -0
- package/dist/execution-sponsored-definition.d.ts +1713 -0
- package/dist/execution-sponsored-definition.js +185 -0
- package/dist/execution-sponsored-gas-policy.d.ts +27 -0
- package/dist/execution-sponsored-gas-policy.js +110 -0
- package/dist/execution-sponsored-hosted.d.ts +3 -0
- package/dist/execution-sponsored-hosted.js +71 -0
- package/dist/execution-sponsored-index.d.ts +1322 -0
- package/dist/execution-sponsored-index.js +102 -0
- package/dist/execution-sponsored-mcp-definition.d.ts +1662 -0
- package/dist/execution-sponsored-mcp-definition.js +94 -0
- package/dist/execution-sponsored-receipt.d.ts +47 -0
- package/dist/execution-sponsored-receipt.js +74 -0
- package/dist/execution-sponsored-registration.d.ts +14 -0
- package/dist/execution-sponsored-registration.js +77 -0
- package/dist/execution-sponsored-runtime.d.ts +84 -0
- package/dist/execution-sponsored-runtime.js +149 -0
- package/dist/execution-sponsored-settlement.d.ts +15 -0
- package/dist/execution-sponsored-settlement.js +88 -0
- package/dist/execution-sponsored-store.d.ts +67 -0
- package/dist/execution-sponsored-store.js +517 -0
- package/dist/execution-sponsored-transport.d.ts +90 -0
- package/dist/execution-sponsored-transport.js +180 -0
- package/dist/execution-tool-definitions.d.ts +21 -21
- package/dist/execution-tool-definitions.js +0 -7
- package/dist/execution-tools.d.ts +53 -1
- package/dist/execution-tools.js +171 -13
- package/dist/execution-worker-guard.d.ts +28 -0
- package/dist/execution-worker-guard.js +124 -0
- package/dist/hybrid-yield-index.d.ts +10 -0
- package/dist/hybrid-yield-index.js +11 -0
- package/dist/hybrid-yield-markets.d.ts +96 -0
- package/dist/hybrid-yield-markets.js +124 -0
- package/dist/hybrid-yield.d.ts +411 -0
- package/dist/hybrid-yield.js +155 -0
- package/dist/hyperliquid-order-builder.js +4 -0
- package/dist/lifi-execution-client.d.ts +6 -0
- package/dist/lifi-execution-client.js +3 -0
- package/dist/lp-userop-account.d.ts +461 -0
- package/dist/lp-userop-account.js +417 -0
- package/dist/lp-userop-authority.d.ts +49 -0
- package/dist/lp-userop-authority.js +211 -0
- package/dist/lp-userop-definition.d.ts +233 -0
- package/dist/lp-userop-definition.js +85 -0
- package/dist/lp-userop-hosted.d.ts +3 -0
- package/dist/lp-userop-hosted.js +73 -0
- package/dist/lp-userop-index.d.ts +1569 -0
- package/dist/lp-userop-index.js +112 -0
- package/dist/lp-userop-mcp-definition.d.ts +1220 -0
- package/dist/lp-userop-mcp-definition.js +46 -0
- package/dist/lp-userop-operation.d.ts +1230 -0
- package/dist/lp-userop-operation.js +140 -0
- package/dist/lp-userop-registration.d.ts +14 -0
- package/dist/lp-userop-registration.js +70 -0
- package/dist/lp-userop-settlement.d.ts +89 -0
- package/dist/lp-userop-settlement.js +184 -0
- package/dist/lp-userop.d.ts +643 -0
- package/dist/lp-userop.js +343 -0
- package/dist/native-yield-account-definition.d.ts +1192 -0
- package/dist/native-yield-account-definition.js +232 -0
- package/dist/native-yield-account-gas.d.ts +58 -0
- package/dist/native-yield-account-gas.js +228 -0
- package/dist/native-yield-account-index.d.ts +23 -0
- package/dist/native-yield-account-index.js +28 -0
- package/dist/native-yield-account-policy.d.ts +168 -0
- package/dist/native-yield-account-policy.js +525 -0
- package/dist/native-yield-account-rpc.d.ts +8 -0
- package/dist/native-yield-account-rpc.js +128 -0
- package/dist/native-yield-account-runtime.d.ts +71 -0
- package/dist/native-yield-account-runtime.js +125 -0
- package/dist/native-yield-account-store.d.ts +40 -0
- package/dist/native-yield-account-store.js +307 -0
- package/dist/native-yield-account.d.ts +662 -0
- package/dist/native-yield-account.js +371 -0
- package/dist/native-yield-consent-store.d.ts +20 -0
- package/dist/native-yield-consent-store.js +317 -0
- package/dist/native-yield-definition.d.ts +288 -0
- package/dist/native-yield-definition.js +105 -0
- package/dist/native-yield-reader.d.ts +4 -0
- package/dist/native-yield-reader.js +137 -0
- package/dist/native-yield-settlement.d.ts +48 -0
- package/dist/native-yield-settlement.js +167 -0
- package/dist/native-yield-simulation.d.ts +18 -0
- package/dist/native-yield-simulation.js +45 -0
- package/dist/native-yield-userop-account.d.ts +675 -0
- package/dist/native-yield-userop-account.js +357 -0
- package/dist/native-yield-userop-authority.d.ts +214 -0
- package/dist/native-yield-userop-authority.js +296 -0
- package/dist/native-yield-userop-definition.d.ts +331 -0
- package/dist/native-yield-userop-definition.js +105 -0
- package/dist/native-yield-userop-hosted.d.ts +3 -0
- package/dist/native-yield-userop-hosted.js +71 -0
- package/dist/native-yield-userop-index.d.ts +1522 -0
- package/dist/native-yield-userop-index.js +142 -0
- package/dist/native-yield-userop-mcp-definition.d.ts +1356 -0
- package/dist/native-yield-userop-mcp-definition.js +50 -0
- package/dist/native-yield-userop-operation.d.ts +845 -0
- package/dist/native-yield-userop-operation.js +127 -0
- package/dist/native-yield-userop-policy.d.ts +23 -0
- package/dist/native-yield-userop-policy.js +25 -0
- package/dist/native-yield-userop-registration.d.ts +17 -0
- package/dist/native-yield-userop-registration.js +76 -0
- package/dist/native-yield-userop-settlement.d.ts +8 -0
- package/dist/native-yield-userop-settlement.js +79 -0
- package/dist/native-yield-userop-simulation.d.ts +18 -0
- package/dist/native-yield-userop-simulation.js +34 -0
- package/dist/native-yield-userop.d.ts +35 -0
- package/dist/native-yield-userop.js +156 -0
- package/dist/native-yield-verify.d.ts +30 -0
- package/dist/native-yield-verify.js +141 -0
- package/dist/native-yield.d.ts +17 -0
- package/dist/native-yield.js +119 -0
- package/dist/stdio-main.js +0 -0
- package/dist/stock-buy-definition.d.ts +338 -0
- package/dist/stock-buy-definition.js +127 -0
- package/dist/stock-buy-oracle.d.ts +8 -0
- package/dist/stock-buy-oracle.js +22 -0
- package/dist/stock-buy.d.ts +17 -0
- package/dist/stock-buy.js +164 -0
- package/dist/tool-definitions.d.ts +3 -1
- package/dist/tool-definitions.js +55 -2
- package/dist/vendor/lp-v3/lp-v3-atomic-contract.d.ts +445 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-contract.js +90 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-evidence.d.ts +14 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-evidence.js +82 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-index.d.ts +80 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-index.js +19 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-plan.d.ts +43 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-plan.js +112 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-read-contract.d.ts +312 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-read-contract.js +41 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-read-index.d.ts +3 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-read-index.js +3 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-read-rpc.d.ts +49 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-read-rpc.js +88 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-read.d.ts +17 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-read.js +232 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-settlement.d.ts +105 -0
- package/dist/vendor/lp-v3/lp-v3-atomic-settlement.js +162 -0
- package/dist/vendor/lp-v3/lp-v3-collect-protocol-contract.d.ts +606 -0
- package/dist/vendor/lp-v3/lp-v3-collect-protocol-contract.js +59 -0
- package/dist/vendor/lp-v3/lp-v3-collect-protocol-index.d.ts +168 -0
- package/dist/vendor/lp-v3/lp-v3-collect-protocol-index.js +23 -0
- package/dist/vendor/lp-v3/lp-v3-collect-protocol-observation.d.ts +32 -0
- package/dist/vendor/lp-v3/lp-v3-collect-protocol-observation.js +228 -0
- package/dist/vendor/lp-v3/lp-v3-collect-protocol-plan.d.ts +11 -0
- package/dist/vendor/lp-v3/lp-v3-collect-protocol-plan.js +91 -0
- package/dist/vendor/lp-v3/lp-v3-collect-protocol-reconcile.d.ts +9 -0
- package/dist/vendor/lp-v3/lp-v3-collect-protocol-reconcile.js +124 -0
- package/dist/vendor/lp-v3/lp-v3-contract.d.ts +538 -0
- package/dist/vendor/lp-v3/lp-v3-contract.js +137 -0
- package/dist/vendor/lp-v3/lp-v3-evidence.d.ts +25 -0
- package/dist/vendor/lp-v3/lp-v3-evidence.js +168 -0
- package/dist/vendor/lp-v3/lp-v3-plan.d.ts +22 -0
- package/dist/vendor/lp-v3/lp-v3-plan.js +135 -0
- package/dist/vendor/lp-v3/types.d.ts +131 -0
- package/dist/vendor/lp-v3/types.js +6 -0
- package/dist/vendor/lp-v3/v4-math.d.ts +18 -0
- package/dist/vendor/lp-v3/v4-math.js +90 -0
- package/dist/yield-deposit-definition.d.ts +374 -0
- package/dist/yield-deposit-definition.js +123 -0
- package/dist/yield-deposit.d.ts +16 -0
- package/dist/yield-deposit.js +149 -0
- package/dist/yield-route-semantics.d.ts +27 -0
- package/dist/yield-route-semantics.js +71 -0
- package/dist/yield-withdraw-definition.d.ts +357 -0
- package/dist/yield-withdraw-definition.js +90 -0
- package/dist/yield-withdraw.d.ts +11 -0
- package/dist/yield-withdraw.js +122 -0
- package/package.json +239 -7
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { type LpV3AtomicEvidenceOptions } from './lp-v3-atomic-evidence.js';
|
|
2
|
+
import type { LpV3GuardDeployment, LpV3AtomicIntent } from './lp-v3-atomic-contract.js';
|
|
3
|
+
import type { LpV3AtomicSettlementContext } from './lp-v3-atomic-plan.js';
|
|
4
|
+
import type { LpV3VerifyOptions } from './lp-v3-plan.js';
|
|
5
|
+
/** Independently reviewed guard manifests are immutable HOST configuration.
|
|
6
|
+
* Default empty policy keeps guard collection unavailable; no deployment is implied.
|
|
7
|
+
* This library starts no transport, signer, operation journal or background worker.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createLpV3AtomicLibrary(guardDeployments?: readonly LpV3GuardDeployment[]): Readonly<{
|
|
10
|
+
prepare: (input: unknown, chainEvidence: unknown, options?: LpV3VerifyOptions) => import("./lp-v3-atomic-contract.js").LpV3AtomicPlan;
|
|
11
|
+
verify: (input: unknown, independentIntent: unknown, freshEvidence: unknown, options?: LpV3VerifyOptions) => import("./lp-v3-atomic-plan.js").VerifiedLpV3AtomicPlan;
|
|
12
|
+
verifyForSettlement: (input: unknown, journalIntent: unknown, historicalBaseline: unknown, canonicalReadback: unknown, options?: LpV3VerifyOptions) => import("./lp-v3-atomic-plan.js").VerifiedLpV3AtomicSettlementContext;
|
|
13
|
+
collectEvidence: (intent: LpV3AtomicIntent, options?: LpV3AtomicEvidenceOptions) => Promise<{
|
|
14
|
+
chainId: 8453;
|
|
15
|
+
blockNumber: string;
|
|
16
|
+
blockHash: string;
|
|
17
|
+
blockTimestamp: number;
|
|
18
|
+
observedAt: number;
|
|
19
|
+
canonical: true;
|
|
20
|
+
account: string;
|
|
21
|
+
accountCode: "0x";
|
|
22
|
+
balances: [string, string];
|
|
23
|
+
allowances: [string, string];
|
|
24
|
+
manager: "0x03a520b32c04bf3beef7beb72e919cf822ed34f1";
|
|
25
|
+
managerFactory: "0x33128a8fc17869897dce68ed026d694621f6fdfd";
|
|
26
|
+
factory: "0x33128a8fc17869897dce68ed026d694621f6fdfd";
|
|
27
|
+
factoryPool: string;
|
|
28
|
+
factoryCodeHash: `0x${string}`;
|
|
29
|
+
managerCodeHash: `0x${string}`;
|
|
30
|
+
token0CodeHash: `0x${string}`;
|
|
31
|
+
token1CodeHash: `0x${string}`;
|
|
32
|
+
usdcImplementation: "0x2ce6311ddae708829bc0784c967b7d77d19fd779";
|
|
33
|
+
usdcImplementationCodeHash: `0x${string}`;
|
|
34
|
+
usdcPaused: false;
|
|
35
|
+
accountBlacklisted: false;
|
|
36
|
+
managerBlacklisted: false;
|
|
37
|
+
pool: string;
|
|
38
|
+
poolFactory: "0x33128a8fc17869897dce68ed026d694621f6fdfd";
|
|
39
|
+
token0: "0x4200000000000000000000000000000000000006";
|
|
40
|
+
token1: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913";
|
|
41
|
+
fee: number;
|
|
42
|
+
tickSpacing: number;
|
|
43
|
+
tick: number;
|
|
44
|
+
sqrtPriceX96: string;
|
|
45
|
+
unlocked: true;
|
|
46
|
+
schemaVersion: 2;
|
|
47
|
+
position: {
|
|
48
|
+
tokenId: string;
|
|
49
|
+
owner: string;
|
|
50
|
+
token0: string;
|
|
51
|
+
token1: string;
|
|
52
|
+
fee: number;
|
|
53
|
+
tickLower: number;
|
|
54
|
+
tickUpper: number;
|
|
55
|
+
liquidity: string;
|
|
56
|
+
tokensOwed: [string, string];
|
|
57
|
+
approved: string;
|
|
58
|
+
};
|
|
59
|
+
managerNativeBalance: string;
|
|
60
|
+
guard: {
|
|
61
|
+
address: string;
|
|
62
|
+
runtimeCodeHash: string;
|
|
63
|
+
configurationHash: string;
|
|
64
|
+
deploymentChainId: 8453;
|
|
65
|
+
ownerApprovalForAll: false;
|
|
66
|
+
guardBlacklisted: false;
|
|
67
|
+
poolBlacklisted: false;
|
|
68
|
+
tokenAllowances: ["0", "0"];
|
|
69
|
+
tokenBalances: [string, string];
|
|
70
|
+
} | null;
|
|
71
|
+
}>;
|
|
72
|
+
verifySettlement: (context: LpV3AtomicSettlementContext, evidence: unknown, options?: LpV3VerifyOptions) => import("./lp-v3-atomic-settlement.js").LpV3AtomicSettlementResult;
|
|
73
|
+
}>;
|
|
74
|
+
export { lpV3AtomicIntentSchema, lpV3AtomicPlanSchema, lpV3AtomicChainEvidenceSchema, DEFAULT_LP_V3_COLLECT_GUARDS, LP_V3_COLLECT_CONFIGURATION_HASH } from './lp-v3-atomic-contract.js';
|
|
75
|
+
export type { LpV3AtomicIntent, LpV3AtomicPlan, LpV3AtomicCall, LpV3AtomicChainEvidence, LpV3GuardDeployment } from './lp-v3-atomic-contract.js';
|
|
76
|
+
export { requireVerifiedLpV3AtomicPlan } from './lp-v3-atomic-plan.js';
|
|
77
|
+
export type { VerifiedLpV3AtomicPlan, VerifiedLpV3AtomicSettlementContext, LpV3AtomicSettlementContext } from './lp-v3-atomic-plan.js';
|
|
78
|
+
export { lpV3AtomicSettlementEvidenceSchema } from './lp-v3-atomic-settlement.js';
|
|
79
|
+
export type { LpV3AtomicSettlementEvidence, LpV3AtomicSettlementResult } from './lp-v3-atomic-settlement.js';
|
|
80
|
+
export type { LpV3AtomicEvidenceOptions, LpV3AtomicReadClient } from './lp-v3-atomic-evidence.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createLpV3AtomicPlanner } from './lp-v3-atomic-plan.js';
|
|
2
|
+
import { collectLpV3AtomicEvidence } from './lp-v3-atomic-evidence.js';
|
|
3
|
+
import { verifyLpV3AtomicSettlement } from './lp-v3-atomic-settlement.js';
|
|
4
|
+
/** Independently reviewed guard manifests are immutable HOST configuration.
|
|
5
|
+
* Default empty policy keeps guard collection unavailable; no deployment is implied.
|
|
6
|
+
* This library starts no transport, signer, operation journal or background worker.
|
|
7
|
+
*/
|
|
8
|
+
export function createLpV3AtomicLibrary(guardDeployments) {
|
|
9
|
+
const planner = createLpV3AtomicPlanner(guardDeployments);
|
|
10
|
+
return Object.freeze({
|
|
11
|
+
prepare: planner.prepare, verify: planner.verify, verifyForSettlement: planner.verifyForSettlement,
|
|
12
|
+
collectEvidence: (intent, options) => collectLpV3AtomicEvidence(intent, planner.policy, options),
|
|
13
|
+
verifySettlement: (context, evidence, options) => verifyLpV3AtomicSettlement(context, evidence, planner.policy, options),
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export { lpV3AtomicIntentSchema, lpV3AtomicPlanSchema, lpV3AtomicChainEvidenceSchema, DEFAULT_LP_V3_COLLECT_GUARDS, LP_V3_COLLECT_CONFIGURATION_HASH } from './lp-v3-atomic-contract.js';
|
|
17
|
+
export { requireVerifiedLpV3AtomicPlan } from './lp-v3-atomic-plan.js';
|
|
18
|
+
export { lpV3AtomicSettlementEvidenceSchema } from './lp-v3-atomic-settlement.js';
|
|
19
|
+
//# sourceMappingURL=lp-v3-atomic-index.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type LpV3VerifyOptions } from './lp-v3-plan.js';
|
|
2
|
+
import { type LpV3AtomicChainEvidence, type LpV3AtomicPlan, type LpV3GuardDeployment } from './lp-v3-atomic-contract.js';
|
|
3
|
+
declare const atomicBrand: unique symbol;
|
|
4
|
+
export interface VerifiedLpV3AtomicPlan {
|
|
5
|
+
readonly [atomicBrand]: true;
|
|
6
|
+
readonly plan: LpV3AtomicPlan;
|
|
7
|
+
readonly purpose: 'execute';
|
|
8
|
+
readonly evidence: LpV3AtomicChainEvidence;
|
|
9
|
+
readonly verifiedAt: number;
|
|
10
|
+
}
|
|
11
|
+
declare const settlementBrand: unique symbol;
|
|
12
|
+
export interface VerifiedLpV3AtomicSettlementContext {
|
|
13
|
+
readonly [settlementBrand]: true;
|
|
14
|
+
readonly purpose: 'settle-only';
|
|
15
|
+
readonly plan: LpV3AtomicPlan;
|
|
16
|
+
readonly evidence: LpV3AtomicChainEvidence;
|
|
17
|
+
readonly verifiedAt: number;
|
|
18
|
+
}
|
|
19
|
+
export type LpV3AtomicSettlementContext = VerifiedLpV3AtomicPlan | VerifiedLpV3AtomicSettlementContext;
|
|
20
|
+
export declare function requireVerifiedLpV3AtomicPlan(verified: VerifiedLpV3AtomicPlan, policy: readonly LpV3GuardDeployment[]): void;
|
|
21
|
+
export declare function requireLpV3AtomicSettlementContext(context: LpV3AtomicSettlementContext, policy: readonly LpV3GuardDeployment[]): void;
|
|
22
|
+
/** A frozen policy is an independently reviewed HOST configuration. It is not
|
|
23
|
+
* wallet authority and must never be accepted alongside an external request. */
|
|
24
|
+
export declare function createLpV3AtomicPlanner(guardDeployments?: readonly LpV3GuardDeployment[]): Readonly<{
|
|
25
|
+
policy: readonly {
|
|
26
|
+
id: "base-weth-usdc-collect-v1";
|
|
27
|
+
chainId: 8453;
|
|
28
|
+
address: string;
|
|
29
|
+
runtimeCodeHash: string;
|
|
30
|
+
configurationHash: `0x${string}`;
|
|
31
|
+
codeVersion: "OttoV3CollectGuard-v1";
|
|
32
|
+
deploymentBlock: string;
|
|
33
|
+
reviewReference: string;
|
|
34
|
+
}[];
|
|
35
|
+
prepare(input: unknown, chainEvidence: unknown, options?: LpV3VerifyOptions): LpV3AtomicPlan;
|
|
36
|
+
verify(input: unknown, independentIntent: unknown, freshEvidence: unknown, options?: LpV3VerifyOptions): VerifiedLpV3AtomicPlan;
|
|
37
|
+
/** Recovery-only reconstruction from the protected journal's ORIGINAL baseline.
|
|
38
|
+
* The host must independently reread that historical block's canonical mapping.
|
|
39
|
+
* This separate brand cannot authorize calls, approvals or a new operation.
|
|
40
|
+
*/
|
|
41
|
+
verifyForSettlement(input: unknown, journalIntent: unknown, historicalBaseline: unknown, canonicalReadback: unknown, options?: LpV3VerifyOptions): VerifiedLpV3AtomicSettlementContext;
|
|
42
|
+
}>;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { encodeFunctionData } from 'viem';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { canonicalJson, commitment, deepFreeze, LP_V3_BASE, lpHash, lpUint } from './lp-v3-contract.js';
|
|
4
|
+
import { checkLpV3Context, prepareLpV3Plan } from './lp-v3-plan.js';
|
|
5
|
+
import { LP_V3_ATOMIC_NPM_ABI, LP_V3_COLLECT_GUARD_ABI, legacyIntent, legacyEvidence, lpV3AtomicIntentSchema, lpV3AtomicChainEvidenceSchema, lpV3AtomicPlanSchema, reviewedGuardPolicy, resolveCollectGuard, } from './lp-v3-atomic-contract.js';
|
|
6
|
+
const verifiedPolicies = new WeakMap();
|
|
7
|
+
const settlementPolicies = new WeakMap();
|
|
8
|
+
export function requireVerifiedLpV3AtomicPlan(verified, policy) {
|
|
9
|
+
if (!verified || verifiedPolicies.get(verified) !== commitment(policy))
|
|
10
|
+
throw new Error('LP_UNVERIFIED_ATOMIC_PLAN');
|
|
11
|
+
}
|
|
12
|
+
export function requireLpV3AtomicSettlementContext(context, policy) {
|
|
13
|
+
if (!context || (verifiedPolicies.get(context) !== commitment(policy) && settlementPolicies.get(context) !== commitment(policy)))
|
|
14
|
+
throw new Error('LP_UNVERIFIED_ATOMIC_SETTLEMENT_CONTEXT');
|
|
15
|
+
}
|
|
16
|
+
const baselineReadbackSchema = z.object({
|
|
17
|
+
operationId: z.string(), planCommitment: lpHash, canonical: z.literal(true),
|
|
18
|
+
blockNumber: lpUint(), blockHash: lpHash,
|
|
19
|
+
originalVerifiedAt: z.number().int().positive().safe(), canonicalCheckedAt: z.number().int().positive().safe(),
|
|
20
|
+
}).strict();
|
|
21
|
+
function check(intent, evidence, policy, now) {
|
|
22
|
+
checkLpV3Context(legacyIntent(intent), legacyEvidence(evidence), now);
|
|
23
|
+
// Canonical NPM may spend existing native ETH for the WETH leg. Reject that
|
|
24
|
+
// known prestate; a later forced donation still requires settlement to fail shut.
|
|
25
|
+
if (intent.action === 'increase' && evidence.managerNativeBalance !== '0')
|
|
26
|
+
throw new Error('LP_NPM_NATIVE_BALANCE_REQUIRES_REVIEW');
|
|
27
|
+
if (evidence.position.approved !== '0x0000000000000000000000000000000000000000')
|
|
28
|
+
throw new Error('LP_EXISTING_NFT_APPROVAL_REQUIRES_RECOVERY');
|
|
29
|
+
const deployment = resolveCollectGuard(intent, policy);
|
|
30
|
+
if (!deployment) {
|
|
31
|
+
if (evidence.guard !== null)
|
|
32
|
+
throw new Error('LP_UNEXPECTED_GUARD_EVIDENCE');
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
const g = evidence.guard;
|
|
36
|
+
if (!g || g.address !== deployment.address || g.runtimeCodeHash !== deployment.runtimeCodeHash || g.configurationHash !== deployment.configurationHash || BigInt(evidence.blockNumber) < BigInt(deployment.deploymentBlock))
|
|
37
|
+
throw new Error('LP_ATOMIC_GUARD_PIN_MISMATCH');
|
|
38
|
+
}
|
|
39
|
+
return deployment;
|
|
40
|
+
}
|
|
41
|
+
function derive(intent, evidence, deployment, now) {
|
|
42
|
+
const basePlan = prepareLpV3Plan(legacyIntent(intent), legacyEvidence(evidence), { now: () => now });
|
|
43
|
+
const call = (step, to, data) => ({ step, tokenIndex: null, chainId: 8453, from: intent.account, to, value: '0', data });
|
|
44
|
+
if (intent.action === 'increase') {
|
|
45
|
+
const selfTransfer = encodeFunctionData({ abi: LP_V3_ATOMIC_NPM_ABI, functionName: 'transferFrom', args: [intent.account, intent.account, BigInt(intent.tokenId)] });
|
|
46
|
+
const mutation = basePlan.calls.find(c => c.step === 'mutation');
|
|
47
|
+
const data = encodeFunctionData({ abi: LP_V3_ATOMIC_NPM_ABI, functionName: 'multicall', args: [[selfTransfer, mutation.data, selfTransfer]] });
|
|
48
|
+
const calls = basePlan.calls.map((c) => ({ ...c, step: c.step === 'approve' ? 'erc20-approve' : c.step === 'cleanup' ? 'erc20-cleanup' : 'mutation', data: c.step === 'mutation' ? data : c.data }));
|
|
49
|
+
return { calls, recoveryCalls: calls.filter(c => c.step === 'erc20-cleanup') };
|
|
50
|
+
}
|
|
51
|
+
if (!deployment)
|
|
52
|
+
throw new Error('LP_ATOMIC_COLLECT_GUARD_NOT_DEPLOYED');
|
|
53
|
+
const approve = (spender) => encodeFunctionData({ abi: LP_V3_ATOMIC_NPM_ABI, functionName: 'approve', args: [spender, BigInt(intent.tokenId)] });
|
|
54
|
+
return {
|
|
55
|
+
calls: [
|
|
56
|
+
call('nft-approve', LP_V3_BASE.manager, approve(deployment.address)),
|
|
57
|
+
call('mutation', deployment.address, encodeFunctionData({ abi: LP_V3_COLLECT_GUARD_ABI, functionName: 'collect', args: [{ owner: intent.account, pool: intent.pool, tokenId: BigInt(intent.tokenId), tickLower: intent.tickLower, tickUpper: intent.tickUpper, amount0Max: BigInt(intent.amountMax[0]), amount1Max: BigInt(intent.amountMax[1]), amount0Min: BigInt(intent.amountMin[0]), amount1Min: BigInt(intent.amountMin[1]), deadline: BigInt(intent.deadline) }] })),
|
|
58
|
+
],
|
|
59
|
+
recoveryCalls: [call('nft-clear', LP_V3_BASE.manager, approve('0x0000000000000000000000000000000000000000'))],
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function validate(input, independentIntent, chainEvidence, policy, at) {
|
|
63
|
+
const plan = lpV3AtomicPlanSchema.parse(input), intent = lpV3AtomicIntentSchema.parse(independentIntent), evidence = lpV3AtomicChainEvidenceSchema.parse(chainEvidence);
|
|
64
|
+
const deployment = check(intent, evidence, policy, at), sequence = derive(intent, evidence, deployment, at);
|
|
65
|
+
if (canonicalJson(intent) !== canonicalJson(plan.intent) || plan.intentCommitment !== commitment(intent))
|
|
66
|
+
throw new Error('LP_ATOMIC_INDEPENDENT_INTENT_MISMATCH');
|
|
67
|
+
if (canonicalJson(sequence.calls) !== canonicalJson(plan.calls) || canonicalJson(sequence.recoveryCalls) !== canonicalJson(plan.recoveryCalls) || canonicalJson(deployment) !== canonicalJson(plan.guardDeployment))
|
|
68
|
+
throw new Error('LP_ATOMIC_CALL_OR_DEPLOYMENT_MISMATCH');
|
|
69
|
+
const { planCommitment, ...body } = plan;
|
|
70
|
+
if (planCommitment !== commitment(body))
|
|
71
|
+
throw new Error('LP_ATOMIC_PLAN_COMMITMENT_MISMATCH');
|
|
72
|
+
if (BigInt(plan.preparedBlock.number) > BigInt(evidence.blockNumber) || (plan.preparedBlock.number === evidence.blockNumber && plan.preparedBlock.hash !== evidence.blockHash))
|
|
73
|
+
throw new Error('LP_ATOMIC_PREPARATION_BLOCK_MISMATCH');
|
|
74
|
+
return { plan, evidence };
|
|
75
|
+
}
|
|
76
|
+
/** A frozen policy is an independently reviewed HOST configuration. It is not
|
|
77
|
+
* wallet authority and must never be accepted alongside an external request. */
|
|
78
|
+
export function createLpV3AtomicPlanner(guardDeployments) {
|
|
79
|
+
const policy = reviewedGuardPolicy(guardDeployments);
|
|
80
|
+
const nowOf = (options) => (options.now ?? (() => Math.floor(Date.now() / 1000)))();
|
|
81
|
+
return Object.freeze({
|
|
82
|
+
policy,
|
|
83
|
+
prepare(input, chainEvidence, options = {}) {
|
|
84
|
+
const intent = lpV3AtomicIntentSchema.parse(input), evidence = lpV3AtomicChainEvidenceSchema.parse(chainEvidence), now = nowOf(options);
|
|
85
|
+
const deployment = check(intent, evidence, policy, now), sequence = derive(intent, evidence, deployment, now);
|
|
86
|
+
const body = { schemaVersion: 2, kind: 'lp-v3-atomic', intent, signingSupport: 'HOST_GATES_REQUIRED', intentCommitment: commitment(intent), ...sequence, guardDeployment: deployment, preparedBlock: { number: evidence.blockNumber, hash: evidence.blockHash } };
|
|
87
|
+
return deepFreeze({ ...body, planCommitment: commitment(body) });
|
|
88
|
+
},
|
|
89
|
+
verify(input, independentIntent, freshEvidence, options = {}) {
|
|
90
|
+
const now = nowOf(options), { plan, evidence } = validate(input, independentIntent, freshEvidence, policy, now);
|
|
91
|
+
const result = deepFreeze({ purpose: 'execute', plan, evidence, verifiedAt: now });
|
|
92
|
+
verifiedPolicies.set(result, commitment(policy));
|
|
93
|
+
return result;
|
|
94
|
+
},
|
|
95
|
+
/** Recovery-only reconstruction from the protected journal's ORIGINAL baseline.
|
|
96
|
+
* The host must independently reread that historical block's canonical mapping.
|
|
97
|
+
* This separate brand cannot authorize calls, approvals or a new operation.
|
|
98
|
+
*/
|
|
99
|
+
verifyForSettlement(input, journalIntent, historicalBaseline, canonicalReadback, options = {}) {
|
|
100
|
+
const proof = baselineReadbackSchema.parse(canonicalReadback), now = nowOf(options);
|
|
101
|
+
if (!Number.isSafeInteger(now) || now <= 0 || proof.canonicalCheckedAt > now || now - proof.canonicalCheckedAt > 30 || proof.originalVerifiedAt > proof.canonicalCheckedAt)
|
|
102
|
+
throw new Error('LP_ATOMIC_STALE_BASELINE_READBACK');
|
|
103
|
+
const { plan, evidence } = validate(input, journalIntent, historicalBaseline, policy, proof.originalVerifiedAt);
|
|
104
|
+
if (proof.operationId !== plan.intent.operationId || proof.planCommitment !== plan.planCommitment || proof.blockNumber !== evidence.blockNumber || proof.blockHash !== evidence.blockHash)
|
|
105
|
+
throw new Error('LP_ATOMIC_JOURNAL_BASELINE_MISMATCH');
|
|
106
|
+
const result = deepFreeze({ purpose: 'settle-only', plan, evidence, verifiedAt: proof.originalVerifiedAt });
|
|
107
|
+
settlementPolicies.set(result, commitment(policy));
|
|
108
|
+
return result;
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=lp-v3-atomic-plan.js.map
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { LpV3AtomicReadClient } from './lp-v3-atomic-evidence.js';
|
|
3
|
+
import type { LpV3AtomicSettlementEvidence, LpV3AtomicSettlementResult } from './lp-v3-atomic-settlement.js';
|
|
4
|
+
/** Mandatory immutable HOST policy. This is not a caller assertion of finality. */
|
|
5
|
+
export declare const lpV3FinalityPolicySchema: z.ZodObject<{
|
|
6
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
7
|
+
id: z.ZodLiteral<"base-finalized-lp-v1">;
|
|
8
|
+
chainId: z.ZodLiteral<8453>;
|
|
9
|
+
blockTag: z.ZodLiteral<"finalized">;
|
|
10
|
+
reviewReference: z.ZodString;
|
|
11
|
+
minFinalizedConfirmations: z.ZodNumber;
|
|
12
|
+
maxHeadAgeSeconds: z.ZodNumber;
|
|
13
|
+
maxFinalizedLagSeconds: z.ZodNumber;
|
|
14
|
+
maxReadDurationSeconds: z.ZodNumber;
|
|
15
|
+
}, z.core.$strict>;
|
|
16
|
+
export type LpV3FinalityPolicy = z.infer<typeof lpV3FinalityPolicySchema>;
|
|
17
|
+
export declare const lpV3JournalRequestSchema: z.ZodObject<{
|
|
18
|
+
userId: z.ZodString;
|
|
19
|
+
address: z.ZodString;
|
|
20
|
+
network: z.ZodLiteral<"base">;
|
|
21
|
+
transaction: z.ZodString;
|
|
22
|
+
idempotencyKey: z.ZodString;
|
|
23
|
+
}, z.core.$strict>;
|
|
24
|
+
export declare const lpV3JournalTransactionSchema: z.ZodObject<{
|
|
25
|
+
callIndex: z.ZodNumber;
|
|
26
|
+
transactionHash: z.ZodString;
|
|
27
|
+
nonce: z.ZodString;
|
|
28
|
+
request: z.ZodObject<{
|
|
29
|
+
userId: z.ZodString;
|
|
30
|
+
address: z.ZodString;
|
|
31
|
+
network: z.ZodLiteral<"base">;
|
|
32
|
+
transaction: z.ZodString;
|
|
33
|
+
idempotencyKey: z.ZodString;
|
|
34
|
+
}, z.core.$strict>;
|
|
35
|
+
requestDigest: z.ZodString;
|
|
36
|
+
state: z.ZodEnum<{
|
|
37
|
+
confirmed: "confirmed";
|
|
38
|
+
submitted: "submitted";
|
|
39
|
+
mined: "mined";
|
|
40
|
+
}>;
|
|
41
|
+
}, z.core.$strict>;
|
|
42
|
+
export type LpV3JournalTransaction = z.infer<typeof lpV3JournalTransactionSchema>;
|
|
43
|
+
export declare const lpV3SettlementReadInputSchema: z.ZodObject<{
|
|
44
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
45
|
+
plan: z.ZodObject<{
|
|
46
|
+
schemaVersion: z.ZodLiteral<2>;
|
|
47
|
+
kind: z.ZodLiteral<"lp-v3-atomic">;
|
|
48
|
+
intent: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
49
|
+
action: z.ZodLiteral<"increase">;
|
|
50
|
+
tokenId: z.ZodString;
|
|
51
|
+
amountDesired: z.ZodTuple<[z.ZodString, z.ZodString], null>;
|
|
52
|
+
amountMin: z.ZodTuple<[z.ZodString, z.ZodString], null>;
|
|
53
|
+
protocol: z.ZodLiteral<"uniswap-v3">;
|
|
54
|
+
chainId: z.ZodLiteral<8453>;
|
|
55
|
+
operationId: z.ZodString;
|
|
56
|
+
account: z.ZodString;
|
|
57
|
+
recipient: z.ZodString;
|
|
58
|
+
manager: z.ZodLiteral<"0x03a520b32c04bf3beef7beb72e919cf822ed34f1">;
|
|
59
|
+
factory: z.ZodLiteral<"0x33128a8fc17869897dce68ed026d694621f6fdfd">;
|
|
60
|
+
pool: z.ZodString;
|
|
61
|
+
token0: z.ZodLiteral<"0x4200000000000000000000000000000000000006">;
|
|
62
|
+
token1: z.ZodLiteral<"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913">;
|
|
63
|
+
fee: z.ZodUnion<readonly [z.ZodLiteral<100>, z.ZodLiteral<500>, z.ZodLiteral<3000>, z.ZodLiteral<10000>]>;
|
|
64
|
+
tickLower: z.ZodNumber;
|
|
65
|
+
tickUpper: z.ZodNumber;
|
|
66
|
+
deadline: z.ZodNumber;
|
|
67
|
+
schemaVersion: z.ZodLiteral<2>;
|
|
68
|
+
nftApprovalPolicy: z.ZodLiteral<"zero-before-and-after">;
|
|
69
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
70
|
+
action: z.ZodLiteral<"collect">;
|
|
71
|
+
tokenId: z.ZodString;
|
|
72
|
+
amountMax: z.ZodTuple<[z.ZodString, z.ZodString], null>;
|
|
73
|
+
amountMin: z.ZodTuple<[z.ZodString, z.ZodString], null>;
|
|
74
|
+
protocol: z.ZodLiteral<"uniswap-v3">;
|
|
75
|
+
chainId: z.ZodLiteral<8453>;
|
|
76
|
+
operationId: z.ZodString;
|
|
77
|
+
account: z.ZodString;
|
|
78
|
+
recipient: z.ZodString;
|
|
79
|
+
manager: z.ZodLiteral<"0x03a520b32c04bf3beef7beb72e919cf822ed34f1">;
|
|
80
|
+
factory: z.ZodLiteral<"0x33128a8fc17869897dce68ed026d694621f6fdfd">;
|
|
81
|
+
pool: z.ZodString;
|
|
82
|
+
token0: z.ZodLiteral<"0x4200000000000000000000000000000000000006">;
|
|
83
|
+
token1: z.ZodLiteral<"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913">;
|
|
84
|
+
fee: z.ZodUnion<readonly [z.ZodLiteral<100>, z.ZodLiteral<500>, z.ZodLiteral<3000>, z.ZodLiteral<10000>]>;
|
|
85
|
+
tickLower: z.ZodNumber;
|
|
86
|
+
tickUpper: z.ZodNumber;
|
|
87
|
+
deadline: z.ZodNumber;
|
|
88
|
+
schemaVersion: z.ZodLiteral<2>;
|
|
89
|
+
nftApprovalPolicy: z.ZodLiteral<"zero-before-and-after">;
|
|
90
|
+
guardDeploymentId: z.ZodLiteral<"base-weth-usdc-collect-v1">;
|
|
91
|
+
}, z.core.$strict>], "action">;
|
|
92
|
+
signingSupport: z.ZodLiteral<"HOST_GATES_REQUIRED">;
|
|
93
|
+
intentCommitment: z.ZodString;
|
|
94
|
+
calls: z.ZodArray<z.ZodObject<{
|
|
95
|
+
step: z.ZodEnum<{
|
|
96
|
+
mutation: "mutation";
|
|
97
|
+
"erc20-approve": "erc20-approve";
|
|
98
|
+
"erc20-cleanup": "erc20-cleanup";
|
|
99
|
+
"nft-approve": "nft-approve";
|
|
100
|
+
"nft-clear": "nft-clear";
|
|
101
|
+
}>;
|
|
102
|
+
tokenIndex: z.ZodNullable<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
|
|
103
|
+
chainId: z.ZodLiteral<8453>;
|
|
104
|
+
from: z.ZodString;
|
|
105
|
+
to: z.ZodString;
|
|
106
|
+
value: z.ZodLiteral<"0">;
|
|
107
|
+
data: z.ZodString;
|
|
108
|
+
}, z.core.$strict>>;
|
|
109
|
+
recoveryCalls: z.ZodArray<z.ZodObject<{
|
|
110
|
+
step: z.ZodEnum<{
|
|
111
|
+
mutation: "mutation";
|
|
112
|
+
"erc20-approve": "erc20-approve";
|
|
113
|
+
"erc20-cleanup": "erc20-cleanup";
|
|
114
|
+
"nft-approve": "nft-approve";
|
|
115
|
+
"nft-clear": "nft-clear";
|
|
116
|
+
}>;
|
|
117
|
+
tokenIndex: z.ZodNullable<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
|
|
118
|
+
chainId: z.ZodLiteral<8453>;
|
|
119
|
+
from: z.ZodString;
|
|
120
|
+
to: z.ZodString;
|
|
121
|
+
value: z.ZodLiteral<"0">;
|
|
122
|
+
data: z.ZodString;
|
|
123
|
+
}, z.core.$strict>>;
|
|
124
|
+
guardDeployment: z.ZodNullable<z.ZodObject<{
|
|
125
|
+
id: z.ZodLiteral<"base-weth-usdc-collect-v1">;
|
|
126
|
+
chainId: z.ZodLiteral<8453>;
|
|
127
|
+
address: z.ZodString;
|
|
128
|
+
runtimeCodeHash: z.ZodString;
|
|
129
|
+
configurationHash: z.ZodLiteral<`0x${string}`>;
|
|
130
|
+
codeVersion: z.ZodLiteral<"OttoV3CollectGuard-v1">;
|
|
131
|
+
deploymentBlock: z.ZodString;
|
|
132
|
+
reviewReference: z.ZodString;
|
|
133
|
+
}, z.core.$strict>>;
|
|
134
|
+
preparedBlock: z.ZodObject<{
|
|
135
|
+
number: z.ZodString;
|
|
136
|
+
hash: z.ZodString;
|
|
137
|
+
}, z.core.$strict>;
|
|
138
|
+
planCommitment: z.ZodString;
|
|
139
|
+
}, z.core.$strict>;
|
|
140
|
+
journal: z.ZodObject<{
|
|
141
|
+
userId: z.ZodString;
|
|
142
|
+
operationId: z.ZodString;
|
|
143
|
+
planCommitment: z.ZodString;
|
|
144
|
+
independentIntent: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
145
|
+
action: z.ZodLiteral<"increase">;
|
|
146
|
+
tokenId: z.ZodString;
|
|
147
|
+
amountDesired: z.ZodTuple<[z.ZodString, z.ZodString], null>;
|
|
148
|
+
amountMin: z.ZodTuple<[z.ZodString, z.ZodString], null>;
|
|
149
|
+
protocol: z.ZodLiteral<"uniswap-v3">;
|
|
150
|
+
chainId: z.ZodLiteral<8453>;
|
|
151
|
+
operationId: z.ZodString;
|
|
152
|
+
account: z.ZodString;
|
|
153
|
+
recipient: z.ZodString;
|
|
154
|
+
manager: z.ZodLiteral<"0x03a520b32c04bf3beef7beb72e919cf822ed34f1">;
|
|
155
|
+
factory: z.ZodLiteral<"0x33128a8fc17869897dce68ed026d694621f6fdfd">;
|
|
156
|
+
pool: z.ZodString;
|
|
157
|
+
token0: z.ZodLiteral<"0x4200000000000000000000000000000000000006">;
|
|
158
|
+
token1: z.ZodLiteral<"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913">;
|
|
159
|
+
fee: z.ZodUnion<readonly [z.ZodLiteral<100>, z.ZodLiteral<500>, z.ZodLiteral<3000>, z.ZodLiteral<10000>]>;
|
|
160
|
+
tickLower: z.ZodNumber;
|
|
161
|
+
tickUpper: z.ZodNumber;
|
|
162
|
+
deadline: z.ZodNumber;
|
|
163
|
+
schemaVersion: z.ZodLiteral<2>;
|
|
164
|
+
nftApprovalPolicy: z.ZodLiteral<"zero-before-and-after">;
|
|
165
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
166
|
+
action: z.ZodLiteral<"collect">;
|
|
167
|
+
tokenId: z.ZodString;
|
|
168
|
+
amountMax: z.ZodTuple<[z.ZodString, z.ZodString], null>;
|
|
169
|
+
amountMin: z.ZodTuple<[z.ZodString, z.ZodString], null>;
|
|
170
|
+
protocol: z.ZodLiteral<"uniswap-v3">;
|
|
171
|
+
chainId: z.ZodLiteral<8453>;
|
|
172
|
+
operationId: z.ZodString;
|
|
173
|
+
account: z.ZodString;
|
|
174
|
+
recipient: z.ZodString;
|
|
175
|
+
manager: z.ZodLiteral<"0x03a520b32c04bf3beef7beb72e919cf822ed34f1">;
|
|
176
|
+
factory: z.ZodLiteral<"0x33128a8fc17869897dce68ed026d694621f6fdfd">;
|
|
177
|
+
pool: z.ZodString;
|
|
178
|
+
token0: z.ZodLiteral<"0x4200000000000000000000000000000000000006">;
|
|
179
|
+
token1: z.ZodLiteral<"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913">;
|
|
180
|
+
fee: z.ZodUnion<readonly [z.ZodLiteral<100>, z.ZodLiteral<500>, z.ZodLiteral<3000>, z.ZodLiteral<10000>]>;
|
|
181
|
+
tickLower: z.ZodNumber;
|
|
182
|
+
tickUpper: z.ZodNumber;
|
|
183
|
+
deadline: z.ZodNumber;
|
|
184
|
+
schemaVersion: z.ZodLiteral<2>;
|
|
185
|
+
nftApprovalPolicy: z.ZodLiteral<"zero-before-and-after">;
|
|
186
|
+
guardDeploymentId: z.ZodLiteral<"base-weth-usdc-collect-v1">;
|
|
187
|
+
}, z.core.$strict>], "action">;
|
|
188
|
+
baseline: z.ZodObject<{
|
|
189
|
+
chainId: z.ZodLiteral<8453>;
|
|
190
|
+
blockNumber: z.ZodString;
|
|
191
|
+
blockHash: z.ZodString;
|
|
192
|
+
blockTimestamp: z.ZodNumber;
|
|
193
|
+
observedAt: z.ZodNumber;
|
|
194
|
+
canonical: z.ZodLiteral<true>;
|
|
195
|
+
account: z.ZodString;
|
|
196
|
+
accountCode: z.ZodLiteral<"0x">;
|
|
197
|
+
balances: z.ZodTuple<[z.ZodString, z.ZodString], null>;
|
|
198
|
+
allowances: z.ZodTuple<[z.ZodString, z.ZodString], null>;
|
|
199
|
+
manager: z.ZodLiteral<"0x03a520b32c04bf3beef7beb72e919cf822ed34f1">;
|
|
200
|
+
managerFactory: z.ZodLiteral<"0x33128a8fc17869897dce68ed026d694621f6fdfd">;
|
|
201
|
+
factory: z.ZodLiteral<"0x33128a8fc17869897dce68ed026d694621f6fdfd">;
|
|
202
|
+
factoryPool: z.ZodString;
|
|
203
|
+
factoryCodeHash: z.ZodLiteral<`0x${string}`>;
|
|
204
|
+
managerCodeHash: z.ZodLiteral<`0x${string}`>;
|
|
205
|
+
token0CodeHash: z.ZodLiteral<`0x${string}`>;
|
|
206
|
+
token1CodeHash: z.ZodLiteral<`0x${string}`>;
|
|
207
|
+
usdcImplementation: z.ZodLiteral<"0x2ce6311ddae708829bc0784c967b7d77d19fd779">;
|
|
208
|
+
usdcImplementationCodeHash: z.ZodLiteral<`0x${string}`>;
|
|
209
|
+
usdcPaused: z.ZodLiteral<false>;
|
|
210
|
+
accountBlacklisted: z.ZodLiteral<false>;
|
|
211
|
+
managerBlacklisted: z.ZodLiteral<false>;
|
|
212
|
+
pool: z.ZodString;
|
|
213
|
+
poolFactory: z.ZodLiteral<"0x33128a8fc17869897dce68ed026d694621f6fdfd">;
|
|
214
|
+
token0: z.ZodLiteral<"0x4200000000000000000000000000000000000006">;
|
|
215
|
+
token1: z.ZodLiteral<"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913">;
|
|
216
|
+
fee: z.ZodNumber;
|
|
217
|
+
tickSpacing: z.ZodNumber;
|
|
218
|
+
tick: z.ZodNumber;
|
|
219
|
+
sqrtPriceX96: z.ZodString;
|
|
220
|
+
unlocked: z.ZodLiteral<true>;
|
|
221
|
+
schemaVersion: z.ZodLiteral<2>;
|
|
222
|
+
position: z.ZodObject<{
|
|
223
|
+
tokenId: z.ZodString;
|
|
224
|
+
owner: z.ZodString;
|
|
225
|
+
token0: z.ZodString;
|
|
226
|
+
token1: z.ZodString;
|
|
227
|
+
fee: z.ZodNumber;
|
|
228
|
+
tickLower: z.ZodNumber;
|
|
229
|
+
tickUpper: z.ZodNumber;
|
|
230
|
+
liquidity: z.ZodString;
|
|
231
|
+
tokensOwed: z.ZodTuple<[z.ZodString, z.ZodString], null>;
|
|
232
|
+
approved: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"0x0000000000000000000000000000000000000000">]>;
|
|
233
|
+
}, z.core.$strict>;
|
|
234
|
+
managerNativeBalance: z.ZodString;
|
|
235
|
+
guard: z.ZodNullable<z.ZodObject<{
|
|
236
|
+
address: z.ZodString;
|
|
237
|
+
runtimeCodeHash: z.ZodString;
|
|
238
|
+
configurationHash: z.ZodString;
|
|
239
|
+
deploymentChainId: z.ZodLiteral<8453>;
|
|
240
|
+
ownerApprovalForAll: z.ZodLiteral<false>;
|
|
241
|
+
guardBlacklisted: z.ZodLiteral<false>;
|
|
242
|
+
poolBlacklisted: z.ZodLiteral<false>;
|
|
243
|
+
tokenAllowances: z.ZodTuple<[z.ZodLiteral<"0">, z.ZodLiteral<"0">], null>;
|
|
244
|
+
tokenBalances: z.ZodTuple<[z.ZodString, z.ZodString], null>;
|
|
245
|
+
}, z.core.$strict>>;
|
|
246
|
+
}, z.core.$strict>;
|
|
247
|
+
originalVerifiedAt: z.ZodNumber;
|
|
248
|
+
transactions: z.ZodArray<z.ZodObject<{
|
|
249
|
+
callIndex: z.ZodNumber;
|
|
250
|
+
transactionHash: z.ZodString;
|
|
251
|
+
nonce: z.ZodString;
|
|
252
|
+
request: z.ZodObject<{
|
|
253
|
+
userId: z.ZodString;
|
|
254
|
+
address: z.ZodString;
|
|
255
|
+
network: z.ZodLiteral<"base">;
|
|
256
|
+
transaction: z.ZodString;
|
|
257
|
+
idempotencyKey: z.ZodString;
|
|
258
|
+
}, z.core.$strict>;
|
|
259
|
+
requestDigest: z.ZodString;
|
|
260
|
+
state: z.ZodEnum<{
|
|
261
|
+
confirmed: "confirmed";
|
|
262
|
+
submitted: "submitted";
|
|
263
|
+
mined: "mined";
|
|
264
|
+
}>;
|
|
265
|
+
}, z.core.$strict>>;
|
|
266
|
+
}, z.core.$strict>;
|
|
267
|
+
}, z.core.$strict>;
|
|
268
|
+
export type LpV3SettlementReadInput = z.infer<typeof lpV3SettlementReadInputSchema>;
|
|
269
|
+
export interface LpV3SettlementReadClient {
|
|
270
|
+
request(request: Omit<Parameters<LpV3AtomicReadClient['request']>[0], 'method'> & {
|
|
271
|
+
method: Parameters<LpV3AtomicReadClient['request']>[0]['method'] | 'eth_getTransactionByHash' | 'eth_getTransactionReceipt';
|
|
272
|
+
}): Promise<unknown>;
|
|
273
|
+
}
|
|
274
|
+
export declare const LP_V3_READ_HOLD_REASONS: readonly ["INVALID_INPUT", "INVALID_CLOCK", "JOURNAL_MISMATCH", "RPC_UNAVAILABLE", "WRONG_CHAIN", "FINALITY_UNAVAILABLE", "FINALITY_STALE", "NOT_FINALIZED", "TRANSACTION_UNAVAILABLE", "TRANSACTION_MISMATCH", "RECEIPT_UNAVAILABLE", "TRANSACTION_REVERTED", "RECEIPT_MISMATCH", "BLOCK_REORG", "HISTORY_UNAVAILABLE", "BASELINE_MISMATCH", "SETTLEMENT_UNPROVEN", "READ_STALE"];
|
|
275
|
+
export type LpV3ReadHoldReason = typeof LP_V3_READ_HOLD_REASONS[number];
|
|
276
|
+
export interface LpV3ReadFinalityEvidence {
|
|
277
|
+
policyCommitment: string;
|
|
278
|
+
observedAt: number;
|
|
279
|
+
latest: {
|
|
280
|
+
number: string;
|
|
281
|
+
hash: string;
|
|
282
|
+
timestamp: number;
|
|
283
|
+
};
|
|
284
|
+
finalized: {
|
|
285
|
+
number: string;
|
|
286
|
+
hash: string;
|
|
287
|
+
timestamp: number;
|
|
288
|
+
};
|
|
289
|
+
minimumObservedFinalizedConfirmations: string;
|
|
290
|
+
}
|
|
291
|
+
interface NoAuthority {
|
|
292
|
+
executionAuthorized: false;
|
|
293
|
+
claimReleased: false;
|
|
294
|
+
retainClaim: true;
|
|
295
|
+
retrySafe: false;
|
|
296
|
+
}
|
|
297
|
+
export type LpV3SettlementReadResult = (NoAuthority & {
|
|
298
|
+
status: 'HELD';
|
|
299
|
+
settlement: 'UNKNOWN';
|
|
300
|
+
reason: LpV3ReadHoldReason;
|
|
301
|
+
operationId: string | null;
|
|
302
|
+
planCommitment: string | null;
|
|
303
|
+
}) | (NoAuthority & {
|
|
304
|
+
status: 'SETTLEMENT_VERIFIED';
|
|
305
|
+
operationId: string;
|
|
306
|
+
planCommitment: string;
|
|
307
|
+
journalCommitment: string;
|
|
308
|
+
evidence: LpV3AtomicSettlementEvidence;
|
|
309
|
+
finality: LpV3ReadFinalityEvidence;
|
|
310
|
+
result: LpV3AtomicSettlementResult;
|
|
311
|
+
});
|
|
312
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { lpHash, lpUint } from './lp-v3-contract.js';
|
|
3
|
+
import { lpV3AtomicPlanSchema, lpV3AtomicIntentSchema, lpV3AtomicChainEvidenceSchema } from './lp-v3-atomic-contract.js';
|
|
4
|
+
/** Mandatory immutable HOST policy. This is not a caller assertion of finality. */
|
|
5
|
+
export const lpV3FinalityPolicySchema = z.object({
|
|
6
|
+
schemaVersion: z.literal(1), id: z.literal('base-finalized-lp-v1'), chainId: z.literal(8453),
|
|
7
|
+
blockTag: z.literal('finalized'), reviewReference: z.string().min(16).max(200),
|
|
8
|
+
minFinalizedConfirmations: z.number().int().min(1).max(10_000),
|
|
9
|
+
maxHeadAgeSeconds: z.number().int().min(1).max(60),
|
|
10
|
+
maxFinalizedLagSeconds: z.number().int().min(1).max(3600),
|
|
11
|
+
maxReadDurationSeconds: z.number().int().min(1).max(30),
|
|
12
|
+
}).strict();
|
|
13
|
+
const userId = z.string().regex(/^[a-zA-Z0-9-]{1,100}$/);
|
|
14
|
+
// Exact CDP EOA request projection. Preserve string case and field order for the
|
|
15
|
+
// existing native-account SHA-256(JSON.stringify(request)) journal digest.
|
|
16
|
+
export const lpV3JournalRequestSchema = z.object({
|
|
17
|
+
userId, address: z.string().regex(/^0x[0-9a-fA-F]{40}$/), network: z.literal('base'),
|
|
18
|
+
transaction: z.string().regex(/^0x(?:[0-9a-fA-F]{2})+$/), idempotencyKey: z.string().uuid(),
|
|
19
|
+
}).strict();
|
|
20
|
+
export const lpV3JournalTransactionSchema = z.object({
|
|
21
|
+
callIndex: z.number().int().min(0).max(4), transactionHash: lpHash, nonce: lpUint(64),
|
|
22
|
+
request: lpV3JournalRequestSchema, requestDigest: z.string().regex(/^[0-9a-f]{64}$/),
|
|
23
|
+
state: z.enum(['submitted', 'mined', 'confirmed']),
|
|
24
|
+
}).strict();
|
|
25
|
+
export const lpV3SettlementReadInputSchema = z.object({
|
|
26
|
+
schemaVersion: z.literal(1), plan: lpV3AtomicPlanSchema,
|
|
27
|
+
// Independently loaded from the protected journal, never external request fields.
|
|
28
|
+
journal: z.object({
|
|
29
|
+
userId, operationId: z.string().regex(/^[a-zA-Z0-9_-]{16,96}$/), planCommitment: lpHash,
|
|
30
|
+
independentIntent: lpV3AtomicIntentSchema, baseline: lpV3AtomicChainEvidenceSchema,
|
|
31
|
+
originalVerifiedAt: z.number().int().positive().safe(),
|
|
32
|
+
transactions: z.array(lpV3JournalTransactionSchema).min(2).max(5),
|
|
33
|
+
}).strict(),
|
|
34
|
+
}).strict();
|
|
35
|
+
export const LP_V3_READ_HOLD_REASONS = [
|
|
36
|
+
'INVALID_INPUT', 'INVALID_CLOCK', 'JOURNAL_MISMATCH', 'RPC_UNAVAILABLE', 'WRONG_CHAIN',
|
|
37
|
+
'FINALITY_UNAVAILABLE', 'FINALITY_STALE', 'NOT_FINALIZED', 'TRANSACTION_UNAVAILABLE',
|
|
38
|
+
'TRANSACTION_MISMATCH', 'RECEIPT_UNAVAILABLE', 'TRANSACTION_REVERTED', 'RECEIPT_MISMATCH',
|
|
39
|
+
'BLOCK_REORG', 'HISTORY_UNAVAILABLE', 'BASELINE_MISMATCH', 'SETTLEMENT_UNPROVEN', 'READ_STALE',
|
|
40
|
+
];
|
|
41
|
+
//# sourceMappingURL=lp-v3-atomic-read-contract.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { createLpV3AtomicSettlementReader, type LpV3SettlementReaderOptions } from './lp-v3-atomic-read.js';
|
|
2
|
+
export { lpV3FinalityPolicySchema, lpV3SettlementReadInputSchema, lpV3JournalTransactionSchema, lpV3JournalRequestSchema, LP_V3_READ_HOLD_REASONS } from './lp-v3-atomic-read-contract.js';
|
|
3
|
+
export type { LpV3FinalityPolicy, LpV3JournalTransaction, LpV3SettlementReadInput, LpV3SettlementReadClient, LpV3SettlementReadResult, LpV3ReadFinalityEvidence, LpV3ReadHoldReason } from './lp-v3-atomic-read-contract.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { createLpV3AtomicSettlementReader } from './lp-v3-atomic-read.js';
|
|
2
|
+
export { lpV3FinalityPolicySchema, lpV3SettlementReadInputSchema, lpV3JournalTransactionSchema, lpV3JournalRequestSchema, LP_V3_READ_HOLD_REASONS } from './lp-v3-atomic-read-contract.js';
|
|
3
|
+
//# sourceMappingURL=lp-v3-atomic-read-index.js.map
|