1import "./chunk-GABYCIRX.js"; 2import "./chunk-GWTLZPQW.js"; 3import "./chunk-TUIXK4GB.js"; 4import "./chunk-2SIOJVPY.js"; 5import "./chunk-DELSWSYH.js"; 6import { 7 G 8} from "./chunk-F6HKBNBJ.js"; 9import "./chunk-EFX7LFQF.js"; 10import { 11 Ze 12} from "./chunk-GW6OWVAS.js"; 13import "./chunk-V3VQYMUU.js"; 14import "./chunk-WAY6HQ7C.js"; 15import "./chunk-KAIIOKO3.js"; 16import "./chunk-F7LOI2M5.js"; 17import "./chunk-GWCOH4DF.js"; 18import "./chunk-FUATFXFK.js"; 19import "./chunk-55ARO2SJ.js"; 20import "./chunk-J46SIAYM.js"; 21import "./chunk-EUVCRAFR.js"; 22import "./chunk-5HUKUZMX.js"; 23import "./chunk-DRQXJS52.js"; 24import "./chunk-EKGTQN7B.js"; 25import "./chunk-57LJOLTQ.js"; 26import "./chunk-QOAWOBZZ.js"; 27import "./chunk-CXC3RFJP.js"; 28import "./chunk-LOYGATPO.js"; 29import "./chunk-MWZBDUVS.js"; 30import "./chunk-IVTAVDWF.js"; 31import { 32 require_react 33} from "./chunk-2TKNTQO7.js"; 34import { 35 __toESM, 36 init_buffer_shim 37} from "./chunk-DMHST2WB.js"; 38 39// ../VeeFriends.Web.Www.Components/React/PrivyFundWallet.tsx 40init_buffer_shim(); 41var React = __toESM(require_react()); 42var PrivyFundWallet = (props) => { 43 const { ready, authenticated, user } = G(); 44 const { fundWallet } = Ze(); 45 const { dotNetRef } = props; 46 const handleFundWallet = React.useCallback(async (options) => { 47 if (!authenticated) { 48 dotNetRef.invokeMethodAsync( 49 "OnEventCallback", 50 JSON.stringify({ 51 type: "error", 52 message: "You must be logged in to fund your wallet" 53 }) 54 ); 55 return; 56 } 57 const embeddedWallets = user?.linkedAccounts.filter( 58 (account) => account.type === "wallet" && account.walletClientType === "privy" && account.chainType === "ethereum" 59 ).sort((a, b) => (a.first_verified_at || 0) - (b.first_verified_at || 0)); 60 const embeddedWallet = embeddedWallets?.[0]; 61 if (!embeddedWallet) { 62 dotNetRef.invokeMethodAsync( 63 "OnEventCallback", 64 JSON.stringify({ 65 type: "error", 66 message: "No embedded wallet found" 67 }) 68 ); 69 return; 70 } 71 try { 72 await fundWallet({ 73 address: options?.address || embeddedWallet.address, 74 ...options?.asset && { asset: options.asset }, 75 ...options?.chain && { chain: options.chain }, 76 ...options?.amount && { amount: options.amount } 77 }); 78 dotNetRef.invokeMethodAsync( 79 "OnEventCallback", 80 JSON.stringify({ 81 type: "fund_wallet_opened", 82 address: options?.address || embeddedWallet.address 83 }) 84 ); 85 } catch (error) { 86 dotNetRef.invokeMethodAsync( 87 "OnEventCallback", 88 JSON.stringify({ 89 type: "error", 90 message: error.message || "Failed to open fund wallet modal" 91 }) 92 ); 93 } 94 }, [authenticated, user, fundWallet, dotNetRef]); 95 const checkWalletStatus = React.useCallback(() => { 96 const embeddedWallet = user?.linkedAccounts.find( 97 (account) => account.type === "wallet" && account.walletClientType === "privy" && account.chainType === "ethereum" 98 ); 99 dotNetRef.invokeMethodAsync( 100 "OnEventCallback", 101 JSON.stringify({ 102 type: "wallet_status", 103 authenticated, 104 hasEmbeddedWallet: !!embeddedWallet, 105 walletAddress: embeddedWallet?.address || null 106 }) 107 ); 108 }, [authenticated, user, dotNetRef]); 109 React.useEffect(() => { 110 window.fundWalletManager = { 111 fundWallet: handleFundWallet, 112 checkWalletStatus 113 }; 114 if (dotNetRef && ready) { 115 dotNetRef.invokeMethodAsync("OnEventCallback", JSON.stringify({ 116 type: "ready" 117 })); 118 } 119 if (ready) { 120 checkWalletStatus(); 121 } 122 return () => { 123 delete window.fundWalletManager; 124 }; 125 }, [handleFundWallet, checkWalletStatus, dotNetRef, ready]); 126 return null; 127}; 128var PrivyFundWallet_default = PrivyFundWallet; 129export { 130 PrivyFundWallet_default as default 131}; 132//# sourceMappingURL=PrivyFundWallet.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.