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,296 @@
|
|
|
1
|
+
import { LP_USEROP_ACTIVATIONS, LP_USEROP_ACTIVATION_SCHEMA } from './lp-userop-definition.js';
|
|
2
|
+
import { assertNativeLpCollectPolicyRelation } from './account-userop-policy-relation.js';
|
|
3
|
+
/** Fresh native UserOp authority. This module has no signer, provider POST or operation journal. */
|
|
4
|
+
import { getAddress } from 'viem';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { freezeHybridValue, getHybridYieldMarket, hybridYieldCommitment } from './hybrid-yield-markets.js';
|
|
7
|
+
import { compileNativeYieldEndUserOperationPolicy } from './native-yield-userop-policy.js';
|
|
8
|
+
import { policyRulesDigest } from './execution-policy-compatibility.js';
|
|
9
|
+
import { SPONSORED_ACCOUNT_ACTIVATIONS, SPONSORED_ACTIVATION_SCHEMA, sponsoredChainTerms, sponsoredDigest } from './execution-sponsored-definition.js';
|
|
10
|
+
import { NATIVE_ACCOUNT_AUTHORITY_SCHEMA, NATIVE_ACCOUNT_RULESET, NATIVE_ACCOUNT_SCOPES, NATIVE_YIELD_ACCOUNT_ACTIVATIONS } from './native-yield-account-definition.js';
|
|
11
|
+
import { assertNativeDepositWithinOwnerUsdCap, deriveExactApprovedNativeMarketLimits, resolveNativeYieldAccountActivation } from './native-yield-account-policy.js';
|
|
12
|
+
import { assertCurrentNativeYieldConsent, confirmNativeYieldConsent, createNativeYieldConsent, readConfirmedNativeYieldConsent } from './native-yield-consent-store.js';
|
|
13
|
+
import { NATIVE_YIELD_STATE_MAX_AGE_MS, PREPARE_NATIVE_YIELD_INPUT_SCHEMA, refuseNative } from './native-yield-definition.js';
|
|
14
|
+
import { resolveNativeYieldMarket } from './native-yield.js';
|
|
15
|
+
import { NATIVE_YIELD_USEROP_CONSENT_TTL_MS, NATIVE_YIELD_USEROP_RULESET, NATIVE_YIELD_USEROP_TERMS_SCHEMA } from './native-yield-userop-definition.js';
|
|
16
|
+
import { assertNativeYieldUserOpAccountState } from './native-yield-userop.js';
|
|
17
|
+
const digest = z.string().regex(/^[0-9a-f]{64}$/).refine(value => !/^0+$/.test(value));
|
|
18
|
+
const commitment = z.string().regex(/^sha256:[0-9a-f]{64}$/);
|
|
19
|
+
const address = z.string().regex(/^0x[0-9a-fA-F]{40}$/).transform(value => getAddress(value));
|
|
20
|
+
const codeHash = z.string().regex(/^0x[0-9a-fA-F]{64}$/);
|
|
21
|
+
const RELATION_SCHEMA = z.object({
|
|
22
|
+
nativeActivationCommitment: commitment, nativeRulesDigest: digest, compiledFullPolicyDigest: digest,
|
|
23
|
+
relationReviewEvidenceDigest: digest, compiler: z.literal('legacy-v2-native-enduser-userop-v1'),
|
|
24
|
+
}).strict();
|
|
25
|
+
const PROFILE_SCHEMA = z.object({
|
|
26
|
+
implementation: address, implementationCodeHash: codeHash,
|
|
27
|
+
delegateBatchAbi: z.literal('coinbase-executeBatch-v1'), delegateBatchReviewDigest: digest,
|
|
28
|
+
entryPointVersion: z.literal('0.6'), ownerProfile: z.object({
|
|
29
|
+
kind: z.literal('sole-eoa-owner'), nextOwnerIndex: z.literal('1'), ownerCount: z.literal('1'),
|
|
30
|
+
requireAccountAsOwner: z.literal(true), spendPermissionsEnabled: z.literal(false),
|
|
31
|
+
}).strict(),
|
|
32
|
+
}).strict();
|
|
33
|
+
export { compileNativeYieldEndUserOperationPolicy } from './native-yield-userop-policy.js';
|
|
34
|
+
const CONSENT_REF_SCHEMA = z.object({
|
|
35
|
+
consentId: z.string().regex(/^nc_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/),
|
|
36
|
+
generation: z.number().int().positive().safe(), consentCommitment: commitment,
|
|
37
|
+
}).strict();
|
|
38
|
+
export const NATIVE_YIELD_USEROP_REVIEW_RECORD_SCHEMA = z.object({ input: PREPARE_NATIVE_YIELD_INPUT_SCHEMA,
|
|
39
|
+
terms: NATIVE_YIELD_USEROP_TERMS_SCHEMA, consent: CONSENT_REF_SCHEMA }).strict();
|
|
40
|
+
const brand = Symbol('native-userop-authority');
|
|
41
|
+
function ensure(value, code) {
|
|
42
|
+
if (!value)
|
|
43
|
+
refuseNative(code, 'Current owner, native consent, protocol scope and sponsorship authority must agree');
|
|
44
|
+
}
|
|
45
|
+
function equal(left, right) { return hybridYieldCommitment(left) === hybridYieldCommitment(right); }
|
|
46
|
+
function sourceIdentity(source) {
|
|
47
|
+
return { nativeActivation: source.nativeActivation, sponsorActivation: source.sponsorActivation,
|
|
48
|
+
chainTerms: source.chainTerms, profile: source.profile, relation: source.relation };
|
|
49
|
+
}
|
|
50
|
+
function consentRef(consent) {
|
|
51
|
+
return { consentId: consent.consentId, generation: consent.generation, consentCommitment: consent.consentCommitment };
|
|
52
|
+
}
|
|
53
|
+
export class NativeYieldUserOpAuthorityIssuer {
|
|
54
|
+
native;
|
|
55
|
+
sponsor;
|
|
56
|
+
db;
|
|
57
|
+
issued = new WeakMap();
|
|
58
|
+
minted = new WeakSet();
|
|
59
|
+
nativeActivations;
|
|
60
|
+
sponsorActivations;
|
|
61
|
+
lpActivations;
|
|
62
|
+
constructor(native, sponsor, db,
|
|
63
|
+
/** Internal source fixtures only. The production constructor uses the two empty reviewed arrays. */
|
|
64
|
+
fixtures) {
|
|
65
|
+
this.native = native;
|
|
66
|
+
this.sponsor = sponsor;
|
|
67
|
+
this.db = db;
|
|
68
|
+
this.nativeActivations = fixtures?.nativeActivations ?? NATIVE_YIELD_ACCOUNT_ACTIVATIONS;
|
|
69
|
+
this.sponsorActivations = fixtures?.sponsoredActivations ?? SPONSORED_ACCOUNT_ACTIVATIONS;
|
|
70
|
+
this.lpActivations = fixtures?.lpActivations ?? LP_USEROP_ACTIVATIONS;
|
|
71
|
+
}
|
|
72
|
+
now() {
|
|
73
|
+
const now = this.sponsor.now();
|
|
74
|
+
ensure(Number.isSafeInteger(now) && now > 0, 'NATIVE_USEROP_CLOCK');
|
|
75
|
+
return now;
|
|
76
|
+
}
|
|
77
|
+
sources(input) {
|
|
78
|
+
const market = resolveNativeYieldMarket(input), chainId = market.chainId;
|
|
79
|
+
ensure(this.nativeActivations.length === 1, 'NATIVE_USEROP_NATIVE_ACTIVATION_REQUIRED');
|
|
80
|
+
const nativeActivation = resolveNativeYieldAccountActivation(chainId, this.nativeActivations);
|
|
81
|
+
const limits = deriveExactApprovedNativeMarketLimits(nativeActivation, { chainId,
|
|
82
|
+
marketId: input.marketId, registryCommitment: input.registryCommitment, action: input.action });
|
|
83
|
+
// The shared sponsored rail admits one activation globally, not one per requested chain.
|
|
84
|
+
ensure(this.sponsorActivations.length === 1, 'NATIVE_USEROP_SPONSOR_ACTIVATION_REQUIRED');
|
|
85
|
+
const sponsorActivation = SPONSORED_ACTIVATION_SCHEMA.parse(this.sponsorActivations[0]);
|
|
86
|
+
ensure(sponsorActivation.chains.some(chain => chain.chainId === chainId), 'NATIVE_USEROP_SPONSOR_CHAIN_REQUIRED');
|
|
87
|
+
const chainTerms = sponsoredChainTerms(sponsorActivation, chainId);
|
|
88
|
+
const profile = PROFILE_SCHEMA.parse(chainTerms.nativeYieldUserOpProfile);
|
|
89
|
+
const relation = RELATION_SCHEMA.parse(sponsorActivation.nativeYieldUserOpPolicyRelation);
|
|
90
|
+
const compiled = compileNativeYieldEndUserOperationPolicy(nativeActivation);
|
|
91
|
+
ensure(sponsorActivation.mode === 'enabled' &&
|
|
92
|
+
sponsorActivation.projectId === this.sponsor.projectId && sponsorActivation.approvedAtMs <= this.now() &&
|
|
93
|
+
sponsorActivation.expiresAtMs > this.now() && sponsorActivation.policyId === nativeActivation.policyId &&
|
|
94
|
+
sponsorActivation.policyName === nativeActivation.policyName &&
|
|
95
|
+
relation.compiler === compiled.compiler && relation.nativeActivationCommitment === compiled.nativeActivationCommitment &&
|
|
96
|
+
relation.nativeRulesDigest === compiled.nativeRulesDigest &&
|
|
97
|
+
relation.compiledFullPolicyDigest === compiled.compiledFullPolicyDigest, 'NATIVE_USEROP_POLICY_RELATION');
|
|
98
|
+
if (sponsorActivation.lpUserOpPolicyRelation) {
|
|
99
|
+
ensure(this.lpActivations.length === 1, 'NATIVE_USEROP_LP_ACTIVATION_REQUIRED');
|
|
100
|
+
const lp = LP_USEROP_ACTIVATION_SCHEMA.parse(this.lpActivations[0]);
|
|
101
|
+
ensure(lp.approvedAtMs <= this.now() && lp.expiresAtMs > this.now(), 'NATIVE_USEROP_LP_ACTIVATION_EXPIRED');
|
|
102
|
+
assertNativeLpCollectPolicyRelation(nativeActivation, sponsorActivation, lp);
|
|
103
|
+
}
|
|
104
|
+
else
|
|
105
|
+
ensure(sponsorActivation.policyRulesDigest === compiled.compiledFullPolicyDigest, 'NATIVE_USEROP_POLICY_RELATION');
|
|
106
|
+
return freezeHybridValue({ nativeActivation, sponsorActivation, chainTerms, profile, relation, limits });
|
|
107
|
+
}
|
|
108
|
+
consentAuthority(source, sponsor) {
|
|
109
|
+
const activation = source.nativeActivation;
|
|
110
|
+
return freezeHybridValue(NATIVE_ACCOUNT_AUTHORITY_SCHEMA.parse({ userId: sponsor.userId, account: sponsor.account,
|
|
111
|
+
mintKey: sponsor.mintKey, grantExpiresAt: sponsor.grantExpiresAt, revokeGeneration: sponsor.revokeGeneration,
|
|
112
|
+
capRulesetVersion: sponsor.capVersion, perSwapCapUsd: sponsor.perSwapCapUsd,
|
|
113
|
+
policyId: source.sponsorActivation.policyId, policyName: source.sponsorActivation.policyName,
|
|
114
|
+
policyDigest: source.sponsorActivation.policyRulesDigest, legacyRulesDigest: activation.legacyRulesDigest,
|
|
115
|
+
nativeRulesDigest: activation.nativeRulesDigest, activationCommitment: source.relation.nativeActivationCommitment,
|
|
116
|
+
scopeCommitment: hybridYieldCommitment({ domain: 'native-yield-enduser-userop-scope-v1',
|
|
117
|
+
ruleset: NATIVE_YIELD_USEROP_RULESET, scopes: NATIVE_ACCOUNT_SCOPES,
|
|
118
|
+
nativeActivationCommitment: source.relation.nativeActivationCommitment,
|
|
119
|
+
sponsoredActivationDigest: sponsoredDigest(source.sponsorActivation),
|
|
120
|
+
relation: source.relation, chainTerms: source.chainTerms }),
|
|
121
|
+
ruleset: NATIVE_ACCOUNT_RULESET, scopes: [...NATIVE_ACCOUNT_SCOPES] }));
|
|
122
|
+
}
|
|
123
|
+
assertValuation(input, facts) {
|
|
124
|
+
// A private valuation input, never returned or passed to an EOA sender. The old helper binds its
|
|
125
|
+
// limits to the original native manifest; actual current policy authority stays the full UserOp policy.
|
|
126
|
+
const valuationOnly = { ...facts.nativeAuthority, policyDigest: facts.nativeActivation.policyDigest };
|
|
127
|
+
const value = assertNativeDepositWithinOwnerUsdCap({ amountAtomic: BigInt(input.amount), authority: valuationOnly,
|
|
128
|
+
limits: facts.limits, priceObservation: facts.price, nowMs: this.now() });
|
|
129
|
+
ensure(value.valuedUsdCents === undefined ||
|
|
130
|
+
value.valuedUsdCents <= BigInt(facts.sponsorActivation.maxSwapUsdc) * 100n, 'NATIVE_USEROP_ABOVE_SPONSOR_CAP');
|
|
131
|
+
}
|
|
132
|
+
window(facts, prior) {
|
|
133
|
+
const consentCreatedAtMs = prior?.consentCreatedAtMs ?? this.now();
|
|
134
|
+
const consentExpiresAtMs = Math.min(consentCreatedAtMs + NATIVE_YIELD_USEROP_CONSENT_TTL_MS, facts.sponsorActivation.expiresAtMs, Date.parse(facts.nativeAuthority.grantExpiresAt), Date.parse(facts.sponsorAuthority.grantExpiresAt));
|
|
135
|
+
ensure(consentCreatedAtMs <= this.now() && this.now() < consentExpiresAtMs &&
|
|
136
|
+
(!prior || prior.consentExpiresAtMs === consentExpiresAtMs), 'NATIVE_USEROP_AUTHORITY_EXPIRED');
|
|
137
|
+
return { consentCreatedAtMs, consentExpiresAtMs };
|
|
138
|
+
}
|
|
139
|
+
derivedTerms(input, facts, window, consent) {
|
|
140
|
+
const { sponsorActivation: activation, chainTerms: chain, profile } = facts;
|
|
141
|
+
return freezeHybridValue(NATIVE_YIELD_USEROP_TERMS_SCHEMA.parse({
|
|
142
|
+
version: 1, ruleset: NATIVE_YIELD_USEROP_RULESET, userId: facts.nativeAuthority.userId,
|
|
143
|
+
account: facts.nativeAuthority.account, chainId: input.accountProfile.chainId,
|
|
144
|
+
authorityDigest: sponsoredDigest({ domain: 'native-yield-userop-current-authority-v1',
|
|
145
|
+
nativeAuthority: facts.nativeAuthority, sponsorAuthority: facts.sponsorAuthority,
|
|
146
|
+
consent: consent ? consentRef(consent) : null, intentCommitment: hybridYieldCommitment(input), ...window }),
|
|
147
|
+
nativeActivationCommitment: facts.relation.nativeActivationCommitment,
|
|
148
|
+
sponsoredActivationId: activation.id, sponsoredActivationDigest: sponsoredDigest(activation),
|
|
149
|
+
projectId: activation.projectId, policyId: activation.policyId, policyRulesDigest: activation.policyRulesDigest,
|
|
150
|
+
providerEnforcementEvidenceDigest: activation.providerEnforcementEvidenceDigest,
|
|
151
|
+
providerEndpoint: 'cdp-end-user-smart-account-send-v1', deployment: facts.limits.deployment,
|
|
152
|
+
delegate: chain.delegate, delegateCodeHash: chain.delegateCodeHash,
|
|
153
|
+
implementation: profile.implementation, implementationCodeHash: profile.implementationCodeHash,
|
|
154
|
+
delegateBatchAbi: profile.delegateBatchAbi, delegateBatchReviewDigest: profile.delegateBatchReviewDigest,
|
|
155
|
+
entryPoint: chain.entryPoint, entryPointCodeHash: chain.entryPointCodeHash,
|
|
156
|
+
entryPointVersion: profile.entryPointVersion, ownerProfile: { kind: 'sole-eoa-owner', nextOwnerIndex: '1',
|
|
157
|
+
ownerCount: '1', ownerAtIndex0: '0x' + '0'.repeat(24) + facts.nativeAuthority.account.slice(2).toLowerCase(),
|
|
158
|
+
spendPermissionsEnabled: false },
|
|
159
|
+
paymaster: chain.paymaster, paymasterCodeHash: chain.paymasterCodeHash,
|
|
160
|
+
sponsorshipPolicyId: chain.sponsorshipPolicyId, maxGasCostWei: chain.maxGasCostWei,
|
|
161
|
+
maxUserGasCostWei: chain.maxUserGasCostWei, maxTotalGasCostWei: chain.maxTotalGasCostWei,
|
|
162
|
+
maximumInputAtomic: facts.limits.maximumInputAtomic.toString(), intentCommitment: hybridYieldCommitment(input),
|
|
163
|
+
...window, initialInputAllowance: '0', initialProtocolAllowance: '0',
|
|
164
|
+
execution: 'atomic-approve-reset-approve-execute'
|
|
165
|
+
}));
|
|
166
|
+
}
|
|
167
|
+
async facts(accessToken, input) {
|
|
168
|
+
const source = this.sources(input), market = source.limits.market, account = getAddress(input.accountProfile.address);
|
|
169
|
+
const output = input.action === 'deposit' ? market.position.tokenAddress : market.asset.address;
|
|
170
|
+
const sponsorAuthority = await this.sponsor.authority(accessToken, account, market.chainId, source.sponsorActivation, getAddress(output), 'native-yield-userop');
|
|
171
|
+
const nativeAuthority = this.consentAuthority(source, sponsorAuthority);
|
|
172
|
+
const facts = { ...source, sponsorAuthority, nativeAuthority, price: await this.native.price(source.limits) };
|
|
173
|
+
this.assertValuation(input, facts);
|
|
174
|
+
// The profile-only check mints no consent or authority; these provisional terms never escape.
|
|
175
|
+
const proofTerms = this.derivedTerms(input, facts, this.window(facts));
|
|
176
|
+
const client = this.sponsor.client(market.chainId), block = await client.getBlock({ blockTag: 'latest' });
|
|
177
|
+
const timestampMs = Number(block.timestamp) * 1000;
|
|
178
|
+
ensure(block.number !== null && block.hash && Number.isSafeInteger(timestampMs) && timestampMs > 0 &&
|
|
179
|
+
timestampMs <= this.now() + 5000 && this.now() - timestampMs <= NATIVE_YIELD_STATE_MAX_AGE_MS, 'NATIVE_USEROP_ACCOUNT_ANCHOR');
|
|
180
|
+
await assertNativeYieldUserOpAccountState(client, proofTerms, block.number, block.hash);
|
|
181
|
+
const [who, grant, policies] = await Promise.all([
|
|
182
|
+
this.sponsor.identity(accessToken, account),
|
|
183
|
+
this.sponsor.cdp.endUser.getDelegationForEndUserAccount({ userId: nativeAuthority.userId, address: account }),
|
|
184
|
+
this.sponsor.cdp.policies.listPolicies({ scope: 'project' }),
|
|
185
|
+
this.native.assertCurrentSession(accessToken, nativeAuthority),
|
|
186
|
+
]);
|
|
187
|
+
const smart = (who.current.evmSmartAccountObjects ?? []).filter(value => getAddress(value.address) === account);
|
|
188
|
+
const project = (policies.policies ?? []).filter(value => value.scope === 'project');
|
|
189
|
+
ensure(who.userId === nativeAuthority.userId && smart.length === 1 && smart[0].ownerAddresses.length === 1 &&
|
|
190
|
+
getAddress(smart[0].ownerAddresses[0]) === account && Date.parse(grant.expiresAt) === Date.parse(nativeAuthority.grantExpiresAt) &&
|
|
191
|
+
Date.parse(grant.expiresAt) > this.now() && project.length === 1 && project[0].id === source.sponsorActivation.policyId &&
|
|
192
|
+
project[0].description === source.sponsorActivation.policyName &&
|
|
193
|
+
policyRulesDigest(project[0].rules) === source.sponsorActivation.policyRulesDigest, 'NATIVE_USEROP_CURRENT_AUTHORITY_CHANGED');
|
|
194
|
+
await this.sponsor.assertCurrentCap(sponsorAuthority);
|
|
195
|
+
ensure(equal(sourceIdentity(this.sources(input)), sourceIdentity(source)), 'NATIVE_USEROP_SOURCE_CHANGED');
|
|
196
|
+
this.assertValuation(input, facts);
|
|
197
|
+
return freezeHybridValue(facts);
|
|
198
|
+
}
|
|
199
|
+
/** Fresh source-scope projection for human consent review, before an operation authority exists. */
|
|
200
|
+
async reviewConsent(accessToken, rawInput) {
|
|
201
|
+
const input = PREPARE_NATIVE_YIELD_INPUT_SCHEMA.parse(rawInput), facts = await this.facts(accessToken, input);
|
|
202
|
+
const marketLimits = facts.nativeActivation.marketRules.flatMap(rule => {
|
|
203
|
+
const market = getHybridYieldMarket(rule.marketId);
|
|
204
|
+
if (market.chainId !== input.accountProfile.chainId ||
|
|
205
|
+
(facts.nativeActivation.mode === 'recovery-only' && rule.action === 'deposit'))
|
|
206
|
+
return [];
|
|
207
|
+
return [{ marketId: rule.marketId, action: rule.action,
|
|
208
|
+
inputToken: rule.action === 'deposit' ? market.asset.address : market.position.tokenAddress,
|
|
209
|
+
maximumInputAtomic: rule.maximumInputAtomic }];
|
|
210
|
+
});
|
|
211
|
+
const scope = freezeHybridValue({ account: facts.nativeAuthority.account, chainId: input.accountProfile.chainId,
|
|
212
|
+
scopes: [...NATIVE_ACCOUNT_SCOPES], marketLimits,
|
|
213
|
+
perDepositCapUsd: Math.min(facts.nativeAuthority.perSwapCapUsd, facts.sponsorActivation.maxSwapUsdc),
|
|
214
|
+
maximumGasCostWei: facts.chainTerms.maxGasCostWei, maximumUserGasCostWei: facts.chainTerms.maxUserGasCostWei,
|
|
215
|
+
maximumActivationGasCostWei: facts.chainTerms.maxTotalGasCostWei,
|
|
216
|
+
expiresAtMs: Math.min(Date.parse(facts.nativeAuthority.grantExpiresAt), facts.sponsorActivation.expiresAtMs),
|
|
217
|
+
requiresSeparateOperationReview: true });
|
|
218
|
+
const consent = createNativeYieldConsent(this.db, facts.nativeAuthority, this.now());
|
|
219
|
+
return { consent, scope };
|
|
220
|
+
}
|
|
221
|
+
async createConsent(accessToken, rawInput) {
|
|
222
|
+
return (await this.reviewConsent(accessToken, rawInput)).consent;
|
|
223
|
+
}
|
|
224
|
+
async confirmConsent(accessToken, rawInput, confirmation) {
|
|
225
|
+
const input = PREPARE_NATIVE_YIELD_INPUT_SCHEMA.parse(rawInput), facts = await this.facts(accessToken, input);
|
|
226
|
+
return confirmNativeYieldConsent(this.db, { ...confirmation, userId: facts.nativeAuthority.userId }, facts.nativeAuthority, this.now());
|
|
227
|
+
}
|
|
228
|
+
async issue(accessToken, rawInput, previous) {
|
|
229
|
+
const input = freezeHybridValue(PREPARE_NATIVE_YIELD_INPUT_SCHEMA.parse(rawInput));
|
|
230
|
+
const facts = await this.facts(accessToken, input);
|
|
231
|
+
const consent = readConfirmedNativeYieldConsent(this.db, facts.nativeAuthority.userId, facts.nativeAuthority.account, this.now());
|
|
232
|
+
ensure(consent, 'NATIVE_USEROP_NATIVE_CONSENT_REQUIRED');
|
|
233
|
+
const terms = this.derivedTerms(input, facts, this.window(facts, previous?.terms), consent);
|
|
234
|
+
const review = freezeHybridValue(NATIVE_YIELD_USEROP_REVIEW_RECORD_SCHEMA.parse({ input, terms, consent: consentRef(consent) }));
|
|
235
|
+
ensure(!previous || equal(review, previous), 'NATIVE_USEROP_REVIEW_AUTHORITY_CHANGED');
|
|
236
|
+
const token = Object.freeze({ [brand]: true });
|
|
237
|
+
// Last synchronous authority read, including when the caller already stamped its shared journal.
|
|
238
|
+
assertCurrentNativeYieldConsent(this.db, consent, facts.nativeAuthority, this.now());
|
|
239
|
+
this.minted.add(token);
|
|
240
|
+
this.issued.set(token, { facts, consent, review });
|
|
241
|
+
return token;
|
|
242
|
+
}
|
|
243
|
+
mint(accessToken, rawInput) {
|
|
244
|
+
return this.issue(accessToken, rawInput);
|
|
245
|
+
}
|
|
246
|
+
read(authority) {
|
|
247
|
+
ensure(authority && this.minted.has(authority), 'NATIVE_USEROP_OPAQUE_AUTHORITY_REQUIRED');
|
|
248
|
+
const issued = this.issued.get(authority);
|
|
249
|
+
ensure(issued, 'NATIVE_USEROP_OPAQUE_AUTHORITY_REQUIRED');
|
|
250
|
+
return issued;
|
|
251
|
+
}
|
|
252
|
+
/** Re-read after the shared journal stamp and after transport auth, immediately before POST. */
|
|
253
|
+
async refresh(accessToken, authority) {
|
|
254
|
+
const previous = this.read(authority).review;
|
|
255
|
+
return this.issue(accessToken, previous.input, previous);
|
|
256
|
+
}
|
|
257
|
+
/** Internal journal recovery only. Never route raw MCP terms into this method. */
|
|
258
|
+
async restoreFromTrustedReview(accessToken, rawStoredReview) {
|
|
259
|
+
const review = NATIVE_YIELD_USEROP_REVIEW_RECORD_SCHEMA.parse(rawStoredReview);
|
|
260
|
+
return this.issue(accessToken, review.input, review);
|
|
261
|
+
}
|
|
262
|
+
/** Must also run synchronously inside/after the caller's shared-journal stamp; performs no await. */
|
|
263
|
+
assertConsent(authority) {
|
|
264
|
+
const issued = this.read(authority), { facts, consent, review } = issued;
|
|
265
|
+
this.window(facts, review.terms);
|
|
266
|
+
ensure(equal(sourceIdentity(this.sources(review.input)), sourceIdentity(facts)), 'NATIVE_USEROP_SOURCE_CHANGED');
|
|
267
|
+
this.assertValuation(review.input, facts);
|
|
268
|
+
assertCurrentNativeYieldConsent(this.db, consent, facts.nativeAuthority, this.now());
|
|
269
|
+
}
|
|
270
|
+
/** Hold the current cap writer lock through the synchronous provider request invocation. */
|
|
271
|
+
withCurrentCap(authority, start) {
|
|
272
|
+
this.assertConsent(authority);
|
|
273
|
+
return this.sponsor.withCurrentCap(this.read(authority).facts.sponsorAuthority, () => {
|
|
274
|
+
// Waiting for the cap writer lock must not outlive the reviewed authority or price observation.
|
|
275
|
+
this.assertConsent(authority);
|
|
276
|
+
return start();
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
terms(authority) {
|
|
280
|
+
this.assertConsent(authority);
|
|
281
|
+
return this.read(authority).review.terms;
|
|
282
|
+
}
|
|
283
|
+
reviewRecord(authority) {
|
|
284
|
+
this.assertConsent(authority);
|
|
285
|
+
return this.read(authority).review;
|
|
286
|
+
}
|
|
287
|
+
sponsorship(authority) {
|
|
288
|
+
this.assertConsent(authority);
|
|
289
|
+
return this.read(authority).facts.sponsorAuthority;
|
|
290
|
+
}
|
|
291
|
+
activation(authority) {
|
|
292
|
+
this.assertConsent(authority);
|
|
293
|
+
return this.read(authority).facts.sponsorActivation;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
//# sourceMappingURL=native-yield-userop-authority.js.map
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const NATIVE_YIELD_USEROP_RULESET: "native-yield-userop-v1";
|
|
3
|
+
export declare const NATIVE_YIELD_USEROP_CONFIRMATION: "I reviewed this native yield action and sponsored atomic batch";
|
|
4
|
+
export declare const NATIVE_YIELD_USEROP_ACCOUNT_GAS_CONFIRMATION: "I reviewed this native yield action and account-paid atomic batch";
|
|
5
|
+
export declare const NATIVE_YIELD_USEROP_CONSENT_TTL_MS: number;
|
|
6
|
+
/** First reviewed contract family only. A new proxy/implementation/profile requires a separate source review. */
|
|
7
|
+
export declare const NATIVE_YIELD_USEROP_PROXY: `0x${string}`;
|
|
8
|
+
export declare const NATIVE_YIELD_USEROP_IMPLEMENTATION: `0x${string}`;
|
|
9
|
+
export declare const NATIVE_YIELD_USEROP_ENTRY_POINT: `0x${string}`;
|
|
10
|
+
export declare const NATIVE_YIELD_USEROP_IMPLEMENTATION_SLOT: `0x${string}`;
|
|
11
|
+
export declare const NATIVE_YIELD_USEROP_ACCOUNT_ABI: readonly [{
|
|
12
|
+
readonly name: "nextOwnerIndex";
|
|
13
|
+
readonly type: "function";
|
|
14
|
+
readonly stateMutability: "view";
|
|
15
|
+
readonly inputs: readonly [];
|
|
16
|
+
readonly outputs: readonly [{
|
|
17
|
+
readonly type: "uint256";
|
|
18
|
+
}];
|
|
19
|
+
}, {
|
|
20
|
+
readonly name: "ownerCount";
|
|
21
|
+
readonly type: "function";
|
|
22
|
+
readonly stateMutability: "view";
|
|
23
|
+
readonly inputs: readonly [];
|
|
24
|
+
readonly outputs: readonly [{
|
|
25
|
+
readonly type: "uint256";
|
|
26
|
+
}];
|
|
27
|
+
}, {
|
|
28
|
+
readonly name: "ownerAtIndex";
|
|
29
|
+
readonly type: "function";
|
|
30
|
+
readonly stateMutability: "view";
|
|
31
|
+
readonly inputs: readonly [{
|
|
32
|
+
readonly type: "uint256";
|
|
33
|
+
readonly name: "index";
|
|
34
|
+
}];
|
|
35
|
+
readonly outputs: readonly [{
|
|
36
|
+
readonly type: "bytes";
|
|
37
|
+
}];
|
|
38
|
+
}, {
|
|
39
|
+
readonly name: "isOwnerAddress";
|
|
40
|
+
readonly type: "function";
|
|
41
|
+
readonly stateMutability: "view";
|
|
42
|
+
readonly inputs: readonly [{
|
|
43
|
+
readonly type: "address";
|
|
44
|
+
readonly name: "account";
|
|
45
|
+
}];
|
|
46
|
+
readonly outputs: readonly [{
|
|
47
|
+
readonly type: "bool";
|
|
48
|
+
}];
|
|
49
|
+
}, {
|
|
50
|
+
readonly name: "entryPoint";
|
|
51
|
+
readonly type: "function";
|
|
52
|
+
readonly stateMutability: "view";
|
|
53
|
+
readonly inputs: readonly [];
|
|
54
|
+
readonly outputs: readonly [{
|
|
55
|
+
readonly type: "address";
|
|
56
|
+
}];
|
|
57
|
+
}];
|
|
58
|
+
/** Supported only when exact delegate bytecode and atomic semantics have been independently reviewed. */
|
|
59
|
+
export declare const NATIVE_YIELD_USEROP_BATCH_ABI: readonly [{
|
|
60
|
+
readonly name: "executeBatch";
|
|
61
|
+
readonly type: "function";
|
|
62
|
+
readonly stateMutability: "nonpayable";
|
|
63
|
+
readonly inputs: readonly [{
|
|
64
|
+
readonly type: "tuple[]";
|
|
65
|
+
readonly components: readonly [{
|
|
66
|
+
readonly type: "address";
|
|
67
|
+
readonly name: "target";
|
|
68
|
+
}, {
|
|
69
|
+
readonly type: "uint256";
|
|
70
|
+
readonly name: "value";
|
|
71
|
+
}, {
|
|
72
|
+
readonly type: "bytes";
|
|
73
|
+
readonly name: "data";
|
|
74
|
+
}];
|
|
75
|
+
readonly name: "calls";
|
|
76
|
+
}];
|
|
77
|
+
readonly outputs: readonly [];
|
|
78
|
+
}];
|
|
79
|
+
export declare const NATIVE_YIELD_USEROP_TERMS_SCHEMA: z.ZodObject<{
|
|
80
|
+
version: z.ZodLiteral<1>;
|
|
81
|
+
ruleset: z.ZodLiteral<"native-yield-userop-v1">;
|
|
82
|
+
userId: z.ZodString;
|
|
83
|
+
account: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
84
|
+
chainId: z.ZodUnion<readonly [z.ZodLiteral<8453>, z.ZodLiteral<42161>]>;
|
|
85
|
+
authorityDigest: z.ZodString;
|
|
86
|
+
nativeActivationCommitment: z.ZodString;
|
|
87
|
+
sponsoredActivationId: z.ZodString;
|
|
88
|
+
sponsoredActivationDigest: z.ZodString;
|
|
89
|
+
projectId: z.ZodString;
|
|
90
|
+
policyId: z.ZodString;
|
|
91
|
+
policyRulesDigest: z.ZodString;
|
|
92
|
+
providerEnforcementEvidenceDigest: z.ZodString;
|
|
93
|
+
providerEndpoint: z.ZodLiteral<"cdp-end-user-smart-account-send-v1">;
|
|
94
|
+
deployment: z.ZodObject<{
|
|
95
|
+
chainId: z.ZodUnion<readonly [z.ZodLiteral<8453>, z.ZodLiteral<42161>]>;
|
|
96
|
+
address: z.ZodString;
|
|
97
|
+
runtimeCodeHash: z.ZodString;
|
|
98
|
+
version: z.ZodLiteral<"native-yield-router-v1">;
|
|
99
|
+
reviewId: z.ZodString;
|
|
100
|
+
}, z.core.$strict>;
|
|
101
|
+
delegate: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
102
|
+
delegateCodeHash: z.ZodString;
|
|
103
|
+
implementation: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
104
|
+
implementationCodeHash: z.ZodString;
|
|
105
|
+
delegateBatchAbi: z.ZodLiteral<"coinbase-executeBatch-v1">;
|
|
106
|
+
delegateBatchReviewDigest: z.ZodString;
|
|
107
|
+
entryPoint: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
108
|
+
entryPointCodeHash: z.ZodString;
|
|
109
|
+
entryPointVersion: z.ZodLiteral<"0.6">;
|
|
110
|
+
ownerProfile: z.ZodObject<{
|
|
111
|
+
kind: z.ZodLiteral<"sole-eoa-owner">;
|
|
112
|
+
nextOwnerIndex: z.ZodLiteral<"1">;
|
|
113
|
+
ownerCount: z.ZodLiteral<"1">;
|
|
114
|
+
ownerAtIndex0: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
115
|
+
spendPermissionsEnabled: z.ZodLiteral<false>;
|
|
116
|
+
}, z.core.$strict>;
|
|
117
|
+
paymaster: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
118
|
+
paymasterCodeHash: z.ZodString;
|
|
119
|
+
sponsorshipPolicyId: z.ZodString;
|
|
120
|
+
maxGasCostWei: z.ZodString;
|
|
121
|
+
maxUserGasCostWei: z.ZodString;
|
|
122
|
+
maxTotalGasCostWei: z.ZodString;
|
|
123
|
+
maximumInputAtomic: z.ZodString;
|
|
124
|
+
intentCommitment: z.ZodString;
|
|
125
|
+
consentCreatedAtMs: z.ZodNumber;
|
|
126
|
+
consentExpiresAtMs: z.ZodNumber;
|
|
127
|
+
initialInputAllowance: z.ZodLiteral<"0">;
|
|
128
|
+
initialProtocolAllowance: z.ZodLiteral<"0">;
|
|
129
|
+
execution: z.ZodLiteral<"atomic-approve-reset-approve-execute">;
|
|
130
|
+
}, z.core.$strict>;
|
|
131
|
+
export type NativeYieldUserOpTerms = z.infer<typeof NATIVE_YIELD_USEROP_TERMS_SCHEMA>;
|
|
132
|
+
export declare const NATIVE_YIELD_USEROP_ENVELOPE_SCHEMA: z.ZodObject<{
|
|
133
|
+
version: z.ZodLiteral<1>;
|
|
134
|
+
kind: z.ZodLiteral<"native-yield-userop">;
|
|
135
|
+
input: z.ZodObject<{
|
|
136
|
+
accountProfile: z.ZodObject<{
|
|
137
|
+
kind: z.ZodLiteral<"eoa">;
|
|
138
|
+
address: z.ZodString;
|
|
139
|
+
chainId: z.ZodUnion<readonly [z.ZodLiteral<8453>, z.ZodLiteral<42161>]>;
|
|
140
|
+
}, z.core.$strict>;
|
|
141
|
+
marketId: z.ZodString;
|
|
142
|
+
registryCommitment: z.ZodString;
|
|
143
|
+
action: z.ZodEnum<{
|
|
144
|
+
deposit: "deposit";
|
|
145
|
+
withdraw: "withdraw";
|
|
146
|
+
}>;
|
|
147
|
+
amount: z.ZodString;
|
|
148
|
+
slippage: z.ZodObject<{
|
|
149
|
+
maxBps: z.ZodNumber;
|
|
150
|
+
minOutput: z.ZodOptional<z.ZodString>;
|
|
151
|
+
}, z.core.$strict>;
|
|
152
|
+
clientRef: z.ZodOptional<z.ZodString>;
|
|
153
|
+
}, z.core.$strict>;
|
|
154
|
+
plan: z.ZodObject<{
|
|
155
|
+
schemaVersion: z.ZodLiteral<"1">;
|
|
156
|
+
kind: z.ZodLiteral<"native-yield-plan">;
|
|
157
|
+
transport: z.ZodLiteral<"native-protocol">;
|
|
158
|
+
marketId: z.ZodString;
|
|
159
|
+
registryCommitment: z.ZodString;
|
|
160
|
+
owner: z.ZodString;
|
|
161
|
+
chainId: z.ZodUnion<readonly [z.ZodLiteral<8453>, z.ZodLiteral<42161>]>;
|
|
162
|
+
action: z.ZodEnum<{
|
|
163
|
+
deposit: "deposit";
|
|
164
|
+
withdraw: "withdraw";
|
|
165
|
+
}>;
|
|
166
|
+
amount: z.ZodString;
|
|
167
|
+
inputToken: z.ZodString;
|
|
168
|
+
outputToken: z.ZodString;
|
|
169
|
+
expectedOutput: z.ZodString;
|
|
170
|
+
minimumOutput: z.ZodString;
|
|
171
|
+
protocolOutput: z.ZodString;
|
|
172
|
+
fee: z.ZodObject<{
|
|
173
|
+
bps: z.ZodLiteral<10>;
|
|
174
|
+
recipient: z.ZodString;
|
|
175
|
+
token: z.ZodString;
|
|
176
|
+
amount: z.ZodString;
|
|
177
|
+
version: z.ZodLiteral<"native-yield-10bps-floor-v1">;
|
|
178
|
+
rounding: z.ZodLiteral<"floor">;
|
|
179
|
+
}, z.core.$strict>;
|
|
180
|
+
nonce: z.ZodString;
|
|
181
|
+
deadline: z.ZodNumber;
|
|
182
|
+
preparedAtMs: z.ZodNumber;
|
|
183
|
+
snapshot: z.ZodObject<{
|
|
184
|
+
blockNumber: z.ZodString;
|
|
185
|
+
blockHash: z.ZodString;
|
|
186
|
+
observedAtMs: z.ZodNumber;
|
|
187
|
+
}, z.core.$strict>;
|
|
188
|
+
deployment: z.ZodObject<{
|
|
189
|
+
chainId: z.ZodUnion<readonly [z.ZodLiteral<8453>, z.ZodLiteral<42161>]>;
|
|
190
|
+
address: z.ZodString;
|
|
191
|
+
runtimeCodeHash: z.ZodString;
|
|
192
|
+
version: z.ZodLiteral<"native-yield-router-v1">;
|
|
193
|
+
reviewId: z.ZodString;
|
|
194
|
+
}, z.core.$strict>;
|
|
195
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
196
|
+
kind: z.ZodEnum<{
|
|
197
|
+
approve: "approve";
|
|
198
|
+
approve_reset: "approve_reset";
|
|
199
|
+
call: "call";
|
|
200
|
+
}>;
|
|
201
|
+
to: z.ZodString;
|
|
202
|
+
value: z.ZodLiteral<"0">;
|
|
203
|
+
data: z.ZodString;
|
|
204
|
+
}, z.core.$strict>>;
|
|
205
|
+
authorization: z.ZodLiteral<"requires-separate-account-authority">;
|
|
206
|
+
allowanceRecovery: z.ZodLiteral<"approval-is-separate-and-may-remain-after-failure">;
|
|
207
|
+
intentCommitment: z.ZodString;
|
|
208
|
+
planCommitment: z.ZodString;
|
|
209
|
+
}, z.core.$strict>;
|
|
210
|
+
terms: z.ZodObject<{
|
|
211
|
+
version: z.ZodLiteral<1>;
|
|
212
|
+
ruleset: z.ZodLiteral<"native-yield-userop-v1">;
|
|
213
|
+
userId: z.ZodString;
|
|
214
|
+
account: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
215
|
+
chainId: z.ZodUnion<readonly [z.ZodLiteral<8453>, z.ZodLiteral<42161>]>;
|
|
216
|
+
authorityDigest: z.ZodString;
|
|
217
|
+
nativeActivationCommitment: z.ZodString;
|
|
218
|
+
sponsoredActivationId: z.ZodString;
|
|
219
|
+
sponsoredActivationDigest: z.ZodString;
|
|
220
|
+
projectId: z.ZodString;
|
|
221
|
+
policyId: z.ZodString;
|
|
222
|
+
policyRulesDigest: z.ZodString;
|
|
223
|
+
providerEnforcementEvidenceDigest: z.ZodString;
|
|
224
|
+
providerEndpoint: z.ZodLiteral<"cdp-end-user-smart-account-send-v1">;
|
|
225
|
+
deployment: z.ZodObject<{
|
|
226
|
+
chainId: z.ZodUnion<readonly [z.ZodLiteral<8453>, z.ZodLiteral<42161>]>;
|
|
227
|
+
address: z.ZodString;
|
|
228
|
+
runtimeCodeHash: z.ZodString;
|
|
229
|
+
version: z.ZodLiteral<"native-yield-router-v1">;
|
|
230
|
+
reviewId: z.ZodString;
|
|
231
|
+
}, z.core.$strict>;
|
|
232
|
+
delegate: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
233
|
+
delegateCodeHash: z.ZodString;
|
|
234
|
+
implementation: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
235
|
+
implementationCodeHash: z.ZodString;
|
|
236
|
+
delegateBatchAbi: z.ZodLiteral<"coinbase-executeBatch-v1">;
|
|
237
|
+
delegateBatchReviewDigest: z.ZodString;
|
|
238
|
+
entryPoint: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
239
|
+
entryPointCodeHash: z.ZodString;
|
|
240
|
+
entryPointVersion: z.ZodLiteral<"0.6">;
|
|
241
|
+
ownerProfile: z.ZodObject<{
|
|
242
|
+
kind: z.ZodLiteral<"sole-eoa-owner">;
|
|
243
|
+
nextOwnerIndex: z.ZodLiteral<"1">;
|
|
244
|
+
ownerCount: z.ZodLiteral<"1">;
|
|
245
|
+
ownerAtIndex0: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
246
|
+
spendPermissionsEnabled: z.ZodLiteral<false>;
|
|
247
|
+
}, z.core.$strict>;
|
|
248
|
+
paymaster: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
249
|
+
paymasterCodeHash: z.ZodString;
|
|
250
|
+
sponsorshipPolicyId: z.ZodString;
|
|
251
|
+
maxGasCostWei: z.ZodString;
|
|
252
|
+
maxUserGasCostWei: z.ZodString;
|
|
253
|
+
maxTotalGasCostWei: z.ZodString;
|
|
254
|
+
maximumInputAtomic: z.ZodString;
|
|
255
|
+
intentCommitment: z.ZodString;
|
|
256
|
+
consentCreatedAtMs: z.ZodNumber;
|
|
257
|
+
consentExpiresAtMs: z.ZodNumber;
|
|
258
|
+
initialInputAllowance: z.ZodLiteral<"0">;
|
|
259
|
+
initialProtocolAllowance: z.ZodLiteral<"0">;
|
|
260
|
+
execution: z.ZodLiteral<"atomic-approve-reset-approve-execute">;
|
|
261
|
+
}, z.core.$strict>;
|
|
262
|
+
preparedAtMs: z.ZodNumber;
|
|
263
|
+
validUntilMs: z.ZodNumber;
|
|
264
|
+
allowanceRecovery: z.ZodLiteral<"atomic-batch-requires-zero-initial-and-final-allowances">;
|
|
265
|
+
commitment: z.ZodString;
|
|
266
|
+
}, z.core.$strict>;
|
|
267
|
+
export type NativeYieldUserOpEnvelope = z.infer<typeof NATIVE_YIELD_USEROP_ENVELOPE_SCHEMA>;
|
|
268
|
+
export interface VerifiedNativeYieldUserOp {
|
|
269
|
+
readonly envelope: NativeYieldUserOpEnvelope;
|
|
270
|
+
readonly verificationOnly: true;
|
|
271
|
+
}
|
|
272
|
+
export declare const NATIVE_YIELD_USEROP_SETTLEMENT_SCHEMA: z.ZodUnion<readonly [z.ZodObject<{
|
|
273
|
+
status: z.ZodLiteral<"completed">;
|
|
274
|
+
actualInput: z.ZodString;
|
|
275
|
+
actualOutput: z.ZodString;
|
|
276
|
+
actualOttoFee: z.ZodString;
|
|
277
|
+
feeToken: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
278
|
+
protocolActionVerified: z.ZodLiteral<true>;
|
|
279
|
+
transactionHash: z.ZodString;
|
|
280
|
+
userOpHash: z.ZodString;
|
|
281
|
+
blockHash: z.ZodString;
|
|
282
|
+
blockNumber: z.ZodString;
|
|
283
|
+
owner: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
284
|
+
marketId: z.ZodString;
|
|
285
|
+
action: z.ZodEnum<{
|
|
286
|
+
deposit: "deposit";
|
|
287
|
+
withdraw: "withdraw";
|
|
288
|
+
}>;
|
|
289
|
+
inputAllowance: z.ZodLiteral<"0">;
|
|
290
|
+
protocolAllowance: z.ZodLiteral<"0">;
|
|
291
|
+
positionBalanceAtBlock: z.ZodString;
|
|
292
|
+
assetBalanceAtBlock: z.ZodString;
|
|
293
|
+
routerNonceAtBlock: z.ZodString;
|
|
294
|
+
actualGasCostWei: z.ZodString;
|
|
295
|
+
actualGasUsed: z.ZodString;
|
|
296
|
+
paymaster: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
297
|
+
releaseClaim: z.ZodLiteral<true>;
|
|
298
|
+
retrySafe: z.ZodLiteral<false>;
|
|
299
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
300
|
+
status: z.ZodLiteral<"reverted">;
|
|
301
|
+
protocolActionVerified: z.ZodLiteral<false>;
|
|
302
|
+
transactionHash: z.ZodString;
|
|
303
|
+
userOpHash: z.ZodString;
|
|
304
|
+
blockHash: z.ZodString;
|
|
305
|
+
blockNumber: z.ZodString;
|
|
306
|
+
owner: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
307
|
+
marketId: z.ZodString;
|
|
308
|
+
action: z.ZodEnum<{
|
|
309
|
+
deposit: "deposit";
|
|
310
|
+
withdraw: "withdraw";
|
|
311
|
+
}>;
|
|
312
|
+
inputAllowance: z.ZodLiteral<"0">;
|
|
313
|
+
protocolAllowance: z.ZodLiteral<"0">;
|
|
314
|
+
positionBalanceAtBlock: z.ZodString;
|
|
315
|
+
assetBalanceAtBlock: z.ZodString;
|
|
316
|
+
routerNonceAtBlock: z.ZodString;
|
|
317
|
+
actualGasCostWei: z.ZodString;
|
|
318
|
+
actualGasUsed: z.ZodString;
|
|
319
|
+
paymaster: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
320
|
+
releaseClaim: z.ZodLiteral<true>;
|
|
321
|
+
retrySafe: z.ZodLiteral<false>;
|
|
322
|
+
}, z.core.$strict>]>;
|
|
323
|
+
export type NativeYieldUserOpSettled = z.infer<typeof NATIVE_YIELD_USEROP_SETTLEMENT_SCHEMA>;
|
|
324
|
+
export type NativeYieldUserOpSettlement = NativeYieldUserOpSettled | {
|
|
325
|
+
readonly status: 'unknown' | 'held';
|
|
326
|
+
readonly reason: string;
|
|
327
|
+
readonly transactionHash: `0x${string}`;
|
|
328
|
+
readonly userOpHash: `0x${string}`;
|
|
329
|
+
readonly releaseClaim: false;
|
|
330
|
+
readonly retrySafe: false;
|
|
331
|
+
};
|