@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
package/src/core/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { OmniToken, WalletType, Network, chains } from "./chains";
2
2
  export { createHotBridge, HotBridge, ReviewFee } from "./bridge";
3
- export { rpc as nearRpc, TGAS } from "../near/rpc";
3
+ export { rpc as nearRpc, TGAS } from "./nearRpc";
4
4
  export { EventEmitter } from "./events";
5
5
  export { Recipient } from "./recipient";
6
6
  export { formatter } from "./utils";
@@ -1,8 +1,6 @@
1
1
  import { JsonRpcProvider } from "@near-js/providers";
2
2
  import { getErrorTypeFromErrorMessage, parseRpcError } from "@near-js/utils";
3
3
  import { TypedError, FinalExecutionOutcome } from "@near-js/types";
4
- import { api } from "../core/api";
5
- import { Network } from "../core";
6
4
 
7
5
  let _nextId = 123;
8
6
 
@@ -24,13 +22,22 @@ const wait = (timeout: number) => {
24
22
  return new Promise<void>((resolve) => setTimeout(resolve, timeout));
25
23
  };
26
24
 
25
+ const c1 = Math.random() > 0.5;
26
+ export const rpcProviders = [
27
+ c1 ? "https://c1.rpc.fastnear.com" : "https://c2.rpc.fastnear.com",
28
+ c1 ? "https://c2.rpc.fastnear.com" : "https://c1.rpc.fastnear.com",
29
+ "https://relmn.aurora.dev",
30
+ "https://nearrpc.aurora.dev",
31
+ "https://archival-rpc.mainnet.near.org",
32
+ ];
33
+
27
34
  export class NearRpc extends JsonRpcProvider {
28
35
  public providers: string[];
29
36
  public currentProviderIndex = 0;
30
37
  public startTimeout;
31
38
 
32
- constructor(providers = [api.getRpcUrl(Network.Near)], private timeout = 30_000, private triesCountForEveryProvider = 3, private incrementTimout = true) {
33
- super({ url: api.getRpcUrl(Network.Near) });
39
+ constructor(providers = rpcProviders, private timeout = 30_000, private triesCountForEveryProvider = 3, private incrementTimout = true) {
40
+ super({ url: "" });
34
41
  this.currentProviderIndex = 0;
35
42
  this.providers = providers;
36
43
  this.startTimeout = timeout;
package/src/core/types.ts CHANGED
@@ -40,30 +40,9 @@ export interface AuthCallIntent {
40
40
  intent: "auth_call";
41
41
  }
42
42
 
43
- export interface AddPublicKeyIntent {
44
- intent: "add_public_key";
45
- public_key: string;
46
- }
47
-
48
- export interface RemovePublicKeyIntent {
49
- intent: "remove_public_key";
50
- public_key: string;
51
- }
52
-
53
- export interface NftWithdrawIntent {
54
- intent: "nft_withdraw";
55
- token_id: string;
56
- receiver_id: string;
57
- memo?: string;
58
- msg?: string;
59
- min_gas?: string;
60
- }
61
-
62
43
  export interface Commitment {
63
44
  signature: string;
64
45
  public_key?: string;
65
46
  payload: Record<string, any> | string;
66
47
  standard: string;
67
48
  }
68
-
69
- export type Intent = TransferIntent | MtWithdrawIntent | FtWithdrawIntent | TokenDiffIntent | AuthCallIntent | AddPublicKeyIntent | RemovePublicKeyIntent | NftWithdrawIntent;
package/src/core/utils.ts CHANGED
@@ -148,12 +148,7 @@ export const formatter = {
148
148
  },
149
149
 
150
150
  amount(value: Value, decimals = 24) {
151
- if (+formatter.num(value) > 1_000_000_000_000_000_000) return `${formatter.round(+formatter.num(value) / 1_000_000_000_000_000, 2)}Q`;
152
- if (+formatter.num(value) > 1_000_000_000_000_000) return `${formatter.round(+formatter.num(value) / 1_000_000_000_000, 2)}T`;
153
- if (+formatter.num(value) > 1_000_000_000_000) return `${formatter.round(+formatter.num(value) / 1_000_000_000, 2)}B`;
154
- if (+formatter.num(value) > 1_000_000_000) return `${formatter.round(+formatter.num(value) / 1_000_000, 2)}M`;
155
- const num = formatter.num(value).toFixed(decimals);
156
- if (+num === 0) return "0";
151
+ const num = String(+formatter.num(value).toFixed(decimals));
157
152
  return formatter.formatNumberWithSubscriptZeros(num, 3, 0.0001);
158
153
  },
159
154
 
@@ -165,15 +160,4 @@ export const formatter = {
165
160
  wait(ms: number) {
166
161
  return new Promise((resolve) => setTimeout(resolve, ms));
167
162
  },
168
-
169
- chunk(array: any[], size: number) {
170
- return array.reduce((acc, item, index) => {
171
- const chunkIndex = Math.floor(index / size);
172
- if (!acc[chunkIndex]) {
173
- acc[chunkIndex] = [];
174
- }
175
- acc[chunkIndex].push(item);
176
- return acc;
177
- }, []);
178
- },
179
163
  };
@@ -6,7 +6,7 @@ import { hex } from "@scure/base";
6
6
 
7
7
  import { api } from "../core/api";
8
8
  import { chains, WalletType } from "../core/chains";
9
- import { ConnectorType, OmniConnector, OmniConnectorOption, WC_ICON } from "../OmniConnector";
9
+ import { ConnectorType, OmniConnector, WC_ICON } from "../OmniConnector";
10
10
  import { HotConnector } from "../HotConnector";
11
11
  import { OmniWallet } from "../OmniWallet";
12
12
 
@@ -20,9 +20,9 @@ declare global {
20
20
  }
21
21
  }
22
22
 
23
- const wallets: Record<string, OmniConnectorOption> = {
23
+ const wallets = {
24
24
  keplr: {
25
- name: "Keplr Wallet",
25
+ name: "Keplr",
26
26
  icon: "https://cdn.prod.website-files.com/667dc891bc7b863b5397495b/68a4ca95f93a9ab64dc67ab4_keplr-symbol.svg",
27
27
  download: "https://www.keplr.app/get",
28
28
  deeplink: "keplrwallet://wcV2?",
@@ -30,21 +30,13 @@ const wallets: Record<string, OmniConnectorOption> = {
30
30
  id: "keplr",
31
31
  },
32
32
  leap: {
33
- name: "Leap Wallet",
33
+ name: "Leap",
34
34
  icon: "https://framerusercontent.com/images/AbGYvbwnLekBbsdf5g7PI5PpSg.png?scale-down-to=512",
35
35
  download: "https://www.leapwallet.io/download",
36
36
  deeplink: "leapcosmos://wcV2?",
37
37
  type: "extension",
38
38
  id: "leap",
39
39
  },
40
- gonkaWallet: {
41
- name: "Gonka Wallet",
42
- icon: "https://gonka-wallet.startonus.com/images/logo.png",
43
- download: "https://t.me/gonka_wallet",
44
- deeplink: "https://gonka-wallet.startonus.com/wc?wc=",
45
- type: "external",
46
- id: "gonkaWallet",
47
- },
48
40
  };
49
41
 
50
42
  export default class CosmosConnector extends OmniConnector<CosmosWallet> {
@@ -58,12 +50,28 @@ export default class CosmosConnector extends OmniConnector<CosmosWallet> {
58
50
  constructor(wibe3: HotConnector) {
59
51
  super(wibe3);
60
52
 
61
- this.options = Object.values(wallets);
53
+ this.options = [
54
+ {
55
+ name: "Keplr",
56
+ download: "https://www.keplr.app/get",
57
+ icon: "https://cdn.prod.website-files.com/667dc891bc7b863b5397495b/68a4ca95f93a9ab64dc67ab4_keplr-symbol.svg",
58
+ type: "keplr" in window ? "extension" : "external",
59
+ id: "keplr",
60
+ },
61
+ {
62
+ name: "leap" in window ? "Leap" : "Leap Mobile",
63
+ download: "https://www.leapwallet.io/download",
64
+ icon: "https://framerusercontent.com/images/AbGYvbwnLekBbsdf5g7PI5PpSg.png?scale-down-to=512",
65
+ type: "leap" in window ? "extension" : "external",
66
+ id: "leap",
67
+ },
68
+ ];
69
+
62
70
  Keplr.getKeplr().then((keplr) => {
63
71
  const option = this.options.find((option) => option.id === "keplr")!;
64
72
  runInAction(() => {
65
73
  option.type = keplr ? "extension" : "external";
66
- option.name = keplr ? "Keplr Wallet" : "Keplr Mobile";
74
+ option.name = keplr ? "Keplr" : "Keplr Mobile";
67
75
  });
68
76
  });
69
77
 
@@ -105,7 +113,7 @@ export default class CosmosConnector extends OmniConnector<CosmosWallet> {
105
113
  return chains.getByType(WalletType.COSMOS).map((t) => t.key);
106
114
  }
107
115
 
108
- async setupWalletConnect(id?: "keplr" | "leap" | "gonkaWallet"): Promise<CosmosWallet> {
116
+ async setupWalletConnect(id?: "keplr" | "leap"): Promise<CosmosWallet> {
109
117
  const wc = await this.wc;
110
118
  if (!wc) throw new Error("WalletConnect not found");
111
119
 
@@ -117,7 +125,7 @@ export default class CosmosConnector extends OmniConnector<CosmosWallet> {
117
125
  const address = account.bech32Address;
118
126
 
119
127
  this.setStorage({ type: "walletconnect", id });
120
- const wallet = new CosmosWallet({
128
+ const wallet = new CosmosWallet(this, {
121
129
  address: address,
122
130
  publicKeyHex: publicKey,
123
131
  disconnect: () => this.disconnectWalletConnect(),
@@ -162,7 +170,7 @@ export default class CosmosConnector extends OmniConnector<CosmosWallet> {
162
170
 
163
171
  async setKeplrWallet(keplr: Keplr, address: string, publicKey: string) {
164
172
  return this.setWallet(
165
- new CosmosWallet({
173
+ new CosmosWallet(this, {
166
174
  address: address,
167
175
  publicKeyHex: publicKey,
168
176
  disconnect: () => keplr.disable(),
@@ -175,7 +183,7 @@ export default class CosmosConnector extends OmniConnector<CosmosWallet> {
175
183
  );
176
184
  }
177
185
 
178
- async connectKeplr(type: "keplr" | "leap" | "gonkaWallet", extension?: Keplr): Promise<OmniWallet | { qrcode: string; deeplink?: string; task: Promise<OmniWallet> }> {
186
+ async connectKeplr(type: "keplr" | "leap", extension?: Keplr): Promise<OmniWallet | { qrcode: string; deeplink?: string; task: Promise<OmniWallet> }> {
179
187
  if (!extension) {
180
188
  return await this.connectWalletConnect({
181
189
  onConnect: () => this.setupWalletConnect(type),
@@ -224,10 +232,6 @@ export default class CosmosConnector extends OmniConnector<CosmosWallet> {
224
232
  });
225
233
  }
226
234
 
227
- if (id === "gonkaWallet") {
228
- return await this.connectKeplr("gonkaWallet");
229
- }
230
-
231
235
  if (id === "keplr") {
232
236
  const keplr = await Keplr.getKeplr();
233
237
  return await this.connectKeplr("keplr", keplr);
@@ -2,6 +2,7 @@ import { StargateClient } from "@cosmjs/stargate";
2
2
  import { OmniWallet } from "../OmniWallet";
3
3
  import { chains, WalletType } from "../core/chains";
4
4
  import { ReviewFee } from "../core/bridge";
5
+ import CosmosConnector from "./connector";
5
6
  import { Commitment } from "../core";
6
7
 
7
8
  interface ProtocolWallet {
@@ -12,11 +13,10 @@ interface ProtocolWallet {
12
13
  }
13
14
 
14
15
  export default class CosmosWallet extends OmniWallet {
15
- readonly icon = "https://legacy.cosmos.network/presskit/cosmos-brandmark-dynamic-dark.svg";
16
16
  readonly type = WalletType.COSMOS;
17
17
 
18
- constructor(readonly wallet: ProtocolWallet) {
19
- super();
18
+ constructor(readonly connector: CosmosConnector, readonly wallet: ProtocolWallet) {
19
+ super(connector);
20
20
  }
21
21
 
22
22
  get address() {
@@ -31,6 +31,11 @@ export default class CosmosWallet extends OmniWallet {
31
31
  return "";
32
32
  }
33
33
 
34
+ async disconnect() {
35
+ super.disconnect();
36
+ this.wallet.disconnect?.();
37
+ }
38
+
34
39
  sendTransaction(signDoc: any): Promise<string> {
35
40
  if (!this.wallet.sendTransaction) throw "Not impl";
36
41
  return this.wallet.sendTransaction(signDoc);
@@ -121,11 +121,6 @@ class EvmConnector extends OmniConnector<EvmWallet, { provider: EvmProvider }> {
121
121
 
122
122
  return await this.connectWallet(id, wallet.provider);
123
123
  }
124
-
125
- async disconnect() {
126
- this.wallets.forEach((w) => w.disconnect());
127
- super.disconnect();
128
- }
129
124
  }
130
125
 
131
126
  export default EvmConnector;
package/src/evm/wallet.ts CHANGED
@@ -22,15 +22,7 @@ class EvmWallet extends OmniWallet {
22
22
  readonly type = WalletType.EVM;
23
23
 
24
24
  constructor(readonly connector: OmniConnector, readonly address: string, readonly provider: EvmProvider) {
25
- super();
26
- }
27
-
28
- async disconnect() {
29
- await this.provider.request?.({ method: "wallet_revokePermissions", params: [{ eth_accounts: {} }] });
30
- }
31
-
32
- get icon() {
33
- return this.connector.icon;
25
+ super(connector);
34
26
  }
35
27
 
36
28
  private rpcs: Record<number, JsonRpcProvider> = {};
@@ -50,6 +42,11 @@ class EvmWallet extends OmniWallet {
50
42
  return this.address.toLowerCase();
51
43
  }
52
44
 
45
+ async disconnect() {
46
+ this.provider.request?.({ method: "wallet_revokePermissions", params: [{ eth_accounts: {} }] });
47
+ await super.disconnect();
48
+ }
49
+
53
50
  async fetchBalances(chain: number, whitelist: string[]): Promise<Record<string, bigint>> {
54
51
  const native = await this.fetchBalance(chain, "native");
55
52
  try {
package/src/exchange.ts CHANGED
@@ -184,7 +184,7 @@ export class Exchange {
184
184
  if (!intentFrom) throw new Error("Unsupported token");
185
185
  if (!intentTo) throw new Error("Unsupported token");
186
186
 
187
- const deadlineTime = 5 * 60 * 1000;
187
+ const deadlineTime = 20 * 60 * 1000;
188
188
  const directChains = [Network.Near, Network.Juno, Network.Gonka, Network.ADI];
189
189
  const deadline = new Date(Date.now() + deadlineTime).toISOString();
190
190
  const noFee = from.symbol === to.symbol || (from.symbol.toLowerCase().includes("usd") && to.symbol.toLowerCase().includes("usd"));
@@ -282,7 +282,10 @@ export class Exchange {
282
282
  if (request.from.chain !== Network.Hot && sender !== "qr") {
283
283
  const amount = BigInt(qoute.quote.amountIn);
284
284
  const depositAddress = qoute.quote.depositAddress!;
285
- fee = await sender.transferFee(request.from, depositAddress, amount).catch(() => null);
285
+ fee = await sender.transferFee(request.from, depositAddress, amount).catch((e) => {
286
+ console.error("Failed to calculate transfer fee", e);
287
+ return null;
288
+ });
286
289
  }
287
290
 
288
291
  return {
@@ -300,7 +303,7 @@ export class Exchange {
300
303
  };
301
304
  }
302
305
 
303
- async makeSwap(review: BridgeReview, pending: { log: (message: string) => void }): Promise<{ review: BridgeReview; processing?: () => Promise<BridgeReview> }> {
306
+ async makeSwap(review: BridgeReview, pending: { log: (message: string) => void }) {
304
307
  const { sender, recipient } = review;
305
308
 
306
309
  if (review.qoute === "withdraw") {
@@ -309,7 +312,7 @@ export class Exchange {
309
312
  const recipientWallet = this.wibe3.wallets.find((w) => w.address === recipient.address);
310
313
  if (recipientWallet) this.wibe3.fetchToken(review.to, recipientWallet);
311
314
  this.wibe3.fetchToken(review.from, sender);
312
- return { review };
315
+ return review;
313
316
  }
314
317
 
315
318
  if (review.qoute === "deposit") {
@@ -319,7 +322,7 @@ export class Exchange {
319
322
 
320
323
  const recipientWallet = this.wibe3.wallets.find((w) => w.address === recipient.address);
321
324
  if (recipientWallet) this.wibe3.fetchToken(review.to, recipientWallet);
322
- return { review };
325
+ return review;
323
326
  }
324
327
 
325
328
  if (sender !== "qr") {
@@ -334,41 +337,44 @@ export class Exchange {
334
337
 
335
338
  const depositAddress = review.qoute.depositAddress!;
336
339
  let hash = "";
337
-
338
340
  if (review.from.chain === Network.Hot) {
339
- hash = await this.wibe3
340
- .intentsBuilder(sender)
341
- .transfer({ amount: review.amountIn, token: review.from.address as OmniToken, recipient: depositAddress })
341
+ hash = await sender.intents
342
+ .transfer({
343
+ amount: review.amountIn,
344
+ token: review.from.address as OmniToken,
345
+ recipient: depositAddress,
346
+ })
342
347
  .execute();
343
348
  } else {
344
349
  hash = await sender.transfer({
345
350
  receiver: depositAddress,
346
351
  amount: review.amountIn,
347
352
  comment: review.qoute.depositMemo,
348
- gasFee: review.fee ?? undefined,
349
353
  token: review.from,
354
+ gasFee: review.fee ?? undefined,
350
355
  });
351
356
  }
352
357
 
358
+ pending.log("Submitting tx");
353
359
  this.wibe3.fetchToken(review.from, sender);
354
- OneClickService.submitDepositTx({ txHash: hash, depositAddress }).catch(() => {});
360
+ await OneClickService.submitDepositTx({ txHash: hash, depositAddress }).catch(() => {});
355
361
  }
356
362
 
357
- return {
358
- review,
359
- processing: async () => {
360
- const recipientWallet = this.wibe3.wallets.find((w) => w.address === recipient.address);
361
- if (!recipientWallet) return await this.processing(review);
363
+ if (sender !== "qr") {
364
+ wait(1000).then(() => this.wibe3.fetchToken(review.to, sender));
365
+ }
362
366
 
363
- const beforeBalance = await this.wibe3.fetchToken(review.to, recipientWallet).catch(() => null);
364
- if (!beforeBalance) return await this.processing(review);
367
+ pending.log("Processing...");
368
+ const recipientWallet = this.wibe3.wallets.find((w) => w.address === recipient.address);
369
+ if (!recipientWallet) return await this.processing(review);
365
370
 
366
- return await Promise.race([
367
- this.waitBalance(review.to, recipientWallet, beforeBalance, review),
368
- this.processing(review), //
369
- ]);
370
- },
371
- };
371
+ const beforeBalance = await this.wibe3.fetchToken(review.to, recipientWallet).catch(() => null);
372
+ if (!beforeBalance) return await this.processing(review);
373
+
374
+ return await Promise.race([
375
+ this.waitBalance(review.to, recipientWallet, beforeBalance, review),
376
+ this.processing(review), //
377
+ ]);
372
378
  }
373
379
 
374
380
  async waitBalance(to: Token, wallet: OmniWallet, beforeBalance: bigint, review: BridgeReview): Promise<BridgeReview> {
@@ -50,19 +50,12 @@ class GoogleConnector extends OmniConnector<OmniWallet> {
50
50
  if (account.type === WalletType.STELLAR) {
51
51
  const signMessage = async (message: string) => request("stellar:signMessage", { message });
52
52
  const signTransaction = async (transaction: Transaction) => request("stellar:signTransaction", { transaction: transaction.toXDR() });
53
- this.wallets.push(
54
- new StellarWallet({
55
- rpc: this.wibe3.hotBridge.stellar,
56
- address: account.address,
57
- signMessage,
58
- signTransaction,
59
- })
60
- );
53
+ this.wallets.push(new StellarWallet(this, { address: account.address, signMessage, signTransaction }));
61
54
  }
62
55
 
63
56
  if (account.type === WalletType.TON) {
64
57
  this.setWallet(
65
- new TonWallet({
58
+ new TonWallet(this, {
66
59
  sendTransaction: (params) => request("ton:sendTransaction", params),
67
60
  signData: (params) => request("ton:signData", params),
68
61
  account: { address: account.address, publicKey: account.publicKey },
@@ -72,21 +65,21 @@ class GoogleConnector extends OmniConnector<OmniWallet> {
72
65
 
73
66
  if (account.type === WalletType.NEAR) {
74
67
  this.setWallet(
75
- new NearWallet(account.address, account.publicKey, {
68
+ new NearWallet(this, account.address, account.publicKey, {
76
69
  signAndSendTransaction: (params: SignAndSendTransactionParams) => request("near:signAndSendTransaction", params),
77
70
  signAndSendTransactions: (params: SignAndSendTransactionsParams) => request("near:signAndSendTransactions", params),
78
71
  signMessage: (params: SignMessageParams) => request("near:signMessage", params),
79
72
  getAccounts: async () => [{ accountId: account.address, publicKey: account.publicKey }],
80
73
  signIn: () => request("near:signIn", {}),
81
- manifest: {} as unknown as WalletManifest,
82
74
  signOut: async () => {},
75
+ manifest: {} as unknown as WalletManifest,
83
76
  }) as NearWallet
84
77
  );
85
78
  }
86
79
 
87
80
  if (account.type === WalletType.SOLANA) {
88
81
  this.setWallet(
89
- new SolanaWallet({
82
+ new SolanaWallet(this, {
90
83
  sendTransaction: async (transaction: unknown, _: unknown, options?: unknown) => await request("solana:sendTransaction", { transaction, options }),
91
84
  signMessage: async (message: string) => await request("solana:signMessage", { message }),
92
85
  disconnect: async () => {},
package/src/index.ts CHANGED
@@ -1,5 +1,3 @@
1
- import "@lottiefiles/dotlottie-wc";
2
-
3
1
  export { OmniWallet } from "./OmniWallet";
4
2
  export { OmniConnector } from "./OmniConnector";
5
3
  export { HotConnector } from "./HotConnector";
@@ -28,7 +28,7 @@ class Connector extends OmniConnector<NearWallet> {
28
28
  this.connector.on("wallet:signOut", () => this.removeWallet());
29
29
  this.connector.getConnectedWallet().then(async ({ wallet }) => {
30
30
  const [account] = await wallet.getAccounts();
31
- if (account) this.setWallet(new NearWallet(account.accountId, account.publicKey, wallet));
31
+ if (account) this.setWallet(new NearWallet(this, account.accountId, account.publicKey, wallet));
32
32
  });
33
33
 
34
34
  this.connector.whenManifestLoaded.then(() => {
@@ -49,7 +49,7 @@ class Connector extends OmniConnector<NearWallet> {
49
49
  if (!wallet) throw new Error("Wallet not found");
50
50
  const [account] = await wallet.getAccounts();
51
51
  if (!account) throw new Error("No account found");
52
- return this.setWallet(new NearWallet(account.accountId, account.publicKey, wallet));
52
+ return this.setWallet(new NearWallet(this, account.accountId, account.publicKey, wallet));
53
53
  }
54
54
 
55
55
  async disconnect() {
@@ -1,25 +1,30 @@
1
1
  import { NearWalletBase, SignMessageParams, SignedMessage, SignAndSendTransactionParams } from "@hot-labs/near-connect";
2
2
  import { base64, base58 } from "@scure/base";
3
3
 
4
+ import { OmniConnector } from "../OmniConnector";
4
5
  import { OmniWallet } from "../OmniWallet";
5
6
  import { WalletType } from "../core/chains";
6
7
  import { ReviewFee } from "../core/bridge";
7
- import { rpc, TGAS } from "./rpc";
8
+ import { rpc, TGAS } from "../core/nearRpc";
8
9
  import { Token } from "../core/token";
9
10
  import { Commitment } from "../core";
10
11
 
11
12
  export default class NearWallet extends OmniWallet {
12
- readonly icon = "https://storage.herewallet.app/upload/73a44e583769f11112b0eff1f2dd2a560c05eed5f6d92f0c03484fa047c31668.png";
13
13
  readonly type = WalletType.NEAR;
14
14
 
15
- constructor(readonly address: string, readonly publicKey?: string, readonly wallet?: NearWalletBase) {
16
- super();
15
+ constructor(readonly connector: OmniConnector, readonly address: string, readonly publicKey?: string, readonly wallet?: NearWalletBase) {
16
+ super(connector);
17
17
  }
18
18
 
19
19
  get omniAddress() {
20
20
  return this.address;
21
21
  }
22
22
 
23
+ async disconnect() {
24
+ await this.wallet?.signOut();
25
+ super.disconnect();
26
+ }
27
+
23
28
  async fetchBalances(_: number, whitelist: string[]): Promise<Record<string, bigint>> {
24
29
  const balances = await Promise.all(
25
30
  whitelist.map(async (token) => {
@@ -9,8 +9,8 @@ import { OmniWallet } from "../OmniWallet";
9
9
  import { WalletType } from "../core/chains";
10
10
  import HOT from "../hot-wallet/iframe";
11
11
 
12
- import SolanaProtocolWallet from "./WalletStandard";
13
- import { getWallets } from "./walletStandartList";
12
+ import SolanaProtocolWallet from "./protocol";
13
+ import { getWallets } from "./wallets";
14
14
  import SolanaWallet from "./wallet";
15
15
 
16
16
  const wallets = getWallets();
@@ -36,7 +36,7 @@ class SolanaConnector extends OmniConnector<SolanaWallet, { wallet: Wallet }> {
36
36
  const wallet = this.options.find((w) => w.id === id);
37
37
  if (!wallet) return;
38
38
  const protocolWallet = await SolanaProtocolWallet.connect(wallet.wallet, { silent: true });
39
- this.setWallet(new SolanaWallet(protocolWallet));
39
+ this.setWallet(new SolanaWallet(this, protocolWallet));
40
40
  } catch {
41
41
  this.removeStorage();
42
42
  }
@@ -59,7 +59,7 @@ class SolanaConnector extends OmniConnector<SolanaWallet, { wallet: Wallet }> {
59
59
  const connected = await this.getConnectedWallet();
60
60
  if (connected !== wallet.name) return;
61
61
  const protocolWallet = await SolanaProtocolWallet.connect(wallet, { silent: true });
62
- this.setWallet(new SolanaWallet(protocolWallet));
62
+ this.setWallet(new SolanaWallet(this, protocolWallet));
63
63
  } catch {
64
64
  this.removeStorage();
65
65
  }
@@ -88,7 +88,7 @@ class SolanaConnector extends OmniConnector<SolanaWallet, { wallet: Wallet }> {
88
88
 
89
89
  this.setStorage({ type: "walletconnect" });
90
90
  return this.setWallet(
91
- new SolanaWallet({
91
+ new SolanaWallet(this, {
92
92
  address: account,
93
93
  sendTransaction: async (tx: Transaction | VersionedTransaction, connection: Connection, options?: any) => {
94
94
  const transaction = Buffer.from(tx.serialize()).toString("base64");
@@ -112,9 +112,8 @@ class SolanaConnector extends OmniConnector<SolanaWallet, { wallet: Wallet }> {
112
112
  );
113
113
  }
114
114
 
115
- async disconnect() {
116
- this.wallets.forEach((w) => w.wallet.disconnect?.());
117
- super.disconnect();
115
+ async createWallet(address: string): Promise<OmniWallet> {
116
+ return new SolanaWallet(this, { address });
118
117
  }
119
118
 
120
119
  async getConnectedWallet() {
@@ -143,7 +142,7 @@ class SolanaConnector extends OmniConnector<SolanaWallet, { wallet: Wallet }> {
143
142
  try {
144
143
  this.setStorage({ type: "wallet", id });
145
144
  const protocolWallet = await SolanaProtocolWallet.connect(wallet.wallet, { silent: false });
146
- return this.setWallet(new SolanaWallet(protocolWallet));
145
+ return this.setWallet(new SolanaWallet(this, protocolWallet));
147
146
  } catch (e) {
148
147
  this.removeStorage();
149
148
  throw e;
@@ -110,7 +110,7 @@ export class GhostWallet implements Wallet {
110
110
  this._connected();
111
111
  }
112
112
 
113
- _on: StandardEventsOnMethod = (event: StandardEventsNames, listener: StandardEventsListeners[StandardEventsNames]) => {
113
+ _on: StandardEventsOnMethod = (event, listener) => {
114
114
  this._listeners[event]?.push(listener) || (this._listeners[event] = [listener]);
115
115
  return (): void => this._off(event, listener);
116
116
  };
@@ -152,7 +152,7 @@ export class GhostWallet implements Wallet {
152
152
  }
153
153
  };
154
154
 
155
- _connect: StandardConnectMethod = async ({ silent }: { silent?: boolean } = {}) => {
155
+ _connect: StandardConnectMethod = async ({ silent } = {}) => {
156
156
  if (!this._account) await this._ghost.connect(silent ? { onlyIfTrusted: true } : undefined);
157
157
  this._connected();
158
158
  return { accounts: this.accounts };
@@ -162,7 +162,7 @@ export class GhostWallet implements Wallet {
162
162
  await this._ghost.disconnect();
163
163
  };
164
164
 
165
- _signAndSendTransaction: SolanaSignAndSendTransactionMethod = async (...inputs: any[]) => {
165
+ _signAndSendTransaction: SolanaSignAndSendTransactionMethod = async (...inputs) => {
166
166
  if (!this._account) throw new Error("not connected");
167
167
 
168
168
  const outputs: SolanaSignAndSendTransactionOutput[] = [];
@@ -189,7 +189,7 @@ export class GhostWallet implements Wallet {
189
189
  return outputs;
190
190
  };
191
191
 
192
- _signTransaction: SolanaSignTransactionMethod = async (...inputs: any[]) => {
192
+ _signTransaction: SolanaSignTransactionMethod = async (...inputs) => {
193
193
  if (!this._account) throw new Error("not connected");
194
194
 
195
195
  const outputs: SolanaSignTransactionOutput[] = [];
@@ -243,7 +243,7 @@ export class GhostWallet implements Wallet {
243
243
  return outputs;
244
244
  };
245
245
 
246
- _signMessage: SolanaSignMessageMethod = async (...inputs: any[]) => {
246
+ _signMessage: SolanaSignMessageMethod = async (...inputs) => {
247
247
  if (!this._account) throw new Error("not connected");
248
248
 
249
249
  const outputs: SolanaSignMessageOutput[] = [];
@@ -264,7 +264,7 @@ export class GhostWallet implements Wallet {
264
264
  return outputs;
265
265
  };
266
266
 
267
- _signIn: SolanaSignInMethod = async (...inputs: any[]) => {
267
+ _signIn: SolanaSignInMethod = async (...inputs) => {
268
268
  const outputs: SolanaSignInOutput[] = [];
269
269
 
270
270
  if (inputs.length > 1) {
@@ -1,5 +1,7 @@
1
1
  import type { Connection, Transaction, VersionedTransaction } from "@solana/web3.js";
2
+ import { SolanaSignAndSendTransactionMethod, SolanaSignMessageMethod, SolanaSignTransactionMethod } from "@solana/wallet-standard-features";
2
3
  import type { Wallet } from "@wallet-standard/base";
4
+ import { base58 } from "@scure/base";
3
5
 
4
6
  export interface ISolanaProtocolWallet {
5
7
  address: string;
@@ -39,7 +41,7 @@ class SolanaProtocolWallet implements ISolanaProtocolWallet {
39
41
  async sendTransaction(transaction: Transaction | VersionedTransaction, connection: Connection, options?: any): Promise<string> {
40
42
  const account = await this.getAccount();
41
43
  const features = this.wallet.features as any;
42
- const signTx = features["solana:signTransaction"]?.signTransaction;
44
+ const signTx = features["solana:signTransaction"]?.signTransaction as SolanaSignTransactionMethod;
43
45
  const [signed] = await signTx({ account, chain: account.chains[0], transaction: transaction.serialize() });
44
46
  const signedTx = signed.signedTransaction as Transaction | VersionedTransaction | Uint8Array;
45
47
  const raw = signedTx instanceof Uint8Array ? signedTx : (signedTx as any).serialize();
@@ -50,7 +52,7 @@ class SolanaProtocolWallet implements ISolanaProtocolWallet {
50
52
  async signMessage(message: string) {
51
53
  const account = await this.getAccount();
52
54
  const features = this.wallet.features as any;
53
- const signMessageFeature = features["solana:signMessage"]?.signMessage;
55
+ const signMessageFeature = features["solana:signMessage"]?.signMessage as SolanaSignMessageMethod;
54
56
 
55
57
  if (!signMessageFeature) throw new Error("Wallet does not support solana:signMessage");
56
58
  const [result] = await signMessageFeature({ account, message: new TextEncoder().encode(message) });