@aurora-is-near/intents-connect 7.23.0 → 7.24.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 (48) hide show
  1. package/README.md +68 -3
  2. package/dist/chunks/recovery-DHInVjvA.js +1610 -0
  3. package/dist/chunks/recovery-DHInVjvA.js.map +1 -0
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.js +75 -74
  6. package/dist/index.js.map +1 -1
  7. package/dist/machine/guards/checks/feeWithinBudget.d.ts +9 -0
  8. package/dist/machine/guards/index.d.ts +1 -0
  9. package/dist/react/index.js +102 -93
  10. package/dist/react/index.js.map +1 -1
  11. package/dist/react/useExecution.d.ts +11 -1
  12. package/dist/runner/constants.d.ts +2 -0
  13. package/dist/runner/flows/previewSteps.d.ts +10 -0
  14. package/dist/runner/flows/resume.d.ts +6 -0
  15. package/dist/runner/flows/runSteps.d.ts +11 -0
  16. package/dist/runner/identity.d.ts +22 -0
  17. package/dist/runner/index.d.ts +1 -1
  18. package/dist/runner/isolated.d.ts +14 -0
  19. package/dist/runner/planHelpers.d.ts +26 -5
  20. package/dist/runner/stages/create.d.ts +23 -6
  21. package/dist/runner/stages/planStepsOnly.d.ts +45 -0
  22. package/dist/runner/types.d.ts +68 -1
  23. package/dist/types/execution.d.ts +12 -2
  24. package/dist/types/recipe.d.ts +4 -1
  25. package/package.json +1 -1
  26. package/src/api/generated/conformance.ts +21 -1
  27. package/src/index.ts +2 -0
  28. package/src/machine/guards/checks/feeWithinBudget.ts +18 -0
  29. package/src/machine/guards/index.ts +1 -0
  30. package/src/react/useExecution.ts +29 -0
  31. package/src/runner/constants.ts +2 -0
  32. package/src/runner/createExecutionRunner.ts +7 -0
  33. package/src/runner/flows/preview.ts +5 -36
  34. package/src/runner/flows/previewSteps.ts +125 -0
  35. package/src/runner/flows/resume.ts +37 -4
  36. package/src/runner/flows/run.ts +20 -64
  37. package/src/runner/flows/runSteps.ts +72 -0
  38. package/src/runner/identity.ts +80 -0
  39. package/src/runner/index.ts +2 -0
  40. package/src/runner/isolated.ts +53 -0
  41. package/src/runner/planHelpers.ts +50 -6
  42. package/src/runner/stages/create.ts +32 -22
  43. package/src/runner/stages/planStepsOnly.ts +201 -0
  44. package/src/runner/types.ts +70 -1
  45. package/src/types/execution.ts +13 -2
  46. package/src/types/recipe.ts +4 -1
  47. package/dist/chunks/recovery-VJ9R3WuV.js +0 -1431
  48. package/dist/chunks/recovery-VJ9R3WuV.js.map +0 -1
package/README.md CHANGED
@@ -227,6 +227,71 @@ application-specific `validateExecution` check to `resume()` again. Existing
227
227
  safe deposit-resume rules still apply: persist the execution ID and deposit
228
228
  hash, and do not force `depositViaWallet: true` if a deposit may be in flight.
229
229
 
230
- This adds bridge-in support only. The service's full transaction size, compute
231
- budget, gasless USDC fee handling, and actual recipient delivery still need a
232
- controlled integration check before enabling a swap route.
230
+ The service's full transaction size, compute budget, gasless USDC fee handling,
231
+ and actual recipient delivery still need a controlled integration check before
232
+ enabling a swap route.
233
+
234
+ ## Steps-only executions
235
+
236
+ A `steps-only` execution spends what the intermediary **already holds**: no
237
+ 1Click quote, no deposit leg. The service still appends its fee-transfer step,
238
+ charged in the recipe's `destination.assetId`, and answers a signing payload.
239
+
240
+ ```
241
+ idle → resolving-identity → planning → creating → awaiting-signature
242
+ → submitting → settling → success | failed
243
+ ```
244
+
245
+ Give the recipe `flow: 'steps-only'` and drive it with `runSteps()` /
246
+ `previewSteps()` (also on `useExecution()`):
247
+
248
+ ```ts
249
+ const sell: SolanaRecipe = {
250
+ id: 'sell-orca', intent: 'sell_orca', title: 'Sell ORCA to USDC',
251
+ flow: 'steps-only', type: 'solana',
252
+ destination: { chain: 'sol', assetId: USDC_ASSET_ID, tokenAddress: USDC_MINT },
253
+ buildSteps: async ({ intermediary, amount }) => jupiterSwap(intermediary, amount),
254
+ };
255
+
256
+ const preview = await runner.previewSteps({
257
+ recipe: sell, params: undefined,
258
+ amount: orcaBalance, // ctx.amount for buildSteps
259
+ maxNetworkFee: minimumUsdcOut, // refuse a fee that would eat the output
260
+ });
261
+ // preview.networkFee, preview.spendable — show them, then commit verbatim:
262
+ await runner.runSteps(preview.plan);
263
+ ```
264
+
265
+ Two fee shapes:
266
+
267
+ | | fee comes out of what the steps **produce** | fee comes out of what the steps **spend** |
268
+ |---|---|---|
269
+ | Example | swap ORCA → USDC | transfer USDC out |
270
+ | Plan | `feeFromAmount` unset | `feeFromAmount: true` or `{ amountReserveBps }` |
271
+ | Rounds | one dry (measure), real | dry at `amount`, rebuild at `amount − fee − reserve`, real |
272
+ | `spendable` | `amount` | `amount − fee − reserve` |
273
+ | Fee cap | `maxNetworkFee` if given | `amount − spendable`, automatic |
274
+
275
+ The cap is enforced against the dry and the real create's `details.networkFee`
276
+ before signing (`FEE_EXCEEDS_AMOUNT`), and recorded in
277
+ `metadata.intentsConnectFeeBudget` so an unsigned cross-session `resume()`
278
+ re-checks it. `metadata.intentsConnectFlow: 'steps-only'` marks the execution
279
+ for `resume()` on deployments that omit `executionMode`.
280
+
281
+ `previewSteps()` runs on an isolated machine (no events, no real create) and
282
+ returns a frozen `prepared` snapshot valid for `previewTtlMs` (default 30 s).
283
+ `runSteps(preview.plan)` refuses an expired snapshot, a different wallet or
284
+ intermediary, or a changed `amount` with `QUOTE_MOVED`. When the fee is carved
285
+ from the spent amount and the confirming dry reports a higher fee, the preview
286
+ rebuilds at the new fee at most twice.
287
+
288
+ A missing `details.networkFee` is fatal only when the fee is carved from the
289
+ spent amount (`FEE_NOT_ESTIMATED`) — the steps cannot be sized without it.
290
+ Otherwise the service still appends its fee transfer and the steps stay
291
+ committable; `networkFee` is then simply absent from the preview and the
292
+ `quoted` event is not emitted.
293
+
294
+ Steps-only and bridge-in executions share the per-wallet in-flight lock: a live
295
+ one of either kind blocks the other until it settles or is cancelled. A `503`
296
+ from the steps endpoint means no Solana durable-nonce account was free — retry
297
+ shortly. `retryDeposit()` does not apply; there is nothing to deposit.