@privy-io/react-auth 2.17.3 → 2.18.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 (48) hide show
  1. package/dist/cjs/abstract-smart-wallets.js +1 -1
  2. package/dist/cjs/extended-chains.js +1 -1
  3. package/dist/cjs/farcaster.js +1 -1
  4. package/dist/cjs/index.js +1 -1
  5. package/dist/cjs/internal-context-Uge-4WDr.js +1 -0
  6. package/dist/cjs/privy-provider-DuC0A2fF.js +29 -0
  7. package/dist/cjs/{smart-wallets-C5OETWB3.js → smart-wallets-Cmfk2YVq.js} +1 -1
  8. package/dist/cjs/smart-wallets.js +1 -1
  9. package/dist/cjs/solana.js +1 -1
  10. package/dist/cjs/ui.js +1 -1
  11. package/dist/cjs/{use-sign-with-user-signer-CpEHKe74.js → use-sign-with-user-signer-BrJ6QN6E.js} +1 -1
  12. package/dist/cjs/{useActiveWallet-C_wN_Vtk.js → useActiveWallet-C6pJYZ4P.js} +1 -1
  13. package/dist/cjs/{useFundWallet-D7jsZQgJ.js → useFundWallet-cWxux3fW.js} +1 -1
  14. package/dist/dts/extended-chains.d.mts +1 -1
  15. package/dist/dts/extended-chains.d.ts +1 -1
  16. package/dist/dts/farcaster.d.mts +1 -1
  17. package/dist/dts/farcaster.d.ts +1 -1
  18. package/dist/dts/index.d.mts +68 -7
  19. package/dist/dts/index.d.ts +68 -7
  20. package/dist/dts/smart-wallets.d.mts +1 -1
  21. package/dist/dts/smart-wallets.d.ts +1 -1
  22. package/dist/dts/solana.d.mts +4 -4
  23. package/dist/dts/solana.d.ts +4 -4
  24. package/dist/dts/{types-C750flIl.d.mts → types-cSndhqyV.d.mts} +6 -2
  25. package/dist/dts/{types-C750flIl.d.ts → types-cSndhqyV.d.ts} +6 -2
  26. package/dist/dts/ui.d.mts +1 -1
  27. package/dist/dts/ui.d.ts +1 -1
  28. package/dist/dts/{useSolanaWallets-BMH597gE.d.mts → useSolanaWallets-BGaZqngA.d.mts} +1 -1
  29. package/dist/dts/{useSolanaWallets-BMH597gE.d.ts → useSolanaWallets-BGaZqngA.d.ts} +1 -1
  30. package/dist/esm/abstract-smart-wallets.mjs +1 -1
  31. package/dist/esm/extended-chains.mjs +1 -1
  32. package/dist/esm/farcaster.mjs +1 -1
  33. package/dist/esm/index.mjs +1 -1
  34. package/dist/esm/internal-context-BzsB315R.mjs +1 -0
  35. package/dist/esm/privy-provider-D3Bw8K9z.mjs +29 -0
  36. package/dist/esm/{smart-wallets-DJW4A6lN.mjs → smart-wallets-BHAJajS8.mjs} +1 -1
  37. package/dist/esm/smart-wallets.mjs +1 -1
  38. package/dist/esm/solana.mjs +1 -1
  39. package/dist/esm/ui.mjs +2 -2
  40. package/dist/esm/{use-sign-with-user-signer-C3vxQSbq.mjs → use-sign-with-user-signer-C21K9CRz.mjs} +1 -1
  41. package/dist/esm/useActiveWallet-Dic5bVzH.mjs +1 -0
  42. package/dist/esm/{useFundWallet-Biyv49Yj.mjs → useFundWallet-BP5Qli7y.mjs} +1 -1
  43. package/package.json +4 -4
  44. package/dist/cjs/internal-context-vhWXhsPy.js +0 -1
  45. package/dist/cjs/privy-provider-DJSBO1cS.js +0 -28
  46. package/dist/esm/internal-context-De1jxnac.mjs +0 -1
  47. package/dist/esm/privy-provider-C8x4T-HJ.mjs +0 -28
  48. package/dist/esm/useActiveWallet-DTVla7H-.mjs +0 -1
@@ -1 +1 @@
1
- import{useRef as e,useState as t,useCallback as r}from"react";import{http as n,createPublicClient as a}from"viem";import{u as i,g as s,c as o}from"./use-sign-with-user-signer-C3vxQSbq.mjs";import{q as l,k as c,e as d,p as u,a as p,aR as m,aQ as y,aP as g}from"./privy-provider-C8x4T-HJ.mjs";import{P as h}from"./paths-j39vuJt8.mjs";import{u as f}from"./internal-context-De1jxnac.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,toKernelSmartAccount 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,useMetaFactory:"optional",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:i,user:s,smartWalletsConfig:o,rpcConfig:c,privyAppId:d})=>{if(!(o?.enabled&&s&&r&&i))return;let u=o?.configuredNetworks.find((t=>t.chainId===`eip155:${e.id}`));if(!u)throw new h(`The chain ${e.name} (eip155:${e.id}) must be configured in the smart wallet configuration in your dashboard`);let p=s.smartWallet?.smartWalletType??o.smartWalletType,m=l(e,c,d),y=a({chain:e,transport:n(m)}),g=t??u.paymasterContext,f=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:i,smartWalletType:p,chain:e,publicClient:y,paymasterContext:g,...u});if(!f)throw new h(`Failed to create smart wallet client for chain ${e.name} (eip155:${e.id})`);return f},q=({clientConfig:n,smartWalletsConfig:a})=>{let{hideWalletUIs:l,openPrivyModal:P,appId:I,isHeadlessSigning:v}=f(),F=c(),{setModalData:W}=d(),{user:x}=i(),{chains:G}=c(),{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}=u(),b=s(x),A=w(S),D=!!b&&o(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 h(`Smart wallet client for chain (eip155:${C.current}) not found`);if(delete e.account,v({showWalletUIs:t?.uiOptions?.showWalletUIs}))return l.current=!0,await r.sendTransaction(e).finally((()=>l.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(i,s)=>{l.current=!0;let{entropyId:o,entropyIdVerifier:c}=p(x);W({connectWallet:{recoveryMethod:b.recoveryMethod,connectingWalletAddress:b.address,isUnifiedWallet:D,entropyId:o,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:o,entropyIdVerifier:c,getIsSponsored:a,signOnly:!1,onConfirm:()=>r.sendTransaction(e),onSuccess:e=>i(e.hash),onFailure:s,uiOptions:t?.uiOptions??{}}}),P(y)})).finally((()=>{l.current=!1}))},signMessage:async(e,t)=>{let r=T.current[C.current];if(!r)throw new h(`Smart wallet client for chain (eip155:${C.current}) not found`);return v({showWalletUIs:t?.uiOptions?.showWalletUIs})?(l.current=!0,await r.signMessage(e).finally((()=>l.current=!1))):new Promise((async(n,a)=>{let{entropyId:i,entropyIdVerifier:s}=p(x);l.current=!0,W({connectWallet:{recoveryMethod:b.recoveryMethod,connectingWalletAddress:b.address,isUnifiedWallet:D,entropyId:i,entropyIdVerifier:s,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((()=>{l.current=!1}))},signTypedData:async(e,t)=>{let r=T.current[C.current];if(!r)throw new h(`Smart wallet client for chain (eip155:${C.current}) not found`);return delete e.account,v({showWalletUIs:t?.uiOptions?.showWalletUIs})?(l.current=!0,await r.signTypedData(e).finally((()=>l.current=!1))):new Promise((async(n,a)=>{l.current=!0;let{entropyId:i,entropyIdVerifier:s}=p(x);W({connectWallet:{recoveryMethod:b.recoveryMethod,connectingWalletAddress:b.address,isUnifiedWallet:D,entropyId:i,entropyIdVerifier:s,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((()=>{l.current=!1}))},getChainId:V,chain:O,switchChain:N}}}},k=()=>{let{hideWalletUIs:e,openPrivyModal:t,isHeadlessSigning:r}=f(),{setModalData:n}=d(),{user:a}=i(),l=s(a),c=!!l&&o(l);return{wrapSmartAccountClientWithUIs:i=>({...i,sendTransaction:async(s,o)=>{if(r({showWalletUIs:o?.uiOptions?.showWalletUIs}))return e.current=!0,await i.sendTransaction(s).finally((()=>e.current=!1));let d=[];"calls"in s&&void 0!==s.calls?d=[...s.calls]:"to"in s&&(d=[{to:s.to,value:s.value||BigInt(0),data:s.data||"0x"}]);let u=async()=>{if(!i.paymaster)return!1;let{paymasterData:e,paymasterAndData:t}=await i.prepareUserOperation({calls:d,maxFeePerGas:s.maxFeePerGas,maxPriorityFeePerGas:s.maxPriorityFeePerGas,nonce:s.nonce?BigInt(s.nonce):void 0});return Number(t??e??0)>0};return new Promise((async(r,g)=>{e.current=!0;let{entropyId:h,entropyIdVerifier:f}=p(a);n({connectWallet:{recoveryMethod:l.recoveryMethod,connectingWalletAddress:l.address,isUnifiedWallet:c,entropyId:h,entropyIdVerifier:f,onCompleteNavigateTo:m,onFailure:()=>{}},sendTransaction:{transactionRequests:B({calls:d,chain:i.chain,maxPriorityFeePerGas:s.maxPriorityFeePerGas,maxFeePerGas:s.maxFeePerGas,nonce:s.nonce?BigInt(s.nonce):void 0}),transactingWalletIndex:0,transactingWalletAddress:i.account.address,entropyId:h,entropyIdVerifier:f,getIsSponsored:u,signOnly:!1,onConfirm:()=>i.sendTransaction(s),onSuccess:e=>r(e.hash),onFailure:g,uiOptions:o?.uiOptions??{}}}),t(y)})).finally((()=>{e.current=!1}))},signMessage:async(s,o)=>r({showWalletUIs:o?.uiOptions?.showWalletUIs})?(e.current=!0,await i.signMessage(s).finally((()=>e.current=!1))):new Promise((async(r,d)=>{let{entropyId:u,entropyIdVerifier:m}=p(a);e.current=!0,n({connectWallet:{recoveryMethod:l.recoveryMethod,connectingWalletAddress:l.address,isUnifiedWallet:c,entropyId:u,entropyIdVerifier:m,onCompleteNavigateTo:g,onFailure:()=>{}},signMessage:{method:"personal_sign",data:"string"==typeof s.message?s.message:s.message.raw.toString(),confirmAndSign:()=>i.signMessage(s),onSuccess:e=>r(e),onFailure:d,uiOptions:o?.uiOptions??{}}}),t(y)})).finally((()=>{e.current=!1})),signTypedData:async(s,o)=>r({showWalletUIs:o?.uiOptions?.showWalletUIs})?(e.current=!0,await i.signTypedData(s).finally((()=>e.current=!1))):new Promise((async(r,d)=>{e.current=!0;let{entropyId:u,entropyIdVerifier:m}=p(a);n({connectWallet:{recoveryMethod:l.recoveryMethod,connectingWalletAddress:l.address,isUnifiedWallet:c,entropyId:u,entropyIdVerifier:m,onCompleteNavigateTo:g,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:s,confirmAndSign:()=>i.signTypedData(s),onSuccess:e=>r(e),onFailure:d,uiOptions:o?.uiOptions??{}}}),t(y)})).finally((()=>{e.current=!1}))})}};export{q as a,B as c,$ as g,k as u};
1
+ import{useRef as e,useState as t,useCallback as r}from"react";import{http as n,createPublicClient as a}from"viem";import{u as i,g as s,c as o}from"./use-sign-with-user-signer-C21K9CRz.mjs";import{x as l,o as c,e as d,w as u,a as p,b1 as m,b0 as y,a$ as g}from"./privy-provider-D3Bw8K9z.mjs";import{P as h}from"./paths-j39vuJt8.mjs";import{u as f}from"./internal-context-BzsB315R.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,toKernelSmartAccount 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 b,LIGHT_ACCOUNT as O,BICONOMY as S,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,useMetaFactory:"optional",owners:[e]});case S:return F({client:r,owners:[e],entryPoint:V});case O:return v({client:r,entryPoint:V,owner:e,version:"1.1.0"});case b: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 $=({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}))),B=async({chain:e,paymasterContext:t,account:r,signer:i,user:s,smartWalletsConfig:o,rpcConfig:c,privyAppId:d})=>{if(!(o?.enabled&&s&&r&&i))return;let u=o?.configuredNetworks.find((t=>t.chainId===`eip155:${e.id}`));if(!u)throw new h(`The chain ${e.name} (eip155:${e.id}) must be configured in the smart wallet configuration in your dashboard`);let p=s.smartWallet?.smartWalletType??o.smartWalletType,m=l(e,c,d),y=a({chain:e,transport:n(m)}),g=t??u.paymasterContext,f=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:i,smartWalletType:p,chain:e,publicClient:y,paymasterContext:g,...u});if(!f)throw new h(`Failed to create smart wallet client for chain ${e.name} (eip155:${e.id})`);return f},q=({clientConfig:n,smartWalletsConfig:a})=>{let{hideWalletUIs:l,openPrivyModal:P,appId:I,isHeadlessSigning:v}=f(),F=c(),{setModalData:W}=d(),{user:x}=i(),{chains:G}=c(),{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}})(),b=G.find((e=>e.id===M)),{wallets:O}=u(),S=s(x),A=w(O),D=!!S&&o(S),V=r((async()=>C.current),[C]),N=r((async({id:e})=>{if(!T.current[e]){let t=await B({chain:G.find((t=>t.id===e)),account:S,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,O,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 h(`Smart wallet client for chain (eip155:${C.current}) not found`);if(delete e.account,v({showWalletUIs:t?.uiOptions?.showWalletUIs}))return l.current=!0,await r.sendTransaction(e).finally((()=>l.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(i,s)=>{l.current=!0;let{entropyId:o,entropyIdVerifier:c}=p(x);W({connectWallet:{recoveryMethod:S.recoveryMethod,connectingWalletAddress:S.address,isUnifiedWallet:D,entropyId:o,entropyIdVerifier:c,onCompleteNavigateTo:m,onFailure:()=>{}},sendTransaction:{transactionRequests:$({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:o,entropyIdVerifier:c,getIsSponsored:a,signOnly:!1,onConfirm:()=>r.sendTransaction(e),onSuccess:e=>i(e.hash),onFailure:s,uiOptions:t?.uiOptions??{}}}),P(y)})).finally((()=>{l.current=!1}))},signMessage:async(e,t)=>{let r=T.current[C.current];if(!r)throw new h(`Smart wallet client for chain (eip155:${C.current}) not found`);return v({showWalletUIs:t?.uiOptions?.showWalletUIs})?(l.current=!0,await r.signMessage(e).finally((()=>l.current=!1))):new Promise((async(n,a)=>{let{entropyId:i,entropyIdVerifier:s}=p(x);l.current=!0,W({connectWallet:{recoveryMethod:S.recoveryMethod,connectingWalletAddress:S.address,isUnifiedWallet:D,entropyId:i,entropyIdVerifier:s,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((()=>{l.current=!1}))},signTypedData:async(e,t)=>{let r=T.current[C.current];if(!r)throw new h(`Smart wallet client for chain (eip155:${C.current}) not found`);return delete e.account,v({showWalletUIs:t?.uiOptions?.showWalletUIs})?(l.current=!0,await r.signTypedData(e).finally((()=>l.current=!1))):new Promise((async(n,a)=>{l.current=!0;let{entropyId:i,entropyIdVerifier:s}=p(x);W({connectWallet:{recoveryMethod:S.recoveryMethod,connectingWalletAddress:S.address,isUnifiedWallet:D,entropyId:i,entropyIdVerifier:s,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((()=>{l.current=!1}))},getChainId:V,chain:b,switchChain:N}}}},j=()=>{let{hideWalletUIs:e,openPrivyModal:t,isHeadlessSigning:r}=f(),{setModalData:n}=d(),{user:a}=i(),l=s(a),c=!!l&&o(l);return{wrapSmartAccountClientWithUIs:i=>({...i,sendTransaction:async(s,o)=>{if(r({showWalletUIs:o?.uiOptions?.showWalletUIs}))return e.current=!0,await i.sendTransaction(s).finally((()=>e.current=!1));let d=[];"calls"in s&&void 0!==s.calls?d=[...s.calls]:"to"in s&&(d=[{to:s.to,value:s.value||BigInt(0),data:s.data||"0x"}]);let u=async()=>{if(!i.paymaster)return!1;let{paymasterData:e,paymasterAndData:t}=await i.prepareUserOperation({calls:d,maxFeePerGas:s.maxFeePerGas,maxPriorityFeePerGas:s.maxPriorityFeePerGas,nonce:s.nonce?BigInt(s.nonce):void 0});return Number(t??e??0)>0};return new Promise((async(r,g)=>{e.current=!0;let{entropyId:h,entropyIdVerifier:f}=p(a);n({connectWallet:{recoveryMethod:l.recoveryMethod,connectingWalletAddress:l.address,isUnifiedWallet:c,entropyId:h,entropyIdVerifier:f,onCompleteNavigateTo:m,onFailure:()=>{}},sendTransaction:{transactionRequests:$({calls:d,chain:i.chain,maxPriorityFeePerGas:s.maxPriorityFeePerGas,maxFeePerGas:s.maxFeePerGas,nonce:s.nonce?BigInt(s.nonce):void 0}),transactingWalletIndex:0,transactingWalletAddress:i.account.address,entropyId:h,entropyIdVerifier:f,getIsSponsored:u,signOnly:!1,onConfirm:()=>i.sendTransaction(s),onSuccess:e=>r(e.hash),onFailure:g,uiOptions:o?.uiOptions??{}}}),t(y)})).finally((()=>{e.current=!1}))},signMessage:async(s,o)=>r({showWalletUIs:o?.uiOptions?.showWalletUIs})?(e.current=!0,await i.signMessage(s).finally((()=>e.current=!1))):new Promise((async(r,d)=>{let{entropyId:u,entropyIdVerifier:m}=p(a);e.current=!0,n({connectWallet:{recoveryMethod:l.recoveryMethod,connectingWalletAddress:l.address,isUnifiedWallet:c,entropyId:u,entropyIdVerifier:m,onCompleteNavigateTo:g,onFailure:()=>{}},signMessage:{method:"personal_sign",data:"string"==typeof s.message?s.message:s.message.raw.toString(),confirmAndSign:()=>i.signMessage(s),onSuccess:e=>r(e),onFailure:d,uiOptions:o?.uiOptions??{}}}),t(y)})).finally((()=>{e.current=!1})),signTypedData:async(s,o)=>r({showWalletUIs:o?.uiOptions?.showWalletUIs})?(e.current=!0,await i.signTypedData(s).finally((()=>e.current=!1))):new Promise((async(r,d)=>{e.current=!0;let{entropyId:u,entropyIdVerifier:m}=p(a);n({connectWallet:{recoveryMethod:l.recoveryMethod,connectingWalletAddress:l.address,isUnifiedWallet:c,entropyId:u,entropyIdVerifier:m,onCompleteNavigateTo:g,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:s,confirmAndSign:()=>i.signTypedData(s),onSuccess:e=>r(e),onFailure:d,uiOptions:o?.uiOptions??{}}}),t(y)})).finally((()=>{e.current=!1}))})}};export{q as a,$ as c,B as g,j 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{u as n,g as c}from"./use-sign-with-user-signer-C3vxQSbq.mjs";import{k as a,p as l}from"./privy-provider-C8x4T-HJ.mjs";import{P as s}from"./paths-j39vuJt8.mjs";import{g as m}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{u as p,g as h,a as u}from"./smart-wallets-DJW4A6lN.mjs";import{u as d,a as g}from"./internal-context-De1jxnac.mjs";import"viem";import"mipd";import"react-device-detect";import"viem/utils";import"@privy-io/js-sdk-core";import"uuid";import"jose";import"eventemitter3";import"@coinbase/wallet-sdk";import"@privy-io/ethereum";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/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@heroicons/react/24/outline/ChevronDownIcon";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/solid/ArrowsRightLeftIcon";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/outline/GlobeAltIcon";import"ofetch";import"@heroicons/react/24/outline";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@tanstack/react-virtual";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:g});const I=({config:e,children:i})=>/*#__PURE__*/o(y,{children:/*#__PURE__*/o(k,{config:e,children:/*#__PURE__*/o(P,{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}=d();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:u}=v(),{appId:g}=d(),{chains:C,defaultChain:I,rpcConfig:f}=a(),{wallets:w}=l(),{user:y}=n(),[k,P]=i(),{wrapSmartAccountClientWithUIs:S}=p(),b=c(y),A=m(w);r((()=>{(async()=>{if(!u?.enabled)return;let o=u.configuredNetworks.find((o=>o.chainId===`eip155:${I.id}`))?I:C.find((o=>u.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.");P(await h({chain:o,privyAppId:g,paymasterContext:e?.paymasterContext,rpcConfig:f,account:b,signer:await(A?.getEthereumProvider()),user:y,smartWalletsConfig:u}))})()}),[!!u?.enabled,!!y?.smartWallet,!!A,!!b]);/*#__PURE__*/return o(W.Provider,{value:{client:k,config:e,getClientForChain:async({id:o})=>{let i=await h({chain:C.find((e=>e.id===o)),privyAppId:g,paymasterContext:e?.paymasterContext,rpcConfig:f,account:b,signer:await(A?.getEthereumProvider()),user:y,smartWalletsConfig:u});if(!i)throw new s(`Failed to create smart wallet client for chain id: ${o}`);return S(i)}},children:t})},W=/*#__PURE__*/t({client:void 0,config:void 0,getClientForChain:g}),P=({children:i})=>{let{client:t,config:c,getClientForChain:a}=(()=>{let{client:o,config:i,getClientForChain:r}=e(W);return{client:o,config:i,getClientForChain:r}})(),{config:l}=v(),{wrapSmartAccountClient:s}=u({clientConfig:c,smartWalletsConfig:l}),{user:m}=n(),{generateSiweMessageForSmartWallet:p,linkSmartWallet:h,hideWalletUIs:g}=d();return r((()=>{(async()=>{if(t&&m&&!m?.smartWallet&&l?.enabled)try{let o=await p({address:t.account.address,chainId:`eip155:${t.chain.id}`});g.current=!0;let e=await t.signMessage({message:o});await h({signature:e,message:o,smartWalletType:l.smartWalletType})}catch(o){console.error("Error creating smart wallet:",o)}finally{g.current=!1}})()}),[!!t,!!m?.smartWallet,!!l?.enabled]),/*#__PURE__*/o(C.Provider,{value:{client:m?.smartWallet&&t?s(t):void 0,getClientForChain:a},children:i})};export{I as SmartWalletsProvider,f 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{u as n,g as c}from"./use-sign-with-user-signer-C21K9CRz.mjs";import{o as a,w as l}from"./privy-provider-D3Bw8K9z.mjs";import{P as s}from"./paths-j39vuJt8.mjs";import{g as m}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{u as p,g as h,a as u}from"./smart-wallets-BHAJajS8.mjs";import{u as d,a as g}from"./internal-context-BzsB315R.mjs";import"viem";import"mipd";import"react-device-detect";import"viem/utils";import"@privy-io/js-sdk-core";import"uuid";import"jose";import"eventemitter3";import"@coinbase/wallet-sdk";import"@privy-io/ethereum";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/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"zustand";import"@headlessui/react";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@walletconnect/ethereum-provider";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/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"@heroicons/react/24/outline";import"@tanstack/react-virtual";import"qrcode";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";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/outline/GlobeAltIcon";import"ofetch";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:g});const I=({config:e,children:i})=>/*#__PURE__*/o(y,{children:/*#__PURE__*/o(k,{config:e,children:/*#__PURE__*/o(P,{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}=d();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:u}=v(),{appId:g}=d(),{chains:C,defaultChain:I,rpcConfig:f}=a(),{wallets:w}=l(),{user:y}=n(),[k,P]=i(),{wrapSmartAccountClientWithUIs:S}=p(),b=c(y),A=m(w);r((()=>{(async()=>{if(!u?.enabled)return;let o=u.configuredNetworks.find((o=>o.chainId===`eip155:${I.id}`))?I:C.find((o=>u.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.");P(await h({chain:o,privyAppId:g,paymasterContext:e?.paymasterContext,rpcConfig:f,account:b,signer:await(A?.getEthereumProvider()),user:y,smartWalletsConfig:u}))})()}),[!!u?.enabled,!!y?.smartWallet,!!A,!!b]);/*#__PURE__*/return o(W.Provider,{value:{client:k,config:e,getClientForChain:async({id:o})=>{let i=await h({chain:C.find((e=>e.id===o)),privyAppId:g,paymasterContext:e?.paymasterContext,rpcConfig:f,account:b,signer:await(A?.getEthereumProvider()),user:y,smartWalletsConfig:u});if(!i)throw new s(`Failed to create smart wallet client for chain id: ${o}`);return S(i)}},children:t})},W=/*#__PURE__*/t({client:void 0,config:void 0,getClientForChain:g}),P=({children:i})=>{let{client:t,config:c,getClientForChain:a}=(()=>{let{client:o,config:i,getClientForChain:r}=e(W);return{client:o,config:i,getClientForChain:r}})(),{config:l}=v(),{wrapSmartAccountClient:s}=u({clientConfig:c,smartWalletsConfig:l}),{user:m}=n(),{generateSiweMessageForSmartWallet:p,linkSmartWallet:h,hideWalletUIs:g}=d();return r((()=>{(async()=>{if(t&&m&&!m?.smartWallet&&l?.enabled)try{let o=await p({address:t.account.address,chainId:`eip155:${t.chain.id}`});g.current=!0;let e=await t.signMessage({message:o});await h({signature:e,message:o,smartWalletType:l.smartWalletType})}catch(o){console.error("Error creating smart wallet:",o)}finally{g.current=!1}})()}),[!!t,!!m?.smartWallet,!!l?.enabled]),/*#__PURE__*/o(C.Provider,{value:{client:m?.smartWallet&&t?s(t):void 0,getClientForChain:a},children:i})};export{I as SmartWalletsProvider,f as useSmartWallets};
@@ -1 +1 @@
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{aC as i,l as r,aD as o,aE as s,k as a,H as c,e as l,u as d,aF as p,p as h,aG as m,aH as g,aI as A,aJ as v,aK as w,aL as f}from"./privy-provider-C8x4T-HJ.mjs";export{X as useSolanaWallets}from"./privy-provider-C8x4T-HJ.mjs";import{useCallback as y,useMemo as b,useEffect as I,useState as T}from"react";import{u as j,n as C}from"./internal-context-De1jxnac.mjs";import{u as P,a as O,d as S,e as k}from"./use-sign-with-user-signer-C3vxQSbq.mjs";import{VersionedTransaction as E,Connection as _,Transaction as M,TransactionInstruction as B,PublicKey as D}from"@solana/web3.js";import F from"eventemitter3";import{base58 as W}from"@scure/base";import{t as x}from"./useFundWallet-Biyv49Yj.mjs";export{u as useFundWallet}from"./useFundWallet-Biyv49Yj.mjs";import"react/jsx-runtime";import"mipd";import"react-device-detect";import"viem/utils";import"@privy-io/js-sdk-core";import"./paths-j39vuJt8.mjs";import"ofetch";import"viem";import"uuid";import"jose";import"@coinbase/wallet-sdk";import"@privy-io/ethereum";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/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@heroicons/react/24/outline/ChevronDownIcon";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/solid/ArrowsRightLeftIcon";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/outline/GlobeAltIcon";import"@heroicons/react/24/outline";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@tanstack/react-virtual";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 U=e=>{let t,{get:r,on:o}=n(),s=e?.shouldAutoConnect??!0,a=new Map,c=[];function l(...e){J(e).forEach((e=>!a.has(e.wallet)&&a.set(e.wallet,e))),c=Array.from(a.values()).map((e=>new i(e,s))),t?.(c)}function u(...e){Array.from(a.keys()).forEach((t=>!e.includes(t)&&a.delete(t))),c=Array.from(a.values()).map((e=>new i(e,s))),t?.(c)}let d=[o("register",l),o("unregister",u)];return J(r()).forEach((e=>!a.has(e.wallet)&&a.set(e.wallet,e))),c=Array.from(a.values()).map((e=>new i(e,s))),{_setOnConnectorsUpdated:e=>{t=e},onMount:()=>{d[0]||(d[0]=o("register",l)),d[1]||(d[1]=o("unregister",u))},onUnmount:()=>{let e=d.pop();for(;e;)e(),e=d.pop()},get:()=>c}};let J=n=>n.filter((t=>e(t)&&!(t.features["privy:"]&&"isPrivyWallet"in t&&t.isPrivyWallet))).map((e=>new t({wallet:e})));const Q=()=>{let{getAccessToken:e,user:t}=P(),{refreshSessionAndUser:n,initializeWalletProxy:i}=j(),s=r();return{importWallet:y((({privateKey:r})=>o({getAccessToken:e,user:t,initializeWalletProxy:i,refreshSessionAndUser:n,emitPrivyEvent:s},{privateKey:r,chainType:"solana"})),[t,e,n,i,s])}},K=["solana:mainnet","solana:devnet","solana:testnet"];function V(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 z(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var G=0,R="__private_"+G+++"__implementation";function q(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var H=0;function Y(e){return"__private_"+H+++"_"+e}var L=/*#__PURE__*/Y("_address"),Z=/*#__PURE__*/Y("_publicKey"),N=/*#__PURE__*/Y("_chains"),$=/*#__PURE__*/Y("_features"),ee=/*#__PURE__*/Y("_label"),te=/*#__PURE__*/Y("_icon");class ne{get address(){return q(this,L)[L]}get publicKey(){return q(this,Z)[Z].slice()}get chains(){return q(this,N)[N].slice()}get features(){return q(this,$)[$].slice()}get label(){return q(this,ee)[ee]}get icon(){return q(this,te)[te]}constructor({address:e,publicKey:t,label:n,icon:i}){Object.defineProperty(this,L,{writable:!0,value:void 0}),Object.defineProperty(this,Z,{writable:!0,value:void 0}),Object.defineProperty(this,N,{writable:!0,value:void 0}),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}),q(this,L)[L]=e,q(this,Z)[Z]=t,q(this,N)[N]=K,q(this,ee)[ee]=n,q(this,te)[te]=i,q(this,$)[$]=["solana:signAndSendTransaction","solana:signTransaction","solana:signMessage"],new.target===ne&&Object.freeze(this)}}function ie(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var re=0;function oe(e){return"__private_"+re+++"_"+e}var se=/*#__PURE__*/oe("_listeners"),ae=/*#__PURE__*/oe("_version"),ce=/*#__PURE__*/oe("_name"),le=/*#__PURE__*/oe("_icon"),ue=/*#__PURE__*/oe("_injection"),de=/*#__PURE__*/oe("_isPrivyWallet"),pe=/*#__PURE__*/oe("_accounts"),he=/*#__PURE__*/oe("_on"),me=/*#__PURE__*/oe("_emit"),ge=/*#__PURE__*/oe("_off"),Ae=/*#__PURE__*/oe("_connected"),ve=/*#__PURE__*/oe("_connect"),we=/*#__PURE__*/oe("_disconnect"),fe=/*#__PURE__*/oe("_signMessage"),ye=/*#__PURE__*/oe("_signAndSendTransaction"),be=/*#__PURE__*/oe("_signTransaction");function Ie(e,...t){ie(this,se)[se][e]?.forEach((e=>e.apply(null,t)))}function Te(e,t){ie(this,se)[se][e]=ie(this,se)[se][e]?.filter((e=>t!==e))}function je(e){let t=a(),{getAccessToken:n,user:i}=c(),{setModalData:o}=l(),{isHeadlessSigning:s,openModal:u,walletProxy:h,recoverEmbeddedWallet:m,privy:g}=j(),A=r(),{signWithUserSigner:v}=O();return d("signSolanaTransaction",e),{signTransaction:async({transaction:e,connection:r,uiOptions:a,transactionOptions:c,address:l})=>{let{signedTransaction:d}=await p({privy:g,appConfig:t,getAccessToken:n,isHeadlessSigning:s,emitPrivyEvent:A,setModalData:o,openModal:u,walletProxy:h,user:i,recoverEmbeddedWallet:m,signWithUserSigner:v},{transaction:e,connection:r,transactionOptions:c,uiOptions:a,address:l,signOnly:!0});return d}}}let Ce=new class extends F{setImplementation(e){z(this,R)[R]=e}async signMessage(e,t){return z(this,R)[R].signMessage(e,t)}async signAndSendTransaction(e,t,n,i){return z(this,R)[R].signAndSendTransaction(e,t,n,i)}async signTransaction(e,t,n,i){return z(this,R)[R].signTransaction(e,t,n,i)}constructor(e){super(),Object.defineProperty(this,R,{writable:!0,value:void 0}),z(this,R)[R]=e}}({signTransaction:C("signTransaction was not injected"),signAndSendTransaction:C("signAndSendTransaction was not injected"),signMessage:C("signMessage was not injected")}),Pe=new class{get version(){return ie(this,ae)[ae]}get name(){return ie(this,ce)[ce]}get icon(){return ie(this,le)[le]}get chains(){return K.slice()}get features(){return{"standard:connect":{version:"1.0.0",connect:ie(this,ve)[ve]},"standard:disconnect":{version:"1.0.0",disconnect:ie(this,we)[we]},"standard:events":{version:"1.0.0",on:ie(this,he)[he]},"solana:signAndSendTransaction":{version:"1.0.0",supportedTransactionVersions:["legacy",0],signAndSendTransaction:ie(this,ye)[ye]},"solana:signTransaction":{version:"1.0.0",supportedTransactionVersions:["legacy",0],signTransaction:ie(this,be)[be]},"solana:signMessage":{version:"1.0.0",signMessage:ie(this,fe)[fe]},"privy:":{privy:{signMessage:ie(this,ue)[ue].signMessage,signTransaction:ie(this,ue)[ue].signTransaction,signAndSendTransaction:ie(this,ue)[ue].signAndSendTransaction}}}}get accounts(){return ie(this,pe)[pe].slice()}get isPrivyWallet(){return ie(this,de)[de]}constructor({name:e,icon:t,version:n,injection:i,wallets:r}){Object.defineProperty(this,me,{value:Ie}),Object.defineProperty(this,ge,{value:Te}),Object.defineProperty(this,se,{writable:!0,value:void 0}),Object.defineProperty(this,ae,{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,de,{writable:!0,value:void 0}),Object.defineProperty(this,pe,{writable:!0,value:void 0}),Object.defineProperty(this,he,{writable:!0,value:void 0}),Object.defineProperty(this,Ae,{writable:!0,value:void 0}),Object.defineProperty(this,ve,{writable:!0,value:void 0}),Object.defineProperty(this,we,{writable:!0,value:void 0}),Object.defineProperty(this,fe,{writable:!0,value:void 0}),Object.defineProperty(this,ye,{writable:!0,value:void 0}),Object.defineProperty(this,be,{writable:!0,value:void 0}),ie(this,se)[se]={},ie(this,he)[he]=(e,t)=>(ie(this,se)[se][e]?.push(t)||(ie(this,se)[se][e]=[t]),()=>ie(this,ge)[ge](e,t)),ie(this,Ae)[Ae]=e=>{null!=e&&(ie(this,pe)[pe]=e.map((({address:e})=>new ne({address:e,publicKey:W.decode(e)})))),ie(this,me)[me]("change",{accounts:this.accounts})},ie(this,ve)[ve]=async()=>(ie(this,me)[me]("change",{accounts:this.accounts}),{accounts:this.accounts}),ie(this,we)[we]=async()=>{ie(this,me)[me]("change",{accounts:this.accounts})},ie(this,fe)[fe]=async(...e)=>{let t=[];for(let{message:n,account:i}of e){let{signature:e}=await ie(this,ue)[ue].signMessage(n,i.address);t.push({signedMessage:n,signature:e})}return t},ie(this,ye)[ye]=async(...e)=>{let t=[];for(let{transaction:n,account:i,options:r,chain:o}of e){let{signature:e}=await ie(this,ue)[ue].signAndSendTransaction(E.deserialize(n),i.address,V(o||"solana:mainnet"),r);t.push({signature:W.decode(e)})}return t},ie(this,be)[be]=async(...e)=>{let t=[];for(let{transaction:n,account:i,options:r,chain:o}of e){let e=await ie(this,ue)[ue].signTransaction(E.deserialize(n),i.address,V(o||"solana:mainnet"),r),a=s(e)?e.serialize():new Uint8Array(e.serialize({requireAllSignatures:!1,verifySignatures:!1}));t.push({signedTransaction:a})}return t},ie(this,ce)[ce]=e,ie(this,le)[le]=t,ie(this,ae)[ae]=n,ie(this,ue)[ue]=i,ie(this,pe)[pe]=[],ie(this,de)[de]=!0,i.on("accountChanged",ie(this,Ae)[Ae],this),ie(this,Ae)[Ae](r)}}({name:"Privy",version:"1.0.0",icon:"data:image/png;base64,AAABAAEAFBQAAAAAIABlAQAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAAUAAAAFAgGAAAAjYkdDQAAAAlwSFlzAAAOwwAADsMBx2+oZAAAAQVJREFUeJxiYMANZIC4E4ivAPFPIP4FxDeAuB+IlfDowwBMQFwJxF+B+D8O/AOI66Bq8QJGIF6ExyB0vAqImfEZmEeCYTDcgMswPiB+T4aB34FYApuBsWQYBsP52AycToGBK7EZuJECAw9jM3AVBQbuwWZgIwUGTsZmoDkFBnpiMxAEjpJh2FV8iVsbiD+TYBgoDVrgMgwGnID4HRGGgTKBGyHDYEAaiBdCSxh0g/5AU4Q8sYYhAzEgjoGmABBOgFo2eACowFABYn0oVgViAVINkQTiZUD8DIj/ATF6GILEXgLxCiCWIsZAbiAuBeKtQHwHiEHJ6C8UfwHie0C8E4jLoWpRAAAAAP//rcbhsQAAAAZJREFUAwBYFs3VKJ0cuQAAAABJRU5ErkJggg==",wallets:[],injection:Ce});function Oe(){let{solanaClusters:e}=a(),{ready:t}=h(),{user:n}=c(),{signMessage:i}=m(),{signTransaction:r}=je(),{sendTransaction:o}=g(),s=b((()=>{let e=[...S(n).sort(((e,t)=>(e.walletIndex??0)-(t.walletIndex??0)))],t=k(n);return t?[...e,t]:e}),[n]),l=b((()=>({signMessage:async(e,t)=>({signature:await i({message:e,options:{address:t}})}),async signTransaction(t,n,i){let o=new _(e[i].rpcUrl);return await r({transaction:t,address:n,connection:o})},async signAndSendTransaction(t,n,i,r){let s=new _(e[i].rpcUrl),{signature:a}=await o({transaction:t,connection:s,address:n,transactionOptions:r});return{signature:a}}})),[i,r,o,e]);return I((()=>{Ce?.setImplementation(l)}),[l]),I((()=>{var e;!t||(e=Pe.accounts).length===s.length&&e.every(((e,t)=>e.address===s[t]?.address))||Ce?.emit("accountChanged",s)}),[t,s]),{ready:t,wallet:Pe}}function Se(){let{client:e}=j(),{ready:t,wallet:n}=Oe(),[i,r]=T([]),[o,s]=T([]);return I((()=>{let e=[n,...i.filter((e=>"solana"===e.chainType)).map((e=>e.wallet))];s(e);let t=e.map((t=>t.features["standard:events"]?.on("change",(()=>{s([...e])}))));return()=>{t.forEach((e=>e?.()))}}),[i]),I((()=>{if(!t)return;r(e.connectors?.walletConnectors.filter((e=>"solana"===e.chainType))??[]);let n=()=>{r(e.connectors?.walletConnectors.filter((e=>"solana"===e.chainType))??[])};return e.connectors?.on("connectorInitialized",n),()=>{e.connectors?.off("connectorInitialized",n)}}),[t,e.connectors]),{ready:t,wallets:o}}var ke=()=>A(x),Ee={id:v,prepareSiwsTransactionWithMemo:({address:e,nonce:t})=>{let n=w({address:e,nonce:t}),i=new M,r=new B({keys:[{pubkey:new D(e),isSigner:!0,isWritable:!1}],programId:new D("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),data:Buffer.from(n,"utf-8")});return i.add(r),i.feePayer=new D(e),i.recentBlockhash="GfVcyD5fWFJ6hRm8bsy7CoVPsLSoJhtJKRJYk8T2VVFN",i.serialize({requireAllSignatures:!1}).toString("base64")},deserializeTransactionFromB64String:e=>M.from(f(e,"base64"))},_e=()=>A(Ee);export{i as SolanaAdapterConnector,U as toSolanaWalletConnectors,Q as useImportWallet,Oe as usePrivyStandardWallet,g as useSendTransaction,m as useSignMessage,je as useSignTransaction,ke as useSolanaFundingPlugin,_e as useSolanaLedgerPlugin,Se as useSolanaStandardWallets};
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{aO as i,p as r,o,aP as s,aQ as a,X as c,e as l,u as d,aR as p,w as h,aS as m,aT as g,aU as A,aV as v,aW as w,aX as f}from"./privy-provider-D3Bw8K9z.mjs";export{a7 as useSolanaWallets}from"./privy-provider-D3Bw8K9z.mjs";import{useCallback as y,useMemo as b,useEffect as I,useState as T}from"react";import{u as C,n as j}from"./internal-context-BzsB315R.mjs";import{u as P,a as O,d as S,e as E}from"./use-sign-with-user-signer-C21K9CRz.mjs";import{VersionedTransaction as _,Connection as k,Transaction as M,TransactionInstruction as B,PublicKey as W}from"@solana/web3.js";import D from"eventemitter3";import{base58 as F}from"@scure/base";import{t as x}from"./useFundWallet-BP5Qli7y.mjs";export{u as useFundWallet}from"./useFundWallet-BP5Qli7y.mjs";import"react/jsx-runtime";import"mipd";import"react-device-detect";import"viem/utils";import"@privy-io/js-sdk-core";import"./paths-j39vuJt8.mjs";import"ofetch";import"viem";import"uuid";import"jose";import"@coinbase/wallet-sdk";import"@privy-io/ethereum";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/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"zustand";import"@headlessui/react";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@walletconnect/ethereum-provider";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/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"@heroicons/react/24/outline";import"@tanstack/react-virtual";import"qrcode";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";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/outline/GlobeAltIcon";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 U=e=>{let t,{get:r,on:o}=n(),s=e?.shouldAutoConnect??!0,a=new Map,c=[];function l(...e){Q(e).forEach((e=>!a.has(e.wallet)&&a.set(e.wallet,e))),c=Array.from(a.values()).map((e=>new i(e,s))),t?.(c)}function u(...e){Array.from(a.keys()).forEach((t=>!e.includes(t)&&a.delete(t))),c=Array.from(a.values()).map((e=>new i(e,s))),t?.(c)}let d=[o("register",l),o("unregister",u)];return Q(r()).forEach((e=>!a.has(e.wallet)&&a.set(e.wallet,e))),c=Array.from(a.values()).map((e=>new i(e,s))),{_setOnConnectorsUpdated:e=>{t=e},onMount:()=>{d[0]||(d[0]=o("register",l)),d[1]||(d[1]=o("unregister",u))},onUnmount:()=>{let e=d.pop();for(;e;)e(),e=d.pop()},get:()=>c}};let Q=n=>n.filter((t=>e(t)&&!(t.features["privy:"]&&"isPrivyWallet"in t&&t.isPrivyWallet))).map((e=>new t({wallet:e})));const V=()=>{let{getAccessToken:e,user:t}=P(),{refreshSessionAndUser:n,initializeWalletProxy:i}=C(),a=r(),c=o();return{importWallet:y((({privateKey:r})=>s({getAccessToken:e,user:t,initializeWalletProxy:i,refreshSessionAndUser:n,emitPrivyEvent:a,appConfig:c},{privateKey:r,chainType:"solana"})),[t,e,n,i,a])}},J=["solana:mainnet","solana:devnet","solana:testnet"];function R(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 z(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var K=0,G="__private_"+K+++"__implementation";function q(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var Y=0;function H(e){return"__private_"+Y+++"_"+e}var L=/*#__PURE__*/H("_address"),Z=/*#__PURE__*/H("_publicKey"),X=/*#__PURE__*/H("_chains"),N=/*#__PURE__*/H("_features"),$=/*#__PURE__*/H("_label"),ee=/*#__PURE__*/H("_icon");class te{get address(){return q(this,L)[L]}get publicKey(){return q(this,Z)[Z].slice()}get chains(){return q(this,X)[X].slice()}get features(){return q(this,N)[N].slice()}get label(){return q(this,$)[$]}get icon(){return q(this,ee)[ee]}constructor({address:e,publicKey:t,label:n,icon:i}){Object.defineProperty(this,L,{writable:!0,value:void 0}),Object.defineProperty(this,Z,{writable:!0,value:void 0}),Object.defineProperty(this,X,{writable:!0,value:void 0}),Object.defineProperty(this,N,{writable:!0,value:void 0}),Object.defineProperty(this,$,{writable:!0,value:void 0}),Object.defineProperty(this,ee,{writable:!0,value:void 0}),q(this,L)[L]=e,q(this,Z)[Z]=t,q(this,X)[X]=J,q(this,$)[$]=n,q(this,ee)[ee]=i,q(this,N)[N]=["solana:signAndSendTransaction","solana:signTransaction","solana:signMessage"],new.target===te&&Object.freeze(this)}}function ne(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var ie=0;function re(e){return"__private_"+ie+++"_"+e}var oe=/*#__PURE__*/re("_listeners"),se=/*#__PURE__*/re("_version"),ae=/*#__PURE__*/re("_name"),ce=/*#__PURE__*/re("_icon"),le=/*#__PURE__*/re("_injection"),ue=/*#__PURE__*/re("_isPrivyWallet"),de=/*#__PURE__*/re("_accounts"),pe=/*#__PURE__*/re("_on"),he=/*#__PURE__*/re("_emit"),me=/*#__PURE__*/re("_off"),ge=/*#__PURE__*/re("_connected"),Ae=/*#__PURE__*/re("_connect"),ve=/*#__PURE__*/re("_disconnect"),we=/*#__PURE__*/re("_signMessage"),fe=/*#__PURE__*/re("_signAndSendTransaction"),ye=/*#__PURE__*/re("_signTransaction");function be(e,...t){ne(this,oe)[oe][e]?.forEach((e=>e.apply(null,t)))}function Ie(e,t){ne(this,oe)[oe][e]=ne(this,oe)[oe][e]?.filter((e=>t!==e))}function Te(e){let t=o(),{getAccessToken:n,user:i}=c(),{setModalData:s}=l(),{isHeadlessSigning:a,openModal:u,walletProxy:h,recoverEmbeddedWallet:m,privy:g,solanaWallets:A}=C(),v=r(),{signWithUserSigner:w}=O();return d("signSolanaTransaction",e),{signTransaction:async({transaction:e,connection:r,uiOptions:o,transactionOptions:c,address:l})=>{let d=l?A.find((e=>e.address===l&&"privy"!==e.walletClientType)):void 0,{signedTransaction:f}=await p({privy:g,appConfig:t,getAccessToken:n,isHeadlessSigning:a,emitPrivyEvent:v,setModalData:s,openModal:u,walletProxy:h,user:i,recoverEmbeddedWallet:m,signWithUserSigner:w,connectedExternalWallet:d},{transaction:e,connection:r,transactionOptions:c,uiOptions:o,address:l,signOnly:!0});return f}}}let Ce=new class extends D{setImplementation(e){z(this,G)[G]=e}async signMessage(e,t){return z(this,G)[G].signMessage(e,t)}async signAndSendTransaction(e,t,n,i){return z(this,G)[G].signAndSendTransaction(e,t,n,i)}async signTransaction(e,t,n,i){return z(this,G)[G].signTransaction(e,t,n,i)}constructor(e){super(),Object.defineProperty(this,G,{writable:!0,value:void 0}),z(this,G)[G]=e}}({signTransaction:j("signTransaction was not injected"),signAndSendTransaction:j("signAndSendTransaction was not injected"),signMessage:j("signMessage was not injected")}),je=new class{get version(){return ne(this,se)[se]}get name(){return ne(this,ae)[ae]}get icon(){return ne(this,ce)[ce]}get chains(){return J.slice()}get features(){return{"standard:connect":{version:"1.0.0",connect:ne(this,Ae)[Ae]},"standard:disconnect":{version:"1.0.0",disconnect:ne(this,ve)[ve]},"standard:events":{version:"1.0.0",on:ne(this,pe)[pe]},"solana:signAndSendTransaction":{version:"1.0.0",supportedTransactionVersions:["legacy",0],signAndSendTransaction:ne(this,fe)[fe]},"solana:signTransaction":{version:"1.0.0",supportedTransactionVersions:["legacy",0],signTransaction:ne(this,ye)[ye]},"solana:signMessage":{version:"1.0.0",signMessage:ne(this,we)[we]},"privy:":{privy:{signMessage:ne(this,le)[le].signMessage,signTransaction:ne(this,le)[le].signTransaction,signAndSendTransaction:ne(this,le)[le].signAndSendTransaction}}}}get accounts(){return ne(this,de)[de].slice()}get isPrivyWallet(){return ne(this,ue)[ue]}constructor({name:e,icon:t,version:n,injection:i,wallets:r}){Object.defineProperty(this,he,{value:be}),Object.defineProperty(this,me,{value:Ie}),Object.defineProperty(this,oe,{writable:!0,value:void 0}),Object.defineProperty(this,se,{writable:!0,value:void 0}),Object.defineProperty(this,ae,{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,de,{writable:!0,value:void 0}),Object.defineProperty(this,pe,{writable:!0,value:void 0}),Object.defineProperty(this,ge,{writable:!0,value:void 0}),Object.defineProperty(this,Ae,{writable:!0,value:void 0}),Object.defineProperty(this,ve,{writable:!0,value:void 0}),Object.defineProperty(this,we,{writable:!0,value:void 0}),Object.defineProperty(this,fe,{writable:!0,value:void 0}),Object.defineProperty(this,ye,{writable:!0,value:void 0}),ne(this,oe)[oe]={},ne(this,pe)[pe]=(e,t)=>(ne(this,oe)[oe][e]?.push(t)||(ne(this,oe)[oe][e]=[t]),()=>ne(this,me)[me](e,t)),ne(this,ge)[ge]=e=>{null!=e&&(ne(this,de)[de]=e.map((({address:e})=>new te({address:e,publicKey:F.decode(e)})))),ne(this,he)[he]("change",{accounts:this.accounts})},ne(this,Ae)[Ae]=async()=>(ne(this,he)[he]("change",{accounts:this.accounts}),{accounts:this.accounts}),ne(this,ve)[ve]=async()=>{ne(this,he)[he]("change",{accounts:this.accounts})},ne(this,we)[we]=async(...e)=>{let t=[];for(let{message:n,account:i}of e){let{signature:e}=await ne(this,le)[le].signMessage(n,i.address);t.push({signedMessage:n,signature:e})}return t},ne(this,fe)[fe]=async(...e)=>{let t=[];for(let{transaction:n,account:i,options:r,chain:o}of e){let{signature:e}=await ne(this,le)[le].signAndSendTransaction(_.deserialize(n),i.address,R(o||"solana:mainnet"),r);t.push({signature:F.decode(e)})}return t},ne(this,ye)[ye]=async(...e)=>{let t=[];for(let{transaction:n,account:i,options:r,chain:o}of e){let e=await ne(this,le)[le].signTransaction(_.deserialize(n),i.address,R(o||"solana:mainnet"),r),s=a(e)?e.serialize():new Uint8Array(e.serialize({requireAllSignatures:!1,verifySignatures:!1}));t.push({signedTransaction:s})}return t},ne(this,ae)[ae]=e,ne(this,ce)[ce]=t,ne(this,se)[se]=n,ne(this,le)[le]=i,ne(this,de)[de]=[],ne(this,ue)[ue]=!0,i.on("accountChanged",ne(this,ge)[ge],this),ne(this,ge)[ge](r)}}({name:"Privy",version:"1.0.0",icon:"data:image/png;base64,AAABAAEAFBQAAAAAIABlAQAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAAUAAAAFAgGAAAAjYkdDQAAAAlwSFlzAAAOwwAADsMBx2+oZAAAAQVJREFUeJxiYMANZIC4E4ivAPFPIP4FxDeAuB+IlfDowwBMQFwJxF+B+D8O/AOI66Bq8QJGIF6ExyB0vAqImfEZmEeCYTDcgMswPiB+T4aB34FYApuBsWQYBsP52AycToGBK7EZuJECAw9jM3AVBQbuwWZgIwUGTsZmoDkFBnpiMxAEjpJh2FV8iVsbiD+TYBgoDVrgMgwGnID4HRGGgTKBGyHDYEAaiBdCSxh0g/5AU4Q8sYYhAzEgjoGmABBOgFo2eACowFABYn0oVgViAVINkQTiZUD8DIj/ATF6GILEXgLxCiCWIsZAbiAuBeKtQHwHiEHJ6C8UfwHie0C8E4jLoWpRAAAAAP//rcbhsQAAAAZJREFUAwBYFs3VKJ0cuQAAAABJRU5ErkJggg==",wallets:[],injection:Ce});function Pe(){let{solanaClusters:e}=o(),{ready:t}=h(),{user:n}=c(),{signMessage:i}=m(),{signTransaction:r}=Te(),{sendTransaction:s}=g(),a=b((()=>{let e=[...S(n).sort(((e,t)=>(e.walletIndex??0)-(t.walletIndex??0)))],t=E(n);return t?[...e,t]:e}),[n]),l=b((()=>({signMessage:async(e,t)=>({signature:await i({message:e,options:{address:t}})}),async signTransaction(t,n,i){let o=new k(e[i].rpcUrl);return await r({transaction:t,address:n,connection:o})},async signAndSendTransaction(t,n,i,r){let o=new k(e[i].rpcUrl),{signature:a}=await s({transaction:t,connection:o,address:n,transactionOptions:r});return{signature:a}}})),[i,r,s,e]);return I((()=>{Ce?.setImplementation(l)}),[l]),I((()=>{var e;!t||(e=je.accounts).length===a.length&&e.every(((e,t)=>e.address===a[t]?.address))||Ce?.emit("accountChanged",a)}),[t,a]),{ready:t,wallet:je}}function Oe(){let{client:e}=C(),{ready:t,wallet:n}=Pe(),[i,r]=T([]),[o,s]=T([]);return I((()=>{let e=[n,...i.filter((e=>"solana"===e.chainType)).map((e=>e.wallet))];s(e);let t=e.map((t=>t.features["standard:events"]?.on("change",(()=>{s([...e])}))));return()=>{t.forEach((e=>e?.()))}}),[i]),I((()=>{if(!t)return;r(e.connectors?.walletConnectors.filter((e=>"solana"===e.chainType))??[]);let n=()=>{r(e.connectors?.walletConnectors.filter((e=>"solana"===e.chainType))??[])};return e.connectors?.on("connectorInitialized",n),()=>{e.connectors?.off("connectorInitialized",n)}}),[t,e.connectors]),{ready:t,wallets:o}}var Se=()=>A(x),Ee={id:v,prepareSiwsTransactionWithMemo:({address:e,nonce:t})=>{let n=w({address:e,nonce:t}),i=new M,r=new B({keys:[{pubkey:new W(e),isSigner:!0,isWritable:!1}],programId:new W("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),data:Buffer.from(n,"utf-8")});return i.add(r),i.feePayer=new W(e),i.recentBlockhash="GfVcyD5fWFJ6hRm8bsy7CoVPsLSoJhtJKRJYk8T2VVFN",i.serialize({requireAllSignatures:!1}).toString("base64")},deserializeTransactionFromB64String:e=>M.from(f(e,"base64"))},_e=()=>A(Ee);export{i as SolanaAdapterConnector,U as toSolanaWalletConnectors,V as useImportWallet,Pe as usePrivyStandardWallet,g as useSendTransaction,m as useSignMessage,Te as useSignTransaction,Se as useSolanaFundingPlugin,_e as useSolanaLedgerPlugin,Oe as useSolanaStandardWallets};