@hot-labs/kit 1.1.2 → 1.2.0-alpha.1

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 (322) hide show
  1. package/README.md +9 -2
  2. package/package.json +4 -8
  3. package/src/HotConnector.ts +31 -21
  4. package/src/OmniConnector.ts +9 -10
  5. package/src/OmniWallet.ts +25 -24
  6. package/src/core/Intents.ts +151 -222
  7. package/src/core/api.ts +4 -37
  8. package/src/core/bridge.ts +2 -3
  9. package/src/core/index.ts +1 -1
  10. package/src/{near/rpc.ts → core/nearRpc.ts} +11 -4
  11. package/src/core/types.ts +0 -21
  12. package/src/core/utils.ts +1 -17
  13. package/src/cosmos/connector.ts +26 -22
  14. package/src/cosmos/wallet.ts +8 -3
  15. package/src/evm/connector.ts +0 -5
  16. package/src/evm/wallet.ts +6 -9
  17. package/src/exchange.ts +30 -24
  18. package/src/hot-wallet/google.ts +5 -12
  19. package/src/index.ts +0 -2
  20. package/src/near/connector.ts +2 -2
  21. package/src/near/wallet.ts +9 -4
  22. package/src/solana/connector.ts +8 -9
  23. package/src/solana/injected/solana-wallet.ts +6 -6
  24. package/src/solana/{WalletStandard.ts → protocol.ts} +4 -2
  25. package/src/solana/wallet.ts +20 -11
  26. package/src/stellar/connector.ts +6 -1
  27. package/src/stellar/wallet.ts +17 -17
  28. package/src/ton/connector.ts +5 -1
  29. package/src/ton/wallet.ts +3 -3
  30. package/src/ui/Popup.tsx +4 -12
  31. package/src/ui/connect/AuthPopup.tsx +1 -2
  32. package/src/ui/connect/ConnectWallet.tsx +6 -12
  33. package/src/ui/icons/arrow-right.tsx +2 -2
  34. package/src/ui/icons/close.tsx +1 -1
  35. package/src/ui/icons/exchange.tsx +4 -4
  36. package/src/ui/icons/logout.tsx +6 -6
  37. package/src/ui/icons/pending.tsx +4 -2
  38. package/src/ui/icons/qr.tsx +2 -1
  39. package/src/ui/icons/search.tsx +4 -4
  40. package/src/ui/icons/switch.tsx +4 -4
  41. package/src/ui/icons/wallet.tsx +4 -2
  42. package/src/ui/payment/Bridge.tsx +6 -25
  43. package/src/ui/payment/Payment.tsx +46 -241
  44. package/src/ui/payment/Profile.tsx +8 -10
  45. package/src/ui/payment/SelectToken.tsx +1 -1
  46. package/src/ui/payment/TokenCard.tsx +18 -22
  47. package/src/ui/router.tsx +16 -56
  48. package/src/ui/styles.ts +0 -2
  49. package/build/HotConnector.d.ts +0 -103
  50. package/build/HotConnector.js +0 -300
  51. package/build/HotConnector.js.map +0 -1
  52. package/build/OmniConnector.d.ts +0 -90
  53. package/build/OmniConnector.js +0 -121
  54. package/build/OmniConnector.js.map +0 -1
  55. package/build/OmniWallet.d.ts +0 -35
  56. package/build/OmniWallet.js +0 -56
  57. package/build/OmniWallet.js.map +0 -1
  58. package/build/activity.d.ts +0 -18
  59. package/build/activity.js +0 -87
  60. package/build/activity.js.map +0 -1
  61. package/build/core/Intents.d.ts +0 -100
  62. package/build/core/Intents.js +0 -472
  63. package/build/core/Intents.js.map +0 -1
  64. package/build/core/api.d.ts +0 -48
  65. package/build/core/api.js +0 -93
  66. package/build/core/api.js.map +0 -1
  67. package/build/core/bridge.d.ts +0 -3
  68. package/build/core/bridge.js +0 -36
  69. package/build/core/bridge.js.map +0 -1
  70. package/build/core/chains.d.ts +0 -115
  71. package/build/core/chains.js +0 -381
  72. package/build/core/chains.js.map +0 -1
  73. package/build/core/defaultTokens.d.ts +0 -17
  74. package/build/core/defaultTokens.js +0 -1079
  75. package/build/core/defaultTokens.js.map +0 -1
  76. package/build/core/events.d.ts +0 -42
  77. package/build/core/events.js +0 -64
  78. package/build/core/events.js.map +0 -1
  79. package/build/core/index.d.ts +0 -10
  80. package/build/core/index.js +0 -11
  81. package/build/core/index.js.map +0 -1
  82. package/build/core/recipient.d.ts +0 -10
  83. package/build/core/recipient.js +0 -40
  84. package/build/core/recipient.js.map +0 -1
  85. package/build/core/token.d.ts +0 -36
  86. package/build/core/token.js +0 -103
  87. package/build/core/token.js.map +0 -1
  88. package/build/core/tokens.d.ts +0 -14
  89. package/build/core/tokens.js +0 -59
  90. package/build/core/tokens.js.map +0 -1
  91. package/build/core/types.d.ts +0 -60
  92. package/build/core/types.js +0 -2
  93. package/build/core/types.js.map +0 -1
  94. package/build/core/utils.d.ts +0 -25
  95. package/build/core/utils.js +0 -170
  96. package/build/core/utils.js.map +0 -1
  97. package/build/cosmos/connector.d.ts +0 -36
  98. package/build/cosmos/connector.js +0 -211
  99. package/build/cosmos/connector.js.map +0 -1
  100. package/build/cosmos/helpers.d.ts +0 -2
  101. package/build/cosmos/helpers.js +0 -29
  102. package/build/cosmos/helpers.js.map +0 -1
  103. package/build/cosmos/index.d.ts +0 -6
  104. package/build/cosmos/index.js +0 -5
  105. package/build/cosmos/index.js.map +0 -1
  106. package/build/cosmos/wallet.d.ts +0 -26
  107. package/build/cosmos/wallet.js +0 -51
  108. package/build/cosmos/wallet.js.map +0 -1
  109. package/build/defaults.d.ts +0 -1
  110. package/build/defaults.js +0 -7
  111. package/build/defaults.js.map +0 -1
  112. package/build/evm/abi.d.ts +0 -17
  113. package/build/evm/abi.js +0 -38
  114. package/build/evm/abi.js.map +0 -1
  115. package/build/evm/connector.d.ts +0 -29
  116. package/build/evm/connector.js +0 -118
  117. package/build/evm/connector.js.map +0 -1
  118. package/build/evm/index.d.ts +0 -6
  119. package/build/evm/index.js +0 -5
  120. package/build/evm/index.js.map +0 -1
  121. package/build/evm/injected.d.ts +0 -1
  122. package/build/evm/injected.js +0 -33
  123. package/build/evm/injected.js.map +0 -1
  124. package/build/evm/wallet.d.ts +0 -42
  125. package/build/evm/wallet.js +0 -130
  126. package/build/evm/wallet.js.map +0 -1
  127. package/build/exchange.d.ts +0 -68
  128. package/build/exchange.js +0 -384
  129. package/build/exchange.js.map +0 -1
  130. package/build/hot-wallet/google.d.ts +0 -25
  131. package/build/hot-wallet/google.js +0 -117
  132. package/build/hot-wallet/google.js.map +0 -1
  133. package/build/hot-wallet/iframe.d.ts +0 -36
  134. package/build/hot-wallet/iframe.js +0 -140
  135. package/build/hot-wallet/iframe.js.map +0 -1
  136. package/build/hot-wallet/index.d.ts +0 -5
  137. package/build/hot-wallet/index.js +0 -4
  138. package/build/hot-wallet/index.js.map +0 -1
  139. package/build/hot-wallet/proxy.d.ts +0 -8
  140. package/build/hot-wallet/proxy.js +0 -45
  141. package/build/hot-wallet/proxy.js.map +0 -1
  142. package/build/index.d.ts +0 -6
  143. package/build/index.js +0 -7
  144. package/build/index.js.map +0 -1
  145. package/build/near/connector.d.ts +0 -18
  146. package/build/near/connector.js +0 -58
  147. package/build/near/connector.js.map +0 -1
  148. package/build/near/index.d.ts +0 -7
  149. package/build/near/index.js +0 -5
  150. package/build/near/index.js.map +0 -1
  151. package/build/near/rpc.d.ts +0 -23
  152. package/build/near/rpc.js +0 -161
  153. package/build/near/rpc.js.map +0 -1
  154. package/build/near/wallet.d.ts +0 -53
  155. package/build/near/wallet.js +0 -190
  156. package/build/near/wallet.js.map +0 -1
  157. package/build/solana/WalletStandard.d.ts +0 -25
  158. package/build/solana/WalletStandard.js +0 -56
  159. package/build/solana/WalletStandard.js.map +0 -1
  160. package/build/solana/connector.d.ts +0 -30
  161. package/build/solana/connector.js +0 -139
  162. package/build/solana/connector.js.map +0 -1
  163. package/build/solana/index.d.ts +0 -6
  164. package/build/solana/index.js +0 -5
  165. package/build/solana/index.js.map +0 -1
  166. package/build/solana/injected/account.d.ts +0 -11
  167. package/build/solana/injected/account.js +0 -41
  168. package/build/solana/injected/account.js.map +0 -1
  169. package/build/solana/injected/index.d.ts +0 -1
  170. package/build/solana/injected/index.js +0 -82
  171. package/build/solana/injected/index.js.map +0 -1
  172. package/build/solana/injected/register.d.ts +0 -2
  173. package/build/solana/injected/register.js +0 -41
  174. package/build/solana/injected/register.js.map +0 -1
  175. package/build/solana/injected/solana-wallet.d.ts +0 -34
  176. package/build/solana/injected/solana-wallet.js +0 -223
  177. package/build/solana/injected/solana-wallet.js.map +0 -1
  178. package/build/solana/injected/utils.d.ts +0 -32
  179. package/build/solana/injected/utils.js +0 -36
  180. package/build/solana/injected/utils.js.map +0 -1
  181. package/build/solana/wallet.d.ts +0 -40
  182. package/build/solana/wallet.js +0 -181
  183. package/build/solana/wallet.js.map +0 -1
  184. package/build/solana/walletStandartList.d.ts +0 -102
  185. package/build/solana/walletStandartList.js +0 -150
  186. package/build/solana/walletStandartList.js.map +0 -1
  187. package/build/stellar/connector.d.ts +0 -29
  188. package/build/stellar/connector.js +0 -64
  189. package/build/stellar/connector.js.map +0 -1
  190. package/build/stellar/freigher.d.ts +0 -46
  191. package/build/stellar/freigher.js +0 -110
  192. package/build/stellar/freigher.js.map +0 -1
  193. package/build/stellar/hotWallet.d.ts +0 -33
  194. package/build/stellar/hotWallet.js +0 -28
  195. package/build/stellar/hotWallet.js.map +0 -1
  196. package/build/stellar/index.d.ts +0 -6
  197. package/build/stellar/index.js +0 -5
  198. package/build/stellar/index.js.map +0 -1
  199. package/build/stellar/wallet.d.ts +0 -67
  200. package/build/stellar/wallet.js +0 -212
  201. package/build/stellar/wallet.js.map +0 -1
  202. package/build/storage.d.ts +0 -10
  203. package/build/storage.js +0 -12
  204. package/build/storage.js.map +0 -1
  205. package/build/ton/connector.d.ts +0 -24
  206. package/build/ton/connector.js +0 -111
  207. package/build/ton/connector.js.map +0 -1
  208. package/build/ton/index.d.ts +0 -7
  209. package/build/ton/index.js +0 -5
  210. package/build/ton/index.js.map +0 -1
  211. package/build/ton/injected.d.ts +0 -1
  212. package/build/ton/injected.js +0 -49
  213. package/build/ton/injected.js.map +0 -1
  214. package/build/ton/utils.d.ts +0 -45
  215. package/build/ton/utils.js +0 -63
  216. package/build/ton/utils.js.map +0 -1
  217. package/build/ton/wallet.d.ts +0 -54
  218. package/build/ton/wallet.js +0 -138
  219. package/build/ton/wallet.js.map +0 -1
  220. package/build/tron/connector.d.ts +0 -51
  221. package/build/tron/connector.js +0 -65
  222. package/build/tron/connector.js.map +0 -1
  223. package/build/tron/index.d.ts +0 -6
  224. package/build/tron/index.js +0 -5
  225. package/build/tron/index.js.map +0 -1
  226. package/build/tron/wallet.d.ts +0 -52
  227. package/build/tron/wallet.js +0 -122
  228. package/build/tron/wallet.js.map +0 -1
  229. package/build/ui/Popup.d.ts +0 -12
  230. package/build/ui/Popup.js +0 -43
  231. package/build/ui/Popup.js.map +0 -1
  232. package/build/ui/Toast.d.ts +0 -4
  233. package/build/ui/Toast.js +0 -33
  234. package/build/ui/Toast.js.map +0 -1
  235. package/build/ui/connect/AuthPopup.d.ts +0 -2
  236. package/build/ui/connect/AuthPopup.js +0 -48
  237. package/build/ui/connect/AuthPopup.js.map +0 -1
  238. package/build/ui/connect/ConnectWallet.d.ts +0 -14
  239. package/build/ui/connect/ConnectWallet.js +0 -22
  240. package/build/ui/connect/ConnectWallet.js.map +0 -1
  241. package/build/ui/connect/LogoutPopup.d.ts +0 -10
  242. package/build/ui/connect/LogoutPopup.js +0 -8
  243. package/build/ui/connect/LogoutPopup.js.map +0 -1
  244. package/build/ui/connect/PrimaryWallet.d.ts +0 -6
  245. package/build/ui/connect/PrimaryWallet.js +0 -18
  246. package/build/ui/connect/PrimaryWallet.js.map +0 -1
  247. package/build/ui/connect/WCPopup.d.ts +0 -13
  248. package/build/ui/connect/WCPopup.js +0 -81
  249. package/build/ui/connect/WCPopup.js.map +0 -1
  250. package/build/ui/connect/WCRequest.d.ts +0 -9
  251. package/build/ui/connect/WCRequest.js +0 -13
  252. package/build/ui/connect/WCRequest.js.map +0 -1
  253. package/build/ui/connect/WalletPicker.d.ts +0 -11
  254. package/build/ui/connect/WalletPicker.js +0 -48
  255. package/build/ui/connect/WalletPicker.js.map +0 -1
  256. package/build/ui/icons/arrow-right.d.ts +0 -1
  257. package/build/ui/icons/arrow-right.js +0 -5
  258. package/build/ui/icons/arrow-right.js.map +0 -1
  259. package/build/ui/icons/close.d.ts +0 -1
  260. package/build/ui/icons/close.js +0 -5
  261. package/build/ui/icons/close.js.map +0 -1
  262. package/build/ui/icons/exchange.d.ts +0 -6
  263. package/build/ui/icons/exchange.js +0 -6
  264. package/build/ui/icons/exchange.js.map +0 -1
  265. package/build/ui/icons/logout.d.ts +0 -1
  266. package/build/ui/icons/logout.js +0 -3
  267. package/build/ui/icons/logout.js.map +0 -1
  268. package/build/ui/icons/pending.d.ts +0 -1
  269. package/build/ui/icons/pending.js +0 -5
  270. package/build/ui/icons/pending.js.map +0 -1
  271. package/build/ui/icons/qr.d.ts +0 -1
  272. package/build/ui/icons/qr.js +0 -5
  273. package/build/ui/icons/qr.js.map +0 -1
  274. package/build/ui/icons/search.d.ts +0 -1
  275. package/build/ui/icons/search.js +0 -5
  276. package/build/ui/icons/search.js.map +0 -1
  277. package/build/ui/icons/switch.d.ts +0 -1
  278. package/build/ui/icons/switch.js +0 -5
  279. package/build/ui/icons/switch.js.map +0 -1
  280. package/build/ui/icons/wallet.d.ts +0 -1
  281. package/build/ui/icons/wallet.js +0 -5
  282. package/build/ui/icons/wallet.js.map +0 -1
  283. package/build/ui/payment/Bridge.d.ts +0 -29
  284. package/build/ui/payment/Bridge.js +0 -373
  285. package/build/ui/payment/Bridge.js.map +0 -1
  286. package/build/ui/payment/DepositQR.d.ts +0 -9
  287. package/build/ui/payment/DepositQR.js +0 -56
  288. package/build/ui/payment/DepositQR.js.map +0 -1
  289. package/build/ui/payment/Payment.d.ts +0 -23
  290. package/build/ui/payment/Payment.js +0 -136
  291. package/build/ui/payment/Payment.js.map +0 -1
  292. package/build/ui/payment/Profile.d.ts +0 -8
  293. package/build/ui/payment/Profile.js +0 -110
  294. package/build/ui/payment/Profile.js.map +0 -1
  295. package/build/ui/payment/SelectRecipient.d.ts +0 -14
  296. package/build/ui/payment/SelectRecipient.js +0 -68
  297. package/build/ui/payment/SelectRecipient.js.map +0 -1
  298. package/build/ui/payment/SelectSender.d.ts +0 -13
  299. package/build/ui/payment/SelectSender.js +0 -23
  300. package/build/ui/payment/SelectSender.js.map +0 -1
  301. package/build/ui/payment/SelectToken.d.ts +0 -13
  302. package/build/ui/payment/SelectToken.js +0 -92
  303. package/build/ui/payment/SelectToken.js.map +0 -1
  304. package/build/ui/payment/Stepper.d.ts +0 -13
  305. package/build/ui/payment/Stepper.js +0 -22
  306. package/build/ui/payment/Stepper.js.map +0 -1
  307. package/build/ui/payment/TokenCard.d.ts +0 -25
  308. package/build/ui/payment/TokenCard.js +0 -63
  309. package/build/ui/payment/TokenCard.js.map +0 -1
  310. package/build/ui/router.d.ts +0 -51
  311. package/build/ui/router.js +0 -68
  312. package/build/ui/router.js.map +0 -1
  313. package/build/ui/styles.d.ts +0 -13
  314. package/build/ui/styles.js +0 -290
  315. package/build/ui/styles.js.map +0 -1
  316. package/src/tron/connector.ts +0 -89
  317. package/src/tron/index.ts +0 -7
  318. package/src/tron/wallet.ts +0 -146
  319. package/src/ui/Toast.tsx +0 -45
  320. package/src/ui/connect/PrimaryWallet.tsx +0 -65
  321. package/src/ui/payment/Stepper.tsx +0 -50
  322. /package/src/solana/{walletStandartList.ts → wallets.ts} +0 -0
@@ -14,6 +14,7 @@ import {
14
14
  } from "@solana/spl-token";
15
15
 
16
16
  import { Network, WalletType } from "../core/chains";
17
+ import { OmniConnector } from "../OmniConnector";
17
18
  import { OmniWallet } from "../OmniWallet";
18
19
 
19
20
  import { Token } from "../core/token";
@@ -22,14 +23,13 @@ import { ReviewFee } from "../core/bridge";
22
23
  import { Commitment } from "../core";
23
24
  import { api } from "../core/api";
24
25
 
25
- import { ISolanaProtocolWallet } from "./WalletStandard";
26
+ import { ISolanaProtocolWallet } from "./protocol";
26
27
 
27
28
  class SolanaWallet extends OmniWallet {
28
- readonly icon = "https://storage.herewallet.app/upload/8700f33153ad813e133e5bf9b791b5ecbeea66edca6b8d17aeccb8048eb29ef7.png";
29
29
  readonly type = WalletType.SOLANA;
30
30
 
31
- constructor(readonly wallet: ISolanaProtocolWallet) {
32
- super();
31
+ constructor(readonly connector: OmniConnector, readonly wallet: ISolanaProtocolWallet) {
32
+ super(connector);
33
33
  }
34
34
 
35
35
  getConnection() {
@@ -63,7 +63,12 @@ class SolanaWallet extends OmniWallet {
63
63
  return BigInt(meta.value.amount);
64
64
  }
65
65
 
66
- async buildTranferInstructions(token: Token, amount: bigint, receiver: string, fee: ReviewFee) {
66
+ async disconnect() {
67
+ await this.wallet.disconnect?.();
68
+ super.disconnect();
69
+ }
70
+
71
+ async buildTranferInstructions(token: Token, amount: bigint, receiver: string, fee?: ReviewFee) {
67
72
  const destination = new PublicKey(receiver);
68
73
  const owner = new PublicKey(this.address);
69
74
  const connection = this.getConnection();
@@ -76,10 +81,10 @@ class SolanaWallet extends OmniWallet {
76
81
  reserve,
77
82
  additionalFee,
78
83
  instructions: [
79
- ComputeBudgetProgram.setComputeUnitPrice({ microLamports: Number(fee.priorityFee) }),
80
- ComputeBudgetProgram.setComputeUnitLimit({ units: Number(fee.gasLimit) }),
84
+ fee ? ComputeBudgetProgram.setComputeUnitPrice({ microLamports: Number(fee.priorityFee) }) : undefined,
85
+ fee ? ComputeBudgetProgram.setComputeUnitLimit({ units: Number(fee.gasLimit) }) : undefined,
81
86
  SystemProgram.transfer({ fromPubkey: owner, toPubkey: destination, lamports: amount }),
82
- ],
87
+ ].filter(Boolean) as TransactionInstruction[],
83
88
  };
84
89
  }
85
90
 
@@ -90,7 +95,11 @@ class SolanaWallet extends OmniWallet {
90
95
  const tokenFrom = getAssociatedTokenAddressSync(mint, owner, false, tokenProgramId);
91
96
  const tokenTo = getAssociatedTokenAddressSync(mint, destination, false, tokenProgramId);
92
97
 
93
- const instructions: TransactionInstruction[] = [ComputeBudgetProgram.setComputeUnitPrice({ microLamports: Number(fee.baseFee) }), ComputeBudgetProgram.setComputeUnitLimit({ units: Number(fee.gasLimit) })];
98
+ const instructions: TransactionInstruction[] = [];
99
+ if (fee) {
100
+ instructions.push(ComputeBudgetProgram.setComputeUnitPrice({ microLamports: Number(fee.baseFee) }));
101
+ instructions.push(ComputeBudgetProgram.setComputeUnitLimit({ units: Number(fee.gasLimit) }));
102
+ }
94
103
 
95
104
  const isRegistered = await getAccount(connection, tokenTo, "confirmed", tokenProgramId).catch(() => null);
96
105
  if (isRegistered == null) {
@@ -147,7 +156,7 @@ class SolanaWallet extends OmniWallet {
147
156
  }
148
157
 
149
158
  async getPriorityFeeEstimate(params: any): Promise<any> {
150
- const response = await fetch(api.baseUrl + "/api/v1/evm/helius/staked", {
159
+ const response = await fetch("https://api0.herewallet.app/api/v1/evm/helius/staked", {
151
160
  body: JSON.stringify({ jsonrpc: "2.0", id: "helius-sdk", method: "getPriorityFeeEstimate", params: [params] }),
152
161
  headers: { "Content-Type": "application/json" },
153
162
  method: "POST",
@@ -160,7 +169,7 @@ class SolanaWallet extends OmniWallet {
160
169
  return result;
161
170
  }
162
171
 
163
- async transfer(args: { token: Token; receiver: string; amount: bigint; comment?: string; gasFee: ReviewFee }): Promise<string> {
172
+ async transfer(args: { token: Token; receiver: string; amount: bigint; comment?: string; gasFee?: ReviewFee }): Promise<string> {
164
173
  const { instructions } = await this.buildTranferInstructions(args.token, args.amount, args.receiver, args.gasFee);
165
174
  return await this.sendTransaction(instructions);
166
175
  }
@@ -4,6 +4,7 @@ import HOT from "../hot-wallet/iframe";
4
4
  import { WalletType } from "../core/chains";
5
5
  import { HotConnector } from "../HotConnector";
6
6
  import { ConnectorType, OmniConnector } from "../OmniConnector";
7
+ import { OmniWallet } from "../OmniWallet";
7
8
 
8
9
  import { FreighterModule } from "./freigher";
9
10
  import { HotWalletModule } from "./hotWallet";
@@ -44,6 +45,10 @@ class StellarConnector extends OmniConnector<StellarWallet> {
44
45
  return Object.values(this.modules).find((module) => module.productId === id) || null;
45
46
  }
46
47
 
48
+ async createWallet(address: string): Promise<OmniWallet> {
49
+ return new StellarWallet(this, { address });
50
+ }
51
+
47
52
  async getConnectedWallet() {
48
53
  if (HOT.isInjected) {
49
54
  const { address } = await this.modules.hotWallet.getAddress();
@@ -56,7 +61,7 @@ class StellarConnector extends OmniConnector<StellarWallet> {
56
61
  async selectWallet(address: string, wallet: HotWalletModule | FreighterModule) {
57
62
  const signMessage = async (message: string) => wallet.signMessage(message);
58
63
  const signTransaction = async (transaction: Transaction) => wallet.signTransaction(transaction.toXDR());
59
- return this.setWallet(new StellarWallet({ address, rpc: this.wibe3.hotBridge.stellar, signMessage, signTransaction }));
64
+ return this.setWallet(new StellarWallet(this, { address, signMessage, signTransaction }));
60
65
  }
61
66
 
62
67
  async connect(id: string) {
@@ -4,6 +4,7 @@ import { rpc } from "@stellar/stellar-sdk";
4
4
 
5
5
  import { WalletType } from "../core/chains";
6
6
  import { OmniWallet } from "../OmniWallet";
7
+ import { OmniConnector } from "../OmniConnector";
7
8
  import { ReviewFee } from "../core/bridge";
8
9
  import { formatter } from "../core/utils";
9
10
  import { Network } from "../core/chains";
@@ -11,13 +12,9 @@ import { Token } from "../core/token";
11
12
  import { Commitment } from "../core";
12
13
 
13
14
  interface ProtocolWallet {
14
- address: string;
15
15
  signTransaction?: (transaction: Transaction) => Promise<{ signedTxXdr: string }>;
16
16
  signMessage?: (message: string) => Promise<{ signedMessage: string }>;
17
- rpc: {
18
- callSoroban: (callback: (s: any) => Promise<any>) => Promise<any>;
19
- callHorizon: (callback: (h: any) => Promise<any>) => Promise<any>;
20
- };
17
+ address: string;
21
18
  }
22
19
 
23
20
  export const ACCOUNT_FOR_SIMULATE = "GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7";
@@ -31,11 +28,14 @@ export enum ASSET_CONTRACT_METHOD {
31
28
  }
32
29
 
33
30
  class StellarWallet extends OmniWallet {
34
- readonly icon = "https://storage.herewallet.app/upload/1469894e53ca248ac6adceb2194e6950a13a52d972beb378a20bce7815ba01a4.png";
35
31
  readonly type = WalletType.STELLAR;
36
32
 
37
- constructor(readonly wallet: ProtocolWallet) {
38
- super();
33
+ constructor(readonly connector: OmniConnector, readonly wallet: ProtocolWallet) {
34
+ super(connector);
35
+ }
36
+
37
+ get rpc() {
38
+ return this.connector.wibe3.hotBridge.stellar;
39
39
  }
40
40
 
41
41
  get address() {
@@ -86,8 +86,8 @@ class StellarWallet extends OmniWallet {
86
86
  const asset = await this.getAssetFromContractId(token);
87
87
  const sendAmount = formatter.formatAmount(amount, 7);
88
88
 
89
- const account = await this.wallet.rpc.callSoroban((s) => s.getAccount(this.address));
90
- const baseFee = await this.wallet.rpc.callHorizon((h) => h.fetchBaseFee()).catch(() => +BASE_FEE);
89
+ const account = await this.connector.wibe3.hotBridge.stellar.callSoroban((s) => s.getAccount(this.address));
90
+ const baseFee = await this.connector.wibe3.hotBridge.stellar.callHorizon((h) => h.fetchBaseFee()).catch(() => +BASE_FEE);
91
91
  const builder = new TransactionBuilder(account, {
92
92
  memo: memo ? Memo.text(memo) : undefined,
93
93
  networkPassphrase: Networks.PUBLIC,
@@ -106,13 +106,13 @@ class StellarWallet extends OmniWallet {
106
106
  )
107
107
  );
108
108
 
109
- const tx = await this.wallet.rpc.callSoroban((s) => s.prepareTransaction(builder.build() as any));
109
+ const tx = await this.rpc.callSoroban((s) => s.prepareTransaction(builder.build() as any));
110
110
  const fee = BigInt(Math.floor(baseFee * tx.operations.length));
111
111
  return { fee: new ReviewFee({ baseFee: fee, priorityFee: 0n, gasLimit: 1n, chain: Network.Stellar }), tx: tx as unknown as Transaction };
112
112
  }
113
113
 
114
114
  let needXlm = 0;
115
- const receiverAccount = await this.wallet.rpc.callHorizon((h) => h.loadAccount(receiver)).catch(() => null);
115
+ const receiverAccount = await this.rpc.callHorizon((h) => h.loadAccount(receiver)).catch(() => null);
116
116
  const claimableBalance = Operation.createClaimableBalance({ amount: amount.toString(), claimants: [new Claimant(receiver)], asset });
117
117
 
118
118
  if (receiverAccount == null) {
@@ -154,7 +154,7 @@ class StellarWallet extends OmniWallet {
154
154
  if (!this.wallet.signTransaction) throw "not impl";
155
155
  const result = await this.wallet.signTransaction(transaction);
156
156
  const txObject = new Transaction(result.signedTxXdr, Networks.PUBLIC);
157
- const { hash } = await this.wallet.rpc.callHorizon((t) => t.submitTransaction(txObject as any));
157
+ const { hash } = await this.rpc.callHorizon((t) => t.submitTransaction(txObject as any));
158
158
  return hash;
159
159
  }
160
160
 
@@ -197,7 +197,7 @@ class StellarWallet extends OmniWallet {
197
197
  async changeTrustline(address: string) {
198
198
  if (address === "native") return;
199
199
  const asset = await this.getAssetFromContractId(address);
200
- const account = await this.wallet.rpc.callHorizon((h) => h.loadAccount(this.address));
200
+ const account = await this.rpc.callHorizon((h) => h.loadAccount(this.address));
201
201
  const trustlineOp = Operation.changeTrust({ asset: asset, source: this.address });
202
202
  const trustlineTx = new TransactionBuilder(account, { fee: BASE_FEE, networkPassphrase: Networks.PUBLIC }) //
203
203
  .addOperation(trustlineOp)
@@ -215,7 +215,7 @@ class StellarWallet extends OmniWallet {
215
215
  }
216
216
 
217
217
  const tx = await this.buildSmartContactTx(ACCOUNT_FOR_SIMULATE, id, ASSET_CONTRACT_METHOD.NAME);
218
- const result = (await this.wallet.rpc.callSoroban((s) => s.simulateTransaction(tx as any))) as unknown as rpc.Api.SimulateTransactionSuccessResponse;
218
+ const result = (await this.rpc.callSoroban((s) => s.simulateTransaction(tx as any))) as unknown as rpc.Api.SimulateTransactionSuccessResponse;
219
219
 
220
220
  const value = result?.result?.retval?.value();
221
221
  if (!value) throw "Asset not found";
@@ -227,7 +227,7 @@ class StellarWallet extends OmniWallet {
227
227
  }
228
228
 
229
229
  async buildSmartContactTx(publicKey: string, contactId: string, method: string, ...args: any[]) {
230
- const account = await this.wallet.rpc.callSoroban((s) => s.getAccount(publicKey));
230
+ const account = await this.rpc.callSoroban((s) => s.getAccount(publicKey));
231
231
  const contract = new Contract(contactId);
232
232
  const builtTx = new TransactionBuilder(account, { fee: BASE_FEE, networkPassphrase: Networks.PUBLIC });
233
233
 
@@ -244,7 +244,7 @@ class StellarWallet extends OmniWallet {
244
244
  Address.fromString(contract).toScVal()
245
245
  );
246
246
 
247
- const result = (await this.wallet.rpc.callSoroban((s) => s.simulateTransaction(tx as any))) as unknown as rpc.Api.SimulateTransactionSuccessResponse;
247
+ const result = (await this.rpc.callSoroban((s) => s.simulateTransaction(tx as any))) as unknown as rpc.Api.SimulateTransactionSuccessResponse;
248
248
  if (result) return BigInt(this.i128ToInt(result.result?.retval.value() as xdr.Int128Parts));
249
249
  return 0n;
250
250
  }
@@ -69,7 +69,7 @@ class TonConnector extends OmniConnector<TonWallet> {
69
69
  tonConnect.onStatusChange(async (wallet) => {
70
70
  if (!wallet) return this.removeWallet();
71
71
  this.setWallet(
72
- new TonWallet({
72
+ new TonWallet(this, {
73
73
  sendTransaction: (params) => tonConnect.sendTransaction(params),
74
74
  signData: (params) => tonConnect.signData(params),
75
75
  account: wallet.account,
@@ -108,6 +108,10 @@ class TonConnector extends OmniConnector<TonWallet> {
108
108
  return tonConnect;
109
109
  }
110
110
 
111
+ async createWallet(address: string) {
112
+ return new TonWallet(this, { account: { address } });
113
+ }
114
+
111
115
  async connect(id: string) {
112
116
  const connector = await this.tonConnect;
113
117
  connector.openSingleWalletModal(id);
package/src/ton/wallet.ts CHANGED
@@ -6,6 +6,7 @@ import { base58, base64, hex } from "@scure/base";
6
6
 
7
7
  import { OmniWallet } from "../OmniWallet";
8
8
  import { WalletType } from "../core/chains";
9
+ import { OmniConnector } from "../OmniConnector";
9
10
  import { ReviewFee } from "../core/bridge";
10
11
  import { Token } from "../core/token";
11
12
 
@@ -18,11 +19,10 @@ interface ProtocolWallet {
18
19
  }
19
20
 
20
21
  class TonWallet extends OmniWallet {
21
- readonly icon = "https://storage.herewallet.app/upload/3ffa61e237f8e38d390abd60200db8edff3ec2b20aad0cc0a8c7a8ba9c318124.png";
22
22
  readonly type = WalletType.TON;
23
23
 
24
- constructor(readonly wallet: ProtocolWallet) {
25
- super();
24
+ constructor(readonly connector: OmniConnector, readonly wallet: ProtocolWallet) {
25
+ super(connector);
26
26
  }
27
27
 
28
28
  get address() {
package/src/ui/Popup.tsx CHANGED
@@ -16,18 +16,13 @@ export const present = (render: (close: () => void) => React.ReactNode) => {
16
16
  div.remove();
17
17
  })
18
18
  );
19
-
20
- return () => {
21
- root.unmount();
22
- div.remove();
23
- };
24
19
  };
25
20
 
26
21
  interface PopupProps {
27
22
  widget?: boolean;
28
23
  children: React.ReactNode;
29
24
  header?: React.ReactNode;
30
- onClose?: () => void;
25
+ onClose: () => void;
31
26
  style?: React.CSSProperties;
32
27
  mobileFullscreen?: boolean;
33
28
  }
@@ -62,12 +57,9 @@ const Popup = ({ widget, children, header, onClose, style, mobileFullscreen }: P
62
57
  <ModalContent ref={contentRef} $mobileFullscreen={mobileFullscreen} style={{ opacity: 0, transform: "translateY(20px)", transition: "all 0.2s ease-in-out" }}>
63
58
  {header && (
64
59
  <ModalHeader>
65
- {onClose != null && (
66
- <button onClick={onClose} style={{ position: "absolute", right: 16, top: 16 }}>
67
- <CloseIcon />
68
- </button>
69
- )}
70
-
60
+ <button onClick={onClose} style={{ position: "absolute", right: 16, top: 16 }}>
61
+ <CloseIcon />
62
+ </button>
71
63
  {header}
72
64
  </ModalHeader>
73
65
  )}
@@ -2,7 +2,6 @@ import React, { useState } from "react";
2
2
  import { OmniWallet } from "../../OmniWallet";
3
3
  import Popup, { present } from "../Popup";
4
4
  import { PopupButton } from "../styles";
5
- import { chains } from "../../core";
6
5
 
7
6
  interface AuthIntentPopupProps {
8
7
  wallet: OmniWallet;
@@ -35,7 +34,7 @@ const AuthIntentPopupComponent: React.FC<AuthIntentPopupProps> = ({ wallet, onAp
35
34
  };
36
35
 
37
36
  return (
38
- <Popup header={<p>Authorize wallet</p>} onClose={onReject}>
37
+ <Popup header={<p>Authorize {wallet.connector?.name}</p>} onClose={onReject}>
39
38
  <p style={{ textAlign: "center", color: "#fff" }}>To verify your account, you need to sign a message, this action is safe, the platform does not have access to your assets.</p>
40
39
  <PopupButton
41
40
  disabled={loading}
@@ -1,11 +1,8 @@
1
1
  import { observer } from "mobx-react-lite";
2
2
 
3
- import { OmniWallet } from "../../OmniWallet";
4
3
  import { HotConnector } from "../../HotConnector";
5
4
  import { ConnectorType, OmniConnector } from "../../OmniConnector";
6
-
7
5
  import { formatter } from "../../core/utils";
8
- import { WalletType } from "../../core";
9
6
 
10
7
  import { ImageView } from "../payment/TokenCard";
11
8
  import { PopupOption, PopupOptionInfo } from "../styles";
@@ -15,24 +12,21 @@ import Popup from "../Popup";
15
12
 
16
13
  interface MultichainPopupProps {
17
14
  hot: HotConnector;
18
- onClose: (wallet?: OmniWallet) => void;
19
- title?: string;
20
- walletType?: WalletType;
21
- widget?: boolean;
15
+ onClose: () => void;
22
16
  }
23
17
 
24
- export const Connector = observer(({ hot, onClose, title, walletType, widget }: MultichainPopupProps) => {
25
- const onechain = hot.connectors.filter((t) => t.type === ConnectorType.WALLET && (walletType == null || t.walletTypes.includes(walletType as WalletType)));
26
- const social = hot.connectors.filter((t) => t.type === ConnectorType.SOCIAL && (walletType == null || t.walletTypes.includes(walletType as WalletType)));
18
+ export const Connector = observer(({ hot, onClose }: MultichainPopupProps) => {
19
+ const onechain = hot.connectors.filter((t) => t.type === ConnectorType.WALLET);
20
+ const social = hot.connectors.filter((t) => t.type === ConnectorType.SOCIAL);
27
21
 
28
22
  const selectConnector = async (t: OmniConnector) => {
29
23
  if (t.wallets[0]) return t.disconnect();
30
- if (t.options.length > 0) return openWalletPicker(t, (w) => onClose(w));
24
+ if (t.options.length > 0) return [openWalletPicker(t), onClose()];
31
25
  await t.connect().finally(() => onClose());
32
26
  };
33
27
 
34
28
  return (
35
- <Popup header={<p>{title || "Select network"}</p>} onClose={onClose} widget={widget}>
29
+ <Popup header={<p>Select network</p>} onClose={onClose}>
36
30
  {onechain.map((t) => (
37
31
  <PopupOption key={t.id} onClick={() => selectConnector(t)}>
38
32
  <ImageView src={t.icon} alt={t.name} size={44} />
@@ -1,8 +1,8 @@
1
1
  export const ArrowRightIcon = (props: React.SVGProps<SVGSVGElement>) => {
2
2
  return (
3
3
  <svg xmlns="http://www.w3.org/2000/svg" width={24} height={24} viewBox="0 0 16 16" fill="none" {...props}>
4
- <path d="M10.6667 8C10.1282 8 6.66669 8.56 6.66669 12.6667" stroke="#eaeaea" strokeWidth="1.2" strokeLinecap="round" />
5
- <path d="M10.6667 8.00001C10.1282 8.00001 6.66669 7.44001 6.66669 3.33334" stroke="#eaeaea" strokeWidth="1.2" strokeLinecap="round" />
4
+ <path d="M10.6667 8C10.1282 8 6.66669 8.56 6.66669 12.6667" stroke="#eaeaea" stroke-width="1.2" stroke-linecap="round" />
5
+ <path d="M10.6667 8.00001C10.1282 8.00001 6.66669 7.44001 6.66669 3.33334" stroke="#eaeaea" stroke-width="1.2" stroke-linecap="round" />
6
6
  </svg>
7
7
  );
8
8
  };
@@ -1,7 +1,7 @@
1
1
  export const CloseIcon = (props: React.SVGProps<SVGSVGElement>) => {
2
2
  return (
3
3
  <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
4
- <path d="M5 19L19 5M5 5L19 19" stroke="#dddddd" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round" />
4
+ <path d="M5 19L19 5M5 5L19 19" stroke="#dddddd" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" />
5
5
  </svg>
6
6
  );
7
7
  };
@@ -1,12 +1,12 @@
1
1
  const ExchangeIcon = ({ size, color, strokeColor }: { size?: number; color?: string; strokeColor?: string }) => {
2
2
  return (
3
3
  <svg width={size} height={size} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
4
- <path fillRule="evenodd" clipRule="evenodd" d="M14 3.5H9C5.41015 3.5 2.5 6.41015 2.5 10V14C2.5 17.5899 5.41015 20.5 9 20.5H14C17.5899 20.5 20.5 17.5899 20.5 14V10C20.5 6.41015 17.5899 3.5 14 3.5Z" fill={color} />
4
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M14 3.5H9C5.41015 3.5 2.5 6.41015 2.5 10V14C2.5 17.5899 5.41015 20.5 9 20.5H14C17.5899 20.5 20.5 17.5899 20.5 14V10C20.5 6.41015 17.5899 3.5 14 3.5Z" fill={color} />
5
5
  <path d="M9 3.5H14C17.5899 3.5 20.5 6.41015 20.5 10V14C20.5 17.5899 17.5899 20.5 14 20.5H9C5.41015 20.5 2.5 17.5899 2.5 14V10C2.5 6.41015 5.41015 3.5 9 3.5Z" fill={color} />
6
- <path d="M9 2.75H15C19.0041 2.75 22.25 5.99594 22.25 10V15C22.25 19.0041 19.0041 22.25 15 22.25H9C4.99594 22.25 1.75 19.0041 1.75 15V10C1.75 5.99594 4.99594 2.75 9 2.75Z" stroke={strokeColor} strokeWidth="1.5" />
6
+ <path d="M9 2.75H15C19.0041 2.75 22.25 5.99594 22.25 10V15C22.25 19.0041 19.0041 22.25 15 22.25H9C4.99594 22.25 1.75 19.0041 1.75 15V10C1.75 5.99594 4.99594 2.75 9 2.75Z" stroke={strokeColor} stroke-width="1.5" />
7
7
  <path
8
- fillRule="evenodd"
9
- clipRule="evenodd"
8
+ fill-rule="evenodd"
9
+ clip-rule="evenodd"
10
10
  d="M14 3.5H9C5.41015 3.5 2.5 6.41015 2.5 10V14C2.5 17.5899 5.41015 20.5 9 20.5H14C17.5899 20.5 20.5 17.5899 20.5 14V10C20.5 6.41015 17.5899 3.5 14 3.5ZM9 2C4.58172 2 1 5.58172 1 10V14C1 18.4183 4.58172 22 9 22H14C18.4183 22 22 18.4183 22 14V10C22 5.58172 18.4183 2 14 2H9ZM9.43398 6.25678C9.84444 6.31237 10.1321 6.69018 10.0765 7.10064C9.88688 8.5013 9.31567 9.52614 8.588 10.25H18C18.4142 10.25 18.75 10.5858 18.75 11C18.75 11.4142 18.4142 11.75 18 11.75H5C4.58579 11.75 4.25 11.4142 4.25 11C4.25 10.5858 4.58579 10.25 5 10.25C5.50127 10.25 6.3231 10.0848 7.05272 9.58232C7.75624 9.09779 8.40283 8.28236 8.59012 6.89936C8.6457 6.48889 9.02351 6.2012 9.43398 6.25678ZM12.9235 17.8994C12.8679 18.3098 13.1556 18.6876 13.566 18.7432C13.9765 18.7988 14.3543 18.5111 14.4099 18.1006C14.5972 16.7176 15.2438 15.9022 15.9473 15.4177C16.6769 14.9152 17.4987 14.75 18 14.75C18.4142 14.75 18.75 14.4142 18.75 14C18.75 13.5858 18.4142 13.25 18 13.25H5C4.58579 13.25 4.25 13.5858 4.25 14C4.25 14.4142 4.58579 14.75 5 14.75H14.412C13.6843 15.4739 13.1131 16.4987 12.9235 17.8994Z"
11
11
  fill={strokeColor}
12
12
  />
@@ -3,16 +3,16 @@ export const LogoutIcon = (props: React.SVGProps<SVGSVGElement>) => (
3
3
  <path
4
4
  d="M7.125 4.12506V3.12506C7.125 2.71085 6.78921 2.37506 6.375 2.37506H2.625C2.21079 2.37506 1.875 2.71085 1.875 3.12506V8.94997C1.875 9.36418 2.21079 9.69997 2.625 9.69997H6.375C6.78921 9.69997 7.125 9.36418 7.125 8.94997V8.62506"
5
5
  stroke="#b8b8b8"
6
- strokeWidth="0.75"
7
- strokeLinecap="round"
8
- strokeLinejoin="round"
6
+ stroke-width="0.75"
7
+ stroke-linecap="round"
8
+ stroke-linejoin="round"
9
9
  />
10
10
  <path
11
- fillRule="evenodd"
12
- clipRule="evenodd"
11
+ fill-rule="evenodd"
12
+ clip-rule="evenodd"
13
13
  d="M2.625 2.00006C2.00368 2.00006 1.5 2.50374 1.5 3.12506V8.62506C1.5 9.24638 2.00368 9.75006 2.625 9.75006H6.125C6.6513 9.75006 7.09319 9.38866 7.21604 8.90049C7.21979 8.89938 7.22349 8.89811 7.22714 8.89665C7.43737 8.81297 7.62507 8.62509 7.37504 8.12509C7.28246 7.9399 7.18987 7.8576 7.10907 7.83207C7.04492 7.78075 6.96354 7.75006 6.875 7.75006C6.66789 7.75006 6.5 7.91795 6.5 8.12506V8.62506C6.5 8.83217 6.33211 9.00006 6.125 9.00006H2.625C2.41789 9.00006 2.25 8.83217 2.25 8.62506V3.12506C2.25 2.91795 2.41789 2.75006 2.625 2.75006H6.125C6.33211 2.75006 6.5 2.91795 6.5 3.12506V3.62506C6.5 3.64361 6.50135 3.66184 6.50395 3.67966C6.50066 3.78168 6.54545 3.90373 6.58628 4.015C6.60039 4.05343 6.61402 4.09059 6.62504 4.12518C6.7401 4.4039 7.12503 4.62518 7.16669 4.40389C7.29825 4.362 7.33697 4.11473 7.25318 3.85161C7.24388 3.8224 7.23346 3.79422 7.2221 3.76726C7.24008 3.72341 7.25 3.67539 7.25 3.62506V3.12506C7.25 2.50374 6.74632 2.00006 6.125 2.00006H2.625Z"
14
14
  fill="#b8b8b8"
15
15
  />
16
- <path d="M4.62499 6L10.1383 6M10.1383 6C9.4301 5.99403 8.10413 6.45886 8.37868 7.5M10.1383 6C9.46912 6.03371 8.18027 5.6316 8.37868 4.5" stroke="#b8b8b8" strokeWidth="0.75" strokeLinecap="round" strokeLinejoin="round" />
16
+ <path d="M4.62499 6L10.1383 6M10.1383 6C9.4301 5.99403 8.10413 6.45886 8.37868 7.5M10.1383 6C9.46912 6.03371 8.18027 5.6316 8.37868 4.5" stroke="#b8b8b8" stroke-width="0.75" stroke-linecap="round" stroke-linejoin="round" />
17
17
  </svg>
18
18
  );
@@ -2,12 +2,14 @@ export const PendingIcon = (props: React.SVGProps<SVGSVGElement>) => {
2
2
  return (
3
3
  <svg xmlns="http://www.w3.org/2000/svg" width="11" height="11" viewBox="0 0 11 11" fill="none" {...props}>
4
4
  <path
5
- clipRule="evenodd"
5
+ fill-rule="evenodd"
6
+ clip-rule="evenodd"
6
7
  d="M5.00001 2.49994C5.20712 2.49994 5.37501 2.66783 5.37501 2.87494V5.3534C5.37501 5.61658 5.28274 5.87143 5.11426 6.07361L4.03809 7.36501C3.90551 7.52411 3.66904 7.54561 3.50994 7.41302C3.35084 7.28044 3.32934 7.04397 3.46193 6.88487L4.53809 5.59347C4.59425 5.52608 4.62501 5.44113 4.62501 5.3534V2.87494C4.62501 2.66783 4.7929 2.49994 5.00001 2.49994Z"
7
8
  fill="#2C3034"
8
9
  />
9
10
  <path
10
- clipRule="evenodd"
11
+ fill-rule="evenodd"
12
+ clip-rule="evenodd"
11
13
  d="M2.11248 8.11847C2.87055 8.82074 3.88514 9.25 5 9.25C7.34721 9.25 9.25 7.34721 9.25 5C9.25 3.88514 8.82073 2.87054 8.11847 2.11248C7.21578 1.26718 6.08279 0.75 5 0.75C2.65279 0.75 0.75 2.65279 0.75 5C0.75 6.08279 1.26718 7.21578 2.11248 8.11847ZM10.5 5.5C10.5 8.26142 8.26142 10.5 5.5 10.5C4.0598 10.5 2.62582 9.75509 1.58332 8.65054C0.608904 7.73817 0 6.4402 0 5C0 2.23858 2.23858 0 5 0C6.44019 0 7.73817 0.608903 8.65054 1.58331C9.75509 2.62582 10.5 4.0598 10.5 5.5Z"
12
14
  fill="#2C3034"
13
15
  />
@@ -2,7 +2,8 @@ export const QRIcon = (props: any) => {
2
2
  return (
3
3
  <svg xmlns="http://www.w3.org/2000/svg" width={24} height={24} viewBox="0 0 12 12" fill="none" {...props}>
4
4
  <path
5
- clipRule="evenodd"
5
+ fill-rule="evenodd"
6
+ clip-rule="evenodd"
6
7
  d="M1.75412 1.95569C1.93703 1.68471 2.21228 1.5 2.55882 1.5H2.69118H5.47059L5.73529 1.92507V5.60294H2.02941L1.5 5.20588V2.82353V2.69118C1.5 2.4136 1.59494 2.15821 1.75412 1.95569ZM2.82353 2.42647C2.60424 2.42647 2.42647 2.60424 2.42647 2.82353V4.41176H4.67647V2.42647H2.82353ZM6.26468 1.5H6.26474H9.04409H9.17651C9.83438 1.5 10.5 2.16566 10.5 2.82353V5.60294H10.103H6.6618L6.26474 5.20588H6.26468V1.5ZM9.44115 2.69118C9.44115 2.59011 9.40339 2.49786 9.3412 2.42777C9.33054 2.42691 9.31975 2.42647 9.30886 2.42647H7.32357V4.41176H9.44115V2.69118ZM5.20588 6.26477L5.20598 6.26487H5.33824L5.73529 6.66193V9.94274V10.3678H2.82353C2.16566 10.3678 1.5 9.70215 1.5 9.04428V8.77948V6.26487V6.26477H5.20588ZM2.5758 9.15951C2.61231 9.17058 2.65105 9.17654 2.69118 9.17654H4.67647V7.05899H2.55882V9.04428C2.55882 9.08435 2.56476 9.12304 2.5758 9.15951ZM6.26468 6.26477H8.38233V7.32359H6.52938L6.26468 7.05889V6.26477ZM9.44121 7.32359H10.5V6.52948L10.2353 6.26477H9.44119V7.32349H8.38239V8.38231H9.44121V7.32359ZM7.3235 8.38239H6.26468V9.44121V10.2353L6.49183 10.3702H7.3235V9.44121H8.38233V8.38239H7.3235ZM10.2353 8.38239L10.5 8.64709V9.44121V9.61103C10.5 10.0252 10.1642 10.361 9.75003 10.361H8.62347L8.38239 10.2353V9.44121H9.44121V8.38239H10.2353Z"
7
8
  fill="#ececec"
8
9
  />
@@ -4,15 +4,15 @@ export const SearchIcon = (props: React.SVGProps<SVGSVGElement>) => {
4
4
  <path
5
5
  d="M5 1.875C5.81162 1.875 6.65905 2.2748 7.30957 2.91699C7.95937 3.55852 8.375 4.40467 8.375 5.25C8.375 7.01349 7.19019 8.375 5.5 8.375C3.44557 8.37499 1.875 6.71455 1.875 5C1.875 3.27411 3.27411 1.875 5 1.875Z"
6
6
  stroke="#2C3034"
7
- strokeWidth="0.75"
7
+ stroke-width="0.75"
8
8
  />
9
9
  <path
10
- fillRule="evenodd"
11
- clipRule="evenodd"
10
+ fill-rule="evenodd"
11
+ clip-rule="evenodd"
12
12
  d="M5 7.75C6.51878 7.75 7.75 6.51878 7.75 5C7.75 3.48122 6.51878 2.25 5 2.25C3.48122 2.25 2.25 3.48122 2.25 5C2.25 6.51878 3.48122 7.75 5 7.75ZM5 8.5C6.933 8.5 8.5 6.933 8.5 5C8.5 3.067 6.933 1.5 5 1.5C3.067 1.5 1.5 3.067 1.5 5C1.5 6.933 3.067 8.5 5 8.5Z"
13
13
  fill="#2C3034"
14
14
  />
15
- <path d="M7.25 7.25006L10.25 10.2501" stroke="#2C3034" strokeWidth="0.75" strokeLinecap="round" />
15
+ <path d="M7.25 7.25006L10.25 10.2501" stroke="#2C3034" stroke-width="0.75" stroke-linecap="round" />
16
16
  </svg>
17
17
  );
18
18
  };
@@ -1,10 +1,10 @@
1
1
  export const SwitchIcon = (props: React.SVGProps<SVGSVGElement>) => {
2
2
  return (
3
3
  <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
4
- <path d="M10 4L10 19" stroke="#EBDEDC" strokeWidth="2" strokeLinecap="round" />
5
- <path d="M14 19L14 4" stroke="#EBDEDC" strokeWidth="2" strokeLinecap="round" />
6
- <path d="M10 19C10 18.3269 9.52 14 6 14" stroke="#EBDEDC" strokeWidth="2" stroke-linecap="round" />
7
- <path d="M14 4C14 4.67308 14.48 9 18 9" stroke="#EBDEDC" strokeWidth="2" stroke-linecap="round" />
4
+ <path d="M10 4L10 19" stroke="#EBDEDC" stroke-width="2" stroke-linecap="round" />
5
+ <path d="M14 19L14 4" stroke="#EBDEDC" stroke-width="2" stroke-linecap="round" />
6
+ <path d="M10 19C10 18.3269 9.52 14 6 14" stroke="#EBDEDC" stroke-width="2" stroke-linecap="round" />
7
+ <path d="M14 4C14 4.67308 14.48 9 18 9" stroke="#EBDEDC" stroke-width="2" stroke-linecap="round" />
8
8
  </svg>
9
9
  );
10
10
  };
@@ -2,12 +2,14 @@ export const WalletIcon = (props: React.SVGProps<SVGSVGElement>) => {
2
2
  return (
3
3
  <svg xmlns="http://www.w3.org/2000/svg" width={24} height={24} viewBox="0 0 12 12" fill="none" {...props}>
4
4
  <path
5
- clipRule="evenodd"
5
+ fill-rule="evenodd"
6
+ clip-rule="evenodd"
6
7
  d="M2.25 1.125C1.62868 1.125 1.125 1.62868 1.125 2.25V3.25V10C1.125 10.6213 1.62868 11.125 2.25 11.125H9.75C10.3713 11.125 10.875 10.6213 10.875 10V8.5C10.875 8.47885 10.8732 8.4581 10.8699 8.43791C11.3095 8.28493 11.625 7.86688 11.625 7.37512V6.66092C11.625 6.24411 11.2859 5.86414 10.875 5.65915V4C10.875 3.37868 10.3713 2.875 9.75 2.875H9.625V2.25C9.625 1.62868 9.12132 1.125 8.5 1.125H2.25ZM10.2206 6.25012C10.2893 6.32677 10.389 6.375 10.5 6.375C10.5051 6.375 10.5103 6.3749 10.5154 6.37469C10.6967 6.51463 10.875 6.73984 10.875 6.87512V7.37512C10.875 7.58223 10.7071 7.75012 10.5 7.75012H9.00003C8.65485 7.75012 8.25003 7.4703 8.25003 7.12512C8.25003 6.77994 8.65485 6.25012 9.00003 6.25012H10.2206ZM10.125 5.52513V4C10.125 3.79289 9.95711 3.625 9.75 3.625H9.25H1.875V10C1.875 10.2071 2.04289 10.375 2.25 10.375H9.75C9.95711 10.375 10.125 10.2071 10.125 10V8.5C10.125 8.47904 10.1267 8.45848 10.13 8.43845L9.00003 8.25012C8.24064 8.25012 7.75003 7.88451 7.75003 7.12512C7.75003 6.36573 8.24064 5.75012 9.00003 5.75012L10.125 5.52513ZM8.875 2.875H1.875V2.25C1.875 2.04289 2.04289 1.875 2.25 1.875H8.5C8.70711 1.875 8.875 2.04289 8.875 2.25V2.875Z"
7
8
  fill="#ececec"
8
9
  />
9
10
  <path
10
- clipRule="evenodd"
11
+ fill-rule="evenodd"
12
+ clip-rule="evenodd"
11
13
  d="M2.25 1.125C1.62868 1.125 1.125 1.62868 1.125 2.25V3.25V9.5C1.125 10.1213 1.62868 10.625 2.25 10.625H9.25C9.87132 10.625 10.375 10.1213 10.375 9.5V8.36813C10.9375 8.30594 11.375 7.82906 11.375 7.25V6.75C11.375 6.17094 10.9375 5.69406 10.375 5.63187V4C10.375 3.37868 9.87132 2.875 9.25 2.875H9.125V2.25C9.125 1.62868 8.62132 1.125 8 1.125H2.25ZM9.625 5.625V4C9.625 3.79289 9.45711 3.625 9.25 3.625H8.75H1.875V9.5C1.875 9.70711 2.04289 9.875 2.25 9.875H9.25C9.45711 9.875 9.625 9.70711 9.625 9.5V8.375H8.99997C8.24058 8.375 7.62497 7.75939 7.62497 7C7.62497 6.24061 8.24058 5.625 8.99997 5.625H9.625ZM10 7.625H10.25C10.4571 7.625 10.625 7.45711 10.625 7.25V6.75C10.625 6.54289 10.4571 6.375 10.25 6.375H10H8.99997C8.65479 6.375 8.37497 6.65482 8.37497 7C8.37497 7.34518 8.65479 7.625 8.99997 7.625H10ZM8.375 2.875H1.875V2.25C1.875 2.04289 2.04289 1.875 2.25 1.875H8C8.20711 1.875 8.375 2.04289 8.375 2.25V2.875Z"
12
14
  fill="#ececec"
13
15
  />
@@ -21,12 +21,6 @@ import { openSelectRecipient, openSelectTokenPopup, openSelectSender } from "../
21
21
  import { TokenIcon } from "./TokenCard";
22
22
  import DepositQR from "./DepositQR";
23
23
 
24
- const animations = {
25
- success: "https://hex.exchange/success.json",
26
- failed: "https://hex.exchange/error.json",
27
- loading: "https://hex.exchange/loading.json",
28
- };
29
-
30
24
  export interface BridgeProps {
31
25
  hot: HotConnector;
32
26
  widget?: boolean;
@@ -54,7 +48,7 @@ const FIXED = 6;
54
48
  export const Bridge = observer(({ hot, widget, setup, onClose, onProcess, onSelectPair }: BridgeProps) => {
55
49
  const [isFiat, setIsFiat] = useState(false);
56
50
  const [type, setType] = useState<"exactIn" | "exactOut">(setup?.type || "exactIn");
57
- const [value, setValue] = useState<string>(setup?.amount?.toFixed(6) ?? "");
51
+ const [value, setValue] = useState<string>(setup?.amount?.toString() ?? "");
58
52
  const [from, setFrom] = useState<Token>(setup?.from || tokens.list.find((t) => t.id === localStorage.getItem("bridge:from")) || tokens.list.find((t) => t.symbol === "NEAR")!);
59
53
  const [to, setTo] = useState<Token>(setup?.to || tokens.list.find((t) => t.id === localStorage.getItem("bridge:to")) || tokens.list.find((t) => t.symbol === "USDT")!);
60
54
 
@@ -62,12 +56,6 @@ export const Bridge = observer(({ hot, widget, setup, onClose, onProcess, onSele
62
56
  const [isError, setIsError] = useState<string | null>(null);
63
57
  const [isReviewing, setIsReviewing] = useState(false);
64
58
 
65
- useState(() => {
66
- fetch(animations.loading);
67
- fetch(animations.success);
68
- fetch(animations.failed);
69
- });
70
-
71
59
  const [processing, setProcessing] = useState<{
72
60
  status: "qr" | "processing" | "success" | "error";
73
61
  resolve?: (value: BridgeReview) => void;
@@ -182,16 +170,9 @@ export const Bridge = observer(({ hot, widget, setup, onClose, onProcess, onSele
182
170
  log("Signing transaction");
183
171
 
184
172
  const result = await hot.exchange.makeSwap(review, { log });
185
- let resultReview = result.review;
186
-
187
- if (result.processing) {
188
- log("Waiting for transaction to be confirmed");
189
- resultReview = await result.processing();
190
- }
191
-
192
- setProcessing({ status: "success", message: "Transaction signed", review: resultReview });
173
+ setProcessing({ status: "success", message: "Transaction signed", review: result });
193
174
  if (setup?.autoClose) onClose();
194
- return resultReview;
175
+ return result;
195
176
  } catch (e) {
196
177
  setProcessing({ status: "error", message: e?.toString?.() ?? "Unknown error", review });
197
178
  throw e;
@@ -239,7 +220,7 @@ export const Bridge = observer(({ hot, widget, setup, onClose, onProcess, onSele
239
220
  <Popup widget={widget} onClose={onClose} header={<p>{title}</p>} mobileFullscreen={setup?.mobileFullscreen}>
240
221
  <div style={{ width: "100%", height: 400, display: "flex", justifyContent: "center", alignItems: "center", flexDirection: "column" }}>
241
222
  {/* @ts-expect-error: dotlottie-wc is not typed */}
242
- <dotlottie-wc key="loading" src={animations.loading} speed="1" style={{ width: 300, height: 300 }} mode="forward" loop autoplay></dotlottie-wc>
223
+ <dotlottie-wc key="loading" src="/loading.json" speed="1" style={{ width: 300, height: 300 }} mode="forward" loop autoplay></dotlottie-wc>
243
224
  <p style={{ marginTop: -32, fontSize: 16 }}>{processing.message}</p>
244
225
  </div>
245
226
  </Popup>
@@ -251,7 +232,7 @@ export const Bridge = observer(({ hot, widget, setup, onClose, onProcess, onSele
251
232
  <Popup widget={widget} onClose={onClose} header={<p>{title}</p>} mobileFullscreen={setup?.mobileFullscreen}>
252
233
  <div style={{ width: "100%", height: 400, display: "flex", justifyContent: "center", alignItems: "center", flexDirection: "column" }}>
253
234
  {/* @ts-expect-error: dotlottie-wc is not typed */}
254
- <dotlottie-wc key="success" src={animations.success} speed="1" style={{ width: 300, height: 300 }} mode="forward" loop autoplay></dotlottie-wc>
235
+ <dotlottie-wc key="success" src="/success.json" speed="1" style={{ width: 300, height: 300 }} mode="forward" loop autoplay></dotlottie-wc>
255
236
  <p style={{ fontSize: 24, marginTop: -32, fontWeight: "bold" }}>Exchange successful</p>
256
237
  </div>
257
238
  <PopupButton style={{ marginTop: "auto" }} onClick={() => (cancelReview(), onClose())}>
@@ -266,7 +247,7 @@ export const Bridge = observer(({ hot, widget, setup, onClose, onProcess, onSele
266
247
  <Popup widget={widget} onClose={onClose} header={<p>{title}</p>} mobileFullscreen={setup?.mobileFullscreen}>
267
248
  <div style={{ width: "100%", height: 400, gap: 8, display: "flex", justifyContent: "center", alignItems: "center", flexDirection: "column" }}>
268
249
  {/* @ts-expect-error: dotlottie-wc is not typed */}
269
- <dotlottie-wc key="error" src={animations.failed} speed="1" style={{ width: 300, height: 300 }} mode="forward" loop autoplay></dotlottie-wc>
250
+ <dotlottie-wc key="error" src="/error.json" speed="1" style={{ width: 300, height: 300 }} mode="forward" loop autoplay></dotlottie-wc>
270
251
  <p style={{ fontSize: 24, marginTop: -32, fontWeight: "bold" }}>Exchange failed</p>
271
252
  <p style={{ fontSize: 14 }}>{processing.message}</p>
272
253
  </div>