@privy-io/react-auth 2.2.0 → 2.2.1

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.
@@ -1 +1 @@
1
- "use strict";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.CUSTOMER_ACCESS_TOKEN_COOKIE_KEY="privy-token",exports.CUSTOMER_ACCESS_TOKEN_STORAGE_KEY="privy:token",exports.DEFAULT_API_TIMEOUT_MS=2e4,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.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.JWT_ALGORITHM="ES256",exports.JWT_ISSUER="privy.io",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.OPTIMISM_STACK_GAS_PRICE_ORACLE_ABI=["function getL1Fee(bytes memory _data) external view returns (uint256)"],exports.OPTIMISM_STACK_GAS_PRICE_ORACLE_ADDRESS="0x420000000000000000000000000000000000000F",exports.PRIVY_ACCESS_TOKEN_STORAGE_KEY="privy:pat",exports.PRIVY_WALLETCONNECT_CLOUD_ID="34357d3c125c2bcf2ce2bc3309d98715",exports.PRIVY_WALLET_KEY_PREFIX="privy:wallet",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.VERSION="2.2.0",exports.WALLET_CONNECT_INFURA_POLLING_INTERVAL=3e4,exports.WALLET_CONNECT_STORAGE_KEY="walletconnect",exports.WALLET_PROXY_TIMEOUT=3e4,exports.getGuestCredentialStorageKey=_=>`privy:guest:${_}`,exports.getPrivyWalletKey=_=>`privy:wallet:${_}`,exports.getProviderAccessTokenStorageKey=_=>`privy:cross-app:${_}`;
1
+ "use strict";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.CUSTOMER_ACCESS_TOKEN_COOKIE_KEY="privy-token",exports.CUSTOMER_ACCESS_TOKEN_STORAGE_KEY="privy:token",exports.DEFAULT_API_TIMEOUT_MS=2e4,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.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.JWT_ALGORITHM="ES256",exports.JWT_ISSUER="privy.io",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.OPTIMISM_STACK_GAS_PRICE_ORACLE_ABI=["function getL1Fee(bytes memory _data) external view returns (uint256)"],exports.OPTIMISM_STACK_GAS_PRICE_ORACLE_ADDRESS="0x420000000000000000000000000000000000000F",exports.PRIVY_ACCESS_TOKEN_STORAGE_KEY="privy:pat",exports.PRIVY_WALLETCONNECT_CLOUD_ID="34357d3c125c2bcf2ce2bc3309d98715",exports.PRIVY_WALLET_KEY_PREFIX="privy:wallet",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.VERSION="2.2.1",exports.WALLET_CONNECT_INFURA_POLLING_INTERVAL=3e4,exports.WALLET_CONNECT_STORAGE_KEY="walletconnect",exports.WALLET_PROXY_TIMEOUT=3e4,exports.getGuestCredentialStorageKey=_=>`privy:guest:${_}`,exports.getPrivyWalletKey=_=>`privy:wallet:${_}`,exports.getProviderAccessTokenStorageKey=_=>`privy:cross-app:${_}`;
@@ -1 +1 @@
1
- "use strict";var e=require("react"),r=require("viem"),n=require("../client/user.js"),i=require("../configuration/context.js"),t=require("../errors.js"),a=require("../hooks/internal-context.js"),s=require("../hooks/modal-context.js"),o=require("../hooks/privy-context.js"),c=require("../hooks/useSmartWalletChain.js"),l=require("../hooks/useWallets.js"),u=require("../screens/index.js"),d=require("../utils/eth/getPublicClient.js"),p=require("./getEmbeddedConnectedWallet.js"),m=require("./smart-wallets-shared.js");require("viem/utils"),require("react/jsx-runtime"),require("../config.js"),require("../configuration/defaultClientConfig.js"),require("../constants.js"),require("../configuration/login-methods.js"),require("../configuration/wallets.js"),require("../connectors/chains/index.js"),require("../connectors/chains/arbitrum.js"),require("../connectors/chains/arbitrumSepolia.js"),require("../connectors/chains/avalanche.js"),require("../connectors/chains/avalancheFuji.js"),require("../connectors/chains/base.js"),require("../connectors/chains/baseSepolia.js"),require("../connectors/chains/berachainArtio.js"),require("../connectors/chains/celo.js"),require("../connectors/chains/celoAlfajores.js"),require("../connectors/chains/filecoin.js"),require("../connectors/chains/filecoinCalibration.js"),require("../connectors/chains/garnetHolesky.js"),require("../connectors/chains/holesky.js"),require("../connectors/chains/linea.js"),require("../connectors/chains/lineaTestnet.js"),require("../connectors/chains/lukso.js"),require("../connectors/chains/mainnet.js"),require("../connectors/chains/optimism.js"),require("../connectors/chains/optimismSepolia.js"),require("../connectors/chains/polygon.js"),require("../connectors/chains/polygonAmoy.js"),require("../connectors/chains/redstone.js"),require("../connectors/chains/sepolia.js"),require("../connectors/chains/zora.js"),require("../connectors/chains/zoraSepolia.js"),require("../connectors/chains/zoraTestnet.js"),require("../connectors/chains/utils.js"),require("./solana/index.js"),require("../theme.js"),require("tinycolor2"),require("./cybr53.js"),require("ofetch"),require("../hooks/index.js"),require("../components/PrefetchedImage.js"),require("permissionless"),require("permissionless/accounts"),require("permissionless/clients/pimlico"),require("viem/account-abstraction"),require("@privy-io/js-sdk-core");const h=({calls:e,chain:r,maxPriorityFeePerGas:n,maxFeePerGas:i,nonce:t})=>e.map((e=>({to:e.to||void 0,data:e.data,value:e.value,chainId:r.id,nonce:t,maxFeePerGas:i,maxPriorityFeePerGas:n}))),y=async({chain:e,paymasterContext:n,embeddedWallet:i,user:a,smartWalletsConfig:s,rpcConfig:o,privyAppId:c})=>{if(!s?.enabled||!a||!i)return;let l=await i.getEthereumProvider(),u=s?.configuredNetworks.find((r=>r.chainId===`eip155:${e.id}`));if(!u)throw new t.PrivyClientError(`The chain ${e.name} (eip155:${e.id}) must be configured in the smart wallet configuration in your dashboard`);let p=a.smartWallet?.smartWalletType??s.smartWalletType,h=d.getJsonRpcEndpointFromChain(e,o,c),y=r.createPublicClient({chain:e,transport:r.http(h)}),g=n??u.paymasterContext,q=await m.signerToSmartAccountClient({owner:l,smartWalletType:p,chain:e,publicClient:y,paymasterContext:g,...u});if(!q)throw new t.PrivyClientError(`Failed to create smart wallet client for chain ${e.name} (eip155:${e.id})`);return q};exports.callsToTransactionRequests=h,exports.getSmartWalletClient=y,exports.useSmartWalletsWrapper=({clientConfig:r,smartWalletsConfig:d})=>{let{hideWalletUIs:m,openPrivyModal:g,appId:q}=a.usePrivyInternal(),f=i.useAppConfig(),{setModalData:C}=s.usePrivyModal(),{user:E}=o.usePrivyContext(),{chains:j}=i.useAppConfig(),{chainId:I,clients:S,setChainId:w,chainIdState:W}=c.useSmartWalletChains(),P=j.find((e=>e.id===W)),{wallets:T}=l.useWallets(),v=e.useCallback((async()=>I.current),[I]),x=e.useCallback((async({id:e})=>{if(!S.current[e]){let n=p.getEmbeddedConnectedWallet(T),i=await y({chain:j.find((r=>r.id===e)),embeddedWallet:n,user:E,paymasterContext:r?.paymasterContext,smartWalletsConfig:d,rpcConfig:f.rpcConfig,privyAppId:q});i&&(S.current[e]=i)}w(e)}),[j,r,T,E,d]);return{wrapSmartAccountClient:e=>{S.current[e.chain.id]=e,W||w(e.chain.id);return{...e,sendTransaction:async(e,r)=>{let i=S.current[I.current];if(!i)throw new t.PrivyClientError(`Smart wallet client for chain (eip155:${I.current}) not found`);if(!f.embeddedWallets.showWalletUIs)return m.current=!0,await i.sendTransaction(e).finally((()=>m.current=!1));let a=[];"calls"in e&&void 0!==e.calls?a=[...e.calls]:"to"in e&&(a=[{to:e.to,value:e.value||BigInt(0),data:e.data||"0x"}]);let s=async()=>{if(!i.paymaster)return!1;let{paymasterAndData:r,paymasterData:n}=await i.prepareUserOperation({calls:a,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return Number(r??n??0)>0};return new Promise((async(t,o)=>{m.current=!0;let{entropyId:c,entropyIdVerifier:l}=n.getEntropyDetailsFromUser(E);C({connectWallet:{entropyId:c,entropyIdVerifier:l,onCompleteNavigateTo:u.ModalScreen.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN,onFailure:()=>{}},sendTransaction:{transactionRequests:h({calls:a,chain:i.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:c,entropyIdVerifier:l,transactingWallet:{address:i.account.address,walletIndex:null},getIsSponsored:s,signOnly:!1,onConfirm:()=>i.sendTransaction(e),onSuccess:e=>t(e.hash),onFailure:o,uiOptions:r?.uiOptions??{}}}),g(u.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{m.current=!1}))},signMessage:async(e,r)=>{let i=S.current[I.current];if(!i)throw new t.PrivyClientError(`Smart wallet client for chain (eip155:${I.current}) not found`);return f.embeddedWallets.showWalletUIs?new Promise((async(t,a)=>{let{entropyId:s,entropyIdVerifier:o}=n.getEntropyDetailsFromUser(E);m.current=!0,C({connectWallet:{entropyId:s,entropyIdVerifier:o,onCompleteNavigateTo:u.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:()=>{}},signMessage:{method:"personal_sign",data:"string"==typeof e.message?e.message:e.message.raw.toString(),confirmAndSign:()=>i.signMessage(e),onSuccess:e=>t(e),onFailure:a,uiOptions:r?.uiOptions??{}}}),g(u.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{m.current=!1})):(m.current=!0,await i.signMessage(e).finally((()=>m.current=!1)))},signTypedData:async(e,r)=>{let i=S.current[I.current];if(!i)throw new t.PrivyClientError(`Smart wallet client for chain (eip155:${I.current}) not found`);return f.embeddedWallets.showWalletUIs?new Promise((async(t,a)=>{m.current=!0;let{entropyId:s,entropyIdVerifier:o}=n.getEntropyDetailsFromUser(E);C({connectWallet:{entropyId:s,entropyIdVerifier:o,onCompleteNavigateTo:u.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>i.signTypedData(e),onSuccess:e=>t(e),onFailure:a,uiOptions:r?.uiOptions??{}}}),g(u.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{m.current=!1})):(m.current=!0,await i.signTypedData(e).finally((()=>m.current=!1)))},getChainId:v,chain:P,switchChain:x}}}};
1
+ "use strict";var e=require("react"),r=require("viem"),n=require("../client/user.js"),t=require("../configuration/context.js"),i=require("../errors.js"),a=require("../hooks/internal-context.js"),s=require("../hooks/modal-context.js"),o=require("../hooks/privy-context.js"),c=require("../hooks/useSmartWalletChain.js"),l=require("../hooks/useWallets.js"),u=require("../screens/index.js"),d=require("../utils/eth/getPublicClient.js"),p=require("./getEmbeddedConnectedWallet.js"),m=require("./smart-wallets-shared.js");require("viem/utils"),require("react/jsx-runtime"),require("../config.js"),require("../configuration/defaultClientConfig.js"),require("../constants.js"),require("../configuration/login-methods.js"),require("../configuration/wallets.js"),require("../connectors/chains/index.js"),require("../connectors/chains/arbitrum.js"),require("../connectors/chains/arbitrumSepolia.js"),require("../connectors/chains/avalanche.js"),require("../connectors/chains/avalancheFuji.js"),require("../connectors/chains/base.js"),require("../connectors/chains/baseSepolia.js"),require("../connectors/chains/berachainArtio.js"),require("../connectors/chains/celo.js"),require("../connectors/chains/celoAlfajores.js"),require("../connectors/chains/filecoin.js"),require("../connectors/chains/filecoinCalibration.js"),require("../connectors/chains/garnetHolesky.js"),require("../connectors/chains/holesky.js"),require("../connectors/chains/linea.js"),require("../connectors/chains/lineaTestnet.js"),require("../connectors/chains/lukso.js"),require("../connectors/chains/mainnet.js"),require("../connectors/chains/optimism.js"),require("../connectors/chains/optimismSepolia.js"),require("../connectors/chains/polygon.js"),require("../connectors/chains/polygonAmoy.js"),require("../connectors/chains/redstone.js"),require("../connectors/chains/sepolia.js"),require("../connectors/chains/zora.js"),require("../connectors/chains/zoraSepolia.js"),require("../connectors/chains/zoraTestnet.js"),require("../connectors/chains/utils.js"),require("./solana/index.js"),require("../theme.js"),require("tinycolor2"),require("./cybr53.js"),require("ofetch"),require("../hooks/index.js"),require("../components/PrefetchedImage.js"),require("permissionless"),require("permissionless/accounts"),require("permissionless/clients/pimlico"),require("viem/account-abstraction"),require("@privy-io/js-sdk-core");const h=({calls:e,chain:r,maxPriorityFeePerGas:n,maxFeePerGas:t,nonce:i})=>e.map((e=>({to:e.to||void 0,data:e.data,value:e.value,chainId:r.id,nonce:i,maxFeePerGas:t,maxPriorityFeePerGas:n}))),y=async({chain:e,paymasterContext:n,embeddedWallet:t,user:a,smartWalletsConfig:s,rpcConfig:o,privyAppId:c})=>{if(!s?.enabled||!a||!t)return;let l=await t.getEthereumProvider(),u=s?.configuredNetworks.find((r=>r.chainId===`eip155:${e.id}`));if(!u)throw new i.PrivyClientError(`The chain ${e.name} (eip155:${e.id}) must be configured in the smart wallet configuration in your dashboard`);let p=a.smartWallet?.smartWalletType??s.smartWalletType,h=d.getJsonRpcEndpointFromChain(e,o,c),y=r.createPublicClient({chain:e,transport:r.http(h)}),g=n??u.paymasterContext,q=await m.signerToSmartAccountClient({owner:l,smartWalletType:p,chain:e,publicClient:y,paymasterContext:g,...u});if(!q)throw new i.PrivyClientError(`Failed to create smart wallet client for chain ${e.name} (eip155:${e.id})`);return q};exports.callsToTransactionRequests=h,exports.getSmartWalletClient=y,exports.useSmartWalletsWrapper=({clientConfig:r,smartWalletsConfig:d})=>{let{hideWalletUIs:m,openPrivyModal:g,appId:q}=a.usePrivyInternal(),f=t.useAppConfig(),{setModalData:C}=s.usePrivyModal(),{user:E}=o.usePrivyContext(),{chains:j}=t.useAppConfig(),{chainId:I,clients:S,setChainId:w,chainIdState:W}=c.useSmartWalletChains(),P=j.find((e=>e.id===W)),{wallets:T}=l.useWallets(),v=e.useCallback((async()=>I.current),[I]),x=e.useCallback((async({id:e})=>{if(!S.current[e]){let n=p.getEmbeddedConnectedWallet(T),t=await y({chain:j.find((r=>r.id===e)),embeddedWallet:n,user:E,paymasterContext:r?.paymasterContext,smartWalletsConfig:d,rpcConfig:f.rpcConfig,privyAppId:q});t&&(S.current[e]=t)}w(e)}),[j,r,T,E,d]);return{wrapSmartAccountClient:e=>{S.current[e.chain.id]=e,W||w(e.chain.id);return{...e,sendTransaction:async(e,r)=>{let t=S.current[I.current];if(!t)throw new i.PrivyClientError(`Smart wallet client for chain (eip155:${I.current}) not found`);if(delete e.account,!f.embeddedWallets.showWalletUIs)return m.current=!0,await t.sendTransaction(e).finally((()=>m.current=!1));let a=[];"calls"in e&&void 0!==e.calls?a=[...e.calls]:"to"in e&&(a=[{to:e.to,value:e.value||BigInt(0),data:e.data||"0x"}]);let s=async()=>{if(!t.paymaster)return!1;let{paymasterAndData:r,paymasterData:n}=await t.prepareUserOperation({calls:a,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return Number(r??n??0)>0};return new Promise((async(i,o)=>{m.current=!0;let{entropyId:c,entropyIdVerifier:l}=n.getEntropyDetailsFromUser(E);C({connectWallet:{entropyId:c,entropyIdVerifier:l,onCompleteNavigateTo:u.ModalScreen.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN,onFailure:()=>{}},sendTransaction:{transactionRequests:h({calls:a,chain:t.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:c,entropyIdVerifier:l,transactingWallet:{address:t.account.address,walletIndex:null},getIsSponsored:s,signOnly:!1,onConfirm:()=>t.sendTransaction(e),onSuccess:e=>i(e.hash),onFailure:o,uiOptions:r?.uiOptions??{}}}),g(u.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{m.current=!1}))},signMessage:async(e,r)=>{let t=S.current[I.current];if(!t)throw new i.PrivyClientError(`Smart wallet client for chain (eip155:${I.current}) not found`);return f.embeddedWallets.showWalletUIs?new Promise((async(i,a)=>{let{entropyId:s,entropyIdVerifier:o}=n.getEntropyDetailsFromUser(E);m.current=!0,C({connectWallet:{entropyId:s,entropyIdVerifier:o,onCompleteNavigateTo:u.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:()=>{}},signMessage:{method:"personal_sign",data:"string"==typeof e.message?e.message:e.message.raw.toString(),confirmAndSign:()=>t.signMessage(e),onSuccess:e=>i(e),onFailure:a,uiOptions:r?.uiOptions??{}}}),g(u.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{m.current=!1})):(m.current=!0,await t.signMessage(e).finally((()=>m.current=!1)))},signTypedData:async(e,r)=>{let t=S.current[I.current];if(!t)throw new i.PrivyClientError(`Smart wallet client for chain (eip155:${I.current}) not found`);return delete e.account,f.embeddedWallets.showWalletUIs?new Promise((async(i,a)=>{m.current=!0;let{entropyId:s,entropyIdVerifier:o}=n.getEntropyDetailsFromUser(E);C({connectWallet:{entropyId:s,entropyIdVerifier:o,onCompleteNavigateTo:u.ModalScreen.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>t.signTypedData(e),onSuccess:e=>i(e),onFailure:a,uiOptions:r?.uiOptions??{}}}),g(u.ModalScreen.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{m.current=!1})):(m.current=!0,await t.signTypedData(e).finally((()=>m.current=!1)))},getChainId:v,chain:P,switchChain:x}}}};
@@ -1 +1 @@
1
- const e="34357d3c125c2bcf2ce2bc3309d98715",i="https://auth.privy.io",r=2e4,t=1400,p=2500,o=4e3,v="2.2.0",s="ES256",n="privy.io",y="privy:token",c="privy-token",a="privy:refresh_token",_="privy-refresh-token",d="privy:pat",l="privy:id_token",h="privy-id-token",k="privy-session",f="privy:session_transfer_token",u="privy:wallet",b="privy:caid",m=e=>`privy:guest:${e}`,w=e=>`privy:cross-app:${e}`,j="privy:state_code",x="privy:code_verifier",F="privy:headless_oauth",g="privy:oauth_disable_signup",L=e=>`privy:wallet:${e}`,S="privy:connectors",$="privy:connections",q="walletconnect",H=3e4,J=12e4,X=1,z="0x1",C=3e4,E="https://api.moonpay.com/v1",I="https://api.moonpay.com/v1",M="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",R="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",U="0x420000000000000000000000000000000000000F",V=["function getL1Fee(bytes memory _data) external view returns (uint256)"],W="deprecated";export{X as CHAIN_ID_MAINNET,b as CLIENT_ANALYTICS_ID_KEY,x as CODE_VERIFIER_KEY,$ as CONNECTIONS_HISTORY_KEY,S as CONNECTORS_STATE_KEY,c as CUSTOMER_ACCESS_TOKEN_COOKIE_KEY,y as CUSTOMER_ACCESS_TOKEN_STORAGE_KEY,r as DEFAULT_API_TIMEOUT_MS,z as DEFAULT_NETWORK,i as DEFAULT_PRIVY_API_URL,J as DEFAULT_RPC_TIMEOUT,t as DEFAULT_SUCCESS_SCREEN_DURATION_MS,o as DEFAULT_SUCCESS_SCREEN_EXTRA_LONG_DURATION_MS,p as DEFAULT_SUCCESS_SCREEN_LONG_DURATION_MS,W as DEPRECATED_REFRESH_TOKEN,f as FORKED_TOKEN_STORAGE_KEY,F as HEADLESS_OAUTH_KEY,h as IDENTITY_TOKEN_COOKIE_KEY,l as IDENTITY_TOKEN_STORAGE_KEY,s as JWT_ALGORITHM,n as JWT_ISSUER,E as MOONPAY_API_URL,I as MOONPAY_API_URL_SANDBOX,M as MOONPAY_PUBLIC_KEY,R as MOONPAY_PUBLIC_KEY_SANDBOX,g as OAUTH_DISABLE_SIGNUP_KEY,V as OPTIMISM_STACK_GAS_PRICE_ORACLE_ABI,U as OPTIMISM_STACK_GAS_PRICE_ORACLE_ADDRESS,d as PRIVY_ACCESS_TOKEN_STORAGE_KEY,e as PRIVY_WALLETCONNECT_CLOUD_ID,u as PRIVY_WALLET_KEY_PREFIX,_ as REFRESH_TOKEN_COOKIE_KEY,a as REFRESH_TOKEN_STORAGE_KEY,k as SESSION_COOKIE_KEY,j as STATE_CODE_KEY,v as VERSION,H as WALLET_CONNECT_INFURA_POLLING_INTERVAL,q as WALLET_CONNECT_STORAGE_KEY,C as WALLET_PROXY_TIMEOUT,m as getGuestCredentialStorageKey,L as getPrivyWalletKey,w as getProviderAccessTokenStorageKey};
1
+ const e="34357d3c125c2bcf2ce2bc3309d98715",i="https://auth.privy.io",r=2e4,t=1400,p=2500,o=4e3,v="2.2.1",s="ES256",n="privy.io",y="privy:token",c="privy-token",a="privy:refresh_token",_="privy-refresh-token",d="privy:pat",l="privy:id_token",h="privy-id-token",k="privy-session",f="privy:session_transfer_token",u="privy:wallet",b="privy:caid",m=e=>`privy:guest:${e}`,w=e=>`privy:cross-app:${e}`,j="privy:state_code",x="privy:code_verifier",F="privy:headless_oauth",g="privy:oauth_disable_signup",L=e=>`privy:wallet:${e}`,S="privy:connectors",$="privy:connections",q="walletconnect",H=3e4,J=12e4,X=1,z="0x1",C=3e4,E="https://api.moonpay.com/v1",I="https://api.moonpay.com/v1",M="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",R="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",U="0x420000000000000000000000000000000000000F",V=["function getL1Fee(bytes memory _data) external view returns (uint256)"],W="deprecated";export{X as CHAIN_ID_MAINNET,b as CLIENT_ANALYTICS_ID_KEY,x as CODE_VERIFIER_KEY,$ as CONNECTIONS_HISTORY_KEY,S as CONNECTORS_STATE_KEY,c as CUSTOMER_ACCESS_TOKEN_COOKIE_KEY,y as CUSTOMER_ACCESS_TOKEN_STORAGE_KEY,r as DEFAULT_API_TIMEOUT_MS,z as DEFAULT_NETWORK,i as DEFAULT_PRIVY_API_URL,J as DEFAULT_RPC_TIMEOUT,t as DEFAULT_SUCCESS_SCREEN_DURATION_MS,o as DEFAULT_SUCCESS_SCREEN_EXTRA_LONG_DURATION_MS,p as DEFAULT_SUCCESS_SCREEN_LONG_DURATION_MS,W as DEPRECATED_REFRESH_TOKEN,f as FORKED_TOKEN_STORAGE_KEY,F as HEADLESS_OAUTH_KEY,h as IDENTITY_TOKEN_COOKIE_KEY,l as IDENTITY_TOKEN_STORAGE_KEY,s as JWT_ALGORITHM,n as JWT_ISSUER,E as MOONPAY_API_URL,I as MOONPAY_API_URL_SANDBOX,M as MOONPAY_PUBLIC_KEY,R as MOONPAY_PUBLIC_KEY_SANDBOX,g as OAUTH_DISABLE_SIGNUP_KEY,V as OPTIMISM_STACK_GAS_PRICE_ORACLE_ABI,U as OPTIMISM_STACK_GAS_PRICE_ORACLE_ADDRESS,d as PRIVY_ACCESS_TOKEN_STORAGE_KEY,e as PRIVY_WALLETCONNECT_CLOUD_ID,u as PRIVY_WALLET_KEY_PREFIX,_ as REFRESH_TOKEN_COOKIE_KEY,a as REFRESH_TOKEN_STORAGE_KEY,k as SESSION_COOKIE_KEY,j as STATE_CODE_KEY,v as VERSION,H as WALLET_CONNECT_INFURA_POLLING_INTERVAL,q as WALLET_CONNECT_STORAGE_KEY,C as WALLET_PROXY_TIMEOUT,m as getGuestCredentialStorageKey,L as getPrivyWalletKey,w as getProviderAccessTokenStorageKey};
@@ -1 +1 @@
1
- import{useCallback as e}from"react";import{createPublicClient as t,http as n}from"viem";import{getEntropyDetailsFromUser as r}from"../client/user.mjs";import{useAppConfig as o}from"../configuration/context.mjs";import{PrivyClientError as i}from"../errors.mjs";import{usePrivyInternal as a}from"../hooks/internal-context.mjs";import{usePrivyModal as s}from"../hooks/modal-context.mjs";import{usePrivyContext as c}from"../hooks/privy-context.mjs";import{useSmartWalletChains as m}from"../hooks/useSmartWalletChain.mjs";import{useWallets as l}from"../hooks/useWallets.mjs";import{ModalScreen as p}from"../screens/index.mjs";import{getJsonRpcEndpointFromChain as d}from"../utils/eth/getPublicClient.mjs";import{getEmbeddedConnectedWallet as u}from"./getEmbeddedConnectedWallet.mjs";import{signerToSmartAccountClient as h}from"./smart-wallets-shared.mjs";import"viem/utils";import"react/jsx-runtime";import"../config.mjs";import"../configuration/defaultClientConfig.mjs";import"../constants.mjs";import"../configuration/login-methods.mjs";import"../configuration/wallets.mjs";import"../connectors/chains/index.mjs";import"../connectors/chains/arbitrum.mjs";import"../connectors/chains/arbitrumSepolia.mjs";import"../connectors/chains/avalanche.mjs";import"../connectors/chains/avalancheFuji.mjs";import"../connectors/chains/base.mjs";import"../connectors/chains/baseSepolia.mjs";import"../connectors/chains/berachainArtio.mjs";import"../connectors/chains/celo.mjs";import"../connectors/chains/celoAlfajores.mjs";import"../connectors/chains/filecoin.mjs";import"../connectors/chains/filecoinCalibration.mjs";import"../connectors/chains/garnetHolesky.mjs";import"../connectors/chains/holesky.mjs";import"../connectors/chains/linea.mjs";import"../connectors/chains/lineaTestnet.mjs";import"../connectors/chains/lukso.mjs";import"../connectors/chains/mainnet.mjs";import"../connectors/chains/optimism.mjs";import"../connectors/chains/optimismSepolia.mjs";import"../connectors/chains/polygon.mjs";import"../connectors/chains/polygonAmoy.mjs";import"../connectors/chains/redstone.mjs";import"../connectors/chains/sepolia.mjs";import"../connectors/chains/zora.mjs";import"../connectors/chains/zoraSepolia.mjs";import"../connectors/chains/zoraTestnet.mjs";import"../connectors/chains/utils.mjs";import"./solana/index.mjs";import"../theme.mjs";import"tinycolor2";import"./cybr53.mjs";import"ofetch";import"../hooks/index.mjs";import"../components/PrefetchedImage.mjs";import"permissionless";import"permissionless/accounts";import"permissionless/clients/pimlico";import"viem/account-abstraction";import"@privy-io/js-sdk-core";const f=({calls:e,chain:t,maxPriorityFeePerGas:n,maxFeePerGas:r,nonce:o})=>e.map((e=>({to:e.to||void 0,data:e.data,value:e.value,chainId:t.id,nonce:o,maxFeePerGas:r,maxPriorityFeePerGas:n}))),y=async({chain:e,paymasterContext:r,embeddedWallet:o,user:a,smartWalletsConfig:s,rpcConfig:c,privyAppId:m})=>{if(!s?.enabled||!a||!o)return;let l=await o.getEthereumProvider(),p=s?.configuredNetworks.find((t=>t.chainId===`eip155:${e.id}`));if(!p)throw new i(`The chain ${e.name} (eip155:${e.id}) must be configured in the smart wallet configuration in your dashboard`);let u=a.smartWallet?.smartWalletType??s.smartWalletType,f=d(e,c,m),y=t({chain:e,transport:n(f)}),g=r??p.paymasterContext,j=await h({owner:l,smartWalletType:u,chain:e,publicClient:y,paymasterContext:g,...p});if(!j)throw new i(`Failed to create smart wallet client for chain ${e.name} (eip155:${e.id})`);return j},g=({clientConfig:t,smartWalletsConfig:n})=>{let{hideWalletUIs:d,openPrivyModal:h,appId:g}=a(),j=o(),{setModalData:E}=s(),{user:C}=c(),{chains:I}=o(),{chainId:w,clients:T,setChainId:x,chainIdState:S}=m(),W=I.find((e=>e.id===S)),{wallets:D}=l(),N=e((async()=>w.current),[w]),P=e((async({id:e})=>{if(!T.current[e]){let r=u(D),o=await y({chain:I.find((t=>t.id===e)),embeddedWallet:r,user:C,paymasterContext:t?.paymasterContext,smartWalletsConfig:n,rpcConfig:j.rpcConfig,privyAppId:g});o&&(T.current[e]=o)}x(e)}),[I,t,D,C,n]);return{wrapSmartAccountClient:e=>{T.current[e.chain.id]=e,S||x(e.chain.id);return{...e,sendTransaction:async(e,t)=>{let n=T.current[w.current];if(!n)throw new i(`Smart wallet client for chain (eip155:${w.current}) not found`);if(!j.embeddedWallets.showWalletUIs)return d.current=!0,await n.sendTransaction(e).finally((()=>d.current=!1));let o=[];"calls"in e&&void 0!==e.calls?o=[...e.calls]:"to"in e&&(o=[{to:e.to,value:e.value||BigInt(0),data:e.data||"0x"}]);let a=async()=>{if(!n.paymaster)return!1;let{paymasterAndData:t,paymasterData:r}=await n.prepareUserOperation({calls:o,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return Number(t??r??0)>0};return new Promise((async(i,s)=>{d.current=!0;let{entropyId:c,entropyIdVerifier:m}=r(C);E({connectWallet:{entropyId:c,entropyIdVerifier:m,onCompleteNavigateTo:p.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN,onFailure:()=>{}},sendTransaction:{transactionRequests:f({calls:o,chain:n.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:c,entropyIdVerifier:m,transactingWallet:{address:n.account.address,walletIndex:null},getIsSponsored:a,signOnly:!1,onConfirm:()=>n.sendTransaction(e),onSuccess:e=>i(e.hash),onFailure:s,uiOptions:t?.uiOptions??{}}}),h(p.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{d.current=!1}))},signMessage:async(e,t)=>{let n=T.current[w.current];if(!n)throw new i(`Smart wallet client for chain (eip155:${w.current}) not found`);return j.embeddedWallets.showWalletUIs?new Promise((async(o,i)=>{let{entropyId:a,entropyIdVerifier:s}=r(C);d.current=!0,E({connectWallet:{entropyId:a,entropyIdVerifier:s,onCompleteNavigateTo:p.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:()=>{}},signMessage:{method:"personal_sign",data:"string"==typeof e.message?e.message:e.message.raw.toString(),confirmAndSign:()=>n.signMessage(e),onSuccess:e=>o(e),onFailure:i,uiOptions:t?.uiOptions??{}}}),h(p.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{d.current=!1})):(d.current=!0,await n.signMessage(e).finally((()=>d.current=!1)))},signTypedData:async(e,t)=>{let n=T.current[w.current];if(!n)throw new i(`Smart wallet client for chain (eip155:${w.current}) not found`);return j.embeddedWallets.showWalletUIs?new Promise((async(o,i)=>{d.current=!0;let{entropyId:a,entropyIdVerifier:s}=r(C);E({connectWallet:{entropyId:a,entropyIdVerifier:s,onCompleteNavigateTo:p.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>n.signTypedData(e),onSuccess:e=>o(e),onFailure:i,uiOptions:t?.uiOptions??{}}}),h(p.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{d.current=!1})):(d.current=!0,await n.signTypedData(e).finally((()=>d.current=!1)))},getChainId:N,chain:W,switchChain:P}}}};export{f as callsToTransactionRequests,y as getSmartWalletClient,g as useSmartWalletsWrapper};
1
+ import{useCallback as e}from"react";import{createPublicClient as t,http as n}from"viem";import{getEntropyDetailsFromUser as r}from"../client/user.mjs";import{useAppConfig as o}from"../configuration/context.mjs";import{PrivyClientError as i}from"../errors.mjs";import{usePrivyInternal as a}from"../hooks/internal-context.mjs";import{usePrivyModal as s}from"../hooks/modal-context.mjs";import{usePrivyContext as c}from"../hooks/privy-context.mjs";import{useSmartWalletChains as m}from"../hooks/useSmartWalletChain.mjs";import{useWallets as l}from"../hooks/useWallets.mjs";import{ModalScreen as p}from"../screens/index.mjs";import{getJsonRpcEndpointFromChain as d}from"../utils/eth/getPublicClient.mjs";import{getEmbeddedConnectedWallet as u}from"./getEmbeddedConnectedWallet.mjs";import{signerToSmartAccountClient as h}from"./smart-wallets-shared.mjs";import"viem/utils";import"react/jsx-runtime";import"../config.mjs";import"../configuration/defaultClientConfig.mjs";import"../constants.mjs";import"../configuration/login-methods.mjs";import"../configuration/wallets.mjs";import"../connectors/chains/index.mjs";import"../connectors/chains/arbitrum.mjs";import"../connectors/chains/arbitrumSepolia.mjs";import"../connectors/chains/avalanche.mjs";import"../connectors/chains/avalancheFuji.mjs";import"../connectors/chains/base.mjs";import"../connectors/chains/baseSepolia.mjs";import"../connectors/chains/berachainArtio.mjs";import"../connectors/chains/celo.mjs";import"../connectors/chains/celoAlfajores.mjs";import"../connectors/chains/filecoin.mjs";import"../connectors/chains/filecoinCalibration.mjs";import"../connectors/chains/garnetHolesky.mjs";import"../connectors/chains/holesky.mjs";import"../connectors/chains/linea.mjs";import"../connectors/chains/lineaTestnet.mjs";import"../connectors/chains/lukso.mjs";import"../connectors/chains/mainnet.mjs";import"../connectors/chains/optimism.mjs";import"../connectors/chains/optimismSepolia.mjs";import"../connectors/chains/polygon.mjs";import"../connectors/chains/polygonAmoy.mjs";import"../connectors/chains/redstone.mjs";import"../connectors/chains/sepolia.mjs";import"../connectors/chains/zora.mjs";import"../connectors/chains/zoraSepolia.mjs";import"../connectors/chains/zoraTestnet.mjs";import"../connectors/chains/utils.mjs";import"./solana/index.mjs";import"../theme.mjs";import"tinycolor2";import"./cybr53.mjs";import"ofetch";import"../hooks/index.mjs";import"../components/PrefetchedImage.mjs";import"permissionless";import"permissionless/accounts";import"permissionless/clients/pimlico";import"viem/account-abstraction";import"@privy-io/js-sdk-core";const f=({calls:e,chain:t,maxPriorityFeePerGas:n,maxFeePerGas:r,nonce:o})=>e.map((e=>({to:e.to||void 0,data:e.data,value:e.value,chainId:t.id,nonce:o,maxFeePerGas:r,maxPriorityFeePerGas:n}))),y=async({chain:e,paymasterContext:r,embeddedWallet:o,user:a,smartWalletsConfig:s,rpcConfig:c,privyAppId:m})=>{if(!s?.enabled||!a||!o)return;let l=await o.getEthereumProvider(),p=s?.configuredNetworks.find((t=>t.chainId===`eip155:${e.id}`));if(!p)throw new i(`The chain ${e.name} (eip155:${e.id}) must be configured in the smart wallet configuration in your dashboard`);let u=a.smartWallet?.smartWalletType??s.smartWalletType,f=d(e,c,m),y=t({chain:e,transport:n(f)}),g=r??p.paymasterContext,j=await h({owner:l,smartWalletType:u,chain:e,publicClient:y,paymasterContext:g,...p});if(!j)throw new i(`Failed to create smart wallet client for chain ${e.name} (eip155:${e.id})`);return j},g=({clientConfig:t,smartWalletsConfig:n})=>{let{hideWalletUIs:d,openPrivyModal:h,appId:g}=a(),j=o(),{setModalData:E}=s(),{user:C}=c(),{chains:I}=o(),{chainId:w,clients:T,setChainId:x,chainIdState:S}=m(),W=I.find((e=>e.id===S)),{wallets:D}=l(),N=e((async()=>w.current),[w]),P=e((async({id:e})=>{if(!T.current[e]){let r=u(D),o=await y({chain:I.find((t=>t.id===e)),embeddedWallet:r,user:C,paymasterContext:t?.paymasterContext,smartWalletsConfig:n,rpcConfig:j.rpcConfig,privyAppId:g});o&&(T.current[e]=o)}x(e)}),[I,t,D,C,n]);return{wrapSmartAccountClient:e=>{T.current[e.chain.id]=e,S||x(e.chain.id);return{...e,sendTransaction:async(e,t)=>{let n=T.current[w.current];if(!n)throw new i(`Smart wallet client for chain (eip155:${w.current}) not found`);if(delete e.account,!j.embeddedWallets.showWalletUIs)return d.current=!0,await n.sendTransaction(e).finally((()=>d.current=!1));let o=[];"calls"in e&&void 0!==e.calls?o=[...e.calls]:"to"in e&&(o=[{to:e.to,value:e.value||BigInt(0),data:e.data||"0x"}]);let a=async()=>{if(!n.paymaster)return!1;let{paymasterAndData:t,paymasterData:r}=await n.prepareUserOperation({calls:o,maxFeePerGas:e.maxFeePerGas,maxPriorityFeePerGas:e.maxPriorityFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0});return Number(t??r??0)>0};return new Promise((async(i,s)=>{d.current=!0;let{entropyId:c,entropyIdVerifier:m}=r(C);E({connectWallet:{entropyId:c,entropyIdVerifier:m,onCompleteNavigateTo:p.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN,onFailure:()=>{}},sendTransaction:{transactionRequests:f({calls:o,chain:n.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:c,entropyIdVerifier:m,transactingWallet:{address:n.account.address,walletIndex:null},getIsSponsored:a,signOnly:!1,onConfirm:()=>n.sendTransaction(e),onSuccess:e=>i(e.hash),onFailure:s,uiOptions:t?.uiOptions??{}}}),h(p.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{d.current=!1}))},signMessage:async(e,t)=>{let n=T.current[w.current];if(!n)throw new i(`Smart wallet client for chain (eip155:${w.current}) not found`);return j.embeddedWallets.showWalletUIs?new Promise((async(o,i)=>{let{entropyId:a,entropyIdVerifier:s}=r(C);d.current=!0,E({connectWallet:{entropyId:a,entropyIdVerifier:s,onCompleteNavigateTo:p.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:()=>{}},signMessage:{method:"personal_sign",data:"string"==typeof e.message?e.message:e.message.raw.toString(),confirmAndSign:()=>n.signMessage(e),onSuccess:e=>o(e),onFailure:i,uiOptions:t?.uiOptions??{}}}),h(p.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{d.current=!1})):(d.current=!0,await n.signMessage(e).finally((()=>d.current=!1)))},signTypedData:async(e,t)=>{let n=T.current[w.current];if(!n)throw new i(`Smart wallet client for chain (eip155:${w.current}) not found`);return delete e.account,j.embeddedWallets.showWalletUIs?new Promise((async(o,i)=>{d.current=!0;let{entropyId:a,entropyIdVerifier:s}=r(C);E({connectWallet:{entropyId:a,entropyIdVerifier:s,onCompleteNavigateTo:p.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>n.signTypedData(e),onSuccess:e=>o(e),onFailure:i,uiOptions:t?.uiOptions??{}}}),h(p.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{d.current=!1})):(d.current=!0,await n.signTypedData(e).finally((()=>d.current=!1)))},getChainId:N,chain:W,switchChain:P}}}};export{f as callsToTransactionRequests,y as getSmartWalletClient,g as useSmartWalletsWrapper};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@privy-io/react-auth",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "React client for the Privy Auth API",
5
5
  "keywords": [
6
6
  "authentication",