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,309 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const DELEGATION_EXIT_TOOL_NAME: "otto_delegation_exit";
|
|
3
|
+
export declare const DELEGATION_EXIT_CHAIN_ID: 8453;
|
|
4
|
+
export declare const DELEGATION_EXIT_USDC: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
5
|
+
export declare const DELEGATION_EXIT_STATES: readonly ["preparing", "signing", "signed", "submitted", "unknown", "confirmed", "reverted", "replaced", "canceled"];
|
|
6
|
+
export declare const DELEGATION_EXIT_INPUT_SCHEMA: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
7
|
+
phase: z.ZodLiteral<"prepare">;
|
|
8
|
+
accessToken: z.ZodString;
|
|
9
|
+
account: z.ZodString;
|
|
10
|
+
destination: z.ZodString;
|
|
11
|
+
amountAtomic: z.ZodString;
|
|
12
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
13
|
+
phase: z.ZodLiteral<"resume">;
|
|
14
|
+
accessToken: z.ZodString;
|
|
15
|
+
operationId: z.ZodString;
|
|
16
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
17
|
+
phase: z.ZodLiteral<"submit">;
|
|
18
|
+
accessToken: z.ZodString;
|
|
19
|
+
operationId: z.ZodString;
|
|
20
|
+
epoch: z.ZodNumber;
|
|
21
|
+
ownerToken: z.ZodString;
|
|
22
|
+
signedTransaction: z.ZodString;
|
|
23
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
24
|
+
phase: z.ZodLiteral<"status">;
|
|
25
|
+
accessToken: z.ZodString;
|
|
26
|
+
operationId: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
28
|
+
phase: z.ZodLiteral<"reconcile">;
|
|
29
|
+
accessToken: z.ZodString;
|
|
30
|
+
operationId: z.ZodString;
|
|
31
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
32
|
+
phase: z.ZodLiteral<"retry_same">;
|
|
33
|
+
accessToken: z.ZodString;
|
|
34
|
+
operationId: z.ZodString;
|
|
35
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
36
|
+
phase: z.ZodLiteral<"cancel">;
|
|
37
|
+
accessToken: z.ZodString;
|
|
38
|
+
operationId: z.ZodString;
|
|
39
|
+
epoch: z.ZodNumber;
|
|
40
|
+
ownerToken: z.ZodString;
|
|
41
|
+
}, z.core.$strict>], "phase">;
|
|
42
|
+
export declare const DELEGATION_EXIT_TRANSACTION_SCHEMA: z.ZodObject<{
|
|
43
|
+
type: z.ZodLiteral<"eip1559">;
|
|
44
|
+
chain_id: z.ZodLiteral<8453>;
|
|
45
|
+
nonce: z.ZodString;
|
|
46
|
+
from: z.ZodString;
|
|
47
|
+
to: z.ZodLiteral<"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913">;
|
|
48
|
+
value: z.ZodLiteral<"0">;
|
|
49
|
+
data: z.ZodString;
|
|
50
|
+
gas: z.ZodString;
|
|
51
|
+
max_fee_per_gas: z.ZodString;
|
|
52
|
+
max_priority_fee_per_gas: z.ZodString;
|
|
53
|
+
sign_idempotency_key: z.ZodString;
|
|
54
|
+
}, z.core.$strict>;
|
|
55
|
+
export declare const DELEGATION_EXIT_RECORD_RESULT_SCHEMA: z.ZodObject<{
|
|
56
|
+
phase: z.ZodEnum<{
|
|
57
|
+
status: "status";
|
|
58
|
+
prepare: "prepare";
|
|
59
|
+
resume: "resume";
|
|
60
|
+
submit: "submit";
|
|
61
|
+
reconcile: "reconcile";
|
|
62
|
+
retry_same: "retry_same";
|
|
63
|
+
cancel: "cancel";
|
|
64
|
+
}>;
|
|
65
|
+
has_exit: z.ZodLiteral<true>;
|
|
66
|
+
user_id: z.ZodString;
|
|
67
|
+
operation_id: z.ZodString;
|
|
68
|
+
state: z.ZodEnum<{
|
|
69
|
+
unknown: "unknown";
|
|
70
|
+
confirmed: "confirmed";
|
|
71
|
+
reverted: "reverted";
|
|
72
|
+
submitted: "submitted";
|
|
73
|
+
signing: "signing";
|
|
74
|
+
preparing: "preparing";
|
|
75
|
+
signed: "signed";
|
|
76
|
+
replaced: "replaced";
|
|
77
|
+
canceled: "canceled";
|
|
78
|
+
}>;
|
|
79
|
+
epoch: z.ZodNumber;
|
|
80
|
+
account: z.ZodString;
|
|
81
|
+
destination: z.ZodString;
|
|
82
|
+
amount_atomic: z.ZodString;
|
|
83
|
+
created_at: z.ZodString;
|
|
84
|
+
updated_at: z.ZodString;
|
|
85
|
+
lease_expires_at: z.ZodOptional<z.ZodString>;
|
|
86
|
+
owner_token: z.ZodOptional<z.ZodString>;
|
|
87
|
+
transaction: z.ZodOptional<z.ZodObject<{
|
|
88
|
+
type: z.ZodLiteral<"eip1559">;
|
|
89
|
+
chain_id: z.ZodLiteral<8453>;
|
|
90
|
+
nonce: z.ZodString;
|
|
91
|
+
from: z.ZodString;
|
|
92
|
+
to: z.ZodLiteral<"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913">;
|
|
93
|
+
value: z.ZodLiteral<"0">;
|
|
94
|
+
data: z.ZodString;
|
|
95
|
+
gas: z.ZodString;
|
|
96
|
+
max_fee_per_gas: z.ZodString;
|
|
97
|
+
max_priority_fee_per_gas: z.ZodString;
|
|
98
|
+
sign_idempotency_key: z.ZodString;
|
|
99
|
+
}, z.core.$strict>>;
|
|
100
|
+
transaction_hash: z.ZodOptional<z.ZodString>;
|
|
101
|
+
broadcast_attempts: z.ZodNumber;
|
|
102
|
+
receipt: z.ZodOptional<z.ZodObject<{
|
|
103
|
+
transaction_hash: z.ZodString;
|
|
104
|
+
block_number: z.ZodString;
|
|
105
|
+
block_hash: z.ZodString;
|
|
106
|
+
status: z.ZodEnum<{
|
|
107
|
+
success: "success";
|
|
108
|
+
reverted: "reverted";
|
|
109
|
+
}>;
|
|
110
|
+
}, z.core.$strict>>;
|
|
111
|
+
replacement: z.ZodOptional<z.ZodObject<{
|
|
112
|
+
transaction_hash: z.ZodString;
|
|
113
|
+
block_number: z.ZodString;
|
|
114
|
+
block_hash: z.ZodString;
|
|
115
|
+
finalized_head_block_number: z.ZodString;
|
|
116
|
+
finalized_head_block_hash: z.ZodString;
|
|
117
|
+
finalized_nonce: z.ZodString;
|
|
118
|
+
}, z.core.$strict>>;
|
|
119
|
+
}, z.core.$strict>;
|
|
120
|
+
export declare const DELEGATION_EXIT_NONE_RESULT_SCHEMA: z.ZodObject<{
|
|
121
|
+
phase: z.ZodLiteral<"status">;
|
|
122
|
+
user_id: z.ZodString;
|
|
123
|
+
has_exit: z.ZodLiteral<false>;
|
|
124
|
+
}, z.core.$strict>;
|
|
125
|
+
/** `status` without an operationId returns this explicit idle variant when no exit exists. */
|
|
126
|
+
export declare const DELEGATION_EXIT_RESULT_SCHEMA: z.ZodUnion<readonly [z.ZodObject<{
|
|
127
|
+
phase: z.ZodEnum<{
|
|
128
|
+
status: "status";
|
|
129
|
+
prepare: "prepare";
|
|
130
|
+
resume: "resume";
|
|
131
|
+
submit: "submit";
|
|
132
|
+
reconcile: "reconcile";
|
|
133
|
+
retry_same: "retry_same";
|
|
134
|
+
cancel: "cancel";
|
|
135
|
+
}>;
|
|
136
|
+
has_exit: z.ZodLiteral<true>;
|
|
137
|
+
user_id: z.ZodString;
|
|
138
|
+
operation_id: z.ZodString;
|
|
139
|
+
state: z.ZodEnum<{
|
|
140
|
+
unknown: "unknown";
|
|
141
|
+
confirmed: "confirmed";
|
|
142
|
+
reverted: "reverted";
|
|
143
|
+
submitted: "submitted";
|
|
144
|
+
signing: "signing";
|
|
145
|
+
preparing: "preparing";
|
|
146
|
+
signed: "signed";
|
|
147
|
+
replaced: "replaced";
|
|
148
|
+
canceled: "canceled";
|
|
149
|
+
}>;
|
|
150
|
+
epoch: z.ZodNumber;
|
|
151
|
+
account: z.ZodString;
|
|
152
|
+
destination: z.ZodString;
|
|
153
|
+
amount_atomic: z.ZodString;
|
|
154
|
+
created_at: z.ZodString;
|
|
155
|
+
updated_at: z.ZodString;
|
|
156
|
+
lease_expires_at: z.ZodOptional<z.ZodString>;
|
|
157
|
+
owner_token: z.ZodOptional<z.ZodString>;
|
|
158
|
+
transaction: z.ZodOptional<z.ZodObject<{
|
|
159
|
+
type: z.ZodLiteral<"eip1559">;
|
|
160
|
+
chain_id: z.ZodLiteral<8453>;
|
|
161
|
+
nonce: z.ZodString;
|
|
162
|
+
from: z.ZodString;
|
|
163
|
+
to: z.ZodLiteral<"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913">;
|
|
164
|
+
value: z.ZodLiteral<"0">;
|
|
165
|
+
data: z.ZodString;
|
|
166
|
+
gas: z.ZodString;
|
|
167
|
+
max_fee_per_gas: z.ZodString;
|
|
168
|
+
max_priority_fee_per_gas: z.ZodString;
|
|
169
|
+
sign_idempotency_key: z.ZodString;
|
|
170
|
+
}, z.core.$strict>>;
|
|
171
|
+
transaction_hash: z.ZodOptional<z.ZodString>;
|
|
172
|
+
broadcast_attempts: z.ZodNumber;
|
|
173
|
+
receipt: z.ZodOptional<z.ZodObject<{
|
|
174
|
+
transaction_hash: z.ZodString;
|
|
175
|
+
block_number: z.ZodString;
|
|
176
|
+
block_hash: z.ZodString;
|
|
177
|
+
status: z.ZodEnum<{
|
|
178
|
+
success: "success";
|
|
179
|
+
reverted: "reverted";
|
|
180
|
+
}>;
|
|
181
|
+
}, z.core.$strict>>;
|
|
182
|
+
replacement: z.ZodOptional<z.ZodObject<{
|
|
183
|
+
transaction_hash: z.ZodString;
|
|
184
|
+
block_number: z.ZodString;
|
|
185
|
+
block_hash: z.ZodString;
|
|
186
|
+
finalized_head_block_number: z.ZodString;
|
|
187
|
+
finalized_head_block_hash: z.ZodString;
|
|
188
|
+
finalized_nonce: z.ZodString;
|
|
189
|
+
}, z.core.$strict>>;
|
|
190
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
191
|
+
phase: z.ZodLiteral<"status">;
|
|
192
|
+
user_id: z.ZodString;
|
|
193
|
+
has_exit: z.ZodLiteral<false>;
|
|
194
|
+
}, z.core.$strict>]>;
|
|
195
|
+
export type DelegationExitInput = z.infer<typeof DELEGATION_EXIT_INPUT_SCHEMA>;
|
|
196
|
+
export type DelegationExitResult = z.infer<typeof DELEGATION_EXIT_RESULT_SCHEMA>;
|
|
197
|
+
export declare const DELEGATION_EXIT_TOOL_DEFINITION: Readonly<{
|
|
198
|
+
name: "otto_delegation_exit";
|
|
199
|
+
title: "Prepare, submit, and recover an exact Base USDC exit";
|
|
200
|
+
description: "Move an authenticated CDP end user's own Base USDC only through a server-held durable reservation. prepare returns one exact EIP-1559 transaction for client-side signing; the client must never broadcast it. submit validates and durably records the signed bytes and computed hash before the server broadcasts. status is read-only and cross-device. reconcile proves a canonical receipt without broadcasting, or returns the exact finalized sender+nonce replacement proof when another transaction consumed the reserved nonce. retry_same is explicit and can broadcast only the already-stored byte-identical transaction after reconciling first. cancel is accepted only before signed bytes were recorded. The caller presents Otto's delegation secret in x-otto-delegation-auth; user identity is always derived from accessToken.";
|
|
201
|
+
inputSchema: z.ZodObject<{}, z.core.$loose>;
|
|
202
|
+
strictInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
203
|
+
phase: z.ZodLiteral<"prepare">;
|
|
204
|
+
accessToken: z.ZodString;
|
|
205
|
+
account: z.ZodString;
|
|
206
|
+
destination: z.ZodString;
|
|
207
|
+
amountAtomic: z.ZodString;
|
|
208
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
209
|
+
phase: z.ZodLiteral<"resume">;
|
|
210
|
+
accessToken: z.ZodString;
|
|
211
|
+
operationId: z.ZodString;
|
|
212
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
213
|
+
phase: z.ZodLiteral<"submit">;
|
|
214
|
+
accessToken: z.ZodString;
|
|
215
|
+
operationId: z.ZodString;
|
|
216
|
+
epoch: z.ZodNumber;
|
|
217
|
+
ownerToken: z.ZodString;
|
|
218
|
+
signedTransaction: z.ZodString;
|
|
219
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
220
|
+
phase: z.ZodLiteral<"status">;
|
|
221
|
+
accessToken: z.ZodString;
|
|
222
|
+
operationId: z.ZodOptional<z.ZodString>;
|
|
223
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
224
|
+
phase: z.ZodLiteral<"reconcile">;
|
|
225
|
+
accessToken: z.ZodString;
|
|
226
|
+
operationId: z.ZodString;
|
|
227
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
228
|
+
phase: z.ZodLiteral<"retry_same">;
|
|
229
|
+
accessToken: z.ZodString;
|
|
230
|
+
operationId: z.ZodString;
|
|
231
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
232
|
+
phase: z.ZodLiteral<"cancel">;
|
|
233
|
+
accessToken: z.ZodString;
|
|
234
|
+
operationId: z.ZodString;
|
|
235
|
+
epoch: z.ZodNumber;
|
|
236
|
+
ownerToken: z.ZodString;
|
|
237
|
+
}, z.core.$strict>], "phase">;
|
|
238
|
+
outputSchema: z.ZodObject<{
|
|
239
|
+
operation_id: z.ZodOptional<z.ZodString>;
|
|
240
|
+
state: z.ZodOptional<z.ZodEnum<{
|
|
241
|
+
unknown: "unknown";
|
|
242
|
+
confirmed: "confirmed";
|
|
243
|
+
reverted: "reverted";
|
|
244
|
+
submitted: "submitted";
|
|
245
|
+
signing: "signing";
|
|
246
|
+
preparing: "preparing";
|
|
247
|
+
signed: "signed";
|
|
248
|
+
replaced: "replaced";
|
|
249
|
+
canceled: "canceled";
|
|
250
|
+
}>>;
|
|
251
|
+
epoch: z.ZodOptional<z.ZodNumber>;
|
|
252
|
+
account: z.ZodOptional<z.ZodString>;
|
|
253
|
+
destination: z.ZodOptional<z.ZodString>;
|
|
254
|
+
amount_atomic: z.ZodOptional<z.ZodString>;
|
|
255
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
256
|
+
updated_at: z.ZodOptional<z.ZodString>;
|
|
257
|
+
lease_expires_at: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
258
|
+
owner_token: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
259
|
+
transaction: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
260
|
+
type: z.ZodLiteral<"eip1559">;
|
|
261
|
+
chain_id: z.ZodLiteral<8453>;
|
|
262
|
+
nonce: z.ZodString;
|
|
263
|
+
from: z.ZodString;
|
|
264
|
+
to: z.ZodLiteral<"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913">;
|
|
265
|
+
value: z.ZodLiteral<"0">;
|
|
266
|
+
data: z.ZodString;
|
|
267
|
+
gas: z.ZodString;
|
|
268
|
+
max_fee_per_gas: z.ZodString;
|
|
269
|
+
max_priority_fee_per_gas: z.ZodString;
|
|
270
|
+
sign_idempotency_key: z.ZodString;
|
|
271
|
+
}, z.core.$strict>>>;
|
|
272
|
+
transaction_hash: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
273
|
+
broadcast_attempts: z.ZodOptional<z.ZodNumber>;
|
|
274
|
+
receipt: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
275
|
+
transaction_hash: z.ZodString;
|
|
276
|
+
block_number: z.ZodString;
|
|
277
|
+
block_hash: z.ZodString;
|
|
278
|
+
status: z.ZodEnum<{
|
|
279
|
+
success: "success";
|
|
280
|
+
reverted: "reverted";
|
|
281
|
+
}>;
|
|
282
|
+
}, z.core.$strict>>>;
|
|
283
|
+
replacement: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
284
|
+
transaction_hash: z.ZodString;
|
|
285
|
+
block_number: z.ZodString;
|
|
286
|
+
block_hash: z.ZodString;
|
|
287
|
+
finalized_head_block_number: z.ZodString;
|
|
288
|
+
finalized_head_block_hash: z.ZodString;
|
|
289
|
+
finalized_nonce: z.ZodString;
|
|
290
|
+
}, z.core.$strict>>>;
|
|
291
|
+
phase: z.ZodEnum<{
|
|
292
|
+
status: "status";
|
|
293
|
+
prepare: "prepare";
|
|
294
|
+
resume: "resume";
|
|
295
|
+
submit: "submit";
|
|
296
|
+
reconcile: "reconcile";
|
|
297
|
+
retry_same: "retry_same";
|
|
298
|
+
cancel: "cancel";
|
|
299
|
+
}>;
|
|
300
|
+
user_id: z.ZodString;
|
|
301
|
+
has_exit: z.ZodBoolean;
|
|
302
|
+
}, z.core.$strict>;
|
|
303
|
+
annotations: Readonly<{
|
|
304
|
+
readOnlyHint: false;
|
|
305
|
+
destructiveHint: true;
|
|
306
|
+
idempotentHint: false;
|
|
307
|
+
openWorldHint: true;
|
|
308
|
+
}>;
|
|
309
|
+
}>;
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DELEGATED_TOOL_TRANSPORT_SCHEMA, DELEGATION_AUTH_HEADER } from './execution-delegated-definition.js';
|
|
3
|
+
export const DELEGATION_EXIT_TOOL_NAME = 'otto_delegation_exit';
|
|
4
|
+
export const DELEGATION_EXIT_CHAIN_ID = 8453;
|
|
5
|
+
export const DELEGATION_EXIT_USDC = '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913';
|
|
6
|
+
export const DELEGATION_EXIT_STATES = [
|
|
7
|
+
'preparing',
|
|
8
|
+
'signing',
|
|
9
|
+
'signed',
|
|
10
|
+
'submitted',
|
|
11
|
+
'unknown',
|
|
12
|
+
'confirmed',
|
|
13
|
+
'reverted',
|
|
14
|
+
'replaced',
|
|
15
|
+
'canceled',
|
|
16
|
+
];
|
|
17
|
+
const ACCESS_TOKEN = z.string().min(16).max(8192);
|
|
18
|
+
const ADDRESS = z.string().regex(/^0x[0-9a-fA-F]{40}$/);
|
|
19
|
+
const OPERATION_ID = z.string().uuid();
|
|
20
|
+
const OWNER_TOKEN = z.string().regex(/^[0-9a-f]{64}$/);
|
|
21
|
+
const DECIMAL = z.string().regex(/^(?:0|[1-9][0-9]*)$/);
|
|
22
|
+
const POSITIVE_DECIMAL = z.string().regex(/^[1-9][0-9]*$/);
|
|
23
|
+
const HEX = z.string().regex(/^0x(?:[0-9a-fA-F]{2})+$/);
|
|
24
|
+
const HASH = z.string().regex(/^0x[0-9a-fA-F]{64}$/);
|
|
25
|
+
const UUID_V4 = z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i);
|
|
26
|
+
export const DELEGATION_EXIT_INPUT_SCHEMA = z.discriminatedUnion('phase', [
|
|
27
|
+
z.object({
|
|
28
|
+
phase: z.literal('prepare'),
|
|
29
|
+
accessToken: ACCESS_TOKEN,
|
|
30
|
+
account: ADDRESS,
|
|
31
|
+
destination: ADDRESS,
|
|
32
|
+
amountAtomic: POSITIVE_DECIMAL,
|
|
33
|
+
}).strict(),
|
|
34
|
+
z.object({
|
|
35
|
+
phase: z.literal('resume'),
|
|
36
|
+
accessToken: ACCESS_TOKEN,
|
|
37
|
+
operationId: OPERATION_ID,
|
|
38
|
+
}).strict(),
|
|
39
|
+
z.object({
|
|
40
|
+
phase: z.literal('submit'),
|
|
41
|
+
accessToken: ACCESS_TOKEN,
|
|
42
|
+
operationId: OPERATION_ID,
|
|
43
|
+
epoch: z.number().int().positive(),
|
|
44
|
+
ownerToken: OWNER_TOKEN,
|
|
45
|
+
signedTransaction: HEX,
|
|
46
|
+
}).strict(),
|
|
47
|
+
z.object({
|
|
48
|
+
phase: z.literal('status'),
|
|
49
|
+
accessToken: ACCESS_TOKEN,
|
|
50
|
+
operationId: OPERATION_ID.optional(),
|
|
51
|
+
}).strict(),
|
|
52
|
+
z.object({
|
|
53
|
+
phase: z.literal('reconcile'),
|
|
54
|
+
accessToken: ACCESS_TOKEN,
|
|
55
|
+
operationId: OPERATION_ID,
|
|
56
|
+
}).strict(),
|
|
57
|
+
z.object({
|
|
58
|
+
phase: z.literal('retry_same'),
|
|
59
|
+
accessToken: ACCESS_TOKEN,
|
|
60
|
+
operationId: OPERATION_ID,
|
|
61
|
+
}).strict(),
|
|
62
|
+
z.object({
|
|
63
|
+
phase: z.literal('cancel'),
|
|
64
|
+
accessToken: ACCESS_TOKEN,
|
|
65
|
+
operationId: OPERATION_ID,
|
|
66
|
+
epoch: z.number().int().positive(),
|
|
67
|
+
ownerToken: OWNER_TOKEN,
|
|
68
|
+
}).strict(),
|
|
69
|
+
]);
|
|
70
|
+
export const DELEGATION_EXIT_TRANSACTION_SCHEMA = z.object({
|
|
71
|
+
type: z.literal('eip1559'),
|
|
72
|
+
chain_id: z.literal(DELEGATION_EXIT_CHAIN_ID),
|
|
73
|
+
nonce: DECIMAL,
|
|
74
|
+
from: ADDRESS,
|
|
75
|
+
to: z.literal(DELEGATION_EXIT_USDC),
|
|
76
|
+
value: z.literal('0'),
|
|
77
|
+
data: HEX,
|
|
78
|
+
gas: POSITIVE_DECIMAL,
|
|
79
|
+
max_fee_per_gas: POSITIVE_DECIMAL,
|
|
80
|
+
max_priority_fee_per_gas: DECIMAL,
|
|
81
|
+
sign_idempotency_key: UUID_V4,
|
|
82
|
+
}).strict();
|
|
83
|
+
export const DELEGATION_EXIT_RECORD_RESULT_SCHEMA = z.object({
|
|
84
|
+
phase: z.enum(['prepare', 'resume', 'submit', 'status', 'reconcile', 'retry_same', 'cancel']),
|
|
85
|
+
has_exit: z.literal(true),
|
|
86
|
+
user_id: z.string().regex(/^[a-zA-Z0-9-]{1,100}$/),
|
|
87
|
+
operation_id: OPERATION_ID,
|
|
88
|
+
state: z.enum(DELEGATION_EXIT_STATES),
|
|
89
|
+
epoch: z.number().int().positive(),
|
|
90
|
+
account: ADDRESS,
|
|
91
|
+
destination: ADDRESS,
|
|
92
|
+
amount_atomic: POSITIVE_DECIMAL,
|
|
93
|
+
created_at: z.string().datetime(),
|
|
94
|
+
updated_at: z.string().datetime(),
|
|
95
|
+
lease_expires_at: z.string().datetime().optional(),
|
|
96
|
+
owner_token: OWNER_TOKEN.optional(),
|
|
97
|
+
transaction: DELEGATION_EXIT_TRANSACTION_SCHEMA.optional(),
|
|
98
|
+
transaction_hash: HASH.optional(),
|
|
99
|
+
broadcast_attempts: z.number().int().nonnegative(),
|
|
100
|
+
receipt: z.object({
|
|
101
|
+
transaction_hash: HASH,
|
|
102
|
+
block_number: POSITIVE_DECIMAL,
|
|
103
|
+
block_hash: HASH,
|
|
104
|
+
status: z.enum(['success', 'reverted']),
|
|
105
|
+
}).strict().optional(),
|
|
106
|
+
replacement: z.object({
|
|
107
|
+
transaction_hash: HASH,
|
|
108
|
+
block_number: DECIMAL,
|
|
109
|
+
block_hash: HASH,
|
|
110
|
+
finalized_head_block_number: DECIMAL,
|
|
111
|
+
finalized_head_block_hash: HASH,
|
|
112
|
+
finalized_nonce: POSITIVE_DECIMAL,
|
|
113
|
+
}).strict().optional(),
|
|
114
|
+
}).strict().superRefine((result, ctx) => {
|
|
115
|
+
const hasTransaction = result.transaction !== undefined;
|
|
116
|
+
const hasHash = result.transaction_hash !== undefined;
|
|
117
|
+
const hasReceipt = result.receipt !== undefined;
|
|
118
|
+
const hasReplacement = result.replacement !== undefined;
|
|
119
|
+
const hasLease = result.lease_expires_at !== undefined;
|
|
120
|
+
const hasOwner = result.owner_token !== undefined;
|
|
121
|
+
const ownerPhase = result.phase === 'prepare' || result.phase === 'resume';
|
|
122
|
+
const issue = (message) => ctx.addIssue({ code: 'custom', message });
|
|
123
|
+
if (hasOwner && !ownerPhase)
|
|
124
|
+
issue('owner_token is returned only by prepare or resume');
|
|
125
|
+
if (result.state === 'preparing') {
|
|
126
|
+
if (!hasLease || hasTransaction || hasHash || hasReceipt || hasReplacement || result.broadcast_attempts !== 0)
|
|
127
|
+
issue('preparing requires its server lease and cannot carry a transaction, hash, receipt, or broadcast attempt');
|
|
128
|
+
}
|
|
129
|
+
else if (result.state === 'signing') {
|
|
130
|
+
if (!hasTransaction || !hasLease || hasHash || hasReceipt || hasReplacement || result.broadcast_attempts !== 0)
|
|
131
|
+
issue('signing requires a leased transaction and forbids a hash, receipt, or attempt');
|
|
132
|
+
if (ownerPhase !== hasOwner)
|
|
133
|
+
issue('a signing owner_token is required by prepare/resume and omitted by status/reconcile');
|
|
134
|
+
}
|
|
135
|
+
else if (result.state === 'signed' || result.state === 'submitted' || result.state === 'unknown') {
|
|
136
|
+
if (!hasTransaction || !hasHash || hasReceipt || hasReplacement || hasOwner || hasLease)
|
|
137
|
+
issue('a hash-known nonterminal state requires transaction+hash and forbids receipt or signing ownership');
|
|
138
|
+
if (result.state === 'signed' && result.broadcast_attempts !== 0)
|
|
139
|
+
issue('signed means no broadcast attempt is recorded');
|
|
140
|
+
if ((result.state === 'submitted' || result.state === 'unknown') && result.broadcast_attempts < 1)
|
|
141
|
+
issue('submitted/unknown requires a recorded broadcast attempt');
|
|
142
|
+
}
|
|
143
|
+
else if (result.state === 'confirmed' || result.state === 'reverted') {
|
|
144
|
+
if (!hasTransaction || !hasHash || !hasReceipt || hasReplacement || hasOwner || hasLease)
|
|
145
|
+
issue('a receipt-terminal state requires transaction+hash+receipt and forbids signing ownership');
|
|
146
|
+
if (result.receipt && result.transaction_hash &&
|
|
147
|
+
result.receipt.transaction_hash.toLowerCase() !== result.transaction_hash.toLowerCase())
|
|
148
|
+
issue('receipt hash must match transaction_hash');
|
|
149
|
+
if (result.receipt && result.state === 'confirmed' && result.receipt.status !== 'success')
|
|
150
|
+
issue('confirmed requires a success receipt');
|
|
151
|
+
if (result.receipt && result.state === 'reverted' && result.receipt.status !== 'reverted')
|
|
152
|
+
issue('reverted requires a reverted receipt');
|
|
153
|
+
}
|
|
154
|
+
else if (result.state === 'replaced') {
|
|
155
|
+
if (!hasTransaction || !hasHash || hasReceipt || !hasReplacement || hasOwner || hasLease)
|
|
156
|
+
issue('replaced requires transaction+hash, finalized replacement proof in-store, and no receipt or signing ownership');
|
|
157
|
+
}
|
|
158
|
+
else if (result.state === 'canceled') {
|
|
159
|
+
if (hasHash || hasReceipt || hasReplacement || hasOwner || hasLease || result.broadcast_attempts !== 0)
|
|
160
|
+
issue('canceled forbids a hash, receipt, signing ownership, or broadcast attempt');
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
export const DELEGATION_EXIT_NONE_RESULT_SCHEMA = z.object({
|
|
164
|
+
phase: z.literal('status'),
|
|
165
|
+
user_id: z.string().regex(/^[a-zA-Z0-9-]{1,100}$/),
|
|
166
|
+
has_exit: z.literal(false),
|
|
167
|
+
}).strict();
|
|
168
|
+
/** `status` without an operationId returns this explicit idle variant when no exit exists. */
|
|
169
|
+
export const DELEGATION_EXIT_RESULT_SCHEMA = z.union([
|
|
170
|
+
DELEGATION_EXIT_RECORD_RESULT_SCHEMA,
|
|
171
|
+
DELEGATION_EXIT_NONE_RESULT_SCHEMA,
|
|
172
|
+
]);
|
|
173
|
+
// MCP SDK 1.x normalizes only object output schemas. Keep the flat wire fields
|
|
174
|
+
// discoverable while the original union remains authoritative for every state.
|
|
175
|
+
const DELEGATION_EXIT_MCP_OUTPUT_SCHEMA = z.object(DELEGATION_EXIT_RECORD_RESULT_SCHEMA.shape)
|
|
176
|
+
.partial()
|
|
177
|
+
.extend({
|
|
178
|
+
phase: DELEGATION_EXIT_RECORD_RESULT_SCHEMA.shape.phase,
|
|
179
|
+
user_id: DELEGATION_EXIT_RECORD_RESULT_SCHEMA.shape.user_id,
|
|
180
|
+
has_exit: z.boolean(),
|
|
181
|
+
})
|
|
182
|
+
.strict()
|
|
183
|
+
.superRefine((result, ctx) => {
|
|
184
|
+
const parsed = DELEGATION_EXIT_RESULT_SCHEMA.safeParse(result);
|
|
185
|
+
if (!parsed.success) {
|
|
186
|
+
for (const issue of parsed.error.issues)
|
|
187
|
+
ctx.addIssue({ ...issue });
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
export const DELEGATION_EXIT_TOOL_DEFINITION = Object.freeze({
|
|
191
|
+
name: DELEGATION_EXIT_TOOL_NAME,
|
|
192
|
+
title: 'Prepare, submit, and recover an exact Base USDC exit',
|
|
193
|
+
description: `Move an authenticated CDP end user's own Base USDC only through a server-held durable reservation. prepare returns one exact EIP-1559 transaction for client-side signing; the client must never broadcast it. submit validates and durably records the signed bytes and computed hash before the server broadcasts. status is read-only and cross-device. reconcile proves a canonical receipt without broadcasting, or returns the exact finalized sender+nonce replacement proof when another transaction consumed the reserved nonce. retry_same is explicit and can broadcast only the already-stored byte-identical transaction after reconciling first. cancel is accepted only before signed bytes were recorded. The caller presents Otto's delegation secret in ${DELEGATION_AUTH_HEADER}; user identity is always derived from accessToken.`,
|
|
194
|
+
inputSchema: DELEGATED_TOOL_TRANSPORT_SCHEMA,
|
|
195
|
+
strictInputSchema: DELEGATION_EXIT_INPUT_SCHEMA,
|
|
196
|
+
outputSchema: DELEGATION_EXIT_MCP_OUTPUT_SCHEMA,
|
|
197
|
+
annotations: Object.freeze({
|
|
198
|
+
readOnlyHint: false,
|
|
199
|
+
destructiveHint: true,
|
|
200
|
+
idempotentHint: false,
|
|
201
|
+
openWorldHint: true,
|
|
202
|
+
}),
|
|
203
|
+
});
|
|
204
|
+
//# sourceMappingURL=execution-delegation-exit-definition.js.map
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { DELEGATION_EXIT_CHAIN_ID, DELEGATION_EXIT_STATES, DELEGATION_EXIT_USDC } from './execution-delegation-exit-definition.js';
|
|
2
|
+
import { type UserExecutionClaim } from './execution-journal-schema.js';
|
|
3
|
+
export { USER_EXECUTION_CLAIM_KINDS, type UserExecutionClaim, type UserExecutionClaimKind } from './execution-journal-schema.js';
|
|
4
|
+
export declare const DELEGATION_EXIT_SIGNING_LEASE_MS: number;
|
|
5
|
+
export type DelegationExitState = (typeof DELEGATION_EXIT_STATES)[number];
|
|
6
|
+
export interface DelegationExitTransaction {
|
|
7
|
+
readonly type: 'eip1559';
|
|
8
|
+
readonly chainId: typeof DELEGATION_EXIT_CHAIN_ID;
|
|
9
|
+
readonly nonce: string;
|
|
10
|
+
readonly from: string;
|
|
11
|
+
readonly to: typeof DELEGATION_EXIT_USDC;
|
|
12
|
+
readonly value: '0';
|
|
13
|
+
readonly data: `0x${string}`;
|
|
14
|
+
readonly gas: string;
|
|
15
|
+
readonly maxFeePerGas: string;
|
|
16
|
+
readonly maxPriorityFeePerGas: string;
|
|
17
|
+
readonly signIdempotencyKey: string;
|
|
18
|
+
}
|
|
19
|
+
export interface DelegationExitReceipt {
|
|
20
|
+
readonly transactionHash: string;
|
|
21
|
+
readonly blockNumber: string;
|
|
22
|
+
readonly blockHash: string;
|
|
23
|
+
readonly status: 'success' | 'reverted';
|
|
24
|
+
}
|
|
25
|
+
export interface DelegationExitReplacementProof {
|
|
26
|
+
readonly transactionHash: string;
|
|
27
|
+
readonly blockNumber: string;
|
|
28
|
+
readonly blockHash: string;
|
|
29
|
+
readonly finalizedHeadBlockNumber: string;
|
|
30
|
+
readonly finalizedHeadBlockHash: string;
|
|
31
|
+
readonly finalizedNonce: string;
|
|
32
|
+
}
|
|
33
|
+
export interface DelegationExitRecord {
|
|
34
|
+
readonly operationId: string;
|
|
35
|
+
readonly userId: string;
|
|
36
|
+
readonly state: DelegationExitState;
|
|
37
|
+
readonly epoch: number;
|
|
38
|
+
readonly account: string;
|
|
39
|
+
readonly destination: string;
|
|
40
|
+
readonly amountAtomic: string;
|
|
41
|
+
readonly createdAt: string;
|
|
42
|
+
readonly updatedAt: string;
|
|
43
|
+
readonly leaseExpiresAt?: string;
|
|
44
|
+
/** Finalized canonical block sampled before the pending nonce used by the prepared transaction. */
|
|
45
|
+
readonly searchFromBlock?: string;
|
|
46
|
+
readonly transaction?: DelegationExitTransaction;
|
|
47
|
+
readonly transactionHash?: string;
|
|
48
|
+
readonly broadcastAttempts: number;
|
|
49
|
+
readonly receipt?: DelegationExitReceipt;
|
|
50
|
+
/** Present only after the actual finalized sender+nonce replacement transaction is sealed. */
|
|
51
|
+
readonly replacement?: DelegationExitReplacementProof;
|
|
52
|
+
}
|
|
53
|
+
export interface PrivateDelegationExitRecord extends DelegationExitRecord {
|
|
54
|
+
readonly ownerTokenDigest?: string;
|
|
55
|
+
readonly signedTransaction?: `0x${string}`;
|
|
56
|
+
}
|
|
57
|
+
export type ClaimOutcome = {
|
|
58
|
+
readonly outcome: 'started' | 'existing';
|
|
59
|
+
} | {
|
|
60
|
+
readonly outcome: 'conflict';
|
|
61
|
+
readonly claim: UserExecutionClaim;
|
|
62
|
+
};
|
|
63
|
+
export type PrepareExitOutcome = {
|
|
64
|
+
readonly outcome: 'started';
|
|
65
|
+
readonly record: DelegationExitRecord;
|
|
66
|
+
} | {
|
|
67
|
+
readonly outcome: 'conflict';
|
|
68
|
+
readonly claim: UserExecutionClaim;
|
|
69
|
+
};
|
|
70
|
+
export type AcceptSignedOutcome = {
|
|
71
|
+
readonly outcome: 'accepted';
|
|
72
|
+
readonly record: PrivateDelegationExitRecord;
|
|
73
|
+
} | {
|
|
74
|
+
readonly outcome: 'already_accepted';
|
|
75
|
+
readonly record: PrivateDelegationExitRecord;
|
|
76
|
+
} | {
|
|
77
|
+
readonly outcome: 'stale_owner';
|
|
78
|
+
readonly record: DelegationExitRecord;
|
|
79
|
+
};
|
|
80
|
+
export interface DelegationExitStore {
|
|
81
|
+
readonly available: boolean;
|
|
82
|
+
readonly unavailableReason?: string;
|
|
83
|
+
claimMint(userId: string, mintKey: string, nowMs: number, claimGeneration?: number): Promise<ClaimOutcome>;
|
|
84
|
+
readClaim(userId: string): Promise<UserExecutionClaim | undefined>;
|
|
85
|
+
releaseMint(userId: string, mintKey: string, claimGeneration?: number): Promise<boolean>;
|
|
86
|
+
prepareExit(input: {
|
|
87
|
+
operationId: string;
|
|
88
|
+
userId: string;
|
|
89
|
+
account: string;
|
|
90
|
+
destination: string;
|
|
91
|
+
amountAtomic: string;
|
|
92
|
+
ownerTokenDigest: string;
|
|
93
|
+
leaseExpiresAtMs: number;
|
|
94
|
+
}, nowMs: number): Promise<PrepareExitOutcome>;
|
|
95
|
+
finishExitPreparation(userId: string, operationId: string, epoch: number, ownerTokenDigest: string, searchFromBlock: string, transaction: DelegationExitTransaction, nowMs: number): Promise<DelegationExitRecord>;
|
|
96
|
+
abandonPreparing(userId: string, operationId: string, nowMs: number): Promise<void>;
|
|
97
|
+
resumeExit(userId: string, operationId: string, ownerTokenDigest: string, leaseExpiresAtMs: number, nowMs: number): Promise<DelegationExitRecord>;
|
|
98
|
+
readExit(userId: string, operationId?: string): Promise<DelegationExitRecord | undefined>;
|
|
99
|
+
readPrivateExit(userId: string, operationId: string): Promise<PrivateDelegationExitRecord | undefined>;
|
|
100
|
+
acceptSigned(userId: string, operationId: string, epoch: number, ownerTokenDigest: string, signedTransaction: `0x${string}`, transactionHash: string, nowMs: number): Promise<AcceptSignedOutcome>;
|
|
101
|
+
beginBroadcast(userId: string, operationId: string, nowMs: number): Promise<PrivateDelegationExitRecord>;
|
|
102
|
+
markBroadcastSubmitted(userId: string, operationId: string, transactionHash: string, nowMs: number): Promise<DelegationExitRecord>;
|
|
103
|
+
markReceipt(userId: string, operationId: string, receipt: DelegationExitReceipt, nowMs: number): Promise<DelegationExitRecord>;
|
|
104
|
+
markReplaced(userId: string, operationId: string, proof: DelegationExitReplacementProof, nowMs: number): Promise<DelegationExitRecord>;
|
|
105
|
+
cancelExit(userId: string, operationId: string, epoch: number, ownerTokenDigest: string, nowMs: number): Promise<DelegationExitRecord>;
|
|
106
|
+
close?(): void;
|
|
107
|
+
}
|
|
108
|
+
export declare class CorruptDelegationExitError extends Error {
|
|
109
|
+
constructor(where: string);
|
|
110
|
+
}
|
|
111
|
+
export declare function delegationExitOwnerTokenDigest(ownerToken: string): string;
|
|
112
|
+
export declare function unavailableDelegationExitStore(reason: string): DelegationExitStore;
|
|
113
|
+
export declare function openDelegationExitStore(root: string): Promise<DelegationExitStore>;
|
|
114
|
+
export declare function createDelegationExitStore(env?: NodeJS.ProcessEnv): Promise<DelegationExitStore>;
|