@orbs-network/spot-react 1.1.21 → 1.1.22
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
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
# @orbs-network/spot-react
|
|
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/).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @orbs-network/spot-react
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Peer Dependencies
|
|
12
|
+
|
|
13
|
+
These must be installed in your application:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @tanstack/react-query bignumber.js react-error-boundary viem zustand react react-dom
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
| Package | Version |
|
|
20
|
+
| ---------------------- | ---------- |
|
|
21
|
+
| `@tanstack/react-query`| `^5.90.12` |
|
|
22
|
+
| `bignumber.js` | `^9.3.1` |
|
|
23
|
+
| `react-error-boundary` | `^6.0.0` |
|
|
24
|
+
| `viem` | `^2.43.3` |
|
|
25
|
+
| `zustand` | `^5.0.9` |
|
|
26
|
+
| `react` | `^18 \|\| ^19` |
|
|
27
|
+
| `react-dom` | `^18 \|\| ^19` |
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import {
|
|
33
|
+
SpotProvider,
|
|
34
|
+
useSpot,
|
|
35
|
+
Module,
|
|
36
|
+
Partners,
|
|
37
|
+
} from "@orbs-network/spot-react";
|
|
38
|
+
|
|
39
|
+
function App() {
|
|
40
|
+
return (
|
|
41
|
+
<SpotProvider
|
|
42
|
+
chainId={137} // Polygon
|
|
43
|
+
provider={walletProvider} // EIP-1193 provider
|
|
44
|
+
account={walletAddress} // Connected wallet address
|
|
45
|
+
partner={Partners.Quick} // DEX partner
|
|
46
|
+
module={Module.TWAP} // Order type
|
|
47
|
+
typedInputAmount={inputAmount} // User-typed amount (string)
|
|
48
|
+
priceProtection={0.5} // Slippage tolerance %
|
|
49
|
+
minChunkSizeUsd={5} // Min chunk size in USD
|
|
50
|
+
srcToken={srcToken} // { address, symbol, decimals, logoUrl }
|
|
51
|
+
dstToken={dstToken}
|
|
52
|
+
srcBalance={srcBalanceWei} // Balance in wei (string)
|
|
53
|
+
dstBalance={dstBalanceWei}
|
|
54
|
+
srcUsd1Token={srcUsdPrice} // USD price of 1 token (string)
|
|
55
|
+
dstUsd1Token={dstUsdPrice}
|
|
56
|
+
marketReferencePrice={marketPrice} // { value?: string, isLoading?: boolean }
|
|
57
|
+
callbacks={callbacks} // Lifecycle event handlers
|
|
58
|
+
fees={0.25} // Fee percentage
|
|
59
|
+
>
|
|
60
|
+
<SwapForm />
|
|
61
|
+
</SpotProvider>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## SpotProvider Props
|
|
67
|
+
|
|
68
|
+
| Prop | Type | Required | Description |
|
|
69
|
+
| --- | --- | --- | --- |
|
|
70
|
+
| `partner` | `Partners` | Yes | DEX partner enum |
|
|
71
|
+
| `module` | `Module` | Yes | `TWAP`, `LIMIT`, `STOP_LOSS`, or `TAKE_PROFIT` |
|
|
72
|
+
| `typedInputAmount` | `string` | Yes | User-typed source amount |
|
|
73
|
+
| `priceProtection` | `number` | Yes | Slippage tolerance percentage |
|
|
74
|
+
| `minChunkSizeUsd` | `number` | Yes | Minimum trade chunk size in USD |
|
|
75
|
+
| `marketReferencePrice` | `MarketReferencePrice` | Yes | `{ value?: string, isLoading?: boolean, noLiquidity?: boolean }` |
|
|
76
|
+
| `chainId` | `number` | No | Connected chain ID |
|
|
77
|
+
| `provider` | `Provider` | No | EIP-1193 wallet provider |
|
|
78
|
+
| `account` | `string` | No | Connected wallet address |
|
|
79
|
+
| `srcToken` | `Token` | No | Source token |
|
|
80
|
+
| `dstToken` | `Token` | No | Destination token |
|
|
81
|
+
| `srcBalance` | `string` | No | Source balance in wei |
|
|
82
|
+
| `dstBalance` | `string` | No | Destination balance in wei |
|
|
83
|
+
| `srcUsd1Token` | `string` | No | USD price of 1 source token |
|
|
84
|
+
| `dstUsd1Token` | `string` | No | USD price of 1 destination token |
|
|
85
|
+
| `callbacks` | `Callbacks` | No | Lifecycle event handlers |
|
|
86
|
+
| `fees` | `number` | No | Fee percentage |
|
|
87
|
+
| `isDev` | `boolean` | No | Enable dev mode |
|
|
88
|
+
| `overrides` | `Overrides` | No | Custom wrap/approve/order handlers |
|
|
89
|
+
|
|
90
|
+
## useSpot() Hook
|
|
91
|
+
|
|
92
|
+
The main hook returns all data and controls for building the UI:
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
const spot = useSpot();
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Returned panels
|
|
99
|
+
|
|
100
|
+
| Panel | Description |
|
|
101
|
+
| --- | --- |
|
|
102
|
+
| `spot.dstTokenPanel` | `{ value, isLoading }` — estimated output amount |
|
|
103
|
+
| `spot.tradesAmountPanel` | Total trades input, per-trade amounts, validation |
|
|
104
|
+
| `spot.durationPanel` | Order expiry duration input |
|
|
105
|
+
| `spot.fillDelayPanel` | Trade interval input |
|
|
106
|
+
| `spot.limitPricePanel` | Limit price input with percentage, toggle, reset |
|
|
107
|
+
| `spot.triggerPricePanel` | Trigger price for stop-loss / take-profit |
|
|
108
|
+
| `spot.pricePanel` | Market price display, inversion toggle |
|
|
109
|
+
| `spot.disclaimerPanel` | Disclaimer key string (or `undefined`) |
|
|
110
|
+
| `spot.inputError` | Validation error `{ type, args }` (or `undefined`) |
|
|
111
|
+
| `spot.submitOrderButton` | `{ disabled, loading }` |
|
|
112
|
+
| `spot.orderExecutionPanel` | Full submission lifecycle (see below) |
|
|
113
|
+
| `spot.orderHistoryPanel` | `{ orders: { all: Order[] } }` |
|
|
114
|
+
| `spot.derivedFormData` | Computed values: amounts, prices, deadline, fees |
|
|
115
|
+
| `spot.supportedChains` | Partner's supported chain IDs |
|
|
116
|
+
| `spot.module` | Current `Module` enum |
|
|
117
|
+
| `spot.mutations` | `{ cancelOrder, signOrder, submitOrder }` |
|
|
118
|
+
|
|
119
|
+
### Order Execution Panel
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
const {
|
|
123
|
+
onSubmit, // Trigger order creation
|
|
124
|
+
status, // SwapStatus: LOADING | SUCCESS | FAILED
|
|
125
|
+
step, // Current step: WRAP | APPROVE | CREATE
|
|
126
|
+
stepIndex, // Current step index (0-based)
|
|
127
|
+
totalSteps, // Total number of steps
|
|
128
|
+
parsedError, // { code, message } on failure
|
|
129
|
+
onSwapSuccess, // Call when user acknowledges success
|
|
130
|
+
confirmButtonLoading, // Loading state for confirm button
|
|
131
|
+
srcToken, // Resolved source token
|
|
132
|
+
dstToken, // Resolved destination token
|
|
133
|
+
wrapTxHash, // Wrap transaction hash
|
|
134
|
+
approveTxHash, // Approve transaction hash
|
|
135
|
+
} = useSpot().orderExecutionPanel;
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Callbacks
|
|
139
|
+
|
|
140
|
+
Pass lifecycle callbacks to `SpotProvider` for wallet notifications:
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
const callbacks: Callbacks = {
|
|
144
|
+
// Token wrapping
|
|
145
|
+
onWrapRequest: () => {},
|
|
146
|
+
onWrapSuccess: ({ txHash, explorerUrl, amount }) => {},
|
|
147
|
+
|
|
148
|
+
// Token approval
|
|
149
|
+
onApproveRequest: () => {},
|
|
150
|
+
onApproveSuccess: ({ txHash, explorerUrl, token, amount }) => {},
|
|
151
|
+
|
|
152
|
+
// Order lifecycle
|
|
153
|
+
onSignOrderRequest: () => {},
|
|
154
|
+
onSignOrderSuccess: (signature) => {},
|
|
155
|
+
onSignOrderError: (error) => {},
|
|
156
|
+
onOrderCreated: (order) => {},
|
|
157
|
+
onOrderFilled: (order) => {},
|
|
158
|
+
|
|
159
|
+
// Errors
|
|
160
|
+
onSubmitOrderFailed: ({ code, message }) => {},
|
|
161
|
+
onSubmitOrderRejected: () => {},
|
|
162
|
+
|
|
163
|
+
// Order management
|
|
164
|
+
onCancelOrderRequest: (orders) => {},
|
|
165
|
+
onCancelOrderSuccess: ({ orders, txHash, explorerUrl }) => {},
|
|
166
|
+
onCancelOrderFailed: (error) => {},
|
|
167
|
+
|
|
168
|
+
// Progress (good place to refetch balances)
|
|
169
|
+
onOrdersProgressUpdate: (orders) => {},
|
|
170
|
+
|
|
171
|
+
// Clipboard
|
|
172
|
+
onCopy: () => {},
|
|
173
|
+
|
|
174
|
+
// State change callbacks
|
|
175
|
+
onLimitPriceChange: (price) => {},
|
|
176
|
+
onTriggerPriceChange: (price) => {},
|
|
177
|
+
onDurationChange: (duration) => {},
|
|
178
|
+
onFillDelayChange: (fillDelay) => {},
|
|
179
|
+
onChunksChange: (chunks) => {},
|
|
180
|
+
};
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Translations / i18n
|
|
184
|
+
|
|
185
|
+
The SDK returns string keys for user-facing messages. You should resolve these through your own i18n system.
|
|
186
|
+
|
|
187
|
+
### Disclaimer keys
|
|
188
|
+
|
|
189
|
+
`useSpot().disclaimerPanel` returns one of:
|
|
190
|
+
- `"limitOrderDisclaimer"` — shown for limit and TWAP-limit orders
|
|
191
|
+
- `"marketOrderDisclaimer"` — shown for market orders
|
|
192
|
+
- `"triggerMarketPriceDisclaimer"` — shown for stop-loss at market price
|
|
193
|
+
|
|
194
|
+
### Input error keys
|
|
195
|
+
|
|
196
|
+
`useSpot().inputError` returns `{ type, args }` where `type` is a key like:
|
|
197
|
+
- `"enterAmount"`, `"insufficientFunds"`, `"emptyLimitPrice"`, `"emptyTriggerPrice"`
|
|
198
|
+
- `"maxChunksError"` (args: `{ maxChunks }`)
|
|
199
|
+
- `"minChunksError"` (args: `{ minChunks }`)
|
|
200
|
+
- `"minTradeSizeError"` (args: `{ minTradeSize }`)
|
|
201
|
+
- `"minDurationError"` / `"maxDurationError"` (args: `{ duration }`)
|
|
202
|
+
- `"minFillDelayError"` / `"maxFillDelayError"` (args: `{ fillDelay }`)
|
|
203
|
+
- `"noLiquidity"`
|
|
204
|
+
|
|
205
|
+
See `integration-example.tsx` for a full working reference.
|
|
206
|
+
|
|
207
|
+
## Order Types
|
|
208
|
+
|
|
209
|
+
| Module | Description |
|
|
210
|
+
| --- | --- |
|
|
211
|
+
| `Module.TWAP` | Time-Weighted Average Price — splits order into multiple trades over time |
|
|
212
|
+
| `Module.LIMIT` | Limit order — executes at specified price or better |
|
|
213
|
+
| `Module.STOP_LOSS` | Stop-loss — triggers when price drops to threshold |
|
|
214
|
+
| `Module.TAKE_PROFIT` | Take-profit — triggers when price rises to threshold |
|
|
215
|
+
|
|
216
|
+
### Panel visibility by module
|
|
217
|
+
|
|
218
|
+
| Panel | TWAP | LIMIT | STOP_LOSS | TAKE_PROFIT |
|
|
219
|
+
| --- | --- | --- | --- | --- |
|
|
220
|
+
| Trades amount | Yes | — | — | — |
|
|
221
|
+
| Fill delay | Yes | — | — | — |
|
|
222
|
+
| Duration | — | Yes | Yes | Yes |
|
|
223
|
+
| Limit price | Yes | Yes | Yes | Yes |
|
|
224
|
+
| Trigger price | — | — | Yes | Yes |
|
|
225
|
+
|
|
226
|
+
## Helper Hooks
|
|
227
|
+
|
|
228
|
+
```tsx
|
|
229
|
+
import {
|
|
230
|
+
useExplorerLink, // (txHash?: string) => explorer URL
|
|
231
|
+
useNetwork, // () => network info (name, native, wToken, explorer)
|
|
232
|
+
useAmountUi, // (amount: string, decimals: number) => formatted amount
|
|
233
|
+
} from "@orbs-network/spot-react";
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Utility Functions
|
|
237
|
+
|
|
238
|
+
```tsx
|
|
239
|
+
import {
|
|
240
|
+
getPartners, // () => all registered partners
|
|
241
|
+
getPartnerChains, // (partner) => supported chain IDs
|
|
242
|
+
getNetwork, // (chainId) => network config
|
|
243
|
+
isNativeAddress, // (address) => boolean
|
|
244
|
+
eqIgnoreCase, // (a, b) => case-insensitive address comparison
|
|
245
|
+
getConfig, // (partner, chainId) => SpotConfig
|
|
246
|
+
} from "@orbs-network/spot-react";
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## Overrides
|
|
250
|
+
|
|
251
|
+
For custom wallet interactions, pass `overrides` to `SpotProvider`:
|
|
252
|
+
|
|
253
|
+
```tsx
|
|
254
|
+
<SpotProvider
|
|
255
|
+
overrides={{
|
|
256
|
+
wrap: async (amountWei) => txHash,
|
|
257
|
+
approveOrder: async ({ tokenAddress, amount, spenderAddress }) => txHash,
|
|
258
|
+
createOrder: async ({ contractAddress, abi, functionName, args }) => txHash,
|
|
259
|
+
getAllowance: async ({ tokenAddress, spenderAddress }) => allowanceString,
|
|
260
|
+
state: {
|
|
261
|
+
isMarketOrder: false,
|
|
262
|
+
chunks: 10,
|
|
263
|
+
limitPrice: "1.5",
|
|
264
|
+
triggerPrice: "1.2",
|
|
265
|
+
fillDelay: { value: 5, unit: TimeUnit.Minutes },
|
|
266
|
+
duration: { value: 1, unit: TimeUnit.Days },
|
|
267
|
+
},
|
|
268
|
+
}}
|
|
269
|
+
// ...other props
|
|
270
|
+
/>
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Constants
|
|
274
|
+
|
|
275
|
+
```tsx
|
|
276
|
+
import {
|
|
277
|
+
SPOT_VERSION, // SDK version identifier
|
|
278
|
+
DISCLAIMER_URL, // Orbs disclaimer page
|
|
279
|
+
ORBS_TWAP_FAQ_URL, // TWAP FAQ page
|
|
280
|
+
ORBS_SLTP_FAQ_URL, // Stop-Loss/Take-Profit FAQ page
|
|
281
|
+
ORBS_LOGO, // Orbs logo URL
|
|
282
|
+
ORBS_WEBSITE_URL, // Orbs website
|
|
283
|
+
networks, // All supported network configs
|
|
284
|
+
} from "@orbs-network/spot-react";
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## License
|
|
288
|
+
|
|
289
|
+
MIT
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as p, g as m, s as w, d as k, i as b, l as L, a as O, c as E, b as x, e as R, H as y, f as M } from "./index-
|
|
1
|
+
import { B as p, g as m, s as w, d as k, i as b, l as L, a as O, c as E, b as x, e as R, H as y, f as M } from "./index-Ccepzg_Y.js";
|
|
2
2
|
class S extends p {
|
|
3
3
|
constructor({ callbackSelector: r, cause: a, data: n, extraData: i, sender: f, urls: t }) {
|
|
4
4
|
var o;
|
|
@@ -3246,7 +3246,7 @@ const Ib = async ({
|
|
|
3246
3246
|
}) => (await Promise.all([
|
|
3247
3247
|
s ? Ib({ chainId: n, signal: e, page: t, limit: r, filters: { accounts: [a], configs: s.twapConfig ? [s.twapConfig] : [] } }) : Promise.resolve([]),
|
|
3248
3248
|
kb({ chainId: n, signal: e, account: a, exchange: s == null ? void 0 : s.adapter, isDev: o })
|
|
3249
|
-
]).then(([l, d]) => [...l, ...d])).sort((l, d) => d.createdAt - l.createdAt), Mb = "1.1.
|
|
3249
|
+
]).then(([l, d]) => [...l, ...d])).sort((l, d) => d.createdAt - l.createdAt), Mb = "1.1.22", Rb = {
|
|
3250
3250
|
version: Mb
|
|
3251
3251
|
}, od = (e) => {
|
|
3252
3252
|
let t;
|
|
@@ -9499,7 +9499,7 @@ async function yi(e, t) {
|
|
|
9499
9499
|
});
|
|
9500
9500
|
return Q === "0x" ? { data: void 0 } : { data: Q };
|
|
9501
9501
|
} catch (F) {
|
|
9502
|
-
const P = H5(F), { offchainLookup: M, offchainLookupSignature: L } = await import("./ccip-
|
|
9502
|
+
const P = H5(F), { offchainLookup: M, offchainLookupSignature: L } = await import("./ccip-CcfZKtLa.js");
|
|
9503
9503
|
if (e.ccipRead !== !1 && (P == null ? void 0 : P.slice(0, 10)) === L && E)
|
|
9504
9504
|
return { data: await M(e, { data: P, to: E }) };
|
|
9505
9505
|
throw C && (P == null ? void 0 : P.slice(0, 10)) === "0x101bb98d" ? new y2({ factory: f }) : lu(F, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
"name": "@orbs-network/spot-react",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.22",
|
|
4
4
|
"description": "Spot React Components - React components for Spot SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/spot-react.umd.cjs",
|
|
@@ -35,11 +35,11 @@ declare const _default: {
|
|
|
35
35
|
"react": "^18.0.0 || ^19.0.0",
|
|
36
36
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
37
37
|
"react-error-boundary": "^6.0.0",
|
|
38
|
-
"viem": "^2.43.3",
|
|
39
38
|
"zustand": "^5.0.9"
|
|
40
39
|
},
|
|
41
40
|
"dependencies": {
|
|
42
|
-
"@orbs-network/spot-ui": "workspace:*"
|
|
41
|
+
"@orbs-network/spot-ui": "workspace:*",
|
|
42
|
+
"viem": "^2.43.3"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/react": "^19.0.2",
|
package/dist/spot-react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as e, Z as r, V as t, U as i, I as o, M as n, N as u, L as d, K as O, Q as l, o as R, O as S, p, P as T, W as _, G as g, S as E, _ as A, Y as I, X as P, T as m, v as U, a3 as L, A as B, q as y, a9 as W, t as k, x as w, C as x, E as C, D, a6 as M, y as c, r as h, F, z as N, a2 as v, a4 as Q, a5 as b, R as f, a1 as j, a8 as q, a7 as z, w as G, a0 as H, $ as V, j as J, h as K, k as X, m as Y, u as Z, n as $ } from "./index-
|
|
1
|
+
import { J as e, Z as r, V as t, U as i, I as o, M as n, N as u, L as d, K as O, Q as l, o as R, O as S, p, P as T, W as _, G as g, S as E, _ as A, Y as I, X as P, T as m, v as U, a3 as L, A as B, q as y, a9 as W, t as k, x as w, C as x, E as C, D, a6 as M, y as c, r as h, F, z as N, a2 as v, a4 as Q, a5 as b, R as f, a1 as j, a8 as q, a7 as z, w as G, a0 as H, $ as V, j as J, h as K, k as X, m as Y, u as Z, n as $ } from "./index-Ccepzg_Y.js";
|
|
2
2
|
export {
|
|
3
3
|
e as DISCLAIMER_URL,
|
|
4
4
|
r as Disclaimer,
|
package/dist/spot-react.umd.cjs
CHANGED
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
dollarValueOut
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
`,extractResults:p=>{var f;return(((f=p.data)==null?void 0:f.orderFilleds)||[]).map(m=>({...m,timestamp:new Date(m.timestamp).getTime()}))}})};class mb extends Error{constructor(){super("No graph endpoint found"),this.name="NoGraphEndpointError"}}const hb=async({chainId:e,signal:t,page:n,limit:r,filters:s})=>{try{const a=await db({chainId:e,signal:t,page:n,limit:r,filters:s}),[o,i]=await Promise.all([fb({chainId:e,orders:a,signal:t}),pb({chainId:e,orders:a,signal:t})]),c=a.map(d=>{const p=o==null?void 0:o.filter(f=>f.TWAP_id===Number(d.Contract_id)&&Vn(f.exchange,d.exchange)&&Vn(f.twapAddress,d.twapAddress));return lb(d,e,p,bb(d,p||[],i))}).sort((d,p)=>p.createdAt-d.createdAt),l=new Set;return c.filter(d=>l.has(d.id)?!1:(l.add(d.id),!0))}catch{return[]}},bb=(e,t,n)=>{var i;const r=(i=n==null?void 0:n.find(c=>c.twapId===e.Contract_id.toString()&&Vn(c.twapAddress,e.twapAddress)))==null?void 0:i.status,a=vd(t).reduce((c,l)=>c.plus(l.inAmount),new z(0)).toFixed(),o=Td(e.ask_srcAmount,a);return yb(o,e.ask_deadline*1e3,r)},Td=(e,t)=>{if(!t||!e)return 0;const n=z(t).dividedBy(e).toNumber();return n>=.99?100:n<=0?0:Number((n*100).toFixed(2))},yb=(e,t,n)=>e===100?Re.Completed:n==="CANCELLED"?Re.Cancelled:n==="COMPLETED"?Re.Completed:t>Date.now()?Re.Open:Re.Expired,xb=async({signal:e,page:t,chainId:n,limit:r,config:s,account:a,isDev:o=!1})=>(await Promise.all([s?hb({chainId:n,signal:e,page:t,limit:r,filters:{accounts:[a],configs:s.twapConfig?[s.twapConfig]:[]}}):Promise.resolve([]),ib({chainId:n,signal:e,account:a,exchange:s==null?void 0:s.adapter,isDev:o})]).then(([l,d])=>[...l,...d])).sort((l,d)=>d.createdAt-l.createdAt),gb={version:"1.1.
|
|
64
|
+
`,extractResults:p=>{var f;return(((f=p.data)==null?void 0:f.orderFilleds)||[]).map(m=>({...m,timestamp:new Date(m.timestamp).getTime()}))}})};class mb extends Error{constructor(){super("No graph endpoint found"),this.name="NoGraphEndpointError"}}const hb=async({chainId:e,signal:t,page:n,limit:r,filters:s})=>{try{const a=await db({chainId:e,signal:t,page:n,limit:r,filters:s}),[o,i]=await Promise.all([fb({chainId:e,orders:a,signal:t}),pb({chainId:e,orders:a,signal:t})]),c=a.map(d=>{const p=o==null?void 0:o.filter(f=>f.TWAP_id===Number(d.Contract_id)&&Vn(f.exchange,d.exchange)&&Vn(f.twapAddress,d.twapAddress));return lb(d,e,p,bb(d,p||[],i))}).sort((d,p)=>p.createdAt-d.createdAt),l=new Set;return c.filter(d=>l.has(d.id)?!1:(l.add(d.id),!0))}catch{return[]}},bb=(e,t,n)=>{var i;const r=(i=n==null?void 0:n.find(c=>c.twapId===e.Contract_id.toString()&&Vn(c.twapAddress,e.twapAddress)))==null?void 0:i.status,a=vd(t).reduce((c,l)=>c.plus(l.inAmount),new z(0)).toFixed(),o=Td(e.ask_srcAmount,a);return yb(o,e.ask_deadline*1e3,r)},Td=(e,t)=>{if(!t||!e)return 0;const n=z(t).dividedBy(e).toNumber();return n>=.99?100:n<=0?0:Number((n*100).toFixed(2))},yb=(e,t,n)=>e===100?Re.Completed:n==="CANCELLED"?Re.Cancelled:n==="COMPLETED"?Re.Completed:t>Date.now()?Re.Open:Re.Expired,xb=async({signal:e,page:t,chainId:n,limit:r,config:s,account:a,isDev:o=!1})=>(await Promise.all([s?hb({chainId:n,signal:e,page:t,limit:r,filters:{accounts:[a],configs:s.twapConfig?[s.twapConfig]:[]}}):Promise.resolve([]),ib({chainId:n,signal:e,account:a,exchange:s==null?void 0:s.adapter,isDev:o})]).then(([l,d])=>[...l,...d])).sort((l,d)=>d.createdAt-l.createdAt),gb={version:"1.1.22"},Sd=e=>{let t;const n=new Set,r=(l,d)=>{const p=typeof l=="function"?l(t):l;if(!Object.is(p,t)){const f=t;t=d??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(m=>m(t,f))}},s=()=>t,i={setState:r,getState:s,getInitialState:()=>c,subscribe:l=>(n.add(l),()=>n.delete(l))},c=t=e(r,s,i);return i},wb=(e=>e?Sd(e):Sd),Eb=e=>e;function kb(e,t=Eb){const n=L.useSyncExternalStore(e.subscribe,L.useCallback(()=>t(e.getState()),[e,t]),L.useCallback(()=>t(e.getInitialState()),[e,t]));return L.useDebugValue(n),n}const Pd=e=>{const t=wb(e),n=r=>kb(t,r);return Object.assign(n,t),n},Cb=(e=>e?Pd(e):Pd),Ja={},Bd={currentTime:Date.now(),swapExecutions:[Ja],swapExecutionIndex:0},re=Cb((e,t)=>({state:Bd,updateState:n=>e(r=>({state:{...r.state,...n}})),updateSwapExecutionAtIndex:(n,r)=>e(s=>{const a=[...s.state.swapExecutions];return a[n]={...a[n]??Ja,...r},{state:{...s.state,swapExecutions:a}}}),resetSwapExecutionAtIndex:()=>e(n=>{const r=[...n.state.swapExecutions];return r[n.state.swapExecutionIndex]=Ja,{state:{...n.state,swapExecutions:r}}}),resetState:()=>{const n=t().state;e({state:{...Bd,currentTime:Date.now(),isMarketOrder:n.isMarketOrder,swapExecutions:[...n.swapExecutions,Ja],swapExecutionIndex:n.swapExecutionIndex+1}})}}));var vt=(e=>(e[e.LOADING=1]="LOADING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILED=3]="FAILED",e))(vt||{}),Ts=(e=>(e.TRIGGER_MARKET_PRICE="triggerMarketPriceDisclaimer",e.MARKET_PRICE="marketOrderDisclaimer",e.LIMIT_PRICE="limitOrderDisclaimer",e))(Ts||{}),gn=(e=>(e.WRAP="wrap",e.APPROVE="approve",e.CREATE="create",e))(gn||{});const vb="1.2.3";let Qe=class Ku extends Error{constructor(t,n={}){var o;const r=n.cause instanceof Ku?n.cause.details:(o=n.cause)!=null&&o.message?n.cause.message:n.details,s=n.cause instanceof Ku&&n.cause.docsPath||n.docsPath,a=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: https://abitype.dev${s}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${vb}`].join(`
|
|
65
65
|
`);super(a),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.shortMessage=t}};function Qt(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const Ud=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Id=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Fd=/^\(.+?\).*?$/,Od=/^tuple(?<array>(\[(\d*)\])*)$/;function ec(e){let t=e.type;if(Od.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let s=0;s<n;s++){const a=e.components[s];t+=ec(a),s<n-1&&(t+=", ")}const r=Qt(Od,e.type);return t+=`)${(r==null?void 0:r.array)||""}`,ec({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Fr(e){let t="";const n=e.length;for(let r=0;r<n;r++){const s=e[r];t+=ec(s),r!==n-1&&(t+=", ")}return t}function Ya(e){var t;return e.type==="function"?`function ${e.name}(${Fr(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${Fr(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Fr(e.inputs)})`:e.type==="error"?`error ${e.name}(${Fr(e.inputs)})`:e.type==="constructor"?`constructor(${Fr(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const Dd=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Ab(e){return Dd.test(e)}function Tb(e){return Qt(Dd,e)}const Md=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Sb(e){return Md.test(e)}function Pb(e){return Qt(Md,e)}const _d=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function Bb(e){return _d.test(e)}function Ub(e){return Qt(_d,e)}const Nd=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function eo(e){return Nd.test(e)}function Ib(e){return Qt(Nd,e)}const Rd=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function Fb(e){return Rd.test(e)}function Ob(e){return Qt(Rd,e)}const zd=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Db(e){return zd.test(e)}function Mb(e){return Qt(zd,e)}const _b=/^receive\(\) external payable$/;function Nb(e){return _b.test(e)}const Ld=new Set(["memory","indexed","storage","calldata"]),Rb=new Set(["indexed"]),tc=new Set(["calldata","memory","storage"]);class zb extends Qe{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class Lb extends Qe{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class $b extends Qe{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class Hb extends Qe{constructor({params:t}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}class Gb extends Qe{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class jb extends Qe{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class Vb extends Qe{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class qb extends Qe{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class Kb extends Qe{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class Or extends Qe{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Wb extends Qe{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Xb extends Qe{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class Zb extends Qe{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class Qb extends Qe{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function Jb(e,t,n){let r="";if(n)for(const s of Object.entries(n)){if(!s)continue;let a="";for(const o of s[1])a+=`[${o.type}${o.name?`:${o.name}`:""}]`;r+=`(${s[0]}{${a}})`}return t?`${t}:${e}${r}`:`${e}${r}`}const nc=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function rc(e,t={}){if(Bb(e))return Yb(e,t);if(Sb(e))return ey(e,t);if(Ab(e))return ty(e,t);if(Fb(e))return ny(e,t);if(Db(e))return ry(e);if(Nb(e))return{type:"receive",stateMutability:"payable"};throw new Wb({signature:e})}function Yb(e,t={}){const n=Ub(e);if(!n)throw new Or({signature:e,type:"function"});const r=ot(n.parameters),s=[],a=r.length;for(let i=0;i<a;i++)s.push(Jt(r[i],{modifiers:tc,structs:t,type:"function"}));const o=[];if(n.returns){const i=ot(n.returns),c=i.length;for(let l=0;l<c;l++)o.push(Jt(i[l],{modifiers:tc,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:s,outputs:o}}function ey(e,t={}){const n=Pb(e);if(!n)throw new Or({signature:e,type:"event"});const r=ot(n.parameters),s=[],a=r.length;for(let o=0;o<a;o++)s.push(Jt(r[o],{modifiers:Rb,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:s}}function ty(e,t={}){const n=Tb(e);if(!n)throw new Or({signature:e,type:"error"});const r=ot(n.parameters),s=[],a=r.length;for(let o=0;o<a;o++)s.push(Jt(r[o],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:s}}function ny(e,t={}){const n=Ob(e);if(!n)throw new Or({signature:e,type:"constructor"});const r=ot(n.parameters),s=[],a=r.length;for(let o=0;o<a;o++)s.push(Jt(r[o],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:s}}function ry(e){const t=Mb(e);if(!t)throw new Or({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const sy=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,ay=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,oy=/^u?int$/;function Jt(e,t){var p,f;const n=Jb(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(nc.has(n))return nc.get(n);const r=Fd.test(e),s=Qt(r?ay:sy,e);if(!s)throw new Gb({param:e});if(s.name&&cy(s.name))throw new jb({param:e,name:s.name});const a=s.name?{name:s.name}:{},o=s.modifier==="indexed"?{indexed:!0}:{},i=(t==null?void 0:t.structs)??{};let c,l={};if(r){c="tuple";const m=ot(s.type),y=[],x=m.length;for(let S=0;S<x;S++)y.push(Jt(m[S],{structs:i}));l={components:y}}else if(s.type in i)c="tuple",l={components:i[s.type]};else if(oy.test(s.type))c=`${s.type}256`;else if(s.type==="address payable")c="address";else if(c=s.type,(t==null?void 0:t.type)!=="struct"&&!$d(c))throw new $b({type:c});if(s.modifier){if(!((f=(p=t==null?void 0:t.modifiers)==null?void 0:p.has)!=null&&f.call(p,s.modifier)))throw new Vb({param:e,type:t==null?void 0:t.type,modifier:s.modifier});if(tc.has(s.modifier)&&!ly(c,!!s.array))throw new qb({param:e,type:t==null?void 0:t.type,modifier:s.modifier})}const d={type:`${c}${s.array??""}`,...a,...o,...l};return nc.set(n,d),d}function ot(e,t=[],n="",r=0){const s=e.trim().length;for(let a=0;a<s;a++){const o=e[a],i=e.slice(a+1);switch(o){case",":return r===0?ot(i,[...t,n.trim()]):ot(i,t,`${n}${o}`,r);case"(":return ot(i,t,`${n}${o}`,r+1);case")":return ot(i,t,`${n}${o}`,r-1);default:return ot(i,t,`${n}${o}`,r)}}if(n==="")return t;if(r!==0)throw new Qb({current:n,depth:r});return t.push(n.trim()),t}function $d(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Ud.test(e)||Id.test(e)}const iy=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function cy(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Ud.test(e)||Id.test(e)||iy.test(e)}function ly(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function sc(e){const t={},n=e.length;for(let o=0;o<n;o++){const i=e[o];if(!eo(i))continue;const c=Ib(i);if(!c)throw new Or({signature:i,type:"struct"});const l=c.properties.split(";"),d=[],p=l.length;for(let f=0;f<p;f++){const y=l[f].trim();if(!y)continue;const x=Jt(y,{type:"struct"});d.push(x)}if(!d.length)throw new Xb({signature:i});t[c.name]=d}const r={},s=Object.entries(t),a=s.length;for(let o=0;o<a;o++){const[i,c]=s[o];r[i]=Hd(c,t)}return r}const uy=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function Hd(e=[],t={},n=new Set){const r=[],s=e.length;for(let a=0;a<s;a++){const o=e[a];if(Fd.test(o.type))r.push(o);else{const c=Qt(uy,o.type);if(!(c!=null&&c.type))throw new Kb({abiParameter:o});const{array:l,type:d}=c;if(d in t){if(n.has(d))throw new Zb({type:d});r.push({...o,type:`tuple${l??""}`,components:Hd(t[d],t,new Set([...n,d]))})}else if($d(d))r.push(o);else throw new Lb({type:d})}}return r}function Gd(e){const t=sc(e),n=[],r=e.length;for(let s=0;s<r;s++){const a=e[s];eo(a)||n.push(rc(a,t))}return n}function jd(e){let t;if(typeof e=="string")t=rc(e);else{const n=sc(e),r=e.length;for(let s=0;s<r;s++){const a=e[s];if(!eo(a)){t=rc(a,n);break}}}if(!t)throw new zb({signature:e});return t}function Vd(e){const t=[];if(typeof e=="string"){const n=ot(e),r=n.length;for(let s=0;s<r;s++)t.push(Jt(n[s],{modifiers:Ld}))}else{const n=sc(e),r=e.length;for(let s=0;s<r;s++){const a=e[s];if(eo(a))continue;const o=ot(a),i=o.length;for(let c=0;c<i;c++)t.push(Jt(o[c],{modifiers:Ld,structs:n}))}}if(t.length===0)throw new Hb({params:e});return t}function W(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const s=e[n];return typeof s=="function"?s:a=>t(e,a)}function At(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new vy(e.type);return`${e.name}(${to(e.inputs,{includeName:t})})`}function to(e,{includeName:t=!1}={}){return e?e.map(n=>dy(n,{includeName:t})).join(t?", ":","):""}function dy(e,{includeName:t}){return e.type.startsWith("tuple")?`(${to(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function Tt(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function we(e){return Tt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const qd="2.43.3";let Ss={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${qd}`},R=class Wu extends Error{constructor(t,n={}){var i;const r=(()=>{var c;return n.cause instanceof Wu?n.cause.details:(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),s=n.cause instanceof Wu&&n.cause.docsPath||n.docsPath,a=(i=Ss.getDocsUrl)==null?void 0:i.call(Ss,{...n,docsPath:s}),o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...Ss.version?[`Version: ${Ss.version}`]:[]].join(`
|
|
66
66
|
`);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=qd}walk(t){return Kd(this,t)}};function Kd(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Kd(e.cause,t):t?null:e}class py extends R{constructor({docsPath:t}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
|
|
67
67
|
`),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class Wd extends R{constructor({docsPath:t}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orbs-network/spot-react",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.22",
|
|
4
4
|
"description": "Spot React Components - React components for Spot SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/spot-react.umd.cjs",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"react": "^18.0.0 || ^19.0.0",
|
|
31
31
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
32
32
|
"react-error-boundary": "^6.0.0",
|
|
33
|
-
"viem": "^2.43.3",
|
|
34
33
|
"zustand": "^5.0.9"
|
|
35
34
|
},
|
|
36
35
|
"dependencies": {
|
|
36
|
+
"viem": "^2.43.3",
|
|
37
37
|
"@orbs-network/spot-ui": "1.0.10"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|