@black-market/sdk 0.15.0 → 0.16.0

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 (113) hide show
  1. package/README.md +10 -8
  2. package/dist/lifecycle/auto-compound.d.ts +21 -0
  3. package/dist/lifecycle/auto-compound.d.ts.map +1 -0
  4. package/dist/lifecycle/auto-compound.js +34 -0
  5. package/dist/lifecycle/auto-compound.js.map +1 -0
  6. package/dist/lifecycle/calibration.d.ts +2 -4
  7. package/dist/lifecycle/calibration.d.ts.map +1 -1
  8. package/dist/lifecycle/calibration.js +1 -26
  9. package/dist/lifecycle/calibration.js.map +1 -1
  10. package/dist/lifecycle/deployments/auto-compound-dynamic-pool-v1-20261028.d.ts +73 -0
  11. package/dist/lifecycle/deployments/auto-compound-dynamic-pool-v1-20261028.d.ts.map +1 -0
  12. package/dist/lifecycle/deployments/auto-compound-dynamic-pool-v1-20261028.js +75 -0
  13. package/dist/lifecycle/deployments/auto-compound-dynamic-pool-v1-20261028.js.map +1 -0
  14. package/dist/lifecycle/deployments/auto-compound-static-pool-v1-20261028.d.ts +73 -0
  15. package/dist/lifecycle/deployments/auto-compound-static-pool-v1-20261028.d.ts.map +1 -0
  16. package/dist/lifecycle/deployments/auto-compound-static-pool-v1-20261028.js +75 -0
  17. package/dist/lifecycle/deployments/auto-compound-static-pool-v1-20261028.js.map +1 -0
  18. package/dist/lifecycle/deployments/raeto-dynamic-pool-v1-20261029.d.ts +71 -0
  19. package/dist/lifecycle/deployments/raeto-dynamic-pool-v1-20261029.d.ts.map +1 -0
  20. package/dist/lifecycle/deployments/raeto-dynamic-pool-v1-20261029.js +73 -0
  21. package/dist/lifecycle/deployments/raeto-dynamic-pool-v1-20261029.js.map +1 -0
  22. package/dist/lifecycle/deployments/raeto-fixed-pool-v1-20261029.d.ts +71 -0
  23. package/dist/lifecycle/deployments/raeto-fixed-pool-v1-20261029.d.ts.map +1 -0
  24. package/dist/lifecycle/deployments/raeto-fixed-pool-v1-20261029.js +73 -0
  25. package/dist/lifecycle/deployments/raeto-fixed-pool-v1-20261029.js.map +1 -0
  26. package/dist/lifecycle/gas-profile.d.ts +17 -13
  27. package/dist/lifecycle/gas-profile.d.ts.map +1 -1
  28. package/dist/lifecycle/gas-profile.js +133 -113
  29. package/dist/lifecycle/gas-profile.js.map +1 -1
  30. package/dist/lifecycle/index.d.ts +6 -4
  31. package/dist/lifecycle/index.d.ts.map +1 -1
  32. package/dist/lifecycle/index.js +6 -4
  33. package/dist/lifecycle/index.js.map +1 -1
  34. package/dist/lifecycle/markets.d.ts +4 -0
  35. package/dist/lifecycle/markets.d.ts.map +1 -1
  36. package/dist/lifecycle/markets.js +58 -3
  37. package/dist/lifecycle/markets.js.map +1 -1
  38. package/dist/lifecycle/opening-buys.js +3 -3
  39. package/dist/lifecycle/opening-buys.js.map +1 -1
  40. package/dist/lifecycle/planner.d.ts +6 -9
  41. package/dist/lifecycle/planner.d.ts.map +1 -1
  42. package/dist/lifecycle/planner.js +122 -208
  43. package/dist/lifecycle/planner.js.map +1 -1
  44. package/dist/lifecycle/presets.d.ts +9 -3
  45. package/dist/lifecycle/presets.d.ts.map +1 -1
  46. package/dist/lifecycle/presets.js +17 -1
  47. package/dist/lifecycle/presets.js.map +1 -1
  48. package/dist/lifecycle/raeto-abi.d.ts +175 -0
  49. package/dist/lifecycle/raeto-abi.d.ts.map +1 -0
  50. package/dist/lifecycle/raeto-abi.js +224 -0
  51. package/dist/lifecycle/raeto-abi.js.map +1 -0
  52. package/dist/lifecycle/raeto.d.ts +21 -0
  53. package/dist/lifecycle/raeto.d.ts.map +1 -0
  54. package/dist/lifecycle/raeto.js +59 -0
  55. package/dist/lifecycle/raeto.js.map +1 -0
  56. package/dist/lifecycle/rpc.d.ts +3 -13
  57. package/dist/lifecycle/rpc.d.ts.map +1 -1
  58. package/dist/lifecycle/rpc.js +11 -37
  59. package/dist/lifecycle/rpc.js.map +1 -1
  60. package/dist/lifecycle/snapshot.d.ts.map +1 -1
  61. package/dist/lifecycle/snapshot.js +1 -2
  62. package/dist/lifecycle/snapshot.js.map +1 -1
  63. package/dist/lifecycle/transactions.d.ts +10 -3
  64. package/dist/lifecycle/transactions.d.ts.map +1 -1
  65. package/dist/lifecycle/transactions.js +47 -10
  66. package/dist/lifecycle/transactions.js.map +1 -1
  67. package/dist/lifecycle/types.d.ts +32 -107
  68. package/dist/lifecycle/types.d.ts.map +1 -1
  69. package/dist/lifecycle/types.js +3 -3
  70. package/dist/lifecycle/types.js.map +1 -1
  71. package/dist/lifecycle/ufg.d.ts +1 -1
  72. package/dist/lifecycle/ufg.d.ts.map +1 -1
  73. package/dist/lifecycle/ufg.js +1 -1
  74. package/dist/lifecycle/ufg.js.map +1 -1
  75. package/docs/launch-lifecycle.md +113 -1
  76. package/docs/lifecycle-gas-profiles.md +141 -24
  77. package/docs/reference.md +112 -3
  78. package/examples/.env.example +0 -3
  79. package/examples/README.md +11 -11
  80. package/examples/launch-example-support.ts +4 -9
  81. package/examples/launch-example.ts +12 -28
  82. package/examples/launch-lifecycle-smoke.ts +10 -22
  83. package/examples/launch.ts +8 -11
  84. package/package.json +1 -1
  85. package/src/lifecycle/auto-compound.ts +38 -0
  86. package/src/lifecycle/calibration.ts +3 -23
  87. package/src/lifecycle/deployments/auto-compound-dynamic-pool-v1-20261028.ts +77 -0
  88. package/src/lifecycle/deployments/auto-compound-static-pool-v1-20261028.ts +77 -0
  89. package/src/lifecycle/deployments/raeto-dynamic-pool-v1-20261029.ts +74 -0
  90. package/src/lifecycle/deployments/raeto-fixed-pool-v1-20261029.ts +74 -0
  91. package/src/lifecycle/gas-profile.ts +125 -104
  92. package/src/lifecycle/index.ts +6 -4
  93. package/src/lifecycle/markets.ts +47 -3
  94. package/src/lifecycle/opening-buys.ts +3 -3
  95. package/src/lifecycle/planner.ts +116 -191
  96. package/src/lifecycle/presets.ts +17 -1
  97. package/src/lifecycle/raeto-abi.ts +223 -0
  98. package/src/lifecycle/raeto.ts +61 -0
  99. package/src/lifecycle/rpc.ts +10 -32
  100. package/src/lifecycle/snapshot.ts +1 -2
  101. package/src/lifecycle/transactions.ts +46 -9
  102. package/src/lifecycle/types.ts +38 -87
  103. package/src/lifecycle/ufg.ts +1 -1
  104. package/dist/lifecycle/fork.d.ts +0 -15
  105. package/dist/lifecycle/fork.d.ts.map +0 -1
  106. package/dist/lifecycle/fork.js +0 -36
  107. package/dist/lifecycle/fork.js.map +0 -1
  108. package/dist/lifecycle/simulation.d.ts +0 -17
  109. package/dist/lifecycle/simulation.d.ts.map +0 -1
  110. package/dist/lifecycle/simulation.js +0 -605
  111. package/dist/lifecycle/simulation.js.map +0 -1
  112. package/src/lifecycle/fork.ts +0 -36
  113. package/src/lifecycle/simulation.ts +0 -543
@@ -5,13 +5,10 @@ import type {
5
5
  MarketLiveStateV1, PreparedMarketV1, ProfileRegistrationV1, ProfileTopologyV1, LaunchEnvelopeV2, LifecycleDeveloperTerms,
6
6
  } from "./schema.js";
7
7
 
8
- /** Local opt-in timing only: never contains request arguments, addresses, results or errors.
9
- * Since 0.14.0, removed replay/envelope stages are represented by simulation.measure,
10
- * which includes the final validated execution at the returned gas envelope. */
8
+ /** Local opt-in timing only: never contains request arguments, addresses, results or errors. */
11
9
  export type LifecycleDiagnosticStage =
12
10
  | "plan" | "plan.context" | "plan.domain" | "plan.progress" | "plan.inputs" | "rpc"
13
- | "profile.certification" | "simulation.context" | "simulation.nitro"
14
- | "simulation.poster" | "simulation.measure" | "session-cache";
11
+ | "profile.certification" | "session-cache";
15
12
  export type LifecycleDiagnosticEvent = {
16
13
  stage: LifecycleDiagnosticStage;
17
14
  phase: "queued" | "start" | "success" | "failure" | "reuse";
@@ -31,13 +28,13 @@ export type LifecycleRpcClient = {
31
28
  request(args: { method: string; params?: readonly unknown[] }): Promise<unknown>;
32
29
  /** Opt in to bounded parallel reads only when the supplied transport batches concurrent requests. */
33
30
  supportsReadBatching?: boolean;
34
- /** Optional local observer. Listener failures cannot change execution or admission. */
31
+ /** Optional local observer. Listener failures cannot change planning or sending. */
35
32
  onDiagnostic?: LifecycleDiagnosticListener;
36
33
  /** Caller-owned, opt-in static observations; create with createLifecycleSessionCache(). */
37
34
  sessionCache?: LifecycleSessionCache;
38
35
  };
39
36
  export type LifecycleBlock = { number: bigint; hash: Hash; timestamp: bigint; gasLimit: bigint; baseFeePerGas?: bigint };
40
- /** A session retains pinned static reads and deployment/backend capability observations. */
37
+ /** A session retains pinned static reads and deployment metadata observations. */
41
38
  export type LifecycleSessionCache = {
42
39
  readonly block: Readonly<Pick<LifecycleBlock, "number" | "hash">> | undefined;
43
40
  /** Call on wallet/chain changes and after every confirmed transaction. */
@@ -48,8 +45,6 @@ export type LifecycleLimits = {
48
45
  /** Optional tightening caps on the complete transaction gas envelope, including Nitro poster gas. */
49
46
  headroomBps?: number; chainGasLimit?: bigint; rpcGasLimit?: bigint; accountGasLimit?: bigint;
50
47
  maxCalldataBytes?: number;
51
- /** Optional aggregate gas-used policy ceiling for one simulation request; no SDK-invented default window. */
52
- maxSimulationGas?: bigint;
53
48
  chainId?: bigint; orchestrator?: Address; account?: Address; observedBlockNumber?: bigint; observedBlockHash?: Hash;
54
49
  /** External data fee not already charged in gas, called with exact calldata and the pinned block.
55
50
  * Nitro poster fees are already included in gas, bounded locally from same-review ArbGasInfo prices. */
@@ -59,18 +54,10 @@ export type LifecycleLimitSource = LifecycleLimits | ((context: LifecycleLimitCo
59
54
  export type ResolvedLifecycleLimits = {
60
55
  /** Fixed native transaction ceiling, including poster gas; caller caps may refuse but never resize it. */
61
56
  executionGasCeiling: bigint; transactionGasCeiling?: bigint; protocol: "evm" | "nitro";
62
- arbOSVersion?: bigint;
63
- headroomBps: number; maxCalldataBytes?: number; maxSimulationGas?: bigint;
57
+ headroomBps: number; maxCalldataBytes?: number;
64
58
  blockGasLimit: bigint; chainGasLimit?: bigint; rpcGasLimit?: bigint; accountGasLimit?: bigint;
65
59
  unknownExecutionConstraints: readonly string[]; unknownConstraints: readonly string[];
66
60
  };
67
- /** Only explicitly disposable RPCs may execute snapshot-isolated simulation transactions. */
68
- export type ControlledLifecycleFork = {
69
- client: LifecycleRpcClient; isolation: "disposable"; allowTransactions: true;
70
- expectedChainId?: bigint; expectedBlockHash?: Hash; impersonation?: "anvil" | "hardhat" | "none";
71
- receiptTimeoutMs?: number;
72
- sourceRpcUrl: string; forkRpcUrl: string; resetMethod?: "anvil_reset" | "hardhat_reset";
73
- };
74
61
  export type LifecycleTransactionKind = "approve-reset" | "approve" | "atomic" | "begin" | "prepare" | "activate" | "cancel";
75
62
  export type LifecyclePostcondition =
76
63
  | { kind: "allowance"; asset: Address; spender: Address; minimum: bigint; exact?: bigint }
@@ -81,70 +68,42 @@ export type LifecycleTransaction = {
81
68
  marketStart?: number; marketCount?: number; gas?: bigint; gasPrice?: bigint;
82
69
  /** Exact encoded byte count; populated on SDK-built commands, including approvals. */
83
70
  calldataBytes?: number;
84
- /** Only the immediate command receives its current fee and admission.
85
- * Executable launch gas is the native ceiling; approvals leave gas to the wallet. */
86
- admission?: LifecycleAdmission;
71
+ /** Only the immediate command receives current planning checks and fees.
72
+ * Launch gas is the native ceiling; approvals leave gas to the wallet. */
73
+ assessment?: LifecyclePlanningAssessment;
87
74
  estimate?: LifecycleTransactionEstimate;
88
75
  };
89
76
  export type LifecycleTransactionEstimate = {
90
- /** Present only for measured execution; a ceiling budget never fabricates gas usage. */
91
- gasUsed?: bigint; gasLimit: bigint; gasPrice: bigint; executionFee: bigint; dataFee?: bigint; totalFee?: bigint;
92
- /** Estimated poster allocation within gasLimit, never an exact compute measurement or an extra fee. */
77
+ gasLimit: bigint; gasPrice: bigint; executionFee: bigint; dataFee?: bigint; totalFee?: bigint;
78
+ /** Estimated poster allocation within gasLimit, never a measured or additional fee. */
93
79
  posterGas?: bigint; posterFee?: bigint; dataFeeIncludedInGas: boolean;
94
- feeConfidence: "execution-and-data" | "execution-only" | "native-ceiling-and-data";
95
- };
96
- /** Proof scopes are independent: current execution is not guaranteed wallet submission. */
97
- export type LifecycleProofOutcomes = {
98
- executionProof: "proved" | "failed" | "unavailable" | "not-run";
99
- protocolFit: "proved" | "failed" | "unknown" | "profiled";
100
- };
101
- export type LifecycleAdmission = LifecycleProofOutcomes & {
102
- admitted: boolean; confidence: "stateful" | "provisional" | "profiled";
103
- blockNumber: bigint; blockHash: Hash; account: Address; chainId: bigint;
104
- reason?: string; limits: ResolvedLifecycleLimits;
105
- };
106
- export type LifecycleFailureCategory = "semantic" | "capacity" | "opaque" | "source" | "postcondition" | "affordability";
107
- export type LifecycleCapacityConstraint = "compute" | "gas-envelope" | "calldata" | "simulation-gas" | "activation";
108
- export type LifecycleSimulationStep = {
109
- transactionId: string; success: boolean; gasUsed?: bigint; gasLimit?: bigint; gasRequired?: bigint;
110
- returnData?: Hex; error?: string; estimate?: LifecycleTransactionEstimate;
111
- /** Suffix proof is historical and provisional; only a fresh build admits
112
- * its immediate transaction, still at the native ceiling and current fee. */
113
- provisional?: boolean;
114
- failureCategory?: LifecycleFailureCategory; decodedError?: string;
115
- /** Safe failed-call facts only; native messages and error-data bytes are never copied here. */
116
- nativeErrorCode?: number;
117
- nativeErrorKind?: "out-of-gas" | "execution-reverted" | "vm-error" | "other" | "missing";
118
- nativeErrorDataBytes?: number;
119
- /** Explicit native simulator report, not inferred from gas consumption or the requested limit. */
120
- nativeGasCapped?: boolean;
80
+ feeConfidence: "native-ceiling-and-data" | "native-ceiling-only";
121
81
  };
82
+ export type LifecycleFailureCategory = "semantic" | "capacity" | "affordability";
83
+ export type LifecycleCapacityConstraint = "gas-envelope" | "calldata" | "activation" | "preparation";
122
84
  export type LifecycleOpeningBuyQuote = {
123
85
  buyIndex: number; marketIndex: number; quoteAmountIn: bigint; quoteSpent: bigint;
124
86
  tokenOut: bigint; sqrtPriceAfterX96: bigint;
125
87
  };
126
- /** Conservative compute bounds used for mode/capacity decisions, never gas-limit sizing.
127
- * An upper bound above the ceiling is uncertain, not proof of impossibility. */
88
+ /** Versioned compute budgets with headroom, never transaction gas-limit sizing.
89
+ * Atomic budget is absent when conversion work is outside the template model. */
128
90
  export type LifecycleLaunchGasBounds = {
129
- atomicComputeGasUpperBound: bigint; activationComputeGasUpperBound: bigint;
91
+ atomicComputeGasUpperBound?: bigint; activationComputeGasUpperBound: bigint;
130
92
  };
131
- export type LifecycleGasProfileEvidence = {
93
+ export type LifecycleGasProfile = {
132
94
  version: string; bounds: LifecycleLaunchGasBounds;
133
95
  initialBuys: readonly LifecycleOpeningBuyQuote[];
134
96
  };
135
- export type LifecycleSimulation = LifecycleProofOutcomes & {
136
- backend: "eth_simulateV1" | "controlled-fork" | "unavailable" | "profiled";
137
- /** Stateful execution or versioned profile coverage; only the immediate envelope is final. */
138
- confidence: "stateful" | "provisional" | "profiled"; admitted: boolean;
97
+ /** Pinned input and gas-budget checks only. No transaction is simulated or proved. */
98
+ export type LifecyclePlanningAssessment = {
99
+ ready: boolean;
139
100
  blockNumber: bigint; blockHash: Hash; account: Address; chainId: bigint;
140
- steps: readonly LifecycleSimulationStep[]; limits: ResolvedLifecycleLimits;
141
- /** Immediate fixed-ceiling fee budget; absent for wallet-prepared approvals. */
101
+ limits: ResolvedLifecycleLimits;
102
+ /** Immediate native-ceiling fee budget; absent for wallet-prepared approvals. */
142
103
  estimate?: LifecycleTransactionEstimate;
143
- gasProfile?: LifecycleGasProfileEvidence;
144
- /** Work outside the returned admission, including an RPC-cap failed suffix. */
145
- deferredTransactionIds: readonly string[];
146
- reason?: string; failedTransactionId?: string;
147
- /** A payer must reserve the native ceiling up front even if actual gas usage is lower. */
104
+ gasProfile?: LifecycleGasProfile;
105
+ /** Controlled SDK code and user-safe actionable reason, never raw provider errors. */
106
+ code?: string; reason?: string; failedTransactionId?: string;
148
107
  failureCategory?: LifecycleFailureCategory; capacityConstraint?: LifecycleCapacityConstraint;
149
108
  };
150
109
  export type LifecycleFundingPrerequisite = {
@@ -190,24 +149,24 @@ export type PlannedLaunch = {
190
149
  account: Address; chainId: bigint; mode: LaunchExecutionMode; confirmations: number;
191
150
  /** Opt-in proxy routing; the committed creator remains the proxy, account is its principal. */
192
151
  ufg?: { config: UfgLaunchConfig; configHash: Hash };
193
- /** Only transactions[0] has fresh immediate admission/fees. Launch gas is fixed
194
- * at the native ceiling; wallet-assigned nonce and approval gas are omitted. */
152
+ /** Only transactions[0] has fresh immediate planning checks/fees. Launch gas is
153
+ * the native ceiling; wallet-assigned nonce and approval gas are omitted. */
195
154
  transactions: readonly LifecycleTransaction[]; prerequisites: readonly LifecycleFundingPrerequisite[];
196
155
  /** Sum of exact calldata bytes across the returned remaining commands, including approvals. */
197
156
  totalCalldataBytes: number;
198
- profiles: readonly (LifecycleProfile | LifecycleConstructionProfile)[]; simulation: LifecycleSimulation;
157
+ profiles: readonly (LifecycleProfile | LifecycleConstructionProfile)[]; assessment: LifecyclePlanningAssessment;
199
158
  /** Exact CREATE2 metadata captured from the final committed bound markets. */
200
159
  hookDeployments: readonly LifecyclePoolBoundHookDeployment[];
201
160
  progress: CanonicalLaunchProgress;
202
161
  limits?: LifecycleLimitSource;
203
- /** Unstarted-launch admission choices only; never part of the committed plan or calldata. */
162
+ /** Unstarted-launch construction choices; never part of committed calldata. */
204
163
  allowTopologyGaps?: boolean; allowMissingPermanentTail?: boolean;
205
164
  };
206
165
  export type PlanLaunchOptions = {
207
166
  client: LifecycleRpcClient; account: Address; plan: LaunchPlanV1;
208
- /** Atomic is a preference: conservative capacity may select staged before begin.
209
- * Explicit staged and an already-started launch's recorded mode are retained. */
210
- mode: LaunchExecutionMode; limits?: LifecycleLimitSource; fork?: ControlledLifecycleFork; receipts?: readonly LifecycleReceiptReference[];
167
+ /** Atomic requires one market, no conversion and a known budget fitting with headroom.
168
+ * All other unstarted launches are staged; started launches retain canonical mode. */
169
+ mode: LaunchExecutionMode; limits?: LifecycleLimitSource; receipts?: readonly LifecycleReceiptReference[];
211
170
  confirmations?: number; signal?: AbortSignal;
212
171
  /** Opt in to the pinned UFG proxy; sender must match the nonce's principal namespace. */
213
172
  ufg?: { config: UfgLaunchConfig };
@@ -218,8 +177,8 @@ export type PlanLaunchOptions = {
218
177
  };
219
178
  export type PrepareAndPlanLifecycleLaunchOptions = PlanLaunchOptions & {
220
179
  onProgress?: (progress: PoolBoundLifecyclePreparationProgress) => void;
221
- /** Protect ordered buys from exact local curve outputs or native diagnostics,
222
- * rounded down. Omitted preserves committed minima; unstarted launches only. */
180
+ /** Protect ordered buys from exact local curve outputs, rounded down.
181
+ * Omitted preserves committed minima; unstarted launches only. */
223
182
  buySlippageBps?: number;
224
183
  };
225
184
  export type BuildLaunchTransactionsOptions = {
@@ -227,29 +186,21 @@ export type BuildLaunchTransactionsOptions = {
227
186
  /** Positive ordered preparation counts covering every market exactly. Staged only. */
228
187
  preparationBatches?: readonly number[];
229
188
  };
230
- export type SimulateLaunchPlanOptions = {
231
- client: LifecycleRpcClient; planned: PlannedLaunch; limits?: LifecycleLimitSource; fork?: ControlledLifecycleFork;
232
- /** Submitted receipt evidence and confirmation depth are inherited from the
233
- * stored plan when omitted, exactly as build-next consumes them; resimulation
234
- * never silently drops submitted-transaction context. */
235
- receipts?: readonly LifecycleReceiptReference[]; confirmations?: number;
236
- signal?: AbortSignal;
237
- };
238
189
  export type ReadLaunchProgressOptions = {
239
190
  client: LifecycleRpcClient; planned: Pick<PlannedLaunch, "plan" | "planHash" | "launchId" | "predictedToken" | "account" | "mode" | "confirmations" | "ufg">;
240
191
  receipts?: readonly LifecycleReceiptReference[]; confirmations?: number;
241
192
  signal?: AbortSignal;
242
193
  };
243
194
  export type BuildNextTransactionOptions = ReadLaunchProgressOptions & {
244
- planned: PlannedLaunch; action?: "continue" | "cancel"; limits?: LifecycleLimitSource; fork?: ControlledLifecycleFork;
195
+ planned: PlannedLaunch; action?: "continue" | "cancel"; limits?: LifecycleLimitSource;
245
196
  /** Untrusted reviewed intent/fee. Gas differing from the native ceiling is stale;
246
197
  * never resize it, bump a held fee or assign a wallet nonce. */
247
198
  reviewedTransaction?: LifecycleTransaction;
248
199
  };
249
200
  export class LifecyclePlanningError extends Error {
250
201
  readonly code: string;
251
- readonly simulation?: LifecycleSimulation;
252
- constructor(code: string, message: string, simulation?: LifecycleSimulation) {
253
- super(message); this.name = "LifecyclePlanningError"; this.code = code; this.simulation = simulation;
202
+ readonly assessment?: LifecyclePlanningAssessment;
203
+ constructor(code: string, message: string, assessment?: LifecyclePlanningAssessment) {
204
+ super(message); this.name = "LifecyclePlanningError"; this.code = code; this.assessment = assessment;
254
205
  }
255
206
  }
@@ -10,7 +10,7 @@ import { buildUfgFeeAssetPolicies, encodeUfgLaunchConfig, hashUfgLaunchConfig, i
10
10
 
11
11
  export { UFG_LAUNCH_PROXY_ADDRESS, UFG_TREASURY_FACTORY_ADDRESS, UFG_UPSTREAM_FACTORY_ADDRESS, UFG_ORCHESTRATOR_ADDRESS, UFG_FIXED_PROFILE_ID, UFG_DYNAMIC_PROFILE_ID, UFG_FIXED_ADAPTER_ID, UFG_DYNAMIC_ADAPTER_ID, isUfgProfile, ufgLaunchConfigComponents, encodeUfgLaunchConfig, decodeUfgLaunchConfig, hashUfgLaunchConfig, validateUfgLaunchConfig, ufgLaunchNonce, buildUfgFeeAssetPolicies, type UfgLaunchConfig } from "./ufg-config.js";
12
12
 
13
- /** Offline proxy-specific admission. Live token/reserve code, registry and transfer checks still require simulation. */
13
+ /** Offline proxy-specific intent checks. Registry, transfers and reserve behavior are enforced on-chain. */
14
14
  export function validateUfgLaunchPlan(plan: LaunchPlanV1, config: UfgLaunchConfig, predictedToken: Address): void {
15
15
  try {
16
16
  ufgPlanPrincipal(plan);
@@ -1,15 +0,0 @@
1
- import { type ControlledLifecycleFork } from "./types.js";
2
- /**
3
- * Connects an explicitly disposable loopback fork. Only the fork receives resets/transactions;
4
- * sourceRpcUrl is used by the fork node for read-only canonical state synchronization.
5
- */
6
- export declare function createControlledLifecycleFork(options: {
7
- sourceRpcUrl: string;
8
- forkRpcUrl: string;
9
- allowTransactions: true;
10
- fetch?: typeof globalThis.fetch;
11
- impersonation?: "anvil" | "hardhat" | "none";
12
- resetMethod?: "anvil_reset" | "hardhat_reset";
13
- receiptTimeoutMs?: number;
14
- }): ControlledLifecycleFork;
15
- //# sourceMappingURL=fork.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fork.d.ts","sourceRoot":"","sources":["../../src/lifecycle/fork.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,uBAAuB,EAA2B,MAAM,YAAY,CAAC;AAG3G;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE;IACrD,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,IAAI,CAAC;IAClE,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAAC,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IAC9E,WAAW,CAAC,EAAE,aAAa,GAAG,eAAe,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC1E,GAAG,uBAAuB,CAwB1B"}
@@ -1,36 +0,0 @@
1
- import { LifecyclePlanningError } from "./types.js";
2
- import { rpcObject } from "./rpc.js";
3
- /**
4
- * Connects an explicitly disposable loopback fork. Only the fork receives resets/transactions;
5
- * sourceRpcUrl is used by the fork node for read-only canonical state synchronization.
6
- */
7
- export function createControlledLifecycleFork(options) {
8
- const source = new URL(options.sourceRpcUrl);
9
- const fork = new URL(options.forkRpcUrl);
10
- if (!["http:", "https:"].includes(source.protocol) || !["http:", "https:"].includes(fork.protocol))
11
- throw new LifecyclePlanningError("UNSAFE_FORK", "Controlled fork RPCs must use HTTP(S)");
12
- const loopback = ["localhost", "127.0.0.1", "[::1]", "::1"];
13
- const sourcePort = source.port || (source.protocol === "https:" ? "443" : "80");
14
- const forkPort = fork.port || (fork.protocol === "https:" ? "443" : "80");
15
- if (!loopback.includes(fork.hostname) || (loopback.includes(source.hostname) && sourcePort === forkPort) || source.href === fork.href || options.allowTransactions !== true)
16
- throw new LifecyclePlanningError("UNSAFE_FORK", "Controlled fork must be an explicit, distinct disposable loopback RPC, not a localhost/IP alias of the source");
17
- const fetch = options.fetch ?? globalThis.fetch;
18
- let id = 0;
19
- const client = {
20
- async request({ method, params }) {
21
- const response = await fetch(fork.href, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ jsonrpc: "2.0", id: ++id, method, params: params ?? [] }) });
22
- if (!response.ok)
23
- throw new LifecyclePlanningError("FORK_RPC_ERROR", `Disposable fork RPC returned HTTP ${response.status}`);
24
- const result = rpcObject(await response.json(), "fork JSON-RPC envelope");
25
- if (result.error !== undefined) {
26
- const error = rpcObject(result.error, "fork JSON-RPC error");
27
- throw new LifecyclePlanningError("FORK_RPC_ERROR", typeof error.message === "string" ? error.message : "Disposable fork RPC returned an error");
28
- }
29
- if (!("result" in result))
30
- throw new LifecyclePlanningError("INVALID_RPC_RESPONSE", "Disposable fork RPC omitted its result");
31
- return result.result;
32
- },
33
- };
34
- return { client, isolation: "disposable", allowTransactions: true, sourceRpcUrl: source.href, forkRpcUrl: fork.href, resetMethod: options.resetMethod ?? "anvil_reset", impersonation: options.impersonation ?? "anvil", receiptTimeoutMs: options.receiptTimeoutMs };
35
- }
36
- //# sourceMappingURL=fork.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fork.js","sourceRoot":"","sources":["../../src/lifecycle/fork.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAyD,MAAM,YAAY,CAAC;AAC3G,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC;;;GAGG;AACH,MAAM,UAAU,6BAA6B,CAAC,OAI7C;IACC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACzC,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,C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- import { type LifecycleBlock, type LifecycleSimulation, type LifecycleTransaction, type SimulateLaunchPlanOptions } from "./types.js";
2
- /** Internal, operation-local fee envelope for the already matched immediate step. */
3
- export type NextTransactionEnvelope = Readonly<{
4
- gas: bigint;
5
- gasPrice: bigint;
6
- }>;
7
- export type PreparedLaunchSimulation = ((transactions: readonly LifecycleTransaction[], nextEnvelope?: NextTransactionEnvelope) => Promise<LifecycleSimulation>) & {
8
- /** Unadmitted diagnostic results only; final measurement validates exact calldata. */
9
- measure(transactions: readonly LifecycleTransaction[]): Promise<LifecycleSimulation>;
10
- close(): void;
11
- };
12
- export declare function observedFields<T extends object>(value: T): () => boolean;
13
- /** Internal continuation owned by one SDK read invocation. Only its positive
14
- * capability proof is reused; every candidate executes its entire economic sequence. */
15
- export declare function prepareLaunchSimulation(options: SimulateLaunchPlanOptions, block: LifecycleBlock, hasTransactions?: boolean, immediate?: boolean): PreparedLaunchSimulation;
16
- export declare function simulateLaunchTransactions(options: SimulateLaunchPlanOptions, transactions: readonly LifecycleTransaction[], pinnedBlock?: LifecycleBlock, nextEnvelope?: NextTransactionEnvelope): Promise<LifecycleSimulation>;
17
- //# sourceMappingURL=simulation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"simulation.d.ts","sourceRoot":"","sources":["../../src/lifecycle/simulation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAwD,KAAK,cAAc,EAAoF,KAAK,mBAAmB,EAAgC,KAAK,oBAAoB,EAAoD,KAAK,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAoS9V,qFAAqF;AACrF,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAClF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,YAAY,EAAE,SAAS,oBAAoB,EAAE,EAAE,YAAY,CAAC,EAAE,uBAAuB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC,GAAG;IACjK,sFAAsF;IACtF,OAAO,CAAC,YAAY,EAAE,SAAS,oBAAoB,EAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACrF,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAEF,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,OAAO,CAIxE;AAED;wFACwF;AACxF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,yBAAyB,EAAE,KAAK,EAAE,cAAc,EAAE,eAAe,UAAO,EAAE,SAAS,UAAQ,GAAG,wBAAwB,CAgHtK;AAED,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,yBAAyB,EAAE,YAAY,EAAE,SAAS,oBAAoB,EAAE,EAAE,WAAW,CAAC,EAAE,cAAc,EAAE,YAAY,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAStO"}