@privy-io/react-auth 1.92.3 → 1.92.4
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/cjs/events-context-BjjOPVXa.js +1 -0
- package/dist/cjs/getEmbeddedConnectedWallet-DKydzAQG.js +1 -0
- package/dist/cjs/index.js +22 -22
- package/dist/cjs/smart-wallets.js +1 -1
- package/dist/cjs/solana.js +1 -1
- package/dist/cjs/ui.js +1 -1
- package/dist/cjs/{useFundWallet-CdeNBtt7.js → useFundWallet-C0W3IOJ9.js} +2 -2
- package/dist/cjs/{useSolanaWallets-9YEhqb4o.js → useSolanaWallets-DDxTypQs.js} +1 -1
- package/dist/cjs/{useWallets-DOBd5kcT.js → useWallets-DaKIdLuq.js} +1 -1
- package/dist/dts/index.d.mts +12 -25
- package/dist/dts/index.d.ts +12 -25
- package/dist/dts/smart-wallets.d.mts +1 -1
- package/dist/dts/smart-wallets.d.ts +1 -1
- package/dist/dts/{solana-57Jxp-1t.d.mts → solana-MHNU24e3.d.mts} +1 -1
- package/dist/dts/{solana-57Jxp-1t.d.ts → solana-MHNU24e3.d.ts} +1 -1
- package/dist/dts/solana.d.mts +2 -2
- package/dist/dts/solana.d.ts +2 -2
- package/dist/dts/{types-kQycDPwW.d.mts → types-CHvDgSZo.d.mts} +13 -2
- package/dist/dts/{types-kQycDPwW.d.ts → types-CHvDgSZo.d.ts} +13 -2
- package/dist/dts/ui.d.mts +1 -1
- package/dist/dts/ui.d.ts +1 -1
- package/dist/esm/events-context-C3fU8cCf.mjs +1 -0
- package/dist/esm/getEmbeddedConnectedWallet-DKiY8uny.mjs +1 -0
- package/dist/esm/index.mjs +328 -328
- package/dist/esm/smart-wallets.mjs +1 -1
- package/dist/esm/solana.mjs +1 -1
- package/dist/esm/ui.mjs +1 -1
- package/dist/esm/{useFundWallet-CyfvL1bd.mjs → useFundWallet-gMiOtXSS.mjs} +1 -1
- package/dist/esm/{useSolanaWallets-BK1ZsW9P.mjs → useSolanaWallets-B_4UBHGn.mjs} +1 -1
- package/dist/esm/{useWallets-VaMYksLb.mjs → useWallets-BEQCDiwm.mjs} +1 -1
- package/package.json +5 -5
- package/dist/cjs/events-context-DoOSxXpH.js +0 -1
- package/dist/cjs/getEmbeddedConnectedWallet-DgbdyqLu.js +0 -1
- package/dist/esm/events-context-BcbWmpUg.mjs +0 -1
- package/dist/esm/getEmbeddedConnectedWallet-CpgKFaVs.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("./useWallets-DOBd5kcT.js"),n=require("./privy-context-CGQoQ1iQ.js"),a=require("./getEmbeddedConnectedWallet-DgbdyqLu.js"),i=require("viem"),s=require("permissionless"),l=require("permissionless/accounts"),o=require("permissionless/clients/pimlico"),c=require("viem/account-abstraction");require("@ethersproject/providers"),require("tinycolor2"),require("ofetch"),require("viem/actions"),require("viem/chains");let d={address:c.entryPoint06Address,version:"0.6"},u={address:c.entryPoint07Address,version:"0.7"},m=({owner:e,smartWalletType:t,publicClient:r})=>{switch(t){case"safe":return l.toSafeSmartAccount({client:r,entryPoint:u,owners:[e],version:"1.4.1"});case"kernel":return l.toEcdsaKernelSmartAccount({client:r,version:"0.3.1",entryPoint:u,owners:[e]});case"biconomy":return l.toBiconomySmartAccount({client:r,owners:[e],entryPoint:d});case"light_account":return l.toLightSmartAccount({client:r,entryPoint:d,owner:e,version:"1.1.0"});case"coinbase_smart_wallet":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 c.toCoinbaseSmartAccount({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});default:throw Error(`Invalid smart account type: ${t}.`)}},p=["rpc.zerodev.app","public.pimlico.io","api.pimlico.io"];let y=({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})));const f=async({chain:e,paymasterContext:t,embeddedWallet:a,user:l,smartWalletsConfig:c,rpcConfig:d,privyAppId:u})=>{if(!c?.enabled||!l||!a)return;let y=await a.getEthereumProvider(),f=c?.configuredNetworks.find((t=>t.chainId===`eip155:${e.id}`));if(!f)throw new n.PrivyClientError(`The chain ${e.name} (eip155:${e.id}) must be configured in the smart wallet configuration in your dashboard`);let g=l.smartWallet?.smartWalletType??c.smartWalletType,h=r.getJsonRpcEndpointFromChain(e,d,u),w=i.createPublicClient({chain:e,transport:i.http(h)}),C=await(async({owner:e,smartWalletType:t,chain:r,publicClient:n,bundlerUrl:a,paymasterUrl:l,paymasterContext:c})=>{let d=await m({owner:e,smartWalletType:t,publicClient:n}),u=o.createPimlicoClient({transport:i.http(a),entryPoint:d.entryPoint}),y=l?o.createPimlicoClient({transport:i.http(l),entryPoint:d.entryPoint}):void 0;return s.createSmartAccountClient({account:d,chain:r,paymaster:y,paymasterContext:c,bundlerTransport:i.http(a),userOperation:{estimateFeesPerGas:async()=>{if(p.some((e=>a.includes(e))))return await u.getUserOperationGasPrice().then((e=>e.fast));{let e=await n.estimateFeesPerGas();return{...e,maxFeePerGas:125n*e.maxFeePerGas/100n,maxPriorityFeePerGas:125n*e.maxPriorityFeePerGas/100n}}}}})})({owner:y,smartWalletType:g,chain:e,publicClient:w,paymasterContext:t,...f});if(!C)throw new n.PrivyClientError(`Failed to create smart wallet client for chain ${e.name} (eip155:${e.id})`);return C},g=({clientConfig:e,smartWalletsConfig:i})=>{let{noPromptOnSignature:s,openPrivyModal:l,appId:o}=n.usePrivyInternal(),c=r.useAppConfig(),{setModalData:d}=a.usePrivyModal(),{user:u}=n.usePrivy(),{chains:m}=r.useAppConfig(),{chainId:p,clients:g,setChainId:h,chainIdState:w}=(()=>{let e=t.useRef(),[r,n]=t.useState();return{clients:t.useRef({}),setChainId:t=>{e.current=t,n(t)},chainId:e,chainIdState:r}})(),C=m.find((e=>e.id===w)),{wallets:P}=r.useWallets(),v=t.useCallback((async()=>p.current),[p]),E=t.useCallback((async({id:t})=>{if(!g.current[t]){let r=a.getEmbeddedConnectedWallet(P),n=await f({chain:m.find((e=>e.id===t)),embeddedWallet:r,user:u,paymasterContext:e?.paymasterContext,smartWalletsConfig:i,rpcConfig:c.rpcConfig,privyAppId:o});n&&(g.current[t]=n)}h(t)}),[m,e,P,u,i]);return{wrapSmartAccountClient:e=>{g.current[e.chain.id]=e,w||h(e.chain.id);return{...e,sendTransaction:async e=>{let t=void 0===c.embeddedWallets.showWalletUIs?c.embeddedWallets.noPromptOnSignature:!c.embeddedWallets.showWalletUIs,r=g.current[p.current];if(!r)throw new n.PrivyClientError(`Smart wallet client for chain (eip155:${p.current}) not found`);if(t)return s.current=!0,await r.sendTransaction(e).finally((()=>s.current=!1));let i=[];"calls"in e&&void 0!==e.calls?i=[...e.calls]:"to"in e&&(i=[{to:e.to,value:e.value||BigInt(0),data:e.data||"0x"}]);let o=async()=>{if(!r.paymaster)return!1;let{paymasterAndData:t,paymasterData:n}=await r.prepareUserOperation({calls:i,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return Number(t??n??0)>0};return new Promise((async(t,n)=>{s.current=!0,d({connectWallet:{onCompleteNavigateTo:a.ModalScreen.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN,onFailure:()=>{}},sendTransaction:{transactionRequests:y({calls:i,chain:r.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),rootWallet:{address:r.account.address},transactingWallet:{address:r.account.address,walletIndex:null},getIsSponsored:o,onConfirm:()=>r.sendTransaction(e),onSuccess:e=>t(e.hash),onFailure:n,uiOptions:{}}}),l(a.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{s.current=!1}))},signMessage:async({message:e})=>{let t=void 0===c.embeddedWallets.showWalletUIs?c.embeddedWallets.noPromptOnSignature:!c.embeddedWallets.showWalletUIs,r=g.current[p.current];if(!r)throw new n.PrivyClientError(`Smart wallet client for chain (eip155:${p.current}) not found`);return t?(s.current=!0,await r.signMessage({message:e}).finally((()=>s.current=!1))):new Promise((async(t,n)=>{s.current=!0,d({connectWallet:{onCompleteNavigateTo:a.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>r.signMessage({message:e}),onSuccess:e=>t(e),onFailure:n,uiOptions:{}}}),l(a.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{s.current=!1}))},signTypedData:async e=>{let t=void 0===c.embeddedWallets.showWalletUIs?c.embeddedWallets.noPromptOnSignature:!c.embeddedWallets.showWalletUIs,r=g.current[p.current];if(!r)throw new n.PrivyClientError(`Smart wallet client for chain (eip155:${p.current}) not found`);return t?(s.current=!0,await r.signTypedData(e).finally((()=>s.current=!1))):new Promise((async(t,n)=>{s.current=!0,d({connectWallet:{onCompleteNavigateTo:a.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>r.signTypedData(e),onSuccess:e=>t(e),onFailure:n,uiOptions:{}}}),l(a.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{s.current=!1}))},getChainId:v,chain:C,switchChain:E}}}};let h=t.createContext({client:void 0});let w=t.createContext({config:void 0}),C=()=>{let{config:e}=t.useContext(w);return{config:e}},P=({children:r})=>{let[a,i]=t.useState(void 0),{client:s}=n.usePrivyInternal();return t.useEffect((()=>{!a&&s&&(async()=>{try{if(!s)return void console.warn("No client found");let e=await s.getSmartWalletsConfig();i(e)}catch(e){console.warn("Error generating smart wallet config: ",e)}})()}),[!!s]),e.jsx(w.Provider,{value:{config:a},children:r})},v=({config:i,children:s})=>{let{config:l}=C(),{appId:o}=n.usePrivyInternal(),{chains:c,defaultChain:d,rpcConfig:u}=r.useAppConfig(),{wallets:m}=r.useWallets(),{user:p}=n.usePrivy(),[y,g]=t.useState(),h=a.getEmbeddedConnectedWallet(m);return t.useEffect((()=>{(async()=>{if(!l?.enabled)return;let e=l.configuredNetworks.find((e=>e.chainId===`eip155:${d.id}`))?d:c.find((e=>l.configuredNetworks.map((e=>e.chainId)).includes(`eip155:${e.id}`)));if(!e)throw new n.PrivyClientError("Could not find smart wallets chain configurations for any Privy client configured chains. Please configure smart wallets for your chains in the Privy dashboard.");g(await f({chain:e,privyAppId:o,paymasterContext:i?.paymasterContext,rpcConfig:u,embeddedWallet:h,user:p,smartWalletsConfig:l}))})()}),[!!l?.enabled,!!p?.smartWallet,!!h]),e.jsx(E.Provider,{value:{client:y,config:i},children:s})},E=t.createContext({client:void 0,config:void 0}),W=({children:r})=>{let{client:a,config:i}=(()=>{let{client:e,config:r}=t.useContext(E);return{client:e,config:r}})(),{config:s}=C(),{wrapSmartAccountClient:l}=g({clientConfig:i,smartWalletsConfig:s}),{user:o}=n.usePrivy(),{generateSiweMessageForSmartWallet:c,linkSmartWallet:d,noPromptOnSignature:u}=n.usePrivyInternal();return t.useEffect((()=>{(async()=>{if(a&&!o?.smartWallet&&s?.enabled)try{let e=await c({address:a.account.address,chainId:`eip155:${a.chain.id}`});u.current=!0;let t=await a.signMessage({message:e});await d({signature:t,message:e,smartWalletType:s.smartWalletType})}catch(e){console.error("Error creating smart wallet:",e)}finally{u.current=!1}})()}),[!!a,!!o?.smartWallet,!!s?.enabled]),e.jsx(h.Provider,{value:{client:o?.smartWallet&&a?l(a):void 0},children:r})};exports.useAbstractSmartWallets=a.useAbstractSmartWallets,exports.SmartWalletsProvider=({config:t,children:r})=>e.jsx(P,{children:e.jsx(v,{config:t,children:e.jsx(W,{children:r})})}),exports.useSmartWallets=()=>{let{client:e}=t.useContext(h);return{client:e}};
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react"),a=require("./useWallets-DaKIdLuq.js"),r=require("./privy-context-CGQoQ1iQ.js"),n=require("./getEmbeddedConnectedWallet-DKydzAQG.js"),i=require("viem"),s=require("permissionless"),o=require("permissionless/accounts"),l=require("permissionless/clients/pimlico"),c=require("viem/account-abstraction"),d=require("viem/actions"),u=require("viem/chains");require("@ethersproject/providers"),require("tinycolor2"),require("ofetch");let m={address:c.entryPoint06Address,version:"0.6"},p={address:c.entryPoint07Address,version:"0.7"},g=({owner:e,smartWalletType:t,publicClient:a})=>{switch(t){case"safe":return o.toSafeSmartAccount({client:a,entryPoint:p,owners:[e],version:"1.4.1"});case"kernel":return o.toEcdsaKernelSmartAccount({client:a,version:"0.3.1",entryPoint:p,owners:[e]});case"biconomy":return o.toBiconomySmartAccount({client:a,owners:[e],entryPoint:m});case"light_account":return o.toLightSmartAccount({client:a,entryPoint:m,owner:e,version:"1.1.0"});case"coinbase_smart_wallet":return async function({client:e,owner:t}){let[a]=await t.request({method:"eth_accounts"});if(!a)throw Error("Unable to request embedded owner for eth_accounts");return await c.toCoinbaseSmartAccount({client:e,owners:[{type:"local",source:"privy",address:a,sign:async({hash:e})=>await t.request({method:"secp256k1_sign",params:[e]})}]})}({client:a,owner:e});default:throw Error(`Invalid smart account type: ${t}.`)}},y=["rpc.zerodev.app","public.pimlico.io","api.pimlico.io"];let f=({calls:e,chain:t,maxPriorityFeePerGas:a,maxFeePerGas:r,nonce:n})=>e.map((e=>({to:e.to||void 0,data:e.data,value:e.value,chainId:t.id,nonce:n,maxFeePerGas:r,maxPriorityFeePerGas:a})));const h=async({chain:e,paymasterContext:t,embeddedWallet:n,user:o,smartWalletsConfig:c,rpcConfig:d,privyAppId:u})=>{if(!c?.enabled||!o||!n)return;let m=await n.getEthereumProvider(),p=c?.configuredNetworks.find((t=>t.chainId===`eip155:${e.id}`));if(!p)throw new r.PrivyClientError(`The chain ${e.name} (eip155:${e.id}) must be configured in the smart wallet configuration in your dashboard`);let f=o.smartWallet?.smartWalletType??c.smartWalletType,h=a.getJsonRpcEndpointFromChain(e,d,u),P=i.createPublicClient({chain:e,transport:i.http(h)}),C=await(async({owner:e,smartWalletType:t,chain:a,publicClient:r,bundlerUrl:n,paymasterUrl:o,paymasterContext:c})=>{let d=await g({owner:e,smartWalletType:t,publicClient:r}),u=l.createPimlicoClient({transport:i.http(n),entryPoint:d.entryPoint}),m=o?l.createPimlicoClient({transport:i.http(o),entryPoint:d.entryPoint}):void 0;return s.createSmartAccountClient({account:d,chain:a,paymaster:m,paymasterContext:c,bundlerTransport:i.http(n),userOperation:{estimateFeesPerGas:async()=>{if(y.some((e=>n.includes(e))))return await u.getUserOperationGasPrice().then((e=>e.fast));{let e=await r.estimateFeesPerGas();return{...e,maxFeePerGas:125n*e.maxFeePerGas/100n,maxPriorityFeePerGas:125n*e.maxPriorityFeePerGas/100n}}}}})})({owner:m,smartWalletType:f,chain:e,publicClient:P,paymasterContext:t,...p});if(!C)throw new r.PrivyClientError(`Failed to create smart wallet client for chain ${e.name} (eip155:${e.id})`);return C},P=({clientConfig:e,smartWalletsConfig:i})=>{let{noPromptOnSignature:s,openPrivyModal:o,appId:l}=r.usePrivyInternal(),c=a.useAppConfig(),{setModalData:d}=n.usePrivyModal(),{user:u}=r.usePrivy(),{chains:m}=a.useAppConfig(),{chainId:p,clients:g,setChainId:y,chainIdState:P}=(()=>{let e=t.useRef(),[a,r]=t.useState();return{clients:t.useRef({}),setChainId:t=>{e.current=t,r(t)},chainId:e,chainIdState:a}})(),C=m.find((e=>e.id===P)),{wallets:v}=a.useWallets(),w=t.useCallback((async()=>p.current),[p]),E=t.useCallback((async({id:t})=>{if(!g.current[t]){let a=n.getEmbeddedConnectedWallet(v),r=await h({chain:m.find((e=>e.id===t)),embeddedWallet:a,user:u,paymasterContext:e?.paymasterContext,smartWalletsConfig:i,rpcConfig:c.rpcConfig,privyAppId:l});r&&(g.current[t]=r)}y(t)}),[m,e,v,u,i]);return{wrapSmartAccountClient:e=>{g.current[e.chain.id]=e,P||y(e.chain.id);return{...e,sendTransaction:async e=>{let t=void 0===c.embeddedWallets.showWalletUIs?c.embeddedWallets.noPromptOnSignature:!c.embeddedWallets.showWalletUIs,a=g.current[p.current];if(!a)throw new r.PrivyClientError(`Smart wallet client for chain (eip155:${p.current}) not found`);if(t)return s.current=!0,await a.sendTransaction(e).finally((()=>s.current=!1));let i=[];"calls"in e&&void 0!==e.calls?i=[...e.calls]:"to"in e&&(i=[{to:e.to,value:e.value||BigInt(0),data:e.data||"0x"}]);let l=async()=>{if(!a.paymaster)return!1;let{paymasterAndData:t,paymasterData:r}=await a.prepareUserOperation({calls:i,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return Number(t??r??0)>0};return new Promise((async(t,r)=>{s.current=!0,d({connectWallet:{onCompleteNavigateTo:n.ModalScreen.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN,onFailure:()=>{}},sendTransaction:{transactionRequests:f({calls:i,chain:a.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),rootWallet:{address:a.account.address},transactingWallet:{address:a.account.address,walletIndex:null},getIsSponsored:l,onConfirm:()=>a.sendTransaction(e),onSuccess:e=>t(e.hash),onFailure:r,uiOptions:{}}}),o(n.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{s.current=!1}))},signMessage:async({message:e})=>{let t=void 0===c.embeddedWallets.showWalletUIs?c.embeddedWallets.noPromptOnSignature:!c.embeddedWallets.showWalletUIs,a=g.current[p.current];if(!a)throw new r.PrivyClientError(`Smart wallet client for chain (eip155:${p.current}) not found`);return t?(s.current=!0,await a.signMessage({message:e}).finally((()=>s.current=!1))):new Promise((async(t,r)=>{s.current=!0,d({connectWallet:{onCompleteNavigateTo:n.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>a.signMessage({message:e}),onSuccess:e=>t(e),onFailure:r,uiOptions:{}}}),o(n.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{s.current=!1}))},signTypedData:async e=>{let t=void 0===c.embeddedWallets.showWalletUIs?c.embeddedWallets.noPromptOnSignature:!c.embeddedWallets.showWalletUIs,a=g.current[p.current];if(!a)throw new r.PrivyClientError(`Smart wallet client for chain (eip155:${p.current}) not found`);return t?(s.current=!0,await a.signTypedData(e).finally((()=>s.current=!1))):new Promise((async(t,r)=>{s.current=!0,d({connectWallet:{onCompleteNavigateTo:n.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>a.signTypedData(e),onSuccess:e=>t(e),onFailure:r,uiOptions:{}}}),o(n.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{s.current=!1}))},getChainId:w,chain:C,switchChain:E}}}};let C=t.createContext({client:void 0});let v=t.createContext({config:void 0}),w=()=>{let{config:e}=t.useContext(v);return{config:e}},E=({children:a})=>{let[n,i]=t.useState(void 0),{client:s}=r.usePrivyInternal();return t.useEffect((()=>{!n&&s&&(async()=>{try{if(!s)return void console.warn("No client found");let e=await s.getSmartWalletsConfig();i(e)}catch(e){console.warn("Error generating smart wallet config: ",e)}})()}),[!!s]),e.jsx(v.Provider,{value:{config:n},children:a})},S=({config:i,children:s})=>{let{config:o}=w(),{appId:l}=r.usePrivyInternal(),{chains:c,defaultChain:d,rpcConfig:u}=a.useAppConfig(),{wallets:m}=a.useWallets(),{user:p}=r.usePrivy(),[g,y]=t.useState(),f=n.getEmbeddedConnectedWallet(m);return t.useEffect((()=>{(async()=>{if(!o?.enabled)return;let e=o.configuredNetworks.find((e=>e.chainId===`eip155:${d.id}`))?d:c.find((e=>o.configuredNetworks.map((e=>e.chainId)).includes(`eip155:${e.id}`)));if(!e)throw new r.PrivyClientError("Could not find smart wallets chain configurations for any Privy client configured chains. Please configure smart wallets for your chains in the Privy dashboard.");y(await h({chain:e,privyAppId:l,paymasterContext:i?.paymasterContext,rpcConfig:u,embeddedWallet:f,user:p,smartWalletsConfig:o}))})()}),[!!o?.enabled,!!p?.smartWallet,!!f]),e.jsx(W.Provider,{value:{client:g,config:i},children:s})},W=t.createContext({client:void 0,config:void 0}),I=({children:a})=>{let{client:n,config:i}=(()=>{let{client:e,config:a}=t.useContext(W);return{client:e,config:a}})(),{config:s}=w(),{wrapSmartAccountClient:o}=P({clientConfig:i,smartWalletsConfig:s}),{user:l}=r.usePrivy(),{generateSiweMessageForSmartWallet:c,linkSmartWallet:d,noPromptOnSignature:u}=r.usePrivyInternal();return t.useEffect((()=>{(async()=>{if(n&&!l?.smartWallet&&s?.enabled)try{let e=await c({address:n.account.address,chainId:`eip155:${n.chain.id}`});u.current=!0;let t=await n.signMessage({message:e});await d({signature:t,message:e,smartWalletType:s.smartWalletType})}catch(e){console.error("Error creating smart wallet:",e)}finally{u.current=!1}})()}),[!!n,!!l?.smartWallet,!!s?.enabled]),e.jsx(C.Provider,{value:{client:l?.smartWallet&&n?o(n):void 0},children:a})};function x(e){return e?i.pad(i.numberToHex(BigInt(e)),{dir:"left",size:20}):"0x"}exports.SmartWalletsProvider=({config:t,children:a})=>e.jsx(E,{children:e.jsx(S,{config:t,children:e.jsx(I,{children:a})})}),exports.useAbstractSmartWallets=function(){let{noPromptOnSignature:e,openPrivyModal:t,chains:s}=r.usePrivyInternal(),{signTypedData:o}=r.usePrivy(),{setModalData:l}=n.usePrivyModal(),c=s.find((e=>e.id===u.abstractTestnet.id));return{sendTransaction:(r,s,u,m,p)=>{s.to=x(s.to);let g=a.generateTypedDataWithDomainType(((e,t)=>{let a="string"==typeof e?JSON.parse(e):e,r=t.custom?.getEip712Domain?.({...a,chainId:t.id,from:a.from,type:"eip712"});return r.domain.name="zkSync",Object.entries(r.message).forEach((([e,t])=>{"bigint"==typeof t&&(r.message[e]=String(t))})),r})(s,c));return new Promise((async(a,y)=>{e.current=!0,l({connectWallet:{onCompleteNavigateTo:n.ModalScreen.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN,onFailure:()=>{}},sendTransaction:{transactionRequests:u.map((e=>({to:x(g.message.to),value:"string"==typeof e.value?i.isHex(e.value)?e.value:i.numberToHex(BigInt(e.value)):e.value,data:e.data??"0x",chainId:g.domain.chainId,maxPriorityFeePerGas:BigInt(g.message.maxPriorityFeePerGas),maxFeePerGas:BigInt(g.message.maxFeePerGas),gasLimit:BigInt(g.message.gasLimit),nonce:g.message.nonce}))),rootWallet:{address:r.address},transactingWallet:{address:r.address,walletIndex:null},getIsSponsored:async()=>Number(g.message.paymaster)>0,onConfirm:async()=>{let e=await o(g),t={to:BigInt(g.message.to),value:BigInt(g.message.value),data:g.message.data??void 0,chainId:g.domain.chainId,maxPriorityFeePerGas:BigInt(g.message.maxPriorityFeePerGas),maxFeePerGas:BigInt(g.message.maxFeePerGas),gas:BigInt(g.message.gasLimit),paymaster:x(g.message.paymaster),paymasterInput:g.message.paymasterInput},a=i.encodeAbiParameters(i.parseAbiParameters(["bytes","address","bytes[]"]),[e,"0xC894DE2894e2F84C0C2944FDcce9490eC22A92b6",[]]),r={...t,factoryDeps:s.factoryDeps,to:x(g.message.to),chainId:c.id,from:i.numberToHex(BigInt(g.message.from)),customSignature:a,type:"eip712",data:g.message.data,nonce:Number(g.message.nonce)},n=c.serializers?.transaction(r,{r:"0x0",s:"0x0",v:0n}),l=i.createPublicClient({chain:c,transport:i.http(`https://abs-testnet.rpc.privy.systems?privyAppId=${m}`)});return await d.sendRawTransaction(l,{serializedTransaction:n})},onSuccess:e=>a(e.hash),onFailure:y,uiOptions:p}}),t(n.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{e.current=!1}))}}},exports.useSmartWallets=()=>{let{client:e}=t.useContext(C);return{client:e}};
|
package/dist/cjs/solana.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("@solana/wallet-adapter-base"),t=require("@solana/wallet-standard-wallet-adapter-base"),a=require("@wallet-standard/app"),r=require("./useSolanaWallets-
|
|
1
|
+
"use strict";var e=require("@solana/wallet-adapter-base"),t=require("@solana/wallet-standard-wallet-adapter-base"),a=require("@wallet-standard/app"),r=require("./useSolanaWallets-DDxTypQs.js"),l=require("./events-context-BjjOPVXa.js"),n=require("./privy-context-CGQoQ1iQ.js");require("eventemitter3"),require("@ethersproject/logger"),require("@ethersproject/address"),require("react"),require("ofetch");let o=a=>a.filter(e.isWalletAdapterCompatibleStandardWallet).map((e=>new t.StandardWalletAdapter({wallet:e})));exports.SolanaAdapterConnector=r.SolanaWalletConnector,exports.useSolanaWallets=r.useSolanaWallets,exports.toSolanaWalletConnectors=e=>{let t,{get:l,on:n}=a.getWallets(),s=e?.shouldAutoConnect??!0,u=o(l()),p=u.map((e=>new r.SolanaWalletConnector(e,s))),i=[];return{_setOnConnectorsUpdated:e=>{t=e},onMount:()=>{i.push(n("register",((...e)=>{p=(u=u.concat(...o(e))).map((e=>new r.SolanaWalletConnector(e,s))),t?.(p)})),n("unregister",((...e)=>{p=(u=u.filter((t=>e.some((e=>t.wallet===e))))).map((e=>new r.SolanaWalletConnector(e,s))),t?.(p)})))},onUnmount:()=>{let e=i.pop();for(;e;)e(),e=i.pop()},get:()=>p}},exports.useFundWallet=e=>{l.usePrivyEventSubscription("fundSolanaWallet",e);let{fundSolanaWallet:t}=n.usePrivyInternal();return{fundWallet:t}};
|
package/dist/cjs/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("./privy-context-CGQoQ1iQ.js"),s=require("./useFundWallet-
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("./privy-context-CGQoQ1iQ.js"),s=require("./useFundWallet-C0W3IOJ9.js"),r=require("./useWallets-DaKIdLuq.js"),i=require("styled-components"),l=require("@heroicons/react/24/outline"),n=require("react"),o=require("@floating-ui/react"),a=require("./events-context-BjjOPVXa.js");function d(e){if(e&&"object"==typeof e&&"default"in e)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(s){if("default"!==s){var r=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,r.get?r:{enumerable:!0,get:function(){return e[s]}})}})),t.default=e,Object.freeze(t)}require("ofetch"),require("@heroicons/react/24/outline/Square2StackIcon"),require("@ethersproject/bignumber"),require("@ethersproject/units"),require("viem"),require("@ethersproject/providers"),require("tinycolor2"),require("@ethersproject/address");var c=d(n);const h=t=>e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M9.99999 10.8333C12.3012 10.8333 14.1667 8.96785 14.1667 6.66667C14.1667 4.36548 12.3012 2.5 9.99999 2.5C7.69881 2.5 5.83333 4.36548 5.83333 6.66667C5.83333 8.96785 7.69881 10.8333 9.99999 10.8333ZM9.99999 10.8333C11.7681 10.8333 13.4638 11.5357 14.714 12.786C15.9643 14.0362 16.6667 15.7319 16.6667 17.5M9.99999 10.8333C8.23188 10.8333 6.53619 11.5357 5.28595 12.786C4.03571 14.0362 3.33333 15.7319 3.33333 17.5",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})}),p=i.styled.button`
|
|
2
2
|
--size: ${({$size:e})=>`${e}px`};
|
|
3
3
|
|
|
4
4
|
-webkit-font-smoothing: antialiased;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("react"),r=require("react/jsx-runtime"),t=require("styled-components"),o=require("./useWallets-
|
|
1
|
+
"use strict";var e=require("react"),r=require("react/jsx-runtime"),t=require("styled-components"),o=require("./useWallets-DaKIdLuq.js"),a=require("./events-context-BjjOPVXa.js"),c=require("./privy-context-CGQoQ1iQ.js"),i=require("@heroicons/react/24/outline/Square2StackIcon"),n=require("@ethersproject/bignumber"),s=require("@ethersproject/units"),l=require("viem");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=d(i);let u=e=>n.BigNumber.from(e);class p{get(e){let r=localStorage.getItem(e);return null===r?void 0:JSON.parse(r)}put(e,r){void 0!==r?localStorage.setItem(e,JSON.stringify(r)):this.del(e)}del(e){localStorage.removeItem(e)}getKeys(){return Object.entries(localStorage).map((([e])=>e))}}var v="undefined"!=typeof window&&window.localStorage?new p:new class{get(e){return this._cache[e]}put(e,r){void 0!==r?this._cache[e]=r:this.del(e)}del(e){delete this._cache[e]}getKeys(){return Object.keys(this._cache)}constructor(){this._cache={}}};const g=t.styled.span`
|
|
2
2
|
&& {
|
|
3
3
|
width: 82px;
|
|
4
4
|
height: 82px;
|
|
@@ -158,4 +158,4 @@
|
|
|
158
158
|
${e=>"error"===e.$state?"border-color: var(--privy-color-error);":""}
|
|
159
159
|
`,I=t.styled.div`
|
|
160
160
|
${E}
|
|
161
|
-
`;let N=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2}),A=e=>N.format(e);exports.Address=w,exports.BlobbyFooter=()=>r.jsx(b,{children:r.jsx("a",{href:"https://www.privy.io/",target:"_blank",children:r.jsx(m,{height:13,width:150})})}),exports.Box=I,exports.BoxStyles=E,exports.ButtonLoader=e=>r.jsx(x,{color:e.color||"var(--privy-color-foreground-3)"}),exports.Chip=C,exports.ConnectionLoader=({success:e,fail:t})=>r.jsxs(r.Fragment,{children:[r.jsx(g,{className:e?"success":t?"fail":""}),r.jsx(y,{className:e?"success":t?"fail":""})]}),exports.Copy=({color:e,...t})=>r.jsx("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 115.77 122.88",xmlSpace:"preserve",...t,children:r.jsx("g",{children:r.jsx("path",{fill:e||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})}),exports.ErrorMessage=F,exports.Loader=g,exports.LoaderFaint=y,exports.LoadingSkeleton=P,exports.ModalFooter=b,exports.RecentlyUsedAccountProvider=({children:t})=>{let c=o.useAppConfig(),[i,n]=e.useState({});return a.usePrivyEventSubscription("login",{onComplete:(e,r,t,o,a)=>{a&&"passkey"!==a.type&&"cross_app"!==a.type&&("wallet"!==a.type||"privy"!==a.walletClientType)&&(v.put(k(c.id),a.type),"wallet"===a.type?(v.put(M(c.id),a.walletClientType),v.put(V(c.id),a.chainType),n({accountType:a.type,walletClientType:a.walletClientType,chainType:a.chainType})):(v.del(M(c.id)),v.del(V(c.id)),n({accountType:a.type})))}}),e.useEffect((()=>{if(!c.id)return;let e=v.get(k(c.id)),r=v.get(M(c.id)),t=v.get(V(c.id));e&&n("wallet"===e?{accountType:e,walletClientType:r,chainType:t}:{accountType:e})}),[c.id]),r.jsx(L.Provider,{value:i,children:t})},exports.TermsAndConditions=function(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:o,requireUsersAcceptTerms:a}}=e.app;if(a&&!e.alwaysShowImplicitConsent||!o&&!t)return r.jsx(f,{});let c=!(!t||!o);return r.jsxs(f,{children:["By logging in I agree to the"," ",o&&r.jsx("a",{href:o,target:"_blank",children:c?"Terms":"Terms of Service"}),c&&" & ",t&&r.jsx("a",{href:t,target:"_blank",children:"Privacy Policy"})]})},exports.WalletInfoCard=({errMsg:e,balance:t,address:o,isLoading:a,className:c,title:i,isPulsing:n,showIcon:s,statusColor:l="green"})=>{let d;return d=l||(e?"red":"green"),r.jsxs(r.Fragment,{children:[r.jsxs(I,{className:c,$state:e?"error":void 0,children:[r.jsxs(Z,{children:[r.jsx(T,{children:i||"Pay with"}),r.jsx(w,{address:o,showCopyIcon:s||!!e})]}),void 0!==t&&r.jsx(C,{isLoading:a,isPulsing:n,color:d,children:t})]}),e&&r.jsx(F,{style:{marginTop:"0.25rem"},children:e})]})},exports.e=function(){try{let e="privy:__session_storage__test",r=new p;return r.put(e,"blobby"),r.del(e),!0}catch(e){return!1}},exports.
|
|
161
|
+
`;let N=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",maximumFractionDigits:2}),A=e=>N.format(e);exports.Address=w,exports.BlobbyFooter=()=>r.jsx(b,{children:r.jsx("a",{href:"https://www.privy.io/",target:"_blank",children:r.jsx(m,{height:13,width:150})})}),exports.Box=I,exports.BoxStyles=E,exports.ButtonLoader=e=>r.jsx(x,{color:e.color||"var(--privy-color-foreground-3)"}),exports.Chip=C,exports.ConnectionLoader=({success:e,fail:t})=>r.jsxs(r.Fragment,{children:[r.jsx(g,{className:e?"success":t?"fail":""}),r.jsx(y,{className:e?"success":t?"fail":""})]}),exports.Copy=({color:e,...t})=>r.jsx("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 115.77 122.88",xmlSpace:"preserve",...t,children:r.jsx("g",{children:r.jsx("path",{fill:e||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})}),exports.ErrorMessage=F,exports.Loader=g,exports.LoaderFaint=y,exports.LoadingSkeleton=P,exports.ModalFooter=b,exports.RecentlyUsedAccountProvider=({children:t})=>{let c=o.useAppConfig(),[i,n]=e.useState({});return a.usePrivyEventSubscription("login",{onComplete:(e,r,t,o,a)=>{a&&"passkey"!==a.type&&"cross_app"!==a.type&&("wallet"!==a.type||"privy"!==a.walletClientType)&&(v.put(k(c.id),a.type),"wallet"===a.type?(v.put(M(c.id),a.walletClientType),v.put(V(c.id),a.chainType),n({accountType:a.type,walletClientType:a.walletClientType,chainType:a.chainType})):(v.del(M(c.id)),v.del(V(c.id)),n({accountType:a.type})))}}),e.useEffect((()=>{if(!c.id)return;let e=v.get(k(c.id)),r=v.get(M(c.id)),t=v.get(V(c.id));e&&n("wallet"===e?{accountType:e,walletClientType:r,chainType:t}:{accountType:e})}),[c.id]),r.jsx(L.Provider,{value:i,children:t})},exports.TermsAndConditions=function(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:o,requireUsersAcceptTerms:a}}=e.app;if(a&&!e.alwaysShowImplicitConsent||!o&&!t)return r.jsx(f,{});let c=!(!t||!o);return r.jsxs(f,{children:["By logging in I agree to the"," ",o&&r.jsx("a",{href:o,target:"_blank",children:c?"Terms":"Terms of Service"}),c&&" & ",t&&r.jsx("a",{href:t,target:"_blank",children:"Privacy Policy"})]})},exports.WalletInfoCard=({errMsg:e,balance:t,address:o,isLoading:a,className:c,title:i,isPulsing:n,showIcon:s,statusColor:l="green"})=>{let d;return d=l||(e?"red":"green"),r.jsxs(r.Fragment,{children:[r.jsxs(I,{className:c,$state:e?"error":void 0,children:[r.jsxs(Z,{children:[r.jsx(T,{children:i||"Pay with"}),r.jsx(w,{address:o,showCopyIcon:s||!!e})]}),void 0!==t&&r.jsx(C,{isLoading:a,isPulsing:n,color:d,children:t})]}),e&&r.jsx(F,{style:{marginTop:"0.25rem"},children:e})]})},exports.e=function(){try{let e="privy:__session_storage__test",r=new p;return r.put(e,"blobby"),r.del(e),!0}catch(e){return!1}},exports.e4=v,exports.getBlockExplorerUrlForAddress=(e,r)=>{let{chains:t}=c.usePrivyInternal(),a=`https://etherscan.io/address/${r}`,i=`${o.getBlockExplorer(e,t)}/address/${r}`;if(!i)return a;try{new URL(i)}catch{return a}return i},exports.getDollarsFromStringFloat=(e,r)=>{let t=A(r*parseFloat(e));return"$0.00"!==t?t:"<$0.01"},exports.getDollarsFromWei=(e,r)=>{let t=A(r*parseFloat(s.formatEther(e)));return"$0.00"===t?"<$0.01":t},exports.getNativeCurrencyFromWei=(e,r,t=6,o=!1)=>{let a=parseFloat(s.formatEther(e)).toFixed(t).replace(/0+$/,"").replace(/\.$/,"");return o?`${a} ${r}`:`${"0"===a?"<0.001":a} ${r}`},exports.i=u,exports.r=function(e){let r={};return void 0!==e.to&&(r.to=e.to),void 0!==e.data&&(r.data=e.data),void 0!==e.chainId&&(r.chainId=e.chainId),void 0!==e.type&&(r.type=e.type),void 0!==e.accessList&&(r.accessList=e.accessList),void 0!==e.nonce&&(r.nonce=u(e.nonce).toNumber()),void 0!==e.gasLimit&&(r.gasLimit=u(e.gasLimit)),void 0!==e.gasPrice&&(r.gasPrice=u(e.gasPrice)),void 0!==e.value&&(r.value=u(e.value)),void 0!==e.maxFeePerGas&&(r.maxFeePerGas=u(e.maxFeePerGas)),void 0!==e.maxPriorityFeePerGas&&(r.maxPriorityFeePerGas=u(e.maxPriorityFeePerGas)),r},exports.sumWeiQuantitiesToHexString=e=>e.map(u).reduce(((e,r)=>e.add(r)),n.BigNumber.from(0)).toHexString(),exports.t=function(e){if("number"==typeof e||"bigint"==typeof e||"string"==typeof e)return e;if("function"==typeof e.toHexString)return e.toHexString();throw Error(`Expected numeric value but received ${e}`)},exports.useConnectWallet=function(r){let{connectWallet:t}=e.useContext(c.PrivyContext);return a.usePrivyEventSubscription("connectWallet",r),{connectWallet:t}},exports.useElementHeight=r=>{let[t,o]=e.useState("auto");return e.useEffect((()=>{let e=new ResizeObserver((e=>{o(e[0]?.contentRect.height??"auto")}));return r.current&&e.observe(r.current),()=>{r.current&&e.unobserve(r.current)}}),[r.current]),t},exports.useFundWallet=e=>{a.usePrivyEventSubscription("fundWallet",e);let{fundWallet:r}=c.usePrivy();return{fundWallet:r}},exports.useLogin=function(r){let{login:t}=e.useContext(c.PrivyContext);return a.usePrivyEventSubscription("login",r),{login:t}},exports.useLogout=function(r){let{logout:t}=e.useContext(c.PrivyContext);return a.usePrivyEventSubscription("logout",r),{logout:t}},exports.useRecentlyUsedLogin=()=>e.useContext(L),exports.useWalletBalance=function({rpcConfig:r,appId:t,address:a,chain:i}){let{chains:n}=c.usePrivyInternal(),[s,d]=e.useState(0n),[h,u]=e.useState(!1),p=e.useMemo((()=>{let e=i||n[0];if(e)return l.createPublicClient({chain:i,transport:l.http(o.getJsonRpcEndpointFromChain(e,r,t))})}),[i,r,t]),v=e.useCallback((async()=>{if(!a||!p)return;u(!0);let e=await p.getBalance({address:a}).catch(console.error);return e?(d(e),u(!1),e):void 0}),[p,a,d]);return e.useEffect((()=>{v().catch(console.error)}),[]),{balance:s,isLoading:h,reloadBalance:v}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("./privy-context-CGQoQ1iQ.js"),t=require("eventemitter3"),a=require("@ethersproject/logger"),s=require("./events-context-DoOSxXpH.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n,o,i=r(t);(o=n||(n={})).MISSING_OR_INVALID_PRIVY_APP_ID="missing_or_invalid_privy_app_id",o.MISSING_OR_INVALID_PRIVY_ACCOUNT_ID="missing_or_invalid_privy_account_id",o.INVALID_DATA="invalid_data",o.LINKED_TO_ANOTHER_USER="linked_to_another_user",o.ALLOWLIST_REJECTED="allowlist_rejected",o.OAUTH_USER_DENIED="oauth_user_denied",o.UNKNOWN_AUTH_ERROR="unknown_auth_error",o.USER_EXITED_AUTH_FLOW="exited_auth_flow",o.MUST_BE_AUTHENTICATED="must_be_authenticated",o.UNKNOWN_CONNECT_WALLET_ERROR="unknown_connect_wallet_error",o.GENERIC_CONNECT_WALLET_ERROR="generic_connect_wallet_error",o.CLIENT_REQUEST_TIMEOUT="client_request_timeout",o.INVALID_CREDENTIALS="invalid_credentials";class l extends Error{toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}constructor(e,t,a){super(e),t instanceof Error&&(this.cause=t),this.privyErrorCode=a}}class d extends l{constructor(e,t,a){super(e),this.type="provider_error",this.code=t,this.data=a}}let c={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1},E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don’t see your wallet? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don’t see your wallet? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don’t see your wallet? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}};class _ extends e.PrivyConnectorError{constructor(){super("Wallet timeout"),this.type="wallet_error"}}class E extends e.PrivyConnectorError{constructor(){super("User rejected connection"),this.type="wallet_error"}}const u=t=>{if(t instanceof e.PrivyConnectorError)return t;if(t?.code&&t?.reason){let e=new h(t);return t.code===a.ErrorCode.ACTION_REJECTED&&(e.details=c.E4001_USER_REJECTED_REQUEST),e}return t?.code?new h(t):new e.PrivyConnectorError("Unknown connector error",t)};class p extends e.PrivyError{constructor(e,t,a){super(e),this.type="provider_error",this.code=t,this.data=a}}class h extends p{constructor(e){super(e.message,e.code,e.data);let t=Object.values(c).find((t=>t.eipCode===e.code));this.details=t||c.UNKNOWN_ERROR,-32002===e.code&&(e.message?.includes("already pending for origin")?e.message?.includes("wallet_requestPermissions")?this.details=c.E32002_CONNECTION_ALREADY_PENDING:this.details=c.E32002_REQUEST_ALREADY_PENDING:e.message?.includes("Already processing")&&e.message.includes("eth_requestAccounts")&&(this.details=c.E32002_WALLET_LOCKED))}}const y={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0},ERROR_USER_LIMIT_REACHED:{message:"Unable to link",detail:"You've reached the maximum number of linked wallets.",retryable:!1},...c};class C extends i.default{constructor(e){super(),this.walletClientType=e,this.connected=!1,this.initialized=!1}}const T=["metamask","phantom","brave_wallet","rainbow","uniswap_wallet_extension","uniswap_extension","rabby_wallet","bybit_wallet","crypto.com_wallet_extension","coinbase_wallet","coinbase_smart_wallet","metamask","trust","safe","rainbow","uniswap","zerion","argent","spot","omni","cryptocom","blockchain","safepal","bitkeep","zengo","1inch","binance","exodus","mew_wallet","alphawallet","keyring_pro","mathwallet","unstoppable","obvious","ambire","internet_money_wallet","coin98","abc_wallet","arculus_wallet","haha","cling_wallet","broearn","copiosa","burrito_wallet","enjin_wallet","plasma_wallet","avacus","bee","pitaka","pltwallet","minerva","kryptogo","prema","slingshot","kriptonio","timeless","secux","bitizen","blocto","okx_wallet","safemoon","rabby_wallet","bybit_wallet","privy","unknown","phantom","solflare","glow"];exports.ConnectorErrors=y,exports.PrivyProviderRpcError=h,exports.ProviderRpcError=p,exports.R=class extends d{constructor(e){super(e.message,e.code,e.data);let t=Object.values(c).find((t=>t.eipCode===e.code));this.details=t||c.UNKNOWN_ERROR,-32002===e.code&&(e.message?.includes("already pending for origin")?e.message?.includes("wallet_requestPermissions")?this.details=c.E32002_CONNECTION_ALREADY_PENDING:this.details=c.E32002_REQUEST_ALREADY_PENDING:e.message?.includes("Already processing")&&e.message.includes("eth_requestAccounts")&&(this.details=c.E32002_WALLET_LOCKED))}},exports.SolanaWalletConnector=class extends C{get isInstalled(){return"Installed"===this.adapter.readyState}buildConnectedWallet(t,a){let s,r,n;if("Installed"!==t.readyState||!t.publicKey)throw Error("Wallet is not connected.");return"signMessage"in t&&(s=async(...e)=>{if(!t.connected)throw Error("Wallet is not connected.");return await t.signMessage(e[0])}),"sendTransaction"in t&&(r=async(...e)=>await t.sendTransaction(e[0],e[1],e[2])),"signTransaction"in t&&(n=async e=>await t.signTransaction(e)),{type:"solana",address:t.publicKey.toBase58(),meta:a,imported:!1,connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:async()=>t.connected,disconnect:()=>{try{t.disconnect()}catch(e){console.error("Wallet does not support programmatic disconnect")}},getProvider:e.notImplementedWithMessage(`${this.walletClientType||""} wallet does not support 'getProvider'`),signMessage:s??e.notImplementedWithMessage(`${this.walletClientType||""} wallet does not support 'signMessage'`),sendTransaction:r??e.notImplementedWithMessage(`${this.walletClientType||""} wallet does not support 'sendTransaction'`),signTransaction:n??e.notImplementedWithMessage(`${this.walletClientType||""} wallet does not support 'signTransaction'`)}}async syncAccounts(){if("Installed"===this.adapter.readyState&&this.adapter.publicKey){let e={name:this.walletBranding.name,icon:"string"==typeof this.walletBranding.icon?this.walletBranding.icon:void 0,id:this.walletBranding.id};this.wallets.find((e=>this.adapter.publicKey&&e.address===this.adapter.publicKey.toBase58()))||(this.wallets=[this.buildConnectedWallet(this.adapter,e)],this.emit("walletsUpdated"))}else this.wallets.length>0&&(this.wallets=[],this.emit("walletsUpdated"))}get walletBranding(){return{id:this.adapter.name,name:this.adapter.name,icon:this.adapter.icon}}async initialize(){this.subscribeListeners(),await this.syncAccounts(),this.shouldAutoConnect&&await this.adapter.autoConnect().catch(console.error),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}async getConnectedWallet(){return this.wallets.sort(((e,t)=>t.connectedAt-e.connectedAt))[0]||null}async isConnected(){return this.adapter.connected&&["Installed"].includes(this.adapter.readyState)}subscribeListeners(){this.adapter.addListener("disconnect",this.onDisconnect),this.adapter.addListener("connect",this.onConnect),this.adapter.addListener("error",this.onError),this.adapter.addListener("readyStateChange",this.onReadyStateChange)}unsubscribeListeners(){this.adapter.removeAllListeners()}constructor(e,t){super(function(e){return T.includes(e)}(e.name.toLowerCase())?e.name.toLowerCase():"unknown"),this.chainType="solana",this.connectorType="solana_adapter",this.disconnect=()=>{this.adapter.disconnect().then((()=>this.onDisconnect())).catch((e=>console.error("Error disconnecting",e)))},this.promptConnection=async()=>{try{await this.adapter.connect()}catch(e){throw u(e)}},this.onDisconnect=()=>{this.syncAccounts()},this.onConnect=e=>{this.syncAccounts()},this.onError=e=>{this.syncAccounts()},this.onReadyStateChange=e=>{"Installed"!==e&&(this.connected=!1),this.syncAccounts()},this.adapter=e,this.shouldAutoConnect=t,this.wallets=[]}},exports.UserRejectedConnectionError=E,exports.WalletConnector=C,exports.WalletTimeoutError=_,exports.formatConnectorError=u,exports.isBaseConnectedSolanaWallet=function(e){return"solana"===e.type},exports.isSolanaWalletConnector=function(e){return"solana"===e.chainType},exports.n=c,exports.useSolanaWallets=()=>{let{embeddedSolanaWallet:t,exportSolanaWallet:a,createEmbeddedSolanaWallet:r,solanaWallets:n,delegateWallet:o}=e.usePrivyInternal(),{user:i}=e.usePrivy();return{createWallet:r,exportWallet:a,delegateWalletAction:async()=>{let t=s.getPrivySolanaWallet(i);if(!t)throw new e.PrivyClientError("User must have a solana wallet in order to delegate actions");return await o({address:t.address,chainType:"solana"})},wallets:n.concat(t?[t]:[])}};
|
|
1
|
+
"use strict";var e=require("./privy-context-CGQoQ1iQ.js"),t=require("eventemitter3"),a=require("@ethersproject/logger"),s=require("./events-context-BjjOPVXa.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n,o,i=r(t);(o=n||(n={})).MISSING_OR_INVALID_PRIVY_APP_ID="missing_or_invalid_privy_app_id",o.MISSING_OR_INVALID_PRIVY_ACCOUNT_ID="missing_or_invalid_privy_account_id",o.INVALID_DATA="invalid_data",o.LINKED_TO_ANOTHER_USER="linked_to_another_user",o.ALLOWLIST_REJECTED="allowlist_rejected",o.OAUTH_USER_DENIED="oauth_user_denied",o.UNKNOWN_AUTH_ERROR="unknown_auth_error",o.USER_EXITED_AUTH_FLOW="exited_auth_flow",o.MUST_BE_AUTHENTICATED="must_be_authenticated",o.UNKNOWN_CONNECT_WALLET_ERROR="unknown_connect_wallet_error",o.GENERIC_CONNECT_WALLET_ERROR="generic_connect_wallet_error",o.CLIENT_REQUEST_TIMEOUT="client_request_timeout",o.INVALID_CREDENTIALS="invalid_credentials";class l extends Error{toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}constructor(e,t,a){super(e),t instanceof Error&&(this.cause=t),this.privyErrorCode=a}}class d extends l{constructor(e,t,a){super(e),this.type="provider_error",this.code=t,this.data=a}}let c={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1},E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don’t see your wallet? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don’t see your wallet? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don’t see your wallet? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}};class _ extends e.PrivyConnectorError{constructor(){super("Wallet timeout"),this.type="wallet_error"}}class E extends e.PrivyConnectorError{constructor(){super("User rejected connection"),this.type="wallet_error"}}const u=t=>{if(t instanceof e.PrivyConnectorError)return t;if(t?.code&&t?.reason){let e=new h(t);return t.code===a.ErrorCode.ACTION_REJECTED&&(e.details=c.E4001_USER_REJECTED_REQUEST),e}return t?.code?new h(t):new e.PrivyConnectorError("Unknown connector error",t)};class p extends e.PrivyError{constructor(e,t,a){super(e),this.type="provider_error",this.code=t,this.data=a}}class h extends p{constructor(e){super(e.message,e.code,e.data);let t=Object.values(c).find((t=>t.eipCode===e.code));this.details=t||c.UNKNOWN_ERROR,-32002===e.code&&(e.message?.includes("already pending for origin")?e.message?.includes("wallet_requestPermissions")?this.details=c.E32002_CONNECTION_ALREADY_PENDING:this.details=c.E32002_REQUEST_ALREADY_PENDING:e.message?.includes("Already processing")&&e.message.includes("eth_requestAccounts")&&(this.details=c.E32002_WALLET_LOCKED))}}const y={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0},ERROR_USER_LIMIT_REACHED:{message:"Unable to link",detail:"You've reached the maximum number of linked wallets.",retryable:!1},...c};class C extends i.default{constructor(e){super(),this.walletClientType=e,this.connected=!1,this.initialized=!1}}const T=["metamask","phantom","brave_wallet","rainbow","uniswap_wallet_extension","uniswap_extension","rabby_wallet","bybit_wallet","crypto.com_wallet_extension","coinbase_wallet","coinbase_smart_wallet","metamask","trust","safe","rainbow","uniswap","zerion","argent","spot","omni","cryptocom","blockchain","safepal","bitkeep","zengo","1inch","binance","exodus","mew_wallet","alphawallet","keyring_pro","mathwallet","unstoppable","obvious","ambire","internet_money_wallet","coin98","abc_wallet","arculus_wallet","haha","cling_wallet","broearn","copiosa","burrito_wallet","enjin_wallet","plasma_wallet","avacus","bee","pitaka","pltwallet","minerva","kryptogo","prema","slingshot","kriptonio","timeless","secux","bitizen","blocto","okx_wallet","safemoon","rabby_wallet","bybit_wallet","privy","unknown","phantom","solflare","glow"];exports.ConnectorErrors=y,exports.PrivyProviderRpcError=h,exports.ProviderRpcError=p,exports.R=class extends d{constructor(e){super(e.message,e.code,e.data);let t=Object.values(c).find((t=>t.eipCode===e.code));this.details=t||c.UNKNOWN_ERROR,-32002===e.code&&(e.message?.includes("already pending for origin")?e.message?.includes("wallet_requestPermissions")?this.details=c.E32002_CONNECTION_ALREADY_PENDING:this.details=c.E32002_REQUEST_ALREADY_PENDING:e.message?.includes("Already processing")&&e.message.includes("eth_requestAccounts")&&(this.details=c.E32002_WALLET_LOCKED))}},exports.SolanaWalletConnector=class extends C{get isInstalled(){return"Installed"===this.adapter.readyState}buildConnectedWallet(t,a){let s,r,n;if("Installed"!==t.readyState||!t.publicKey)throw Error("Wallet is not connected.");return"signMessage"in t&&(s=async(...e)=>{if(!t.connected)throw Error("Wallet is not connected.");return await t.signMessage(e[0])}),"sendTransaction"in t&&(r=async(...e)=>await t.sendTransaction(e[0],e[1],e[2])),"signTransaction"in t&&(n=async e=>await t.signTransaction(e)),{type:"solana",address:t.publicKey.toBase58(),meta:a,imported:!1,connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:async()=>t.connected,disconnect:()=>{try{t.disconnect()}catch(e){console.error("Wallet does not support programmatic disconnect")}},getProvider:e.notImplementedWithMessage(`${this.walletClientType||""} wallet does not support 'getProvider'`),signMessage:s??e.notImplementedWithMessage(`${this.walletClientType||""} wallet does not support 'signMessage'`),sendTransaction:r??e.notImplementedWithMessage(`${this.walletClientType||""} wallet does not support 'sendTransaction'`),signTransaction:n??e.notImplementedWithMessage(`${this.walletClientType||""} wallet does not support 'signTransaction'`)}}async syncAccounts(){if("Installed"===this.adapter.readyState&&this.adapter.publicKey){let e={name:this.walletBranding.name,icon:"string"==typeof this.walletBranding.icon?this.walletBranding.icon:void 0,id:this.walletBranding.id};this.wallets.find((e=>this.adapter.publicKey&&e.address===this.adapter.publicKey.toBase58()))||(this.wallets=[this.buildConnectedWallet(this.adapter,e)],this.emit("walletsUpdated"))}else this.wallets.length>0&&(this.wallets=[],this.emit("walletsUpdated"))}get walletBranding(){return{id:this.adapter.name,name:this.adapter.name,icon:this.adapter.icon}}async initialize(){this.subscribeListeners(),await this.syncAccounts(),this.shouldAutoConnect&&await this.adapter.autoConnect().catch(console.error),this.initialized=!0,this.emit("initialized")}async connect(e){return e.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}async getConnectedWallet(){return this.wallets.sort(((e,t)=>t.connectedAt-e.connectedAt))[0]||null}async isConnected(){return this.adapter.connected&&["Installed"].includes(this.adapter.readyState)}subscribeListeners(){this.adapter.addListener("disconnect",this.onDisconnect),this.adapter.addListener("connect",this.onConnect),this.adapter.addListener("error",this.onError),this.adapter.addListener("readyStateChange",this.onReadyStateChange)}unsubscribeListeners(){this.adapter.removeAllListeners()}constructor(e,t){super(function(e){return T.includes(e)}(e.name.toLowerCase())?e.name.toLowerCase():"unknown"),this.chainType="solana",this.connectorType="solana_adapter",this.disconnect=()=>{this.adapter.disconnect().then((()=>this.onDisconnect())).catch((e=>console.error("Error disconnecting",e)))},this.promptConnection=async()=>{try{await this.adapter.connect()}catch(e){throw u(e)}},this.onDisconnect=()=>{this.syncAccounts()},this.onConnect=e=>{this.syncAccounts()},this.onError=e=>{this.syncAccounts()},this.onReadyStateChange=e=>{"Installed"!==e&&(this.connected=!1),this.syncAccounts()},this.adapter=e,this.shouldAutoConnect=t,this.wallets=[]}},exports.UserRejectedConnectionError=E,exports.WalletConnector=C,exports.WalletTimeoutError=_,exports.formatConnectorError=u,exports.isBaseConnectedSolanaWallet=function(e){return"solana"===e.type},exports.isSolanaWalletConnector=function(e){return"solana"===e.chainType},exports.n=c,exports.useSolanaWallets=()=>{let{embeddedSolanaWallet:t,exportSolanaWallet:a,createEmbeddedSolanaWallet:r,solanaWallets:n,delegateWallet:o}=e.usePrivyInternal(),{user:i}=e.usePrivy();return{createWallet:r,exportWallet:a,delegateWalletAction:async()=>{let t=s.getPrivySolanaWallet(i);if(!t)throw new e.PrivyClientError("User must have a solana wallet in order to delegate actions");return await o({address:t.address,chainType:"solana"})},wallets:n.concat(t?[t]:[])}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("@ethersproject/providers"),t=require("./privy-context-CGQoQ1iQ.js"),r=require("react/jsx-runtime"),a=require("react");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=o(require("tinycolor2"));const l=e=>e.isApexWallet?"Apex Wallet":e.isAvalanche?"Core Wallet":e.isBackpack?"Backpack":e.isBifrost?"Bifrost Wallet":e.isBitKeep?"BitKeep":e.isBitski?"Bitski":e.isBlockWallet?"BlockWallet":e.isBraveWallet?"Brave Wallet":e.isClover?"Clover":e.isCoin98?"Coin98 Wallet":e.isCoinbaseWallet?"Coinbase Wallet":e.isDawn?"Dawn Wallet":e.isDefiant?"Defiant":e.isDesig?"Desig Wallet":e.isEnkrypt?"Enkrypt":e.isExodus?"Exodus":e.isFordefi?"Fordefi":e.isFrame?"Frame":e.isFrontier?"Frontier Wallet":e.isGamestop?"GameStop Wallet":e.isHaqqWallet?"HAQQ Wallet":e.isHyperPay?"HyperPay Wallet":e.isImToken?"ImToken":e.isHaloWallet?"Halo Wallet":e.isKuCoinWallet?"KuCoin Wallet":e.isMathWallet?"MathWallet":e.isNovaWallet?"Nova Wallet":e.isOkxWallet||e.isOKExWallet?"OKX Wallet":e.isOneInchIOSWallet||e.isOneInchAndroidWallet?"1inch Wallet":e.isOneKey?"OneKey Wallet":e.isOpera?"Opera":e.isPhantom?"Phantom":e.isPortal?"Ripio Portal":e.isRabby?"Rabby Wallet":e.isRainbow?"Rainbow":e.isSafePal?"SafePal Wallet":e.isStatus?"Status":e.isSubWallet?"SubWallet":e.isTalisman?"Talisman":e.isTally||e.isTaho?"Taho":e.isTokenPocket?"TokenPocket":e.isTokenary?"Tokenary":e.isTrust||e.isTrustWallet?"Trust Wallet":e.isTTWallet?"TTWallet":e.isXDEFI?"XDEFI Wallet":e.isZeal?"Zeal":e.isZerion?"Zerion":e.isMetaMask?"MetaMask":void 0,i=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||"MetaMask"!==l(e))return!1;if(e.providers)for(let t of e.providers)if(!i(t))return!1;return!0},s=(e,t=3,r=4,a="ethereum")=>{if(!e)return"";let o="ethereum"===a?2:0;return t+r+o+3>=e.length?e:`${e.slice(0,o+t)}...${e.slice(e.length-r,e.length)}`},p=e=>new Promise((t=>setTimeout(t,e)));const c=(e,r,a)=>{let o,n=e.id,l=Number(e.id);if(e.rpcUrls.privyWalletOverride&&e.rpcUrls.privyWalletOverride.http[0])o=e.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[l])o=r.rpcUrls[l];else if(e.rpcUrls.privy?.http[0]){let t=new URL(e.rpcUrls.privy.http[0]);t.searchParams.append("privyAppId",a),o=t.toString()}else o=e.rpcUrls.public?.http[0]?e.rpcUrls.public.http[0]:e.rpcUrls.default?.http[0];if(!o)throw new t.PrivyConnectorError(`No RPC url found for ${n}`);return o};const u={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-mainnet.rpc.privy.systems"]},alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}},h={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0},d={id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}}},m={id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},testnet:!0},f={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-mainnet.rpc.privy.systems"]},blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}}},g={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0},y={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1},b={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1},w={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://mainnet.rpc.privy.systems"]},alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}},v={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-mainnet.rpc.privy.systems"]},alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}},C={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0},E={id:137,name:"Polygon Mainnet",network:"polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-mainnet.rpc.privy.systems"]},alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}},x={id:80002,name:"Polygon Amoy",network:"polygon-amoy",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-amoy.rpc.privy.systems"]},infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0},k={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{privy:{http:["https://sepolia.rpc.privy.systems"]},alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},testnet:!0},S={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}},O=[u,h,k,w,v,C,E,x,y,{id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0},{id:314,name:"Filecoin - Mainnet",network:"filecoin-mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]},public:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"},filscan:{name:"Filscan",url:"https://filscan.io"},filscout:{name:"Filscout",url:"https://filscout.io/en"},glif:{name:"Glif",url:"https://explorer.glif.io"}}},{id:314159,name:"Filecoin - Calibration testnet",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}},f,g,{id:80085,network:"berachain-artio",name:"Berachain Artio",nativeCurrency:{name:"BERA",symbol:"BERA",decimals:18},rpcUrls:{default:{http:["https://berachain-artio.rpc.privy.systems"]},public:{http:["https://berachain-artio.rpc.privy.systems"]}},blockExplorers:{default:{name:"Beratrail",url:"https://artio.beratrail.io"}},testnet:!0},{id:42,network:"lukso",name:"LUKSO",nativeCurrency:{name:"LUKSO",symbol:"LYX",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.lukso.network"],webSocket:["wss://ws-rpc.mainnet.lukso.network"]}},blockExplorers:{default:{name:"LUKSO Mainnet Explorer",url:"https://explorer.execution.mainnet.lukso.network"}}},b,{id:59140,network:"linea-testnet",name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"}},testnet:!0},d,m,S,{id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0},{id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0},{id:17e3,name:"Holesky",network:"holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://holesky.etherscan.io"},default:{name:"EtherScan",url:"https://holesky.etherscan.io"}}},{id:690,name:"Redstone",network:"redstone",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.redstonechain.com"]},public:{http:["https://rpc.redstonechain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.redstone.xyz/"}}},{id:17069,name:"Garnet Holesky",network:"garnet-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.garnetchain.com"]},public:{http:["https://rpc.garnetchain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.garnetchain.com"}}}],A=new Set(O.map((e=>e.id))),U={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:"34357d3c125c2bcf2ce2bc3309d98715",rpcConfig:{rpcUrls:{},rpcTimeouts:{}},externalWallets:{coinbaseWallet:{connectionOptions:"all"}},captchaEnabled:!1,_render:{standalone:!1},fundingMethodConfig:{moonpay:{useSandbox:!1}}};let T=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","universal_profile","bybit_wallet","wallet_connect","detected_wallets","detected_solana_wallets","detected_ethereum_wallets","rabby_wallet","safe"]),_=e=>T.has(e),W=(e,t,r)=>r.indexOf(e)===t;const P=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(_).filter(W):e?e.filter(_).filter(W):U.appearance.walletList;function I(e,t){return{...e,rpcUrls:{...e.rpcUrls,privy:{http:[t]}}}}let M="#FFFFFF";function F(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return n.default({...e.toHsl(),l:r})}function L({backgroundTheme:e,accentHex:t}){let r;switch(e){case"light":r=M;break;case"dark":r="#1E1E1D";break;default:r=e}let a=n.default(r),o=n.default(t),l=n.default("#51BA81"),i=n.default("#FFB74D"),s=n.default("#EC6351"),p=function(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}(a.getLuminance()),c=F(a,"light"===p?-.04:.11),u=F(a,"light"===p?-.88:.87),h=F(a,"light"===p?-.7:.75),d=F(a,"light"===p?-.43:.45).desaturate("light"===p?60:20),m=F(a,"light"===p?-.08:.25).desaturate("light"===p?60:20),f=F(o,.15),g=F(o,-.06),y=F(s,.3),b=F(i,.3),w=n.default(o.getLuminance()>.5?"#040217":M),v=F(l,-.16),C=F(l,.4);return{colorScheme:p,background:a.toHslString(),background2:c.toHslString(),foreground:u.toHslString(),foreground2:h.toHslString(),foreground3:d.toHslString(),foreground4:m.toHslString(),accent:o.toHslString(),accentLight:f.toHslString(),accentDark:g.toHslString(),foregroundAccent:w.toHslString(),success:l.toHslString(),successDark:v.toHslString(),successLight:C.toHslString(),error:s.toHslString(),errorLight:y.toHslString(),warn:i.toHslString(),warnLight:b.toHslString()}}function D(e,t,r){let a,o,n,l,i,s,p,c,u,h,d,m,f,g,y,b,v=r?console.warn:()=>{};t?.loginMethods?(a=t.loginMethods.includes("email"),o=t.loginMethods.includes("sms"),l=t.loginMethods.includes("wallet"),i=t.loginMethods.includes("google"),s=t.loginMethods.includes("twitter"),p=t.loginMethods.includes("discord"),u=t.loginMethods.includes("spotify"),h=t.loginMethods.includes("instagram"),c=t.loginMethods.includes("tiktok"),m=t.loginMethods.includes("github"),d=t.loginMethods.includes("linkedin"),f=t.loginMethods.includes("apple"),g=t.loginMethods.includes("farcaster"),y=t.loginMethods.includes("telegram")):(a=e.emailAuth,o=e.smsAuth,l=e.walletAuth||e.solanaWalletAuth,i=e.googleOAuth,s=e.twitterOAuth,p=e.discordOAuth,m=e.githubOAuth,u=e.spotifyOAuth,h=e.instagramOAuth,c=e.tiktokOAuth,d=e.linkedinOAuth,f=e.appleOAuth,g=e.farcasterAuth,y=e.telegramAuth),"undefined"!=typeof window&&"function"!=typeof window.PublicKeyCredential?n=!1:e.passkeyAuth&&(n=!0);let C=[a,o].filter(Boolean),E=[i,s,p,m,u,h,c,d,f,g,y].filter(Boolean),x=[l].filter(Boolean);if(C.length+E.length+x.length===0)throw Error("You must enable at least one login method");let k=void 0!==t?.appearance?.showWalletLoginFirst?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;k&&0===x.length?(v("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),k=!1):k||E.length+C.length!==0||(v("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),k=!0);let S=t?.externalWallets?.walletConnect?.enabled??!0;t?.loginMethods&&t.loginMethodsAndOrder&&v("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let A=P({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),T=(({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],r=[];for(let r of(e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`"),e.primary.slice(1)))t.includes(r)?console.warn(`Duplicated login method: ${r}`):t.push(r);for(let a of e.overflow??[])t.includes(a)||r.includes(a)?console.warn(`Duplicated login method: ${a}`):r.push(a);return{primary:t,overflow:r}})({input:t?.loginMethodsAndOrder}),_=t?.intl?.defaultCountry??"US",{chains:W,defaultChain:M}=function({additionalChains:e,supportedChains:t,defaultChainFromConfig:r,hasRpcConfigDefined:a}){let o;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(0===t.length)throw Error("`supportedChains` must contain at least one chain");t.filter((e=>e.rpcUrls.privyWalletOverride)).length>0&&a&&console.warn("You have specified at least one `supportedChain` with `privyWalletOverride` but also have `rpcConfig` defined. The `rpcConfig` will be ignored. `rpcConfig` is deprecated and you should use `privyWalletOverride` in a `supportedChain`."),o=t.map((e=>{if(e.rpcUrls.privyWalletOverride)return e;let t=O.find((t=>t.id===e.id)),r=t?.rpcUrls.privy?.http[0];return r?I(e,r):e}))}else o=O.concat(e??[]);let n=t?o[0]:w,l=r??n;if(!o.find((e=>e.id===l.id)))throw Error("`defaultChain` must be included in `supportedChains`");return{chains:o,defaultChain:l}}({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),F=!!t?.defaultChain,D=t?.customAuth?.getCustomAccessToken&&!1!==t?.customAuth?.enabled,R=!(e.enforceWalletUis??1);if(b=e.legacyWalletUiConfig??1?D?t?.embeddedWallets?.noPromptOnSignature??!0:t?.embeddedWallets?.noPromptOnSignature??R:R,!1===t?.embeddedWallets?.waitForTransactionConfirmation&&!0!==b)throw Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:H,...N}=t?.embeddedWallets??{};return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,landingHeader:t?.appearance?.landingHeader??U.appearance.landingHeader,loginMessage:"string"==typeof t?.appearance?.loginMessage?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,palette:L({backgroundTheme:t?.appearance?.theme??U.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??U.appearance.accentColor}),loginGroupPriority:k?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:A,walletChainType:t?.appearance?.walletChainType??(({evmWalletAuth:e,solanaWalletAuth:t})=>e&&t?"ethereum-and-solana":e?"ethereum-only":t?"solana-only":"ethereum-only")({evmWalletAuth:e.walletAuth??!1,solanaWalletAuth:e.solanaWalletAuth??!1})},loginMethods:{wallet:l,email:a,sms:o,passkey:n,google:i,twitter:s,discord:p,github:m,spotify:u,instagram:h,tiktok:c,linkedin:d,apple:f,farcaster:g,telegram:y},disablePlusEmails:e.disablePlusEmails,loginMethodsAndOrder:T,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??U.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??U.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??U.rpcConfig.rpcTimeouts},chains:W,defaultChain:M,intl:{defaultCountry:_},shouldEnforceDefaultChainOnConnect:F,captchaEnabled:e.captchaEnabled??U.captchaEnabled,captchaSiteKey:e.captchaSiteKey,externalWallets:{coinbaseWallet:{connectionOptions:t?.externalWallets?.coinbaseWallet?.connectionOptions??U.externalWallets.coinbaseWallet.connectionOptions},walletConnect:{enabled:S},solana:{connectors:t?.externalWallets?.solana?.connectors}},embeddedWallets:{...e.embeddedWalletConfig,..."boolean"==typeof H?{requireUserOwnedRecoveryOnCreate:H}:{},...D?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...N,noPromptOnSignature:b,showWalletUIs:t?.embeddedWallets?.showWalletUIs},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:D?{enabled:!0,...t.customAuth}:void 0,loginConfig:{telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{standalone:t?._render?.standalone??U._render.standalone},fundingConfig:e.fundingConfig,fundingMethodConfig:{...t?.fundingMethodConfig??U.fundingMethodConfig,moonpay:{...t?.fundingMethodConfig?.moonpay??U.fundingMethodConfig.moonpay,useSandbox:t?.fundingMethodConfig?.moonpay.useSandbox??t?.fiatOnRamp?.useSandbox??U.fundingMethodConfig.moonpay.useSandbox}}}}let R={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,disablePlusEmails:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""};const H=D(R,void 0,!1);let N=a.createContext({appConfig:H,isServerConfigLoaded:!1});const K=a.createContext(null);exports.CHAIN_ID_MAINNET=1,exports.CLIENT_ANALYTICS_ID_KEY="privy:caid",exports.CODE_VERIFIER_KEY="privy:code_verifier",exports.CONNECTIONS_HISTORY_KEY="privy:connections",exports.CONNECTORS_STATE_KEY="privy:connectors",exports.DEFAULT_API_TIMEOUT_MS=2e4,exports.DEFAULT_APP_CONFIG=H,exports.DEFAULT_NETWORK="0x1",exports.DEFAULT_PRIVY_API_URL="https://auth.privy.io",exports.DEFAULT_RPC_TIMEOUT=12e4,exports.DEFAULT_SUCCESS_SCREEN_DURATION_MS=1400,exports.DEFAULT_SUCCESS_SCREEN_EXTRA_LONG_DURATION_MS=4e3,exports.DEFAULT_SUCCESS_SCREEN_LONG_DURATION_MS=2500,exports.DEFAULT_SUPPORTED_CHAINS=O,exports.DEFAULT_SUPPORTED_CHAIN_IDS=A,exports.DEPRECATED_REFRESH_TOKEN="deprecated",exports.FORKED_TOKEN_STORAGE_KEY="privy:session_transfer_token",exports.HEADLESS_OAUTH_KEY="privy:headless_oauth",exports.IDENTITY_TOKEN_COOKIE_KEY="privy-id-token",exports.IDENTITY_TOKEN_STORAGE_KEY="privy:id_token",exports.MOONPAY_API_URL="https://api.moonpay.com/v1",exports.MOONPAY_API_URL_SANDBOX="https://api.moonpay.com/v1",exports.MOONPAY_PUBLIC_KEY="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",exports.MOONPAY_PUBLIC_KEY_SANDBOX="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",exports.OAUTH_DISABLE_SIGNUP_KEY="privy:oauth_disable_signup",exports.PrivyAppConfigProvider=({children:e,legacyCreateEmbeddedWalletFlag:t,client:o,clientConfig:n})=>{let[l,i]=a.useState(null),s=a.useMemo((()=>D(l??R,n,!!l)),[l,n]);return a.useEffect((()=>{if(!l)return;let e=function(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:a,supportedChains:o,defaultChain:n,externalWallets:l,...i}=e;return{...i,...a?{additionalChains:a.map((e=>e.id))}:void 0,...o?{supportedChains:o.map((e=>e.id))}:void 0,...n?{defaultChain:n.id}:void 0,...l?{walletConnect:l.walletConnect,coinbaseWallet:l.coinbaseWallet,solana:{connectors:l.solana?.connectors?.get().map((e=>e.walletClientType))}}:void 0,legacyCreateEmbeddedWalletFlag:t}}(n,t),r=function(e,t=0){let r=3735928559^t,a=1103547991^t;for(let t,o=0;o<e.length;o++)r=Math.imul(r^(t=e.charCodeAt(o)),2654435761),a=Math.imul(a^t,1597334677);return r=Math.imul(r^r>>>16,2246822507)^Math.imul(a^a>>>13,3266489909),4294967296*(2097151&(a=Math.imul(a^a>>>16,2246822507)^Math.imul(r^r>>>13,3266489909)))+(r>>>0)}(JSON.stringify(e)).toString(),a=`privy:sent:${l.id}:${r}`;localStorage.getItem(a)||(o.createAnalyticsEvent({eventName:"sdk_initialize",payload:e}),localStorage.setItem(a,"t"))}),[n,t,l]),a.useEffect((()=>{l||(async()=>{try{let e=await o.getServerConfig();e.customApiUrl&&o.updateApiUrl(e.customApiUrl),i(e)}catch(e){console.warn("Error generating app config: ",e)}})()}),[]),r.jsx(N.Provider,{value:{appConfig:s,isServerConfigLoaded:!!l},children:e})},exports.REFRESH_TOKEN_COOKIE_KEY="privy-refresh-token",exports.REFRESH_TOKEN_STORAGE_KEY="privy:refresh_token",exports.SESSION_COOKIE_KEY="privy-session",exports.STATE_CODE_KEY="privy:state_code",exports.TOKEN_COOKIE_KEY="privy-token",exports.TOKEN_STORAGE_KEY="privy:token",exports.UseWalletsContext=K,exports.VERSION="1.92.3",exports.WALLET_PROXY_TIMEOUT=3e4,exports.addPrivyRpcToChain=I,exports.addRpcUrlOverrideToChain=function(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}},exports.addToDefaultChains=function(e){let t=e.filter((e=>!A.has(e.id)));return O.concat(t)},exports.arbitrum=u,exports.arbitrumSepolia=h,exports.avalanche=d,exports.avalancheFuji=m,exports.base=f,exports.baseSepolia=g,exports.celo=y,exports.clamp=function(e,{min:t,max:r}){return Math.min(Math.max(e,t),r)},exports.constructURL=(e,t,r={},a={})=>{let o=new URL(t,e);for(let[e,t]of Object.entries(r))void 0!==t&&o.searchParams.set(e,t);let n=Object.entries(a);if(n.length>0){let e=new URLSearchParams;for(let[t,r]of n)e.append(t,r);o.hash=e.toString()}return o.href},exports.convert1dTo2dArray=(e,t)=>{let r=e.slice(0),a=[];for(;r.length;)a.push(r.splice(0,t));return a},exports.detectInjectedConnectors=async function({store:e,walletList:t,externalWalletConfig:r,walletChainType:a,timeout:o=3e3}){let n=!1,s=window;return new Promise((p=>{function c(){if(n)return;n=!0,window.removeEventListener("ethereum#initialized",c);let o=e.getProviders();console.debug("Detected injected providers:",o.map((e=>e.info)));let s=[];for(let e of o)t.includes("coinbase_wallet")&&"com.coinbase.wallet"===e.info.rdns||"solana-only"===a&&"app.phantom"===e.info.rdns||s.push({type:e.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:e});if("solana-only"!==a)for(let e of function(){let e=window,t=e.ethereum;if(!t)return[];let r=[];if(t.providers?.length)for(let e of t.providers)e&&r.push(e);return r.push(e.ethereum),r}()){let t=l(e);if(!o.some((e=>e.info.name===t))){if(i(e,!0)&&!s.find((e=>"metamask"===e.type))){s.push({type:"metamask",legacyInjectedProvider:e});continue}if("Phantom"===t&&!s.find((e=>"phantom"===e.type))){s.push({type:"phantom",legacyInjectedProvider:e});continue}if("Coinbase Wallet"===t&&!s.find((e=>"coinbase_wallet"===e.type&&"smartWalletOnly"!==r.coinbaseWallet?.connectionOptions))){s.push({type:"coinbase_wallet",legacyInjectedProvider:e});continue}s.find((e=>"unknown_browser_extension"===e.type))||s.push({type:"unknown_browser_extension",legacyInjectedProvider:e})}}p(s)}s.ethereum?c():(window.addEventListener("ethereum#initialized",c,{once:!0}),setTimeout((()=>{c()}),o))}))},exports.formatChainIdToCAIP2=function(e){return`eip155:${String(Number(e))}`},exports.formatSolanaWalletAddress=(e,t=3,r=4)=>s(e,t,r,"solana"),exports.formatWalletAddress=s,exports.generateTypedDataWithDomainType=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},r=e.types.EIP712Domain??Object.entries(e.domain).map((([e,r])=>{if(null!=r&&"string"==typeof e&&e in t)return{name:e,type:t[e]}})).filter((e=>void 0!==e));return{...e,types:{...e.types,EIP712Domain:r}}},exports.getBlockExplorer=(e,r)=>{let a=Number(e),o=r.find((e=>e.id===a));if(!o)throw new t.PrivyConnectorError(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},exports.getGuestCredentialStorageKey=e=>`privy:guest:${e}`,exports.getJsonRpcEndpoint=(e,r,a,o)=>{let n=Number(e),l=r.find((e=>e.id===n));if(!l)throw new t.PrivyConnectorError(`Unsupported chainId ${e}`,4901);return c(l,a,o)},exports.getJsonRpcEndpointFromChain=c,exports.getJsonRpcProvider=(r,a,o,n)=>{let l=Number(r),i=a.find((e=>e.id===l));if(!i)throw new t.PrivyConnectorError(`Unsupported chainId ${r}`,4901);return new e.StaticJsonRpcProvider(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0]?i.rpcUrls.privyWalletOverride.http[0]:o.rpcUrls&&o.rpcUrls[l]?o.rpcUrls[l]:i.rpcUrls.privy?.http[0]?{url:i.rpcUrls.privy.http[0],headers:{"privy-app-id":n.appId}}:i.rpcUrls.public?.http[0]?i.rpcUrls.public.http[0]:i.rpcUrls.default?.http[0])},exports.getPrivyWalletKey=e=>`privy:wallet:${e}`,exports.getProviderAccessTokenStorageKey=e=>`privy:cross-app:${e}`,exports.invokeUntilSettled=(e,t={})=>{let r=t.delayMs||150,a=t.maxAttempts||270;return new Promise((async(o,n)=>{let l=!1,i=0;for(;!l&&i<a;){if(t.abortSignal?.aborted)return;e().then((e=>{l=!0,o(e)}),((...e)=>{l=!0,n(...e)})),i+=1,await p(r)}l||n(Error("Exceeded max attempts before resolving function"))}))},exports.isCoinbaseWalletInstalled=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers)for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0;return!1},exports.isPhantomInstalled=()=>{if("phantom"in window){let e=window;if(e?.phantom?.ethereum?.isPhantom&&e?.phantom?.ethereum?.chainId)return!0}return!1},exports.linea=b,exports.mainnet=w,exports.optimism=v,exports.optimismSepolia=C,exports.pollForResult=function(e,{interval:t=100,timeout:r=5e3}={}){return new Promise(((a,o)=>{let n,l=0,i=()=>{l>=r?o("Max attempts reached without result"):(n=e(),l+=t,null==n?setTimeout(i,t):a(n))};i()}))},exports.polygon=E,exports.polygonAmoy=x,exports.sepolia=k,exports.sleep=p,exports.splitAtIndex=(e,t)=>{let r=[],a=[];for(let[o,n]of e.entries())o<t?r.push(n):a.push(n);return[r,a]},exports.stripEmoji=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),exports.toHex=e=>"string"==typeof e?e:"0x"+e.toString(16),exports.useAppConfig=()=>{let{appConfig:e}=a.useContext(N);return e},exports.useIsServerConfigLoaded=()=>{let{isServerConfigLoaded:e}=a.useContext(N);return e},exports.useWallets=function(){let e=a.useContext(K);if(null===e)throw Error("`useWallets` was called outside the PrivyProvider component");return e},exports.validateEmail=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),exports.zora=S;
|
|
1
|
+
"use strict";var e=require("@ethersproject/providers"),t=require("./privy-context-CGQoQ1iQ.js"),r=require("react/jsx-runtime"),a=require("react");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=o(require("tinycolor2"));const l=e=>e.isApexWallet?"Apex Wallet":e.isAvalanche?"Core Wallet":e.isBackpack?"Backpack":e.isBifrost?"Bifrost Wallet":e.isBitKeep?"BitKeep":e.isBitski?"Bitski":e.isBlockWallet?"BlockWallet":e.isBraveWallet?"Brave Wallet":e.isClover?"Clover":e.isCoin98?"Coin98 Wallet":e.isCoinbaseWallet?"Coinbase Wallet":e.isDawn?"Dawn Wallet":e.isDefiant?"Defiant":e.isDesig?"Desig Wallet":e.isEnkrypt?"Enkrypt":e.isExodus?"Exodus":e.isFordefi?"Fordefi":e.isFrame?"Frame":e.isFrontier?"Frontier Wallet":e.isGamestop?"GameStop Wallet":e.isHaqqWallet?"HAQQ Wallet":e.isHyperPay?"HyperPay Wallet":e.isImToken?"ImToken":e.isHaloWallet?"Halo Wallet":e.isKuCoinWallet?"KuCoin Wallet":e.isMathWallet?"MathWallet":e.isNovaWallet?"Nova Wallet":e.isOkxWallet||e.isOKExWallet?"OKX Wallet":e.isOneInchIOSWallet||e.isOneInchAndroidWallet?"1inch Wallet":e.isOneKey?"OneKey Wallet":e.isOpera?"Opera":e.isPhantom?"Phantom":e.isPortal?"Ripio Portal":e.isRabby?"Rabby Wallet":e.isRainbow?"Rainbow":e.isSafePal?"SafePal Wallet":e.isStatus?"Status":e.isSubWallet?"SubWallet":e.isTalisman?"Talisman":e.isTally||e.isTaho?"Taho":e.isTokenPocket?"TokenPocket":e.isTokenary?"Tokenary":e.isTrust||e.isTrustWallet?"Trust Wallet":e.isTTWallet?"TTWallet":e.isXDEFI?"XDEFI Wallet":e.isZeal?"Zeal":e.isZerion?"Zerion":e.isMetaMask?"MetaMask":void 0,i=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||"MetaMask"!==l(e))return!1;if(e.providers)for(let t of e.providers)if(!i(t))return!1;return!0},s=(e,t=3,r=4,a="ethereum")=>{if(!e)return"";let o="ethereum"===a?2:0;return t+r+o+3>=e.length?e:`${e.slice(0,o+t)}...${e.slice(e.length-r,e.length)}`},p=e=>new Promise((t=>setTimeout(t,e)));const c=(e,r,a)=>{let o,n=e.id,l=Number(e.id);if(e.rpcUrls.privyWalletOverride&&e.rpcUrls.privyWalletOverride.http[0])o=e.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[l])o=r.rpcUrls[l];else if(e.rpcUrls.privy?.http[0]){let t=new URL(e.rpcUrls.privy.http[0]);t.searchParams.append("privyAppId",a),o=t.toString()}else o=e.rpcUrls.public?.http[0]?e.rpcUrls.public.http[0]:e.rpcUrls.default?.http[0];if(!o)throw new t.PrivyConnectorError(`No RPC url found for ${n}`);return o};const u={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-mainnet.rpc.privy.systems"]},alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}},h={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0},d={id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}}},m={id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},testnet:!0},f={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-mainnet.rpc.privy.systems"]},blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}}},g={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0},y={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1},b={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1},w={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://mainnet.rpc.privy.systems"]},alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}},v={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-mainnet.rpc.privy.systems"]},alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}},C={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0},E={id:137,name:"Polygon Mainnet",network:"polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-mainnet.rpc.privy.systems"]},alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}},x={id:80002,name:"Polygon Amoy",network:"polygon-amoy",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-amoy.rpc.privy.systems"]},infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0},k={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{privy:{http:["https://sepolia.rpc.privy.systems"]},alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},testnet:!0},S={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}},O=[u,h,k,w,v,C,E,x,y,{id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0},{id:314,name:"Filecoin - Mainnet",network:"filecoin-mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]},public:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"},filscan:{name:"Filscan",url:"https://filscan.io"},filscout:{name:"Filscout",url:"https://filscout.io/en"},glif:{name:"Glif",url:"https://explorer.glif.io"}}},{id:314159,name:"Filecoin - Calibration testnet",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}},f,g,{id:80085,network:"berachain-artio",name:"Berachain Artio",nativeCurrency:{name:"BERA",symbol:"BERA",decimals:18},rpcUrls:{default:{http:["https://berachain-artio.rpc.privy.systems"]},public:{http:["https://berachain-artio.rpc.privy.systems"]}},blockExplorers:{default:{name:"Beratrail",url:"https://artio.beratrail.io"}},testnet:!0},{id:42,network:"lukso",name:"LUKSO",nativeCurrency:{name:"LUKSO",symbol:"LYX",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.lukso.network"],webSocket:["wss://ws-rpc.mainnet.lukso.network"]}},blockExplorers:{default:{name:"LUKSO Mainnet Explorer",url:"https://explorer.execution.mainnet.lukso.network"}}},b,{id:59140,network:"linea-testnet",name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"}},testnet:!0},d,m,S,{id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0},{id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0},{id:17e3,name:"Holesky",network:"holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://holesky.etherscan.io"},default:{name:"EtherScan",url:"https://holesky.etherscan.io"}}},{id:690,name:"Redstone",network:"redstone",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.redstonechain.com"]},public:{http:["https://rpc.redstonechain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.redstone.xyz/"}}},{id:17069,name:"Garnet Holesky",network:"garnet-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.garnetchain.com"]},public:{http:["https://rpc.garnetchain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.garnetchain.com"}}}],A=new Set(O.map((e=>e.id))),U={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:"34357d3c125c2bcf2ce2bc3309d98715",rpcConfig:{rpcUrls:{},rpcTimeouts:{}},externalWallets:{coinbaseWallet:{connectionOptions:"all"}},captchaEnabled:!1,_render:{standalone:!1},fundingMethodConfig:{moonpay:{useSandbox:!1}}};let T=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","universal_profile","bybit_wallet","wallet_connect","detected_wallets","detected_solana_wallets","detected_ethereum_wallets","rabby_wallet","safe"]),_=e=>T.has(e),W=(e,t,r)=>r.indexOf(e)===t;const P=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(_).filter(W):e?e.filter(_).filter(W):U.appearance.walletList;function I(e,t){return{...e,rpcUrls:{...e.rpcUrls,privy:{http:[t]}}}}let M="#FFFFFF";function F(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return n.default({...e.toHsl(),l:r})}function L({backgroundTheme:e,accentHex:t}){let r;switch(e){case"light":r=M;break;case"dark":r="#1E1E1D";break;default:r=e}let a=n.default(r),o=n.default(t),l=n.default("#51BA81"),i=n.default("#FFB74D"),s=n.default("#EC6351"),p=function(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}(a.getLuminance()),c=F(a,"light"===p?-.04:.11),u=F(a,"light"===p?-.88:.87),h=F(a,"light"===p?-.7:.75),d=F(a,"light"===p?-.43:.45).desaturate("light"===p?60:20),m=F(a,"light"===p?-.08:.25).desaturate("light"===p?60:20),f=F(o,.15),g=F(o,-.06),y=F(s,.3),b=F(i,.3),w=n.default(o.getLuminance()>.5?"#040217":M),v=F(l,-.16),C=F(l,.4);return{colorScheme:p,background:a.toHslString(),background2:c.toHslString(),foreground:u.toHslString(),foreground2:h.toHslString(),foreground3:d.toHslString(),foreground4:m.toHslString(),accent:o.toHslString(),accentLight:f.toHslString(),accentDark:g.toHslString(),foregroundAccent:w.toHslString(),success:l.toHslString(),successDark:v.toHslString(),successLight:C.toHslString(),error:s.toHslString(),errorLight:y.toHslString(),warn:i.toHslString(),warnLight:b.toHslString()}}function D(e,t,r){let a,o,n,l,i,s,p,c,u,h,d,m,f,g,y,b,v=r?console.warn:()=>{};t?.loginMethods?(a=t.loginMethods.includes("email"),o=t.loginMethods.includes("sms"),l=t.loginMethods.includes("wallet"),i=t.loginMethods.includes("google"),s=t.loginMethods.includes("twitter"),p=t.loginMethods.includes("discord"),u=t.loginMethods.includes("spotify"),h=t.loginMethods.includes("instagram"),c=t.loginMethods.includes("tiktok"),m=t.loginMethods.includes("github"),d=t.loginMethods.includes("linkedin"),f=t.loginMethods.includes("apple"),g=t.loginMethods.includes("farcaster"),y=t.loginMethods.includes("telegram")):(a=e.emailAuth,o=e.smsAuth,l=e.walletAuth||e.solanaWalletAuth,i=e.googleOAuth,s=e.twitterOAuth,p=e.discordOAuth,m=e.githubOAuth,u=e.spotifyOAuth,h=e.instagramOAuth,c=e.tiktokOAuth,d=e.linkedinOAuth,f=e.appleOAuth,g=e.farcasterAuth,y=e.telegramAuth),"undefined"!=typeof window&&"function"!=typeof window.PublicKeyCredential?n=!1:e.passkeyAuth&&(n=!0);let C=[a,o].filter(Boolean),E=[i,s,p,m,u,h,c,d,f,g,y].filter(Boolean),x=[l].filter(Boolean);if(C.length+E.length+x.length===0)throw Error("You must enable at least one login method");let k=void 0!==t?.appearance?.showWalletLoginFirst?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;k&&0===x.length?(v("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),k=!1):k||E.length+C.length!==0||(v("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),k=!0);let S=t?.externalWallets?.walletConnect?.enabled??!0;t?.loginMethods&&t.loginMethodsAndOrder&&v("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let A=P({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),T=(({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],r=[];for(let r of(e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`"),e.primary.slice(1)))t.includes(r)?console.warn(`Duplicated login method: ${r}`):t.push(r);for(let a of e.overflow??[])t.includes(a)||r.includes(a)?console.warn(`Duplicated login method: ${a}`):r.push(a);return{primary:t,overflow:r}})({input:t?.loginMethodsAndOrder}),_=t?.intl?.defaultCountry??"US",{chains:W,defaultChain:M}=function({additionalChains:e,supportedChains:t,defaultChainFromConfig:r,hasRpcConfigDefined:a}){let o;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(0===t.length)throw Error("`supportedChains` must contain at least one chain");t.filter((e=>e.rpcUrls.privyWalletOverride)).length>0&&a&&console.warn("You have specified at least one `supportedChain` with `privyWalletOverride` but also have `rpcConfig` defined. The `rpcConfig` will be ignored. `rpcConfig` is deprecated and you should use `privyWalletOverride` in a `supportedChain`."),o=t.map((e=>{if(e.rpcUrls.privyWalletOverride)return e;let t=O.find((t=>t.id===e.id)),r=t?.rpcUrls.privy?.http[0];return r?I(e,r):e}))}else o=O.concat(e??[]);let n=t?o[0]:w,l=r??n;if(!o.find((e=>e.id===l.id)))throw Error("`defaultChain` must be included in `supportedChains`");return{chains:o,defaultChain:l}}({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),F=!!t?.defaultChain,D=t?.customAuth?.getCustomAccessToken&&!1!==t?.customAuth?.enabled,R=!(e.enforceWalletUis??1);if(b=e.legacyWalletUiConfig??1?D?t?.embeddedWallets?.noPromptOnSignature??!0:t?.embeddedWallets?.noPromptOnSignature??R:R,!1===t?.embeddedWallets?.waitForTransactionConfirmation&&!0!==b)throw Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:H,...N}=t?.embeddedWallets??{};return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,landingHeader:t?.appearance?.landingHeader??U.appearance.landingHeader,loginMessage:"string"==typeof t?.appearance?.loginMessage?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,palette:L({backgroundTheme:t?.appearance?.theme??U.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??U.appearance.accentColor}),loginGroupPriority:k?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:A,walletChainType:t?.appearance?.walletChainType??(({evmWalletAuth:e,solanaWalletAuth:t})=>e&&t?"ethereum-and-solana":e?"ethereum-only":t?"solana-only":"ethereum-only")({evmWalletAuth:e.walletAuth??!1,solanaWalletAuth:e.solanaWalletAuth??!1})},loginMethods:{wallet:l,email:a,sms:o,passkey:n,google:i,twitter:s,discord:p,github:m,spotify:u,instagram:h,tiktok:c,linkedin:d,apple:f,farcaster:g,telegram:y},disablePlusEmails:e.disablePlusEmails,loginMethodsAndOrder:T,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??U.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??U.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??U.rpcConfig.rpcTimeouts},chains:W,defaultChain:M,intl:{defaultCountry:_},shouldEnforceDefaultChainOnConnect:F,captchaEnabled:e.captchaEnabled??U.captchaEnabled,captchaSiteKey:e.captchaSiteKey,externalWallets:{coinbaseWallet:{connectionOptions:t?.externalWallets?.coinbaseWallet?.connectionOptions??U.externalWallets.coinbaseWallet.connectionOptions},walletConnect:{enabled:S},solana:{connectors:t?.externalWallets?.solana?.connectors}},embeddedWallets:{...e.embeddedWalletConfig,..."boolean"==typeof H?{requireUserOwnedRecoveryOnCreate:H}:{},...D?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...N,noPromptOnSignature:b,showWalletUIs:t?.embeddedWallets?.showWalletUIs},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:D?{enabled:!0,...t.customAuth}:void 0,loginConfig:{telegramAuthConfiguration:e.telegramAuthConfiguration},headless:!!t?.headless,render:{standalone:t?._render?.standalone??U._render.standalone},fundingConfig:e.fundingConfig,fundingMethodConfig:{...t?.fundingMethodConfig??U.fundingMethodConfig,moonpay:{...t?.fundingMethodConfig?.moonpay??U.fundingMethodConfig.moonpay,useSandbox:t?.fundingMethodConfig?.moonpay.useSandbox??t?.fiatOnRamp?.useSandbox??U.fundingMethodConfig.moonpay.useSandbox}}}}let R={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,disablePlusEmails:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""};const H=D(R,void 0,!1);let N=a.createContext({appConfig:H,isServerConfigLoaded:!1});const K=a.createContext(null);exports.CHAIN_ID_MAINNET=1,exports.CLIENT_ANALYTICS_ID_KEY="privy:caid",exports.CODE_VERIFIER_KEY="privy:code_verifier",exports.CONNECTIONS_HISTORY_KEY="privy:connections",exports.CONNECTORS_STATE_KEY="privy:connectors",exports.DEFAULT_API_TIMEOUT_MS=2e4,exports.DEFAULT_APP_CONFIG=H,exports.DEFAULT_NETWORK="0x1",exports.DEFAULT_PRIVY_API_URL="https://auth.privy.io",exports.DEFAULT_RPC_TIMEOUT=12e4,exports.DEFAULT_SUCCESS_SCREEN_DURATION_MS=1400,exports.DEFAULT_SUCCESS_SCREEN_EXTRA_LONG_DURATION_MS=4e3,exports.DEFAULT_SUCCESS_SCREEN_LONG_DURATION_MS=2500,exports.DEFAULT_SUPPORTED_CHAINS=O,exports.DEFAULT_SUPPORTED_CHAIN_IDS=A,exports.DEPRECATED_REFRESH_TOKEN="deprecated",exports.FORKED_TOKEN_STORAGE_KEY="privy:session_transfer_token",exports.HEADLESS_OAUTH_KEY="privy:headless_oauth",exports.IDENTITY_TOKEN_COOKIE_KEY="privy-id-token",exports.IDENTITY_TOKEN_STORAGE_KEY="privy:id_token",exports.MOONPAY_API_URL="https://api.moonpay.com/v1",exports.MOONPAY_API_URL_SANDBOX="https://api.moonpay.com/v1",exports.MOONPAY_PUBLIC_KEY="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",exports.MOONPAY_PUBLIC_KEY_SANDBOX="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",exports.OAUTH_DISABLE_SIGNUP_KEY="privy:oauth_disable_signup",exports.PrivyAppConfigProvider=({children:e,legacyCreateEmbeddedWalletFlag:t,client:o,clientConfig:n})=>{let[l,i]=a.useState(null),s=a.useMemo((()=>D(l??R,n,!!l)),[l,n]);return a.useEffect((()=>{if(!l)return;let e=function(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:a,supportedChains:o,defaultChain:n,externalWallets:l,...i}=e;return{...i,...a?{additionalChains:a.map((e=>e.id))}:void 0,...o?{supportedChains:o.map((e=>e.id))}:void 0,...n?{defaultChain:n.id}:void 0,...l?{walletConnect:l.walletConnect,coinbaseWallet:l.coinbaseWallet,solana:{connectors:l.solana?.connectors?.get().map((e=>e.walletClientType))}}:void 0,legacyCreateEmbeddedWalletFlag:t}}(n,t),r=function(e,t=0){let r=3735928559^t,a=1103547991^t;for(let t,o=0;o<e.length;o++)r=Math.imul(r^(t=e.charCodeAt(o)),2654435761),a=Math.imul(a^t,1597334677);return r=Math.imul(r^r>>>16,2246822507)^Math.imul(a^a>>>13,3266489909),4294967296*(2097151&(a=Math.imul(a^a>>>16,2246822507)^Math.imul(r^r>>>13,3266489909)))+(r>>>0)}(JSON.stringify(e)).toString(),a=`privy:sent:${l.id}:${r}`;localStorage.getItem(a)||(o.createAnalyticsEvent({eventName:"sdk_initialize",payload:e}),localStorage.setItem(a,"t"))}),[n,t,l]),a.useEffect((()=>{l||(async()=>{try{let e=await o.getServerConfig();e.customApiUrl&&o.updateApiUrl(e.customApiUrl),i(e)}catch(e){console.warn("Error generating app config: ",e)}})()}),[]),r.jsx(N.Provider,{value:{appConfig:s,isServerConfigLoaded:!!l},children:e})},exports.REFRESH_TOKEN_COOKIE_KEY="privy-refresh-token",exports.REFRESH_TOKEN_STORAGE_KEY="privy:refresh_token",exports.SESSION_COOKIE_KEY="privy-session",exports.STATE_CODE_KEY="privy:state_code",exports.TOKEN_COOKIE_KEY="privy-token",exports.TOKEN_STORAGE_KEY="privy:token",exports.UseWalletsContext=K,exports.VERSION="1.92.4",exports.WALLET_PROXY_TIMEOUT=3e4,exports.addPrivyRpcToChain=I,exports.addRpcUrlOverrideToChain=function(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}},exports.addToDefaultChains=function(e){let t=e.filter((e=>!A.has(e.id)));return O.concat(t)},exports.arbitrum=u,exports.arbitrumSepolia=h,exports.avalanche=d,exports.avalancheFuji=m,exports.base=f,exports.baseSepolia=g,exports.celo=y,exports.clamp=function(e,{min:t,max:r}){return Math.min(Math.max(e,t),r)},exports.constructURL=(e,t,r={},a={})=>{let o=new URL(t,e);for(let[e,t]of Object.entries(r))void 0!==t&&o.searchParams.set(e,t);let n=Object.entries(a);if(n.length>0){let e=new URLSearchParams;for(let[t,r]of n)e.append(t,r);o.hash=e.toString()}return o.href},exports.convert1dTo2dArray=(e,t)=>{let r=e.slice(0),a=[];for(;r.length;)a.push(r.splice(0,t));return a},exports.detectInjectedConnectors=async function({store:e,walletList:t,externalWalletConfig:r,walletChainType:a,timeout:o=3e3}){let n=!1,s=window;return new Promise((p=>{function c(){if(n)return;n=!0,window.removeEventListener("ethereum#initialized",c);let o=e.getProviders();console.debug("Detected injected providers:",o.map((e=>e.info)));let s=[];for(let e of o)t.includes("coinbase_wallet")&&"com.coinbase.wallet"===e.info.rdns||"solana-only"===a&&"app.phantom"===e.info.rdns||s.push({type:e.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:e});if("solana-only"!==a)for(let e of function(){let e=window,t=e.ethereum;if(!t)return[];let r=[];if(t.providers?.length)for(let e of t.providers)e&&r.push(e);return r.push(e.ethereum),r}()){let t=l(e);if(!o.some((e=>e.info.name===t))){if(i(e,!0)&&!s.find((e=>"metamask"===e.type))){s.push({type:"metamask",legacyInjectedProvider:e});continue}if("Phantom"===t&&!s.find((e=>"phantom"===e.type))){s.push({type:"phantom",legacyInjectedProvider:e});continue}if("Coinbase Wallet"===t&&!s.find((e=>"coinbase_wallet"===e.type&&"smartWalletOnly"!==r.coinbaseWallet?.connectionOptions))){s.push({type:"coinbase_wallet",legacyInjectedProvider:e});continue}s.find((e=>"unknown_browser_extension"===e.type))||s.push({type:"unknown_browser_extension",legacyInjectedProvider:e})}}p(s)}s.ethereum?c():(window.addEventListener("ethereum#initialized",c,{once:!0}),setTimeout((()=>{c()}),o))}))},exports.formatChainIdToCAIP2=function(e){return`eip155:${String(Number(e))}`},exports.formatSolanaWalletAddress=(e,t=3,r=4)=>s(e,t,r,"solana"),exports.formatWalletAddress=s,exports.generateTypedDataWithDomainType=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},r=e.types.EIP712Domain??Object.entries(e.domain).map((([e,r])=>{if(null!=r&&"string"==typeof e&&e in t)return{name:e,type:t[e]}})).filter((e=>void 0!==e));return{...e,types:{...e.types,EIP712Domain:r}}},exports.getBlockExplorer=(e,r)=>{let a=Number(e),o=r.find((e=>e.id===a));if(!o)throw new t.PrivyConnectorError(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},exports.getGuestCredentialStorageKey=e=>`privy:guest:${e}`,exports.getJsonRpcEndpoint=(e,r,a,o)=>{let n=Number(e),l=r.find((e=>e.id===n));if(!l)throw new t.PrivyConnectorError(`Unsupported chainId ${e}`,4901);return c(l,a,o)},exports.getJsonRpcEndpointFromChain=c,exports.getJsonRpcProvider=(r,a,o,n)=>{let l=Number(r),i=a.find((e=>e.id===l));if(!i)throw new t.PrivyConnectorError(`Unsupported chainId ${r}`,4901);return new e.StaticJsonRpcProvider(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0]?i.rpcUrls.privyWalletOverride.http[0]:o.rpcUrls&&o.rpcUrls[l]?o.rpcUrls[l]:i.rpcUrls.privy?.http[0]?{url:i.rpcUrls.privy.http[0],headers:{"privy-app-id":n.appId}}:i.rpcUrls.public?.http[0]?i.rpcUrls.public.http[0]:i.rpcUrls.default?.http[0])},exports.getPrivyWalletKey=e=>`privy:wallet:${e}`,exports.getProviderAccessTokenStorageKey=e=>`privy:cross-app:${e}`,exports.invokeUntilSettled=(e,t={})=>{let r=t.delayMs||150,a=t.maxAttempts||270;return new Promise((async(o,n)=>{let l=!1,i=0;for(;!l&&i<a;){if(t.abortSignal?.aborted)return;e().then((e=>{l=!0,o(e)}),((...e)=>{l=!0,n(...e)})),i+=1,await p(r)}l||n(Error("Exceeded max attempts before resolving function"))}))},exports.isCoinbaseWalletInstalled=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers)for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0;return!1},exports.isPhantomInstalled=()=>{if("phantom"in window){let e=window;if(e?.phantom?.ethereum?.isPhantom&&e?.phantom?.ethereum?.chainId)return!0}return!1},exports.linea=b,exports.mainnet=w,exports.optimism=v,exports.optimismSepolia=C,exports.pollForResult=function(e,{interval:t=100,timeout:r=5e3}={}){return new Promise(((a,o)=>{let n,l=0,i=()=>{l>=r?o("Max attempts reached without result"):(n=e(),l+=t,null==n?setTimeout(i,t):a(n))};i()}))},exports.polygon=E,exports.polygonAmoy=x,exports.sepolia=k,exports.sleep=p,exports.splitAtIndex=(e,t)=>{let r=[],a=[];for(let[o,n]of e.entries())o<t?r.push(n):a.push(n);return[r,a]},exports.stripEmoji=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),exports.toHex=e=>"string"==typeof e?e:"0x"+e.toString(16),exports.useAppConfig=()=>{let{appConfig:e}=a.useContext(N);return e},exports.useIsServerConfigLoaded=()=>{let{isServerConfigLoaded:e}=a.useContext(N);return e},exports.useWallets=function(){let e=a.useContext(K);if(null===e)throw Error("`useWallets` was called outside the PrivyProvider component");return e},exports.validateEmail=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),exports.zora=S;
|
package/dist/dts/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import react__default, { MouseEvent } from 'react';
|
|
3
|
-
import { C as Chain, W as WalletConnector, B as BaseConnectedEthereumWallet, a as RpcConfig, P as PrivyProxyProvider, E as Embedded1193Provider, b as WalletClientType, c as ConnectedWalletMetadata, d as ConnectorType, e as WalletListEntry, f as ExternalWalletsConfig, g as BaseConnectedWallet, S as SolanaWalletConnector, h as EIP1193Provider, U as User, O as OAuthTokens, i as OAuthProviderType, M as MoonpaySignRequest, j as MoonpaySignResponse, k as SmartWalletConfig, l as PrivyServerConfig, m as PrivyFarcasterSignerInitResponse, L as LoginMethod, n as SiweWalletMetadata, T as TelegramAuthResult, o as OAuthUserInfo, p as PrivyClientConfig, q as ConnectWalletModalOptions, r as LoginModalOptions, s as CreateWalletOptions, t as Wallet, u as SetWalletRecoveryOptions, v as SignMessageModalUIOptions, w as SignTypedDataParams, x as MfaMethod, y as UnsignedTransactionRequest, z as SendTransactionModalUIOptions, F as FundWalletConfig, A as TransactionReceipt, D as SupportedSolanaTransaction, G as SolanaTransactionReceipt, H as ConnectedWallet, I as PrivyIframeErrorTypesType, J as OAuthFlowState, K as LoginWithCode, N as OtpFlowState, Q as PasskeyFlowState, V as SiweFlowState, X as UnsignedTransactionRequestWithChainId, Y as CustomAuthFlowState } from './types-
|
|
4
|
-
export { ag as Apple, aq as AppleOAuthWithMetadata, Z as AsExternalProvider, aF as ConnectedSolanaWallet, ay as ContractUIOptions, aj as CrossAppAccount, at as CrossAppAccountWithMetadata, ad as Discord, am as DiscordOAuthWithMetadata, av as Email, a8 as EmailWithMetadata, aC as Farcaster, ar as FarcasterWithMetadata, ae as Github, an as GithubOAuthWithMetadata, ab as Google, ak as GoogleOAuthWithMetadata, af as LinkedIn, ap as LinkedInOAuthWithMetadata, aE as LoginMethodOrderOption, $ as MessageTypes, a1 as MoonpayConfig, a2 as MoonpayCurrencyCode, aA as MoonpayFundingConfig, a3 as MoonpayPaymentMethod, az as NativeFundingConfig, a7 as NonEmptyArray, aD as Passkey, au as PasskeyWithMetadata, aw as Phone, a9 as PhoneWithMetadata, aB as PriceDisplayOptions, a4 as Quantity, a6 as SolanaCluster, a0 as SolanaFundingConfig, ai as Telegram, as as TelegramWithMetadata, ah as Tiktok, ao as TiktokOAuthWithMetadata, a5 as TransactionLog, ax as TransactionUIOptions, ac as Twitter, al as TwitterOAuthWithMetadata, _ as TypedMessage, aa as WalletWithMetadata } from './types-
|
|
3
|
+
import { C as Chain, W as WalletConnector, B as BaseConnectedEthereumWallet, a as RpcConfig, P as PrivyProxyProvider, E as Embedded1193Provider, b as WalletClientType, c as ConnectedWalletMetadata, d as ConnectorType, e as WalletListEntry, f as ExternalWalletsConfig, g as BaseConnectedWallet, S as SolanaWalletConnector, h as EIP1193Provider, U as User, O as OAuthTokens, i as OAuthProviderType, M as MoonpaySignRequest, j as MoonpaySignResponse, k as SmartWalletConfig, l as PrivyServerConfig, m as PrivyFarcasterSignerInitResponse, L as LoginMethod, n as SiweWalletMetadata, T as TelegramAuthResult, o as OAuthUserInfo, p as PrivyClientConfig, q as ConnectWalletModalOptions, r as LoginModalOptions, s as CreateWalletOptions, t as Wallet, u as SetWalletRecoveryOptions, v as SignMessageModalUIOptions, w as SignTypedDataParams, x as MfaMethod, y as UnsignedTransactionRequest, z as SendTransactionModalUIOptions, F as FundWalletConfig, A as TransactionReceipt, D as SupportedSolanaTransaction, G as SolanaTransactionReceipt, H as ConnectedWallet, I as PrivyIframeErrorTypesType, J as OAuthFlowState, K as LoginWithCode, N as OtpFlowState, Q as PasskeyFlowState, V as SiweFlowState, X as UnsignedTransactionRequestWithChainId, Y as CustomAuthFlowState } from './types-CHvDgSZo.js';
|
|
4
|
+
export { ag as Apple, aq as AppleOAuthWithMetadata, Z as AsExternalProvider, aF as ConnectedSolanaWallet, ay as ContractUIOptions, aj as CrossAppAccount, at as CrossAppAccountWithMetadata, ad as Discord, am as DiscordOAuthWithMetadata, av as Email, a8 as EmailWithMetadata, aC as Farcaster, ar as FarcasterWithMetadata, ae as Github, an as GithubOAuthWithMetadata, ab as Google, ak as GoogleOAuthWithMetadata, af as LinkedIn, ap as LinkedInOAuthWithMetadata, aE as LoginMethodOrderOption, $ as MessageTypes, a1 as MoonpayConfig, a2 as MoonpayCurrencyCode, aA as MoonpayFundingConfig, a3 as MoonpayPaymentMethod, az as NativeFundingConfig, a7 as NonEmptyArray, aD as Passkey, au as PasskeyWithMetadata, aw as Phone, a9 as PhoneWithMetadata, aB as PriceDisplayOptions, a4 as Quantity, a6 as SolanaCluster, a0 as SolanaFundingConfig, ai as Telegram, as as TelegramWithMetadata, ah as Tiktok, ao as TiktokOAuthWithMetadata, a5 as TransactionLog, ax as TransactionUIOptions, ac as Twitter, al as TwitterOAuthWithMetadata, _ as TypedMessage, aa as WalletWithMetadata } from './types-CHvDgSZo.js';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import { TurnstileProps } from '@marsidev/react-turnstile';
|
|
7
7
|
import EventEmitter from 'eventemitter3';
|
|
@@ -14,13 +14,12 @@ import { SendTransactionOptions } from '@solana/wallet-adapter-base';
|
|
|
14
14
|
import * as _solana_web3_js from '@solana/web3.js';
|
|
15
15
|
import { Connection } from '@solana/web3.js';
|
|
16
16
|
import { AbstractProvider } from 'web3-core';
|
|
17
|
-
import { Address, Hex } from 'viem';
|
|
18
|
-
import { SendEip712TransactionParameters } from 'viem/zksync';
|
|
19
17
|
import { CustomMetadataType, SmartWalletType, PrivyCoinbaseOnRampInitInput, PrivyCoinbaseOnRampInitResponse, PrivyCoinbaseOnRampStatusResponse } from '@privy-io/public-api';
|
|
20
18
|
import { FetchOptions } from 'ofetch';
|
|
21
|
-
import { P as PrivyEvents } from './solana-
|
|
22
|
-
export { C as CallbackError, a as UseFundSolanaWalletInterface, U as UseSolanaWalletsInterface, u as useSolanaWallets } from './solana-
|
|
19
|
+
import { P as PrivyEvents } from './solana-MHNU24e3.js';
|
|
20
|
+
export { C as CallbackError, a as UseFundSolanaWalletInterface, U as UseSolanaWalletsInterface, u as useSolanaWallets } from './solana-MHNU24e3.js';
|
|
23
21
|
import '@metamask/eth-sig-util';
|
|
22
|
+
import 'viem';
|
|
24
23
|
import '@privy-io/js-sdk-core';
|
|
25
24
|
|
|
26
25
|
declare const DEFAULT_SUPPORTED_CHAINS: readonly [Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain];
|
|
@@ -210,6 +209,11 @@ interface ResponseCrossAppAccount {
|
|
|
210
209
|
first_verified_at: number | null;
|
|
211
210
|
latest_verified_at: number | null;
|
|
212
211
|
}
|
|
212
|
+
interface ResponseDelegatedWallet {
|
|
213
|
+
chain_type: 'solana';
|
|
214
|
+
address: string;
|
|
215
|
+
}
|
|
216
|
+
type DelegatedWalletsResponseType = Array<ResponseDelegatedWallet>;
|
|
213
217
|
type LinkedAccountsResponseType = Array<ResponseEmailAccount | ResponsePhoneAccount | ResponseEthereumAccount | ResponseSmartWalletAccount | ResponseSolanaAccount | ResponseOAuthGoogle | ResponseOAuthTwitter | ResponseOAuthDiscord | ResponseOAuthGithub | ResponseOAuthSpotify | ResponseOAuthInstagram | ResponseOAuthTiktok | ResponseOAuthLinkedIn | ResponseOAuthApple | ResponseCustomJwtAccount | ResponseFarcasterAccount | ResponsePasskeyAccount | ResponseTelegramAccount | ResponseCrossAppAccount>;
|
|
214
218
|
interface ResponseSmsMfaMethod {
|
|
215
219
|
type: 'sms';
|
|
@@ -221,6 +225,7 @@ interface GetCurrentUserResponse {
|
|
|
221
225
|
is_guest: boolean;
|
|
222
226
|
created_at: number;
|
|
223
227
|
linked_accounts: LinkedAccountsResponseType;
|
|
228
|
+
delegated_wallets: DelegatedWalletsResponseType;
|
|
224
229
|
mfa_methods: LinkedMfaMethodsResponseType;
|
|
225
230
|
has_accepted_terms: boolean;
|
|
226
231
|
oauth_tokens?: {
|
|
@@ -1402,24 +1407,6 @@ declare function useMfa(): {
|
|
|
1402
1407
|
mfaMethods: ("sms" | "totp" | "passkey")[];
|
|
1403
1408
|
};
|
|
1404
1409
|
|
|
1405
|
-
type FactoryDeps = {
|
|
1406
|
-
factoryDeps?: Hex[];
|
|
1407
|
-
};
|
|
1408
|
-
type Call = {
|
|
1409
|
-
readonly to?: any;
|
|
1410
|
-
readonly value?: any;
|
|
1411
|
-
readonly data?: any;
|
|
1412
|
-
};
|
|
1413
|
-
/**
|
|
1414
|
-
* This is ONLY for the cross app transact screen and should eventually be unified with our other
|
|
1415
|
-
* smart wallet wrapper logic.
|
|
1416
|
-
*/
|
|
1417
|
-
declare function useAbstractSmartWallets(): {
|
|
1418
|
-
sendTransaction: (fromAddress: {
|
|
1419
|
-
address: Address;
|
|
1420
|
-
}, sendEip712TransactionParams: SendEip712TransactionParameters & FactoryDeps, calls: Call[], providerId: string, uiOptions: SendTransactionModalUIOptions) => Promise<`0x${string}`>;
|
|
1421
|
-
};
|
|
1422
|
-
|
|
1423
1410
|
/**
|
|
1424
1411
|
* Use this hook to enroll a user in MFA
|
|
1425
1412
|
*
|
|
@@ -2287,4 +2274,4 @@ declare const LoginModal: ({ open }: {
|
|
|
2287
2274
|
open: boolean;
|
|
2288
2275
|
}) => react_jsx_runtime.JSX.Element;
|
|
2289
2276
|
|
|
2290
|
-
export { Captcha, ConnectWalletModalOptions, ConnectedWallet, ConnectorManager, CustomAuthFlowState, EIP1193Provider, EthereumWalletConnector, FundWalletConfig, LoginModal, LoginModalOptions, LoginWithCode, MfaMethod, OAuthFlowState, OAuthProviderType, OAuthTokens, OtpFlowState, PasskeyFlowState, PrivyClient, PrivyClientConfig, PrivyEvents, type PrivyInterface, PrivyProvider, type PrivyProviderProps, PrivyProxyProvider, DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS, type SendCodeToEmail, type SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, SiweFlowState, SolanaTransactionReceipt, SupportedSolanaTransaction, TransactionReceipt, UnsignedTransactionRequest, type UseConnectCoinbaseSmartWalletInterface, type UseCustomAuth, type UseDelegatedActionsInterface, type UseFundWalletInterface, type UseLoginWithEmail, type UseLoginWithPasskey, type UseLoginWithSms, type UseOAuthTokens, type UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletListEntry, addPrivyRpcToChain, addRpcUrlOverrideToChain, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getAccessToken, getEmbeddedConnectedWallet,
|
|
2277
|
+
export { Captcha, ConnectWalletModalOptions, ConnectedWallet, ConnectorManager, CustomAuthFlowState, EIP1193Provider, EthereumWalletConnector, FundWalletConfig, LoginModal, LoginModalOptions, LoginWithCode, MfaMethod, OAuthFlowState, OAuthProviderType, OAuthTokens, OtpFlowState, PasskeyFlowState, PrivyClient, PrivyClientConfig, PrivyEvents, type PrivyInterface, PrivyProvider, type PrivyProviderProps, PrivyProxyProvider, DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS, type SendCodeToEmail, type SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, SiweFlowState, SolanaTransactionReceipt, SupportedSolanaTransaction, TransactionReceipt, UnsignedTransactionRequest, type UseConnectCoinbaseSmartWalletInterface, type UseCustomAuth, type UseDelegatedActionsInterface, type UseFundWalletInterface, type UseLoginWithEmail, type UseLoginWithPasskey, type UseLoginWithSms, type UseOAuthTokens, type UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletListEntry, addPrivyRpcToChain, addRpcUrlOverrideToChain, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getAccessToken, getEmbeddedConnectedWallet, useConnectCoinbaseSmartWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useCustomAuth, useDelegatedActions, useExperimentalFarcasterSigner, useFarcasterSigner, useFundWallet, useGuestAccounts, useLinkAccount, useLinkWithSiwe, useLogin, useLoginWithEmail, useLoginWithOAuth, useLoginWithPasskey, useLoginWithSms, useLogout, useMfa, useMfaEnrollment, useModalStatus, useOAuthTokens, usePrivy, useRegisterMfaListener, useSendSolanaTransaction, useSendTransaction, useSetWalletPassword, useSetWalletRecovery, useSignMessage, useSignTypedData, useToken, useUpdateAccount, useWallets };
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import react__default, { MouseEvent } from 'react';
|
|
3
|
-
import { C as Chain, W as WalletConnector, B as BaseConnectedEthereumWallet, a as RpcConfig, P as PrivyProxyProvider, E as Embedded1193Provider, b as WalletClientType, c as ConnectedWalletMetadata, d as ConnectorType, e as WalletListEntry, f as ExternalWalletsConfig, g as BaseConnectedWallet, S as SolanaWalletConnector, h as EIP1193Provider, U as User, O as OAuthTokens, i as OAuthProviderType, M as MoonpaySignRequest, j as MoonpaySignResponse, k as SmartWalletConfig, l as PrivyServerConfig, m as PrivyFarcasterSignerInitResponse, L as LoginMethod, n as SiweWalletMetadata, T as TelegramAuthResult, o as OAuthUserInfo, p as PrivyClientConfig, q as ConnectWalletModalOptions, r as LoginModalOptions, s as CreateWalletOptions, t as Wallet, u as SetWalletRecoveryOptions, v as SignMessageModalUIOptions, w as SignTypedDataParams, x as MfaMethod, y as UnsignedTransactionRequest, z as SendTransactionModalUIOptions, F as FundWalletConfig, A as TransactionReceipt, D as SupportedSolanaTransaction, G as SolanaTransactionReceipt, H as ConnectedWallet, I as PrivyIframeErrorTypesType, J as OAuthFlowState, K as LoginWithCode, N as OtpFlowState, Q as PasskeyFlowState, V as SiweFlowState, X as UnsignedTransactionRequestWithChainId, Y as CustomAuthFlowState } from './types-
|
|
4
|
-
export { ag as Apple, aq as AppleOAuthWithMetadata, Z as AsExternalProvider, aF as ConnectedSolanaWallet, ay as ContractUIOptions, aj as CrossAppAccount, at as CrossAppAccountWithMetadata, ad as Discord, am as DiscordOAuthWithMetadata, av as Email, a8 as EmailWithMetadata, aC as Farcaster, ar as FarcasterWithMetadata, ae as Github, an as GithubOAuthWithMetadata, ab as Google, ak as GoogleOAuthWithMetadata, af as LinkedIn, ap as LinkedInOAuthWithMetadata, aE as LoginMethodOrderOption, $ as MessageTypes, a1 as MoonpayConfig, a2 as MoonpayCurrencyCode, aA as MoonpayFundingConfig, a3 as MoonpayPaymentMethod, az as NativeFundingConfig, a7 as NonEmptyArray, aD as Passkey, au as PasskeyWithMetadata, aw as Phone, a9 as PhoneWithMetadata, aB as PriceDisplayOptions, a4 as Quantity, a6 as SolanaCluster, a0 as SolanaFundingConfig, ai as Telegram, as as TelegramWithMetadata, ah as Tiktok, ao as TiktokOAuthWithMetadata, a5 as TransactionLog, ax as TransactionUIOptions, ac as Twitter, al as TwitterOAuthWithMetadata, _ as TypedMessage, aa as WalletWithMetadata } from './types-
|
|
3
|
+
import { C as Chain, W as WalletConnector, B as BaseConnectedEthereumWallet, a as RpcConfig, P as PrivyProxyProvider, E as Embedded1193Provider, b as WalletClientType, c as ConnectedWalletMetadata, d as ConnectorType, e as WalletListEntry, f as ExternalWalletsConfig, g as BaseConnectedWallet, S as SolanaWalletConnector, h as EIP1193Provider, U as User, O as OAuthTokens, i as OAuthProviderType, M as MoonpaySignRequest, j as MoonpaySignResponse, k as SmartWalletConfig, l as PrivyServerConfig, m as PrivyFarcasterSignerInitResponse, L as LoginMethod, n as SiweWalletMetadata, T as TelegramAuthResult, o as OAuthUserInfo, p as PrivyClientConfig, q as ConnectWalletModalOptions, r as LoginModalOptions, s as CreateWalletOptions, t as Wallet, u as SetWalletRecoveryOptions, v as SignMessageModalUIOptions, w as SignTypedDataParams, x as MfaMethod, y as UnsignedTransactionRequest, z as SendTransactionModalUIOptions, F as FundWalletConfig, A as TransactionReceipt, D as SupportedSolanaTransaction, G as SolanaTransactionReceipt, H as ConnectedWallet, I as PrivyIframeErrorTypesType, J as OAuthFlowState, K as LoginWithCode, N as OtpFlowState, Q as PasskeyFlowState, V as SiweFlowState, X as UnsignedTransactionRequestWithChainId, Y as CustomAuthFlowState } from './types-CHvDgSZo.js';
|
|
4
|
+
export { ag as Apple, aq as AppleOAuthWithMetadata, Z as AsExternalProvider, aF as ConnectedSolanaWallet, ay as ContractUIOptions, aj as CrossAppAccount, at as CrossAppAccountWithMetadata, ad as Discord, am as DiscordOAuthWithMetadata, av as Email, a8 as EmailWithMetadata, aC as Farcaster, ar as FarcasterWithMetadata, ae as Github, an as GithubOAuthWithMetadata, ab as Google, ak as GoogleOAuthWithMetadata, af as LinkedIn, ap as LinkedInOAuthWithMetadata, aE as LoginMethodOrderOption, $ as MessageTypes, a1 as MoonpayConfig, a2 as MoonpayCurrencyCode, aA as MoonpayFundingConfig, a3 as MoonpayPaymentMethod, az as NativeFundingConfig, a7 as NonEmptyArray, aD as Passkey, au as PasskeyWithMetadata, aw as Phone, a9 as PhoneWithMetadata, aB as PriceDisplayOptions, a4 as Quantity, a6 as SolanaCluster, a0 as SolanaFundingConfig, ai as Telegram, as as TelegramWithMetadata, ah as Tiktok, ao as TiktokOAuthWithMetadata, a5 as TransactionLog, ax as TransactionUIOptions, ac as Twitter, al as TwitterOAuthWithMetadata, _ as TypedMessage, aa as WalletWithMetadata } from './types-CHvDgSZo.js';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import { TurnstileProps } from '@marsidev/react-turnstile';
|
|
7
7
|
import EventEmitter from 'eventemitter3';
|
|
@@ -14,13 +14,12 @@ import { SendTransactionOptions } from '@solana/wallet-adapter-base';
|
|
|
14
14
|
import * as _solana_web3_js from '@solana/web3.js';
|
|
15
15
|
import { Connection } from '@solana/web3.js';
|
|
16
16
|
import { AbstractProvider } from 'web3-core';
|
|
17
|
-
import { Address, Hex } from 'viem';
|
|
18
|
-
import { SendEip712TransactionParameters } from 'viem/zksync';
|
|
19
17
|
import { CustomMetadataType, SmartWalletType, PrivyCoinbaseOnRampInitInput, PrivyCoinbaseOnRampInitResponse, PrivyCoinbaseOnRampStatusResponse } from '@privy-io/public-api';
|
|
20
18
|
import { FetchOptions } from 'ofetch';
|
|
21
|
-
import { P as PrivyEvents } from './solana-
|
|
22
|
-
export { C as CallbackError, a as UseFundSolanaWalletInterface, U as UseSolanaWalletsInterface, u as useSolanaWallets } from './solana-
|
|
19
|
+
import { P as PrivyEvents } from './solana-MHNU24e3.js';
|
|
20
|
+
export { C as CallbackError, a as UseFundSolanaWalletInterface, U as UseSolanaWalletsInterface, u as useSolanaWallets } from './solana-MHNU24e3.js';
|
|
23
21
|
import '@metamask/eth-sig-util';
|
|
22
|
+
import 'viem';
|
|
24
23
|
import '@privy-io/js-sdk-core';
|
|
25
24
|
|
|
26
25
|
declare const DEFAULT_SUPPORTED_CHAINS: readonly [Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain];
|
|
@@ -210,6 +209,11 @@ interface ResponseCrossAppAccount {
|
|
|
210
209
|
first_verified_at: number | null;
|
|
211
210
|
latest_verified_at: number | null;
|
|
212
211
|
}
|
|
212
|
+
interface ResponseDelegatedWallet {
|
|
213
|
+
chain_type: 'solana';
|
|
214
|
+
address: string;
|
|
215
|
+
}
|
|
216
|
+
type DelegatedWalletsResponseType = Array<ResponseDelegatedWallet>;
|
|
213
217
|
type LinkedAccountsResponseType = Array<ResponseEmailAccount | ResponsePhoneAccount | ResponseEthereumAccount | ResponseSmartWalletAccount | ResponseSolanaAccount | ResponseOAuthGoogle | ResponseOAuthTwitter | ResponseOAuthDiscord | ResponseOAuthGithub | ResponseOAuthSpotify | ResponseOAuthInstagram | ResponseOAuthTiktok | ResponseOAuthLinkedIn | ResponseOAuthApple | ResponseCustomJwtAccount | ResponseFarcasterAccount | ResponsePasskeyAccount | ResponseTelegramAccount | ResponseCrossAppAccount>;
|
|
214
218
|
interface ResponseSmsMfaMethod {
|
|
215
219
|
type: 'sms';
|
|
@@ -221,6 +225,7 @@ interface GetCurrentUserResponse {
|
|
|
221
225
|
is_guest: boolean;
|
|
222
226
|
created_at: number;
|
|
223
227
|
linked_accounts: LinkedAccountsResponseType;
|
|
228
|
+
delegated_wallets: DelegatedWalletsResponseType;
|
|
224
229
|
mfa_methods: LinkedMfaMethodsResponseType;
|
|
225
230
|
has_accepted_terms: boolean;
|
|
226
231
|
oauth_tokens?: {
|
|
@@ -1402,24 +1407,6 @@ declare function useMfa(): {
|
|
|
1402
1407
|
mfaMethods: ("sms" | "totp" | "passkey")[];
|
|
1403
1408
|
};
|
|
1404
1409
|
|
|
1405
|
-
type FactoryDeps = {
|
|
1406
|
-
factoryDeps?: Hex[];
|
|
1407
|
-
};
|
|
1408
|
-
type Call = {
|
|
1409
|
-
readonly to?: any;
|
|
1410
|
-
readonly value?: any;
|
|
1411
|
-
readonly data?: any;
|
|
1412
|
-
};
|
|
1413
|
-
/**
|
|
1414
|
-
* This is ONLY for the cross app transact screen and should eventually be unified with our other
|
|
1415
|
-
* smart wallet wrapper logic.
|
|
1416
|
-
*/
|
|
1417
|
-
declare function useAbstractSmartWallets(): {
|
|
1418
|
-
sendTransaction: (fromAddress: {
|
|
1419
|
-
address: Address;
|
|
1420
|
-
}, sendEip712TransactionParams: SendEip712TransactionParameters & FactoryDeps, calls: Call[], providerId: string, uiOptions: SendTransactionModalUIOptions) => Promise<`0x${string}`>;
|
|
1421
|
-
};
|
|
1422
|
-
|
|
1423
1410
|
/**
|
|
1424
1411
|
* Use this hook to enroll a user in MFA
|
|
1425
1412
|
*
|
|
@@ -2287,4 +2274,4 @@ declare const LoginModal: ({ open }: {
|
|
|
2287
2274
|
open: boolean;
|
|
2288
2275
|
}) => react_jsx_runtime.JSX.Element;
|
|
2289
2276
|
|
|
2290
|
-
export { Captcha, ConnectWalletModalOptions, ConnectedWallet, ConnectorManager, CustomAuthFlowState, EIP1193Provider, EthereumWalletConnector, FundWalletConfig, LoginModal, LoginModalOptions, LoginWithCode, MfaMethod, OAuthFlowState, OAuthProviderType, OAuthTokens, OtpFlowState, PasskeyFlowState, PrivyClient, PrivyClientConfig, PrivyEvents, type PrivyInterface, PrivyProvider, type PrivyProviderProps, PrivyProxyProvider, DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS, type SendCodeToEmail, type SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, SiweFlowState, SolanaTransactionReceipt, SupportedSolanaTransaction, TransactionReceipt, UnsignedTransactionRequest, type UseConnectCoinbaseSmartWalletInterface, type UseCustomAuth, type UseDelegatedActionsInterface, type UseFundWalletInterface, type UseLoginWithEmail, type UseLoginWithPasskey, type UseLoginWithSms, type UseOAuthTokens, type UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletListEntry, addPrivyRpcToChain, addRpcUrlOverrideToChain, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getAccessToken, getEmbeddedConnectedWallet,
|
|
2277
|
+
export { Captcha, ConnectWalletModalOptions, ConnectedWallet, ConnectorManager, CustomAuthFlowState, EIP1193Provider, EthereumWalletConnector, FundWalletConfig, LoginModal, LoginModalOptions, LoginWithCode, MfaMethod, OAuthFlowState, OAuthProviderType, OAuthTokens, OtpFlowState, PasskeyFlowState, PrivyClient, PrivyClientConfig, PrivyEvents, type PrivyInterface, PrivyProvider, type PrivyProviderProps, PrivyProxyProvider, DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS, type SendCodeToEmail, type SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, SiweFlowState, SolanaTransactionReceipt, SupportedSolanaTransaction, TransactionReceipt, UnsignedTransactionRequest, type UseConnectCoinbaseSmartWalletInterface, type UseCustomAuth, type UseDelegatedActionsInterface, type UseFundWalletInterface, type UseLoginWithEmail, type UseLoginWithPasskey, type UseLoginWithSms, type UseOAuthTokens, type UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletListEntry, addPrivyRpcToChain, addRpcUrlOverrideToChain, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getAccessToken, getEmbeddedConnectedWallet, useConnectCoinbaseSmartWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useCustomAuth, useDelegatedActions, useExperimentalFarcasterSigner, useFarcasterSigner, useFundWallet, useGuestAccounts, useLinkAccount, useLinkWithSiwe, useLogin, useLoginWithEmail, useLoginWithOAuth, useLoginWithPasskey, useLoginWithSms, useLogout, useMfa, useMfaEnrollment, useModalStatus, useOAuthTokens, usePrivy, useRegisterMfaListener, useSendSolanaTransaction, useSendTransaction, useSetWalletPassword, useSetWalletRecovery, useSignMessage, useSignTypedData, useToken, useUpdateAccount, useWallets };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import react__default from 'react';
|
|
3
|
-
import './types-
|
|
3
|
+
import './types-CHvDgSZo.js';
|
|
4
4
|
import * as permissionless from 'permissionless';
|
|
5
5
|
import * as viem__types_account_abstraction_types_userOperation from 'viem/_types/account-abstraction/types/userOperation';
|
|
6
6
|
import * as viem_account_abstraction from 'viem/account-abstraction';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import react__default from 'react';
|
|
3
|
-
import './types-
|
|
3
|
+
import './types-CHvDgSZo.js';
|
|
4
4
|
import * as permissionless from 'permissionless';
|
|
5
5
|
import * as viem__types_account_abstraction_types_userOperation from 'viem/_types/account-abstraction/types/userOperation';
|
|
6
6
|
import * as viem_account_abstraction from 'viem/account-abstraction';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { aG as PrivyErrorCode, U as User, L as LoginMethod, aH as LinkedAccountWithMetadata, O as OAuthTokens, B as BaseConnectedEthereumWallet, aI as BaseConnectedSolanaWallet, t as Wallet, x as MfaMethod, aJ as UserRecoveryMethod, G as SolanaTransactionReceipt, C as Chain, aK as FundingMethod, a6 as SolanaCluster, aF as ConnectedSolanaWallet, a0 as SolanaFundingConfig } from './types-
|
|
1
|
+
import { aG as PrivyErrorCode, U as User, L as LoginMethod, aH as LinkedAccountWithMetadata, O as OAuthTokens, B as BaseConnectedEthereumWallet, aI as BaseConnectedSolanaWallet, t as Wallet, x as MfaMethod, aJ as UserRecoveryMethod, G as SolanaTransactionReceipt, C as Chain, aK as FundingMethod, a6 as SolanaCluster, aF as ConnectedSolanaWallet, a0 as SolanaFundingConfig } from './types-CHvDgSZo.js';
|
|
2
2
|
import { TransactionResponse } from '@ethersproject/providers';
|
|
3
3
|
|
|
4
4
|
/**
|