@privy-io/js-sdk-core 0.60.9 → 0.61.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.
Files changed (53) hide show
  1. package/dist/cjs/client/EmbeddedWalletApi.js +1 -1
  2. package/dist/cjs/client/EmbeddedWalletApi.js.map +1 -1
  3. package/dist/cjs/client/Privy.js +1 -1
  4. package/dist/cjs/client/Privy.js.map +1 -1
  5. package/dist/cjs/client/PrivyInternal.js +1 -1
  6. package/dist/cjs/embedded/EmbeddedSolanaWalletProvider.js +1 -1
  7. package/dist/cjs/embedded/EmbeddedSolanaWalletProvider.js.map +1 -1
  8. package/dist/cjs/embedded/EmbeddedWalletProvider.js +1 -1
  9. package/dist/cjs/embedded/EmbeddedWalletProvider.js.map +1 -1
  10. package/dist/cjs/embedded/index.js +1 -1
  11. package/dist/cjs/embedded/stack/session-signers.js +1 -1
  12. package/dist/cjs/embedded/stack/session-signers.js.map +1 -1
  13. package/dist/cjs/embedded/stack/walletRpc.js +1 -1
  14. package/dist/cjs/embedded/stack/walletRpc.js.map +1 -1
  15. package/dist/cjs/index.js +1 -1
  16. package/dist/cjs/index.js.map +1 -1
  17. package/dist/cjs/wallet-api/generate-authorization-signature.js +1 -1
  18. package/dist/cjs/wallet-api/generate-authorization-signature.js.map +1 -1
  19. package/dist/cjs/wallet-api/raw-sign.js +1 -1
  20. package/dist/cjs/wallet-api/raw-sign.js.map +1 -1
  21. package/dist/cjs/wallet-api/rpc.js +1 -1
  22. package/dist/cjs/wallet-api/rpc.js.map +1 -1
  23. package/dist/cjs/wallet-api/update-wallet.js +1 -1
  24. package/dist/cjs/wallet-api/update-wallet.js.map +1 -1
  25. package/dist/dts/index.d.mts +15 -7
  26. package/dist/dts/index.d.ts +15 -7
  27. package/dist/dts/smart-wallets.d.mts +2 -1
  28. package/dist/dts/smart-wallets.d.ts +2 -1
  29. package/dist/esm/client/EmbeddedWalletApi.mjs +1 -1
  30. package/dist/esm/client/EmbeddedWalletApi.mjs.map +1 -1
  31. package/dist/esm/client/Privy.mjs +1 -1
  32. package/dist/esm/client/Privy.mjs.map +1 -1
  33. package/dist/esm/client/PrivyInternal.mjs +1 -1
  34. package/dist/esm/embedded/EmbeddedSolanaWalletProvider.mjs +1 -1
  35. package/dist/esm/embedded/EmbeddedSolanaWalletProvider.mjs.map +1 -1
  36. package/dist/esm/embedded/EmbeddedWalletProvider.mjs +1 -1
  37. package/dist/esm/embedded/EmbeddedWalletProvider.mjs.map +1 -1
  38. package/dist/esm/embedded/index.mjs +1 -1
  39. package/dist/esm/embedded/stack/session-signers.mjs +1 -1
  40. package/dist/esm/embedded/stack/session-signers.mjs.map +1 -1
  41. package/dist/esm/embedded/stack/walletRpc.mjs +1 -1
  42. package/dist/esm/embedded/stack/walletRpc.mjs.map +1 -1
  43. package/dist/esm/index.mjs +1 -1
  44. package/dist/esm/index.mjs.map +1 -1
  45. package/dist/esm/wallet-api/generate-authorization-signature.mjs +1 -1
  46. package/dist/esm/wallet-api/generate-authorization-signature.mjs.map +1 -1
  47. package/dist/esm/wallet-api/raw-sign.mjs +1 -1
  48. package/dist/esm/wallet-api/raw-sign.mjs.map +1 -1
  49. package/dist/esm/wallet-api/rpc.mjs +1 -1
  50. package/dist/esm/wallet-api/rpc.mjs.map +1 -1
  51. package/dist/esm/wallet-api/update-wallet.mjs +1 -1
  52. package/dist/esm/wallet-api/update-wallet.mjs.map +1 -1
  53. package/package.json +12 -10
@@ -1390,7 +1390,7 @@ type CoinbaseWalletClientType = (typeof COINBASE_WALLET_CLIENT_TYPES)[number];
1390
1390
  type WalletConnectWalletClientType = (typeof WALLET_CONNECT_WALLET_CLIENT_TYPES)[number];
1391
1391
  declare const UNKNOWN_WALLET_CLIENT_TYPES: readonly ["unknown"];
1392
1392
  type UnknownWalletClientType = (typeof UNKNOWN_WALLET_CLIENT_TYPES)[number];
1393
- declare const ALL_WALLET_CLIENT_TYPES: ("safe" | "unknown" | "privy" | "metamask" | "phantom" | "brave_wallet" | "rainbow" | "coinbase_wallet" | "trust" | "uniswap" | "zerion" | "argent" | "spot" | "omni" | "cryptocom" | "blockchain" | "safepal" | "bitget_wallet" | "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" | "safemoon")[];
1393
+ declare const ALL_WALLET_CLIENT_TYPES: ("safe" | "privy" | "metamask" | "phantom" | "brave_wallet" | "rainbow" | "coinbase_wallet" | "trust" | "uniswap" | "zerion" | "argent" | "spot" | "omni" | "cryptocom" | "blockchain" | "safepal" | "bitget_wallet" | "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" | "safemoon" | "unknown")[];
1394
1394
  type WalletClientType = InjectedWalletClientType | CoinbaseWalletClientType | WalletConnectWalletClientType | EmbeddedWalletClientType | UnknownWalletClientType;
1395
1395
  declare const SUPPORTED_CONNECTOR_TYPES: readonly ["injected", "wallet_connect", "wallet_connect_v2", "coinbase_wallet", "embedded"];
1396
1396
  type ConnectorType = (typeof SUPPORTED_CONNECTOR_TYPES)[number];
@@ -2431,7 +2431,10 @@ declare const revokeWallets: (client: Privy) => () => Promise<{
2431
2431
  declare const index$2_delegateWallet: typeof delegateWallet;
2432
2432
  declare const index$2_revokeWallets: typeof revokeWallets;
2433
2433
  declare namespace index$2 {
2434
- export { index$2_delegateWallet as delegateWallet, index$2_revokeWallets as revokeWallets };
2434
+ export {
2435
+ index$2_delegateWallet as delegateWallet,
2436
+ index$2_revokeWallets as revokeWallets,
2437
+ };
2435
2438
  }
2436
2439
 
2437
2440
  interface LoginWithCrossAppAuthDependencies {
@@ -2552,7 +2555,8 @@ declare const index$1_sendTransaction: typeof sendTransaction;
2552
2555
  declare const index$1_signMessage: typeof signMessage;
2553
2556
  declare const index$1_signTypedData: typeof signTypedData;
2554
2557
  declare namespace index$1 {
2555
- export { type index$1_SendTransactionDependencies as SendTransactionDependencies, type index$1_SendTransactionInput as SendTransactionInput, type index$1_SendTransactionOutput as SendTransactionOutput, type index$1_SignMessageDependencies as SignMessageDependencies, type index$1_SignMessageInput as SignMessageInput, type index$1_SignMessageOutput as SignMessageOutput, type index$1_SignTypedDataDependencies as SignTypedDataDependencies, type index$1_SignTypedDataInput as SignTypedDataInput, type index$1_SignTypedDataOutput as SignTypedDataOutput, index$1_sendTransaction as sendTransaction, index$1_signMessage as signMessage, index$1_signTypedData as signTypedData };
2558
+ export { index$1_sendTransaction as sendTransaction, index$1_signMessage as signMessage, index$1_signTypedData as signTypedData };
2559
+ export type { index$1_SendTransactionDependencies as SendTransactionDependencies, index$1_SendTransactionInput as SendTransactionInput, index$1_SendTransactionOutput as SendTransactionOutput, index$1_SignMessageDependencies as SignMessageDependencies, index$1_SignMessageInput as SignMessageInput, index$1_SignMessageOutput as SignMessageOutput, index$1_SignTypedDataDependencies as SignTypedDataDependencies, index$1_SignTypedDataInput as SignTypedDataInput, index$1_SignTypedDataOutput as SignTypedDataOutput };
2556
2560
  }
2557
2561
 
2558
2562
  type index_LinkWithCrossAppAuthDependencies = LinkWithCrossAppAuthDependencies;
@@ -2564,7 +2568,8 @@ type index_LoginWithCrossAppAuthOutput = LoginWithCrossAppAuthOutput;
2564
2568
  declare const index_linkWithCrossAppAuth: typeof linkWithCrossAppAuth;
2565
2569
  declare const index_loginWithCrossAppAuth: typeof loginWithCrossAppAuth;
2566
2570
  declare namespace index {
2567
- export { type index_LinkWithCrossAppAuthDependencies as LinkWithCrossAppAuthDependencies, type index_LinkWithCrossAppAuthInput as LinkWithCrossAppAuthInput, type index_LinkWithCrossAppAuthOutput as LinkWithCrossAppAuthOutput, type index_LoginWithCrossAppAuthDependencies as LoginWithCrossAppAuthDependencies, type index_LoginWithCrossAppAuthInput as LoginWithCrossAppAuthInput, type index_LoginWithCrossAppAuthOutput as LoginWithCrossAppAuthOutput, index_linkWithCrossAppAuth as linkWithCrossAppAuth, index_loginWithCrossAppAuth as loginWithCrossAppAuth, index$1 as wallet };
2571
+ export { index_linkWithCrossAppAuth as linkWithCrossAppAuth, index_loginWithCrossAppAuth as loginWithCrossAppAuth, index$1 as wallet };
2572
+ export type { index_LinkWithCrossAppAuthDependencies as LinkWithCrossAppAuthDependencies, index_LinkWithCrossAppAuthInput as LinkWithCrossAppAuthInput, index_LinkWithCrossAppAuthOutput as LinkWithCrossAppAuthOutput, index_LoginWithCrossAppAuthDependencies as LoginWithCrossAppAuthDependencies, index_LoginWithCrossAppAuthInput as LoginWithCrossAppAuthInput, index_LoginWithCrossAppAuthOutput as LoginWithCrossAppAuthOutput };
2568
2573
  }
2569
2574
 
2570
2575
  interface SignWalletRequestInput {
@@ -2618,10 +2623,12 @@ interface GenerateAuthorizationSignatureOutput {
2618
2623
  * @see {@link https://docs.privy.io/api-reference/authorization-signatures |Authorization signatures}
2619
2624
  *
2620
2625
  * @param sign A function that signs a wallet request
2621
- * @param payload The request payload to sign.
2626
+ * @param payload The request payload to sign. Can be a structured request object (which will be
2627
+ * canonicalized to JSON before signing) or a pre-serialized binary payload (`Uint8Array`) that
2628
+ * will be signed directly.
2622
2629
  * @returns The user's authorization signature over the API request.
2623
2630
  */
2624
- declare function generateAuthorizationSignature(sign: SignWalletRequest, payload: GenerateAuthorizationSignatureInput): Promise<GenerateAuthorizationSignatureOutput>;
2631
+ declare function generateAuthorizationSignature(sign: SignWalletRequest, payload: GenerateAuthorizationSignatureInput | Uint8Array): Promise<GenerateAuthorizationSignatureOutput>;
2625
2632
 
2626
2633
  type Input$3 = {
2627
2634
  request: WalletCreateParams;
@@ -2805,4 +2812,5 @@ declare const SAFE: "safe";
2805
2812
  /** @deprecated {@link SmartWalletType} is a well-typed union, use the `'thirdweb'` literal instead */
2806
2813
  declare const THIRDWEB: "thirdweb";
2807
2814
 
2808
- export { ALL_WALLET_CLIENT_TYPES, BICONOMY, COINBASE_SMART_WALLET, type Cluster, type CoinbaseAssetId, type CoinbaseWalletClientType, ConnectedStandardSolanaWallet, type ConnectorType, type CreateSiwsMessageOpts, type EIP1193Provider, EmbeddedBitcoinWalletProvider, EmbeddedProviderError, type EmbeddedWalletClientType, type EmbeddedWalletConfig, type EmbeddedWalletRecoveryOptions, type EntropyIdVerifier, type ErrorMessageMap, type ExternalWallet, type ExternalWalletMetadata, type FundingMethod, type FundingProvider, type GenerateAuthorizationSignatureInput, type GenerateAuthorizationSignatureOutput, type IdentifierString, InMemoryCache, type InjectedWalletClientType, KERNEL, LIGHT_ACCOUNT, LocalStorage, type LogLevel, type Logger, type MfaMethod, type MfaPromise, type MfaSubmitArgs, type MfaSubmitPromise, MoonpayApiError, type MoonpayTransactionStatus, type MoonpayTransactionStatusResponse, type OAuthProviderType, type OnNeedsRecovery, type PaymentOption, type PreparedTransactionRequest, PrivyApiError, PrivyClientError, PrivyConnectorError, type PrivyEmbeddedSolanaWalletProvider, PrivyEmbeddedWalletErrorCode, type PrivyEmbeddedWalletProvider, PrivyProviderRpcError, ProviderErrors, type Quantity, SAFE, SUPPORTED_CONNECTOR_TYPES, type SetRecoveryInput, SolanaClient, type SolanaCluster, type SolanaSignAndSendTransactionInput, type SolanaSignAndSendTransactionMode, type SolanaSignAndSendTransactionOptions, type SolanaSignAndSendTransactionOutput, type SolanaSignMessageInput, type SolanaSignMessageOutput, type SolanaSignTransactionInput, type SolanaSignTransactionOptions, type SolanaSignTransactionOutput, type SolanaStandardWallet, type SolanaTransactionCommitment, SolanaUsdcAddressMap, type Storage, THIRDWEB, type UnknownWalletClientType, type UnsignedTransactionRequest, type UnsignedTransactionRequestWithChainId, UsdcAddressMap, type WalletBranding, type WalletClientType, type WalletConnectWalletClientType, addSessionSigners, chainToMoonpayCurrency, countryCodesAndNumbers, create, createErrorFormatter, createSiwsMessage, index as crossApp, Privy as default, index$2 as delegatedActions, errorIndicatesMaxMfaRetries, errorIndicatesMfaCanceled, errorIndicatesMfaRateLimit, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, errorIndicatesRecoveryIsNeeded, formatLamportsAmount, formatPhoneNumber, formatTokenAmount, formatWalletAddress, formatWeiAmount, fundingMethodToMoonpayPaymentMethod, generateAuthorizationSignature, generateWalletIdempotencyKey, getAllUserEmbeddedBitcoinWallets, getAllUserEmbeddedEthereumWallets, getAllUserEmbeddedSolanaWallets, getCoinbaseOnRampUrl, getEntropyDetailsFromAccount, getEntropyDetailsFromUser, getIsTokenUsdc, getJsonRpcEndpointFromChain, getPhoneCountryCodeAndNumber, getPlaceholderPhoneNumber, getSolanaClusterDisplayName, getSolanaRpcEndpointForCluster, getSolanaUsdcMintAddressForCluster, getUserEmbeddedEthereumWallet, getUserEmbeddedSolanaWallet, getUserEmbeddedWallet, getUserSmartWallet, getWallet, isEmbeddedWalletAccount, isSupportedChainIdForCoinbaseOnramp, isSupportedChainIdForMoonpay, isUnifiedWallet, lastFourDigits, phoneNumberTypingFormatter, rawSign, removeSessionSigners, rpc, throwIfInvalidRecoveryUpgradePath, toCoinbaseAssetId, toCoinbaseBlockchainFromChainId, toObjectKeys, updateWallet, validatePhoneNumber };
2815
+ export { ALL_WALLET_CLIENT_TYPES, BICONOMY, COINBASE_SMART_WALLET, ConnectedStandardSolanaWallet, EmbeddedBitcoinWalletProvider, EmbeddedProviderError, InMemoryCache, KERNEL, LIGHT_ACCOUNT, LocalStorage, MoonpayApiError, PrivyApiError, PrivyClientError, PrivyConnectorError, PrivyEmbeddedWalletErrorCode, PrivyProviderRpcError, ProviderErrors, SAFE, SUPPORTED_CONNECTOR_TYPES, SolanaClient, SolanaUsdcAddressMap, THIRDWEB, UsdcAddressMap, addSessionSigners, chainToMoonpayCurrency, countryCodesAndNumbers, create, createErrorFormatter, createSiwsMessage, index as crossApp, Privy as default, index$2 as delegatedActions, errorIndicatesMaxMfaRetries, errorIndicatesMfaCanceled, errorIndicatesMfaRateLimit, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, errorIndicatesRecoveryIsNeeded, formatLamportsAmount, formatPhoneNumber, formatTokenAmount, formatWalletAddress, formatWeiAmount, fundingMethodToMoonpayPaymentMethod, generateAuthorizationSignature, generateWalletIdempotencyKey, getAllUserEmbeddedBitcoinWallets, getAllUserEmbeddedEthereumWallets, getAllUserEmbeddedSolanaWallets, getCoinbaseOnRampUrl, getEntropyDetailsFromAccount, getEntropyDetailsFromUser, getIsTokenUsdc, getJsonRpcEndpointFromChain, getPhoneCountryCodeAndNumber, getPlaceholderPhoneNumber, getSolanaClusterDisplayName, getSolanaRpcEndpointForCluster, getSolanaUsdcMintAddressForCluster, getUserEmbeddedEthereumWallet, getUserEmbeddedSolanaWallet, getUserEmbeddedWallet, getUserSmartWallet, getWallet, isEmbeddedWalletAccount, isSupportedChainIdForCoinbaseOnramp, isSupportedChainIdForMoonpay, isUnifiedWallet, lastFourDigits, phoneNumberTypingFormatter, rawSign, removeSessionSigners, rpc, throwIfInvalidRecoveryUpgradePath, toCoinbaseAssetId, toCoinbaseBlockchainFromChainId, toObjectKeys, updateWallet, validatePhoneNumber };
2816
+ export type { Cluster, CoinbaseAssetId, CoinbaseWalletClientType, ConnectorType, CreateSiwsMessageOpts, EIP1193Provider, EmbeddedWalletClientType, EmbeddedWalletConfig, EmbeddedWalletRecoveryOptions, EntropyIdVerifier, ErrorMessageMap, ExternalWallet, ExternalWalletMetadata, FundingMethod, FundingProvider, GenerateAuthorizationSignatureInput, GenerateAuthorizationSignatureOutput, IdentifierString, InjectedWalletClientType, LogLevel, Logger, MfaMethod, MfaPromise, MfaSubmitArgs, MfaSubmitPromise, MoonpayTransactionStatus, MoonpayTransactionStatusResponse, OAuthProviderType, OnNeedsRecovery, PaymentOption, PreparedTransactionRequest, PrivyEmbeddedSolanaWalletProvider, PrivyEmbeddedWalletProvider, Quantity, SetRecoveryInput, SolanaCluster, SolanaSignAndSendTransactionInput, SolanaSignAndSendTransactionMode, SolanaSignAndSendTransactionOptions, SolanaSignAndSendTransactionOutput, SolanaSignMessageInput, SolanaSignMessageOutput, SolanaSignTransactionInput, SolanaSignTransactionOptions, SolanaSignTransactionOutput, SolanaStandardWallet, SolanaTransactionCommitment, Storage, UnknownWalletClientType, UnsignedTransactionRequest, UnsignedTransactionRequestWithChainId, WalletBranding, WalletClientType, WalletConnectWalletClientType };
@@ -1390,7 +1390,7 @@ type CoinbaseWalletClientType = (typeof COINBASE_WALLET_CLIENT_TYPES)[number];
1390
1390
  type WalletConnectWalletClientType = (typeof WALLET_CONNECT_WALLET_CLIENT_TYPES)[number];
1391
1391
  declare const UNKNOWN_WALLET_CLIENT_TYPES: readonly ["unknown"];
1392
1392
  type UnknownWalletClientType = (typeof UNKNOWN_WALLET_CLIENT_TYPES)[number];
1393
- declare const ALL_WALLET_CLIENT_TYPES: ("safe" | "unknown" | "privy" | "metamask" | "phantom" | "brave_wallet" | "rainbow" | "coinbase_wallet" | "trust" | "uniswap" | "zerion" | "argent" | "spot" | "omni" | "cryptocom" | "blockchain" | "safepal" | "bitget_wallet" | "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" | "safemoon")[];
1393
+ declare const ALL_WALLET_CLIENT_TYPES: ("safe" | "privy" | "metamask" | "phantom" | "brave_wallet" | "rainbow" | "coinbase_wallet" | "trust" | "uniswap" | "zerion" | "argent" | "spot" | "omni" | "cryptocom" | "blockchain" | "safepal" | "bitget_wallet" | "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" | "safemoon" | "unknown")[];
1394
1394
  type WalletClientType = InjectedWalletClientType | CoinbaseWalletClientType | WalletConnectWalletClientType | EmbeddedWalletClientType | UnknownWalletClientType;
1395
1395
  declare const SUPPORTED_CONNECTOR_TYPES: readonly ["injected", "wallet_connect", "wallet_connect_v2", "coinbase_wallet", "embedded"];
1396
1396
  type ConnectorType = (typeof SUPPORTED_CONNECTOR_TYPES)[number];
@@ -2431,7 +2431,10 @@ declare const revokeWallets: (client: Privy) => () => Promise<{
2431
2431
  declare const index$2_delegateWallet: typeof delegateWallet;
2432
2432
  declare const index$2_revokeWallets: typeof revokeWallets;
2433
2433
  declare namespace index$2 {
2434
- export { index$2_delegateWallet as delegateWallet, index$2_revokeWallets as revokeWallets };
2434
+ export {
2435
+ index$2_delegateWallet as delegateWallet,
2436
+ index$2_revokeWallets as revokeWallets,
2437
+ };
2435
2438
  }
2436
2439
 
2437
2440
  interface LoginWithCrossAppAuthDependencies {
@@ -2552,7 +2555,8 @@ declare const index$1_sendTransaction: typeof sendTransaction;
2552
2555
  declare const index$1_signMessage: typeof signMessage;
2553
2556
  declare const index$1_signTypedData: typeof signTypedData;
2554
2557
  declare namespace index$1 {
2555
- export { type index$1_SendTransactionDependencies as SendTransactionDependencies, type index$1_SendTransactionInput as SendTransactionInput, type index$1_SendTransactionOutput as SendTransactionOutput, type index$1_SignMessageDependencies as SignMessageDependencies, type index$1_SignMessageInput as SignMessageInput, type index$1_SignMessageOutput as SignMessageOutput, type index$1_SignTypedDataDependencies as SignTypedDataDependencies, type index$1_SignTypedDataInput as SignTypedDataInput, type index$1_SignTypedDataOutput as SignTypedDataOutput, index$1_sendTransaction as sendTransaction, index$1_signMessage as signMessage, index$1_signTypedData as signTypedData };
2558
+ export { index$1_sendTransaction as sendTransaction, index$1_signMessage as signMessage, index$1_signTypedData as signTypedData };
2559
+ export type { index$1_SendTransactionDependencies as SendTransactionDependencies, index$1_SendTransactionInput as SendTransactionInput, index$1_SendTransactionOutput as SendTransactionOutput, index$1_SignMessageDependencies as SignMessageDependencies, index$1_SignMessageInput as SignMessageInput, index$1_SignMessageOutput as SignMessageOutput, index$1_SignTypedDataDependencies as SignTypedDataDependencies, index$1_SignTypedDataInput as SignTypedDataInput, index$1_SignTypedDataOutput as SignTypedDataOutput };
2556
2560
  }
2557
2561
 
2558
2562
  type index_LinkWithCrossAppAuthDependencies = LinkWithCrossAppAuthDependencies;
@@ -2564,7 +2568,8 @@ type index_LoginWithCrossAppAuthOutput = LoginWithCrossAppAuthOutput;
2564
2568
  declare const index_linkWithCrossAppAuth: typeof linkWithCrossAppAuth;
2565
2569
  declare const index_loginWithCrossAppAuth: typeof loginWithCrossAppAuth;
2566
2570
  declare namespace index {
2567
- export { type index_LinkWithCrossAppAuthDependencies as LinkWithCrossAppAuthDependencies, type index_LinkWithCrossAppAuthInput as LinkWithCrossAppAuthInput, type index_LinkWithCrossAppAuthOutput as LinkWithCrossAppAuthOutput, type index_LoginWithCrossAppAuthDependencies as LoginWithCrossAppAuthDependencies, type index_LoginWithCrossAppAuthInput as LoginWithCrossAppAuthInput, type index_LoginWithCrossAppAuthOutput as LoginWithCrossAppAuthOutput, index_linkWithCrossAppAuth as linkWithCrossAppAuth, index_loginWithCrossAppAuth as loginWithCrossAppAuth, index$1 as wallet };
2571
+ export { index_linkWithCrossAppAuth as linkWithCrossAppAuth, index_loginWithCrossAppAuth as loginWithCrossAppAuth, index$1 as wallet };
2572
+ export type { index_LinkWithCrossAppAuthDependencies as LinkWithCrossAppAuthDependencies, index_LinkWithCrossAppAuthInput as LinkWithCrossAppAuthInput, index_LinkWithCrossAppAuthOutput as LinkWithCrossAppAuthOutput, index_LoginWithCrossAppAuthDependencies as LoginWithCrossAppAuthDependencies, index_LoginWithCrossAppAuthInput as LoginWithCrossAppAuthInput, index_LoginWithCrossAppAuthOutput as LoginWithCrossAppAuthOutput };
2568
2573
  }
2569
2574
 
2570
2575
  interface SignWalletRequestInput {
@@ -2618,10 +2623,12 @@ interface GenerateAuthorizationSignatureOutput {
2618
2623
  * @see {@link https://docs.privy.io/api-reference/authorization-signatures |Authorization signatures}
2619
2624
  *
2620
2625
  * @param sign A function that signs a wallet request
2621
- * @param payload The request payload to sign.
2626
+ * @param payload The request payload to sign. Can be a structured request object (which will be
2627
+ * canonicalized to JSON before signing) or a pre-serialized binary payload (`Uint8Array`) that
2628
+ * will be signed directly.
2622
2629
  * @returns The user's authorization signature over the API request.
2623
2630
  */
2624
- declare function generateAuthorizationSignature(sign: SignWalletRequest, payload: GenerateAuthorizationSignatureInput): Promise<GenerateAuthorizationSignatureOutput>;
2631
+ declare function generateAuthorizationSignature(sign: SignWalletRequest, payload: GenerateAuthorizationSignatureInput | Uint8Array): Promise<GenerateAuthorizationSignatureOutput>;
2625
2632
 
2626
2633
  type Input$3 = {
2627
2634
  request: WalletCreateParams;
@@ -2805,4 +2812,5 @@ declare const SAFE: "safe";
2805
2812
  /** @deprecated {@link SmartWalletType} is a well-typed union, use the `'thirdweb'` literal instead */
2806
2813
  declare const THIRDWEB: "thirdweb";
2807
2814
 
2808
- export { ALL_WALLET_CLIENT_TYPES, BICONOMY, COINBASE_SMART_WALLET, type Cluster, type CoinbaseAssetId, type CoinbaseWalletClientType, ConnectedStandardSolanaWallet, type ConnectorType, type CreateSiwsMessageOpts, type EIP1193Provider, EmbeddedBitcoinWalletProvider, EmbeddedProviderError, type EmbeddedWalletClientType, type EmbeddedWalletConfig, type EmbeddedWalletRecoveryOptions, type EntropyIdVerifier, type ErrorMessageMap, type ExternalWallet, type ExternalWalletMetadata, type FundingMethod, type FundingProvider, type GenerateAuthorizationSignatureInput, type GenerateAuthorizationSignatureOutput, type IdentifierString, InMemoryCache, type InjectedWalletClientType, KERNEL, LIGHT_ACCOUNT, LocalStorage, type LogLevel, type Logger, type MfaMethod, type MfaPromise, type MfaSubmitArgs, type MfaSubmitPromise, MoonpayApiError, type MoonpayTransactionStatus, type MoonpayTransactionStatusResponse, type OAuthProviderType, type OnNeedsRecovery, type PaymentOption, type PreparedTransactionRequest, PrivyApiError, PrivyClientError, PrivyConnectorError, type PrivyEmbeddedSolanaWalletProvider, PrivyEmbeddedWalletErrorCode, type PrivyEmbeddedWalletProvider, PrivyProviderRpcError, ProviderErrors, type Quantity, SAFE, SUPPORTED_CONNECTOR_TYPES, type SetRecoveryInput, SolanaClient, type SolanaCluster, type SolanaSignAndSendTransactionInput, type SolanaSignAndSendTransactionMode, type SolanaSignAndSendTransactionOptions, type SolanaSignAndSendTransactionOutput, type SolanaSignMessageInput, type SolanaSignMessageOutput, type SolanaSignTransactionInput, type SolanaSignTransactionOptions, type SolanaSignTransactionOutput, type SolanaStandardWallet, type SolanaTransactionCommitment, SolanaUsdcAddressMap, type Storage, THIRDWEB, type UnknownWalletClientType, type UnsignedTransactionRequest, type UnsignedTransactionRequestWithChainId, UsdcAddressMap, type WalletBranding, type WalletClientType, type WalletConnectWalletClientType, addSessionSigners, chainToMoonpayCurrency, countryCodesAndNumbers, create, createErrorFormatter, createSiwsMessage, index as crossApp, Privy as default, index$2 as delegatedActions, errorIndicatesMaxMfaRetries, errorIndicatesMfaCanceled, errorIndicatesMfaRateLimit, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, errorIndicatesRecoveryIsNeeded, formatLamportsAmount, formatPhoneNumber, formatTokenAmount, formatWalletAddress, formatWeiAmount, fundingMethodToMoonpayPaymentMethod, generateAuthorizationSignature, generateWalletIdempotencyKey, getAllUserEmbeddedBitcoinWallets, getAllUserEmbeddedEthereumWallets, getAllUserEmbeddedSolanaWallets, getCoinbaseOnRampUrl, getEntropyDetailsFromAccount, getEntropyDetailsFromUser, getIsTokenUsdc, getJsonRpcEndpointFromChain, getPhoneCountryCodeAndNumber, getPlaceholderPhoneNumber, getSolanaClusterDisplayName, getSolanaRpcEndpointForCluster, getSolanaUsdcMintAddressForCluster, getUserEmbeddedEthereumWallet, getUserEmbeddedSolanaWallet, getUserEmbeddedWallet, getUserSmartWallet, getWallet, isEmbeddedWalletAccount, isSupportedChainIdForCoinbaseOnramp, isSupportedChainIdForMoonpay, isUnifiedWallet, lastFourDigits, phoneNumberTypingFormatter, rawSign, removeSessionSigners, rpc, throwIfInvalidRecoveryUpgradePath, toCoinbaseAssetId, toCoinbaseBlockchainFromChainId, toObjectKeys, updateWallet, validatePhoneNumber };
2815
+ export { ALL_WALLET_CLIENT_TYPES, BICONOMY, COINBASE_SMART_WALLET, ConnectedStandardSolanaWallet, EmbeddedBitcoinWalletProvider, EmbeddedProviderError, InMemoryCache, KERNEL, LIGHT_ACCOUNT, LocalStorage, MoonpayApiError, PrivyApiError, PrivyClientError, PrivyConnectorError, PrivyEmbeddedWalletErrorCode, PrivyProviderRpcError, ProviderErrors, SAFE, SUPPORTED_CONNECTOR_TYPES, SolanaClient, SolanaUsdcAddressMap, THIRDWEB, UsdcAddressMap, addSessionSigners, chainToMoonpayCurrency, countryCodesAndNumbers, create, createErrorFormatter, createSiwsMessage, index as crossApp, Privy as default, index$2 as delegatedActions, errorIndicatesMaxMfaRetries, errorIndicatesMfaCanceled, errorIndicatesMfaRateLimit, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, errorIndicatesRecoveryIsNeeded, formatLamportsAmount, formatPhoneNumber, formatTokenAmount, formatWalletAddress, formatWeiAmount, fundingMethodToMoonpayPaymentMethod, generateAuthorizationSignature, generateWalletIdempotencyKey, getAllUserEmbeddedBitcoinWallets, getAllUserEmbeddedEthereumWallets, getAllUserEmbeddedSolanaWallets, getCoinbaseOnRampUrl, getEntropyDetailsFromAccount, getEntropyDetailsFromUser, getIsTokenUsdc, getJsonRpcEndpointFromChain, getPhoneCountryCodeAndNumber, getPlaceholderPhoneNumber, getSolanaClusterDisplayName, getSolanaRpcEndpointForCluster, getSolanaUsdcMintAddressForCluster, getUserEmbeddedEthereumWallet, getUserEmbeddedSolanaWallet, getUserEmbeddedWallet, getUserSmartWallet, getWallet, isEmbeddedWalletAccount, isSupportedChainIdForCoinbaseOnramp, isSupportedChainIdForMoonpay, isUnifiedWallet, lastFourDigits, phoneNumberTypingFormatter, rawSign, removeSessionSigners, rpc, throwIfInvalidRecoveryUpgradePath, toCoinbaseAssetId, toCoinbaseBlockchainFromChainId, toObjectKeys, updateWallet, validatePhoneNumber };
2816
+ export type { Cluster, CoinbaseAssetId, CoinbaseWalletClientType, ConnectorType, CreateSiwsMessageOpts, EIP1193Provider, EmbeddedWalletClientType, EmbeddedWalletConfig, EmbeddedWalletRecoveryOptions, EntropyIdVerifier, ErrorMessageMap, ExternalWallet, ExternalWalletMetadata, FundingMethod, FundingProvider, GenerateAuthorizationSignatureInput, GenerateAuthorizationSignatureOutput, IdentifierString, InjectedWalletClientType, LogLevel, Logger, MfaMethod, MfaPromise, MfaSubmitArgs, MfaSubmitPromise, MoonpayTransactionStatus, MoonpayTransactionStatusResponse, OAuthProviderType, OnNeedsRecovery, PaymentOption, PreparedTransactionRequest, PrivyEmbeddedSolanaWalletProvider, PrivyEmbeddedWalletProvider, Quantity, SetRecoveryInput, SolanaCluster, SolanaSignAndSendTransactionInput, SolanaSignAndSendTransactionMode, SolanaSignAndSendTransactionOptions, SolanaSignAndSendTransactionOutput, SolanaSignMessageInput, SolanaSignMessageOutput, SolanaSignTransactionInput, SolanaSignTransactionOptions, SolanaSignTransactionOutput, SolanaStandardWallet, SolanaTransactionCommitment, Storage, UnknownWalletClientType, UnsignedTransactionRequest, UnsignedTransactionRequestWithChainId, WalletBranding, WalletClientType, WalletConnectWalletClientType };
@@ -26,4 +26,5 @@ type SmartWalletClientType = Omit<SmartAccountClient<Transport, Chain, SmartAcco
26
26
  }, TPrimaryType extends string>(args: Omit<SignTypedDataParameters<TTypedData, TPrimaryType, SmartAccount>, 'account'>) => Promise<Hex>;
27
27
  };
28
28
 
29
- export { type Call, type SmartWalletClientType, signerToSmartAccountClient };
29
+ export { signerToSmartAccountClient };
30
+ export type { Call, SmartWalletClientType };
@@ -26,4 +26,5 @@ type SmartWalletClientType = Omit<SmartAccountClient<Transport, Chain, SmartAcco
26
26
  }, TPrimaryType extends string>(args: Omit<SignTypedDataParameters<TTypedData, TPrimaryType, SmartAccount>, 'account'>) => Promise<Hex>;
27
27
  };
28
28
 
29
- export { type Call, type SmartWalletClientType, signerToSmartAccountClient };
29
+ export { signerToSmartAccountClient };
30
+ export type { Call, SmartWalletClientType };
@@ -1,2 +1,2 @@
1
- import{DEFAULT_SUPPORTED_CHAINS as e,dedupeSupportedChains as r}from"@privy-io/chains";import{PrivyClientError as t}from"../Error.mjs";import{EmbeddedBitcoinWalletProvider as o}from"../embedded/EmbeddedBitcoinWalletProvider.mjs";import{errorIndicatesRecoveryIsNeeded as i}from"../embedded/errors.mjs";import{walletCreate as d}from"../embedded/stack/walletCreate.mjs";import{throwIfInvalidRecoveryUpgradePath as a}from"../embedded/utils/index.mjs";import{isUnifiedWallet as s}from"../wallet-api/unified-wallet.mjs";import{EmbeddedWalletProxy as n}from"../embedded/EmbeddedWalletProxy.mjs";import{EmbeddedWalletProvider as c}from"../embedded/EmbeddedWalletProvider.mjs";import{EmbeddedSolanaWalletProvider as l}from"../embedded/EmbeddedSolanaWalletProvider.mjs";import"../embedded/types.mjs";import"../wallet-api/create.mjs";import"@privy-io/routes";import"viem";import"../utils/sleep.mjs";import"../embedded/EventCallbackQueue.mjs";import"../embedded/withMfa.mjs";import"eventemitter3";import"@privy-io/ethereum";import"../embedded/stack/walletRpc.mjs";import"../utils/encodings.mjs";import"../wallet-api/rpc.mjs";import"../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"../wallet-api/types.mjs";import"../embedded/stack/wallet-api-eth-transaction.mjs";import"../embedded/stack/wallet-api-eth-typed-data.mjs";import"../solana/getWalletPublicKeyFromTransaction.mjs";import"../solana/isVersionedTransaction.mjs";class y{setMessagePoster(e){this._proxy=new n(e,this._mfaPromises),this._mfa.setProxy(this._proxy)}async signWithUserSigner(e){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");let r=await this._privyInternal.getAccessTokenInternal();if(!r)throw new t({error:"User must be logged in to sign a message with the user signer",code:"user_signer_sign_error"});let{signature:o}=await this._proxy.signWithUserSigner({accessToken:r,message:e.message});return{signature:o}}async add(e){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");if("user-controlled-server-wallets-only"===this._privyInternal.config?.embedded_wallet_config.mode)await d({context:{app:this._appApi,fetchPrivyRoute:(...e)=>this._privyInternal.fetch(...e),getCompiledPath:(...e)=>this._privyInternal.getPath(...e)},chainType:e.chainType});else{let r=await this._privyInternal.getAccessTokenInternal();if(!r)throw new t({error:"User must be logged in to create an embedded wallet",code:"embedded_wallet_creation_error"});await this._proxy.addWallet({accessToken:r,...e})}let{user:r}=await this._privyInternal.refreshSession();return{user:r}}async getBitcoinProvider({wallet:e,entropyId:r,entropyIdVerifier:t,recoveryPassword:i,recoveryAccessToken:d,recoverySecretOverride:a}){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");if(!await this._privyInternal.getAccessTokenInternal())throw Error("User must be logged in to create an embedded wallet");return s(e)||await this._load({entropyId:r,entropyIdVerifier:t,wallet:e,recoveryPassword:i,recoveryAccessToken:d,recoverySecretOverride:a}),new o({account:e,privyInternal:this._privyInternal,proxy:this._proxy,entropyId:r,entropyIdVerifier:t})}async create({password:e,recoveryMethod:r,recoveryToken:o,recoveryKey:i,recoverySecretOverride:a,iCloudRecordNameOverride:s,solanaAccount:n,skipCallbacks:c,idempotencyKey:l}){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");if("user-controlled-server-wallets-only"===this._privyInternal.config?.embedded_wallet_config.mode){if(r&&!r.startsWith("privy"))throw new t({error:"User-controlled server wallets do not support custom recovery methods",code:"embedded_wallet_creation_error"});await d({context:{app:this._appApi,fetchPrivyRoute:(...e)=>this._privyInternal.fetch(...e),getCompiledPath:(...e)=>this._privyInternal.getPath(...e)},chainType:"ethereum",idempotencyKey:l})}else{let t;if(t=r||(e?"user-passcode":"privy"),e&&"string"!=typeof e)throw Error("Invalid recovery password, must be a string");if("privy"===t&&this._privyInternal.config?.embedded_wallet_config.require_user_password_on_create)throw Error("Password not provided yet is required by App configuration");let d=await this._privyInternal.getAccessTokenInternal();if(!d)throw Error("User must be logged in to create an embedded wallet");let{address:c}=await this._proxy.create({accessToken:d,recoveryMethod:t,recoveryKey:i,recoveryPassword:e,recoveryAccessToken:o,recoverySecretOverride:a,iCloudRecordNameOverride:s,solanaAddress:n?.address});if(!c)throw Error("Failed to create wallet")}return await this._privyInternal.refreshSession(c)}async createSolana(e){if(!this._proxy)throw new t({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_creation_error"});if("user-controlled-server-wallets-only"===this._privyInternal.config?.embedded_wallet_config.mode)await d({context:{app:this._appApi,fetchPrivyRoute:(...e)=>this._privyInternal.fetch(...e),getCompiledPath:(...e)=>this._privyInternal.getPath(...e)},chainType:"solana",idempotencyKey:e?.idempotencyKey});else{let r=await this._privyInternal.getAccessTokenInternal();if(!r)throw new t({error:"User must be logged in to create an embedded wallet",code:"embedded_wallet_creation_error"});e?.ethereumAccount&&await this.getProvider(e.ethereumAccount);let{publicKey:o}=await this._proxy.createSolana({accessToken:r,ethereumAddress:e?.ethereumAccount?.address});if(!o)throw new t({error:"Failed to create wallet",code:"embedded_wallet_creation_error"})}return await this._privyInternal.refreshSession()}async delegateWallets({delegatedWallets:e,rootWallet:r}){if(!this._proxy)throw new t({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_creation_error"});let o=await this._privyInternal.getAccessTokenInternal();if(!o)throw new t({error:"User must be logged in to create an embedded wallet",code:"embedded_wallet_creation_error"});await this._proxy.delegateWallets({accessToken:o,delegatedWallets:e,rootWallet:r})}async getProvider(e,r,t,o,i){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");return s(e)||await this._load({wallet:e,entropyId:e.address,entropyIdVerifier:"ethereum-address-verifier",recoveryPassword:r,recoveryKey:i,recoveryAccessToken:t,recoverySecretOverride:o}),new c({account:e,entropyId:e.address,entropyIdVerifier:"ethereum-address-verifier",privyInternal:this._privyInternal,chains:this._chains,walletProxy:this._proxy,appApi:this._appApi})}async getEthereumProvider({wallet:e,entropyId:r,entropyIdVerifier:t,recoveryPassword:o,recoveryAccessToken:i,recoverySecretOverride:d,recoveryKey:a,onNeedsRecovery:n}){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");if(!await this._privyInternal.getAccessTokenInternal())throw Error("User must be logged in to create an embedded wallet");return s(e)||(!n||o||i||d||a)&&await this._load({entropyId:r,entropyIdVerifier:t,wallet:e,recoveryPassword:o,recoveryAccessToken:i,recoverySecretOverride:d,recoveryKey:a}),new c({account:e,entropyId:r,entropyIdVerifier:"ethereum-address-verifier",privyInternal:this._privyInternal,chains:this._chains,walletProxy:this._proxy,onNeedsRecovery:n,appApi:this._appApi})}async getSolanaProvider(e,r,o,i,d,a,n){if(!this._proxy)throw new t({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});return s(e)||(!n||i||d||a)&&await this._load({wallet:e,entropyId:r,entropyIdVerifier:o,recoveryPassword:i,recoveryAccessToken:d,recoverySecretOverride:a}),new l({account:e,privyInternal:this._privyInternal,proxy:this._proxy,entropyId:r,entropyIdVerifier:o,onNeedsRecovery:n,app:this._appApi})}async setRecovery(e){let{wallet:r,...o}=e;if(!this._proxy)throw Error("Embedded wallet proxy not initialized");if(s(r))throw new t({error:"This wallet does not support setting recovery methods",code:"unsupported_recovery_method"});a({currentRecoveryMethod:r.recovery_method,upgradeToRecoveryMethod:"icloud-native"===o.recoveryMethod?"icloud":o.recoveryMethod}),await this._load("solana"===r.chain_type?{wallet:r,entropyId:r.address,entropyIdVerifier:"solana-address-verifier"}:{wallet:r,entropyId:r.address,entropyIdVerifier:"ethereum-address-verifier"});let i=await this._privyInternal.getAccessTokenInternal();if(!i)throw Error("User must be logged in to interact with embedded wallets");let d=r.recovery_method;this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_set_recovery_started",{address:r.address,target_recovery_method:o.recoveryMethod,existing_recovery_method:d});try{let e;if("user-passcode"===o.recoveryMethod)e={recoveryMethod:"user-passcode",recoveryPassword:o.password};else if("google-drive"===o.recoveryMethod)e={recoveryMethod:"google-drive",recoveryAccessToken:o.recoveryAccessToken};else if("icloud"===o.recoveryMethod)e={recoveryMethod:"icloud",recoveryAccessToken:o.recoveryAccessToken};else if("icloud-native"===o.recoveryMethod)e={recoveryMethod:"icloud-native",iCloudRecordNameOverride:o.iCloudRecordNameOverride,recoverySecretOverride:o.recoverySecretOverride};else if("recovery-encryption-key"===o.recoveryMethod)e={recoveryMethod:"recovery-encryption-key",recoveryKey:o.recoveryKey};else{if("privy"!==o.recoveryMethod)throw Error(`Unknown recovery method: ${o.recoveryMethod}`);e={recoveryMethod:"privy"}}await this._proxy.setRecovery({accessToken:i,entropyId:r.address,entropyIdVerifier:"solana"===r.chain_type?"solana-address-verifier":"ethereum-address-verifier",...e}),this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_set_recovery_completed",{address:r.address,target_recovery_method:o.recoveryMethod,existing_recovery_method:d});let{user:t}=await this._privyInternal.refreshSession();return{user:t,provider:"ethereum"!==r.chain_type?null:new c({account:r,entropyId:r.address,entropyIdVerifier:"ethereum-address-verifier",privyInternal:this._privyInternal,chains:this._chains,walletProxy:this._proxy,appApi:this._appApi})}}catch(e){throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_set_recovery_failed",{address:r.address,recovery_method:r.recovery_method,error:e instanceof Error?e.message:"Unable to recover wallet"}),e}}getURL(){let e=new URL(`${this._privyInternal.baseUrl}/apps/${this._privyInternal.appId}/embedded-wallets`);return this._privyInternal.caid&&e.searchParams.append("caid",this._privyInternal.caid),this._privyInternal.appClientId&&e.searchParams.append("client_id",this._privyInternal.appClientId),e.href}get chains(){return this._chains}onMessage(e){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");return this._proxy.handleEmbeddedWalletMessages(e)}reload(){this._proxy?this._proxy.reload():console.warn("Attempted to reload proxy before initialized")}async ping(e){try{if(!this._proxy)throw Error("Embedded wallet proxy not initialized");return await this._proxy.ping(e),!0}catch(e){return console.error(e),!1}}async _load({entropyId:e,entropyIdVerifier:r,wallet:t,recoveryPassword:o,recoveryKey:d,recoveryAccessToken:a,recoverySecretOverride:s}){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");let n=await this._privyInternal.getAccessTokenInternal();if(!n)throw Error("User must be logged in to interact with embedded wallets");try{return await this._proxy.connect({accessToken:n,entropyId:e,entropyIdVerifier:r}),e}catch(c){if(i(c))try{if("privy"===t.recovery_method){this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_started",{address:t.address,recovery_method:t.recovery_method});let o=await this._proxy.recover({accessToken:n,entropyId:e,entropyIdVerifier:r});return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_completed",{address:t.address,recovery_method:t.recovery_method}),o.entropyId}if("user-passcode"===t.recovery_method&&o){this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_started",{address:t.address,recovery_method:t.recovery_method});let i=await this._proxy.recover({accessToken:n,recoveryPassword:o,entropyId:e,entropyIdVerifier:r});return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_completed",{address:t.address,recovery_method:t.recovery_method}),i.entropyId}if(["google-drive","icloud"].includes(t.recovery_method)&&a){this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_started",{address:t.address,recovery_method:t.recovery_method});let o=await this._proxy.recover({accessToken:n,recoveryAccessToken:a,entropyId:e,entropyIdVerifier:r});return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_completed",{address:t.address,recovery_method:t.recovery_method}),o.entropyId}if("icloud"===t.recovery_method&&s){this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_started",{address:t.address,recovery_method:"icloud-native"});let o=await this._proxy.recover({accessToken:n,recoverySecretOverride:s,entropyId:e,entropyIdVerifier:r});return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_completed",{address:t.address,recovery_method:"icloud-native"}),o.entropyId}if("recovery-encryption-key"===t.recovery_method&&d){this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_started",{address:t.address,recovery_method:t.recovery_method});let o=await this._proxy.recover({accessToken:n,recoveryKey:d,entropyId:e,entropyIdVerifier:r});return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_completed",{address:t.address,recovery_method:t.recovery_method}),o.entropyId}}catch(r){throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_failed",{address:t.address,recovery_method:t.recovery_method,error:r instanceof Error?r.message:`Unable to recover wallet: ${e}`}),r}throw c}}constructor(t,o,i,d,a,s){if(this._chains=Array.from(e),this._privyInternal=t,o&&(this._proxy=new n(o,a),d.setProxy(this._proxy)),i){let e=r(i);this._chains=e}this._mfa=d,this._mfaPromises=a,this._appApi=s}}export{y as default};
1
+ import{DEFAULT_SUPPORTED_CHAINS as e,dedupeSupportedChains as r}from"@privy-io/chains";import{PrivyClientError as t}from"../Error.mjs";import{EmbeddedBitcoinWalletProvider as o}from"../embedded/EmbeddedBitcoinWalletProvider.mjs";import{errorIndicatesRecoveryIsNeeded as i}from"../embedded/errors.mjs";import{walletCreate as d}from"../embedded/stack/walletCreate.mjs";import{throwIfInvalidRecoveryUpgradePath as a}from"../embedded/utils/index.mjs";import{isUnifiedWallet as s}from"../wallet-api/unified-wallet.mjs";import{EmbeddedWalletProxy as n}from"../embedded/EmbeddedWalletProxy.mjs";import{EmbeddedWalletProvider as c}from"../embedded/EmbeddedWalletProvider.mjs";import{EmbeddedSolanaWalletProvider as l}from"../embedded/EmbeddedSolanaWalletProvider.mjs";import"../embedded/types.mjs";import"../wallet-api/create.mjs";import"@privy-io/routes";import"viem";import"../utils/sleep.mjs";import"../embedded/EventCallbackQueue.mjs";import"../embedded/withMfa.mjs";import"eventemitter3";import"@privy-io/ethereum";import"../embedded/stack/walletRpc.mjs";import"../utils/encodings.mjs";import"../wallet-api/rpc.mjs";import"../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"@privy-io/encoding";import"../wallet-api/types.mjs";import"../embedded/stack/wallet-api-eth-transaction.mjs";import"../embedded/stack/wallet-api-eth-typed-data.mjs";import"../solana/getWalletPublicKeyFromTransaction.mjs";import"../solana/isVersionedTransaction.mjs";class y{setMessagePoster(e){this._proxy=new n(e,this._mfaPromises),this._mfa.setProxy(this._proxy)}async signWithUserSigner(e){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");let r=await this._privyInternal.getAccessTokenInternal();if(!r)throw new t({error:"User must be logged in to sign a message with the user signer",code:"user_signer_sign_error"});let{signature:o}=await this._proxy.signWithUserSigner({accessToken:r,message:e.message});return{signature:o}}async add(e){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");if("user-controlled-server-wallets-only"===this._privyInternal.config?.embedded_wallet_config.mode)await d({context:{app:this._appApi,fetchPrivyRoute:(...e)=>this._privyInternal.fetch(...e),getCompiledPath:(...e)=>this._privyInternal.getPath(...e)},chainType:e.chainType});else{let r=await this._privyInternal.getAccessTokenInternal();if(!r)throw new t({error:"User must be logged in to create an embedded wallet",code:"embedded_wallet_creation_error"});await this._proxy.addWallet({accessToken:r,...e})}let{user:r}=await this._privyInternal.refreshSession();return{user:r}}async getBitcoinProvider({wallet:e,entropyId:r,entropyIdVerifier:t,recoveryPassword:i,recoveryAccessToken:d,recoverySecretOverride:a}){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");if(!await this._privyInternal.getAccessTokenInternal())throw Error("User must be logged in to create an embedded wallet");return s(e)||await this._load({entropyId:r,entropyIdVerifier:t,wallet:e,recoveryPassword:i,recoveryAccessToken:d,recoverySecretOverride:a}),new o({account:e,privyInternal:this._privyInternal,proxy:this._proxy,entropyId:r,entropyIdVerifier:t})}async create({password:e,recoveryMethod:r,recoveryToken:o,recoveryKey:i,recoverySecretOverride:a,iCloudRecordNameOverride:s,solanaAccount:n,skipCallbacks:c,idempotencyKey:l}){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");if("user-controlled-server-wallets-only"===this._privyInternal.config?.embedded_wallet_config.mode){if(r&&!r.startsWith("privy"))throw new t({error:"User-controlled server wallets do not support custom recovery methods",code:"embedded_wallet_creation_error"});await d({context:{app:this._appApi,fetchPrivyRoute:(...e)=>this._privyInternal.fetch(...e),getCompiledPath:(...e)=>this._privyInternal.getPath(...e)},chainType:"ethereum",idempotencyKey:l})}else{let t;if(t=r||(e?"user-passcode":"privy"),e&&"string"!=typeof e)throw Error("Invalid recovery password, must be a string");if("privy"===t&&this._privyInternal.config?.embedded_wallet_config.require_user_password_on_create)throw Error("Password not provided yet is required by App configuration");let d=await this._privyInternal.getAccessTokenInternal();if(!d)throw Error("User must be logged in to create an embedded wallet");let{address:c}=await this._proxy.create({accessToken:d,recoveryMethod:t,recoveryKey:i,recoveryPassword:e,recoveryAccessToken:o,recoverySecretOverride:a,iCloudRecordNameOverride:s,solanaAddress:n?.address});if(!c)throw Error("Failed to create wallet")}return await this._privyInternal.refreshSession(c)}async createSolana(e){if(!this._proxy)throw new t({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_creation_error"});if("user-controlled-server-wallets-only"===this._privyInternal.config?.embedded_wallet_config.mode)await d({context:{app:this._appApi,fetchPrivyRoute:(...e)=>this._privyInternal.fetch(...e),getCompiledPath:(...e)=>this._privyInternal.getPath(...e)},chainType:"solana",idempotencyKey:e?.idempotencyKey});else{let r=await this._privyInternal.getAccessTokenInternal();if(!r)throw new t({error:"User must be logged in to create an embedded wallet",code:"embedded_wallet_creation_error"});e?.ethereumAccount&&await this.getProvider(e.ethereumAccount);let{publicKey:o}=await this._proxy.createSolana({accessToken:r,ethereumAddress:e?.ethereumAccount?.address});if(!o)throw new t({error:"Failed to create wallet",code:"embedded_wallet_creation_error"})}return await this._privyInternal.refreshSession()}async delegateWallets({delegatedWallets:e,rootWallet:r}){if(!this._proxy)throw new t({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_creation_error"});let o=await this._privyInternal.getAccessTokenInternal();if(!o)throw new t({error:"User must be logged in to create an embedded wallet",code:"embedded_wallet_creation_error"});await this._proxy.delegateWallets({accessToken:o,delegatedWallets:e,rootWallet:r})}async getProvider(e,r,t,o,i){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");return s(e)||await this._load({wallet:e,entropyId:e.address,entropyIdVerifier:"ethereum-address-verifier",recoveryPassword:r,recoveryKey:i,recoveryAccessToken:t,recoverySecretOverride:o}),new c({account:e,entropyId:e.address,entropyIdVerifier:"ethereum-address-verifier",privyInternal:this._privyInternal,chains:this._chains,walletProxy:this._proxy,appApi:this._appApi})}async getEthereumProvider({wallet:e,entropyId:r,entropyIdVerifier:t,recoveryPassword:o,recoveryAccessToken:i,recoverySecretOverride:d,recoveryKey:a,onNeedsRecovery:n}){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");if(!await this._privyInternal.getAccessTokenInternal())throw Error("User must be logged in to create an embedded wallet");return s(e)||(!n||o||i||d||a)&&await this._load({entropyId:r,entropyIdVerifier:t,wallet:e,recoveryPassword:o,recoveryAccessToken:i,recoverySecretOverride:d,recoveryKey:a}),new c({account:e,entropyId:r,entropyIdVerifier:"ethereum-address-verifier",privyInternal:this._privyInternal,chains:this._chains,walletProxy:this._proxy,onNeedsRecovery:n,appApi:this._appApi})}async getSolanaProvider(e,r,o,i,d,a,n){if(!this._proxy)throw new t({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});return s(e)||(!n||i||d||a)&&await this._load({wallet:e,entropyId:r,entropyIdVerifier:o,recoveryPassword:i,recoveryAccessToken:d,recoverySecretOverride:a}),new l({account:e,privyInternal:this._privyInternal,proxy:this._proxy,entropyId:r,entropyIdVerifier:o,onNeedsRecovery:n,app:this._appApi})}async setRecovery(e){let{wallet:r,...o}=e;if(!this._proxy)throw Error("Embedded wallet proxy not initialized");if(s(r))throw new t({error:"This wallet does not support setting recovery methods",code:"unsupported_recovery_method"});a({currentRecoveryMethod:r.recovery_method,upgradeToRecoveryMethod:"icloud-native"===o.recoveryMethod?"icloud":o.recoveryMethod}),await this._load("solana"===r.chain_type?{wallet:r,entropyId:r.address,entropyIdVerifier:"solana-address-verifier"}:{wallet:r,entropyId:r.address,entropyIdVerifier:"ethereum-address-verifier"});let i=await this._privyInternal.getAccessTokenInternal();if(!i)throw Error("User must be logged in to interact with embedded wallets");let d=r.recovery_method;this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_set_recovery_started",{address:r.address,target_recovery_method:o.recoveryMethod,existing_recovery_method:d});try{let e;if("user-passcode"===o.recoveryMethod)e={recoveryMethod:"user-passcode",recoveryPassword:o.password};else if("google-drive"===o.recoveryMethod)e={recoveryMethod:"google-drive",recoveryAccessToken:o.recoveryAccessToken};else if("icloud"===o.recoveryMethod)e={recoveryMethod:"icloud",recoveryAccessToken:o.recoveryAccessToken};else if("icloud-native"===o.recoveryMethod)e={recoveryMethod:"icloud-native",iCloudRecordNameOverride:o.iCloudRecordNameOverride,recoverySecretOverride:o.recoverySecretOverride};else if("recovery-encryption-key"===o.recoveryMethod)e={recoveryMethod:"recovery-encryption-key",recoveryKey:o.recoveryKey};else{if("privy"!==o.recoveryMethod)throw Error(`Unknown recovery method: ${o.recoveryMethod}`);e={recoveryMethod:"privy"}}await this._proxy.setRecovery({accessToken:i,entropyId:r.address,entropyIdVerifier:"solana"===r.chain_type?"solana-address-verifier":"ethereum-address-verifier",...e}),this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_set_recovery_completed",{address:r.address,target_recovery_method:o.recoveryMethod,existing_recovery_method:d});let{user:t}=await this._privyInternal.refreshSession();return{user:t,provider:"ethereum"!==r.chain_type?null:new c({account:r,entropyId:r.address,entropyIdVerifier:"ethereum-address-verifier",privyInternal:this._privyInternal,chains:this._chains,walletProxy:this._proxy,appApi:this._appApi})}}catch(e){throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_set_recovery_failed",{address:r.address,recovery_method:r.recovery_method,error:e instanceof Error?e.message:"Unable to recover wallet"}),e}}getURL(){let e=new URL(`${this._privyInternal.baseUrl}/apps/${this._privyInternal.appId}/embedded-wallets`);return this._privyInternal.caid&&e.searchParams.append("caid",this._privyInternal.caid),this._privyInternal.appClientId&&e.searchParams.append("client_id",this._privyInternal.appClientId),e.href}get chains(){return this._chains}onMessage(e){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");return this._proxy.handleEmbeddedWalletMessages(e)}reload(){this._proxy?this._proxy.reload():this._privyInternal.logger.warn("Attempted to reload proxy before initialized")}async ping(e){try{if(!this._proxy)throw Error("Embedded wallet proxy not initialized");return await this._proxy.ping(e),!0}catch(e){return this._privyInternal.logger.debug(e),!1}}async _load({entropyId:e,entropyIdVerifier:r,wallet:t,recoveryPassword:o,recoveryKey:d,recoveryAccessToken:a,recoverySecretOverride:s}){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");let n=await this._privyInternal.getAccessTokenInternal();if(!n)throw Error("User must be logged in to interact with embedded wallets");try{return await this._proxy.connect({accessToken:n,entropyId:e,entropyIdVerifier:r}),e}catch(c){if(i(c))try{if("privy"===t.recovery_method){this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_started",{address:t.address,recovery_method:t.recovery_method});let o=await this._proxy.recover({accessToken:n,entropyId:e,entropyIdVerifier:r});return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_completed",{address:t.address,recovery_method:t.recovery_method}),o.entropyId}if("user-passcode"===t.recovery_method&&o){this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_started",{address:t.address,recovery_method:t.recovery_method});let i=await this._proxy.recover({accessToken:n,recoveryPassword:o,entropyId:e,entropyIdVerifier:r});return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_completed",{address:t.address,recovery_method:t.recovery_method}),i.entropyId}if(["google-drive","icloud"].includes(t.recovery_method)&&a){this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_started",{address:t.address,recovery_method:t.recovery_method});let o=await this._proxy.recover({accessToken:n,recoveryAccessToken:a,entropyId:e,entropyIdVerifier:r});return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_completed",{address:t.address,recovery_method:t.recovery_method}),o.entropyId}if("icloud"===t.recovery_method&&s){this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_started",{address:t.address,recovery_method:"icloud-native"});let o=await this._proxy.recover({accessToken:n,recoverySecretOverride:s,entropyId:e,entropyIdVerifier:r});return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_completed",{address:t.address,recovery_method:"icloud-native"}),o.entropyId}if("recovery-encryption-key"===t.recovery_method&&d){this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_started",{address:t.address,recovery_method:t.recovery_method});let o=await this._proxy.recover({accessToken:n,recoveryKey:d,entropyId:e,entropyIdVerifier:r});return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_completed",{address:t.address,recovery_method:t.recovery_method}),o.entropyId}}catch(r){throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_failed",{address:t.address,recovery_method:t.recovery_method,error:r instanceof Error?r.message:`Unable to recover wallet: ${e}`}),r}throw c}}constructor(t,o,i,d,a,s){if(this._chains=Array.from(e),this._privyInternal=t,o&&(this._proxy=new n(o,a),d.setProxy(this._proxy)),i){let e=r(i);this._chains=e}this._mfa=d,this._mfaPromises=a,this._appApi=s}}export{y as default};
2
2
  //# sourceMappingURL=EmbeddedWalletApi.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmbeddedWalletApi.mjs","sources":["../../../src/client/EmbeddedWalletApi.ts"],"names":["EmbeddedWalletApi","setMessagePoster","poster","this","_proxy","EmbeddedWalletProxy","_mfaPromises","_mfa","setProxy","signWithUserSigner","opts","Error","accessToken","_privyInternal","getAccessTokenInternal","PrivyClientError","error","code","signature","message","add","config","embedded_wallet_config","mode","walletCreate","context","app","_appApi","fetchPrivyRoute","args","fetch","getCompiledPath","getPath","chainType","addWallet","user","refreshSession","getBitcoinProvider","wallet","entropyId","entropyIdVerifier","recoveryPassword","recoveryAccessToken","recoverySecretOverride","isUnifiedWallet","_load","EmbeddedBitcoinWalletProvider","account","privyInternal","proxy","create","password","recoveryMethod","recoveryToken","recoveryKey","iCloudRecordNameOverride","solanaAccount","skipCallbacks","idempotencyKey","walletMode","startsWith","parsedRecoveryMethod","require_user_password_on_create","address","solanaAddress","createSolana","ethereumAccount","getProvider","publicKey","ethereumAddress","delegateWallets","delegatedWallets","rootWallet","EmbeddedWalletProvider","chains","_chains","walletProxy","appApi","getEthereumProvider","onNeedsRecovery","getSolanaProvider","EmbeddedSolanaWalletProvider","setRecovery","setRecoveryInput","recoveryArgs","throwIfInvalidRecoveryUpgradePath","currentRecoveryMethod","recovery_method","upgradeToRecoveryMethod","chain_type","existingRecoveryMethod","createAnalyticsEvent","target_recovery_method","existing_recovery_method","recoveryOnlyArgs","provider","e","getURL","url","URL","baseUrl","appId","caid","searchParams","append","appClientId","href","onMessage","event","handleEmbeddedWalletMessages","reload","console","warn","ping","timeoutMs","connect","err","errorIndicatesRecoveryIsNeeded","recovered","recover","includes","constructor","embeddedWalletMessagePoster","mfa","mfaPromises","Array","from","DEFAULT_SUPPORTED_CHAINS","d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sCAAuC,CACnF5B,QAASzB,EAAOyB,QAChBwB,gBAAiBjD,EAAOiD,gBACxBvE,MAAOgF,aAAarF,MAAQqF,EAAE7E,QAAU,6BAA6BoB,MAEjEyD,CACR,CAKA,MAAMoB,CAEV,CACF,CAz6BAK,WAAAA,CACEzE,EACA0E,EACAhD,EACAiD,EACAC,EACA/C,GASA,GAtCD1E,KACOwE,QAAgCkD,MAAMC,KAC5CC,GA6BA5H,KAAKU,eAAiBmC,EAElB0E,IACFvH,KAAKC,OAAS,IAAIC,EAAoBqH,EAA6BE,GACnED,EAAInH,SAASL,KAAKC,SAGhBsE,EAAQ,CACV,IAAMsD,EAAgBC,EAAsBvD,GAC5CvE,KAAKwE,QAAUqD,CACjB,CAEA7H,KAAKI,KAAOoH,EACZxH,KAAKG,aAAesH,EACpBzH,KAAKwB,QAAUkD,CACjB"}
1
+ {"version":3,"file":"EmbeddedWalletApi.mjs","sources":["../../../src/client/EmbeddedWalletApi.ts"],"names":["EmbeddedWalletApi","setMessagePoster","poster","this","_proxy","EmbeddedWalletProxy","_mfaPromises","_mfa","setProxy","signWithUserSigner","opts","Error","accessToken","_privyInternal","getAccessTokenInternal","PrivyClientError","error","code","signature","message","add","config","embedded_wallet_config","mode","walletCreate","context","app","_appApi","fetchPrivyRoute","args","fetch","getCompiledPath","getPath","chainType","addWallet","user","refreshSession","getBitcoinProvider","wallet","entropyId","entropyIdVerifier","recoveryPassword","recoveryAccessToken","recoverySecretOverride","isUnifiedWallet","_load","EmbeddedBitcoinWalletProvider","account","privyInternal","proxy","create","password","recoveryMethod","recoveryToken","recoveryKey","iCloudRecordNameOverride","solanaAccount","skipCallbacks","idempotencyKey","walletMode","startsWith","parsedRecoveryMethod","require_user_password_on_create","address","solanaAddress","createSolana","ethereumAccount","getProvider","publicKey","ethereumAddress","delegateWallets","delegatedWallets","rootWallet","EmbeddedWalletProvider","chains","_chains","walletProxy","appApi","getEthereumProvider","onNeedsRecovery","getSolanaProvider","EmbeddedSolanaWalletProvider","setRecovery","setRecoveryInput","recoveryArgs","throwIfInvalidRecoveryUpgradePath","currentRecoveryMethod","recovery_method","upgradeToRecoveryMethod","chain_type","existingRecoveryMethod","createAnalyticsEvent","target_recovery_method","existing_recovery_method","recoveryOnlyArgs","provider","e","getURL","url","URL","baseUrl","appId","caid","searchParams","append","appClientId","href","onMessage","event","handleEmbeddedWalletMessages","reload","logger","warn","ping","timeoutMs","debug","connect","err","errorIndicatesRecoveryIsNeeded","recovered","recover","includes","constructor","embeddedWalletMessagePoster","mfa","mfaPromises","Array","from","DEFAULT_SUPPORTED_CHAINS","dedupedChains","dedupeSupportedChains"],"mappings":"07CAmEe,MAAMA,EAoEZC,gBAAAA,CAAiBC,GACtBC,KAAKC,OAAS,IAAIC,EAAoBH,EAAQC,KAAKG,cACnDH,KAAKI,KAAKC,SAASL,KAAKC,OAC1B,CAWA,wBAAaK,CAAmBC,GAC9B,IAAKP,KAAKC,OACR,MAAMO,MAAU,yCAGlB,IAAMC,QAAoBT,KAAKU,eAAeC,yBAC9C,IAAKF,EACH,MAAM,IAAIG,EAAiB,CACzBC,MAAO,gEACPC,KAAM,2BAIV,IAAOC,UAAAA,SAAmBf,KAAKC,OAAOK,mBAAmB,CACvDG,YAAAA,EACAO,QAAST,EAAKS,UAGhB,MAAO,CAACD,UAAAA,EACV,CAeA,SAAaE,CAAIV,GAMf,IAAKP,KAAKC,OACR,MAAMO,MAAU,yCAIlB,GAAmB,wCADAR,KAAKU,eAAeQ,QAAQC,uBAAuBC,WAE9DC,EAAa,CACjBC,QAAS,CACPC,IAAKvB,KAAKwB,QACVC,gBAAiB,IAAIC,IAAS1B,KAAKU,eAAeiB,SAASD,GAC3DE,gBAAiB,IAAIF,IAAS1B,KAAKU,eAAemB,WAAWH,IAE/DI,UAAWvB,EAAKuB,gBAEb,CACL,IAAMrB,QAAoBT,KAAKU,eAAeC,yBAC9C,IAAKF,EACH,MAAM,IAAIG,EAAiB,CACzBC,MAAO,sDACPC,KAAM,yCAIJd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iD,iBAAiDjC,EAAa,CAClEnD,KAAKU,eAAe8E,qBAAqB,uCAAwC,CACpF5B,QAASzB,EAAOyB,QAChBwB,gBAAiBjD,EAAOiD,kBAG1B,IAAMgC,QAAkBpH,KAAKC,OAAOoH,QAAQ,CAC1C5G,YAAAA,EACA0C,YAAAA,EACAf,UAAAA,EACAC,kBAAAA,IAWF,OARKrC,KAAKU,eAAe8E,qBACvB,yCACA,CACE5B,QAASzB,EAAOyB,QAChBwB,gBAAiBjD,EAAOiD,kBAIrBgC,EAAUhF,SAAS,CAE9B,CAAE,MAAOyD,GAMP,MALK7F,KAAKU,eAAe8E,qBAAqB,sCAAuC,CACnF5B,QAASzB,EAAOyB,QAChBwB,gBAAiBjD,EAAOiD,gBACxBvE,MAAOgF,aAAarF,MAAQqF,EAAE7E,QAAU,6BAA6BoB,MAEjEyD,CACR,CAKA,MAAMqB,CAEV,CACF,CAz6BAK,WAAAA,CACE1E,EACA2E,EACAjD,EACAkD,EACAC,EACAhD,GASA,GAtCD1E,KACOwE,QAAgCmD,MAAMC,KAC5CC,GA6BA7H,KAAKU,eAAiBmC,EAElB2E,IACFxH,KAAKC,OAAS,IAAIC,EAAoBsH,EAA6BE,GACnED,EAAIpH,SAASL,KAAKC,SAGhBsE,EAAQ,CACV,IAAMuD,EAAgBC,EAAsBxD,GAC5CvE,KAAKwE,QAAUsD,CACjB,CAEA9H,KAAKI,KAAOqH,EACZzH,KAAKG,aAAeuH,EACpB1H,KAAKwB,QAAUkD,CACjB"}
@@ -1,2 +1,2 @@
1
- import e from"./AppApi.mjs";import t from"./CrossAppApi.mjs";import i from"./DelegatedWalletsApi.mjs";import r from"./EmbeddedWalletApi.mjs";import s from"./MfaPromises.mjs";import{PrivyInternal as m}from"./PrivyInternal.mjs";import o from"./UserApi.mjs";import a from"./auth/AuthApi.mjs";import p from"./funding/FundingApi.mjs";import l from"./mfa/MfaApi.mjs";import n from"./recovery/RecoveryApi.mjs";import"@privy-io/routes";import"../Token.mjs";import"jose";import"@privy-io/chains";import"../Error.mjs";import"../embedded/EmbeddedBitcoinWalletProvider.mjs";import"../wallet-api/unified-wallet.mjs";import"../embedded/errors.mjs";import"../embedded/types.mjs";import"../embedded/stack/walletCreate.mjs";import"../wallet-api/create.mjs";import"../embedded/utils/index.mjs";import"viem";import"../embedded/EmbeddedWalletProxy.mjs";import"../utils/sleep.mjs";import"../embedded/EventCallbackQueue.mjs";import"../embedded/withMfa.mjs";import"../embedded/EmbeddedWalletProvider.mjs";import"eventemitter3";import"@privy-io/ethereum";import"../embedded/stack/walletRpc.mjs";import"../utils/encodings.mjs";import"../wallet-api/rpc.mjs";import"../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"../wallet-api/types.mjs";import"../embedded/stack/wallet-api-eth-transaction.mjs";import"../embedded/stack/wallet-api-eth-typed-data.mjs";import"../embedded/EmbeddedSolanaWalletProvider.mjs";import"../solana/getWalletPublicKeyFromTransaction.mjs";import"../solana/isVersionedTransaction.mjs";import"fetch-retry";import"uuid";import"@privy-io/api-base";import"../Session.mjs";import"js-cookie";import"../utils/allSettled.mjs";import"../toAbortSignalTimeout.mjs";import"../utils/toSearchParams.mjs";import"./logger.mjs";import"../utils/noop.mjs";import"./auth/CustomProviderApi.mjs";import"./auth/maybeCreateWalletOnLogin.mjs";import"../utils/getUserEmbeddedEthereumWallet.mjs";import"../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../utils/embedded-wallets.mjs";import"../utils/getUserEmbeddedSolanaWallet.mjs";import"../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../utils/shouldCreateEmbeddedEthWallet.mjs";import"../utils/shouldCreateEmbeddedSolWallet.mjs";import"./auth/EmailApi.mjs";import"./auth/FarcasterApi.mjs";import"./auth/FarcasterV2Api.mjs";import"./auth/GuestApi.mjs";import"./auth/OAuthApi.mjs";import"../pkce.mjs";import"./auth/PasskeyApi.mjs";import"./auth/PhoneApi.mjs";import"./auth/SiweApi.mjs";import"./auth/SiwsApi.mjs";import"./auth/SmartWalletApi.mjs";import"./funding/CoinbaseOnRampApi.mjs";import"./funding/MoonpayOnRampApi.mjs";import"../funding/moonpay.mjs";import"./mfa/MfaPasskeyApi.mjs";import"./mfa/MfaSmsApi.mjs";import"./recovery/RecoveryICloudApi.mjs";import"./recovery/RecoveryOAuthApi.mjs";class d{async initialize(){await this._privyInternal._initialize()}setMessagePoster(e){this.embeddedWallet.setMessagePoster(e)}addOAuthTokensListener(e){return this._privyInternal.session.on("oauth_tokens_granted",e),{unsubscribe:()=>{this._privyInternal.session.removeListener("oauth_tokens_granted",e)}}}setCallbacks(e){this._privyInternal.setCallbacks(e)}getAccessToken(){return this._privyInternal.getAccessToken()}getIdentityToken(){return this._privyInternal.getIdentityToken()}getCompiledPath(e,t){return this._privyInternal.getPath(e,t)}async fetchPrivyRoute(e,t){return this._privyInternal.fetch(e,t)}get logger(){return this._privyInternal.logger}constructor({clientId:d,...h}){this._privyInternal=new m({...h,appClientId:d}),this.mfa=new l(this._privyInternal),this.mfaPromises=new s,this.app=new e(this._privyInternal),this.embeddedWallet=new r(this._privyInternal,h.embeddedWalletMessagePoster,h.supportedChains,this.mfa,this.mfaPromises,this.app),this.user=new o(this._privyInternal),this.auth=new a(this._privyInternal,this.embeddedWallet,h.storage,h.crypto,this.mfa),this.recovery=new n(this._privyInternal,h.storage,h.crypto),this.funding=new p(this._privyInternal),this.delegated=new i(this._privyInternal),this.crossApp=new t(this._privyInternal,h.storage)}}export{d as default};
1
+ import e from"./AppApi.mjs";import t from"./CrossAppApi.mjs";import i from"./DelegatedWalletsApi.mjs";import r from"./EmbeddedWalletApi.mjs";import m from"./MfaPromises.mjs";import{PrivyInternal as s}from"./PrivyInternal.mjs";import o from"./UserApi.mjs";import a from"./auth/AuthApi.mjs";import p from"./funding/FundingApi.mjs";import n from"./mfa/MfaApi.mjs";import l from"./recovery/RecoveryApi.mjs";import"@privy-io/routes";import"../Token.mjs";import"jose";import"@privy-io/chains";import"../Error.mjs";import"../embedded/EmbeddedBitcoinWalletProvider.mjs";import"../wallet-api/unified-wallet.mjs";import"../embedded/errors.mjs";import"../embedded/types.mjs";import"../embedded/stack/walletCreate.mjs";import"../wallet-api/create.mjs";import"../embedded/utils/index.mjs";import"viem";import"../embedded/EmbeddedWalletProxy.mjs";import"../utils/sleep.mjs";import"../embedded/EventCallbackQueue.mjs";import"../embedded/withMfa.mjs";import"../embedded/EmbeddedWalletProvider.mjs";import"eventemitter3";import"@privy-io/ethereum";import"../embedded/stack/walletRpc.mjs";import"../utils/encodings.mjs";import"../wallet-api/rpc.mjs";import"../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"@privy-io/encoding";import"../wallet-api/types.mjs";import"../embedded/stack/wallet-api-eth-transaction.mjs";import"../embedded/stack/wallet-api-eth-typed-data.mjs";import"../embedded/EmbeddedSolanaWalletProvider.mjs";import"../solana/getWalletPublicKeyFromTransaction.mjs";import"../solana/isVersionedTransaction.mjs";import"fetch-retry";import"uuid";import"@privy-io/api-base";import"../Session.mjs";import"js-cookie";import"../utils/allSettled.mjs";import"../toAbortSignalTimeout.mjs";import"../utils/toSearchParams.mjs";import"./logger.mjs";import"../utils/noop.mjs";import"./auth/CustomProviderApi.mjs";import"./auth/maybeCreateWalletOnLogin.mjs";import"../utils/getUserEmbeddedEthereumWallet.mjs";import"../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../utils/embedded-wallets.mjs";import"../utils/getUserEmbeddedSolanaWallet.mjs";import"../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../utils/shouldCreateEmbeddedEthWallet.mjs";import"../utils/shouldCreateEmbeddedSolWallet.mjs";import"./auth/EmailApi.mjs";import"./auth/FarcasterApi.mjs";import"./auth/FarcasterV2Api.mjs";import"./auth/GuestApi.mjs";import"./auth/OAuthApi.mjs";import"../pkce.mjs";import"./auth/PasskeyApi.mjs";import"./auth/PhoneApi.mjs";import"./auth/SiweApi.mjs";import"./auth/SiwsApi.mjs";import"./auth/SmartWalletApi.mjs";import"./funding/CoinbaseOnRampApi.mjs";import"./funding/MoonpayOnRampApi.mjs";import"../funding/moonpay.mjs";import"./mfa/MfaPasskeyApi.mjs";import"./mfa/MfaSmsApi.mjs";import"./recovery/RecoveryICloudApi.mjs";import"./recovery/RecoveryOAuthApi.mjs";class d{async initialize(){await this._privyInternal._initialize()}setMessagePoster(e){this.embeddedWallet.setMessagePoster(e)}addOAuthTokensListener(e){return this._privyInternal.session.on("oauth_tokens_granted",e),{unsubscribe:()=>{this._privyInternal.session.removeListener("oauth_tokens_granted",e)}}}setCallbacks(e){this._privyInternal.setCallbacks(e)}getAccessToken(){return this._privyInternal.getAccessToken()}getIdentityToken(){return this._privyInternal.getIdentityToken()}getCompiledPath(e,t){return this._privyInternal.getPath(e,t)}async fetchPrivyRoute(e,t){return this._privyInternal.fetch(e,t)}get logger(){return this._privyInternal.logger}constructor({clientId:d,...h}){this._privyInternal=new s({...h,appClientId:d}),this.mfa=new n(this._privyInternal),this.mfaPromises=new m,this.app=new e(this._privyInternal),this.embeddedWallet=new r(this._privyInternal,h.embeddedWalletMessagePoster,h.supportedChains,this.mfa,this.mfaPromises,this.app),this.user=new o(this._privyInternal),this.auth=new a(this._privyInternal,this.embeddedWallet,h.storage,h.crypto,this.mfa),this.recovery=new l(this._privyInternal,h.storage,h.crypto),this.funding=new p(this._privyInternal),this.delegated=new i(this._privyInternal),this.crossApp=new t(this._privyInternal,h.storage)}}export{d as default};
2
2
  //# sourceMappingURL=Privy.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Privy.mjs","sources":["../../../src/client/Privy.ts"],"names":["Privy","initialize","this","_privyInternal","_initialize","setMessagePoster","poster","embeddedWallet","addOAuthTokensListener","listener","session","on","unsubscribe","removeListener","setCallbacks","callbacks","getAccessToken","getIdentityToken","getCompiledPath","r","opts","getPath","fetchPrivyRoute","fetch","logger","constructor","clientId","o","PrivyInternal","appClientId","mfa","MfaApi","mfaPromises","MfaPromises","app","AppApi","EmbeddedWalletApi","embeddedWalletMessagePoster","supportedChains","user","UserApi","auth","AuthApi","storage","crypto","recovery","RecoveryApi","funding","FundingApi","delegated","DelegatedWalletsApi","crossApp","CrossAppApi"],"mappings":"usFAgFe,MAAMA,EAsGnB,gBAAaC,SACLC,KAAKC,eAAeC,aAC5B,CAEA,gBAAAC,CAAwBC,GACtBJ,KAAKK,eAAeF,iBAAiBC,EACvC,CAQA,sBAAAE,CAA8BC,GAE5B,OADAP,KAAKC,eAAeO,QAAQC,GAAG,uBAAwBF,GAChD,CACLG,YAAa,KACXV,KAAKC,eAAeO,QAAQG,eAAe,uBAAwBJ,EAAAA,EAGzE,CAKA,YAAAK,CAAoBC,GAClBb,KAAKC,eAAeW,aAAaC,EACnC,CAEA,cAAAC,GACE,OAAOd,KAAKC,eAAea,gBAC7B,CAEOC,gBAAAA,GACL,OAAOf,KAAKC,eAAec,kBAC7B,CAEOC,eAAAA,CACLC,EACAC,GAMA,OAAOlB,KAAKC,eAAekB,QAAQF,EAAGC,EACxC,CAEA,qBAAaE,CACXH,EACAC,GAOA,OAAOlB,KAAKC,eAAeoB,MAAMJ,EAAGC,EACtC,CAKA,UAAWI,GACT,OAAOtB,KAAKC,eAAeqB,MAC7B,CA/GA,WAAAC,EAAoBC,SAAAA,KAAaC,IAE/BzB,KAAKC,eAAiB,IAAIyB,EAAc,IACnCD,EACHE,YAAaH,IAIfxB,KAAK4B,IAAM,IAAIC,EAAO7B,KAAKC,gBAC3BD,KAAK8B,YAAc,IAAIC,EAGvB/B,KAAKgC,IAAM,IAAIC,EAAOjC,KAAKC,gBAG3BD,KAAKK,eAAiB,IAAI6B,EACxBlC,KAAKC,eACLwB,EAAEU,4BACFV,EAAEW,gBACFpC,KAAK4B,IACL5B,KAAK8B,YACL9B,KAAKgC,KAIPhC,KAAKqC,KAAO,IAAIC,EAAQtC,KAAKC,gBAC7BD,KAAKuC,KAAO,IAAIC,EACdxC,KAAKC,eACLD,KAAKK,eACLoB,EAAEgB,QACFhB,EAAEiB,OACF1C,KAAK4B,KAEP5B,KAAK2C,SAAW,IAAIC,EAAY5C,KAAKC,eAAgBwB,EAAEgB,QAAShB,EAAEiB,QAClE1C,KAAK6C,QAAU,IAAIC,EAAW9C,KAAKC,gBACnCD,KAAK+C,UAAY,IAAIC,EAAoBhD,KAAKC,gBAC9CD,KAAKiD,SAAW,IAAIC,EAAYlD,KAAKC,eAAgBwB,EAAEgB,QACzD"}
1
+ {"version":3,"file":"Privy.mjs","sources":["../../../src/client/Privy.ts"],"names":["Privy","initialize","this","_privyInternal","_initialize","setMessagePoster","poster","embeddedWallet","addOAuthTokensListener","listener","session","on","unsubscribe","removeListener","setCallbacks","callbacks","getAccessToken","getIdentityToken","getCompiledPath","r","opts","getPath","fetchPrivyRoute","fetch","logger","constructor","clientId","o","PrivyInternal","appClientId","mfa","MfaApi","mfaPromises","MfaPromises","app","AppApi","EmbeddedWalletApi","embeddedWalletMessagePoster","supportedChains","user","UserApi","auth","AuthApi","storage","crypto","recovery","RecoveryApi","funding","FundingApi","delegated","DelegatedWalletsApi","crossApp","CrossAppApi"],"mappings":"kuFAgFe,MAAMA,EAsGnB,gBAAaC,SACLC,KAAKC,eAAeC,aAC5B,CAEA,gBAAAC,CAAwBC,GACtBJ,KAAKK,eAAeF,iBAAiBC,EACvC,CAQA,sBAAAE,CAA8BC,GAE5B,OADAP,KAAKC,eAAeO,QAAQC,GAAG,uBAAwBF,GAChD,CACLG,YAAa,KACXV,KAAKC,eAAeO,QAAQG,eAAe,uBAAwBJ,EAAAA,EAGzE,CAKA,YAAAK,CAAoBC,GAClBb,KAAKC,eAAeW,aAAaC,EACnC,CAEA,cAAAC,GACE,OAAOd,KAAKC,eAAea,gBAC7B,CAEOC,gBAAAA,GACL,OAAOf,KAAKC,eAAec,kBAC7B,CAEOC,eAAAA,CACLC,EACAC,GAMA,OAAOlB,KAAKC,eAAekB,QAAQF,EAAGC,EACxC,CAEA,qBAAaE,CACXH,EACAC,GAOA,OAAOlB,KAAKC,eAAeoB,MAAMJ,EAAGC,EACtC,CAKA,UAAWI,GACT,OAAOtB,KAAKC,eAAeqB,MAC7B,CA/GA,WAAAC,EAAoBC,SAAAA,KAAaC,IAE/BzB,KAAKC,eAAiB,IAAIyB,EAAc,IACnCD,EACHE,YAAaH,IAIfxB,KAAK4B,IAAM,IAAIC,EAAO7B,KAAKC,gBAC3BD,KAAK8B,YAAc,IAAIC,EAGvB/B,KAAKgC,IAAM,IAAIC,EAAOjC,KAAKC,gBAG3BD,KAAKK,eAAiB,IAAI6B,EACxBlC,KAAKC,eACLwB,EAAEU,4BACFV,EAAEW,gBACFpC,KAAK4B,IACL5B,KAAK8B,YACL9B,KAAKgC,KAIPhC,KAAKqC,KAAO,IAAIC,EAAQtC,KAAKC,gBAC7BD,KAAKuC,KAAO,IAAIC,EACdxC,KAAKC,eACLD,KAAKK,eACLoB,EAAEgB,QACFhB,EAAEiB,OACF1C,KAAK4B,KAEP5B,KAAK2C,SAAW,IAAIC,EAAY5C,KAAKC,eAAgBwB,EAAEgB,QAAShB,EAAEiB,QAClE1C,KAAK6C,QAAU,IAAIC,EAAW9C,KAAKC,gBACnCD,KAAK+C,UAAY,IAAIC,EAAoBhD,KAAKC,gBAC9CD,KAAKiD,SAAW,IAAIC,EAAYlD,KAAKC,eAAgBwB,EAAEgB,QACzD"}
@@ -1,2 +1,2 @@
1
- import e from"fetch-retry";import{v4 as t}from"uuid";import{PrivyErrorCode as s}from"@privy-io/api-base";import{getPathWithParams as i,AppConfig as r,AnalyticsEvent as a,RefreshSession as o}from"@privy-io/routes";import{PrivyClientError as n,PrivyApiError as h}from"../Error.mjs";import{Session as c}from"../Session.mjs";import l from"../toAbortSignalTimeout.mjs";import{toSearchParams as g}from"../utils/toSearchParams.mjs";import{toLoggerWithLevel as d}from"./logger.mjs";import"eventemitter3";import"jose";import"js-cookie";import"../Token.mjs";import"../utils/allSettled.mjs";import"../utils/noop.mjs";let p="privy:caid";class u{setCallbacks(e){this.callbacks={...this.callbacks,...e}}get isReady(){return!!this._config}get config(){return this._config}get caid(){return this._analyticsId}async _initialize(){if(this.isReady)this.callbacks?.setIsReady?.(!0);else{if(!await this.isStorageAccessible())throw new n({code:"storage_error",error:"Unable to access storage"});this._config=await this.getAppConfig(),this._config?.custom_api_url&&(this.baseUrl=this._config.custom_api_url,this.session.isUsingServerCookies=!0),this.callbacks?.setIsReady?.(!0),this._sdkVersion.startsWith("react-auth:")||this.createAnalyticsEvent("sdk_initialize",{})}}getPath(e,{params:t,query:s}){return`${this.baseUrl}${i(e.path,t)}${g(s)}`}async fetch(e,{body:t,params:s,query:i,headers:r,onRequest:a=this._beforeRequest.bind(this)}){let o=new Request(this.getPath(e,{params:s,query:i}),{method:e.method,body:JSON.stringify(t),headers:r}),n=await a(o),c=await this._fetch(o,n),l=await c.json();if(c.status>299)throw new h({...l,status:c.status});return l}async _beforeRequestWithoutInitialize(e){let t=await this.session.getPrivyAccessToken()??await this.session.getCustomerAccessToken(),s=new Headers(e.headers);s.set("privy-app-id",this.appId),this.appClientId&&s.set("privy-client-id",this.appClientId),s.set("privy-client",this._sdkVersion),t&&s.set("Authorization",`Bearer ${t}`),s.set("Content-Type","application/json"),s.set("Accept","application/json");let i=await this._getOrGenerateClientAnalyticsId();return i&&s.set("privy-ca-id",i),this.nativeAppIdentifier&&s.set("x-native-app-identifier",this.nativeAppIdentifier),{signal:l(2e4),headers:s,credentials:"include"}}async beforeRequestWithoutRefresh(e){return await this._initialize(),this._beforeRequestWithoutInitialize(e)}async _beforeRequest(e){return await this._initialize(),await this.getAccessTokenInternal(),this.beforeRequestWithoutRefresh(e)}async getAppConfig(){return await this.fetch(r,{params:{app_id:this.appId},onRequest:this._beforeRequestWithoutInitialize.bind(this)})}async _getOrGenerateClientAnalyticsId(){if(this._analyticsId)return this._analyticsId;try{let e=await this._storage.get(p);if("string"==typeof e&&e.length>0)return this._analyticsId=e,e}catch(e){this.logger.error("Unable to load clientId",e)}try{this._analyticsId=t()}catch(e){this.logger.error("Unable to generate uuidv4",e)}if(this._analyticsId){try{await this._storage.put(p,this._analyticsId)}catch(e){this.logger.error(`Unable to store clientId: ${this._analyticsId}`,e)}return this._analyticsId}}async destroyClientAnalyticsId(){try{return await this._storage.del(p)}catch(e){this.logger.error("Unable to delete clientId",e)}}async createAnalyticsEvent(e,t){try{await this.fetch(a,{body:{event_name:e,client_id:await this._getOrGenerateClientAnalyticsId(),payload:t},onRequest:this.beforeRequestWithoutRefresh.bind(this)})}catch(e){}}async refreshSession(e=!1){if(!await this.isStorageAccessible())throw new n({code:"storage_error",error:"Unable to access storage"});let t=await this.session.getRefreshToken()??void 0,s=t??"key",i=this._cache.get(s);if(i)return this.logger.debug("[privy:refresh] found in-flight session refresh request, deduping"),await i;let r=this._refreshSession(t,e);this._cache.set(s,r);try{return await r}finally{this._cache.delete(s)}}async _refreshSession(e,t){let i=await this.session.getCustomerAccessToken();if(!this.session.hasRefreshCredentials(i,e??null))throw this.logger.debug("[privy:refresh] missing tokens, skipping request"),await this._initialize(),new h({code:s.MISSING_OR_INVALID_TOKEN,error:"No tokens found in storage",status:401});try{this.logger.debug(`[privy:refresh] fetching: ${o.path}`);let s=await this.fetch(o,{body:{refresh_token:e},onRequest:this.beforeRequestWithoutRefresh.bind(this)}),i=s.session_update_action;return this.logger.debug(`[privy:refresh] response: ${i}`),"set"===i&&(await this.session.updateWithTokensResponse(s),this.logger.debug("[privy:refresh] tokens stored")),"clear"===i&&(await this.session.destroyLocalState(),this.logger.debug("[privy:refresh] tokens cleared"),t||this.callbacks?.setUser?.(null)),"ignore"===i&&(s.token&&(await this.session.storeCustomerAccessToken(s.token),this.logger.debug("[privy:refresh] token stored (CAT)")),s.privy_access_token&&(await this.session.storePrivyAccessToken(s.privy_access_token),this.logger.debug("[privy:refresh] token stored (PAT)")),s.identity_token&&(this.logger.debug("[privy:refresh] token stored (IDT)"),await this.session.storeIdentityToken(s.identity_token))),this.logger.debug("[privy:refresh] returning response"),t||this.callbacks?.setUser?.(s.user),s}catch(e){throw this.logger.debug(`[privy:refresh] error: ${e.message??"unknown error"}`),e instanceof h&&e.code===s.MISSING_OR_INVALID_TOKEN&&(await this.session.destroyLocalState(),t||this.callbacks?.setUser?.(null)),e}}async getAccessToken(){let[e,t]=await Promise.all([this.session.getCustomerAccessToken(),this.session.getRefreshToken()]);if(e&&!this.session.tokenIsActive(e)&&this.session.hasRefreshCredentials(e,t)){let t=await this.refreshSession(),s=await this.session.getCustomerAccessToken();return t.token||this.logger.debug("[privy:getAccessToken] expected token received null"),t.token===e&&this.logger.debug("[privy:getAccessToken] expected new token in response received existing"),s===e&&this.logger.debug("[privy:getAccessToken] expected new token in storage received existing"),t.token??s}return e&&!this.session.tokenIsActive(e)?(this.logger.debug("[privy:getAccessToken] unable to refresh inactive token"),this.callbacks?.setUser?.(null),await this.session.destroyLocalState(),null):e}async getAccessTokenInternal(){let e=await this.getAccessToken();return await this.session.getPrivyAccessToken()??e}async getIdentityToken(){return await this.session.getIdentityToken()}async isStorageAccessible(){try{let e=`privy:__storage__test-${t()}`,s="blobby";await this._storage.put(e,s);let i=await this._storage.get(e);return await this._storage.del(e),i===s}catch(e){return this.logger.error(e),!1}}constructor(t){this._sdkVersion="js-sdk-core:0.60.9",this._cache=new Map,this.logger=d({level:t.logger?.level??t.logLevel??"ERROR",logger:t.logger??console}),this._storage=t.storage,this._analyticsId=null,this._getOrGenerateClientAnalyticsId(),this.baseUrl=t.baseUrl??"https://auth.privy.io",this.appId=t.appId,this.appClientId=t.appClientId,this._sdkVersion=t.sdkVersion??this._sdkVersion,this.callbacks=t.callbacks,this.nativeAppIdentifier=t.nativeAppIdentifier,this.session=new c({storage:this._storage,isUsingServerCookies:!1,appId:t.appId}),this._fetch=e(globalThis.fetch,{retries:3,retryDelay:e=>3**e*500,retryOn:[408,409,425,500,502,503,504]}),this.session.on("error_storing_tokens",(e=>{this.createAnalyticsEvent("error_updating_tokens_in_storage",{reason:e})}))}}export{u as PrivyInternal};
1
+ import e from"fetch-retry";import{v4 as t}from"uuid";import{PrivyErrorCode as s}from"@privy-io/api-base";import{getPathWithParams as i,AppConfig as r,AnalyticsEvent as a,RefreshSession as o}from"@privy-io/routes";import{PrivyClientError as n,PrivyApiError as h}from"../Error.mjs";import{Session as c}from"../Session.mjs";import l from"../toAbortSignalTimeout.mjs";import{toSearchParams as g}from"../utils/toSearchParams.mjs";import{toLoggerWithLevel as d}from"./logger.mjs";import"eventemitter3";import"jose";import"js-cookie";import"../Token.mjs";import"../utils/allSettled.mjs";import"../utils/noop.mjs";let p="privy:caid";class u{setCallbacks(e){this.callbacks={...this.callbacks,...e}}get isReady(){return!!this._config}get config(){return this._config}get caid(){return this._analyticsId}async _initialize(){if(this.isReady)this.callbacks?.setIsReady?.(!0);else{if(!await this.isStorageAccessible())throw new n({code:"storage_error",error:"Unable to access storage"});this._config=await this.getAppConfig(),this._config?.custom_api_url&&(this.baseUrl=this._config.custom_api_url,this.session.isUsingServerCookies=!0),this.callbacks?.setIsReady?.(!0),this._sdkVersion.startsWith("react-auth:")||this.createAnalyticsEvent("sdk_initialize",{})}}getPath(e,{params:t,query:s}){return`${this.baseUrl}${i(e.path,t)}${g(s)}`}async fetch(e,{body:t,params:s,query:i,headers:r,onRequest:a=this._beforeRequest.bind(this)}){let o=new Request(this.getPath(e,{params:s,query:i}),{method:e.method,body:JSON.stringify(t),headers:r}),n=await a(o),c=await this._fetch(o,n),l=await c.json();if(c.status>299)throw new h({...l,status:c.status});return l}async _beforeRequestWithoutInitialize(e){let t=await this.session.getPrivyAccessToken()??await this.session.getCustomerAccessToken(),s=new Headers(e.headers);s.set("privy-app-id",this.appId),this.appClientId&&s.set("privy-client-id",this.appClientId),s.set("privy-client",this._sdkVersion),t&&s.set("Authorization",`Bearer ${t}`),s.set("Content-Type","application/json"),s.set("Accept","application/json");let i=await this._getOrGenerateClientAnalyticsId();return i&&s.set("privy-ca-id",i),this.nativeAppIdentifier&&s.set("x-native-app-identifier",this.nativeAppIdentifier),{signal:l(2e4),headers:s,credentials:"include"}}async beforeRequestWithoutRefresh(e){return await this._initialize(),this._beforeRequestWithoutInitialize(e)}async _beforeRequest(e){return await this._initialize(),await this.getAccessTokenInternal(),this.beforeRequestWithoutRefresh(e)}async getAppConfig(){return await this.fetch(r,{params:{app_id:this.appId},onRequest:this._beforeRequestWithoutInitialize.bind(this)})}async _getOrGenerateClientAnalyticsId(){if(this._analyticsId)return this._analyticsId;try{let e=await this._storage.get(p);if("string"==typeof e&&e.length>0)return this._analyticsId=e,e}catch(e){this.logger.error("Unable to load clientId",e)}try{this._analyticsId=t()}catch(e){this.logger.error("Unable to generate uuidv4",e)}if(this._analyticsId){try{await this._storage.put(p,this._analyticsId)}catch(e){this.logger.error(`Unable to store clientId: ${this._analyticsId}`,e)}return this._analyticsId}}async destroyClientAnalyticsId(){try{return await this._storage.del(p)}catch(e){this.logger.error("Unable to delete clientId",e)}}async createAnalyticsEvent(e,t){try{await this.fetch(a,{body:{event_name:e,client_id:await this._getOrGenerateClientAnalyticsId(),payload:t},onRequest:this.beforeRequestWithoutRefresh.bind(this)})}catch(e){}}async refreshSession(e=!1){if(!await this.isStorageAccessible())throw new n({code:"storage_error",error:"Unable to access storage"});let t=await this.session.getRefreshToken()??void 0,s=t??"key",i=this._cache.get(s);if(i)return this.logger.debug("[privy:refresh] found in-flight session refresh request, deduping"),await i;let r=this._refreshSession(t,e);this._cache.set(s,r);try{return await r}finally{this._cache.delete(s)}}async _refreshSession(e,t){let i=await this.session.getCustomerAccessToken();if(!this.session.hasRefreshCredentials(i,e??null))throw this.logger.debug("[privy:refresh] missing tokens, skipping request"),await this._initialize(),new h({code:s.MISSING_OR_INVALID_TOKEN,error:"No tokens found in storage",status:401});try{this.logger.debug(`[privy:refresh] fetching: ${o.path}`);let s=await this.fetch(o,{body:{refresh_token:e},onRequest:this.beforeRequestWithoutRefresh.bind(this)}),i=s.session_update_action;return this.logger.debug(`[privy:refresh] response: ${i}`),"set"===i&&(await this.session.updateWithTokensResponse(s),this.logger.debug("[privy:refresh] tokens stored")),"clear"===i&&(await this.session.destroyLocalState(),this.logger.debug("[privy:refresh] tokens cleared"),t||this.callbacks?.setUser?.(null)),"ignore"===i&&(s.token&&(await this.session.storeCustomerAccessToken(s.token),this.logger.debug("[privy:refresh] token stored (CAT)")),s.privy_access_token&&(await this.session.storePrivyAccessToken(s.privy_access_token),this.logger.debug("[privy:refresh] token stored (PAT)")),s.identity_token&&(this.logger.debug("[privy:refresh] token stored (IDT)"),await this.session.storeIdentityToken(s.identity_token))),this.logger.debug("[privy:refresh] returning response"),t||this.callbacks?.setUser?.(s.user),s}catch(e){throw this.logger.debug(`[privy:refresh] error: ${e.message??"unknown error"}`),e instanceof h&&e.code===s.MISSING_OR_INVALID_TOKEN&&(await this.session.destroyLocalState(),t||this.callbacks?.setUser?.(null)),e}}async getAccessToken(){let[e,t]=await Promise.all([this.session.getCustomerAccessToken(),this.session.getRefreshToken()]);if(e&&!this.session.tokenIsActive(e)&&this.session.hasRefreshCredentials(e,t)){let t=await this.refreshSession(),s=await this.session.getCustomerAccessToken();return t.token||this.logger.debug("[privy:getAccessToken] expected token received null"),t.token===e&&this.logger.debug("[privy:getAccessToken] expected new token in response received existing"),s===e&&this.logger.debug("[privy:getAccessToken] expected new token in storage received existing"),t.token??s}return e&&!this.session.tokenIsActive(e)?(this.logger.debug("[privy:getAccessToken] unable to refresh inactive token"),this.callbacks?.setUser?.(null),await this.session.destroyLocalState(),null):e}async getAccessTokenInternal(){let e=await this.getAccessToken();return await this.session.getPrivyAccessToken()??e}async getIdentityToken(){return await this.session.getIdentityToken()}async isStorageAccessible(){try{let e=`privy:__storage__test-${t()}`,s="blobby";await this._storage.put(e,s);let i=await this._storage.get(e);return await this._storage.del(e),i===s}catch(e){return this.logger.error(e),!1}}constructor(t){this._sdkVersion="js-sdk-core:0.61.1",this._cache=new Map,this.logger=d({level:t.logger?.level??t.logLevel??"ERROR",logger:t.logger??console}),this._storage=t.storage,this._analyticsId=null,this._getOrGenerateClientAnalyticsId(),this.baseUrl=t.baseUrl??"https://auth.privy.io",this.appId=t.appId,this.appClientId=t.appClientId,this._sdkVersion=t.sdkVersion??this._sdkVersion,this.callbacks=t.callbacks,this.nativeAppIdentifier=t.nativeAppIdentifier,this.session=new c({storage:this._storage,isUsingServerCookies:!1,appId:t.appId}),this._fetch=e(globalThis.fetch,{retries:3,retryDelay:e=>3**e*500,retryOn:[408,409,425,500,502,503,504]}),this.session.on("error_storing_tokens",(e=>{this.createAnalyticsEvent("error_updating_tokens_in_storage",{reason:e})}))}}export{u as PrivyInternal};
2
2
  //# sourceMappingURL=PrivyInternal.mjs.map
@@ -1,2 +1,2 @@
1
- import{PrivyClientError as e}from"../Error.mjs";import{getWalletPublicKeyFromTransaction as t}from"../solana/getWalletPublicKeyFromTransaction.mjs";import{isVersionedTransaction as r}from"../solana/isVersionedTransaction.mjs";import{isUnifiedWallet as a}from"../wallet-api/unified-wallet.mjs";import{errorIndicatesRecoveryIsNeeded as s}from"./errors.mjs";import{walletRpc as n}from"./stack/walletRpc.mjs";import"./types.mjs";import"../utils/encodings.mjs";import"../wallet-api/rpc.mjs";import"@privy-io/routes";import"../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"../wallet-api/types.mjs";import"./stack/wallet-api-eth-transaction.mjs";import"./stack/wallet-api-eth-typed-data.mjs";class i{async request(t){if(!await this._privyInternal.getAccessTokenInternal())throw new e({error:"Missing access token",code:"attempted_rpc_call_before_logged_in"});switch(t.method){case"signAndSendTransaction":return await this.handleSignAndSendTransaction(t);case"signTransaction":return await this.handleSignTransaction(t);default:return await this.handleIFrameRpc(t)}}get _publicKey(){return this._account.address}async connectAndRecover(t){if("privy-v2"!==this._account.recovery_method)try{await this._proxy.connect({entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,accessToken:t})}catch(r){let a=s(r);if(a&&"privy"===this._account.recovery_method)await this._proxy.recover({entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,accessToken:t});else{if(!a||!this._onNeedsRecovery)throw r;{let t;await new Promise((async(r,a)=>{t=setTimeout((()=>a(new e({code:"embedded_wallet_recovery_error",error:"User-owned recovery timed out"}))),12e4),await(this._onNeedsRecovery?.({recoveryMethod:this._account.recovery_method,onRecovered:()=>r(!0)}))})).finally((()=>clearTimeout(t)))}}}}async signMessageRpc(e,t){let r=this._account;if(!a(r))return(await this._proxy.rpcWallet({accessToken:t,request:e,chainType:"solana",hdWalletIndex:this._account.wallet_index,entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier})).response.data;{let{data:a}=await n({context:{app:this._app,fetchPrivyRoute:(...e)=>this._privyInternal.fetch(...e),getCompiledPath:(...e)=>this._privyInternal.getPath(...e),signRequest:({message:e})=>this._proxy.signWithUserSigner({accessToken:t,message:e})},account:r,rpcRequest:{chainType:"solana",request:e}});return{signature:a}}}async handleIFrameRpc(t){try{let e=await this._privyInternal.getAccessTokenInternal();if(!e)throw Error("Missing privy token. User must be logged in");return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_started",{method:t.method,address:this._account.address}),await this.connectAndRecover(e),await this.signMessageRpc(t,e)}catch(r){console.error(r);let a=r instanceof Error?r.message:"Unable to make wallet request";throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_failed",{method:t.method,address:this._account.address,error:a}),new e({code:"embedded_wallet_request_error",error:a})}}async handleSignAndSendTransaction(a){try{let e=await this._privyInternal.getAccessTokenInternal();if(!e)throw Error("Missing privy token. User must be logged in");this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_started",{method:a.method,address:this._account.address}),await this.connectAndRecover(e);let{transaction:s,connection:n,options:i}=a.params,o=t(s,this._account.address),c=r(s)?Buffer.from(s.message.serialize()):s.serializeMessage(),{signature:d}=await this.signMessageRpc({method:"signMessage",params:{message:c.toString("base64")}},e);return s.addSignature(o,Buffer.from(d,"base64")),{signature:await n.sendRawTransaction(s.serialize(),i)}}catch(t){console.error(t);let r=t instanceof Error?t.message:"Unable to make wallet request";throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_failed",{method:a.method,address:this._account.address,error:r}),new e({code:"embedded_wallet_request_error",error:r})}}async handleSignTransaction(a){try{let e=await this._privyInternal.getAccessTokenInternal();if(!e)throw Error("Missing privy token. User must be logged in");this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_started",{method:a.method,address:this._account.address}),await this.connectAndRecover(e);let{transaction:s}=a.params,n=t(s,this._account.address),i=r(s)?Buffer.from(s.message.serialize()):s.serializeMessage(),{signature:o}=await this.signMessageRpc({method:"signMessage",params:{message:i.toString("base64")}},e);return s.addSignature(n,Buffer.from(o,"base64")),{signedTransaction:s}}catch(t){console.error(t);let r=t instanceof Error?t.message:"Unable to make wallet request";throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_failed",{method:a.method,address:this._account.wallet_index,error:r}),new e({code:"embedded_wallet_request_error",error:r})}}toJSON(){return`PrivyEmbeddedSolanaProvider { address: '${this._account.address}', request: [Function] }`}constructor({proxy:e,privyInternal:t,account:r,entropyId:a,entropyIdVerifier:s,onNeedsRecovery:n,app:i}){this._proxy=e,this._privyInternal=t,this._account=r,this._entropyId=a,this._entropyIdVerifier=s,this._onNeedsRecovery=n,this._app=i}}export{i as EmbeddedSolanaWalletProvider};
1
+ import{PrivyClientError as e}from"../Error.mjs";import{getWalletPublicKeyFromTransaction as t}from"../solana/getWalletPublicKeyFromTransaction.mjs";import{isVersionedTransaction as r}from"../solana/isVersionedTransaction.mjs";import{isUnifiedWallet as a}from"../wallet-api/unified-wallet.mjs";import{errorIndicatesRecoveryIsNeeded as s}from"./errors.mjs";import{walletRpc as n}from"./stack/walletRpc.mjs";import"./types.mjs";import"../utils/encodings.mjs";import"../wallet-api/rpc.mjs";import"@privy-io/routes";import"../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"@privy-io/encoding";import"../wallet-api/types.mjs";import"./stack/wallet-api-eth-transaction.mjs";import"./stack/wallet-api-eth-typed-data.mjs";class i{async request(t){if(!await this._privyInternal.getAccessTokenInternal())throw new e({error:"Missing access token",code:"attempted_rpc_call_before_logged_in"});switch(t.method){case"signAndSendTransaction":return await this.handleSignAndSendTransaction(t);case"signTransaction":return await this.handleSignTransaction(t);default:return await this.handleIFrameRpc(t)}}get _publicKey(){return this._account.address}async connectAndRecover(t){if("privy-v2"!==this._account.recovery_method)try{await this._proxy.connect({entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,accessToken:t})}catch(r){let a=s(r);if(a&&"privy"===this._account.recovery_method)await this._proxy.recover({entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,accessToken:t});else{if(!a||!this._onNeedsRecovery)throw r;{let t;await new Promise((async(r,a)=>{t=setTimeout((()=>a(new e({code:"embedded_wallet_recovery_error",error:"User-owned recovery timed out"}))),12e4),await(this._onNeedsRecovery?.({recoveryMethod:this._account.recovery_method,onRecovered:()=>r(!0)}))})).finally((()=>clearTimeout(t)))}}}}async signMessageRpc(e,t){let r=this._account;if(!a(r))return(await this._proxy.rpcWallet({accessToken:t,request:e,chainType:"solana",hdWalletIndex:this._account.wallet_index,entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier})).response.data;{let{data:a}=await n({context:{app:this._app,fetchPrivyRoute:(...e)=>this._privyInternal.fetch(...e),getCompiledPath:(...e)=>this._privyInternal.getPath(...e),signRequest:({message:e})=>this._proxy.signWithUserSigner({accessToken:t,message:e})},account:r,rpcRequest:{chainType:"solana",request:e}});return{signature:a}}}async handleIFrameRpc(t){try{let e=await this._privyInternal.getAccessTokenInternal();if(!e)throw Error("Missing privy token. User must be logged in");return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_started",{method:t.method,address:this._account.address}),await this.connectAndRecover(e),await this.signMessageRpc(t,e)}catch(r){console.error(r);let a=r instanceof Error?r.message:"Unable to make wallet request";throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_failed",{method:t.method,address:this._account.address,error:a}),new e({code:"embedded_wallet_request_error",error:a})}}async handleSignAndSendTransaction(a){try{let e=await this._privyInternal.getAccessTokenInternal();if(!e)throw Error("Missing privy token. User must be logged in");this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_started",{method:a.method,address:this._account.address}),await this.connectAndRecover(e);let{transaction:s,connection:n,options:i}=a.params,o=t(s,this._account.address),c=r(s)?Buffer.from(s.message.serialize()):s.serializeMessage(),{signature:d}=await this.signMessageRpc({method:"signMessage",params:{message:c.toString("base64")}},e);return s.addSignature(o,Buffer.from(d,"base64")),{signature:await n.sendRawTransaction(s.serialize(),i)}}catch(t){console.error(t);let r=t instanceof Error?t.message:"Unable to make wallet request";throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_failed",{method:a.method,address:this._account.address,error:r}),new e({code:"embedded_wallet_request_error",error:r})}}async handleSignTransaction(a){try{let e=await this._privyInternal.getAccessTokenInternal();if(!e)throw Error("Missing privy token. User must be logged in");this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_started",{method:a.method,address:this._account.address}),await this.connectAndRecover(e);let{transaction:s}=a.params,n=t(s,this._account.address),i=r(s)?Buffer.from(s.message.serialize()):s.serializeMessage(),{signature:o}=await this.signMessageRpc({method:"signMessage",params:{message:i.toString("base64")}},e);return s.addSignature(n,Buffer.from(o,"base64")),{signedTransaction:s}}catch(t){console.error(t);let r=t instanceof Error?t.message:"Unable to make wallet request";throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_failed",{method:a.method,address:this._account.wallet_index,error:r}),new e({code:"embedded_wallet_request_error",error:r})}}toJSON(){return`PrivyEmbeddedSolanaProvider { address: '${this._account.address}', request: [Function] }`}constructor({proxy:e,privyInternal:t,account:r,entropyId:a,entropyIdVerifier:s,onNeedsRecovery:n,app:i}){this._proxy=e,this._privyInternal=t,this._account=r,this._entropyId=a,this._entropyIdVerifier=s,this._onNeedsRecovery=n,this._app=i}}export{i as EmbeddedSolanaWalletProvider};
2
2
  //# sourceMappingURL=EmbeddedSolanaWalletProvider.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmbeddedSolanaWalletProvider.mjs","sources":["../../../src/embedded/EmbeddedSolanaWalletProvider.ts"],"names":["EmbeddedSolanaWalletProvider","request","this","_privyInternal","getAccessTokenInternal","PrivyClientError","error","code","method","handleSignAndSendTransaction","handleSignTransaction","handleIFrameRpc","_publicKey","_account","address","connectAndRecover","token","recovery_method","_proxy","connect","entropyId","_entropyId","entropyIdVerifier","_entropyIdVerifier","accessToken","e","needsRecovery","errorIndicatesRecoveryIsNeeded","recover","_onNeedsRecovery","timeout","Promise","async","res","rej","setTimeout","recoveryMethod","onRecovered","finally","clearTimeout","signMessageRpc","account","isUnifiedWallet","rpcWallet","chainType","hdWalletIndex","wallet_index","response","data","walletRpc","context","app","_app","fetchPrivyRoute","args","fetch","getCompiledPath","getPath","signRequest","message","signWithUserSigner","rpcRequest","signature","Error","createAnalyticsEvent","console","transaction","tx","connection","options","params","walletPublicKey","getWalletPublicKeyFromTransaction","serializedMessage","isVersionedTransaction","Buffer","from","serialize","serializeMessage","toString","addSignature","sendRawTransaction","signedTransaction","toJSON","constructor","proxy","privyInternal","onNeedsRecovery"],"mappings":"4sBA8EO,MAAMA,EA8DX,aAAMC,CAAQA,GAGZ,UAF0BC,KAAKC,eAAeC,yBAG5C,MAAM,IAAIC,EAAiB,CACzBC,MAAO,uBACPC,KAAM,wCAIV,OAAQN,EAAQO,QACd,IAAK,yBACH,aAAaN,KAAKO,6BAA6BR,GACjD,IAAK,kBACH,aAAaC,KAAKQ,sBAAsBT,GAC1C,QACE,aAAaC,KAAKS,gBAAgBV,GAExC,CAOA,cAAWW,GACT,OAAOV,KAAKW,SAASC,OACvB,CAMA,uBAAcC,CAAkBC,GAC9B,GAAsC,aAAlCd,KAAKW,SAASI,gBAMlB,UACQf,KAAKgB,OAAOC,QAAQ,CACxBC,UAAWlB,KAAKmB,WAChBC,kBAAmBpB,KAAKqB,mBACxBC,YAAaR,GAEjB,CAAE,MAAOS,GACP,IAAMC,EAAgBC,EAA+B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AKqB,mBAAqBD,EAC1BpB,KAAK2B,iBAAmB0D,EACxBrF,KAAKkD,KAAOD,CACd"}
1
+ {"version":3,"file":"EmbeddedSolanaWalletProvider.mjs","sources":["../../../src/embedded/EmbeddedSolanaWalletProvider.ts"],"names":["EmbeddedSolanaWalletProvider","request","this","_privyInternal","getAccessTokenInternal","PrivyClientError","error","code","method","handleSignAndSendTransaction","handleSignTransaction","handleIFrameRpc","_publicKey","_account","address","connectAndRecover","token","recovery_method","_proxy","connect","entropyId","_entropyId","entropyIdVerifier","_entropyIdVerifier","accessToken","e","needsRecovery","errorIndicatesRecoveryIsNeeded","recover","_onNeedsRecovery","timeout","Promise","async","res","rej","setTimeout","recoveryMethod","onRecovered","finally","clearTimeout","signMessageRpc","account","isUnifiedWallet","rpcWallet","chainType","hdWalletIndex","wallet_index","response","data","walletRpc","context","app","_app","fetchPrivyRoute","args","fetch","getCompiledPath","getPath","signRequest","message","signWithUserSigner","rpcRequest","signature","Error","createAnalyticsEvent","console","transaction","tx","connection","options","params","walletPublicKey","getWalletPublicKeyFromTransaction","serializedMessage","isVersionedTransaction","Buffer","from","serialize","serializeMessage","toString","addSignature","sendRawTransaction","signedTransaction","toJSON","constructor","proxy","privyInternal","onNeedsRecovery"],"mappings":"uuBA8EO,MAAMA,EA8DX,aAAMC,CAAQA,GAGZ,UAF0BC,KAAKC,eAAeC,yBAG5C,MAAM,IAAIC,EAAiB,CACzBC,MAAO,uBACPC,KAAM,wCAIV,OAAQN,EAAQO,QACd,IAAK,yBACH,aAAaN,KAAKO,6BAA6BR,GACjD,IAAK,kBACH,aAAaC,KAAKQ,sBAAsBT,GAC1C,QACE,aAAaC,KAAKS,gBAAgBV,GAExC,CAOA,cAAWW,GACT,OAAOV,KAAKW,SAASC,OACvB,CAMA,uBAAcC,CAAkBC,GAC9B,GAAsC,aAAlCd,KAAKW,SAASI,gBAMlB,UACQf,KAAKgB,OAAOC,QAAQ,CACxBC,UAAWlB,KAAKmB,WAChBC,kBAAmBp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AKC,eAAiBmF,EACtBpF,KAAKW,SAAW4B,EAChBvC,KAAKmB,WAAaD,EAClBlB,KAAKqB,mBAAqBD,EAC1BpB,KAAK2B,iBAAmB0D,EACxBrF,KAAKkD,KAAOD,CACd"}
@@ -1,2 +1,2 @@
1
- import e from"eventemitter3";import{toHex as t}from"viem";import{toViemTransactionSerializable as a,STRING_TO_NUMBER_TXN_TYPE as r}from"@privy-io/ethereum";import{PrivyClientError as i}from"../Error.mjs";import{isUnifiedWallet as s}from"../wallet-api/unified-wallet.mjs";import{EmbeddedProviderError as n,errorIndicatesRecoveryIsNeeded as o}from"./errors.mjs";import{walletRpc as h}from"./stack/walletRpc.mjs";import{getPublicClient as c}from"./utils/index.mjs";import"./types.mjs";import"../utils/encodings.mjs";import"../wallet-api/rpc.mjs";import"@privy-io/routes";import"../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"../wallet-api/types.mjs";import"./stack/wallet-api-eth-transaction.mjs";import"./stack/wallet-api-eth-typed-data.mjs";let d=new Set(["eth_sign","personal_sign","eth_signTypedData_v4","csw_signUserOperation","secp256k1_sign"]);class p extends e{async request(e){if(d.has(e.method))return this.handleIFrameRpc(e);switch(e.method){case"eth_accounts":case"eth_requestAccounts":return this._account.address?[this._account.address]:[];case"eth_chainId":return`0x${this._chainId.toString(16)}`;case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(e);case"eth_estimateGas":return this.handleEstimateGas(e);case"eth_signTransaction":{let t=e.params?.[0];return this.handleSignTransaction(t)}case"eth_sendTransaction":{let t=e.params?.[0];return this.handleSendTransaction(t)}case"eth_populateTransactionRequest":{let t=e.params?.[0];return this.handlePopulateTransaction(t)}default:return this.handleJsonRpc(e)}}ensureChainId(e){let t={chainId:this._chainId,...e};return this.internalSwitchEthereumChain(t.chainId),t}internalSwitchEthereumChain(e){e&&Number(e)!==this._chainId&&(this._chainId=Number(e),this._client=c(this._chainId,this._chains,{rpcUrls:[]},{appId:this._privyInternal.appId}),this.emit("chainChanged",e))}async handlePopulateTransaction(e){let t=this.ensureChainId(e),i=a(t),{type:s,...n}=await this._client.prepareTransactionRequest({account:t.from??this._account.address,...i});return{...n,type:r[s]}}async handleSignTransaction(e){let a={...e};for(let e of Object.keys(a)){let r=a[e];r&&"bigint"==typeof r&&(a[e]=t(r))}return await this.handleIFrameRpc({method:"eth_signTransaction",params:[a]})}async handleSendTransaction(e){let t=await this.handlePopulateTransaction(e),a=await this.handleSignTransaction(t);return await this.handleJsonRpc({method:"eth_sendRawTransaction",params:[a]})}async handleEstimateGas(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for eth_estimateGas");let t=e.params?.[0],r=this.ensureChainId(t),i=a(r);return await this._client.estimateGas({account:r.from??this._account.address,...i})}handleSwitchEthereumChain(e){let t;if(!e.params||!Array.isArray(e.params))throw new n(`Invalid params for ${e.method}`,4200);if("string"==typeof e.params[0])t=e.params[0];else{if(!("chainId"in e.params[0])||"string"!=typeof e.params[0].chainId)throw new n(`Invalid params for ${e.method}`,4200);t=e.params[0].chainId}this.internalSwitchEthereumChain(t)}async handleIFrameRpc(e){try{let t=await this._privyInternal.getAccessTokenInternal();if(!t)throw Error("Missing privy token. User must be logged in");this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_started",{method:e.method,address:this._account.address});let a=this._account;if(s(a)){let{data:r}=await h({context:{app:this._appApi,fetchPrivyRoute:(...e)=>this._privyInternal.fetch(...e),getCompiledPath:(...e)=>this._privyInternal.getPath(...e),signRequest:({message:e})=>this._walletProxy.signWithUserSigner({accessToken:t,message:e})},account:a,rpcRequest:{chainType:"ethereum",request:e}});return r}try{await this._walletProxy.connect({entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,accessToken:t})}catch(e){let a=o(e);if(a&&"privy"===this._account.recovery_method)await this._walletProxy.recover({entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,accessToken:t});else{if(!a||!this._onNeedsRecovery)throw e;{let e;await new Promise((async(t,a)=>{e=setTimeout((()=>a(new i({code:"embedded_wallet_recovery_error",error:"User-owned recovery timed out"}))),12e4),await(this._onNeedsRecovery?.({recoveryMethod:this._account.recovery_method,onRecovered:()=>t(!0)}))})).finally((()=>clearTimeout(e)))}}}return(await this._walletProxy.rpcWallet({accessToken:t,request:e,entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,hdWalletIndex:this._account.wallet_index,chainType:"ethereum"})).response.data}catch(t){console.error(t);let a=t instanceof Error?t.message:"Unable to make wallet request";throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_failed",{method:e.method,address:this._account.address,error:a}),new i({code:"embedded_wallet_request_error",error:a})}}async handleJsonRpc(e){return this._client.request(e)}toJSON(){return`PrivyEIP1193Provider { address: '${this._account.address}', chainId: ${this._chainId}, request: [Function] }`}constructor({walletProxy:e,privyInternal:t,account:a,entropyId:r,entropyIdVerifier:i,chains:s,onNeedsRecovery:n,chainId:o=s[0].id,appApi:h}){super(),this._walletProxy=e,this._privyInternal=t,this._account=a,this._entropyId=r,this._entropyIdVerifier=i,this._chainId=o,this._chains=s,this._onNeedsRecovery=n,this._client=c(o,s,{rpcUrls:[]},{appId:h.appId}),this._appApi=h}}export{p as EmbeddedWalletProvider};
1
+ import e from"eventemitter3";import{toHex as t}from"viem";import{toViemTransactionSerializable as r,STRING_TO_NUMBER_TXN_TYPE as a}from"@privy-io/ethereum";import{PrivyClientError as i}from"../Error.mjs";import{isUnifiedWallet as s}from"../wallet-api/unified-wallet.mjs";import{EmbeddedProviderError as n,errorIndicatesRecoveryIsNeeded as o}from"./errors.mjs";import{walletRpc as h}from"./stack/walletRpc.mjs";import{getPublicClient as c}from"./utils/index.mjs";import"./types.mjs";import"../utils/encodings.mjs";import"../wallet-api/rpc.mjs";import"@privy-io/routes";import"../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"@privy-io/encoding";import"../wallet-api/types.mjs";import"./stack/wallet-api-eth-transaction.mjs";import"./stack/wallet-api-eth-typed-data.mjs";let d=new Set(["eth_sign","personal_sign","eth_signTypedData_v4","csw_signUserOperation","secp256k1_sign"]);class p extends e{async request(e){if(d.has(e.method))return this.handleIFrameRpc(e);switch(e.method){case"eth_accounts":case"eth_requestAccounts":return this._account.address?[this._account.address]:[];case"eth_chainId":return`0x${this._chainId.toString(16)}`;case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(e);case"eth_estimateGas":return this.handleEstimateGas(e);case"eth_signTransaction":{let t=e.params?.[0];return this.handleSignTransaction(t)}case"eth_sendTransaction":{let t=e.params?.[0];return this.handleSendTransaction(t)}case"eth_populateTransactionRequest":{let t=e.params?.[0];return this.handlePopulateTransaction(t)}default:return this.handleJsonRpc(e)}}ensureChainId(e){let t={chainId:this._chainId,...e};return this.internalSwitchEthereumChain(t.chainId),t}internalSwitchEthereumChain(e){e&&Number(e)!==this._chainId&&(this._chainId=Number(e),this._client=c(this._chainId,this._chains,{rpcUrls:[]},{appId:this._privyInternal.appId}),this.emit("chainChanged",e))}async handlePopulateTransaction(e){let t=this.ensureChainId(e),i=r(t),{type:s,...n}=await this._client.prepareTransactionRequest({account:t.from??this._account.address,...i});return{...n,type:a[s]}}async handleSignTransaction(e){let r={...e};for(let e of Object.keys(r)){let a=r[e];a&&"bigint"==typeof a&&(r[e]=t(a))}return await this.handleIFrameRpc({method:"eth_signTransaction",params:[r]})}async handleSendTransaction(e){let t=await this.handlePopulateTransaction(e),r=await this.handleSignTransaction(t);return await this.handleJsonRpc({method:"eth_sendRawTransaction",params:[r]})}async handleEstimateGas(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for eth_estimateGas");let t=e.params?.[0],a=this.ensureChainId(t),i=r(a);return await this._client.estimateGas({account:a.from??this._account.address,...i})}handleSwitchEthereumChain(e){let t;if(!e.params||!Array.isArray(e.params))throw new n(`Invalid params for ${e.method}`,4200);if("string"==typeof e.params[0])t=e.params[0];else{if(!("chainId"in e.params[0])||"string"!=typeof e.params[0].chainId)throw new n(`Invalid params for ${e.method}`,4200);t=e.params[0].chainId}this.internalSwitchEthereumChain(t)}async handleIFrameRpc(e){try{let t=await this._privyInternal.getAccessTokenInternal();if(!t)throw Error("Missing privy token. User must be logged in");this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_started",{method:e.method,address:this._account.address});let r=this._account;if(s(r)){let{data:a}=await h({context:{app:this._appApi,fetchPrivyRoute:(...e)=>this._privyInternal.fetch(...e),getCompiledPath:(...e)=>this._privyInternal.getPath(...e),signRequest:({message:e})=>this._walletProxy.signWithUserSigner({accessToken:t,message:e})},account:r,rpcRequest:{chainType:"ethereum",request:e}});return a}try{await this._walletProxy.connect({entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,accessToken:t})}catch(e){let r=o(e);if(r&&"privy"===this._account.recovery_method)await this._walletProxy.recover({entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,accessToken:t});else{if(!r||!this._onNeedsRecovery)throw e;{let e;await new Promise((async(t,r)=>{e=setTimeout((()=>r(new i({code:"embedded_wallet_recovery_error",error:"User-owned recovery timed out"}))),12e4),await(this._onNeedsRecovery?.({recoveryMethod:this._account.recovery_method,onRecovered:()=>t(!0)}))})).finally((()=>clearTimeout(e)))}}}return(await this._walletProxy.rpcWallet({accessToken:t,request:e,entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,hdWalletIndex:this._account.wallet_index,chainType:"ethereum"})).response.data}catch(t){console.error(t);let r=t instanceof Error?t.message:"Unable to make wallet request";throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_failed",{method:e.method,address:this._account.address,error:r}),new i({code:"embedded_wallet_request_error",error:r})}}async handleJsonRpc(e){return this._client.request(e)}toJSON(){return`PrivyEIP1193Provider { address: '${this._account.address}', chainId: ${this._chainId}, request: [Function] }`}constructor({walletProxy:e,privyInternal:t,account:r,entropyId:a,entropyIdVerifier:i,chains:s,onNeedsRecovery:n,chainId:o=s[0].id,appApi:h}){super(),this._walletProxy=e,this._privyInternal=t,this._account=r,this._entropyId=a,this._entropyIdVerifier=i,this._chainId=o,this._chains=s,this._onNeedsRecovery=n,this._client=c(o,s,{rpcUrls:[]},{appId:h.appId}),this._appApi=h}}export{p as EmbeddedWalletProvider};
2
2
  //# sourceMappingURL=EmbeddedWalletProvider.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmbeddedWalletProvider.mjs","sources":["../../../src/embedded/EmbeddedWalletProvider.ts"],"names":["IFRAME_PASSTHROUGH_RPC_METHODS","Set","EmbeddedWalletProvider","EventEmitter","request","has","method","this","handleIFrameRpc","_account","address","_chainId","toString","handleSwitchEthereumChain","handleEstimateGas","data","params","handleSignTransaction","handleSendTransaction","handlePopulateTransaction","handleJsonRpc","ensureChainId","tx","ensureTxChainId","chainId","internalSwitchEthereumChain","Number","_client","getPublicClient","_chains","rpcUrls","appId","_privyInternal","emit","txRequest","viemTxn","toViemTransactionSerializable","type","preparedTxn","prepareTransactionRequest","account","from","STRING_TO_NUMBER_TXN_TYPE","serializable","key","Object","keys","val","toHex","populatedTx","signedTx","Array","isArray","Error","estimateGas","args","newChain","EmbeddedProviderError","token","getAccessTokenInternal","createAnalyticsEvent","isUnifiedWallet","walletRpc","context","app","_appApi","fetchPrivyRoute","fetch","getCompiledPath","getPath","signRequest","message","_walletProxy","signWithUserSigner","accessToken","rpcRequest","chainType","connect","entropyId","_entropyId","entropyIdVerifier","_entropyIdVerifier","e","needsRecovery","errorIndicatesRecoveryIsNeeded","recovery_method","recover","_onNeedsRecovery","timeout","Promise","async","res","rej","setTimeout","PrivyClientError","code","error","recoveryMethod","onRecovered","finally","clearTimeout","rpcWallet","hdWalletIndex","wallet_index","response","console","toJSON","constructor","walletProxy","privyInternal","chains","onNeedsRecovery","id","appApi","super"],"mappings":"qwBA0EA,IAAMA,EAAiC,IAAIC,IAAI,CAC7C,WACA,gBACA,uBACA,wBACA,mBAGK,MAAMC,UAA+BC,EAiD1C,aAAMC,CAAQA,GAGZ,GAAIJ,EAA+BK,IAAID,EAAQE,QAC7C,OA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KAAKE,SAAS8F,aAC7B3B,UAAW,cAGC4B,SAAa,IAC7B,CAAE,MAAOR,GACPS,QAAQT,MAAMA,GACd,IAAMzB,EAAUyB,aAAiB3C,MAAQ2C,EAAMzB,QAAU,gCAOzD,MANKhE,KAAKyB,eAAe4B,qBAAqB,iCAAkC,CAC9EtD,OAAQF,EAAQE,OAChBI,QAASH,KAAKE,SAASC,QACvBsF,MAAOzB,IAGH,IAAIuB,EAAiB,CAACC,KAAM,gCAAiCC,MAAOzB,GAC5E,CACF,CAEA,mBAAcnD,CAAchB,GAC1B,OAAOG,KAAKoB,QAAQvB,QAAQA,EAC9B,CAEAsG,MAAAA,GAEE,MAAO,oCAAoCnG,KAAKE,SAASC,sBAAsBH,KAAKI,iCACtF,CAvRAgG,WAAAA,EACEC,YAAAA,EACAC,cAAAA,EACArE,QAAAA,EACAsC,UAAAA,EACAE,kBAAAA,EACA8B,OAAAA,EACAC,gBAAAA,EACAvF,QAAAA,EAAUsF,EAAO,GAAGE,GACpBC,OAAAA,IAEAC,QACA3G,KAAKiE,aAAeoC,EACpBrG,KAAKyB,eAAiB6E,EACtBtG,KAAKE,SAAW+B,EAChBjC,KAAKwE,WAAaD,EAClBvE,KAAK0E,mBAAqBD,EAC1BzE,KAAKI,SAAWa,EAChBjB,KAAKsB,QAAUiF,EACfvG,KAAKgF,iBAAmBwB,EACxBxG,KAAKoB,QAAUC,EAAgBJ,EAASsF,EAAQ,CAAChF,QAAS,IAAK,CAACC,MAAOkF,EAAOlF,QAC9ExB,KAAK0D,QAAUgD,CACjB"}
1
+ {"version":3,"file":"EmbeddedWalletProvider.mjs","sources":["../../../src/embedded/EmbeddedWalletProvider.ts"],"names":["IFRAME_PASSTHROUGH_RPC_METHODS","Set","EmbeddedWalletProvider","EventEmitter","request","has","method","this","handleIFrameRpc","_account","address","_chainId","toString","handleSwitchEthereumChain","handleEstimateGas","data","params","handleSignTransaction","handleSendTransaction","handlePopulateTransaction","handleJsonRpc","ensureChainId","tx","ensureTxChainId","chainId","internalSwitchEthereumChain","Number","_client","getPublicClient","_chains","rpcUrls","appId","_privyInternal","emit","txRequest","viemTxn","toViemTransactionSerializable","type","preparedTxn","prepareTransactionRequest","account","from","STRING_TO_NUMBER_TXN_TYPE","serializable","key","Object","keys","val","toHex","populatedTx","signedTx","Array","isArray","Error","estimateGas","args","newChain","EmbeddedProviderError","token","getAccessTokenInternal","createAnalyticsEvent","isUnifiedWallet","walletRpc","context","app","_appApi","fetchPrivyRoute","fetch","getCompiledPath","getPath","signRequest","message","_walletProxy","signWithUserSigner","accessToken","rpcRequest","chainType","connect","entropyId","_entropyId","entropyIdVerifier","_entropyIdVerifier","e","needsRecovery","errorIndicatesRecoveryIsNeeded","recovery_method","recover","_onNeedsRecovery","timeout","Promise","async","res","rej","setTimeout","PrivyClientError","code","error","recoveryMethod","onRecovered","finally","clearTimeout","rpcWallet","hdWalletIndex","wallet_index","response","console","toJSON","constructor","walletProxy","privyInternal","chains","onNeedsRecovery","id","appApi","super"],"mappings":"gyBA0EA,IAAMA,EAAiC,IAAIC,IAAI,CAC7C,WACA,gBACA,uBACA,wBACA,mBAGK,MAAMC,UAA+BC,EAiD1C,aAAMC,CAAQA,GAGZ,GAAIJ,EAA+BK,IAAID,EAAQE,QAC7C,OAAOC,KAAKC,gBAAgBJ,GAG9B,OAAQA,EAAQE,QACd,IAAK,eACL,IAAK,sBACH,OAAOC,KAAKE,SAASC,QAAU,CAACH,KAAKE,SAASC,SAAW,GAE3D,IAAK,cACH,MAAO,KAAKH,KAAKI,SAASC,SAAS,MAErC,IAAK,6BACH,OAAOL,KAAKM,0BAA0BT,GAExC,IAAK,kBACH,OAAOG,KAAKO,kBAAkBV,GAEhC,IAAK,sBAAuB,CAC1B,IAAMW,EAAOX,EAAQY,SAAS,GAC9B,OAAOT,KAAKU,sBAAsBF,EACpC,CACA,IAAK,sBAAuB,CAC1B,IAAMA,EAAOX,EAAQY,SAAS,GAC9B,OAAOT,KAAKW,sBAAsBH,EACpC,CAC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AsBH,KAAKI,iCACtF,CAvRAgG,WAAAA,EACEC,YAAAA,EACAC,cAAAA,EACArE,QAAAA,EACAsC,UAAAA,EACAE,kBAAAA,EACA8B,OAAAA,EACAC,gBAAAA,EACAvF,QAAAA,EAAUsF,EAAO,GAAGE,GACpBC,OAAAA,IAEAC,QACA3G,KAAKiE,aAAeoC,EACpBrG,KAAKyB,eAAiB6E,EACtBtG,KAAKE,SAAW+B,EAChBjC,KAAKwE,WAAaD,EAClBvE,KAAK0E,mBAAqBD,EAC1BzE,KAAKI,SAAWa,EAChBjB,KAAKsB,QAAUiF,EACfvG,KAAKgF,iBAAmBwB,EACxBxG,KAAKoB,QAAUC,EAAgBJ,EAASsF,EAAQ,CAAChF,QAAS,IAAK,CAACC,MAAOkF,EAAOlF,QAC9ExB,KAAK0D,QAAUgD,CACjB"}
@@ -1,2 +1,2 @@
1
- export{EmbeddedWalletProvider}from"./EmbeddedWalletProvider.mjs";export{EmbeddedSolanaWalletProvider}from"./EmbeddedSolanaWalletProvider.mjs";export{EmbeddedWalletProxy}from"./EmbeddedWalletProxy.mjs";import"eventemitter3";import"viem";import"@privy-io/ethereum";import"../Error.mjs";import"../wallet-api/unified-wallet.mjs";import"./errors.mjs";import"./types.mjs";import"./stack/walletRpc.mjs";import"../utils/encodings.mjs";import"../wallet-api/rpc.mjs";import"@privy-io/routes";import"../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"../wallet-api/types.mjs";import"./stack/wallet-api-eth-transaction.mjs";import"./stack/wallet-api-eth-typed-data.mjs";import"./utils/index.mjs";import"../solana/getWalletPublicKeyFromTransaction.mjs";import"../solana/isVersionedTransaction.mjs";import"../utils/sleep.mjs";import"./EventCallbackQueue.mjs";import"./withMfa.mjs";
1
+ export{EmbeddedWalletProvider}from"./EmbeddedWalletProvider.mjs";export{EmbeddedSolanaWalletProvider}from"./EmbeddedSolanaWalletProvider.mjs";export{EmbeddedWalletProxy}from"./EmbeddedWalletProxy.mjs";import"eventemitter3";import"viem";import"@privy-io/ethereum";import"../Error.mjs";import"../wallet-api/unified-wallet.mjs";import"./errors.mjs";import"./types.mjs";import"./stack/walletRpc.mjs";import"../utils/encodings.mjs";import"../wallet-api/rpc.mjs";import"@privy-io/routes";import"../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"@privy-io/encoding";import"../wallet-api/types.mjs";import"./stack/wallet-api-eth-transaction.mjs";import"./stack/wallet-api-eth-typed-data.mjs";import"./utils/index.mjs";import"../solana/getWalletPublicKeyFromTransaction.mjs";import"../solana/isVersionedTransaction.mjs";import"../utils/sleep.mjs";import"./EventCallbackQueue.mjs";import"./withMfa.mjs";
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1,2 +1,2 @@
1
- import{getRootWalletForDelegation as e}from"../../action/delegatedActions/utils.mjs";import{getWallet as t}from"../../wallet-api/get-wallet.mjs";import{isUnifiedWallet as r}from"../../wallet-api/unified-wallet.mjs";import{updateWallet as i}from"../../wallet-api/update-wallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/embedded-wallets.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"@privy-io/routes";import"../../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"../../Error.mjs";async function a({client:a,wallet:s,signers:d}){if("ethereum"!==s.chain_type&&"solana"!==s.chain_type)throw Error("Session signers are only supported for Ethereum and Solana wallets");if(r(s)){if(0===d.length)throw Error("Must specify at least one signer to add.");let e={wallet_id:s.id},r=await t(a,e);await i(a,e,o(a),{additional_signers:r.additional_signers.concat(d)})}else{if(s.delegated)return l(a);if(d.length>0)throw Error("Specifying signers in addSessionSigners is only supported for TEE execution and this app uses On-device execution. Pass an empty array for signers instead. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide");let{user:t}=await a.user.get(),r=e(s,t);if(!r)throw Error("Unable to determine root address for delegated address.");await a.embeddedWallet.delegateWallets({rootWallet:{address:r.address,chainType:r.chain_type,imported:r.imported??!1},delegatedWallets:[{address:s.address,chainType:s.chain_type,walletIndex:s.wallet_index}]})}return l(a)}async function s({client:e,wallet:t}){if(r(t)){let r={wallet_id:t.id};await i(e,r,o(e),{additional_signers:[]})}else await e.delegated.revoke();return l(e)}async function l(e){let{user:t}=await e.user.get();if(!t)throw Error("Could not refresh user");return{user:t}}function o(e){return(...t)=>e.embeddedWallet.signWithUserSigner(...t)}export{a as addSessionSigners,s as removeSessionSigners};
1
+ import{getRootWalletForDelegation as e}from"../../action/delegatedActions/utils.mjs";import{getWallet as t}from"../../wallet-api/get-wallet.mjs";import{isUnifiedWallet as r}from"../../wallet-api/unified-wallet.mjs";import{updateWallet as i}from"../../wallet-api/update-wallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/embedded-wallets.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"@privy-io/routes";import"../../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"@privy-io/encoding";import"../../Error.mjs";async function a({client:a,wallet:s,signers:n}){if("ethereum"!==s.chain_type&&"solana"!==s.chain_type)throw Error("Session signers are only supported for Ethereum and Solana wallets");if(r(s)){if(0===n.length)throw Error("Must specify at least one signer to add.");let e={wallet_id:s.id},r=await t(a,e);await i(a,e,o(a),{additional_signers:r.additional_signers.concat(n)})}else{if(s.delegated)return l(a);if(n.length>0)throw Error("Specifying signers in addSessionSigners is only supported for TEE execution and this app uses On-device execution. Pass an empty array for signers instead. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide");let{user:t}=await a.user.get(),r=e(s,t);if(!r)throw Error("Unable to determine root address for delegated address.");await a.embeddedWallet.delegateWallets({rootWallet:{address:r.address,chainType:r.chain_type,imported:r.imported??!1},delegatedWallets:[{address:s.address,chainType:s.chain_type,walletIndex:s.wallet_index}]})}return l(a)}async function s({client:e,wallet:t}){if(r(t)){let r={wallet_id:t.id};await i(e,r,o(e),{additional_signers:[]})}else await e.delegated.revoke();return l(e)}async function l(e){let{user:t}=await e.user.get();if(!t)throw Error("Could not refresh user");return{user:t}}function o(e){return(...t)=>e.embeddedWallet.signWithUserSigner(...t)}export{a as addSessionSigners,s as removeSessionSigners};
2
2
  //# sourceMappingURL=session-signers.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-signers.mjs","sources":["../../../../src/embedded/stack/session-signers.ts"],"names":["async","addSessionSigners","client","wallet","signers","chain_type","Error","isUnifiedWallet","length","walletKey","wallet_id","id","walletObject","getWallet","updateWallet","makeWalletApiRequestSigner","additional_signers","concat","delegated","getRefreshedUser","user","get","rootWallet","getRootWalletForDelegation","embeddedWallet","delegateWallets","address","chainType","imported","delegatedWallets","walletIndex","wallet_index","removeSessionSigners","revoke","refreshedUser","args","signWithUserSigner"],"mappings":"kqBAgCOA,eAAeC,GACpBC,OAAAA,EACAC,OAAAA,EACAC,QAAAA,IAIA,GAAID,aAAAA,EAAOE,YAAmD,WAAtBF,EAAOE,WAC7C,MAAUC,MAAM,sEAGlB,GAAKC,EAAgBJ,GA6Bd,CACL,GAAuB,IAAnBC,EAAQI,OACV,MAAUF,MAAM,4CAGlB,IAAMG,EAAY,CAACC,UAAWP,EAAOQ,IAE/BC,QAAqBC,EAAUX,EAAQO,SAEvCK,EAAaZ,EAAQO,EAAWM,EAA2Bb,GAAS,CACxEc,mBAAoBJ,EAAaI,mBAAmBC,OAAOb,IAE/D,KAzC8B,CAC5B,GAAID,EAAOe,UAET,OAAOC,EAAiBjB,GAG1B,GAAIE,EAAQI,OAAS,EACnB,MAAMF,MACJ,mOAIJ,IAAOc,KAAAA,SAAclB,EAAOkB,KAAKC,MAC3BC,EAAaC,EAA2BpB,EAAQiB,GAEtD,IAAKE,EACH,MAAMhB,MAAU,iEAGZJ,EAAOsB,eAAeC,gBAAgB,CAC1CH,WAAY,CACVI,QAASJ,EAAWI,QACpBC,UAAWL,EAAWjB,WACtBuB,SAAUN,EAAWM,WAAY,GAEnCC,iBAAkB,CAChB,CAACH,QAASvB,EAAOuB,QAASC,UAAWxB,EAAOE,WAAYyB,YAAa3B,EAAO4B,gBAGlF,CAcA,OAAOZ,EAAiBjB,EAC1B,CAkBOF,eAAegC,GACpB9B,OAAAA,EACAC,OAAAA,IAEA,GAAKI,EAAgBJ,GAEd,CACL,IAAMM,EAAY,CAACC,UAAWP,EAAOQ,UAE/BG,EAAaZ,EAAQO,EAAWM,EAA2Bb,GAAS,CACxEc,mBAAoB,IAExB,YAPQd,EAAOgB,UAAUe,SASzB,OAAOd,EAAiBjB,EAC1B,CAEAF,eAAemB,EAAiBjB,GAC9B,IAAOkB,KAAMc,SAAuBhC,EAAOkB,KAAKC,MAChD,IAAKa,EACH,MAAU5B,MAAM,0BAElB,MAAO,CAACc,KAAMc,EAChB,CAEA,SAASnB,EAA2Bb,GAClC,MAAO,IAAIiC,IAASjC,EAAOsB,eAAeY,sBAAsBD,EAClE"}
1
+ {"version":3,"file":"session-signers.mjs","sources":["../../../../src/embedded/stack/session-signers.ts"],"names":["async","addSessionSigners","client","wallet","signers","chain_type","Error","isUnifiedWallet","length","walletKey","wallet_id","id","walletObject","getWallet","updateWallet","makeWalletApiRequestSigner","additional_signers","concat","delegated","getRefreshedUser","user","get","rootWallet","getRootWalletForDelegation","embeddedWallet","delegateWallets","address","chainType","imported","delegatedWallets","walletIndex","wallet_index","removeSessionSigners","revoke","refreshedUser","args","signWithUserSigner"],"mappings":"6rBAgCOA,eAAeC,GACpBC,OAAAA,EACAC,OAAAA,EACAC,QAAAA,IAIA,GAAID,aAAAA,EAAOE,YAAmD,WAAtBF,EAAOE,WAC7C,MAAUC,MAAM,sEAGlB,GAAKC,EAAgBJ,GA6Bd,CACL,GAAuB,IAAnBC,EAAQI,OACV,MAAUF,MAAM,4CAGlB,IAAMG,EAAY,CAACC,UAAWP,EAAOQ,IAE/BC,QAAqBC,EAAUX,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