@privy-io/react-auth 2.8.3 → 2.9.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 (33) hide show
  1. package/dist/cjs/abstract-smart-wallets.js +1 -1
  2. package/dist/cjs/index.js +1 -1
  3. package/dist/cjs/{privy-provider-FtDgdqaz.js → privy-provider-COW8bXG_.js} +9 -8
  4. package/dist/cjs/{smart-wallets-DpZ1VbmP.js → smart-wallets-BlQqPUkn.js} +1 -1
  5. package/dist/cjs/smart-wallets.js +1 -1
  6. package/dist/cjs/solana.js +1 -1
  7. package/dist/cjs/ui.js +1 -1
  8. package/dist/cjs/{useActiveWallet-b98a2Pfo.js → useActiveWallet-aq96kDBK.js} +1 -1
  9. package/dist/cjs/{useFundWallet-CK866vxp.js → useFundWallet-Q4YDjdfL.js} +1 -1
  10. package/dist/dts/farcaster.d.mts +1 -1
  11. package/dist/dts/farcaster.d.ts +1 -1
  12. package/dist/dts/index.d.mts +4 -4
  13. package/dist/dts/index.d.ts +4 -4
  14. package/dist/dts/smart-wallets.d.mts +1 -1
  15. package/dist/dts/smart-wallets.d.ts +1 -1
  16. package/dist/dts/solana.d.mts +4 -4
  17. package/dist/dts/solana.d.ts +4 -4
  18. package/dist/dts/{types-B92M8x5e.d.mts → types-KvucBAHb.d.mts} +4 -2
  19. package/dist/dts/{types-B92M8x5e.d.ts → types-KvucBAHb.d.ts} +4 -2
  20. package/dist/dts/ui.d.mts +1 -1
  21. package/dist/dts/ui.d.ts +1 -1
  22. package/dist/dts/{useSolanaWallets-BSNPWBSM.d.mts → useSolanaWallets-DNXOzCOL.d.mts} +1 -1
  23. package/dist/dts/{useSolanaWallets-BSNPWBSM.d.ts → useSolanaWallets-DNXOzCOL.d.ts} +1 -1
  24. package/dist/esm/abstract-smart-wallets.mjs +1 -1
  25. package/dist/esm/index.mjs +1 -1
  26. package/dist/esm/{privy-provider-8kKbowq5.mjs → privy-provider-D5n8VKd6.mjs} +9 -8
  27. package/dist/esm/{smart-wallets-Cb3AejtF.mjs → smart-wallets-BysbTeHa.mjs} +1 -1
  28. package/dist/esm/smart-wallets.mjs +1 -1
  29. package/dist/esm/solana.mjs +1 -1
  30. package/dist/esm/ui.mjs +2 -2
  31. package/dist/esm/{useActiveWallet-Cpqv9qnc.mjs → useActiveWallet-D148SCAa.mjs} +1 -1
  32. package/dist/esm/{useFundWallet-Lp53P4p6.mjs → useFundWallet-DT4w0BAE.mjs} +1 -1
  33. package/package.json +5 -5
@@ -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{n as i,f as s,an as o,u as l,l as c,m as d,a as u,ax as p,aw as m,av as y}from"./privy-provider-8kKbowq5.mjs";import{P as g,u as h}from"./internal-context-D5bEplez.mjs";import{g as f}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{createSmartAccountClient as w}from"permissionless";import{toThirdwebSmartAccount as P,toLightSmartAccount as I,toBiconomySmartAccount as v,toEcdsaKernelSmartAccount as F,toSafeSmartAccount as W}from"permissionless/accounts";import{createPimlicoClient as x}from"permissionless/clients/pimlico";import{toCoinbaseSmartAccount as G,entryPoint06Address as C,entryPoint07Address as T}from"viem/account-abstraction";import{THIRDWEB as M,COINBASE_SMART_WALLET as O,LIGHT_ACCOUNT as S,BICONOMY as b,KERNEL as U,SAFE as A}from"@privy-io/js-sdk-core";let D={address:C,version:"0.6"},V={address:T,version:"0.7"},_=({owner:e,smartWalletType:t,publicClient:r})=>{switch(t){case A:return W({client:r,entryPoint:V,owners:[e],version:"1.4.1"});case U:return F({client:r,version:"0.3.1",entryPoint:V,owners:[e]});case b:return v({client:r,owners:[e],entryPoint:D});case S:return I({client:r,entryPoint:D,owner:e,version:"1.1.0"});case O:return async function({client:e,owner:t}){let[r]=await t.request({method:"eth_accounts"});if(!r)throw Error("Unable to request embedded owner for eth_accounts");return await G({client:e,owners:[{type:"local",source:"privy",address:r,sign:async({hash:e})=>await t.request({method:"secp256k1_sign",params:[e]})}]})}({client:r,owner:e});case M:return P({client:r,entryPoint:V,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}))),N=async({chain:e,paymasterContext:t,embeddedWallet:r,user:s,smartWalletsConfig:o,rpcConfig:l,privyAppId:c})=>{if(!o?.enabled||!s||!r)return;let d=await r.getEthereumProvider(),u=o?.configuredNetworks.find((t=>t.chainId===`eip155:${e.id}`));if(!u)throw new g(`The chain ${e.name} (eip155:${e.id}) must be configured in the smart wallet configuration in your dashboard`);let p=s.smartWallet?.smartWalletType??o.smartWalletType,m=i(e,l,c),y=a({chain:e,transport:n(m)}),h=t??u.paymasterContext,f=await(async({owner:e,smartWalletType:t,chain:r,publicClient:a,bundlerUrl:i,paymasterUrl:s,paymasterContext:o})=>{let l=await _({owner:e,smartWalletType:t,publicClient:a}),c=x({transport:n(i),entryPoint:l.entryPoint}),d=s?x({transport:n(s),entryPoint:l.entryPoint}):void 0;return w({account:l,chain:r,paymaster:d,paymasterContext:o,bundlerTransport:n(i),userOperation:{estimateFeesPerGas:async()=>{if(["public.pimlico.io","api.pimlico.io"].some((e=>i.includes(e))))return await c.getUserOperationGasPrice().then((e=>e.fast));if(["rpc.zerodev.app"].some((e=>i.includes(e))))return(await c.request({method:"zd_getUserOperationGasPrice",params:[]})).fast;if(["g.alchemy.com"].some((e=>i.includes(e)))){let[e,t]=await Promise.all([a.getBlock({blockTag:"latest"}),c.request({method:"rundler_maxPriorityFeePerGas",params:[]})]);if(!e.baseFeePerGas||!t)throw Error("Failed to get block or maxPriorityFeePerGasEstimate");return{maxFeePerGas:150n*e.baseFeePerGas/100n+BigInt(t.toString()),maxPriorityFeePerGas:BigInt(t.toString())}}{let e=await a.estimateFeesPerGas(),t=i.includes("api.developer.coinbase.com")?175n:150n;return{...e,maxFeePerGas:e.maxFeePerGas*t/100n,maxPriorityFeePerGas:e.maxPriorityFeePerGas*t/100n}}}}})})({owner:d,smartWalletType:p,chain:e,publicClient:y,paymasterContext:h,...u});if(!f)throw new g(`Failed to create smart wallet client for chain ${e.name} (eip155:${e.id})`);return f},$=({clientConfig:n,smartWalletsConfig:a})=>{let{hideWalletUIs:i,openPrivyModal:w,appId:P,isHeadlessSigning:I}=h(),v=s(),{setModalData:F}=o(),{user:W}=l(),{chains:x}=s(),{chainId:G,clients:C,setChainId:T,chainIdState:M}=(()=>{let r=e(),[n,a]=t();return{clients:e({}),setChainId:e=>{r.current=e,a(e)},chainId:r,chainIdState:n}})(),O=x.find((e=>e.id===M)),{wallets:S}=c(),b=f(S),U=d(W),A=r((async()=>G.current),[G]),D=r((async({id:e})=>{if(!C.current[e]){let t=await N({chain:x.find((t=>t.id===e)),embeddedWallet:b,user:W,paymasterContext:n?.paymasterContext,smartWalletsConfig:a,rpcConfig:v.rpcConfig,privyAppId:P});t&&(C.current[e]=t)}T(e)}),[x,n,S,W,a]);return{wrapSmartAccountClient:e=>{C.current[e.chain.id]=e,M||T(e.chain.id);return{...e,sendTransaction:async(e,t)=>{let r=C.current[G.current];if(!r)throw new g(`Smart wallet client for chain (eip155:${G.current}) not found`);if(delete e.account,I({showWalletUIs:t?.uiOptions?.showWalletUIs}))return i.current=!0,await r.sendTransaction(e).finally((()=>i.current=!1));let n=[];"calls"in e&&void 0!==e.calls?n=[...e.calls]:"to"in e&&(n=[{to:e.to,value:e.value||BigInt(0),data:e.data||"0x"}]);let a=async()=>{if(!r.paymaster)return!1;let{paymasterAndData:t,paymasterData:a}=await r.prepareUserOperation({calls:n,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return Number(t??a??0)>0};return new Promise((async(s,o)=>{i.current=!0;let{entropyId:l,entropyIdVerifier:c}=u(W);F({connectWallet:{recoveryMethod:U.recoveryMethod,connectingWalletAddress:U.address,entropyId:l,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:l,entropyIdVerifier:c,getIsSponsored:a,signOnly:!1,onConfirm:()=>r.sendTransaction(e),onSuccess:e=>s(e.hash),onFailure:o,uiOptions:t?.uiOptions??{}}}),w(m)})).finally((()=>{i.current=!1}))},signMessage:async(e,t)=>{let r=C.current[G.current];if(!r)throw new g(`Smart wallet client for chain (eip155:${G.current}) not found`);return I({showWalletUIs:t?.uiOptions?.showWalletUIs})?(i.current=!0,await r.signMessage(e).finally((()=>i.current=!1))):new Promise((async(n,a)=>{let{entropyId:s,entropyIdVerifier:o}=u(W);i.current=!0,F({connectWallet:{recoveryMethod:U.recoveryMethod,connectingWalletAddress:U.address,entropyId:s,entropyIdVerifier:o,onCompleteNavigateTo:y,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??{}}}),w(m)})).finally((()=>{i.current=!1}))},signTypedData:async(e,t)=>{let r=C.current[G.current];if(!r)throw new g(`Smart wallet client for chain (eip155:${G.current}) not found`);return delete e.account,I({showWalletUIs:t?.uiOptions?.showWalletUIs})?(i.current=!0,await r.signTypedData(e).finally((()=>i.current=!1))):new Promise((async(n,a)=>{i.current=!0;let{entropyId:s,entropyIdVerifier:o}=u(W);F({connectWallet:{recoveryMethod:U.recoveryMethod,connectingWalletAddress:U.address,entropyId:s,entropyIdVerifier:o,onCompleteNavigateTo:y,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>r.signTypedData(e),onSuccess:e=>n(e),onFailure:a,uiOptions:t?.uiOptions??{}}}),w(m)})).finally((()=>{i.current=!1}))},getChainId:A,chain:O,switchChain:D}}}},q=()=>{let{hideWalletUIs:e,openPrivyModal:t,isHeadlessSigning:r}=h(),{setModalData:n}=o(),{user:a}=l(),i=d(a);return{wrapSmartAccountClientWithUIs:s=>({...s,sendTransaction:async(o,l)=>{if(r({showWalletUIs:l?.uiOptions?.showWalletUIs}))return e.current=!0,await s.sendTransaction(o).finally((()=>e.current=!1));let c=[];"calls"in o&&void 0!==o.calls?c=[...o.calls]:"to"in o&&(c=[{to:o.to,value:o.value||BigInt(0),data:o.data||"0x"}]);let d=async()=>{if(!s.paymaster)return!1;let{paymasterAndData:e,paymasterData:t}=await s.prepareUserOperation({calls:c,maxFeePerGas:o.maxFeePerGas,maxPriorityFeePerGas:o.maxPriorityFeePerGas,nonce:o.nonce?BigInt(o.nonce):void 0});return Number(e??t??0)>0};return new Promise((async(r,y)=>{e.current=!0;let{entropyId:g,entropyIdVerifier:h}=u(a);n({connectWallet:{recoveryMethod:i.recoveryMethod,connectingWalletAddress:i.address,entropyId:g,entropyIdVerifier:h,onCompleteNavigateTo:p,onFailure:()=>{}},sendTransaction:{transactionRequests:B({calls:c,chain:s.chain,maxPriorityFeePerGas:o.maxPriorityFeePerGas,maxFeePerGas:o.maxFeePerGas,nonce:o.nonce?BigInt(o.nonce):void 0}),transactingWalletIndex:0,transactingWalletAddress:s.account.address,entropyId:g,entropyIdVerifier:h,getIsSponsored:d,signOnly:!1,onConfirm:()=>s.sendTransaction(o),onSuccess:e=>r(e.hash),onFailure:y,uiOptions:l?.uiOptions??{}}}),t(m)})).finally((()=>{e.current=!1}))},signMessage:async(o,l)=>r({showWalletUIs:l?.uiOptions?.showWalletUIs})?(e.current=!0,await s.signMessage(o).finally((()=>e.current=!1))):new Promise((async(r,c)=>{let{entropyId:d,entropyIdVerifier:p}=u(a);e.current=!0,n({connectWallet:{recoveryMethod:i.recoveryMethod,connectingWalletAddress:i.address,entropyId:d,entropyIdVerifier:p,onCompleteNavigateTo:y,onFailure:()=>{}},signMessage:{method:"personal_sign",data:"string"==typeof o.message?o.message:o.message.raw.toString(),confirmAndSign:()=>s.signMessage(o),onSuccess:e=>r(e),onFailure:c,uiOptions:l?.uiOptions??{}}}),t(m)})).finally((()=>{e.current=!1})),signTypedData:async(o,l)=>r({showWalletUIs:l?.uiOptions?.showWalletUIs})?(e.current=!0,await s.signTypedData(o).finally((()=>e.current=!1))):new Promise((async(r,c)=>{e.current=!0;let{entropyId:d,entropyIdVerifier:p}=u(a);n({connectWallet:{recoveryMethod:i.recoveryMethod,connectingWalletAddress:i.address,entropyId:d,entropyIdVerifier:p,onCompleteNavigateTo:y,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:o,confirmAndSign:()=>s.signTypedData(o),onSuccess:e=>r(e),onFailure:c,uiOptions:l?.uiOptions??{}}}),t(m)})).finally((()=>{e.current=!1}))})}};export{$ as a,B as c,N as g,q 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{n as i,f as s,an as o,u as l,l as c,m as d,a as u,ax as p,aw as m,av as y}from"./privy-provider-D5n8VKd6.mjs";import{P as g,u as h}from"./internal-context-D5bEplez.mjs";import{g as f}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{createSmartAccountClient as w}from"permissionless";import{toThirdwebSmartAccount as P,toLightSmartAccount as I,toBiconomySmartAccount as v,toEcdsaKernelSmartAccount as F,toSafeSmartAccount as W}from"permissionless/accounts";import{createPimlicoClient as x}from"permissionless/clients/pimlico";import{toCoinbaseSmartAccount as G,entryPoint06Address as C,entryPoint07Address as T}from"viem/account-abstraction";import{THIRDWEB as M,COINBASE_SMART_WALLET as O,LIGHT_ACCOUNT as S,BICONOMY as b,KERNEL as U,SAFE as A}from"@privy-io/js-sdk-core";let D={address:C,version:"0.6"},V={address:T,version:"0.7"},_=({owner:e,smartWalletType:t,publicClient:r})=>{switch(t){case A:return W({client:r,entryPoint:V,owners:[e],version:"1.4.1"});case U:return F({client:r,version:"0.3.1",entryPoint:V,owners:[e]});case b:return v({client:r,owners:[e],entryPoint:D});case S:return I({client:r,entryPoint:D,owner:e,version:"1.1.0"});case O:return async function({client:e,owner:t}){let[r]=await t.request({method:"eth_accounts"});if(!r)throw Error("Unable to request embedded owner for eth_accounts");return await G({client:e,owners:[{type:"local",source:"privy",address:r,sign:async({hash:e})=>await t.request({method:"secp256k1_sign",params:[e]})}]})}({client:r,owner:e});case M:return P({client:r,entryPoint:V,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}))),N=async({chain:e,paymasterContext:t,embeddedWallet:r,user:s,smartWalletsConfig:o,rpcConfig:l,privyAppId:c})=>{if(!o?.enabled||!s||!r)return;let d=await r.getEthereumProvider(),u=o?.configuredNetworks.find((t=>t.chainId===`eip155:${e.id}`));if(!u)throw new g(`The chain ${e.name} (eip155:${e.id}) must be configured in the smart wallet configuration in your dashboard`);let p=s.smartWallet?.smartWalletType??o.smartWalletType,m=i(e,l,c),y=a({chain:e,transport:n(m)}),h=t??u.paymasterContext,f=await(async({owner:e,smartWalletType:t,chain:r,publicClient:a,bundlerUrl:i,paymasterUrl:s,paymasterContext:o})=>{let l=await _({owner:e,smartWalletType:t,publicClient:a}),c=x({transport:n(i),entryPoint:l.entryPoint}),d=s?x({transport:n(s),entryPoint:l.entryPoint}):void 0;return w({account:l,chain:r,paymaster:d,paymasterContext:o,bundlerTransport:n(i),userOperation:{estimateFeesPerGas:async()=>{if(["public.pimlico.io","api.pimlico.io"].some((e=>i.includes(e))))return await c.getUserOperationGasPrice().then((e=>e.fast));if(["rpc.zerodev.app"].some((e=>i.includes(e))))return(await c.request({method:"zd_getUserOperationGasPrice",params:[]})).fast;if(["g.alchemy.com"].some((e=>i.includes(e)))){let[e,t]=await Promise.all([a.getBlock({blockTag:"latest"}),c.request({method:"rundler_maxPriorityFeePerGas",params:[]})]);if(!e.baseFeePerGas||!t)throw Error("Failed to get block or maxPriorityFeePerGasEstimate");return{maxFeePerGas:150n*e.baseFeePerGas/100n+BigInt(t.toString()),maxPriorityFeePerGas:BigInt(t.toString())}}{let e=await a.estimateFeesPerGas(),t=i.includes("api.developer.coinbase.com")?175n:150n;return{...e,maxFeePerGas:e.maxFeePerGas*t/100n,maxPriorityFeePerGas:e.maxPriorityFeePerGas*t/100n}}}}})})({owner:d,smartWalletType:p,chain:e,publicClient:y,paymasterContext:h,...u});if(!f)throw new g(`Failed to create smart wallet client for chain ${e.name} (eip155:${e.id})`);return f},$=({clientConfig:n,smartWalletsConfig:a})=>{let{hideWalletUIs:i,openPrivyModal:w,appId:P,isHeadlessSigning:I}=h(),v=s(),{setModalData:F}=o(),{user:W}=l(),{chains:x}=s(),{chainId:G,clients:C,setChainId:T,chainIdState:M}=(()=>{let r=e(),[n,a]=t();return{clients:e({}),setChainId:e=>{r.current=e,a(e)},chainId:r,chainIdState:n}})(),O=x.find((e=>e.id===M)),{wallets:S}=c(),b=f(S),U=d(W),A=r((async()=>G.current),[G]),D=r((async({id:e})=>{if(!C.current[e]){let t=await N({chain:x.find((t=>t.id===e)),embeddedWallet:b,user:W,paymasterContext:n?.paymasterContext,smartWalletsConfig:a,rpcConfig:v.rpcConfig,privyAppId:P});t&&(C.current[e]=t)}T(e)}),[x,n,S,W,a]);return{wrapSmartAccountClient:e=>{C.current[e.chain.id]=e,M||T(e.chain.id);return{...e,sendTransaction:async(e,t)=>{let r=C.current[G.current];if(!r)throw new g(`Smart wallet client for chain (eip155:${G.current}) not found`);if(delete e.account,I({showWalletUIs:t?.uiOptions?.showWalletUIs}))return i.current=!0,await r.sendTransaction(e).finally((()=>i.current=!1));let n=[];"calls"in e&&void 0!==e.calls?n=[...e.calls]:"to"in e&&(n=[{to:e.to,value:e.value||BigInt(0),data:e.data||"0x"}]);let a=async()=>{if(!r.paymaster)return!1;let{paymasterAndData:t,paymasterData:a}=await r.prepareUserOperation({calls:n,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return Number(t??a??0)>0};return new Promise((async(s,o)=>{i.current=!0;let{entropyId:l,entropyIdVerifier:c}=u(W);F({connectWallet:{recoveryMethod:U.recoveryMethod,connectingWalletAddress:U.address,entropyId:l,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:l,entropyIdVerifier:c,getIsSponsored:a,signOnly:!1,onConfirm:()=>r.sendTransaction(e),onSuccess:e=>s(e.hash),onFailure:o,uiOptions:t?.uiOptions??{}}}),w(m)})).finally((()=>{i.current=!1}))},signMessage:async(e,t)=>{let r=C.current[G.current];if(!r)throw new g(`Smart wallet client for chain (eip155:${G.current}) not found`);return I({showWalletUIs:t?.uiOptions?.showWalletUIs})?(i.current=!0,await r.signMessage(e).finally((()=>i.current=!1))):new Promise((async(n,a)=>{let{entropyId:s,entropyIdVerifier:o}=u(W);i.current=!0,F({connectWallet:{recoveryMethod:U.recoveryMethod,connectingWalletAddress:U.address,entropyId:s,entropyIdVerifier:o,onCompleteNavigateTo:y,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??{}}}),w(m)})).finally((()=>{i.current=!1}))},signTypedData:async(e,t)=>{let r=C.current[G.current];if(!r)throw new g(`Smart wallet client for chain (eip155:${G.current}) not found`);return delete e.account,I({showWalletUIs:t?.uiOptions?.showWalletUIs})?(i.current=!0,await r.signTypedData(e).finally((()=>i.current=!1))):new Promise((async(n,a)=>{i.current=!0;let{entropyId:s,entropyIdVerifier:o}=u(W);F({connectWallet:{recoveryMethod:U.recoveryMethod,connectingWalletAddress:U.address,entropyId:s,entropyIdVerifier:o,onCompleteNavigateTo:y,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>r.signTypedData(e),onSuccess:e=>n(e),onFailure:a,uiOptions:t?.uiOptions??{}}}),w(m)})).finally((()=>{i.current=!1}))},getChainId:A,chain:O,switchChain:D}}}},q=()=>{let{hideWalletUIs:e,openPrivyModal:t,isHeadlessSigning:r}=h(),{setModalData:n}=o(),{user:a}=l(),i=d(a);return{wrapSmartAccountClientWithUIs:s=>({...s,sendTransaction:async(o,l)=>{if(r({showWalletUIs:l?.uiOptions?.showWalletUIs}))return e.current=!0,await s.sendTransaction(o).finally((()=>e.current=!1));let c=[];"calls"in o&&void 0!==o.calls?c=[...o.calls]:"to"in o&&(c=[{to:o.to,value:o.value||BigInt(0),data:o.data||"0x"}]);let d=async()=>{if(!s.paymaster)return!1;let{paymasterAndData:e,paymasterData:t}=await s.prepareUserOperation({calls:c,maxFeePerGas:o.maxFeePerGas,maxPriorityFeePerGas:o.maxPriorityFeePerGas,nonce:o.nonce?BigInt(o.nonce):void 0});return Number(e??t??0)>0};return new Promise((async(r,y)=>{e.current=!0;let{entropyId:g,entropyIdVerifier:h}=u(a);n({connectWallet:{recoveryMethod:i.recoveryMethod,connectingWalletAddress:i.address,entropyId:g,entropyIdVerifier:h,onCompleteNavigateTo:p,onFailure:()=>{}},sendTransaction:{transactionRequests:B({calls:c,chain:s.chain,maxPriorityFeePerGas:o.maxPriorityFeePerGas,maxFeePerGas:o.maxFeePerGas,nonce:o.nonce?BigInt(o.nonce):void 0}),transactingWalletIndex:0,transactingWalletAddress:s.account.address,entropyId:g,entropyIdVerifier:h,getIsSponsored:d,signOnly:!1,onConfirm:()=>s.sendTransaction(o),onSuccess:e=>r(e.hash),onFailure:y,uiOptions:l?.uiOptions??{}}}),t(m)})).finally((()=>{e.current=!1}))},signMessage:async(o,l)=>r({showWalletUIs:l?.uiOptions?.showWalletUIs})?(e.current=!0,await s.signMessage(o).finally((()=>e.current=!1))):new Promise((async(r,c)=>{let{entropyId:d,entropyIdVerifier:p}=u(a);e.current=!0,n({connectWallet:{recoveryMethod:i.recoveryMethod,connectingWalletAddress:i.address,entropyId:d,entropyIdVerifier:p,onCompleteNavigateTo:y,onFailure:()=>{}},signMessage:{method:"personal_sign",data:"string"==typeof o.message?o.message:o.message.raw.toString(),confirmAndSign:()=>s.signMessage(o),onSuccess:e=>r(e),onFailure:c,uiOptions:l?.uiOptions??{}}}),t(m)})).finally((()=>{e.current=!1})),signTypedData:async(o,l)=>r({showWalletUIs:l?.uiOptions?.showWalletUIs})?(e.current=!0,await s.signTypedData(o).finally((()=>e.current=!1))):new Promise((async(r,c)=>{e.current=!0;let{entropyId:d,entropyIdVerifier:p}=u(a);n({connectWallet:{recoveryMethod:i.recoveryMethod,connectingWalletAddress:i.address,entropyId:d,entropyIdVerifier:p,onCompleteNavigateTo:y,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:o,confirmAndSign:()=>s.signTypedData(o),onSuccess:e=>r(e),onFailure:c,uiOptions:l?.uiOptions??{}}}),t(m)})).finally((()=>{e.current=!1}))})}};export{$ as a,B as c,N as g,q as u};
@@ -1 +1 @@
1
- import{jsx as o}from"react/jsx-runtime";import{useContext as e,useState as i,useEffect as r,createContext as t}from"react";import{f as n,l as c,u as a}from"./privy-provider-8kKbowq5.mjs";import{u as l,P as s,n as m}from"./internal-context-D5bEplez.mjs";import{g as p}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{u as h,g as d,a as u}from"./smart-wallets-Cb3AejtF.mjs";import"mipd";import"react-device-detect";import"viem/utils";import"@privy-io/js-sdk-core";import"viem";import"uuid";import"jose";import"eventemitter3";import"@coinbase/wallet-sdk";import"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"zustand";import"fast-password-entropy";import"secure-password-utilities";import"secure-password-utilities/wordlists";import"@heroicons/react/24/outline/UserCircleIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/20/solid/CheckIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import"@heroicons/react/24/solid/DocumentCheckIcon";import"@heroicons/react/24/solid/XCircleIcon";import"@heroicons/react/24/solid/CheckCircleIcon";import"qrcode";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/LockClosedIcon";import"@heroicons/react/24/outline/PencilSquareIcon";import"@heroicons/react/24/outline/ArrowPathIcon";import"@heroicons/react/24/outline/EyeIcon";import"@heroicons/react/24/outline/EyeSlashIcon";import"@heroicons/react/24/outline/KeyIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/LockClosedIcon";import"@heroicons/react/24/outline/CheckCircleIcon";import"@heroicons/react/24/outline/InformationCircleIcon";import"@heroicons/react/24/outline/CreditCardIcon";import"@heroicons/react/24/outline/QrCodeIcon";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";import"@heroicons/react/24/outline/GlobeAltIcon";import"ofetch";import"@heroicons/react/24/outline";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@heroicons/react/24/outline/CloudArrowUpIcon";import"@heroicons/react/24/outline/NoSymbolIcon";import"@heroicons/react/24/outline/ClockIcon";import"@heroicons/react/24/outline/TrashIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/solid/ShieldCheckIcon";import"js-cookie";import"permissionless";import"permissionless/accounts";import"permissionless/clients/pimlico";import"viem/account-abstraction";let C=/*#__PURE__*/t({client:void 0,getClientForChain:m});const g=({config:e,children:i})=>/*#__PURE__*/o(v,{children:/*#__PURE__*/o(y,{config:e,children:/*#__PURE__*/o(W,{children:i})})}),I=()=>{let{client:o,getClientForChain:i}=e(C);return{client:o,getClientForChain:i}};let f=/*#__PURE__*/t({config:void 0}),w=()=>{let{config:o}=e(f);return{config:o}},v=({children:e})=>{let[t,n]=i(void 0),{client:c}=l();return r((()=>{!t&&c&&(async()=>{try{if(!c)return void console.warn("No client found");let o=await c.getSmartWalletsConfig();n(o)}catch(o){console.warn("Error generating smart wallet config: ",o)}})()}),[!!c]),/*#__PURE__*/o(f.Provider,{value:{config:t},children:e})},y=({config:e,children:t})=>{let{config:m}=w(),{appId:u}=l(),{chains:C,defaultChain:g,rpcConfig:I}=n(),{wallets:f}=c(),{user:v}=a(),[y,W]=i(),{wrapSmartAccountClientWithUIs:b}=h(),S=p(f);r((()=>{(async()=>{if(!m?.enabled)return;let o=m.configuredNetworks.find((o=>o.chainId===`eip155:${g.id}`))?g:C.find((o=>m.configuredNetworks.map((o=>o.chainId)).includes(`eip155:${o.id}`)));if(!o)throw new s("Could not find smart wallets chain configurations for any Privy client configured chains. Please configure smart wallets for your chains in the Privy dashboard.");W(await d({chain:o,privyAppId:u,paymasterContext:e?.paymasterContext,rpcConfig:I,embeddedWallet:S,user:v,smartWalletsConfig:m}))})()}),[!!m?.enabled,!!v?.smartWallet,!!S]);/*#__PURE__*/return o(k.Provider,{value:{client:y,config:e,getClientForChain:async({id:o})=>{let i=p(f),r=await d({chain:C.find((e=>e.id===o)),privyAppId:u,paymasterContext:e?.paymasterContext,rpcConfig:I,embeddedWallet:i,user:v,smartWalletsConfig:m});if(!r)throw new s(`Failed to create smart wallet client for chain id: ${o}`);return b(r)}},children:t})},k=/*#__PURE__*/t({client:void 0,config:void 0,getClientForChain:m}),W=({children:i})=>{let{client:t,config:n,getClientForChain:c}=(()=>{let{client:o,config:i,getClientForChain:r}=e(k);return{client:o,config:i,getClientForChain:r}})(),{config:s}=w(),{wrapSmartAccountClient:m}=u({clientConfig:n,smartWalletsConfig:s}),{user:p}=a(),{generateSiweMessageForSmartWallet:h,linkSmartWallet:d,hideWalletUIs:g}=l();return r((()=>{(async()=>{if(t&&p&&!p?.smartWallet&&s?.enabled)try{let o=await h({address:t.account.address,chainId:`eip155:${t.chain.id}`});g.current=!0;let e=await t.signMessage({message:o});await d({signature:e,message:o,smartWalletType:s.smartWalletType})}catch(o){console.error("Error creating smart wallet:",o)}finally{g.current=!1}})()}),[!!t,!!p?.smartWallet,!!s?.enabled]),/*#__PURE__*/o(C.Provider,{value:{client:p?.smartWallet&&t?m(t):void 0,getClientForChain:c},children:i})};export{g as SmartWalletsProvider,I as useSmartWallets};
1
+ import{jsx as o}from"react/jsx-runtime";import{useContext as e,useState as i,useEffect as r,createContext as t}from"react";import{f as n,l as c,u as a}from"./privy-provider-D5n8VKd6.mjs";import{u as l,P as s,n as m}from"./internal-context-D5bEplez.mjs";import{g as p}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{u as h,g as d,a as u}from"./smart-wallets-BysbTeHa.mjs";import"mipd";import"react-device-detect";import"viem/utils";import"@privy-io/js-sdk-core";import"viem";import"uuid";import"jose";import"eventemitter3";import"@coinbase/wallet-sdk";import"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"zustand";import"fast-password-entropy";import"secure-password-utilities";import"secure-password-utilities/wordlists";import"@heroicons/react/24/outline/UserCircleIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/20/solid/CheckIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import"@heroicons/react/24/solid/DocumentCheckIcon";import"@heroicons/react/24/solid/XCircleIcon";import"@heroicons/react/24/solid/CheckCircleIcon";import"qrcode";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/LockClosedIcon";import"@heroicons/react/24/outline/PencilSquareIcon";import"@heroicons/react/24/outline/ArrowPathIcon";import"@heroicons/react/24/outline/EyeIcon";import"@heroicons/react/24/outline/EyeSlashIcon";import"@heroicons/react/24/outline/KeyIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/LockClosedIcon";import"@heroicons/react/24/outline/CheckCircleIcon";import"@heroicons/react/24/outline/InformationCircleIcon";import"@heroicons/react/24/outline/CreditCardIcon";import"@heroicons/react/24/outline/QrCodeIcon";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";import"@heroicons/react/24/outline/GlobeAltIcon";import"ofetch";import"@heroicons/react/24/outline";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@heroicons/react/24/outline/CloudArrowUpIcon";import"@heroicons/react/24/outline/NoSymbolIcon";import"@heroicons/react/24/outline/ClockIcon";import"@heroicons/react/24/outline/TrashIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/solid/ShieldCheckIcon";import"js-cookie";import"permissionless";import"permissionless/accounts";import"permissionless/clients/pimlico";import"viem/account-abstraction";let C=/*#__PURE__*/t({client:void 0,getClientForChain:m});const g=({config:e,children:i})=>/*#__PURE__*/o(v,{children:/*#__PURE__*/o(y,{config:e,children:/*#__PURE__*/o(W,{children:i})})}),I=()=>{let{client:o,getClientForChain:i}=e(C);return{client:o,getClientForChain:i}};let f=/*#__PURE__*/t({config:void 0}),w=()=>{let{config:o}=e(f);return{config:o}},v=({children:e})=>{let[t,n]=i(void 0),{client:c}=l();return r((()=>{!t&&c&&(async()=>{try{if(!c)return void console.warn("No client found");let o=await c.getSmartWalletsConfig();n(o)}catch(o){console.warn("Error generating smart wallet config: ",o)}})()}),[!!c]),/*#__PURE__*/o(f.Provider,{value:{config:t},children:e})},y=({config:e,children:t})=>{let{config:m}=w(),{appId:u}=l(),{chains:C,defaultChain:g,rpcConfig:I}=n(),{wallets:f}=c(),{user:v}=a(),[y,W]=i(),{wrapSmartAccountClientWithUIs:b}=h(),S=p(f);r((()=>{(async()=>{if(!m?.enabled)return;let o=m.configuredNetworks.find((o=>o.chainId===`eip155:${g.id}`))?g:C.find((o=>m.configuredNetworks.map((o=>o.chainId)).includes(`eip155:${o.id}`)));if(!o)throw new s("Could not find smart wallets chain configurations for any Privy client configured chains. Please configure smart wallets for your chains in the Privy dashboard.");W(await d({chain:o,privyAppId:u,paymasterContext:e?.paymasterContext,rpcConfig:I,embeddedWallet:S,user:v,smartWalletsConfig:m}))})()}),[!!m?.enabled,!!v?.smartWallet,!!S]);/*#__PURE__*/return o(k.Provider,{value:{client:y,config:e,getClientForChain:async({id:o})=>{let i=p(f),r=await d({chain:C.find((e=>e.id===o)),privyAppId:u,paymasterContext:e?.paymasterContext,rpcConfig:I,embeddedWallet:i,user:v,smartWalletsConfig:m});if(!r)throw new s(`Failed to create smart wallet client for chain id: ${o}`);return b(r)}},children:t})},k=/*#__PURE__*/t({client:void 0,config:void 0,getClientForChain:m}),W=({children:i})=>{let{client:t,config:n,getClientForChain:c}=(()=>{let{client:o,config:i,getClientForChain:r}=e(k);return{client:o,config:i,getClientForChain:r}})(),{config:s}=w(),{wrapSmartAccountClient:m}=u({clientConfig:n,smartWalletsConfig:s}),{user:p}=a(),{generateSiweMessageForSmartWallet:h,linkSmartWallet:d,hideWalletUIs:g}=l();return r((()=>{(async()=>{if(t&&p&&!p?.smartWallet&&s?.enabled)try{let o=await h({address:t.account.address,chainId:`eip155:${t.chain.id}`});g.current=!0;let e=await t.signMessage({message:o});await d({signature:e,message:o,smartWalletType:s.smartWalletType})}catch(o){console.error("Error creating smart wallet:",o)}finally{g.current=!1}})()}),[!!t,!!p?.smartWallet,!!s?.enabled]),/*#__PURE__*/o(C.Provider,{value:{client:p?.smartWallet&&t?m(t):void 0,getClientForChain:c},children:i})};export{g as SmartWalletsProvider,I as useSmartWallets};
@@ -1 +1 @@
1
- import{isWalletAdapterCompatibleStandardWallet as o}from"@solana/wallet-adapter-base";import{StandardWalletAdapter as e}from"@solana/wallet-standard-wallet-adapter-base";import{getWallets as r}from"@wallet-standard/app";import{ak as t,u as i,h as n,al as c,am as a,f as s,x as l,an as p,b as m,ao as h}from"./privy-provider-8kKbowq5.mjs";export{ap as useSendTransaction,aq as useSignMessage,L as useSolanaWallets}from"./privy-provider-8kKbowq5.mjs";import{useCallback as d}from"react";import{u as I}from"./internal-context-D5bEplez.mjs";import{t as C}from"./useFundWallet-Lp53P4p6.mjs";export{u as useFundWallet}from"./useFundWallet-Lp53P4p6.mjs";import"react/jsx-runtime";import"mipd";import"react-device-detect";import"viem/utils";import"@privy-io/js-sdk-core";import"viem";import"uuid";import"jose";import"eventemitter3";import"@coinbase/wallet-sdk";import"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"zustand";import"fast-password-entropy";import"secure-password-utilities";import"secure-password-utilities/wordlists";import"@heroicons/react/24/outline/UserCircleIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/20/solid/CheckIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import"@heroicons/react/24/solid/DocumentCheckIcon";import"@heroicons/react/24/solid/XCircleIcon";import"@heroicons/react/24/solid/CheckCircleIcon";import"qrcode";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/LockClosedIcon";import"@heroicons/react/24/outline/PencilSquareIcon";import"@heroicons/react/24/outline/ArrowPathIcon";import"@heroicons/react/24/outline/EyeIcon";import"@heroicons/react/24/outline/EyeSlashIcon";import"@heroicons/react/24/outline/KeyIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/LockClosedIcon";import"@heroicons/react/24/outline/CheckCircleIcon";import"@heroicons/react/24/outline/InformationCircleIcon";import"@heroicons/react/24/outline/CreditCardIcon";import"@heroicons/react/24/outline/QrCodeIcon";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";import"@heroicons/react/24/outline/GlobeAltIcon";import"ofetch";import"@heroicons/react/24/outline";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@heroicons/react/24/outline/CloudArrowUpIcon";import"@heroicons/react/24/outline/NoSymbolIcon";import"@heroicons/react/24/outline/ClockIcon";import"@heroicons/react/24/outline/TrashIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/solid/ShieldCheckIcon";import"js-cookie";import"@solana/web3.js";const g=o=>{let e,{get:i,on:n}=r(),c=o?.shouldAutoConnect??!0,a=[],s=[];function l(...o){s=(a=a.concat(...w(o))).map((o=>new t(o,c))),e?.(s)}function p(...o){s=(a=a.filter((e=>o.some((o=>e.wallet===o))))).map((o=>new t(o,c))),e?.(s)}let m=[n("register",l),n("unregister",p)];return s=(a=w(i())).map((o=>new t(o,c))),{_setOnConnectorsUpdated:o=>{e=o},onMount:()=>{m[0]||(m[0]=n("register",l)),m[1]||(m[1]=n("unregister",p))},onUnmount:()=>{let o=m.pop();for(;o;)o(),o=m.pop()},get:()=>s}};let w=r=>r.filter(o).map((o=>new e({wallet:o})));const v=()=>{let{getAccessToken:o,user:e}=i(),{refreshSessionAndUser:r,initializeWalletProxy:t}=I(),a=n();return{importWallet:d((({privateKey:i})=>c({getAccessToken:o,user:e,initializeWalletProxy:t,refreshSessionAndUser:r,emitPrivyEvent:a},{privateKey:i,chainType:"solana"})),[e,o,r,t,a])}};var y=()=>a(C);function f(o){let e=s(),{getAccessToken:r,user:t}=l(),{setModalData:i}=p(),{isHeadlessSigning:c,openModal:a,walletProxy:u,recoverPrimaryWallet:d,privy:C}=I(),g=n();return m("signSolanaTransaction",o),{signTransaction:async({transaction:o,connection:n,uiOptions:s,transactionOptions:l,address:p})=>{let{signedTransaction:m}=await h({privy:C,appConfig:e,getAccessToken:r,isHeadlessSigning:c,emitPrivyEvent:g,setModalData:i,openModal:a,walletProxy:u,user:t,recoverPrimaryWallet:d},{transaction:o,connection:n,transactionOptions:l,uiOptions:s,address:p,signOnly:!0});return m}}}export{t as SolanaAdapterConnector,g as toSolanaWalletConnectors,v as useImportWallet,f as useSignTransaction,y as useSolanaFundingPlugin};
1
+ import{isWalletAdapterCompatibleStandardWallet as o}from"@solana/wallet-adapter-base";import{StandardWalletAdapter as e}from"@solana/wallet-standard-wallet-adapter-base";import{getWallets as r}from"@wallet-standard/app";import{ak as t,u as i,h as n,al as c,am as a,f as s,x as l,an as p,b as m,ao as h}from"./privy-provider-D5n8VKd6.mjs";export{ap as useSendTransaction,aq as useSignMessage,L as useSolanaWallets}from"./privy-provider-D5n8VKd6.mjs";import{useCallback as d}from"react";import{u as I}from"./internal-context-D5bEplez.mjs";import{t as C}from"./useFundWallet-DT4w0BAE.mjs";export{u as useFundWallet}from"./useFundWallet-DT4w0BAE.mjs";import"react/jsx-runtime";import"mipd";import"react-device-detect";import"viem/utils";import"@privy-io/js-sdk-core";import"viem";import"uuid";import"jose";import"eventemitter3";import"@coinbase/wallet-sdk";import"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"zustand";import"fast-password-entropy";import"secure-password-utilities";import"secure-password-utilities/wordlists";import"@heroicons/react/24/outline/UserCircleIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/20/solid/CheckIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import"@heroicons/react/24/solid/DocumentCheckIcon";import"@heroicons/react/24/solid/XCircleIcon";import"@heroicons/react/24/solid/CheckCircleIcon";import"qrcode";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/LockClosedIcon";import"@heroicons/react/24/outline/PencilSquareIcon";import"@heroicons/react/24/outline/ArrowPathIcon";import"@heroicons/react/24/outline/EyeIcon";import"@heroicons/react/24/outline/EyeSlashIcon";import"@heroicons/react/24/outline/KeyIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/LockClosedIcon";import"@heroicons/react/24/outline/CheckCircleIcon";import"@heroicons/react/24/outline/InformationCircleIcon";import"@heroicons/react/24/outline/CreditCardIcon";import"@heroicons/react/24/outline/QrCodeIcon";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";import"@heroicons/react/24/outline/GlobeAltIcon";import"ofetch";import"@heroicons/react/24/outline";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@heroicons/react/24/outline/CloudArrowUpIcon";import"@heroicons/react/24/outline/NoSymbolIcon";import"@heroicons/react/24/outline/ClockIcon";import"@heroicons/react/24/outline/TrashIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/solid/ShieldCheckIcon";import"js-cookie";import"@solana/web3.js";const g=o=>{let e,{get:i,on:n}=r(),c=o?.shouldAutoConnect??!0,a=[],s=[];function l(...o){s=(a=a.concat(...w(o))).map((o=>new t(o,c))),e?.(s)}function p(...o){s=(a=a.filter((e=>o.some((o=>e.wallet===o))))).map((o=>new t(o,c))),e?.(s)}let m=[n("register",l),n("unregister",p)];return s=(a=w(i())).map((o=>new t(o,c))),{_setOnConnectorsUpdated:o=>{e=o},onMount:()=>{m[0]||(m[0]=n("register",l)),m[1]||(m[1]=n("unregister",p))},onUnmount:()=>{let o=m.pop();for(;o;)o(),o=m.pop()},get:()=>s}};let w=r=>r.filter(o).map((o=>new e({wallet:o})));const v=()=>{let{getAccessToken:o,user:e}=i(),{refreshSessionAndUser:r,initializeWalletProxy:t}=I(),a=n();return{importWallet:d((({privateKey:i})=>c({getAccessToken:o,user:e,initializeWalletProxy:t,refreshSessionAndUser:r,emitPrivyEvent:a},{privateKey:i,chainType:"solana"})),[e,o,r,t,a])}};var y=()=>a(C);function f(o){let e=s(),{getAccessToken:r,user:t}=l(),{setModalData:i}=p(),{isHeadlessSigning:c,openModal:a,walletProxy:u,recoverPrimaryWallet:d,privy:C}=I(),g=n();return m("signSolanaTransaction",o),{signTransaction:async({transaction:o,connection:n,uiOptions:s,transactionOptions:l,address:p})=>{let{signedTransaction:m}=await h({privy:C,appConfig:e,getAccessToken:r,isHeadlessSigning:c,emitPrivyEvent:g,setModalData:i,openModal:a,walletProxy:u,user:t,recoverPrimaryWallet:d},{transaction:o,connection:n,transactionOptions:l,uiOptions:s,address:p,signOnly:!0});return m}}}export{t as SolanaAdapterConnector,g as toSolanaWalletConnectors,v as useImportWallet,f as useSignTransaction,y as useSolanaFundingPlugin};