@orbs-network/spot-react 1.1.46 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +226 -117
- package/dist/spot-react/src/context/client-error-notice.d.ts +7 -0
- package/dist/spot-react/src/context/client-error-notice.d.ts.map +1 -0
- package/dist/spot-react/src/context/error-boundary.d.ts +7 -0
- package/dist/spot-react/src/context/error-boundary.d.ts.map +1 -0
- package/dist/spot-react/src/context/order-form-context.d.ts +7 -0
- package/dist/spot-react/src/context/order-form-context.d.ts.map +1 -0
- package/dist/spot-react/src/context/spot-form-synchronizer.d.ts +14 -0
- package/dist/spot-react/src/context/spot-form-synchronizer.d.ts.map +1 -0
- package/dist/spot-react/src/context/spot-provider.d.ts +3 -0
- package/dist/spot-react/src/context/spot-provider.d.ts.map +1 -0
- package/dist/spot-react/src/context/spot-store.d.ts +86 -0
- package/dist/spot-react/src/context/spot-store.d.ts.map +1 -0
- package/dist/spot-react/src/context/use-client.d.ts +10 -0
- package/dist/spot-react/src/context/use-client.d.ts.map +1 -0
- package/dist/spot-react/src/context/use-spot-analytics.d.ts +3 -0
- package/dist/spot-react/src/context/use-spot-analytics.d.ts.map +1 -0
- package/dist/spot-react/src/context/use-spot-provider-state.d.ts +10 -0
- package/dist/spot-react/src/context/use-spot-provider-state.d.ts.map +1 -0
- package/dist/spot-react/src/execute-order.d.ts +24 -0
- package/dist/spot-react/src/execute-order.d.ts.map +1 -0
- package/dist/spot-react/src/execution-state.d.ts +19 -0
- package/dist/spot-react/src/execution-state.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/helper-hooks.d.ts +2 -547
- package/dist/spot-react/src/hooks/helper-hooks.d.ts.map +1 -1
- package/dist/spot-react/src/hooks/order-hooks.d.ts +28 -18
- package/dist/spot-react/src/hooks/order-hooks.d.ts.map +1 -1
- package/dist/spot-react/src/hooks/use-cancel-order.d.ts +4 -4
- package/dist/spot-react/src/hooks/use-cancel-order.d.ts.map +1 -1
- package/dist/spot-react/src/hooks/use-disclaimer.d.ts.map +1 -1
- package/dist/spot-react/src/hooks/use-duration.d.ts +2 -19
- package/dist/spot-react/src/hooks/use-duration.d.ts.map +1 -1
- package/dist/spot-react/src/hooks/use-execution.d.ts +30 -0
- package/dist/spot-react/src/hooks/use-execution.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-fill-delay.d.ts +2 -21
- package/dist/spot-react/src/hooks/use-fill-delay.d.ts.map +1 -1
- package/dist/spot-react/src/hooks/use-history-order.d.ts +51 -27
- package/dist/spot-react/src/hooks/use-history-order.d.ts.map +1 -1
- package/dist/spot-react/src/hooks/use-input-errors.d.ts +1 -1
- package/dist/spot-react/src/hooks/use-input-errors.d.ts.map +1 -1
- package/dist/spot-react/src/hooks/use-limit-price.d.ts +14 -21
- package/dist/spot-react/src/hooks/use-limit-price.d.ts.map +1 -1
- package/dist/spot-react/src/hooks/use-output-amount.d.ts +5 -0
- package/dist/spot-react/src/hooks/use-output-amount.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-price-display.d.ts +10 -0
- package/dist/spot-react/src/hooks/use-price-display.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-submit-order.d.ts +1 -2
- 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 +9 -10
- package/dist/spot-react/src/hooks/use-swap-execution.d.ts.map +1 -1
- package/dist/spot-react/src/hooks/use-trades.d.ts +7 -17
- package/dist/spot-react/src/hooks/use-trades.d.ts.map +1 -1
- package/dist/spot-react/src/hooks/use-trigger-price.d.ts +13 -20
- package/dist/spot-react/src/hooks/use-trigger-price.d.ts.map +1 -1
- package/dist/spot-react/src/index.d.ts +19 -10
- package/dist/spot-react/src/index.d.ts.map +1 -1
- package/dist/spot-react/src/order-history-data.d.ts +14 -0
- package/dist/spot-react/src/order-history-data.d.ts.map +1 -0
- package/dist/spot-react/src/types.d.ts +90 -106
- package/dist/spot-react/src/types.d.ts.map +1 -1
- package/dist/spot-react.js +1647 -6503
- package/dist/spot-react.umd.cjs +1 -64
- package/package.json +8 -13
- package/dist/spot-react/package.json.d.ts +0 -56
- package/dist/spot-react/src/hooks/use-amounts-usd.d.ts +0 -5
- package/dist/spot-react/src/hooks/use-amounts-usd.d.ts.map +0 -1
- package/dist/spot-react/src/hooks/use-build-order-info.d.ts +0 -62
- package/dist/spot-react/src/hooks/use-build-order-info.d.ts.map +0 -1
- package/dist/spot-react/src/hooks/use-deadline.d.ts +0 -2
- package/dist/spot-react/src/hooks/use-deadline.d.ts.map +0 -1
- package/dist/spot-react/src/hooks/use-default-values.d.ts +0 -3
- package/dist/spot-react/src/hooks/use-default-values.d.ts.map +0 -1
- package/dist/spot-react/src/hooks/use-dst-amount.d.ts +0 -11
- package/dist/spot-react/src/hooks/use-dst-amount.d.ts.map +0 -1
- package/dist/spot-react/src/hooks/use-dst-token-panel.d.ts +0 -7
- package/dist/spot-react/src/hooks/use-dst-token-panel.d.ts.map +0 -1
- package/dist/spot-react/src/hooks/use-fees.d.ts +0 -7
- package/dist/spot-react/src/hooks/use-fees.d.ts.map +0 -1
- package/dist/spot-react/src/hooks/use-form-data.d.ts +0 -57
- package/dist/spot-react/src/hooks/use-form-data.d.ts.map +0 -1
- package/dist/spot-react/src/hooks/use-input-with-percentage.d.ts +0 -16
- package/dist/spot-react/src/hooks/use-input-with-percentage.d.ts.map +0 -1
- package/dist/spot-react/src/hooks/use-limit-price-panel.d.ts +0 -22
- package/dist/spot-react/src/hooks/use-limit-price-panel.d.ts.map +0 -1
- package/dist/spot-react/src/hooks/use-partner-chains.d.ts +0 -2
- package/dist/spot-react/src/hooks/use-partner-chains.d.ts.map +0 -1
- package/dist/spot-react/src/hooks/use-price-panel.d.ts +0 -21
- package/dist/spot-react/src/hooks/use-price-panel.d.ts.map +0 -1
- package/dist/spot-react/src/hooks/use-repermit-data.d.ts +0 -7
- package/dist/spot-react/src/hooks/use-repermit-data.d.ts.map +0 -1
- package/dist/spot-react/src/hooks/use-repermit-order-data.d.ts +0 -20
- package/dist/spot-react/src/hooks/use-repermit-order-data.d.ts.map +0 -1
- package/dist/spot-react/src/hooks/use-spot.d.ts +0 -40
- package/dist/spot-react/src/hooks/use-spot.d.ts.map +0 -1
- package/dist/spot-react/src/hooks/use-src-amount.d.ts +0 -6
- package/dist/spot-react/src/hooks/use-src-amount.d.ts.map +0 -1
- package/dist/spot-react/src/hooks/use-submit-order-panel.d.ts +0 -28
- package/dist/spot-react/src/hooks/use-submit-order-panel.d.ts.map +0 -1
- package/dist/spot-react/src/hooks/use-trade-price.d.ts +0 -2
- package/dist/spot-react/src/hooks/use-trade-price.d.ts.map +0 -1
- package/dist/spot-react/src/hooks/use-trigger-price-panel.d.ts +0 -23
- package/dist/spot-react/src/hooks/use-trigger-price-panel.d.ts.map +0 -1
- package/dist/spot-react/src/spot-context.d.ts +0 -6
- package/dist/spot-react/src/spot-context.d.ts.map +0 -1
- package/dist/spot-react/src/store.d.ts +0 -11
- package/dist/spot-react/src/store.d.ts.map +0 -1
- package/dist/spot-react/src/utils.d.ts +0 -20
- package/dist/spot-react/src/utils.d.ts.map +0 -1
- package/dist/spot-ui/src/index.d.ts +0 -14
- package/dist/spot-ui/src/index.d.ts.map +0 -1
- package/dist/spot-ui/src/lib/abi/erc20.json.d.ts +0 -291
- package/dist/spot-ui/src/lib/abi/index.d.ts +0 -260
- package/dist/spot-ui/src/lib/abi/index.d.ts.map +0 -1
- package/dist/spot-ui/src/lib/abi/iweth.json.d.ts +0 -41
- package/dist/spot-ui/src/lib/abi/repermit.json.d.ts +0 -315
- package/dist/spot-ui/src/lib/analytics.d.ts +0 -111
- package/dist/spot-ui/src/lib/analytics.d.ts.map +0 -1
- package/dist/spot-ui/src/lib/build-repermit-order-data.d.ts +0 -35
- package/dist/spot-ui/src/lib/build-repermit-order-data.d.ts.map +0 -1
- package/dist/spot-ui/src/lib/consts.d.ts +0 -99
- package/dist/spot-ui/src/lib/consts.d.ts.map +0 -1
- package/dist/spot-ui/src/lib/lib.d.ts +0 -80
- package/dist/spot-ui/src/lib/lib.d.ts.map +0 -1
- package/dist/spot-ui/src/lib/networks.d.ts +0 -571
- package/dist/spot-ui/src/lib/networks.d.ts.map +0 -1
- package/dist/spot-ui/src/lib/orders/index.d.ts +0 -13
- package/dist/spot-ui/src/lib/orders/index.d.ts.map +0 -1
- package/dist/spot-ui/src/lib/orders/v1-orders.d.ts +0 -34
- package/dist/spot-ui/src/lib/orders/v1-orders.d.ts.map +0 -1
- package/dist/spot-ui/src/lib/orders/v2-orders.d.ts +0 -11
- package/dist/spot-ui/src/lib/orders/v2-orders.d.ts.map +0 -1
- package/dist/spot-ui/src/lib/submit-order.d.ts +0 -3
- package/dist/spot-ui/src/lib/submit-order.d.ts.map +0 -1
- package/dist/spot-ui/src/lib/types.d.ts +0 -319
- package/dist/spot-ui/src/lib/types.d.ts.map +0 -1
- package/dist/spot-ui/src/lib/utils.d.ts +0 -578
- package/dist/spot-ui/src/lib/utils.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
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/).
|
|
4
4
|
|
|
5
|
-
`spot-react` owns Spot order state and exposes it through `SpotProvider` and
|
|
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
7
|
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
8
|
|
|
@@ -12,9 +12,17 @@ Every DEX needs a member of the exported `Partners` enum and a server-side Orbs
|
|
|
12
12
|
|
|
13
13
|
### RePermit configuration security
|
|
14
14
|
|
|
15
|
-
The `/config` endpoint is a security boundary. The SDK
|
|
15
|
+
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.
|
|
16
16
|
|
|
17
|
-
`SpotProvider`
|
|
17
|
+
`SpotProvider` initializes the `spot-ui` client only when the connected chain supports the selected partner. It never substitutes another chain. Client state and order history are scoped to that provider, with no global cache or host query provider required. The framework-neutral `createClient` factory also retains no global state. The client owns configuration-dependent order preparation, signing/approval/cancellation request values, submission, and configured history access; calculations remain package-level functions. Form previews and order construction share the framework-agnostic `calculateOrderForm` model, so defaults, prices, trades, schedules, errors, raw/token-formatted/USD values, and signed execution values cannot diverge. Form calculation is time-independent; `prepareOrder` assigns fresh start, deadline, and nonce values after wrapping and approval, immediately before signing. Initialization is retried twice. After those retries, the provider keeps its children mounted and renders the retryable `clientErrorFallback` alongside them. Supply that component to localize and style the error for the host DEX.
|
|
18
|
+
|
|
19
|
+
The authoritative shared model is available from `useOrderForm()`.
|
|
20
|
+
|
|
21
|
+
Each mounted `SpotProvider` owns one stable store. Changing the module or token
|
|
22
|
+
pair reapplies form defaults without recreating the partner/chain client,
|
|
23
|
+
history cache, or cancellation state. If that scope changes during execution,
|
|
24
|
+
the reset waits until the frozen execution reaches a terminal phase. Changing
|
|
25
|
+
partner or chain reconfigures only the resources whose keys actually changed.
|
|
18
26
|
|
|
19
27
|
The completed integration should:
|
|
20
28
|
|
|
@@ -36,35 +44,44 @@ npm install @orbs-network/spot-react@latest @orbs-network/swap-ui@latest
|
|
|
36
44
|
|
|
37
45
|
If migrating from `@orbs-network/twap-ui`, remove it before installing the packages above.
|
|
38
46
|
|
|
39
|
-
###
|
|
47
|
+
### Migrating from 1.x
|
|
40
48
|
|
|
41
|
-
|
|
49
|
+
Version 2 is a deliberately breaking, headless API. Replace the broad `useSpot`
|
|
50
|
+
and `useSwapExecution` interfaces with focused hooks such as `useOrderForm`,
|
|
51
|
+
`useExecution`, `useSubmitButton`, and `useOrders`. Provider values now use
|
|
52
|
+
`input`/`output` terminology (`inputToken`, `outputToken`, `inputBalance`, and
|
|
53
|
+
`minTradeSizeUsd`), and the host supplies wallet operations through
|
|
54
|
+
`walletInteractions`. Debug query parameters and the `isDev` option are no
|
|
55
|
+
longer supported.
|
|
42
56
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
57
|
+
`@orbs-network/swap-ui` is a recommended companion for the documented order
|
|
58
|
+
progress modal, but it is not imported by `spot-react` and is not required for
|
|
59
|
+
a headless or custom-progress integration.
|
|
60
|
+
|
|
61
|
+
### Peer Dependency
|
|
62
|
+
|
|
63
|
+
The host application must provide React. Zustand is an internal runtime
|
|
64
|
+
dependency of `spot-react`; integrators do not install or configure it.
|
|
46
65
|
|
|
47
66
|
| Package | Version |
|
|
48
67
|
| --- | --- |
|
|
49
|
-
| `@tanstack/react-query` | `^5.90.12` |
|
|
50
|
-
| `bignumber.js` | `^9.3.1` |
|
|
51
|
-
| `react-error-boundary` | `^6.0.0` |
|
|
52
|
-
| `zustand` | `^5.0.9` |
|
|
53
68
|
| `react` | `^18 \|\| ^19` |
|
|
54
|
-
| `react-dom` | `^18 \|\| ^19` |
|
|
55
69
|
|
|
56
70
|
`viem` is not a dependency. Adapt the wallet library already used by the DEX through `walletInteractions`.
|
|
57
71
|
|
|
72
|
+
The published entry includes a `"use client"` directive, so it can be imported
|
|
73
|
+
directly from a Next.js App Router client component.
|
|
74
|
+
|
|
58
75
|
## Integration Model
|
|
59
76
|
|
|
60
77
|
Keep the DEX swap form as the source of truth. Pass the following adapted values directly to `SpotProvider`:
|
|
61
78
|
|
|
62
79
|
| Value | Expected shape |
|
|
63
80
|
| --- | --- |
|
|
64
|
-
| Selected tokens | `Token` objects with `address`, `symbol`, `decimals`, and `logoUrl` |
|
|
81
|
+
| Selected tokens | `Token` objects with `address`, `symbol`, `decimals`, and optional `logoUrl` |
|
|
65
82
|
| Typed source amount | User-facing decimal string, for example `"1.25"` |
|
|
66
83
|
| Quote output | Raw destination-token amount for the current typed input |
|
|
67
|
-
|
|
|
84
|
+
| Input balance | Raw integer string |
|
|
68
85
|
| USD prices | USD value of exactly one whole source/destination token |
|
|
69
86
|
| Chain and account | Values from the connected wallet/account state |
|
|
70
87
|
|
|
@@ -77,6 +94,7 @@ Memoize objects with `useMemo` and functions with `useCallback`. In particular,
|
|
|
77
94
|
```tsx
|
|
78
95
|
import { useMemo } from "react";
|
|
79
96
|
import {
|
|
97
|
+
type ClientErrorFallbackProps,
|
|
80
98
|
Module,
|
|
81
99
|
Partners,
|
|
82
100
|
SpotProvider,
|
|
@@ -86,6 +104,21 @@ import {
|
|
|
86
104
|
type WalletInteractions,
|
|
87
105
|
} from "@orbs-network/spot-react";
|
|
88
106
|
|
|
107
|
+
function ClientErrorFallback({
|
|
108
|
+
error,
|
|
109
|
+
retry,
|
|
110
|
+
isRetrying,
|
|
111
|
+
}: ClientErrorFallbackProps) {
|
|
112
|
+
return (
|
|
113
|
+
<div role="alert">
|
|
114
|
+
<p>{getLocalizedErrorMessage(error)}</p>
|
|
115
|
+
<button type="button" disabled={isRetrying} onClick={retry}>
|
|
116
|
+
{isRetrying ? t("retrying") : t("retry")}
|
|
117
|
+
</button>
|
|
118
|
+
</div>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
89
122
|
function SpotOrderForm({ module }: { module: Module }) {
|
|
90
123
|
// Read these from the DEX's existing swap and wallet state.
|
|
91
124
|
const {
|
|
@@ -94,7 +127,6 @@ function SpotOrderForm({ module }: { module: Module }) {
|
|
|
94
127
|
inputCurrency,
|
|
95
128
|
outputCurrency,
|
|
96
129
|
inputBalance,
|
|
97
|
-
outputBalance,
|
|
98
130
|
typedInputAmount,
|
|
99
131
|
quotedInputAmount,
|
|
100
132
|
quoteOutputRaw,
|
|
@@ -105,7 +137,7 @@ function SpotOrderForm({ module }: { module: Module }) {
|
|
|
105
137
|
dexWallet,
|
|
106
138
|
} = useDexSpotAdapter();
|
|
107
139
|
|
|
108
|
-
const
|
|
140
|
+
const inputToken = useMemo<Token | undefined>(() => {
|
|
109
141
|
if (!inputCurrency) return undefined;
|
|
110
142
|
return {
|
|
111
143
|
address: inputCurrency.address,
|
|
@@ -115,7 +147,7 @@ function SpotOrderForm({ module }: { module: Module }) {
|
|
|
115
147
|
};
|
|
116
148
|
}, [inputCurrency]);
|
|
117
149
|
|
|
118
|
-
const
|
|
150
|
+
const outputToken = useMemo<Token | undefined>(() => {
|
|
119
151
|
if (!outputCurrency) return undefined;
|
|
120
152
|
return {
|
|
121
153
|
address: outputCurrency.address,
|
|
@@ -169,20 +201,20 @@ function SpotOrderForm({ module }: { module: Module }) {
|
|
|
169
201
|
module={module}
|
|
170
202
|
typedInputAmount={typedInputAmount}
|
|
171
203
|
priceProtection={3}
|
|
172
|
-
|
|
204
|
+
minTradeSizeUsd={5}
|
|
173
205
|
marketReferencePrice={marketReferencePrice}
|
|
174
206
|
walletInteractions={walletInteractions}
|
|
175
207
|
chainId={chainId}
|
|
176
208
|
account={account}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
dstUsd1Token={outputUsdPrice}
|
|
209
|
+
inputToken={inputToken}
|
|
210
|
+
outputToken={outputToken}
|
|
211
|
+
inputBalance={inputBalance?.toString()}
|
|
212
|
+
inputUsd1Token={inputUsdPrice}
|
|
213
|
+
outputUsd1Token={outputUsdPrice}
|
|
183
214
|
callbacks={callbacks}
|
|
215
|
+
clientErrorFallback={ClientErrorFallback}
|
|
184
216
|
appId="my-dex"
|
|
185
|
-
|
|
217
|
+
displayFeePercent={0.25}
|
|
186
218
|
>
|
|
187
219
|
<SpotFormContent />
|
|
188
220
|
</SpotProvider>
|
|
@@ -192,7 +224,7 @@ function SpotOrderForm({ module }: { module: Module }) {
|
|
|
192
224
|
|
|
193
225
|
`marketReferencePrice.value` is the DEX quote's raw destination amount for the current `typedInputAmount`, not a standalone per-token price. If the quote belongs to an older input or token pair, omit `value` and report `isLoading: true` until a current quote arrives.
|
|
194
226
|
|
|
195
|
-
Use the connected wallet chain as the
|
|
227
|
+
Use the connected wallet chain as the source of truth. When it is absent or unsupported, the provider does not initialize a client and submission stays disabled. The DEX submit area should show its connect-wallet or switch-network control.
|
|
196
228
|
|
|
197
229
|
### SpotProvider Props
|
|
198
230
|
|
|
@@ -202,25 +234,30 @@ Use the connected wallet chain as the UI source of truth. The provider falls bac
|
|
|
202
234
|
| `module` | `Module` | Yes | `TWAP`, `LIMIT`, `STOP_LOSS`, or `TAKE_PROFIT` |
|
|
203
235
|
| `typedInputAmount` | `string` | Yes | User-facing source amount from DEX state |
|
|
204
236
|
| `priceProtection` | `number` | Yes | Price Protection percentage; this is not swap slippage |
|
|
205
|
-
| `
|
|
237
|
+
| `minTradeSizeUsd` | `number` | Yes | Minimum individual trade size in USD |
|
|
206
238
|
| `marketReferencePrice` | `MarketReferencePrice` | Yes | `{ value?, isLoading?, noLiquidity? }` for the current DEX quote |
|
|
207
239
|
| `walletInteractions` | `WalletInteractions` | Yes | Five wallet methods implemented by the DEX |
|
|
208
240
|
| `chainId` | `number` | No | Connected wallet chain ID |
|
|
209
|
-
| `account` | `
|
|
210
|
-
| `appId` | `string` | No |
|
|
211
|
-
| `
|
|
212
|
-
| `
|
|
213
|
-
| `
|
|
214
|
-
| `
|
|
215
|
-
| `
|
|
216
|
-
| `dstUsd1Token` | `string` | No | USD value of one whole destination token |
|
|
217
|
-
| `enableQueryParams` | `boolean` | No | Sync supported form state to URL query parameters |
|
|
241
|
+
| `account` | `Address` | No | Connected wallet address |
|
|
242
|
+
| `appId` | `string` | No | Stable host-defined analytics identifier (for example the DEX slug) |
|
|
243
|
+
| `inputToken` | `Token` | No | Input token metadata |
|
|
244
|
+
| `outputToken` | `Token` | No | Output token metadata |
|
|
245
|
+
| `inputBalance` | `string` | No | Raw input-token balance |
|
|
246
|
+
| `inputUsd1Token` | `string` | No | USD value of one whole input token |
|
|
247
|
+
| `outputUsd1Token` | `string` | No | USD value of one whole output token |
|
|
218
248
|
| `callbacks` | `Callbacks` | No | Lifecycle and field-change callbacks |
|
|
219
|
-
| `
|
|
220
|
-
| `isDev` | `boolean` | No | Use development services/configuration |
|
|
249
|
+
| `displayFeePercent` | `number` | No | Display-only fee estimate percentage; does not collect or subtract fees |
|
|
221
250
|
| `supportLegacyOrders` | `boolean` | No | Include supported legacy v1 orders in history |
|
|
251
|
+
| `clientErrorFallback` | `ComponentType<ClientErrorFallbackProps>` | No | Host-rendered client initialization error UI with `error`, `retry`, and `isRetrying` |
|
|
252
|
+
| `errorFallback` | `ComponentType<SpotErrorFallbackProps>` | No | Host-rendered fallback for unexpected calculation or rendering errors |
|
|
253
|
+
|
|
254
|
+
Although the input balance and USD prices are optional in the TypeScript type, production integrations should pass them so validation, loading states, minimum trade size, and review details are correct.
|
|
222
255
|
|
|
223
|
-
|
|
256
|
+
`minTradeSizeUsd` must be a positive USD threshold approved for the partner;
|
|
257
|
+
there is intentionally no SDK default. `priceProtection` is a percentage, so
|
|
258
|
+
`3` means 3% (300 bps). `displayFeePercent` only populates `form.fees` for the
|
|
259
|
+
review UI. Protocol fee collection is configured separately by the partner and
|
|
260
|
+
backend.
|
|
224
261
|
|
|
225
262
|
## WalletInteractions
|
|
226
263
|
|
|
@@ -255,8 +292,8 @@ const walletInteractions: WalletInteractions = {
|
|
|
255
292
|
return txHash;
|
|
256
293
|
},
|
|
257
294
|
|
|
258
|
-
signOrder: ({
|
|
259
|
-
dexWallet.signTypedData({
|
|
295
|
+
signOrder: ({ signerAddress, typedData }) =>
|
|
296
|
+
dexWallet.signTypedData({ ...typedData, account: signerAddress }),
|
|
260
297
|
|
|
261
298
|
getAllowance: ({ tokenAddress, spenderAddress }) =>
|
|
262
299
|
dexWallet.getAllowance({ tokenAddress, spenderAddress }),
|
|
@@ -268,41 +305,66 @@ const walletInteractions: WalletInteractions = {
|
|
|
268
305
|
| `wrapNativeToken(amountWei)` | Wrap native currency, wait for confirmation, return tx hash |
|
|
269
306
|
| `approveToken({ tokenAddress, amount, spenderAddress })` | Approve the requested spender, wait for confirmation, return tx hash |
|
|
270
307
|
| `cancelOrder({ order, contractAddress, args, abi })` | Call `cancel` with the supplied ABI and args, wait for confirmation, return tx hash |
|
|
271
|
-
| `signOrder({
|
|
308
|
+
| `signOrder({ signerAddress, typedData })` | Adapt the framework-neutral EIP-712 request to the host wallet and return its original `0x`-prefixed signature |
|
|
272
309
|
| `getAllowance({ tokenAddress, spenderAddress })` | Return the connected account's raw allowance as a string |
|
|
273
310
|
|
|
274
311
|
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.
|
|
275
312
|
|
|
276
|
-
## Building
|
|
313
|
+
## Building with focused hooks
|
|
277
314
|
|
|
278
|
-
|
|
315
|
+
Import only the hooks each component needs. Leaf components should call the
|
|
316
|
+
smallest hook that provides what they render:
|
|
279
317
|
|
|
280
318
|
```tsx
|
|
281
|
-
|
|
319
|
+
import {
|
|
320
|
+
useExecution,
|
|
321
|
+
useLimitPrice,
|
|
322
|
+
useOrderForm,
|
|
323
|
+
useOrders,
|
|
324
|
+
useOutputAmount,
|
|
325
|
+
usePriceDisplay,
|
|
326
|
+
useTrades,
|
|
327
|
+
} from "@orbs-network/spot-react";
|
|
328
|
+
|
|
329
|
+
const calculatedForm = useOrderForm();
|
|
330
|
+
const tradesPanel = useTrades();
|
|
331
|
+
const limitPricePanel = useLimitPrice();
|
|
332
|
+
const outputAmount = useOutputAmount();
|
|
333
|
+
|
|
334
|
+
const execution = useExecution();
|
|
335
|
+
const history = useOrders();
|
|
282
336
|
```
|
|
283
337
|
|
|
338
|
+
`useOrderForm()` reads the calculated form shared by `OrderFormProvider`; it does not rerun the calculation. The other hooks expose smaller panel contracts for clearer component code. They currently share the same calculated-form context, so a form update can rerender every mounted form-panel hook.
|
|
339
|
+
|
|
284
340
|
| Value | Key returns |
|
|
285
341
|
| --- | --- |
|
|
286
|
-
| `
|
|
287
|
-
| `
|
|
288
|
-
| `
|
|
289
|
-
| `
|
|
290
|
-
| `
|
|
291
|
-
| `
|
|
292
|
-
| `
|
|
293
|
-
| `
|
|
294
|
-
| `
|
|
295
|
-
| `
|
|
296
|
-
| `
|
|
297
|
-
| `
|
|
298
|
-
| `
|
|
299
|
-
| `
|
|
300
|
-
| `
|
|
301
|
-
| `
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
342
|
+
| `useOutputAmount()` | `amount: { raw, ui, usd }`, `isLoading` |
|
|
343
|
+
| `useTrades()` | `totalTrades`, `maxTrades`, `onChange`, `error`, structured input/min-output/trigger-output amounts, input/output tokens |
|
|
344
|
+
| `useDuration()` | `duration`, input/unit callbacks, `milliseconds`, `error` |
|
|
345
|
+
| `useFillDelay()` | `fillDelay`, input/unit callbacks, `milliseconds`, `error` |
|
|
346
|
+
| `useLimitPrice()` | `price: { raw, ui, usd }`, canonical raw price, percentage, enable/toggle actions, tokens, loading/error state |
|
|
347
|
+
| `useTriggerPrice()` | `price: { raw, ui, usd }`, canonical raw price, percentage, structured output-per-trade amount, tokens, loading/error state |
|
|
348
|
+
| `usePriceDisplay()` | Inversion state/callback, actual and display-direction tokens, market-order state |
|
|
349
|
+
| `useDisclaimer()` | Disclaimer translation key or `undefined` |
|
|
350
|
+
| `useInputErrors()` | `{ type, args }` or `undefined` |
|
|
351
|
+
| `useSubmitButton()` | `disabled` and `loading` |
|
|
352
|
+
| `useExecution()` | Submission, status, steps, errors, resets, resolved tokens, and tx hashes |
|
|
353
|
+
| `useOrders()` | Provider-scoped categorized order lists and polling state |
|
|
354
|
+
| `useHistoryOrder()` | Display-ready values for one history order |
|
|
355
|
+
| `useCancelOrder()` | Per-order cancellation state and action |
|
|
356
|
+
| `useClient()` | Provider-scoped initialized client state |
|
|
357
|
+
| `useAmountUi()` | Raw-token amount formatting |
|
|
358
|
+
| `useExplorerLink()` | Chain explorer transaction URL |
|
|
359
|
+
| `useNetwork()` | Current or specified network metadata |
|
|
360
|
+
|
|
361
|
+
Child components should call the relevant focused hook themselves instead of receiving hook-returned panels through intermediate props. `useOrders()` activates order-history fetching while an orders consumer is mounted; form-only integrations do not fetch or poll history.
|
|
362
|
+
|
|
363
|
+
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.
|
|
364
|
+
|
|
365
|
+
### Trade-count validation behavior
|
|
366
|
+
|
|
367
|
+
An explicitly selected TWAP trade count persists when `typedInputAmount` 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.
|
|
306
368
|
|
|
307
369
|
### Panel Visibility
|
|
308
370
|
|
|
@@ -318,87 +380,106 @@ Use `TimeUnit.Minutes`, `TimeUnit.Hours`, and `TimeUnit.Days` for duration and f
|
|
|
318
380
|
|
|
319
381
|
### Display Amounts
|
|
320
382
|
|
|
321
|
-
|
|
383
|
+
Every calculated amount uses the same `{ raw, ui, usd }` shape. Convert `raw`
|
|
384
|
+
into the DEX's native amount type before display when possible:
|
|
322
385
|
|
|
323
386
|
```tsx
|
|
324
387
|
const amount = CurrencyAmount.fromRawAmount(
|
|
325
388
|
inputCurrency,
|
|
326
|
-
|
|
389
|
+
tradesPanel.inputAmountPerTrade.raw,
|
|
327
390
|
);
|
|
328
391
|
|
|
329
392
|
return `${amount.toSignificant()} ${inputCurrency.symbol}`;
|
|
330
393
|
```
|
|
331
394
|
|
|
332
|
-
Use
|
|
395
|
+
Use `.ui` for editable text inputs or when the DEX has no amount object. Do not
|
|
396
|
+
format `.raw` integer strings directly for user display.
|
|
333
397
|
|
|
334
398
|
## Submit and Progress Modal
|
|
335
399
|
|
|
336
|
-
Use `
|
|
400
|
+
Use `useExecution()` for execution state, `useOrderForm()` for review details, and `@orbs-network/swap-ui`'s `SwapFlow` for the creation/progress UI.
|
|
337
401
|
|
|
338
402
|
```tsx
|
|
339
|
-
import { SwapFlow } from "@orbs-network/swap-ui";
|
|
340
|
-
import {
|
|
403
|
+
import { SwapFlow, SwapStatus as SwapUiStatus } from "@orbs-network/swap-ui";
|
|
404
|
+
import {
|
|
405
|
+
ExecutionStatus,
|
|
406
|
+
useExecution,
|
|
407
|
+
useOrderForm,
|
|
408
|
+
} from "@orbs-network/spot-react";
|
|
341
409
|
|
|
342
410
|
function SpotOrderFlow() {
|
|
343
411
|
const {
|
|
344
412
|
status,
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
413
|
+
error,
|
|
414
|
+
inputToken,
|
|
415
|
+
outputToken,
|
|
416
|
+
currentStepIndex,
|
|
349
417
|
totalSteps,
|
|
350
|
-
} =
|
|
351
|
-
const form =
|
|
418
|
+
} = useExecution();
|
|
419
|
+
const form = useOrderForm();
|
|
420
|
+
const swapStatus =
|
|
421
|
+
status === ExecutionStatus.SUCCESS
|
|
422
|
+
? SwapUiStatus.SUCCESS
|
|
423
|
+
: status === ExecutionStatus.FAILED
|
|
424
|
+
? SwapUiStatus.FAILED
|
|
425
|
+
: status === ExecutionStatus.LOADING
|
|
426
|
+
? SwapUiStatus.LOADING
|
|
427
|
+
: undefined;
|
|
352
428
|
|
|
353
429
|
return (
|
|
354
430
|
<SwapFlow
|
|
355
|
-
inAmount={form.
|
|
356
|
-
outAmount={form.
|
|
357
|
-
inToken={{ symbol:
|
|
358
|
-
outToken={{ symbol:
|
|
359
|
-
swapStatus={
|
|
360
|
-
currentStepIndex={
|
|
431
|
+
inAmount={form.inputAmount.ui}
|
|
432
|
+
outAmount={form.outputAmount.ui}
|
|
433
|
+
inToken={{ symbol: inputToken?.symbol, logoUrl: inputToken?.logoUrl }}
|
|
434
|
+
outToken={{ symbol: outputToken?.symbol, logoUrl: outputToken?.logoUrl }}
|
|
435
|
+
swapStatus={swapStatus}
|
|
436
|
+
currentStepIndex={currentStepIndex}
|
|
361
437
|
totalSteps={totalSteps}
|
|
362
438
|
components={{
|
|
363
|
-
Main: <SwapFlow.Main inUsd={form.
|
|
439
|
+
Main: <SwapFlow.Main inUsd={form.inputAmount.usd} outUsd={form.outputAmount.usd} />,
|
|
364
440
|
Success: <SwapFlow.Success title="Order created" />,
|
|
365
|
-
Failed: <SwapFlow.Failed error={
|
|
441
|
+
Failed: <SwapFlow.Failed error={error?.message} />,
|
|
366
442
|
}}
|
|
367
443
|
/>
|
|
368
444
|
);
|
|
369
445
|
}
|
|
370
446
|
```
|
|
371
447
|
|
|
372
|
-
Wrap `SwapFlow` in the DEX's modal shell and skin it with DEX colors, surfaces, typography, token logos, and loaders. Once `
|
|
448
|
+
Wrap `SwapFlow` in the DEX's modal shell and skin it with DEX colors, surfaces, typography, token logos, and loaders. Once `useExecution().status` is set, hide the review details, confirm button, duplicate title, and secondary footer actions so the progress/success/failure content owns the modal.
|
|
373
449
|
|
|
374
450
|
### Execution State and Reset
|
|
375
451
|
|
|
376
|
-
`
|
|
452
|
+
`useExecution()` returns:
|
|
377
453
|
|
|
378
|
-
- `
|
|
379
|
-
- `
|
|
380
|
-
- `
|
|
381
|
-
- `
|
|
454
|
+
- `submitOrder`, `phase`, `status`, `isExecuting`, `isSuccess`, `isFailed`, `isRejected`, `isPreparingOrder`, and `canDismiss`;
|
|
455
|
+
- `currentStep`, `currentStepIndex`, `totalSteps`, and `executionSteps`;
|
|
456
|
+
- `error`, `inputToken`, `outputToken`, `chainId`, `wrapTxHash`, and `approvalTxHash`;
|
|
457
|
+
- `returnToOrderForm()` and `startNewOrder()`.
|
|
382
458
|
|
|
383
459
|
`spot-react` does not clear the DEX input. Do that only when a successful modal closes:
|
|
384
460
|
|
|
385
461
|
```tsx
|
|
386
|
-
const { status, isSuccess,
|
|
387
|
-
|
|
462
|
+
const { status, isSuccess, isExecuting, returnToOrderForm, startNewOrder } =
|
|
463
|
+
useExecution();
|
|
388
464
|
|
|
389
465
|
const onClose = useCallback(() => {
|
|
466
|
+
if (isExecuting) return;
|
|
390
467
|
setIsModalOpen(false);
|
|
391
468
|
|
|
392
469
|
if (isSuccess) {
|
|
393
470
|
setInputAmount("");
|
|
394
|
-
setTimeout(
|
|
471
|
+
setTimeout(startNewOrder, 500);
|
|
395
472
|
} else if (status) {
|
|
396
|
-
setTimeout(
|
|
473
|
+
setTimeout(returnToOrderForm, 500);
|
|
397
474
|
}
|
|
398
|
-
}, [
|
|
475
|
+
}, [isExecuting, isSuccess, returnToOrderForm, setInputAmount, startNewOrder, status]);
|
|
399
476
|
```
|
|
400
477
|
|
|
401
|
-
|
|
478
|
+
Neither reset action can clear an active execution: both return `false` while `isExecuting` is true. Keep the modal open during execution. `returnToOrderForm()` dismisses a failed or rejected execution while preserving the form and a completed native-token wrap for a safe retry. `startNewOrder()` resets Spot's internal form state and all retry metadata after a terminal execution; the host must still clear its own input amount. The short delay lets the close animation finish before state resets.
|
|
479
|
+
|
|
480
|
+
`phase` is the precise execution state: `idle → preparing → wrapping → approving → signing → submitting → success`, with `failed` and `rejected` terminal branches. `status` is the coarser `ExecutionStatus` value. Map it explicitly to the separately versioned `@orbs-network/swap-ui` `SwapStatus` enum as shown above. Each attempt has an internal identity, duplicate starts are rejected atomically, and stale async writes cannot replace a newer attempt. Host callbacks are observational: synchronous throws and rejected callback promises never change a wallet or API result.
|
|
481
|
+
|
|
482
|
+
Once submission begins, `useOrderForm()` exposes the frozen form and `useExecution()` exposes the frozen tokens and chain associated with that execution. The prepared order is frozen internally and reused through approval, wrapping, signing, and submission. Host quote, token, chain, or time updates cannot change the active order.
|
|
402
483
|
|
|
403
484
|
## Callbacks
|
|
404
485
|
|
|
@@ -428,7 +509,7 @@ const callbacks: Callbacks = {
|
|
|
428
509
|
onTriggerPricePercentChange: (percent) => {},
|
|
429
510
|
onDurationChange: (duration) => {},
|
|
430
511
|
onFillDelayChange: (fillDelay) => {},
|
|
431
|
-
|
|
512
|
+
onTradesChange: (trades) => {},
|
|
432
513
|
};
|
|
433
514
|
```
|
|
434
515
|
|
|
@@ -455,18 +536,31 @@ function CancelButton({ order }) {
|
|
|
455
536
|
}
|
|
456
537
|
```
|
|
457
538
|
|
|
458
|
-
|
|
539
|
+
Cancellation uses the initialized client for both v1 and v2 orders, keeping request construction on one path; `disabled` remains true while that client is loading or unavailable. History starts after client initialization because v2 requests need the configured exchange adapter. When `supportLegacyOrders` is enabled, v1 history is loaded once and retained while v2 history continues polling.
|
|
459
540
|
|
|
460
|
-
Order history is available from `
|
|
541
|
+
Order history is available directly from `useOrders()`. The query is enabled only while a component using this hook is mounted:
|
|
461
542
|
|
|
462
543
|
```tsx
|
|
463
|
-
const { orders, isLoading, isRefetching,
|
|
464
|
-
useSpot().orderHistoryPanel;
|
|
544
|
+
const { data: orders, isLoading, isRefetching, refetch } = useOrders();
|
|
465
545
|
|
|
466
|
-
// orders
|
|
546
|
+
// orders?.all, orders?.open, orders?.completed, orders?.cancelled, orders?.expired
|
|
467
547
|
```
|
|
468
548
|
|
|
469
|
-
|
|
549
|
+
Like `useClient()`, `data` is undefined before the first result. `refetch()`
|
|
550
|
+
resolves to the latest categorized orders or `undefined` when no request can be
|
|
551
|
+
made. Default the category you render to an empty array, for example
|
|
552
|
+
`const allOrders = orders?.all ?? []`.
|
|
553
|
+
|
|
554
|
+
Use `useHistoryOrder(order, inputToken?, outputToken?)` for display fields. For large histories, use the virtualization library already present in the DEX for both the orders and fills lists. Store the selected `order.historyKey`, then look up the current order from `orders?.all ?? []` by that key; do not store a stale copy of the order object. The key avoids collisions between numeric v1 IDs from different TWAP contracts; `order.id` remains the protocol ID used for display and cancellation.
|
|
555
|
+
|
|
556
|
+
Amounts returned by `useHistoryOrder` and its `fills` use `{ raw, ui }`, matching
|
|
557
|
+
the form model without fabricating unavailable historical USD values.
|
|
558
|
+
|
|
559
|
+
`OrderFilter` contains `ALL`, `OPEN`, `COMPLETED`, `CANCELLED`, and `EXPIRED`.
|
|
560
|
+
`OrderType` identifies the calculated module/mode combination: limit, TWAP
|
|
561
|
+
market/limit, stop-loss market/limit, or take-profit market/limit. Normalized
|
|
562
|
+
`Order` and `OrderFill` retain `src`/`dst` and `in`/`out` names because those are
|
|
563
|
+
protocol/history response models; form-facing APIs use `input`/`output`.
|
|
470
564
|
|
|
471
565
|
Keep history, details, and modal portals under `SpotProvider` context. Details should include execution summary, order info, fills, explorer/copy actions, and cancellation for open orders.
|
|
472
566
|
|
|
@@ -480,35 +574,46 @@ Disclaimer keys are:
|
|
|
480
574
|
- `marketOrderDisclaimer`
|
|
481
575
|
- `triggerMarketPriceDisclaimer`
|
|
482
576
|
|
|
483
|
-
Input errors have the shape `{ type, args }`. Resolve `type` through the DEX's i18n system and interpolate `args`, including values such as `
|
|
577
|
+
Input errors have the shape `{ type, args }`. Resolve `type` through the DEX's i18n system and interpolate `args`, including values such as `maxTrades`, `minTrades`, `minTradeSize`, `duration`, and `fillDelay`. Current duration and fill-delay arguments are human-readable; custom or older integrations should convert raw milliseconds before display.
|
|
484
578
|
|
|
485
|
-
##
|
|
579
|
+
## React helper APIs
|
|
486
580
|
|
|
487
581
|
```tsx
|
|
488
582
|
import {
|
|
489
|
-
useAmountUi,
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
useSignOrder, // low-level signing hook
|
|
494
|
-
useSubmitOrder, // low-level submission mutation
|
|
495
|
-
useSwapExecution, // low-level execution state
|
|
583
|
+
useAmountUi,
|
|
584
|
+
useClient,
|
|
585
|
+
useExplorerLink,
|
|
586
|
+
useNetwork,
|
|
496
587
|
} from "@orbs-network/spot-react";
|
|
588
|
+
|
|
589
|
+
useAmountUi(decimals, rawAmount);
|
|
590
|
+
useClient();
|
|
591
|
+
useExplorerLink(txHash, chainId);
|
|
592
|
+
useNetwork(chainId);
|
|
497
593
|
```
|
|
498
594
|
|
|
499
|
-
|
|
595
|
+
Submit through `useExecution()`. Internal mutations and execution-store hooks
|
|
596
|
+
are deliberately not exported, keeping one supported workflow and one error
|
|
597
|
+
contract. `useClient()` must be called under `SpotProvider`; every caller shares
|
|
598
|
+
the same partner/chain query, and RePermit configuration is available as
|
|
599
|
+
`client?.rePermitData`. Initialization recovery belongs to
|
|
600
|
+
`clientErrorFallback`, which receives the query error and retry action.
|
|
500
601
|
|
|
501
602
|
Public utilities and constants include:
|
|
502
603
|
|
|
503
604
|
```tsx
|
|
504
605
|
import {
|
|
505
|
-
getMinChunkSizeUsd,
|
|
506
606
|
getNetwork,
|
|
507
607
|
getOrderExecutionRate,
|
|
508
608
|
getOrderFillDelayMillis,
|
|
509
609
|
getOrderLimitPriceRate,
|
|
510
610
|
getPartnerChains,
|
|
511
611
|
getPartners,
|
|
612
|
+
getTwapConfig,
|
|
613
|
+
calculateOrderForm,
|
|
614
|
+
toAmountWei,
|
|
615
|
+
toAmountUI,
|
|
616
|
+
invertPriceInput,
|
|
512
617
|
getTriggerPriceRate,
|
|
513
618
|
eqIgnoreCase,
|
|
514
619
|
isNativeAddress,
|
|
@@ -522,7 +627,11 @@ import {
|
|
|
522
627
|
} from "@orbs-network/spot-react";
|
|
523
628
|
```
|
|
524
629
|
|
|
525
|
-
|
|
630
|
+
React integrations can import the single `calculateOrderForm` entry point and
|
|
631
|
+
its public calculated types directly from `@orbs-network/spot-react`. Non-React
|
|
632
|
+
integrations should import them from `@orbs-network/spot-ui`. Lower-level
|
|
633
|
+
calculators remain internal entry points; do not import from `dist/*` or
|
|
634
|
+
package-internal source paths.
|
|
526
635
|
|
|
527
636
|
## Integration Checklist
|
|
528
637
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import { ClientErrorFallbackProps } from '../types';
|
|
3
|
+
export declare const ClientErrorNotice: ({ children, fallback: ClientErrorFallback, }: {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
fallback?: ComponentType<ClientErrorFallbackProps>;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=client-error-notice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-error-notice.d.ts","sourceRoot":"","sources":["../../../../src/context/client-error-notice.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAsBzD,eAAO,MAAM,iBAAiB,GAAI,8CAG/B;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,aAAa,CAAC,wBAAwB,CAAC,CAAC;CACpD,4CA8BA,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import { SpotErrorFallbackProps } from '../types';
|
|
3
|
+
export declare const SpotErrorBoundary: ({ children, fallback: ErrorFallback, }: {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
fallback?: ComponentType<SpotErrorFallbackProps>;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=error-boundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-boundary.d.ts","sourceRoot":"","sources":["../../../../src/context/error-boundary.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAavD,eAAO,MAAM,iBAAiB,GAAI,wCAG/B;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC;CAClD,4CAIA,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CalculatedOrderForm } from '@orbs-network/spot-ui';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export declare const OrderFormProvider: ({ children }: {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const useOrderForm: () => CalculatedOrderForm;
|
|
7
|
+
//# sourceMappingURL=order-form-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-form-context.d.ts","sourceRoot":"","sources":["../../../../src/context/order-form-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAM3E,eAAO,MAAM,iBAAiB,GAAI,cAAc;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,4CA+GtE,CAAC;AAEF,eAAO,MAAM,YAAY,QAAO,mBAM/B,CAAC"}
|