@privy-io/react-auth
Version:
React client for the Privy Auth API
2 lines (1 loc) • 791 B
JavaScript
;var e=require("./get-is-unified-wallet-D4ouXJpi.js"),r=require("react");const t=e=>{if("ethereum"===e.chainType)return{entropyId:e.address,entropyIdVerifier:"ethereum-address-verifier"};if("solana"===e.chainType)return{entropyId:e.address,entropyIdVerifier:"solana-address-verifier"};throw Error("Failed to get account entropy details")},o=/*#__PURE__*/r.createContext(null);exports.UseWalletsContext=o,exports.getEntropyDetailsForUser=(r,o)=>{if(o?.imported)return t(o);let i=e.getPrivyPrimaryWallet(r);if(!i)throw Error("Failed to find primary wallet");return t(i)},exports.toEntropyDetailsFromAccount=t,exports.useWallets=function(){let e=r.useContext(o);return null===e?(console.warn("`useWallets` was called outside the PrivyProvider component"),{wallets:[],ready:!1}):e};