@privy-io/expo 0.67.1 → 0.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-FHT7IQ6Z.js +1 -0
- package/dist/{chunk-IYDAGJC7.js → chunk-OEKXMJDY.js} +1 -1
- package/dist/esm/chunk-FHT7IQ6Z.js +1 -0
- package/dist/esm/{chunk-IYDAGJC7.js → chunk-OEKXMJDY.js} +1 -1
- package/dist/esm/extended-chains.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/passkey.js +1 -1
- package/dist/esm/smart-wallets.js +1 -1
- package/dist/esm/ui.js +1 -1
- package/dist/extended-chains.js +1 -1
- package/dist/index.d.ts +37 -2
- package/dist/index.js +1 -1
- package/dist/passkey.js +1 -1
- package/dist/smart-wallets.js +1 -1
- package/dist/ui.js +1 -1
- package/package.json +6 -6
- package/dist/chunk-2KAWFHVD.js +0 -1
- package/dist/esm/chunk-2KAWFHVD.js +0 -1
package/dist/extended-chains.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkFHT7IQ6Zjs = require('./chunk-FHT7IQ6Z.js');var _chunkQTVIWU3Njs = require('./chunk-QTVIWU3N.js');var _react = require('react');var _jssdkcore = require('@privy-io/js-sdk-core');var f=()=>{let e=_chunkFHT7IQ6Zjs.l.call(void 0, );return _react.useMemo.call(void 0, ()=>({createWallet(n){return _chunkQTVIWU3Njs.d.call(void 0, this,null,function*(){let s=yield _jssdkcore.create.call(void 0, e,{request:{chain_type:n.chainType}}),{user:o}=yield e.user.get();return{user:o,wallet:s}})}}),[e])};var C=()=>{let e=_chunkFHT7IQ6Zjs.l.call(void 0, );return _react.useMemo.call(void 0, ()=>({signRawHash(k){return _chunkQTVIWU3Njs.d.call(void 0, this,arguments,function*({address:n,chainType:s,hash:o}){let l=_chunkFHT7IQ6Zjs.b.call(void 0, );if(!l)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_before_logged_in",error:"User must be authenticated before signing a raw hash"});let p=l.linked_accounts.filter(_jssdkcore.isEmbeddedWalletAccount).filter(_jssdkcore.isUnifiedWallet).filter(t=>t.chain_type===s).find(t=>t.address===n);if(!p)throw new (0, _jssdkcore.PrivyClientError)({code:"embedded_wallet_does_not_exist",error:"No embedded wallet found for the given address and chain type"});let r=yield _jssdkcore.rawSign.call(void 0, e,(...t)=>e.embeddedWallet.signWithUserSigner(...t),{wallet_id:p.id,params:{hash:o}});if(r.data&&"signature"in r.data&&r.data.encoding==="hex")return{signature:r.data.signature};throw new Error("Failed to sign")})}}),[e])};exports.useCreateWallet = f; exports.useSignRawHash = C;
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export { Y as CreateEthereumEmbeddedWalletOpts, X as CreateOrRecoverEmbeddedWall
|
|
|
7
7
|
import * as _privy_io_api_types from '@privy-io/api-types';
|
|
8
8
|
import { User, AuthenticatedUser } from '@privy-io/api-types';
|
|
9
9
|
export { LinkedAccount, LinkedAccountBitcoinSegwitEmbeddedWallet, LinkedAccountBitcoinTaprootEmbeddedWallet, LinkedAccountEmbeddedWallet, LinkedAccountEthereumEmbeddedWallet, LinkedAccountSmartWallet, LinkedAccountSolanaEmbeddedWallet, User } from '@privy-io/api-types';
|
|
10
|
-
import { TypedDataDefinition } from 'viem';
|
|
10
|
+
import { TypedDataDefinition, SignedAuthorization } from 'viem';
|
|
11
11
|
import { PublicKeyCredentialRequestOptionsJSON } from '@simplewebauthn/types';
|
|
12
12
|
import { EncryptedAuthorizationKeyResponse } from '@privy-io/routes';
|
|
13
13
|
import { AppleAuthenticationCredential } from 'expo-apple-authentication';
|
|
@@ -834,6 +834,12 @@ interface UseMfa {
|
|
|
834
834
|
}): Promise<void>;
|
|
835
835
|
prompt(): Promise<void>;
|
|
836
836
|
cancel(): void;
|
|
837
|
+
/**
|
|
838
|
+
* Clears the cached MFA token. Call this when you want to require fresh MFA
|
|
839
|
+
* verification on the user's next action — for example, when your app moves
|
|
840
|
+
* to the background.
|
|
841
|
+
*/
|
|
842
|
+
clear(): Promise<void>;
|
|
837
843
|
}
|
|
838
844
|
/**
|
|
839
845
|
* Use this hook to execute the MFA flow with Privy.
|
|
@@ -842,6 +848,7 @@ interface UseMfa {
|
|
|
842
848
|
* @returns submit - completes the MFA verification flow
|
|
843
849
|
* @returns prompt - programmatically send mfaRequired event if MFA is needed
|
|
844
850
|
* @returns cancel - cancels the MFA verification flow
|
|
851
|
+
* @returns clear - clears the cached MFA token
|
|
845
852
|
*
|
|
846
853
|
* @example
|
|
847
854
|
* // MFA flow
|
|
@@ -1290,6 +1297,34 @@ interface UseGetEncryptedAuthorizationKeyInterface {
|
|
|
1290
1297
|
*/
|
|
1291
1298
|
declare const useGetEncryptedAuthorizationKey: () => UseGetEncryptedAuthorizationKeyInterface;
|
|
1292
1299
|
|
|
1300
|
+
type Sign7702AuthorizationInput = {
|
|
1301
|
+
/** Address of the contract to delegate execution to. */
|
|
1302
|
+
contractAddress: `0x${string}`;
|
|
1303
|
+
/** Chain ID for the authorization. Use 0 for chain-agnostic (requires explicit nonce). */
|
|
1304
|
+
chainId: number;
|
|
1305
|
+
/** Nonce of the EOA. Required when chainId is 0. Fetched from the chain automatically otherwise. */
|
|
1306
|
+
nonce?: number;
|
|
1307
|
+
/** Executor address. 'self' means the EOA executes its own authorization. */
|
|
1308
|
+
executor?: 'self' | `0x${string}`;
|
|
1309
|
+
};
|
|
1310
|
+
type Sign7702AuthorizationOptions = {
|
|
1311
|
+
/** Address of the wallet to sign with. Defaults to the user's primary embedded wallet. */
|
|
1312
|
+
address?: string;
|
|
1313
|
+
};
|
|
1314
|
+
interface UseSign7702AuthorizationInterface {
|
|
1315
|
+
/**
|
|
1316
|
+
* Signs an EIP-7702 authorization with the user's embedded wallet.
|
|
1317
|
+
* @param input The authorization parameters (contract address, chain ID, optional nonce).
|
|
1318
|
+
* @param options Optional signing options (wallet address override).
|
|
1319
|
+
* @returns A signed authorization containing the authorization fields and signature (r, s, v/yParity).
|
|
1320
|
+
*/
|
|
1321
|
+
signAuthorization: (input: Sign7702AuthorizationInput, options?: Sign7702AuthorizationOptions) => Promise<SignedAuthorization>;
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
* Signs an EIP-7702 authorization with the user's embedded Ethereum wallet.
|
|
1325
|
+
*/
|
|
1326
|
+
declare const useSign7702Authorization: () => UseSign7702AuthorizationInterface;
|
|
1327
|
+
|
|
1293
1328
|
type PrivyContext = {
|
|
1294
1329
|
client: Privy__default;
|
|
1295
1330
|
isReady: boolean;
|
|
@@ -1678,4 +1713,4 @@ declare const useMigrateWallets: () => {
|
|
|
1678
1713
|
}>;
|
|
1679
1714
|
};
|
|
1680
1715
|
|
|
1681
|
-
export { AddSessionSignersInput, AddSessionSignersOutput, AddSignersInput, AddSignersOutput, AuthBoundary, ConnectedEthereumWallet, CustomAuthProviderConfig, EmbeddedSolanaWalletState, EmbeddedWalletState, FarcasterV2State, LinkWithCrossAppInput, LinkWithCrossAppOutput, LinkWithEmailHookResult, LinkWithEmailOptions, LinkWithOAuthInput, LinkWithSMSHookResult, LinkWithSMSOptions, LoginWithCrossAppInput, LoginWithCrossAppOutput, LoginWithEmailHookResult, LoginWithEmailOptions, LoginWithFarcasterV2Input, LoginWithOAuthInput, LoginWithSMSHookResult, LoginWithSMSOptions, OAuthFlowHookResult, OAuthFlowState, OAuthTokens, OtpFlowState, PrivyAuthGuardProps, PrivyConfig, PrivyContext, PrivyOptions, PrivyProvider, PrivyProviderProps, RecoveryFlowState, RemoveSessionSignersInput, RemoveSessionSignersOutput, RemoveSignersInput, RemoveSignersOutput, SecureStorageAdapter, SendEmailCodeInput, SendPhoneCodeInput, SendTransactionWithCrossAppInput, SendTransactionWithCrossAppOutput, SignMessageWithCrossAppInput, SignMessageWithCrossAppOutput, SignTypedDataWithCrossAppInput, SignTypedDataWithCrossAppOutput, UnlinkOAuthInput, UpdateEmailInput, UpdatePhoneInput, UseCreateGuestAccount, UseCreateGuestAccountOptions, UseGetEncryptedAuthorizationKeyInterface, UseHeadlessDelegatedActionsInterface, UseLinkWithCrossAppInterface, UseLinkWithFarcaster, UseLinkWithFarcasterOptions, UseLinkWithOAuth, UseLinkWithSiwe, UseLinkWithSiweOptions, UseLinkWithSiwsInterface, UseLoginWithCrossAppInterface, UseLoginWithFarcaster, UseLoginWithFarcasterOptions, UseLoginWithFarcasterV2, UseLoginWithOAuth, UseLoginWithSiwe, UseLoginWithSiweOptions, UseLoginWithSiwsInterface, UseMfa, UseMfaEnrollment, UseOAuthTokens, UseOAuthTokensOptions, UseOnEmbeddedWalletStateChange, UseRecoverEmbeddedWallet, UseSendTransactionWithCrossAppInterface, UseSessionSignersInterface, UseSetEmbeddedWalletRecovery, UseSignMessageWithCrossAppInterface, UseSignTypedDataWithCrossAppInterface, UseSignersInterface, UseUnlinkEmailOptions, UseUnlinkFarcaster, UseUnlinkFarcasterOptions, UseUnlinkOAuth, UseUnlinkWallet, UseUnlinkWalletOptions, UseUpdateEmailInterface, UseUpdatePhoneInterface, createPrivyClient, getAccessToken, useAcceptTerms, useAuthorizationSignature, useCreateGuestAccount, useEmbeddedBitcoinWallet, useEmbeddedEthereumWallet, useEmbeddedSolanaWallet, useEmbeddedWallet, useEmbeddedWalletStateChange, useGetEncryptedAuthorizationKey, useHeadlessDelegatedActions, useIdentityToken, useLinkEmail, useLinkSMS, useLinkWithCrossApp, useLinkWithFarcaster, useLinkWithOAuth, useLinkWithSiwe, useLinkWithSiws, useLoginWithCrossApp, useLoginWithEmail, useLoginWithFarcaster, useLoginWithFarcasterV2, useLoginWithOAuth, useLoginWithSMS, useLoginWithSiwe, useLoginWithSiws, useMfa, useMfaEnrollment, useMigrateWallets, useOAuthFlow, useOAuthTokens, useOnNeedsRecovery, usePrivy, usePrivyClient, useRecoverEmbeddedWallet, useRegisterMfaListener, useSendTransactionWithCrossApp, useSessionSigners, useSetEmbeddedWalletRecovery, useSignMessageWithCrossApp, useSignTypedDataWithCrossApp, useSigners, useUnlinkEmail, useUnlinkFarcaster, useUnlinkOAuth, useUnlinkWallet, useUpdateEmail, useUpdatePhone };
|
|
1716
|
+
export { AddSessionSignersInput, AddSessionSignersOutput, AddSignersInput, AddSignersOutput, AuthBoundary, ConnectedEthereumWallet, CustomAuthProviderConfig, EmbeddedSolanaWalletState, EmbeddedWalletState, FarcasterV2State, LinkWithCrossAppInput, LinkWithCrossAppOutput, LinkWithEmailHookResult, LinkWithEmailOptions, LinkWithOAuthInput, LinkWithSMSHookResult, LinkWithSMSOptions, LoginWithCrossAppInput, LoginWithCrossAppOutput, LoginWithEmailHookResult, LoginWithEmailOptions, LoginWithFarcasterV2Input, LoginWithOAuthInput, LoginWithSMSHookResult, LoginWithSMSOptions, OAuthFlowHookResult, OAuthFlowState, OAuthTokens, OtpFlowState, PrivyAuthGuardProps, PrivyConfig, PrivyContext, PrivyOptions, PrivyProvider, PrivyProviderProps, RecoveryFlowState, RemoveSessionSignersInput, RemoveSessionSignersOutput, RemoveSignersInput, RemoveSignersOutput, SecureStorageAdapter, SendEmailCodeInput, SendPhoneCodeInput, SendTransactionWithCrossAppInput, SendTransactionWithCrossAppOutput, SignMessageWithCrossAppInput, SignMessageWithCrossAppOutput, SignTypedDataWithCrossAppInput, SignTypedDataWithCrossAppOutput, UnlinkOAuthInput, UpdateEmailInput, UpdatePhoneInput, UseCreateGuestAccount, UseCreateGuestAccountOptions, UseGetEncryptedAuthorizationKeyInterface, UseHeadlessDelegatedActionsInterface, UseLinkWithCrossAppInterface, UseLinkWithFarcaster, UseLinkWithFarcasterOptions, UseLinkWithOAuth, UseLinkWithSiwe, UseLinkWithSiweOptions, UseLinkWithSiwsInterface, UseLoginWithCrossAppInterface, UseLoginWithFarcaster, UseLoginWithFarcasterOptions, UseLoginWithFarcasterV2, UseLoginWithOAuth, UseLoginWithSiwe, UseLoginWithSiweOptions, UseLoginWithSiwsInterface, UseMfa, UseMfaEnrollment, UseOAuthTokens, UseOAuthTokensOptions, UseOnEmbeddedWalletStateChange, UseRecoverEmbeddedWallet, UseSendTransactionWithCrossAppInterface, UseSessionSignersInterface, UseSetEmbeddedWalletRecovery, UseSignMessageWithCrossAppInterface, UseSignTypedDataWithCrossAppInterface, UseSignersInterface, UseUnlinkEmailOptions, UseUnlinkFarcaster, UseUnlinkFarcasterOptions, UseUnlinkOAuth, UseUnlinkWallet, UseUnlinkWalletOptions, UseUpdateEmailInterface, UseUpdatePhoneInterface, createPrivyClient, getAccessToken, useAcceptTerms, useAuthorizationSignature, useCreateGuestAccount, useEmbeddedBitcoinWallet, useEmbeddedEthereumWallet, useEmbeddedSolanaWallet, useEmbeddedWallet, useEmbeddedWalletStateChange, useGetEncryptedAuthorizationKey, useHeadlessDelegatedActions, useIdentityToken, useLinkEmail, useLinkSMS, useLinkWithCrossApp, useLinkWithFarcaster, useLinkWithOAuth, useLinkWithSiwe, useLinkWithSiws, useLoginWithCrossApp, useLoginWithEmail, useLoginWithFarcaster, useLoginWithFarcasterV2, useLoginWithOAuth, useLoginWithSMS, useLoginWithSiwe, useLoginWithSiws, useMfa, useMfaEnrollment, useMigrateWallets, useOAuthFlow, useOAuthTokens, useOnNeedsRecovery, usePrivy, usePrivyClient, useRecoverEmbeddedWallet, useRegisterMfaListener, useSendTransactionWithCrossApp, useSessionSigners, useSetEmbeddedWalletRecovery, useSign7702Authorization, useSignMessageWithCrossApp, useSignTypedDataWithCrossApp, useSigners, useUnlinkEmail, useUnlinkFarcaster, useUnlinkOAuth, useUnlinkWallet, useUpdateEmail, useUpdatePhone };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); }var _chunkQSWCX5XIjs = require('./chunk-QSWCX5XI.js');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); }var _chunkQSWCX5XIjs = require('./chunk-QSWCX5XI.js');var _chunkOEKXMJDYjs = require('./chunk-OEKXMJDY.js');var _chunkFHT7IQ6Zjs = require('./chunk-FHT7IQ6Z.js');var _chunkQTVIWU3Njs = require('./chunk-QTVIWU3N.js');var _jssdkcore = require('@privy-io/js-sdk-core'); _createStarExport(_jssdkcore);var _react = require('react'); var _react2 = _interopRequireDefault(_react);var jt=({loading:t,error:e,unauthenticated:o,children:i})=>{let{isReady:u,error:p}=_chunkFHT7IQ6Zjs.X.call(void 0, ),d=_chunkFHT7IQ6Zjs.e.call(void 0, );if(!u)return _react2.default.createElement(_react2.default.Fragment,null,t);if(p&&e){let n=typeof e=="function"?e(p):e;return _react2.default.createElement(_react2.default.Fragment,null,n)}return d?_react2.default.createElement(_react2.default.Fragment,null,i):_react2.default.createElement(_react2.default.Fragment,null,o)};function T(t){return _chunkOEKXMJDYjs.a.call(void 0, t)}function F(t){let{state:e,start:o}=_chunkOEKXMJDYjs.a.call(void 0, _chunkQTVIWU3Njs.b.call(void 0, _chunkQTVIWU3Njs.a.call(void 0, {},t),{action:"link"}));return{state:e,link:o}}var H=t=>{let{client:e}=_react.useContext.call(void 0, _chunkFHT7IQ6Zjs.ba),o=_react.useRef.call(void 0, t);return _react.useEffect.call(void 0, ()=>{o.current=t},[t]),{unlinkOAuth:_react.useCallback.call(void 0, d=>_chunkQTVIWU3Njs.d.call(void 0, void 0,[d],function*({provider:u,subject:p}){var n,a,s,c;try{let{user:h}=yield e.auth.oauth.unlink(u,p);return(a=(n=o.current)==null?void 0:n.onSuccess)==null||a.call(n,h),h}catch(h){let m=_chunkFHT7IQ6Zjs.g.call(void 0, h);throw(c=(s=o.current)==null?void 0:s.onError)==null||c.call(s,m),m}}),[e.auth.oauth])}};var b=t=>{let{client:e}=_react.useContext.call(void 0, _chunkFHT7IQ6Zjs.ba),o=_react.useRef.call(void 0, t.onOAuthTokenGrant);o.current=t.onOAuthTokenGrant,_react.useEffect.call(void 0, ()=>{let{unsubscribe:i}=e.addOAuthTokensListener(u=>{o.current(u)});return i},[e])};exports.AuthBoundary = jt; exports.PrivyContext = _chunkFHT7IQ6Zjs.ba; exports.PrivyProvider = _chunkFHT7IQ6Zjs.da; exports.SecureStorageAdapter = _chunkQTVIWU3Njs.g; exports.createPrivyClient = _chunkFHT7IQ6Zjs.i; exports.getAccessToken = _chunkFHT7IQ6Zjs.ca; exports.hasError = _chunkQSWCX5XIjs.g; exports.isConnected = _chunkQSWCX5XIjs.a; exports.isConnecting = _chunkQSWCX5XIjs.c; exports.isCreating = _chunkQSWCX5XIjs.f; exports.isDisconnected = _chunkQSWCX5XIjs.d; exports.isNotCreated = _chunkQSWCX5XIjs.e; exports.isReconnecting = _chunkQSWCX5XIjs.b; exports.needsRecovery = _chunkQSWCX5XIjs.h; exports.useAcceptTerms = _chunkFHT7IQ6Zjs.Y; exports.useAuthorizationSignature = _chunkFHT7IQ6Zjs.Z; exports.useCreateGuestAccount = _chunkFHT7IQ6Zjs.N; exports.useEmbeddedBitcoinWallet = _chunkFHT7IQ6Zjs.W; exports.useEmbeddedEthereumWallet = _chunkFHT7IQ6Zjs.U; exports.useEmbeddedSolanaWallet = _chunkFHT7IQ6Zjs.V; exports.useEmbeddedWallet = _chunkFHT7IQ6Zjs.K; exports.useEmbeddedWalletStateChange = _chunkFHT7IQ6Zjs.L; exports.useGetEncryptedAuthorizationKey = _chunkFHT7IQ6Zjs._; exports.useHeadlessDelegatedActions = _chunkFHT7IQ6Zjs.y; exports.useIdentityToken = _chunkFHT7IQ6Zjs.M; exports.useLinkEmail = _chunkFHT7IQ6Zjs.p; exports.useLinkSMS = _chunkFHT7IQ6Zjs.s; exports.useLinkWithCrossApp = _chunkFHT7IQ6Zjs.E; exports.useLinkWithFarcaster = _chunkFHT7IQ6Zjs.u; exports.useLinkWithOAuth = F; exports.useLinkWithSiwe = _chunkFHT7IQ6Zjs.j; exports.useLinkWithSiws = _chunkFHT7IQ6Zjs.m; exports.useLoginWithCrossApp = _chunkFHT7IQ6Zjs.D; exports.useLoginWithEmail = _chunkFHT7IQ6Zjs.r; exports.useLoginWithFarcaster = _chunkFHT7IQ6Zjs.w; exports.useLoginWithFarcasterV2 = _chunkFHT7IQ6Zjs.x; exports.useLoginWithOAuth = _chunkOEKXMJDYjs.b; exports.useLoginWithSMS = _chunkFHT7IQ6Zjs.t; exports.useLoginWithSiwe = _chunkFHT7IQ6Zjs.k; exports.useLoginWithSiws = _chunkFHT7IQ6Zjs.n; exports.useMfa = _chunkFHT7IQ6Zjs.S; exports.useMfaEnrollment = _chunkFHT7IQ6Zjs.T; exports.useMigrateWallets = _chunkFHT7IQ6Zjs.aa; exports.useOAuthFlow = T; exports.useOAuthTokens = b; exports.useOnNeedsRecovery = _chunkFHT7IQ6Zjs.f; exports.usePrivy = _chunkFHT7IQ6Zjs.X; exports.usePrivyClient = _chunkFHT7IQ6Zjs.l; exports.useRecoverEmbeddedWallet = _chunkFHT7IQ6Zjs.J; exports.useRegisterMfaListener = _chunkFHT7IQ6Zjs.O; exports.useSendTransactionWithCrossApp = _chunkFHT7IQ6Zjs.H; exports.useSessionSigners = _chunkFHT7IQ6Zjs.z; exports.useSetEmbeddedWalletRecovery = _chunkFHT7IQ6Zjs.I; exports.useSign7702Authorization = _chunkFHT7IQ6Zjs.$; exports.useSignMessageWithCrossApp = _chunkFHT7IQ6Zjs.F; exports.useSignTypedDataWithCrossApp = _chunkFHT7IQ6Zjs.G; exports.useSigners = _chunkFHT7IQ6Zjs.A; exports.useUnlinkEmail = _chunkFHT7IQ6Zjs.q; exports.useUnlinkFarcaster = _chunkFHT7IQ6Zjs.v; exports.useUnlinkOAuth = H; exports.useUnlinkWallet = _chunkFHT7IQ6Zjs.o; exports.useUpdateEmail = _chunkFHT7IQ6Zjs.B; exports.useUpdatePhone = _chunkFHT7IQ6Zjs.C;
|
package/dist/passkey.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkQSWCX5XIjs = require('./chunk-QSWCX5XI.js');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkQSWCX5XIjs = require('./chunk-QSWCX5XI.js');var _chunkFHT7IQ6Zjs = require('./chunk-FHT7IQ6Z.js');var _chunkQTVIWU3Njs = require('./chunk-QTVIWU3N.js');var _react = require('react');var _jssdkcore = require('@privy-io/js-sdk-core');var X=e=>{let{client:n,passkeyState:h,setPasskeyState:s}=_react.useContext.call(void 0, _chunkFHT7IQ6Zjs.ba),c=_react.useCallback.call(void 0, o=>{var r;let a=_chunkFHT7IQ6Zjs.g.call(void 0, o);return s({status:"error",error:a}),(r=e==null?void 0:e.onError)==null||r.call(e,a),a},[e==null?void 0:e.onError]);return{linkWithPasskey:_react.useCallback.call(void 0, a=>_chunkQTVIWU3Njs.d.call(void 0, void 0,[a],function*({relyingParty:o}){var r;try{if(!_chunkFHT7IQ6Zjs.b.call(void 0, ))throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_link_passkey_before_logged_in",error:"Must be logged in to link a passkey."});s({status:"generating-challenege"});let{options:u}=yield n.auth.passkey.generateRegistrationOptions(o);s({status:"awaiting-passkey"});let k=yield _chunkFHT7IQ6Zjs.P.call(void 0, _chunkFHT7IQ6Zjs.R.call(void 0, u));s({status:"submitting-response"});let{user:y}=yield n.auth.passkey.linkWithPasskey(k,o);return s({status:"done"}),(r=e==null?void 0:e.onSuccess)==null||r.call(e,y),y}catch(t){throw c(t)}}),[n,c,e==null?void 0:e.onSuccess]),state:h}};var ne=e=>{let{client:n,passkeyState:h,setPasskeyState:s}=_react.useContext.call(void 0, _chunkFHT7IQ6Zjs.ba),c=_react.useCallback.call(void 0, o=>{var r;let a=_chunkFHT7IQ6Zjs.g.call(void 0, o);return s({status:"error",error:a}),(r=e==null?void 0:e.onError)==null||r.call(e,a),a},[e==null?void 0:e.onError]);return{loginWithPasskey:_react.useCallback.call(void 0, a=>_chunkQTVIWU3Njs.d.call(void 0, void 0,[a],function*({relyingParty:o}){var r,t,u,k;try{if(_chunkFHT7IQ6Zjs.b.call(void 0, ))throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_passkey_while_already_logged_in",error:"Already logged in, use `useLinkWithPasskey` if you are trying to link a passkey to an existing account"});s({status:"generating-challenege"});let{options:i}=yield n.auth.passkey.generateAuthenticationOptions(o);s({status:"awaiting-passkey"});let P=yield _chunkFHT7IQ6Zjs.Q.call(void 0, {challenge:i.challenge,rpId:i.rp_id,extensions:{appid:(r=i.extensions)==null?void 0:r.app_id,credProps:(t=i.extensions)==null?void 0:t.cred_props,hmacCreateSecret:(u=i.extensions)==null?void 0:u.hmac_create_secret},timeout:i.timeout,allowCredentials:i.allow_credentials,userVerification:i.user_verification});s({status:"submitting-response"});let w=_chunkFHT7IQ6Zjs.a.call(void 0, ),_=yield n.auth.passkey.loginWithPasskey(P,i.challenge,o,{embedded:w==null?void 0:w.embedded});return s({status:"done"}),(k=e==null?void 0:e.onSuccess)==null||k.call(e,_.user,_.is_new_user),_.user}catch(y){throw c(y)}}),[n,c,e==null?void 0:e.onSuccess]),state:h}};var me=e=>{let{client:n,passkeyState:h,setPasskeyState:s}=_react.useContext.call(void 0, _chunkFHT7IQ6Zjs.ba),c=_react.useRef.call(void 0, e);_react.useEffect.call(void 0, ()=>{c.current=e},[e]);let f=_react.useCallback.call(void 0, a=>{var t,u;let r=_chunkFHT7IQ6Zjs.g.call(void 0, a);return s({status:"error",error:r}),(u=(t=c.current)==null?void 0:t.onError)==null||u.call(t,r),r},[s]);return{signupWithPasskey:_react.useCallback.call(void 0, r=>_chunkQTVIWU3Njs.d.call(void 0, void 0,[r],function*({relyingParty:a}){var t,u;try{if(_chunkFHT7IQ6Zjs.b.call(void 0, ))throw new (0, _jssdkcore.PrivyClientError)({code:"attempted_login_with_passkey_while_already_logged_in",error:"Already logged in, use `useLinkWithPasskey` if you are trying to link a passkey to an existing account"});s({status:"generating-challenege"});let{options:y}=yield n.auth.passkey.generateSignupOptions(a);s({status:"awaiting-passkey"});let i=yield _chunkFHT7IQ6Zjs.P.call(void 0, _chunkFHT7IQ6Zjs.R.call(void 0, y));s({status:"submitting-response"});let P=yield n.auth.passkey.signupWithPasskey(i,a);return s({status:"done"}),(u=(t=c.current)==null?void 0:t.onSuccess)==null||u.call(t,P.user,P.is_new_user),{user:P.user}}catch(k){throw f(k)}}),[n.auth.passkey,f,s]),state:h}};exports.hasError = _chunkQSWCX5XIjs.g; exports.isConnected = _chunkQSWCX5XIjs.a; exports.isConnecting = _chunkQSWCX5XIjs.c; exports.isCreating = _chunkQSWCX5XIjs.f; exports.isDisconnected = _chunkQSWCX5XIjs.d; exports.isNotCreated = _chunkQSWCX5XIjs.e; exports.isReconnecting = _chunkQSWCX5XIjs.b; exports.needsRecovery = _chunkQSWCX5XIjs.h; exports.useLinkWithPasskey = X; exports.useLoginWithPasskey = ne; exports.useSignupWithPasskey = me;
|
package/dist/smart-wallets.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkQSWCX5XIjs = require('./chunk-QSWCX5XI.js');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkQSWCX5XIjs = require('./chunk-QSWCX5XI.js');var _chunkFHT7IQ6Zjs = require('./chunk-FHT7IQ6Z.js');var _chunkQTVIWU3Njs = require('./chunk-QTVIWU3N.js');var _react = require('react'); var _react2 = _interopRequireDefault(_react);var _jssdkcore = require('@privy-io/js-sdk-core');var _viem = require('viem');var _smartwallets = require('@privy-io/js-sdk-core/smart-wallets');var W=l=>_chunkQTVIWU3Njs.d.call(void 0, void 0,[l],function*({chain:t,privyAppId:e,user:a,embeddedWallet:r,smartWalletsConfig:n,client:o}){if(!(n!=null&&n.enabled)||!r||!_chunkQSWCX5XIjs.a.call(void 0, r))return;let f=yield o.embeddedWallet.getProvider(r.account),i=n==null?void 0:n.configured_networks.find($=>$.chain_id===`eip155:${t.id}`);if(!i)throw new (0, _jssdkcore.PrivyClientError)({code:"chain_not_supported",error:`The chain ${t.name} (eip155:${t.id}) must be configured in the smart wallet configuration in your dashboard`});let s=_jssdkcore.getUserSmartWallet.call(void 0, a),y=s?s.smart_wallet_type:n.smart_wallet_type,w=s?s.smart_wallet_version:n.smart_wallet_version,N=_jssdkcore.getJsonRpcEndpointFromChain.call(void 0, t,{rpcUrls:[]},e),O=_viem.createPublicClient.call(void 0, {chain:t,transport:_viem.http.call(void 0, N)}),P=yield _smartwallets.signerToSmartAccountClient.call(void 0, {owner:f,smartWalletType:y,smartWalletVersion:w,chain:t,publicClient:O,paymasterContext:j(i.paymaster_url,i.paymaster_context),bundlerUrl:i.bundler_url,paymasterUrl:i.paymaster_url});if(!P)throw new (0, _jssdkcore.PrivyClientError)({code:"smart_wallet_client_error",error:`Failed to create smart wallet client for chain ${t.name} (eip155:${t.id})`});return P}),B=/paymaster\.biconomy\.io\/api/i;function D(t){return B.test(t)}var Y={mode:"SPONSORED",calculateGasLimits:!0,expiryDuration:300,sponsorshipInfo:{webhookData:{},smartAccountInfo:{name:"BICONOMY",version:"2.0.0"}}},j=(t,e)=>{if(t&&D(t))return Y;if(e&&e.policy_id)return{policyId:e.policy_id}};var J=({children:t})=>_react2.default.createElement(z,null,_react2.default.createElement(H,null,_react2.default.createElement(K,null,t))),T=_react.createContext.call(void 0, {config:void 0}),v=()=>{let{config:t}=_react.useContext.call(void 0, T);return{config:t}},k=_react.createContext.call(void 0, {smartWalletClient:void 0}),V=()=>{let{smartWalletClient:t}=_react.useContext.call(void 0, k);return{smartWalletClient:t}},U=_react.createContext.call(void 0, {client:void 0}),q= exports.useSmartWallets =()=>{let{client:t}=_react.useContext.call(void 0, U),e=Q();return{client:t,getClientForChain:e}},z=({children:t})=>{let[e,a]=_react.useState.call(void 0, void 0),r=_chunkFHT7IQ6Zjs.l.call(void 0, );return _react.useEffect.call(void 0, ()=>{!e&&r&&(()=>_chunkQTVIWU3Njs.d.call(void 0, void 0,null,function*(){try{if(!r){console.warn("No client found");return}let o=yield r.app.getSmartWalletConfig();a(o)}catch(o){console.warn("Error generating smart wallet config: ",o)}}))()},[r,e]),_react2.default.createElement(T.Provider,{value:{config:e}},t)},H=({children:t})=>{let{config:e}=v(),{client:a,wallet:r}=_react.useContext.call(void 0, _chunkFHT7IQ6Zjs.ba),n=_chunkFHT7IQ6Zjs.d.call(void 0, ),[o,l]=_react.useState.call(void 0, );return _react.useEffect.call(void 0, ()=>{(()=>_chunkQTVIWU3Njs.d.call(void 0, void 0,null,function*(){if(!n&&o&&l(void 0),!(e!=null&&e.enabled)||!n||r.status!=="connected"||n&&o&&r.status==="connected")return;let i=a.embeddedWallet.chains.find(y=>e.configured_networks.map(w=>w.chain_id).includes(`eip155:${y.id}`));if(!i)throw new (0, _jssdkcore.PrivyClientError)({error:"Could not find smart wallets chain configurations for any Privy client configured chains. Please configure smart wallets for your chains in the Privy dashboard.",code:"chain_not_supported"});let s=yield W({chain:i,privyAppId:a.app.appId,user:n,embeddedWallet:r,smartWalletsConfig:e,client:a});if(!s)throw new (0, _jssdkcore.PrivyClientError)({error:"Could not create smart wallet client",code:"smart_wallet_client_error"});l(s)}))()},[!!(e!=null&&e.enabled),!!a,!!n,r.status]),_react2.default.createElement(k.Provider,{value:{smartWalletClient:o}},t)},K=({children:t})=>{let{client:e}=_react.useContext.call(void 0, _chunkFHT7IQ6Zjs.ba),a=_chunkFHT7IQ6Zjs.d.call(void 0, ),{smartWalletClient:r}=V(),{config:n}=v();return _react.useEffect.call(void 0, ()=>{(()=>_chunkQTVIWU3Njs.d.call(void 0, void 0,null,function*(){if(!(!r||!a||_jssdkcore.getUserSmartWallet.call(void 0, a)||!(n!=null&&n.enabled)))try{let{message:l}=yield e.auth.smartWallet.init({address:r.account.address,chainId:`eip155:${r.chain.id}`}),d=yield r.signMessage({message:l});yield e.auth.smartWallet.link(l,d,n.smart_wallet_type,n.smart_wallet_version)}catch(l){console.error("Error creating smart wallet:",l)}}))()},[!!r,!!a,!!_jssdkcore.getUserSmartWallet.call(void 0, a),n]),_react2.default.createElement(U.Provider,{value:{client:_jssdkcore.getUserSmartWallet.call(void 0, a)?r:void 0}},t)},Q=()=>{let{client:t,wallet:e}=_react.useContext.call(void 0, _chunkFHT7IQ6Zjs.ba),{config:a}=v();return _react.useCallback.call(void 0, n=>_chunkQTVIWU3Njs.d.call(void 0, void 0,[n],function*({chainId:r}){let o=_chunkFHT7IQ6Zjs.b.call(void 0, );if(!o)throw new (0, _jssdkcore.PrivyClientError)({error:"Must be logged in to get a smart wallet client",code:"smart_wallet_client_error"});if(!a||!a.enabled)throw new (0, _jssdkcore.PrivyClientError)({error:"Must have smart wallets enabled to get a smart wallet client",code:"smart_wallet_client_error"});let d=t.embeddedWallet.chains.find(i=>i.id===r);if(!d)throw new (0, _jssdkcore.PrivyClientError)({error:`Could not find chain with id: ${r}`,code:"chain_not_supported"});let f=yield W({chain:d,privyAppId:t.app.appId,user:o,embeddedWallet:e,smartWalletsConfig:a,client:t});if(!f)throw new (0, _jssdkcore.PrivyClientError)({error:`Could not create smart wallet client for chain ${r}`,code:"smart_wallet_client_error"});return f}),[a,e,t])};exports.SmartWalletsProvider = J; exports.useSmartWallets = q;
|