@privy-io/react-auth 2.21.4 → 2.22.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 (42) 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/index.js +1 -1
  4. package/dist/cjs/privy-provider-DXrPQcjO.js +34 -0
  5. package/dist/cjs/{smart-wallets-Cgv0XYXg.js → smart-wallets-ohOqJE5r.js} +1 -1
  6. package/dist/cjs/smart-wallets.js +1 -1
  7. package/dist/cjs/solana.js +1 -1
  8. package/dist/cjs/ui.js +2 -2
  9. package/dist/cjs/use-sign-with-user-signer-mIruAdfm.js +1 -0
  10. package/dist/cjs/{useActiveWallet-CYfVhCkS.js → useActiveWallet-BOhTaQoP.js} +1 -1
  11. package/dist/cjs/{useFundWallet-CdT-bV73.js → useFundWallet-BlDOcTKs.js} +1 -1
  12. package/dist/dts/extended-chains.d.mts +1 -1
  13. package/dist/dts/extended-chains.d.ts +1 -1
  14. package/dist/dts/farcaster.d.mts +1 -1
  15. package/dist/dts/farcaster.d.ts +1 -1
  16. package/dist/dts/index.d.mts +16 -4
  17. package/dist/dts/index.d.ts +16 -4
  18. package/dist/dts/smart-wallets.d.mts +1 -1
  19. package/dist/dts/smart-wallets.d.ts +1 -1
  20. package/dist/dts/solana.d.mts +63 -6
  21. package/dist/dts/solana.d.ts +63 -6
  22. package/dist/dts/{types-DRqchVAL.d.mts → types-koC7eIOP.d.mts} +62 -3
  23. package/dist/dts/{types-DRqchVAL.d.ts → types-koC7eIOP.d.ts} +62 -3
  24. package/dist/dts/ui.d.mts +1 -1
  25. package/dist/dts/ui.d.ts +1 -1
  26. package/dist/dts/{useSolanaWallets-yARRzx3f.d.mts → useSolanaWallets-CDu74ZFA.d.mts} +4 -1
  27. package/dist/dts/{useSolanaWallets-yARRzx3f.d.ts → useSolanaWallets-CDu74ZFA.d.ts} +4 -1
  28. package/dist/esm/abstract-smart-wallets.mjs +1 -1
  29. package/dist/esm/extended-chains.mjs +1 -1
  30. package/dist/esm/index.mjs +1 -1
  31. package/dist/esm/privy-provider-CoOSBvfN.mjs +31 -0
  32. package/dist/esm/{smart-wallets-ScQvzONo.mjs → smart-wallets-TO2YIcTb.mjs} +1 -1
  33. package/dist/esm/smart-wallets.mjs +1 -1
  34. package/dist/esm/solana.mjs +1 -1
  35. package/dist/esm/ui.mjs +2 -2
  36. package/dist/esm/{use-sign-with-user-signer-DYa7HrQH.mjs → use-sign-with-user-signer-u7zZ9cLA.mjs} +1 -1
  37. package/dist/esm/{useActiveWallet-CBnd9EMy.mjs → useActiveWallet-DknggGRp.mjs} +1 -1
  38. package/dist/esm/{useFundWallet-DSxHvjFr.mjs → useFundWallet-DvuaQdcB.mjs} +1 -1
  39. package/package.json +19 -8
  40. package/dist/cjs/privy-provider-dT3e7Jkf.js +0 -29
  41. package/dist/cjs/use-sign-with-user-signer-gh4MDT3P.js +0 -1
  42. package/dist/esm/privy-provider-BkunMgHl.mjs +0 -29
@@ -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-DYa7HrQH.mjs";import{x as l,o as c,e as d,w as u,a as m,b2 as p,b1 as y,b0 as g}from"./privy-provider-BkunMgHl.mjs";import{P as h}from"./paths-DCwuPDUk.mjs";import{u as f}from"./internal-context-qdNgTV5f.mjs";import{g as w}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{createSmartAccountClient as P}from"permissionless";import{toThirdwebSmartAccount as I,toLightSmartAccount as W,toBiconomySmartAccount as v,toKernelSmartAccount as F,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 V,SAFE as A}from"@privy-io/js-sdk-core";let D={address:T,version:"0.6"},N={address:U,version:"0.7"},_=({owner:e,smartWalletType:t,smartWalletVersion:r,publicClient:n})=>{switch(t){case A:return x({client:n,entryPoint:N,owners:[e],version:"1.4.1"});case V:return F({client:n,version:"0.3.1",entryPoint:N,useMetaFactory:"optional",owners:[e]});case S:return v({client:n,owners:[e],entryPoint:D});case O:return W({client:n,entryPoint:D,owner:e,version:"1.1.0"});case b:return async function({client:e,owner:t,version:r}){let[n]=await t.request({method:"eth_accounts"});if(!n)throw Error("Unable to request embedded owner for eth_accounts");return await C({client:e,owners:[{type:"local",source:"privy",address:n,sign:async({hash:e})=>await t.request({method:"secp256k1_sign",params:[e]})}],version:r})}({client:n,owner:e,version:r??"1"});case M:return I({client:n,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 m=s.smartWallet?s.smartWallet.smartWalletType:o.smartWalletType,p=s.smartWallet?s.smartWallet.smartWalletVersion:o.smartWalletVersion,y=l(e,c,d),g=a({chain:e,transport:n(y)}),f=t??u.paymasterContext,w=await(async({owner:e,smartWalletType:t,smartWalletVersion:r,chain:a,publicClient:i,bundlerUrl:s,paymasterUrl:o,paymasterContext:l})=>{let c=await _({owner:e,smartWalletType:t,publicClient:i,smartWalletVersion:r}),d=G({transport:n(s),entryPoint:c.entryPoint}),u=o?G({transport:n(o),entryPoint:c.entryPoint}):void 0;return P({account:c,chain:a,paymaster:u,paymasterContext:l,bundlerTransport:n(s),userOperation:{estimateFeesPerGas:async()=>{if(["public.pimlico.io","api.pimlico.io"].some((e=>s.includes(e))))return await d.getUserOperationGasPrice().then((e=>e.fast));if(["rpc.zerodev.app"].some((e=>s.includes(e))))return(await d.request({method:"zd_getUserOperationGasPrice",params:[]})).fast;if(["g.alchemy.com"].some((e=>s.includes(e)))){let[e,t]=await Promise.all([i.getBlock({blockTag:"latest"}),d.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 i.estimateFeesPerGas(),t=s.includes("api.developer.coinbase.com")?175n:150n;return{...e,maxFeePerGas:e.maxFeePerGas*t/100n,maxPriorityFeePerGas:e.maxPriorityFeePerGas*t/100n}}}}})})({owner:i,smartWalletType:m,smartWalletVersion:p,chain:e,publicClient:g,paymasterContext:f,...u});if(!w)throw new h(`Failed to create smart wallet client for chain ${e.name} (eip155:${e.id})`);return w},q=({clientConfig:n,smartWalletsConfig:a})=>{let{hideWalletUIs:l,openPrivyModal:P,appId:I,isHeadlessSigning:W}=f(),v=c(),{setModalData:F}=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),V=w(O),A=!!S&&o(S),D=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:S,signer:await(V?.getEthereumProvider()),user:x,paymasterContext:n?.paymasterContext,smartWalletsConfig:a,rpcConfig:v.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,W({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}=m(x);F({connectWallet:{recoveryMethod:S.recoveryMethod,connectingWalletAddress:S.address,isUnifiedWallet:A,entropyId:o,entropyIdVerifier:c,onCompleteNavigateTo:p,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 W({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}=m(x);l.current=!0,F({connectWallet:{recoveryMethod:S.recoveryMethod,connectingWalletAddress:S.address,isUnifiedWallet:A,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,W({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}=m(x);F({connectWallet:{recoveryMethod:S.recoveryMethod,connectingWalletAddress:S.address,isUnifiedWallet:A,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:D,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}=m(a);n({connectWallet:{recoveryMethod:l.recoveryMethod,connectingWalletAddress:l.address,isUnifiedWallet:c,entropyId:h,entropyIdVerifier:f,onCompleteNavigateTo:p,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:p}=m(a);e.current=!0,n({connectWallet:{recoveryMethod:l.recoveryMethod,connectingWalletAddress:l.address,isUnifiedWallet:c,entropyId:u,entropyIdVerifier:p,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:p}=m(a);n({connectWallet:{recoveryMethod:l.recoveryMethod,connectingWalletAddress:l.address,isUnifiedWallet:c,entropyId:u,entropyIdVerifier:p,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,j as u};
1
+ import{useRef as e,useState as t,useCallback as r}from"react";import{http as a,createPublicClient as n}from"viem";import{u as i,g as s,c as o}from"./use-sign-with-user-signer-u7zZ9cLA.mjs";import{x as l,o as c,e as d,w as u,a as m,b1 as p,b0 as y,a$ as g}from"./privy-provider-CoOSBvfN.mjs";import{P as h}from"./paths-DCwuPDUk.mjs";import{u as f}from"./internal-context-qdNgTV5f.mjs";import{g as w}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{createSmartAccountClient as P}from"permissionless";import{toThirdwebSmartAccount as I,toLightSmartAccount as W,toBiconomySmartAccount as v,toKernelSmartAccount as F,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 V,SAFE as A}from"@privy-io/js-sdk-core";let D={address:T,version:"0.6"},N={address:U,version:"0.7"},_=({owner:e,smartWalletType:t,smartWalletVersion:r,publicClient:a})=>{switch(t){case A:return x({client:a,entryPoint:N,owners:[e],version:"1.4.1"});case V:return F({client:a,version:"0.3.1",entryPoint:N,useMetaFactory:"optional",owners:[e]});case S:return v({client:a,owners:[e],entryPoint:D});case O:return W({client:a,entryPoint:D,owner:e,version:"1.1.0"});case b:return async function({client:e,owner:t,version:r}){let[a]=await t.request({method:"eth_accounts"});if(!a)throw Error("Unable to request embedded owner for eth_accounts");return await C({client:e,owners:[{type:"local",source:"privy",address:a,sign:async({hash:e})=>await t.request({method:"secp256k1_sign",params:[e]})}],version:r})}({client:a,owner:e,version:r??"1"});case M:return I({client:a,entryPoint:N,owner:e});default:throw Error(`Invalid smart account type: ${t}.`)}};const $=({calls:e,chain:t,maxPriorityFeePerGas:r,maxFeePerGas:a,nonce:n})=>e.map((e=>({to:e.to||void 0,data:e.data,value:e.value,chainId:t.id,nonce:n,maxFeePerGas:a,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 m=s.smartWallet?s.smartWallet.smartWalletType:o.smartWalletType,p=s.smartWallet?s.smartWallet.smartWalletVersion:o.smartWalletVersion,y=l(e,c,d),g=n({chain:e,transport:a(y)}),f=t??u.paymasterContext,w=await(async({owner:e,smartWalletType:t,smartWalletVersion:r,chain:n,publicClient:i,bundlerUrl:s,paymasterUrl:o,paymasterContext:l})=>{let c=await _({owner:e,smartWalletType:t,publicClient:i,smartWalletVersion:r}),d=G({transport:a(s),entryPoint:c.entryPoint}),u=o?G({transport:a(o),entryPoint:c.entryPoint}):void 0;return P({account:c,chain:n,paymaster:u,paymasterContext:l,bundlerTransport:a(s),userOperation:{estimateFeesPerGas:async()=>{if(["public.pimlico.io","api.pimlico.io"].some((e=>s.includes(e))))return await d.getUserOperationGasPrice().then((e=>e.fast));if(["rpc.zerodev.app"].some((e=>s.includes(e))))return(await d.request({method:"zd_getUserOperationGasPrice",params:[]})).fast;if(["g.alchemy.com"].some((e=>s.includes(e)))){let[e,t]=await Promise.all([i.getBlock({blockTag:"latest"}),d.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 i.estimateFeesPerGas(),t=s.includes("api.developer.coinbase.com")?175n:150n;return{...e,maxFeePerGas:e.maxFeePerGas*t/100n,maxPriorityFeePerGas:e.maxPriorityFeePerGas*t/100n}}}}})})({owner:i,smartWalletType:m,smartWalletVersion:p,chain:e,publicClient:g,paymasterContext:f,...u});if(!w)throw new h(`Failed to create smart wallet client for chain ${e.name} (eip155:${e.id})`);return w},q=({clientConfig:a,smartWalletsConfig:n})=>{let{hideWalletUIs:l,openPrivyModal:P,appId:I,isHeadlessSigning:W}=f(),v=c(),{setModalData:F}=d(),{user:x}=i(),{chains:G}=c(),{chainId:C,clients:T,setChainId:U,chainIdState:M}=(()=>{let r=e(),[a,n]=t();return{clients:e({}),setChainId:e=>{r.current=e,n(e)},chainId:r,chainIdState:a}})(),b=G.find((e=>e.id===M)),{wallets:O}=u(),S=s(x),V=w(O),A=!!S&&o(S),D=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(V?.getEthereumProvider()),user:x,paymasterContext:a?.paymasterContext,smartWalletsConfig:n,rpcConfig:v.rpcConfig,privyAppId:I});t&&(T.current[e]=t)}U(e)}),[G,a,O,x,n]);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,W({showWalletUIs:t?.uiOptions?.showWalletUIs}))return l.current=!0,await r.sendTransaction(e).finally((()=>l.current=!1));let a=[];"calls"in e&&void 0!==e.calls?a=[...e.calls]:"to"in e&&(a=[{to:e.to,value:e.value||BigInt(0),data:e.data||"0x"}]);let n=async()=>{let{paymasterAndData:t,paymasterData:n,maxFeePerGas:i,maxPriorityFeePerGas:s}=await r.prepareUserOperation({calls:a,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return 0===Number(i)&&0===Number(s)||Number(t??n??0)>0};return new Promise((async(i,s)=>{l.current=!0;let{entropyId:o,entropyIdVerifier:c}=m(x);F({connectWallet:{recoveryMethod:S.recoveryMethod,connectingWalletAddress:S.address,isUnifiedWallet:A,entropyId:o,entropyIdVerifier:c,onCompleteNavigateTo:p,onFailure:()=>{}},sendTransaction:{transactionRequests:$({calls:a,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:n,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 W({showWalletUIs:t?.uiOptions?.showWalletUIs})?(l.current=!0,await r.signMessage(e).finally((()=>l.current=!1))):new Promise((async(a,n)=>{let{entropyId:i,entropyIdVerifier:s}=m(x);l.current=!0,F({connectWallet:{recoveryMethod:S.recoveryMethod,connectingWalletAddress:S.address,isUnifiedWallet:A,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=>a(e),onFailure:n,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,W({showWalletUIs:t?.uiOptions?.showWalletUIs})?(l.current=!0,await r.signTypedData(e).finally((()=>l.current=!1))):new Promise((async(a,n)=>{l.current=!0;let{entropyId:i,entropyIdVerifier:s}=m(x);F({connectWallet:{recoveryMethod:S.recoveryMethod,connectingWalletAddress:S.address,isUnifiedWallet:A,entropyId:i,entropyIdVerifier:s,onCompleteNavigateTo:g,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>r.signTypedData(e),onSuccess:e=>a(e),onFailure:n,uiOptions:t?.uiOptions??{}}}),P(y)})).finally((()=>{l.current=!1}))},getChainId:D,chain:b,switchChain:N}}}},j=()=>{let{hideWalletUIs:e,openPrivyModal:t,isHeadlessSigning:r}=f(),{setModalData:a}=d(),{user:n}=i(),l=s(n),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}=m(n);a({connectWallet:{recoveryMethod:l.recoveryMethod,connectingWalletAddress:l.address,isUnifiedWallet:c,entropyId:h,entropyIdVerifier:f,onCompleteNavigateTo:p,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:p}=m(n);e.current=!0,a({connectWallet:{recoveryMethod:l.recoveryMethod,connectingWalletAddress:l.address,isUnifiedWallet:c,entropyId:u,entropyIdVerifier:p,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:p}=m(n);a({connectWallet:{recoveryMethod:l.recoveryMethod,connectingWalletAddress:l.address,isUnifiedWallet:c,entropyId:u,entropyIdVerifier:p,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 r,useEffect as i,createContext as t}from"react";import{u as n,g as c}from"./use-sign-with-user-signer-DYa7HrQH.mjs";import{o as a,w as l}from"./privy-provider-BkunMgHl.mjs";import{P as s}from"./paths-DCwuPDUk.mjs";import{g as m}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{u as p,g as h,a as u}from"./smart-wallets-ScQvzONo.mjs";import{u as d,a as g}from"./internal-context-qdNgTV5f.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:r})=>/*#__PURE__*/o(y,{children:/*#__PURE__*/o(k,{config:e,children:/*#__PURE__*/o(P,{children:r})})}),f=()=>{let{client:o,getClientForChain:r}=e(C);return{client:o,getClientForChain:r}};let w=/*#__PURE__*/t({config:void 0}),v=()=>{let{config:o}=e(w);return{config:o}},y=({children:e})=>{let[t,n]=r(void 0),{client:c}=d();return i((()=>{!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]=r(),{wrapSmartAccountClientWithUIs:S}=p(),b=c(y),A=m(w);i((()=>{(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 r=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(!r)throw new s(`Failed to create smart wallet client for chain id: ${o}`);return S(r)}},children:t})},W=/*#__PURE__*/t({client:void 0,config:void 0,getClientForChain:g}),P=({children:r})=>{let{client:t,config:c,getClientForChain:a}=(()=>{let{client:o,config:r,getClientForChain:i}=e(W);return{client:o,config:r,getClientForChain:i}})(),{config:l}=v(),{wrapSmartAccountClient:s}=u({clientConfig:c,smartWalletsConfig:l}),{user:m}=n(),{generateSiweMessageForSmartWallet:p,linkSmartWallet:h,hideWalletUIs:g}=d();return i((()=>{(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,smartWalletVersion:l.smartWalletVersion})}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:r})};export{I as SmartWalletsProvider,f as useSmartWallets};
1
+ import{jsx as e}from"react/jsx-runtime";import{useContext as o,useState as i,useEffect as t,createContext as r}from"react";import{u as n,g as c}from"./use-sign-with-user-signer-u7zZ9cLA.mjs";import{o as a,w as l}from"./privy-provider-CoOSBvfN.mjs";import{P as s}from"./paths-DCwuPDUk.mjs";import{g as m}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{u as p,g as h,a as u}from"./smart-wallets-TO2YIcTb.mjs";import{u as d,a as g}from"./internal-context-qdNgTV5f.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"lucide-react";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/20/solid/CheckIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline";import"@tanstack/react-virtual";import"@heroicons/react/24/outline/CheckIcon";import"qrcode";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/solid/CheckCircleIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/XCircleIcon";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/ClipboardDocumentIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/outline/ClockIcon";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__*/r({client:void 0,getClientForChain:g});const f=({config:o,children:i})=>/*#__PURE__*/e(y,{children:/*#__PURE__*/e(k,{config:o,children:/*#__PURE__*/e(P,{children:i})})}),I=()=>{let{client:e,getClientForChain:i}=o(C);return{client:e,getClientForChain:i}};let w=/*#__PURE__*/r({config:void 0}),v=()=>{let{config:e}=o(w);return{config:e}},y=({children:o})=>{let[r,n]=i(void 0),{client:c}=d();return t((()=>{!r&&c&&(async()=>{try{if(!c)return void console.warn("No client found");let e=await c.getSmartWalletsConfig();n(e)}catch(e){console.warn("Error generating smart wallet config: ",e)}})()}),[!!c]),/*#__PURE__*/e(w.Provider,{value:{config:r},children:o})},k=({config:o,children:r})=>{let{config:u}=v(),{appId:g}=d(),{chains:C,defaultChain:f,rpcConfig:I}=a(),{wallets:w}=l(),{user:y}=n(),[k,P]=i(),{wrapSmartAccountClientWithUIs:b}=p(),F=c(y),S=m(w);t((()=>{(async()=>{if(!u?.enabled)return;let e=u.configuredNetworks.find((e=>e.chainId===`eip155:${f.id}`))?f:C.find((e=>u.configuredNetworks.map((e=>e.chainId)).includes(`eip155:${e.id}`)));if(!e)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:e,privyAppId:g,paymasterContext:o?.paymasterContext,rpcConfig:I,account:F,signer:await(S?.getEthereumProvider()),user:y,smartWalletsConfig:u}))})()}),[!!u?.enabled,!!y?.smartWallet,!!S,!!F]);/*#__PURE__*/return e(W.Provider,{value:{client:k,config:o,getClientForChain:async({id:e})=>{let i=await h({chain:C.find((o=>o.id===e)),privyAppId:g,paymasterContext:o?.paymasterContext,rpcConfig:I,account:F,signer:await(S?.getEthereumProvider()),user:y,smartWalletsConfig:u});if(!i)throw new s(`Failed to create smart wallet client for chain id: ${e}`);return b(i)}},children:r})},W=/*#__PURE__*/r({client:void 0,config:void 0,getClientForChain:g}),P=({children:i})=>{let{client:r,config:c,getClientForChain:a}=(()=>{let{client:e,config:i,getClientForChain:t}=o(W);return{client:e,config:i,getClientForChain:t}})(),{config:l}=v(),{wrapSmartAccountClient:s}=u({clientConfig:c,smartWalletsConfig:l}),{user:m}=n(),{generateSiweMessageForSmartWallet:p,linkSmartWallet:h,hideWalletUIs:g}=d();return t((()=>{(async()=>{if(r&&m&&!m?.smartWallet&&l?.enabled)try{let e=await p({address:r.account.address,chainId:`eip155:${r.chain.id}`});g.current=!0;let o=await r.signMessage({message:e});await h({signature:o,message:e,smartWalletType:l.smartWalletType,smartWalletVersion:l.smartWalletVersion})}catch(e){console.error("Error creating smart wallet:",e)}finally{g.current=!1}})()}),[!!r,!!m?.smartWallet,!!l?.enabled]),/*#__PURE__*/e(C.Provider,{value:{client:m?.smartWallet&&r?s(r):void 0,getClientForChain:a},children:i})};export{f as SmartWalletsProvider,I 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{aP as i,p as r,o,aQ as s,aR as a,X as c,e as l,u as d,aS as p,w as h,aT as m,aU as g,aV as A,aW as v,aX as w,aY as f}from"./privy-provider-BkunMgHl.mjs";export{a7 as useSolanaWallets}from"./privy-provider-BkunMgHl.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-qdNgTV5f.mjs";import{u as P,a as O,d as S,e as E}from"./use-sign-with-user-signer-DYa7HrQH.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-DSxHvjFr.mjs";export{u as useFundWallet}from"./useFundWallet-DSxHvjFr.mjs";import"react/jsx-runtime";import"mipd";import"react-device-detect";import"viem/utils";import"@privy-io/js-sdk-core";import"./paths-DCwuPDUk.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{user:e}=P(),{client:t,refreshSessionAndUser:n,initializeWalletProxy:i}=C(),a=r(),c=o();return{importWallet:y((({privateKey:r})=>s({getAccessToken:()=>t.getAccessToken(),user:e,initializeWalletProxy:i,refreshSessionAndUser:n,emitPrivyEvent:a,appConfig:c},{privateKey:r,chainType:"solana"})),[e,t,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 Y(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var q=0;function H(e){return"__private_"+q+++"_"+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 Y(this,L)[L]}get publicKey(){return Y(this,Z)[Z].slice()}get chains(){return Y(this,X)[X].slice()}get features(){return Y(this,N)[N].slice()}get label(){return Y(this,$)[$]}get icon(){return Y(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}),Y(this,L)[L]=e,Y(this,Z)[Z]=t,Y(this,X)[X]=J,Y(this,$)[$]=n,Y(this,ee)[ee]=i,Y(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(),{user:n}=c(),{setModalData:i}=l(),{client:s,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:()=>s.getAccessToken(),isHeadlessSigning:a,emitPrivyEvent:v,setModalData:i,openModal:u,walletProxy:h,user:n,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};
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 a,aQ as s,X as c,e as l,u as d,aR as p,w as h,aS as m,aT as g,aU as w,aV as f,aW as v,aX as A,q as y}from"./privy-provider-CoOSBvfN.mjs";export{a7 as useSolanaWallets}from"./privy-provider-CoOSBvfN.mjs";import{useCallback as b,useMemo as I,useEffect as T,useState as j}from"react";import{u as P,n as C}from"./internal-context-qdNgTV5f.mjs";import{u as O,a as S,d as E,e as _}from"./use-sign-with-user-signer-u7zZ9cLA.mjs";import{VersionedTransaction as M,Connection as k,Transaction as W,TransactionInstruction as B,PublicKey as x}from"@solana/web3.js";import F from"eventemitter3";import{base58 as D}from"@scure/base";import{t as U}from"./useFundWallet-DvuaQdcB.mjs";export{u as useFundWallet}from"./useFundWallet-DvuaQdcB.mjs";import{ConnectedStandardSolanaWallet as Q}from"@privy-io/js-sdk-core";import"react/jsx-runtime";import"mipd";import"react-device-detect";import"viem/utils";import"./paths-DCwuPDUk.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"lucide-react";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/20/solid/CheckIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline";import"@tanstack/react-virtual";import"@heroicons/react/24/outline/CheckIcon";import"qrcode";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/solid/CheckCircleIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/XCircleIcon";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"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/outline/ClockIcon";import"@heroicons/react/24/solid/ShieldCheckIcon";import"js-cookie";import"@solana/spl-token";const V=e=>{let t,{get:r,on:o}=n(),a=e?.shouldAutoConnect??!0,s=new Map,c=[];function l(...e){J(e).forEach((e=>!s.has(e.wallet)&&s.set(e.wallet,e))),c=Array.from(s.values()).map((e=>new i(e,a))),t?.(c)}function u(...e){Array.from(s.keys()).forEach((t=>!e.includes(t)&&s.delete(t))),c=Array.from(s.values()).map((e=>new i(e,a))),t?.(c)}let d=[o("register",l),o("unregister",u)];return J(r()).forEach((e=>!s.has(e.wallet)&&s.set(e.wallet,e))),c=Array.from(s.values()).map((e=>new i(e,a))),{_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 z=()=>{let{user:e}=O(),{client:t,refreshSessionAndUser:n,initializeWalletProxy:i}=P(),s=r(),c=o();return{importWallet:b((({privateKey:r})=>a({getAccessToken:()=>t.getAccessToken(),user:e,initializeWalletProxy:i,refreshSessionAndUser:n,emitPrivyEvent:s,appConfig:c},{privateKey:r,chainType:"solana"})),[e,t,n,i,s])}},K=["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 G(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var q=0,Y="__private_"+q+++"__implementation";function H(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var Z=0;function L(e){return"__private_"+Z+++"_"+e}var X=/*#__PURE__*/L("_address"),N=/*#__PURE__*/L("_publicKey"),$=/*#__PURE__*/L("_chains"),ee=/*#__PURE__*/L("_features"),te=/*#__PURE__*/L("_label"),ne=/*#__PURE__*/L("_icon");class ie{get address(){return H(this,X)[X]}get publicKey(){return H(this,N)[N].slice()}get chains(){return H(this,$)[$].slice()}get features(){return H(this,ee)[ee].slice()}get label(){return H(this,te)[te]}get icon(){return H(this,ne)[ne]}constructor({address:e,publicKey:t,label:n,icon:i}){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}),Object.defineProperty(this,te,{writable:!0,value:void 0}),Object.defineProperty(this,ne,{writable:!0,value:void 0}),H(this,X)[X]=e,H(this,N)[N]=t,H(this,$)[$]=K,H(this,te)[te]=n,H(this,ne)[ne]=i,H(this,ee)[ee]=["solana:signAndSendTransaction","solana:signTransaction","solana:signMessage"],new.target===ie&&Object.freeze(this)}}function re(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var oe=0;function ae(e){return"__private_"+oe+++"_"+e}var se=/*#__PURE__*/ae("_listeners"),ce=/*#__PURE__*/ae("_version"),le=/*#__PURE__*/ae("_name"),ue=/*#__PURE__*/ae("_icon"),de=/*#__PURE__*/ae("_injection"),pe=/*#__PURE__*/ae("_isPrivyWallet"),he=/*#__PURE__*/ae("_accounts"),me=/*#__PURE__*/ae("_on"),ge=/*#__PURE__*/ae("_emit"),we=/*#__PURE__*/ae("_off"),fe=/*#__PURE__*/ae("_connected"),ve=/*#__PURE__*/ae("_connect"),Ae=/*#__PURE__*/ae("_disconnect"),ye=/*#__PURE__*/ae("_signMessage"),be=/*#__PURE__*/ae("_signAndSendTransaction"),Ie=/*#__PURE__*/ae("_signTransaction");function Te(e,...t){re(this,se)[se][e]?.forEach((e=>e.apply(null,t)))}function je(e,t){re(this,se)[se][e]=re(this,se)[se][e]?.filter((e=>t!==e))}function Pe(e){let t=o(),{user:n}=c(),{setModalData:i}=l(),{client:a,isHeadlessSigning:s,openModal:u,walletProxy:h,recoverEmbeddedWallet:m,privy:g,solanaWallets:w}=P(),f=r(),{signWithUserSigner:v}=S();return d("signSolanaTransaction",e),{signTransaction:async({transaction:e,connection:r,uiOptions:o,transactionOptions:c,address:l})=>{let d=l?w.find((e=>e.address===l&&"privy"!==e.walletClientType)):void 0,{signedTransaction:A}=await p({privy:g,appConfig:t,getAccessToken:()=>a.getAccessToken(),isHeadlessSigning:s,emitPrivyEvent:f,setModalData:i,openModal:u,walletProxy:h,user:n,recoverEmbeddedWallet:m,signWithUserSigner:v,connectedExternalWallet:d},{transaction:e,connection:r,transactionOptions:c,uiOptions:o,address:l,signOnly:!0});return A}}}let Ce=new class extends F{setImplementation(e){G(this,Y)[Y]=e}async signMessage(e,t){return G(this,Y)[Y].signMessage(e,t)}async signAndSendTransaction(e,t,n,i){return G(this,Y)[Y].signAndSendTransaction(e,t,n,i)}async signTransaction(e,t,n,i){return G(this,Y)[Y].signTransaction(e,t,n,i)}constructor(e){super(),Object.defineProperty(this,Y,{writable:!0,value:void 0}),G(this,Y)[Y]=e}}({signTransaction:C("signTransaction was not injected"),signAndSendTransaction:C("signAndSendTransaction was not injected"),signMessage:C("signMessage was not injected")}),Oe=new class{get version(){return re(this,ce)[ce]}get name(){return re(this,le)[le]}get icon(){return re(this,ue)[ue]}get chains(){return K.slice()}get features(){return{"standard:connect":{version:"1.0.0",connect:re(this,ve)[ve]},"standard:disconnect":{version:"1.0.0",disconnect:re(this,Ae)[Ae]},"standard:events":{version:"1.0.0",on:re(this,me)[me]},"solana:signAndSendTransaction":{version:"1.0.0",supportedTransactionVersions:["legacy",0],signAndSendTransaction:re(this,be)[be]},"solana:signTransaction":{version:"1.0.0",supportedTransactionVersions:["legacy",0],signTransaction:re(this,Ie)[Ie]},"solana:signMessage":{version:"1.0.0",signMessage:re(this,ye)[ye]},"privy:":{privy:{signMessage:re(this,de)[de].signMessage,signTransaction:re(this,de)[de].signTransaction,signAndSendTransaction:re(this,de)[de].signAndSendTransaction}}}}get accounts(){return re(this,he)[he].slice()}get isPrivyWallet(){return re(this,pe)[pe]}constructor({name:e,icon:t,version:n,injection:i,wallets:r}){Object.defineProperty(this,ge,{value:Te}),Object.defineProperty(this,we,{value:je}),Object.defineProperty(this,se,{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,me,{writable:!0,value:void 0}),Object.defineProperty(this,fe,{writable:!0,value:void 0}),Object.defineProperty(this,ve,{writable:!0,value:void 0}),Object.defineProperty(this,Ae,{writable:!0,value:void 0}),Object.defineProperty(this,ye,{writable:!0,value:void 0}),Object.defineProperty(this,be,{writable:!0,value:void 0}),Object.defineProperty(this,Ie,{writable:!0,value:void 0}),re(this,se)[se]={},re(this,me)[me]=(e,t)=>(re(this,se)[se][e]?.push(t)||(re(this,se)[se][e]=[t]),()=>re(this,we)[we](e,t)),re(this,fe)[fe]=e=>{null!=e&&(re(this,he)[he]=e.map((({address:e})=>new ie({address:e,publicKey:D.decode(e)})))),re(this,ge)[ge]("change",{accounts:this.accounts})},re(this,ve)[ve]=async()=>(re(this,ge)[ge]("change",{accounts:this.accounts}),{accounts:this.accounts}),re(this,Ae)[Ae]=async()=>{re(this,ge)[ge]("change",{accounts:this.accounts})},re(this,ye)[ye]=async(...e)=>{let t=[];for(let{message:n,account:i}of e){let{signature:e}=await re(this,de)[de].signMessage(n,i.address);t.push({signedMessage:n,signature:e})}return t},re(this,be)[be]=async(...e)=>{let t=[];for(let{transaction:n,account:i,options:r,chain:o}of e){let{signature:e}=await re(this,de)[de].signAndSendTransaction(M.deserialize(n),i.address,R(o||"solana:mainnet"),r);t.push({signature:D.decode(e)})}return t},re(this,Ie)[Ie]=async(...e)=>{let t=[];for(let{transaction:n,account:i,options:r,chain:o}of e){let e=await re(this,de)[de].signTransaction(M.deserialize(n),i.address,R(o||"solana:mainnet"),r),a=s(e)?e.serialize():new Uint8Array(e.serialize({requireAllSignatures:!1,verifySignatures:!1}));t.push({signedTransaction:a})}return t},re(this,le)[le]=e,re(this,ue)[ue]=t,re(this,ce)[ce]=n,re(this,de)[de]=i,re(this,he)[he]=[],re(this,pe)[pe]=!0,i.on("accountChanged",re(this,fe)[fe],this),re(this,fe)[fe](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 Se(){let{solanaClusters:e}=o(),{ready:t}=h(),{user:n}=c(),{signMessage:i}=m(),{signTransaction:r}=Pe(),{sendTransaction:a}=g(),s=I((()=>{let e=[...E(n).sort(((e,t)=>(e.walletIndex??0)-(t.walletIndex??0)))],t=_(n);return t?[...e,t]:e}),[n]),l=I((()=>({signMessage:async(e,t)=>({signature:await i({message:e,options:{address:t}})}),async signTransaction(t,n,i){let o=e[i];if(!o)throw Error(`Invalid Solana cluster: ${i}`);let a=new k(o.rpcUrl);return await r({transaction:t,address:n,connection:a})},async signAndSendTransaction(t,n,i,r){let o=e[i];if(!o)throw Error(`Invalid Solana cluster: ${i}`);let s=new k(o.rpcUrl),{signature:c}=await a({transaction:t,connection:s,address:n,transactionOptions:r});return{signature:c}}})),[i,r,a,e]);return T((()=>{Ce?.setImplementation(l)}),[l]),T((()=>{var e;!t||(e=Oe.accounts).length===s.length&&e.every(((e,t)=>e.address===s[t]?.address))||Ce?.emit("accountChanged",s)}),[t,s]),{ready:t,wallet:Oe}}function Ee(){let{client:e}=P(),{ready:t,wallet:n}=Se(),[i,r]=j([]),[o,a]=j([]);return T((()=>{let e=[n,...i.filter((e=>"solana"===e.chainType&&!!e.wallet)).map((e=>e.wallet))];a(e);let t=e.map((t=>t.features["standard:events"]?.on("change",(()=>{a([...e])}))));return()=>{t.forEach((e=>e?.()))}}),[i]),T((()=>{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 _e=()=>w(U),Me={id:f,prepareSiwsTransactionWithMemo:({address:e,nonce:t})=>{let n=v({address:e,nonce:t}),i=new W,r=new B({keys:[{pubkey:new x(e),isSigner:!0,isWritable:!1}],programId:new x("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),data:Buffer.from(n,"utf-8")});return i.add(r),i.feePayer=new x(e),i.recentBlockhash="GfVcyD5fWFJ6hRm8bsy7CoVPsLSoJhtJKRJYk8T2VVFN",i.serialize({requireAllSignatures:!1}).toString("base64")},deserializeTransactionFromB64String:e=>W.from(A(e,"base64"))},ke=()=>w(Me);function We(){let{ready:e,wallets:t}=Ee();return{ready:e,wallets:I((()=>t.flatMap((e=>e.accounts.map((t=>new Q({wallet:e,account:t})))))),[t])}}function Be(){let{create:e}=y();return{createWallet:async t=>{t&&"target"in t&&t&&(t=void 0);let{account:n}=await e({chainType:"solana",options:t});return{wallet:n}}}}function xe(){let{exportSolanaWallet:e}=P();return{exportWallet:e}}export{i as SolanaAdapterConnector,V as toSolanaWalletConnectors,We as useConnectedStandardWallets,Be as useCreateWallet,xe as useExportWallet,z as useImportWallet,Se as usePrivyStandardWallet,g as useSendTransaction,m as useSignMessage,Pe as useSignTransaction,_e as useSolanaFundingPlugin,ke as useSolanaLedgerPlugin,Ee as useSolanaStandardWallets};