@orbs-network/spot-react 0.0.4 → 0.0.6
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/dist/ccip-CtSUe45L.js +149 -0
- package/dist/index-vzISTdG1.js +42004 -0
- package/dist/spot-react/package.json.d.ts +63 -0
- package/dist/spot-react/src/chains.d.ts +3 -0
- package/dist/spot-react/src/chains.d.ts.map +1 -0
- package/dist/spot-react/src/components/TokenLogo.d.ts +9 -0
- package/dist/spot-react/src/components/TokenLogo.d.ts.map +1 -0
- package/dist/spot-react/src/components/order-details.d.ts +79 -0
- package/dist/spot-react/src/components/order-details.d.ts.map +1 -0
- package/dist/spot-react/src/consts.d.ts +13 -0
- package/dist/spot-react/src/consts.d.ts.map +1 -0
- package/dist/spot-react/src/context/twap-context.d.ts +6 -0
- package/dist/spot-react/src/context/twap-context.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/helper-hooks.d.ts +438 -0
- package/dist/spot-react/src/hooks/helper-hooks.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/order-hooks.d.ts +212 -0
- package/dist/spot-react/src/hooks/order-hooks.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-amounts-usd.d.ts +5 -0
- package/dist/spot-react/src/hooks/use-amounts-usd.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-base-order.d.ts +79 -0
- package/dist/spot-react/src/hooks/use-base-order.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-build-repermit-order-data-callback.ts.d.ts +37 -0
- package/dist/spot-react/src/hooks/use-build-repermit-order-data-callback.ts.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-cancel-order.d.ts +5 -0
- package/dist/spot-react/src/hooks/use-cancel-order.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-current-order.d.ts +74 -0
- package/dist/spot-react/src/hooks/use-current-order.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-deadline.d.ts +2 -0
- package/dist/spot-react/src/hooks/use-deadline.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-default-values.d.ts +3 -0
- package/dist/spot-react/src/hooks/use-default-values.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-disclaimer-panel.d.ts +5 -0
- package/dist/spot-react/src/hooks/use-disclaimer-panel.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-dst-amount.d.ts +10 -0
- package/dist/spot-react/src/hooks/use-dst-amount.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-duration.d.ts +18 -0
- package/dist/spot-react/src/hooks/use-duration.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-fill-delay.d.ts +18 -0
- package/dist/spot-react/src/hooks/use-fill-delay.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-get-transaction-receipt.d.ts +2 -0
- package/dist/spot-react/src/hooks/use-get-transaction-receipt.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-history-order.d.ts +99 -0
- package/dist/spot-react/src/hooks/use-history-order.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-input-errors.d.ts +4 -0
- package/dist/spot-react/src/hooks/use-input-errors.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-input-with-percentage.d.ts +17 -0
- package/dist/spot-react/src/hooks/use-input-with-percentage.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-invert-trade-panel.d.ts +8 -0
- package/dist/spot-react/src/hooks/use-invert-trade-panel.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-limit-price.d.ts +40 -0
- package/dist/spot-react/src/hooks/use-limit-price.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-market-price.d.ts +8 -0
- package/dist/spot-react/src/hooks/use-market-price.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-src-amount.d.ts +6 -0
- package/dist/spot-react/src/hooks/use-src-amount.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-submit-order.d.ts +2 -0
- package/dist/spot-react/src/hooks/use-submit-order.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-submit-swap-panel.d.ts +104 -0
- package/dist/spot-react/src/hooks/use-submit-swap-panel.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-toggle-price.d.ts +5 -0
- package/dist/spot-react/src/hooks/use-toggle-price.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-token-panel.d.ts +27 -0
- package/dist/spot-react/src/hooks/use-token-panel.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-trade-price.d.ts +2 -0
- package/dist/spot-react/src/hooks/use-trade-price.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-trades.d.ts +24 -0
- package/dist/spot-react/src/hooks/use-trades.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-translations.d.ts +3 -0
- package/dist/spot-react/src/hooks/use-translations.d.ts.map +1 -0
- package/dist/spot-react/src/hooks/use-trigger-price.d.ts +37 -0
- package/dist/spot-react/src/hooks/use-trigger-price.d.ts.map +1 -0
- package/dist/spot-react/src/i18n/en.json.d.ts +94 -0
- package/dist/spot-react/src/index.d.ts +9 -4
- package/dist/spot-react/src/index.d.ts.map +1 -1
- package/dist/spot-react/src/lib.d.ts +7 -0
- package/dist/spot-react/src/lib.d.ts.map +1 -0
- package/dist/spot-react/src/twap/components/orders/order-preview.d.ts +3 -0
- package/dist/spot-react/src/twap/components/orders/order-preview.d.ts.map +1 -0
- package/dist/spot-react/src/twap/components/orders/orders-list.d.ts +2 -0
- package/dist/spot-react/src/twap/components/orders/orders-list.d.ts.map +1 -0
- package/dist/spot-react/src/twap/components/orders/orders.d.ts +2 -0
- package/dist/spot-react/src/twap/components/orders/orders.d.ts.map +1 -0
- package/dist/spot-react/src/twap/components/submit-order-panel.d.ts +10 -0
- package/dist/spot-react/src/twap/components/submit-order-panel.d.ts.map +1 -0
- package/dist/spot-react/src/twap/twap.d.ts +22 -0
- package/dist/spot-react/src/twap/twap.d.ts.map +1 -0
- package/dist/spot-react/src/types.d.ts +418 -0
- package/dist/spot-react/src/types.d.ts.map +1 -0
- package/dist/spot-react/src/useTwapStore.d.ts +11 -0
- package/dist/spot-react/src/useTwapStore.d.ts.map +1 -0
- package/dist/spot-react/src/utils.d.ts +27 -0
- package/dist/spot-react/src/utils.d.ts.map +1 -0
- package/dist/spot-react.js +54 -64
- package/dist/spot-react.umd.cjs +63 -1
- package/package.json +13 -2
- package/dist/spot-react/src/components/SpotEventList.d.ts +0 -7
- package/dist/spot-react/src/components/SpotEventList.d.ts.map +0 -1
- package/dist/spot-react/src/components/SpotTracker.d.ts +0 -9
- package/dist/spot-react/src/components/SpotTracker.d.ts.map +0 -1
- package/dist/spot-react/src/context/SpotContext.d.ts +0 -16
- package/dist/spot-react/src/context/SpotContext.d.ts.map +0 -1
- package/dist/spot-react.css +0 -1
|
@@ -0,0 +1,149 @@
|
|
|
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-vzISTdG1.js";
|
|
2
|
+
class S extends p {
|
|
3
|
+
constructor({ callbackSelector: r, cause: a, data: n, extraData: i, sender: f, urls: t }) {
|
|
4
|
+
var o;
|
|
5
|
+
super(a.shortMessage || "An error occurred while fetching for an offchain result.", {
|
|
6
|
+
cause: a,
|
|
7
|
+
metaMessages: [
|
|
8
|
+
...a.metaMessages || [],
|
|
9
|
+
(o = a.metaMessages) != null && o.length ? "" : [],
|
|
10
|
+
"Offchain Gateway Call:",
|
|
11
|
+
t && [
|
|
12
|
+
" Gateway URL(s):",
|
|
13
|
+
...t.map((d) => ` ${m(d)}`)
|
|
14
|
+
],
|
|
15
|
+
` Sender: ${f}`,
|
|
16
|
+
` Data: ${n}`,
|
|
17
|
+
` Callback selector: ${r}`,
|
|
18
|
+
` Extra data: ${i}`
|
|
19
|
+
].flat(),
|
|
20
|
+
name: "OffchainLookupError"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
class $ extends p {
|
|
25
|
+
constructor({ result: r, url: a }) {
|
|
26
|
+
super("Offchain gateway response is malformed. Response data must be a hex value.", {
|
|
27
|
+
metaMessages: [
|
|
28
|
+
`Gateway URL: ${m(a)}`,
|
|
29
|
+
`Response: ${w(r)}`
|
|
30
|
+
],
|
|
31
|
+
name: "OffchainLookupResponseMalformedError"
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
class q extends p {
|
|
36
|
+
constructor({ sender: r, to: a }) {
|
|
37
|
+
super("Reverted sender address does not match target contract address (`to`).", {
|
|
38
|
+
metaMessages: [
|
|
39
|
+
`Contract address: ${a}`,
|
|
40
|
+
`OffchainLookup sender address: ${r}`
|
|
41
|
+
],
|
|
42
|
+
name: "OffchainLookupSenderMismatchError"
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const A = "0x556f1830", T = {
|
|
47
|
+
name: "OffchainLookup",
|
|
48
|
+
type: "error",
|
|
49
|
+
inputs: [
|
|
50
|
+
{
|
|
51
|
+
name: "sender",
|
|
52
|
+
type: "address"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: "urls",
|
|
56
|
+
type: "string[]"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "callData",
|
|
60
|
+
type: "bytes"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "callbackFunction",
|
|
64
|
+
type: "bytes4"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: "extraData",
|
|
68
|
+
type: "bytes"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
};
|
|
72
|
+
async function D(c, { blockNumber: r, blockTag: a, data: n, to: i }) {
|
|
73
|
+
const { args: f } = k({
|
|
74
|
+
data: n,
|
|
75
|
+
abi: [T]
|
|
76
|
+
}), [t, o, d, l, s] = f, { ccipRead: e } = c, h = e && typeof (e == null ? void 0 : e.request) == "function" ? e.request : C;
|
|
77
|
+
try {
|
|
78
|
+
if (!b(i, t))
|
|
79
|
+
throw new q({ sender: t, to: i });
|
|
80
|
+
const u = o.includes(L) ? await O({
|
|
81
|
+
data: d,
|
|
82
|
+
ccipRequest: h
|
|
83
|
+
}) : await h({ data: d, sender: t, urls: o }), { data: g } = await E(c, {
|
|
84
|
+
blockNumber: r,
|
|
85
|
+
blockTag: a,
|
|
86
|
+
data: x([
|
|
87
|
+
l,
|
|
88
|
+
R([{ type: "bytes" }, { type: "bytes" }], [u, s])
|
|
89
|
+
]),
|
|
90
|
+
to: i
|
|
91
|
+
});
|
|
92
|
+
return g;
|
|
93
|
+
} catch (u) {
|
|
94
|
+
throw new S({
|
|
95
|
+
callbackSelector: l,
|
|
96
|
+
cause: u,
|
|
97
|
+
data: n,
|
|
98
|
+
extraData: s,
|
|
99
|
+
sender: t,
|
|
100
|
+
urls: o
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
async function C({ data: c, sender: r, urls: a }) {
|
|
105
|
+
var i;
|
|
106
|
+
let n = new Error("An unknown error occurred.");
|
|
107
|
+
for (let f = 0; f < a.length; f++) {
|
|
108
|
+
const t = a[f], o = t.includes("{data}") ? "GET" : "POST", d = o === "POST" ? { data: c, sender: r } : void 0, l = o === "POST" ? { "Content-Type": "application/json" } : {};
|
|
109
|
+
try {
|
|
110
|
+
const s = await fetch(t.replace("{sender}", r.toLowerCase()).replace("{data}", c), {
|
|
111
|
+
body: JSON.stringify(d),
|
|
112
|
+
headers: l,
|
|
113
|
+
method: o
|
|
114
|
+
});
|
|
115
|
+
let e;
|
|
116
|
+
if ((i = s.headers.get("Content-Type")) != null && i.startsWith("application/json") ? e = (await s.json()).data : e = await s.text(), !s.ok) {
|
|
117
|
+
n = new y({
|
|
118
|
+
body: d,
|
|
119
|
+
details: e != null && e.error ? w(e.error) : s.statusText,
|
|
120
|
+
headers: s.headers,
|
|
121
|
+
status: s.status,
|
|
122
|
+
url: t
|
|
123
|
+
});
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
if (!M(e)) {
|
|
127
|
+
n = new $({
|
|
128
|
+
result: e,
|
|
129
|
+
url: t
|
|
130
|
+
});
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
return e;
|
|
134
|
+
} catch (s) {
|
|
135
|
+
n = new y({
|
|
136
|
+
body: d,
|
|
137
|
+
details: s.message,
|
|
138
|
+
url: t
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
throw n;
|
|
143
|
+
}
|
|
144
|
+
export {
|
|
145
|
+
C as ccipRequest,
|
|
146
|
+
D as offchainLookup,
|
|
147
|
+
T as offchainLookupAbiItem,
|
|
148
|
+
A as offchainLookupSignature
|
|
149
|
+
};
|