@privy-io/expo 0.74.2 → 0.75.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-SMZX5SMH.js → chunk-5ZRKD53Z.js} +2 -2
- package/dist/{chunk-N2TBAO4F.js → chunk-AZJ2Z2SD.js} +1 -1
- package/dist/esm/chunk-5ZRKD53Z.js +12 -0
- package/dist/esm/{chunk-N2TBAO4F.js → chunk-AZJ2Z2SD.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 +6 -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/esm/chunk-SMZX5SMH.js +0 -12
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 _chunk5ZRKD53Zjs = require('./chunk-5ZRKD53Z.js');var _chunkK5SPDXVFjs = require('./chunk-K5SPDXVF.js');var _react = require('react');var _jssdkcore = require('@privy-io/js-sdk-core');var f=()=>{let e=_chunk5ZRKD53Zjs.m.call(void 0, );return _react.useMemo.call(void 0, ()=>({createWallet(n){return _chunkK5SPDXVFjs.e.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=_chunk5ZRKD53Zjs.m.call(void 0, );return _react.useMemo.call(void 0, ()=>({signRawHash(k){return _chunkK5SPDXVFjs.e.call(void 0, this,arguments,function*({address:n,chainType:s,hash:o}){let l=_chunk5ZRKD53Zjs.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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Privy from '@privy-io/js-sdk-core';
|
|
2
|
-
import Privy__default, { EmbeddedWalletConfig, DepositConfig, GenerateDepositAddressInput, DepositAddressQuote, GetDepositInput, DepositAddressOrder, WaitForDepositInput, DepositAddressPollingResult, WaitForCompletionInput, CreateCryptoDepositAccountInput, CreateCryptoDepositAccountResponse, CryptoDepositAccountQuoteInput, CryptoDepositAccountQuote, UnsignedTransactionRequest, OnNeedsRecovery, MfaMethod, SessionSignerInput, PrivyEmbeddedWalletProvider, PrivyEmbeddedSolanaWalletProvider, EmbeddedBitcoinWalletProvider, GenerateAuthorizationSignatureInput, GenerateAuthorizationSignatureOutput, Storage, Chain, OAuthProviderID, PrivyPlugin, Logger } from '@privy-io/js-sdk-core';
|
|
2
|
+
import Privy__default, { EmbeddedWalletConfig, DepositConfig, GenerateDepositAddressInput, DepositAddressQuote, GetDepositInput, DepositAddressOrder, WaitForDepositInput, DepositAddressPollingResult, WaitForCompletionInput, CreateCryptoDepositAccountInput, CreateCryptoDepositAccountResponse, CryptoDepositAccountQuoteInput, CryptoDepositAccountQuote, GetCryptoDepositAccountOrderInput, GetCryptoDepositAccountOrderResponse, GetCryptoDepositAccountNextOrderInput, GetCryptoDepositAccountNextOrderResponse, UnsignedTransactionRequest, OnNeedsRecovery, MfaMethod, SessionSignerInput, PrivyEmbeddedWalletProvider, PrivyEmbeddedSolanaWalletProvider, EmbeddedBitcoinWalletProvider, GenerateAuthorizationSignatureInput, GenerateAuthorizationSignatureOutput, Storage, Chain, OAuthProviderID, PrivyPlugin, Logger } from '@privy-io/js-sdk-core';
|
|
3
3
|
export * from '@privy-io/js-sdk-core';
|
|
4
|
-
export { CreateCryptoDepositAccountInput, CreateCryptoDepositAccountResponse, CryptoDepositAccountQuote, CryptoDepositAccountQuoteInput, DataSuffixPlugin, DepositAddressOrder, DepositAddressPollingResult, DepositAddressQuote, DepositConfig, GenerateDepositAddressInput, GetDepositInput, WaitForCompletionInput, WaitForDepositInput, createDataSuffixPlugin as dataSuffix } from '@privy-io/js-sdk-core';
|
|
4
|
+
export { CreateCryptoDepositAccountInput, CreateCryptoDepositAccountResponse, CryptoDepositAccountQuote, CryptoDepositAccountQuoteInput, DataSuffixPlugin, DepositAddressOrder, DepositAddressPollingResult, DepositAddressQuote, DepositConfig, GenerateDepositAddressInput, GetCryptoDepositAccountNextOrderInput, GetCryptoDepositAccountNextOrderResponse, GetCryptoDepositAccountOrderInput, GetCryptoDepositAccountOrderResponse, GetDepositInput, WaitForCompletionInput, WaitForDepositInput, createDataSuffixPlugin as dataSuffix } from '@privy-io/js-sdk-core';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { E as ErrorCallback, A as AuthLinkSuccessCallback, G as GenerateSiweMessage, S as SiweFlowState, a as AuthSuccessCallback, O as OtpLinkHookOptions, b as OtpLinkHookResult, c as OtpLoginHookOptions, d as OtpLoginHookResult, F as FarcasterFlowState, L as LinkFarcasterInput, e as SubmitFarcasterOptions, f as LoginWithFarcasterInput, g as EmbeddedWalletState, P as PublicKeyCredentialRequestOptionsJSON, h as EmbeddedSolanaWalletState, i as OtpFlowState, j as OAuthFlowState, W as WalletRecoveryCallbacks, k as SolanaWalletRecoveryCallbacks, R as RecoveryFlowState, l as PasskeyFlowState } from './types-045de424.js';
|
|
7
7
|
export { Z as CreateEthereumEmbeddedWalletOpts, Y as CreateOrRecoverEmbeddedWalletProps, $ as CreateSolanaEmbeddedWalletOpts, a2 as CustomAuthFlowState, a6 as EmbeddedSolanaWalletActions, a7 as EmbeddedSolanaWalletStatus, q as EmbeddedWallet, a4 as EmbeddedWalletActions, a5 as EmbeddedWalletStatus, o as LinkedAccountWithMetadata, a3 as MfaConfig, N as PrivyAppleOauthAccount, t as PrivyBitcoinSegwitEmbeddedWalletAccount, u as PrivyBitcoinTaprootEmbeddedWalletAccount, X as PrivyCrossAppWalletAccount, Q as PrivyCustomJwtAccount, D as PrivyDiscordOauthAccount, w as PrivyEmailAccount, p as PrivyEmbeddedWalletAccount, y as PrivyEthereumAccount, r as PrivyEthereumEmbeddedWalletAccount, T as PrivyFarcasterAccount, H as PrivyGithubOauthAccount, B as PrivyGoogleOauthAccount, J as PrivyInstagramOauthAccount, n as PrivyLinkedAccount, M as PrivyLinkedInOauthAccount, U as PrivyPasskeyAccount, x as PrivyPhoneAccount, v as PrivySmartWalletAccount, z as PrivySolanaAccount, s as PrivySolanaEmbeddedWalletAccount, I as PrivySpotifyOauthAccount, V as PrivyTelegramAccount, K as PrivyTiktokOauthAccount, C as PrivyTwitterOauthAccount, m as PrivyUser, _ as RecoverEthereumEmbeddedWalletOpts, a0 as RecoverSolanaEmbeddedWalletOpts, a1 as SetRecoveryProps, ae as hasError, a8 as isConnected, aa as isConnecting, ad as isCreating, ab as isDisconnected, ac as isNotCreated, a9 as isReconnecting, af as needsRecovery } from './types-045de424.js';
|
|
@@ -380,6 +380,10 @@ interface UseHeadlessCryptoDepositInterface {
|
|
|
380
380
|
createCryptoDepositAccount: (opts: CreateCryptoDepositAccountInput) => Promise<CreateCryptoDepositAccountResponse>;
|
|
381
381
|
/** Fetches an indicative quote. */
|
|
382
382
|
getQuote: (opts: CryptoDepositAccountQuoteInput) => Promise<CryptoDepositAccountQuote>;
|
|
383
|
+
/** Fetches a crypto deposit-account sweep by wallet action ID. */
|
|
384
|
+
getOrder: (opts: GetCryptoDepositAccountOrderInput) => Promise<GetCryptoDepositAccountOrderResponse>;
|
|
385
|
+
/** Fetches the next sweep after `after`. */
|
|
386
|
+
getNextOrder: (opts: GetCryptoDepositAccountNextOrderInput) => Promise<GetCryptoDepositAccountNextOrderResponse>;
|
|
383
387
|
}
|
|
384
388
|
/** @experimental This interface may change at any time. */
|
|
385
389
|
declare const useHeadlessCryptoDeposit: () => UseHeadlessCryptoDepositInterface;
|
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 _chunkAZJ2Z2SDjs = require('./chunk-AZJ2Z2SD.js');var _chunk5ZRKD53Zjs = require('./chunk-5ZRKD53Z.js');var _chunkK5SPDXVFjs = require('./chunk-K5SPDXVF.js');var _jssdkcore = require('@privy-io/js-sdk-core'); _createStarExport(_jssdkcore);var _react = require('react'); var _react2 = _interopRequireDefault(_react);var Kt=({loading:t,error:e,unauthenticated:o,children:i})=>{let{isReady:u,error:p}=_chunk5ZRKD53Zjs.aa.call(void 0, ),U=_chunk5ZRKD53Zjs.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 U?_react2.default.createElement(_react2.default.Fragment,null,i):_react2.default.createElement(_react2.default.Fragment,null,o)};function g(t){return _chunkAZJ2Z2SDjs.a.call(void 0, t)}function F(t){let{state:e,start:o}=_chunkAZJ2Z2SDjs.a.call(void 0, _chunkK5SPDXVFjs.c.call(void 0, _chunkK5SPDXVFjs.b.call(void 0, {},t),{action:"link"}));return{state:e,link:o}}var H=t=>{let{client:e}=_react.useContext.call(void 0, _chunk5ZRKD53Zjs.ka),o=_react.useRef.call(void 0, t);return _react.useEffect.call(void 0, ()=>{o.current=t},[t]),{unlinkOAuth:_react.useCallback.call(void 0, U=>_chunkK5SPDXVFjs.e.call(void 0, void 0,[U],function*({provider:u,subject:p}){var n,A,s,O;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 c=_chunk5ZRKD53Zjs.h.call(void 0, h);throw(O=(s=o.current)==null?void 0:s.onError)==null||O.call(s,c),c}}),[e.auth.oauth])}};var D=t=>{let{client:e}=_react.useContext.call(void 0, _chunk5ZRKD53Zjs.ka),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 = Kt; exports.PrivyContext = _chunk5ZRKD53Zjs.ka; exports.PrivyProvider = _chunk5ZRKD53Zjs.ma; exports.SecureStorageAdapter = _chunkK5SPDXVFjs.h; exports.createPrivyClient = _chunk5ZRKD53Zjs.j; exports.dataSuffix = _jssdkcore.createDataSuffixPlugin; exports.getAccessToken = _chunk5ZRKD53Zjs.la; 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 = _chunk5ZRKD53Zjs.ba; exports.useAuthorizationSignature = _chunk5ZRKD53Zjs.ca; exports.useCreateGuestAccount = _chunk5ZRKD53Zjs.Q; exports.useDepositAddress = _chunk5ZRKD53Zjs.A; exports.useEmbeddedBitcoinWallet = _chunk5ZRKD53Zjs.$; exports.useEmbeddedEthereumWallet = _chunk5ZRKD53Zjs.Z; exports.useEmbeddedSolanaWallet = _chunk5ZRKD53Zjs._; exports.useEmbeddedWallet = _chunk5ZRKD53Zjs.N; exports.useEmbeddedWalletStateChange = _chunk5ZRKD53Zjs.O; exports.useGetEncryptedAuthorizationKey = _chunk5ZRKD53Zjs.da; exports.useHeadlessCryptoDeposit = _chunk5ZRKD53Zjs.B; exports.useHeadlessDelegatedActions = _chunk5ZRKD53Zjs.z; exports.useIdentityToken = _chunk5ZRKD53Zjs.P; exports.useImportWallet = _chunk5ZRKD53Zjs.Y; exports.useLinkEmail = _chunk5ZRKD53Zjs.q; exports.useLinkSMS = _chunk5ZRKD53Zjs.t; exports.useLinkWithCrossApp = _chunk5ZRKD53Zjs.H; exports.useLinkWithFarcaster = _chunk5ZRKD53Zjs.v; exports.useLinkWithOAuth = F; exports.useLinkWithSiwe = _chunk5ZRKD53Zjs.k; exports.useLinkWithSiws = _chunk5ZRKD53Zjs.n; exports.useLoginWithCrossApp = _chunk5ZRKD53Zjs.G; exports.useLoginWithEmail = _chunk5ZRKD53Zjs.s; exports.useLoginWithFarcaster = _chunk5ZRKD53Zjs.x; exports.useLoginWithFarcasterV2 = _chunk5ZRKD53Zjs.y; exports.useLoginWithOAuth = _chunkAZJ2Z2SDjs.b; exports.useLoginWithSMS = _chunk5ZRKD53Zjs.u; exports.useLoginWithSiwe = _chunk5ZRKD53Zjs.l; exports.useLoginWithSiws = _chunk5ZRKD53Zjs.o; exports.useMfa = _chunk5ZRKD53Zjs.V; exports.useMfaEnrollment = _chunk5ZRKD53Zjs.W; exports.useMigrateWallets = _chunk5ZRKD53Zjs.ja; exports.useOAuthFlow = g; exports.useOAuthTokens = D; exports.useOnNeedsRecovery = _chunk5ZRKD53Zjs.f; exports.usePrivy = _chunk5ZRKD53Zjs.aa; exports.usePrivyClient = _chunk5ZRKD53Zjs.m; exports.useRecoverEmbeddedWallet = _chunk5ZRKD53Zjs.M; exports.useRegisterMfaListener = _chunk5ZRKD53Zjs.R; exports.useSendTransactionWithCrossApp = _chunk5ZRKD53Zjs.K; exports.useSessionSigners = _chunk5ZRKD53Zjs.C; exports.useSetEmbeddedWalletRecovery = _chunk5ZRKD53Zjs.L; exports.useSign7702Authorization = _chunk5ZRKD53Zjs.ea; exports.useSignMessageWithCrossApp = _chunk5ZRKD53Zjs.I; exports.useSignTypedDataWithCrossApp = _chunk5ZRKD53Zjs.J; exports.useSigners = _chunk5ZRKD53Zjs.D; exports.useStoredUsers = _chunk5ZRKD53Zjs.ha; exports.useSwitchUser = _chunk5ZRKD53Zjs.ia; exports.useTransfer = _chunk5ZRKD53Zjs.fa; exports.useUnlinkEmail = _chunk5ZRKD53Zjs.r; exports.useUnlinkFarcaster = _chunk5ZRKD53Zjs.w; exports.useUnlinkOAuth = H; exports.useUnlinkPasskey = _chunk5ZRKD53Zjs.X; exports.useUnlinkWallet = _chunk5ZRKD53Zjs.p; exports.useUpdateEmail = _chunk5ZRKD53Zjs.E; exports.useUpdatePhone = _chunk5ZRKD53Zjs.F; exports.useWalletActions = _chunk5ZRKD53Zjs.ga;
|
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 _chunk5ZRKD53Zjs = require('./chunk-5ZRKD53Z.js');var _chunkK5SPDXVFjs = require('./chunk-K5SPDXVF.js');var _react = require('react');var _jssdkcore = require('@privy-io/js-sdk-core');var Y=e=>{let{client:a,passkeyState:P,setPasskeyState:s}=_react.useContext.call(void 0, _chunk5ZRKD53Zjs.ka),c=_react.useCallback.call(void 0, o=>{var n;let r=_chunk5ZRKD53Zjs.h.call(void 0, o);return s({status:"error",error:r}),(n=e==null?void 0:e.onError)==null||n.call(e,r),r},[e==null?void 0:e.onError]);return{linkWithPasskey:_react.useCallback.call(void 0, n=>_chunkK5SPDXVFjs.e.call(void 0, void 0,[n],function*({relyingParty:o,extra_options:r}){var u;try{if(!_chunk5ZRKD53Zjs.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:k}=yield a.auth.passkey.generateRegistrationOptions(o);s({status:"awaiting-passkey"});let y=yield _chunk5ZRKD53Zjs.S.call(void 0, _chunk5ZRKD53Zjs.U.call(void 0, k),r);s({status:"submitting-response"});let{user:l}=yield a.auth.passkey.linkWithPasskey(y,o);return s({status:"done"}),(u=e==null?void 0:e.onSuccess)==null||u.call(e,l),l}catch(t){throw c(t)}}),[a,c,e==null?void 0:e.onSuccess]),state:P}};var ie=e=>{let{client:a,passkeyState:P,setPasskeyState:s}=_react.useContext.call(void 0, _chunk5ZRKD53Zjs.ka),c=_react.useCallback.call(void 0, o=>{var n;let r=_chunk5ZRKD53Zjs.h.call(void 0, o);return s({status:"error",error:r}),(n=e==null?void 0:e.onError)==null||n.call(e,r),r},[e==null?void 0:e.onError]);return{loginWithPasskey:_react.useCallback.call(void 0, n=>_chunkK5SPDXVFjs.e.call(void 0, void 0,[n],function*({relyingParty:o,extra_options:r}){var u,t,k,y;try{if(_chunk5ZRKD53Zjs.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 a.auth.passkey.generateAuthenticationOptions(o);s({status:"awaiting-passkey"});let f=yield _chunk5ZRKD53Zjs.T.call(void 0, {challenge:i.challenge,rpId:i.rp_id,extensions:{appid:(u=i.extensions)==null?void 0:u.app_id,credProps:(t=i.extensions)==null?void 0:t.cred_props,hmacCreateSecret:(k=i.extensions)==null?void 0:k.hmac_create_secret},timeout:i.timeout,allowCredentials:i.allow_credentials,userVerification:i.user_verification},r);s({status:"submitting-response"});let _=_chunk5ZRKD53Zjs.a.call(void 0, ),b=yield a.auth.passkey.loginWithPasskey(f,i.challenge,o,{embedded:_==null?void 0:_.embedded});return s({status:"done"}),(y=e==null?void 0:e.onSuccess)==null||y.call(e,b.user,b.is_new_user),b.user}catch(l){throw c(l)}}),[a,c,e==null?void 0:e.onSuccess]),state:P}};var pe=e=>{let{client:a,passkeyState:P,setPasskeyState:s}=_react.useContext.call(void 0, _chunk5ZRKD53Zjs.ka),c=_react.useRef.call(void 0, e);_react.useEffect.call(void 0, ()=>{c.current=e},[e]);let d=_react.useCallback.call(void 0, r=>{var u,t;let n=_chunk5ZRKD53Zjs.h.call(void 0, r);return s({status:"error",error:n}),(t=(u=c.current)==null?void 0:u.onError)==null||t.call(u,n),n},[s]);return{signupWithPasskey:_react.useCallback.call(void 0, u=>_chunkK5SPDXVFjs.e.call(void 0, void 0,[u],function*({relyingParty:r,extra_options:n}){var t,k;try{if(_chunk5ZRKD53Zjs.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:l}=yield a.auth.passkey.generateSignupOptions(r);s({status:"awaiting-passkey"});let i=yield _chunk5ZRKD53Zjs.S.call(void 0, _chunk5ZRKD53Zjs.U.call(void 0, l),n);s({status:"submitting-response"});let f=yield a.auth.passkey.signupWithPasskey(i,r);return s({status:"done"}),(k=(t=c.current)==null?void 0:t.onSuccess)==null||k.call(t,f.user,f.is_new_user),{user:f.user}}catch(y){throw d(y)}}),[a.auth.passkey,d,s]),state:P}};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 = Y; exports.useLoginWithPasskey = ie; exports.useSignupWithPasskey = pe;
|
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 _chunk5ZRKD53Zjs = require('./chunk-5ZRKD53Z.js');var _chunkK5SPDXVFjs = require('./chunk-K5SPDXVF.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 P=y=>_chunkK5SPDXVFjs.e.call(void 0, void 0,[y],function*({chain:t,privyAppId:e,user:a,embeddedWallet:r,smartWalletsConfig:n,client:i,dataSuffix:c}){if(!(n!=null&&n.enabled)||!r||!_chunkQSWCX5XIjs.a.call(void 0, r))return;let s=yield i.embeddedWallet.getProvider(r.account),o=n==null?void 0:n.configured_networks.find(B=>B.chain_id===`eip155:${t.id}`);if(!o)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 l=_jssdkcore.getUserSmartWallet.call(void 0, a),C=l?l.smart_wallet_type:n.smart_wallet_type,W=l?l.smart_wallet_version:n.smart_wallet_version,F=_jssdkcore.getJsonRpcEndpointFromChain.call(void 0, t,{rpcUrls:[]},e),G=_viem.createPublicClient.call(void 0, {chain:t,transport:_viem.http.call(void 0, F)}),E=yield _smartwallets.signerToSmartAccountClient.call(void 0, {owner:s,smartWalletType:C,smartWalletVersion:W,chain:t,publicClient:G,paymasterContext:Q(o.paymaster_url,o.paymaster_context),bundlerUrl:o.bundler_url,paymasterUrl:o.paymaster_url});if(!E)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 K(E,c)});function K(t,e){return e?t.extend(a=>({sendTransaction:r=>a.sendTransaction(_chunkK5SPDXVFjs.c.call(void 0, _chunkK5SPDXVFjs.b.call(void 0, {},r),{dataSuffix:e}))})):t}var V=/paymaster\.biconomy\.io\/api/i;function q(t){return V.test(t)}var z={mode:"SPONSORED",calculateGasLimits:!0,expiryDuration:300,sponsorshipInfo:{webhookData:{},smartAccountInfo:{name:"BICONOMY",version:"2.0.0"}}},Q=(t,e)=>{if(t&&q(t))return z;if(e&&e.policy_id)return{policyId:e.policy_id}};var U=3,tt=500,et= exports.SmartWalletsProvider =({children:t})=>_react2.default.createElement(at,null,_react2.default.createElement(it,null,_react2.default.createElement(lt,null,t))),D=_react.createContext.call(void 0, {config:void 0}),b=()=>{let{config:t}=_react.useContext.call(void 0, D);return{config:t}},R=_react.createContext.call(void 0, {smartWalletClient:void 0}),rt=()=>{let{smartWalletClient:t}=_react.useContext.call(void 0, R);return{smartWalletClient:t}},$=_react.createContext.call(void 0, {client:void 0}),nt= exports.useSmartWallets =()=>{let{client:t}=_react.useContext.call(void 0, $),e=ot();return{client:t,getClientForChain:e}},at=({children:t})=>{let[e,a]=_react.useState.call(void 0, void 0),r=_chunk5ZRKD53Zjs.m.call(void 0, );return _react.useEffect.call(void 0, ()=>{!e&&r&&(()=>_chunkK5SPDXVFjs.e.call(void 0, void 0,null,function*(){try{if(!r){console.warn("No client found");return}let i=yield r.app.getSmartWalletConfig();a(i)}catch(i){console.warn("Error generating smart wallet config: ",i)}}))()},[r,e]),_react2.default.createElement(D.Provider,{value:{config:e}},t)},it=({children:t})=>{let{config:e}=b(),{client:a,wallet:r}=_react.useContext.call(void 0, _chunk5ZRKD53Zjs.ka),n=_chunk5ZRKD53Zjs.d.call(void 0, ),[i,c]=_react.useState.call(void 0, );return _react.useEffect.call(void 0, ()=>{(()=>_chunkK5SPDXVFjs.e.call(void 0, void 0,null,function*(){var l;if(!n&&i&&c(void 0),!(e!=null&&e.enabled)||!n||r.status!=="connected"||n&&i&&r.status==="connected")return;let s=a.embeddedWallet.chains.find(C=>e.configured_networks.map(W=>W.chain_id).includes(`eip155:${C.id}`));if(!s)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 o=yield P({chain:s,privyAppId:a.app.appId,user:n,embeddedWallet:r,smartWalletsConfig:e,client:a,dataSuffix:(l=_jssdkcore.getDataSuffixPlugin.call(void 0, a.plugins))==null?void 0:l.suffix});if(!o)throw new (0, _jssdkcore.PrivyClientError)({error:"Could not create smart wallet client",code:"smart_wallet_client_error"});c(o)}))()},[!!(e!=null&&e.enabled),!!a,!!n,r.status]),_react2.default.createElement(R.Provider,{value:{smartWalletClient:i}},t)},lt=({children:t})=>{let{client:e,wallet:a}=_react.useContext.call(void 0, _chunk5ZRKD53Zjs.ka),r=_chunk5ZRKD53Zjs.d.call(void 0, ),{smartWalletClient:n}=rt(),{config:i}=b();return _react.useEffect.call(void 0, ()=>{let c=!1;return(()=>_chunkK5SPDXVFjs.e.call(void 0, void 0,null,function*(){var d;if(!(!n||!r||_jssdkcore.getUserSmartWallet.call(void 0, r)||!(i!=null&&i.enabled)||a.status!=="connected"))for(let s=0;s<U;s++){if(c||_jssdkcore.getUserSmartWallet.call(void 0, (d=_chunk5ZRKD53Zjs.b.call(void 0, ))!=null?d:r))return;let o=!1;for(let l=0;l<5;l++){if(c)return;if(yield e.embeddedWallet.ping(tt)){o=!0;break}yield _chunk5ZRKD53Zjs.i.call(void 0, 200*_chunkK5SPDXVFjs.a.call(void 0, 2,l))}if(o)try{let{message:l}=yield e.auth.smartWallet.init({address:n.account.address,chainId:`eip155:${n.chain.id}`}),C=yield n.signMessage({message:l});yield e.auth.smartWallet.link(l,C,i.smart_wallet_type,i.smart_wallet_version);return}catch(l){s===U-1?console.error("Error creating smart wallet:",l):yield _chunk5ZRKD53Zjs.i.call(void 0, 500*_chunkK5SPDXVFjs.a.call(void 0, 2,s))}}}))(),()=>{c=!0}},[!!n,!!r,!!_jssdkcore.getUserSmartWallet.call(void 0, r),i,a.status]),_react2.default.createElement($.Provider,{value:{client:_jssdkcore.getUserSmartWallet.call(void 0, r)?n:void 0}},t)},ot=()=>{let{client:t,wallet:e}=_react.useContext.call(void 0, _chunk5ZRKD53Zjs.ka),{config:a}=b();return _react.useCallback.call(void 0, n=>_chunkK5SPDXVFjs.e.call(void 0, void 0,[n],function*({chainId:r}){var s;let i=_chunk5ZRKD53Zjs.b.call(void 0, );if(!i)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 y=t.embeddedWallet.chains.find(o=>o.id===r);if(!y)throw new (0, _jssdkcore.PrivyClientError)({error:`Could not find chain with id: ${r}`,code:"chain_not_supported"});let d=yield P({chain:y,privyAppId:t.app.appId,user:i,embeddedWallet:e,smartWalletsConfig:a,client:t,dataSuffix:(s=_jssdkcore.getDataSuffixPlugin.call(void 0, t.plugins))==null?void 0:s.suffix});if(!d)throw new (0, _jssdkcore.PrivyClientError)({error:`Could not create smart wallet client for chain ${r}`,code:"smart_wallet_client_error"});return d}),[a,e,t])};exports.SmartWalletsProvider = et; exports.useSmartWallets = nt;
|