@orbs-network/spot-react 2.1.18 → 2.1.20

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 (29) hide show
  1. package/README.md +134 -26
  2. package/dist/spot-react/src/context/create-spot-store.d.ts +3 -2
  3. package/dist/spot-react/src/context/create-spot-store.d.ts.map +1 -1
  4. package/dist/spot-react/src/context/spot-trading-context.d.ts +1 -1
  5. package/dist/spot-react/src/context/spot-trading-context.d.ts.map +1 -1
  6. package/dist/spot-react/src/execute-order.d.ts.map +1 -1
  7. package/dist/spot-react/src/execution-state.d.ts +6 -4
  8. package/dist/spot-react/src/execution-state.d.ts.map +1 -1
  9. package/dist/spot-react/src/hooks/use-execution.d.ts +8 -1
  10. package/dist/spot-react/src/hooks/use-execution.d.ts.map +1 -1
  11. package/dist/spot-react/src/hooks/use-resume-execution.d.ts +3 -0
  12. package/dist/spot-react/src/hooks/use-resume-execution.d.ts.map +1 -0
  13. package/dist/spot-react/src/hooks/use-swap-execution.d.ts +3 -0
  14. package/dist/spot-react/src/hooks/use-swap-execution.d.ts.map +1 -1
  15. package/dist/spot-react/src/index.d.ts +1 -1
  16. package/dist/spot-react/src/index.d.ts.map +1 -1
  17. package/dist/spot-react/src/order-history-data.d.ts +4 -3
  18. package/dist/spot-react/src/order-history-data.d.ts.map +1 -1
  19. package/dist/spot-react/src/parse-execution-error.d.ts +6 -0
  20. package/dist/spot-react/src/parse-execution-error.d.ts.map +1 -0
  21. package/dist/spot-react/src/resume-execution.d.ts +11 -0
  22. package/dist/spot-react/src/resume-execution.d.ts.map +1 -0
  23. package/dist/spot-react/src/types.d.ts +11 -2
  24. package/dist/spot-react/src/types.d.ts.map +1 -1
  25. package/dist/spot-react/src/wait-for-swap-order.d.ts +2 -0
  26. package/dist/spot-react/src/wait-for-swap-order.d.ts.map +1 -1
  27. package/dist/spot-react.js +1023 -878
  28. package/dist/spot-react.umd.cjs +1 -1
  29. package/package.json +3 -4
package/README.md CHANGED
@@ -35,20 +35,38 @@ Every DEX needs a member of the exported `Partners` enum and a server-side Orbs
35
35
 
36
36
  The `/config` endpoint is a security boundary. The SDK rejects configurations whose domain or order chain differs from the requested chain, and rejects zero or malformed RePermit and exchange-adapter addresses. It uses `domain.verifyingContract` as the ERC-20 approval spender and the v2 cancellation contract, and uses the returned adapter, reactor, and executor when constructing orders. The SDK does not independently verify deployed bytecode or contract identity, so deployments must use the trusted Orbs endpoint over TLS and contract-address changes require explicit approval from the protocol/security owner.
37
37
 
38
- `SpotProvider` initializes the `spot-ui` client when a valid connected chain ID is available; the order-sink API determines whether the selected partner/chain is supported. It never substitutes another chain. Client state and order history are scoped to that provider, with no global cache or host query provider required. The framework-neutral `createClient` factory does not cache clients. It initializes analytics after validating configuration; no `appId` or React analytics effect is needed. The client owns configuration-dependent order preparation, signing/approval/cancellation request values, submission, and configured history access; calculations remain package-level functions. Form previews and order construction share the framework-agnostic `calculateOrder` model, so defaults, prices, trades, schedules, errors, raw/token-formatted/USD values, and signed execution values cannot diverge. Form calculation is time-independent; `prepareOrder` assigns fresh start, deadline, and nonce values after wrapping and approval, immediately before signing. Initialization is retried twice. After those retries, the provider keeps its children mounted and renders the retryable `clientErrorFallback` alongside them. Supply that component to localize and style the error for the host DEX.
38
+ `SpotProvider` initializes the `spot-ui` client when a valid connected chain ID is
39
+ available; the service determines partner/chain support. Client and history state
40
+ are provider-scoped and require no host query provider. `createClient` returns a
41
+ new client while sharing validated configuration templates and in-flight requests
42
+ through a 60-second, 32-entry LRU cache. Each client receives a deep copy; failures
43
+ are evicted. Analytics initialize after validation, without an `appId` or React
44
+ effect. Nonce allocation is shared across clients in the loaded SDK instance.
45
+
46
+ The client owns configuration-dependent preparation, signing/approval/cancellation
47
+ requests, submission, and history access. Package-level `calculateOrder` provides
48
+ the shared form model. `prepareOrder` assigns fresh start, deadline, and nonce
49
+ after wrapping/approval, immediately before signing. Swap execution first
50
+ re-quotes: net output below the reviewed minimum rejects with `INVALID_QUOTE` and
51
+ requires fresh review; otherwise the exact reviewed minimum remains signed.
52
+
53
+ Initialization is retried twice. After those retries, the provider keeps children
54
+ mounted and renders `clientErrorFallback` alongside them. Supply that component
55
+ to localize and style retryable initialization errors.
39
56
 
40
57
  The authoritative shared model is available from `useOrderForm()`.
41
58
 
42
59
  Each mounted `SpotProvider` owns one stable store. Changing the module or token
43
60
  pair reapplies form defaults without recreating the partner/chain client,
44
61
  history cache, or cancellation state. If that scope changes during execution,
45
- the reset waits until the frozen execution reaches a terminal phase. Changing
62
+ the reset waits until the frozen execution reaches a definitive terminal outcome;
63
+ unconfirmed attempts retain their snapshot until reconciliation. Changing
46
64
  partner or chain reconfigures only the resources whose keys actually changed.
47
65
 
48
66
  The completed integration should:
49
67
 
50
68
  - keep tokens, typed amount, balances, USD prices, and quote state in the DEX's existing swap store or context;
51
- - provide all five `walletInteractions` methods using the DEX's existing wallet stack;
69
+ - provide the five required `walletInteractions` methods using the DEX's existing wallet stack, plus `getTokenBalance` for completed-wrap retries;
52
70
  - render TWAP, Limit, Stop-Loss, and Take-Profit entry points using DEX-native navigation and components;
53
71
  - use `@orbs-network/swap-ui` for the order review/progress flow inside the DEX's modal shell;
54
72
  - render order history and cancellation inside `SpotProvider` scope or through a context-preserving portal.
@@ -106,7 +124,7 @@ Keep the DEX swap form as the source of truth. Pass the following adapted values
106
124
  | Selected tokens | `Token` objects with `address`, `symbol`, `decimals`, and optional `logoUrl` |
107
125
  | Wrapped native token | The connected chain's wrapped-native `Token`, supplied by the DEX |
108
126
  | Typed source amount | User-facing decimal string, for example `"1.25"` |
109
- | Quote output | Raw destination-token amount for the current typed input; swaps also require `minimumOutputAmountRaw` after UI slippage |
127
+ | Quote output | Raw destination-token amount for the current typed input; swaps map `quote.minimumAmountOut` unchanged to `minimumOutputAmountRaw` |
110
128
  | Input balance | Raw integer string |
111
129
  | USD prices | USD value of exactly one whole source/destination token |
112
130
  | Chain and account | Values from the connected wallet/account state |
@@ -261,7 +279,12 @@ function SpotOrderForm({ module }: { module: Module }) {
261
279
  }
262
280
  ```
263
281
 
264
- `marketQuote.quotedOutputAmountRaw` is the quote's raw output amount for the current `inputAmountUi`, not a standalone per-token price. For swaps, use `quote.netAmountOut` and also pass `minimumOutputAmountRaw` after UI slippage. If the quote belongs to an older input, token pair, account, chain, partner, or slippage setting, omit both amounts and report `isLoading: true` until a current quote arrives.
282
+ `marketQuote.quotedOutputAmountRaw` is the quote's raw output amount for the current
283
+ `inputAmountUi`, not a standalone per-token price. For swaps, pass
284
+ `quote.netAmountOut` and `minimumOutputAmountRaw: quote.minimumAmountOut`.
285
+ The returned minimum is authoritative; do not apply slippage again. If the quote
286
+ belongs to older inputs, omit both amounts and report `isLoading: true` until a
287
+ current quote arrives.
265
288
 
266
289
  `spot-react` has no network registry. Always pass the `wrappedNativeToken` prop
267
290
  from the DEX's own chain configuration; its value may be `undefined` only until
@@ -281,7 +304,7 @@ Use the connected wallet chain as the source of truth. When it is absent or unsu
281
304
  | `inputAmountUi` | `string` | Yes | User-entered input-token amount |
282
305
  | `priceProtectionPercent` | `number` | Yes | Price Protection percentage for advanced orders; ignored for `SWAP`, which signs 500 bps oracle protection |
283
306
  | `minTradeSizeUsd` | `number` | Yes | Minimum individual trade size in USD |
284
- | `marketQuote` | `MarketQuote` | Yes | `{ quotedOutputAmountRaw?, minimumOutputAmountRaw?, isLoading?, noLiquidity? }` for the current quote; swaps require the raw minimum after UI slippage |
307
+ | `marketQuote` | `MarketQuote` | Yes | `{ quotedOutputAmountRaw?, minimumOutputAmountRaw?, isLoading?, noLiquidity? }`; swaps use `quote.netAmountOut` and `quote.minimumAmountOut` unchanged |
285
308
  | `walletInteractions` | `WalletInteractions` | Yes | Five wallet methods implemented by the DEX |
286
309
  | `chainId` | `number` | No | Connected wallet chain ID |
287
310
  | `account` | `Address` | No | Connected wallet address |
@@ -318,7 +341,10 @@ partner and backend.
318
341
  history. The `ApproveTokenProps`, `GetAllowanceProps`, and `CancelOrderProps`
319
342
  aliases remain available for existing adapters.
320
343
 
321
- The DEX must implement all five methods. Write methods must wait for the transaction receipt, throw when the transaction reverts, and then return the transaction hash.
344
+ The DEX must implement the five required methods. Add `getTokenBalance` when
345
+ retrying an attempt with completed native-wrap metadata. Write methods must wait
346
+ for the transaction receipt, throw when the transaction reverts, and then return
347
+ the transaction hash.
322
348
 
323
349
  ```tsx
324
350
  const walletInteractions: WalletInteractions = {
@@ -354,6 +380,9 @@ const walletInteractions: WalletInteractions = {
354
380
 
355
381
  getAllowance: ({ tokenAddress, spenderAddress }) =>
356
382
  dexWallet.getAllowance({ tokenAddress, spenderAddress }),
383
+
384
+ getTokenBalance: ({ tokenAddress }) =>
385
+ dexWallet.getTokenBalance({ tokenAddress }),
357
386
  };
358
387
  ```
359
388
 
@@ -364,8 +393,13 @@ const walletInteractions: WalletInteractions = {
364
393
  | `cancelOrder({ order, contractAddress, args, abi })` | Call `cancel` with the supplied ABI and args, wait for confirmation, return tx hash |
365
394
  | `signOrder({ signerAddress, typedData })` | Adapt the framework-neutral EIP-712 request to the host wallet and return its original `0x`-prefixed signature |
366
395
  | `getAllowance({ tokenAddress, spenderAddress })` | Return the connected account's raw allowance as a string |
396
+ | `getTokenBalance({ tokenAddress })` | Optional; return the captured account's current raw ERC-20 balance as a string. Required when reusing completed wrap metadata |
367
397
 
368
398
  The signature returned by `signOrder` is submitted unchanged. Do not split it into `{ v, r, s }`, rewrite its recovery byte, or otherwise normalize the wallet's byte representation.
399
+ On a native-input retry, a previous wrap receipt alone does not prove the tokens
400
+ are still available. The executor checks the current wrapped-token balance and
401
+ wraps only a shortfall. `onWrapSuccess.amount` reports the amount actually wrapped
402
+ in that step.
369
403
 
370
404
  ## Building with focused hooks
371
405
 
@@ -406,7 +440,7 @@ const history = useOrders();
406
440
  | `useDisclaimer()` | Disclaimer translation key or `undefined` |
407
441
  | `useInputErrors()` | `{ type, args }` or `undefined` |
408
442
  | `useSubmitButton()` | `disabled` and `loading` |
409
- | `useExecution()` | Submission, status, steps, errors, resets, resolved tokens, and tx hashes |
443
+ | `useExecution()` | Submission/recovery, status, steps, errors, retained order/account, resets, resolved tokens, and tx hashes |
410
444
  | `useOrders()` | Provider-scoped categorized order lists and polling state |
411
445
  | `useHistoryOrder()` | Display-ready values for one history order |
412
446
  | `useCancelOrder()` | Per-order cancellation state and action |
@@ -476,8 +510,20 @@ function SpotOrderFlow() {
476
510
  outputToken,
477
511
  currentStepIndex,
478
512
  totalSteps,
513
+ isUnconfirmed,
514
+ resumeTracking,
515
+ orderId,
479
516
  } = useExecution();
480
517
  const form = useOrderForm();
518
+ if (isUnconfirmed) {
519
+ return (
520
+ <div role="status">
521
+ <p>{error?.message || "Order status needs confirmation."}</p>
522
+ {orderId && <p>Order: {orderId}</p>}
523
+ <button type="button" onClick={resumeTracking}>Check order status</button>
524
+ </div>
525
+ );
526
+ }
481
527
  const swapStatus =
482
528
  status === ExecutionStatus.SUCCESS
483
529
  ? SwapUiStatus.SUCCESS
@@ -512,20 +558,21 @@ Wrap `SwapFlow` in the DEX's modal shell and skin it with DEX colors, surfaces,
512
558
 
513
559
  `useExecution()` returns:
514
560
 
515
- - `submitOrder`, `phase`, `status`, `isExecuting`, `isSuccess`, `isFailed`, `isRejected`, `isPreparingOrder`, and `canDismiss`;
561
+ - `submitOrder`, `resumeTracking`, `phase`, `status`, `isExecuting`, `isUnconfirmed`, `isSuccess`, `isFailed`, `isRejected`, `isPreparingOrder`, and `canDismiss`;
516
562
  - `currentStep`, `currentStepIndex`, `totalSteps`, and `executionSteps`;
517
- - `error`, `inputToken`, `outputToken`, `chainId`, `wrapTxHash`, and `approvalTxHash`;
563
+ - `error`, `order`, `orderId`, `account`, `inputToken`, `outputToken`, `chainId`, `wrapTxHash`, and `approvalTxHash`;
518
564
  - `returnToOrderForm()` and `startNewOrder()`.
519
565
 
520
566
  `spot-react` does not clear the DEX input. Do that only when a successful modal closes:
521
567
 
522
568
  ```tsx
523
- const { status, isSuccess, isExecuting, returnToOrderForm, startNewOrder } =
569
+ const { status, isSuccess, isUnconfirmed, canDismiss, returnToOrderForm, startNewOrder } =
524
570
  useExecution();
525
571
 
526
572
  const onClose = useCallback(() => {
527
- if (isExecuting) return;
573
+ if (!canDismiss) return;
528
574
  setIsModalOpen(false);
575
+ if (isUnconfirmed) return;
529
576
 
530
577
  if (isSuccess) {
531
578
  setInputAmount("");
@@ -533,16 +580,66 @@ const onClose = useCallback(() => {
533
580
  } else if (status) {
534
581
  setTimeout(returnToOrderForm, 500);
535
582
  }
536
- }, [isExecuting, isSuccess, returnToOrderForm, setInputAmount, startNewOrder, status]);
583
+ }, [canDismiss, isSuccess, isUnconfirmed, returnToOrderForm, setInputAmount, startNewOrder, status]);
537
584
  ```
538
585
 
539
- `isExecuting` covers preparation, wrapping, approval, signing, submission, and swap settlement. For `Module.SWAP`, it stays true until the submitted order reaches a terminal result, and `isSuccess` becomes true only after the order fills. Other modules report success after submission. Use `phase === ExecutionPhase.SETTLING` when the UI needs settlement-specific messages.
540
-
541
- Neither reset action can clear an active execution: both return `false` while `isExecuting` is true. Keep the modal open during execution. `returnToOrderForm()` dismisses a failed or rejected execution while preserving the form and a completed native-token wrap for a safe retry. `startNewOrder()` resets Spot's internal form state and all retry metadata after a terminal execution; the host must still clear its own input amount. The short delay lets the close animation finish before state resets.
542
-
543
- `phase` is the precise execution state: `idle → preparing → wrapping → approving → signing → submitting`, followed by `settling → success` for swaps or immediate `success` for advanced order creation. Wrapping and approval are skipped when unnecessary. `failed` and `rejected` are terminal branches; settlement can end in `failed`. `status` is the coarser `ExecutionStatus` value. Map it explicitly to the separately versioned `@orbs-network/swap-ui` `SwapStatus` enum as shown above. Each attempt has an internal identity, duplicate starts are rejected atomically, and stale async writes cannot replace a newer attempt. Host callbacks are observational: synchronous throws and rejected callback promises never change a wallet or API result.
544
-
545
- Once submission begins, `useOrderForm()` exposes the frozen form and `useExecution()` exposes the frozen tokens and chain associated with that execution. The prepared order is frozen internally and reused through approval, wrapping, signing, and submission. Host quote, token, chain, or time updates cannot change the active order.
586
+ `isExecuting` covers preparation, wrapping, approval, signing, submission, and
587
+ active swap settlement tracking. `isSuccess` becomes true only after a swap fills;
588
+ other modules report success after submission. Use
589
+ `phase === ExecutionPhase.SETTLING` for settlement-specific messages.
590
+
591
+ Ambiguous submission, stopped tracking, and unconfirmed settlement use
592
+ `ExecutionPhase.UNCONFIRMED`. In that phase, `isUnconfirmed` and `canDismiss` are
593
+ true and `isExecuting` is false. The order snapshot, captured account/chain, and
594
+ available order ID remain in execution state. Closing the modal preserves them.
595
+ Fresh submissions and both reset actions remain blocked until reconciliation.
596
+ Render a recovery action before mapping the coarse `status` to generic failure UI.
597
+
598
+ `resumeTracking()` checks the existing order without signing again. When
599
+ submission acceptance was ambiguous, it can discover the exact previously
600
+ prepared payload in the original account and chain's history. For swaps, a
601
+ confirmed fill becomes `SUCCESS`; a confirmed cancellation or expiry becomes
602
+ `FAILED` and permits a new attempt. Advanced order creation succeeds once
603
+ acceptance is confirmed. Missing/indexing results and network failures remain
604
+ `UNCONFIRMED`.
605
+
606
+ Submission uses one POST with an optional lifecycle signal and a fixed 30-second
607
+ timeout covering fetch and body reads. Pre-abort prevents the POST; abort/timeout
608
+ after sending leaves acceptance uncertain and enters recovery. No POST is retried
609
+ automatically. Settlement normally polls every two seconds; errors/missing
610
+ snapshots back off at 2, 4, 8, 16, then 30 seconds and reset after a matching
611
+ snapshot. Unknown statuses stay open even past the deadline. Service statuses
612
+ `expired`, `failed`, and `partially_completed` become expired only after the signed
613
+ deadline has passed, with completion and cancellation taking precedence.
614
+
615
+ Both reset actions return `false` during active or unconfirmed execution. Keep
616
+ the modal open while `isExecuting`. `returnToOrderForm()` dismisses a definitive
617
+ failure or rejection while preserving the form and completed-wrap metadata;
618
+ reusing that metadata requires `getTokenBalance` to verify funds again.
619
+ `startNewOrder()` resets Spot's internal form and retry metadata after a confirmed
620
+ terminal outcome. The host still clears its own input only after success. The
621
+ short delay lets the close animation finish before state resets.
622
+
623
+ `phase` is the precise execution state: `idle → preparing → wrapping → approving
624
+ → signing → submitting`, followed by `settling → success` for swaps or immediate
625
+ `success` for advanced order creation. Wrapping and approval are skipped when
626
+ unnecessary. Definitive failures and wallet rejections use `failed` and `rejected`;
627
+ uncertain submission or settlement uses `unconfirmed`. `status` is the coarser
628
+ `ExecutionStatus` value. Map it explicitly to the separately versioned
629
+ `@orbs-network/swap-ui` `SwapStatus` enum as shown above. Each attempt has an
630
+ internal identity, duplicate starts are rejected atomically, and stale async
631
+ writes cannot replace a newer attempt. Host callbacks are observational:
632
+ synchronous throws and rejected callback promises never change a wallet or API result.
633
+
634
+ Once an attempt begins, `useOrderForm()` exposes its frozen form and
635
+ `useExecution()` exposes its captured tokens, account, and chain. Preparation runs
636
+ after wrapping and approval; the resulting payload is retained through signing,
637
+ submission, and recovery. Host quote, token, chain, or time updates cannot replace
638
+ an unresolved order.
639
+
640
+ `error` is a `ParsedError`: `code` retains string SDK classifications or numeric
641
+ wallet codes, with `0` as the fallback. Optional `reason`, `orderId`, HTTP `status`,
642
+ and `serviceCode` preserve settlement and service details for host error UI.
546
643
 
547
644
  ## Callbacks
548
645
 
@@ -712,7 +809,7 @@ import the framework-neutral SDK helpers from `@orbs-network/spot-react`:
712
809
 
713
810
  ```ts
714
811
  import {
715
- createClient, getMinimumOutputAmount, isSwapSupported,
812
+ createClient, isSwapSupported,
716
813
  waitForOrder, QuoteError, type SwapQuote,
717
814
  } from "@orbs-network/spot-react";
718
815
  ```
@@ -720,13 +817,22 @@ import {
720
817
  Use `client.getQuote({ inToken, outToken, inAmount, user, slippage, signal })`
721
818
  to inherit the initialized client's partner and chain. The standalone `getQuote`
722
819
  export remains available for quoting without a client. Slippage is a percentage:
723
- `0.5` means 0.5%. Before a wallet connects, a nonzero preview account such as
724
- `0x0000000000000000000000000000000000000001` can satisfy `user`; include it in
725
- the quote key and refetch for the connected signer before review and execution.
820
+ `0.5` means 0.5%. Before a wallet connects, a preview account
821
+ such as `0x0000000000000000000000000000000000000001` can satisfy `user`;
822
+ include it in the quote key. This is quote-request metadata; pass the connected
823
+ account as `userAddress` for preparation and execution. A refetch solely to bind
824
+ the signer is unnecessary; the host owns its quote cache policy and live wallet
825
+ context checks.
726
826
 
727
827
  Keep wrapping, approval, and EIP-712 signing in the DEX's existing wallet flow.
728
- After confirmed approval to `client.spenderAddress`, call `client.prepareSwap`,
729
- sign its `signingRequest`, then call `client.submitOrder(prepared.order, signature)`.
828
+ After confirmed approval to `client.spenderAddress`, call
829
+ `client.prepareSwap(quote, account)`,
830
+ sign its `signingRequest`, then call `client.submitOrder(prepared.order, signature, { signal })`.
831
+ The manual router flow fetches a current quote after wrapping/approval and checks
832
+ its net output against the original `quote.minimumAmountOut` before pure preparation. A lower
833
+ quote requires fresh review; keep the reviewed minimum when it is still covered.
834
+ All swaps have a fixed 3-minute expiration from preparation, immediately before
835
+ signing.
730
836
  Call `waitForOrder({ order })`; it derives the ID, chain, and deadline from the
731
837
  returned order. Tracking needs no initialized client. No `walletInteractions` object,
732
838
  React provider, or calculated form is required for this path.
@@ -734,6 +840,8 @@ React provider, or calculated form is required for this path.
734
840
  No separate `spot-ui` installation is needed. See the [router example](../spot-ui/examples/router-swap.ts).
735
841
  The optional `submitSwap` convenience function remains available from `spot-react`
736
842
  when SDK wallet orchestration through callbacks is preferred.
843
+ The 3-minute window starts at final preparation after wrapping and approval.
844
+ Calculated form swaps in `SpotProvider` use the same fixed expiration.
737
845
  `spot-react` reuses the SDK wallet executor and `watchOrder` stream underlying
738
846
  `waitForOrder`; both tracking helpers take only `order` and optional `signal`. Its provider
739
847
  adds React state, frozen review data, history updates, and modal lifecycle.
@@ -1,5 +1,5 @@
1
1
  import { StoreApi } from 'zustand/vanilla';
2
- import { SpotProps, State, StartedSwapExecution, SwapExecution } from '../types';
2
+ import { Callbacks, SpotProps, State, StartedSwapExecution, SwapExecution } from '../types';
3
3
  import { Order, SpotClient } from '@orbs-network/spot-ui';
4
4
  export interface SpotFormDefaults {
5
5
  tradeCount?: number;
@@ -34,10 +34,11 @@ export interface SpotStore {
34
34
  orders: OrdersResourceState;
35
35
  configureClient: (key?: string, loader?: ClientLoader) => void;
36
36
  refetchClient: () => Promise<SpotClient | undefined>;
37
- configureOrders: (key?: string, loader?: OrdersLoader) => void;
37
+ configureOrders: (key?: string, loader?: OrdersLoader, callbacks?: Callbacks) => void;
38
38
  registerOrdersConsumer: () => () => void;
39
39
  refetchOrders: (force?: boolean, refreshLegacy?: boolean) => Promise<Order[] | undefined>;
40
40
  addOrder: (order: Order) => void;
41
+ updateOrder: (order: Order, callbacks?: Callbacks) => void;
41
42
  setCancelOrder: (historyKey: string, value: State["cancelOrders"][string]) => void;
42
43
  clearCancelOrder: (historyKey: string) => void;
43
44
  beginExecution: (value: Omit<SwapExecution, "executionId" | "phase">) => StartedSwapExecution | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"create-spot-store.d.ts","sourceRoot":"","sources":["../../../../src/context/create-spot-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EACV,SAAS,EACT,KAAK,EACL,oBAAoB,EACpB,aAAa,EACd,MAAM,UAAU,CAAC;AAElB,OAAO,EAAU,KAAK,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAU5E,MAAM,WAAW,gBAAgB;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IACvC,aAAa,CAAC,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,mBAAmB;IAClC,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sBAAsB,GACjC,OAAO,IAAI,CAAC,SAAS,EAAE,QAAQ,GAAG,WAAW,CAAC,KAC7C,gBAcF,CAAC"}
@@ -5,7 +5,7 @@ import { Callbacks, Overrides, Token, WalletInteractions } from '../types';
5
5
  export interface SpotTradingState {
6
6
  walletInteractions: WalletInteractions;
7
7
  quotedOutputAmountRaw?: string;
8
- /** Slippage-adjusted minimum, required for Module.SWAP; expressed in output-token base units. */
8
+ /** Current quote.minimumAmountOut unchanged, required for Module.SWAP; output-token base units. */
9
9
  minimumOutputAmountRaw?: string;
10
10
  marketPriceLoading?: boolean;
11
11
  account?: Address;
@@ -1 +1 @@
1
- {"version":3,"file":"spot-trading-context.d.ts","sourceRoot":"","sources":["../../../../src/context/spot-trading-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EACL,MAAM,EACN,KAAK,OAAO,EACZ,KAAK,QAAQ,EACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,KAAK,EACL,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAElB,8EAA8E;AAC9E,MAAM,WAAW,gBAAgB;IAC/B,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,iGAAiG;IACjG,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,QAAQ,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,kBAAkB,EAAE,KAAK,GAAG,SAAS,CAAC;IACtC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAID,eAAO,MAAM,mBAAmB,GAAI,sBAGjC;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,gBAAgB,CAAC;CACzB,4CAMA,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,gBAMjC,CAAC"}
1
+ {"version":3,"file":"spot-trading-context.d.ts","sourceRoot":"","sources":["../../../../src/context/spot-trading-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EACL,MAAM,EACN,KAAK,OAAO,EACZ,KAAK,QAAQ,EACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,KAAK,EACL,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAElB,8EAA8E;AAC9E,MAAM,WAAW,gBAAgB;IAC/B,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mGAAmG;IACnG,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,QAAQ,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IAC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IACzC,cAAc,EAAE,CACd,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,KAChD,oBAAoB,GAAG,SAAS,CAAC;IACtC,gBAAgB,EAAE,CAChB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,aAAa,KACjB,OAAO,CAAC;CACd;AAED,MAAM,WAAW,kBAAmB,SAAQ,qBAAqB;IAC/D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,kBAAkB,CAAC,EAAE,KAAK,CAAC;IAC3B,IAAI,EAAE,mBAAmB,CAAC;IAC1B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACpC,mBAAmB,EAAE,MAAM,OAAO,CAAC;IACnC,IAAI,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,KAAK,CAAC,CAAC;CAC1E;AAgGD,eAAO,MAAM,YAAY,GACvB,QAAQ,kBAAkB,KACzB,OAAO,CAAC,KAAK,GAAG,SAAS,CAuM3B,CAAC"}
@@ -1,13 +1,15 @@
1
- import { ExecutionPhase, Steps, ExecutionStatus, CompletedWrap, ParsedError, SwapExecution } from './types';
1
+ import { ExecutionPhase, Steps, ExecutionStatus, CompletedWrap, SwapExecution } from './types';
2
+ export { getErrorMessage, normalizeError, parseExecutionError } from './parse-execution-error';
2
3
  export declare const createIdleExecution: (completedWrap?: CompletedWrap) => SwapExecution;
3
4
  export declare const isExecutionActive: (phase: ExecutionPhase) => boolean;
5
+ /** An uncertain intent must be reconciled before its state can be reset or replaced. */
6
+ export declare const isExecutionLocked: (phase: ExecutionPhase) => boolean;
4
7
  export declare const canBeginExecution: (phase: ExecutionPhase) => boolean;
8
+ /** A stopped lookup or lost submission response does not establish that the order failed. */
9
+ export declare const isUnconfirmedExecutionError: (error: unknown, phase: ExecutionPhase) => boolean;
5
10
  export declare const canTransitionExecution: (from: ExecutionPhase, to: ExecutionPhase) => boolean;
6
11
  export declare const getExecutionStatus: (phase: ExecutionPhase) => ExecutionStatus | undefined;
7
12
  export declare const getExecutionStep: (phase: ExecutionPhase) => Steps | undefined;
8
- export declare const getErrorMessage: (error: unknown) => string;
9
- export declare const normalizeError: (error: unknown) => Error;
10
- export declare const parseExecutionError: (error: unknown) => ParsedError;
11
13
  export declare const observe: (callback: (() => unknown) | undefined) => void;
12
14
  export declare const getReusableCompletedWrap: ({ execution, account, chainId, inputTokenAddress, inputAmountRaw, }: {
13
15
  execution: SwapExecution;
@@ -1 +1 @@
1
- {"version":3,"file":"execution-state.d.ts","sourceRoot":"","sources":["../../../src/execution-state.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,KAAK,EACL,eAAe,EACf,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,aAAa,EACnB,MAAM,SAAS,CAAC;AAuDjB,eAAO,MAAM,mBAAmB,GAC9B,gBAAgB,aAAa,KAC5B,aAGD,CAAC;AAEH,eAAO,MAAM,iBAAiB,GAAI,OAAO,cAAc,KAAG,OAChC,CAAC;AAE3B,eAAO,MAAM,iBAAiB,GAAI,OAAO,cAAc,KAAG,OAGvB,CAAC;AAEpC,eAAO,MAAM,sBAAsB,GACjC,MAAM,cAAc,EACpB,IAAI,cAAc,KACjB,OAA4C,CAAC;AAEhD,eAAO,MAAM,kBAAkB,GAC7B,OAAO,cAAc,KACpB,eAAe,GAAG,SAOpB,CAAC;A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M,sBAAsB,GACjC,MAAM,cAAc,EACpB,IAAI,cAAc,KACjB,OAA4C,CAAC;AAEhD,eAAO,MAAM,kBAAkB,GAC7B,OAAO,cAAc,KACpB,eAAe,GAAG,SAOpB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,OAAO,cAAc,KAAG,KAAK,GAAG,SAUhE,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,UAAU,CAAC,MAAM,OAAO,CAAC,GAAG,SAAS,KAAG,IAQ/D,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,qEAMtC;IACD,SAAS,EAAE,aAAa,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;CACxB,KAAG,aAAa,GAAG,SAYnB,CAAC"}
@@ -1,4 +1,5 @@
1
- import { ExecutionPhase, ExecutionStatus, ParsedError, Steps, Token } from '../types';
1
+ import { ExecutionPhase, ExecutionStatus, ParsedError, Order, Steps, Token } from '../types';
2
+ import { Address } from '@orbs-network/spot-ui';
2
3
  export interface SpotExecutionData {
3
4
  phase: ExecutionPhase;
4
5
  status?: ExecutionStatus;
@@ -12,7 +13,12 @@ export interface SpotExecutionData {
12
13
  inputToken?: Token;
13
14
  outputToken?: Token;
14
15
  chainId?: number;
16
+ account?: Address;
17
+ orderId?: string;
18
+ order?: Order;
15
19
  submitOrder: () => void;
20
+ /** Checks the saved attempt without signing or submitting a replacement. */
21
+ resumeTracking: () => void;
16
22
  startNewOrder: () => boolean;
17
23
  returnToOrderForm: () => boolean;
18
24
  /** True throughout preparation, wallet steps, submission, and swap settlement. */
@@ -21,6 +27,7 @@ export interface SpotExecutionData {
21
27
  isSuccess: boolean;
22
28
  isFailed: boolean;
23
29
  isRejected: boolean;
30
+ isUnconfirmed: boolean;
24
31
  isPreparingOrder: boolean;
25
32
  canDismiss: boolean;
26
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"use-execution.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,eAAe,EACf,KAAK,WAAW,EAChB,KAAK,KAAK,EACV,KAAK,KAAK,EACX,MAAM,UAAU,CAAC;AAgBlB,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,cAAc,CAAC;IACtB,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,KAAK,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,aAAa,EAAE,MAAM,OAAO,CAAC;IAC7B,iBAAiB,EAAE,MAAM,OAAO,CAAC;IACjC,kFAAkF;IAClF,WAAW,EAAE,OAAO,CAAC;IACrB,sFAAsF;IACtF,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,YAAY,QAAO,iBA8D/B,CAAC;AAEF,eAAO,MAAM,eAAe;;;CAkD3B,CAAC"}
1
+ {"version":3,"file":"use-execution.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,eAAe,EACf,KAAK,WAAW,EAChB,KAAK,KAAK,EACV,KAAK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*/
2
+ export declare const useResumeExecution: () => (() => void);
3
+ //# sourceMappingURL=use-resume-execution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-resume-execution.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-resume-execution.ts"],"names":[],"mappings":"AAKA,oFAAoF;AACpF,eAAO,MAAM,kBAAkB,QAAO,CAAC,MAAM,IAAI,CAehD,CAAC"}
@@ -2,6 +2,8 @@ export declare const useSwapExecution: () => {
2
2
  returnToOrderForm: () => boolean;
3
3
  executionId?: number;
4
4
  phase: import('..').ExecutionPhase;
5
+ account?: import('@orbs-network/spot-ui').Address;
6
+ partner?: import('@orbs-network/spot-ui').Partners;
5
7
  parsedError?: import('..').ParsedError;
6
8
  error?: Error;
7
9
  stepIndex?: number;
@@ -13,6 +15,7 @@ export declare const useSwapExecution: () => {
13
15
  outputToken?: import('@orbs-network/spot-ui').Token;
14
16
  chainId?: number;
15
17
  orderId?: string;
18
+ order?: import('@orbs-network/spot-ui').Order;
16
19
  hasApproval?: boolean;
17
20
  form?: import('@orbs-network/spot-ui').CalculatedOrderForm;
18
21
  preparedOrder?: import('@orbs-network/spot-ui').PreparedOrder;
@@ -1 +1 @@
1
- {"version":3,"file":"use-swap-execution.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-swap-execution.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;CAU5B,CAAC"}
1
+ {"version":3,"file":"use-swap-execution.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-swap-execution.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;CAU5B,CAAC"}
@@ -18,6 +18,6 @@ export { useTrades } from './hooks/use-trades';
18
18
  export { useTriggerPrice } from './hooks/use-trigger-price';
19
19
  export { type CancelOrderStatus } from './hooks/use-cancel-order';
20
20
  export type { SpotExecutionData } from './hooks/use-execution';
21
- export { type Config, type TimeDuration, type RePermitData, type RePermitOrder, type SpotClient, type CreateClientOptions, type SpotAnalytics, type AccountOrdersResult, type GetOrdersParams, type QuoteErrorKind, type SwapQuote, type SwapQuoteParams, type PrepareSwapParams, type PreparedSwap, type SubmitSwapParams, type SubmittedSwap, type SwapTradeType, type ExecuteOrderParams, type OrderExecutionUpdate, type OrderExecutionPhase, type OrderExecutionStep, type OrderWalletInteractions, type SignableOrder, type WaitForOrderParams, type PrepareOrderParams, type PreparedOrder, type PreparedOrderValues, type Eip712TypedData, type OrderSigningRequest, type ApprovalRequest, type AllowanceRequest, type CancelOrderRequest, type ClientGetAccountOrdersParams, type ClientGetOrderParams, type ClientGetQuoteParams, type SpotErrorCode, type SpotErrorOptions, type Signature, type Address, type Hex, type InputError, type CalculateOrderFormParams, type CalculatedAmount, type CalculatedOrderInputAmount, type CalculatedMarketPriceValues, type CalculatedOrderTrades, type CalculatedOrderFees, type CalculatedOrderFormSchedule, type CalculatedOrderFormErrors, type CalculatedOrderForm, type CalculatedOrderSchedule, type CalculatedPriceInput, type CalculatedPriceDisplay, type CalculatedTriggerPriceValues, type CalculatedLimitPriceValues, type CalculatedOrderValues, Module, OrderStatus, OrderFilter, OrderType, TimeUnit, Partners, InputErrors, getQuote, isQuoteFresh, getMinimumOutputAmount, isSwapSupported, submitSwap, executeOrder, waitForOrder, watchOrder, getOrders, getTwapConfig, calculateOrder, calculateOrderForm, toAmountRaw, toAmountUI, invertPriceInput, createClient, isNativeAddress, eqIgnoreCase, getOrderExecutionRate, getOrderLimitPriceRate, getOrderFillDelayMillis, getTriggerPriceRate, isTxRejected, QuoteError, SpotError, OrderSettlementError, SWAP_CAPABILITIES, DISCLAIMER_URL, ORBS_TWAP_FAQ_URL, ORBS_SLTP_FAQ_URL, ORBS_LOGO, ORBS_WEBSITE_URL, analytics, setUIVersion, } from '@orbs-network/spot-ui';
21
+ export { type Config, type TimeDuration, type RePermitData, type RePermitOrder, type SpotClient, type CreateClientOptions, type SubmitOrderOptions, type SpotAnalytics, type AccountOrdersResult, type GetOrdersParams, type QuoteErrorKind, type SwapQuote, type SwapQuoteParams, type PrepareSwapParams, type PreparedSwap, type SubmitSwapParams, type SubmittedSwap, type SwapTradeType, type ExecuteOrderParams, type OrderExecutionUpdate, type OrderExecutionPhase, type OrderExecutionStep, type OrderWalletInteractions, type SignableOrder, type WaitForOrderParams, type PrepareOrderParams, type PreparedOrder, type PreparedOrderValues, type Eip712TypedData, type OrderSigningRequest, type ApprovalRequest, type AllowanceRequest, type CancelOrderRequest, type ClientGetAccountOrdersParams, type ClientGetOrderParams, type ClientGetQuoteParams, type SpotErrorCode, type SpotErrorOptions, type Signature, type Address, type Hex, type InputError, type CalculateOrderFormParams, type CalculatedAmount, type CalculatedOrderInputAmount, type CalculatedMarketPriceValues, type CalculatedOrderTrades, type CalculatedOrderFees, type CalculatedOrderFormSchedule, type CalculatedOrderFormErrors, type CalculatedOrderForm, type CalculatedOrderSchedule, type CalculatedPriceInput, type CalculatedPriceDisplay, type CalculatedTriggerPriceValues, type CalculatedLimitPriceValues, type CalculatedOrderValues, Module, OrderStatus, OrderFilter, OrderType, TimeUnit, Partners, InputErrors, getQuote, isQuoteFresh, isSwapSupported, submitSwap, executeOrder, waitForOrder, watchOrder, getOrders, getTwapConfig, calculateOrder, calculateOrderForm, toAmountRaw, toAmountUI, invertPriceInput, createClient, isNativeAddress, eqIgnoreCase, getOrderExecutionRate, getOrderLimitPriceRate, getOrderFillDelayMillis, getTriggerPriceRate, isTxRejected, QuoteError, SpotError, OrderSettlementError, SWAP_CAPABILITIES, DISCLAIMER_URL, ORBS_TWAP_FAQ_URL, ORBS_SLTP_FAQ_URL, ORBS_LOGO, ORBS_WEBSITE_URL, analytics, setUIVersion, } from '@orbs-network/spot-ui';
22
22
  export { SpotProvider };
23
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MA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AQ,EACR,QAAQ,EACR,WAAW,EAGX,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,SAAS,EACT,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,YAAY,EAGZ,UAAU,EACV,SAAS,EACT,oBAAoB,EAGpB,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAEhB,SAAS,EACT,YAAY,GACb,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -9,17 +9,18 @@ export interface CategorizedOrders {
9
9
  }
10
10
  export declare const categorizeOrders: (orders: Order[]) => CategorizedOrders;
11
11
  export declare const mergeCachedLegacyOrders: (orders: Order[], cachedOrders?: Order[]) => Order[];
12
- export declare const notifyOrderUpdates: (previousOrders: Order[] | undefined, orders: Order[], callbacks?: Callbacks) => void;
12
+ /** Preserve accepted snapshots while older history requests finish indexing. */
13
+ export declare const mergeOrderSnapshots: (previousOrders: Order[] | undefined, orders: Order[]) => Order[];
14
+ export declare const notifyOrderUpdates: (previousOrders: Order[] | undefined, orders: Order[], callbacks?: Callbacks, notifiedFilledOrders?: Set<string>, trackedOrder?: Order) => void;
13
15
  export declare const structurallyShareOrders: (previousOrders: Order[] | undefined, orders: Order[]) => Order[];
14
16
  /** A partial SDK result must not suppress the next legacy-history retry. */
15
- export declare const loadOrderHistory: ({ client, account, signal, supportLegacyOrders, previousOrders, legacyLoaded, callbacks, }: {
17
+ export declare const loadOrderHistory: ({ client, account, signal, supportLegacyOrders, previousOrders, legacyLoaded, }: {
16
18
  client: Pick<SpotClient, "getAccountOrdersResult">;
17
19
  account: string;
18
20
  signal: AbortSignal;
19
21
  supportLegacyOrders: boolean;
20
22
  previousOrders?: Order[];
21
23
  legacyLoaded: boolean;
22
- callbacks?: Callbacks;
23
24
  }) => Promise<{
24
25
  orders: Order[];
25
26
  legacyLoaded: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"order-history-data.d.ts","sourceRoot":"","sources":["../../../src/order-history-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,KAAK,EAAE,CAAC;IACb,IAAI,EAAE,KAAK,EAAE,CAAC;IACd,SAAS,EAAE,KAAK,EAAE,CAAC;IACnB,SAAS,EAAE,KAAK,EAAE,CAAC;IACnB,OAAO,EAAE,KAAK,EAAE,CAAC;CAClB;AAMD,eAAO,MAAM,gBAAgB,GAAI,QAAQ,KAAK,EAAE,KAAG,iBAgClD,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,QAAQ,KAAK,EAAE,EACf,eAAe,KAAK,EAAE,KACrB,KAAK,EAQP,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,gBAAgB,KAAK,EAAE,GAAG,SAAS,EACnC,QAAQ,KAAK,EAAE,EACf,YAAY,SAAS,KACpB,IA2BF,CAAC;AA6CF,eAAO,MAAM,uBAAuB,GAClC,gBAAgB,KAAK,EAAE,GAAG,SAAS,EACnC,QAAQ,KAAK,EAAE,KACd,KAAK,EAGI,CAAC;AAEb,4EAA4E;AAC5E,eAAO,MAAM,gBAAgB,GAAU,4FAEpC;IACD,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,wBAAwB,CAAC,CAAC;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;IACpB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,cAAc,CAAC,EAAE,KAAK,EAAE,CAAC;IACz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,GAAU,iFAEpC;IACD,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,wBAAwB,CAAC,CAAC;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;IACpB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,cAAc,CAAC,EAAE,KAAK,EAAE,CAAC;IACzB,YAAY,EAAE,OAAO,CAAC;CACvB,KAAG,OAAO,CAAC;IAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAAC,YAAY,EAAE,OAAO,CAAA;CAAE,CAWrD,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { ParsedError } from './types';
2
+ export declare const getErrorMessage: (error: unknown) => string;
3
+ export declare const getErrorCode: (error: unknown) => ParsedError["code"];
4
+ export declare const normalizeError: (error: unknown) => Error;
5
+ export declare const parseExecutionError: (error: unknown) => ParsedError;
6
+ //# sourceMappingURL=parse-execution-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-execution-error.d.ts","sourceRoot":"","sources":["../../../src/parse-execution-error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAI3C,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,KAAG,MAQhD,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,WAAW,CAAC,MAAM,CAY/D,CAAC;AAoBF,eAAO,MAAM,cAAc,GAAI,OAAO,OAAO,KAAG,KAG/C,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,OAAO,OAAO,KAAG,WAcpD,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { Order } from '@orbs-network/spot-ui';
2
+ import { StoreApi } from 'zustand/vanilla';
3
+ import { SpotStore } from './context/create-spot-store';
4
+ import { Callbacks } from './types';
5
+ /** Reconciles the saved attempt using read-only lookups; never signs or submits again. */
6
+ export declare function resumeExecution({ store, callbacks, signal }: {
7
+ store: StoreApi<SpotStore>;
8
+ callbacks?: Callbacks;
9
+ signal: AbortSignal;
10
+ }): Promise<Order | undefined>;
11
+ //# sourceMappingURL=resume-execution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resume-execution.d.ts","sourceRoot":"","sources":["../../../src/resume-execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwD,KAAK,KAAK,EAAsB,MAAM,uBAAuB,CAAC;AAC7H,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAkB,KAAK,SAAS,EAAsB,MAAM,SAAS,CAAC;AAmC7E,0FAA0F;AAC1F,wBAAsB,eAAe,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;IAClE,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,MAAM,EAAE,WAAW,CAAC;CACrB,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAuD7B"}
@@ -13,6 +13,7 @@ export declare enum ExecutionPhase {
13
13
  SIGNING = "signing",
14
14
  SUBMITTING = "submitting",
15
15
  SETTLING = "settling",
16
+ UNCONFIRMED = "unconfirmed",
16
17
  SUCCESS = "success",
17
18
  FAILED = "failed",
18
19
  REJECTED = "rejected"
@@ -59,7 +60,11 @@ export type OnCancelOrderSuccess = {
59
60
  };
60
61
  export type ParsedError = {
61
62
  message: string;
62
- code: number;
63
+ code: number | string;
64
+ reason?: "cancelled" | "expired" | "unconfirmed" | "aborted";
65
+ orderId?: string;
66
+ status?: number;
67
+ serviceCode?: string | number;
63
68
  };
64
69
  export type ObserverResult = void | PromiseLike<unknown>;
65
70
  export type Callbacks = {
@@ -89,7 +94,7 @@ export type Callbacks = {
89
94
  };
90
95
  export type MarketQuote = {
91
96
  quotedOutputAmountRaw?: string;
92
- /** Slippage-adjusted minimum, required for Module.SWAP; expressed in output-token base units. */
97
+ /** Current quote.minimumAmountOut unchanged, required for Module.SWAP; output-token base units. */
93
98
  minimumOutputAmountRaw?: string;
94
99
  isLoading?: boolean;
95
100
  noLiquidity?: boolean;
@@ -148,6 +153,8 @@ export interface CompletedWrap {
148
153
  export type SwapExecution = {
149
154
  executionId?: number;
150
155
  phase: ExecutionPhase;
156
+ account?: Address;
157
+ partner?: Partners;
151
158
  parsedError?: ParsedError;
152
159
  error?: Error;
153
160
  stepIndex?: number;
@@ -159,6 +166,8 @@ export type SwapExecution = {
159
166
  outputToken?: Token;
160
167
  chainId?: number;
161
168
  orderId?: string;
169
+ /** Accepted order retained for status recovery without submitting another intent. */
170
+ order?: Order;
162
171
  hasApproval?: boolean;
163
172
  form?: CalculatedOrderForm;
164
173
  preparedOrder?: PreparedOrder;