@privy-io/wagmi 0.2.3 → 0.2.4-beta-20240501222318
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.
- package/dist/esm/index.js +1 -1
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{WagmiProvider as
|
|
1
|
+
import{WagmiProvider as I}from"wagmi";import{useEffect as y}from"react";import{useReconnect as g}from"wagmi";import{usePrivy as C,useWallets as W}from"@privy-io/react-auth";var p=()=>{let{ready:e,user:t}=C(),{wallets:r}=W(),{reconnect:o,connectors:s}=g(),i=!!t?.linkedAccounts.find(c=>c.type==="wallet"&&c.walletClientType==="privy")?!!r.find(c=>c.walletClientType==="privy"):!0;y(()=>{e&&i&&o()},[e&&i,s])};import{useEffect as A}from"react";import{useConfig as x}from"wagmi";import{injected as h}from"wagmi/connectors";import{useWallets as E}from"@privy-io/react-auth";var f=()=>{let{wallets:e}=E(),t=x();A(()=>{let r=e.map(async o=>{o.walletClientType==="privy"&&await t.storage?.removeItem(`${o.meta.id}.disconnected`);let s=await o.getEthereumProvider(),n=t.connectors.find(c=>c.id===o.meta.id);if(n)return await t.storage?.removeItem(`${o.meta.id}.disconnected`),n;let i=h({target:{provider:s,id:o.meta.id,name:o.meta.name,icon:o.meta.icon}});return t._internal.connectors.setup(i)});Promise.all(r).then(async o=>{t._internal.connectors.setState(o),o[0]&&await t.storage?.setItem("recentConnectorId",o[0].id)}).catch(console.error)},[e])};import{Fragment as S,jsx as w}from"react/jsx-runtime";var u=({children:e})=>(f(),p(),w(S,{children:e}));import{jsx as l}from"react/jsx-runtime";var b=({children:e,...t})=>l(I,{...t,reconnectOnMount:!1,children:l(u,{children:e})});import{createConfig as R}from"wagmi";var _=e=>R({ssr:!0,...e,connectors:e.connectors?.filter(t=>t.type==="mock"),multiInjectedProviderDiscovery:!1});import{useCallback as T}from"react";import{useSwitchAccount as k,useConfig as H,useConnect as $}from"wagmi";var m=()=>{let{switchAccount:e}=k(),{connect:t}=$(),r=H();return{setActiveWallet:T(async s=>{for(let n of r.connectors)if(n.id===s.meta.id&&(await n.getAccounts()).includes(s.address)){r.state.connections.get(n.uid)?e({connector:n}):t({connector:n});return}},[r.connectors,r.state.connections,t,e])}};var B=()=>{let{setActiveWallet:e}=m();return{setActiveWallet:e,activeWallet:void 0}};import{useEffect as j}from"react";import{useConfig as D,useConnectors as L,useReconnect as M}from"wagmi";import{injected as N}from"wagmi/connectors";var O=({getSmartAccountFromSigner:e})=>{let t=L(),r=D(),{reconnect:o}=M();j(()=>{(async()=>{if(t.find(a=>a.id==="io.privy.smart_wallet"))return;let i=t.find(a=>a.id==="io.privy.wallet");if(!i)return;let c=await i.getProvider(),v=await e({signer:c}),P=N({target:{provider:v,id:"io.privy.smart_wallet",name:"io.privy.smart_wallet",icon:""}}),d=r._internal.connectors.setup(P);r._internal.connectors.setState([d]),await r.storage?.setItem("recentConnectorId",d.id),o()})()},[t,r,e])};export{b as WagmiProvider,_ as createConfig,O as useEmbeddedSmartAccountConnector,B as usePrivyWagmi,m as useSetActiveWallet};
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.2.
|
|
2
|
+
"version": "0.2.4-beta-20240501222318",
|
|
3
3
|
"name": "@privy-io/wagmi",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "Wagmi bindings for the react client",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"typescript": "^5.0.4"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@privy-io/react-auth": "
|
|
49
|
+
"@privy-io/react-auth": "1.63.0-beta-20240501222318",
|
|
50
50
|
"viem": "^2",
|
|
51
51
|
"wagmi": "^2",
|
|
52
52
|
"react": "^18",
|