@aurora-is-near/intents-connect 7.22.0 → 7.23.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 (56) hide show
  1. package/README.md +61 -1
  2. package/dist/api/types.d.ts +5 -3
  3. package/dist/chunks/recovery-VJ9R3WuV.js +1431 -0
  4. package/dist/chunks/recovery-VJ9R3WuV.js.map +1 -0
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.js +69 -68
  7. package/dist/index.js.map +1 -1
  8. package/dist/machine/guards/checks/solanaStepsAreLegal.d.ts +3 -0
  9. package/dist/machine/guards/checks/stepShapeIsLegal.d.ts +2 -2
  10. package/dist/machine/guards/checks/stepsRequiredForRealCreate.d.ts +2 -2
  11. package/dist/machine/guards/checks/stepsUsePlaceholder.d.ts +2 -2
  12. package/dist/machine/guards/checks/strategiesAreExclusive.d.ts +2 -2
  13. package/dist/machine/guards/index.d.ts +1 -0
  14. package/dist/react/index.js +63 -59
  15. package/dist/react/index.js.map +1 -1
  16. package/dist/react/useExecution.d.ts +2 -1
  17. package/dist/runner/ctx.d.ts +3 -0
  18. package/dist/runner/flows/preview.d.ts +4 -0
  19. package/dist/runner/index.d.ts +1 -1
  20. package/dist/runner/planHelpers.d.ts +6 -3
  21. package/dist/runner/quoteAmounts.d.ts +3 -0
  22. package/dist/runner/stages/create.d.ts +2 -2
  23. package/dist/runner/stages/planSteps.d.ts +2 -2
  24. package/dist/runner/stages/validatePreparedExecution.d.ts +3 -0
  25. package/dist/runner/types.d.ts +24 -4
  26. package/dist/types/execution.d.ts +43 -2
  27. package/dist/types/recipe.d.ts +10 -4
  28. package/package.json +1 -1
  29. package/src/api/generated/conformance.ts +27 -0
  30. package/src/api/types.ts +5 -3
  31. package/src/index.ts +1 -0
  32. package/src/machine/guards/checks/feeMustBeEstimated.ts +1 -1
  33. package/src/machine/guards/checks/solanaStepsAreLegal.ts +145 -0
  34. package/src/machine/guards/checks/stepShapeIsLegal.ts +14 -2
  35. package/src/machine/guards/checks/stepsRequiredForRealCreate.ts +2 -2
  36. package/src/machine/guards/checks/stepsUsePlaceholder.ts +11 -7
  37. package/src/machine/guards/checks/strategiesAreExclusive.ts +2 -2
  38. package/src/machine/guards/index.ts +1 -0
  39. package/src/react/useExecution.ts +11 -0
  40. package/src/runner/createExecutionRunner.ts +3 -0
  41. package/src/runner/ctx.ts +6 -0
  42. package/src/runner/flows/preview.ts +141 -0
  43. package/src/runner/flows/resume.ts +7 -0
  44. package/src/runner/flows/run.ts +19 -1
  45. package/src/runner/index.ts +1 -0
  46. package/src/runner/planHelpers.ts +82 -8
  47. package/src/runner/quoteAmounts.ts +16 -0
  48. package/src/runner/stages/create.ts +13 -7
  49. package/src/runner/stages/planSteps.ts +95 -22
  50. package/src/runner/stages/signAndSubmit.ts +1 -0
  51. package/src/runner/stages/validatePreparedExecution.ts +25 -0
  52. package/src/runner/types.ts +27 -3
  53. package/src/types/execution.ts +58 -4
  54. package/src/types/recipe.ts +24 -4
  55. package/dist/chunks/recovery-BzOR1iVj.js +0 -1205
  56. package/dist/chunks/recovery-BzOR1iVj.js.map +0 -1
package/README.md CHANGED
@@ -80,7 +80,7 @@ Two phases behave in non-obvious ways:
80
80
  ## Fee strategies
81
81
 
82
82
  The gas fee is charged in the *destination* token and the backend appends its own
83
- fee-transfer step, so `spendable + networkFee ≤ quote.minAmountOut`. That is
83
+ fee-transfer step, so the bridged funds must cover both the spend and the fee. That is
84
84
  circular — the amount depends on the fee, the fee on the steps, the steps on the
85
85
  amount. Two ways out:
86
86
 
@@ -170,3 +170,63 @@ Notes:
170
170
  for fields it actually reads.
171
171
  - `run`, `resume` and `cancel` always **reject** rather than throwing
172
172
  synchronously, so `run(plan).catch(…)` behaves.
173
+
174
+
175
+ ## Solana bridge-in previews
176
+
177
+ Use `SolanaRecipe<TParams>` for a Solana destination. Its asynchronous
178
+ `buildSteps({ intermediary, userAddress, amount }, params)` returns
179
+ `{ steps: SolanaStep[], addressLookupTables?: string[] }`. Existing EVM
180
+ `Recipe` builders keep their synchronous API.
181
+
182
+ Solana uses the existing `threeRound` fee strategy: build at the gross bridge
183
+ amount to measure the fee, then rebuild at the concrete post-fee amount.
184
+ Solana responses keep `quote.minAmountOut` as the gross bridge guarantee and
185
+ report `details.networkFee` separately. The SDK subtracts that fee before
186
+ building instructions and checks `encoded input + fee <= gross guarantee`
187
+ again before signing and on unsigned resume. EVM responses already report a
188
+ net minimum; their fee is not subtracted again.
189
+ An optional `feeStrategy: { kind: 'threeRound', amountReserveBps: 25 }` leaves
190
+ 0.25% of the post-fee guarantee out of the encoded input, rounded down in atomic
191
+ units, to cover movement before real create. It defaults to zero. Account for
192
+ this reserve in the application's slippage budget and display output estimates
193
+ for the actual prepared input. Unspent funds remain at the intermediary.
194
+ Instruction fetching and encoding belong to the caller; the SDK does not
195
+ include a Jupiter client. The wallet package's
196
+ [`/solana` helpers](../intents-connect-wallet#solana-execution-instructions)
197
+ convert native instructions and prepare recipient token accounts.
198
+
199
+ ```ts
200
+ const preview = await runner.preview(solanaPlan);
201
+ // Show the caller's final-token quote; preview.execution.quote is the bridge quote.
202
+ // After the user accepts, commit these exact prepared instructions:
203
+ const execution = await runner.run(preview.plan);
204
+ console.log(execution.id, execution.transaction?.solanaTxHash);
205
+ ```
206
+
207
+ `preview()` makes only dry create requests, emits no runner events, and leaves
208
+ the active machine untouched. It returns the final dry response and a plan
209
+ containing an immutable snapshot of the prepared steps and lookup tables.
210
+ `useExecution()` exposes the same `preview()` method.
211
+ If a final Solana dry response no longer funds its instructions, preview rebuilds
212
+ them at the latest post-fee amount (with any configured reserve), at most twice.
213
+ Only a successfully checked build is returned. This never changes a committed
214
+ execution or triggers signing, funding, or cancellation.
215
+
216
+ `run(preview.plan)` checks the wallet, intermediary, quote, deadline, and real
217
+ post-fee guarantee before signing. A fee increase is acceptable only if the
218
+ returned guarantee still covers the encoded input. A missing fee or lower
219
+ guarantee rejects before signing; an already-created execution remains
220
+ available for cancellation. `validateExecution` on the plan can impose
221
+ additional acceptance checks (such as the final token minimum).
222
+
223
+ Resume uses the existing execution and never rebuilds its instructions. The
224
+ prepared spendable amount is saved in execution metadata and checked again
225
+ when an unsigned Solana execution resumes. After reload, pass any
226
+ application-specific `validateExecution` check to `resume()` again. Existing
227
+ safe deposit-resume rules still apply: persist the execution ID and deposit
228
+ hash, and do not force `depositViaWallet: true` if a deposit may be in flight.
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.
@@ -1,4 +1,4 @@
1
- import { Execution, ExecutionStatus, ExecutionType, Intermediary, QuoteRequest, Step, SubmitStatus } from '../types/execution';
1
+ import { Execution, ExecutionStatus, ExecutionStep, ExecutionType, Intermediary, QuoteRequest, SubmitStatus } from '../types/execution';
2
2
  import { DeleteSignatureEnvelope, SignatureEnvelope } from '../types/signing';
3
3
  export type ExecutionMetadata = {
4
4
  title: string;
@@ -10,7 +10,9 @@ export type CreateExecutionBody = {
10
10
  version: '1.0';
11
11
  type: ExecutionType;
12
12
  quote: QuoteRequest;
13
- steps: Step[];
13
+ steps: ExecutionStep[];
14
+ /** Solana Address Lookup Table accounts, kept in caller order. */
15
+ addressLookupTables?: string[];
14
16
  metadata: ExecutionMetadata;
15
17
  dry: boolean;
16
18
  outOperation?: boolean;
@@ -37,7 +39,7 @@ export type CreateStepsExecutionBody = {
37
39
  type?: ExecutionType;
38
40
  /** 1Click asset id of the destination token. */
39
41
  destinationAsset?: string;
40
- steps: Step[];
42
+ steps: ExecutionStep[];
41
43
  metadata?: ExecutionMetadata;
42
44
  dry: boolean;
43
45
  /** Solana destinations only — base58 Address Lookup Table accounts. */