@getpara/react-sdk-lite 2.0.0-alpha.33

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 (311) hide show
  1. package/dist/chunk-MMUBH76A.js +59 -0
  2. package/dist/cli/cli.mjs +51 -0
  3. package/dist/css/modal.css +13 -0
  4. package/dist/index.d.ts +6 -0
  5. package/dist/index.js +10 -0
  6. package/dist/modal/ParaModal.d.ts +2 -0
  7. package/dist/modal/ParaModal.js +308 -0
  8. package/dist/modal/components/Account/Account.d.ts +5 -0
  9. package/dist/modal/components/Account/Account.js +148 -0
  10. package/dist/modal/components/Account/AccountProfile.d.ts +1 -0
  11. package/dist/modal/components/Account/AccountProfile.js +168 -0
  12. package/dist/modal/components/Account/AccountProfileLink.d.ts +1 -0
  13. package/dist/modal/components/Account/AccountProfileLink.js +206 -0
  14. package/dist/modal/components/Account/AccountProfileLinkOptions.d.ts +1 -0
  15. package/dist/modal/components/Account/AccountProfileLinkOptions.js +111 -0
  16. package/dist/modal/components/Account/AccountProfileUnlink.d.ts +1 -0
  17. package/dist/modal/components/Account/AccountProfileUnlink.js +47 -0
  18. package/dist/modal/components/AddFunds/AddFunds.d.ts +1 -0
  19. package/dist/modal/components/AddFunds/AddFunds.js +69 -0
  20. package/dist/modal/components/AddFunds/AddFundsAsset.d.ts +1 -0
  21. package/dist/modal/components/AddFunds/AddFundsAsset.js +125 -0
  22. package/dist/modal/components/AddFunds/AddFundsAwaiting.d.ts +1 -0
  23. package/dist/modal/components/AddFunds/AddFundsAwaiting.js +78 -0
  24. package/dist/modal/components/AddFunds/AddFundsContext.d.ts +31 -0
  25. package/dist/modal/components/AddFunds/AddFundsContext.js +160 -0
  26. package/dist/modal/components/AddFunds/AddFundsDone.d.ts +6 -0
  27. package/dist/modal/components/AddFunds/AddFundsDone.js +49 -0
  28. package/dist/modal/components/AddFunds/AddFundsProvider.d.ts +1 -0
  29. package/dist/modal/components/AddFunds/AddFundsProvider.js +109 -0
  30. package/dist/modal/components/AddFunds/AddFundsReceive.d.ts +1 -0
  31. package/dist/modal/components/AddFunds/AddFundsReceive.js +83 -0
  32. package/dist/modal/components/AddFunds/AddFundsSettings.d.ts +1 -0
  33. package/dist/modal/components/AddFunds/AddFundsSettings.js +237 -0
  34. package/dist/modal/components/AddFunds/MoonPayEmbed.d.ts +2 -0
  35. package/dist/modal/components/AddFunds/MoonPayEmbed.js +7 -0
  36. package/dist/modal/components/AddFunds/common.d.ts +19 -0
  37. package/dist/modal/components/AddFunds/common.js +24 -0
  38. package/dist/modal/components/AddFunds/index.d.ts +3 -0
  39. package/dist/modal/components/AddFunds/index.js +4 -0
  40. package/dist/modal/components/AuthInput/AuthInput.d.ts +20 -0
  41. package/dist/modal/components/AuthInput/AuthInput.js +277 -0
  42. package/dist/modal/components/AuthInput/hooks/useDropdownPosition.d.ts +7 -0
  43. package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +33 -0
  44. package/dist/modal/components/AuthInput/phoneMasks.d.ts +247 -0
  45. package/dist/modal/components/AuthInput/phoneMasks.js +253 -0
  46. package/dist/modal/components/AuthMainStep/AuthMainStep.d.ts +9 -0
  47. package/dist/modal/components/AuthMainStep/AuthMainStep.js +50 -0
  48. package/dist/modal/components/AuthMainStep/AuthMainStepContent.d.ts +9 -0
  49. package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +179 -0
  50. package/dist/modal/components/AuthOptions/AuthOptions.d.ts +9 -0
  51. package/dist/modal/components/AuthOptions/AuthOptions.js +85 -0
  52. package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.d.ts +1 -0
  53. package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +18 -0
  54. package/dist/modal/components/AwaitingIFrameStep/AwaitingIFrameStep.d.ts +1 -0
  55. package/dist/modal/components/AwaitingIFrameStep/AwaitingIFrameStep.js +12 -0
  56. package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.d.ts +1 -0
  57. package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +10 -0
  58. package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.d.ts +1 -0
  59. package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +18 -0
  60. package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.d.ts +5 -0
  61. package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +49 -0
  62. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.d.ts +1 -0
  63. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +62 -0
  64. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.d.ts +1 -0
  65. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +48 -0
  66. package/dist/modal/components/Body/AnimatedHeightWrapper.d.ts +6 -0
  67. package/dist/modal/components/Body/AnimatedHeightWrapper.js +29 -0
  68. package/dist/modal/components/Body/Body.d.ts +11 -0
  69. package/dist/modal/components/Body/Body.js +354 -0
  70. package/dist/modal/components/ChainSwitch/ChainSwitch.d.ts +1 -0
  71. package/dist/modal/components/ChainSwitch/ChainSwitch.js +95 -0
  72. package/dist/modal/components/ChainSwitch/config.d.ts +7 -0
  73. package/dist/modal/components/ChainSwitch/config.js +17 -0
  74. package/dist/modal/components/Controls/Controls.d.ts +5 -0
  75. package/dist/modal/components/Controls/Controls.js +78 -0
  76. package/dist/modal/components/Controls/Selects.d.ts +2 -0
  77. package/dist/modal/components/Controls/Selects.js +173 -0
  78. package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.d.ts +1 -0
  79. package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +75 -0
  80. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +8 -0
  81. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +175 -0
  82. package/dist/modal/components/ExternalWalletStep/config.d.ts +7 -0
  83. package/dist/modal/components/ExternalWalletStep/config.js +17 -0
  84. package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.d.ts +1 -0
  85. package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +39 -0
  86. package/dist/modal/components/ExternalWallets/ExternalWallets.d.ts +1 -0
  87. package/dist/modal/components/ExternalWallets/ExternalWallets.js +182 -0
  88. package/dist/modal/components/Footer/Footer.d.ts +1 -0
  89. package/dist/modal/components/Footer/Footer.js +95 -0
  90. package/dist/modal/components/Header/Header.d.ts +1 -0
  91. package/dist/modal/components/Header/Header.js +43 -0
  92. package/dist/modal/components/Header/hooks/useStepTitle.d.ts +3 -0
  93. package/dist/modal/components/Header/hooks/useStepTitle.js +62 -0
  94. package/dist/modal/components/Hero/Hero.d.ts +1 -0
  95. package/dist/modal/components/Hero/Hero.js +116 -0
  96. package/dist/modal/components/IFrameStep/IFrameStep.d.ts +1 -0
  97. package/dist/modal/components/IFrameStep/IFrameStep.js +70 -0
  98. package/dist/modal/components/LoginDoneStep/LoginDoneStep.d.ts +5 -0
  99. package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +44 -0
  100. package/dist/modal/components/ModalContent/ModalContent.d.ts +10 -0
  101. package/dist/modal/components/ModalContent/ModalContent.js +88 -0
  102. package/dist/modal/components/OAuth/FarcasterOAuthStep.d.ts +3 -0
  103. package/dist/modal/components/OAuth/FarcasterOAuthStep.js +31 -0
  104. package/dist/modal/components/OAuth/OAuth.d.ts +6 -0
  105. package/dist/modal/components/OAuth/OAuth.js +81 -0
  106. package/dist/modal/components/OAuth/TelegramOAuthStep.d.ts +8 -0
  107. package/dist/modal/components/OAuth/TelegramOAuthStep.js +74 -0
  108. package/dist/modal/components/OnRampComponents/AddingFunds.d.ts +1 -0
  109. package/dist/modal/components/OnRampComponents/AddingFunds.js +23 -0
  110. package/dist/modal/components/OnRampComponents/OnRampProviderButton.d.ts +9 -0
  111. package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +77 -0
  112. package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.d.ts +6 -0
  113. package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +107 -0
  114. package/dist/modal/components/Setup2FAStep/Setup2FAStep.d.ts +5 -0
  115. package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +132 -0
  116. package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.d.ts +5 -0
  117. package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +27 -0
  118. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.d.ts +12 -0
  119. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +160 -0
  120. package/dist/modal/components/Waiting/Waiting.d.ts +6 -0
  121. package/dist/modal/components/Waiting/Waiting.js +17 -0
  122. package/dist/modal/components/WalletCard/PartnerIcon.d.ts +6 -0
  123. package/dist/modal/components/WalletCard/PartnerIcon.js +34 -0
  124. package/dist/modal/components/WalletCard/WalletCard.d.ts +18 -0
  125. package/dist/modal/components/WalletCard/WalletCard.js +128 -0
  126. package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.d.ts +6 -0
  127. package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +83 -0
  128. package/dist/modal/components/common.d.ts +59 -0
  129. package/dist/modal/components/common.js +261 -0
  130. package/dist/modal/components/index.d.ts +1 -0
  131. package/dist/modal/components/index.js +2 -0
  132. package/dist/modal/constants/constants.d.ts +40 -0
  133. package/dist/modal/constants/constants.js +142 -0
  134. package/dist/modal/constants/defaults.d.ts +5 -0
  135. package/dist/modal/constants/defaults.js +10 -0
  136. package/dist/modal/constants/oAuthLogos.d.ts +17 -0
  137. package/dist/modal/constants/oAuthLogos.js +158 -0
  138. package/dist/modal/constants/walletTypeConfig.d.ts +6 -0
  139. package/dist/modal/constants/walletTypeConfig.js +13 -0
  140. package/dist/modal/hooks/useGoBack.d.ts +1 -0
  141. package/dist/modal/hooks/useGoBack.js +43 -0
  142. package/dist/modal/hooks/useTelegramLogin.d.ts +12 -0
  143. package/dist/modal/hooks/useTelegramLogin.js +65 -0
  144. package/dist/modal/index.d.ts +8 -0
  145. package/dist/modal/index.js +29 -0
  146. package/dist/modal/stores/index.d.ts +1 -0
  147. package/dist/modal/stores/index.js +2 -0
  148. package/dist/modal/stores/modal/actions.d.ts +3 -0
  149. package/dist/modal/stores/modal/actions.js +139 -0
  150. package/dist/modal/stores/modal/useModalStore.d.ts +105 -0
  151. package/dist/modal/stores/modal/useModalStore.js +75 -0
  152. package/dist/modal/types/commonTypes.d.ts +6 -0
  153. package/dist/modal/types/commonTypes.js +1 -0
  154. package/dist/modal/types/modalProps.d.ts +129 -0
  155. package/dist/modal/types/modalProps.js +12 -0
  156. package/dist/modal/utils/authInputHelpers.d.ts +5 -0
  157. package/dist/modal/utils/authInputHelpers.js +41 -0
  158. package/dist/modal/utils/authLayoutHelpers.d.ts +3 -0
  159. package/dist/modal/utils/authLayoutHelpers.js +8 -0
  160. package/dist/modal/utils/countryCodes.d.ts +8 -0
  161. package/dist/modal/utils/countryCodes.js +45 -0
  162. package/dist/modal/utils/getMailtoLink.d.ts +1 -0
  163. package/dist/modal/utils/getMailtoLink.js +10 -0
  164. package/dist/modal/utils/getTileButtonFlex.d.ts +1 -0
  165. package/dist/modal/utils/getTileButtonFlex.js +20 -0
  166. package/dist/modal/utils/getWalletDisplayName.d.ts +5 -0
  167. package/dist/modal/utils/getWalletDisplayName.js +22 -0
  168. package/dist/modal/utils/isPasskeySupported.d.ts +1 -0
  169. package/dist/modal/utils/isPasskeySupported.js +15 -0
  170. package/dist/modal/utils/openPopup.d.ts +6 -0
  171. package/dist/modal/utils/openPopup.js +60 -0
  172. package/dist/modal/utils/routeMobileExternalWallet.d.ts +1 -0
  173. package/dist/modal/utils/routeMobileExternalWallet.js +31 -0
  174. package/dist/modal/utils/steps.d.ts +136 -0
  175. package/dist/modal/utils/steps.js +279 -0
  176. package/dist/modal/utils/stringFormatters.d.ts +5 -0
  177. package/dist/modal/utils/stringFormatters.js +19 -0
  178. package/dist/modal/utils/validateOnRampConfig.d.ts +5 -0
  179. package/dist/modal/utils/validateOnRampConfig.js +32 -0
  180. package/dist/package.json +6 -0
  181. package/dist/provider/ParaProvider.d.ts +4 -0
  182. package/dist/provider/ParaProvider.js +140 -0
  183. package/dist/provider/actions/getEmbeddedAccount.d.ts +26 -0
  184. package/dist/provider/actions/getEmbeddedAccount.js +57 -0
  185. package/dist/provider/actions/getWallet.d.ts +5 -0
  186. package/dist/provider/actions/getWallet.js +18 -0
  187. package/dist/provider/actions/index.d.ts +47 -0
  188. package/dist/provider/actions/index.js +79 -0
  189. package/dist/provider/actions/utils.d.ts +4 -0
  190. package/dist/provider/actions/utils.js +34 -0
  191. package/dist/provider/components/CosmosWalletWrapper.d.ts +11 -0
  192. package/dist/provider/components/CosmosWalletWrapper.js +43 -0
  193. package/dist/provider/components/EvmWalletWrapper.d.ts +12 -0
  194. package/dist/provider/components/EvmWalletWrapper.js +43 -0
  195. package/dist/provider/components/ExternalWalletWrapper.d.ts +8 -0
  196. package/dist/provider/components/ExternalWalletWrapper.js +140 -0
  197. package/dist/provider/components/SolanaWalletWrapper.d.ts +9 -0
  198. package/dist/provider/components/SolanaWalletWrapper.js +44 -0
  199. package/dist/provider/external/getParaCosmosConnector.d.ts +7 -0
  200. package/dist/provider/external/getParaCosmosConnector.js +19 -0
  201. package/dist/provider/external/getParaCosmosLib.d.ts +4 -0
  202. package/dist/provider/external/getParaCosmosLib.js +16 -0
  203. package/dist/provider/external/getParaEvmConnector.d.ts +7 -0
  204. package/dist/provider/external/getParaEvmConnector.js +19 -0
  205. package/dist/provider/external/getParaEvmLib.d.ts +4 -0
  206. package/dist/provider/external/getParaEvmLib.js +16 -0
  207. package/dist/provider/external/getParaSolanaConnector.d.ts +7 -0
  208. package/dist/provider/external/getParaSolanaConnector.js +19 -0
  209. package/dist/provider/external/getParaSolanaLib.d.ts +4 -0
  210. package/dist/provider/external/getParaSolanaLib.js +16 -0
  211. package/dist/provider/external/stubs/CosmosExternalWalletContextStub.d.ts +2 -0
  212. package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +8 -0
  213. package/dist/provider/external/stubs/EvmExternalWalletContextStub.d.ts +2 -0
  214. package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +8 -0
  215. package/dist/provider/external/stubs/SolanaExternalWalletContextStub.d.ts +2 -0
  216. package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +8 -0
  217. package/dist/provider/hooks/index.d.ts +3 -0
  218. package/dist/provider/hooks/index.js +4 -0
  219. package/dist/provider/hooks/mutations/core.d.ts +27 -0
  220. package/dist/provider/hooks/mutations/core.js +66 -0
  221. package/dist/provider/hooks/mutations/index.d.ts +3 -0
  222. package/dist/provider/hooks/mutations/index.js +9 -0
  223. package/dist/provider/hooks/mutations/useLinkAccount.d.ts +9 -0
  224. package/dist/provider/hooks/mutations/useLinkAccount.js +18 -0
  225. package/dist/provider/hooks/mutations/utils.d.ts +12 -0
  226. package/dist/provider/hooks/mutations/utils.js +90 -0
  227. package/dist/provider/hooks/queries/core.d.ts +4 -0
  228. package/dist/provider/hooks/queries/core.js +16 -0
  229. package/dist/provider/hooks/queries/index.d.ts +5 -0
  230. package/dist/provider/hooks/queries/index.js +13 -0
  231. package/dist/provider/hooks/queries/useAccount.d.ts +90 -0
  232. package/dist/provider/hooks/queries/useAccount.js +141 -0
  233. package/dist/provider/hooks/queries/useIsFullyLoggedIn.d.ts +5 -0
  234. package/dist/provider/hooks/queries/useIsFullyLoggedIn.js +24 -0
  235. package/dist/provider/hooks/queries/useParaStatus.d.ts +22 -0
  236. package/dist/provider/hooks/queries/useParaStatus.js +25 -0
  237. package/dist/provider/hooks/queries/useWallet.d.ts +5 -0
  238. package/dist/provider/hooks/queries/useWallet.js +26 -0
  239. package/dist/provider/hooks/queries/useWalletBalance.d.ts +6 -0
  240. package/dist/provider/hooks/queries/useWalletBalance.js +55 -0
  241. package/dist/provider/hooks/queries/utils.d.ts +7 -0
  242. package/dist/provider/hooks/queries/utils.js +25 -0
  243. package/dist/provider/hooks/utils/index.d.ts +3 -0
  244. package/dist/provider/hooks/utils/index.js +10 -0
  245. package/dist/provider/hooks/utils/useAutoSessionKeepAlive.d.ts +3 -0
  246. package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +74 -0
  247. package/dist/provider/hooks/utils/useClient.d.ts +5 -0
  248. package/dist/provider/hooks/utils/useClient.js +10 -0
  249. package/dist/provider/hooks/utils/useEventListeners.d.ts +2 -0
  250. package/dist/provider/hooks/utils/useEventListeners.js +157 -0
  251. package/dist/provider/hooks/utils/useFormattedBiometricHints.d.ts +4 -0
  252. package/dist/provider/hooks/utils/useFormattedBiometricHints.js +27 -0
  253. package/dist/provider/hooks/utils/useInternalClient.d.ts +5 -0
  254. package/dist/provider/hooks/utils/useInternalClient.js +10 -0
  255. package/dist/provider/hooks/utils/useModal.d.ts +11 -0
  256. package/dist/provider/hooks/utils/useModal.js +27 -0
  257. package/dist/provider/hooks/utils/useWalletState.d.ts +15 -0
  258. package/dist/provider/hooks/utils/useWalletState.js +48 -0
  259. package/dist/provider/index.d.ts +6 -0
  260. package/dist/provider/index.js +11 -0
  261. package/dist/provider/providers/AccountLinkProvider.d.ts +47 -0
  262. package/dist/provider/providers/AccountLinkProvider.js +452 -0
  263. package/dist/provider/providers/AuthProvider.d.ts +38 -0
  264. package/dist/provider/providers/AuthProvider.js +575 -0
  265. package/dist/provider/providers/CosmosExternalWalletProvider.d.ts +7 -0
  266. package/dist/provider/providers/CosmosExternalWalletProvider.js +66 -0
  267. package/dist/provider/providers/EvmExternalWalletProvider.d.ts +7 -0
  268. package/dist/provider/providers/EvmExternalWalletProvider.js +74 -0
  269. package/dist/provider/providers/ExternalWalletProvider.d.ts +61 -0
  270. package/dist/provider/providers/ExternalWalletProvider.js +626 -0
  271. package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +7 -0
  272. package/dist/provider/providers/SolanaExternalWalletProvider.js +66 -0
  273. package/dist/provider/stores/getters.d.ts +4 -0
  274. package/dist/provider/stores/getters.js +13 -0
  275. package/dist/provider/stores/setters.d.ts +1 -0
  276. package/dist/provider/stores/setters.js +7 -0
  277. package/dist/provider/stores/slices/analytics.d.ts +3 -0
  278. package/dist/provider/stores/slices/analytics.js +9 -0
  279. package/dist/provider/stores/slices/client.d.ts +3 -0
  280. package/dist/provider/stores/slices/client.js +9 -0
  281. package/dist/provider/stores/slices/config.d.ts +3 -0
  282. package/dist/provider/stores/slices/config.js +11 -0
  283. package/dist/provider/stores/slices/externalWallets.d.ts +3 -0
  284. package/dist/provider/stores/slices/externalWallets.js +46 -0
  285. package/dist/provider/stores/slices/index.d.ts +5 -0
  286. package/dist/provider/stores/slices/index.js +6 -0
  287. package/dist/provider/stores/slices/modal.d.ts +3 -0
  288. package/dist/provider/stores/slices/modal.js +18 -0
  289. package/dist/provider/stores/slices/wallet.d.ts +3 -0
  290. package/dist/provider/stores/slices/wallet.js +13 -0
  291. package/dist/provider/stores/types.d.ts +86 -0
  292. package/dist/provider/stores/types.js +1 -0
  293. package/dist/provider/stores/useStore.d.ts +17 -0
  294. package/dist/provider/stores/useStore.js +34 -0
  295. package/dist/provider/types/externalWalletProviders.d.ts +12 -0
  296. package/dist/provider/types/externalWalletProviders.js +1 -0
  297. package/dist/provider/types/provider.d.ts +166 -0
  298. package/dist/provider/types/provider.js +1 -0
  299. package/dist/provider/types/query.d.ts +3 -0
  300. package/dist/provider/types/query.js +1 -0
  301. package/dist/provider/types/utils.d.ts +45 -0
  302. package/dist/provider/types/utils.js +1 -0
  303. package/dist/provider/utils/constants.d.ts +5 -0
  304. package/dist/provider/utils/constants.js +10 -0
  305. package/dist/provider/utils/paraConfigTypeGuards.d.ts +7 -0
  306. package/dist/provider/utils/paraConfigTypeGuards.js +13 -0
  307. package/dist/provider/utils/renameMutations.d.ts +5 -0
  308. package/dist/provider/utils/renameMutations.js +18 -0
  309. package/dist/public/Inter-VariableFont_slnt,wght.ttf +0 -0
  310. package/package.json +63 -0
  311. package/styles.css/package.json +3 -0
@@ -0,0 +1,626 @@
1
+ "use client";
2
+ import {
3
+ __async,
4
+ __spreadValues
5
+ } from "../../chunk-MMUBH76A.js";
6
+ import { jsx } from "react/jsx-runtime";
7
+ import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
8
+ import { isMobile, truncateAddress } from "@getpara/web-sdk";
9
+ import { useInternalClient } from "../hooks/utils/useInternalClient.js";
10
+ import { useStore } from "../stores/useStore.js";
11
+ import { ModalStep } from "../../modal/index.js";
12
+ import { useModalStore } from "../../modal/stores/index.js";
13
+ import { useAccount, useModal, useParaStatus, useVerifyExternalWallet, useWalletState } from "../hooks/index.js";
14
+ import {
15
+ COSMOS_WALLETS,
16
+ EVM_WALLETS,
17
+ SOLANA_WALLETS
18
+ } from "@getpara/web-sdk";
19
+ import { useAuthActions } from "./AuthProvider.js";
20
+ const useWalletDisplayHelpers = (wallet) => {
21
+ const isUsingMobileConnector = useModalStore((state) => state.isUsingMobileConnector);
22
+ return {
23
+ // Show the extension screen if on web and the wallet is an extension and installed or the wallet isn't a mobile wallet
24
+ // Also show the extension connection if on desktop for a solana wallet (no walletConnect)
25
+ showExtension: !isMobile() && ((wallet == null ? void 0 : wallet.isExtension) && (wallet == null ? void 0 : wallet.installed) || !(wallet == null ? void 0 : wallet.isMobile) || (wallet == null ? void 0 : wallet.type) === "SOLANA"),
26
+ // Show the mobile screen if on mobile and the wallet is a mobile wallet or if on desktop and the wallet isn't installed
27
+ showMobile: isMobile() && (wallet == null ? void 0 : wallet.isMobile) || !isMobile() && !(wallet == null ? void 0 : wallet.installed),
28
+ isCosmosMobileWallet: (wallet == null ? void 0 : wallet.type) === "COSMOS" && !!isUsingMobileConnector
29
+ };
30
+ };
31
+ const defaultExternalWallet = {
32
+ wallets: [],
33
+ chains: [],
34
+ chainId: void 0,
35
+ wallet: void 0,
36
+ qrUri: void 0,
37
+ chainIdSwitchingTo: void 0,
38
+ walletDisplayHelpers: { showExtension: false, showMobile: false, isCosmosMobileWallet: false },
39
+ username: void 0,
40
+ avatar: void 0,
41
+ connectExternalWallet: () => Promise.resolve(),
42
+ disconnectExternalWallet: () => Promise.resolve(),
43
+ switchChain: () => Promise.resolve(),
44
+ setChainIdSwitchingTo: () => {
45
+ },
46
+ connectEmbeddedToExternalConnectors: () => Promise.resolve(),
47
+ verifyWalletSignature: () => Promise.resolve({}),
48
+ signMessage: () => Promise.resolve({}),
49
+ isSigningMessage: false,
50
+ getWalletBalance: () => Promise.resolve(void 0),
51
+ requestInfo: (_) => Promise.resolve({}),
52
+ disconnectBase: (_) => Promise.resolve(),
53
+ connectFarcasterMiniApp: () => Promise.resolve()
54
+ };
55
+ const ExternalWalletContext = createContext(defaultExternalWallet);
56
+ function ExternalWalletProvider({ children }) {
57
+ const { isReady, isFarcasterMiniApp } = useParaStatus();
58
+ const { closeModal } = useModal();
59
+ const { isConnected } = useAccount();
60
+ const farcasterMiniAppConfig = useStore((state) => state.farcasterMiniAppConfig);
61
+ const evmContext = useStore((state) => state.evmContext);
62
+ const cosmosContext = useStore((state) => state.cosmosContext);
63
+ const solanaContext = useStore((state) => state.solanaContext);
64
+ const externalWallets = useStore((state) => state.externalWallets);
65
+ const externalWalletsWithFullAuth = useStore((state) => state.externalWalletsWithFullAuth);
66
+ const includeWalletVerification = useStore((state) => state.includeWalletVerification);
67
+ const connectionOnly = useStore((state) => state.connectionOnly);
68
+ const {
69
+ wallets: evmWallets,
70
+ disconnect: evmDisconnect,
71
+ chains: evmChains,
72
+ chainId: evmChainId,
73
+ switchChain: evmSwitchChain,
74
+ username: evmUsername,
75
+ avatar: evmAvatar,
76
+ connectParaEmbedded: evmConnectParaEmbedded,
77
+ signMessage: evmSignMessage,
78
+ signVerificationMessage: evmSignVerificationMessage,
79
+ getWalletBalance: evmGetWalletBalance,
80
+ requestInfo: evmRequestInfo,
81
+ disconnectBase: evmDisconnectBase,
82
+ farcasterStatus: evmFarcasterStatus
83
+ } = useContext(evmContext);
84
+ const {
85
+ wallets: solanaWallets,
86
+ disconnect: solanaDisconnect,
87
+ signMessage: solanaSignMessage,
88
+ signVerificationMessage: solanaSignVerificationMessage,
89
+ requestInfo: solanaRequestInfo,
90
+ disconnectBase: solanaDisconnectBase,
91
+ farcasterStatus: solanaFarcasterStatus
92
+ } = useContext(solanaContext);
93
+ const {
94
+ wallets: cosmosWallets,
95
+ disconnect: cosmosDisconnect,
96
+ chains: cosmosChains,
97
+ chainId: cosmosChainId,
98
+ switchChain: cosmosSwitchChain,
99
+ connectParaEmbedded: cosmosConnectParaEmbedded,
100
+ signMessage: cosmosSignMessage,
101
+ signVerificationMessage: cosmosSignVerificationMessage,
102
+ requestInfo: cosmosRequestInfo,
103
+ disconnectBase: cosmosDisconnectBase
104
+ } = useContext(cosmosContext);
105
+ const onLoginRef = useStore((state) => state.onLoginRef);
106
+ const setStep = useModalStore((state) => state.setStep);
107
+ const setStepDirection = useModalStore((state) => state.setStepDirection);
108
+ const setIsExternalWalletConnecting = useModalStore((state) => state.setIsExternalWalletConnecting);
109
+ const isExternalWalletConnecting = useModalStore((state) => state.isExternalWalletConnecting);
110
+ const setSelectedExternalWalletId = useModalStore((state) => state.setSelectedExternalWalletId);
111
+ const selectedExternalWalletId = useModalStore((state) => state.selectedExternalWalletId);
112
+ const setExternalWalletError = useModalStore((state) => state.setExternalWalletError);
113
+ const setIsUsingMobileConnector = useModalStore((state) => state.setIsUsingMobileConnector);
114
+ const refs = useModalStore((state) => state.refs);
115
+ const para = useInternalClient();
116
+ const { setSelectedWallet } = useWalletState();
117
+ const { onNewAuthState } = useAuthActions();
118
+ const { mutateAsync: verifyExternalWallet } = useVerifyExternalWallet();
119
+ const [qrUri, setQrUri] = useState();
120
+ const [chainIdSwitchingTo, setChainIdSwitchingTo] = useState();
121
+ const [isSigningMessage, setIsSigningMessage] = useState(false);
122
+ const wallets = [...evmWallets, ...solanaWallets, ...cosmosWallets].filter(
123
+ (w) => (w.internalId !== "FARCASTER" || (para == null ? void 0 : para.isFarcasterMiniApp)) && externalWallets.includes(w.id.toUpperCase())
124
+ ).sort(
125
+ (a, b) => externalWallets.indexOf(a.id.toUpperCase()) - externalWallets.indexOf(b.id.toUpperCase())
126
+ ).sort((a, b) => a.installed === b.installed ? 0 : a.installed ? -1 : 1);
127
+ const wallet = useMemo(
128
+ () => wallets.find((w) => w.internalId === selectedExternalWalletId),
129
+ [wallets, selectedExternalWalletId]
130
+ );
131
+ const updateQrUri = () => __async(this, null, function* () {
132
+ var _a;
133
+ const uri = yield (_a = wallet == null ? void 0 : wallet.getQrUri) == null ? void 0 : _a.call(wallet);
134
+ setQrUri(uri);
135
+ });
136
+ useEffect(() => {
137
+ if (wallet) {
138
+ if (!qrUri) {
139
+ updateQrUri();
140
+ }
141
+ } else if (qrUri) {
142
+ setQrUri(void 0);
143
+ }
144
+ }, [wallet]);
145
+ const getWalletBalance = useCallback(() => __async(this, null, function* () {
146
+ var _a;
147
+ const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
148
+ switch (walletType) {
149
+ case "EVM": {
150
+ return yield evmGetWalletBalance();
151
+ }
152
+ default: {
153
+ return void 0;
154
+ }
155
+ }
156
+ }), [evmGetWalletBalance, selectedExternalWalletId]);
157
+ const chains = useMemo(() => {
158
+ var _a;
159
+ const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
160
+ switch (walletType) {
161
+ case "COSMOS": {
162
+ return cosmosChains;
163
+ }
164
+ case "EVM": {
165
+ return evmChains;
166
+ }
167
+ default: {
168
+ return [];
169
+ }
170
+ }
171
+ }, [cosmosChains, evmChains, selectedExternalWalletId]);
172
+ const chainId = useMemo(() => {
173
+ var _a;
174
+ const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
175
+ switch (walletType) {
176
+ case "COSMOS": {
177
+ return cosmosChainId;
178
+ }
179
+ case "EVM": {
180
+ return evmChainId == null ? void 0 : evmChainId.toString();
181
+ }
182
+ default: {
183
+ return void 0;
184
+ }
185
+ }
186
+ }, [cosmosChains, evmChains, selectedExternalWalletId]);
187
+ const switchChain = useCallback(
188
+ (chainId2) => __async(this, null, function* () {
189
+ var _a;
190
+ const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
191
+ if (walletType) {
192
+ let resp;
193
+ setExternalWalletError();
194
+ setChainIdSwitchingTo(chainId2);
195
+ switch (walletType) {
196
+ case "COSMOS": {
197
+ setStep(ModalStep.CHAIN_SWITCH);
198
+ resp = yield cosmosSwitchChain(chainId2);
199
+ break;
200
+ }
201
+ case "EVM": {
202
+ setStep(ModalStep.CHAIN_SWITCH);
203
+ resp = yield evmSwitchChain(parseInt(chainId2));
204
+ break;
205
+ }
206
+ default: {
207
+ resp = {};
208
+ break;
209
+ }
210
+ }
211
+ if (resp.error) {
212
+ setExternalWalletError(resp.error);
213
+ } else {
214
+ setChainIdSwitchingTo(void 0);
215
+ setStepDirection(-1);
216
+ setStep(ModalStep.ACCOUNT_MAIN);
217
+ }
218
+ }
219
+ }),
220
+ [evmSwitchChain, cosmosSwitchChain]
221
+ );
222
+ const verifyWalletSignature = useCallback(() => __async(this, null, function* () {
223
+ var _a;
224
+ setExternalWalletError();
225
+ const wallet2 = Object.values(para.externalWallets)[0];
226
+ const walletType = wallet2 == null ? void 0 : wallet2.type;
227
+ let verifyExternalWalletParams;
228
+ const withVerification = includeWalletVerification;
229
+ const isConnectionOnly = connectionOnly;
230
+ const withFullParaAuth = (wallet2 == null ? void 0 : wallet2.name) ? externalWalletsWithFullAuth.includes(wallet2.name.toUpperCase()) : false;
231
+ const defaultWalletInfo = {
232
+ withVerification,
233
+ isConnectionOnly,
234
+ withFullParaAuth,
235
+ provider: wallet2.name,
236
+ providerId: wallet2.externalProviderId,
237
+ isExternal: true
238
+ };
239
+ switch (walletType) {
240
+ case "COSMOS":
241
+ {
242
+ const { address, signature, error, cosmosPublicKeyHex, cosmosSigner, addressBech32 } = yield cosmosSignVerificationMessage();
243
+ if (error) {
244
+ setExternalWalletError([error]);
245
+ } else if (signature && address) {
246
+ verifyExternalWalletParams = {
247
+ externalWallet: __spreadValues({
248
+ partnerId: para.partnerId,
249
+ type: "COSMOS",
250
+ address,
251
+ addressBech32
252
+ }, defaultWalletInfo),
253
+ signedMessage: signature,
254
+ cosmosPublicKeyHex,
255
+ cosmosSigner
256
+ };
257
+ }
258
+ }
259
+ break;
260
+ case "EVM":
261
+ {
262
+ const { signature, error, address } = yield evmSignVerificationMessage();
263
+ if (error) {
264
+ setExternalWalletError([error]);
265
+ } else if (signature && address) {
266
+ verifyExternalWalletParams = {
267
+ externalWallet: __spreadValues({
268
+ partnerId: para.partnerId,
269
+ type: "EVM",
270
+ address
271
+ }, defaultWalletInfo),
272
+ signedMessage: signature
273
+ };
274
+ }
275
+ }
276
+ break;
277
+ case "SOLANA":
278
+ {
279
+ const { signature, error, address } = yield solanaSignVerificationMessage();
280
+ if (error) {
281
+ setExternalWalletError([error]);
282
+ } else if (signature && address) {
283
+ verifyExternalWalletParams = {
284
+ externalWallet: __spreadValues({
285
+ partnerId: para.partnerId,
286
+ type: "SOLANA",
287
+ address
288
+ }, defaultWalletInfo),
289
+ signedMessage: signature
290
+ };
291
+ }
292
+ }
293
+ break;
294
+ default:
295
+ break;
296
+ }
297
+ if (!(verifyExternalWalletParams == null ? void 0 : verifyExternalWalletParams.externalWallet) || !(verifyExternalWalletParams == null ? void 0 : verifyExternalWalletParams.signedMessage)) {
298
+ console.error("No signature or address found on the verifyWalletSignature response.");
299
+ setExternalWalletError(["Signature verification failed."]);
300
+ return;
301
+ }
302
+ try {
303
+ const d = yield verifyExternalWallet(verifyExternalWalletParams);
304
+ if (wallet2 && (externalWalletsWithFullAuth == null ? void 0 : externalWalletsWithFullAuth.includes((_a = wallet2.name) == null ? void 0 : _a.toUpperCase()))) {
305
+ yield onNewAuthState(d);
306
+ } else {
307
+ setStep(ModalStep.LOGIN_DONE);
308
+ }
309
+ } catch (e) {
310
+ console.error("Error verifying signature:", e);
311
+ setExternalWalletError(["Signature verification failed."]);
312
+ }
313
+ return verifyExternalWalletParams;
314
+ }), [cosmosSignVerificationMessage, evmSignVerificationMessage, solanaSignVerificationMessage, wallet]);
315
+ const signMessage = useCallback(
316
+ (_0) => __async(this, [_0], function* ({ message, externalWallet: _externalWallet }) {
317
+ var _a;
318
+ setExternalWalletError();
319
+ setIsSigningMessage(true);
320
+ let externalWallet = _externalWallet;
321
+ const walletType = (externalWallet == null ? void 0 : externalWallet.type) || ((_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type);
322
+ let response;
323
+ try {
324
+ switch (walletType) {
325
+ case "COSMOS":
326
+ {
327
+ const { address, signature, error, cosmosPublicKeyHex, cosmosSigner } = yield cosmosSignMessage({
328
+ message,
329
+ externalWallet
330
+ });
331
+ if (error) {
332
+ throw new Error(error);
333
+ } else if (signature && address) {
334
+ response = { address, signature, cosmosPublicKeyHex, cosmosSigner };
335
+ }
336
+ }
337
+ break;
338
+ case "EVM":
339
+ {
340
+ const { address, signature, error } = yield evmSignMessage({ message, externalWallet });
341
+ if (error) {
342
+ throw new Error(error);
343
+ } else if (signature && address) {
344
+ response = { address, signature };
345
+ }
346
+ }
347
+ break;
348
+ case "SOLANA":
349
+ {
350
+ const { signature, error, address } = yield solanaSignMessage({ message });
351
+ if (error) {
352
+ throw new Error(error);
353
+ } else if (signature && address) {
354
+ response = { address, signature };
355
+ }
356
+ }
357
+ break;
358
+ default:
359
+ break;
360
+ }
361
+ setIsSigningMessage(false);
362
+ return response;
363
+ } catch (error) {
364
+ setIsSigningMessage(false);
365
+ throw error;
366
+ }
367
+ }),
368
+ [cosmosSignMessage, evmSignMessage, solanaSignMessage]
369
+ );
370
+ const connectExternalWallet = useCallback(
371
+ (wallet2, isMobileConnect, isManualWalletConnect, isResetAfterManualWalletConnect) => __async(this, null, function* () {
372
+ if (isExternalWalletConnecting && isManualWalletConnect) {
373
+ yield evmDisconnect();
374
+ yield solanaDisconnect();
375
+ yield cosmosDisconnect();
376
+ setQrUri(void 0);
377
+ setIsExternalWalletConnecting(false);
378
+ }
379
+ if (isResetAfterManualWalletConnect || isManualWalletConnect || !isExternalWalletConnecting) {
380
+ setExternalWalletError();
381
+ setIsExternalWalletConnecting(true);
382
+ setIsUsingMobileConnector(isMobileConnect);
383
+ const { address, error, authState } = yield isMobileConnect ? wallet2.connectMobile(isManualWalletConnect, connectionOnly) : wallet2.connect(connectionOnly);
384
+ if (error) {
385
+ setExternalWalletError([error]);
386
+ setIsUsingMobileConnector();
387
+ if (isManualWalletConnect && error === "Connection request rejected") {
388
+ setExternalWalletError();
389
+ yield connectExternalWallet(wallet2, false, false, true);
390
+ yield updateQrUri();
391
+ return;
392
+ }
393
+ } else if (address) {
394
+ if (!!authState && ((externalWalletsWithFullAuth == null ? void 0 : externalWalletsWithFullAuth.includes(wallet2.name.toUpperCase())) || includeWalletVerification)) {
395
+ onNewAuthState(authState);
396
+ } else {
397
+ setStep(ModalStep.LOGIN_DONE);
398
+ }
399
+ }
400
+ setIsExternalWalletConnecting(false);
401
+ }
402
+ }),
403
+ [isExternalWalletConnecting, externalWalletsWithFullAuth, connectionOnly, includeWalletVerification]
404
+ );
405
+ const connectFarcasterMiniApp = () => __async(this, null, function* () {
406
+ const evmWallet = para.supportedWalletTypes.find(({ type }) => type === "EVM") ? evmWallets.find((w) => w.internalId === "FARCASTER") : void 0;
407
+ const solanaWallet = para.supportedWalletTypes.find(({ type }) => type === "SOLANA") ? solanaWallets.find((w) => w.internalId === "FARCASTER") : void 0;
408
+ if (evmWallet || solanaWallet) {
409
+ const loginWallets = [];
410
+ if (evmWallet && (evmFarcasterStatus == null ? void 0 : evmFarcasterStatus.isPresent)) {
411
+ const isEvmConnected = evmFarcasterStatus.isConnected && !!evmFarcasterStatus.address;
412
+ if (isEvmConnected) {
413
+ loginWallets.push({
414
+ type: "EVM",
415
+ provider: "Farcaster",
416
+ providerId: "FARCASTER",
417
+ address: evmFarcasterStatus.address,
418
+ isConnectionOnly: true
419
+ });
420
+ } else {
421
+ yield connectExternalWallet(evmWallet, false, true);
422
+ }
423
+ }
424
+ if (solanaWallet && (solanaFarcasterStatus == null ? void 0 : solanaFarcasterStatus.isPresent)) {
425
+ const isSolanaConnected = solanaFarcasterStatus.isConnected && !!solanaFarcasterStatus.address;
426
+ if (isSolanaConnected) {
427
+ loginWallets.push({
428
+ type: "SOLANA",
429
+ provider: "Farcaster",
430
+ providerId: "FARCASTER",
431
+ address: solanaFarcasterStatus.address,
432
+ isConnectionOnly: true
433
+ });
434
+ } else {
435
+ yield connectExternalWallet(solanaWallet, false, true);
436
+ }
437
+ }
438
+ if (loginWallets.length > 0) {
439
+ yield para.loginExternalWallet({
440
+ externalWallet: loginWallets
441
+ });
442
+ }
443
+ closeModal();
444
+ }
445
+ });
446
+ const requestInfo = (providerId, type) => __async(this, null, function* () {
447
+ switch (type) {
448
+ case "EVM": {
449
+ const externalWallet = yield evmRequestInfo(providerId);
450
+ return externalWallet;
451
+ }
452
+ case "SOLANA": {
453
+ const externalWallet = yield solanaRequestInfo(providerId);
454
+ return externalWallet;
455
+ }
456
+ case "COSMOS": {
457
+ const externalWallet = yield cosmosRequestInfo(providerId);
458
+ return externalWallet;
459
+ }
460
+ }
461
+ });
462
+ const disconnectBase = (providerId) => __async(this, null, function* () {
463
+ const [isEvm, isSolana, _isCosmos] = [
464
+ EVM_WALLETS.includes(providerId),
465
+ SOLANA_WALLETS.includes(providerId),
466
+ COSMOS_WALLETS.includes(providerId)
467
+ ];
468
+ switch (true) {
469
+ case isEvm:
470
+ yield evmDisconnectBase(providerId);
471
+ break;
472
+ case isSolana:
473
+ yield solanaDisconnectBase(providerId);
474
+ break;
475
+ default: {
476
+ yield cosmosDisconnectBase();
477
+ break;
478
+ }
479
+ }
480
+ });
481
+ const disconnectExternalWallet = () => __async(this, null, function* () {
482
+ yield para.logout();
483
+ yield evmDisconnect();
484
+ yield cosmosDisconnect();
485
+ setSelectedExternalWalletId();
486
+ yield solanaDisconnect();
487
+ });
488
+ const walletDisplayHelpers = useWalletDisplayHelpers(wallet);
489
+ const username = useMemo(() => {
490
+ let username2;
491
+ const storedExternalWallet = Object.values(para.externalWallets || {})[0];
492
+ if (storedExternalWallet) {
493
+ const walletType = storedExternalWallet == null ? void 0 : storedExternalWallet.type;
494
+ switch (walletType) {
495
+ case "EVM": {
496
+ username2 = evmUsername ? evmUsername.startsWith("0x") ? truncateAddress(evmUsername, "EVM") : evmUsername : void 0;
497
+ break;
498
+ }
499
+ default: {
500
+ username2 = storedExternalWallet.address && storedExternalWallet.type ? truncateAddress(storedExternalWallet.address, storedExternalWallet.type) : void 0;
501
+ break;
502
+ }
503
+ }
504
+ }
505
+ return username2;
506
+ }, [evmUsername, wallet]);
507
+ const avatar = useMemo(() => {
508
+ var _a;
509
+ const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
510
+ if (walletType) {
511
+ switch (walletType) {
512
+ case "EVM": {
513
+ return evmAvatar;
514
+ }
515
+ default: {
516
+ return void 0;
517
+ }
518
+ }
519
+ }
520
+ }, [evmAvatar, wallet]);
521
+ const connectEmbeddedToExternalConnectors = useCallback(() => __async(this, null, function* () {
522
+ const evmWallet = para.findWallet(void 0, void 0, { type: ["EVM"] });
523
+ const cosmosWallet = para.findWallet(void 0, void 0, { type: ["COSMOS"] });
524
+ if (evmWallet) {
525
+ try {
526
+ const { error } = yield evmConnectParaEmbedded();
527
+ if (error) {
528
+ console.warn("Failed to connect Para EVM wallet to Wagmi:", error);
529
+ } else {
530
+ if (evmWallet) {
531
+ setSelectedWallet({ id: evmWallet.id, type: "EVM" });
532
+ }
533
+ }
534
+ } catch (err) {
535
+ console.warn("Error calling connectParaEvmWallet:", err);
536
+ }
537
+ }
538
+ if (cosmosWallet) {
539
+ try {
540
+ const { error } = yield cosmosConnectParaEmbedded();
541
+ if (error) {
542
+ console.warn("Failed to connect Para Cosmos wallet to Graz:", error);
543
+ } else {
544
+ if (cosmosWallet) {
545
+ setSelectedWallet({ id: cosmosWallet.id, type: "COSMOS" });
546
+ }
547
+ }
548
+ } catch (err) {
549
+ console.warn("Error calling connectParaCosmosWallet:", err);
550
+ }
551
+ }
552
+ }), [evmConnectParaEmbedded, cosmosConnectParaEmbedded]);
553
+ useEffect(() => {
554
+ onLoginRef.current = () => __async(this, null, function* () {
555
+ yield connectEmbeddedToExternalConnectors();
556
+ });
557
+ }, [connectEmbeddedToExternalConnectors]);
558
+ useEffect(() => {
559
+ if (isReady && isFarcasterMiniApp && !isConnected && !(farcasterMiniAppConfig == null ? void 0 : farcasterMiniAppConfig.disableAutoConnect) && !refs.wasSignedIn.current && !refs.initialFarcasterConnected.current && !!evmFarcasterStatus && !!solanaFarcasterStatus) {
560
+ refs.initialFarcasterConnected.current = true;
561
+ connectFarcasterMiniApp();
562
+ }
563
+ }, [isReady, isConnected, isFarcasterMiniApp, farcasterMiniAppConfig, evmFarcasterStatus, solanaFarcasterStatus]);
564
+ return /* @__PURE__ */ jsx(
565
+ ExternalWalletContext.Provider,
566
+ {
567
+ value: useMemo(
568
+ () => ({
569
+ wallets,
570
+ chains,
571
+ chainId,
572
+ wallet,
573
+ qrUri,
574
+ walletDisplayHelpers,
575
+ chainIdSwitchingTo,
576
+ username,
577
+ avatar,
578
+ connectExternalWallet,
579
+ disconnectExternalWallet,
580
+ switchChain,
581
+ setChainIdSwitchingTo,
582
+ connectEmbeddedToExternalConnectors,
583
+ signMessage,
584
+ isSigningMessage,
585
+ verifyWalletSignature,
586
+ getWalletBalance,
587
+ requestInfo,
588
+ disconnectBase,
589
+ connectFarcasterMiniApp
590
+ }),
591
+ [
592
+ wallets,
593
+ chains,
594
+ chainId,
595
+ wallet,
596
+ qrUri,
597
+ walletDisplayHelpers,
598
+ chainIdSwitchingTo,
599
+ username,
600
+ avatar,
601
+ disconnectExternalWallet,
602
+ connectExternalWallet,
603
+ switchChain,
604
+ setChainIdSwitchingTo,
605
+ connectEmbeddedToExternalConnectors,
606
+ signMessage,
607
+ isSigningMessage,
608
+ verifyWalletSignature,
609
+ getWalletBalance,
610
+ requestInfo,
611
+ disconnectBase,
612
+ connectFarcasterMiniApp
613
+ ]
614
+ ),
615
+ children
616
+ }
617
+ );
618
+ }
619
+ const useExternalWallets = () => useContext(ExternalWalletContext);
620
+ export {
621
+ ExternalWalletContext,
622
+ ExternalWalletProvider,
623
+ defaultExternalWallet,
624
+ useExternalWallets,
625
+ useWalletDisplayHelpers
626
+ };
@@ -0,0 +1,7 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { ParaSolanaProviderProps } from '@getpara/solana-wallet-connectors';
3
+ import { ExternalWalletProviderCommon, ParaSolanaProviderConfigNoWallets } from '../types/externalWalletProviders.js';
4
+ export declare function SolanaExternalWalletProvider({ children, isUsing, wallets: walletsFromProps, ...rest }: Omit<ParaSolanaProviderProps, 'config'> & {
5
+ config: ParaSolanaProviderConfigNoWallets;
6
+ } & PropsWithChildren & ExternalWalletProviderCommon): string | number | boolean | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
7
+ export declare const MemoizedSolanaExternalWalletProvider: import("react").MemoExoticComponent<typeof SolanaExternalWalletProvider>;
@@ -0,0 +1,66 @@
1
+ "use client";
2
+ import {
3
+ __async,
4
+ __objRest,
5
+ __spreadProps,
6
+ __spreadValues
7
+ } from "../../chunk-MMUBH76A.js";
8
+ import { jsx } from "react/jsx-runtime";
9
+ import { memo, useEffect, useMemo } from "react";
10
+ import { useStore } from "../stores/useStore.js";
11
+ import { getParaSolanaConnector } from "../external/getParaSolanaConnector.js";
12
+ function SolanaExternalWalletProvider(_a) {
13
+ var _b = _a, {
14
+ children,
15
+ isUsing,
16
+ wallets: walletsFromProps
17
+ } = _b, rest = __objRest(_b, [
18
+ "children",
19
+ "isUsing",
20
+ "wallets"
21
+ ]);
22
+ const setSolanaContext = useStore((state) => state.setSolanaContext);
23
+ const setSolanaProvider = useStore((state) => state.setSolanaProvider);
24
+ const SolanaProvider = useStore((state) => state.SolanaProvider);
25
+ const setSolanaWallets = useStore((state) => state.setSolanaWallets);
26
+ const solanaWallets = useStore((state) => state.solanaWallets);
27
+ const isLoadingLib = useStore((state) => state.isLoadingSolanaLib);
28
+ const setIsLoadingLib = useStore((state) => state.setIsLoadingSolanaLib);
29
+ const filteredWallets = useMemo(
30
+ () => solanaWallets.filter((w) => walletsFromProps.includes(w().id.toUpperCase())),
31
+ [solanaWallets, walletsFromProps]
32
+ );
33
+ useEffect(() => {
34
+ const loadLib = () => __async(this, null, function* () {
35
+ if (SolanaProvider) {
36
+ return;
37
+ }
38
+ const { Provider, context, wallets } = yield getParaSolanaConnector();
39
+ if (Provider) {
40
+ setSolanaProvider(Provider);
41
+ }
42
+ if (wallets) {
43
+ setSolanaWallets(wallets);
44
+ }
45
+ if (context) {
46
+ setSolanaContext(context);
47
+ }
48
+ setIsLoadingLib(false);
49
+ });
50
+ loadLib();
51
+ }, []);
52
+ if (isLoadingLib) {
53
+ return null;
54
+ }
55
+ if (SolanaProvider) {
56
+ return /* @__PURE__ */ jsx(SolanaProvider, __spreadProps(__spreadValues({}, rest), { config: __spreadProps(__spreadValues({}, rest == null ? void 0 : rest.config), { wallets: filteredWallets }), children }));
57
+ } else if (isUsing) {
58
+ console.warn("@getpara/solana-wallet-connectors is required to use an external Solana wallet.");
59
+ }
60
+ return children;
61
+ }
62
+ const MemoizedSolanaExternalWalletProvider = memo(SolanaExternalWalletProvider);
63
+ export {
64
+ MemoizedSolanaExternalWalletProvider,
65
+ SolanaExternalWalletProvider
66
+ };