@orbs-network/spot-react 2.1.18 → 2.1.19
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.
- package/README.md +133 -26
- package/dist/spot-react/src/context/create-spot-store.d.ts +3 -2
- package/dist/spot-react/src/context/create-spot-store.d.ts.map +1 -1
- package/dist/spot-react/src/context/spot-trading-context.d.ts +1 -1
- package/dist/spot-react/src/context/spot-trading-context.d.ts.map +1 -1
- package/dist/spot-react/src/execute-order.d.ts.map +1 -1
- package/dist/spot-react/src/execution-state.d.ts +6 -4
- package/dist/spot-react/src/execution-state.d.ts.map +1 -1
- package/dist/spot-react/src/hooks/use-execution.d.ts +8 -1
- package/dist/spot-react/src/hooks/use-execution.d.ts.map +1 -1
- package/dist/spot-react/src/hooks/use-resume-execution.d.ts +3 -0
- package/dist/spot-react/src/hooks/use-resume-execution.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-swap-execution.d.ts +3 -0
- package/dist/spot-react/src/hooks/use-swap-execution.d.ts.map +1 -1
- package/dist/spot-react/src/index.d.ts +1 -1
- package/dist/spot-react/src/index.d.ts.map +1 -1
- package/dist/spot-react/src/order-history-data.d.ts +4 -3
- package/dist/spot-react/src/order-history-data.d.ts.map +1 -1
- package/dist/spot-react/src/parse-execution-error.d.ts +6 -0
- package/dist/spot-react/src/parse-execution-error.d.ts.map +1 -0
- package/dist/spot-react/src/resume-execution.d.ts +11 -0
- package/dist/spot-react/src/resume-execution.d.ts.map +1 -0
- package/dist/spot-react/src/types.d.ts +11 -2
- package/dist/spot-react/src/types.d.ts.map +1 -1
- package/dist/spot-react/src/wait-for-swap-order.d.ts +2 -0
- package/dist/spot-react/src/wait-for-swap-order.d.ts.map +1 -1
- package/dist/spot-react.js +1023 -878
- package/dist/spot-react.umd.cjs +1 -1
- 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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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? }
|
|
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
|
|
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,
|
|
569
|
+
const { status, isSuccess, isUnconfirmed, canDismiss, returnToOrderForm, startNewOrder } =
|
|
524
570
|
useExecution();
|
|
525
571
|
|
|
526
572
|
const onClose = useCallback(() => {
|
|
527
|
-
if (
|
|
573
|
+
if (!canDismiss) return;
|
|
528
574
|
setIsModalOpen(false);
|
|
575
|
+
if (isUnconfirmed) return;
|
|
529
576
|
|
|
530
577
|
if (isSuccess) {
|
|
531
578
|
setInputAmount("");
|
|
@@ -533,16 +580,65 @@ const onClose = useCallback(() => {
|
|
|
533
580
|
} else if (status) {
|
|
534
581
|
setTimeout(returnToOrderForm, 500);
|
|
535
582
|
}
|
|
536
|
-
}, [
|
|
583
|
+
}, [canDismiss, isSuccess, isUnconfirmed, returnToOrderForm, setInputAmount, startNewOrder, status]);
|
|
537
584
|
```
|
|
538
585
|
|
|
539
|
-
`isExecuting` covers preparation, wrapping, approval, signing, submission, and
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
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; an explicit expired
|
|
612
|
+
status becomes terminal only after its deadline has passed.
|
|
613
|
+
|
|
614
|
+
Both reset actions return `false` during active or unconfirmed execution. Keep
|
|
615
|
+
the modal open while `isExecuting`. `returnToOrderForm()` dismisses a definitive
|
|
616
|
+
failure or rejection while preserving the form and completed-wrap metadata;
|
|
617
|
+
reusing that metadata requires `getTokenBalance` to verify funds again.
|
|
618
|
+
`startNewOrder()` resets Spot's internal form and retry metadata after a confirmed
|
|
619
|
+
terminal outcome. The host still clears its own input only after success. The
|
|
620
|
+
short delay lets the close animation finish before state resets.
|
|
621
|
+
|
|
622
|
+
`phase` is the precise execution state: `idle → preparing → wrapping → approving
|
|
623
|
+
→ signing → submitting`, followed by `settling → success` for swaps or immediate
|
|
624
|
+
`success` for advanced order creation. Wrapping and approval are skipped when
|
|
625
|
+
unnecessary. Definitive failures and wallet rejections use `failed` and `rejected`;
|
|
626
|
+
uncertain submission or settlement uses `unconfirmed`. `status` is the coarser
|
|
627
|
+
`ExecutionStatus` value. Map it explicitly to the separately versioned
|
|
628
|
+
`@orbs-network/swap-ui` `SwapStatus` enum as shown above. Each attempt has an
|
|
629
|
+
internal identity, duplicate starts are rejected atomically, and stale async
|
|
630
|
+
writes cannot replace a newer attempt. Host callbacks are observational:
|
|
631
|
+
synchronous throws and rejected callback promises never change a wallet or API result.
|
|
632
|
+
|
|
633
|
+
Once an attempt begins, `useOrderForm()` exposes its frozen form and
|
|
634
|
+
`useExecution()` exposes its captured tokens, account, and chain. Preparation runs
|
|
635
|
+
after wrapping and approval; the resulting payload is retained through signing,
|
|
636
|
+
submission, and recovery. Host quote, token, chain, or time updates cannot replace
|
|
637
|
+
an unresolved order.
|
|
638
|
+
|
|
639
|
+
`error` is a `ParsedError`: `code` retains string SDK classifications or numeric
|
|
640
|
+
wallet codes, with `0` as the fallback. Optional `reason`, `orderId`, HTTP `status`,
|
|
641
|
+
and `serviceCode` preserve settlement and service details for host error UI.
|
|
546
642
|
|
|
547
643
|
## Callbacks
|
|
548
644
|
|
|
@@ -712,7 +808,7 @@ import the framework-neutral SDK helpers from `@orbs-network/spot-react`:
|
|
|
712
808
|
|
|
713
809
|
```ts
|
|
714
810
|
import {
|
|
715
|
-
createClient,
|
|
811
|
+
createClient, isSwapSupported,
|
|
716
812
|
waitForOrder, QuoteError, type SwapQuote,
|
|
717
813
|
} from "@orbs-network/spot-react";
|
|
718
814
|
```
|
|
@@ -720,13 +816,22 @@ import {
|
|
|
720
816
|
Use `client.getQuote({ inToken, outToken, inAmount, user, slippage, signal })`
|
|
721
817
|
to inherit the initialized client's partner and chain. The standalone `getQuote`
|
|
722
818
|
export remains available for quoting without a client. Slippage is a percentage:
|
|
723
|
-
`0.5` means 0.5%. Before a wallet connects, a
|
|
724
|
-
`0x0000000000000000000000000000000000000001` can satisfy `user`;
|
|
725
|
-
the quote key
|
|
819
|
+
`0.5` means 0.5%. Before a wallet connects, a preview account
|
|
820
|
+
such as `0x0000000000000000000000000000000000000001` can satisfy `user`;
|
|
821
|
+
include it in the quote key. This is quote-request metadata; pass the connected
|
|
822
|
+
account as `userAddress` for preparation and execution. A refetch solely to bind
|
|
823
|
+
the signer is unnecessary; the host owns its quote cache policy and live wallet
|
|
824
|
+
context checks.
|
|
726
825
|
|
|
727
826
|
Keep wrapping, approval, and EIP-712 signing in the DEX's existing wallet flow.
|
|
728
|
-
After confirmed approval to `client.spenderAddress`, call
|
|
729
|
-
|
|
827
|
+
After confirmed approval to `client.spenderAddress`, call
|
|
828
|
+
`client.prepareSwap(quote, account)`,
|
|
829
|
+
sign its `signingRequest`, then call `client.submitOrder(prepared.order, signature, { signal })`.
|
|
830
|
+
The manual router flow fetches a current quote after wrapping/approval and checks
|
|
831
|
+
its net output against the original `quote.minimumAmountOut` before pure preparation. A lower
|
|
832
|
+
quote requires fresh review; keep the reviewed minimum when it is still covered.
|
|
833
|
+
All swaps have a fixed 3-minute expiration from preparation, immediately before
|
|
834
|
+
signing.
|
|
730
835
|
Call `waitForOrder({ order })`; it derives the ID, chain, and deadline from the
|
|
731
836
|
returned order. Tracking needs no initialized client. No `walletInteractions` object,
|
|
732
837
|
React provider, or calculated form is required for this path.
|
|
@@ -734,6 +839,8 @@ React provider, or calculated form is required for this path.
|
|
|
734
839
|
No separate `spot-ui` installation is needed. See the [router example](../spot-ui/examples/router-swap.ts).
|
|
735
840
|
The optional `submitSwap` convenience function remains available from `spot-react`
|
|
736
841
|
when SDK wallet orchestration through callbacks is preferred.
|
|
842
|
+
The 3-minute window starts at final preparation after wrapping and approval.
|
|
843
|
+
Calculated form swaps in `SpotProvider` use the same fixed expiration.
|
|
737
844
|
`spot-react` reuses the SDK wallet executor and `watchOrder` stream underlying
|
|
738
845
|
`waitForOrder`; both tracking helpers take only `order` and optional `signal`. Its provider
|
|
739
846
|
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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MAAM,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;
|
|
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,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,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,KAAK,YAAY,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;AAE9C,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,YAAY,EA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,EACnB,KAAK,EAAE,aAAa,KACjB,OAAO,CAAC;IACb,gBAAgB,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,OAAO,CAAC;IAC1D,aAAa,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,OAAO,CAAC;IACvD,iBAAiB,EAAE,MAAM,OAAO,CAAC;IACjC,WAAW,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;IAC7C,KAAK,EAAE,KAAK,CAAC;CACd;AAqCD,eAAO,MAAM,eAAe,GAC1B,cAAc,gBAAgB,KAC7B,QAAQ,CAAC,SAAS,CA2VpB,CAAC;AAEF,eAAO,MAAM,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
|
-
/**
|
|
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,
|
|
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;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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute-order.d.ts","sourceRoot":"","sources":["../../../src/execute-order.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"execute-order.d.ts","sourceRoot":"","sources":["../../../src/execute-order.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,OAAO,EACZ,KAAK,mBAAmB,EACxB,KAAK,KAAK,EAEV,KAAK,UAAU,EAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,KAAK,kBAAkB,EACxB,MAAM,SAAS,CAAC;AASjB,UAAU,qBAAqB;IAC7B,mBAAmB,EAAE,MAAM,aAAa,CAAC;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,
|
|
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,
|
|
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,aAAa,EACnB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AA+D/F,eAAO,MAAM,mBAAmB,GAC9B,gBAAgB,aAAa,KAC5B,aAGD,CAAC;AAEH,eAAO,MAAM,iBAAiB,GAAI,OAAO,cAAc,KAAG,OAChC,CAAC;AAE3B,wFAAwF;AACxF,eAAO,MAAM,iBAAiB,GAAI,OAAO,cAAc,KAAG,OACQ,CAAC;AAEnE,eAAO,MAAM,iBAAiB,GAAI,OAAO,cAAc,KAAG,OAGvB,CAAC;AAEpC,6FAA6F;AAC7F,eAAO,MAAM,2BAA2B,GAAI,OAAO,OAAO,EAAE,OAAO,cAAc,KAAG,OAUnF,CAAC;AAEF,eAAO,MAAM,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;
|
|
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,EACV,KAAK,KAAK,EACX,MAAM,UAAU,CAAC;AAClB,OAAO,EAAmB,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAiBtE,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,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,4EAA4E;IAC5E,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,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,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,YAAY,QAAO,iBAqE/B,CAAC;AAEF,eAAO,MAAM,eAAe;;;CAkD3B,CAAC"}
|
|
@@ -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
|
|
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,
|
|
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 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B,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
|
-
|
|
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,
|
|
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,E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9B,gBAAgB,KAAK,EAAE,GAAG,SAAS,EACnC,QAAQ,KAAK,EAAE,KACd,KAAK,EAaP,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,gBAAgB,KAAK,EAAE,GAAG,SAAS,EACnC,QAAQ,KAAK,EAAE,EACf,YAAY,SAAS,EACrB,uBAAuB,GAAG,CAAC,MAAM,CAAC,EAClC,eAAe,KAAK,KACnB,IA4CF,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,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
|
-
/**
|
|
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;
|