@privy-io/react-auth 2.20.0 → 2.21.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 (39) 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/{privy-provider-C10uh7jj.js → privy-provider-NikYcweE.js} +22 -22
  6. package/dist/cjs/{smart-wallets-BZ1m1NrG.js → smart-wallets-mWRMk0wI.js} +1 -1
  7. package/dist/cjs/smart-wallets.js +1 -1
  8. package/dist/cjs/solana.js +1 -1
  9. package/dist/cjs/ui.js +1 -1
  10. package/dist/cjs/{useActiveWallet-Bwo1C1JJ.js → useActiveWallet-D0kSB8pr.js} +1 -1
  11. package/dist/cjs/{useFundWallet-w17P8l1R.js → useFundWallet-BLnL9YuU.js} +1 -1
  12. package/dist/dts/extended-chains.d.mts +3 -3
  13. package/dist/dts/extended-chains.d.ts +3 -3
  14. package/dist/dts/farcaster.d.mts +37 -7
  15. package/dist/dts/farcaster.d.ts +37 -7
  16. package/dist/dts/index.d.mts +16 -5
  17. package/dist/dts/index.d.ts +16 -5
  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 +4 -4
  21. package/dist/dts/solana.d.ts +4 -4
  22. package/dist/dts/{types-Dmys-XR7.d.mts → types-DYBA51G_.d.mts} +14 -2
  23. package/dist/dts/{types-Dmys-XR7.d.ts → types-DYBA51G_.d.ts} +14 -2
  24. package/dist/dts/ui.d.mts +1 -1
  25. package/dist/dts/ui.d.ts +1 -1
  26. package/dist/dts/{useSolanaWallets-C9c0550h.d.mts → useSolanaWallets-BiSasRT6.d.mts} +1 -1
  27. package/dist/dts/{useSolanaWallets-C9c0550h.d.ts → useSolanaWallets-BiSasRT6.d.ts} +1 -1
  28. package/dist/esm/abstract-smart-wallets.mjs +1 -1
  29. package/dist/esm/extended-chains.mjs +1 -1
  30. package/dist/esm/farcaster.mjs +1 -1
  31. package/dist/esm/index.mjs +1 -1
  32. package/dist/esm/{privy-provider-DRh_qFir.mjs → privy-provider-NPBEALzA.mjs} +23 -23
  33. package/dist/esm/{smart-wallets-BVE7Yf57.mjs → smart-wallets-JbwIgnkS.mjs} +1 -1
  34. package/dist/esm/smart-wallets.mjs +1 -1
  35. package/dist/esm/solana.mjs +1 -1
  36. package/dist/esm/ui.mjs +2 -2
  37. package/dist/esm/{useActiveWallet-BrSwJdVC.mjs → useActiveWallet-MSI4YjRM.mjs} +1 -1
  38. package/dist/esm/{useFundWallet-Ca0OzIi8.mjs → useFundWallet-Cv33RFig.mjs} +1 -1
  39. package/package.json +4 -4
@@ -1 +1 @@
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-CyFzXla-.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-DRh_qFir.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
+ 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-CyFzXla-.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-NPBEALzA.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 +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-CyFzXla-.mjs";import{o as a,w as l}from"./privy-provider-DRh_qFir.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-BVE7Yf57.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 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-CyFzXla-.mjs";import{o as a,w as l}from"./privy-provider-NPBEALzA.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-JbwIgnkS.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 +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{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-DRh_qFir.mjs";export{a7 as useSolanaWallets}from"./privy-provider-DRh_qFir.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-CyFzXla-.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-Ca0OzIi8.mjs";export{u as useFundWallet}from"./useFundWallet-Ca0OzIi8.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{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};
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-NPBEALzA.mjs";export{a7 as useSolanaWallets}from"./privy-provider-NPBEALzA.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-CyFzXla-.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-Cv33RFig.mjs";export{u as useFundWallet}from"./useFundWallet-Cv33RFig.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{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 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(),{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};