@privy-io/react-auth 1.91.0 → 1.92.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
+ import { aG as PrivyErrorCode, U as User, L as LoginMethod, aH as LinkedAccountWithMetadata, O as OAuthTokens, g as BaseConnectedWallet, t as Wallet, x as MfaMethod, aI as UserRecoveryMethod, G as SolanaTransactionReceipt, C as Chain, aJ as FundingMethod, a6 as SolanaCluster, aF as ConnectedSolanaWallet, a0 as SolanaFundingConfig } from './types.js';
1
2
  import { TransactionResponse } from '@ethersproject/providers';
2
- import { aH as PrivyErrorCode, U as User, L as LoginMethod, aI as LinkedAccountWithMetadata, O as OAuthTokens, f as BaseConnectedWallet, s as Wallet, w as MfaMethod, aJ as UserRecoveryMethod, D as SolanaTransactionReceipt, C as Chain, aK as FundingMethod, a5 as SolanaCluster, aE as ConnectedSolanaWallet } from './types.js';
3
3
 
4
4
  /**
5
5
  * `CallbackError` optionally includes a second parameter with further error details.
@@ -319,4 +319,34 @@ interface UseSolanaWalletsInterface {
319
319
  }
320
320
  declare const useSolanaWallets: () => UseSolanaWalletsInterface;
321
321
 
322
- export { type CallbackError as C, type PrivyEvents as P, type UseSolanaWalletsInterface as U, useSolanaWallets as u };
322
+ /**
323
+ * Method to fund a user's wallet via Privy's funding feature by inputting a valid wallet address.
324
+ * You can access the fields and methods documented here via the {@link useFundWallet} hook.
325
+ */
326
+ interface UseFundSolanaWalletInterface {
327
+ /**
328
+ * Prompt the user to go through the funding flow and for a specified wallet.
329
+ *
330
+ * This will open the modal with a prompt for the user to select a funding method (if multiple are enabled).
331
+ *
332
+ * Once the user continues to the funding flow, Privy will display the funding status screen, and wait
333
+ * for the transaction to complete.
334
+ *
335
+ * Note: Even after a successful funding, funds can take a few minutes to arrive in the user's wallet.
336
+ *
337
+ * Privy currently supports funding via external wallets and Moonpay.
338
+ *
339
+ * @param address typed data payload to be signed
340
+ * @param fundWalletConfig {@link SolanaFundingConfig} Funding configuration to specify chain and funding amount (if enabled)
341
+ */
342
+ fundWallet: (address: string, fundWalletConfig?: SolanaFundingConfig) => Promise<void>;
343
+ }
344
+ /**
345
+ * Hook to fund a wallet via Privy's fiat on-ramp integration given the wallet address.
346
+ *
347
+ * @param callbacks.onUserExited {@link PrivyEvents} Callback that will execute when a funding flow is exited. This fires when a user closes a funding flow modal, for any reason.
348
+ * @returns fundWallet - function to on-ramp funds to any given wallet
349
+ */
350
+ declare const useFundWallet: (callbacks?: PrivyEvents["fundSolanaWallet"]) => UseFundSolanaWalletInterface;
351
+
352
+ export { type CallbackError as C, type PrivyEvents as P, type UseSolanaWalletsInterface as U, type UseFundSolanaWalletInterface as a, useFundWallet as b, useSolanaWallets as u };
@@ -767,7 +767,10 @@ type SolanaTransactionReceipt = {
767
767
  fees: bigint;
768
768
  };
769
769
  type SolanaCluster = {
770
- /** The network name */
770
+ /**
771
+ * The network name
772
+ * Refer to {@link https://solana-labs.github.io/solana-web3.js/types/Cluster.html Cluster} for more information
773
+ * */
771
774
  name: Cluster;
772
775
  /** The RPC endpoint */
773
776
  rpcUrl?: string;
@@ -2353,4 +2356,4 @@ type EthereumRpcResponseType = eth_signTransactionResponse | eth_populateTransac
2353
2356
  type SolanaRpcRequestType = solana_signMessage;
2354
2357
  type SolanaRpcResponseType = solana_signMessageResponse;
2355
2358
 
2356
- export { type SolanaFundingConfig as $, type SupportedSolanaTransaction as A, type BaseConnectedEthereumWallet as B, type Chain as C, type SolanaTransactionReceipt as D, Embedded1193Provider as E, type FundWalletConfig as F, type ConnectedWallet as G, type PrivyIframeErrorTypesType as H, type OAuthFlowState as I, type LoginWithCode as J, type OtpFlowState as K, type LoginMethod as L, type MoonpaySignRequest as M, type PasskeyFlowState as N, type OAuthTokens as O, PrivyProxyProvider as P, type SiweFlowState as Q, type RpcConfig as R, SolanaWalletConnector as S, type TelegramAuthResult as T, type User as U, type UnsignedTransactionRequestWithChainId as V, WalletConnector as W, type CustomAuthFlowState as X, AsExternalProvider as Y, type TypedMessage as Z, type MessageTypes as _, type WalletClientType as a, type MoonpayConfig as a0, type MoonpayCurrencyCode as a1, type MoonpayPaymentMethod as a2, type Quantity as a3, type TransactionLog as a4, type SolanaCluster as a5, type NonEmptyArray as a6, type EmailWithMetadata as a7, type PhoneWithMetadata as a8, type WalletWithMetadata as a9, type PriceDisplayOptions as aA, type Farcaster as aB, type Passkey as aC, type LoginMethodOrderOption as aD, type ConnectedSolanaWallet as aE, type RuntimeLoginOverridableOptions as aF, toSolanaWalletConnectors as aG, PrivyErrorCode as aH, type LinkedAccountWithMetadata as aI, type UserRecoveryMethod as aJ, type FundingMethod as aK, type Google as aa, type Twitter as ab, type Discord as ac, type Github as ad, type LinkedIn as ae, type Apple as af, type Tiktok as ag, type Telegram as ah, type CrossAppAccount as ai, type GoogleOAuthWithMetadata as aj, type TwitterOAuthWithMetadata as ak, type DiscordOAuthWithMetadata as al, type GithubOAuthWithMetadata as am, type TiktokOAuthWithMetadata as an, type LinkedInOAuthWithMetadata as ao, type AppleOAuthWithMetadata as ap, type FarcasterWithMetadata as aq, type TelegramWithMetadata as ar, type CrossAppAccountWithMetadata as as, type PasskeyWithMetadata as at, type Email as au, type Phone as av, type TransactionUIOptions as aw, type ContractUIOptions as ax, type NativeFundingConfig as ay, type MoonpayFundingConfig as az, type ConnectedWalletMetadata as b, type ConnectorType as c, type WalletListEntry as d, type ExternalWalletsConfig as e, type BaseConnectedWallet as f, type EIP1193Provider as g, type OAuthProviderType as h, type MoonpaySignResponse as i, type SmartWalletConfig as j, type PrivyServerConfig as k, type PrivyFarcasterSignerInitResponse as l, type SiweWalletMetadata as m, type OAuthUserInfo as n, type PrivyClientConfig as o, type ConnectWalletModalOptions as p, type LoginModalOptions as q, type CreateWalletOptions as r, type Wallet as s, type SetWalletRecoveryOptions as t, type SignMessageModalUIOptions as u, type SignTypedDataParams as v, type MfaMethod as w, type UnsignedTransactionRequest as x, type SendTransactionModalUIOptions as y, type TransactionReceipt as z };
2359
+ export { type MessageTypes as $, type TransactionReceipt as A, type BaseConnectedEthereumWallet as B, type Chain as C, type SupportedSolanaTransaction as D, Embedded1193Provider as E, type FundWalletConfig as F, type SolanaTransactionReceipt as G, type ConnectedWallet as H, type PrivyIframeErrorTypesType as I, type OAuthFlowState as J, type LoginWithCode as K, type LoginMethod as L, type MoonpaySignRequest as M, type OtpFlowState as N, type OAuthTokens as O, PrivyProxyProvider as P, type PasskeyFlowState as Q, type RuntimeLoginOverridableOptions as R, SolanaWalletConnector as S, type TelegramAuthResult as T, type User as U, type SiweFlowState as V, WalletConnector as W, type UnsignedTransactionRequestWithChainId as X, type CustomAuthFlowState as Y, AsExternalProvider as Z, type TypedMessage as _, type RpcConfig as a, type SolanaFundingConfig as a0, type MoonpayConfig as a1, type MoonpayCurrencyCode as a2, type MoonpayPaymentMethod as a3, type Quantity as a4, type TransactionLog as a5, type SolanaCluster as a6, type NonEmptyArray as a7, type EmailWithMetadata as a8, type PhoneWithMetadata as a9, type MoonpayFundingConfig as aA, type PriceDisplayOptions as aB, type Farcaster as aC, type Passkey as aD, type LoginMethodOrderOption as aE, type ConnectedSolanaWallet as aF, PrivyErrorCode as aG, type LinkedAccountWithMetadata as aH, type UserRecoveryMethod as aI, type FundingMethod as aJ, toSolanaWalletConnectors as aK, type WalletWithMetadata as aa, type Google as ab, type Twitter as ac, type Discord as ad, type Github as ae, type LinkedIn as af, type Apple as ag, type Tiktok as ah, type Telegram as ai, type CrossAppAccount as aj, type GoogleOAuthWithMetadata as ak, type TwitterOAuthWithMetadata as al, type DiscordOAuthWithMetadata as am, type GithubOAuthWithMetadata as an, type TiktokOAuthWithMetadata as ao, type LinkedInOAuthWithMetadata as ap, type AppleOAuthWithMetadata as aq, type FarcasterWithMetadata as ar, type TelegramWithMetadata as as, type CrossAppAccountWithMetadata as at, type PasskeyWithMetadata as au, type Email as av, type Phone as aw, type TransactionUIOptions as ax, type ContractUIOptions as ay, type NativeFundingConfig as az, type WalletClientType as b, type ConnectedWalletMetadata as c, type ConnectorType as d, type WalletListEntry as e, type ExternalWalletsConfig as f, type BaseConnectedWallet as g, type EIP1193Provider as h, type OAuthProviderType as i, type MoonpaySignResponse as j, type SmartWalletConfig as k, type PrivyServerConfig as l, type PrivyFarcasterSignerInitResponse as m, type SiweWalletMetadata as n, type OAuthUserInfo as o, type PrivyClientConfig as p, type ConnectWalletModalOptions as q, type LoginModalOptions as r, type CreateWalletOptions as s, type Wallet as t, type SetWalletRecoveryOptions as u, type SignMessageModalUIOptions as v, type SignTypedDataParams as w, type MfaMethod as x, type UnsignedTransactionRequest as y, type SendTransactionModalUIOptions as z };
@@ -767,7 +767,10 @@ type SolanaTransactionReceipt = {
767
767
  fees: bigint;
768
768
  };
769
769
  type SolanaCluster = {
770
- /** The network name */
770
+ /**
771
+ * The network name
772
+ * Refer to {@link https://solana-labs.github.io/solana-web3.js/types/Cluster.html Cluster} for more information
773
+ * */
771
774
  name: Cluster;
772
775
  /** The RPC endpoint */
773
776
  rpcUrl?: string;
@@ -2353,4 +2356,4 @@ type EthereumRpcResponseType = eth_signTransactionResponse | eth_populateTransac
2353
2356
  type SolanaRpcRequestType = solana_signMessage;
2354
2357
  type SolanaRpcResponseType = solana_signMessageResponse;
2355
2358
 
2356
- export { type SolanaFundingConfig as $, type SupportedSolanaTransaction as A, type BaseConnectedEthereumWallet as B, type Chain as C, type SolanaTransactionReceipt as D, Embedded1193Provider as E, type FundWalletConfig as F, type ConnectedWallet as G, type PrivyIframeErrorTypesType as H, type OAuthFlowState as I, type LoginWithCode as J, type OtpFlowState as K, type LoginMethod as L, type MoonpaySignRequest as M, type PasskeyFlowState as N, type OAuthTokens as O, PrivyProxyProvider as P, type SiweFlowState as Q, type RpcConfig as R, SolanaWalletConnector as S, type TelegramAuthResult as T, type User as U, type UnsignedTransactionRequestWithChainId as V, WalletConnector as W, type CustomAuthFlowState as X, AsExternalProvider as Y, type TypedMessage as Z, type MessageTypes as _, type WalletClientType as a, type MoonpayConfig as a0, type MoonpayCurrencyCode as a1, type MoonpayPaymentMethod as a2, type Quantity as a3, type TransactionLog as a4, type SolanaCluster as a5, type NonEmptyArray as a6, type EmailWithMetadata as a7, type PhoneWithMetadata as a8, type WalletWithMetadata as a9, type PriceDisplayOptions as aA, type Farcaster as aB, type Passkey as aC, type LoginMethodOrderOption as aD, type ConnectedSolanaWallet as aE, type RuntimeLoginOverridableOptions as aF, toSolanaWalletConnectors as aG, PrivyErrorCode as aH, type LinkedAccountWithMetadata as aI, type UserRecoveryMethod as aJ, type FundingMethod as aK, type Google as aa, type Twitter as ab, type Discord as ac, type Github as ad, type LinkedIn as ae, type Apple as af, type Tiktok as ag, type Telegram as ah, type CrossAppAccount as ai, type GoogleOAuthWithMetadata as aj, type TwitterOAuthWithMetadata as ak, type DiscordOAuthWithMetadata as al, type GithubOAuthWithMetadata as am, type TiktokOAuthWithMetadata as an, type LinkedInOAuthWithMetadata as ao, type AppleOAuthWithMetadata as ap, type FarcasterWithMetadata as aq, type TelegramWithMetadata as ar, type CrossAppAccountWithMetadata as as, type PasskeyWithMetadata as at, type Email as au, type Phone as av, type TransactionUIOptions as aw, type ContractUIOptions as ax, type NativeFundingConfig as ay, type MoonpayFundingConfig as az, type ConnectedWalletMetadata as b, type ConnectorType as c, type WalletListEntry as d, type ExternalWalletsConfig as e, type BaseConnectedWallet as f, type EIP1193Provider as g, type OAuthProviderType as h, type MoonpaySignResponse as i, type SmartWalletConfig as j, type PrivyServerConfig as k, type PrivyFarcasterSignerInitResponse as l, type SiweWalletMetadata as m, type OAuthUserInfo as n, type PrivyClientConfig as o, type ConnectWalletModalOptions as p, type LoginModalOptions as q, type CreateWalletOptions as r, type Wallet as s, type SetWalletRecoveryOptions as t, type SignMessageModalUIOptions as u, type SignTypedDataParams as v, type MfaMethod as w, type UnsignedTransactionRequest as x, type SendTransactionModalUIOptions as y, type TransactionReceipt as z };
2359
+ export { type MessageTypes as $, type TransactionReceipt as A, type BaseConnectedEthereumWallet as B, type Chain as C, type SupportedSolanaTransaction as D, Embedded1193Provider as E, type FundWalletConfig as F, type SolanaTransactionReceipt as G, type ConnectedWallet as H, type PrivyIframeErrorTypesType as I, type OAuthFlowState as J, type LoginWithCode as K, type LoginMethod as L, type MoonpaySignRequest as M, type OtpFlowState as N, type OAuthTokens as O, PrivyProxyProvider as P, type PasskeyFlowState as Q, type RuntimeLoginOverridableOptions as R, SolanaWalletConnector as S, type TelegramAuthResult as T, type User as U, type SiweFlowState as V, WalletConnector as W, type UnsignedTransactionRequestWithChainId as X, type CustomAuthFlowState as Y, AsExternalProvider as Z, type TypedMessage as _, type RpcConfig as a, type SolanaFundingConfig as a0, type MoonpayConfig as a1, type MoonpayCurrencyCode as a2, type MoonpayPaymentMethod as a3, type Quantity as a4, type TransactionLog as a5, type SolanaCluster as a6, type NonEmptyArray as a7, type EmailWithMetadata as a8, type PhoneWithMetadata as a9, type MoonpayFundingConfig as aA, type PriceDisplayOptions as aB, type Farcaster as aC, type Passkey as aD, type LoginMethodOrderOption as aE, type ConnectedSolanaWallet as aF, PrivyErrorCode as aG, type LinkedAccountWithMetadata as aH, type UserRecoveryMethod as aI, type FundingMethod as aJ, toSolanaWalletConnectors as aK, type WalletWithMetadata as aa, type Google as ab, type Twitter as ac, type Discord as ad, type Github as ae, type LinkedIn as af, type Apple as ag, type Tiktok as ah, type Telegram as ai, type CrossAppAccount as aj, type GoogleOAuthWithMetadata as ak, type TwitterOAuthWithMetadata as al, type DiscordOAuthWithMetadata as am, type GithubOAuthWithMetadata as an, type TiktokOAuthWithMetadata as ao, type LinkedInOAuthWithMetadata as ap, type AppleOAuthWithMetadata as aq, type FarcasterWithMetadata as ar, type TelegramWithMetadata as as, type CrossAppAccountWithMetadata as at, type PasskeyWithMetadata as au, type Email as av, type Phone as aw, type TransactionUIOptions as ax, type ContractUIOptions as ay, type NativeFundingConfig as az, type WalletClientType as b, type ConnectedWalletMetadata as c, type ConnectorType as d, type WalletListEntry as e, type ExternalWalletsConfig as f, type BaseConnectedWallet as g, type EIP1193Provider as h, type OAuthProviderType as i, type MoonpaySignResponse as j, type SmartWalletConfig as k, type PrivyServerConfig as l, type PrivyFarcasterSignerInitResponse as m, type SiweWalletMetadata as n, type OAuthUserInfo as o, type PrivyClientConfig as p, type ConnectWalletModalOptions as q, type LoginModalOptions as r, type CreateWalletOptions as s, type Wallet as t, type SetWalletRecoveryOptions as u, type SignMessageModalUIOptions as v, type SignTypedDataParams as w, type MfaMethod as x, type UnsignedTransactionRequest as y, type SendTransactionModalUIOptions as z };
package/dist/dts/ui.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { aF as RuntimeLoginOverridableOptions } from './types.js';
2
+ import { R as RuntimeLoginOverridableOptions } from './types.js';
3
3
  import '@metamask/eth-sig-util';
4
4
  import '@ethersproject/providers';
5
5
  import 'eventemitter3';
package/dist/dts/ui.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { aF as RuntimeLoginOverridableOptions } from './types.js';
2
+ import { R as RuntimeLoginOverridableOptions } from './types.js';
3
3
  import '@metamask/eth-sig-util';
4
4
  import '@ethersproject/providers';
5
5
  import 'eventemitter3';
@@ -1 +1 @@
1
- import{isHex as E,numberToHex as _,encodeAbiParameters as N,parseAbiParameters as e,createPublicClient as A,http as S,pad as a}from"viem";import{sendRawTransaction as T}from"viem/actions";import{abstractTestnet as R}from"viem/chains";import{n as C,u as t,h as n}from"./privy-context.mjs";import{jsx as D,jsxs as L}from"react/jsx-runtime";import{useState as I,useEffect as s,useRef as r,useContext as O,createContext as i}from"react";import{z as o,ao as l,b as c}from"./useWallets.mjs";function W({src:E,..._}){return D("img",{src:E,..._,style:{display:"none"}})}var m,M;(m=M||(M={})).LANDING="LANDING",m.CONNECT_OR_CREATE="CONNECT_OR_CREATE",m.AWAITING_CONNECTION="AWAITING_CONNECTION",m.AWAITING_FARCASTER_CONNECTION="AWAITING_FARCASTER_CONNECTION",m.AWAITING_FARCASTER_SIGNER="AWAITING_FARCASTER_SIGNER",m.AWAITING_OAUTH_SCREEN="AWAITING_OAUTH_SCREEN",m.CROSS_APP_AUTH_SCREEN="CROSS_APP_AUTH_SCREEN",m.AWAITING_PASSWORDLESS_CODE="AWAITING_PASSWORDLESS_CODE",m.AWAITING_PASSKEY_SYSTEM_DIALOGUE="AWAITING_PASSKEY_SYSTEM_DIALOGUE",m.LINK_EMAIL_SCREEN="LINK_EMAIL_SCREEN",m.LINK_PHONE_SCREEN="LINK_PHONE_SCREEN",m.LINK_WALLET_SCREEN="LINK_WALLET_SCREEN",m.LINK_PASSKEY_SCREEN="LINK_PASSKEY_SCREEN",m.UPDATE_EMAIL_SCREEN="UPDATE_EMAIL_SCREEN",m.UPDATE_PHONE_SCREEN="UPDATE_PHONE_SCREEN",m.AWAITING_CONNECT_ONLY_CONNECTION="AWAITING_CONNECT_ONLY_CONNECTION",m.CONNECT_ONLY_LANDING_SCREEN="CONNECT_ONLY_LANDING_SCREEN",m.CONNECT_ONLY_AUTHENTICATED_SCREEN="CONNECT_ONLY_AUTHENTICATED_SCREEN",m.LOGIN_FAILED_SCREEN="LOGIN_FAILED_SCREEN",m.ALLOWLIST_REJECTION_SCREEN="ALLOWLIST_REJECTION_SCREEN",m.ACCOUNT_NOT_FOUND_SCREEN="ACCOUNT_NOT_FOUND_SCREEN",m.USER_LIMIT_REACHED_SCREEN="USER_LIMIT_REACHED_SCREEN",m.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN="EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN",m.EMBEDDED_WALLET_CREATED_SCREEN="EMBEDDED_WALLET_CREATED_SCREEN",m.EMBEDDED_WALLET_CONNECTING_SCREEN="EMBEDDED_WALLET_CONNECTING_SCREEN",m.EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN="EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN",m.EMBEDDED_WALLET_KEY_EXPORT_SCREEN="EMBEDDED_WALLET_KEY_EXPORT_SCREEN",m.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN="EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",m.EMBEDDED_WALLET_SEND_SOLANA_TRANSACTION_SCREEN="EMBEDDED_WALLET_SEND_SOLANA_TRANSACTION_SCREEN",m.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN="EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",m.EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN="EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",m.EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN="EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN",m.EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN="EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN",m.EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN="EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN",m.EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN="EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN",m.EMBEDDED_WALLET_SET_AUTOMATIC_RECOVERY_SCREEN="EMBEDDED_WALLET_SET_AUTOMATIC_RECOVERY_SCREEN",m.EMBEDDED_WALLET_DELEGATED_ACTIONS_CONSENT_SCREEN="EMBEDDED_WALLET_DELEGATED_ACTIONS_CONSENT_SCREEN",m.INSTALL_PHANTOM_SCREEN="INSTALL_PHANTOM_SCREEN",m.PHANTOM_INTERSTITIAL_SCREEN="PHANTOM_INTERSTITIAL_SCREEN",m.AFFIRMATIVE_CONSENT_SCREEN="AFFIRMATIVE_CONSENT_SCREEN",m.FUNDING_METHOD_SELECTION_SCREEN="FUNDING_METHOD_SELECTION_SCREEN",m.FUNDING_TRANSFER_FROM_WALLET_SCREEN="FUNDING_TRANSFER_FROM_WALLET_SCREEN",m.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN="FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN",m.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_SOLANA_WALLET_SCREEN="FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_SOLANA_WALLET_SCREEN",m.FUNDING_AWAITING_EXTERNAL_SOLANA_BRIDGING_SCREEN="FUNDING_AWAITING_EXTERNAL_SOLANA_BRIDGING_SCREEN",m.FUNDING_MANUAL_TRANSFER_SCREEN="FUNDING_MANUAL_TRANSFER_SCREEN",m.MOONPAY_PROMPT_SCREEN="MOONPAY_PROMPT_SCREEN",m.MOONPAY_STATUS_SCREEN="MOONPAY_STATUS_SCREEN",m.COINBASE_ONRAMP_STATUS_SCREEN="COINBASE_ONRAMP_STATUS_SCREEN",m.MFA_ENROLLMENT_FLOW_SCREEN="MFA_ENROLLMENT_FLOW_SCREEN",m.CAPTCHA_SCREEN="CAPTCHA_SCREEN",m.ERROR_SCREEN="ERROR_SCREEN",m.IN_APP_BROWSER_LOGIN_NOT_POSSIBLE="IN_APP_BROWSER_LOGIN_NOT_POSSIBLE",m.TELEGRAM_AUTH_SCREEN="TELEGRAM_AUTH_SCREEN",m.LINK_CONFLICT_SCREEN="LINK_CONFLICT_SCREEN";const P=i({ready:!1,app:l,currentScreen:null,lastScreen:null,navigate:C,navigateBack:C,resetNavigation:C,setModalData:C,onUserCloseViaDialogOrKeybindRef:void 0});let p=[M.LANDING,M.CONNECT_ONLY_LANDING_SCREEN,null];const G=E=>{let _=o(),N=E.authenticated,[e,A]=I(E.initialScreen);s((()=>{N||p.includes(E.initialScreen)||E.setInitialScreen(null)}),[N]);let S=r(null);s((()=>{E.open||(S.current=null)}),[E.open]),s((()=>{S.current=null}),[E.initialScreen]);let a={ready:!!_.id,app:_,data:E.data,setModalData:E.setModalData,currentScreen:E.initialScreen,lastScreen:e,navigate:(_,N=!0)=>{E.setInitialScreen(_),N&&A(E.initialScreen)},navigateBack:()=>{E.setInitialScreen(e)},resetNavigation:()=>{E.setInitialScreen(null),A(null)},onUserCloseViaDialogOrKeybindRef:S};return L(P.Provider,{value:a,children:[("string"==typeof _.appearance.logo||"img"===_.appearance.logo?.type)&&D(W,{src:"string"==typeof _.appearance.logo?_.appearance.logo:_.appearance.logo.props.src}),E.children]})},g=()=>O(P);function d(E){return E?a(_(BigInt(E)),{dir:"left",size:20}):"0x"}function u(){let{noPromptOnSignature:a,openPrivyModal:C,chains:D}=t(),{signTypedData:L}=n(),{setModalData:I}=g(),s=D.find((E=>E.id===R.id));return{sendTransaction:(R,t,n,D,r)=>{t.to=d(t.to);let O=c(((E,_)=>{let N="string"==typeof E?JSON.parse(E):E,e=_.custom?.getEip712Domain?.({...N,chainId:_.id,from:N.from,type:"eip712"});return e.domain.name="zkSync",Object.entries(e.message).forEach((([E,_])=>{"bigint"==typeof _&&(e.message[E]=String(_))})),e})(t,s));return new Promise((async(i,o)=>{a.current=!0,I({connectWallet:{onCompleteNavigateTo:M.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN,onFailure:()=>{}},sendTransaction:{transactionRequests:n.map((N=>({to:d(O.message.to),value:"string"==typeof N.value?E(N.value)?N.value:_(BigInt(N.value)):N.value,data:N.data??"0x",chainId:O.domain.chainId,maxPriorityFeePerGas:BigInt(O.message.maxPriorityFeePerGas),maxFeePerGas:BigInt(O.message.maxFeePerGas),gasLimit:BigInt(O.message.gasLimit),nonce:O.message.nonce}))),rootWallet:{address:R.address},transactingWallet:{address:R.address,walletIndex:null},getIsSponsored:async()=>Number(O.message.paymaster)>0,onConfirm:async()=>{let E=await L(O),a={to:BigInt(O.message.to),value:BigInt(O.message.value),data:O.message.data??void 0,chainId:O.domain.chainId,maxPriorityFeePerGas:BigInt(O.message.maxPriorityFeePerGas),maxFeePerGas:BigInt(O.message.maxFeePerGas),gas:BigInt(O.message.gasLimit),paymaster:d(O.message.paymaster),paymasterInput:O.message.paymasterInput},R=N(e(["bytes","address","bytes[]"]),[E,"0xC894DE2894e2F84C0C2944FDcce9490eC22A92b6",[]]),C={...a,factoryDeps:t.factoryDeps,to:d(O.message.to),chainId:s.id,from:_(BigInt(O.message.from)),customSignature:R,type:"eip712",data:O.message.data,nonce:Number(O.message.nonce)},n=s.serializers?.transaction(C,{r:"0x0",s:"0x0",v:0n}),I=A({chain:s,transport:S(`https://abs-testnet.rpc.privy.systems?privyAppId=${D}`)});return await T(I,{serializedTransaction:n})},onSuccess:E=>i(E.hash),onFailure:o,uiOptions:r}}),C(M.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{a.current=!1}))}}}function F(E){return E.find((E=>"privy"===E.walletClientType&&"embedded"===E.connectorType&&!E.imported))??null}export{M,G as a,u as b,F as g,g as u};
1
+ import{isHex as E,numberToHex as _,encodeAbiParameters as N,parseAbiParameters as e,createPublicClient as A,http as S,pad as a}from"viem";import{sendRawTransaction as T}from"viem/actions";import{abstractTestnet as R}from"viem/chains";import{n as C,u as t,h as I}from"./privy-context.mjs";import{jsx as D,jsxs as n}from"react/jsx-runtime";import{useState as L,useEffect as O,useRef as s,useContext as r,createContext as i}from"react";import{z as o,ap as l,b as c}from"./useWallets.mjs";function M({src:E,..._}){return D("img",{src:E,..._,style:{display:"none"}})}var W,m;(W=m||(m={})).LANDING="LANDING",W.CONNECT_OR_CREATE="CONNECT_OR_CREATE",W.AWAITING_CONNECTION="AWAITING_CONNECTION",W.AWAITING_FARCASTER_CONNECTION="AWAITING_FARCASTER_CONNECTION",W.AWAITING_FARCASTER_SIGNER="AWAITING_FARCASTER_SIGNER",W.AWAITING_OAUTH_SCREEN="AWAITING_OAUTH_SCREEN",W.CROSS_APP_AUTH_SCREEN="CROSS_APP_AUTH_SCREEN",W.AWAITING_PASSWORDLESS_CODE="AWAITING_PASSWORDLESS_CODE",W.AWAITING_PASSKEY_SYSTEM_DIALOGUE="AWAITING_PASSKEY_SYSTEM_DIALOGUE",W.LINK_EMAIL_SCREEN="LINK_EMAIL_SCREEN",W.LINK_PHONE_SCREEN="LINK_PHONE_SCREEN",W.LINK_WALLET_SCREEN="LINK_WALLET_SCREEN",W.LINK_PASSKEY_SCREEN="LINK_PASSKEY_SCREEN",W.UPDATE_EMAIL_SCREEN="UPDATE_EMAIL_SCREEN",W.UPDATE_PHONE_SCREEN="UPDATE_PHONE_SCREEN",W.AWAITING_CONNECT_ONLY_CONNECTION="AWAITING_CONNECT_ONLY_CONNECTION",W.CONNECT_ONLY_LANDING_SCREEN="CONNECT_ONLY_LANDING_SCREEN",W.CONNECT_ONLY_AUTHENTICATED_SCREEN="CONNECT_ONLY_AUTHENTICATED_SCREEN",W.LOGIN_FAILED_SCREEN="LOGIN_FAILED_SCREEN",W.ALLOWLIST_REJECTION_SCREEN="ALLOWLIST_REJECTION_SCREEN",W.ACCOUNT_NOT_FOUND_SCREEN="ACCOUNT_NOT_FOUND_SCREEN",W.USER_LIMIT_REACHED_SCREEN="USER_LIMIT_REACHED_SCREEN",W.EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN="EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN",W.EMBEDDED_WALLET_CREATED_SCREEN="EMBEDDED_WALLET_CREATED_SCREEN",W.EMBEDDED_WALLET_CONNECTING_SCREEN="EMBEDDED_WALLET_CONNECTING_SCREEN",W.EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN="EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN",W.EMBEDDED_WALLET_KEY_EXPORT_SCREEN="EMBEDDED_WALLET_KEY_EXPORT_SCREEN",W.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN="EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",W.EMBEDDED_WALLET_SEND_SOLANA_TRANSACTION_SCREEN="EMBEDDED_WALLET_SEND_SOLANA_TRANSACTION_SCREEN",W.EMBEDDED_WALLET_SIGN_REQUEST_SCREEN="EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",W.EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN="EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",W.EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN="EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN",W.EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN="EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN",W.EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN="EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN",W.EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN="EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN",W.EMBEDDED_WALLET_SET_AUTOMATIC_RECOVERY_SCREEN="EMBEDDED_WALLET_SET_AUTOMATIC_RECOVERY_SCREEN",W.EMBEDDED_WALLET_DELEGATED_ACTIONS_CONSENT_SCREEN="EMBEDDED_WALLET_DELEGATED_ACTIONS_CONSENT_SCREEN",W.INSTALL_PHANTOM_SCREEN="INSTALL_PHANTOM_SCREEN",W.PHANTOM_INTERSTITIAL_SCREEN="PHANTOM_INTERSTITIAL_SCREEN",W.AFFIRMATIVE_CONSENT_SCREEN="AFFIRMATIVE_CONSENT_SCREEN",W.FUNDING_METHOD_SELECTION_SCREEN="FUNDING_METHOD_SELECTION_SCREEN",W.FUNDING_TRANSFER_FROM_WALLET_SCREEN="FUNDING_TRANSFER_FROM_WALLET_SCREEN",W.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN="FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_WALLET_SCREEN",W.FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_SOLANA_WALLET_SCREEN="FUNDING_AWAITING_TRANSFER_FROM_EXTERNAL_SOLANA_WALLET_SCREEN",W.FUNDING_AWAITING_EVM_TO_SOL_BRIDGING_SCREEN="FUNDING_AWAITING_EVM_TO_SOL_BRIDGING_SCREEN",W.FUNDING_AWAITING_SOL_TO_EVM_BRIDGING_SCREEN="FUNDING_AWAITING_SOL_TO_EVM_BRIDGING_SCREEN",W.FUNDING_MANUAL_TRANSFER_SCREEN="FUNDING_MANUAL_TRANSFER_SCREEN",W.MOONPAY_PROMPT_SCREEN="MOONPAY_PROMPT_SCREEN",W.MOONPAY_STATUS_SCREEN="MOONPAY_STATUS_SCREEN",W.COINBASE_ONRAMP_STATUS_SCREEN="COINBASE_ONRAMP_STATUS_SCREEN",W.MFA_ENROLLMENT_FLOW_SCREEN="MFA_ENROLLMENT_FLOW_SCREEN",W.CAPTCHA_SCREEN="CAPTCHA_SCREEN",W.ERROR_SCREEN="ERROR_SCREEN",W.IN_APP_BROWSER_LOGIN_NOT_POSSIBLE="IN_APP_BROWSER_LOGIN_NOT_POSSIBLE",W.TELEGRAM_AUTH_SCREEN="TELEGRAM_AUTH_SCREEN",W.LINK_CONFLICT_SCREEN="LINK_CONFLICT_SCREEN";const G=i({ready:!1,app:l,currentScreen:null,lastScreen:null,navigate:C,navigateBack:C,resetNavigation:C,setModalData:C,onUserCloseViaDialogOrKeybindRef:void 0});let P=[m.LANDING,m.CONNECT_ONLY_LANDING_SCREEN,null];const p=E=>{let _=o(),N=E.authenticated,[e,A]=L(E.initialScreen);O((()=>{N||P.includes(E.initialScreen)||E.setInitialScreen(null)}),[N]);let S=s(null);O((()=>{E.open||(S.current=null)}),[E.open]),O((()=>{S.current=null}),[E.initialScreen]);let a={ready:!!_.id,app:_,data:E.data,setModalData:E.setModalData,currentScreen:E.initialScreen,lastScreen:e,navigate:(_,N=!0)=>{E.setInitialScreen(_),N&&A(E.initialScreen)},navigateBack:()=>{E.setInitialScreen(e)},resetNavigation:()=>{E.setInitialScreen(null),A(null)},onUserCloseViaDialogOrKeybindRef:S};return n(G.Provider,{value:a,children:[("string"==typeof _.appearance.logo||"img"===_.appearance.logo?.type)&&D(M,{src:"string"==typeof _.appearance.logo?_.appearance.logo:_.appearance.logo.props.src}),E.children]})},g=()=>r(G);function d(E){return E?a(_(BigInt(E)),{dir:"left",size:20}):"0x"}function F(){let{noPromptOnSignature:a,openPrivyModal:C,chains:D}=t(),{signTypedData:n}=I(),{setModalData:L}=g(),O=D.find((E=>E.id===R.id));return{sendTransaction:(R,t,I,D,s)=>{t.to=d(t.to);let r=c(((E,_)=>{let N="string"==typeof E?JSON.parse(E):E,e=_.custom?.getEip712Domain?.({...N,chainId:_.id,from:N.from,type:"eip712"});return e.domain.name="zkSync",Object.entries(e.message).forEach((([E,_])=>{"bigint"==typeof _&&(e.message[E]=String(_))})),e})(t,O));return new Promise((async(i,o)=>{a.current=!0,L({connectWallet:{onCompleteNavigateTo:m.EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN,onFailure:()=>{}},sendTransaction:{transactionRequests:I.map((N=>({to:d(r.message.to),value:"string"==typeof N.value?E(N.value)?N.value:_(BigInt(N.value)):N.value,data:N.data??"0x",chainId:r.domain.chainId,maxPriorityFeePerGas:BigInt(r.message.maxPriorityFeePerGas),maxFeePerGas:BigInt(r.message.maxFeePerGas),gasLimit:BigInt(r.message.gasLimit),nonce:r.message.nonce}))),rootWallet:{address:R.address},transactingWallet:{address:R.address,walletIndex:null},getIsSponsored:async()=>Number(r.message.paymaster)>0,onConfirm:async()=>{let E=await n(r),a={to:BigInt(r.message.to),value:BigInt(r.message.value),data:r.message.data??void 0,chainId:r.domain.chainId,maxPriorityFeePerGas:BigInt(r.message.maxPriorityFeePerGas),maxFeePerGas:BigInt(r.message.maxFeePerGas),gas:BigInt(r.message.gasLimit),paymaster:d(r.message.paymaster),paymasterInput:r.message.paymasterInput},R=N(e(["bytes","address","bytes[]"]),[E,"0xC894DE2894e2F84C0C2944FDcce9490eC22A92b6",[]]),C={...a,factoryDeps:t.factoryDeps,to:d(r.message.to),chainId:O.id,from:_(BigInt(r.message.from)),customSignature:R,type:"eip712",data:r.message.data,nonce:Number(r.message.nonce)},I=O.serializers?.transaction(C,{r:"0x0",s:"0x0",v:0n}),L=A({chain:O,transport:S(`https://abs-testnet.rpc.privy.systems?privyAppId=${D}`)});return await T(L,{serializedTransaction:I})},onSuccess:E=>i(E.hash),onFailure:o,uiOptions:s}}),C(m.EMBEDDED_WALLET_CONNECTING_SCREEN)})).finally((()=>{a.current=!1}))}}}function u(E){return E.find((E=>"privy"===E.walletClientType&&"embedded"===E.connectorType&&!E.imported))??null}export{m as M,p as a,F as b,u as g,g as u};