@privy-io/react-auth 3.14.0 → 3.14.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 (239) hide show
  1. package/dist/cjs/{AccountNotFoundScreen-B2BwM9IL.js → AccountNotFoundScreen-C25iBRLm.js} +1 -1
  2. package/dist/cjs/{Address-CMUXgM3h.js → Address-CHKhHgKJ.js} +1 -1
  3. package/dist/cjs/{AffirmativeConsentScreen-B7nTfKFs.js → AffirmativeConsentScreen-DT0ojGpw.js} +1 -1
  4. package/dist/cjs/{AllowlistRejectionScreen-C0ubkz2f.js → AllowlistRejectionScreen-D0I4vTcK.js} +1 -1
  5. package/dist/cjs/{AuthenticateWithWalletScreen-DHRXcjT5.js → AuthenticateWithWalletScreen-dcVrFqXU.js} +1 -1
  6. package/dist/cjs/{AwaitingEvmToSolBridgingScreen-D6MB0SW8.js → AwaitingEvmToSolBridgingScreen-20Lokl_2.js} +1 -1
  7. package/dist/cjs/{AwaitingExternalEthereumTransferScreen-BcnofXQv.js → AwaitingExternalEthereumTransferScreen-B2BOyvEP.js} +1 -1
  8. package/dist/cjs/{AwaitingPasswordlessCodeScreen-CMMIM_Pj.js → AwaitingPasswordlessCodeScreen-CjeHuBk7.js} +1 -1
  9. package/dist/cjs/{AwaitingSolToEvmBridgingScreen-C2Op_A4L.js → AwaitingSolToEvmBridgingScreen-NSyS8djM.js} +1 -1
  10. package/dist/cjs/{BridgeNetworkSelectionView-BU5hxQ4Z.js → BridgeNetworkSelectionView-Cy4dUUah.js} +1 -1
  11. package/dist/cjs/{CaptchaScreen-TVUbEsJK.js → CaptchaScreen-CchfnELg.js} +1 -1
  12. package/dist/cjs/{CoinbaseOnrampStatusScreen-_mCdKOIM.js → CoinbaseOnrampStatusScreen-RmmivwEu.js} +1 -1
  13. package/dist/cjs/{ConnectEmailForm-BgS2Yn3u.js → ConnectEmailForm-BibKRhlR.js} +1 -1
  14. package/dist/cjs/{ConnectLedgerScreen-DjDvgzxV.js → ConnectLedgerScreen-CB1oTLjq.js} +1 -1
  15. package/dist/cjs/{ConnectOnlyLandingScreen-CbUMwYrO.js → ConnectOnlyLandingScreen-BI0zDj3o.js} +1 -1
  16. package/dist/cjs/{ConnectOnlyStatusScreen-DyoV_8V9.js → ConnectOnlyStatusScreen-BAUS-OpP.js} +1 -1
  17. package/dist/cjs/{ConnectOrCreateScreen-DpR4OmSO.js → ConnectOrCreateScreen-CdoSL34u.js} +1 -1
  18. package/dist/cjs/{ConnectPhoneForm-CdRNa4Lg.js → ConnectPhoneForm-BPgbe0j3.js} +1 -1
  19. package/dist/cjs/{ConnectWalletView-Bb4271wb.js → ConnectWalletView-BB2DjcE-.js} +1 -1
  20. package/dist/cjs/{ConnectionStatusScreen-B8TxWdVC.js → ConnectionStatusScreen-D2pFs10v.js} +1 -1
  21. package/dist/cjs/{CrossAppAuthScreen-By4i5UqT.js → CrossAppAuthScreen-Dzqgp4fv.js} +1 -1
  22. package/dist/cjs/{CustomLandingScreenView-C0Vky31_.js → CustomLandingScreenView-Pamy7vPb.js} +1 -1
  23. package/dist/cjs/{DelegatedActionsConsentScreen-CjUYU339.js → DelegatedActionsConsentScreen-B1RznIyD.js} +1 -1
  24. package/dist/cjs/{DelegatedActionsRevokeScreen-BGATOJGL.js → DelegatedActionsRevokeScreen-BfYkymoM.js} +1 -1
  25. package/dist/cjs/{EmbeddedWalletConnectingScreen-GZ8nOvWq.js → EmbeddedWalletConnectingScreen-DaOL3Ico.js} +1 -1
  26. package/dist/cjs/{EmbeddedWalletCreatedScreen-Be8AYwZh.js → EmbeddedWalletCreatedScreen-B5K1ek4V.js} +1 -1
  27. package/dist/cjs/{EmbeddedWalletKeyExportScreen-DXa54jFw.js → EmbeddedWalletKeyExportScreen-BJTyn-Lk.js} +1 -1
  28. package/dist/cjs/{EmbeddedWalletOnAccountCreateScreen-C8-LkEhs.js → EmbeddedWalletOnAccountCreateScreen-BbZKkeLp.js} +1 -1
  29. package/dist/cjs/{EmbeddedWalletPasswordUpdateScreen-B7N8Noqf.js → EmbeddedWalletPasswordUpdateScreen-DMx4Tn8E.js} +1 -1
  30. package/dist/cjs/{EmbeddedWalletPasswordUpdateSplashScreen-kiTrvJ2h.js → EmbeddedWalletPasswordUpdateSplashScreen-wUfHEYpF.js} +1 -1
  31. package/dist/cjs/{EnrollTotp-Bxzun51r.js → EnrollTotp-B1qE1mCx.js} +1 -1
  32. package/dist/cjs/{ErrorScreen-BsvL8i4R.js → ErrorScreen-BPXQabSS.js} +1 -1
  33. package/dist/cjs/{FarcasterConnectStatusScreen-DMnzjTAV.js → FarcasterConnectStatusScreen-C_NK2UCS.js} +1 -1
  34. package/dist/cjs/{FarcasterSignerStatusScreen-Xb4KBH8f.js → FarcasterSignerStatusScreen-D3DUvPPw.js} +1 -1
  35. package/dist/cjs/{FundSolWalletWithExternalSolanaWallet-BT4nT21N.js → FundSolWalletWithExternalSolanaWallet-BoOhBVX9.js} +1 -1
  36. package/dist/cjs/{FundWalletMethodHeader-D_l3529h.js → FundWalletMethodHeader-BUHyY_8M.js} +1 -1
  37. package/dist/cjs/FundWithBankDepositScreen-D_qA2wCk.js +176 -0
  38. package/dist/cjs/{FundingEditAmountScreen-CBp--May.js → FundingEditAmountScreen-DLWLIjEZ.js} +1 -1
  39. package/dist/cjs/FundingMethodSelectionScreen-BRz8TLz5.js +1 -0
  40. package/dist/cjs/{InAppBrowserLoginNotPossible-fTc3VwS8.js → InAppBrowserLoginNotPossible-iLA0OVLk.js} +1 -1
  41. package/dist/cjs/{InstallWalletScreen-Bm_jzHEL.js → InstallWalletScreen-BS2Bwxvi.js} +1 -1
  42. package/dist/cjs/{LandingScreen-D6094d73.js → LandingScreen-C4KpTL08.js} +1 -1
  43. package/dist/cjs/{LinkConflictScreen-Bic4pZUv.js → LinkConflictScreen-CNQSun1F.js} +1 -1
  44. package/dist/cjs/{LinkEmailScreen-BuuqcFAa.js → LinkEmailScreen-oNzcpVes.js} +1 -1
  45. package/dist/cjs/{LinkPasskeyScreen-CbuNym_z.js → LinkPasskeyScreen-CjdxFDoA.js} +1 -1
  46. package/dist/cjs/{LinkPhoneScreen-ZIe5uzPN.js → LinkPhoneScreen-B6OzKZnd.js} +1 -1
  47. package/dist/cjs/{LoginFailedScreen-JnBtBxi1.js → LoginFailedScreen-Cj3ATfwH.js} +1 -1
  48. package/dist/cjs/{ManualTransferScreen-B4TkbelL.js → ManualTransferScreen-M26HCQmU.js} +1 -1
  49. package/dist/cjs/{MfaAuthEnrollmentFlowScreen-CmLIp9Ll.js → MfaAuthEnrollmentFlowScreen-D1zKxqD8.js} +1 -1
  50. package/dist/cjs/{MfaAuthVerifyFlowScreen-B3ATEO7f.js → MfaAuthVerifyFlowScreen-D3eQj9zt.js} +1 -1
  51. package/dist/cjs/{MfaEnrollmentFlowScreen-COciRqP3.js → MfaEnrollmentFlowScreen-B2gvvMfX.js} +1 -1
  52. package/dist/cjs/{MfaVerifyFlowScreen-BuljrcdS.js → MfaVerifyFlowScreen-AyHxACnF.js} +1 -1
  53. package/dist/cjs/{ModalHeader-C45fdSY0.js → ModalHeader-BCPQgekO.js} +1 -1
  54. package/dist/cjs/{MoonpayStatusScreen-zWJq589Z.js → MoonpayStatusScreen-BQaJBdWu.js} +1 -1
  55. package/dist/cjs/{OAuthStatusScreen-ecJqpiHx.js → OAuthStatusScreen-JHIOff6A.js} +1 -1
  56. package/dist/cjs/{PasskeySelectSignupOrLogin-B-0EIFsW.js → PasskeySelectSignupOrLogin-B9J49RMF.js} +1 -1
  57. package/dist/cjs/{PasskeyStatusScreen-DzuiIFq2.js → PasskeyStatusScreen-ms-tH4cc.js} +1 -1
  58. package/dist/cjs/{PasswordRecoveryScreen-DQEy0Nqy.js → PasswordRecoveryScreen-CDHZosNL.js} +1 -1
  59. package/dist/cjs/{QrCode-BKnLFoFt.js → QrCode-CE12LRBB.js} +1 -1
  60. package/dist/cjs/{RecoveryOAuthStatusScreen-06xKXwi8.js → RecoveryOAuthStatusScreen-BUxNTtqd.js} +1 -1
  61. package/dist/cjs/{RecoveryPasswordCreateScreen-yfl_af11.js → RecoveryPasswordCreateScreen-BkFOrb6m.js} +1 -1
  62. package/dist/cjs/{RecoverySelectionScreen-BdHkBTuB.js → RecoverySelectionScreen-HBLOm2va.js} +1 -1
  63. package/dist/cjs/{Screen-ChnafgL7.js → Screen-BfKedqka.js} +1 -1
  64. package/dist/cjs/{ScreenLayout-CpclvUVQ.js → ScreenLayout-CMb-Fua0.js} +1 -1
  65. package/dist/cjs/{SetAutomaticRecoveryScreen-JwwwXok0.js → SetAutomaticRecoveryScreen-DPjXBMos.js} +1 -1
  66. package/dist/cjs/{SetWalletPasswordForm-ByGHfNqH.js → SetWalletPasswordForm-BslxSGLC.js} +1 -1
  67. package/dist/cjs/{SignRequestScreen-Bcr25XmN.js → SignRequestScreen-Cjn1PsqC.js} +1 -1
  68. package/dist/cjs/{StandardSignAndSendTransactionScreen-D-63yMIJ.js → StandardSignAndSendTransactionScreen-BIh1TSV6.js} +1 -1
  69. package/dist/cjs/{TelegramAuthScreen-DxZS64fR.js → TelegramAuthScreen-BZpPqkC8.js} +1 -1
  70. package/dist/cjs/{TransactionDetails-DBFsWnn1.js → TransactionDetails-BY2Ynu2J.js} +1 -1
  71. package/dist/cjs/{TransactionErrorView-nUOKizXV.js → TransactionErrorView-CueeggTz.js} +1 -1
  72. package/dist/cjs/{TransferFromWalletScreen-CYPZmSPV.js → TransferFromWalletScreen-BfWPkgYH.js} +1 -1
  73. package/dist/cjs/{TransferOrBridgeLoadingScreen-DiPwnn60.js → TransferOrBridgeLoadingScreen-CI2oh7CB.js} +1 -1
  74. package/dist/cjs/{UpdateEmailScreen-Bwxxqz1k.js → UpdateEmailScreen-BHgHi-KQ.js} +1 -1
  75. package/dist/cjs/{UpdatePhoneScreen-DU7RGenX.js → UpdatePhoneScreen-J83rbDYY.js} +1 -1
  76. package/dist/cjs/{UserLimitReachedScreen-fuIfecOX.js → UserLimitReachedScreen-CYNd-wAp.js} +1 -1
  77. package/dist/cjs/{WalletInfoCard-DmD26XB9.js → WalletInfoCard-CHdyZdLe.js} +1 -1
  78. package/dist/cjs/{WalletInterstitialScreen-Bn8l3kCq.js → WalletInterstitialScreen-CmqF-Oas.js} +1 -1
  79. package/dist/cjs/{WalletLink-D7Q4z7WW.js → WalletLink-Bs_1C81F.js} +1 -1
  80. package/dist/cjs/{WalletOverflowButton-fU7XMRV1.js → WalletOverflowButton-BqeWaSEy.js} +1 -1
  81. package/dist/cjs/abstract-smart-wallets.js +1 -1
  82. package/dist/cjs/{context-DK3qW12H.js → context-D-ZJYjUg.js} +1 -1
  83. package/dist/cjs/{ethers-DpiO5t5F.js → ethers-SCb3aakT.js} +1 -1
  84. package/dist/cjs/extended-chains.js +1 -1
  85. package/dist/cjs/{get-is-unified-wallet-CMHZpDfE.js → get-is-unified-wallet-UpdjHxOV.js} +1 -1
  86. package/dist/cjs/{index-DhmrMcn2.js → index-BcyDbfqY.js} +1 -1
  87. package/dist/cjs/{index-CgsQCH2r.js → index-C8lpxYDX.js} +3 -3
  88. package/dist/cjs/{index-VgEQ4kaA.js → index-gohEbwKU.js} +1 -1
  89. package/dist/cjs/index.js +1 -1
  90. package/dist/cjs/internal.js +1 -1
  91. package/dist/cjs/{shared-BTeM_5HJ.js → shared-e1wjsjhc.js} +1 -1
  92. package/dist/cjs/{shouldProceedtoEmbeddedWalletCreationFlow-eB6IctoD.js → shouldProceedtoEmbeddedWalletCreationFlow-DADJI9f0.js} +1 -1
  93. package/dist/cjs/{smart-wallets-DPXIV14D.js → smart-wallets-D-oPjsFS.js} +1 -1
  94. package/dist/cjs/smart-wallets.js +1 -1
  95. package/dist/cjs/solana.js +1 -1
  96. package/dist/cjs/{styles-BfCR4pAO.js → styles-DUvzIwf1.js} +1 -1
  97. package/dist/cjs/{to-ui-error-CQ9FNFg-.js → to-ui-error-BJRhg6yc.js} +1 -1
  98. package/dist/cjs/ui.js +1 -1
  99. package/dist/cjs/use-export-wallet-B5ujV5Nk.js +1 -0
  100. package/dist/cjs/{use-export-wallet-Ddpx0kgg.js → use-export-wallet-Dt1qheK5.js} +1 -1
  101. package/dist/cjs/{useActiveWallet-BgdIZtS6.js → useActiveWallet-Cn6zOXx5.js} +1 -1
  102. package/dist/cjs/{useGetTokenPrice-CouzWOSt.js → useGetTokenPrice-761HAiva.js} +1 -1
  103. package/dist/cjs/{useI18n-DDbtkfuB.js → useI18n-DFGBJl_S.js} +1 -1
  104. package/dist/cjs/{usePrivy-DUT7RIf5.js → usePrivy-cfS6o4tX.js} +1 -1
  105. package/dist/cjs/{useSolanaRpcClient-CefJOh8Z.js → useSolanaRpcClient-PnNtmWdo.js} +1 -1
  106. package/dist/cjs/{useWallets-XTVLGZyz.js → useWallets-CKAypPZB.js} +1 -1
  107. package/dist/cjs/{useWallets-DXWvKTyb.js → useWallets-DeTGSqF_.js} +1 -1
  108. package/dist/dts/{events-context-Fks6josE.d.ts → events-context-Bz1yk0zU.d.mts} +1 -1
  109. package/dist/dts/{events-context-Fks6josE.d.mts → events-context-Bz1yk0zU.d.ts} +1 -1
  110. package/dist/dts/extended-chains.d.mts +1 -1
  111. package/dist/dts/extended-chains.d.ts +1 -1
  112. package/dist/dts/farcaster.d.mts +1 -1
  113. package/dist/dts/farcaster.d.ts +1 -1
  114. package/dist/dts/index.d.mts +4 -4
  115. package/dist/dts/index.d.ts +4 -4
  116. package/dist/dts/internal.d.mts +1 -1
  117. package/dist/dts/internal.d.ts +1 -1
  118. package/dist/dts/smart-wallets.d.mts +1 -1
  119. package/dist/dts/smart-wallets.d.ts +1 -1
  120. package/dist/dts/solana.d.mts +3 -3
  121. package/dist/dts/solana.d.ts +3 -3
  122. package/dist/dts/{types-CjDYScKX.d.mts → types-CIvz-X6P.d.mts} +21 -5
  123. package/dist/dts/{types-CjDYScKX.d.ts → types-CIvz-X6P.d.ts} +21 -5
  124. package/dist/dts/ui.d.mts +1 -1
  125. package/dist/dts/ui.d.ts +1 -1
  126. package/dist/esm/{AccountNotFoundScreen-DzQ8Ded6.mjs → AccountNotFoundScreen-C055cesr.mjs} +1 -1
  127. package/dist/esm/{Address-ClnXOtX_.mjs → Address-BjZb-TIL.mjs} +1 -1
  128. package/dist/esm/{AffirmativeConsentScreen-CGLpvQm4.mjs → AffirmativeConsentScreen-DXy2kEcy.mjs} +1 -1
  129. package/dist/esm/{AllowlistRejectionScreen-0T0W1npW.mjs → AllowlistRejectionScreen-BIzWPeoe.mjs} +1 -1
  130. package/dist/esm/{AuthenticateWithWalletScreen-aIIbB44q.mjs → AuthenticateWithWalletScreen-q3jQKiH6.mjs} +1 -1
  131. package/dist/esm/{AwaitingEvmToSolBridgingScreen-Bcx6oRJE.mjs → AwaitingEvmToSolBridgingScreen-B4R4PEVm.mjs} +1 -1
  132. package/dist/esm/{AwaitingExternalEthereumTransferScreen-BlmM5W1W.mjs → AwaitingExternalEthereumTransferScreen-Dwy69FD1.mjs} +1 -1
  133. package/dist/esm/{AwaitingPasswordlessCodeScreen-DxV44L8v.mjs → AwaitingPasswordlessCodeScreen-Ch_YXDTX.mjs} +1 -1
  134. package/dist/esm/{AwaitingSolToEvmBridgingScreen-C_VwI_Sw.mjs → AwaitingSolToEvmBridgingScreen-spElnpUE.mjs} +1 -1
  135. package/dist/esm/{BridgeNetworkSelectionView-F7koQMl8.mjs → BridgeNetworkSelectionView-CaDh-Zck.mjs} +1 -1
  136. package/dist/esm/{CaptchaScreen-BeoBh2yB.mjs → CaptchaScreen-BZy78GrD.mjs} +1 -1
  137. package/dist/esm/{CoinbaseOnrampStatusScreen-h359lw0u.mjs → CoinbaseOnrampStatusScreen-CTWZaE1o.mjs} +1 -1
  138. package/dist/esm/{ConnectEmailForm-D96RP15S.mjs → ConnectEmailForm-0GOHNayM.mjs} +1 -1
  139. package/dist/esm/{ConnectLedgerScreen-DlzVqbV7.mjs → ConnectLedgerScreen-CIPOaq8e.mjs} +1 -1
  140. package/dist/esm/{ConnectOnlyLandingScreen-wbu-70B6.mjs → ConnectOnlyLandingScreen-CbLV-cj4.mjs} +1 -1
  141. package/dist/esm/{ConnectOnlyStatusScreen-CbWmfcm8.mjs → ConnectOnlyStatusScreen-bmx1wwk1.mjs} +1 -1
  142. package/dist/esm/{ConnectOrCreateScreen-CSKKpNhC.mjs → ConnectOrCreateScreen-DXw5Y8gN.mjs} +1 -1
  143. package/dist/esm/{ConnectPhoneForm-Cfdo1Hxx.mjs → ConnectPhoneForm-_lOAQG_X.mjs} +1 -1
  144. package/dist/esm/{ConnectWalletView-D9FJQoQd.mjs → ConnectWalletView-CDqboUej.mjs} +1 -1
  145. package/dist/esm/{ConnectionStatusScreen-BCZOSVuo.mjs → ConnectionStatusScreen-D-9fLZfA.mjs} +1 -1
  146. package/dist/esm/{CrossAppAuthScreen-C9Y8UmMT.mjs → CrossAppAuthScreen-Co723kT3.mjs} +1 -1
  147. package/dist/esm/{CustomLandingScreenView-C9zIdEBy.mjs → CustomLandingScreenView-9mrgsDhT.mjs} +1 -1
  148. package/dist/esm/{DelegatedActionsConsentScreen-CRlv1sFS.mjs → DelegatedActionsConsentScreen-CyQTJHgT.mjs} +1 -1
  149. package/dist/esm/{DelegatedActionsRevokeScreen-CfOOZLtD.mjs → DelegatedActionsRevokeScreen-CFm4F3CM.mjs} +1 -1
  150. package/dist/esm/{EmbeddedWalletConnectingScreen-DuSxBQbx.mjs → EmbeddedWalletConnectingScreen-DmTtzGwq.mjs} +1 -1
  151. package/dist/esm/{EmbeddedWalletCreatedScreen--ZpH1G0k.mjs → EmbeddedWalletCreatedScreen-Cj1c5KyP.mjs} +1 -1
  152. package/dist/esm/{EmbeddedWalletKeyExportScreen-CSJq1Sik.mjs → EmbeddedWalletKeyExportScreen-CsWRTEgd.mjs} +1 -1
  153. package/dist/esm/{EmbeddedWalletOnAccountCreateScreen-DOSya90v.mjs → EmbeddedWalletOnAccountCreateScreen-DBAmWm90.mjs} +1 -1
  154. package/dist/esm/{EmbeddedWalletPasswordUpdateScreen-C_es2EpS.mjs → EmbeddedWalletPasswordUpdateScreen-B5w6wtgf.mjs} +1 -1
  155. package/dist/esm/{EmbeddedWalletPasswordUpdateSplashScreen-DhwnqiCK.mjs → EmbeddedWalletPasswordUpdateSplashScreen-BvsscceO.mjs} +1 -1
  156. package/dist/esm/{EnrollTotp-YxZ_oitd.mjs → EnrollTotp-uSQt9d2Q.mjs} +1 -1
  157. package/dist/esm/{ErrorScreen-DZ153hPv.mjs → ErrorScreen-DtGc3Chy.mjs} +1 -1
  158. package/dist/esm/{FarcasterConnectStatusScreen-CwQhh_aC.mjs → FarcasterConnectStatusScreen-DGeCyr6b.mjs} +1 -1
  159. package/dist/esm/{FarcasterSignerStatusScreen-D1SKEl4x.mjs → FarcasterSignerStatusScreen-DASa1xq2.mjs} +1 -1
  160. package/dist/esm/{FundSolWalletWithExternalSolanaWallet-CH85fmbL.mjs → FundSolWalletWithExternalSolanaWallet-0jNi_hvn.mjs} +1 -1
  161. package/dist/esm/{FundWalletMethodHeader-D0DhWPu0.mjs → FundWalletMethodHeader-Cfci4-83.mjs} +1 -1
  162. package/dist/esm/FundWithBankDepositScreen-D_uu3GEF.mjs +176 -0
  163. package/dist/esm/{FundingEditAmountScreen-C_YGQD1r.mjs → FundingEditAmountScreen-vQUS-a80.mjs} +1 -1
  164. package/dist/esm/FundingMethodSelectionScreen-G8gkM1Mk.mjs +1 -0
  165. package/dist/esm/{InAppBrowserLoginNotPossible-BiwxWFju.mjs → InAppBrowserLoginNotPossible-C8mlSbYe.mjs} +1 -1
  166. package/dist/esm/{InstallWalletScreen-DHPONpNA.mjs → InstallWalletScreen-D0kdHc5W.mjs} +1 -1
  167. package/dist/esm/{LandingScreen-DBZbonr_.mjs → LandingScreen-0MlIkV3C.mjs} +1 -1
  168. package/dist/esm/{LinkConflictScreen-D0TlabXV.mjs → LinkConflictScreen-DW31R5fr.mjs} +1 -1
  169. package/dist/esm/{LinkEmailScreen-D9zKrb4E.mjs → LinkEmailScreen-B10iXGH8.mjs} +1 -1
  170. package/dist/esm/{LinkPasskeyScreen-3_thbT6t.mjs → LinkPasskeyScreen-OxaghvUl.mjs} +1 -1
  171. package/dist/esm/{LinkPhoneScreen-BwBdaLqt.mjs → LinkPhoneScreen-Cdg3eg7w.mjs} +1 -1
  172. package/dist/esm/{LoginFailedScreen-Dxi-7tx8.mjs → LoginFailedScreen-BVOo2ycm.mjs} +1 -1
  173. package/dist/esm/{ManualTransferScreen-e347H8JC.mjs → ManualTransferScreen-_04Sq7zU.mjs} +1 -1
  174. package/dist/esm/{MfaAuthEnrollmentFlowScreen-BUF154dJ.mjs → MfaAuthEnrollmentFlowScreen-DApO6DPY.mjs} +1 -1
  175. package/dist/esm/{MfaAuthVerifyFlowScreen-BJ4ZNRWe.mjs → MfaAuthVerifyFlowScreen-mdmdgWdO.mjs} +1 -1
  176. package/dist/esm/{MfaEnrollmentFlowScreen-B5DfdOkM.mjs → MfaEnrollmentFlowScreen-DRZTnt-I.mjs} +1 -1
  177. package/dist/esm/{MfaVerifyFlowScreen-fjVmi3M8.mjs → MfaVerifyFlowScreen-mrf95cEs.mjs} +1 -1
  178. package/dist/esm/{ModalHeader-DBfMXKy4.mjs → ModalHeader-D8-mhjp4.mjs} +1 -1
  179. package/dist/esm/{MoonpayStatusScreen-BeZtoeAo.mjs → MoonpayStatusScreen-DDSK5dda.mjs} +1 -1
  180. package/dist/esm/{OAuthStatusScreen-BVLexXQC.mjs → OAuthStatusScreen-DSAUQ_YN.mjs} +1 -1
  181. package/dist/esm/{PasskeySelectSignupOrLogin-CejGrqSb.mjs → PasskeySelectSignupOrLogin-G19VpAdI.mjs} +1 -1
  182. package/dist/esm/{PasskeyStatusScreen-BrDLZfaA.mjs → PasskeyStatusScreen-TD2nYAnk.mjs} +1 -1
  183. package/dist/esm/{PasswordRecoveryScreen-Bks4ITku.mjs → PasswordRecoveryScreen-C0oVVZYe.mjs} +1 -1
  184. package/dist/esm/{QrCode-CKNL79V_.mjs → QrCode-C1tgJtOy.mjs} +1 -1
  185. package/dist/esm/{RecoveryOAuthStatusScreen-TsrFc2KU.mjs → RecoveryOAuthStatusScreen-Ca9VYOrA.mjs} +1 -1
  186. package/dist/esm/{RecoveryPasswordCreateScreen--aWRhenB.mjs → RecoveryPasswordCreateScreen-Q1zuy9fu.mjs} +1 -1
  187. package/dist/esm/{RecoverySelectionScreen-DJ33E1hd.mjs → RecoverySelectionScreen-scmqFA8Y.mjs} +1 -1
  188. package/dist/esm/{Screen-omroCwTV.mjs → Screen-Bp-TN9gb.mjs} +1 -1
  189. package/dist/esm/{ScreenLayout-z1I4hafk.mjs → ScreenLayout-DTmQLGPf.mjs} +1 -1
  190. package/dist/esm/{SetAutomaticRecoveryScreen-DelsQl1S.mjs → SetAutomaticRecoveryScreen-D-__1Pf7.mjs} +1 -1
  191. package/dist/esm/{SetWalletPasswordForm-DyVubYdV.mjs → SetWalletPasswordForm-0nuoz3XZ.mjs} +1 -1
  192. package/dist/esm/{SignRequestScreen-C6XvfvXV.mjs → SignRequestScreen-D6HSUOxx.mjs} +1 -1
  193. package/dist/esm/{StandardSignAndSendTransactionScreen-FQcyAQoq.mjs → StandardSignAndSendTransactionScreen-YlstFfkB.mjs} +1 -1
  194. package/dist/esm/{TelegramAuthScreen-LB2IdLqW.mjs → TelegramAuthScreen-DHCcieoC.mjs} +1 -1
  195. package/dist/esm/{TransactionDetails-CLHEcWFe.mjs → TransactionDetails-BurRo8R0.mjs} +1 -1
  196. package/dist/esm/{TransactionErrorView-D7uZmR_V.mjs → TransactionErrorView-CPFrt0L4.mjs} +1 -1
  197. package/dist/esm/{TransferFromWalletScreen-BLLYNl1T.mjs → TransferFromWalletScreen-BG5Mj5tz.mjs} +1 -1
  198. package/dist/esm/{TransferOrBridgeLoadingScreen-DgS9Jr0v.mjs → TransferOrBridgeLoadingScreen-DcCdHB-g.mjs} +1 -1
  199. package/dist/esm/{UpdateEmailScreen-DGAco54E.mjs → UpdateEmailScreen-ndRi1gY6.mjs} +1 -1
  200. package/dist/esm/{UpdatePhoneScreen-CLCixHYj.mjs → UpdatePhoneScreen-DoH__glA.mjs} +1 -1
  201. package/dist/esm/{UserLimitReachedScreen-ClahBH0m.mjs → UserLimitReachedScreen-BLzaOW7F.mjs} +1 -1
  202. package/dist/esm/{WalletInfoCard-BURM3rIP.mjs → WalletInfoCard-DFt8ndGE.mjs} +1 -1
  203. package/dist/esm/{WalletInterstitialScreen-CBzg1He2.mjs → WalletInterstitialScreen-BQ-ku50j.mjs} +1 -1
  204. package/dist/esm/{WalletLink-BXlPbPVx.mjs → WalletLink--05Hzo2b.mjs} +1 -1
  205. package/dist/esm/{WalletOverflowButton-CWeBF-Wv.mjs → WalletOverflowButton-BlijhJnI.mjs} +1 -1
  206. package/dist/esm/abstract-smart-wallets.mjs +1 -1
  207. package/dist/esm/{context-CCRnMB8L.mjs → context-WTldtXS8.mjs} +1 -1
  208. package/dist/esm/{ethers-B0Y3_-Pp.mjs → ethers-D1WT71Ay.mjs} +1 -1
  209. package/dist/esm/extended-chains.mjs +1 -1
  210. package/dist/esm/{get-is-unified-wallet-j2fzd2YE.mjs → get-is-unified-wallet-Boa8DYrQ.mjs} +1 -1
  211. package/dist/esm/{index-BgGYO9kN.mjs → index-BBRkihRn.mjs} +3 -3
  212. package/dist/esm/{index-CIjObncO.mjs → index-BH9-XZRZ.mjs} +1 -1
  213. package/dist/esm/{index-Dk-s5iXx.mjs → index-C9k7EfLZ.mjs} +1 -1
  214. package/dist/esm/index.mjs +1 -1
  215. package/dist/esm/internal.mjs +1 -1
  216. package/dist/esm/{shared-B_TYFBiH.mjs → shared-CwuyxHmv.mjs} +1 -1
  217. package/dist/esm/{shouldProceedtoEmbeddedWalletCreationFlow-DjxNSuIS.mjs → shouldProceedtoEmbeddedWalletCreationFlow-BMF_3TVv.mjs} +1 -1
  218. package/dist/esm/{smart-wallets-DL1EjW8i.mjs → smart-wallets-DOAgnxKI.mjs} +1 -1
  219. package/dist/esm/smart-wallets.mjs +1 -1
  220. package/dist/esm/solana.mjs +1 -1
  221. package/dist/esm/{styles-BeQ5nIO3.mjs → styles-BmZHuqSX.mjs} +1 -1
  222. package/dist/esm/{to-ui-error-DR840l8Y.mjs → to-ui-error-REESv0kM.mjs} +1 -1
  223. package/dist/esm/ui.mjs +1 -1
  224. package/dist/esm/use-export-wallet-CV4p7L0b.mjs +1 -0
  225. package/dist/esm/{use-export-wallet-AwUSjJIc.mjs → use-export-wallet-DQde4t0V.mjs} +1 -1
  226. package/dist/esm/{useActiveWallet-Dqi9nNxj.mjs → useActiveWallet-3RHPIBxJ.mjs} +1 -1
  227. package/dist/esm/{useGetTokenPrice-Djb6UHOW.mjs → useGetTokenPrice-BPBpM07F.mjs} +1 -1
  228. package/dist/esm/{useI18n-BK0a87xw.mjs → useI18n-BuIe8nUA.mjs} +1 -1
  229. package/dist/esm/{usePrivy-D9f62ILp.mjs → usePrivy-6nkpbErN.mjs} +1 -1
  230. package/dist/esm/{useSolanaRpcClient-DizarIU5.mjs → useSolanaRpcClient-BUWOblv_.mjs} +1 -1
  231. package/dist/esm/{useWallets-BKPOCKnv.mjs → useWallets-CR0z5IIt.mjs} +1 -1
  232. package/dist/esm/{useWallets-DQOA0__U.mjs → useWallets-C_dCo2_Q.mjs} +1 -1
  233. package/package.json +6 -6
  234. package/dist/cjs/FundWithBankDepositScreen-C1BRYtc8.js +0 -175
  235. package/dist/cjs/FundingMethodSelectionScreen-CL9xLuBR.js +0 -1
  236. package/dist/cjs/use-export-wallet-BEW54Ynq.js +0 -1
  237. package/dist/esm/FundWithBankDepositScreen-BJk-wxSq.mjs +0 -175
  238. package/dist/esm/FundingMethodSelectionScreen-gGZKP4LD.mjs +0 -1
  239. package/dist/esm/use-export-wallet-Voe8hSb9.mjs +0 -1
@@ -1,4 +1,4 @@
1
- import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useState as a,useMemo as s,useCallback as i,useEffect as o}from"react";import{createPublicClient as r,http as p,toHex as l,decodeFunctionData as u,decodeAbiParameters as m,formatEther as c}from"viem";import{getJsonRpcEndpointFromChain as d,formatTokenAmount as y,ProviderErrors as f}from"@privy-io/js-sdk-core";import{A as b}from"./Address-ClnXOtX_.mjs";import{u as T,q as h}from"./context-CCRnMB8L.mjs";import{P as g,j as v}from"./use-export-wallet-Voe8hSb9.mjs";import{u as I}from"./internal-context-Z-fyxadS.mjs";import{a as k,u as j}from"./get-is-unified-wallet-j2fzd2YE.mjs";import{u as E}from"./useGetTokenPrice-Djb6UHOW.mjs";import{u as M}from"./useWalletBalance-CDyi5_iR.mjs";import{g as C}from"./getErc20TokenInfo-1Q6w1Ibq.mjs";import{f as w}from"./formatErc20TokenAmount-BuPk9xcy.mjs";import{g as F,a as _,p as x}from"./ethers-B0Y3_-Pp.mjs";import{Y as S,D as A}from"./useActiveWallet-Dqi9nNxj.mjs";import{g as N}from"./getPublicClient-B4uPLKn-.mjs";import{ErrorScreenView as O}from"./ErrorScreen-DZ153hPv.mjs";import{styled as R}from"styled-components";import{M as D,B as P,P as $}from"./ModalHeader-DBfMXKy4.mjs";import{D as B}from"./JsonTree-aPaJmPx7.mjs";import{T as q,S as L}from"./TransactionErrorView-D7uZmR_V.mjs";import{R as U}from"./Layouts-BlFm53ED.mjs";import{S as W}from"./ScreenHeader-CHmc4-Lu.mjs";import{T as G}from"./TransactionDetails-CLHEcWFe.mjs";import{E as V}from"./transfer-6YztDh-t.mjs";import{p as H}from"./index-BgGYO9kN.mjs";import"lucide-react";import"tinycolor2";import"eventemitter3";import"viem/utils";import"./useWallets-BKPOCKnv.mjs";import"ofetch";import"@privy-io/are-addresses-equal";import"./useGetSolPrice-DwwjjGbd.mjs";import"zustand";import"react-device-detect";import"./events-context-CI0iqAXA.mjs";import"./reservoir-0wfhnc0j.mjs";import"./ScreenLayout-z1I4hafk.mjs";import"./Screen-omroCwTV.mjs";import"./index-Dq_xe9dz.mjs";import"uuid";import"jose";import"@coinbase/wallet-sdk";import"@privy-io/ethereum";import"mipd";import"@privy-io/popup";import"./paths-3HW55qZg.mjs";import"./usePrivy-D9f62ILp.mjs";import"@scure/base";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"@privy-io/urls";import"./PrivyPluginContext-2QN2dVUw.mjs";import"./getEmbeddedConnectedWallet-JzK4iD-L.mjs";import"js-cookie";import"./frame-uzTmvtww.mjs";import"@privy-io/routes";import"x402/client";import"@privy-io/api-base";import"viem/accounts";import"./use-sign-with-user-signer-Do5Oi_rb.mjs";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline";import"./Value-tcJV9e0L.mjs";import"./LoadingSkeleton-U6-3yFwI.mjs";import"./Row-C9vrS4Zi.mjs";import"./ErrorMessage-D8VaAP5m.mjs";import"./LabelXs-oqZNqbm_.mjs";import"./Subtitle-CV-2yKE4.mjs";import"./Title-BnzYV3Is.mjs";import"./WalletInfoCard-BURM3rIP.mjs";import"./shared-FM0rljBt.mjs";import"./Checkbox-BhNoOKjX.mjs";import"./ErrorBanner-CQERa7bL.mjs";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"./WarningBanner-c8L53pJ2.mjs";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"./WalletLink-BXlPbPVx.mjs";import"./getFormattedUsdFromLamports-B6EqSEho.mjs";import"./transaction-CnfuREWo.mjs";import"@heroicons/react/24/outline/ChevronDownIcon";let z=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}],Q=R.div`
1
+ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useState as a,useMemo as s,useCallback as i,useEffect as o}from"react";import{createPublicClient as r,http as p,toHex as l,decodeFunctionData as u,decodeAbiParameters as m,formatEther as c}from"viem";import{getJsonRpcEndpointFromChain as d,formatTokenAmount as y,ProviderErrors as f}from"@privy-io/js-sdk-core";import{A as b}from"./Address-BjZb-TIL.mjs";import{u as T,q as h}from"./context-WTldtXS8.mjs";import{P as g,j as v}from"./use-export-wallet-CV4p7L0b.mjs";import{u as I}from"./internal-context-Z-fyxadS.mjs";import{a as k,u as j}from"./get-is-unified-wallet-Boa8DYrQ.mjs";import{u as E}from"./useGetTokenPrice-BPBpM07F.mjs";import{u as M}from"./useWalletBalance-CDyi5_iR.mjs";import{g as C}from"./getErc20TokenInfo-1Q6w1Ibq.mjs";import{f as w}from"./formatErc20TokenAmount-BuPk9xcy.mjs";import{g as F,a as _,p as x}from"./ethers-D1WT71Ay.mjs";import{Y as S,D as A}from"./useActiveWallet-3RHPIBxJ.mjs";import{g as N}from"./getPublicClient-B4uPLKn-.mjs";import{ErrorScreenView as O}from"./ErrorScreen-DtGc3Chy.mjs";import{styled as R}from"styled-components";import{M as D,B as P,P as $}from"./ModalHeader-D8-mhjp4.mjs";import{D as B}from"./JsonTree-aPaJmPx7.mjs";import{T as q,S as L}from"./TransactionErrorView-CPFrt0L4.mjs";import{R as U}from"./Layouts-BlFm53ED.mjs";import{S as W}from"./ScreenHeader-CHmc4-Lu.mjs";import{T as G}from"./TransactionDetails-BurRo8R0.mjs";import{E as V}from"./transfer-6YztDh-t.mjs";import{p as H}from"./index-BBRkihRn.mjs";import"lucide-react";import"tinycolor2";import"eventemitter3";import"viem/utils";import"./useWallets-CR0z5IIt.mjs";import"ofetch";import"@privy-io/are-addresses-equal";import"./useGetSolPrice-DwwjjGbd.mjs";import"zustand";import"react-device-detect";import"./events-context-CI0iqAXA.mjs";import"./reservoir-0wfhnc0j.mjs";import"./ScreenLayout-DTmQLGPf.mjs";import"./Screen-Bp-TN9gb.mjs";import"./index-Dq_xe9dz.mjs";import"uuid";import"jose";import"@coinbase/wallet-sdk";import"@privy-io/ethereum";import"mipd";import"@privy-io/popup";import"./paths-3HW55qZg.mjs";import"./usePrivy-6nkpbErN.mjs";import"@scure/base";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"@privy-io/urls";import"./PrivyPluginContext-2QN2dVUw.mjs";import"./getEmbeddedConnectedWallet-JzK4iD-L.mjs";import"js-cookie";import"./frame-uzTmvtww.mjs";import"@privy-io/routes";import"x402/client";import"@privy-io/api-base";import"viem/accounts";import"./use-sign-with-user-signer-Do5Oi_rb.mjs";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline";import"./Value-tcJV9e0L.mjs";import"./LoadingSkeleton-U6-3yFwI.mjs";import"./Row-C9vrS4Zi.mjs";import"./ErrorMessage-D8VaAP5m.mjs";import"./LabelXs-oqZNqbm_.mjs";import"./Subtitle-CV-2yKE4.mjs";import"./Title-BnzYV3Is.mjs";import"./WalletInfoCard-DFt8ndGE.mjs";import"./shared-FM0rljBt.mjs";import"./Checkbox-BhNoOKjX.mjs";import"./ErrorBanner-CQERa7bL.mjs";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"./WarningBanner-c8L53pJ2.mjs";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"./WalletLink--05Hzo2b.mjs";import"./getFormattedUsdFromLamports-B6EqSEho.mjs";import"./transaction-CnfuREWo.mjs";import"@heroicons/react/24/outline/ChevronDownIcon";let z=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"}],Q=R.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  min-height: 72px;
@@ -1 +1 @@
1
- import{ofetch as e}from"ofetch";import{useState as t,useRef as n,useEffect as a}from"react";import{M as r,v as o,w as i,x as u}from"./context-CCRnMB8L.mjs";import{u as s}from"./internal-context-Z-fyxadS.mjs";import{a as d}from"./get-is-unified-wallet-j2fzd2YE.mjs";import{O as c}from"./analytics-mkkvFRju.mjs";const m="moonpay";function l(e){return parseFloat(e)}function y(l,y=!1){let[f,g]=t(null),{createAnalyticsEvent:p}=s(),{data:h,navigate:v,setModalData:w}=d(),A=h?.funding,F=n(0);return a((()=>{let t=setInterval((async()=>{if(l)try{let[n]=await async function(t,n){return e(`${n?r:o}/transactions/ext/${t}`,{query:{apiKey:n?i:u}})}(l,y),a="waitingAuthorization"===n.status&&"credit_debit_card"===n.paymentMethod?"pending":n.status;if(["failed","completed","awaitingAuthorization"].includes(a)&&(p({eventName:c,payload:{status:a,provider:m,paymentMethod:n.paymentMethod,cardPaymentType:n.cardPaymentType,currency:n.currency?.code,baseCurrencyAmount:n.baseCurrencyAmount,quoteCurrencyAmount:n.quoteCurrencyAmount,feeAmount:n.feeAmount,extraFeeAmount:n.extraFeeAmount,networkFeeAmount:n.networkFeeAmount,isSandbox:y}}),clearInterval(t)),"failed"===a||"serviceFailure"===a)return w({funding:{...A,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."},solanaFundingData:h?.solanaFundingData}),void v("FundingMethodSelectionScreen");g(a)}catch(e){404!==e.response?.status&&(F.current+=1),F.current>=3&&(p({eventName:c,payload:{status:"serviceFailure",provider:m}}),clearInterval(t),w({funding:{...A,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."},solanaFundingData:h?.solanaFundingData}),v("FundingMethodSelectionScreen"))}}),3e3);return()=>clearInterval(t)}),[l,F]),f}export{l as a,y as u};
1
+ import{ofetch as e}from"ofetch";import{useState as t,useRef as n,useEffect as a}from"react";import{M as r,v as o,w as i,x as u}from"./context-WTldtXS8.mjs";import{u as s}from"./internal-context-Z-fyxadS.mjs";import{a as d}from"./get-is-unified-wallet-Boa8DYrQ.mjs";import{O as c}from"./analytics-mkkvFRju.mjs";const m="moonpay";function l(e){return parseFloat(e)}function y(l,y=!1){let[f,g]=t(null),{createAnalyticsEvent:p}=s(),{data:h,navigate:v,setModalData:w}=d(),A=h?.funding,F=n(0);return a((()=>{let t=setInterval((async()=>{if(l)try{let[n]=await async function(t,n){return e(`${n?r:o}/transactions/ext/${t}`,{query:{apiKey:n?i:u}})}(l,y),a="waitingAuthorization"===n.status&&"credit_debit_card"===n.paymentMethod?"pending":n.status;if(["failed","completed","awaitingAuthorization"].includes(a)&&(p({eventName:c,payload:{status:a,provider:m,paymentMethod:n.paymentMethod,cardPaymentType:n.cardPaymentType,currency:n.currency?.code,baseCurrencyAmount:n.baseCurrencyAmount,quoteCurrencyAmount:n.quoteCurrencyAmount,feeAmount:n.feeAmount,extraFeeAmount:n.extraFeeAmount,networkFeeAmount:n.networkFeeAmount,isSandbox:y}}),clearInterval(t)),"failed"===a||"serviceFailure"===a)return w({funding:{...A,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."},solanaFundingData:h?.solanaFundingData}),void v("FundingMethodSelectionScreen");g(a)}catch(e){404!==e.response?.status&&(F.current+=1),F.current>=3&&(p({eventName:c,payload:{status:"serviceFailure",provider:m}}),clearInterval(t),w({funding:{...A,errorMessage:"Something went wrong adding funds from Moonpay. Please try again or use another method to fund your wallet."},solanaFundingData:h?.solanaFundingData}),v("FundingMethodSelectionScreen"))}}),3e3);return()=>clearInterval(t)}),[l,F]),f}export{l as a,y as u};
@@ -1 +1 @@
1
- export{K as Captcha,L as ConnectorManager,aF as LoginModal,N as PrivyClient,aG as PrivyModal,I as PrivyProvider,J as createCrossTabUserSyncPlugin,j as errorIndicatesMaxMfaRetries,h as errorIndicatesMfaTimeout,g as errorIndicatesMfaVerificationFailed,Q as getAccessToken,O as getIdentityToken,aH as toViemAccount,af as useAuthMfa,ag as useAuthMfaEnrollment,aA as useAuthorizationSignature,ae as useBaseAccountSdk,ad as useConnectBaseAccount,ac as useConnectCoinbaseSmartWallet,a1 as useConnectOrCreateWallet,ah as useCrossAppAccounts,at as useCustomAuth,ax as useDelegatedActions,aw as useFarcasterSigner,ab as useFundWalletWithBankDeposit,V as useGetAccessTokenForProvider,aC as useGetWalletPrivateKey,aj as useGuestAccounts,aE as useHeadlessDelegatedActions,U as useIdentityToken,a8 as useLinkAccount,as as useLinkJwtAccount,$ as useLinkWithPasskey,a2 as useLinkWithSiwe,a5 as useLinkWithSiws,Y as useLoginWithEmail,T as useLoginWithFarcasterV2,X as useLoginWithOAuth,_ as useLoginWithPasskey,a3 as useLoginWithSiwe,a4 as useLoginWithSiws,a0 as useLoginWithSms,aD as useLoginWithTelegram,u as useMfa,d as useMfaEnrollment,aI as useMigrateWallets,ap as useModalStatus,ar as useOAuthTokens,M as useRecoverEmbeddedWallet,a7 as useRegisterMfaListener,ai as useSendTransaction,ay as useSessionSigners,ak as useSetWalletRecovery,am as useSign7702Authorization,al as useSignMessage,a6 as useSignTransaction,an as useSignTypedData,az as useSigners,Z as useSignupWithPasskey,av as useSubscribeToJwtAuthWithFlag,au as useSyncJwtBasedAuthState,aq as useToken,a9 as useUpdateAccount,aa as useUpdateEmail,aB as useUser,ao as useX402Fetch}from"./index-BgGYO9kN.mjs";export{c as WalletConnector,u as useExportWallet}from"./use-export-wallet-Voe8hSb9.mjs";export{E as EthereumWalletConnector,C as useActiveWallet,A as useConnectWallet,B as useFundWallet,y as useLogin,z as useLogout}from"./useActiveWallet-Dqi9nNxj.mjs";export{u as useWallets}from"./useWallets-BKPOCKnv.mjs";export{g as useCreateWallet,h as useImportWallet,u as usePrivy}from"./usePrivy-D9f62ILp.mjs";export{V as VERSION}from"./context-CCRnMB8L.mjs";export{DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS,addPrivyRpcToChain,addRpcUrlOverrideToChain}from"@privy-io/js-sdk-core";export{c as dataSuffix,g as getEmbeddedConnectedWallet}from"./getEmbeddedConnectedWallet-JzK4iD-L.mjs";import"react/jsx-runtime";import"react";import"uuid";import"jose";import"./get-is-unified-wallet-j2fzd2YE.mjs";import"@privy-io/are-addresses-equal";import"./internal-context-Z-fyxadS.mjs";import"ofetch";import"eventemitter3";import"@coinbase/wallet-sdk";import"@privy-io/ethereum";import"mipd";import"react-device-detect";import"viem/utils";import"@privy-io/popup";import"./paths-3HW55qZg.mjs";import"@scure/base";import"styled-components";import"./events-context-CI0iqAXA.mjs";import"zustand";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"@privy-io/urls";import"viem";import"./PrivyPluginContext-2QN2dVUw.mjs";import"./getPublicClient-B4uPLKn-.mjs";import"js-cookie";import"./frame-uzTmvtww.mjs";import"@privy-io/routes";import"x402/client";import"@privy-io/api-base";import"viem/accounts";import"./use-sign-with-user-signer-Do5Oi_rb.mjs";import"tinycolor2";
1
+ export{K as Captcha,L as ConnectorManager,aF as LoginModal,N as PrivyClient,aG as PrivyModal,I as PrivyProvider,J as createCrossTabUserSyncPlugin,j as errorIndicatesMaxMfaRetries,h as errorIndicatesMfaTimeout,g as errorIndicatesMfaVerificationFailed,Q as getAccessToken,O as getIdentityToken,aH as toViemAccount,af as useAuthMfa,ag as useAuthMfaEnrollment,aA as useAuthorizationSignature,ae as useBaseAccountSdk,ad as useConnectBaseAccount,ac as useConnectCoinbaseSmartWallet,a1 as useConnectOrCreateWallet,ah as useCrossAppAccounts,at as useCustomAuth,ax as useDelegatedActions,aw as useFarcasterSigner,ab as useFundWalletWithBankDeposit,V as useGetAccessTokenForProvider,aC as useGetWalletPrivateKey,aj as useGuestAccounts,aE as useHeadlessDelegatedActions,U as useIdentityToken,a8 as useLinkAccount,as as useLinkJwtAccount,$ as useLinkWithPasskey,a2 as useLinkWithSiwe,a5 as useLinkWithSiws,Y as useLoginWithEmail,T as useLoginWithFarcasterV2,X as useLoginWithOAuth,_ as useLoginWithPasskey,a3 as useLoginWithSiwe,a4 as useLoginWithSiws,a0 as useLoginWithSms,aD as useLoginWithTelegram,u as useMfa,d as useMfaEnrollment,aI as useMigrateWallets,ap as useModalStatus,ar as useOAuthTokens,M as useRecoverEmbeddedWallet,a7 as useRegisterMfaListener,ai as useSendTransaction,ay as useSessionSigners,ak as useSetWalletRecovery,am as useSign7702Authorization,al as useSignMessage,a6 as useSignTransaction,an as useSignTypedData,az as useSigners,Z as useSignupWithPasskey,av as useSubscribeToJwtAuthWithFlag,au as useSyncJwtBasedAuthState,aq as useToken,a9 as useUpdateAccount,aa as useUpdateEmail,aB as useUser,ao as useX402Fetch}from"./index-BBRkihRn.mjs";export{c as WalletConnector,u as useExportWallet}from"./use-export-wallet-CV4p7L0b.mjs";export{E as EthereumWalletConnector,C as useActiveWallet,A as useConnectWallet,B as useFundWallet,y as useLogin,z as useLogout}from"./useActiveWallet-3RHPIBxJ.mjs";export{u as useWallets}from"./useWallets-CR0z5IIt.mjs";export{g as useCreateWallet,h as useImportWallet,u as usePrivy}from"./usePrivy-6nkpbErN.mjs";export{V as VERSION}from"./context-WTldtXS8.mjs";export{DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS,addPrivyRpcToChain,addRpcUrlOverrideToChain}from"@privy-io/js-sdk-core";export{c as dataSuffix,g as getEmbeddedConnectedWallet}from"./getEmbeddedConnectedWallet-JzK4iD-L.mjs";import"react/jsx-runtime";import"react";import"uuid";import"jose";import"./get-is-unified-wallet-Boa8DYrQ.mjs";import"@privy-io/are-addresses-equal";import"./internal-context-Z-fyxadS.mjs";import"ofetch";import"eventemitter3";import"@coinbase/wallet-sdk";import"@privy-io/ethereum";import"mipd";import"react-device-detect";import"viem/utils";import"@privy-io/popup";import"./paths-3HW55qZg.mjs";import"@scure/base";import"styled-components";import"./events-context-CI0iqAXA.mjs";import"zustand";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"@privy-io/urls";import"viem";import"./PrivyPluginContext-2QN2dVUw.mjs";import"./getPublicClient-B4uPLKn-.mjs";import"js-cookie";import"./frame-uzTmvtww.mjs";import"@privy-io/routes";import"x402/client";import"@privy-io/api-base";import"viem/accounts";import"./use-sign-with-user-signer-Do5Oi_rb.mjs";import"tinycolor2";
@@ -1 +1 @@
1
- import{a as t,f as e,u as o,b as r}from"./internal-context-Z-fyxadS.mjs";import{a7 as n}from"./paths-3HW55qZg.mjs";import{u as s}from"./context-CCRnMB8L.mjs";import{a as i}from"./events-context-CI0iqAXA.mjs";import"ofetch";import"react";import"react/jsx-runtime";import"@privy-io/js-sdk-core";import"tinycolor2";class a{async authenticate(){if(!this.api)throw new t("Auth flow has no API instance");try{return await this.api.post(n,{})}catch(t){throw e(t)}}async link(){throw new t("Linking is not supported for the SSO token flow")}constructor(){this.meta={}}}function c(){let e=s(),n=i(),{client:c,setUser:h,setAuthenticated:l,setIsNewUser:w}=o();return{loginWithSsoToken:async()=>{if(!e.id||!c)throw new t("SDK not yet ready");try{let e=new a;c.startAuthFlow(e);let o=await c.authenticate(),r=o.user,s=o.isNewUser??!1;if(!r)throw new t("Unable to authenticate with SSO response");return h(r),w(s),l(!0),n("login","onComplete",{user:r,isNewUser:s,wasAlreadyAuthenticated:!1,loginMethod:"sso",loginAccount:null}),r}catch(t){throw n("login","onError",t.privyErrorCode||r.UNKNOWN_AUTH_ERROR),t}}}}export{c as useLoginWithSsoToken};
1
+ import{a as t,f as e,u as o,b as r}from"./internal-context-Z-fyxadS.mjs";import{a7 as n}from"./paths-3HW55qZg.mjs";import{u as s}from"./context-WTldtXS8.mjs";import{a as i}from"./events-context-CI0iqAXA.mjs";import"ofetch";import"react";import"react/jsx-runtime";import"@privy-io/js-sdk-core";import"tinycolor2";class a{async authenticate(){if(!this.api)throw new t("Auth flow has no API instance");try{return await this.api.post(n,{})}catch(t){throw e(t)}}async link(){throw new t("Linking is not supported for the SSO token flow")}constructor(){this.meta={}}}function c(){let e=s(),n=i(),{client:c,setUser:h,setAuthenticated:l,setIsNewUser:w}=o();return{loginWithSsoToken:async()=>{if(!e.id||!c)throw new t("SDK not yet ready");try{let e=new a;c.startAuthFlow(e);let o=await c.authenticate(),r=o.user,s=o.isNewUser??!1;if(!r)throw new t("Unable to authenticate with SSO response");return h(r),w(s),l(!0),n("login","onComplete",{user:r,isNewUser:s,wasAlreadyAuthenticated:!1,loginMethod:"sso",loginAccount:null}),r}catch(t){throw n("login","onError",t.privyErrorCode||r.UNKNOWN_AUTH_ERROR),t}}}}export{c as useLoginWithSsoToken};
@@ -1,4 +1,4 @@
1
- import r from"@heroicons/react/24/outline/ArrowPathIcon";import e from"@heroicons/react/24/outline/EyeIcon";import o from"@heroicons/react/24/outline/EyeSlashIcon";import{styled as i,css as t}from"styled-components";import{P as a,a as n}from"./ModalHeader-DBfMXKy4.mjs";let l=t`
1
+ import r from"@heroicons/react/24/outline/ArrowPathIcon";import e from"@heroicons/react/24/outline/EyeIcon";import o from"@heroicons/react/24/outline/EyeSlashIcon";import{styled as i,css as t}from"styled-components";import{P as a,a as n}from"./ModalHeader-D8-mhjp4.mjs";let l=t`
2
2
  font-size: 14px;
3
3
  font-style: normal;
4
4
  font-weight: 400;
@@ -1 +1 @@
1
- import{s as e,k as s}from"./index-BgGYO9kN.mjs";const a=(a,n)=>e(a,n.ethereum.createOnLogin)||s(a,n.solana.createOnLogin);export{a as s};
1
+ import{s as e,k as s}from"./index-BBRkihRn.mjs";const a=(a,n)=>e(a,n.ethereum.createOnLogin)||s(a,n.solana.createOnLogin);export{a as s};
@@ -1 +1 @@
1
- import{useRef as e,useState as a,useCallback as n}from"react";import{http as r,createPublicClient as t}from"viem";import{a as i,u as s,c as o,b as l}from"./get-is-unified-wallet-j2fzd2YE.mjs";import{u as c}from"./context-CCRnMB8L.mjs";import{u as d,a as m}from"./internal-context-Z-fyxadS.mjs";import{u,g as p}from"./useWallets-BKPOCKnv.mjs";import{u as y}from"./PrivyPluginContext-2QN2dVUw.mjs";import{a as g,D as P}from"./getEmbeddedConnectedWallet-JzK4iD-L.mjs";import{a as f}from"./getPublicClient-B4uPLKn-.mjs";import{createSmartAccountClient as h}from"permissionless";import{toThirdwebSmartAccount as w,toLightSmartAccount as I,toBiconomySmartAccount as F,toKernelSmartAccount as x,toSafeSmartAccount as W}from"permissionless/accounts";import{createPimlicoClient as v}from"permissionless/clients/pimlico";import{entryPoint07Address as G,entryPoint06Address as S,toCoinbaseSmartAccount as C}from"viem/account-abstraction";import{THIRDWEB as T,COINBASE_SMART_WALLET as b,LIGHT_ACCOUNT as U,BICONOMY as M,KERNEL as O,SAFE as D}from"@privy-io/js-sdk-core";let V={address:S,version:"0.6"},A={address:G,version:"0.7"},B=({owner:e,smartWalletType:a,smartWalletVersion:n,publicClient:r})=>{switch(a){case D:return W({client:r,entryPoint:A,owners:[e],version:"1.4.1"});case O:return x({client:r,version:"0.3.1",entryPoint:A,useMetaFactory:"optional",owners:[e]});case M:return F({client:r,owners:[e],entryPoint:V});case U:return I({client:r,entryPoint:V,owner:e,version:"1.1.0"});case b:return async function({client:e,owner:a,version:n}){let[r]=await a.request({method:"eth_accounts"});if(!r)throw Error("Unable to request embedded owner for eth_accounts");return await C({client:e,owners:[{type:"local",source:"privy",address:r,sign:async({hash:e})=>await a.request({method:"secp256k1_sign",params:[e]})}],version:n})}({client:r,owner:e,version:n??"1"});case T:return w({client:r,entryPoint:A,owner:e});default:throw Error(`Invalid smart account type: ${a}.`)}};const E=({calls:e,chain:a,maxPriorityFeePerGas:n,maxFeePerGas:r,nonce:t})=>e.map((e=>({to:e.to||void 0,data:e.data,value:e.value,chainId:a.id,nonce:t,maxFeePerGas:r,maxPriorityFeePerGas:n}))),q=async({chain:e,paymasterContext:a,account:n,signer:i,user:s,smartWalletsConfig:o,rpcConfig:l,privyAppId:c})=>{if(!(o?.enabled&&s&&n&&i))return;let d=o?.configuredNetworks.find((a=>a.chainId===`eip155:${e.id}`));if(!d)throw new m(`The chain ${e.name} (eip155:${e.id}) must be configured in the smart wallet configuration in your dashboard`);let u=s.smartWallet?s.smartWallet.smartWalletType:o.smartWalletType,p=s.smartWallet?s.smartWallet.smartWalletVersion:o.smartWalletVersion,y=f(e,l,c),g=t({chain:e,transport:r(y)}),P=a??d.paymasterContext,w=await(async({owner:e,smartWalletType:a,smartWalletVersion:n,chain:t,publicClient:i,bundlerUrl:s,paymasterUrl:o,paymasterContext:l})=>{let c=await B({owner:e,smartWalletType:a,publicClient:i,smartWalletVersion:n}),d=v({transport:r(s),entryPoint:c.entryPoint}),m=o?v({transport:r(o),entryPoint:c.entryPoint}):void 0;return h({account:c,chain:t,paymaster:m,paymasterContext:l,bundlerTransport:r(s),userOperation:{estimateFeesPerGas:async()=>{if(["public.pimlico.io","api.pimlico.io"].some((e=>s.includes(e))))return await d.getUserOperationGasPrice().then((e=>e.fast));if(["rpc.zerodev.app"].some((e=>s.includes(e))))return(await d.request({method:"zd_getUserOperationGasPrice",params:[]})).fast;if(["g.alchemy.com"].some((e=>s.includes(e)))){let[e,a]=await Promise.all([i.getBlock({blockTag:"latest"}),d.request({method:"rundler_maxPriorityFeePerGas",params:[]})]);if(!e.baseFeePerGas||!a)throw Error("Failed to get block or maxPriorityFeePerGasEstimate");return{maxFeePerGas:150n*e.baseFeePerGas/100n+BigInt(a.toString()),maxPriorityFeePerGas:BigInt(a.toString())}}{let e=await i.estimateFeesPerGas(),a=s.includes("api.developer.coinbase.com")?175n:150n;return{...e,maxFeePerGas:e.maxFeePerGas*a/100n,maxPriorityFeePerGas:e.maxPriorityFeePerGas*a/100n}}}}})})({owner:i,smartWalletType:u,smartWalletVersion:p,chain:e,publicClient:g,paymasterContext:P,...d});if(!w)throw new m(`Failed to create smart wallet client for chain ${e.name} (eip155:${e.id})`);return w},N=({clientConfig:r,smartWalletsConfig:t})=>{let{hideWalletUIs:f,openPrivyModal:h,appId:w,isHeadlessSigning:I}=d(),F=c(),{setModalData:x}=i(),{user:W}=s(),{chains:v}=c(),G=y(),{chainId:S,clients:C,setChainId:T,chainIdState:b}=(()=>{let n=e(),[r,t]=a();return{clients:e({}),setChainId:e=>{n.current=e,t(e)},chainId:n,chainIdState:r}})(),U=v.find((e=>e.id===b)),{wallets:M}=u(),O=o(W),D=g(M,O?.address),V=!!O&&l(O),A=n((async()=>S.current),[S]),B=n((async({id:e})=>{if(!C.current[e]){let a=await q({chain:v.find((a=>a.id===e)),account:O,signer:await(D?.getEthereumProvider()),user:W,paymasterContext:r?.paymasterContext,smartWalletsConfig:t,rpcConfig:F.rpcConfig,privyAppId:w});a&&(C.current[e]=a)}T(e)}),[v,r,M,W,t]);return{wrapSmartAccountClient:e=>{C.current[e.chain.id]=e,b||T(e.chain.id);return{...e,sendTransaction:async(e,a)=>{let n=C.current[S.current];if(!n)throw new m(`Smart wallet client for chain (eip155:${S.current}) not found`);delete e.account;let r=[];"calls"in e&&void 0!==e.calls?r=[...e.calls]:"to"in e&&(r=[{to:e.to,value:e.value||BigInt(0),data:e.data||"0x"}]);let t=(await n.prepareUserOperation({calls:r,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0})).callData,i=G(P);if(i&&(t=i.appendDataSuffix({data:t})),I({showWalletUIs:a?.uiOptions?.showWalletUIs}))return f.current=!0,await n.sendTransaction({callData:t,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}).finally((()=>f.current=!1));let s=async()=>{let{paymasterAndData:a,paymasterData:t,maxFeePerGas:i,maxPriorityFeePerGas:s}=await n.prepareUserOperation({calls:r,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return 0===Number(i)&&0===Number(s)||Number(a??t??0)>0};return new Promise((async(i,o)=>{f.current=!0;let{entropyId:l,entropyIdVerifier:c}=p(W);x({connectWallet:{recoveryMethod:O.recoveryMethod,connectingWalletAddress:O.address,isUnifiedWallet:V,entropyId:l,entropyIdVerifier:c,onCompleteNavigateTo:"SendTransactionScreen",onFailure:()=>{}},sendTransaction:{transactionRequests:E({calls:r,chain:n.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),transactingWalletIndex:0,transactingWalletAddress:n.account.address,entropyId:l,entropyIdVerifier:c,getIsSponsored:s,signOnly:!1,onConfirm:async()=>n.sendTransaction({callData:t,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),onSuccess:e=>i(e.hash),onFailure:o,uiOptions:a?.uiOptions??{}}}),h("EmbeddedWalletConnectingScreen")})).finally((()=>{f.current=!1}))},signMessage:async(e,a)=>{let n=C.current[S.current];if(!n)throw new m(`Smart wallet client for chain (eip155:${S.current}) not found`);return I({showWalletUIs:a?.uiOptions?.showWalletUIs})?(f.current=!0,await n.signMessage(e).finally((()=>f.current=!1))):new Promise((async(r,t)=>{let{entropyId:i,entropyIdVerifier:s}=p(W);f.current=!0,x({connectWallet:{recoveryMethod:O.recoveryMethod,connectingWalletAddress:O.address,isUnifiedWallet:V,entropyId:i,entropyIdVerifier:s,onCompleteNavigateTo:"SignRequestScreen",onFailure:()=>{}},signMessage:{method:"personal_sign",data:"string"==typeof e.message?e.message:e.message.raw.toString(),confirmAndSign:()=>n.signMessage(e),onSuccess:e=>r(e),onFailure:t,uiOptions:a?.uiOptions??{}}}),h("EmbeddedWalletConnectingScreen")})).finally((()=>{f.current=!1}))},signTypedData:async(e,a)=>{let n=C.current[S.current];if(!n)throw new m(`Smart wallet client for chain (eip155:${S.current}) not found`);return delete e.account,I({showWalletUIs:a?.uiOptions?.showWalletUIs})?(f.current=!0,await n.signTypedData(e).finally((()=>f.current=!1))):new Promise((async(r,t)=>{f.current=!0;let{entropyId:i,entropyIdVerifier:s}=p(W);x({connectWallet:{recoveryMethod:O.recoveryMethod,connectingWalletAddress:O.address,isUnifiedWallet:V,entropyId:i,entropyIdVerifier:s,onCompleteNavigateTo:"SignRequestScreen",onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>n.signTypedData(e),onSuccess:e=>r(e),onFailure:t,uiOptions:a?.uiOptions??{}}}),h("EmbeddedWalletConnectingScreen")})).finally((()=>{f.current=!1}))},getChainId:A,chain:U,switchChain:B}}}},_=()=>{let{hideWalletUIs:e,openPrivyModal:a,isHeadlessSigning:n}=d(),{setModalData:r}=i(),{user:t}=s(),c=y(),m=o(t),u=!!m&&l(m);return{wrapSmartAccountClientWithUIs:i=>({...i,sendTransaction:async(s,o)=>{let l=[];"calls"in s&&void 0!==s.calls?l=[...s.calls]:"to"in s&&(l=[{to:s.to,value:s.value||BigInt(0),data:s.data||"0x"}]);let d=(await i.prepareUserOperation({calls:l,maxFeePerGas:s.maxFeePerGas,maxPriorityFeePerGas:s.maxPriorityFeePerGas,nonce:s.nonce?BigInt(s.nonce):void 0})).callData,y=c(P);if(y&&(d=y.appendDataSuffix({data:d})),n({showWalletUIs:o?.uiOptions?.showWalletUIs}))return e.current=!0,await i.sendTransaction({callData:d,maxFeePerGas:s.maxFeePerGas,maxPriorityFeePerGas:s.maxPriorityFeePerGas,nonce:s.nonce?BigInt(s.nonce):void 0}).finally((()=>e.current=!1));let g=async()=>{if(!i.paymaster)return!1;let{paymasterData:e,paymasterAndData:a}=await i.prepareUserOperation({calls:l,maxFeePerGas:s.maxFeePerGas,maxPriorityFeePerGas:s.maxPriorityFeePerGas,nonce:s.nonce?BigInt(s.nonce):void 0});return Number(a??e??0)>0};return new Promise((async(n,c)=>{e.current=!0;let{entropyId:y,entropyIdVerifier:P}=p(t);r({connectWallet:{recoveryMethod:m.recoveryMethod,connectingWalletAddress:m.address,isUnifiedWallet:u,entropyId:y,entropyIdVerifier:P,onCompleteNavigateTo:"SendTransactionScreen",onFailure:()=>{}},sendTransaction:{transactionRequests:E({calls:l,chain:i.chain,maxPriorityFeePerGas:s.maxPriorityFeePerGas,maxFeePerGas:s.maxFeePerGas,nonce:s.nonce?BigInt(s.nonce):void 0}),transactingWalletIndex:0,transactingWalletAddress:i.account.address,entropyId:y,entropyIdVerifier:P,getIsSponsored:g,signOnly:!1,onConfirm:async()=>i.sendTransaction({callData:d,maxFeePerGas:s.maxFeePerGas,maxPriorityFeePerGas:s.maxPriorityFeePerGas,nonce:s.nonce?BigInt(s.nonce):void 0}),onSuccess:e=>n(e.hash),onFailure:c,uiOptions:o?.uiOptions??{}}}),a("EmbeddedWalletConnectingScreen")})).finally((()=>{e.current=!1}))},signMessage:async(s,o)=>n({showWalletUIs:o?.uiOptions?.showWalletUIs})?(e.current=!0,await i.signMessage(s).finally((()=>e.current=!1))):new Promise((async(n,l)=>{let{entropyId:c,entropyIdVerifier:d}=p(t);e.current=!0,r({connectWallet:{recoveryMethod:m.recoveryMethod,connectingWalletAddress:m.address,isUnifiedWallet:u,entropyId:c,entropyIdVerifier:d,onCompleteNavigateTo:"SignRequestScreen",onFailure:()=>{}},signMessage:{method:"personal_sign",data:"string"==typeof s.message?s.message:s.message.raw.toString(),confirmAndSign:()=>i.signMessage(s),onSuccess:e=>n(e),onFailure:l,uiOptions:o?.uiOptions??{}}}),a("EmbeddedWalletConnectingScreen")})).finally((()=>{e.current=!1})),signTypedData:async(s,o)=>n({showWalletUIs:o?.uiOptions?.showWalletUIs})?(e.current=!0,await i.signTypedData(s).finally((()=>e.current=!1))):new Promise((async(n,l)=>{e.current=!0;let{entropyId:c,entropyIdVerifier:d}=p(t);r({connectWallet:{recoveryMethod:m.recoveryMethod,connectingWalletAddress:m.address,isUnifiedWallet:u,entropyId:c,entropyIdVerifier:d,onCompleteNavigateTo:"SignRequestScreen",onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:s,confirmAndSign:()=>i.signTypedData(s),onSuccess:e=>n(e),onFailure:l,uiOptions:o?.uiOptions??{}}}),a("EmbeddedWalletConnectingScreen")})).finally((()=>{e.current=!1}))})}};export{N as a,E as c,q as g,_ as u};
1
+ import{useRef as e,useState as a,useCallback as n}from"react";import{http as r,createPublicClient as t}from"viem";import{a as i,u as s,c as o,b as l}from"./get-is-unified-wallet-Boa8DYrQ.mjs";import{u as c}from"./context-WTldtXS8.mjs";import{u as d,a as m}from"./internal-context-Z-fyxadS.mjs";import{u,g as p}from"./useWallets-CR0z5IIt.mjs";import{u as y}from"./PrivyPluginContext-2QN2dVUw.mjs";import{a as g,D as P}from"./getEmbeddedConnectedWallet-JzK4iD-L.mjs";import{a as f}from"./getPublicClient-B4uPLKn-.mjs";import{createSmartAccountClient as h}from"permissionless";import{toThirdwebSmartAccount as w,toLightSmartAccount as I,toBiconomySmartAccount as F,toKernelSmartAccount as x,toSafeSmartAccount as W}from"permissionless/accounts";import{createPimlicoClient as v}from"permissionless/clients/pimlico";import{entryPoint07Address as G,entryPoint06Address as S,toCoinbaseSmartAccount as C}from"viem/account-abstraction";import{THIRDWEB as T,COINBASE_SMART_WALLET as b,LIGHT_ACCOUNT as U,BICONOMY as M,KERNEL as O,SAFE as D}from"@privy-io/js-sdk-core";let V={address:S,version:"0.6"},A={address:G,version:"0.7"},B=({owner:e,smartWalletType:a,smartWalletVersion:n,publicClient:r})=>{switch(a){case D:return W({client:r,entryPoint:A,owners:[e],version:"1.4.1"});case O:return x({client:r,version:"0.3.1",entryPoint:A,useMetaFactory:"optional",owners:[e]});case M:return F({client:r,owners:[e],entryPoint:V});case U:return I({client:r,entryPoint:V,owner:e,version:"1.1.0"});case b:return async function({client:e,owner:a,version:n}){let[r]=await a.request({method:"eth_accounts"});if(!r)throw Error("Unable to request embedded owner for eth_accounts");return await C({client:e,owners:[{type:"local",source:"privy",address:r,sign:async({hash:e})=>await a.request({method:"secp256k1_sign",params:[e]})}],version:n})}({client:r,owner:e,version:n??"1"});case T:return w({client:r,entryPoint:A,owner:e});default:throw Error(`Invalid smart account type: ${a}.`)}};const E=({calls:e,chain:a,maxPriorityFeePerGas:n,maxFeePerGas:r,nonce:t})=>e.map((e=>({to:e.to||void 0,data:e.data,value:e.value,chainId:a.id,nonce:t,maxFeePerGas:r,maxPriorityFeePerGas:n}))),q=async({chain:e,paymasterContext:a,account:n,signer:i,user:s,smartWalletsConfig:o,rpcConfig:l,privyAppId:c})=>{if(!(o?.enabled&&s&&n&&i))return;let d=o?.configuredNetworks.find((a=>a.chainId===`eip155:${e.id}`));if(!d)throw new m(`The chain ${e.name} (eip155:${e.id}) must be configured in the smart wallet configuration in your dashboard`);let u=s.smartWallet?s.smartWallet.smartWalletType:o.smartWalletType,p=s.smartWallet?s.smartWallet.smartWalletVersion:o.smartWalletVersion,y=f(e,l,c),g=t({chain:e,transport:r(y)}),P=a??d.paymasterContext,w=await(async({owner:e,smartWalletType:a,smartWalletVersion:n,chain:t,publicClient:i,bundlerUrl:s,paymasterUrl:o,paymasterContext:l})=>{let c=await B({owner:e,smartWalletType:a,publicClient:i,smartWalletVersion:n}),d=v({transport:r(s),entryPoint:c.entryPoint}),m=o?v({transport:r(o),entryPoint:c.entryPoint}):void 0;return h({account:c,chain:t,paymaster:m,paymasterContext:l,bundlerTransport:r(s),userOperation:{estimateFeesPerGas:async()=>{if(["public.pimlico.io","api.pimlico.io"].some((e=>s.includes(e))))return await d.getUserOperationGasPrice().then((e=>e.fast));if(["rpc.zerodev.app"].some((e=>s.includes(e))))return(await d.request({method:"zd_getUserOperationGasPrice",params:[]})).fast;if(["g.alchemy.com"].some((e=>s.includes(e)))){let[e,a]=await Promise.all([i.getBlock({blockTag:"latest"}),d.request({method:"rundler_maxPriorityFeePerGas",params:[]})]);if(!e.baseFeePerGas||!a)throw Error("Failed to get block or maxPriorityFeePerGasEstimate");return{maxFeePerGas:150n*e.baseFeePerGas/100n+BigInt(a.toString()),maxPriorityFeePerGas:BigInt(a.toString())}}{let e=await i.estimateFeesPerGas(),a=s.includes("api.developer.coinbase.com")?175n:150n;return{...e,maxFeePerGas:e.maxFeePerGas*a/100n,maxPriorityFeePerGas:e.maxPriorityFeePerGas*a/100n}}}}})})({owner:i,smartWalletType:u,smartWalletVersion:p,chain:e,publicClient:g,paymasterContext:P,...d});if(!w)throw new m(`Failed to create smart wallet client for chain ${e.name} (eip155:${e.id})`);return w},N=({clientConfig:r,smartWalletsConfig:t})=>{let{hideWalletUIs:f,openPrivyModal:h,appId:w,isHeadlessSigning:I}=d(),F=c(),{setModalData:x}=i(),{user:W}=s(),{chains:v}=c(),G=y(),{chainId:S,clients:C,setChainId:T,chainIdState:b}=(()=>{let n=e(),[r,t]=a();return{clients:e({}),setChainId:e=>{n.current=e,t(e)},chainId:n,chainIdState:r}})(),U=v.find((e=>e.id===b)),{wallets:M}=u(),O=o(W),D=g(M,O?.address),V=!!O&&l(O),A=n((async()=>S.current),[S]),B=n((async({id:e})=>{if(!C.current[e]){let a=await q({chain:v.find((a=>a.id===e)),account:O,signer:await(D?.getEthereumProvider()),user:W,paymasterContext:r?.paymasterContext,smartWalletsConfig:t,rpcConfig:F.rpcConfig,privyAppId:w});a&&(C.current[e]=a)}T(e)}),[v,r,M,W,t]);return{wrapSmartAccountClient:e=>{C.current[e.chain.id]=e,b||T(e.chain.id);return{...e,sendTransaction:async(e,a)=>{let n=C.current[S.current];if(!n)throw new m(`Smart wallet client for chain (eip155:${S.current}) not found`);delete e.account;let r=[];"calls"in e&&void 0!==e.calls?r=[...e.calls]:"to"in e&&(r=[{to:e.to,value:e.value||BigInt(0),data:e.data||"0x"}]);let t=(await n.prepareUserOperation({calls:r,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0})).callData,i=G(P);if(i&&(t=i.appendDataSuffix({data:t})),I({showWalletUIs:a?.uiOptions?.showWalletUIs}))return f.current=!0,await n.sendTransaction({callData:t,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}).finally((()=>f.current=!1));let s=async()=>{let{paymasterAndData:a,paymasterData:t,maxFeePerGas:i,maxPriorityFeePerGas:s}=await n.prepareUserOperation({calls:r,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return 0===Number(i)&&0===Number(s)||Number(a??t??0)>0};return new Promise((async(i,o)=>{f.current=!0;let{entropyId:l,entropyIdVerifier:c}=p(W);x({connectWallet:{recoveryMethod:O.recoveryMethod,connectingWalletAddress:O.address,isUnifiedWallet:V,entropyId:l,entropyIdVerifier:c,onCompleteNavigateTo:"SendTransactionScreen",onFailure:()=>{}},sendTransaction:{transactionRequests:E({calls:r,chain:n.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),transactingWalletIndex:0,transactingWalletAddress:n.account.address,entropyId:l,entropyIdVerifier:c,getIsSponsored:s,signOnly:!1,onConfirm:async()=>n.sendTransaction({callData:t,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),onSuccess:e=>i(e.hash),onFailure:o,uiOptions:a?.uiOptions??{}}}),h("EmbeddedWalletConnectingScreen")})).finally((()=>{f.current=!1}))},signMessage:async(e,a)=>{let n=C.current[S.current];if(!n)throw new m(`Smart wallet client for chain (eip155:${S.current}) not found`);return I({showWalletUIs:a?.uiOptions?.showWalletUIs})?(f.current=!0,await n.signMessage(e).finally((()=>f.current=!1))):new Promise((async(r,t)=>{let{entropyId:i,entropyIdVerifier:s}=p(W);f.current=!0,x({connectWallet:{recoveryMethod:O.recoveryMethod,connectingWalletAddress:O.address,isUnifiedWallet:V,entropyId:i,entropyIdVerifier:s,onCompleteNavigateTo:"SignRequestScreen",onFailure:()=>{}},signMessage:{method:"personal_sign",data:"string"==typeof e.message?e.message:e.message.raw.toString(),confirmAndSign:()=>n.signMessage(e),onSuccess:e=>r(e),onFailure:t,uiOptions:a?.uiOptions??{}}}),h("EmbeddedWalletConnectingScreen")})).finally((()=>{f.current=!1}))},signTypedData:async(e,a)=>{let n=C.current[S.current];if(!n)throw new m(`Smart wallet client for chain (eip155:${S.current}) not found`);return delete e.account,I({showWalletUIs:a?.uiOptions?.showWalletUIs})?(f.current=!0,await n.signTypedData(e).finally((()=>f.current=!1))):new Promise((async(r,t)=>{f.current=!0;let{entropyId:i,entropyIdVerifier:s}=p(W);x({connectWallet:{recoveryMethod:O.recoveryMethod,connectingWalletAddress:O.address,isUnifiedWallet:V,entropyId:i,entropyIdVerifier:s,onCompleteNavigateTo:"SignRequestScreen",onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>n.signTypedData(e),onSuccess:e=>r(e),onFailure:t,uiOptions:a?.uiOptions??{}}}),h("EmbeddedWalletConnectingScreen")})).finally((()=>{f.current=!1}))},getChainId:A,chain:U,switchChain:B}}}},_=()=>{let{hideWalletUIs:e,openPrivyModal:a,isHeadlessSigning:n}=d(),{setModalData:r}=i(),{user:t}=s(),c=y(),m=o(t),u=!!m&&l(m);return{wrapSmartAccountClientWithUIs:i=>({...i,sendTransaction:async(s,o)=>{let l=[];"calls"in s&&void 0!==s.calls?l=[...s.calls]:"to"in s&&(l=[{to:s.to,value:s.value||BigInt(0),data:s.data||"0x"}]);let d=(await i.prepareUserOperation({calls:l,maxFeePerGas:s.maxFeePerGas,maxPriorityFeePerGas:s.maxPriorityFeePerGas,nonce:s.nonce?BigInt(s.nonce):void 0})).callData,y=c(P);if(y&&(d=y.appendDataSuffix({data:d})),n({showWalletUIs:o?.uiOptions?.showWalletUIs}))return e.current=!0,await i.sendTransaction({callData:d,maxFeePerGas:s.maxFeePerGas,maxPriorityFeePerGas:s.maxPriorityFeePerGas,nonce:s.nonce?BigInt(s.nonce):void 0}).finally((()=>e.current=!1));let g=async()=>{if(!i.paymaster)return!1;let{paymasterData:e,paymasterAndData:a}=await i.prepareUserOperation({calls:l,maxFeePerGas:s.maxFeePerGas,maxPriorityFeePerGas:s.maxPriorityFeePerGas,nonce:s.nonce?BigInt(s.nonce):void 0});return Number(a??e??0)>0};return new Promise((async(n,c)=>{e.current=!0;let{entropyId:y,entropyIdVerifier:P}=p(t);r({connectWallet:{recoveryMethod:m.recoveryMethod,connectingWalletAddress:m.address,isUnifiedWallet:u,entropyId:y,entropyIdVerifier:P,onCompleteNavigateTo:"SendTransactionScreen",onFailure:()=>{}},sendTransaction:{transactionRequests:E({calls:l,chain:i.chain,maxPriorityFeePerGas:s.maxPriorityFeePerGas,maxFeePerGas:s.maxFeePerGas,nonce:s.nonce?BigInt(s.nonce):void 0}),transactingWalletIndex:0,transactingWalletAddress:i.account.address,entropyId:y,entropyIdVerifier:P,getIsSponsored:g,signOnly:!1,onConfirm:async()=>i.sendTransaction({callData:d,maxFeePerGas:s.maxFeePerGas,maxPriorityFeePerGas:s.maxPriorityFeePerGas,nonce:s.nonce?BigInt(s.nonce):void 0}),onSuccess:e=>n(e.hash),onFailure:c,uiOptions:o?.uiOptions??{}}}),a("EmbeddedWalletConnectingScreen")})).finally((()=>{e.current=!1}))},signMessage:async(s,o)=>n({showWalletUIs:o?.uiOptions?.showWalletUIs})?(e.current=!0,await i.signMessage(s).finally((()=>e.current=!1))):new Promise((async(n,l)=>{let{entropyId:c,entropyIdVerifier:d}=p(t);e.current=!0,r({connectWallet:{recoveryMethod:m.recoveryMethod,connectingWalletAddress:m.address,isUnifiedWallet:u,entropyId:c,entropyIdVerifier:d,onCompleteNavigateTo:"SignRequestScreen",onFailure:()=>{}},signMessage:{method:"personal_sign",data:"string"==typeof s.message?s.message:s.message.raw.toString(),confirmAndSign:()=>i.signMessage(s),onSuccess:e=>n(e),onFailure:l,uiOptions:o?.uiOptions??{}}}),a("EmbeddedWalletConnectingScreen")})).finally((()=>{e.current=!1})),signTypedData:async(s,o)=>n({showWalletUIs:o?.uiOptions?.showWalletUIs})?(e.current=!0,await i.signTypedData(s).finally((()=>e.current=!1))):new Promise((async(n,l)=>{e.current=!0;let{entropyId:c,entropyIdVerifier:d}=p(t);r({connectWallet:{recoveryMethod:m.recoveryMethod,connectingWalletAddress:m.address,isUnifiedWallet:u,entropyId:c,entropyIdVerifier:d,onCompleteNavigateTo:"SignRequestScreen",onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:s,confirmAndSign:()=>i.signTypedData(s),onSuccess:e=>n(e),onFailure:l,uiOptions:o?.uiOptions??{}}}),a("EmbeddedWalletConnectingScreen")})).finally((()=>{e.current=!1}))})}};export{N as a,E as c,q as g,_ as u};
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{useContext as t,createContext as i,useState as r,useEffect as a}from"react";import{u as n,c as l}from"./get-is-unified-wallet-j2fzd2YE.mjs";import{u as s}from"./context-CCRnMB8L.mjs";import{u as o,a as c,n as m}from"./internal-context-Z-fyxadS.mjs";import{a as d}from"./getEmbeddedConnectedWallet-JzK4iD-L.mjs";import{u as p,g,a as u}from"./smart-wallets-DL1EjW8i.mjs";import{u as f}from"./useWallets-BKPOCKnv.mjs";import"@privy-io/are-addresses-equal";import"@privy-io/js-sdk-core";import"tinycolor2";import"ofetch";import"viem";import"./PrivyPluginContext-2QN2dVUw.mjs";import"./getPublicClient-B4uPLKn-.mjs";import"permissionless";import"permissionless/accounts";import"permissionless/clients/pimlico";import"viem/account-abstraction";let h=/*#__PURE__*/i({client:void 0,getClientForChain:m});const C=({config:t,children:i})=>/*#__PURE__*/e(y,{config:t,children:/*#__PURE__*/e(W,{children:i})}),w=()=>{let{client:e,getClientForChain:i}=t(h);return{client:e,getClientForChain:i}};let y=({config:t,children:i})=>{let{appId:m}=o(),{chains:u,defaultChain:h,rpcConfig:C,smartWallets:w}=s(),{wallets:y}=f(),{user:W}=n(),[F,j]=r(),{wrapSmartAccountClientWithUIs:P}=p(),b=l(W),x=d(y,b?.address);a((()=>{(async()=>{if(!w?.enabled)return;let e=w.configuredNetworks.find((e=>e.chainId===`eip155:${h.id}`))?h:u.find((e=>w.configuredNetworks.map((e=>e.chainId)).includes(`eip155:${e.id}`)));if(!e)throw new c("Could not find smart wallets chain configurations for any Privy client configured chains. Please configure smart wallets for your chains in the Privy dashboard.");j(await g({chain:e,privyAppId:m,paymasterContext:t?.paymasterContext,rpcConfig:C,account:b,signer:await(x?.getEthereumProvider()),user:W,smartWalletsConfig:w}))})()}),[!!w?.enabled,!!W?.smartWallet,!!x,!!b]);/*#__PURE__*/return e(v.Provider,{value:{client:F,config:t,getClientForChain:async({id:e})=>{let i=await g({chain:u.find((t=>t.id===e)),privyAppId:m,paymasterContext:t?.paymasterContext,rpcConfig:C,account:b,signer:await(x?.getEthereumProvider()),user:W,smartWalletsConfig:w});if(!i)throw new c(`Failed to create smart wallet client for chain id: ${e}`);return P(i)}},children:i})},v=/*#__PURE__*/i({client:void 0,config:void 0,getClientForChain:m}),W=({children:i})=>{let{smartWallets:r}=s(),{client:l,config:c,getClientForChain:m}=(()=>{let{client:e,config:i,getClientForChain:r}=t(v);return{client:e,config:i,getClientForChain:r}})(),{wrapSmartAccountClient:d}=u({clientConfig:c,smartWalletsConfig:r}),{user:p}=n(),{generateSiweMessageForSmartWallet:g,linkSmartWallet:f,hideWalletUIs:C}=o();return a((()=>{(async()=>{if(l&&p&&!p?.smartWallet&&r?.enabled)try{let e=await g({address:l.account.address,chainId:`eip155:${l.chain.id}`});C.current=!0;let t=await l.signMessage({message:e});await f({signature:t,message:e,smartWalletType:r.smartWalletType,smartWalletVersion:r.smartWalletVersion})}catch(e){console.error("Error creating smart wallet:",e)}finally{C.current=!1}})()}),[!!l,!!p?.smartWallet,!!r?.enabled]),/*#__PURE__*/e(h.Provider,{value:{client:p?.smartWallet&&l?d(l):void 0,getClientForChain:m},children:i})};export{C as SmartWalletsProvider,w as useSmartWallets};
1
+ import{jsx as e}from"react/jsx-runtime";import{useContext as t,createContext as i,useState as r,useEffect as a}from"react";import{u as n,c as l}from"./get-is-unified-wallet-Boa8DYrQ.mjs";import{u as s}from"./context-WTldtXS8.mjs";import{u as o,a as c,n as m}from"./internal-context-Z-fyxadS.mjs";import{a as d}from"./getEmbeddedConnectedWallet-JzK4iD-L.mjs";import{u as p,g,a as u}from"./smart-wallets-DOAgnxKI.mjs";import{u as f}from"./useWallets-CR0z5IIt.mjs";import"@privy-io/are-addresses-equal";import"@privy-io/js-sdk-core";import"tinycolor2";import"ofetch";import"viem";import"./PrivyPluginContext-2QN2dVUw.mjs";import"./getPublicClient-B4uPLKn-.mjs";import"permissionless";import"permissionless/accounts";import"permissionless/clients/pimlico";import"viem/account-abstraction";let h=/*#__PURE__*/i({client:void 0,getClientForChain:m});const C=({config:t,children:i})=>/*#__PURE__*/e(y,{config:t,children:/*#__PURE__*/e(W,{children:i})}),w=()=>{let{client:e,getClientForChain:i}=t(h);return{client:e,getClientForChain:i}};let y=({config:t,children:i})=>{let{appId:m}=o(),{chains:u,defaultChain:h,rpcConfig:C,smartWallets:w}=s(),{wallets:y}=f(),{user:W}=n(),[F,j]=r(),{wrapSmartAccountClientWithUIs:P}=p(),b=l(W),x=d(y,b?.address);a((()=>{(async()=>{if(!w?.enabled)return;let e=w.configuredNetworks.find((e=>e.chainId===`eip155:${h.id}`))?h:u.find((e=>w.configuredNetworks.map((e=>e.chainId)).includes(`eip155:${e.id}`)));if(!e)throw new c("Could not find smart wallets chain configurations for any Privy client configured chains. Please configure smart wallets for your chains in the Privy dashboard.");j(await g({chain:e,privyAppId:m,paymasterContext:t?.paymasterContext,rpcConfig:C,account:b,signer:await(x?.getEthereumProvider()),user:W,smartWalletsConfig:w}))})()}),[!!w?.enabled,!!W?.smartWallet,!!x,!!b]);/*#__PURE__*/return e(v.Provider,{value:{client:F,config:t,getClientForChain:async({id:e})=>{let i=await g({chain:u.find((t=>t.id===e)),privyAppId:m,paymasterContext:t?.paymasterContext,rpcConfig:C,account:b,signer:await(x?.getEthereumProvider()),user:W,smartWalletsConfig:w});if(!i)throw new c(`Failed to create smart wallet client for chain id: ${e}`);return P(i)}},children:i})},v=/*#__PURE__*/i({client:void 0,config:void 0,getClientForChain:m}),W=({children:i})=>{let{smartWallets:r}=s(),{client:l,config:c,getClientForChain:m}=(()=>{let{client:e,config:i,getClientForChain:r}=t(v);return{client:e,config:i,getClientForChain:r}})(),{wrapSmartAccountClient:d}=u({clientConfig:c,smartWalletsConfig:r}),{user:p}=n(),{generateSiweMessageForSmartWallet:g,linkSmartWallet:f,hideWalletUIs:C}=o();return a((()=>{(async()=>{if(l&&p&&!p?.smartWallet&&r?.enabled)try{let e=await g({address:l.account.address,chainId:`eip155:${l.chain.id}`});C.current=!0;let t=await l.signMessage({message:e});await f({signature:t,message:e,smartWalletType:r.smartWalletType,smartWalletVersion:r.smartWalletVersion})}catch(e){console.error("Error creating smart wallet:",e)}finally{C.current=!1}})()}),[!!l,!!p?.smartWallet,!!r?.enabled]),/*#__PURE__*/e(h.Provider,{value:{client:p?.smartWallet&&l?d(l):void 0,getClientForChain:m},children:i})};export{C as SmartWalletsProvider,w as useSmartWallets};
@@ -1 +1 @@
1
- import{useCallback as e}from"react";import{b as t,i as s,S as i,p as n,e as r,f as o}from"./usePrivy-D9f62ILp.mjs";import{u as l}from"./context-CCRnMB8L.mjs";import{a as c}from"./events-context-CI0iqAXA.mjs";import{u as d}from"./internal-context-Z-fyxadS.mjs";import{u as h}from"./get-is-unified-wallet-j2fzd2YE.mjs";import{a as p}from"./PrivyPluginContext-2QN2dVUw.mjs";import{pipe as f,createTransactionMessage as m,setTransactionMessageFeePayerSigner as v,setTransactionMessageLifetimeUsingBlockhash as g,appendTransactionMessageInstructions as y,compileTransaction as w,getTransactionEncoder as b,address as P,setTransactionMessageFeePayer as j,blockhash as _,getTransactionDecoder as O}from"@solana/kit";import{f as S,s as T,g as A}from"./useSolanaRpcClient-DizarIU5.mjs";import{S as W,g as C}from"./useWallets-DQOA0__U.mjs";export{a as useStandardWallets,u as useWallets}from"./useWallets-DQOA0__U.mjs";import{base58 as E,base64 as k}from"@scure/base";import{getAddMemoInstruction as M}from"@solana-program/memo";export{a as useExportWallet,u as useFundWallet}from"./use-export-wallet-AwUSjJIc.mjs";import{S as x,W as U}from"./use-export-wallet-Voe8hSb9.mjs";import{getWallets as R}from"@wallet-standard/app";import{UniversalProvider as q}from"@walletconnect/universal-provider";import{isMobile as F}from"react-device-detect";import"@privy-io/js-sdk-core";import"./useWallets-BKPOCKnv.mjs";import"react/jsx-runtime";import"tinycolor2";import"ofetch";import"@privy-io/are-addresses-equal";import"eventemitter3";import"./use-sign-with-user-signer-Do5Oi_rb.mjs";import"viem/utils";const K=e=>{let t,{get:s,on:i}=R(),n=e?.shouldAutoConnect??!0,a=new x(new ke,n),r=new Map,o=[];function l(...e){e.forEach((e=>{!(e.features["privy:"]&&"isPrivyWallet"in e&&e.isPrivyWallet||r.has(e.name))&&e.chains.some((e=>"string"==typeof e&&e.startsWith("solana:")))&&r.set(e.name,e)})),o=Array.from(r.values()).map((e=>new x(e,n))).concat(a),t?.(o)}function c(...e){Array.from(r.values()).forEach((t=>!e.includes(t)&&r.delete(t.name))),o=Array.from(r.values()).map((e=>new x(e,n))).concat(a),t?.(o)}let d=[i("register",l),i("unregister",c)];return l(...s()),{_setOnConnectorsUpdated:e=>{t=e},onMount:()=>{d[0]||(d[0]=i("register",l)),d[1]||(d[1]=i("unregister",c))},onUnmount:()=>{let e=d.pop();for(;e;)e(),e=d.pop()},get:()=>o}};function I(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var V=0;function z(e){return"__private_"+V+++"_"+e}var B=/*#__PURE__*/z("_address"),D=/*#__PURE__*/z("_publicKey"),J=/*#__PURE__*/z("_chains"),N=/*#__PURE__*/z("_features"),L=/*#__PURE__*/z("_label"),Y=/*#__PURE__*/z("_icon");class H{get address(){return I(this,B)[B]}get publicKey(){return I(this,D)[D].slice()}get chains(){return I(this,J)[J].slice()}get features(){return I(this,N)[N].slice()}get label(){return I(this,L)[L]}get icon(){return I(this,Y)[Y]}constructor({address:e,publicKey:t,label:s,icon:i}){Object.defineProperty(this,B,{writable:!0,value:void 0}),Object.defineProperty(this,D,{writable:!0,value:void 0}),Object.defineProperty(this,J,{writable:!0,value:void 0}),Object.defineProperty(this,N,{writable:!0,value:void 0}),Object.defineProperty(this,L,{writable:!0,value:void 0}),Object.defineProperty(this,Y,{writable:!0,value:void 0}),I(this,B)[B]=e,I(this,D)[D]=t,I(this,J)[J]=W,I(this,N)[N]=["solana:signAndSendTransaction","solana:signTransaction","solana:signMessage"],I(this,L)[L]=s,I(this,Y)[Y]=i}}function Z(e){if("string"==typeof e)return E.decode(e);if(e instanceof Uint8Array)return e;let t=e.signature;return"string"==typeof t?E.decode(t):t}function $(e){if("string"==typeof e){try{return E.decode(e)}catch{}return k.decode(e)}if(e instanceof Uint8Array)return e;let t=e.transaction??e.signature;if(!t)throw Error("Invalid result from signTransaction or signAndSendTransaction attempt");if("string"==typeof t){try{return E.decode(t)}catch{}return k.decode(t)}return t}function G(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var Q=0;function X(e){return"__private_"+Q+++"_"+e}let ee="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",te="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1";var se=/*#__PURE__*/X("_listeners"),ie=/*#__PURE__*/X("_version"),ne=/*#__PURE__*/X("_name"),ae=/*#__PURE__*/X("_icon"),re=/*#__PURE__*/X("_provider"),oe=/*#__PURE__*/X("_accounts"),le=/*#__PURE__*/X("_privyAppName"),ce=/*#__PURE__*/X("_walletConnectCloudProjectId"),de=/*#__PURE__*/X("_walletEntry"),he=/*#__PURE__*/X("_onDisplayUriCallback"),ue=/*#__PURE__*/X("_providerEventListeners"),pe=/*#__PURE__*/X("_on"),fe=/*#__PURE__*/X("_emit"),me=/*#__PURE__*/X("_off"),ve=/*#__PURE__*/X("_connected"),ge=/*#__PURE__*/X("_disconnected"),ye=/*#__PURE__*/X("_connect"),we=/*#__PURE__*/X("_disconnect"),be=/*#__PURE__*/X("_signMessage"),Pe=/*#__PURE__*/X("_signAndSendTransaction"),je=/*#__PURE__*/X("_signTransaction"),_e=/*#__PURE__*/X("_getOrCreateProvider"),Oe=/*#__PURE__*/X("_getOrCreateSession"),Se=/*#__PURE__*/X("_restoreSession"),Te=/*#__PURE__*/X("_addProviderEventListener"),Ae=/*#__PURE__*/X("_destroySession"),We=/*#__PURE__*/X("_makeRpcRequest"),Ce=/*#__PURE__*/X("_onDisplayUri"),Ee=/*#__PURE__*/X("_onSessionDelete");class ke{get version(){return G(this,ie)[ie]}get name(){return G(this,ne)[ne]}get icon(){return G(this,ae)[ae]}get chains(){return W.slice()}get features(){return{"standard:connect":{version:"1.0.0",connect:G(this,ye)[ye]},"standard:disconnect":{version:"1.0.0",disconnect:G(this,we)[we]},"standard:events":{version:"1.0.0",on:G(this,pe)[pe]},"solana:signAndSendTransaction":{version:"1.0.0",supportedTransactionVersions:["legacy",0],signAndSendTransaction:G(this,Pe)[Pe]},"solana:signTransaction":{version:"1.0.0",supportedTransactionVersions:["legacy",0],signTransaction:G(this,je)[je]},"solana:signMessage":{version:"1.0.0",signMessage:G(this,be)[be]}}}get accounts(){return G(this,oe)[oe].slice()}get isWalletConnectSolana(){return!0}async initialize({walletConnectCloudProjectId:e,privyAppName:t}){G(this,ce)[ce]=e,G(this,le)[le]=t,await G(this,_e)[_e](),await G(this,Se)[Se]()}setWalletEntry(e,t){G(this,de)[de]=e,G(this,he)[he]=t}constructor(){Object.defineProperty(this,fe,{value:Me}),Object.defineProperty(this,me,{value:xe}),Object.defineProperty(this,se,{writable:!0,value:void 0}),Object.defineProperty(this,ie,{writable:!0,value:void 0}),Object.defineProperty(this,ne,{writable:!0,value:void 0}),Object.defineProperty(this,ae,{writable:!0,value:void 0}),Object.defineProperty(this,re,{writable:!0,value:void 0}),Object.defineProperty(this,oe,{writable:!0,value:void 0}),Object.defineProperty(this,le,{writable:!0,value:void 0}),Object.defineProperty(this,ce,{writable:!0,value:void 0}),Object.defineProperty(this,de,{writable:!0,value:void 0}),Object.defineProperty(this,he,{writable:!0,value:void 0}),Object.defineProperty(this,ue,{writable:!0,value:void 0}),Object.defineProperty(this,pe,{writable:!0,value:void 0}),Object.defineProperty(this,ve,{writable:!0,value:void 0}),Object.defineProperty(this,ge,{writable:!0,value:void 0}),Object.defineProperty(this,ye,{writable:!0,value:void 0}),Object.defineProperty(this,we,{writable:!0,value:void 0}),Object.defineProperty(this,be,{writable:!0,value:void 0}),Object.defineProperty(this,Pe,{writable:!0,value:void 0}),Object.defineProperty(this,je,{writable:!0,value:void 0}),Object.defineProperty(this,_e,{writable:!0,value:void 0}),Object.defineProperty(this,Oe,{writable:!0,value:void 0}),Object.defineProperty(this,Se,{writable:!0,value:void 0}),Object.defineProperty(this,Te,{writable:!0,value:void 0}),Object.defineProperty(this,Ae,{writable:!0,value:void 0}),Object.defineProperty(this,We,{writable:!0,value:void 0}),Object.defineProperty(this,Ce,{writable:!0,value:void 0}),Object.defineProperty(this,Ee,{writable:!0,value:void 0}),G(this,se)[se]={},G(this,ie)[ie]="1.0.0",G(this,ne)[ne]="WalletConnect",G(this,ae)[ae]=U,G(this,re)[re]=null,G(this,oe)[oe]=[],G(this,le)[le]="",G(this,ce)[ce]="",G(this,ue)[ue]=new Map,G(this,pe)[pe]=(e,t)=>(G(this,se)[se][e]?.push(t)||(G(this,se)[se][e]=[t]),()=>G(this,me)[me](e,t)),G(this,ve)[ve]=e=>{G(this,ne)[ne]=G(this,re)[re]?.session?.peer?.metadata?.name||G(this,de)[de]?.name||"WalletConnect",G(this,ae)[ae]=G(this,re)[re]?.session?.peer?.metadata?.icons?.[0]||G(this,de)[de]?.image_url?.sm||G(this,ae)[ae],G(this,oe)[oe]=e.map((e=>new H({address:e,publicKey:E.decode(e),label:G(this,ne)[ne],icon:G(this,ae)[ae]}))),G(this,fe)[fe]("change",{accounts:this.accounts})},G(this,ge)[ge]=()=>{G(this,oe)[oe]=[],G(this,fe)[fe]("change",{accounts:this.accounts})},G(this,ye)[ye]=async()=>(this.accounts.length||await G(this,Oe)[Oe](),{accounts:this.accounts}),G(this,we)[we]=async()=>{await G(this,Ae)[Ae](),G(this,fe)[fe]("change",{accounts:this.accounts})},G(this,be)[be]=async(...e)=>{let t=[];for(let{account:s,message:i}of e){let e=E.encode(i);try{let n=await G(this,We)[We]("solana_signMessage",{message:e,pubkey:s.address},Re("solana:mainnet"));t.push({signedMessage:i,signature:Z(n)})}catch(n){if(n?.message?.includes("Missing or invalid")){let n=await G(this,We)[We]("solana:signMessage",{message:e,pubkey:s.address},Re("solana:mainnet"));t.push({signedMessage:i,signature:Z(n)})}throw n}}return t},G(this,Pe)[Pe]=async(...e)=>{let t=[];for(let{account:s,chain:i,transaction:n,options:a}of e){let e=k.encode(n);try{let n=await G(this,We)[We]("solana_signAndSendTransaction",{transaction:e,pubkey:s.address,sendOptions:a},Re(i));t.push({signature:Z(n)})}catch(n){if(n?.message?.includes("Missing or invalid")){let n=await G(this,We)[We]("solana:signAndSendTransaction",{transaction:e,pubkey:s.address,sendOptions:a},Re(i));t.push({signature:Z(n)})}}}return t},G(this,je)[je]=async(...e)=>{let t=[];for(let{account:s,chain:i,transaction:n}of e){let e=k.encode(n);try{let n=await G(this,We)[We]("solana_signTransaction",{transaction:e,pubkey:s.address},Re(i||"solana:mainnet"));t.push({signedTransaction:$(n)})}catch(n){if(n?.message?.includes("Missing or invalid")){let n=await G(this,We)[We]("solana:signTransaction",{transaction:e,pubkey:s.address},Re(i||"solana:mainnet"));t.push({signedTransaction:$(n)})}}}return t},G(this,_e)[_e]=async()=>{if(G(this,re)[re])return G(this,re)[re];if(!G(this,ce)[ce])throw Error("WalletConnect Cloud Project ID is required");return G(this,re)[re]=await q.init({projectId:G(this,ce)[ce],metadata:{name:G(this,le)[le],description:G(this,le)[le],url:window.location.origin,icons:[]},relayUrl:"wss://relay.walletconnect.com",telemetryEnabled:!1}),G(this,Te)[Te]("display_uri",G(this,Ce)[Ce]),G(this,Te)[Te]("session_delete",G(this,Ee)[Ee]),G(this,Te)[Te]("session_ping",(()=>{})),G(this,Te)[Te]("session_event",(()=>{})),G(this,Te)[Te]("session_update",(()=>{})),G(this,re)[re]},G(this,Oe)[Oe]=async()=>{if(!G(this,re)[re])throw Error("WalletConnectSolana: Failed to get or create session. Provider not initialized");if(G(this,re)[re].session)return G(this,re)[re].session;let e=await G(this,re)[re].connect({optionalNamespaces:{solana:{chains:[ee,te],methods:["solana_signMessage","solana_signTransaction","solana_signAndSendTransaction"],events:[]}}});if(!e)throw Error("WalletConnectSolana: Failed to create new session");return G(this,ve)[ve](Ue(e)),e},G(this,Se)[Se]=async()=>{let e=G(this,re)[re]?.session;if(e){if(!e.namespaces?.solana)return await(G(this,re)[re]?.disconnect().catch((e=>console.error("WalletConnectSolana: Error disconnecting session",e)))),void(G(this,re)[re].session=void 0);G(this,ve)[ve](Ue(e))}},G(this,Te)[Te]=(e,t)=>{let s=G(this,ue)[ue].get(e);s&&(G(this,re)[re]?.off(e,s),G(this,ue)[ue].delete(e)),G(this,re)[re]?.on(e,t),G(this,ue)[ue].set(e,t)},G(this,Ae)[Ae]=async()=>{try{if(G(this,re)[re]?.session&&await(G(this,re)[re]?.disconnect().catch((e=>console.error("WalletConnectSolana: Error disconnecting session",e)))),G(this,re)[re]?.client){let e=G(this,re)[re].client.proposal.getAll();await Promise.allSettled(e.map((e=>G(this,re)[re]?.client.proposal.delete(e.id,{code:6e3,message:"User disconnected"}))));let t=G(this,re)[re].client.pairing.getAll();await Promise.allSettled(t.map((e=>G(this,re)[re]?.client.pairing.delete(e.topic,{code:6e3,message:"User disconnected"}))))}G(this,ge)[ge]()}catch(e){console.error("WalletConnectSolana: Error destroying session",e)}},G(this,We)[We]=async(e,t,s)=>{try{return await G(this,re)[re].request({method:e,params:t},s)}catch(t){if(console.error(`WalletConnectSolana: RPC Error - ${e}:`,t),t?.message?.includes("without any listeners")&&t.result)return t.result;if(t?.message?.includes("session topic does not exist in keychain"))throw Error("WalletConnectSolana: Wallet connection lost. Please reconnect.");throw t}},G(this,Ce)[Ce]=e=>{if(F&&G(this,de)[de]){let{redirect:s}=t(e,G(this,de)[de]);null==G(this,he)[he]||G(this,he)[he].call(this,{native:s,universal:s})}else null==G(this,he)[he]||G(this,he)[he].call(this,{native:e,universal:void 0})},G(this,Ee)[Ee]=()=>{G(this,ge)[ge]()}}}function Me(e,...t){G(this,se)[se][e]?.forEach((e=>e.apply(null,t)))}function xe(e,t){G(this,se)[se][e]=G(this,se)[se][e]?.filter((e=>t!==e))}function Ue(e){return e.namespaces.solana.accounts.reduce(((e,t)=>{let s=t.split(":").at(-1);return e.includes(s)||e.push(s),e}),[])}function Re(e){switch(e){case"solana:mainnet":return ee;case"solana:devnet":return te;default:return e}}const qe=()=>{let{user:t}=h(),{client:i,refreshSessionAndUser:n,initializeWalletProxy:a}=d(),r=c(),o=l();return{importWallet:e((({privateKey:e,additionalSigners:l})=>s({getAccessToken:()=>i.getAccessToken(),user:t,initializeWalletProxy:a,refreshSessionAndUser:n,emitPrivyEvent:r,appConfig:o},{privateKey:e,chainType:"solana",additionalSigners:l})),[t,i,n,a,r,o])}};var Fe={id:i,getSolanaRpcClient:A,createTransactionFromRelayQuote:async function({solanaClient:e,quote:t,source:s}){let i=t.steps[0]?.items?.[0];if(!i)throw Error("Invalid quote");let n=i.data.instructions.map((({keys:e,programId:t,data:s})=>({accounts:e.map((({pubkey:e,isSigner:t,isWritable:s})=>({address:e,role:t&&s?3:t&&!s?2:!t&&s?1:0}))),programAddress:t,data:new Uint8Array(Buffer.from(s,"hex"))}))),{value:a}=await e.rpc.getLatestBlockhash().send(),r=f(m({version:0}),(e=>v({address:s},e)),(e=>g(a,e)),(e=>y(n,e)),(e=>w(e)));return new Uint8Array(b().encode(r))},simulateTransaction:T,getAddressFromBuffer:C,fetchTransactionEstimatedFees:S},Ke=()=>p(Fe);var Ie={id:r,createSiwsMemoTransaction:({address:e,nonce:t})=>{let s=M({memo:n({address:P(e),nonce:t})});return f(m({version:"legacy"}),(t=>j(P(e),t)),(e=>g({blockhash:_("GfVcyD5fWFJ6hRm8bsy7CoVPsLSoJhtJKRJYk8T2VVFN"),lastValidBlockHeight:0n},e)),(e=>y([s],e)),(e=>w(e)),(e=>k.encode(Uint8Array.from(b().encode(e)))))},getSignatureFromTransaction:(e,t)=>{let s=O().decode(e).signatures[t];if(!s)throw Error(`Missing transaction signature for address: ${t}`);return k.encode(s)}},Ve=()=>p(Ie);function ze(){let{create:e}=o();return{createWallet:async t=>{t&&"target"in t&&t&&(t=void 0);let{account:s}=await e({chainType:"solana",options:t});return{wallet:s}}}}function Be(){return{signMessage:async function(...e){let t=[];for(let s of e)t.push(await s.wallet.signMessage({...s,options:s.options}));return 1===e.length?t[0]:[...t]}}}function De(){return{signTransaction:async function(...e){let t=[];for(let s of e)t.push(await s.wallet.signTransaction({...s,chain:s.chain||"solana:mainnet"}));return 1===e.length?t[0]:[...t]}}}function Je(){return{signAndSendTransaction:async function(...e){let t=[];for(let s of e)t.push(await s.wallet.signAndSendTransaction({...s,chain:s.chain||"solana:mainnet"}));return 1===e.length?t[0]:[...t]}}}export{x as SolanaAdapterConnector,K as toSolanaWalletConnectors,ze as useCreateWallet,qe as useImportWallet,Je as useSignAndSendTransaction,Be as useSignMessage,De as useSignTransaction,Ke as useSolanaFundingPlugin,Ve as useSolanaLedgerPlugin};
1
+ import{useCallback as e}from"react";import{b as t,i as s,S as i,p as n,e as r,f as o}from"./usePrivy-6nkpbErN.mjs";import{u as l}from"./context-WTldtXS8.mjs";import{a as c}from"./events-context-CI0iqAXA.mjs";import{u as d}from"./internal-context-Z-fyxadS.mjs";import{u as h}from"./get-is-unified-wallet-Boa8DYrQ.mjs";import{a as p}from"./PrivyPluginContext-2QN2dVUw.mjs";import{pipe as f,createTransactionMessage as m,setTransactionMessageFeePayerSigner as v,setTransactionMessageLifetimeUsingBlockhash as g,appendTransactionMessageInstructions as y,compileTransaction as w,getTransactionEncoder as b,address as P,setTransactionMessageFeePayer as j,blockhash as _,getTransactionDecoder as O}from"@solana/kit";import{f as S,s as T,g as A}from"./useSolanaRpcClient-BUWOblv_.mjs";import{S as W,g as C}from"./useWallets-C_dCo2_Q.mjs";export{a as useStandardWallets,u as useWallets}from"./useWallets-C_dCo2_Q.mjs";import{base58 as E,base64 as k}from"@scure/base";import{getAddMemoInstruction as M}from"@solana-program/memo";export{a as useExportWallet,u as useFundWallet}from"./use-export-wallet-DQde4t0V.mjs";import{S as x,W as U}from"./use-export-wallet-CV4p7L0b.mjs";import{getWallets as R}from"@wallet-standard/app";import{UniversalProvider as q}from"@walletconnect/universal-provider";import{isMobile as F}from"react-device-detect";import"@privy-io/js-sdk-core";import"./useWallets-CR0z5IIt.mjs";import"react/jsx-runtime";import"tinycolor2";import"ofetch";import"@privy-io/are-addresses-equal";import"eventemitter3";import"./use-sign-with-user-signer-Do5Oi_rb.mjs";import"viem/utils";const K=e=>{let t,{get:s,on:i}=R(),n=e?.shouldAutoConnect??!0,a=new x(new ke,n),r=new Map,o=[];function l(...e){e.forEach((e=>{!(e.features["privy:"]&&"isPrivyWallet"in e&&e.isPrivyWallet||r.has(e.name))&&e.chains.some((e=>"string"==typeof e&&e.startsWith("solana:")))&&r.set(e.name,e)})),o=Array.from(r.values()).map((e=>new x(e,n))).concat(a),t?.(o)}function c(...e){Array.from(r.values()).forEach((t=>!e.includes(t)&&r.delete(t.name))),o=Array.from(r.values()).map((e=>new x(e,n))).concat(a),t?.(o)}let d=[i("register",l),i("unregister",c)];return l(...s()),{_setOnConnectorsUpdated:e=>{t=e},onMount:()=>{d[0]||(d[0]=i("register",l)),d[1]||(d[1]=i("unregister",c))},onUnmount:()=>{let e=d.pop();for(;e;)e(),e=d.pop()},get:()=>o}};function I(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var V=0;function z(e){return"__private_"+V+++"_"+e}var B=/*#__PURE__*/z("_address"),D=/*#__PURE__*/z("_publicKey"),J=/*#__PURE__*/z("_chains"),N=/*#__PURE__*/z("_features"),L=/*#__PURE__*/z("_label"),Y=/*#__PURE__*/z("_icon");class H{get address(){return I(this,B)[B]}get publicKey(){return I(this,D)[D].slice()}get chains(){return I(this,J)[J].slice()}get features(){return I(this,N)[N].slice()}get label(){return I(this,L)[L]}get icon(){return I(this,Y)[Y]}constructor({address:e,publicKey:t,label:s,icon:i}){Object.defineProperty(this,B,{writable:!0,value:void 0}),Object.defineProperty(this,D,{writable:!0,value:void 0}),Object.defineProperty(this,J,{writable:!0,value:void 0}),Object.defineProperty(this,N,{writable:!0,value:void 0}),Object.defineProperty(this,L,{writable:!0,value:void 0}),Object.defineProperty(this,Y,{writable:!0,value:void 0}),I(this,B)[B]=e,I(this,D)[D]=t,I(this,J)[J]=W,I(this,N)[N]=["solana:signAndSendTransaction","solana:signTransaction","solana:signMessage"],I(this,L)[L]=s,I(this,Y)[Y]=i}}function Z(e){if("string"==typeof e)return E.decode(e);if(e instanceof Uint8Array)return e;let t=e.signature;return"string"==typeof t?E.decode(t):t}function $(e){if("string"==typeof e){try{return E.decode(e)}catch{}return k.decode(e)}if(e instanceof Uint8Array)return e;let t=e.transaction??e.signature;if(!t)throw Error("Invalid result from signTransaction or signAndSendTransaction attempt");if("string"==typeof t){try{return E.decode(t)}catch{}return k.decode(t)}return t}function G(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var Q=0;function X(e){return"__private_"+Q+++"_"+e}let ee="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",te="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1";var se=/*#__PURE__*/X("_listeners"),ie=/*#__PURE__*/X("_version"),ne=/*#__PURE__*/X("_name"),ae=/*#__PURE__*/X("_icon"),re=/*#__PURE__*/X("_provider"),oe=/*#__PURE__*/X("_accounts"),le=/*#__PURE__*/X("_privyAppName"),ce=/*#__PURE__*/X("_walletConnectCloudProjectId"),de=/*#__PURE__*/X("_walletEntry"),he=/*#__PURE__*/X("_onDisplayUriCallback"),ue=/*#__PURE__*/X("_providerEventListeners"),pe=/*#__PURE__*/X("_on"),fe=/*#__PURE__*/X("_emit"),me=/*#__PURE__*/X("_off"),ve=/*#__PURE__*/X("_connected"),ge=/*#__PURE__*/X("_disconnected"),ye=/*#__PURE__*/X("_connect"),we=/*#__PURE__*/X("_disconnect"),be=/*#__PURE__*/X("_signMessage"),Pe=/*#__PURE__*/X("_signAndSendTransaction"),je=/*#__PURE__*/X("_signTransaction"),_e=/*#__PURE__*/X("_getOrCreateProvider"),Oe=/*#__PURE__*/X("_getOrCreateSession"),Se=/*#__PURE__*/X("_restoreSession"),Te=/*#__PURE__*/X("_addProviderEventListener"),Ae=/*#__PURE__*/X("_destroySession"),We=/*#__PURE__*/X("_makeRpcRequest"),Ce=/*#__PURE__*/X("_onDisplayUri"),Ee=/*#__PURE__*/X("_onSessionDelete");class ke{get version(){return G(this,ie)[ie]}get name(){return G(this,ne)[ne]}get icon(){return G(this,ae)[ae]}get chains(){return W.slice()}get features(){return{"standard:connect":{version:"1.0.0",connect:G(this,ye)[ye]},"standard:disconnect":{version:"1.0.0",disconnect:G(this,we)[we]},"standard:events":{version:"1.0.0",on:G(this,pe)[pe]},"solana:signAndSendTransaction":{version:"1.0.0",supportedTransactionVersions:["legacy",0],signAndSendTransaction:G(this,Pe)[Pe]},"solana:signTransaction":{version:"1.0.0",supportedTransactionVersions:["legacy",0],signTransaction:G(this,je)[je]},"solana:signMessage":{version:"1.0.0",signMessage:G(this,be)[be]}}}get accounts(){return G(this,oe)[oe].slice()}get isWalletConnectSolana(){return!0}async initialize({walletConnectCloudProjectId:e,privyAppName:t}){G(this,ce)[ce]=e,G(this,le)[le]=t,await G(this,_e)[_e](),await G(this,Se)[Se]()}setWalletEntry(e,t){G(this,de)[de]=e,G(this,he)[he]=t}constructor(){Object.defineProperty(this,fe,{value:Me}),Object.defineProperty(this,me,{value:xe}),Object.defineProperty(this,se,{writable:!0,value:void 0}),Object.defineProperty(this,ie,{writable:!0,value:void 0}),Object.defineProperty(this,ne,{writable:!0,value:void 0}),Object.defineProperty(this,ae,{writable:!0,value:void 0}),Object.defineProperty(this,re,{writable:!0,value:void 0}),Object.defineProperty(this,oe,{writable:!0,value:void 0}),Object.defineProperty(this,le,{writable:!0,value:void 0}),Object.defineProperty(this,ce,{writable:!0,value:void 0}),Object.defineProperty(this,de,{writable:!0,value:void 0}),Object.defineProperty(this,he,{writable:!0,value:void 0}),Object.defineProperty(this,ue,{writable:!0,value:void 0}),Object.defineProperty(this,pe,{writable:!0,value:void 0}),Object.defineProperty(this,ve,{writable:!0,value:void 0}),Object.defineProperty(this,ge,{writable:!0,value:void 0}),Object.defineProperty(this,ye,{writable:!0,value:void 0}),Object.defineProperty(this,we,{writable:!0,value:void 0}),Object.defineProperty(this,be,{writable:!0,value:void 0}),Object.defineProperty(this,Pe,{writable:!0,value:void 0}),Object.defineProperty(this,je,{writable:!0,value:void 0}),Object.defineProperty(this,_e,{writable:!0,value:void 0}),Object.defineProperty(this,Oe,{writable:!0,value:void 0}),Object.defineProperty(this,Se,{writable:!0,value:void 0}),Object.defineProperty(this,Te,{writable:!0,value:void 0}),Object.defineProperty(this,Ae,{writable:!0,value:void 0}),Object.defineProperty(this,We,{writable:!0,value:void 0}),Object.defineProperty(this,Ce,{writable:!0,value:void 0}),Object.defineProperty(this,Ee,{writable:!0,value:void 0}),G(this,se)[se]={},G(this,ie)[ie]="1.0.0",G(this,ne)[ne]="WalletConnect",G(this,ae)[ae]=U,G(this,re)[re]=null,G(this,oe)[oe]=[],G(this,le)[le]="",G(this,ce)[ce]="",G(this,ue)[ue]=new Map,G(this,pe)[pe]=(e,t)=>(G(this,se)[se][e]?.push(t)||(G(this,se)[se][e]=[t]),()=>G(this,me)[me](e,t)),G(this,ve)[ve]=e=>{G(this,ne)[ne]=G(this,re)[re]?.session?.peer?.metadata?.name||G(this,de)[de]?.name||"WalletConnect",G(this,ae)[ae]=G(this,re)[re]?.session?.peer?.metadata?.icons?.[0]||G(this,de)[de]?.image_url?.sm||G(this,ae)[ae],G(this,oe)[oe]=e.map((e=>new H({address:e,publicKey:E.decode(e),label:G(this,ne)[ne],icon:G(this,ae)[ae]}))),G(this,fe)[fe]("change",{accounts:this.accounts})},G(this,ge)[ge]=()=>{G(this,oe)[oe]=[],G(this,fe)[fe]("change",{accounts:this.accounts})},G(this,ye)[ye]=async()=>(this.accounts.length||await G(this,Oe)[Oe](),{accounts:this.accounts}),G(this,we)[we]=async()=>{await G(this,Ae)[Ae](),G(this,fe)[fe]("change",{accounts:this.accounts})},G(this,be)[be]=async(...e)=>{let t=[];for(let{account:s,message:i}of e){let e=E.encode(i);try{let n=await G(this,We)[We]("solana_signMessage",{message:e,pubkey:s.address},Re("solana:mainnet"));t.push({signedMessage:i,signature:Z(n)})}catch(n){if(n?.message?.includes("Missing or invalid")){let n=await G(this,We)[We]("solana:signMessage",{message:e,pubkey:s.address},Re("solana:mainnet"));t.push({signedMessage:i,signature:Z(n)})}throw n}}return t},G(this,Pe)[Pe]=async(...e)=>{let t=[];for(let{account:s,chain:i,transaction:n,options:a}of e){let e=k.encode(n);try{let n=await G(this,We)[We]("solana_signAndSendTransaction",{transaction:e,pubkey:s.address,sendOptions:a},Re(i));t.push({signature:Z(n)})}catch(n){if(n?.message?.includes("Missing or invalid")){let n=await G(this,We)[We]("solana:signAndSendTransaction",{transaction:e,pubkey:s.address,sendOptions:a},Re(i));t.push({signature:Z(n)})}}}return t},G(this,je)[je]=async(...e)=>{let t=[];for(let{account:s,chain:i,transaction:n}of e){let e=k.encode(n);try{let n=await G(this,We)[We]("solana_signTransaction",{transaction:e,pubkey:s.address},Re(i||"solana:mainnet"));t.push({signedTransaction:$(n)})}catch(n){if(n?.message?.includes("Missing or invalid")){let n=await G(this,We)[We]("solana:signTransaction",{transaction:e,pubkey:s.address},Re(i||"solana:mainnet"));t.push({signedTransaction:$(n)})}}}return t},G(this,_e)[_e]=async()=>{if(G(this,re)[re])return G(this,re)[re];if(!G(this,ce)[ce])throw Error("WalletConnect Cloud Project ID is required");return G(this,re)[re]=await q.init({projectId:G(this,ce)[ce],metadata:{name:G(this,le)[le],description:G(this,le)[le],url:window.location.origin,icons:[]},relayUrl:"wss://relay.walletconnect.com",telemetryEnabled:!1}),G(this,Te)[Te]("display_uri",G(this,Ce)[Ce]),G(this,Te)[Te]("session_delete",G(this,Ee)[Ee]),G(this,Te)[Te]("session_ping",(()=>{})),G(this,Te)[Te]("session_event",(()=>{})),G(this,Te)[Te]("session_update",(()=>{})),G(this,re)[re]},G(this,Oe)[Oe]=async()=>{if(!G(this,re)[re])throw Error("WalletConnectSolana: Failed to get or create session. Provider not initialized");if(G(this,re)[re].session)return G(this,re)[re].session;let e=await G(this,re)[re].connect({optionalNamespaces:{solana:{chains:[ee,te],methods:["solana_signMessage","solana_signTransaction","solana_signAndSendTransaction"],events:[]}}});if(!e)throw Error("WalletConnectSolana: Failed to create new session");return G(this,ve)[ve](Ue(e)),e},G(this,Se)[Se]=async()=>{let e=G(this,re)[re]?.session;if(e){if(!e.namespaces?.solana)return await(G(this,re)[re]?.disconnect().catch((e=>console.error("WalletConnectSolana: Error disconnecting session",e)))),void(G(this,re)[re].session=void 0);G(this,ve)[ve](Ue(e))}},G(this,Te)[Te]=(e,t)=>{let s=G(this,ue)[ue].get(e);s&&(G(this,re)[re]?.off(e,s),G(this,ue)[ue].delete(e)),G(this,re)[re]?.on(e,t),G(this,ue)[ue].set(e,t)},G(this,Ae)[Ae]=async()=>{try{if(G(this,re)[re]?.session&&await(G(this,re)[re]?.disconnect().catch((e=>console.error("WalletConnectSolana: Error disconnecting session",e)))),G(this,re)[re]?.client){let e=G(this,re)[re].client.proposal.getAll();await Promise.allSettled(e.map((e=>G(this,re)[re]?.client.proposal.delete(e.id,{code:6e3,message:"User disconnected"}))));let t=G(this,re)[re].client.pairing.getAll();await Promise.allSettled(t.map((e=>G(this,re)[re]?.client.pairing.delete(e.topic,{code:6e3,message:"User disconnected"}))))}G(this,ge)[ge]()}catch(e){console.error("WalletConnectSolana: Error destroying session",e)}},G(this,We)[We]=async(e,t,s)=>{try{return await G(this,re)[re].request({method:e,params:t},s)}catch(t){if(console.error(`WalletConnectSolana: RPC Error - ${e}:`,t),t?.message?.includes("without any listeners")&&t.result)return t.result;if(t?.message?.includes("session topic does not exist in keychain"))throw Error("WalletConnectSolana: Wallet connection lost. Please reconnect.");throw t}},G(this,Ce)[Ce]=e=>{if(F&&G(this,de)[de]){let{redirect:s}=t(e,G(this,de)[de]);null==G(this,he)[he]||G(this,he)[he].call(this,{native:s,universal:s})}else null==G(this,he)[he]||G(this,he)[he].call(this,{native:e,universal:void 0})},G(this,Ee)[Ee]=()=>{G(this,ge)[ge]()}}}function Me(e,...t){G(this,se)[se][e]?.forEach((e=>e.apply(null,t)))}function xe(e,t){G(this,se)[se][e]=G(this,se)[se][e]?.filter((e=>t!==e))}function Ue(e){return e.namespaces.solana.accounts.reduce(((e,t)=>{let s=t.split(":").at(-1);return e.includes(s)||e.push(s),e}),[])}function Re(e){switch(e){case"solana:mainnet":return ee;case"solana:devnet":return te;default:return e}}const qe=()=>{let{user:t}=h(),{client:i,refreshSessionAndUser:n,initializeWalletProxy:a}=d(),r=c(),o=l();return{importWallet:e((({privateKey:e,additionalSigners:l})=>s({getAccessToken:()=>i.getAccessToken(),user:t,initializeWalletProxy:a,refreshSessionAndUser:n,emitPrivyEvent:r,appConfig:o},{privateKey:e,chainType:"solana",additionalSigners:l})),[t,i,n,a,r,o])}};var Fe={id:i,getSolanaRpcClient:A,createTransactionFromRelayQuote:async function({solanaClient:e,quote:t,source:s}){let i=t.steps[0]?.items?.[0];if(!i)throw Error("Invalid quote");let n=i.data.instructions.map((({keys:e,programId:t,data:s})=>({accounts:e.map((({pubkey:e,isSigner:t,isWritable:s})=>({address:e,role:t&&s?3:t&&!s?2:!t&&s?1:0}))),programAddress:t,data:new Uint8Array(Buffer.from(s,"hex"))}))),{value:a}=await e.rpc.getLatestBlockhash().send(),r=f(m({version:0}),(e=>v({address:s},e)),(e=>g(a,e)),(e=>y(n,e)),(e=>w(e)));return new Uint8Array(b().encode(r))},simulateTransaction:T,getAddressFromBuffer:C,fetchTransactionEstimatedFees:S},Ke=()=>p(Fe);var Ie={id:r,createSiwsMemoTransaction:({address:e,nonce:t})=>{let s=M({memo:n({address:P(e),nonce:t})});return f(m({version:"legacy"}),(t=>j(P(e),t)),(e=>g({blockhash:_("GfVcyD5fWFJ6hRm8bsy7CoVPsLSoJhtJKRJYk8T2VVFN"),lastValidBlockHeight:0n},e)),(e=>y([s],e)),(e=>w(e)),(e=>k.encode(Uint8Array.from(b().encode(e)))))},getSignatureFromTransaction:(e,t)=>{let s=O().decode(e).signatures[t];if(!s)throw Error(`Missing transaction signature for address: ${t}`);return k.encode(s)}},Ve=()=>p(Ie);function ze(){let{create:e}=o();return{createWallet:async t=>{t&&"target"in t&&t&&(t=void 0);let{account:s}=await e({chainType:"solana",options:t});return{wallet:s}}}}function Be(){return{signMessage:async function(...e){let t=[];for(let s of e)t.push(await s.wallet.signMessage({...s,options:s.options}));return 1===e.length?t[0]:[...t]}}}function De(){return{signTransaction:async function(...e){let t=[];for(let s of e)t.push(await s.wallet.signTransaction({...s,chain:s.chain||"solana:mainnet"}));return 1===e.length?t[0]:[...t]}}}function Je(){return{signAndSendTransaction:async function(...e){let t=[];for(let s of e)t.push(await s.wallet.signAndSendTransaction({...s,chain:s.chain||"solana:mainnet"}));return 1===e.length?t[0]:[...t]}}}export{x as SolanaAdapterConnector,K as toSolanaWalletConnectors,ze as useCreateWallet,qe as useImportWallet,Je as useSignAndSendTransaction,Be as useSignMessage,De as useSignTransaction,Ke as useSolanaFundingPlugin,Ve as useSolanaLedgerPlugin};
@@ -1,4 +1,4 @@
1
- import{styled as o,keyframes as i}from"styled-components";import{d as t}from"./ModalHeader-DBfMXKy4.mjs";import{LinkButton as r}from"./LinkPasskeyScreen-3_thbT6t.mjs";const e=o.div`
1
+ import{styled as o,keyframes as i}from"styled-components";import{d as t}from"./ModalHeader-D8-mhjp4.mjs";import{LinkButton as r}from"./LinkPasskeyScreen-OxaghvUl.mjs";const e=o.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 12px;
@@ -1,4 +1,4 @@
1
- import{jsxs as e,jsx as r,Fragment as o}from"react/jsx-runtime";import n from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import i from"@heroicons/react/24/outline/FingerPrintIcon";import t from"@heroicons/react/24/outline/PhoneIcon";import a from"@heroicons/react/24/outline/ShieldCheckIcon";import{b as s,M as c,P as l,S as d}from"./ModalHeader-DBfMXKy4.mjs";import{S as m}from"./ScreenLayout-z1I4hafk.mjs";import{U as h,V as p,a4 as u}from"./useActiveWallet-Dqi9nNxj.mjs";import{M as g,F as f,T as y,L as C,b as k,c as T,C as S,E as b,P as v,I,N as j,S as w}from"./PinInput-3SLvbnQa.mjs";import P from"@heroicons/react/24/outline/CalendarIcon";import x from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{e as B}from"./StackedContainer-B2vaEl56.mjs";import{u as E}from"./internal-context-Z-fyxadS.mjs";import{useState as M,useMemo as V,useEffect as A}from"react";import{styled as L}from"styled-components";import{toHex as D}from"viem";import{u as F}from"./useGetTokenPrice-Djb6UHOW.mjs";import{u as N}from"./useWallets-BKPOCKnv.mjs";import{p as Y,j as H,g as W,h as G}from"./index-BgGYO9kN.mjs";import{g as O}from"./getPublicClient-B4uPLKn-.mjs";import{T as Q}from"./TransactionDetails-CLHEcWFe.mjs";import{u as U}from"./context-CCRnMB8L.mjs";const q=({handleClose:o,mfaMethods:c,onSelect:l})=>/*#__PURE__*/e(m,{title:"Verify your identity",subtitle:"Choose a verification method",icon:a,iconVariant:"subtle",onClose:o,showClose:!0,watermark:!0,children:[/*#__PURE__*/e(g,{children:[c.includes("totp")&&/*#__PURE__*/e(h,{onClick:()=>l("totp"),children:[/*#__PURE__*/r(p,{children:/*#__PURE__*/r(n,{})}),"Authenticator app"]},"totp"),c.includes("sms")&&/*#__PURE__*/e(h,{onClick:()=>l("sms"),children:[/*#__PURE__*/r(p,{children:/*#__PURE__*/r(t,{})}),"SMS"]},"sms"),c.includes("passkey")&&/*#__PURE__*/e(h,{onClick:()=>l("passkey"),children:[/*#__PURE__*/r(p,{children:/*#__PURE__*/r(i,{})}),"Passkey"]},"passkey")]}),/*#__PURE__*/r(s,{})]}),z=({pendingTransaction:e})=>{let{wallets:o}=N(),{walletProxy:n,rpcConfig:i,chains:t,appId:a,nativeTokenSymbolForChainId:s}=E(),[c,l]=M(null),[d,m]=M(e),{tokenPrice:h}=F(d.chainId),p=s(e.chainId)||"ETH",u=V((()=>o.find((e=>"privy"===e.walletClientType))),[o]);return A((()=>{(async function(){if(!n||!u)return d;let e=O(d.chainId,t,i,{appId:a}),r=await Y(d,e,u.address);return l(D(BigInt(r.gas??0))),r})().then(m).catch(console.error)}),[n]),u?/*#__PURE__*/r(J,{children:/*#__PURE__*/r(Q,{from:u.address,to:d.to,txn:d,gas:c??void 0,tokenPrice:h,tokenSymbol:p})}):null};let J=L.div`
1
+ import{jsxs as e,jsx as r,Fragment as o}from"react/jsx-runtime";import n from"@heroicons/react/24/outline/DevicePhoneMobileIcon";import i from"@heroicons/react/24/outline/FingerPrintIcon";import t from"@heroicons/react/24/outline/PhoneIcon";import a from"@heroicons/react/24/outline/ShieldCheckIcon";import{b as s,M as c,P as l,S as d}from"./ModalHeader-D8-mhjp4.mjs";import{S as m}from"./ScreenLayout-DTmQLGPf.mjs";import{U as h,V as p,a4 as u}from"./useActiveWallet-3RHPIBxJ.mjs";import{M as g,F as f,T as y,L as C,b as k,c as T,C as S,E as b,P as v,I,N as j,S as w}from"./PinInput-3SLvbnQa.mjs";import P from"@heroicons/react/24/outline/CalendarIcon";import x from"@heroicons/react/24/outline/ExclamationTriangleIcon";import{e as B}from"./StackedContainer-B2vaEl56.mjs";import{u as E}from"./internal-context-Z-fyxadS.mjs";import{useState as M,useMemo as V,useEffect as A}from"react";import{styled as L}from"styled-components";import{toHex as D}from"viem";import{u as F}from"./useGetTokenPrice-BPBpM07F.mjs";import{u as N}from"./useWallets-CR0z5IIt.mjs";import{p as Y,j as H,g as W,h as G}from"./index-BBRkihRn.mjs";import{g as O}from"./getPublicClient-B4uPLKn-.mjs";import{T as Q}from"./TransactionDetails-BurRo8R0.mjs";import{u as U}from"./context-WTldtXS8.mjs";const q=({handleClose:o,mfaMethods:c,onSelect:l})=>/*#__PURE__*/e(m,{title:"Verify your identity",subtitle:"Choose a verification method",icon:a,iconVariant:"subtle",onClose:o,showClose:!0,watermark:!0,children:[/*#__PURE__*/e(g,{children:[c.includes("totp")&&/*#__PURE__*/e(h,{onClick:()=>l("totp"),children:[/*#__PURE__*/r(p,{children:/*#__PURE__*/r(n,{})}),"Authenticator app"]},"totp"),c.includes("sms")&&/*#__PURE__*/e(h,{onClick:()=>l("sms"),children:[/*#__PURE__*/r(p,{children:/*#__PURE__*/r(t,{})}),"SMS"]},"sms"),c.includes("passkey")&&/*#__PURE__*/e(h,{onClick:()=>l("passkey"),children:[/*#__PURE__*/r(p,{children:/*#__PURE__*/r(i,{})}),"Passkey"]},"passkey")]}),/*#__PURE__*/r(s,{})]}),z=({pendingTransaction:e})=>{let{wallets:o}=N(),{walletProxy:n,rpcConfig:i,chains:t,appId:a,nativeTokenSymbolForChainId:s}=E(),[c,l]=M(null),[d,m]=M(e),{tokenPrice:h}=F(d.chainId),p=s(e.chainId)||"ETH",u=V((()=>o.find((e=>"privy"===e.walletClientType))),[o]);return A((()=>{(async function(){if(!n||!u)return d;let e=O(d.chainId,t,i,{appId:a}),r=await Y(d,e,u.address);return l(D(BigInt(r.gas??0))),r})().then(m).catch(console.error)}),[n]),u?/*#__PURE__*/r(J,{children:/*#__PURE__*/r(Q,{from:u.address,to:d.to,txn:d,gas:c??void 0,tokenPrice:h,tokenSymbol:p})}):null};let J=L.div`
2
2
  width: 100%;
3
3
  padding: 1rem 0;
4
4
  `;const K=({hasBlockingError:n,error:i,onClose:t,onBack:d,handleSubmit:m,account:h,submitSuccess:p})=>{let{pendingTransaction:g}=E();/*#__PURE__*/return e(o,{children:[/*#__PURE__*/r(c,{onClose:t},"header"),/*#__PURE__*/r(B,{children:/*#__PURE__*/e("div",{children:[/*#__PURE__*/r(u,{success:p,fail:!!i}),/*#__PURE__*/r(i?x:f,{style:{width:"38px",height:"38px"}})]})}),/*#__PURE__*/r(y,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),/*#__PURE__*/e(C,{children:[/*#__PURE__*/e(k,{children:[/*#__PURE__*/r(T,{children:/*#__PURE__*/r(a,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),/*#__PURE__*/e(k,{children:[/*#__PURE__*/r(T,{children:/*#__PURE__*/r(P,{})}),"You last added a passkey on"," ",h?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),g&&/*#__PURE__*/r(S,{children:/*#__PURE__*/r(z,{pendingTransaction:g})}),i&&/*#__PURE__*/e(o,{children:[/*#__PURE__*/r(b,{style:{marginTop:"1.25rem"},children:i.message}),/*#__PURE__*/r(l,{disabled:n,onClick:m,style:{margin:"1.25rem auto 0"},children:"Try again"})]}),d&&/*#__PURE__*/r(v,{style:{marginTop:"1rem"},onClick:d,children:"Choose another method"}),/*#__PURE__*/r(s,{})]})},R=({selectedMethod:i,submitSuccess:a,hasBlockingError:l,onClose:m,onBack:h,handleSubmitCode:p})=>{let u=U(),{pendingTransaction:g}=E();switch(i){case"sms":/*#__PURE__*/return e(o,{children:[/*#__PURE__*/r(c,{onClose:m},"header"),/*#__PURE__*/r(I,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/r(t,{})}),/*#__PURE__*/r(y,{children:"Enter verification code"}),/*#__PURE__*/e(S,{children:[/*#__PURE__*/r(j,{success:a,disabled:l,onChange:p}),/*#__PURE__*/e(w,{children:["To continue, please enter the 6-digit code sent to your ",/*#__PURE__*/r("strong",{children:"mobile device"})]}),g&&/*#__PURE__*/r(z,{pendingTransaction:g})]}),h&&/*#__PURE__*/r(v,{theme:u?.appearance.palette.colorScheme,onClick:h,children:"Choose another method"}),/*#__PURE__*/r(d,{onClick:m,children:"Cancel"}),/*#__PURE__*/r(s,{})]});case"totp":/*#__PURE__*/return e(o,{children:[/*#__PURE__*/r(c,{onClose:m},"header"),/*#__PURE__*/r(I,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/r(n,{})}),/*#__PURE__*/r(y,{children:"Enter verification code"}),/*#__PURE__*/e(S,{children:[/*#__PURE__*/r(j,{success:a,disabled:l,onChange:p}),/*#__PURE__*/e(w,{children:["To continue, please enter the 6-digit code generated from your"," ",/*#__PURE__*/r("strong",{children:"authenticator app"})]}),g&&/*#__PURE__*/r(z,{pendingTransaction:g})]}),h&&/*#__PURE__*/r(v,{theme:u?.appearance.palette.colorScheme,onClick:h,children:"Choose another method"}),/*#__PURE__*/r(d,{onClick:m,children:"Cancel"}),/*#__PURE__*/r(s,{})]});default:return null}},X=e=>H(e)?{isBlocking:!0,error:Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")}:W(e)?{isBlocking:!1,error:Error("The code you entered is not valid")}:G(e)?{isBlocking:!0,error:Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")}:(console.error(e),{isBlocking:!1,error:Error("Something went wrong.")});export{K as V,R as a,q as b,X as t};
package/dist/esm/ui.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import{D as i,F as n,B as a,z as l,u as o,y as s,A as d,G as c,I as h,f as p,J as m,n as u,C as w,v as C,K as f,N as g,O as v}from"./useActiveWallet-Dqi9nNxj.mjs";import{i as y,u as x}from"./get-is-unified-wallet-j2fzd2YE.mjs";import{u as k}from"./useWallets-BKPOCKnv.mjs";import{styled as b,css as _}from"styled-components";import{C as M}from"./CopyableText-BCytXyJL.mjs";import{u as z}from"./context-CCRnMB8L.mjs";import{W as L}from"./WalletCards-DH1rqayz.mjs";import{T as H,L as A}from"./twitch-5IOe4sIQ.mjs";import{B as F}from"./ModalHeader-DBfMXKy4.mjs";import*as j from"react";import{useState as V,createContext as Z,useContext as B,useRef as I,useMemo as S,useEffect as T}from"react";import{useMergeRefs as U,useTransitionStyles as W,FloatingPortal as R,FloatingFocusManager as P,useFloating as O,offset as D,flip as N,shift as G,autoUpdate as $,useInteractions as E,useClick as X,useDismiss as q,useRole as Q}from"@floating-ui/react";import Y from"@heroicons/react/24/outline/UserIcon";import{W as J}from"./WalletInfoCard-BURM3rIP.mjs";import{u as K}from"./internal-context-Z-fyxadS.mjs";import{u as ee}from"./useWalletBalance-CDyi5_iR.mjs";import{g as te}from"./ethers-B0Y3_-Pp.mjs";import re from"@heroicons/react/24/outline/EllipsisHorizontalIcon";import ie from"@heroicons/react/24/outline/PlusCircleIcon";import{u as ne,e as ae}from"./use-export-wallet-Voe8hSb9.mjs";import{u as le,a as oe}from"./use-export-wallet-AwUSjJIc.mjs";import{Menu as se,MenuButton as de,MenuItems as ce,MenuItem as he,Disclosure as pe,DisclosureButton as me,DisclosurePanel as ue,DialogTitle as we,Dialog as Ce,DialogBackdrop as fe,DialogPanel as ge}from"@headlessui/react";import{C as ve,W as ye,H as xe,a as ke,S as be,i as _e}from"./ConnectWalletView-D9FJQoQd.mjs";import{PlusIcon as Me}from"@heroicons/react/24/outline";import{S as ze}from"./Subtitle-CV-2yKE4.mjs";import{T as Le}from"./Title-BnzYV3Is.mjs";import He from"@heroicons/react/24/outline/ChevronDownIcon";import{C as Ae}from"./Column-C2X2MHYX.mjs";import{R as Fe,a as je}from"./Row-C9vrS4Zi.mjs";import{A as Ve}from"./Address-ClnXOtX_.mjs";import{N as Ze}from"./NetworkIcon-B48ilzF8.mjs";import{g as Be}from"./getErc20TokenInfo-1Q6w1Ibq.mjs";import{f as Ie}from"./formatErc20TokenAmount-BuPk9xcy.mjs";import{g as Se}from"./getErc20Balance-DA4dGV9O.mjs";import Te from"@heroicons/react/24/outline/CurrencyDollarIcon";import"zustand";import"react-device-detect";import"./events-context-CI0iqAXA.mjs";import"viem";import"viem/utils";import"./getPublicClient-B4uPLKn-.mjs";import"@privy-io/are-addresses-equal";import"lucide-react";import"@privy-io/js-sdk-core";import"tinycolor2";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"./ErrorMessage-D8VaAP5m.mjs";import"./LabelXs-oqZNqbm_.mjs";import"./shared-FM0rljBt.mjs";import"ofetch";import"eventemitter3";import"@tanstack/react-virtual";import"./Link-DJ5gq9Di.mjs";import"./QrCode-CKNL79V_.mjs";import"qrcode";import"./EmailInputForm-Dgoii4vf.mjs";import"./useI18n-BK0a87xw.mjs";import"./Screen-omroCwTV.mjs";import"./index-Dq_xe9dz.mjs";import"@heroicons/react/24/outline/GlobeAltIcon";const Ue=b.button`
1
+ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import{D as i,F as n,B as a,z as l,u as o,y as s,A as d,G as c,I as h,f as p,J as m,n as u,C as w,v as C,K as f,N as g,O as v}from"./useActiveWallet-3RHPIBxJ.mjs";import{i as y,u as x}from"./get-is-unified-wallet-Boa8DYrQ.mjs";import{u as k}from"./useWallets-CR0z5IIt.mjs";import{styled as b,css as _}from"styled-components";import{C as M}from"./CopyableText-BCytXyJL.mjs";import{u as z}from"./context-WTldtXS8.mjs";import{W as L}from"./WalletCards-DH1rqayz.mjs";import{T as H,L as A}from"./twitch-5IOe4sIQ.mjs";import{B as F}from"./ModalHeader-D8-mhjp4.mjs";import*as j from"react";import{useState as V,createContext as Z,useContext as B,useRef as I,useMemo as S,useEffect as T}from"react";import{useMergeRefs as U,useTransitionStyles as W,FloatingPortal as R,FloatingFocusManager as P,useFloating as O,offset as D,flip as N,shift as G,autoUpdate as $,useInteractions as E,useClick as X,useDismiss as q,useRole as Q}from"@floating-ui/react";import Y from"@heroicons/react/24/outline/UserIcon";import{W as J}from"./WalletInfoCard-DFt8ndGE.mjs";import{u as K}from"./internal-context-Z-fyxadS.mjs";import{u as ee}from"./useWalletBalance-CDyi5_iR.mjs";import{g as te}from"./ethers-D1WT71Ay.mjs";import re from"@heroicons/react/24/outline/EllipsisHorizontalIcon";import ie from"@heroicons/react/24/outline/PlusCircleIcon";import{u as ne,e as ae}from"./use-export-wallet-CV4p7L0b.mjs";import{u as le,a as oe}from"./use-export-wallet-DQde4t0V.mjs";import{Menu as se,MenuButton as de,MenuItems as ce,MenuItem as he,Disclosure as pe,DisclosureButton as me,DisclosurePanel as ue,DialogTitle as we,Dialog as Ce,DialogBackdrop as fe,DialogPanel as ge}from"@headlessui/react";import{C as ve,W as ye,H as xe,a as ke,S as be,i as _e}from"./ConnectWalletView-CDqboUej.mjs";import{PlusIcon as Me}from"@heroicons/react/24/outline";import{S as ze}from"./Subtitle-CV-2yKE4.mjs";import{T as Le}from"./Title-BnzYV3Is.mjs";import He from"@heroicons/react/24/outline/ChevronDownIcon";import{C as Ae}from"./Column-C2X2MHYX.mjs";import{R as Fe,a as je}from"./Row-C9vrS4Zi.mjs";import{A as Ve}from"./Address-BjZb-TIL.mjs";import{N as Ze}from"./NetworkIcon-B48ilzF8.mjs";import{g as Be}from"./getErc20TokenInfo-1Q6w1Ibq.mjs";import{f as Ie}from"./formatErc20TokenAmount-BuPk9xcy.mjs";import{g as Se}from"./getErc20Balance-DA4dGV9O.mjs";import Te from"@heroicons/react/24/outline/CurrencyDollarIcon";import"zustand";import"react-device-detect";import"./events-context-CI0iqAXA.mjs";import"viem";import"viem/utils";import"./getPublicClient-B4uPLKn-.mjs";import"@privy-io/are-addresses-equal";import"lucide-react";import"@privy-io/js-sdk-core";import"tinycolor2";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"./ErrorMessage-D8VaAP5m.mjs";import"./LabelXs-oqZNqbm_.mjs";import"./shared-FM0rljBt.mjs";import"ofetch";import"eventemitter3";import"@tanstack/react-virtual";import"./Link-DJ5gq9Di.mjs";import"./QrCode-C1tgJtOy.mjs";import"qrcode";import"./EmailInputForm-Dgoii4vf.mjs";import"./useI18n-BuIe8nUA.mjs";import"./Screen-Bp-TN9gb.mjs";import"./index-Dq_xe9dz.mjs";import"@heroicons/react/24/outline/GlobeAltIcon";const Ue=b.button`
2
2
  --size: ${({$size:e})=>`${e}px`};
3
3
 
4
4
  -webkit-font-smoothing: antialiased;
@@ -0,0 +1 @@
1
+ import{ProviderErrors as e,ConnectedStandardSolanaWallet as t,monadMainnet as n,hyperEVMMainnet as a,arbitrumSepolia as i,arbitrum as s,avalancheFuji as r,avalanche as o,baseSepolia as d,base as l,polygonAmoy as c,polygon as h,optimismSepolia as u,optimism as f,sepolia as p,mainnet as m}from"@privy-io/js-sdk-core";import{P as C,c as A,j as w,a as g,u as y}from"./internal-context-Z-fyxadS.mjs";import b from"eventemitter3";import{b as E,u as x}from"./context-WTldtXS8.mjs";import{jsxs as D,jsx as v}from"react/jsx-runtime";import{useMemo as I}from"react";import{isAddress as M}from"viem/utils";import{u as T,a as S,h as W,c as O,b as R}from"./get-is-unified-wallet-Boa8DYrQ.mjs";import{g as N}from"./useWallets-CR0z5IIt.mjs";class j extends C{constructor(){super("Wallet timeout"),this.type="wallet_error"}}const F=e=>e instanceof C?e:e?.code?new B(e):new C("Unknown connector error",e);class U extends A{constructor(e,t,n){super(e),this.type="provider_error",this.code=t,this.data=n}}class B extends U{constructor(t){super(t.message,t.code,t.data);let n=Object.values(e).find((e=>e.eipCode===t.code));this.details=n||e.UNKNOWN_ERROR,-32002===t.code&&(t.message?.includes("already pending for origin")?t.message?.includes("wallet_requestPermissions")?this.details=e.E32002_CONNECTION_ALREADY_PENDING:this.details=e.E32002_REQUEST_ALREADY_PENDING:t.message?.includes("Already processing")&&t.message.includes("eth_requestAccounts")&&(this.details=e.E32002_WALLET_LOCKED))}}const L={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_LIMIT_REACHED:{message:"Unable to link",detail:"You've reached the maximum number of linked wallets.",retryable:!1},...e};class P{get(e){let t=localStorage.getItem(e);return null===t?void 0:JSON.parse(t)}put(e,t){void 0!==t?localStorage.setItem(e,JSON.stringify(t)):this.del(e)}del(e){localStorage.removeItem(e)}getKeys(){return Object.entries(localStorage).map((([e])=>e))}}function _(){try{let e="privy:__session_storage__test",t=new P;return t.put(e,"blobby"),t.del(e),!0}catch(e){return!1}}var Y="undefined"!=typeof window&&window.localStorage?new P:new class{get(e){return this._cache[e]}put(e,t){void 0!==t?this._cache[e]=t:this.del(e)}del(e){delete this._cache[e]}getKeys(){return Object.keys(this._cache)}constructor(){this._cache={}}};class J extends b{constructor(e){super(),this.walletClientType=e,this.connected=!1,this.initialized=!1}}const k=()=>{let e=Y.get(E);return e&&Array.isArray(e)&&e.map((e=>(e=>e&&"string"==typeof e.address&&"string"==typeof e.connectorType&&"string"==typeof e.walletClientType&&"number"==typeof e.connectedAt)(e))).every(Boolean)?e:[]};let z=["phantom","glow","solflare","backpack","okx_wallet","walletconnect","mobile_wallet_adapter","jupiter"];function G(e){return e.toLowerCase().split(" ").join("_")}class Z extends J{get isInstalled(){return!0}get wallet(){return this._wallet}buildConnectedWallet(){return this._wallet.accounts.map((e=>({type:"solana",provider:new t({wallet:this._wallet,account:e}),address:e.address,connectedAt:Date.now(),walletClientType:this._wallet.name,connectorType:this.connectorType,imported:!1,meta:{name:this._wallet.name,id:this._wallet.name,icon:this._wallet.icon},isConnected:async()=>this._wallet.accounts.length>0,disconnect:async()=>{await this.disconnect()}})))}async syncAccounts(){this.wallets=this.buildConnectedWallet(),this.emit("walletsUpdated")}get walletBranding(){return{id:X(this.wallet)?"walletconnect_solana":this.wallet.name,name:this.wallet.name,icon:this.wallet.icon}}async initialize(){this.subscribeListeners(),await this.syncAccounts(),this.shouldAttemptAutoConnect()&&(await(this.wallet.features["standard:connect"]?.connect({silent:!0}).catch((()=>{}))),await this.isConnected()&&await this.syncAccounts()),this.initialized=!0,this.emit("initialized")}async connect(e){if(e.showPrompt)try{await this.promptConnection()}catch(e){if(0===this._wallet.accounts.length)throw new w;throw e}if(!await this.isConnected())throw new w;return await this.syncAccounts(),this.getConnectedWallet()}async getConnectedWallet(){return this.wallets.sort(((e,t)=>t.connectedAt-e.connectedAt))[0]||null}async isConnected(){return this._wallet.accounts.length>0}subscribeListeners(){this._unsubscribeListeners=this.wallet.features["standard:events"]?.on("change",this.onChange)}unsubscribeListeners(){this._unsubscribeListeners?.()}shouldAttemptAutoConnect(){return!(!this.autoConnectEnabled||!z.includes(this.walletClientType))&&("phantom"!==this.walletClientType&&"metamask"!==this.walletClientType.toLowerCase()||k().some((({walletClientType:e})=>"phantom"===e||"metamask"===e.toLowerCase())))}constructor(e,t){super(G(X(e)?"walletconnect_solana":e.name)),this.chainType="solana",this.connectorType="solana_adapter",this.disconnect=async()=>{await(this.wallet.features["standard:disconnect"]?.disconnect().catch((e=>console.error("Error disconnecting",e)))),await this.syncAccounts()},this.promptConnection=async()=>{try{await(this.wallet.features["standard:connect"]?.connect())}catch(e){throw F(e)}},this.onChange=()=>{this.syncAccounts()},this._wallet=e,this.autoConnectEnabled=t,this.wallets=[]}}function X(e){return"isWalletConnectSolana"in e&&e.isWalletConnectSolana}const H=({style:e,...t})=>{let n=x();/*#__PURE__*/return D("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[/*#__PURE__*/v("rect",{width:"28",height:"28",rx:"3",fill:"dark"===n?.appearance.palette.colorScheme?"#3396ff":"#141414"}),/*#__PURE__*/v("g",{clipPath:"url(#clip0_1765_9946)",children:/*#__PURE__*/v("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),/*#__PURE__*/v("defs",{children:/*#__PURE__*/v("clipPath",{id:"clip0_1765_9946",children:/*#__PURE__*/v("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})},q="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAHdElNRQfoDAIVODUC+w+GAAAGsUlEQVRYw6WXbYwWVxXHf+fOLAtCXYS2QJdIaClipGCTknXXNqBQMVHbfmhItH4Aral+IAEaG03UxJgYKQJGTUxtDWjaxDSNtcZqIGDwpRuW1oYiVqpdpZSlpC3qysu+PHPP3w/3mXnmeXZbPzjJZO7cefn/z/mfe865xlscq3dGDIguGiHLaMQVLja4s87FShcLo5jtApdddnHexUmHIy475JmdUkPRAQMu7gzT4ljnxJpdk0QPmMFkyAKN2OfOFpc2uuh1J3MZDrjAvXmVEQUuoosRxw642FcEG7IoDxiFxNiu8NYE+vcUYIFYRKKs113bXWx2Z34CoQZsVHOiCZ7mopdzdsFhv8NexEgRDHMxUSNREbh1bwNZwBsFblmfu/a4a6AEENYO5i3AOoEWeEUCF4MOOxBDMQAOk99OJALA2u80sBCwWGBZWG/yRwMaCAbBIAsQTJT3gea1OWfNeaPzvjoHEI85rA8ObtB1v7cIdJkIHgkh9AXpocy0LJjIKvB2wPpZB0v3wkrw5jdNEjeYeMhFX3BAyfn2ke9NUrgB9LrrcZcGJFCld4fWNddXbvbWfWzGR6xJFZsBGh0cBh3bBIxIEGTQ3W0h4NuDaSAzyAxCmGq11Vzf5uaa1aG8p+WFtrEYQGwvjICJkAEqvC+YNmcmMlMNvEaCdrcbyUvQAWDTjVuESHObM6cPGWHmzDwLaEtmzG9Z3qF1zUpXmuuZBb1z4bqeNC6f0WE1NtUTwHzEloiy3BvFisy0sYoLlQtT6XW15md2Qf9SY+2Ngfdca/TMSm/9ewz+/Boc/It45h/i4kSTsKw90SQJsPTvjSZbkWemDW7qTRZ0JEYJWSKxZJ7xmf6M224MzMzbX1s8F1YugjtvMg6eErt/4/z1jUrz1rXUKxnZC2zIg2mdBTK1mFUOKC1fOt/48kdzVixIz86Nij+eEacvpJWyZJ5xy7th8VzjjpuMJfMCW58QL73ekXPVlhsyE+vyzFiplJyauEIyrGIquruMq7qTxk+dcB495rzyTzFepCUWLIFv/kBg081Gd55WUk1IDGFTS89K++TDYxddzKnWcbluHd450xgdh7EGrOo1rr868PMTzqWJRGZ2d8oB/xpL33Xnxl2rjeNn4blXRXduzJ4B5y+28kWscAwXl+yeR654FFZPHoUb710YuPeDOUdPO48di1xptKpeEeHqOcYXNwQKGd88EDk3mqxtxPSfGRlsXRtYt8z4ytPOH/7eqpg1Aso7fYKgK4NPrMpYvsC4/poMA34yVJIQC3sCD9yecdsNyaV5yPj6ryJnR1PAvSNP4J+/1cgDfLbfePaMGGtM7Qdyl12WmKOmXgKKAp54vmBRTxfLrjE+tSYjBPjRM5FrrzIeuD2jf2lLzw8vN4JlfPVp581LsO1DgXv7jSzAiXPw/d+JiYLpjsu26Yfjf5O0rF5WoxsNT9G/bX0XKxakmPjlSee6HlizJJXSX7/oRDc+vjKR+f2wODcKd78/gR8/C9uedF44myJxmhh4OY/ipMQyqaWxmjn95TfEroMFOzbkvG+RceeqViPx1Aln1yEnOow1AnffHCpJAJ5/Vex4UvzptZRdY/O/1dJIS/NkcNmR6MTYah6qzseA4TfFtw4UvHBW1bc/O+7sPhwZHYf/jMODh5yfPudVbXj2TAJ/8XxrOZagNamj4Ei2/GNfuyRxh8t6BG2l15up+MIVODEiFr8rcPS0+O6RBF6mrrEGHHtFzOo2Lo7Dl37hvPQ6mNV6R9JYKgnYWcE37K5HlE2OT/5A0udaPUBHH+BQOMzuNsYLuDyZflTW+fTcmJFDHhJhaZqewMuewXDxcDR9IYyPN6Jj+6K4MF2vV8qBtZJScqVRNi6lpGONVJis5mpKi1WbgwsY+zIsBpcR8mzIZfuTRVZrtdu9odrptR/Xx5XONXJqBmCN0P6YMUQq9WJiwt0Je102WHdbpxSqydMObBWYdwDWLVcqcIMYe3NPjg0Ht84od0Ajju1w2XCr9e6QoqM9V23ZtnmI6cfAMMb9AY0YEHdb6oobEh4y3H3Ize6LsmGvN5IdUnhttdQ9UVrfLk/ljWEZ9wXsqAdQk1EA+O22GcgdZTke/bAs3OPY4HSdcB20HhvVtTMu0jmI8ekAhz2IICj2hKpNqI60NcuIRUHEej1quzubXa2tmZhenrfZmv3YYQ9ipDAIgvHptmblccuDjdRcmjFpWbDi/9ycZjZkRbk5jYztai/AUwiUx+qdEQB/m+25i9lxyvbcjrg45Lmd0uT/3p7/Fw6ODf+WO019AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDI0LTEyLTAyVDIxOjU2OjQ4KzAwOjAwMVpslgAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyNC0xMi0wMlQyMTo1Njo0OCswMDowMEAH1CoAAAAodEVYdGRhdGU6dGltZXN0YW1wADIwMjQtMTItMDJUMjE6NTY6NTMrMDA6MDDZv6GRAAAAAElFTkSuQmCC";function Q(e){return["ethereum","solana"].includes(e.chainType)}function V(e){let t=e.replace("eip155:","");if(t)return parseInt(t);throw Error("Chain ID not compatible with CAIP-2 format.")}const K=e=>e.filter((e=>"wallets"===e.method||("exchange"===e.method?"coinbase"===e.provider:"card"===e.method||"payment-request"===e.method?"coinbase"===e.provider||"moonpay"===e.provider:(e.method,!1)))),$={[m.id]:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",[p.id]:"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",[f.id]:"0x0b2c639c533813f4aa9d7837caf62653d097ff85",[u.id]:"0x5fd84259d66Cd46123540766Be93DFE6D43130D7",[h.id]:"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",[c.id]:"0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582",[l.id]:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",[d.id]:"0x036CbD53842c5426634e7929541eC2318f3dCF7e",[o.id]:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",[r.id]:"0x5425890298aed601595a70ab815c96711a31bc65",[s.id]:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",[i.id]:"0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",[a.id]:"0xb88339CB7199b77E23DB6E890353E22632Ba630f",[n.id]:"0x754704Bc059F8C67012fEd69BC8A327a5aafb603"},ee=({address:e,appConfig:t,fundWalletConfig:n,methodScreen:a,chainIdOverride:i,comingFromSendTransactionScreen:s=!1,onComplete:r,onError:o})=>{let d,l;if(!t.fundingConfig)throw Error("Wallet funding is not enabled");let c=K(t.fundingConfig.options);if(c.length<1)throw Error("Wallet funding is not enabled");d=i||(n?.chain?n.chain.id:V(t.fundingConfig.defaultRecommendedCurrency.chain));let h=t.chains.find((e=>e.id===d));if(!h)throw new g(`Funding chain ${d} is not in PrivyProvider chains list`);let u=n?.amount??t.fundingConfig.defaultRecommendedAmount,f=!1;function p(){if(!d)return;let e=$[d];c.find((e=>"wallets"===e.method))&&!e&&console.warn("Attempting to fund with USDC on chain where USDC address is not known. Funding via external wallet will be disabled."),l=e,f=!0}n&&"asset"in n?"USDC"===n.asset?p():"string"!=typeof n.asset&&"erc20"in n.asset&&(f=((e,t)=>e===$[t.id])(l=n.asset.erc20,h)):"USDC"===t.fundingConfig.defaultRecommendedCurrency.asset&&p();let m=n?.defaultFundingMethod;return{chainType:"ethereum",address:e,amount:u,chain:h,erc20Address:l,erc20ContractInfo:f?{symbol:"USDC",decimals:6}:void 0,isUSDC:f,methodScreen:a,supportedOptions:c,comingFromSendTransactionScreen:s,defaultFundingMethod:m,usingDefaultFundingMethod:!!m,preferredCardProvider:n?.card?.preferredProvider,crossChainBridgingEnabled:t.fundingConfig.crossChainBridgingEnabled??!1,solanaChain:"solana:mainnet",uiConfig:n&&"uiConfig"in n?n.uiConfig:void 0,externalSolanaFundingScreen:null,onComplete:r??(()=>{}),onError:o??(()=>{})}};function te({address:e,fundWalletConfig:t,appConfig:n,comingFromSendTransactionScreen:a,externalSolanaFundingScreen:i,methodScreen:s}){if(!n.fundingConfig)throw Error("Wallet funding is not enabled");let r=K(n.fundingConfig.options);if(r.length<1)throw Error("Wallet funding is not enabled");if("USDC"===t?.asset&&"solana:testnet"===t?.chain)throw Error("USDC funding is not supported on the Solana testnet");let o=t?.amount??n.fundingConfig.defaultRecommendedAmount,d=t?.defaultFundingMethod;return{chainType:"solana",address:e,supportedOptions:r,amount:o,isUSDC:"USDC"===t?.asset,methodScreen:s,comingFromSendTransactionScreen:a,chain:t?.chain||"solana:mainnet",crossChainBridgingEnabled:n.fundingConfig.crossChainBridgingEnabled??!1,defaultFundingMethod:d,preferredCardProvider:t?.card?.preferredProvider,usingDefaultFundingMethod:!!d,uiConfig:t?.uiConfig,externalSolanaFundingScreen:i,onComplete:()=>{},onError:()=>{}}}function ne(){let{user:e,getAccessToken:t}=T(),{walletProxy:n,openModal:a,client:i}=y(),{setModalData:s}=S(),r=x();return I((()=>({exportWallet:o=>new Promise((async(d,l)=>{if(!e)return void l(Error("User must be authenticated before exporting their Privy wallet"));o&&"target"in o&&o&&(o=void 0);let c=o?.address?W(e,o.address):O(e);if(!c)return void l(new g("User must have an embedded wallet."));let h=c.address,{entropyId:u,entropyIdVerifier:f}=N(e,c),p=R(c);if(!h)return void l(Error("User does not have an HD Ethereum wallet. To export an imported wallet, pass the `address` of the wallet to `exportWallet`."));if(!M(h))return void l(Error("Must provide a valid Ethereum address."));let m={recoveryMethod:c.recoveryMethod,connectingWalletAddress:c.address,isUnifiedWallet:p,entropyId:u,entropyIdVerifier:f,onCompleteNavigateTo:"EmbeddedWalletKeyExportScreen",onFailure:l,shouldForceMFA:!0};await t()&&n?Q(c)?(s({keyExport:{appId:r.id,appClientId:r.appClientId,origin:i.apiUrl,address:c.address,entropyId:u,entropyIdVerifier:f,hdWalletIndex:c.walletIndex,chainType:c.chainType,walletId:c.id,isUnifiedWallet:p,imported:c.imported,onSuccess:d,onFailure:l,showBackButton:o?.showBackButton},connectWallet:m}),a("EmbeddedWalletConnectingScreen")):l(Error(`Export is not supported for ${c.chainType} wallets`)):l(Error("Must have valid access token."))}))})),[e,t,n,a,i,s,r])}export{L as C,B as P,Z as S,q as W,K as a,_ as b,J as c,j as d,V as e,F as f,te as g,H as h,Q as i,U as j,k as l,ee as p,Y as s,G as t,ne as u};
@@ -1 +1 @@
1
- import{u as e}from"./context-CCRnMB8L.mjs";import{u as t}from"./events-context-CI0iqAXA.mjs";import{u as n,a}from"./internal-context-Z-fyxadS.mjs";import{a as o,u as r,h as d,d as i,b as s}from"./get-is-unified-wallet-j2fzd2YE.mjs";import{g as l,i as c}from"./use-export-wallet-Voe8hSb9.mjs";import{useMemo as u}from"react";import{g as p}from"./useWallets-BKPOCKnv.mjs";function m(a){t("fundSolanaWallet",a);let r=e(),{openModal:d}=n(),{setModalData:i}=o();return{fundWallet:async({address:e,options:t})=>{let n=t?.amount||r.fundingConfig?.defaultRecommendedAmount||"1",a=t?.asset||r.fundingConfig?.defaultRecommendedCurrency.asset||"native-currency",o=t?.chain||"solana:mainnet";i({funding:l({address:e,appConfig:r,methodScreen:"FundingMethodSelectionScreen",fundWalletConfig:{...t,amount:n,asset:a,chain:o},externalSolanaFundingScreen:"FundSolWalletWithExternalSolanaWallet"}),solanaFundingData:{amount:n,asset:"native-currency"===a?"SOL":"USDC",chain:o,destinationAddress:e,sourceWalletData:void 0}}),d("FundingMethodSelectionScreen")}}}function f(){let{user:t,getAccessToken:l}=r(),{walletProxy:m,openModal:f,client:h}=n(),{setModalData:y}=o(),g=e();return u((()=>({exportWallet:e=>new Promise((async(n,o)=>{if(!t)return void o(new a("User must be authenticated before exporting their Privy wallet"));let r=e?.address?d(t,e.address):i(t);if(!r)return void o(new a("User must have an embedded wallet."));if(!c(r))return void o(Error(`Export is not supported for ${r.chainType} wallets`));let u=s(r),{entropyId:W,entropyIdVerifier:w}=p(t,r);await l()?m?(y({connectWallet:{recoveryMethod:r.recoveryMethod,connectingWalletAddress:r.address,isUnifiedWallet:u,entropyId:W,entropyIdVerifier:w,onCompleteNavigateTo:"EmbeddedWalletKeyExportScreen",onFailure:o,shouldForceMFA:!0},keyExport:{appId:g.id,appClientId:g.appClientId,origin:h.apiUrl,address:r.address,entropyId:W,entropyIdVerifier:w,hdWalletIndex:r.walletIndex,chainType:r.chainType,walletId:r.id,isUnifiedWallet:u,imported:r.imported,onSuccess:n,onFailure:o,showBackButton:e?.showBackButton}}),f("EmbeddedWalletConnectingScreen")):o(new a("Wallet not ready for export")):o(new a("Must have valid access token."))}))})),[t,l,m,f,h,y,g])}export{f as a,m as u};
1
+ import{u as e}from"./context-WTldtXS8.mjs";import{u as t}from"./events-context-CI0iqAXA.mjs";import{u as n,a}from"./internal-context-Z-fyxadS.mjs";import{a as o,u as r,h as d,d as i,b as s}from"./get-is-unified-wallet-Boa8DYrQ.mjs";import{g as l,i as c}from"./use-export-wallet-CV4p7L0b.mjs";import{useMemo as u}from"react";import{g as p}from"./useWallets-CR0z5IIt.mjs";function m(a){t("fundSolanaWallet",a);let r=e(),{openModal:d}=n(),{setModalData:i}=o();return{fundWallet:async({address:e,options:t})=>{let n=t?.amount||r.fundingConfig?.defaultRecommendedAmount||"1",a=t?.asset||r.fundingConfig?.defaultRecommendedCurrency.asset||"native-currency",o=t?.chain||"solana:mainnet";i({funding:l({address:e,appConfig:r,methodScreen:"FundingMethodSelectionScreen",fundWalletConfig:{...t,amount:n,asset:a,chain:o},externalSolanaFundingScreen:"FundSolWalletWithExternalSolanaWallet"}),solanaFundingData:{amount:n,asset:"native-currency"===a?"SOL":"USDC",chain:o,destinationAddress:e,sourceWalletData:void 0}}),d("FundingMethodSelectionScreen")}}}function f(){let{user:t,getAccessToken:l}=r(),{walletProxy:m,openModal:f,client:h}=n(),{setModalData:y}=o(),g=e();return u((()=>({exportWallet:e=>new Promise((async(n,o)=>{if(!t)return void o(new a("User must be authenticated before exporting their Privy wallet"));let r=e?.address?d(t,e.address):i(t);if(!r)return void o(new a("User must have an embedded wallet."));if(!c(r))return void o(Error(`Export is not supported for ${r.chainType} wallets`));let u=s(r),{entropyId:W,entropyIdVerifier:w}=p(t,r);await l()?m?(y({connectWallet:{recoveryMethod:r.recoveryMethod,connectingWalletAddress:r.address,isUnifiedWallet:u,entropyId:W,entropyIdVerifier:w,onCompleteNavigateTo:"EmbeddedWalletKeyExportScreen",onFailure:o,shouldForceMFA:!0},keyExport:{appId:g.id,appClientId:g.appClientId,origin:h.apiUrl,address:r.address,entropyId:W,entropyIdVerifier:w,hdWalletIndex:r.walletIndex,chainType:r.chainType,walletId:r.id,isUnifiedWallet:u,imported:r.imported,onSuccess:n,onFailure:o,showBackButton:e?.showBackButton}}),f("EmbeddedWalletConnectingScreen")):o(new a("Wallet not ready for export")):o(new a("Must have valid access token."))}))})),[t,l,m,f,h,y,g])}export{f as a,m as u};
@@ -1,4 +1,4 @@
1
- import{useEffect as e,useState as t,createContext as n,useContext as i,useMemo as a,useCallback as r}from"react";import{create as l}from"zustand";import{u as o,n as s,o as c,p as d}from"./context-CCRnMB8L.mjs";import{styled as h,css as p}from"styled-components";import{jsx as u,jsxs as m}from"react/jsx-runtime";import*as w from"react-device-detect";import{c as f,s as y,f as g,d as b,S as v}from"./use-export-wallet-Voe8hSb9.mjs";import{u as x}from"./events-context-CI0iqAXA.mjs";import{isAddress as k}from"viem";import{getAddress as C,toHex as _}from"viem/utils";import{P as T,u as P}from"./internal-context-Z-fyxadS.mjs";import{a as W}from"./getPublicClient-B4uPLKn-.mjs";import{P as z}from"./get-is-unified-wallet-j2fzd2YE.mjs";import{u as $}from"./useWallets-BKPOCKnv.mjs";const S=l((()=>({listings:[],loading:!1}))),I=S.setState,j=e=>S.getState().listings.find((({slug:t})=>N(t)===N(e))),E=e=>{let t;try{t=new URL(e).hostname}catch(e){return}return S.getState().listings.find((({homepage:e})=>{let n;try{n=new URL(e).hostname}catch(e){return!1}return t.includes(n)}))},D=(t=!0)=>{let n=o(),i=S((e=>e.listings)),a=S((e=>e.loading)),r=!!i.length;return e((()=>{t&&!r&&(I({listings:[],loading:!0}),(async e=>{let t=new URL("v3/wallets","https://explorer-api.walletconnect.com");t.searchParams.append("projectId",e);let n=await fetch(t);return n.ok?Object.values((await n.json()).listings).sort((({slug:e},{slug:t})=>"rainbow"===e&&"metamask"===t?1:"metamask"===e||"rainbow"===e?-1:1)):(console.debug(`Failed to fetch WalletConnect listings: ${await n.text().catch((()=>"No response."))}`),[])})(n.walletConnectCloudProjectId).then((e=>I({listings:e,loading:!1}))).catch((e=>{console.error(e),I({listings:[],loading:!1})})))}),[t,r,n.walletConnectCloudProjectId]),{listings:i,loading:a}},O=e=>{let{listings:t}=D();return t.find((({slug:t})=>N(t)===N(e)))};function N(e){return"cryptocom"===e?"cryptocom-defi":"binance"===e?"binance-defi":e.replace(/[-_]wallet$/,"")}function A(e){return["wallet_connect","backpack","binance","binanceus","bitget_wallet","bybit_wallet","cryptocom","haha_wallet","jupiter","metamask","okx_wallet","phantom","rabby_wallet","rainbow","ronin_wallet","safe","solflare","uniswap","zerion","kraken_wallet"].some((t=>e?.includes(t)))}const M=e=>e.isApexWallet?"Apex Wallet":e.isAvalanche?"Core Wallet":e.isBackpack?"Backpack":e.isBifrost?"Bifrost Wallet":e.isBitKeep?"BitKeep":e.isBitski?"Bitski":e.isBlockWallet?"BlockWallet":e.isBraveWallet?"Brave Wallet":e.isClover?"Clover":e.isCoin98?"Coin98 Wallet":e.isCoinbaseWallet?"Coinbase Wallet":e.isDawn?"Dawn Wallet":e.isDefiant?"Defiant":e.isDesig?"Desig Wallet":e.isEnkrypt?"Enkrypt":e.isExodus?"Exodus":e.isFordefi?"Fordefi":e.isFrame?"Frame":e.isFrontier?"Frontier Wallet":e.isGamestop?"GameStop Wallet":e.isHaqqWallet?"HAQQ Wallet":e.isHyperPay?"HyperPay Wallet":e.isImToken?"ImToken":e.isHaloWallet?"Halo Wallet":e.isKuCoinWallet?"KuCoin Wallet":e.isMathWallet?"MathWallet":e.isNovaWallet?"Nova Wallet":e.isOkxWallet||e.isOKExWallet?"OKX Wallet":e.isOneInchIOSWallet||e.isOneInchAndroidWallet?"1inch Wallet":e.isOneKey?"OneKey Wallet":e.isOpera?"Opera":e.isPhantom||"isPhantom"in e?"Phantom":e.isPortal?"Ripio Portal":e.isRabby?"Rabby Wallet":e.isRainbow?"Rainbow":e.isSafePal?"SafePal Wallet":e.isStatus?"Status":e.isSubWallet?"SubWallet":e.isTalisman?"Talisman":e.isTally||e.isTaho?"Taho":e.isTokenPocket?"TokenPocket":e.isTokenary?"Tokenary":e.isTrust||e.isTrustWallet?"Trust Wallet":e.isTTWallet?"TTWallet":e.isXDEFI?"XDEFI Wallet":e.isZeal?"Zeal":e.isZerion?"Zerion":e.isMetaMask?"MetaMask":void 0,L=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||"MetaMask"!==M(e))return!1;if(e.providers)for(let t of e.providers)if(!L(t))return!1;return!0},F=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers)for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0;return!1},B=(e,t)=>{let n=[],i=[];for(let[a,r]of e.entries())a<t?n.push(r):i.push(r);return[n,i]},U=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),R=(e,t)=>{let n=e.slice(0),i=[];for(;n.length;)i.push(n.splice(0,t));return i},q=(e,t=3,n=4,i="ethereum")=>{if(!e)return"";let a="ethereum"===i?2:0;return t+n+a+3>=e.length?e:`${e.slice(0,a+t)}...${e.slice(e.length-n,e.length)}`},K=(e,t=3,n=4)=>q(e,t,n,"solana"),H=e=>new Promise((t=>setTimeout(t,e)));function Z(e,{interval:t=100,timeout:n=5e3}={}){return new Promise(((i,a)=>{let r,l=0,o=()=>{l>=n?a("Max attempts reached without result"):(r=e(),l+=t,null==r?setTimeout(o,t):i(r))};o()}))}const X=(e,t={})=>{let n=t.delayMs||150,i=t.maxAttempts||270;return new Promise((async(a,r)=>{let l=!1,o=0;for(;!l&&o<i;){if(t.abortSignal?.aborted)return;e().then((e=>{l=!0,a(e)}),((...e)=>{l=!0,r(...e)})),o+=1,await H(n)}l||r(Error("Exceeded max attempts before resolving function"))}))},G=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),J=e=>"string"==typeof e?e:"0x"+e.toString(16);async function Q({store:e,walletList:t,externalWalletConfig:n,walletChainType:i,timeout:a=3e3}){let r=!1,l=window;return new Promise((o=>{function s(){if(r)return;r=!0,window.removeEventListener("ethereum#initialized",s);let a=e.getProviders();console.debug("Detected injected providers:",a.map((e=>e.info)));let l=[];for(let e of a)t.includes("coinbase_wallet")&&"com.coinbase.wallet"===e.info.rdns||"solana-only"===i&&"app.phantom"===e.info.rdns||l.push({type:e.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:e});if("solana-only"!==i)for(let e of function(){let e=window,t=e.ethereum;if(!t)return[];let n=[];if(t.providers?.length)for(let e of t.providers)e&&n.push(e);return n.push(e.ethereum),n}()){let t=M(e);if(!a.some((e=>e.info.name===t))){if(L(e,!0)&&!l.find((e=>"metamask"===e.type))){l.push({type:"metamask",legacyInjectedProvider:e});continue}if("Phantom"===t&&!l.find((e=>"phantom"===e.type))){l.push({type:"phantom",legacyInjectedProvider:e});continue}if("Coinbase Wallet"===t&&!l.find((e=>"coinbase_wallet"===e.type&&"smartWalletOnly"!==n.coinbaseWallet?.config?.preference?.options))){l.push({type:"coinbase_wallet",legacyInjectedProvider:e});continue}l.find((e=>"unknown_browser_extension"===e.type))||l.push({type:"unknown_browser_extension",legacyInjectedProvider:e})}}o(l)}l.ethereum?s():(window.addEventListener("ethereum#initialized",s,{once:!0}),setTimeout((()=>{s()}),a))}))}function V(e){return`eip155:${String(Number(e))}`}const Y=(e,t,n,i)=>{let a=Number(e),r=t.find((e=>e.id===a));if(!r)throw new T(`Unsupported chainId ${e}`,4901);return W(r,n,i)},ee=(e,t)=>{let n=Number(e),i=t.find((e=>e.id===n));if(!i)throw new T(`Unsupported chainId ${e}`,4901);return i.blockExplorers?.default.url},te=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},n=e.types.EIP712Domain??Object.entries(e.domain).map((([e,n])=>{if(null!=n&&"string"==typeof e&&e in t)return{name:e,type:t[e]}})).filter((e=>void 0!==e));return{...e,types:{...e.types,EIP712Domain:n}}};function ne(e,{min:t,max:n}){return Math.min(Math.max(e,t),n)}const ie=e=>e?.map((e=>({signer_id:e.signerId,override_policy_ids:e.policyIds})));function ae(e){return"ethereum"===e.type}function re(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],a=t[n];if(i?.address!==a?.address||i&&a&&ae(i)&&ae(a)&&i?.chainId!==a?.chainId||i?.connectorType!==a?.connectorType||i?.connectedAt!==a?.connectedAt||i?.walletClientType!==a?.walletClientType||i?.isConnected!==a?.isConnected||i?.linked!==a?.linked)return!1}return!0}const le=(e,t)=>e.rpcTimeouts&&e.rpcTimeouts[t]||s;function oe(e){return"ethereum"===e.chainType}class se extends f{buildConnectedWallet(e,t,n,i){let a=async()=>!!this.wallets.find((t=>C(t.address)===C(e)));return{type:"ethereum",address:C(e),chainId:t,meta:n,imported:i,switchChain:async n=>{let i,r;if(!a)throw new T("Wallet is not currently connected.");let l=this.wallets.find((t=>C(t.address)===C(e)))?.chainId;if(!l)throw new T("Unable to determine current chainId.");if("number"==typeof n?(i=`0x${n.toString(16)}`,r=n):(i=n,r=Number(n)),l===V(i))return;let o=this.chains.find((e=>e.id===r));if(!o)throw new T(`Unsupported chainId: ${n}`);let s=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:i}]})};try{return await s()}catch(e){if(((e,t)=>{switch(t){case"coinbase_wallet":case"base_account":return e.message.includes("addEthereumChain");case"rabby_wallet":return e.message.includes("Unrecognized chain ID");default:return 4902===e.code||e.message?.includes("4902")}})(e,this.walletClientType))return"rabby_wallet"===this.walletClientType&&await H(300),await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:i,chainName:o.name,nativeCurrency:o.nativeCurrency,rpcUrls:[o.rpcUrls.default?.http[0]??""],blockExplorerUrls:[o.blockExplorers?.default.url??""]}]}),s();if("rainbow"===this.walletClientType&&e.message?.includes("wallet_switchEthereumChain"))throw new T(`Rainbow does not support the chainId ${t}`);throw e}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:a,getEthereumProvider:async()=>{if(!await a())throw new T("Wallet is not currently connected.");return this.proxyProvider},sign:async e=>{if(!await a())throw new T("Wallet is not currently connected.");return await this.sign(e)},disconnect:()=>{this.disconnect()}}}async syncAccounts(e){let t,n=e;try{if(void 0===n){let e=await X((()=>this.proxyProvider.request({method:"eth_accounts"})),{maxAttempts:10,delayMs:500});console.debug(`eth_accounts for ${this.walletClientType}:`,e),Array.isArray(e)&&(n=e)}}catch(e){console.debug("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.",e)}if(!n||!Array.isArray(n)||n.length<=0||!n[0])return;let i=n[0];if(!k(i))return void console.warn(`Invalid ethereum address reported by ${this.walletClientType}: ${i}`);let a=C(i),r=[];if("privy"===this.walletClientType){let e=y.get(c(a));this.chains.find((t=>t.id===Number(e)))||(y.del(c(a)),e=null),t=e||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]})}catch(e){console.warn(`Unable to switch embedded wallet to chain ID ${t} on initialization`)}}else try{let e=await X((()=>this.proxyProvider.request({method:"eth_chainId"})),{maxAttempts:10,delayMs:500});if(console.debug(`eth_chainId for ${this.walletClientType}:`,e),"string"==typeof e)t=e;else{if("number"!=typeof e)throw Error("Invalid chainId returned from provider");t=`0x${e.toString(16)}`}}catch(e){console.warn(`Failed to get chainId from provider, defaulting to ${d}`,e),t=d}let l=V(t);if(!r.find((e=>C(e.address)===a))){let e={name:this.walletBranding.name,icon:"string"==typeof this.walletBranding.icon?this.walletBranding.icon:void 0,id:this.walletBranding.id};r.push(this.buildConnectedWallet(C(i),l,e,"embedded_imported"===this.connectorType))}re(r,this.wallets)||(this.wallets=r,this.emit("walletsUpdated"))}async getConnectedWallet(){let e=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort(((e,t)=>t.connectedAt-e.connectedAt)).find((t=>e.find((e=>C(e)===C(t.address)))))||null}async isConnected(){let e=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(e)&&e.length>0}async sign(e){return await this.connect({showPrompt:!1}),this.proxyProvider.request({method:"personal_sign",params:[_(e),this.wallets[0]?.address]})}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}constructor(e,t,n,i){super(e),this.chainType="ethereum",this.onAccountsChanged=e=>{0===e.length?this.onDisconnect():this.syncAccounts(e)},this.onChainChanged=e=>{this.wallets.forEach((t=>{t.chainId=V(e),"privy"===this.walletClientType&&y.put(c(t.address),e)})),this.emit("walletsUpdated")},this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")},this.onConnect=async()=>{"base_account"===this.connectorType&&this.connected||(this.connected=!0,"coinbase_wallet"===this.connectorType&&await H(500),this.syncAccounts())},this.wallets=[],this.walletClientType=e,this.chains=t,this.defaultChain=n,this.rpcConfig=i,this.rpcTimeoutDuration=le(i,e),this.connected=!1,this.initialized=!1}}class ce{on(e,t){if(this.walletProvider)return this.walletProvider.on(e,t);this._subscriptions.push({eventName:e,listener:t})}async request(e){if(!this.walletProvider)throw new T(`A wallet request of type ${e.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(e),this.walletTimeout()]).catch((e=>{throw g(e)}))}constructor(e,t){this.removeListener=(e,t)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(e,t)}catch(e){console.warn("Unable to remove wallet provider listener")}},this.walletTimeout=(e=new b,t=this.rpcTimeoutDuration)=>new Promise(((n,i)=>setTimeout((()=>{i(e)}),t))),this.setWalletProvider=e=>{this.walletProvider&&this._subscriptions.forEach((e=>{this.removeListener(e.eventName,e.listener)})),this.walletProvider=e,this._subscriptions.forEach((e=>{this.walletProvider?.on(e.eventName,e.listener)}))},this.walletProvider=e,this.rpcTimeoutDuration=t||s,this._subscriptions=[]}}const de=n=>{let[i,a]=t("auto");return e((()=>{let e=new ResizeObserver((e=>{a(e[0]?.contentRect.height??"auto")}));return n.current&&e.observe(n.current),()=>{n.current&&e.unobserve(n.current)}}),[n.current]),i},he=h.div`
1
+ import{useEffect as e,useState as t,createContext as n,useContext as i,useMemo as a,useCallback as r}from"react";import{create as l}from"zustand";import{u as o,n as s,o as c,p as d}from"./context-WTldtXS8.mjs";import{styled as h,css as p}from"styled-components";import{jsx as u,jsxs as m}from"react/jsx-runtime";import*as w from"react-device-detect";import{c as f,s as y,f as g,d as b,S as v}from"./use-export-wallet-CV4p7L0b.mjs";import{u as x}from"./events-context-CI0iqAXA.mjs";import{isAddress as k}from"viem";import{getAddress as C,toHex as _}from"viem/utils";import{P as T,u as P}from"./internal-context-Z-fyxadS.mjs";import{a as W}from"./getPublicClient-B4uPLKn-.mjs";import{P as z}from"./get-is-unified-wallet-Boa8DYrQ.mjs";import{u as $}from"./useWallets-CR0z5IIt.mjs";const S=l((()=>({listings:[],loading:!1}))),I=S.setState,j=e=>S.getState().listings.find((({slug:t})=>N(t)===N(e))),E=e=>{let t;try{t=new URL(e).hostname}catch(e){return}return S.getState().listings.find((({homepage:e})=>{let n;try{n=new URL(e).hostname}catch(e){return!1}return t.includes(n)}))},D=(t=!0)=>{let n=o(),i=S((e=>e.listings)),a=S((e=>e.loading)),r=!!i.length;return e((()=>{t&&!r&&(I({listings:[],loading:!0}),(async e=>{let t=new URL("v3/wallets","https://explorer-api.walletconnect.com");t.searchParams.append("projectId",e);let n=await fetch(t);return n.ok?Object.values((await n.json()).listings).sort((({slug:e},{slug:t})=>"rainbow"===e&&"metamask"===t?1:"metamask"===e||"rainbow"===e?-1:1)):(console.debug(`Failed to fetch WalletConnect listings: ${await n.text().catch((()=>"No response."))}`),[])})(n.walletConnectCloudProjectId).then((e=>I({listings:e,loading:!1}))).catch((e=>{console.error(e),I({listings:[],loading:!1})})))}),[t,r,n.walletConnectCloudProjectId]),{listings:i,loading:a}},O=e=>{let{listings:t}=D();return t.find((({slug:t})=>N(t)===N(e)))};function N(e){return"cryptocom"===e?"cryptocom-defi":"binance"===e?"binance-defi":e.replace(/[-_]wallet$/,"")}function A(e){return["wallet_connect","backpack","binance","binanceus","bitget_wallet","bybit_wallet","cryptocom","haha_wallet","jupiter","metamask","okx_wallet","phantom","rabby_wallet","rainbow","ronin_wallet","safe","solflare","uniswap","zerion","kraken_wallet"].some((t=>e?.includes(t)))}const M=e=>e.isApexWallet?"Apex Wallet":e.isAvalanche?"Core Wallet":e.isBackpack?"Backpack":e.isBifrost?"Bifrost Wallet":e.isBitKeep?"BitKeep":e.isBitski?"Bitski":e.isBlockWallet?"BlockWallet":e.isBraveWallet?"Brave Wallet":e.isClover?"Clover":e.isCoin98?"Coin98 Wallet":e.isCoinbaseWallet?"Coinbase Wallet":e.isDawn?"Dawn Wallet":e.isDefiant?"Defiant":e.isDesig?"Desig Wallet":e.isEnkrypt?"Enkrypt":e.isExodus?"Exodus":e.isFordefi?"Fordefi":e.isFrame?"Frame":e.isFrontier?"Frontier Wallet":e.isGamestop?"GameStop Wallet":e.isHaqqWallet?"HAQQ Wallet":e.isHyperPay?"HyperPay Wallet":e.isImToken?"ImToken":e.isHaloWallet?"Halo Wallet":e.isKuCoinWallet?"KuCoin Wallet":e.isMathWallet?"MathWallet":e.isNovaWallet?"Nova Wallet":e.isOkxWallet||e.isOKExWallet?"OKX Wallet":e.isOneInchIOSWallet||e.isOneInchAndroidWallet?"1inch Wallet":e.isOneKey?"OneKey Wallet":e.isOpera?"Opera":e.isPhantom||"isPhantom"in e?"Phantom":e.isPortal?"Ripio Portal":e.isRabby?"Rabby Wallet":e.isRainbow?"Rainbow":e.isSafePal?"SafePal Wallet":e.isStatus?"Status":e.isSubWallet?"SubWallet":e.isTalisman?"Talisman":e.isTally||e.isTaho?"Taho":e.isTokenPocket?"TokenPocket":e.isTokenary?"Tokenary":e.isTrust||e.isTrustWallet?"Trust Wallet":e.isTTWallet?"TTWallet":e.isXDEFI?"XDEFI Wallet":e.isZeal?"Zeal":e.isZerion?"Zerion":e.isMetaMask?"MetaMask":void 0,L=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||"MetaMask"!==M(e))return!1;if(e.providers)for(let t of e.providers)if(!L(t))return!1;return!0},F=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers)for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0;return!1},B=(e,t)=>{let n=[],i=[];for(let[a,r]of e.entries())a<t?n.push(r):i.push(r);return[n,i]},U=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),R=(e,t)=>{let n=e.slice(0),i=[];for(;n.length;)i.push(n.splice(0,t));return i},q=(e,t=3,n=4,i="ethereum")=>{if(!e)return"";let a="ethereum"===i?2:0;return t+n+a+3>=e.length?e:`${e.slice(0,a+t)}...${e.slice(e.length-n,e.length)}`},K=(e,t=3,n=4)=>q(e,t,n,"solana"),H=e=>new Promise((t=>setTimeout(t,e)));function Z(e,{interval:t=100,timeout:n=5e3}={}){return new Promise(((i,a)=>{let r,l=0,o=()=>{l>=n?a("Max attempts reached without result"):(r=e(),l+=t,null==r?setTimeout(o,t):i(r))};o()}))}const X=(e,t={})=>{let n=t.delayMs||150,i=t.maxAttempts||270;return new Promise((async(a,r)=>{let l=!1,o=0;for(;!l&&o<i;){if(t.abortSignal?.aborted)return;e().then((e=>{l=!0,a(e)}),((...e)=>{l=!0,r(...e)})),o+=1,await H(n)}l||r(Error("Exceeded max attempts before resolving function"))}))},G=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),J=e=>"string"==typeof e?e:"0x"+e.toString(16);async function Q({store:e,walletList:t,externalWalletConfig:n,walletChainType:i,timeout:a=3e3}){let r=!1,l=window;return new Promise((o=>{function s(){if(r)return;r=!0,window.removeEventListener("ethereum#initialized",s);let a=e.getProviders();console.debug("Detected injected providers:",a.map((e=>e.info)));let l=[];for(let e of a)t.includes("coinbase_wallet")&&"com.coinbase.wallet"===e.info.rdns||"solana-only"===i&&"app.phantom"===e.info.rdns||l.push({type:e.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:e});if("solana-only"!==i)for(let e of function(){let e=window,t=e.ethereum;if(!t)return[];let n=[];if(t.providers?.length)for(let e of t.providers)e&&n.push(e);return n.push(e.ethereum),n}()){let t=M(e);if(!a.some((e=>e.info.name===t))){if(L(e,!0)&&!l.find((e=>"metamask"===e.type))){l.push({type:"metamask",legacyInjectedProvider:e});continue}if("Phantom"===t&&!l.find((e=>"phantom"===e.type))){l.push({type:"phantom",legacyInjectedProvider:e});continue}if("Coinbase Wallet"===t&&!l.find((e=>"coinbase_wallet"===e.type&&"smartWalletOnly"!==n.coinbaseWallet?.config?.preference?.options))){l.push({type:"coinbase_wallet",legacyInjectedProvider:e});continue}l.find((e=>"unknown_browser_extension"===e.type))||l.push({type:"unknown_browser_extension",legacyInjectedProvider:e})}}o(l)}l.ethereum?s():(window.addEventListener("ethereum#initialized",s,{once:!0}),setTimeout((()=>{s()}),a))}))}function V(e){return`eip155:${String(Number(e))}`}const Y=(e,t,n,i)=>{let a=Number(e),r=t.find((e=>e.id===a));if(!r)throw new T(`Unsupported chainId ${e}`,4901);return W(r,n,i)},ee=(e,t)=>{let n=Number(e),i=t.find((e=>e.id===n));if(!i)throw new T(`Unsupported chainId ${e}`,4901);return i.blockExplorers?.default.url},te=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},n=e.types.EIP712Domain??Object.entries(e.domain).map((([e,n])=>{if(null!=n&&"string"==typeof e&&e in t)return{name:e,type:t[e]}})).filter((e=>void 0!==e));return{...e,types:{...e.types,EIP712Domain:n}}};function ne(e,{min:t,max:n}){return Math.min(Math.max(e,t),n)}const ie=e=>e?.map((e=>({signer_id:e.signerId,override_policy_ids:e.policyIds})));function ae(e){return"ethereum"===e.type}function re(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],a=t[n];if(i?.address!==a?.address||i&&a&&ae(i)&&ae(a)&&i?.chainId!==a?.chainId||i?.connectorType!==a?.connectorType||i?.connectedAt!==a?.connectedAt||i?.walletClientType!==a?.walletClientType||i?.isConnected!==a?.isConnected||i?.linked!==a?.linked)return!1}return!0}const le=(e,t)=>e.rpcTimeouts&&e.rpcTimeouts[t]||s;function oe(e){return"ethereum"===e.chainType}class se extends f{buildConnectedWallet(e,t,n,i){let a=async()=>!!this.wallets.find((t=>C(t.address)===C(e)));return{type:"ethereum",address:C(e),chainId:t,meta:n,imported:i,switchChain:async n=>{let i,r;if(!a)throw new T("Wallet is not currently connected.");let l=this.wallets.find((t=>C(t.address)===C(e)))?.chainId;if(!l)throw new T("Unable to determine current chainId.");if("number"==typeof n?(i=`0x${n.toString(16)}`,r=n):(i=n,r=Number(n)),l===V(i))return;let o=this.chains.find((e=>e.id===r));if(!o)throw new T(`Unsupported chainId: ${n}`);let s=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:i}]})};try{return await s()}catch(e){if(((e,t)=>{switch(t){case"coinbase_wallet":case"base_account":return e.message.includes("addEthereumChain");case"rabby_wallet":return e.message.includes("Unrecognized chain ID");default:return 4902===e.code||e.message?.includes("4902")}})(e,this.walletClientType))return"rabby_wallet"===this.walletClientType&&await H(300),await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:i,chainName:o.name,nativeCurrency:o.nativeCurrency,rpcUrls:[o.rpcUrls.default?.http[0]??""],blockExplorerUrls:[o.blockExplorers?.default.url??""]}]}),s();if("rainbow"===this.walletClientType&&e.message?.includes("wallet_switchEthereumChain"))throw new T(`Rainbow does not support the chainId ${t}`);throw e}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:a,getEthereumProvider:async()=>{if(!await a())throw new T("Wallet is not currently connected.");return this.proxyProvider},sign:async e=>{if(!await a())throw new T("Wallet is not currently connected.");return await this.sign(e)},disconnect:()=>{this.disconnect()}}}async syncAccounts(e){let t,n=e;try{if(void 0===n){let e=await X((()=>this.proxyProvider.request({method:"eth_accounts"})),{maxAttempts:10,delayMs:500});console.debug(`eth_accounts for ${this.walletClientType}:`,e),Array.isArray(e)&&(n=e)}}catch(e){console.debug("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.",e)}if(!n||!Array.isArray(n)||n.length<=0||!n[0])return;let i=n[0];if(!k(i))return void console.warn(`Invalid ethereum address reported by ${this.walletClientType}: ${i}`);let a=C(i),r=[];if("privy"===this.walletClientType){let e=y.get(c(a));this.chains.find((t=>t.id===Number(e)))||(y.del(c(a)),e=null),t=e||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]})}catch(e){console.warn(`Unable to switch embedded wallet to chain ID ${t} on initialization`)}}else try{let e=await X((()=>this.proxyProvider.request({method:"eth_chainId"})),{maxAttempts:10,delayMs:500});if(console.debug(`eth_chainId for ${this.walletClientType}:`,e),"string"==typeof e)t=e;else{if("number"!=typeof e)throw Error("Invalid chainId returned from provider");t=`0x${e.toString(16)}`}}catch(e){console.warn(`Failed to get chainId from provider, defaulting to ${d}`,e),t=d}let l=V(t);if(!r.find((e=>C(e.address)===a))){let e={name:this.walletBranding.name,icon:"string"==typeof this.walletBranding.icon?this.walletBranding.icon:void 0,id:this.walletBranding.id};r.push(this.buildConnectedWallet(C(i),l,e,"embedded_imported"===this.connectorType))}re(r,this.wallets)||(this.wallets=r,this.emit("walletsUpdated"))}async getConnectedWallet(){let e=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort(((e,t)=>t.connectedAt-e.connectedAt)).find((t=>e.find((e=>C(e)===C(t.address)))))||null}async isConnected(){let e=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(e)&&e.length>0}async sign(e){return await this.connect({showPrompt:!1}),this.proxyProvider.request({method:"personal_sign",params:[_(e),this.wallets[0]?.address]})}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}constructor(e,t,n,i){super(e),this.chainType="ethereum",this.onAccountsChanged=e=>{0===e.length?this.onDisconnect():this.syncAccounts(e)},this.onChainChanged=e=>{this.wallets.forEach((t=>{t.chainId=V(e),"privy"===this.walletClientType&&y.put(c(t.address),e)})),this.emit("walletsUpdated")},this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")},this.onConnect=async()=>{"base_account"===this.connectorType&&this.connected||(this.connected=!0,"coinbase_wallet"===this.connectorType&&await H(500),this.syncAccounts())},this.wallets=[],this.walletClientType=e,this.chains=t,this.defaultChain=n,this.rpcConfig=i,this.rpcTimeoutDuration=le(i,e),this.connected=!1,this.initialized=!1}}class ce{on(e,t){if(this.walletProvider)return this.walletProvider.on(e,t);this._subscriptions.push({eventName:e,listener:t})}async request(e){if(!this.walletProvider)throw new T(`A wallet request of type ${e.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(e),this.walletTimeout()]).catch((e=>{throw g(e)}))}constructor(e,t){this.removeListener=(e,t)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(e,t)}catch(e){console.warn("Unable to remove wallet provider listener")}},this.walletTimeout=(e=new b,t=this.rpcTimeoutDuration)=>new Promise(((n,i)=>setTimeout((()=>{i(e)}),t))),this.setWalletProvider=e=>{this.walletProvider&&this._subscriptions.forEach((e=>{this.removeListener(e.eventName,e.listener)})),this.walletProvider=e,this._subscriptions.forEach((e=>{this.walletProvider?.on(e.eventName,e.listener)}))},this.walletProvider=e,this.rpcTimeoutDuration=t||s,this._subscriptions=[]}}const de=n=>{let[i,a]=t("auto");return e((()=>{let e=new ResizeObserver((e=>{a(e[0]?.contentRect.height??"auto")}));return n.current&&e.observe(n.current),()=>{n.current&&e.unobserve(n.current)}}),[n.current]),i},he=h.div`
2
2
  text-align: left;
3
3
  flex-grow: 1;
4
4
  `,pe=h.div`
@@ -1 +1 @@
1
- import{useState as r,useEffect as e}from"react";import{addToDefaultChains as o}from"@privy-io/js-sdk-core";import{s as i}from"./context-CCRnMB8L.mjs";import{u as n}from"./internal-context-Z-fyxadS.mjs";import{u as t}from"./useGetSolPrice-DwwjjGbd.mjs";function c(c){let{tokenPrice:a,isTokenPriceLoading:s,tokenPriceError:P}=(t=>{let{showFiatPrices:c,getUsdTokenPrice:a,chains:s}=n(),[P,l]=r(!0),[d,k]=r(void 0),[m,f]=r(void 0);return e((()=>{t||=i;let r=o(s).find((r=>r.id===Number(t)));(async()=>{if(c){if(!r)return l(!1),void k(Error(`Unable to fetch token price on chain id ${t}`));try{l(!0);let e=await a(r);e?f(e):k(Error(`Unable to fetch token price on chain id ${r.id}`))}catch(r){k(r)}finally{l(!1)}}else l(!1)})()}),[t]),{tokenPrice:m,isTokenPriceLoading:P,tokenPriceError:d}})("solana"===c?-1:c),{solPrice:l,isSolPriceLoading:d,solPriceError:k}=t({enabled:"solana"===c});return"solana"===c?{tokenPrice:l,isTokenPriceLoading:d,tokenPriceError:k}:{tokenPrice:a,isTokenPriceLoading:s,tokenPriceError:P}}export{c as u};
1
+ import{useState as r,useEffect as e}from"react";import{addToDefaultChains as o}from"@privy-io/js-sdk-core";import{s as i}from"./context-WTldtXS8.mjs";import{u as n}from"./internal-context-Z-fyxadS.mjs";import{u as t}from"./useGetSolPrice-DwwjjGbd.mjs";function c(c){let{tokenPrice:a,isTokenPriceLoading:s,tokenPriceError:P}=(t=>{let{showFiatPrices:c,getUsdTokenPrice:a,chains:s}=n(),[P,l]=r(!0),[d,k]=r(void 0),[m,f]=r(void 0);return e((()=>{t||=i;let r=o(s).find((r=>r.id===Number(t)));(async()=>{if(c){if(!r)return l(!1),void k(Error(`Unable to fetch token price on chain id ${t}`));try{l(!0);let e=await a(r);e?f(e):k(Error(`Unable to fetch token price on chain id ${r.id}`))}catch(r){k(r)}finally{l(!1)}}else l(!1)})()}),[t]),{tokenPrice:m,isTokenPriceLoading:P,tokenPriceError:d}})("solana"===c?-1:c),{solPrice:l,isSolPriceLoading:d,solPriceError:k}=t({enabled:"solana"===c});return"solana"===c?{tokenPrice:l,isTokenPriceLoading:d,tokenPriceError:k}:{tokenPrice:a,isTokenPriceLoading:s,tokenPriceError:P}}export{c as u};
@@ -1 +1 @@
1
- import{u as e}from"./context-CCRnMB8L.mjs";const t={"connectionStatus.successfullyConnected":"Successfully connected with {walletName}","connectionStatus.errorTitle":"{errorMessage}","connectionStatus.connecting":"Connecting","connectionStatus.connectOneWallet":"For the best experience, connect only one wallet at a time.","connectionStatus.checkOtherWindows":"Don't see your wallet? Check your other browser windows.","connectionStatus.stillHere":"Still here?","connectionStatus.tryConnectingAgain":"Try connecting again","connectionStatus.or":"or","connectionStatus.useDifferentLink":"use this different link","connectWallet.connectYourWallet":"Connect a wallet","connectWallet.waitingForWallet":"Waiting for {walletName}","connectWallet.connectToAccount":"Connect a wallet to your {appName} account","connectWallet.installAndConnect":"To connect to {walletName}, install and open the app. Then confirm the connection when prompted.","connectWallet.tryConnectingAgain":"Please try connecting again.","connectWallet.openInApp":"Open in app","connectWallet.copyLink":"Copy link","connectWallet.retry":"Retry","connectWallet.searchPlaceholder":"Search through {count} wallets","connectWallet.noWalletsFound":"No wallets found. Try another search.","connectWallet.lastUsed":"Last used","connectWallet.selectYourWallet":"Select your wallet","connectWallet.selectNetwork":"Select network","connectWallet.goToWallet":"Go to {walletName} to continue","connectWallet.scanToConnect":"Scan code to connect to {walletName}","connectWallet.openOrInstall":"Open or install {walletName}"};function n(){let n=e();return{t:(e,o)=>function(e,n,o){let c=n?.[e]??t[e];return o&&0!==Object.keys(o).length?c.replace(/\{(\w+)\}/g,((e,t)=>o[t]??e)):c}(e,n.intl.textLocalization,o)}}export{n as u};
1
+ import{u as e}from"./context-WTldtXS8.mjs";const t={"connectionStatus.successfullyConnected":"Successfully connected with {walletName}","connectionStatus.errorTitle":"{errorMessage}","connectionStatus.connecting":"Connecting","connectionStatus.connectOneWallet":"For the best experience, connect only one wallet at a time.","connectionStatus.checkOtherWindows":"Don't see your wallet? Check your other browser windows.","connectionStatus.stillHere":"Still here?","connectionStatus.tryConnectingAgain":"Try connecting again","connectionStatus.or":"or","connectionStatus.useDifferentLink":"use this different link","connectWallet.connectYourWallet":"Connect a wallet","connectWallet.waitingForWallet":"Waiting for {walletName}","connectWallet.connectToAccount":"Connect a wallet to your {appName} account","connectWallet.installAndConnect":"To connect to {walletName}, install and open the app. Then confirm the connection when prompted.","connectWallet.tryConnectingAgain":"Please try connecting again.","connectWallet.openInApp":"Open in app","connectWallet.copyLink":"Copy link","connectWallet.retry":"Retry","connectWallet.searchPlaceholder":"Search through {count} wallets","connectWallet.noWalletsFound":"No wallets found. Try another search.","connectWallet.lastUsed":"Last used","connectWallet.selectYourWallet":"Select your wallet","connectWallet.selectNetwork":"Select network","connectWallet.goToWallet":"Go to {walletName} to continue","connectWallet.scanToConnect":"Scan code to connect to {walletName}","connectWallet.openOrInstall":"Open or install {walletName}"};function n(){let n=e();return{t:(e,o)=>function(e,n,o){let c=n?.[e]??t[e];return o&&0!==Object.keys(o).length?c.replace(/\{(\w+)\}/g,((e,t)=>o[t]??e)):c}(e,n.intl.textLocalization,o)}}export{n as u};
@@ -1 +1 @@
1
- import{isMobile as e,isAndroid as t}from"react-device-detect";import{a as r,b as a,u as n}from"./internal-context-Z-fyxadS.mjs";import{useCallback as o,useContext as i}from"react";import{u as l}from"./use-export-wallet-Voe8hSb9.mjs";import{d as s,c as d,g as c,a as p,k as u,f as y,u as m,P as E}from"./get-is-unified-wallet-j2fzd2YE.mjs";import{a as w,u as h}from"./events-context-CI0iqAXA.mjs";import{create as f}from"@privy-io/js-sdk-core";import{g as v}from"./useWallets-BKPOCKnv.mjs";import{u as T,W}from"./context-CCRnMB8L.mjs";function A(e){return{name:e.metadata?.shortName||e.name||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function g(a,n){let o=A(n);if(e&&t&&o.universalLink)return M(o.universalLink,a);if(o.deepLink)return _(o.deepLink,a);if(o.universalLink)return M(o.universalLink,a);throw new r(`Unsupported wallet ${n.id}`)}function D(e,t){let r=A(t);if(r.universalLink)return M(r.universalLink,e)}let U="WALLETCONNECT_DEEPLINK_CHOICE";function I(){try{localStorage.removeItem(U)}catch{}}function x({href:e,name:t}){try{localStorage.setItem(U,JSON.stringify({href:e,name:t}))}catch{}}function S(){try{localStorage.removeItem(U)}catch{}}function k(e){return e.startsWith("http://")||e.startsWith("https://")}function _(e,t){if(k(e))return M(e,t);let r=e;return r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),{redirect:`${r}wc?uri=${encodeURIComponent(t)}`,href:r}}function M(e,t){if(!k(e))return _(e,t);let r=e;return r.endsWith("/")||(r=`${r}/`),{redirect:`${r}wc?uri=${encodeURIComponent(t)}`,href:r}}function b(e,t){window.open(e,t,"noreferrer noopener")}const L=({address:e,nonce:t})=>`${window.location.host} wants you to sign in with your Solana account:\n${e}\n\n${`You are proving you own ${e}.`}\n\nURI: ${window.location.origin}\nVersion: 1\nChain ID: mainnet\nNonce: ${t}\nIssued At: ${(new Date).toISOString()}\nResources:\n- https://privy.io`,C=Symbol("solana-funding-plugin"),R=Symbol("solana-ledger-plugin"),P=(e,{chainType:t,walletIndex:r}={})=>e?.linkedAccounts.filter((e=>!("wallet"!==e.type||"privy"!==e.walletClientType||void 0!==r&&e.walletIndex!==r||void 0!==t&&e.chainType!==t)))??[],N=async({user:e,accessToken:t,proxy:r,refreshSessionAndUser:a,privy:n,appConfig:o,recoverEmbeddedWallet:i,setUser:l,walletIndex:c,chainType:p,recoveryMethod:u,recoveryPassword:y,recoveryAccessToken:m,idempotencyKey:E})=>{if(0===c)if("user-controlled-server-wallets-only"===o.embeddedWallets.mode)await f(n,{request:{chain_type:p},headers:E?{"privy-idempotency-key":E}:void 0});else if("ethereum"===p){let a=s(e);a&&await i({address:a.address}),await r.create({accessToken:t,solanaAddress:a?.address,recoveryMethod:u,recoveryPassword:y,recoveryAccessToken:m})}else{if("solana"!==p)throw Error("Invalid input to create wallet");{let a=d(e);a&&await i({address:a.address}),await r.createSolana({accessToken:t,ethereumAddress:a?.address,recoveryMethod:u,recoveryPassword:y,recoveryAccessToken:m})}}else if("user-controlled-server-wallets-only"===o.embeddedWallets.mode)await f(n,{request:{chain_type:p}});else{let{entropyId:a,entropyIdVerifier:n}=v(e);await i(),await r.addWallet({accessToken:t,entropyId:a,entropyIdVerifier:n,chainType:p,hdWalletIndex:c})}let w=await a(),h=P(w,{chainType:p,walletIndex:c})[0];return l(w),{user:w,account:h}},O=e=>e.reduce(((e,t)=>!e||e.walletIndex<t.walletIndex?t:e),null);let K=async({accessToken:e,appConfig:t,privy:r,emitPrivyEvent:n,proxy:o,refreshSessionAndUser:i,recoverEmbeddedWallet:l,user:s,walletIndex:d,setModalData:p,openModal:u,chainType:y,setUser:m,idempotencyKey:E})=>{if(d<0)throw n("createWallet","onError",a.EMBEDDED_WALLET_CREATE_ERROR),Error(`A negative walletIndex (${d}) is invalid.`);let w=c(s);if(d>0&&!w)throw n("createWallet","onError",a.EMBEDDED_WALLET_NOT_FOUND),Error("Must have an existing embedded wallet to create an additional wallet.");if(t.embeddedWallets.requireUserOwnedRecoveryOnCreate&&"user-controlled-server-wallets-only"===t.embeddedWallets.mode)throw n("createWallet","onError",a.EMBEDDED_WALLET_CREATE_ERROR),Error("User owned recovery not yet supported for this app.");if(!w&&t.embeddedWallets.requireUserOwnedRecoveryOnCreate)return await $({emitPrivyEvent:n,setModalData:p,openModal:u,chainType:y});let h=P(s,{chainType:y,walletIndex:d})[0];if(h)return{user:s,account:h};if(0===d&&!o)return $({emitPrivyEvent:n,setModalData:p,openModal:u,chainType:y});if(!o)throw n("createWallet","onError",a.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to connect to wallet proxy");return N({appConfig:t,walletIndex:d,chainType:y,user:s,accessToken:e,proxy:o,refreshSessionAndUser:i,privy:r,recoverEmbeddedWallet:l,setUser:m,idempotencyKey:E})},$=async({emitPrivyEvent:e,setModalData:t,openModal:r,chainType:n})=>new Promise(((o,i)=>{t({createWallet:{onSuccess:({user:t,account:r})=>{e("createWallet","onSuccess",{wallet:r}),o({user:t,account:r})},onFailure:t=>{e("createWallet","onError",a.UNKNOWN_EMBEDDED_WALLET_ERROR),i(t)},callAuthOnSuccessOnClose:!1,shouldCreateEth:"ethereum"===n,shouldCreateSol:"solana"===n}}),r("EmbeddedWalletOnAccountCreateScreen")}));const B=()=>{let e=T(),t=w(),{setModalData:r}=p(),{initializeWalletProxy:o,recoverEmbeddedWallet:i,setUser:l,openModal:s,refreshSessionAndUser:d,privy:c,client:u}=n();return{create:async({chainType:n,options:p,latestUser:y,idempotencyKey:m})=>{let E=y;if(E||(E=await d()),!E)throw t("createWallet","onError",a.MUST_BE_AUTHENTICATED),Error("User must be authenticated before creating a Privy wallet");return await(async({appConfig:e,getAccessToken:t,initializeWalletProxy:r,user:n,privy:o,emitPrivyEvent:i,recoverEmbeddedWallet:l,setModalData:s,openModal:d,setUser:c,options:p,timeoutDuration:u,refreshSessionAndUser:y,chainType:m,idempotencyKey:E})=>{let[w,h]=await Promise.all([r(u),t()]);if(!h||!n)throw i("createWallet","onError",a.MUST_BE_AUTHENTICATED),Error("User must be authenticated before creating a Privy wallet");if(!w&&e.customAuth?.enabled)throw i("createWallet","onError",a.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to connect to wallet proxy");if(p&&"walletIndex"in p&&"number"==typeof p.walletIndex){if("user-controlled-server-wallets-only"===e.embeddedWallets.mode)throw i("createWallet","onError",a.INVALID_DATA),Error("Invalid input, use `createAdditional` instead of `walletIndex` to create additional wallets.");return K({accessToken:h,appConfig:e,privy:o,emitPrivyEvent:i,openModal:d,proxy:w,refreshSessionAndUser:y,recoverEmbeddedWallet:l,setModalData:s,user:n,walletIndex:p.walletIndex,chainType:m,setUser:c})}let f=p&&"createAdditional"in p&&p.createAdditional,v=P(n,{chainType:m});if(v[0]&&!f)throw i("createWallet","onError",a.EMBEDDED_WALLET_ALREADY_EXISTS),Error("User already has an embedded wallet.");return K({accessToken:h,appConfig:e,privy:o,emitPrivyEvent:i,openModal:d,proxy:w,recoverEmbeddedWallet:l,setModalData:s,user:n,walletIndex:(O(v)?.walletIndex??-1)+1,chainType:m,refreshSessionAndUser:y,setUser:c,idempotencyKey:E})})({appConfig:e,privy:c,getAccessToken:()=>u.getAccessToken(),refreshSessionAndUser:d,initializeWalletProxy:o,user:E,emitPrivyEvent:t,recoverEmbeddedWallet:i,setModalData:r,openModal:s,setUser:l,options:p,timeoutDuration:W,chainType:n,idempotencyKey:m})}}};function j(e){let{create:t}=B();return h("createWallet",e),{createWallet:async e=>{e&&"target"in e&&e&&(e=void 0);let{account:r}=await t({chainType:"ethereum",options:e});return r}}}const z=async({emitPrivyEvent:e,getAccessToken:t,initializeWalletProxy:n,refreshSessionAndUser:o,user:i,appConfig:l},{privateKey:s,chainType:d,additionalSigners:c})=>{if(!i)throw e("linkAccount","onError",a.MUST_BE_AUTHENTICATED,{linkMethod:"siwe"}),new r("User must be authenticated before linking an account.");let p="user-controlled-server-wallets-only"===l.embeddedWallets.mode?"tee":"on-device";if(c&&"on-device"===p)throw new r("Specifying additionalSigners is only supported for TEE execution and this app uses On-device execution. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide");let[m,E]=await Promise.all([t(),n(15e3)]);if(!E||!m)throw e("linkAccount","onError",a.MUST_BE_AUTHENTICATED,{linkMethod:"siwe"}),new r("User must be authenticated before linking an account.");let{address:w}=await E.importWallet({privateKey:s,accessToken:m,chainType:d,mode:p,additionalSigners:c}),h=await o(),f="solana"===d?u(h):y(h),v=f?.find((e=>e.address===w));if(!v)throw e("createWallet","onError",a.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to import wallet");return e("createWallet","onSuccess",{wallet:v}),v},F=()=>{let{user:e}=m(),{client:t,refreshSessionAndUser:r,initializeWalletProxy:a}=n(),i=w(),l=T();return{importWallet:o((({privateKey:n,additionalSigners:o})=>z({getAccessToken:()=>t.getAccessToken(),user:e,initializeWalletProxy:a,refreshSessionAndUser:r,emitPrivyEvent:i,appConfig:l},{privateKey:n,chainType:"ethereum",additionalSigners:o})),[e,t,r,a,i,l])}},H=()=>{let{importWallet:e}=F(),{exportWallet:t}=l(),{createWallet:r}=j();return{...i(E),importWallet:e,createWallet:r,exportWallet:t}};export{C as S,D as a,g as b,N as c,I as d,R as e,B as f,j as g,F as h,z as i,b as o,L as p,S as r,x as s,H as u};
1
+ import{isMobile as e,isAndroid as t}from"react-device-detect";import{a as r,b as a,u as n}from"./internal-context-Z-fyxadS.mjs";import{useCallback as o,useContext as i}from"react";import{u as l}from"./use-export-wallet-CV4p7L0b.mjs";import{d as s,c as d,g as c,a as p,k as u,f as y,u as m,P as E}from"./get-is-unified-wallet-Boa8DYrQ.mjs";import{a as w,u as h}from"./events-context-CI0iqAXA.mjs";import{create as f}from"@privy-io/js-sdk-core";import{g as v}from"./useWallets-CR0z5IIt.mjs";import{u as T,W}from"./context-WTldtXS8.mjs";function A(e){return{name:e.metadata?.shortName||e.name||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function g(a,n){let o=A(n);if(e&&t&&o.universalLink)return M(o.universalLink,a);if(o.deepLink)return _(o.deepLink,a);if(o.universalLink)return M(o.universalLink,a);throw new r(`Unsupported wallet ${n.id}`)}function D(e,t){let r=A(t);if(r.universalLink)return M(r.universalLink,e)}let U="WALLETCONNECT_DEEPLINK_CHOICE";function I(){try{localStorage.removeItem(U)}catch{}}function x({href:e,name:t}){try{localStorage.setItem(U,JSON.stringify({href:e,name:t}))}catch{}}function S(){try{localStorage.removeItem(U)}catch{}}function k(e){return e.startsWith("http://")||e.startsWith("https://")}function _(e,t){if(k(e))return M(e,t);let r=e;return r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),{redirect:`${r}wc?uri=${encodeURIComponent(t)}`,href:r}}function M(e,t){if(!k(e))return _(e,t);let r=e;return r.endsWith("/")||(r=`${r}/`),{redirect:`${r}wc?uri=${encodeURIComponent(t)}`,href:r}}function b(e,t){window.open(e,t,"noreferrer noopener")}const L=({address:e,nonce:t})=>`${window.location.host} wants you to sign in with your Solana account:\n${e}\n\n${`You are proving you own ${e}.`}\n\nURI: ${window.location.origin}\nVersion: 1\nChain ID: mainnet\nNonce: ${t}\nIssued At: ${(new Date).toISOString()}\nResources:\n- https://privy.io`,C=Symbol("solana-funding-plugin"),R=Symbol("solana-ledger-plugin"),P=(e,{chainType:t,walletIndex:r}={})=>e?.linkedAccounts.filter((e=>!("wallet"!==e.type||"privy"!==e.walletClientType||void 0!==r&&e.walletIndex!==r||void 0!==t&&e.chainType!==t)))??[],N=async({user:e,accessToken:t,proxy:r,refreshSessionAndUser:a,privy:n,appConfig:o,recoverEmbeddedWallet:i,setUser:l,walletIndex:c,chainType:p,recoveryMethod:u,recoveryPassword:y,recoveryAccessToken:m,idempotencyKey:E})=>{if(0===c)if("user-controlled-server-wallets-only"===o.embeddedWallets.mode)await f(n,{request:{chain_type:p},headers:E?{"privy-idempotency-key":E}:void 0});else if("ethereum"===p){let a=s(e);a&&await i({address:a.address}),await r.create({accessToken:t,solanaAddress:a?.address,recoveryMethod:u,recoveryPassword:y,recoveryAccessToken:m})}else{if("solana"!==p)throw Error("Invalid input to create wallet");{let a=d(e);a&&await i({address:a.address}),await r.createSolana({accessToken:t,ethereumAddress:a?.address,recoveryMethod:u,recoveryPassword:y,recoveryAccessToken:m})}}else if("user-controlled-server-wallets-only"===o.embeddedWallets.mode)await f(n,{request:{chain_type:p}});else{let{entropyId:a,entropyIdVerifier:n}=v(e);await i(),await r.addWallet({accessToken:t,entropyId:a,entropyIdVerifier:n,chainType:p,hdWalletIndex:c})}let w=await a(),h=P(w,{chainType:p,walletIndex:c})[0];return l(w),{user:w,account:h}},O=e=>e.reduce(((e,t)=>!e||e.walletIndex<t.walletIndex?t:e),null);let K=async({accessToken:e,appConfig:t,privy:r,emitPrivyEvent:n,proxy:o,refreshSessionAndUser:i,recoverEmbeddedWallet:l,user:s,walletIndex:d,setModalData:p,openModal:u,chainType:y,setUser:m,idempotencyKey:E})=>{if(d<0)throw n("createWallet","onError",a.EMBEDDED_WALLET_CREATE_ERROR),Error(`A negative walletIndex (${d}) is invalid.`);let w=c(s);if(d>0&&!w)throw n("createWallet","onError",a.EMBEDDED_WALLET_NOT_FOUND),Error("Must have an existing embedded wallet to create an additional wallet.");if(t.embeddedWallets.requireUserOwnedRecoveryOnCreate&&"user-controlled-server-wallets-only"===t.embeddedWallets.mode)throw n("createWallet","onError",a.EMBEDDED_WALLET_CREATE_ERROR),Error("User owned recovery not yet supported for this app.");if(!w&&t.embeddedWallets.requireUserOwnedRecoveryOnCreate)return await $({emitPrivyEvent:n,setModalData:p,openModal:u,chainType:y});let h=P(s,{chainType:y,walletIndex:d})[0];if(h)return{user:s,account:h};if(0===d&&!o)return $({emitPrivyEvent:n,setModalData:p,openModal:u,chainType:y});if(!o)throw n("createWallet","onError",a.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to connect to wallet proxy");return N({appConfig:t,walletIndex:d,chainType:y,user:s,accessToken:e,proxy:o,refreshSessionAndUser:i,privy:r,recoverEmbeddedWallet:l,setUser:m,idempotencyKey:E})},$=async({emitPrivyEvent:e,setModalData:t,openModal:r,chainType:n})=>new Promise(((o,i)=>{t({createWallet:{onSuccess:({user:t,account:r})=>{e("createWallet","onSuccess",{wallet:r}),o({user:t,account:r})},onFailure:t=>{e("createWallet","onError",a.UNKNOWN_EMBEDDED_WALLET_ERROR),i(t)},callAuthOnSuccessOnClose:!1,shouldCreateEth:"ethereum"===n,shouldCreateSol:"solana"===n}}),r("EmbeddedWalletOnAccountCreateScreen")}));const B=()=>{let e=T(),t=w(),{setModalData:r}=p(),{initializeWalletProxy:o,recoverEmbeddedWallet:i,setUser:l,openModal:s,refreshSessionAndUser:d,privy:c,client:u}=n();return{create:async({chainType:n,options:p,latestUser:y,idempotencyKey:m})=>{let E=y;if(E||(E=await d()),!E)throw t("createWallet","onError",a.MUST_BE_AUTHENTICATED),Error("User must be authenticated before creating a Privy wallet");return await(async({appConfig:e,getAccessToken:t,initializeWalletProxy:r,user:n,privy:o,emitPrivyEvent:i,recoverEmbeddedWallet:l,setModalData:s,openModal:d,setUser:c,options:p,timeoutDuration:u,refreshSessionAndUser:y,chainType:m,idempotencyKey:E})=>{let[w,h]=await Promise.all([r(u),t()]);if(!h||!n)throw i("createWallet","onError",a.MUST_BE_AUTHENTICATED),Error("User must be authenticated before creating a Privy wallet");if(!w&&e.customAuth?.enabled)throw i("createWallet","onError",a.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to connect to wallet proxy");if(p&&"walletIndex"in p&&"number"==typeof p.walletIndex){if("user-controlled-server-wallets-only"===e.embeddedWallets.mode)throw i("createWallet","onError",a.INVALID_DATA),Error("Invalid input, use `createAdditional` instead of `walletIndex` to create additional wallets.");return K({accessToken:h,appConfig:e,privy:o,emitPrivyEvent:i,openModal:d,proxy:w,refreshSessionAndUser:y,recoverEmbeddedWallet:l,setModalData:s,user:n,walletIndex:p.walletIndex,chainType:m,setUser:c})}let f=p&&"createAdditional"in p&&p.createAdditional,v=P(n,{chainType:m});if(v[0]&&!f)throw i("createWallet","onError",a.EMBEDDED_WALLET_ALREADY_EXISTS),Error("User already has an embedded wallet.");return K({accessToken:h,appConfig:e,privy:o,emitPrivyEvent:i,openModal:d,proxy:w,recoverEmbeddedWallet:l,setModalData:s,user:n,walletIndex:(O(v)?.walletIndex??-1)+1,chainType:m,refreshSessionAndUser:y,setUser:c,idempotencyKey:E})})({appConfig:e,privy:c,getAccessToken:()=>u.getAccessToken(),refreshSessionAndUser:d,initializeWalletProxy:o,user:E,emitPrivyEvent:t,recoverEmbeddedWallet:i,setModalData:r,openModal:s,setUser:l,options:p,timeoutDuration:W,chainType:n,idempotencyKey:m})}}};function j(e){let{create:t}=B();return h("createWallet",e),{createWallet:async e=>{e&&"target"in e&&e&&(e=void 0);let{account:r}=await t({chainType:"ethereum",options:e});return r}}}const z=async({emitPrivyEvent:e,getAccessToken:t,initializeWalletProxy:n,refreshSessionAndUser:o,user:i,appConfig:l},{privateKey:s,chainType:d,additionalSigners:c})=>{if(!i)throw e("linkAccount","onError",a.MUST_BE_AUTHENTICATED,{linkMethod:"siwe"}),new r("User must be authenticated before linking an account.");let p="user-controlled-server-wallets-only"===l.embeddedWallets.mode?"tee":"on-device";if(c&&"on-device"===p)throw new r("Specifying additionalSigners is only supported for TEE execution and this app uses On-device execution. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide");let[m,E]=await Promise.all([t(),n(15e3)]);if(!E||!m)throw e("linkAccount","onError",a.MUST_BE_AUTHENTICATED,{linkMethod:"siwe"}),new r("User must be authenticated before linking an account.");let{address:w}=await E.importWallet({privateKey:s,accessToken:m,chainType:d,mode:p,additionalSigners:c}),h=await o(),f="solana"===d?u(h):y(h),v=f?.find((e=>e.address===w));if(!v)throw e("createWallet","onError",a.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to import wallet");return e("createWallet","onSuccess",{wallet:v}),v},F=()=>{let{user:e}=m(),{client:t,refreshSessionAndUser:r,initializeWalletProxy:a}=n(),i=w(),l=T();return{importWallet:o((({privateKey:n,additionalSigners:o})=>z({getAccessToken:()=>t.getAccessToken(),user:e,initializeWalletProxy:a,refreshSessionAndUser:r,emitPrivyEvent:i,appConfig:l},{privateKey:n,chainType:"ethereum",additionalSigners:o})),[e,t,r,a,i,l])}},H=()=>{let{importWallet:e}=F(),{exportWallet:t}=l(),{createWallet:r}=j();return{...i(E),importWallet:e,createWallet:r,exportWallet:t}};export{C as S,D as a,g as b,N as c,I as d,R as e,B as f,j as g,F as h,z as i,b as o,L as p,S as r,x as s,H as u};
@@ -1 +1 @@
1
- import{getTransactionDecoder as r,getBase64Decoder as n,getBase58Encoder as e}from"@solana/kit";import{useMemo as o,useCallback as t}from"react";import{u as a}from"./context-CCRnMB8L.mjs";import{a as i,b as s}from"./internal-context-Z-fyxadS.mjs";function c(n){return new Uint8Array(r().decode(n).messageBytes)}async function l({solanaClient:r,tx:e}){let o=n().decode(c(e)),{value:t}=await r.rpc.getFeeForMessage(o).send();return t??0n}async function u({solanaClient:r,tx:e,replaceRecentBlockhash:o}){let{value:t}=await r.rpc.simulateTransaction(n().decode(e),{commitment:"confirmed",encoding:"base64",sigVerify:!1,replaceRecentBlockhash:o}).send();if("BlockhashNotFound"===t.err&&o)throw Error("Simulation failed: Blockhash not found");return"BlockhashNotFound"===t.err?await u({solanaClient:r,tx:e,replaceRecentBlockhash:!0}):{logs:t.logs??[],error:t.err,hasError:!!t.err,hasFunds:t.logs?.every((r=>!/insufficient funds/gi.test(r)&&!/insufficient lamports/gi.test(r)))??!0}}const f=(...r)=>{if("undefined"==typeof Buffer)throw new i("Buffer is not defined.",void 0,s.BUFFER_NOT_DEFINED);return Buffer.from(...r)};async function p({rpcSubscriptions:r,signature:n,timeout:e}){let o=new AbortController,t=await r.signatureNotifications(n,{commitment:"confirmed"}).subscribe({abortSignal:o.signal}),a=await Promise.race([new Promise((r=>{setTimeout((()=>{o.abort(),r(Error("Transaction confirmation timed out"))}),e)})),new Promise((async r=>{for await(let n of t){if(o.abort(),n.value.err)return r(Error("Transaction confirmation failed"));r(void 0)}}))]);if(a instanceof Error)throw a}function m({rpc:r,rpcSubscriptions:n,chain:o,blockExplorerUrl:t}){let a=function({rpc:r,rpcSubscriptions:n}){return async o=>new Promise((async(t,a)=>{try{let a=await r.sendTransaction(f(o).toString("base64"),{preflightCommitment:"confirmed",encoding:"base64"}).send();await p({rpcSubscriptions:n,signature:a,timeout:1e4}),t({signature:new Uint8Array(e().encode(a))})}catch(r){a(r)}}))}({rpc:r,rpcSubscriptions:n});return{rpc:r,rpcSubscriptions:n,chain:o,blockExplorerUrl:t,sendAndConfirmTransaction:a}}function d(){let r=a(),n=o((()=>Object.fromEntries(["solana:mainnet","solana:devnet","solana:testnet"].map((n=>[n,r.solanaRpcs[n]?m({chain:n,rpc:r.solanaRpcs[n].rpc,rpcSubscriptions:r.solanaRpcs[n].rpcSubscriptions,blockExplorerUrl:r.solanaRpcs[n].blockExplorerUrl??`https://explorer.solana.com?cluster=${n.replace("solana:","")}`}):null])))),[r.solanaRpcs]);return t((r=>{if(!n[r])throw Error(`No RPC configuration found for chain ${r}`);return n[r]}),[n])}export{c as a,f as b,l as f,m as g,u as s,d as u,p as w};
1
+ import{getTransactionDecoder as r,getBase64Decoder as n,getBase58Encoder as e}from"@solana/kit";import{useMemo as o,useCallback as t}from"react";import{u as a}from"./context-WTldtXS8.mjs";import{a as i,b as s}from"./internal-context-Z-fyxadS.mjs";function c(n){return new Uint8Array(r().decode(n).messageBytes)}async function l({solanaClient:r,tx:e}){let o=n().decode(c(e)),{value:t}=await r.rpc.getFeeForMessage(o).send();return t??0n}async function u({solanaClient:r,tx:e,replaceRecentBlockhash:o}){let{value:t}=await r.rpc.simulateTransaction(n().decode(e),{commitment:"confirmed",encoding:"base64",sigVerify:!1,replaceRecentBlockhash:o}).send();if("BlockhashNotFound"===t.err&&o)throw Error("Simulation failed: Blockhash not found");return"BlockhashNotFound"===t.err?await u({solanaClient:r,tx:e,replaceRecentBlockhash:!0}):{logs:t.logs??[],error:t.err,hasError:!!t.err,hasFunds:t.logs?.every((r=>!/insufficient funds/gi.test(r)&&!/insufficient lamports/gi.test(r)))??!0}}const f=(...r)=>{if("undefined"==typeof Buffer)throw new i("Buffer is not defined.",void 0,s.BUFFER_NOT_DEFINED);return Buffer.from(...r)};async function p({rpcSubscriptions:r,signature:n,timeout:e}){let o=new AbortController,t=await r.signatureNotifications(n,{commitment:"confirmed"}).subscribe({abortSignal:o.signal}),a=await Promise.race([new Promise((r=>{setTimeout((()=>{o.abort(),r(Error("Transaction confirmation timed out"))}),e)})),new Promise((async r=>{for await(let n of t){if(o.abort(),n.value.err)return r(Error("Transaction confirmation failed"));r(void 0)}}))]);if(a instanceof Error)throw a}function m({rpc:r,rpcSubscriptions:n,chain:o,blockExplorerUrl:t}){let a=function({rpc:r,rpcSubscriptions:n}){return async o=>new Promise((async(t,a)=>{try{let a=await r.sendTransaction(f(o).toString("base64"),{preflightCommitment:"confirmed",encoding:"base64"}).send();await p({rpcSubscriptions:n,signature:a,timeout:1e4}),t({signature:new Uint8Array(e().encode(a))})}catch(r){a(r)}}))}({rpc:r,rpcSubscriptions:n});return{rpc:r,rpcSubscriptions:n,chain:o,blockExplorerUrl:t,sendAndConfirmTransaction:a}}function d(){let r=a(),n=o((()=>Object.fromEntries(["solana:mainnet","solana:devnet","solana:testnet"].map((n=>[n,r.solanaRpcs[n]?m({chain:n,rpc:r.solanaRpcs[n].rpc,rpcSubscriptions:r.solanaRpcs[n].rpcSubscriptions,blockExplorerUrl:r.solanaRpcs[n].blockExplorerUrl??`https://explorer.solana.com?cluster=${n.replace("solana:","")}`}):null])))),[r.solanaRpcs]);return t((r=>{if(!n[r])throw Error(`No RPC configuration found for chain ${r}`);return n[r]}),[n])}export{c as a,f as b,l as f,m as g,u as s,d as u,p as w};
@@ -1 +1 @@
1
- import{g as e}from"./get-is-unified-wallet-j2fzd2YE.mjs";import{useContext as r,createContext as t}from"react";const a=e=>{if("ethereum"===e.chainType)return{entropyId:e.address,entropyIdVerifier:"ethereum-address-verifier"};if("solana"===e.chainType)return{entropyId:e.address,entropyIdVerifier:"solana-address-verifier"};throw Error("Failed to get account entropy details")},i=(r,t)=>{if(t?.imported)return a(t);let i=e(r);if(!i)throw Error("Failed to find primary wallet");return a(i)},o=/*#__PURE__*/t(null);function n(){let e=r(o);return null===e?(console.warn("`useWallets` was called outside the PrivyProvider component"),{wallets:[],ready:!1}):e}export{o as U,i as g,a as t,n as u};
1
+ import{g as e}from"./get-is-unified-wallet-Boa8DYrQ.mjs";import{useContext as r,createContext as t}from"react";const a=e=>{if("ethereum"===e.chainType)return{entropyId:e.address,entropyIdVerifier:"ethereum-address-verifier"};if("solana"===e.chainType)return{entropyId:e.address,entropyIdVerifier:"solana-address-verifier"};throw Error("Failed to get account entropy details")},i=(r,t)=>{if(t?.imported)return a(t);let i=e(r);if(!i)throw Error("Failed to find primary wallet");return a(i)},o=/*#__PURE__*/t(null);function n(){let e=r(o);return null===e?(console.warn("`useWallets` was called outside the PrivyProvider component"),{wallets:[],ready:!1}):e}export{o as U,i as g,a as t,n as u};