@hot-labs/kit 1.2.0-alpha.1 → 1.2.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 (368) hide show
  1. package/README.md +2 -9
  2. package/build/HotConnector.d.ts +105 -0
  3. package/build/HotConnector.js +303 -0
  4. package/build/HotConnector.js.map +1 -0
  5. package/build/OmniConnector.d.ts +90 -0
  6. package/build/OmniConnector.js +121 -0
  7. package/build/OmniConnector.js.map +1 -0
  8. package/build/OmniWallet.d.ts +35 -0
  9. package/build/OmniWallet.js +56 -0
  10. package/build/OmniWallet.js.map +1 -0
  11. package/build/activity.d.ts +18 -0
  12. package/build/activity.js +87 -0
  13. package/build/activity.js.map +1 -0
  14. package/build/core/Intents.d.ts +100 -0
  15. package/build/core/Intents.js +472 -0
  16. package/build/core/Intents.js.map +1 -0
  17. package/build/core/api.d.ts +60 -0
  18. package/build/core/api.js +108 -0
  19. package/build/core/api.js.map +1 -0
  20. package/build/core/bridge.d.ts +3 -0
  21. package/build/core/bridge.js +36 -0
  22. package/build/core/bridge.js.map +1 -0
  23. package/build/core/chains.d.ts +115 -0
  24. package/build/core/chains.js +381 -0
  25. package/build/core/chains.js.map +1 -0
  26. package/build/core/defaultTokens.d.ts +17 -0
  27. package/build/core/defaultTokens.js +1079 -0
  28. package/build/core/defaultTokens.js.map +1 -0
  29. package/build/core/events.d.ts +42 -0
  30. package/build/core/events.js +64 -0
  31. package/build/core/events.js.map +1 -0
  32. package/build/core/index.d.ts +10 -0
  33. package/build/core/index.js +11 -0
  34. package/build/core/index.js.map +1 -0
  35. package/build/core/recipient.d.ts +10 -0
  36. package/build/core/recipient.js +40 -0
  37. package/build/core/recipient.js.map +1 -0
  38. package/build/core/telemetry.d.ts +13 -0
  39. package/build/core/telemetry.js +27 -0
  40. package/build/core/telemetry.js.map +1 -0
  41. package/build/core/token.d.ts +37 -0
  42. package/build/core/token.js +106 -0
  43. package/build/core/token.js.map +1 -0
  44. package/build/core/tokens.d.ts +14 -0
  45. package/build/core/tokens.js +51 -0
  46. package/build/core/tokens.js.map +1 -0
  47. package/build/core/types.d.ts +60 -0
  48. package/build/core/types.js +2 -0
  49. package/build/core/types.js.map +1 -0
  50. package/build/core/utils.d.ts +25 -0
  51. package/build/core/utils.js +170 -0
  52. package/build/core/utils.js.map +1 -0
  53. package/build/cosmos/connector.d.ts +36 -0
  54. package/build/cosmos/connector.js +211 -0
  55. package/build/cosmos/connector.js.map +1 -0
  56. package/build/cosmos/helpers.d.ts +2 -0
  57. package/build/cosmos/helpers.js +29 -0
  58. package/build/cosmos/helpers.js.map +1 -0
  59. package/build/cosmos/index.d.ts +6 -0
  60. package/build/cosmos/index.js +5 -0
  61. package/build/cosmos/index.js.map +1 -0
  62. package/build/cosmos/wallet.d.ts +26 -0
  63. package/build/cosmos/wallet.js +51 -0
  64. package/build/cosmos/wallet.js.map +1 -0
  65. package/build/defaults.d.ts +1 -0
  66. package/build/defaults.js +7 -0
  67. package/build/defaults.js.map +1 -0
  68. package/build/evm/abi.d.ts +17 -0
  69. package/build/evm/abi.js +38 -0
  70. package/build/evm/abi.js.map +1 -0
  71. package/build/evm/connector.d.ts +29 -0
  72. package/build/evm/connector.js +118 -0
  73. package/build/evm/connector.js.map +1 -0
  74. package/build/evm/index.d.ts +6 -0
  75. package/build/evm/index.js +5 -0
  76. package/build/evm/index.js.map +1 -0
  77. package/build/evm/injected.d.ts +1 -0
  78. package/build/evm/injected.js +33 -0
  79. package/build/evm/injected.js.map +1 -0
  80. package/build/evm/wallet.d.ts +42 -0
  81. package/build/evm/wallet.js +130 -0
  82. package/build/evm/wallet.js.map +1 -0
  83. package/build/exchange.d.ts +68 -0
  84. package/build/exchange.js +384 -0
  85. package/build/exchange.js.map +1 -0
  86. package/build/hot-wallet/google.d.ts +25 -0
  87. package/build/hot-wallet/google.js +117 -0
  88. package/build/hot-wallet/google.js.map +1 -0
  89. package/build/hot-wallet/iframe.d.ts +36 -0
  90. package/build/hot-wallet/iframe.js +140 -0
  91. package/build/hot-wallet/iframe.js.map +1 -0
  92. package/build/hot-wallet/index.d.ts +5 -0
  93. package/build/hot-wallet/index.js +4 -0
  94. package/build/hot-wallet/index.js.map +1 -0
  95. package/build/hot-wallet/proxy.d.ts +8 -0
  96. package/build/hot-wallet/proxy.js +45 -0
  97. package/build/hot-wallet/proxy.js.map +1 -0
  98. package/build/index.d.ts +6 -0
  99. package/build/index.js +7 -0
  100. package/build/index.js.map +1 -0
  101. package/build/near/connector.d.ts +18 -0
  102. package/build/near/connector.js +58 -0
  103. package/build/near/connector.js.map +1 -0
  104. package/build/near/index.d.ts +7 -0
  105. package/build/near/index.js +5 -0
  106. package/build/near/index.js.map +1 -0
  107. package/build/near/rpc.d.ts +23 -0
  108. package/build/near/rpc.js +153 -0
  109. package/build/near/rpc.js.map +1 -0
  110. package/build/near/wallet.d.ts +55 -0
  111. package/build/near/wallet.js +201 -0
  112. package/build/near/wallet.js.map +1 -0
  113. package/build/solana/WalletStandard.d.ts +25 -0
  114. package/build/solana/WalletStandard.js +56 -0
  115. package/build/solana/WalletStandard.js.map +1 -0
  116. package/build/solana/connector.d.ts +30 -0
  117. package/build/solana/connector.js +139 -0
  118. package/build/solana/connector.js.map +1 -0
  119. package/build/solana/index.d.ts +6 -0
  120. package/build/solana/index.js +5 -0
  121. package/build/solana/index.js.map +1 -0
  122. package/build/solana/injected/account.d.ts +11 -0
  123. package/build/solana/injected/account.js +41 -0
  124. package/build/solana/injected/account.js.map +1 -0
  125. package/build/solana/injected/index.d.ts +1 -0
  126. package/build/solana/injected/index.js +82 -0
  127. package/build/solana/injected/index.js.map +1 -0
  128. package/build/solana/injected/register.d.ts +2 -0
  129. package/build/solana/injected/register.js +41 -0
  130. package/build/solana/injected/register.js.map +1 -0
  131. package/build/solana/injected/solana-wallet.d.ts +34 -0
  132. package/build/solana/injected/solana-wallet.js +223 -0
  133. package/build/solana/injected/solana-wallet.js.map +1 -0
  134. package/build/solana/injected/utils.d.ts +32 -0
  135. package/build/solana/injected/utils.js +36 -0
  136. package/build/solana/injected/utils.js.map +1 -0
  137. package/build/solana/wallet.d.ts +40 -0
  138. package/build/solana/wallet.js +181 -0
  139. package/build/solana/wallet.js.map +1 -0
  140. package/build/solana/walletStandartList.d.ts +102 -0
  141. package/build/solana/walletStandartList.js +150 -0
  142. package/build/solana/walletStandartList.js.map +1 -0
  143. package/build/stellar/connector.d.ts +29 -0
  144. package/build/stellar/connector.js +64 -0
  145. package/build/stellar/connector.js.map +1 -0
  146. package/build/stellar/freigher.d.ts +46 -0
  147. package/build/stellar/freigher.js +110 -0
  148. package/build/stellar/freigher.js.map +1 -0
  149. package/build/stellar/hotWallet.d.ts +33 -0
  150. package/build/stellar/hotWallet.js +28 -0
  151. package/build/stellar/hotWallet.js.map +1 -0
  152. package/build/stellar/index.d.ts +6 -0
  153. package/build/stellar/index.js +5 -0
  154. package/build/stellar/index.js.map +1 -0
  155. package/build/stellar/wallet.d.ts +67 -0
  156. package/build/stellar/wallet.js +212 -0
  157. package/build/stellar/wallet.js.map +1 -0
  158. package/build/storage.d.ts +10 -0
  159. package/build/storage.js +12 -0
  160. package/build/storage.js.map +1 -0
  161. package/build/ton/connector.d.ts +24 -0
  162. package/build/ton/connector.js +111 -0
  163. package/build/ton/connector.js.map +1 -0
  164. package/build/ton/index.d.ts +7 -0
  165. package/build/ton/index.js +5 -0
  166. package/build/ton/index.js.map +1 -0
  167. package/build/ton/injected.d.ts +1 -0
  168. package/build/ton/injected.js +49 -0
  169. package/build/ton/injected.js.map +1 -0
  170. package/build/ton/utils.d.ts +45 -0
  171. package/build/ton/utils.js +63 -0
  172. package/build/ton/utils.js.map +1 -0
  173. package/build/ton/wallet.d.ts +54 -0
  174. package/build/ton/wallet.js +138 -0
  175. package/build/ton/wallet.js.map +1 -0
  176. package/build/tron/connector.d.ts +51 -0
  177. package/build/tron/connector.js +65 -0
  178. package/build/tron/connector.js.map +1 -0
  179. package/build/tron/index.d.ts +6 -0
  180. package/build/tron/index.js +5 -0
  181. package/build/tron/index.js.map +1 -0
  182. package/build/tron/wallet.d.ts +52 -0
  183. package/build/tron/wallet.js +122 -0
  184. package/build/tron/wallet.js.map +1 -0
  185. package/build/ui/Popup.d.ts +12 -0
  186. package/build/ui/Popup.js +43 -0
  187. package/build/ui/Popup.js.map +1 -0
  188. package/build/ui/bridge/Bridge.d.ts +29 -0
  189. package/build/ui/bridge/Bridge.js +389 -0
  190. package/build/ui/bridge/Bridge.js.map +1 -0
  191. package/build/ui/bridge/SelectRecipient.d.ts +14 -0
  192. package/build/ui/bridge/SelectRecipient.js +68 -0
  193. package/build/ui/bridge/SelectRecipient.js.map +1 -0
  194. package/build/ui/bridge/SelectSender.d.ts +13 -0
  195. package/build/ui/bridge/SelectSender.js +23 -0
  196. package/build/ui/bridge/SelectSender.js.map +1 -0
  197. package/build/ui/bridge/SelectToken.d.ts +13 -0
  198. package/build/ui/bridge/SelectToken.js +93 -0
  199. package/build/ui/bridge/SelectToken.js.map +1 -0
  200. package/build/ui/bridge/TokenCard.d.ts +21 -0
  201. package/build/ui/bridge/TokenCard.js +65 -0
  202. package/build/ui/bridge/TokenCard.js.map +1 -0
  203. package/build/ui/connect/AuthPopup.d.ts +2 -0
  204. package/build/ui/connect/AuthPopup.js +48 -0
  205. package/build/ui/connect/AuthPopup.js.map +1 -0
  206. package/build/ui/connect/ConnectWallet.d.ts +14 -0
  207. package/build/ui/connect/ConnectWallet.js +22 -0
  208. package/build/ui/connect/ConnectWallet.js.map +1 -0
  209. package/build/ui/connect/LogoutPopup.d.ts +10 -0
  210. package/build/ui/connect/LogoutPopup.js +8 -0
  211. package/build/ui/connect/LogoutPopup.js.map +1 -0
  212. package/build/ui/connect/PrimaryWallet.d.ts +6 -0
  213. package/build/ui/connect/PrimaryWallet.js +18 -0
  214. package/build/ui/connect/PrimaryWallet.js.map +1 -0
  215. package/build/ui/connect/WCPopup.d.ts +13 -0
  216. package/build/ui/connect/WCPopup.js +81 -0
  217. package/build/ui/connect/WCPopup.js.map +1 -0
  218. package/build/ui/connect/WCRequest.d.ts +9 -0
  219. package/build/ui/connect/WCRequest.js +13 -0
  220. package/build/ui/connect/WCRequest.js.map +1 -0
  221. package/build/ui/connect/WalletPicker.d.ts +11 -0
  222. package/build/ui/connect/WalletPicker.js +48 -0
  223. package/build/ui/connect/WalletPicker.js.map +1 -0
  224. package/build/ui/icons/arrow-right.d.ts +3 -0
  225. package/build/ui/icons/arrow-right.js +5 -0
  226. package/build/ui/icons/arrow-right.js.map +1 -0
  227. package/build/ui/icons/close.d.ts +1 -0
  228. package/build/ui/icons/close.js +5 -0
  229. package/build/ui/icons/close.js.map +1 -0
  230. package/build/ui/icons/exchange.d.ts +5 -0
  231. package/build/ui/icons/exchange.js +6 -0
  232. package/build/ui/icons/exchange.js.map +1 -0
  233. package/build/ui/icons/logout.d.ts +1 -0
  234. package/build/ui/icons/logout.js +3 -0
  235. package/build/ui/icons/logout.js.map +1 -0
  236. package/build/ui/icons/pending.d.ts +1 -0
  237. package/build/ui/icons/pending.js +5 -0
  238. package/build/ui/icons/pending.js.map +1 -0
  239. package/build/ui/icons/plus.d.ts +2 -0
  240. package/build/ui/icons/plus.js +6 -0
  241. package/build/ui/icons/plus.js.map +1 -0
  242. package/build/ui/icons/qr.d.ts +1 -0
  243. package/build/ui/icons/qr.js +5 -0
  244. package/build/ui/icons/qr.js.map +1 -0
  245. package/build/ui/icons/refresh.d.ts +2 -0
  246. package/build/ui/icons/refresh.js +6 -0
  247. package/build/ui/icons/refresh.js.map +1 -0
  248. package/build/ui/icons/search.d.ts +1 -0
  249. package/build/ui/icons/search.js +5 -0
  250. package/build/ui/icons/search.js.map +1 -0
  251. package/build/ui/icons/switch.d.ts +1 -0
  252. package/build/ui/icons/switch.js +5 -0
  253. package/build/ui/icons/switch.js.map +1 -0
  254. package/build/ui/icons/wallet.d.ts +1 -0
  255. package/build/ui/icons/wallet.js +5 -0
  256. package/build/ui/icons/wallet.js.map +1 -0
  257. package/build/ui/profile/DepositQR.d.ts +9 -0
  258. package/build/ui/profile/DepositQR.js +56 -0
  259. package/build/ui/profile/DepositQR.js.map +1 -0
  260. package/build/ui/profile/Payment.d.ts +23 -0
  261. package/build/ui/profile/Payment.js +150 -0
  262. package/build/ui/profile/Payment.js.map +1 -0
  263. package/build/ui/profile/Profile.d.ts +7 -0
  264. package/build/ui/profile/Profile.js +135 -0
  265. package/build/ui/profile/Profile.js.map +1 -0
  266. package/build/ui/router.d.ts +51 -0
  267. package/build/ui/router.js +68 -0
  268. package/build/ui/router.js.map +1 -0
  269. package/build/ui/styles.d.ts +13 -0
  270. package/build/ui/styles.js +281 -0
  271. package/build/ui/styles.js.map +1 -0
  272. package/build/ui/uikit/Stepper.d.ts +13 -0
  273. package/build/ui/uikit/Stepper.js +22 -0
  274. package/build/ui/uikit/Stepper.js.map +1 -0
  275. package/build/ui/uikit/Toast.d.ts +4 -0
  276. package/build/ui/uikit/Toast.js +33 -0
  277. package/build/ui/uikit/Toast.js.map +1 -0
  278. package/build/ui/uikit/button.d.ts +2 -0
  279. package/build/ui/uikit/button.js +52 -0
  280. package/build/ui/uikit/button.js.map +1 -0
  281. package/build/ui/uikit/image.d.ts +6 -0
  282. package/build/ui/uikit/image.js +38 -0
  283. package/build/ui/uikit/image.js.map +1 -0
  284. package/build/ui/uikit/loader.d.ts +2 -0
  285. package/build/ui/uikit/loader.js +50 -0
  286. package/build/ui/uikit/loader.js.map +1 -0
  287. package/build/ui/uikit/tabs.d.ts +12 -0
  288. package/build/ui/uikit/tabs.js +35 -0
  289. package/build/ui/uikit/tabs.js.map +1 -0
  290. package/build/ui/uikit/text.d.ts +6 -0
  291. package/build/ui/uikit/text.js +59 -0
  292. package/build/ui/uikit/text.js.map +1 -0
  293. package/build/ui/utils.d.ts +1 -0
  294. package/build/ui/utils.js +20 -0
  295. package/build/ui/utils.js.map +1 -0
  296. package/package.json +8 -4
  297. package/src/HotConnector.ts +24 -31
  298. package/src/OmniConnector.ts +10 -9
  299. package/src/OmniWallet.ts +24 -25
  300. package/src/core/Intents.ts +222 -151
  301. package/src/core/api.ts +56 -10
  302. package/src/core/bridge.ts +3 -2
  303. package/src/core/index.ts +1 -1
  304. package/src/core/telemetry.ts +28 -0
  305. package/src/core/token.ts +4 -0
  306. package/src/core/tokens.ts +0 -9
  307. package/src/core/types.ts +21 -0
  308. package/src/core/utils.ts +17 -1
  309. package/src/cosmos/connector.ts +22 -26
  310. package/src/cosmos/wallet.ts +3 -8
  311. package/src/evm/connector.ts +5 -0
  312. package/src/evm/wallet.ts +9 -6
  313. package/src/exchange.ts +24 -30
  314. package/src/hot-wallet/google.ts +12 -5
  315. package/src/hot-wallet/proxy.ts +2 -2
  316. package/src/index.ts +3 -1
  317. package/src/near/connector.ts +2 -2
  318. package/src/{core/nearRpc.ts → near/rpc.ts} +9 -23
  319. package/src/near/wallet.ts +39 -31
  320. package/src/solana/{protocol.ts → WalletStandard.ts} +2 -4
  321. package/src/solana/connector.ts +9 -8
  322. package/src/solana/injected/solana-wallet.ts +6 -6
  323. package/src/solana/wallet.ts +11 -20
  324. package/src/stellar/connector.ts +1 -6
  325. package/src/stellar/wallet.ts +17 -17
  326. package/src/ton/connector.ts +1 -5
  327. package/src/ton/wallet.ts +3 -3
  328. package/src/tron/connector.ts +89 -0
  329. package/src/tron/index.ts +7 -0
  330. package/src/tron/wallet.ts +146 -0
  331. package/src/ui/Popup.tsx +12 -4
  332. package/src/ui/{payment → bridge}/Bridge.tsx +266 -212
  333. package/src/ui/{payment → bridge}/SelectRecipient.tsx +5 -4
  334. package/src/ui/{payment → bridge}/SelectSender.tsx +5 -5
  335. package/src/ui/{payment → bridge}/SelectToken.tsx +6 -4
  336. package/src/ui/bridge/TokenCard.tsx +99 -0
  337. package/src/ui/connect/AuthPopup.tsx +1 -1
  338. package/src/ui/connect/ConnectWallet.tsx +16 -10
  339. package/src/ui/connect/PrimaryWallet.tsx +65 -0
  340. package/src/ui/connect/WCRequest.tsx +1 -1
  341. package/src/ui/connect/WalletPicker.tsx +1 -1
  342. package/src/ui/icons/arrow-right.tsx +3 -4
  343. package/src/ui/icons/close.tsx +1 -1
  344. package/src/ui/icons/exchange.tsx +4 -11
  345. package/src/ui/icons/logout.tsx +4 -13
  346. package/src/ui/icons/pending.tsx +2 -4
  347. package/src/ui/icons/plus.tsx +12 -0
  348. package/src/ui/icons/qr.tsx +1 -2
  349. package/src/ui/icons/refresh.tsx +20 -0
  350. package/src/ui/icons/search.tsx +4 -4
  351. package/src/ui/icons/switch.tsx +4 -4
  352. package/src/ui/icons/wallet.tsx +2 -4
  353. package/src/ui/profile/Payment.tsx +309 -0
  354. package/src/ui/{payment → profile}/Profile.tsx +110 -70
  355. package/src/ui/router.tsx +57 -17
  356. package/src/ui/styles.ts +4 -11
  357. package/src/ui/uikit/Stepper.tsx +50 -0
  358. package/src/ui/uikit/Toast.tsx +45 -0
  359. package/src/ui/uikit/button.tsx +53 -0
  360. package/src/ui/uikit/image.tsx +45 -0
  361. package/src/ui/uikit/loader.tsx +52 -0
  362. package/src/ui/uikit/tabs.tsx +56 -0
  363. package/src/ui/uikit/text.tsx +64 -0
  364. package/src/ui/utils.ts +14 -0
  365. package/src/ui/payment/Payment.tsx +0 -79
  366. package/src/ui/payment/TokenCard.tsx +0 -98
  367. /package/src/solana/{wallets.ts → walletStandartList.ts} +0 -0
  368. /package/src/ui/{payment → profile}/DepositQR.tsx +0 -0
package/src/ui/styles.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import styled, { css } from "styled-components";
2
2
 
3
- const font = `-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"`;
3
+ const font = `Golos Text, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"`;
4
4
 
5
5
  export const ModalContainer = styled.div`
6
6
  position: fixed;
@@ -133,16 +133,6 @@ export const ModalBody = styled.div`
133
133
  transition: background 0.2s ease-in-out;
134
134
  font-family: monospace;
135
135
  }
136
-
137
- p {
138
- color: rgba(255, 255, 255, 0.9);
139
- text-align: center;
140
- font-size: 16px;
141
- font-style: normal;
142
- font-weight: 500;
143
- line-height: normal;
144
- letter-spacing: -0.8px;
145
- }
146
136
  `;
147
137
 
148
138
  export const Footer = styled.div`
@@ -195,6 +185,7 @@ export const PopupOption = styled.button`
195
185
  outline: none;
196
186
  border: none;
197
187
  background: transparent;
188
+ width: 100%;
198
189
  gap: 12px;
199
190
 
200
191
  img {
@@ -263,7 +254,9 @@ export const PopupButton = styled.button`
263
254
  `;
264
255
 
265
256
  export const PopupRoot = styled.div`
257
+ @import url("https://fonts.googleapis.com/css2?family=Golos+Text:wght@400..900&display=swap");
266
258
  height: 100%;
259
+ width: 100%;
267
260
 
268
261
  h1,
269
262
  h2,
@@ -0,0 +1,50 @@
1
+ import React from "react";
2
+
3
+ interface Step {
4
+ label: string;
5
+ completed?: boolean;
6
+ active?: boolean;
7
+ }
8
+
9
+ interface StepperProps {
10
+ steps: Step[];
11
+ currentStep: number;
12
+ style?: React.CSSProperties;
13
+ }
14
+
15
+ export const HorizontalStepper: React.FC<StepperProps> = ({ steps, currentStep, style }) => {
16
+ return (
17
+ <div style={{ padding: "0 32px 32px", display: "flex", alignItems: "center", width: "100%", margin: "16px 0", ...style }}>
18
+ {steps.map((step, idx) => {
19
+ const isCompleted = idx < currentStep;
20
+ const isActive = idx === currentStep;
21
+
22
+ return (
23
+ <React.Fragment key={idx}>
24
+ <div style={{ display: "flex", flexDirection: "column", alignItems: "center" }}>
25
+ <div
26
+ style={{
27
+ width: 16,
28
+ height: 16,
29
+ position: "relative",
30
+ borderRadius: "50%",
31
+ border: isActive || isCompleted ? "2px solid #ffffff" : "2px solid #a0a0a0",
32
+ background: isCompleted ? "#ffffff" : "#333",
33
+ display: "flex",
34
+ alignItems: "center",
35
+ justifyContent: "center",
36
+ transition: "all 0.2s",
37
+ zIndex: 1,
38
+ }}
39
+ >
40
+ <p style={{ fontSize: 16, color: "#fff", opacity: isActive ? 1 : 0.5, position: "absolute", top: 24, width: 100 }}>{step.label}</p>
41
+ </div>
42
+ </div>
43
+
44
+ {idx < steps.length - 1 && <div style={{ transition: "background 0.2s", flex: 1, height: 2, background: idx < currentStep ? "#ffffff" : "#333", margin: "0 6px", borderRadius: 24, minWidth: 24 }} />}
45
+ </React.Fragment>
46
+ );
47
+ })}
48
+ </div>
49
+ );
50
+ };
@@ -0,0 +1,45 @@
1
+ import styled from "styled-components";
2
+ import { Loader } from "./loader";
3
+
4
+ const Toast = ({ message }: { message: string }) => {
5
+ return (
6
+ <ToastRoot>
7
+ <div style={{ width: 44, height: 44, display: "flex", alignItems: "center", justifyContent: "center", borderRadius: 12, background: "rgba(255, 255, 255, 0.07)" }}>
8
+ <Loader />
9
+ </div>
10
+
11
+ <div>
12
+ <p style={{ color: "#ADA5A4" }}>Executing transaction</p>
13
+ <p style={{ marginTop: 2 }}>{message}</p>
14
+ </div>
15
+ </ToastRoot>
16
+ );
17
+ };
18
+
19
+ export default Toast;
20
+
21
+ const ToastRoot = styled.div`
22
+ position: fixed;
23
+ bottom: 48px;
24
+ left: 12px;
25
+ right: 12px;
26
+ background: var(--surface-common-container--low, #262729);
27
+ border: 1px solid var(--border-lowest, rgba(255, 255, 255, 0.07));
28
+ border-radius: 8px;
29
+ padding: 12px;
30
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
31
+ display: flex;
32
+ align-items: center;
33
+ justify-content: space-between;
34
+ z-index: 1000000000;
35
+ width: fit-content;
36
+ padding-right: 24px;
37
+ gap: 12px;
38
+
39
+ p {
40
+ color: var(--text-primary, #fff);
41
+ font-size: 16px;
42
+ font-weight: 500;
43
+ margin: 0;
44
+ }
45
+ `;
@@ -0,0 +1,53 @@
1
+ import styled from "styled-components";
2
+
3
+ export const ActionButton = styled.button`
4
+ display: flex;
5
+ padding: 0 24px;
6
+ border-radius: 12px;
7
+ background: #e7e7e7;
8
+ border: none;
9
+ outline: none;
10
+ cursor: pointer;
11
+ transition: background 0.2s ease-in-out;
12
+ height: 48px;
13
+ min-height: 48px;
14
+ align-items: center;
15
+ justify-content: center;
16
+ flex-shrink: 0;
17
+ gap: 8px;
18
+ flex: 1;
19
+ width: 100%;
20
+
21
+ color: #121212;
22
+ text-align: center;
23
+ font-family: "Golos Text";
24
+ font-size: 16px;
25
+ font-style: normal;
26
+ font-weight: 500;
27
+ line-height: 22px;
28
+ letter-spacing: -0.16px;
29
+
30
+ &:hover {
31
+ background: #d2d2d2;
32
+ }
33
+
34
+ &:disabled {
35
+ background: #3e3e3e;
36
+ color: #828282;
37
+ cursor: not-allowed;
38
+ }
39
+ `;
40
+
41
+ export const Button = styled.button`
42
+ padding: 0;
43
+ margin: 0;
44
+ border: none;
45
+ background: transparent;
46
+ cursor: pointer;
47
+ outline: none;
48
+ transition: 0.2s opacity;
49
+
50
+ &:hover {
51
+ opacity: 0.8;
52
+ }
53
+ `;
@@ -0,0 +1,45 @@
1
+ import { useEffect, useState } from "react";
2
+
3
+ const images = {
4
+ cached: new Map<string, Promise<void>>(),
5
+ cache(url: string): Promise<void> {
6
+ if (this.cached.has(url)) return this.cached.get(url)!;
7
+ const promise = new Promise<void>((resolve, reject) => {
8
+ const img = new Image();
9
+ img.src = url;
10
+ img.onload = () => resolve();
11
+ img.onerror = () => reject(new Error("Failed to load image"));
12
+ });
13
+
14
+ this.cached.set(url, promise);
15
+ return promise;
16
+ },
17
+ };
18
+
19
+ enum ImageState {
20
+ Loading = "loading",
21
+ Loaded = "loaded",
22
+ Error = "error",
23
+ }
24
+
25
+ export const ImageView = ({ src, size = 40, alt, style }: { src: string; size?: number; alt: string; style?: React.CSSProperties }) => {
26
+ const [icon, setIcon] = useState<ImageState>(ImageState.Loading);
27
+
28
+ useEffect(() => {
29
+ setIcon(ImageState.Loading);
30
+ images
31
+ .cache(src)
32
+ .then(() => setIcon(ImageState.Loaded))
33
+ .catch(() => setIcon(ImageState.Error));
34
+ }, [src]);
35
+
36
+ if (icon === ImageState.Loaded) {
37
+ return <img src={src} alt={alt} style={{ objectFit: "contain", width: size, height: size, borderRadius: "50%", ...style }} />;
38
+ }
39
+
40
+ return (
41
+ <div style={{ display: "flex", alignItems: "center", justifyContent: "center", width: size, height: size, borderRadius: "50%", backgroundColor: "#0e0e0e", ...style }}>
42
+ <p style={{ fontWeight: "bold", fontSize: size / 2, color: "#ffffff" }}>{alt.charAt(0)?.toUpperCase()}</p>
43
+ </div>
44
+ );
45
+ };
@@ -0,0 +1,52 @@
1
+ import styled, { keyframes } from "styled-components";
2
+
3
+ export const Loader = styled.div`
4
+ border: 4px solid #2a2a2a;
5
+ border-top: 4px solid #fff;
6
+ border-radius: 50%;
7
+ width: 24px;
8
+ height: 24px;
9
+ animation: spin 0.9s linear infinite;
10
+ margin: 0 auto;
11
+
12
+ @keyframes spin {
13
+ 0% {
14
+ transform: rotate(0deg);
15
+ }
16
+ 100% {
17
+ transform: rotate(360deg);
18
+ }
19
+ }
20
+ `;
21
+
22
+ const shine = keyframes`
23
+ 0% {
24
+ background-position: -200px 0;
25
+ }
26
+ 100% {
27
+ background-position: calc(200px + 100%) 0;
28
+ }
29
+ `;
30
+
31
+ export const Skeleton = styled.div`
32
+ display: inline-block;
33
+ width: 100px;
34
+ height: 40px;
35
+ border-radius: 8px;
36
+ background: #2e2e2e;
37
+ position: relative;
38
+ overflow: hidden;
39
+
40
+ &:after {
41
+ content: "";
42
+ display: block;
43
+ height: 100%;
44
+ width: 100%;
45
+ position: absolute;
46
+ top: 0;
47
+ left: 0;
48
+ background: linear-gradient(90deg, rgba(34, 34, 34, 0) 0%, rgba(255, 255, 255, 0.06) 40%, rgba(255, 255, 255, 0.12) 50%, rgba(255, 255, 255, 0.06) 60%, rgba(34, 34, 34, 0) 100%);
49
+ background-size: 200px 100%;
50
+ animation: ${shine} 1.4s infinite linear;
51
+ }
52
+ `;
@@ -0,0 +1,56 @@
1
+ import styled from "styled-components";
2
+
3
+ interface SegmentedControlProps {
4
+ options: { label: string; value: string; color?: string; background?: string }[];
5
+ value: string;
6
+ onChange: (value: string) => void;
7
+ }
8
+
9
+ const SegmentedControl = ({ options, value, onChange }: SegmentedControlProps) => {
10
+ return (
11
+ <Tabs>
12
+ {options.map((option) => (
13
+ <Tab
14
+ key={option.value}
15
+ onClick={() => onChange(option.value)}
16
+ $active={option.value === value}
17
+ style={{
18
+ background: option.value === value ? option.background || "#1D1F20" : "transparent",
19
+ color: option.value === value ? option.color : "#6b6661",
20
+ }}
21
+ >
22
+ {option.label}
23
+ </Tab>
24
+ ))}
25
+ </Tabs>
26
+ );
27
+ };
28
+
29
+ const Tabs = styled.div`
30
+ display: flex;
31
+ border-radius: 16px;
32
+ border: 1px solid var(--border-lowest-solid, #242627);
33
+ padding: 0;
34
+ flex-shrink: 0;
35
+ height: 40px;
36
+ padding: 2px;
37
+ width: 100%;
38
+ `;
39
+
40
+ const Tab = styled.button<{ $active?: boolean }>`
41
+ display: flex;
42
+ flex-direction: column;
43
+ justify-content: center;
44
+ align-items: center;
45
+ border-radius: 14px;
46
+ height: 100%;
47
+ border: none;
48
+ outline: none;
49
+ cursor: pointer;
50
+ transition: 0.2s background-color;
51
+ flex: 1;
52
+ font-size: 14px;
53
+ font-weight: 500;
54
+ `;
55
+
56
+ export default SegmentedControl;
@@ -0,0 +1,64 @@
1
+ import styled from "styled-components";
2
+
3
+ export const PSmall = styled.p`
4
+ color: var(--text-text-secondary, #bfbfbf);
5
+ font-family: var(--font-family-text, "Golos Text");
6
+ font-size: var(--P-Small-font-size, 14px);
7
+ line-height: var(--P-Small-line-height, 20px); /* 142.857% */
8
+ letter-spacing: -0.14px;
9
+ font-style: normal;
10
+ font-weight: 400;
11
+ margin: 0;
12
+ `;
13
+
14
+ export const PMedium = styled.p`
15
+ color: var(--text-text-primary, #fff);
16
+ font-family: var(--font-family-text, "Golos Text");
17
+ font-size: var(--P-Default-font-size, 16px);
18
+ line-height: var(--P-Default-line-height, 22px); /* 137.5% */
19
+ letter-spacing: -0.16px;
20
+ font-style: normal;
21
+ margin: 0;
22
+ `;
23
+
24
+ export const PLarge = styled.p`
25
+ color: var(--text-text-primary, #fff);
26
+ font-family: var(--font-family-text, "Golos Text");
27
+ font-size: var(--P-Large-font-size, 18px);
28
+ line-height: var(--P-Large-line-height, 24px); /* 133.333% */
29
+ font-style: normal;
30
+ font-weight: 500;
31
+ letter-spacing: -0.18px;
32
+ margin: 0;
33
+ `;
34
+
35
+ export const PTiny = styled.p`
36
+ color: var(--text-text-primary, #fff);
37
+ font-family: var(--font-family-text, "Golos Text");
38
+ font-size: var(--P-Tiny-font-size, 12px);
39
+ line-height: var(--P-Tiny-line-height, 16px);
40
+ letter-spacing: -0.12px;
41
+ font-style: normal;
42
+ font-weight: 400;
43
+ margin: 0;
44
+ `;
45
+
46
+ export const H5 = styled.h5`
47
+ color: var(--text-text-tertiary, #fff);
48
+ font-family: var(--font-family-headings, "Golos Text");
49
+ font-size: var(--h5-font-size, 24px);
50
+ line-height: var(--h5-line-height, 32px);
51
+ font-style: normal;
52
+ font-weight: 500;
53
+ margin: 0;
54
+ `;
55
+
56
+ export const H4 = styled.h4`
57
+ color: var(--text-text-primary, #fff);
58
+ font-family: var(--font-family-headings, "Golos Text");
59
+ font-size: var(--h4-font-size, 32px);
60
+ line-height: var(--h4-line-height, 44px);
61
+ font-style: normal;
62
+ font-weight: 600;
63
+ margin: 0;
64
+ `;
@@ -0,0 +1,14 @@
1
+ import { NetworkError, TimeoutNetworkError } from "../core/api";
2
+
3
+ export const serializeError = (error: any): string => {
4
+ try {
5
+ if (error instanceof Error) return error.message;
6
+ if (error instanceof NetworkError) return error.toString();
7
+ if (error instanceof TimeoutNetworkError) return error.toString();
8
+ if (typeof error === "object" && Object.keys(error).length > 0) return JSON.stringify(error);
9
+ if (typeof error === "string" || typeof error === "number") return error.toString();
10
+ return "";
11
+ } catch (error) {
12
+ return "Unknown error";
13
+ }
14
+ };
@@ -1,79 +0,0 @@
1
- import { observer } from "mobx-react-lite";
2
- import { useEffect } from "react";
3
-
4
- import { HotConnector } from "../../HotConnector";
5
- import { openBridge, openConnector } from "../router";
6
- import { Recipient } from "../../core/recipient";
7
- import { BridgeReview } from "../../exchange";
8
- import { OmniWallet } from "../../OmniWallet";
9
- import { Network } from "../../core/chains";
10
- import { Token } from "../../core/token";
11
- import Popup from "../Popup";
12
-
13
- import { TokenCard } from "./TokenCard";
14
- import { PopupOption, PopupOptionInfo } from "../styles";
15
- import { WalletIcon } from "../icons/wallet";
16
-
17
- interface PaymentProps {
18
- connector: HotConnector;
19
- token: Token;
20
- amount: bigint;
21
- recipient?: Recipient;
22
- onClose: () => void;
23
- onProcess: (task: Promise<BridgeReview>) => void;
24
- }
25
-
26
- export const Payment = observer(({ connector, recipient, token: need, amount: needAmount, onProcess, onClose }: PaymentProps) => {
27
- const title = `Need ${need.readable(needAmount)} ${need.symbol}`;
28
- const selectToken = async (from: Token, wallet?: OmniWallet) => {
29
- onProcess(
30
- openBridge(connector, {
31
- sender: wallet,
32
- autoClose: true,
33
- type: "exactOut",
34
- recipient: recipient || Recipient.fromWallet(connector.priorityWallet!),
35
- readonlyTo: recipient ? true : false,
36
- amount: need.float(needAmount),
37
- readonlyAmount: true,
38
- title: title,
39
- from: from,
40
- to: need,
41
- })
42
- );
43
- };
44
-
45
- useEffect(() => {
46
- if (connector.wallets.length !== 0) return;
47
- openConnector(connector);
48
- }, [connector.wallets.length, connector]);
49
-
50
- return (
51
- <Popup onClose={onClose} header={<p>{title}</p>}>
52
- {connector.walletsTokens.map(({ token, wallet, balance }) => {
53
- if (token.id === need.id) return null;
54
- const availableBalance = token.float(balance) - token.reserve;
55
-
56
- if (need.originalChain === Network.Gonka || need.originalChain === Network.Juno) {
57
- if (token.id === need.id) return null;
58
- if (token.originalAddress !== need.originalAddress) return null;
59
-
60
- if (availableBalance < need.float(needAmount)) return null;
61
- return <TokenCard key={token.id} token={token} onSelect={selectToken} hot={connector} wallet={wallet} />;
62
- }
63
-
64
- if (availableBalance * token.usd <= need.usd * need.float(needAmount)) return null;
65
- return <TokenCard key={token.id} token={token} onSelect={selectToken} hot={connector} wallet={wallet} />;
66
- })}
67
-
68
- <PopupOption onClick={() => openConnector(connector)}>
69
- <div style={{ width: 44, height: 44, borderRadius: 16, background: "#000", display: "flex", alignItems: "center", justifyContent: "center" }}>
70
- <WalletIcon />
71
- </div>
72
- <PopupOptionInfo>
73
- <p>Connect wallet</p>
74
- <span className="wallet-address">To more pay options</span>
75
- </PopupOptionInfo>
76
- </PopupOption>
77
- </Popup>
78
- );
79
- });
@@ -1,98 +0,0 @@
1
- import { observer } from "mobx-react-lite";
2
- import { useEffect, useState } from "react";
3
- import styled from "styled-components";
4
-
5
- import { chains } from "../../core/chains";
6
- import { formatter } from "../../core/utils";
7
- import { Token } from "../../core/token";
8
-
9
- import { HotConnector } from "../../HotConnector";
10
- import { OmniWallet } from "../../OmniWallet";
11
- import { PopupOption } from "../styles";
12
-
13
- const images = {
14
- cached: new Map<string, Promise<void>>(),
15
- cache(url: string): Promise<void> {
16
- if (this.cached.has(url)) return this.cached.get(url)!;
17
- const promise = new Promise<void>((resolve, reject) => {
18
- const img = new Image();
19
- img.src = url;
20
- img.onload = () => resolve();
21
- img.onerror = () => reject(new Error("Failed to load image"));
22
- });
23
-
24
- this.cached.set(url, promise);
25
- return promise;
26
- },
27
- };
28
-
29
- enum ImageState {
30
- Loading = "loading",
31
- Loaded = "loaded",
32
- Error = "error",
33
- }
34
-
35
- export const ImageView = ({ src, size = 40, alt, style }: { src: string; size?: number; alt: string; style?: React.CSSProperties }) => {
36
- const [icon, setIcon] = useState<ImageState>(ImageState.Loading);
37
- useEffect(() => {
38
- setIcon(ImageState.Loading);
39
- images
40
- .cache(src)
41
- .then(() => setIcon(ImageState.Loaded))
42
- .catch(() => setIcon(ImageState.Error));
43
- }, [src]);
44
-
45
- if (icon === ImageState.Loaded) {
46
- return <img src={src} alt={alt} style={{ objectFit: "contain", width: size, height: size, borderRadius: "50%", ...style }} />;
47
- }
48
-
49
- return (
50
- <div style={{ display: "flex", alignItems: "center", justifyContent: "center", width: size, height: size, borderRadius: "50%", backgroundColor: "#0e0e0e", ...style }}>
51
- <p style={{ fontWeight: "bold", fontSize: size / 2, color: "#ffffff" }}>{alt.charAt(0)?.toUpperCase()}</p>
52
- </div>
53
- );
54
- };
55
-
56
- export const TokenIcon = observer(({ token, wallet }: { token: Token; wallet?: OmniWallet }) => {
57
- return (
58
- <div style={{ position: "relative", width: 40, height: 40 }}>
59
- <ImageView src={token.icon} alt={token.symbol} size={40} />
60
- <ImageView src={token.chainIcon} alt={token.symbol} size={14} style={{ position: "absolute", bottom: 0, right: 0 }} />
61
- {token.chain === -4 && wallet?.type && <ImageView src={wallet.icon} alt={chains.get(wallet.type)?.name || ""} size={14} style={{ position: "absolute", bottom: 0, left: 0 }} />}
62
- </div>
63
- );
64
- });
65
-
66
- export const TokenCard = observer(({ token, onSelect, hot, wallet }: { token: Token; onSelect: (token: Token, wallet?: OmniWallet) => void; hot: HotConnector; wallet?: OmniWallet }) => {
67
- const balance = hot.balance(wallet, token);
68
- const symbol = token.chain === -4 && !token.isMainOmni ? `${token.originalChainSymbol}_${token.symbol}` : token.symbol;
69
-
70
- return (
71
- <PopupOption key={token.id} onClick={() => onSelect(token, wallet)}>
72
- <TokenIcon token={token} wallet={wallet} />
73
-
74
- <TokenWrap style={{ marginTop: -2, textAlign: "left" }}>
75
- <p style={{ textAlign: "left", fontSize: 20, fontWeight: "bold" }}>{symbol}</p>
76
- <p style={{ textAlign: "left", fontSize: 14, color: "#c6c6c6" }}>${formatter.amount(token.usd)}</p>
77
- </TokenWrap>
78
-
79
- <TokenWrap style={{ paddingRight: 4, marginLeft: "auto", alignItems: "flex-end" }}>
80
- <p style={{ textAlign: "right", fontSize: 20 }}>{token.readable(balance)}</p>
81
- <p style={{ textAlign: "right", fontSize: 14, color: "#c6c6c6" }}>${token.readable(balance, token.usd)}</p>
82
- </TokenWrap>
83
- </PopupOption>
84
- );
85
- });
86
-
87
- const TokenWrap = styled.div`
88
- display: flex;
89
- flex-direction: column;
90
- gap: 4px;
91
-
92
- &,
93
- p {
94
- white-space: nowrap;
95
- overflow: hidden;
96
- text-overflow: ellipsis;
97
- }
98
- `;
File without changes