@orbs-network/spot-react 2.1.17 → 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 +197 -27
- 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/order-form-context.d.ts.map +1 -1
- package/dist/spot-react/src/context/spot-trading-context.d.ts +2 -0
- package/dist/spot-react/src/context/spot-trading-context.d.ts.map +1 -1
- package/dist/spot-react/src/context/use-spot-provider-state.d.ts.map +1 -1
- package/dist/spot-react/src/execute-order.d.ts +2 -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/order-hooks.d.ts.map +1 -1
- package/dist/spot-react/src/hooks/use-execution.d.ts +10 -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-submit-order.d.ts.map +1 -1
- 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 +16 -7
- package/dist/spot-react/src/types.d.ts.map +1 -1
- package/dist/spot-react/src/wait-for-swap-order.d.ts +15 -0
- package/dist/spot-react/src/wait-for-swap-order.d.ts.map +1 -0
- package/dist/spot-react.js +982 -844
- package/dist/spot-react.umd.cjs +1 -1
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
# @orbs-network/spot-react
|
|
2
2
|
|
|
3
|
-
React SDK for building TWAP, Limit, Stop-Loss, and Take-Profit order interfaces on top of the [Orbs Spot protocol](https://www.orbs.com/).
|
|
3
|
+
React SDK for building Swap, TWAP, Limit, Stop-Loss, and Take-Profit order interfaces on top of the [Orbs Spot protocol](https://www.orbs.com/).
|
|
4
4
|
|
|
5
5
|
`spot-react` owns Spot order state and exposes it through `SpotProvider` and focused named hooks. The host DEX remains responsible for swap-form state, wallet access, components, styling, translations, routing, and modal shells.
|
|
6
6
|
|
|
7
|
+
| I'm building… | Use… |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| A React order form | `SpotProvider` with `Module.SWAP` or an advanced module, then `useExecution()` |
|
|
10
|
+
| A DEX router with an existing wallet flow | `client.getQuote` → `client.prepareSwap` → DEX signing → `client.submitOrder` → `waitForOrder`; no provider required |
|
|
11
|
+
| A custom flow that needs SDK wallet orchestration | `submitSwap` for swaps; `calculateOrder` + `executeOrder` with `client.prepareOrder` for advanced orders |
|
|
12
|
+
|
|
13
|
+
Every path can import its SDK functions and types from `spot-react` alone.
|
|
14
|
+
The underlying `spot-ui` package is framework-neutral and renders no components.
|
|
15
|
+
|
|
7
16
|
For the complete integration workflow, see the [Spot React integration skill](https://github.com/orbs-network/spot-ui/tree/master/skills/spot-react-integration) and the [reference implementation](https://github.com/orbs-network/spot-ui/blob/master/apps/web/components/spot/spot-form.tsx).
|
|
8
17
|
|
|
9
18
|
Client and history resources are configured once per provider. History and
|
|
@@ -26,26 +35,48 @@ Every DEX needs a member of the exported `Partners` enum and a server-side Orbs
|
|
|
26
35
|
|
|
27
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.
|
|
28
37
|
|
|
29
|
-
`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.
|
|
30
56
|
|
|
31
57
|
The authoritative shared model is available from `useOrderForm()`.
|
|
32
58
|
|
|
33
59
|
Each mounted `SpotProvider` owns one stable store. Changing the module or token
|
|
34
60
|
pair reapplies form defaults without recreating the partner/chain client,
|
|
35
61
|
history cache, or cancellation state. If that scope changes during execution,
|
|
36
|
-
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
|
|
37
64
|
partner or chain reconfigures only the resources whose keys actually changed.
|
|
38
65
|
|
|
39
66
|
The completed integration should:
|
|
40
67
|
|
|
41
68
|
- keep tokens, typed amount, balances, USD prices, and quote state in the DEX's existing swap store or context;
|
|
42
|
-
- provide
|
|
69
|
+
- provide the five required `walletInteractions` methods using the DEX's existing wallet stack, plus `getTokenBalance` for completed-wrap retries;
|
|
43
70
|
- render TWAP, Limit, Stop-Loss, and Take-Profit entry points using DEX-native navigation and components;
|
|
44
71
|
- use `@orbs-network/swap-ui` for the order review/progress flow inside the DEX's modal shell;
|
|
45
72
|
- render order history and cancellation inside `SpotProvider` scope or through a context-preserving portal.
|
|
46
73
|
|
|
47
74
|
## Installation
|
|
48
75
|
|
|
76
|
+
`spot-react` includes `spot-ui` as a dependency and re-exports all of its public
|
|
77
|
+
functions and types. Install only `spot-react` for the SDK and hooks; add
|
|
78
|
+
`swap-ui` when using its order progress components.
|
|
79
|
+
|
|
49
80
|
Install the latest Spot packages with the host application's package manager. Do not mix lockfiles.
|
|
50
81
|
|
|
51
82
|
```bash
|
|
@@ -93,7 +124,7 @@ Keep the DEX swap form as the source of truth. Pass the following adapted values
|
|
|
93
124
|
| Selected tokens | `Token` objects with `address`, `symbol`, `decimals`, and optional `logoUrl` |
|
|
94
125
|
| Wrapped native token | The connected chain's wrapped-native `Token`, supplied by the DEX |
|
|
95
126
|
| Typed source amount | User-facing decimal string, for example `"1.25"` |
|
|
96
|
-
| Quote output | Raw destination-token amount for the current typed input |
|
|
127
|
+
| Quote output | Raw destination-token amount for the current typed input; swaps map `quote.minimumAmountOut` unchanged to `minimumOutputAmountRaw` |
|
|
97
128
|
| Input balance | Raw integer string |
|
|
98
129
|
| USD prices | USD value of exactly one whole source/destination token |
|
|
99
130
|
| Chain and account | Values from the connected wallet/account state |
|
|
@@ -248,7 +279,12 @@ function SpotOrderForm({ module }: { module: Module }) {
|
|
|
248
279
|
}
|
|
249
280
|
```
|
|
250
281
|
|
|
251
|
-
`marketQuote.quotedOutputAmountRaw` is the
|
|
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.
|
|
252
288
|
|
|
253
289
|
`spot-react` has no network registry. Always pass the `wrappedNativeToken` prop
|
|
254
290
|
from the DEX's own chain configuration; its value may be `undefined` only until
|
|
@@ -264,11 +300,11 @@ Use the connected wallet chain as the source of truth. When it is absent or unsu
|
|
|
264
300
|
| Prop | Type | Required | Description |
|
|
265
301
|
| --- | --- | --- | --- |
|
|
266
302
|
| `partner` | `Partners` | Yes | DEX partner enum |
|
|
267
|
-
| `module` | `Module` | Yes | `TWAP`, `LIMIT`, `STOP_LOSS`, or `TAKE_PROFIT` |
|
|
303
|
+
| `module` | `Module` | Yes | `SWAP`, `TWAP`, `LIMIT`, `STOP_LOSS`, or `TAKE_PROFIT` |
|
|
268
304
|
| `inputAmountUi` | `string` | Yes | User-entered input-token amount |
|
|
269
|
-
| `priceProtectionPercent` | `number` | Yes | Price Protection percentage;
|
|
305
|
+
| `priceProtectionPercent` | `number` | Yes | Price Protection percentage for advanced orders; ignored for `SWAP`, which signs 500 bps oracle protection |
|
|
270
306
|
| `minTradeSizeUsd` | `number` | Yes | Minimum individual trade size in USD |
|
|
271
|
-
| `marketQuote` | `MarketQuote` | Yes | `{ quotedOutputAmountRaw?, isLoading?, noLiquidity? }
|
|
307
|
+
| `marketQuote` | `MarketQuote` | Yes | `{ quotedOutputAmountRaw?, minimumOutputAmountRaw?, isLoading?, noLiquidity? }`; swaps use `quote.netAmountOut` and `quote.minimumAmountOut` unchanged |
|
|
272
308
|
| `walletInteractions` | `WalletInteractions` | Yes | Five wallet methods implemented by the DEX |
|
|
273
309
|
| `chainId` | `number` | No | Connected wallet chain ID |
|
|
274
310
|
| `account` | `Address` | No | Connected wallet address |
|
|
@@ -288,16 +324,27 @@ Use the connected wallet chain as the source of truth. When it is absent or unsu
|
|
|
288
324
|
`undefined` only while their values are genuinely unavailable. The output-token
|
|
289
325
|
USD price remains optional because it is used for display details rather than
|
|
290
326
|
submission readiness.
|
|
327
|
+
These required keys make host ownership explicit while allowing disconnected or
|
|
328
|
+
loading states; use the same pattern for `wrappedNativeToken` before a chain is known.
|
|
291
329
|
|
|
292
330
|
`minTradeSizeUsd` must be a positive USD threshold approved for the partner;
|
|
293
331
|
there is intentionally no SDK default. `priceProtectionPercent` uses percentage
|
|
294
|
-
units, so `3` means 3% (300 bps)
|
|
332
|
+
units, so `3` means 3% (300 bps); swaps ignore it and sign 500 bps (5%) oracle
|
|
333
|
+
protection independently of the UI minimum. `displayFeePercent` only populates `form.fees`
|
|
295
334
|
for the review UI. Protocol fee collection is configured separately by the
|
|
296
335
|
partner and backend.
|
|
297
336
|
|
|
298
337
|
## WalletInteractions
|
|
299
338
|
|
|
300
|
-
|
|
339
|
+
`WalletInteractions` extends the SDK's `OrderWalletInteractions` with
|
|
340
|
+
`cancelOrder`; one wallet adapter can support both SDK orchestration and React
|
|
341
|
+
history. The `ApproveTokenProps`, `GetAllowanceProps`, and `CancelOrderProps`
|
|
342
|
+
aliases remain available for existing adapters.
|
|
343
|
+
|
|
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.
|
|
301
348
|
|
|
302
349
|
```tsx
|
|
303
350
|
const walletInteractions: WalletInteractions = {
|
|
@@ -333,6 +380,9 @@ const walletInteractions: WalletInteractions = {
|
|
|
333
380
|
|
|
334
381
|
getAllowance: ({ tokenAddress, spenderAddress }) =>
|
|
335
382
|
dexWallet.getAllowance({ tokenAddress, spenderAddress }),
|
|
383
|
+
|
|
384
|
+
getTokenBalance: ({ tokenAddress }) =>
|
|
385
|
+
dexWallet.getTokenBalance({ tokenAddress }),
|
|
336
386
|
};
|
|
337
387
|
```
|
|
338
388
|
|
|
@@ -343,8 +393,13 @@ const walletInteractions: WalletInteractions = {
|
|
|
343
393
|
| `cancelOrder({ order, contractAddress, args, abi })` | Call `cancel` with the supplied ABI and args, wait for confirmation, return tx hash |
|
|
344
394
|
| `signOrder({ signerAddress, typedData })` | Adapt the framework-neutral EIP-712 request to the host wallet and return its original `0x`-prefixed signature |
|
|
345
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 |
|
|
346
397
|
|
|
347
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.
|
|
348
403
|
|
|
349
404
|
## Building with focused hooks
|
|
350
405
|
|
|
@@ -385,7 +440,7 @@ const history = useOrders();
|
|
|
385
440
|
| `useDisclaimer()` | Disclaimer translation key or `undefined` |
|
|
386
441
|
| `useInputErrors()` | `{ type, args }` or `undefined` |
|
|
387
442
|
| `useSubmitButton()` | `disabled` and `loading` |
|
|
388
|
-
| `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 |
|
|
389
444
|
| `useOrders()` | Provider-scoped categorized order lists and polling state |
|
|
390
445
|
| `useHistoryOrder()` | Display-ready values for one history order |
|
|
391
446
|
| `useCancelOrder()` | Per-order cancellation state and action |
|
|
@@ -396,6 +451,11 @@ Child components should call the relevant focused hook themselves instead of rec
|
|
|
396
451
|
|
|
397
452
|
Keep the submit button disabled while `loading` is true. If client initialization fails, `SpotProvider` keeps child components mounted and renders the retryable `clientErrorFallback` alongside them.
|
|
398
453
|
|
|
454
|
+
For `Module.SWAP`, a missing or invalid minimum reports
|
|
455
|
+
`InputErrors.INVALID_SWAP_MINIMUM` through `useInputErrors()` once the other
|
|
456
|
+
required inputs are ready. Render and translate this error; `useSubmitButton()`
|
|
457
|
+
then disables submission without showing an indefinite quote-loading spinner.
|
|
458
|
+
|
|
399
459
|
### Trade-count validation behavior
|
|
400
460
|
|
|
401
461
|
An explicitly selected TWAP trade count persists when `inputAmountUi` changes. If lowering the amount makes that count greater than the newly calculated `maxTrades`, Spot does not clamp or reset it: `useTrades().error` and `useInputErrors()` report `InputErrors.MAX_TRADES`, and submission remains disabled until the user selects a valid count. This is an intentional behavior change from integrations that silently reset the trade count on every amount edit. Hosts should render the returned validation error so the user can correct the value.
|
|
@@ -437,6 +497,7 @@ Use `useExecution()` for execution state, `useOrderForm()` for review details, a
|
|
|
437
497
|
import { SwapFlow, SwapStatus as SwapUiStatus } from "@orbs-network/swap-ui";
|
|
438
498
|
import {
|
|
439
499
|
ExecutionStatus,
|
|
500
|
+
Module,
|
|
440
501
|
useExecution,
|
|
441
502
|
useOrderForm,
|
|
442
503
|
} from "@orbs-network/spot-react";
|
|
@@ -449,8 +510,20 @@ function SpotOrderFlow() {
|
|
|
449
510
|
outputToken,
|
|
450
511
|
currentStepIndex,
|
|
451
512
|
totalSteps,
|
|
513
|
+
isUnconfirmed,
|
|
514
|
+
resumeTracking,
|
|
515
|
+
orderId,
|
|
452
516
|
} = useExecution();
|
|
453
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
|
+
}
|
|
454
527
|
const swapStatus =
|
|
455
528
|
status === ExecutionStatus.SUCCESS
|
|
456
529
|
? SwapUiStatus.SUCCESS
|
|
@@ -471,7 +544,7 @@ function SpotOrderFlow() {
|
|
|
471
544
|
totalSteps={totalSteps}
|
|
472
545
|
components={{
|
|
473
546
|
Main: <SwapFlow.Main inUsd={form.inputAmount.usd} outUsd={form.outputAmount.usd} />,
|
|
474
|
-
Success: <SwapFlow.Success title="Order created" />,
|
|
547
|
+
Success: <SwapFlow.Success title={form.module === Module.SWAP ? "Swap completed" : "Order created"} />,
|
|
475
548
|
Failed: <SwapFlow.Failed error={error?.message} />,
|
|
476
549
|
}}
|
|
477
550
|
/>
|
|
@@ -485,20 +558,21 @@ Wrap `SwapFlow` in the DEX's modal shell and skin it with DEX colors, surfaces,
|
|
|
485
558
|
|
|
486
559
|
`useExecution()` returns:
|
|
487
560
|
|
|
488
|
-
- `submitOrder`, `phase`, `status`, `isExecuting`, `isSuccess`, `isFailed`, `isRejected`, `isPreparingOrder`, and `canDismiss`;
|
|
561
|
+
- `submitOrder`, `resumeTracking`, `phase`, `status`, `isExecuting`, `isUnconfirmed`, `isSuccess`, `isFailed`, `isRejected`, `isPreparingOrder`, and `canDismiss`;
|
|
489
562
|
- `currentStep`, `currentStepIndex`, `totalSteps`, and `executionSteps`;
|
|
490
|
-
- `error`, `inputToken`, `outputToken`, `chainId`, `wrapTxHash`, and `approvalTxHash`;
|
|
563
|
+
- `error`, `order`, `orderId`, `account`, `inputToken`, `outputToken`, `chainId`, `wrapTxHash`, and `approvalTxHash`;
|
|
491
564
|
- `returnToOrderForm()` and `startNewOrder()`.
|
|
492
565
|
|
|
493
566
|
`spot-react` does not clear the DEX input. Do that only when a successful modal closes:
|
|
494
567
|
|
|
495
568
|
```tsx
|
|
496
|
-
const { status, isSuccess,
|
|
569
|
+
const { status, isSuccess, isUnconfirmed, canDismiss, returnToOrderForm, startNewOrder } =
|
|
497
570
|
useExecution();
|
|
498
571
|
|
|
499
572
|
const onClose = useCallback(() => {
|
|
500
|
-
if (
|
|
573
|
+
if (!canDismiss) return;
|
|
501
574
|
setIsModalOpen(false);
|
|
575
|
+
if (isUnconfirmed) return;
|
|
502
576
|
|
|
503
577
|
if (isSuccess) {
|
|
504
578
|
setInputAmount("");
|
|
@@ -506,14 +580,65 @@ const onClose = useCallback(() => {
|
|
|
506
580
|
} else if (status) {
|
|
507
581
|
setTimeout(returnToOrderForm, 500);
|
|
508
582
|
}
|
|
509
|
-
}, [
|
|
583
|
+
}, [canDismiss, isSuccess, isUnconfirmed, returnToOrderForm, setInputAmount, startNewOrder, status]);
|
|
510
584
|
```
|
|
511
585
|
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
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.
|
|
517
642
|
|
|
518
643
|
## Callbacks
|
|
519
644
|
|
|
@@ -637,7 +762,7 @@ import {
|
|
|
637
762
|
getOrderFillDelayMillis,
|
|
638
763
|
getOrderLimitPriceRate,
|
|
639
764
|
getTwapConfig,
|
|
640
|
-
|
|
765
|
+
calculateOrder,
|
|
641
766
|
toAmountRaw,
|
|
642
767
|
toAmountUI,
|
|
643
768
|
invertPriceInput,
|
|
@@ -652,8 +777,9 @@ import {
|
|
|
652
777
|
} from "@orbs-network/spot-react";
|
|
653
778
|
```
|
|
654
779
|
|
|
655
|
-
React integrations can import the
|
|
656
|
-
its
|
|
780
|
+
React integrations can import the entire public Spot SDK API, including
|
|
781
|
+
`calculateOrder`, its deprecated `calculateOrderForm` alias, swap helpers, and their types, from `@orbs-network/spot-react`.
|
|
782
|
+
It includes `spot-ui` as a runtime dependency; no separate install is needed. Non-React
|
|
657
783
|
integrations should import them from `@orbs-network/spot-ui`. Lower-level
|
|
658
784
|
calculators remain internal entry points; do not import from `dist/*` or
|
|
659
785
|
package-internal source paths.
|
|
@@ -663,7 +789,7 @@ package-internal source paths.
|
|
|
663
789
|
- Use the DEX's existing tokens, inputs, selectors, components, styling, wallet controls, and routing.
|
|
664
790
|
- Keep chain switching out of the Spot token selector; use the DEX network control.
|
|
665
791
|
- Keep the form visible while disconnected; replace only the submit area with connect/switch controls.
|
|
666
|
-
- Persist Price Protection separately from swap slippage
|
|
792
|
+
- Persist Price Protection separately from swap slippage. Show DEX slippage for `Module.SWAP`; show Price Protection for advanced orders.
|
|
667
793
|
- Use `@orbs-network/swap-ui` for order creation/progress content.
|
|
668
794
|
- Convert raw amounts into the DEX's amount type before display.
|
|
669
795
|
- Use callbacks for balance refetch and reset the input only after success.
|
|
@@ -674,3 +800,47 @@ package-internal source paths.
|
|
|
674
800
|
## License
|
|
675
801
|
|
|
676
802
|
MIT
|
|
803
|
+
|
|
804
|
+
## DEX route competition without a provider
|
|
805
|
+
|
|
806
|
+
When a DEX already owns the swap form and selects among liquidity sources,
|
|
807
|
+
import the framework-neutral SDK helpers from `@orbs-network/spot-react`:
|
|
808
|
+
|
|
809
|
+
```ts
|
|
810
|
+
import {
|
|
811
|
+
createClient, isSwapSupported,
|
|
812
|
+
waitForOrder, QuoteError, type SwapQuote,
|
|
813
|
+
} from "@orbs-network/spot-react";
|
|
814
|
+
```
|
|
815
|
+
|
|
816
|
+
Use `client.getQuote({ inToken, outToken, inAmount, user, slippage, signal })`
|
|
817
|
+
to inherit the initialized client's partner and chain. The standalone `getQuote`
|
|
818
|
+
export remains available for quoting without a client. Slippage is a percentage:
|
|
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.
|
|
825
|
+
|
|
826
|
+
Keep wrapping, approval, and EIP-712 signing in the DEX's existing wallet flow.
|
|
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.
|
|
835
|
+
Call `waitForOrder({ order })`; it derives the ID, chain, and deadline from the
|
|
836
|
+
returned order. Tracking needs no initialized client. No `walletInteractions` object,
|
|
837
|
+
React provider, or calculated form is required for this path.
|
|
838
|
+
|
|
839
|
+
No separate `spot-ui` installation is needed. See the [router example](../spot-ui/examples/router-swap.ts).
|
|
840
|
+
The optional `submitSwap` convenience function remains available from `spot-react`
|
|
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.
|
|
844
|
+
`spot-react` reuses the SDK wallet executor and `watchOrder` stream underlying
|
|
845
|
+
`waitForOrder`; both tracking helpers take only `order` and optional `signal`. Its provider
|
|
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,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,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,EAAE,QAAQ,GAAG,WAAW,CAAC,KAC7C,gBAcF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-form-context.d.ts","sourceRoot":"","sources":["../../../../src/context/order-form-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAO3E,eAAO,MAAM,iBAAiB,GAAI,cAAc;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"order-form-context.d.ts","sourceRoot":"","sources":["../../../../src/context/order-form-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAO3E,eAAO,MAAM,iBAAiB,GAAI,cAAc;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,4CA6GtE,CAAC;AAEF,eAAO,MAAM,YAAY,QAAO,mBAM/B,CAAC"}
|
|
@@ -5,6 +5,8 @@ import { Callbacks, Overrides, Token, WalletInteractions } from '../types';
|
|
|
5
5
|
export interface SpotTradingState {
|
|
6
6
|
walletInteractions: WalletInteractions;
|
|
7
7
|
quotedOutputAmountRaw?: string;
|
|
8
|
+
/** Current quote.minimumAmountOut unchanged, required for Module.SWAP; output-token base units. */
|
|
9
|
+
minimumOutputAmountRaw?: string;
|
|
8
10
|
marketPriceLoading?: boolean;
|
|
9
11
|
account?: Address;
|
|
10
12
|
noLiquidity?: boolean;
|
|
@@ -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,OA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B,4CAMA,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,gBAMjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-spot-provider-state.d.ts","sourceRoot":"","sources":["../../../../src/context/use-spot-provider-state.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,UAAU,iBAAiB;IACzB,YAAY,EAAE,gBAAgB,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAED,eAAO,MAAM,oBAAoB,GAAI,OAAO,SAAS,KAAG,
|
|
1
|
+
{"version":3,"file":"use-spot-provider-state.d.ts","sourceRoot":"","sources":["../../../../src/context/use-spot-provider-state.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,UAAU,iBAAiB;IACzB,YAAY,EAAE,gBAAgB,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAED,eAAO,MAAM,oBAAoB,GAAI,OAAO,SAAS,KAAG,iBAoGvD,CAAC"}
|
|
@@ -8,7 +8,6 @@ interface ExecutionStoreActions {
|
|
|
8
8
|
export interface ExecuteOrderParams extends ExecutionStoreActions {
|
|
9
9
|
account?: Address;
|
|
10
10
|
chainId?: number;
|
|
11
|
-
hasChainId: boolean;
|
|
12
11
|
inputToken?: Token;
|
|
13
12
|
outputToken?: Token;
|
|
14
13
|
wrappedNativeToken?: Token;
|
|
@@ -19,6 +18,8 @@ export interface ExecuteOrderParams extends ExecutionStoreActions {
|
|
|
19
18
|
addNewOrder: (order: Order) => void;
|
|
20
19
|
refetchActiveOrders: () => unknown;
|
|
21
20
|
wait?: (milliseconds: number) => Promise<void>;
|
|
21
|
+
signal?: AbortSignal;
|
|
22
|
+
waitForOrderFill?: (order: Order, executionId: number) => Promise<Order>;
|
|
22
23
|
}
|
|
23
24
|
export declare const executeOrder: (params: ExecuteOrderParams) => Promise<Order | undefined>;
|
|
24
25
|
export {};
|
|
@@ -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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-hooks.d.ts","sourceRoot":"","sources":["../../../../src/hooks/order-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAc,MAAM,uBAAuB,CAAC;AAY/D,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAgB/D;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,QAAO,IAuB7C,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;CAa7B,CAAC;AAEF,oEAAoE;AACpE,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"order-hooks.d.ts","sourceRoot":"","sources":["../../../../src/hooks/order-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAc,MAAM,uBAAuB,CAAC;AAY/D,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAgB/D;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,QAAO,IAuB7C,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;CAa7B,CAAC;AAEF,oEAAoE;AACpE,eAAO,MAAM,cAAc,gBAMf,KAAK,SAQhB,CAAC;AAEF,eAAO,MAAM,sBAAsB,0CAMlC,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,MAAM,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAAC;CACvD;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,QAAO,YAsC5B,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,13 +13,21 @@ 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;
|
|
24
|
+
/** True throughout preparation, wallet steps, submission, and swap settlement. */
|
|
18
25
|
isExecuting: boolean;
|
|
26
|
+
/** For swaps, true only after the order fills; other modules finish on submission. */
|
|
19
27
|
isSuccess: boolean;
|
|
20
28
|
isFailed: boolean;
|
|
21
29
|
isRejected: boolean;
|
|
30
|
+
isUnconfirmed: boolean;
|
|
22
31
|
isPreparingOrder: boolean;
|
|
23
32
|
canDismiss: boolean;
|
|
24
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-submit-order.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-submit-order.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-submit-order.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-submit-order.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,cAAc,QAAO,CAAC,MAAM,IAAI,CA8D5C,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 PrepareOrderParams, type PreparedOrder, type PreparedOrderValues, type Eip712TypedData, type OrderSigningRequest, type ApprovalRequest, type AllowanceRequest, type CancelOrderRequest, type ClientGetAccountOrdersParams, 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, getTwapConfig, calculateOrderForm, toAmountRaw, toAmountUI, invertPriceInput, createClient, isNativeAddress, eqIgnoreCase, getOrderExecutionRate, getOrderLimitPriceRate, getOrderFillDelayMillis, getTriggerPriceRate, isTxRejected, DISCLAIMER_URL, ORBS_TWAP_FAQ_URL, ORBS_SLTP_FAQ_URL, ORBS_LOGO, ORBS_WEBSITE_URL, } 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
|