@privy-io/react-auth 2.11.1 → 2.12.0

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 (41) hide show
  1. package/dist/cjs/abstract-smart-wallets.js +1 -1
  2. package/dist/cjs/index.js +1 -1
  3. package/dist/cjs/privy-provider-WROKgGLv.js +28 -0
  4. package/dist/cjs/smart-wallets-BOO4AAyW.js +1 -0
  5. package/dist/cjs/smart-wallets.js +1 -1
  6. package/dist/cjs/solana.js +1 -1
  7. package/dist/cjs/ui.js +1 -1
  8. package/dist/cjs/{useActiveWallet-BJPtwRwN.js → useActiveWallet-jRYT06Mr.js} +1 -1
  9. package/dist/cjs/{useFundWallet-CHZEiRO4.js → useFundWallet-Cgo-Ct91.js} +1 -1
  10. package/dist/dts/farcaster.d.mts +1 -1
  11. package/dist/dts/farcaster.d.ts +1 -1
  12. package/dist/dts/index.d.mts +67 -39
  13. package/dist/dts/index.d.ts +67 -39
  14. package/dist/dts/smart-wallets.d.mts +1 -1
  15. package/dist/dts/smart-wallets.d.ts +1 -1
  16. package/dist/dts/solana.d.mts +113 -7
  17. package/dist/dts/solana.d.ts +113 -7
  18. package/dist/dts/{types-B6jqW_Bc.d.mts → types-Nqh9YCV3.d.mts} +6 -12
  19. package/dist/dts/{types-B6jqW_Bc.d.ts → types-Nqh9YCV3.d.ts} +6 -12
  20. package/dist/dts/ui.d.mts +1 -1
  21. package/dist/dts/ui.d.ts +1 -1
  22. package/dist/dts/{useSolanaWallets-DtHAHWtA.d.mts → useSolanaWallets-BSVQS05e.d.mts} +1 -1
  23. package/dist/dts/{useSolanaWallets-DtHAHWtA.d.ts → useSolanaWallets-BSVQS05e.d.ts} +1 -1
  24. package/dist/esm/abstract-smart-wallets.mjs +1 -1
  25. package/dist/esm/farcaster.mjs +1 -1
  26. package/dist/esm/{frame-BeG8p5X6.mjs → frame-B1kjU0LI.mjs} +1 -1
  27. package/dist/esm/index.mjs +1 -1
  28. package/dist/esm/{internal-context-eu0bC04Q.mjs → internal-context-lAHxpYRu.mjs} +1 -1
  29. package/dist/esm/privy-provider-CE4-s2JH.mjs +28 -0
  30. package/dist/esm/smart-wallets-C2dDEs0t.mjs +1 -0
  31. package/dist/esm/smart-wallets.mjs +1 -1
  32. package/dist/esm/solana.mjs +1 -1
  33. package/dist/esm/ui.mjs +2 -2
  34. package/dist/esm/useActiveWallet-B62Sy0KW.mjs +1 -0
  35. package/dist/esm/{useFundWallet-CCbN4yzN.mjs → useFundWallet-D2_dle4r.mjs} +1 -1
  36. package/package.json +6 -5
  37. package/dist/cjs/privy-provider-Cddj6OMJ.js +0 -28
  38. package/dist/cjs/smart-wallets-CyVw0HIK.js +0 -1
  39. package/dist/esm/privy-provider-B9IzlOpv.mjs +0 -28
  40. package/dist/esm/smart-wallets-D0LqwcPM.mjs +0 -1
  41. package/dist/esm/useActiveWallet-Cvm0O_EX.mjs +0 -1
@@ -0,0 +1 @@
1
+ import{useRef as e,useState as t,useCallback as r}from"react";import{http as n,createPublicClient as a}from"viem";import{n as i,f as s,at as o,u as l,l as c,m as d,t as u,a as p,aG as m,aF as y,aE as g}from"./privy-provider-CE4-s2JH.mjs";import{P as f,u as h}from"./internal-context-lAHxpYRu.mjs";import{g as w}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{createSmartAccountClient as P}from"permissionless";import{toThirdwebSmartAccount as I,toLightSmartAccount as v,toBiconomySmartAccount as F,toEcdsaKernelSmartAccount as W,toSafeSmartAccount as x}from"permissionless/accounts";import{createPimlicoClient as G}from"permissionless/clients/pimlico";import{toCoinbaseSmartAccount as C,entryPoint06Address as T,entryPoint07Address as U}from"viem/account-abstraction";import{THIRDWEB as M,COINBASE_SMART_WALLET as O,LIGHT_ACCOUNT as S,BICONOMY as b,KERNEL as A,SAFE as D}from"@privy-io/js-sdk-core";let V={address:T,version:"0.6"},N={address:U,version:"0.7"},_=({owner:e,smartWalletType:t,publicClient:r})=>{switch(t){case D:return x({client:r,entryPoint:N,owners:[e],version:"1.4.1"});case A:return W({client:r,version:"0.3.1",entryPoint:N,owners:[e]});case b:return F({client:r,owners:[e],entryPoint:V});case S:return v({client:r,entryPoint:V,owner:e,version:"1.1.0"});case O:return async function({client:e,owner:t}){let[r]=await t.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 t.request({method:"secp256k1_sign",params:[e]})}]})}({client:r,owner:e});case M:return I({client:r,entryPoint:N,owner:e});default:throw Error(`Invalid smart account type: ${t}.`)}};const B=({calls:e,chain:t,maxPriorityFeePerGas:r,maxFeePerGas:n,nonce:a})=>e.map((e=>({to:e.to||void 0,data:e.data,value:e.value,chainId:t.id,nonce:a,maxFeePerGas:n,maxPriorityFeePerGas:r}))),$=async({chain:e,paymasterContext:t,account:r,signer:s,user:o,smartWalletsConfig:l,rpcConfig:c,privyAppId:d})=>{if(!(l?.enabled&&o&&r&&s))return;let u=l?.configuredNetworks.find((t=>t.chainId===`eip155:${e.id}`));if(!u)throw new f(`The chain ${e.name} (eip155:${e.id}) must be configured in the smart wallet configuration in your dashboard`);let p=o.smartWallet?.smartWalletType??l.smartWalletType,m=i(e,c,d),y=a({chain:e,transport:n(m)}),g=t??u.paymasterContext,h=await(async({owner:e,smartWalletType:t,chain:r,publicClient:a,bundlerUrl:i,paymasterUrl:s,paymasterContext:o})=>{let l=await _({owner:e,smartWalletType:t,publicClient:a}),c=G({transport:n(i),entryPoint:l.entryPoint}),d=s?G({transport:n(s),entryPoint:l.entryPoint}):void 0;return P({account:l,chain:r,paymaster:d,paymasterContext:o,bundlerTransport:n(i),userOperation:{estimateFeesPerGas:async()=>{if(["public.pimlico.io","api.pimlico.io"].some((e=>i.includes(e))))return await c.getUserOperationGasPrice().then((e=>e.fast));if(["rpc.zerodev.app"].some((e=>i.includes(e))))return(await c.request({method:"zd_getUserOperationGasPrice",params:[]})).fast;if(["g.alchemy.com"].some((e=>i.includes(e)))){let[e,t]=await Promise.all([a.getBlock({blockTag:"latest"}),c.request({method:"rundler_maxPriorityFeePerGas",params:[]})]);if(!e.baseFeePerGas||!t)throw Error("Failed to get block or maxPriorityFeePerGasEstimate");return{maxFeePerGas:150n*e.baseFeePerGas/100n+BigInt(t.toString()),maxPriorityFeePerGas:BigInt(t.toString())}}{let e=await a.estimateFeesPerGas(),t=i.includes("api.developer.coinbase.com")?175n:150n;return{...e,maxFeePerGas:e.maxFeePerGas*t/100n,maxPriorityFeePerGas:e.maxPriorityFeePerGas*t/100n}}}}})})({owner:s,smartWalletType:p,chain:e,publicClient:y,paymasterContext:g,...u});if(!h)throw new f(`Failed to create smart wallet client for chain ${e.name} (eip155:${e.id})`);return h},q=({clientConfig:n,smartWalletsConfig:a})=>{let{hideWalletUIs:i,openPrivyModal:P,appId:I,isHeadlessSigning:v}=h(),F=s(),{setModalData:W}=o(),{user:x}=l(),{chains:G}=s(),{chainId:C,clients:T,setChainId:U,chainIdState:M}=(()=>{let r=e(),[n,a]=t();return{clients:e({}),setChainId:e=>{r.current=e,a(e)},chainId:r,chainIdState:n}})(),O=G.find((e=>e.id===M)),{wallets:S}=c(),b=d(x),A=w(S),D=!!b&&u(b),V=r((async()=>C.current),[C]),N=r((async({id:e})=>{if(!T.current[e]){let t=await $({chain:G.find((t=>t.id===e)),account:b,signer:await(A?.getEthereumProvider()),user:x,paymasterContext:n?.paymasterContext,smartWalletsConfig:a,rpcConfig:F.rpcConfig,privyAppId:I});t&&(T.current[e]=t)}U(e)}),[G,n,S,x,a]);return{wrapSmartAccountClient:e=>{T.current[e.chain.id]=e,M||U(e.chain.id);return{...e,sendTransaction:async(e,t)=>{let r=T.current[C.current];if(!r)throw new f(`Smart wallet client for chain (eip155:${C.current}) not found`);if(delete e.account,v({showWalletUIs:t?.uiOptions?.showWalletUIs}))return i.current=!0,await r.sendTransaction(e).finally((()=>i.current=!1));let n=[];"calls"in e&&void 0!==e.calls?n=[...e.calls]:"to"in e&&(n=[{to:e.to,value:e.value||BigInt(0),data:e.data||"0x"}]);let a=async()=>{let{paymasterAndData:t,paymasterData:a,maxFeePerGas:i,maxPriorityFeePerGas:s}=await r.prepareUserOperation({calls:n,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return 0===Number(i)&&0===Number(s)||Number(t??a??0)>0};return new Promise((async(s,o)=>{i.current=!0;let{entropyId:l,entropyIdVerifier:c}=p(x);W({connectWallet:{recoveryMethod:b.recoveryMethod,connectingWalletAddress:b.address,isUnifiedWallet:D,entropyId:l,entropyIdVerifier:c,onCompleteNavigateTo:m,onFailure:()=>{}},sendTransaction:{transactionRequests:B({calls:n,chain:r.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),transactingWalletIndex:0,transactingWalletAddress:r.account.address,entropyId:l,entropyIdVerifier:c,getIsSponsored:a,signOnly:!1,onConfirm:()=>r.sendTransaction(e),onSuccess:e=>s(e.hash),onFailure:o,uiOptions:t?.uiOptions??{}}}),P(y)})).finally((()=>{i.current=!1}))},signMessage:async(e,t)=>{let r=T.current[C.current];if(!r)throw new f(`Smart wallet client for chain (eip155:${C.current}) not found`);return v({showWalletUIs:t?.uiOptions?.showWalletUIs})?(i.current=!0,await r.signMessage(e).finally((()=>i.current=!1))):new Promise((async(n,a)=>{let{entropyId:s,entropyIdVerifier:o}=p(x);i.current=!0,W({connectWallet:{recoveryMethod:b.recoveryMethod,connectingWalletAddress:b.address,isUnifiedWallet:D,entropyId:s,entropyIdVerifier:o,onCompleteNavigateTo:g,onFailure:()=>{}},signMessage:{method:"personal_sign",data:"string"==typeof e.message?e.message:e.message.raw.toString(),confirmAndSign:()=>r.signMessage(e),onSuccess:e=>n(e),onFailure:a,uiOptions:t?.uiOptions??{}}}),P(y)})).finally((()=>{i.current=!1}))},signTypedData:async(e,t)=>{let r=T.current[C.current];if(!r)throw new f(`Smart wallet client for chain (eip155:${C.current}) not found`);return delete e.account,v({showWalletUIs:t?.uiOptions?.showWalletUIs})?(i.current=!0,await r.signTypedData(e).finally((()=>i.current=!1))):new Promise((async(n,a)=>{i.current=!0;let{entropyId:s,entropyIdVerifier:o}=p(x);W({connectWallet:{recoveryMethod:b.recoveryMethod,connectingWalletAddress:b.address,isUnifiedWallet:D,entropyId:s,entropyIdVerifier:o,onCompleteNavigateTo:g,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>r.signTypedData(e),onSuccess:e=>n(e),onFailure:a,uiOptions:t?.uiOptions??{}}}),P(y)})).finally((()=>{i.current=!1}))},getChainId:V,chain:O,switchChain:N}}}},E=()=>{let{hideWalletUIs:e,openPrivyModal:t,isHeadlessSigning:r}=h(),{setModalData:n}=o(),{user:a}=l(),i=d(a),s=!!i&&u(i);return{wrapSmartAccountClientWithUIs:o=>({...o,sendTransaction:async(l,c)=>{if(r({showWalletUIs:c?.uiOptions?.showWalletUIs}))return e.current=!0,await o.sendTransaction(l).finally((()=>e.current=!1));let d=[];"calls"in l&&void 0!==l.calls?d=[...l.calls]:"to"in l&&(d=[{to:l.to,value:l.value||BigInt(0),data:l.data||"0x"}]);let u=async()=>{if(!o.paymaster)return!1;let{paymasterAndData:e,paymasterData:t}=await o.prepareUserOperation({calls:d,maxFeePerGas:l.maxFeePerGas,maxPriorityFeePerGas:l.maxPriorityFeePerGas,nonce:l.nonce?BigInt(l.nonce):void 0});return Number(e??t??0)>0};return new Promise((async(r,g)=>{e.current=!0;let{entropyId:f,entropyIdVerifier:h}=p(a);n({connectWallet:{recoveryMethod:i.recoveryMethod,connectingWalletAddress:i.address,isUnifiedWallet:s,entropyId:f,entropyIdVerifier:h,onCompleteNavigateTo:m,onFailure:()=>{}},sendTransaction:{transactionRequests:B({calls:d,chain:o.chain,maxPriorityFeePerGas:l.maxPriorityFeePerGas,maxFeePerGas:l.maxFeePerGas,nonce:l.nonce?BigInt(l.nonce):void 0}),transactingWalletIndex:0,transactingWalletAddress:o.account.address,entropyId:f,entropyIdVerifier:h,getIsSponsored:u,signOnly:!1,onConfirm:()=>o.sendTransaction(l),onSuccess:e=>r(e.hash),onFailure:g,uiOptions:c?.uiOptions??{}}}),t(y)})).finally((()=>{e.current=!1}))},signMessage:async(l,c)=>r({showWalletUIs:c?.uiOptions?.showWalletUIs})?(e.current=!0,await o.signMessage(l).finally((()=>e.current=!1))):new Promise((async(r,d)=>{let{entropyId:u,entropyIdVerifier:m}=p(a);e.current=!0,n({connectWallet:{recoveryMethod:i.recoveryMethod,connectingWalletAddress:i.address,isUnifiedWallet:s,entropyId:u,entropyIdVerifier:m,onCompleteNavigateTo:g,onFailure:()=>{}},signMessage:{method:"personal_sign",data:"string"==typeof l.message?l.message:l.message.raw.toString(),confirmAndSign:()=>o.signMessage(l),onSuccess:e=>r(e),onFailure:d,uiOptions:c?.uiOptions??{}}}),t(y)})).finally((()=>{e.current=!1})),signTypedData:async(l,c)=>r({showWalletUIs:c?.uiOptions?.showWalletUIs})?(e.current=!0,await o.signTypedData(l).finally((()=>e.current=!1))):new Promise((async(r,d)=>{e.current=!0;let{entropyId:u,entropyIdVerifier:m}=p(a);n({connectWallet:{recoveryMethod:i.recoveryMethod,connectingWalletAddress:i.address,isUnifiedWallet:s,entropyId:u,entropyIdVerifier:m,onCompleteNavigateTo:g,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:l,confirmAndSign:()=>o.signTypedData(l),onSuccess:e=>r(e),onFailure:d,uiOptions:c?.uiOptions??{}}}),t(y)})).finally((()=>{e.current=!1}))})}};export{q as a,B as c,$ as g,E as u};
@@ -1 +1 @@
1
- import{jsx as o}from"react/jsx-runtime";import{useContext as e,useState as i,useEffect as r,createContext as t}from"react";import{f as n,l as c,u as a}from"./privy-provider-B9IzlOpv.mjs";import{u as l,P as s,n as m}from"./internal-context-eu0bC04Q.mjs";import{g as p}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{u as h,g as d,a as u}from"./smart-wallets-D0LqwcPM.mjs";import"mipd";import"react-device-detect";import"viem/utils";import"@privy-io/js-sdk-core";import"viem";import"uuid";import"jose";import"eventemitter3";import"@coinbase/wallet-sdk";import"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";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/ChevronDownIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"zustand";import"fast-password-entropy";import"secure-password-utilities";import"secure-password-utilities/wordlists";import"@heroicons/react/24/outline/UserCircleIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/20/solid/CheckIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import"@heroicons/react/24/solid/DocumentCheckIcon";import"@heroicons/react/24/solid/XCircleIcon";import"@heroicons/react/24/solid/CheckCircleIcon";import"qrcode";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/LockClosedIcon";import"@heroicons/react/24/outline/PencilSquareIcon";import"@heroicons/react/24/outline/ArrowPathIcon";import"@heroicons/react/24/outline/EyeIcon";import"@heroicons/react/24/outline/EyeSlashIcon";import"@heroicons/react/24/outline/KeyIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/LockClosedIcon";import"@heroicons/react/24/outline/CheckCircleIcon";import"@heroicons/react/24/outline/InformationCircleIcon";import"@heroicons/react/24/outline/CreditCardIcon";import"@heroicons/react/24/outline/QrCodeIcon";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";import"@heroicons/react/24/outline/GlobeAltIcon";import"ofetch";import"@heroicons/react/24/outline";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@heroicons/react/24/outline/CloudArrowUpIcon";import"@heroicons/react/24/outline/NoSymbolIcon";import"@heroicons/react/24/outline/ClockIcon";import"@heroicons/react/24/outline/TrashIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/solid/ShieldCheckIcon";import"js-cookie";import"permissionless";import"permissionless/accounts";import"permissionless/clients/pimlico";import"viem/account-abstraction";let C=/*#__PURE__*/t({client:void 0,getClientForChain:m});const g=({config:e,children:i})=>/*#__PURE__*/o(v,{children:/*#__PURE__*/o(y,{config:e,children:/*#__PURE__*/o(W,{children:i})})}),I=()=>{let{client:o,getClientForChain:i}=e(C);return{client:o,getClientForChain:i}};let f=/*#__PURE__*/t({config:void 0}),w=()=>{let{config:o}=e(f);return{config:o}},v=({children:e})=>{let[t,n]=i(void 0),{client:c}=l();return r((()=>{!t&&c&&(async()=>{try{if(!c)return void console.warn("No client found");let o=await c.getSmartWalletsConfig();n(o)}catch(o){console.warn("Error generating smart wallet config: ",o)}})()}),[!!c]),/*#__PURE__*/o(f.Provider,{value:{config:t},children:e})},y=({config:e,children:t})=>{let{config:m}=w(),{appId:u}=l(),{chains:C,defaultChain:g,rpcConfig:I}=n(),{wallets:f}=c(),{user:v}=a(),[y,W]=i(),{wrapSmartAccountClientWithUIs:b}=h(),S=p(f);r((()=>{(async()=>{if(!m?.enabled)return;let o=m.configuredNetworks.find((o=>o.chainId===`eip155:${g.id}`))?g:C.find((o=>m.configuredNetworks.map((o=>o.chainId)).includes(`eip155:${o.id}`)));if(!o)throw new s("Could not find smart wallets chain configurations for any Privy client configured chains. Please configure smart wallets for your chains in the Privy dashboard.");W(await d({chain:o,privyAppId:u,paymasterContext:e?.paymasterContext,rpcConfig:I,embeddedWallet:S,user:v,smartWalletsConfig:m}))})()}),[!!m?.enabled,!!v?.smartWallet,!!S]);/*#__PURE__*/return o(k.Provider,{value:{client:y,config:e,getClientForChain:async({id:o})=>{let i=p(f),r=await d({chain:C.find((e=>e.id===o)),privyAppId:u,paymasterContext:e?.paymasterContext,rpcConfig:I,embeddedWallet:i,user:v,smartWalletsConfig:m});if(!r)throw new s(`Failed to create smart wallet client for chain id: ${o}`);return b(r)}},children:t})},k=/*#__PURE__*/t({client:void 0,config:void 0,getClientForChain:m}),W=({children:i})=>{let{client:t,config:n,getClientForChain:c}=(()=>{let{client:o,config:i,getClientForChain:r}=e(k);return{client:o,config:i,getClientForChain:r}})(),{config:s}=w(),{wrapSmartAccountClient:m}=u({clientConfig:n,smartWalletsConfig:s}),{user:p}=a(),{generateSiweMessageForSmartWallet:h,linkSmartWallet:d,hideWalletUIs:g}=l();return r((()=>{(async()=>{if(t&&p&&!p?.smartWallet&&s?.enabled)try{let o=await h({address:t.account.address,chainId:`eip155:${t.chain.id}`});g.current=!0;let e=await t.signMessage({message:o});await d({signature:e,message:o,smartWalletType:s.smartWalletType})}catch(o){console.error("Error creating smart wallet:",o)}finally{g.current=!1}})()}),[!!t,!!p?.smartWallet,!!s?.enabled]),/*#__PURE__*/o(C.Provider,{value:{client:p?.smartWallet&&t?m(t):void 0,getClientForChain:c},children:i})};export{g as SmartWalletsProvider,I as useSmartWallets};
1
+ import{jsx as o}from"react/jsx-runtime";import{useContext as e,useState as i,useEffect as r,createContext as t}from"react";import{f as n,l as c,u as a,m as l}from"./privy-provider-CE4-s2JH.mjs";import{u as s,P as m,b as p}from"./internal-context-lAHxpYRu.mjs";import{g as h}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{u,g as d,a as g}from"./smart-wallets-C2dDEs0t.mjs";import"mipd";import"react-device-detect";import"viem/utils";import"@privy-io/js-sdk-core";import"viem";import"uuid";import"jose";import"eventemitter3";import"@coinbase/wallet-sdk";import"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";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/ChevronDownIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"zustand";import"fast-password-entropy";import"secure-password-utilities";import"secure-password-utilities/wordlists";import"@heroicons/react/24/outline/UserCircleIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/20/solid/CheckIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import"@heroicons/react/24/solid/DocumentCheckIcon";import"@heroicons/react/24/solid/XCircleIcon";import"@heroicons/react/24/solid/CheckCircleIcon";import"qrcode";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/LockClosedIcon";import"@heroicons/react/24/outline/PencilSquareIcon";import"@heroicons/react/24/outline/ArrowPathIcon";import"@heroicons/react/24/outline/EyeIcon";import"@heroicons/react/24/outline/EyeSlashIcon";import"@heroicons/react/24/outline/KeyIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/LockClosedIcon";import"@heroicons/react/24/outline/CheckCircleIcon";import"@heroicons/react/24/outline/InformationCircleIcon";import"@heroicons/react/24/outline/CreditCardIcon";import"@heroicons/react/24/outline/QrCodeIcon";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";import"@heroicons/react/24/outline/GlobeAltIcon";import"ofetch";import"@heroicons/react/24/outline";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@heroicons/react/24/outline/CloudArrowUpIcon";import"@heroicons/react/24/outline/NoSymbolIcon";import"@heroicons/react/24/outline/ClockIcon";import"@heroicons/react/24/outline/TrashIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/solid/ShieldCheckIcon";import"js-cookie";import"permissionless";import"permissionless/accounts";import"permissionless/clients/pimlico";import"viem/account-abstraction";let C=/*#__PURE__*/t({client:void 0,getClientForChain:p});const I=({config:e,children:i})=>/*#__PURE__*/o(y,{children:/*#__PURE__*/o(k,{config:e,children:/*#__PURE__*/o(b,{children:i})})}),f=()=>{let{client:o,getClientForChain:i}=e(C);return{client:o,getClientForChain:i}};let w=/*#__PURE__*/t({config:void 0}),v=()=>{let{config:o}=e(w);return{config:o}},y=({children:e})=>{let[t,n]=i(void 0),{client:c}=s();return r((()=>{!t&&c&&(async()=>{try{if(!c)return void console.warn("No client found");let o=await c.getSmartWalletsConfig();n(o)}catch(o){console.warn("Error generating smart wallet config: ",o)}})()}),[!!c]),/*#__PURE__*/o(w.Provider,{value:{config:t},children:e})},k=({config:e,children:t})=>{let{config:p}=v(),{appId:g}=s(),{chains:C,defaultChain:I,rpcConfig:f}=n(),{wallets:w}=c(),{user:y}=a(),[k,b]=i(),{wrapSmartAccountClientWithUIs:P}=u(),S=l(y),A=h(w);r((()=>{(async()=>{if(!p?.enabled)return;let o=p.configuredNetworks.find((o=>o.chainId===`eip155:${I.id}`))?I:C.find((o=>p.configuredNetworks.map((o=>o.chainId)).includes(`eip155:${o.id}`)));if(!o)throw new m("Could not find smart wallets chain configurations for any Privy client configured chains. Please configure smart wallets for your chains in the Privy dashboard.");b(await d({chain:o,privyAppId:g,paymasterContext:e?.paymasterContext,rpcConfig:f,account:S,signer:await(A?.getEthereumProvider()),user:y,smartWalletsConfig:p}))})()}),[!!p?.enabled,!!y?.smartWallet,!!A,!!S]);/*#__PURE__*/return o(W.Provider,{value:{client:k,config:e,getClientForChain:async({id:o})=>{let i=await d({chain:C.find((e=>e.id===o)),privyAppId:g,paymasterContext:e?.paymasterContext,rpcConfig:f,account:S,signer:await(A?.getEthereumProvider()),user:y,smartWalletsConfig:p});if(!i)throw new m(`Failed to create smart wallet client for chain id: ${o}`);return P(i)}},children:t})},W=/*#__PURE__*/t({client:void 0,config:void 0,getClientForChain:p}),b=({children:i})=>{let{client:t,config:n,getClientForChain:c}=(()=>{let{client:o,config:i,getClientForChain:r}=e(W);return{client:o,config:i,getClientForChain:r}})(),{config:l}=v(),{wrapSmartAccountClient:m}=g({clientConfig:n,smartWalletsConfig:l}),{user:p}=a(),{generateSiweMessageForSmartWallet:h,linkSmartWallet:u,hideWalletUIs:d}=s();return r((()=>{(async()=>{if(t&&p&&!p?.smartWallet&&l?.enabled)try{let o=await h({address:t.account.address,chainId:`eip155:${t.chain.id}`});d.current=!0;let e=await t.signMessage({message:o});await u({signature:e,message:o,smartWalletType:l.smartWalletType})}catch(o){console.error("Error creating smart wallet:",o)}finally{d.current=!1}})()}),[!!t,!!p?.smartWallet,!!l?.enabled]),/*#__PURE__*/o(C.Provider,{value:{client:p?.smartWallet&&t?m(t):void 0,getClientForChain:c},children:i})};export{I as SmartWalletsProvider,f as useSmartWallets};
@@ -1 +1 @@
1
- import{isWalletAdapterCompatibleStandardWallet as o}from"@solana/wallet-adapter-base";import{StandardWalletAdapter as e}from"@solana/wallet-standard-wallet-adapter-base";import{getWallets as r}from"@wallet-standard/app";import{ak as t,u as i,h as n,al as c,am as a,f as s,x as l,an as p,b as m,ao as h}from"./privy-provider-B9IzlOpv.mjs";export{ap as useSendTransaction,aq as useSignMessage,L as useSolanaWallets}from"./privy-provider-B9IzlOpv.mjs";import{useCallback as d}from"react";import{u as I}from"./internal-context-eu0bC04Q.mjs";import{t as C}from"./useFundWallet-CCbN4yzN.mjs";export{u as useFundWallet}from"./useFundWallet-CCbN4yzN.mjs";import"react/jsx-runtime";import"mipd";import"react-device-detect";import"viem/utils";import"@privy-io/js-sdk-core";import"viem";import"uuid";import"jose";import"eventemitter3";import"@coinbase/wallet-sdk";import"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";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/ChevronDownIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"zustand";import"fast-password-entropy";import"secure-password-utilities";import"secure-password-utilities/wordlists";import"@heroicons/react/24/outline/UserCircleIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/20/solid/CheckIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import"@heroicons/react/24/solid/DocumentCheckIcon";import"@heroicons/react/24/solid/XCircleIcon";import"@heroicons/react/24/solid/CheckCircleIcon";import"qrcode";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/LockClosedIcon";import"@heroicons/react/24/outline/PencilSquareIcon";import"@heroicons/react/24/outline/ArrowPathIcon";import"@heroicons/react/24/outline/EyeIcon";import"@heroicons/react/24/outline/EyeSlashIcon";import"@heroicons/react/24/outline/KeyIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/LockClosedIcon";import"@heroicons/react/24/outline/CheckCircleIcon";import"@heroicons/react/24/outline/InformationCircleIcon";import"@heroicons/react/24/outline/CreditCardIcon";import"@heroicons/react/24/outline/QrCodeIcon";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";import"@heroicons/react/24/outline/GlobeAltIcon";import"ofetch";import"@heroicons/react/24/outline";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@heroicons/react/24/outline/CloudArrowUpIcon";import"@heroicons/react/24/outline/NoSymbolIcon";import"@heroicons/react/24/outline/ClockIcon";import"@heroicons/react/24/outline/TrashIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/solid/ShieldCheckIcon";import"js-cookie";import"@solana/spl-token";import"@solana/web3.js";const g=o=>{let e,{get:i,on:n}=r(),c=o?.shouldAutoConnect??!0,a=[],s=[];function l(...o){s=(a=a.concat(...w(o))).map((o=>new t(o,c))),e?.(s)}function p(...o){s=(a=a.filter((e=>o.some((o=>e.wallet===o))))).map((o=>new t(o,c))),e?.(s)}let m=[n("register",l),n("unregister",p)];return s=(a=w(i())).map((o=>new t(o,c))),{_setOnConnectorsUpdated:o=>{e=o},onMount:()=>{m[0]||(m[0]=n("register",l)),m[1]||(m[1]=n("unregister",p))},onUnmount:()=>{let o=m.pop();for(;o;)o(),o=m.pop()},get:()=>s}};let w=r=>r.filter(o).map((o=>new e({wallet:o})));const v=()=>{let{getAccessToken:o,user:e}=i(),{refreshSessionAndUser:r,initializeWalletProxy:t}=I(),a=n();return{importWallet:d((({privateKey:i})=>c({getAccessToken:o,user:e,initializeWalletProxy:t,refreshSessionAndUser:r,emitPrivyEvent:a},{privateKey:i,chainType:"solana"})),[e,o,r,t,a])}};var y=()=>a(C);function f(o){let e=s(),{getAccessToken:r,user:t}=l(),{setModalData:i}=p(),{isHeadlessSigning:c,openModal:a,walletProxy:u,recoverPrimaryWallet:d,privy:C}=I(),g=n();return m("signSolanaTransaction",o),{signTransaction:async({transaction:o,connection:n,uiOptions:s,transactionOptions:l,address:p})=>{let{signedTransaction:m}=await h({privy:C,appConfig:e,getAccessToken:r,isHeadlessSigning:c,emitPrivyEvent:g,setModalData:i,openModal:a,walletProxy:u,user:t,recoverPrimaryWallet:d},{transaction:o,connection:n,transactionOptions:l,uiOptions:s,address:p,signOnly:!0});return m}}}export{t as SolanaAdapterConnector,g as toSolanaWalletConnectors,v as useImportWallet,f as useSignTransaction,y as useSolanaFundingPlugin};
1
+ import{isWalletAdapterCompatibleStandardWallet as e}from"@solana/wallet-adapter-base";import{StandardWalletAdapter as t}from"@solana/wallet-standard-wallet-adapter-base";import{getWallets as n}from"@wallet-standard/app";import{aq as i,u as o,h as r,ar as s,as as a,f as c,F as l,at as p,q as d,b as h,au as m,l as g,av as A,aw as v,ax as w,ay as y,az as f}from"./privy-provider-CE4-s2JH.mjs";export{S as useSolanaWallets}from"./privy-provider-CE4-s2JH.mjs";import{useCallback as I,useMemo as b,useEffect as T}from"react";import{u as j,n as C}from"./internal-context-lAHxpYRu.mjs";import{VersionedTransaction as P,Connection as O}from"@solana/web3.js";import _ from"eventemitter3";import{base58 as M}from"@scure/base";import{t as k}from"./useFundWallet-D2_dle4r.mjs";export{u as useFundWallet}from"./useFundWallet-D2_dle4r.mjs";import"react/jsx-runtime";import"mipd";import"react-device-detect";import"viem/utils";import"@privy-io/js-sdk-core";import"viem";import"uuid";import"jose";import"@coinbase/wallet-sdk";import"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";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/ChevronDownIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"zustand";import"fast-password-entropy";import"secure-password-utilities";import"secure-password-utilities/wordlists";import"@heroicons/react/24/outline/UserCircleIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/20/solid/CheckIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import"@heroicons/react/24/solid/DocumentCheckIcon";import"@heroicons/react/24/solid/XCircleIcon";import"@heroicons/react/24/solid/CheckCircleIcon";import"qrcode";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/LockClosedIcon";import"@heroicons/react/24/outline/PencilSquareIcon";import"@heroicons/react/24/outline/ArrowPathIcon";import"@heroicons/react/24/outline/EyeIcon";import"@heroicons/react/24/outline/EyeSlashIcon";import"@heroicons/react/24/outline/KeyIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/LockClosedIcon";import"@heroicons/react/24/outline/CheckCircleIcon";import"@heroicons/react/24/outline/InformationCircleIcon";import"@heroicons/react/24/outline/CreditCardIcon";import"@heroicons/react/24/outline/QrCodeIcon";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";import"@heroicons/react/24/outline/GlobeAltIcon";import"ofetch";import"@heroicons/react/24/outline";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@heroicons/react/24/outline/CloudArrowUpIcon";import"@heroicons/react/24/outline/NoSymbolIcon";import"@heroicons/react/24/outline/ClockIcon";import"@heroicons/react/24/outline/TrashIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/solid/ShieldCheckIcon";import"js-cookie";import"@solana/spl-token";const E=e=>{let t,{get:o,on:r}=n(),s=e?.shouldAutoConnect??!0,a=[],c=[];function l(...e){c=(a=a.concat(...B(e))).map((e=>new i(e,s))),t?.(c)}function u(...e){c=(a=a.filter((t=>e.some((e=>t.wallet===e))))).map((e=>new i(e,s))),t?.(c)}let p=[r("register",l),r("unregister",u)];return c=(a=B(o())).map((e=>new i(e,s))),{_setOnConnectorsUpdated:e=>{t=e},onMount:()=>{p[0]||(p[0]=r("register",l)),p[1]||(p[1]=r("unregister",u))},onUnmount:()=>{let e=p.pop();for(;e;)e(),e=p.pop()},get:()=>c}};let B=n=>n.filter(e).map((e=>new t({wallet:e})));const D=()=>{let{getAccessToken:e,user:t}=o(),{refreshSessionAndUser:n,initializeWalletProxy:i}=j(),a=r();return{importWallet:I((({privateKey:o})=>s({getAccessToken:e,user:t,initializeWalletProxy:i,refreshSessionAndUser:n,emitPrivyEvent:a},{privateKey:o,chainType:"solana"})),[t,e,n,i,a])}},F=["solana:mainnet","solana:devnet","solana:testnet"];function x(e){switch(e){case"solana:mainnet":return"mainnet-beta";case"solana:devnet":return"devnet";case"solana:testnet":return"testnet";default:throw Error(`Unknown chain: ${e}`)}}function U(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var Q=0,W="__private_"+Q+++"__implementation";function K(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var R=0;function z(e){return"__private_"+R+++"_"+e}var G=/*#__PURE__*/z("_address"),J=/*#__PURE__*/z("_publicKey"),V=/*#__PURE__*/z("_chains"),Y=/*#__PURE__*/z("_features"),q=/*#__PURE__*/z("_label"),Z=/*#__PURE__*/z("_icon");class H{get address(){return K(this,G)[G]}get publicKey(){return K(this,J)[J].slice()}get chains(){return K(this,V)[V].slice()}get features(){return K(this,Y)[Y].slice()}get label(){return K(this,q)[q]}get icon(){return K(this,Z)[Z]}constructor({address:e,publicKey:t,label:n,icon:i}){Object.defineProperty(this,G,{writable:!0,value:void 0}),Object.defineProperty(this,J,{writable:!0,value:void 0}),Object.defineProperty(this,V,{writable:!0,value:void 0}),Object.defineProperty(this,Y,{writable:!0,value:void 0}),Object.defineProperty(this,q,{writable:!0,value:void 0}),Object.defineProperty(this,Z,{writable:!0,value:void 0}),K(this,G)[G]=e,K(this,J)[J]=t,K(this,V)[V]=F,K(this,q)[q]=n,K(this,Z)[Z]=i,K(this,Y)[Y]=["solana:signAndSendTransaction","solana:signTransaction","solana:signMessage"],new.target===H&&Object.freeze(this)}}function L(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var N=0;function X(e){return"__private_"+N+++"_"+e}var $=/*#__PURE__*/X("_listeners"),ee=/*#__PURE__*/X("_version"),te=/*#__PURE__*/X("_name"),ne=/*#__PURE__*/X("_icon"),ie=/*#__PURE__*/X("_injection"),oe=/*#__PURE__*/X("_accounts"),re=/*#__PURE__*/X("_on"),se=/*#__PURE__*/X("_emit"),ae=/*#__PURE__*/X("_off"),ce=/*#__PURE__*/X("_connected"),le=/*#__PURE__*/X("_connect"),ue=/*#__PURE__*/X("_disconnect"),pe=/*#__PURE__*/X("_signMessage"),de=/*#__PURE__*/X("_signAndSendTransaction"),he=/*#__PURE__*/X("_signTransaction");function me(e,...t){L(this,$)[$][e]?.forEach((e=>e.apply(null,t)))}function ge(e,t){L(this,$)[$][e]=L(this,$)[$][e]?.filter((e=>t!==e))}function Ae(e){let t=c(),{getAccessToken:n,user:i}=l(),{setModalData:o}=p(),{isHeadlessSigning:s,openModal:a,walletProxy:u,recoverPrimaryWallet:g,privy:A}=j(),v=r(),{signWithUserSigner:w}=d();return h("signSolanaTransaction",e),{signTransaction:async({transaction:e,connection:r,uiOptions:c,transactionOptions:l,address:p})=>{let{signedTransaction:d}=await m({privy:A,appConfig:t,getAccessToken:n,isHeadlessSigning:s,emitPrivyEvent:v,setModalData:o,openModal:a,walletProxy:u,user:i,recoverPrimaryWallet:g,signWithUserSigner:w},{transaction:e,connection:r,transactionOptions:l,uiOptions:c,address:p,signOnly:!0});return d}}}let ve=new class extends _{setImplementation(e){U(this,W)[W]=e}async signMessage(e,t){return U(this,W)[W].signMessage(e,t)}async signAndSendTransaction(e,t,n,i){return U(this,W)[W].signAndSendTransaction(e,t,n,i)}async signTransaction(e,t,n,i){return U(this,W)[W].signTransaction(e,t,n,i)}constructor(e){super(),Object.defineProperty(this,W,{writable:!0,value:void 0}),U(this,W)[W]=e}}({signTransaction:C("signTransaction was not injected"),signAndSendTransaction:C("signAndSendTransaction was not injected"),signMessage:C("signMessage was not injected")}),we=new class{get version(){return L(this,ee)[ee]}get name(){return L(this,te)[te]}get icon(){return L(this,ne)[ne]}get chains(){return F.slice()}get features(){return{"standard:connect":{version:"1.0.0",connect:L(this,le)[le]},"standard:disconnect":{version:"1.0.0",disconnect:L(this,ue)[ue]},"standard:events":{version:"1.0.0",on:L(this,re)[re]},"solana:signAndSendTransaction":{version:"1.0.0",supportedTransactionVersions:["legacy",0],signAndSendTransaction:L(this,de)[de]},"solana:signTransaction":{version:"1.0.0",supportedTransactionVersions:["legacy",0],signTransaction:L(this,he)[he]},"solana:signMessage":{version:"1.0.0",signMessage:L(this,pe)[pe]},"privy:":{privy:{signMessage:L(this,ie)[ie].signMessage,signTransaction:L(this,ie)[ie].signTransaction,signAndSendTransaction:L(this,ie)[ie].signAndSendTransaction}}}}get accounts(){return L(this,oe)[oe].slice()}constructor({name:e,icon:t,version:n,injection:i,wallets:o}){Object.defineProperty(this,se,{value:me}),Object.defineProperty(this,ae,{value:ge}),Object.defineProperty(this,$,{writable:!0,value:void 0}),Object.defineProperty(this,ee,{writable:!0,value:void 0}),Object.defineProperty(this,te,{writable:!0,value:void 0}),Object.defineProperty(this,ne,{writable:!0,value:void 0}),Object.defineProperty(this,ie,{writable:!0,value:void 0}),Object.defineProperty(this,oe,{writable:!0,value:void 0}),Object.defineProperty(this,re,{writable:!0,value:void 0}),Object.defineProperty(this,ce,{writable:!0,value:void 0}),Object.defineProperty(this,le,{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,de,{writable:!0,value:void 0}),Object.defineProperty(this,he,{writable:!0,value:void 0}),L(this,$)[$]={},L(this,re)[re]=(e,t)=>(L(this,$)[$][e]?.push(t)||(L(this,$)[$][e]=[t]),()=>L(this,ae)[ae](e,t)),L(this,ce)[ce]=e=>{null!=e&&(L(this,oe)[oe]=e.map((({address:e})=>new H({address:e,publicKey:M.decode(e)})))),L(this,se)[se]("change",{accounts:this.accounts})},L(this,le)[le]=async()=>(L(this,se)[se]("change",{accounts:this.accounts}),{accounts:this.accounts}),L(this,ue)[ue]=async()=>{L(this,se)[se]("change",{accounts:this.accounts})},L(this,pe)[pe]=async(...e)=>{let t=[];for(let{message:n,account:i}of e){let{signature:e}=await L(this,ie)[ie].signMessage(n,i.address);t.push({signedMessage:n,signature:e})}return t},L(this,de)[de]=async(...e)=>{let t=[];for(let{transaction:n,account:i,options:o,chain:r}of e){let{signature:e}=await L(this,ie)[ie].signAndSendTransaction(P.deserialize(n),i.address,x(r||"solana:mainnet"),o);t.push({signature:M.decode(e)})}return t},L(this,he)[he]=async(...e)=>{let t=[];for(let{transaction:n,account:i,options:o,chain:r}of e){let e=await L(this,ie)[ie].signTransaction(P.deserialize(n),i.address,x(r||"solana:mainnet"),o),s=a(e)?e.serialize():new Uint8Array(e.serialize({requireAllSignatures:!1,verifySignatures:!1}));t.push({signedTransaction:s})}return t},L(this,te)[te]=e,L(this,ne)[ne]=t,L(this,ee)[ee]=n,L(this,ie)[ie]=i,L(this,oe)[oe]=[],i.on("accountChanged",L(this,ce)[ce],this),L(this,ce)[ce](o)}}({name:"Privy",version:"1.0.0",icon:"data:image/png;base64,AAABAAEAFBQAAAAAIABlAQAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAAUAAAAFAgGAAAAjYkdDQAAAAlwSFlzAAAOwwAADsMBx2+oZAAAAQVJREFUeJxiYMANZIC4E4ivAPFPIP4FxDeAuB+IlfDowwBMQFwJxF+B+D8O/AOI66Bq8QJGIF6ExyB0vAqImfEZmEeCYTDcgMswPiB+T4aB34FYApuBsWQYBsP52AycToGBK7EZuJECAw9jM3AVBQbuwWZgIwUGTsZmoDkFBnpiMxAEjpJh2FV8iVsbiD+TYBgoDVrgMgwGnID4HRGGgTKBGyHDYEAaiBdCSxh0g/5AU4Q8sYYhAzEgjoGmABBOgFo2eACowFABYn0oVgViAVINkQTiZUD8DIj/ATF6GILEXgLxCiCWIsZAbiAuBeKtQHwHiEHJ6C8UfwHie0C8E4jLoWpRAAAAAP//rcbhsQAAAAZJREFUAwBYFs3VKJ0cuQAAAABJRU5ErkJggg==",wallets:[],injection:ve});function ye(){let{solanaClusters:e}=c(),{ready:t}=g(),{user:n}=l(),{signMessage:i}=A(),{signTransaction:o}=Ae(),{sendTransaction:r}=v(),s=b((()=>{let e=[...w(n).sort(((e,t)=>(e.walletIndex??0)-(t.walletIndex??0)))],t=y(n);return t?[...e,t]:e}),[n]),a=b((()=>({signMessage:async(e,t)=>({signature:await i({message:e,options:{address:t}})}),async signTransaction(t,n,i){let r=new O(e[i].rpcUrl);return await o({transaction:t,address:n,connection:r})},async signAndSendTransaction(t,n,i,o){let s=new O(e[i].rpcUrl),{signature:a}=await r({transaction:t,connection:s,address:n,transactionOptions:o});return{signature:a}}})),[i,o,r,e]);return T((()=>{ve?.setImplementation(a)}),[a]),T((()=>{var e;!t||(e=we.accounts).length===s.length&&e.every(((e,t)=>e.address===s[t]?.address))||ve?.emit("accountChanged",s)}),[t,s]),{ready:t,wallet:we}}var fe=()=>f(k);export{i as SolanaAdapterConnector,E as toSolanaWalletConnectors,D as useImportWallet,ye as usePrivyStandardWallet,v as useSendTransaction,A as useSignMessage,Ae as useSignTransaction,fe as useSolanaFundingPlugin};