otto-intel-mcp 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/README.md +74 -18
  2. package/dist/account-userop-policy-definition.d.ts +14 -0
  3. package/dist/account-userop-policy-definition.js +12 -0
  4. package/dist/account-userop-policy-relation.d.ts +371 -0
  5. package/dist/account-userop-policy-relation.js +87 -0
  6. package/dist/adapter/cdp-signer.d.ts +32 -4
  7. package/dist/adapter/cdp-signer.js +128 -37
  8. package/dist/adapter-cdp-index.d.ts +1 -1
  9. package/dist/execution-account-gas-quote.d.ts +141 -0
  10. package/dist/execution-account-gas-quote.js +443 -0
  11. package/dist/execution-account-gas-review.d.ts +123 -0
  12. package/dist/execution-account-gas-review.js +104 -0
  13. package/dist/execution-account-gas-runtime.d.ts +33 -0
  14. package/dist/execution-account-gas-runtime.js +131 -0
  15. package/dist/execution-account-gas-view.d.ts +936 -0
  16. package/dist/execution-account-gas-view.js +56 -0
  17. package/dist/execution-config.d.ts +3 -0
  18. package/dist/execution-config.js +4 -0
  19. package/dist/execution-delegated-definition.d.ts +6 -6
  20. package/dist/execution-delegated-definition.js +1 -1
  21. package/dist/execution-delegation-admin-definition.d.ts +12 -11
  22. package/dist/execution-delegation-admin-definition.js +6 -5
  23. package/dist/execution-delegation-admin.d.ts +5 -5
  24. package/dist/execution-delegation-admin.js +157 -49
  25. package/dist/execution-delegation-cap-store.d.ts +22 -5
  26. package/dist/execution-delegation-cap-store.js +74 -7
  27. package/dist/execution-delegation-exit-definition.d.ts +309 -0
  28. package/dist/execution-delegation-exit-definition.js +204 -0
  29. package/dist/execution-delegation-exit-store.d.ts +114 -0
  30. package/dist/execution-delegation-exit-store.js +671 -0
  31. package/dist/execution-delegation-exit.d.ts +4 -0
  32. package/dist/execution-delegation-exit.js +614 -0
  33. package/dist/execution-delegation-finality.d.ts +22 -0
  34. package/dist/execution-delegation-finality.js +90 -0
  35. package/dist/execution-delegation-operation-store.d.ts +129 -0
  36. package/dist/execution-delegation-operation-store.js +1107 -0
  37. package/dist/execution-delegation-operations-definition.d.ts +282 -0
  38. package/dist/execution-delegation-operations-definition.js +117 -0
  39. package/dist/execution-delegation-operations.d.ts +6 -0
  40. package/dist/execution-delegation-operations.js +282 -0
  41. package/dist/execution-delegation-policy.d.ts +1 -2
  42. package/dist/execution-delegation-policy.js +13 -24
  43. package/dist/execution-delegation.d.ts +16 -0
  44. package/dist/execution-delegation.js +221 -26
  45. package/dist/execution-errors.d.ts +1 -1
  46. package/dist/execution-errors.js +27 -3
  47. package/dist/execution-index.d.ts +4 -0
  48. package/dist/execution-index.js +4 -0
  49. package/dist/execution-journal-schema.d.ts +96 -0
  50. package/dist/execution-journal-schema.js +368 -0
  51. package/dist/execution-journal-tables.d.ts +14 -0
  52. package/dist/execution-journal-tables.js +227 -0
  53. package/dist/execution-policy-compatibility.d.ts +34 -0
  54. package/dist/execution-policy-compatibility.js +76 -0
  55. package/dist/execution-registration.d.ts +8 -5
  56. package/dist/execution-registration.js +106 -3
  57. package/dist/execution-sponsored-account-profile.d.ts +32 -0
  58. package/dist/execution-sponsored-account-profile.js +59 -0
  59. package/dist/execution-sponsored-account.d.ts +1519 -0
  60. package/dist/execution-sponsored-account.js +222 -0
  61. package/dist/execution-sponsored-definition.d.ts +1713 -0
  62. package/dist/execution-sponsored-definition.js +185 -0
  63. package/dist/execution-sponsored-gas-policy.d.ts +27 -0
  64. package/dist/execution-sponsored-gas-policy.js +110 -0
  65. package/dist/execution-sponsored-hosted.d.ts +3 -0
  66. package/dist/execution-sponsored-hosted.js +71 -0
  67. package/dist/execution-sponsored-index.d.ts +1322 -0
  68. package/dist/execution-sponsored-index.js +102 -0
  69. package/dist/execution-sponsored-mcp-definition.d.ts +1662 -0
  70. package/dist/execution-sponsored-mcp-definition.js +94 -0
  71. package/dist/execution-sponsored-receipt.d.ts +47 -0
  72. package/dist/execution-sponsored-receipt.js +74 -0
  73. package/dist/execution-sponsored-registration.d.ts +14 -0
  74. package/dist/execution-sponsored-registration.js +77 -0
  75. package/dist/execution-sponsored-runtime.d.ts +84 -0
  76. package/dist/execution-sponsored-runtime.js +149 -0
  77. package/dist/execution-sponsored-settlement.d.ts +15 -0
  78. package/dist/execution-sponsored-settlement.js +88 -0
  79. package/dist/execution-sponsored-store.d.ts +67 -0
  80. package/dist/execution-sponsored-store.js +517 -0
  81. package/dist/execution-sponsored-transport.d.ts +90 -0
  82. package/dist/execution-sponsored-transport.js +180 -0
  83. package/dist/execution-tool-definitions.d.ts +21 -21
  84. package/dist/execution-tool-definitions.js +0 -7
  85. package/dist/execution-tools.d.ts +9 -0
  86. package/dist/execution-tools.js +14 -0
  87. package/dist/execution-worker-guard.d.ts +28 -0
  88. package/dist/execution-worker-guard.js +124 -0
  89. package/dist/hybrid-yield-index.d.ts +10 -0
  90. package/dist/hybrid-yield-index.js +11 -0
  91. package/dist/hybrid-yield-markets.d.ts +96 -0
  92. package/dist/hybrid-yield-markets.js +124 -0
  93. package/dist/hybrid-yield.d.ts +411 -0
  94. package/dist/hybrid-yield.js +155 -0
  95. package/dist/hyperliquid-order-builder.js +4 -0
  96. package/dist/lp-userop-account.d.ts +461 -0
  97. package/dist/lp-userop-account.js +417 -0
  98. package/dist/lp-userop-authority.d.ts +49 -0
  99. package/dist/lp-userop-authority.js +211 -0
  100. package/dist/lp-userop-definition.d.ts +233 -0
  101. package/dist/lp-userop-definition.js +85 -0
  102. package/dist/lp-userop-hosted.d.ts +3 -0
  103. package/dist/lp-userop-hosted.js +73 -0
  104. package/dist/lp-userop-index.d.ts +1569 -0
  105. package/dist/lp-userop-index.js +112 -0
  106. package/dist/lp-userop-mcp-definition.d.ts +1220 -0
  107. package/dist/lp-userop-mcp-definition.js +46 -0
  108. package/dist/lp-userop-operation.d.ts +1230 -0
  109. package/dist/lp-userop-operation.js +140 -0
  110. package/dist/lp-userop-registration.d.ts +14 -0
  111. package/dist/lp-userop-registration.js +70 -0
  112. package/dist/lp-userop-settlement.d.ts +89 -0
  113. package/dist/lp-userop-settlement.js +184 -0
  114. package/dist/lp-userop.d.ts +643 -0
  115. package/dist/lp-userop.js +343 -0
  116. package/dist/native-yield-account-definition.d.ts +1192 -0
  117. package/dist/native-yield-account-definition.js +232 -0
  118. package/dist/native-yield-account-gas.d.ts +58 -0
  119. package/dist/native-yield-account-gas.js +228 -0
  120. package/dist/native-yield-account-index.d.ts +23 -0
  121. package/dist/native-yield-account-index.js +28 -0
  122. package/dist/native-yield-account-policy.d.ts +168 -0
  123. package/dist/native-yield-account-policy.js +525 -0
  124. package/dist/native-yield-account-rpc.d.ts +8 -0
  125. package/dist/native-yield-account-rpc.js +128 -0
  126. package/dist/native-yield-account-runtime.d.ts +71 -0
  127. package/dist/native-yield-account-runtime.js +125 -0
  128. package/dist/native-yield-account-store.d.ts +40 -0
  129. package/dist/native-yield-account-store.js +307 -0
  130. package/dist/native-yield-account.d.ts +662 -0
  131. package/dist/native-yield-account.js +371 -0
  132. package/dist/native-yield-consent-store.d.ts +20 -0
  133. package/dist/native-yield-consent-store.js +317 -0
  134. package/dist/native-yield-definition.d.ts +288 -0
  135. package/dist/native-yield-definition.js +105 -0
  136. package/dist/native-yield-reader.d.ts +4 -0
  137. package/dist/native-yield-reader.js +137 -0
  138. package/dist/native-yield-settlement.d.ts +48 -0
  139. package/dist/native-yield-settlement.js +167 -0
  140. package/dist/native-yield-simulation.d.ts +18 -0
  141. package/dist/native-yield-simulation.js +45 -0
  142. package/dist/native-yield-userop-account.d.ts +675 -0
  143. package/dist/native-yield-userop-account.js +357 -0
  144. package/dist/native-yield-userop-authority.d.ts +214 -0
  145. package/dist/native-yield-userop-authority.js +296 -0
  146. package/dist/native-yield-userop-definition.d.ts +331 -0
  147. package/dist/native-yield-userop-definition.js +105 -0
  148. package/dist/native-yield-userop-hosted.d.ts +3 -0
  149. package/dist/native-yield-userop-hosted.js +71 -0
  150. package/dist/native-yield-userop-index.d.ts +1522 -0
  151. package/dist/native-yield-userop-index.js +142 -0
  152. package/dist/native-yield-userop-mcp-definition.d.ts +1356 -0
  153. package/dist/native-yield-userop-mcp-definition.js +50 -0
  154. package/dist/native-yield-userop-operation.d.ts +845 -0
  155. package/dist/native-yield-userop-operation.js +127 -0
  156. package/dist/native-yield-userop-policy.d.ts +23 -0
  157. package/dist/native-yield-userop-policy.js +25 -0
  158. package/dist/native-yield-userop-registration.d.ts +17 -0
  159. package/dist/native-yield-userop-registration.js +76 -0
  160. package/dist/native-yield-userop-settlement.d.ts +8 -0
  161. package/dist/native-yield-userop-settlement.js +79 -0
  162. package/dist/native-yield-userop-simulation.d.ts +18 -0
  163. package/dist/native-yield-userop-simulation.js +34 -0
  164. package/dist/native-yield-userop.d.ts +35 -0
  165. package/dist/native-yield-userop.js +156 -0
  166. package/dist/native-yield-verify.d.ts +30 -0
  167. package/dist/native-yield-verify.js +141 -0
  168. package/dist/native-yield.d.ts +17 -0
  169. package/dist/native-yield.js +119 -0
  170. package/dist/stdio-main.js +0 -0
  171. package/dist/stock-buy-definition.d.ts +10 -10
  172. package/dist/tool-definitions.d.ts +3 -1
  173. package/dist/tool-definitions.js +54 -1
  174. package/dist/vendor/lp-v3/lp-v3-atomic-contract.d.ts +445 -0
  175. package/dist/vendor/lp-v3/lp-v3-atomic-contract.js +90 -0
  176. package/dist/vendor/lp-v3/lp-v3-atomic-evidence.d.ts +14 -0
  177. package/dist/vendor/lp-v3/lp-v3-atomic-evidence.js +82 -0
  178. package/dist/vendor/lp-v3/lp-v3-atomic-index.d.ts +80 -0
  179. package/dist/vendor/lp-v3/lp-v3-atomic-index.js +19 -0
  180. package/dist/vendor/lp-v3/lp-v3-atomic-plan.d.ts +43 -0
  181. package/dist/vendor/lp-v3/lp-v3-atomic-plan.js +112 -0
  182. package/dist/vendor/lp-v3/lp-v3-atomic-read-contract.d.ts +312 -0
  183. package/dist/vendor/lp-v3/lp-v3-atomic-read-contract.js +41 -0
  184. package/dist/vendor/lp-v3/lp-v3-atomic-read-index.d.ts +3 -0
  185. package/dist/vendor/lp-v3/lp-v3-atomic-read-index.js +3 -0
  186. package/dist/vendor/lp-v3/lp-v3-atomic-read-rpc.d.ts +49 -0
  187. package/dist/vendor/lp-v3/lp-v3-atomic-read-rpc.js +88 -0
  188. package/dist/vendor/lp-v3/lp-v3-atomic-read.d.ts +17 -0
  189. package/dist/vendor/lp-v3/lp-v3-atomic-read.js +232 -0
  190. package/dist/vendor/lp-v3/lp-v3-atomic-settlement.d.ts +105 -0
  191. package/dist/vendor/lp-v3/lp-v3-atomic-settlement.js +162 -0
  192. package/dist/vendor/lp-v3/lp-v3-collect-protocol-contract.d.ts +606 -0
  193. package/dist/vendor/lp-v3/lp-v3-collect-protocol-contract.js +59 -0
  194. package/dist/vendor/lp-v3/lp-v3-collect-protocol-index.d.ts +168 -0
  195. package/dist/vendor/lp-v3/lp-v3-collect-protocol-index.js +23 -0
  196. package/dist/vendor/lp-v3/lp-v3-collect-protocol-observation.d.ts +32 -0
  197. package/dist/vendor/lp-v3/lp-v3-collect-protocol-observation.js +228 -0
  198. package/dist/vendor/lp-v3/lp-v3-collect-protocol-plan.d.ts +11 -0
  199. package/dist/vendor/lp-v3/lp-v3-collect-protocol-plan.js +91 -0
  200. package/dist/vendor/lp-v3/lp-v3-collect-protocol-reconcile.d.ts +9 -0
  201. package/dist/vendor/lp-v3/lp-v3-collect-protocol-reconcile.js +124 -0
  202. package/dist/vendor/lp-v3/lp-v3-contract.d.ts +538 -0
  203. package/dist/vendor/lp-v3/lp-v3-contract.js +137 -0
  204. package/dist/vendor/lp-v3/lp-v3-evidence.d.ts +25 -0
  205. package/dist/vendor/lp-v3/lp-v3-evidence.js +168 -0
  206. package/dist/vendor/lp-v3/lp-v3-plan.d.ts +22 -0
  207. package/dist/vendor/lp-v3/lp-v3-plan.js +135 -0
  208. package/dist/vendor/lp-v3/types.d.ts +131 -0
  209. package/dist/vendor/lp-v3/types.js +6 -0
  210. package/dist/vendor/lp-v3/v4-math.d.ts +18 -0
  211. package/dist/vendor/lp-v3/v4-math.js +90 -0
  212. package/dist/yield-deposit-definition.d.ts +65 -14
  213. package/dist/yield-deposit-definition.js +6 -4
  214. package/dist/yield-deposit.js +8 -0
  215. package/dist/yield-route-semantics.d.ts +27 -0
  216. package/dist/yield-route-semantics.js +71 -0
  217. package/dist/yield-withdraw-definition.d.ts +62 -11
  218. package/dist/yield-withdraw-definition.js +3 -1
  219. package/dist/yield-withdraw.d.ts +0 -10
  220. package/dist/yield-withdraw.js +2 -0
  221. package/package.json +215 -7
@@ -0,0 +1,87 @@
1
+ /** Pure source-policy relation for native yield plus same-account guarded LP collection. */
2
+ import { getAddress } from 'viem';
3
+ import { z } from 'zod';
4
+ import { freezeHybridValue, hybridYieldCommitment } from './hybrid-yield-markets.js';
5
+ import { policyRulesDigest } from './execution-policy-compatibility.js';
6
+ import { compileNativeYieldEndUserOperationPolicy } from './native-yield-userop-policy.js';
7
+ import { LP_USEROP_ACTIVATION_SCHEMA } from './lp-userop-definition.js';
8
+ import { LP_V3_BASE } from './vendor/lp-v3/lp-v3-contract.js';
9
+ import { LP_V3_ATOMIC_NPM_ABI, LP_V3_COLLECT_GUARD_ABI } from './vendor/lp-v3/lp-v3-atomic-contract.js';
10
+ const digest = z.string().regex(/^[0-9a-f]{64}$/).refine(value => !/^0+$/.test(value));
11
+ import { ACCOUNT_NATIVE_LP_USEROP_COMPILER, SPONSORED_LP_USEROP_POLICY_RELATION_SCHEMA } from './account-userop-policy-definition.js';
12
+ export { ACCOUNT_NATIVE_LP_USEROP_COMPILER, SPONSORED_LP_USEROP_POLICY_RELATION_SCHEMA } from './account-userop-policy-definition.js';
13
+ export class LpUserOpPolicyRefusal extends Error {
14
+ code;
15
+ constructor(code) {
16
+ super(code);
17
+ this.code = code;
18
+ this.name = 'LpUserOpPolicyRefusal';
19
+ }
20
+ }
21
+ function ensure(value, code) { if (!value)
22
+ throw new LpUserOpPolicyRefusal(code); }
23
+ export function lpUserOpActivationCommitment(raw) {
24
+ return hybridYieldCommitment(LP_USEROP_ACTIVATION_SCHEMA.parse(raw));
25
+ }
26
+ /**
27
+ * Provider scope is per call: Base, zero native value, pinned NPM/guard, and only
28
+ * approve(guard, tokenId) or the guard's exact collect selector. The immutable
29
+ * guard enforces the caller/recipient, position, pair and atomic NFT cleanup.
30
+ * The host separately enforces exactly [approve, collect]. This provider rule
31
+ * cannot express batch cardinality/order; allowed subsets/repetitions remain a
32
+ * provider-authority residual, including a standalone approval to the guard.
33
+ * Tuple-parameter enforcement is not claimed. Provider acceptance and denial
34
+ * evidence remain an activation gate, independent of SDK schema parsing.
35
+ */
36
+ export function compileLpCollectEndUserOperationRules(raw) {
37
+ const activation = LP_USEROP_ACTIVATION_SCHEMA.parse(raw);
38
+ const guard = getAddress(activation.guardDeployment.address), manager = getAddress(LP_V3_BASE.manager);
39
+ const approvalAbi = LP_V3_ATOMIC_NPM_ABI.filter(item => item.type === 'function' && item.name === 'approve');
40
+ const collectionAbi = LP_V3_COLLECT_GUARD_ABI.filter(item => item.type === 'function' && item.name === 'collect');
41
+ ensure(approvalAbi.length === 1 && collectionAbi.length === 1 && guard !== manager, 'LP_USEROP_POLICY_ABI_UNAVAILABLE');
42
+ return freezeHybridValue([{
43
+ action: 'accept', operation: 'sendEndUserOperation',
44
+ criteria: [
45
+ { type: 'evmNetwork', networks: ['base'], operator: 'in' },
46
+ { type: 'ethValue', ethValue: '0', operator: '<=' },
47
+ { type: 'evmAddress', addresses: [manager, guard], operator: 'in' },
48
+ { type: 'evmData', abi: [...approvalAbi, ...collectionAbi], conditions: [
49
+ { function: 'approve', params: [{ name: 'to', operator: 'in', values: [guard] }] },
50
+ { function: 'collect' },
51
+ ] },
52
+ ],
53
+ }]);
54
+ }
55
+ export function compileNativeLpCollectEndUserOperationPolicy(nativeActivation, rawLpActivation) {
56
+ const native = compileNativeYieldEndUserOperationPolicy(nativeActivation);
57
+ const lpActivation = LP_USEROP_ACTIVATION_SCHEMA.parse(rawLpActivation);
58
+ ensure(lpActivation.nativeActivationCommitment === native.nativeActivationCommitment, 'LP_USEROP_NATIVE_ACTIVATION_RELATION');
59
+ const lpRules = compileLpCollectEndUserOperationRules(lpActivation), rules = [...native.body.rules, ...lpRules];
60
+ ensure(lpRules.length === 1 && rules.length <= 10, 'LP_USEROP_POLICY_RULE_LIMIT');
61
+ return freezeHybridValue({
62
+ body: { scope: 'project', description: native.body.description, rules },
63
+ compiler: ACCOUNT_NATIVE_LP_USEROP_COMPILER,
64
+ nativeCompiledPolicyDigest: native.compiledFullPolicyDigest,
65
+ nativeActivationCommitment: native.nativeActivationCommitment, nativeRulesDigest: native.nativeRulesDigest,
66
+ lpActivationCommitment: lpUserOpActivationCommitment(lpActivation), lpRulesDigest: policyRulesDigest(lpRules),
67
+ compiledFullPolicyDigest: policyRulesDigest(rules),
68
+ });
69
+ }
70
+ /** Preserve the existing native-only compiler proof; the new relation binds the augmented actual policy. */
71
+ export function assertNativeLpCollectPolicyRelation(nativeActivation, sponsorActivation, lpActivation) {
72
+ const base = compileNativeYieldEndUserOperationPolicy(nativeActivation);
73
+ const compiled = compileNativeLpCollectEndUserOperationPolicy(nativeActivation, lpActivation);
74
+ const relation = SPONSORED_LP_USEROP_POLICY_RELATION_SCHEMA.parse(sponsorActivation.lpUserOpPolicyRelation);
75
+ const native = sponsorActivation.nativeYieldUserOpPolicyRelation;
76
+ ensure(native && native.compiler === base.compiler &&
77
+ native.nativeActivationCommitment === base.nativeActivationCommitment &&
78
+ native.nativeRulesDigest === base.nativeRulesDigest && native.compiledFullPolicyDigest === base.compiledFullPolicyDigest &&
79
+ digest.safeParse(native.relationReviewEvidenceDigest).success, 'LP_USEROP_NATIVE_POLICY_RELATION');
80
+ const { relationReviewEvidenceDigest: _reviewEvidence, ...derived } = relation;
81
+ const { body: _body, ...expected } = compiled;
82
+ ensure(hybridYieldCommitment(derived) === hybridYieldCommitment(expected) &&
83
+ sponsorActivation.policyId === nativeActivation.policyId && sponsorActivation.policyName === nativeActivation.policyName &&
84
+ sponsorActivation.policyRulesDigest === compiled.compiledFullPolicyDigest, 'LP_USEROP_COMPOSITE_POLICY_RELATION');
85
+ return compiled;
86
+ }
87
+ //# sourceMappingURL=account-userop-policy-relation.js.map
@@ -41,6 +41,31 @@ export interface CdpEndUser {
41
41
  readonly userId: string;
42
42
  readonly address: Address;
43
43
  }
44
+ export interface DelegatedSubmissionAttempt {
45
+ readonly index: number;
46
+ readonly kind: 'approve_reset' | 'approve' | 'call' | 'allowance_clear';
47
+ readonly userId: string;
48
+ readonly address: Address;
49
+ readonly transaction: Hex;
50
+ readonly network: typeof NETWORK;
51
+ }
52
+ export interface DelegatedSubmissionReceipt {
53
+ readonly transactionHash: Hex;
54
+ readonly status: 'success' | 'reverted';
55
+ readonly blockNumber: string;
56
+ readonly blockHash: Hex;
57
+ readonly gasUsed: string;
58
+ }
59
+ /** Durable observer used by the hosted delegated path. Its prepare call must commit before it resolves. */
60
+ export interface DelegatedSubmissionJournal {
61
+ prepare(attempt: DelegatedSubmissionAttempt): Promise<{
62
+ readonly idempotencyKey: string;
63
+ }>;
64
+ notSubmitted(index: number, idempotencyKey: string): Promise<void>;
65
+ submitted(index: number, idempotencyKey: string, transactionHash: Hex): Promise<void>;
66
+ unknown(index: number, idempotencyKey: string): Promise<void>;
67
+ receipt(index: number, idempotencyKey: string, receipt: DelegatedSubmissionReceipt): Promise<void>;
68
+ }
44
69
  /** The PUBLIC face of a rig: chain reads, delegation read-back, revocation. No submission surface. */
45
70
  export interface CdpRig {
46
71
  readonly pub: PublicClient;
@@ -58,7 +83,7 @@ export interface CdpRig {
58
83
  export interface CdpRawOperations {
59
84
  readonly pub: PublicClient;
60
85
  /** Sign + broadcast an unsigned serialized EIP-1559 transaction under the user's delegation. Returns the tx hash. */
61
- submit(user: CdpEndUser, unsignedTransaction: Hex): Promise<Hex>;
86
+ submit(user: CdpEndUser, unsignedTransaction: Hex, idempotencyKey?: string): Promise<Hex>;
62
87
  revoke(userId: string): Promise<void>;
63
88
  readDelegation(userId: string): Promise<{
64
89
  expiresAt: string;
@@ -80,9 +105,11 @@ export type DelegatedHaltCause = 'policy_violation' | 'delegation_not_active' |
80
105
  /** The node could not estimate a later step (timeout, rate limit, transport); nothing more was broadcast. */
81
106
  | 'estimate_unavailable' | 'receipt_not_sealed' | 'upstream_failure';
82
107
  /**
83
- * A delegated plan halted; `cause` is the structured class above, `allowanceCleared` says whether the
84
- * router allowance is known to be zero again. The message is for the operator; a consumer that must not
85
- * relay upstream text reads `cause` and the two fields only.
108
+ * A delegated plan halted; `cause` is the structured class above. `allowanceCleared` reports only
109
+ * whether the bounded cleanup's live, unpinned allowance read returned zero. It is diagnostic and is
110
+ * never sufficient to release a durable operation claim; finalized-canonical recovery owns that proof.
111
+ * The message is for the operator; a consumer that must not relay upstream text reads `cause` and the
112
+ * two fields only.
86
113
  */
87
114
  export declare class DelegatedPlanHaltedError extends Error {
88
115
  readonly failedStep: number;
@@ -147,6 +174,7 @@ export declare class CdpDelegatedSigner {
147
174
  readonly afterBuild?: () => Promise<void>;
148
175
  readonly beforeSubmit?: () => void;
149
176
  readonly grantExpiresAt?: string;
177
+ readonly submissionJournal?: DelegatedSubmissionJournal;
150
178
  });
151
179
  get address(): Address;
152
180
  get user(): CdpEndUser;
@@ -34,6 +34,15 @@ import { assertPlanSignableBy } from './verify.js';
34
34
  export const CDP_CAPABILITIES = Object.freeze(['send_evm_transaction']);
35
35
  export const CHAIN_ID = 8453;
36
36
  export const NETWORK = 'base';
37
+ /** Internal proof that a step failed before the raw CDP submission function was entered. */
38
+ class DelegatedPreHandoffError extends Error {
39
+ original;
40
+ constructor(original) {
41
+ super('delegated step refused before the CDP hand-off');
42
+ this.original = original;
43
+ this.name = 'DelegatedPreHandoffError';
44
+ }
45
+ }
37
46
  const RAW = new WeakMap();
38
47
  /** One lifecycle lock PER RIG — shared by every signer over it and by the rig's own public `revoke`. */
39
48
  const LOCKS = new WeakMap();
@@ -67,9 +76,11 @@ function serializedOn(rig, operation) {
67
76
  return run;
68
77
  }
69
78
  /**
70
- * A delegated plan halted; `cause` is the structured class above, `allowanceCleared` says whether the
71
- * router allowance is known to be zero again. The message is for the operator; a consumer that must not
72
- * relay upstream text reads `cause` and the two fields only.
79
+ * A delegated plan halted; `cause` is the structured class above. `allowanceCleared` reports only
80
+ * whether the bounded cleanup's live, unpinned allowance read returned zero. It is diagnostic and is
81
+ * never sufficient to release a durable operation claim; finalized-canonical recovery owns that proof.
82
+ * The message is for the operator; a consumer that must not relay upstream text reads `cause` and the
83
+ * two fields only.
73
84
  */
74
85
  export class DelegatedPlanHaltedError extends Error {
75
86
  failedStep;
@@ -192,8 +203,14 @@ export async function openCdpRig(credentials, rpcUrl) {
192
203
  throw new Error(`RPC reports chainId ${chainId}, expected ${CHAIN_ID} (Base mainnet)`);
193
204
  return createCdpRig({
194
205
  pub,
195
- submit: async (user, transaction) => {
196
- const result = await cdp.endUser.sendEvmTransaction({ userId: user.userId, address: user.address, transaction, network: NETWORK });
206
+ submit: async (user, transaction, idempotencyKey) => {
207
+ const result = await cdp.endUser.sendEvmTransaction({
208
+ userId: user.userId,
209
+ address: user.address,
210
+ transaction,
211
+ network: NETWORK,
212
+ ...(idempotencyKey ? { idempotencyKey } : {}),
213
+ });
197
214
  return result.transactionHash;
198
215
  },
199
216
  revoke: async (userId) => {
@@ -330,6 +347,7 @@ export class CdpDelegatedSigner {
330
347
  */
331
348
  #afterBuild;
332
349
  #beforeSubmit;
350
+ #submissionJournal;
333
351
  constructor(rig, user, options = {}) {
334
352
  const raw = RAW.get(rig);
335
353
  if (!raw)
@@ -342,6 +360,7 @@ export class CdpDelegatedSigner {
342
360
  this.#afterBuild = options.afterBuild;
343
361
  this.#beforeSubmit = options.beforeSubmit;
344
362
  this.#grantExpiresAt = options.grantExpiresAt;
363
+ this.#submissionJournal = options.submissionJournal;
345
364
  }
346
365
  get address() {
347
366
  return this.#user.address;
@@ -353,28 +372,70 @@ export class CdpDelegatedSigner {
353
372
  * Assemble the unsigned transaction from chain reads, run `beforeSubmit` (the plan's freshness /
354
373
  * binding re-check, AFTER the RPC round trips and immediately before the hand-off), then submit.
355
374
  */
356
- async #submit(step, beforeSubmit) {
357
- // A plan step (it carries `beforeSubmit`) refuses on a reverting estimate; the halt path's clear does not.
358
- const transaction = await buildUnsignedTransaction(this.#raw.pub, this.#user.address, step, beforeSubmit ? { kind: 'refuse', stepKind: step.kind ?? 'plan' } : { kind: 'allowance_clear' });
359
- /**
360
- * 🔴 THE AUTHORITATIVE RE-READ, AFTER CONSTRUCTION. A revoke or a narrower re-mint that landed while
361
- * the nonce, fees and gas were being fetched is visible here and nowhere earlier.
362
- *
363
- * 🔴 AND ONLY FOR A PLAN STEP. `beforeSubmit` is passed by `sendPlan` and by nothing else, so it is
364
- * the signal that this submission is part of the plan. The halt path's `approve(spender, 0)` goes
365
- * out through this same method WITHOUT it, and it must never be gated: the clear is the safety
366
- * action that runs precisely BECAUSE something went wrong, including the grant changing under it.
367
- * Refusing to clear an allowance because the permission that opened it has gone is the one outcome
368
- * nobody wants.
369
- */
370
- if (beforeSubmit) {
371
- await this.#afterBuild?.();
372
- beforeSubmit();
373
- // …and the caller's own last word, synchronous, on what that re-read just found. Nothing is
374
- // awaited between here and the hand-off, because an await is the window this exists to close.
375
- this.#beforeSubmit?.();
375
+ async #submit(step, beforeSubmit, journalStep) {
376
+ let idempotencyKey;
377
+ let handedToCdp = false;
378
+ try {
379
+ // A plan step (it carries `beforeSubmit`) refuses on a reverting estimate; the halt path's clear does not.
380
+ // The build and journal prepare are inside this boundary: both are provably before the raw hand-off.
381
+ const transaction = await buildUnsignedTransaction(this.#raw.pub, this.#user.address, step, beforeSubmit ? { kind: 'refuse', stepKind: step.kind ?? 'plan' } : { kind: 'allowance_clear' });
382
+ if (this.#submissionJournal) {
383
+ if (!journalStep)
384
+ throw new Error('a journaled submission needs a stable step identity');
385
+ ({ idempotencyKey } = await this.#submissionJournal.prepare({
386
+ index: journalStep.index,
387
+ kind: journalStep.kind,
388
+ userId: this.#user.userId,
389
+ address: this.#user.address,
390
+ transaction,
391
+ network: NETWORK,
392
+ }));
393
+ }
394
+ /**
395
+ * 🔴 THE AUTHORITATIVE RE-READ, AFTER CONSTRUCTION. A revoke or a narrower re-mint that landed while
396
+ * the nonce, fees and gas were being fetched is visible here and nowhere earlier.
397
+ *
398
+ * 🔴 AND ONLY FOR A PLAN STEP. `beforeSubmit` is passed by `sendPlan` and by nothing else, so it is
399
+ * the signal that this submission is part of the plan. The halt path's `approve(spender, 0)` goes
400
+ * out through this same method WITHOUT it, and it must never be gated: the clear is the safety
401
+ * action that runs precisely BECAUSE something went wrong, including the grant changing under it.
402
+ * Refusing to clear an allowance because the permission that opened it has gone is the one outcome
403
+ * nobody wants.
404
+ */
405
+ if (beforeSubmit) {
406
+ // The journal write above is asynchronous. Re-read authority AFTER it, so the final synchronous
407
+ // checks still stand immediately beside the CDP hand-off rather than before a database wait.
408
+ await this.#afterBuild?.();
409
+ beforeSubmit();
410
+ this.#beforeSubmit?.();
411
+ }
412
+ handedToCdp = true;
413
+ const hash = await this.#raw.submit(this.#user, transaction, idempotencyKey);
414
+ if (this.#submissionJournal && idempotencyKey && journalStep)
415
+ await this.#submissionJournal.submitted(journalStep.index, idempotencyKey, hash);
416
+ return Object.freeze({ hash, ...(idempotencyKey ? { idempotencyKey } : {}) });
417
+ }
418
+ catch (error) {
419
+ if (this.#submissionJournal && idempotencyKey && journalStep) {
420
+ try {
421
+ if (handedToCdp)
422
+ await this.#submissionJournal.unknown(journalStep.index, idempotencyKey);
423
+ else
424
+ await this.#submissionJournal.notSubmitted(journalStep.index, idempotencyKey);
425
+ }
426
+ catch {
427
+ // The durable row already remains unresolved. Never replace the causal refusal with a journal
428
+ // cleanup error, and never retry CDP to compensate for a local write failure.
429
+ }
430
+ }
431
+ // `handedToCdp` flips immediately before entering the raw submission function. While it is false,
432
+ // zero requests are a local fact, independent of the error class (build, journal, authority recheck,
433
+ // or any other pre-handoff failure). Preserve that fact for step 0 so no cleanup transaction creates
434
+ // the first ambiguous request.
435
+ if (!handedToCdp)
436
+ throw new DelegatedPreHandoffError(error);
437
+ throw error;
376
438
  }
377
- return this.#raw.submit(this.#user, transaction);
378
439
  }
379
440
  /**
380
441
  * Fail-closed: once revocation was requested for THE GRANT THIS PLAN IS BOUND TO, nothing more is
@@ -413,36 +474,55 @@ export class CdpDelegatedSigner {
413
474
  await this.#beforeEachStep?.();
414
475
  }
415
476
  catch (error) {
477
+ // Before step 0 no transaction has been built, journaled, or handed to CDP. Propagate the
478
+ // refusal directly so the caller's zero-step finalizer can release the exact claim. Trying an
479
+ // allowance clear here would create the first ambiguous request under a grant that may already
480
+ // have been revoked, turning provable no-send into an unnecessary unknown operation.
481
+ if (index === 0)
482
+ throw error;
416
483
  throw await this.#halt(plan, index, `plan no longer signable before step ${index}: ${error instanceof Error ? error.message : String(error)}`, haltCauseOf(error));
417
484
  }
418
485
  let hash;
419
486
  let receipt;
420
487
  try {
421
- hash = await this.#submit(step, () => {
488
+ const submitted = await this.#submit(step, () => {
422
489
  this.#assertNotRevoked();
423
490
  assertPlanSignableBy(plan, this, Date.now());
424
- });
491
+ }, { index, kind: step.kind });
492
+ hash = submitted.hash;
425
493
  await this.#raw.pub.waitForTransactionReceipt({ hash }); // first sight (may be a preconfirmation) …
426
494
  // … then only the SEALED, CANONICAL receipt counts: the next step is estimated against sealed state,
427
495
  // and a preconfirmation omitted from the sealed block is never reported as success.
428
496
  receipt = await waitForSealedReceipt(this.#raw.pub, hash, this.#sealedWait);
497
+ if (this.#submissionJournal && submitted.idempotencyKey) {
498
+ await this.#submissionJournal.receipt(index, submitted.idempotencyKey, {
499
+ transactionHash: hash,
500
+ status: receipt.status,
501
+ blockNumber: receipt.blockNumber.toString(),
502
+ blockHash: receipt.blockHash,
503
+ gasUsed: receipt.gasUsed.toString(),
504
+ });
505
+ }
429
506
  }
430
507
  catch (error) {
508
+ const cause = error instanceof DelegatedPreHandoffError ? error.original : error;
509
+ if (index === 0 && error instanceof DelegatedPreHandoffError)
510
+ throw cause;
431
511
  /**
432
512
  * 🔴 A REVERTING ESTIMATE BEFORE THE FIRST STEP IS A REFUSAL, NOT A HALT. Nothing of this plan has
433
513
  * reached the chain, so there is no allowance of ours to clear and no reason to spend the user's gas
434
514
  * on a clear; the caller gets the typed reason and may prepare again. From step 1 on, an earlier step
435
515
  * has landed (an allowance may stand), so the halt path runs and the cause is `would_revert`.
436
516
  */
437
- if ((error instanceof DelegatedTransactionWouldRevertError ||
438
- error instanceof DelegatedTransactionEstimateUnavailableError) &&
517
+ if ((cause instanceof DelegatedTransactionWouldRevertError ||
518
+ cause instanceof DelegatedTransactionEstimateUnavailableError) &&
439
519
  index === 0) {
440
- throw error;
520
+ throw cause;
441
521
  }
442
522
  // The CAUSE is classified from the error's structure (`haltCauseOf`); the message carries the upstream
443
523
  // text for the operator and is never what a consumer classifies on.
444
- const errorType = error.errorType;
445
- throw await this.#halt(plan, index, `delegated step ${index} (${step.kind}) failed: ${typeof errorType === 'string' && errorType ? `${errorType} | ` : ''}${error instanceof Error ? error.message : String(error)}`, haltCauseOf(error));
524
+ const errorType = cause.errorType;
525
+ throw await this.#halt(plan, index, `delegated step ${index} (${step.kind}) failed: ${typeof errorType === 'string' && errorType ? `${errorType} | ` : ''}${cause instanceof Error ? cause.message : String(cause)}`, haltCauseOf(cause));
446
526
  }
447
527
  if (receipt.status !== 'success') {
448
528
  throw await this.#halt(plan, index, `delegated step ${index} (${step.kind}) reverted on-chain: ${hash}`, 'reverted');
@@ -462,21 +542,32 @@ export class CdpDelegatedSigner {
462
542
  }
463
543
  /**
464
544
  * After ANY failure: attempt `approve(spender, 0)` under the delegation, then READ the allowance back.
465
- * `allowanceCleared` is true only when the read-back is zero — a mined clear whose read-back is not
466
- * zero, a reverted clear, a failed submission or a failed read all report false with the hand-off.
545
+ * `allowanceCleared` is true only when the live read-back is zero — a mined clear whose read-back is
546
+ * not zero, a reverted clear, a failed submission or a failed read all report false with the hand-off.
547
+ * This is operator context, not finality or durable-claim release evidence.
467
548
  */
468
549
  async #halt(plan, failedStep, message, cause) {
469
550
  const handOff = `clear approve(${plan.spender}, 0) on ${plan.token} BEFORE revoking the delegation`;
470
551
  let hash;
471
552
  try {
472
- hash = await this.#submit({
553
+ const submitted = await this.#submit({
473
554
  to: plan.token,
474
555
  value: 0n,
475
556
  data: encodeFunctionData({ abi: ERC20_APPROVE_ABI, functionName: 'approve', args: [plan.spender, 0n] }),
476
- });
557
+ }, undefined, { index: 3, kind: 'allowance_clear' });
558
+ hash = submitted.hash;
477
559
  await this.#raw.pub.waitForTransactionReceipt({ hash });
478
560
  // The read-back below must see the clear: only its sealed canonical receipt counts.
479
561
  const clearReceipt = await waitForSealedReceipt(this.#raw.pub, hash, this.#sealedWait);
562
+ if (this.#submissionJournal && submitted.idempotencyKey) {
563
+ await this.#submissionJournal.receipt(3, submitted.idempotencyKey, {
564
+ transactionHash: hash,
565
+ status: clearReceipt.status,
566
+ blockNumber: clearReceipt.blockNumber.toString(),
567
+ blockHash: clearReceipt.blockHash,
568
+ gasUsed: clearReceipt.gasUsed.toString(),
569
+ });
570
+ }
480
571
  if (clearReceipt.status !== 'success') {
481
572
  return new DelegatedPlanHaltedError(`${message}; allowance clear ${hash} reverted — ${handOff}`, failedStep, false, cause, hash);
482
573
  }
@@ -3,4 +3,4 @@
3
3
  * `@coinbase/cdp-sdk` is an optional dependency loaded lazily inside `openCdpRig`; importing this
4
4
  * entry never resolves the SDK, and a rig built from raw operations (`createCdpRig`) never needs it.
5
5
  */
6
- export { CDP_CAPABILITIES, CHAIN_ID, CdpDelegatedSigner, DelegatedPlanHaltedError, NETWORK, RevocationRequestedError, createCdpRig, haltCauseOf, openCdpRig, revocationRequested, revokeDelegationByUserId, type CdpDeveloperCredentials, type DelegatedHaltCause, type CdpEndUser, type CdpRawOperations, type CdpRig, } from './adapter/cdp-signer.js';
6
+ export { CDP_CAPABILITIES, CHAIN_ID, CdpDelegatedSigner, DelegatedPlanHaltedError, NETWORK, RevocationRequestedError, createCdpRig, haltCauseOf, openCdpRig, revocationRequested, revokeDelegationByUserId, type CdpDeveloperCredentials, type DelegatedHaltCause, type CdpEndUser, type CdpRawOperations, type CdpRig, type DelegatedSubmissionAttempt, type DelegatedSubmissionJournal, type DelegatedSubmissionReceipt, } from './adapter/cdp-signer.js';
@@ -0,0 +1,141 @@
1
+ import { type PublicClient } from 'viem';
2
+ import { z } from 'zod';
3
+ declare const callsSchema: z.ZodArray<z.ZodObject<{
4
+ to: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
5
+ data: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
6
+ value: z.ZodString;
7
+ }, z.core.$strict>>;
8
+ declare const bindingSchema: z.ZodObject<{
9
+ account: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
10
+ chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<8453>, z.ZodLiteral<42161>, z.ZodLiteral<10>, z.ZodLiteral<137>]>;
11
+ entryPoint: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
12
+ calls: z.ZodArray<z.ZodObject<{
13
+ to: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
14
+ data: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
15
+ value: z.ZodString;
16
+ }, z.core.$strict>>;
17
+ }, z.core.$strict>;
18
+ declare const priceSchema: z.ZodObject<{
19
+ amountAtomic: z.ZodString;
20
+ decimals: z.ZodNumber;
21
+ observedAtMs: z.ZodNumber;
22
+ expiresAtMs: z.ZodNumber;
23
+ }, z.core.$strict>;
24
+ declare const sponsorSchema: z.ZodObject<{
25
+ paymaster: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
26
+ sponsorshipPolicyId: z.ZodString;
27
+ }, z.core.$strict>;
28
+ export type AccountGasQuoteCall = z.input<typeof callsSchema>[number];
29
+ export type AccountGasQuoteBinding = Omit<z.input<typeof bindingSchema>, 'calls'> & {
30
+ calls: readonly AccountGasQuoteCall[];
31
+ };
32
+ export type AccountGasQuoteUsdPrice = z.input<typeof priceSchema>;
33
+ /** The block anchor covers balance, deposit and nonce only. The bundler estimate has no block parameter. */
34
+ export declare const ACCOUNT_GAS_QUOTE_SCHEMA: z.ZodObject<{
35
+ version: z.ZodLiteral<1>;
36
+ kind: z.ZodLiteral<"estimate">;
37
+ payer: z.ZodLiteral<"user">;
38
+ account: z.ZodString;
39
+ chainId: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<8453>, z.ZodLiteral<42161>, z.ZodLiteral<10>, z.ZodLiteral<137>]>;
40
+ entryPoint: z.ZodString;
41
+ nativeAsset: z.ZodObject<{
42
+ symbol: z.ZodEnum<{
43
+ ETH: "ETH";
44
+ POL: "POL";
45
+ }>;
46
+ decimals: z.ZodLiteral<18>;
47
+ }, z.core.$strict>;
48
+ callsCommitment: z.ZodString;
49
+ nonce: z.ZodString;
50
+ blockNumber: z.ZodString;
51
+ blockHash: z.ZodString;
52
+ blockTimestampMs: z.ZodNumber;
53
+ observedAtMs: z.ZodNumber;
54
+ expiresAtMs: z.ZodNumber;
55
+ simulation: z.ZodLiteral<"sender-balance-override">;
56
+ providerEstimate: z.ZodObject<{
57
+ blockAnchor: z.ZodLiteral<"unanchored">;
58
+ startedAtMs: z.ZodNumber;
59
+ completedAtMs: z.ZodNumber;
60
+ elapsedMs: z.ZodNumber;
61
+ }, z.core.$strict>;
62
+ gas: z.ZodObject<{
63
+ callGasLimit: z.ZodString;
64
+ verificationGasLimit: z.ZodString;
65
+ preVerificationGas: z.ZodString;
66
+ maxFeePerGasWei: z.ZodString;
67
+ maxPriorityFeePerGasWei: z.ZodString;
68
+ estimatedPrefundWei: z.ZodString;
69
+ reserveWei: z.ZodString;
70
+ estimatedRequiredWei: z.ZodString;
71
+ reserveBps: z.ZodLiteral<"2500">;
72
+ }, z.core.$strict>;
73
+ balance: z.ZodObject<{
74
+ nativeWei: z.ZodString;
75
+ entryPointDepositWei: z.ZodString;
76
+ callValueWei: z.ZodString;
77
+ depositAppliedToGasWei: z.ZodString;
78
+ walletGasRequirementWei: z.ZodString;
79
+ nativeAvailableForGasWei: z.ZodString;
80
+ gasShortfallWei: z.ZodString;
81
+ requiredNativeWei: z.ZodString;
82
+ shortfallWei: z.ZodString;
83
+ }, z.core.$strict>;
84
+ usdPrice: z.ZodOptional<z.ZodObject<{
85
+ amountAtomic: z.ZodString;
86
+ decimals: z.ZodNumber;
87
+ observedAtMs: z.ZodNumber;
88
+ expiresAtMs: z.ZodNumber;
89
+ }, z.core.$strict>>;
90
+ estimatedGasCostUsdMicros: z.ZodOptional<z.ZodString>;
91
+ sponsoredEstimate: z.ZodOptional<z.ZodObject<{
92
+ kind: z.ZodLiteral<"estimate">;
93
+ simulation: z.ZodLiteral<"paymaster-stub">;
94
+ entryPointVersion: z.ZodLiteral<"0.6">;
95
+ paymaster: z.ZodString;
96
+ sponsorshipPolicyId: z.ZodString;
97
+ paymasterAndDataCommitment: z.ZodString;
98
+ providerEstimate: z.ZodObject<{
99
+ blockAnchor: z.ZodLiteral<"unanchored">;
100
+ startedAtMs: z.ZodNumber;
101
+ completedAtMs: z.ZodNumber;
102
+ elapsedMs: z.ZodNumber;
103
+ }, z.core.$strict>;
104
+ gas: z.ZodObject<{
105
+ callGasLimit: z.ZodString;
106
+ verificationGasLimit: z.ZodString;
107
+ preVerificationGas: z.ZodString;
108
+ maxFeePerGasWei: z.ZodString;
109
+ maxPriorityFeePerGasWei: z.ZodString;
110
+ verificationGasMultiplier: z.ZodLiteral<"3">;
111
+ estimatedPrefundWei: z.ZodString;
112
+ reserveWei: z.ZodString;
113
+ estimatedRequiredWei: z.ZodString;
114
+ reserveBps: z.ZodLiteral<"2500">;
115
+ }, z.core.$strict>;
116
+ estimatedGasCostUsdMicros: z.ZodOptional<z.ZodString>;
117
+ }, z.core.$strict>>;
118
+ }, z.core.$strict>;
119
+ export type AccountGasQuote = z.infer<typeof ACCOUNT_GAS_QUOTE_SCHEMA>;
120
+ export declare class AccountGasQuoteError extends Error {
121
+ readonly code = "ACCOUNT_GAS_QUOTE_UNAVAILABLE";
122
+ constructor(message?: string);
123
+ }
124
+ export declare function accountGasCallsCommitment(calls: readonly AccountGasQuoteCall[]): string;
125
+ export interface PrepareAccountGasQuoteInput extends AccountGasQuoteBinding {
126
+ client: PublicClient;
127
+ /** Operator-configured Pimlico endpoint. Kept out of quotes, hashes and errors. */
128
+ paymasterUrl: string;
129
+ fetch?: typeof globalThis.fetch;
130
+ nowMs?: () => number;
131
+ monotonicNowMs?: () => number;
132
+ /** Optional separately sourced advisory USD price. Missing means unavailable, never zero. */
133
+ usdPrice?: AccountGasQuoteUsdPrice;
134
+ /** Already reviewed source activation identity, never selected by the end user. */
135
+ sponsor?: z.input<typeof sponsorSchema>;
136
+ }
137
+ /** No signer, paymaster sponsorship, submission, account authority or account code reads. */
138
+ export declare function prepareAccountGasQuote(input: PrepareAccountGasQuoteInput): Promise<AccountGasQuote>;
139
+ /** Call synchronously at request start. Persisted copies retain wall-clock expiry but no process-local clock proof. */
140
+ export declare function assertFreshAccountGasQuote(value: AccountGasQuote, input: AccountGasQuoteBinding, nowMs?: number): void;
141
+ export {};