@orbs-network/spot-react 0.1.0 → 1.0.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.
Files changed (138) hide show
  1. package/dist/ccip-bPFWIGtu.js +149 -0
  2. package/dist/index-Jq763Rdi.js +45137 -0
  3. package/dist/index.d.ts +2 -2
  4. package/dist/spot-react/package.json.d.ts +63 -0
  5. package/dist/spot-react/src/components/TokenLogo.d.ts +9 -0
  6. package/dist/spot-react/src/components/TokenLogo.d.ts.map +1 -0
  7. package/dist/spot-react/src/components/format-number.d.ts +10 -0
  8. package/dist/spot-react/src/components/format-number.d.ts.map +1 -0
  9. package/dist/spot-react/src/components/order-details.d.ts +75 -0
  10. package/dist/spot-react/src/components/order-details.d.ts.map +1 -0
  11. package/dist/spot-react/src/components/orders/order-fills.d.ts +8 -0
  12. package/dist/spot-react/src/components/orders/order-fills.d.ts.map +1 -0
  13. package/dist/spot-react/src/components/orders/order-preview.d.ts +3 -0
  14. package/dist/spot-react/src/components/orders/order-preview.d.ts.map +1 -0
  15. package/dist/spot-react/src/components/orders/orders-list.d.ts +2 -0
  16. package/dist/spot-react/src/components/orders/orders-list.d.ts.map +1 -0
  17. package/dist/spot-react/src/components/orders/orders.d.ts +2 -0
  18. package/dist/spot-react/src/components/orders/orders.d.ts.map +1 -0
  19. package/dist/spot-react/src/components/portal.d.ts +6 -0
  20. package/dist/spot-react/src/components/portal.d.ts.map +1 -0
  21. package/dist/spot-react/src/components/submit-order-panel.d.ts +10 -0
  22. package/dist/spot-react/src/components/submit-order-panel.d.ts.map +1 -0
  23. package/dist/spot-react/src/consts.d.ts +8 -0
  24. package/dist/spot-react/src/consts.d.ts.map +1 -0
  25. package/dist/spot-react/src/hooks/helper-hooks.d.ts +438 -0
  26. package/dist/spot-react/src/hooks/helper-hooks.d.ts.map +1 -0
  27. package/dist/spot-react/src/hooks/order-hooks.d.ts +39 -0
  28. package/dist/spot-react/src/hooks/order-hooks.d.ts.map +1 -0
  29. package/dist/spot-react/src/hooks/use-addresses.d.ts +4 -0
  30. package/dist/spot-react/src/hooks/use-addresses.d.ts.map +1 -0
  31. package/dist/spot-react/src/hooks/use-amounts-usd.d.ts +5 -0
  32. package/dist/spot-react/src/hooks/use-amounts-usd.d.ts.map +1 -0
  33. package/dist/spot-react/src/hooks/use-build-order-info.d.ts +90 -0
  34. package/dist/spot-react/src/hooks/use-build-order-info.d.ts.map +1 -0
  35. package/dist/spot-react/src/hooks/use-cancel-order.d.ts +6 -0
  36. package/dist/spot-react/src/hooks/use-cancel-order.d.ts.map +1 -0
  37. package/dist/spot-react/src/hooks/use-deadline.d.ts +2 -0
  38. package/dist/spot-react/src/hooks/use-deadline.d.ts.map +1 -0
  39. package/dist/spot-react/src/hooks/use-default-values.d.ts +3 -0
  40. package/dist/spot-react/src/hooks/use-default-values.d.ts.map +1 -0
  41. package/dist/spot-react/src/hooks/use-disclaimer-panel.d.ts +5 -0
  42. package/dist/spot-react/src/hooks/use-disclaimer-panel.d.ts.map +1 -0
  43. package/dist/spot-react/src/hooks/use-dst-amount.d.ts +11 -0
  44. package/dist/spot-react/src/hooks/use-dst-amount.d.ts.map +1 -0
  45. package/dist/spot-react/src/hooks/use-dst-token-panel.d.ts +7 -0
  46. package/dist/spot-react/src/hooks/use-dst-token-panel.d.ts.map +1 -0
  47. package/dist/spot-react/src/hooks/use-duration.d.ts +25 -0
  48. package/dist/spot-react/src/hooks/use-duration.d.ts.map +1 -0
  49. package/dist/spot-react/src/hooks/use-fees.d.ts +6 -0
  50. package/dist/spot-react/src/hooks/use-fees.d.ts.map +1 -0
  51. package/dist/spot-react/src/hooks/use-fill-delay.d.ts +19 -0
  52. package/dist/spot-react/src/hooks/use-fill-delay.d.ts.map +1 -0
  53. package/dist/spot-react/src/hooks/use-get-transaction-receipt.d.ts +2 -0
  54. package/dist/spot-react/src/hooks/use-get-transaction-receipt.d.ts.map +1 -0
  55. package/dist/spot-react/src/hooks/use-history-order.d.ts +3 -0
  56. package/dist/spot-react/src/hooks/use-history-order.d.ts.map +1 -0
  57. package/dist/spot-react/src/hooks/use-input-errors.d.ts +2 -0
  58. package/dist/spot-react/src/hooks/use-input-errors.d.ts.map +1 -0
  59. package/dist/spot-react/src/hooks/use-input-with-percentage.d.ts +18 -0
  60. package/dist/spot-react/src/hooks/use-input-with-percentage.d.ts.map +1 -0
  61. package/dist/spot-react/src/hooks/use-invert-trade-panel.d.ts +8 -0
  62. package/dist/spot-react/src/hooks/use-invert-trade-panel.d.ts.map +1 -0
  63. package/dist/spot-react/src/hooks/use-limit-price-panel.d.ts +27 -0
  64. package/dist/spot-react/src/hooks/use-limit-price-panel.d.ts.map +1 -0
  65. package/dist/spot-react/src/hooks/use-limit-price.d.ts +27 -0
  66. package/dist/spot-react/src/hooks/use-limit-price.d.ts.map +1 -0
  67. package/dist/spot-react/src/hooks/use-order.d.ts +121 -0
  68. package/dist/spot-react/src/hooks/use-order.d.ts.map +1 -0
  69. package/dist/spot-react/src/hooks/use-partner-chains.d.ts +2 -0
  70. package/dist/spot-react/src/hooks/use-partner-chains.d.ts.map +1 -0
  71. package/dist/spot-react/src/hooks/use-repermit-order-data.d.ts +37 -0
  72. package/dist/spot-react/src/hooks/use-repermit-order-data.d.ts.map +1 -0
  73. package/dist/spot-react/src/hooks/use-src-amount.d.ts +6 -0
  74. package/dist/spot-react/src/hooks/use-src-amount.d.ts.map +1 -0
  75. package/dist/spot-react/src/hooks/use-submit-order-panel.d.ts +31 -0
  76. package/dist/spot-react/src/hooks/use-submit-order-panel.d.ts.map +1 -0
  77. package/dist/spot-react/src/hooks/use-submit-order.d.ts +3 -0
  78. package/dist/spot-react/src/hooks/use-submit-order.d.ts.map +1 -0
  79. package/dist/spot-react/src/hooks/use-toggle-price.d.ts +5 -0
  80. package/dist/spot-react/src/hooks/use-toggle-price.d.ts.map +1 -0
  81. package/dist/spot-react/src/hooks/use-trade-price.d.ts +2 -0
  82. package/dist/spot-react/src/hooks/use-trade-price.d.ts.map +1 -0
  83. package/dist/spot-react/src/hooks/use-trades.d.ts +32 -0
  84. package/dist/spot-react/src/hooks/use-trades.d.ts.map +1 -0
  85. package/dist/spot-react/src/hooks/use-translations.d.ts +3 -0
  86. package/dist/spot-react/src/hooks/use-translations.d.ts.map +1 -0
  87. package/dist/spot-react/src/hooks/use-trigger-price-panel.d.ts +28 -0
  88. package/dist/spot-react/src/hooks/use-trigger-price-panel.d.ts.map +1 -0
  89. package/dist/spot-react/src/hooks/use-trigger-price.d.ts +25 -0
  90. package/dist/spot-react/src/hooks/use-trigger-price.d.ts.map +1 -0
  91. package/dist/spot-react/src/i18n/en.json.d.ts +99 -0
  92. package/dist/spot-react/src/index.d.ts +38 -0
  93. package/dist/spot-react/src/index.d.ts.map +1 -0
  94. package/dist/spot-react/src/spot-context.d.ts +6 -0
  95. package/dist/spot-react/src/spot-context.d.ts.map +1 -0
  96. package/dist/spot-react/src/store.d.ts +11 -0
  97. package/dist/spot-react/src/store.d.ts.map +1 -0
  98. package/dist/spot-react/src/types.d.ts +487 -0
  99. package/dist/spot-react/src/types.d.ts.map +1 -0
  100. package/dist/spot-react/src/utils.d.ts +26 -0
  101. package/dist/spot-react/src/utils.d.ts.map +1 -0
  102. package/dist/spot-react.js +133 -0
  103. package/dist/spot-react.umd.cjs +126 -0
  104. package/dist/spot-ui/src/index.d.ts +14 -0
  105. package/dist/spot-ui/src/index.d.ts.map +1 -0
  106. package/dist/spot-ui/src/lib/abi/erc20.json.d.ts +291 -0
  107. package/dist/spot-ui/src/lib/abi/index.d.ts +260 -0
  108. package/dist/spot-ui/src/lib/abi/index.d.ts.map +1 -0
  109. package/dist/spot-ui/src/lib/abi/iweth.json.d.ts +41 -0
  110. package/dist/spot-ui/src/lib/abi/repermit.json.d.ts +315 -0
  111. package/dist/spot-ui/src/lib/analytics.d.ts +108 -0
  112. package/dist/spot-ui/src/lib/analytics.d.ts.map +1 -0
  113. package/dist/spot-ui/src/lib/build-repermit-order-data.d.ts +55 -0
  114. package/dist/spot-ui/src/lib/build-repermit-order-data.d.ts.map +1 -0
  115. package/dist/spot-ui/src/lib/consts.d.ts +118 -0
  116. package/dist/spot-ui/src/lib/consts.d.ts.map +1 -0
  117. package/dist/spot-ui/src/lib/lib.d.ts +67 -0
  118. package/dist/spot-ui/src/lib/lib.d.ts.map +1 -0
  119. package/dist/spot-ui/src/lib/networks.d.ts +445 -0
  120. package/dist/spot-ui/src/lib/networks.d.ts.map +1 -0
  121. package/dist/spot-ui/src/lib/orders/index.d.ts +11 -0
  122. package/dist/spot-ui/src/lib/orders/index.d.ts.map +1 -0
  123. package/dist/spot-ui/src/lib/orders/v1-orders.d.ts +34 -0
  124. package/dist/spot-ui/src/lib/orders/v1-orders.d.ts.map +1 -0
  125. package/dist/spot-ui/src/lib/orders/v2-orders.d.ts +10 -0
  126. package/dist/spot-ui/src/lib/orders/v2-orders.d.ts.map +1 -0
  127. package/dist/spot-ui/src/lib/submit-order.d.ts +3 -0
  128. package/dist/spot-ui/src/lib/submit-order.d.ts.map +1 -0
  129. package/dist/spot-ui/src/lib/types.d.ts +308 -0
  130. package/dist/spot-ui/src/lib/types.d.ts.map +1 -0
  131. package/dist/spot-ui/src/lib/utils.d.ts +458 -0
  132. package/dist/spot-ui/src/lib/utils.d.ts.map +1 -0
  133. package/package.json +41 -19
  134. package/dist/index.cjs.js +0 -14
  135. package/dist/index.d.ts.map +0 -1
  136. package/dist/index.es.js +0 -626
  137. package/dist/wallet-info.d.ts +0 -7
  138. package/dist/wallet-info.d.ts.map +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-Jq763Rdi.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
+ };