@privy-io/js-sdk-core 0.41.4 → 0.41.5
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/cjs/client/PrivyInternal.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/smart-wallets.js +1 -1
- package/dist/dts/index.d.mts +13 -13
- package/dist/dts/index.d.ts +13 -13
- package/dist/esm/client/PrivyInternal.mjs +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/smart-wallets.mjs +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("fetch-retry"),t=require("uuid"),s=require("@privy-io/api-base"),i=require("@privy-io/public-api"),r=require("../Error.js"),a=require("../Session.js"),n=require("../toAbortSignalTimeout.js"),o=require("../utils/toSearchParams.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("eventemitter3"),require("jose"),require("js-cookie"),require("../Token.js"),require("../utils/allSettled.js");var c=/*#__PURE__*/h(e);let l="privy:caid";exports.PrivyInternal=class{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 r.PrivyClientError({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.createAnalyticsEvent("sdk_initialize",{})}}async fetch(e,{body:t,params:s,query:a,headers:n,options:h={onRequest:this._beforeRequest.bind(this)}}){let c=new Request(`${this.baseUrl}${i.getPathWithParams(e.path,s)}${o.toSearchParams(a)}`,{method:e.method,body:JSON.stringify(t),headers:n}),l=await h.onRequest(c),d=await this._fetch(c,l),u=await d.json();if(d.status>299)throw new r.PrivyApiError(u);return u}async _beforeRequestWithoutInitialize(e){let t=await this.session.getToken(),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:n.default(2e4),headers:s,credentials:"include"}}async beforeRequestWithoutRefresh(e){return await this._initialize(),this._beforeRequestWithoutInitialize(e)}async _beforeRequest(e){return await this._initialize(),await this.getAccessToken(),this.beforeRequestWithoutRefresh(e)}async getAppConfig(){return await this.fetch(i.AppConfig,{params:{app_id:this.appId},options:{onRequest:this._beforeRequestWithoutInitialize.bind(this)}})}async _getOrGenerateClientAnalyticsId(){if(this._analyticsId)return this._analyticsId;try{let e=await this._storage.get(l);if("string"==typeof e&&e.length>0)return this._analyticsId=e,e}catch(e){console.error("Unable to load clientId",e)}try{this._analyticsId=t.v4()}catch(e){console.error("Unable to generate uuidv4",e)}if(!this._analyticsId)return null;try{await this._storage.put(l,this._analyticsId)}catch(e){console.error(`Unable to store clientId: ${this._analyticsId}`,e)}return this._analyticsId}async destroyClientAnalyticsId(){try{return await this._storage.del(l)}catch(e){console.error("Unable to delete clientId",e)}}async createAnalyticsEvent(e,t){try{await this.fetch(i.AnalyticsEvent,{body:{event_name:e,client_id:await this._getOrGenerateClientAnalyticsId(),payload:t},options:{onRequest:this.beforeRequestWithoutRefresh.bind(this)}})}catch(e){}}async refreshSession(e=!1){let t=await this.session.getRefreshToken()??void 0,s=t??"key",i=this._cache.get(s);if(i)return console.debug("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 a=await this.session.getToken();if(!this.session.hasRefreshCredentials(a,e??null))throw await this._initialize(),new r.PrivyApiError({code:s.PrivyErrorCode.MISSING_OR_INVALID_TOKEN,error:"No tokens found in storage"});try{let s=await this.fetch(i.RefreshSession,{body:{refresh_token:e},options:{onRequest:this.beforeRequestWithoutRefresh.bind(this)}}),r=s.session_update_action;return t||this.callbacks?.setUser?.(s.user),"set"===r&&await this.session.updateWithTokensResponse(s),"clear"===r&&(await this.session.destroyLocalState(),t||this.callbacks?.setUser?.(null)),"ignore"===r&&s.token&&(await this.session.storeToken(s.token),s.identity_token&&await this.session.storeIdentityToken(s.identity_token)),s}catch(e){throw e instanceof r.PrivyApiError&&e.code===s.PrivyErrorCode.MISSING_OR_INVALID_TOKEN&&(await this.session.destroyLocalState(),t||this.callbacks?.setUser?.(null)),e}}async getAccessToken(){let[e,t]=await Promise.all([this.session.getToken(),this.session.getRefreshToken()]);return!this.session.tokenIsActive(e)&&this.session.hasRefreshCredentials(e,t)?(await this.refreshSession(),await this.session.getToken()):e}async getIdentityToken(){return await this.session.getIdentityToken()}async isStorageAccessible(){try{let e=`privy:__storage__test-${t.v4()}`,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 console.error(e),!1}}constructor(e){this._sdkVersion="js-sdk-core:0.41.
|
|
1
|
+
"use strict";var e=require("fetch-retry"),t=require("uuid"),s=require("@privy-io/api-base"),i=require("@privy-io/public-api"),r=require("../Error.js"),a=require("../Session.js"),n=require("../toAbortSignalTimeout.js"),o=require("../utils/toSearchParams.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("eventemitter3"),require("jose"),require("js-cookie"),require("../Token.js"),require("../utils/allSettled.js");var c=/*#__PURE__*/h(e);let l="privy:caid";exports.PrivyInternal=class{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 r.PrivyClientError({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.createAnalyticsEvent("sdk_initialize",{})}}async fetch(e,{body:t,params:s,query:a,headers:n,options:h={onRequest:this._beforeRequest.bind(this)}}){let c=new Request(`${this.baseUrl}${i.getPathWithParams(e.path,s)}${o.toSearchParams(a)}`,{method:e.method,body:JSON.stringify(t),headers:n}),l=await h.onRequest(c),d=await this._fetch(c,l),u=await d.json();if(d.status>299)throw new r.PrivyApiError(u);return u}async _beforeRequestWithoutInitialize(e){let t=await this.session.getToken(),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:n.default(2e4),headers:s,credentials:"include"}}async beforeRequestWithoutRefresh(e){return await this._initialize(),this._beforeRequestWithoutInitialize(e)}async _beforeRequest(e){return await this._initialize(),await this.getAccessToken(),this.beforeRequestWithoutRefresh(e)}async getAppConfig(){return await this.fetch(i.AppConfig,{params:{app_id:this.appId},options:{onRequest:this._beforeRequestWithoutInitialize.bind(this)}})}async _getOrGenerateClientAnalyticsId(){if(this._analyticsId)return this._analyticsId;try{let e=await this._storage.get(l);if("string"==typeof e&&e.length>0)return this._analyticsId=e,e}catch(e){console.error("Unable to load clientId",e)}try{this._analyticsId=t.v4()}catch(e){console.error("Unable to generate uuidv4",e)}if(!this._analyticsId)return null;try{await this._storage.put(l,this._analyticsId)}catch(e){console.error(`Unable to store clientId: ${this._analyticsId}`,e)}return this._analyticsId}async destroyClientAnalyticsId(){try{return await this._storage.del(l)}catch(e){console.error("Unable to delete clientId",e)}}async createAnalyticsEvent(e,t){try{await this.fetch(i.AnalyticsEvent,{body:{event_name:e,client_id:await this._getOrGenerateClientAnalyticsId(),payload:t},options:{onRequest:this.beforeRequestWithoutRefresh.bind(this)}})}catch(e){}}async refreshSession(e=!1){let t=await this.session.getRefreshToken()??void 0,s=t??"key",i=this._cache.get(s);if(i)return console.debug("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 a=await this.session.getToken();if(!this.session.hasRefreshCredentials(a,e??null))throw await this._initialize(),new r.PrivyApiError({code:s.PrivyErrorCode.MISSING_OR_INVALID_TOKEN,error:"No tokens found in storage"});try{let s=await this.fetch(i.RefreshSession,{body:{refresh_token:e},options:{onRequest:this.beforeRequestWithoutRefresh.bind(this)}}),r=s.session_update_action;return t||this.callbacks?.setUser?.(s.user),"set"===r&&await this.session.updateWithTokensResponse(s),"clear"===r&&(await this.session.destroyLocalState(),t||this.callbacks?.setUser?.(null)),"ignore"===r&&s.token&&(await this.session.storeToken(s.token),s.identity_token&&await this.session.storeIdentityToken(s.identity_token)),s}catch(e){throw e instanceof r.PrivyApiError&&e.code===s.PrivyErrorCode.MISSING_OR_INVALID_TOKEN&&(await this.session.destroyLocalState(),t||this.callbacks?.setUser?.(null)),e}}async getAccessToken(){let[e,t]=await Promise.all([this.session.getToken(),this.session.getRefreshToken()]);return!this.session.tokenIsActive(e)&&this.session.hasRefreshCredentials(e,t)?(await this.refreshSession(),await this.session.getToken()):e}async getIdentityToken(){return await this.session.getIdentityToken()}async isStorageAccessible(){try{let e=`privy:__storage__test-${t.v4()}`,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 console.error(e),!1}}constructor(e){this._sdkVersion="js-sdk-core:0.41.5",this._cache=new Map,this._storage=e.storage,this._analyticsId=null,this._getOrGenerateClientAnalyticsId(),this.baseUrl=e.baseUrl??"https://auth.privy.io",this.appId=e.appId,this.appClientId=e.appClientId,this._sdkVersion=e.sdkVersion??this._sdkVersion,this.callbacks=e.callbacks,this.nativeAppIdentifier=e.nativeAppIdentifier,this.session=new a.Session({storage:this._storage,isUsingServerCookies:!1,appId:e.appId}),this._fetch=c.default(fetch,{retries:3,retryDelay:500}),this.session.on("error_storing_tokens",(e=>{this.createAnalyticsEvent("error_updating_tokens_in_storage",{reason:e})}))}};
|
package/dist/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./client/Privy.js"),r=require("@privy-io/public-api"),t=require("./storage/LocalStorage.js"),s=require("./storage/InMemoryStorage.js"),i=require("./Error.js"),o=require("./embedded/errors.js"),a=require("./utils/getUserEmbeddedEthereumWallet.js"),n=require("./utils/getAllUserEmbeddedEthereumWallets.js"),l=require("./utils/getAllUserEmbeddedSolanaWallets.js"),u=require("./utils/getAllUserEmbeddedBitcoinWallets.js"),d=require("./utils/getEntropyDetailsFromUser.js"),p=require("./utils/getEntropyDetailsFromAccount.js"),c=require("./utils/getUserSmartWallet.js"),m=require("./embedded/utils/index.js"),j=require("./utils/phoneNumberUtils.js"),q=require("./utils/getUserEmbeddedSolanaWallet.js"),h=require("./utils/toObjectKeys.js"),A=require("./embedded/utils/gas.js"),g=require("./embedded/utils/ethers.js"),b=require("./utils/getIsTokenUsdc.js"),E=require("./funding/moonpay.js"),y=require("./funding/coinbase.js"),x=require("./solana/client.js"),C=require("./solana/getSolanaRpcEndpointForCluster.js"),P=require("./solana/getSolanaUsdcMintAddressForCluster.js"),S=require("./solana/getSolanaClusterDisplayName.js"),f=require("./types.js"),T=require("./chains/index.js"),I=require("./utils/formatters.js"),U=require("libphonenumber-js/min"),v=require("./index-BDWdfIuK.js"),W=require("./index-DzfqDJJ9.js");require("./client/AppApi.js"),require("./client/CrossAppApi.js"),require("./Token.js"),require("jose"),require("./client/DelegatedWalletsApi.js"),require("./client/EmbeddedWalletApi.js"),require("./embedded/EmbeddedBitcoinWalletProvider.js"),require("./embedded/EmbeddedWalletProxy.js"),require("./utils/sleep.js"),require("./embedded/EventCallbackQueue.js"),require("./embedded/withMfa.js"),require("./embedded/EmbeddedWalletProvider.js"),require("eventemitter3"),require("./embedded/methods.js"),require("./embedded/EmbeddedSolanaWalletProvider.js"),require("./solana/getWalletPublicKeyFromTransaction.js"),require("./solana/isVersionedTransaction.js"),require("./client/MfaPromises.js"),require("./client/PrivyInternal.js"),require("fetch-retry"),require("uuid"),require("@privy-io/api-base"),require("./Session.js"),require("js-cookie"),require("./utils/allSettled.js"),require("./toAbortSignalTimeout.js"),require("./utils/toSearchParams.js"),require("./client/UserApi.js"),require("./client/auth/AuthApi.js"),require("./client/auth/CustomProviderApi.js"),require("./client/auth/maybeCreateWalletOnLogin.js"),require("./utils/shouldCreateEmbeddedEthWallet.js"),require("./utils/shouldCreateEmbeddedSolWallet.js"),require("./client/auth/EmailApi.js"),require("./client/auth/FarcasterApi.js"),require("./client/auth/FarcasterV2Api.js"),require("./client/auth/GuestApi.js"),require("./client/auth/OAuthApi.js"),require("./pkce.js"),require("./client/auth/PasskeyApi.js"),require("./client/auth/PhoneApi.js"),require("./client/auth/SiweApi.js"),require("./client/auth/SmartWalletApi.js"),require("./client/funding/FundingApi.js"),require("./client/funding/CoinbaseOnRampApi.js"),require("./client/funding/MoonpayOnRampApi.js"),require("./client/mfa/MfaApi.js"),require("./client/mfa/MfaPasskeyApi.js"),require("./client/mfa/MfaSmsApi.js"),require("./client/recovery/RecoveryApi.js"),require("./client/recovery/RecoveryICloudApi.js"),require("./client/recovery/RecoveryOAuthApi.js"),require("./embedded/types.js"),require("@ethersproject/abstract-signer"),require("@ethersproject/providers"),require("./embedded/gas/arbitrum.js"),require("@ethersproject/bignumber"),require("./chains/arbitrum.js"),require("./chains/arbitrumGoerli.js"),require("./chains/arbitrumSepolia.js"),require("./embedded/gas/bsc.js"),require("./embedded/gas/op-stack.js"),require("@ethersproject/contracts"),require("@ethersproject/transactions"),require("./chains/base.js"),require("./chains/baseGoerli.js"),require("./chains/baseSepolia.js"),require("./chains/optimism.js"),require("./chains/optimismGoerli.js"),require("./chains/optimismSepolia.js"),require("./chains/zora.js"),require("./chains/zoraSepolia.js"),require("./chains/zoraTestnet.js"),require("./embedded/gas/polygon.js"),require("@ethersproject/units"),require("./chains/polygon.js"),require("./chains/polygonAmoy.js"),require("./chains/polygonMumbai.js"),require("libphonenumber-js/examples.mobile.json"),require("./chains/avalanche.js"),require("./chains/avalancheFuji.js"),require("./chains/mainnet.js"),require("./chains/sepolia.js"),require("./chains/celo.js"),require("./chains/berachainArtio.js"),require("./chains/celoAlfajores.js"),require("./chains/filecoin.js"),require("./chains/filecoinCalibration.js"),require("./chains/garnetHolesky.js"),require("./chains/goerli.js"),require("./chains/holesky.js"),require("./chains/linea.js"),require("./chains/lineaTestnet.js"),require("./chains/redstone.js"),require("./chains/redstoneHolesky.js"),require("viem"),require("./action/delegatedActions/delegateWallet.js"),require("./action/delegatedActions/utils.js"),require("./action/delegatedActions/revokeWallets.js"),require("./action/crossApp/loginWithCrossAppAuth.js"),require("./action/crossApp/linkWithCrossAppAuth.js"),require("./index-CARkJvRM.js"),require("./action/crossApp/wallet/signMessage.js"),require("./action/crossApp/wallet/utils/isCrossAppWalletSmart.js"),require("./action/crossApp/wallet/utils/sendCrossAppRequest.js"),require("./action/crossApp/wallet/utils/getCrossAppAccountByWalletAddress.js"),require("./action/crossApp/wallet/utils/getProviderAccessTokenOrRelink.js"),require("./action/crossApp/wallet/utils/throwIfNotLoggedIn.js"),require("./action/crossApp/wallet/signTypedData.js"),require("./utils/typedData/generateDomainType.js"),require("./action/crossApp/wallet/sendTransaction.js"),exports.default=e.default,Object.defineProperty(exports,"BICONOMY",{enumerable:!0,get:function(){return r.BICONOMY}}),Object.defineProperty(exports,"COINBASE_SMART_WALLET",{enumerable:!0,get:function(){return r.COINBASE_SMART_WALLET}}),Object.defineProperty(exports,"KERNEL",{enumerable:!0,get:function(){return r.KERNEL}}),Object.defineProperty(exports,"LIGHT_ACCOUNT",{enumerable:!0,get:function(){return r.LIGHT_ACCOUNT}}),Object.defineProperty(exports,"SAFE",{enumerable:!0,get:function(){return r.SAFE}}),exports.LocalStorage=t.LocalStorage,exports.InMemoryCache=s.InMemoryCache,exports.MoonpayApiError=i.MoonpayApiError,exports.PrivyApiError=i.PrivyApiError,exports.PrivyClientError=i.PrivyClientError,exports.createErrorFormatter=i.createErrorFormatter,exports.errorIndicatesMfaCanceled=i.errorIndicatesMfaCanceled,exports.EmbeddedProviderError=o.EmbeddedProviderError,exports.PrivyConnectorError=o.PrivyConnectorError,exports.PrivyEmbeddedWalletErrorCode=o.PrivyEmbeddedWalletErrorCode,exports.PrivyProviderRpcError=o.PrivyProviderRpcError,exports.ProviderErrors=o.ProviderErrors,exports.errorIndicatesMaxMfaRetries=o.errorIndicatesMaxMfaRetries,exports.errorIndicatesMfaRateLimit=o.errorIndicatesMfaRateLimit,exports.errorIndicatesMfaTimeout=o.errorIndicatesMfaTimeout,exports.errorIndicatesMfaVerificationFailed=o.errorIndicatesMfaVerificationFailed,exports.errorIndicatesRecoveryIsNeeded=o.errorIndicatesRecoveryIsNeeded,exports.getUserEmbeddedEthereumWallet=a.getUserEmbeddedEthereumWallet,exports.getUserEmbeddedWallet=a.getUserEmbeddedWallet,exports.getAllUserEmbeddedEthereumWallets=n.getAllUserEmbeddedEthereumWallets,exports.getAllUserEmbeddedSolanaWallets=l.getAllUserEmbeddedSolanaWallets,exports.getAllUserEmbeddedBitcoinWallets=u.getAllUserEmbeddedBitcoinWallets,exports.getEntropyDetailsFromUser=d.getEntropyDetailsFromUser,exports.getEntropyDetailsFromAccount=p.getEntropyDetailsFromAccount,exports.getUserSmartWallet=c.getUserSmartWallet,exports.getJsonRpcEndpointFromChain=m.getJsonRpcEndpointFromChain,exports.populateTransactionRequest=m.populateTransactionRequest,exports.throwIfInvalidRecoveryUpgradePath=m.throwIfInvalidRecoveryUpgradePath,exports.countryCodesAndNumbers=j.countryCodesAndNumbers,exports.formatPhoneNumber=j.formatPhoneNumber,exports.getPhoneCountryCodeAndNumber=j.getPhoneCountryCodeAndNumber,exports.getPlaceholderPhoneNumber=j.getPlaceholderPhoneNumber,exports.lastFourDigits=j.lastFourDigits,exports.phoneNumberTypingFormatter=j.phoneNumberTypingFormatter,exports.validatePhoneNumber=j.validatePhoneNumber,exports.getUserEmbeddedSolanaWallet=q.getUserEmbeddedSolanaWallet,exports.toObjectKeys=h.toObjectKeys,exports.calculateTotalGasEstimate=A.calculateTotalGasEstimate,exports.QuantityToBigNumber=g.QuantityToBigNumber,exports.convertBigNumberish=g.convertBigNumberish,exports.toEthersUnsignedTransaction=g.toEthersUnsignedTransaction,exports.UsdcAddressMap=b.UsdcAddressMap,exports.getIsTokenUsdc=b.getIsTokenUsdc,exports.chainToMoonpayCurrency=E.chainToMoonpayCurrency,exports.fundingMethodToMoonpayPaymentMethod=E.fundingMethodToMoonpayPaymentMethod,exports.isSupportedChainIdForMoonpay=E.isSupportedChainIdForMoonpay,exports.getCoinbaseOnRampUrl=y.getCoinbaseOnRampUrl,exports.isSupportedChainIdForCoinbaseOnramp=y.isSupportedChainIdForCoinbaseOnramp,exports.toCoinbaseAssetId=y.toCoinbaseAssetId,exports.toCoinbaseBlockchainFromChainId=y.toCoinbaseBlockchainFromChainId,exports.SolanaClient=x.SolanaClient,exports.getSolanaRpcEndpointForCluster=C.getSolanaRpcEndpointForCluster,exports.getSolanaUsdcMintAddressForCluster=P.getSolanaUsdcMintAddressForCluster,exports.getSolanaClusterDisplayName=S.getSolanaClusterDisplayName,exports.ALL_WALLET_CLIENT_TYPES=f.ALL_WALLET_CLIENT_TYPES,exports.SUPPORTED_CONNECTOR_TYPES=f.SUPPORTED_CONNECTOR_TYPES,exports.DEFAULT_SUPPORTED_CHAINS=T.DEFAULT_SUPPORTED_CHAINS,exports.DEFAULT_SUPPORTED_CHAIN_IDS=T.DEFAULT_SUPPORTED_CHAIN_IDS,exports.chainDefs=T.chainDefs,exports.getSupportedChainById=T.getSupportedChainById,exports.formatLamportsAmount=I.formatLamportsAmount,exports.formatTokenAmount=I.formatTokenAmount,exports.formatWalletAddress=I.formatWalletAddress,exports.formatWeiAmount=I.formatWeiAmount,Object.defineProperty(exports,"getCountryCallingCode",{enumerable:!0,get:function(){return U.getCountryCallingCode}}),exports.delegatedActions=v.index,exports.crossApp=W.index;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./client/Privy.js"),r=require("@privy-io/public-api"),t=require("./storage/LocalStorage.js"),s=require("./storage/InMemoryStorage.js"),i=require("./Error.js"),o=require("./embedded/errors.js"),a=require("./utils/getUserEmbeddedEthereumWallet.js"),n=require("./utils/getAllUserEmbeddedEthereumWallets.js"),l=require("./utils/getAllUserEmbeddedSolanaWallets.js"),u=require("./utils/getAllUserEmbeddedBitcoinWallets.js"),d=require("./utils/getEntropyDetailsFromUser.js"),p=require("./utils/getEntropyDetailsFromAccount.js"),c=require("./utils/getUserSmartWallet.js"),m=require("./embedded/utils/index.js"),j=require("./utils/phoneNumberUtils.js"),q=require("./utils/getUserEmbeddedSolanaWallet.js"),h=require("./utils/toObjectKeys.js"),g=require("./embedded/utils/gas.js"),A=require("./embedded/utils/ethers.js"),b=require("./utils/getIsTokenUsdc.js"),E=require("./funding/moonpay.js"),y=require("./funding/coinbase.js"),x=require("./solana/client.js"),C=require("./solana/getSolanaRpcEndpointForCluster.js"),P=require("./solana/getSolanaUsdcMintAddressForCluster.js"),f=require("./solana/getSolanaClusterDisplayName.js"),S=require("./types.js"),T=require("./chains/index.js"),I=require("./utils/formatters.js"),U=require("libphonenumber-js/min"),v=require("./index-BDWdfIuK.js"),W=require("./index-DzfqDJJ9.js");require("./client/AppApi.js"),require("./client/CrossAppApi.js"),require("./Token.js"),require("jose"),require("./client/DelegatedWalletsApi.js"),require("./client/EmbeddedWalletApi.js"),require("./embedded/EmbeddedBitcoinWalletProvider.js"),require("./embedded/EmbeddedWalletProxy.js"),require("./utils/sleep.js"),require("./embedded/EventCallbackQueue.js"),require("./embedded/withMfa.js"),require("./embedded/EmbeddedWalletProvider.js"),require("eventemitter3"),require("./embedded/methods.js"),require("./embedded/EmbeddedSolanaWalletProvider.js"),require("./solana/getWalletPublicKeyFromTransaction.js"),require("./solana/isVersionedTransaction.js"),require("./client/MfaPromises.js"),require("./client/PrivyInternal.js"),require("fetch-retry"),require("uuid"),require("@privy-io/api-base"),require("./Session.js"),require("js-cookie"),require("./utils/allSettled.js"),require("./toAbortSignalTimeout.js"),require("./utils/toSearchParams.js"),require("./client/UserApi.js"),require("./client/auth/AuthApi.js"),require("./client/auth/CustomProviderApi.js"),require("./client/auth/maybeCreateWalletOnLogin.js"),require("./utils/shouldCreateEmbeddedEthWallet.js"),require("./utils/shouldCreateEmbeddedSolWallet.js"),require("./client/auth/EmailApi.js"),require("./client/auth/FarcasterApi.js"),require("./client/auth/FarcasterV2Api.js"),require("./client/auth/GuestApi.js"),require("./client/auth/OAuthApi.js"),require("./pkce.js"),require("./client/auth/PasskeyApi.js"),require("./client/auth/PhoneApi.js"),require("./client/auth/SiweApi.js"),require("./client/auth/SmartWalletApi.js"),require("./client/funding/FundingApi.js"),require("./client/funding/CoinbaseOnRampApi.js"),require("./client/funding/MoonpayOnRampApi.js"),require("./client/mfa/MfaApi.js"),require("./client/mfa/MfaPasskeyApi.js"),require("./client/mfa/MfaSmsApi.js"),require("./client/recovery/RecoveryApi.js"),require("./client/recovery/RecoveryICloudApi.js"),require("./client/recovery/RecoveryOAuthApi.js"),require("./embedded/types.js"),require("@ethersproject/abstract-signer"),require("@ethersproject/providers"),require("./embedded/gas/arbitrum.js"),require("@ethersproject/bignumber"),require("./chains/arbitrum.js"),require("./chains/arbitrumGoerli.js"),require("./chains/arbitrumSepolia.js"),require("./embedded/gas/bsc.js"),require("./embedded/gas/op-stack.js"),require("@ethersproject/contracts"),require("@ethersproject/transactions"),require("./chains/base.js"),require("./chains/baseGoerli.js"),require("./chains/baseSepolia.js"),require("./chains/optimism.js"),require("./chains/optimismGoerli.js"),require("./chains/optimismSepolia.js"),require("./chains/zora.js"),require("./chains/zoraSepolia.js"),require("./chains/zoraTestnet.js"),require("./embedded/gas/polygon.js"),require("@ethersproject/units"),require("./chains/polygon.js"),require("./chains/polygonAmoy.js"),require("./chains/polygonMumbai.js"),require("libphonenumber-js/examples.mobile.json"),require("./chains/avalanche.js"),require("./chains/avalancheFuji.js"),require("./chains/mainnet.js"),require("./chains/sepolia.js"),require("./chains/celo.js"),require("./chains/berachainArtio.js"),require("./chains/celoAlfajores.js"),require("./chains/filecoin.js"),require("./chains/filecoinCalibration.js"),require("./chains/garnetHolesky.js"),require("./chains/goerli.js"),require("./chains/holesky.js"),require("./chains/linea.js"),require("./chains/lineaTestnet.js"),require("./chains/redstone.js"),require("./chains/redstoneHolesky.js"),require("viem"),require("./action/delegatedActions/delegateWallet.js"),require("./action/delegatedActions/utils.js"),require("./action/delegatedActions/revokeWallets.js"),require("./action/crossApp/loginWithCrossAppAuth.js"),require("./action/crossApp/linkWithCrossAppAuth.js"),require("./index-CARkJvRM.js"),require("./action/crossApp/wallet/signMessage.js"),require("./action/crossApp/wallet/utils/isCrossAppWalletSmart.js"),require("./action/crossApp/wallet/utils/sendCrossAppRequest.js"),require("./action/crossApp/wallet/utils/getCrossAppAccountByWalletAddress.js"),require("./action/crossApp/wallet/utils/getProviderAccessTokenOrRelink.js"),require("./action/crossApp/wallet/utils/throwIfNotLoggedIn.js"),require("./action/crossApp/wallet/signTypedData.js"),require("./utils/typedData/generateDomainType.js"),require("./action/crossApp/wallet/sendTransaction.js"),exports.default=e.default,Object.defineProperty(exports,"BICONOMY",{enumerable:!0,get:function(){return r.BICONOMY}}),Object.defineProperty(exports,"COINBASE_SMART_WALLET",{enumerable:!0,get:function(){return r.COINBASE_SMART_WALLET}}),Object.defineProperty(exports,"KERNEL",{enumerable:!0,get:function(){return r.KERNEL}}),Object.defineProperty(exports,"LIGHT_ACCOUNT",{enumerable:!0,get:function(){return r.LIGHT_ACCOUNT}}),Object.defineProperty(exports,"SAFE",{enumerable:!0,get:function(){return r.SAFE}}),Object.defineProperty(exports,"THIRDWEB",{enumerable:!0,get:function(){return r.THIRDWEB}}),exports.LocalStorage=t.LocalStorage,exports.InMemoryCache=s.InMemoryCache,exports.MoonpayApiError=i.MoonpayApiError,exports.PrivyApiError=i.PrivyApiError,exports.PrivyClientError=i.PrivyClientError,exports.createErrorFormatter=i.createErrorFormatter,exports.errorIndicatesMfaCanceled=i.errorIndicatesMfaCanceled,exports.EmbeddedProviderError=o.EmbeddedProviderError,exports.PrivyConnectorError=o.PrivyConnectorError,exports.PrivyEmbeddedWalletErrorCode=o.PrivyEmbeddedWalletErrorCode,exports.PrivyProviderRpcError=o.PrivyProviderRpcError,exports.ProviderErrors=o.ProviderErrors,exports.errorIndicatesMaxMfaRetries=o.errorIndicatesMaxMfaRetries,exports.errorIndicatesMfaRateLimit=o.errorIndicatesMfaRateLimit,exports.errorIndicatesMfaTimeout=o.errorIndicatesMfaTimeout,exports.errorIndicatesMfaVerificationFailed=o.errorIndicatesMfaVerificationFailed,exports.errorIndicatesRecoveryIsNeeded=o.errorIndicatesRecoveryIsNeeded,exports.getUserEmbeddedEthereumWallet=a.getUserEmbeddedEthereumWallet,exports.getUserEmbeddedWallet=a.getUserEmbeddedWallet,exports.getAllUserEmbeddedEthereumWallets=n.getAllUserEmbeddedEthereumWallets,exports.getAllUserEmbeddedSolanaWallets=l.getAllUserEmbeddedSolanaWallets,exports.getAllUserEmbeddedBitcoinWallets=u.getAllUserEmbeddedBitcoinWallets,exports.getEntropyDetailsFromUser=d.getEntropyDetailsFromUser,exports.getEntropyDetailsFromAccount=p.getEntropyDetailsFromAccount,exports.getUserSmartWallet=c.getUserSmartWallet,exports.getJsonRpcEndpointFromChain=m.getJsonRpcEndpointFromChain,exports.populateTransactionRequest=m.populateTransactionRequest,exports.throwIfInvalidRecoveryUpgradePath=m.throwIfInvalidRecoveryUpgradePath,exports.countryCodesAndNumbers=j.countryCodesAndNumbers,exports.formatPhoneNumber=j.formatPhoneNumber,exports.getPhoneCountryCodeAndNumber=j.getPhoneCountryCodeAndNumber,exports.getPlaceholderPhoneNumber=j.getPlaceholderPhoneNumber,exports.lastFourDigits=j.lastFourDigits,exports.phoneNumberTypingFormatter=j.phoneNumberTypingFormatter,exports.validatePhoneNumber=j.validatePhoneNumber,exports.getUserEmbeddedSolanaWallet=q.getUserEmbeddedSolanaWallet,exports.toObjectKeys=h.toObjectKeys,exports.calculateTotalGasEstimate=g.calculateTotalGasEstimate,exports.QuantityToBigNumber=A.QuantityToBigNumber,exports.convertBigNumberish=A.convertBigNumberish,exports.toEthersUnsignedTransaction=A.toEthersUnsignedTransaction,exports.UsdcAddressMap=b.UsdcAddressMap,exports.getIsTokenUsdc=b.getIsTokenUsdc,exports.chainToMoonpayCurrency=E.chainToMoonpayCurrency,exports.fundingMethodToMoonpayPaymentMethod=E.fundingMethodToMoonpayPaymentMethod,exports.isSupportedChainIdForMoonpay=E.isSupportedChainIdForMoonpay,exports.getCoinbaseOnRampUrl=y.getCoinbaseOnRampUrl,exports.isSupportedChainIdForCoinbaseOnramp=y.isSupportedChainIdForCoinbaseOnramp,exports.toCoinbaseAssetId=y.toCoinbaseAssetId,exports.toCoinbaseBlockchainFromChainId=y.toCoinbaseBlockchainFromChainId,exports.SolanaClient=x.SolanaClient,exports.getSolanaRpcEndpointForCluster=C.getSolanaRpcEndpointForCluster,exports.getSolanaUsdcMintAddressForCluster=P.getSolanaUsdcMintAddressForCluster,exports.getSolanaClusterDisplayName=f.getSolanaClusterDisplayName,exports.ALL_WALLET_CLIENT_TYPES=S.ALL_WALLET_CLIENT_TYPES,exports.SUPPORTED_CONNECTOR_TYPES=S.SUPPORTED_CONNECTOR_TYPES,exports.DEFAULT_SUPPORTED_CHAINS=T.DEFAULT_SUPPORTED_CHAINS,exports.DEFAULT_SUPPORTED_CHAIN_IDS=T.DEFAULT_SUPPORTED_CHAIN_IDS,exports.chainDefs=T.chainDefs,exports.getSupportedChainById=T.getSupportedChainById,exports.formatLamportsAmount=I.formatLamportsAmount,exports.formatTokenAmount=I.formatTokenAmount,exports.formatWalletAddress=I.formatWalletAddress,exports.formatWeiAmount=I.formatWeiAmount,Object.defineProperty(exports,"getCountryCallingCode",{enumerable:!0,get:function(){return U.getCountryCallingCode}}),exports.delegatedActions=v.index,exports.crossApp=W.index;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("permissionless"),t=require("permissionless/accounts"),r=require("permissionless/clients/pimlico"),n=require("viem"),i=require("viem/account-abstraction"),a=require("@privy-io/public-api");let
|
|
1
|
+
"use strict";var e=require("permissionless"),t=require("permissionless/accounts"),r=require("permissionless/clients/pimlico"),n=require("viem"),i=require("viem/account-abstraction"),a=require("@privy-io/public-api");let o={address:i.entryPoint06Address,version:"0.6"},s={address:i.entryPoint07Address,version:"0.7"},c=({owner:e,smartWalletType:r,publicClient:n})=>{switch(r){case a.SAFE:return t.toSafeSmartAccount({client:n,entryPoint:s,owners:[e],version:"1.4.1"});case a.KERNEL:return t.toEcdsaKernelSmartAccount({client:n,version:"0.3.1",entryPoint:s,owners:[e]});case a.BICONOMY:return t.toBiconomySmartAccount({client:n,owners:[e],entryPoint:o});case a.LIGHT_ACCOUNT:return t.toLightSmartAccount({client:n,entryPoint:o,owner:e,version:"1.1.0"});case a.COINBASE_SMART_WALLET:return async function({client:e,owner:t}){let[r]=await t.request({method:"eth_accounts"});if(!r)throw Error("Unable to request embedded owner for eth_accounts");return await i.toCoinbaseSmartAccount({client:e,owners:[{type:"local",source:"privy",address:r,sign:async({hash:e})=>await t.request({method:"secp256k1_sign",params:[e]})}]})}({client:n,owner:e});case a.THIRDWEB:return t.toThirdwebSmartAccount({client:n,entryPoint:s,owner:e});default:throw Error(`Invalid smart account type: ${r}.`)}},l=["rpc.zerodev.app","public.pimlico.io","api.pimlico.io"];exports.signerToSmartAccountClient=async({owner:t,smartWalletType:i,chain:a,publicClient:o,bundlerUrl:s,paymasterUrl:u,paymasterContext:p})=>{let m=await c({owner:t,smartWalletType:i,publicClient:o}),y=r.createPimlicoClient({transport:n.http(s),entryPoint:m.entryPoint}),d=u?r.createPimlicoClient({transport:n.http(u),entryPoint:m.entryPoint}):void 0;return e.createSmartAccountClient({account:m,chain:a,paymaster:d,paymasterContext:p,bundlerTransport:n.http(s),userOperation:{estimateFeesPerGas:async()=>{if(l.some((e=>s.includes(e))))return await y.getUserOperationGasPrice().then((e=>e.fast));{let e=await o.estimateFeesPerGas(),t=s.includes("api.developer.coinbase.com")?175n:150n;return{...e,maxFeePerGas:e.maxFeePerGas*t/100n,maxPriorityFeePerGas:e.maxPriorityFeePerGas*t/100n}}}}})};
|
package/dist/dts/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _privy_io_public_api from '@privy-io/public-api';
|
|
2
2
|
import { PasskeyAuthenticateInputType, PrivyEthereumEmbeddedWalletAccount, PrivySolanaEmbeddedWalletAccount, PrivyUser, PrivySmartWalletConfigurationResponse, PrivyAuthenticatedUser, OAuthProviderType, SmartWalletType, CoinbaseOnRampInitInput, PrivyMoonpayOnRampSignInput, MfaPasskeyInitInputType, MfaSmsInitInputType, PrivyBitcoinSegwitEmbeddedWalletAccount as PrivyBitcoinSegwitEmbeddedWalletAccount$1, PrivyBitcoinTaprootEmbeddedWalletAccount as PrivyBitcoinTaprootEmbeddedWalletAccount$1, PrivySmartWalletAccount, PrivyCoinbaseOnRampInitResponse, PrivyCoinbaseOnRampInitInput } from '@privy-io/public-api';
|
|
3
|
-
export { BICONOMY, COINBASE_SMART_WALLET, KERNEL, LIGHT_ACCOUNT, OAuthProviderType, SAFE, SmartWalletType } from '@privy-io/public-api';
|
|
3
|
+
export { BICONOMY, COINBASE_SMART_WALLET, KERNEL, LIGHT_ACCOUNT, OAuthProviderType, SAFE, SmartWalletType, THIRDWEB } from '@privy-io/public-api';
|
|
4
4
|
import EventEmitter from 'eventemitter3';
|
|
5
5
|
import { PrivyErrorCode } from '@privy-io/api-base';
|
|
6
6
|
import { PrivyBitcoinSegwitEmbeddedWalletAccount, PrivyBitcoinTaprootEmbeddedWalletAccount, PrivySolanaEmbeddedWalletAccount as PrivySolanaEmbeddedWalletAccount$1, PrivyAuthenticatedUser as PrivyAuthenticatedUser$1, PrivyEthereumEmbeddedWalletAccount as PrivyEthereumEmbeddedWalletAccount$1 } from '@privy-io/public-api/schemas';
|
|
@@ -1088,7 +1088,7 @@ declare class EmbeddedWalletApi {
|
|
|
1088
1088
|
} | {
|
|
1089
1089
|
type: "smart_wallet";
|
|
1090
1090
|
address: string;
|
|
1091
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
1091
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
1092
1092
|
verified_at: number;
|
|
1093
1093
|
first_verified_at: number | null;
|
|
1094
1094
|
latest_verified_at: number | null;
|
|
@@ -1447,7 +1447,7 @@ declare class UserApi {
|
|
|
1447
1447
|
} | {
|
|
1448
1448
|
type: "smart_wallet";
|
|
1449
1449
|
address: string;
|
|
1450
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
1450
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
1451
1451
|
verified_at: number;
|
|
1452
1452
|
first_verified_at: number | null;
|
|
1453
1453
|
latest_verified_at: number | null;
|
|
@@ -1742,7 +1742,7 @@ declare class EmailApi {
|
|
|
1742
1742
|
} | {
|
|
1743
1743
|
type: "smart_wallet";
|
|
1744
1744
|
address: string;
|
|
1745
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
1745
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
1746
1746
|
verified_at: number;
|
|
1747
1747
|
first_verified_at: number | null;
|
|
1748
1748
|
latest_verified_at: number | null;
|
|
@@ -1992,7 +1992,7 @@ declare class EmailApi {
|
|
|
1992
1992
|
} | {
|
|
1993
1993
|
type: "smart_wallet";
|
|
1994
1994
|
address: string;
|
|
1995
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
1995
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
1996
1996
|
verified_at: number;
|
|
1997
1997
|
first_verified_at: number | null;
|
|
1998
1998
|
latest_verified_at: number | null;
|
|
@@ -2277,7 +2277,7 @@ declare class FarcasterApi {
|
|
|
2277
2277
|
} | {
|
|
2278
2278
|
type: "smart_wallet";
|
|
2279
2279
|
address: string;
|
|
2280
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
2280
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
2281
2281
|
verified_at: number;
|
|
2282
2282
|
first_verified_at: number | null;
|
|
2283
2283
|
latest_verified_at: number | null;
|
|
@@ -2532,7 +2532,7 @@ declare class FarcasterApi {
|
|
|
2532
2532
|
} | {
|
|
2533
2533
|
type: "smart_wallet";
|
|
2534
2534
|
address: string;
|
|
2535
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
2535
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
2536
2536
|
verified_at: number;
|
|
2537
2537
|
first_verified_at: number | null;
|
|
2538
2538
|
latest_verified_at: number | null;
|
|
@@ -2835,7 +2835,7 @@ declare class OAuthApi {
|
|
|
2835
2835
|
} | {
|
|
2836
2836
|
type: "smart_wallet";
|
|
2837
2837
|
address: string;
|
|
2838
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
2838
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
2839
2839
|
verified_at: number;
|
|
2840
2840
|
first_verified_at: number | null;
|
|
2841
2841
|
latest_verified_at: number | null;
|
|
@@ -3091,7 +3091,7 @@ declare class OAuthApi {
|
|
|
3091
3091
|
} | {
|
|
3092
3092
|
type: "smart_wallet";
|
|
3093
3093
|
address: string;
|
|
3094
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
3094
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
3095
3095
|
verified_at: number;
|
|
3096
3096
|
first_verified_at: number | null;
|
|
3097
3097
|
latest_verified_at: number | null;
|
|
@@ -3494,7 +3494,7 @@ declare class PhoneApi {
|
|
|
3494
3494
|
} | {
|
|
3495
3495
|
type: "smart_wallet";
|
|
3496
3496
|
address: string;
|
|
3497
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
3497
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
3498
3498
|
verified_at: number;
|
|
3499
3499
|
first_verified_at: number | null;
|
|
3500
3500
|
latest_verified_at: number | null;
|
|
@@ -3744,7 +3744,7 @@ declare class PhoneApi {
|
|
|
3744
3744
|
} | {
|
|
3745
3745
|
type: "smart_wallet";
|
|
3746
3746
|
address: string;
|
|
3747
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
3747
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
3748
3748
|
verified_at: number;
|
|
3749
3749
|
first_verified_at: number | null;
|
|
3750
3750
|
latest_verified_at: number | null;
|
|
@@ -4856,7 +4856,7 @@ declare const delegateWallet: (client: Privy) => ({ address, chainType }: Delega
|
|
|
4856
4856
|
} | {
|
|
4857
4857
|
type: "smart_wallet";
|
|
4858
4858
|
address: string;
|
|
4859
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
4859
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
4860
4860
|
verified_at: number;
|
|
4861
4861
|
first_verified_at: number | null;
|
|
4862
4862
|
latest_verified_at: number | null;
|
|
@@ -5117,7 +5117,7 @@ declare const revokeWallets: (client: Privy) => () => Promise<{
|
|
|
5117
5117
|
} | {
|
|
5118
5118
|
type: "smart_wallet";
|
|
5119
5119
|
address: string;
|
|
5120
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
5120
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
5121
5121
|
verified_at: number;
|
|
5122
5122
|
first_verified_at: number | null;
|
|
5123
5123
|
latest_verified_at: number | null;
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _privy_io_public_api from '@privy-io/public-api';
|
|
2
2
|
import { PasskeyAuthenticateInputType, PrivyEthereumEmbeddedWalletAccount, PrivySolanaEmbeddedWalletAccount, PrivyUser, PrivySmartWalletConfigurationResponse, PrivyAuthenticatedUser, OAuthProviderType, SmartWalletType, CoinbaseOnRampInitInput, PrivyMoonpayOnRampSignInput, MfaPasskeyInitInputType, MfaSmsInitInputType, PrivyBitcoinSegwitEmbeddedWalletAccount as PrivyBitcoinSegwitEmbeddedWalletAccount$1, PrivyBitcoinTaprootEmbeddedWalletAccount as PrivyBitcoinTaprootEmbeddedWalletAccount$1, PrivySmartWalletAccount, PrivyCoinbaseOnRampInitResponse, PrivyCoinbaseOnRampInitInput } from '@privy-io/public-api';
|
|
3
|
-
export { BICONOMY, COINBASE_SMART_WALLET, KERNEL, LIGHT_ACCOUNT, OAuthProviderType, SAFE, SmartWalletType } from '@privy-io/public-api';
|
|
3
|
+
export { BICONOMY, COINBASE_SMART_WALLET, KERNEL, LIGHT_ACCOUNT, OAuthProviderType, SAFE, SmartWalletType, THIRDWEB } from '@privy-io/public-api';
|
|
4
4
|
import EventEmitter from 'eventemitter3';
|
|
5
5
|
import { PrivyErrorCode } from '@privy-io/api-base';
|
|
6
6
|
import { PrivyBitcoinSegwitEmbeddedWalletAccount, PrivyBitcoinTaprootEmbeddedWalletAccount, PrivySolanaEmbeddedWalletAccount as PrivySolanaEmbeddedWalletAccount$1, PrivyAuthenticatedUser as PrivyAuthenticatedUser$1, PrivyEthereumEmbeddedWalletAccount as PrivyEthereumEmbeddedWalletAccount$1 } from '@privy-io/public-api/schemas';
|
|
@@ -1088,7 +1088,7 @@ declare class EmbeddedWalletApi {
|
|
|
1088
1088
|
} | {
|
|
1089
1089
|
type: "smart_wallet";
|
|
1090
1090
|
address: string;
|
|
1091
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
1091
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
1092
1092
|
verified_at: number;
|
|
1093
1093
|
first_verified_at: number | null;
|
|
1094
1094
|
latest_verified_at: number | null;
|
|
@@ -1447,7 +1447,7 @@ declare class UserApi {
|
|
|
1447
1447
|
} | {
|
|
1448
1448
|
type: "smart_wallet";
|
|
1449
1449
|
address: string;
|
|
1450
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
1450
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
1451
1451
|
verified_at: number;
|
|
1452
1452
|
first_verified_at: number | null;
|
|
1453
1453
|
latest_verified_at: number | null;
|
|
@@ -1742,7 +1742,7 @@ declare class EmailApi {
|
|
|
1742
1742
|
} | {
|
|
1743
1743
|
type: "smart_wallet";
|
|
1744
1744
|
address: string;
|
|
1745
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
1745
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
1746
1746
|
verified_at: number;
|
|
1747
1747
|
first_verified_at: number | null;
|
|
1748
1748
|
latest_verified_at: number | null;
|
|
@@ -1992,7 +1992,7 @@ declare class EmailApi {
|
|
|
1992
1992
|
} | {
|
|
1993
1993
|
type: "smart_wallet";
|
|
1994
1994
|
address: string;
|
|
1995
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
1995
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
1996
1996
|
verified_at: number;
|
|
1997
1997
|
first_verified_at: number | null;
|
|
1998
1998
|
latest_verified_at: number | null;
|
|
@@ -2277,7 +2277,7 @@ declare class FarcasterApi {
|
|
|
2277
2277
|
} | {
|
|
2278
2278
|
type: "smart_wallet";
|
|
2279
2279
|
address: string;
|
|
2280
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
2280
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
2281
2281
|
verified_at: number;
|
|
2282
2282
|
first_verified_at: number | null;
|
|
2283
2283
|
latest_verified_at: number | null;
|
|
@@ -2532,7 +2532,7 @@ declare class FarcasterApi {
|
|
|
2532
2532
|
} | {
|
|
2533
2533
|
type: "smart_wallet";
|
|
2534
2534
|
address: string;
|
|
2535
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
2535
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
2536
2536
|
verified_at: number;
|
|
2537
2537
|
first_verified_at: number | null;
|
|
2538
2538
|
latest_verified_at: number | null;
|
|
@@ -2835,7 +2835,7 @@ declare class OAuthApi {
|
|
|
2835
2835
|
} | {
|
|
2836
2836
|
type: "smart_wallet";
|
|
2837
2837
|
address: string;
|
|
2838
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
2838
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
2839
2839
|
verified_at: number;
|
|
2840
2840
|
first_verified_at: number | null;
|
|
2841
2841
|
latest_verified_at: number | null;
|
|
@@ -3091,7 +3091,7 @@ declare class OAuthApi {
|
|
|
3091
3091
|
} | {
|
|
3092
3092
|
type: "smart_wallet";
|
|
3093
3093
|
address: string;
|
|
3094
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
3094
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
3095
3095
|
verified_at: number;
|
|
3096
3096
|
first_verified_at: number | null;
|
|
3097
3097
|
latest_verified_at: number | null;
|
|
@@ -3494,7 +3494,7 @@ declare class PhoneApi {
|
|
|
3494
3494
|
} | {
|
|
3495
3495
|
type: "smart_wallet";
|
|
3496
3496
|
address: string;
|
|
3497
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
3497
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
3498
3498
|
verified_at: number;
|
|
3499
3499
|
first_verified_at: number | null;
|
|
3500
3500
|
latest_verified_at: number | null;
|
|
@@ -3744,7 +3744,7 @@ declare class PhoneApi {
|
|
|
3744
3744
|
} | {
|
|
3745
3745
|
type: "smart_wallet";
|
|
3746
3746
|
address: string;
|
|
3747
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
3747
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
3748
3748
|
verified_at: number;
|
|
3749
3749
|
first_verified_at: number | null;
|
|
3750
3750
|
latest_verified_at: number | null;
|
|
@@ -4856,7 +4856,7 @@ declare const delegateWallet: (client: Privy) => ({ address, chainType }: Delega
|
|
|
4856
4856
|
} | {
|
|
4857
4857
|
type: "smart_wallet";
|
|
4858
4858
|
address: string;
|
|
4859
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
4859
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
4860
4860
|
verified_at: number;
|
|
4861
4861
|
first_verified_at: number | null;
|
|
4862
4862
|
latest_verified_at: number | null;
|
|
@@ -5117,7 +5117,7 @@ declare const revokeWallets: (client: Privy) => () => Promise<{
|
|
|
5117
5117
|
} | {
|
|
5118
5118
|
type: "smart_wallet";
|
|
5119
5119
|
address: string;
|
|
5120
|
-
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet";
|
|
5120
|
+
smart_wallet_type: "safe" | "kernel" | "biconomy" | "light_account" | "coinbase_smart_wallet" | "thirdweb";
|
|
5121
5121
|
verified_at: number;
|
|
5122
5122
|
first_verified_at: number | null;
|
|
5123
5123
|
latest_verified_at: number | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"fetch-retry";import{v4 as e}from"uuid";import{PrivyErrorCode as s}from"@privy-io/api-base";import{getPathWithParams as i,AppConfig as a,AnalyticsEvent as r,RefreshSession as n}from"@privy-io/public-api";import{PrivyClientError as o,PrivyApiError as h}from"../Error.mjs";import{Session as c}from"../Session.mjs";import l from"../toAbortSignalTimeout.mjs";import{toSearchParams as d}from"../utils/toSearchParams.mjs";import"eventemitter3";import"jose";import"js-cookie";import"../Token.mjs";import"../utils/allSettled.mjs";let p="privy:caid";class _{setCallbacks(t){this.callbacks={...this.callbacks,...t}}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 o({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.createAnalyticsEvent("sdk_initialize",{})}}async fetch(t,{body:e,params:s,query:a,headers:r,options:n={onRequest:this._beforeRequest.bind(this)}}){let o=new Request(`${this.baseUrl}${i(t.path,s)}${d(a)}`,{method:t.method,body:JSON.stringify(e),headers:r}),c=await n.onRequest(o),l=await this._fetch(o,c),p=await l.json();if(l.status>299)throw new h(p);return p}async _beforeRequestWithoutInitialize(t){let e=await this.session.getToken(),s=new Headers(t.headers);s.set("privy-app-id",this.appId),this.appClientId&&s.set("privy-client-id",this.appClientId),s.set("privy-client",this._sdkVersion),e&&s.set("Authorization",`Bearer ${e}`),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(t){return await this._initialize(),this._beforeRequestWithoutInitialize(t)}async _beforeRequest(t){return await this._initialize(),await this.getAccessToken(),this.beforeRequestWithoutRefresh(t)}async getAppConfig(){return await this.fetch(a,{params:{app_id:this.appId},options:{onRequest:this._beforeRequestWithoutInitialize.bind(this)}})}async _getOrGenerateClientAnalyticsId(){if(this._analyticsId)return this._analyticsId;try{let t=await this._storage.get(p);if("string"==typeof t&&t.length>0)return this._analyticsId=t,t}catch(t){console.error("Unable to load clientId",t)}try{this._analyticsId=e()}catch(t){console.error("Unable to generate uuidv4",t)}if(!this._analyticsId)return null;try{await this._storage.put(p,this._analyticsId)}catch(t){console.error(`Unable to store clientId: ${this._analyticsId}`,t)}return this._analyticsId}async destroyClientAnalyticsId(){try{return await this._storage.del(p)}catch(t){console.error("Unable to delete clientId",t)}}async createAnalyticsEvent(t,e){try{await this.fetch(r,{body:{event_name:t,client_id:await this._getOrGenerateClientAnalyticsId(),payload:e},options:{onRequest:this.beforeRequestWithoutRefresh.bind(this)}})}catch(t){}}async refreshSession(t=!1){let e=await this.session.getRefreshToken()??void 0,s=e??"key",i=this._cache.get(s);if(i)return console.debug("Found in-flight session refresh request, deduping"),await i;let a=this._refreshSession(e,t);this._cache.set(s,a);try{return await a}finally{this._cache.delete(s)}}async _refreshSession(t,e){let i=await this.session.getToken();if(!this.session.hasRefreshCredentials(i,t??null))throw await this._initialize(),new h({code:s.MISSING_OR_INVALID_TOKEN,error:"No tokens found in storage"});try{let s=await this.fetch(n,{body:{refresh_token:t},options:{onRequest:this.beforeRequestWithoutRefresh.bind(this)}}),i=s.session_update_action;return e||this.callbacks?.setUser?.(s.user),"set"===i&&await this.session.updateWithTokensResponse(s),"clear"===i&&(await this.session.destroyLocalState(),e||this.callbacks?.setUser?.(null)),"ignore"===i&&s.token&&(await this.session.storeToken(s.token),s.identity_token&&await this.session.storeIdentityToken(s.identity_token)),s}catch(t){throw t instanceof h&&t.code===s.MISSING_OR_INVALID_TOKEN&&(await this.session.destroyLocalState(),e||this.callbacks?.setUser?.(null)),t}}async getAccessToken(){let[t,e]=await Promise.all([this.session.getToken(),this.session.getRefreshToken()]);return!this.session.tokenIsActive(t)&&this.session.hasRefreshCredentials(t,e)?(await this.refreshSession(),await this.session.getToken()):t}async getIdentityToken(){return await this.session.getIdentityToken()}async isStorageAccessible(){try{let t=`privy:__storage__test-${e()}`,s="blobby";await this._storage.put(t,s);let i=await this._storage.get(t);return await this._storage.del(t),i===s}catch(t){return console.error(t),!1}}constructor(e){this._sdkVersion="js-sdk-core:0.41.
|
|
1
|
+
import t from"fetch-retry";import{v4 as e}from"uuid";import{PrivyErrorCode as s}from"@privy-io/api-base";import{getPathWithParams as i,AppConfig as a,AnalyticsEvent as r,RefreshSession as n}from"@privy-io/public-api";import{PrivyClientError as o,PrivyApiError as h}from"../Error.mjs";import{Session as c}from"../Session.mjs";import l from"../toAbortSignalTimeout.mjs";import{toSearchParams as d}from"../utils/toSearchParams.mjs";import"eventemitter3";import"jose";import"js-cookie";import"../Token.mjs";import"../utils/allSettled.mjs";let p="privy:caid";class _{setCallbacks(t){this.callbacks={...this.callbacks,...t}}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 o({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.createAnalyticsEvent("sdk_initialize",{})}}async fetch(t,{body:e,params:s,query:a,headers:r,options:n={onRequest:this._beforeRequest.bind(this)}}){let o=new Request(`${this.baseUrl}${i(t.path,s)}${d(a)}`,{method:t.method,body:JSON.stringify(e),headers:r}),c=await n.onRequest(o),l=await this._fetch(o,c),p=await l.json();if(l.status>299)throw new h(p);return p}async _beforeRequestWithoutInitialize(t){let e=await this.session.getToken(),s=new Headers(t.headers);s.set("privy-app-id",this.appId),this.appClientId&&s.set("privy-client-id",this.appClientId),s.set("privy-client",this._sdkVersion),e&&s.set("Authorization",`Bearer ${e}`),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(t){return await this._initialize(),this._beforeRequestWithoutInitialize(t)}async _beforeRequest(t){return await this._initialize(),await this.getAccessToken(),this.beforeRequestWithoutRefresh(t)}async getAppConfig(){return await this.fetch(a,{params:{app_id:this.appId},options:{onRequest:this._beforeRequestWithoutInitialize.bind(this)}})}async _getOrGenerateClientAnalyticsId(){if(this._analyticsId)return this._analyticsId;try{let t=await this._storage.get(p);if("string"==typeof t&&t.length>0)return this._analyticsId=t,t}catch(t){console.error("Unable to load clientId",t)}try{this._analyticsId=e()}catch(t){console.error("Unable to generate uuidv4",t)}if(!this._analyticsId)return null;try{await this._storage.put(p,this._analyticsId)}catch(t){console.error(`Unable to store clientId: ${this._analyticsId}`,t)}return this._analyticsId}async destroyClientAnalyticsId(){try{return await this._storage.del(p)}catch(t){console.error("Unable to delete clientId",t)}}async createAnalyticsEvent(t,e){try{await this.fetch(r,{body:{event_name:t,client_id:await this._getOrGenerateClientAnalyticsId(),payload:e},options:{onRequest:this.beforeRequestWithoutRefresh.bind(this)}})}catch(t){}}async refreshSession(t=!1){let e=await this.session.getRefreshToken()??void 0,s=e??"key",i=this._cache.get(s);if(i)return console.debug("Found in-flight session refresh request, deduping"),await i;let a=this._refreshSession(e,t);this._cache.set(s,a);try{return await a}finally{this._cache.delete(s)}}async _refreshSession(t,e){let i=await this.session.getToken();if(!this.session.hasRefreshCredentials(i,t??null))throw await this._initialize(),new h({code:s.MISSING_OR_INVALID_TOKEN,error:"No tokens found in storage"});try{let s=await this.fetch(n,{body:{refresh_token:t},options:{onRequest:this.beforeRequestWithoutRefresh.bind(this)}}),i=s.session_update_action;return e||this.callbacks?.setUser?.(s.user),"set"===i&&await this.session.updateWithTokensResponse(s),"clear"===i&&(await this.session.destroyLocalState(),e||this.callbacks?.setUser?.(null)),"ignore"===i&&s.token&&(await this.session.storeToken(s.token),s.identity_token&&await this.session.storeIdentityToken(s.identity_token)),s}catch(t){throw t instanceof h&&t.code===s.MISSING_OR_INVALID_TOKEN&&(await this.session.destroyLocalState(),e||this.callbacks?.setUser?.(null)),t}}async getAccessToken(){let[t,e]=await Promise.all([this.session.getToken(),this.session.getRefreshToken()]);return!this.session.tokenIsActive(t)&&this.session.hasRefreshCredentials(t,e)?(await this.refreshSession(),await this.session.getToken()):t}async getIdentityToken(){return await this.session.getIdentityToken()}async isStorageAccessible(){try{let t=`privy:__storage__test-${e()}`,s="blobby";await this._storage.put(t,s);let i=await this._storage.get(t);return await this._storage.del(t),i===s}catch(t){return console.error(t),!1}}constructor(e){this._sdkVersion="js-sdk-core:0.41.5",this._cache=new Map,this._storage=e.storage,this._analyticsId=null,this._getOrGenerateClientAnalyticsId(),this.baseUrl=e.baseUrl??"https://auth.privy.io",this.appId=e.appId,this.appClientId=e.appClientId,this._sdkVersion=e.sdkVersion??this._sdkVersion,this.callbacks=e.callbacks,this.nativeAppIdentifier=e.nativeAppIdentifier,this.session=new c({storage:this._storage,isUsingServerCookies:!1,appId:e.appId}),this._fetch=t(fetch,{retries:3,retryDelay:500}),this.session.on("error_storing_tokens",(t=>{this.createAnalyticsEvent("error_updating_tokens_in_storage",{reason:t})}))}}export{_ as PrivyInternal};
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./client/Privy.mjs";export{BICONOMY,COINBASE_SMART_WALLET,KERNEL,LIGHT_ACCOUNT,SAFE}from"@privy-io/public-api";export{LocalStorage}from"./storage/LocalStorage.mjs";export{InMemoryCache}from"./storage/InMemoryStorage.mjs";export{MoonpayApiError,PrivyApiError,PrivyClientError,createErrorFormatter,errorIndicatesMfaCanceled}from"./Error.mjs";export{EmbeddedProviderError,PrivyConnectorError,PrivyEmbeddedWalletErrorCode,PrivyProviderRpcError,ProviderErrors,errorIndicatesMaxMfaRetries,errorIndicatesMfaRateLimit,errorIndicatesMfaTimeout,errorIndicatesMfaVerificationFailed,errorIndicatesRecoveryIsNeeded}from"./embedded/errors.mjs";export{getUserEmbeddedEthereumWallet,getUserEmbeddedWallet}from"./utils/getUserEmbeddedEthereumWallet.mjs";export{getAllUserEmbeddedEthereumWallets}from"./utils/getAllUserEmbeddedEthereumWallets.mjs";export{getAllUserEmbeddedSolanaWallets}from"./utils/getAllUserEmbeddedSolanaWallets.mjs";export{getAllUserEmbeddedBitcoinWallets}from"./utils/getAllUserEmbeddedBitcoinWallets.mjs";export{getEntropyDetailsFromUser}from"./utils/getEntropyDetailsFromUser.mjs";export{getEntropyDetailsFromAccount}from"./utils/getEntropyDetailsFromAccount.mjs";export{getUserSmartWallet}from"./utils/getUserSmartWallet.mjs";export{getJsonRpcEndpointFromChain,populateTransactionRequest,throwIfInvalidRecoveryUpgradePath}from"./embedded/utils/index.mjs";export{countryCodesAndNumbers,formatPhoneNumber,getPhoneCountryCodeAndNumber,getPlaceholderPhoneNumber,lastFourDigits,phoneNumberTypingFormatter,validatePhoneNumber}from"./utils/phoneNumberUtils.mjs";export{getUserEmbeddedSolanaWallet}from"./utils/getUserEmbeddedSolanaWallet.mjs";export{toObjectKeys}from"./utils/toObjectKeys.mjs";export{calculateTotalGasEstimate}from"./embedded/utils/gas.mjs";export{QuantityToBigNumber,convertBigNumberish,toEthersUnsignedTransaction}from"./embedded/utils/ethers.mjs";export{UsdcAddressMap,getIsTokenUsdc}from"./utils/getIsTokenUsdc.mjs";export{chainToMoonpayCurrency,fundingMethodToMoonpayPaymentMethod,isSupportedChainIdForMoonpay}from"./funding/moonpay.mjs";export{getCoinbaseOnRampUrl,isSupportedChainIdForCoinbaseOnramp,toCoinbaseAssetId,toCoinbaseBlockchainFromChainId}from"./funding/coinbase.mjs";export{SolanaClient}from"./solana/client.mjs";export{getSolanaRpcEndpointForCluster}from"./solana/getSolanaRpcEndpointForCluster.mjs";export{getSolanaUsdcMintAddressForCluster}from"./solana/getSolanaUsdcMintAddressForCluster.mjs";export{getSolanaClusterDisplayName}from"./solana/getSolanaClusterDisplayName.mjs";export{ALL_WALLET_CLIENT_TYPES,SUPPORTED_CONNECTOR_TYPES}from"./types.mjs";export{DEFAULT_SUPPORTED_CHAINS,DEFAULT_SUPPORTED_CHAIN_IDS,chainDefs,getSupportedChainById}from"./chains/index.mjs";export{formatLamportsAmount,formatTokenAmount,formatWalletAddress,formatWeiAmount}from"./utils/formatters.mjs";export{getCountryCallingCode}from"libphonenumber-js/min";export{i as delegatedActions}from"./index-g0cxoRWQ.mjs";export{i as crossApp}from"./index-Bu3ySxLM.mjs";import"./client/AppApi.mjs";import"./client/CrossAppApi.mjs";import"./Token.mjs";import"jose";import"./client/DelegatedWalletsApi.mjs";import"./client/EmbeddedWalletApi.mjs";import"./embedded/EmbeddedBitcoinWalletProvider.mjs";import"./embedded/EmbeddedWalletProxy.mjs";import"./utils/sleep.mjs";import"./embedded/EventCallbackQueue.mjs";import"./embedded/withMfa.mjs";import"./embedded/EmbeddedWalletProvider.mjs";import"eventemitter3";import"./embedded/methods.mjs";import"./embedded/EmbeddedSolanaWalletProvider.mjs";import"./solana/getWalletPublicKeyFromTransaction.mjs";import"./solana/isVersionedTransaction.mjs";import"./client/MfaPromises.mjs";import"./client/PrivyInternal.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"./client/UserApi.mjs";import"./client/auth/AuthApi.mjs";import"./client/auth/CustomProviderApi.mjs";import"./client/auth/maybeCreateWalletOnLogin.mjs";import"./utils/shouldCreateEmbeddedEthWallet.mjs";import"./utils/shouldCreateEmbeddedSolWallet.mjs";import"./client/auth/EmailApi.mjs";import"./client/auth/FarcasterApi.mjs";import"./client/auth/FarcasterV2Api.mjs";import"./client/auth/GuestApi.mjs";import"./client/auth/OAuthApi.mjs";import"./pkce.mjs";import"./client/auth/PasskeyApi.mjs";import"./client/auth/PhoneApi.mjs";import"./client/auth/SiweApi.mjs";import"./client/auth/SmartWalletApi.mjs";import"./client/funding/FundingApi.mjs";import"./client/funding/CoinbaseOnRampApi.mjs";import"./client/funding/MoonpayOnRampApi.mjs";import"./client/mfa/MfaApi.mjs";import"./client/mfa/MfaPasskeyApi.mjs";import"./client/mfa/MfaSmsApi.mjs";import"./client/recovery/RecoveryApi.mjs";import"./client/recovery/RecoveryICloudApi.mjs";import"./client/recovery/RecoveryOAuthApi.mjs";import"./embedded/types.mjs";import"@ethersproject/abstract-signer";import"@ethersproject/providers";import"./embedded/gas/arbitrum.mjs";import"@ethersproject/bignumber";import"./chains/arbitrum.mjs";import"./chains/arbitrumGoerli.mjs";import"./chains/arbitrumSepolia.mjs";import"./embedded/gas/bsc.mjs";import"./embedded/gas/op-stack.mjs";import"@ethersproject/contracts";import"@ethersproject/transactions";import"./chains/base.mjs";import"./chains/baseGoerli.mjs";import"./chains/baseSepolia.mjs";import"./chains/optimism.mjs";import"./chains/optimismGoerli.mjs";import"./chains/optimismSepolia.mjs";import"./chains/zora.mjs";import"./chains/zoraSepolia.mjs";import"./chains/zoraTestnet.mjs";import"./embedded/gas/polygon.mjs";import"@ethersproject/units";import"./chains/polygon.mjs";import"./chains/polygonAmoy.mjs";import"./chains/polygonMumbai.mjs";import"libphonenumber-js/examples.mobile.json";import"./chains/avalanche.mjs";import"./chains/avalancheFuji.mjs";import"./chains/mainnet.mjs";import"./chains/sepolia.mjs";import"./chains/celo.mjs";import"./chains/berachainArtio.mjs";import"./chains/celoAlfajores.mjs";import"./chains/filecoin.mjs";import"./chains/filecoinCalibration.mjs";import"./chains/garnetHolesky.mjs";import"./chains/goerli.mjs";import"./chains/holesky.mjs";import"./chains/linea.mjs";import"./chains/lineaTestnet.mjs";import"./chains/redstone.mjs";import"./chains/redstoneHolesky.mjs";import"viem";import"./action/delegatedActions/delegateWallet.mjs";import"./action/delegatedActions/utils.mjs";import"./action/delegatedActions/revokeWallets.mjs";import"./action/crossApp/loginWithCrossAppAuth.mjs";import"./action/crossApp/linkWithCrossAppAuth.mjs";import"./index-DTAjYY8z.mjs";import"./action/crossApp/wallet/signMessage.mjs";import"./action/crossApp/wallet/utils/isCrossAppWalletSmart.mjs";import"./action/crossApp/wallet/utils/sendCrossAppRequest.mjs";import"./action/crossApp/wallet/utils/getCrossAppAccountByWalletAddress.mjs";import"./action/crossApp/wallet/utils/getProviderAccessTokenOrRelink.mjs";import"./action/crossApp/wallet/utils/throwIfNotLoggedIn.mjs";import"./action/crossApp/wallet/signTypedData.mjs";import"./utils/typedData/generateDomainType.mjs";import"./action/crossApp/wallet/sendTransaction.mjs";export{e as default};
|
|
1
|
+
import e from"./client/Privy.mjs";export{BICONOMY,COINBASE_SMART_WALLET,KERNEL,LIGHT_ACCOUNT,SAFE,THIRDWEB}from"@privy-io/public-api";export{LocalStorage}from"./storage/LocalStorage.mjs";export{InMemoryCache}from"./storage/InMemoryStorage.mjs";export{MoonpayApiError,PrivyApiError,PrivyClientError,createErrorFormatter,errorIndicatesMfaCanceled}from"./Error.mjs";export{EmbeddedProviderError,PrivyConnectorError,PrivyEmbeddedWalletErrorCode,PrivyProviderRpcError,ProviderErrors,errorIndicatesMaxMfaRetries,errorIndicatesMfaRateLimit,errorIndicatesMfaTimeout,errorIndicatesMfaVerificationFailed,errorIndicatesRecoveryIsNeeded}from"./embedded/errors.mjs";export{getUserEmbeddedEthereumWallet,getUserEmbeddedWallet}from"./utils/getUserEmbeddedEthereumWallet.mjs";export{getAllUserEmbeddedEthereumWallets}from"./utils/getAllUserEmbeddedEthereumWallets.mjs";export{getAllUserEmbeddedSolanaWallets}from"./utils/getAllUserEmbeddedSolanaWallets.mjs";export{getAllUserEmbeddedBitcoinWallets}from"./utils/getAllUserEmbeddedBitcoinWallets.mjs";export{getEntropyDetailsFromUser}from"./utils/getEntropyDetailsFromUser.mjs";export{getEntropyDetailsFromAccount}from"./utils/getEntropyDetailsFromAccount.mjs";export{getUserSmartWallet}from"./utils/getUserSmartWallet.mjs";export{getJsonRpcEndpointFromChain,populateTransactionRequest,throwIfInvalidRecoveryUpgradePath}from"./embedded/utils/index.mjs";export{countryCodesAndNumbers,formatPhoneNumber,getPhoneCountryCodeAndNumber,getPlaceholderPhoneNumber,lastFourDigits,phoneNumberTypingFormatter,validatePhoneNumber}from"./utils/phoneNumberUtils.mjs";export{getUserEmbeddedSolanaWallet}from"./utils/getUserEmbeddedSolanaWallet.mjs";export{toObjectKeys}from"./utils/toObjectKeys.mjs";export{calculateTotalGasEstimate}from"./embedded/utils/gas.mjs";export{QuantityToBigNumber,convertBigNumberish,toEthersUnsignedTransaction}from"./embedded/utils/ethers.mjs";export{UsdcAddressMap,getIsTokenUsdc}from"./utils/getIsTokenUsdc.mjs";export{chainToMoonpayCurrency,fundingMethodToMoonpayPaymentMethod,isSupportedChainIdForMoonpay}from"./funding/moonpay.mjs";export{getCoinbaseOnRampUrl,isSupportedChainIdForCoinbaseOnramp,toCoinbaseAssetId,toCoinbaseBlockchainFromChainId}from"./funding/coinbase.mjs";export{SolanaClient}from"./solana/client.mjs";export{getSolanaRpcEndpointForCluster}from"./solana/getSolanaRpcEndpointForCluster.mjs";export{getSolanaUsdcMintAddressForCluster}from"./solana/getSolanaUsdcMintAddressForCluster.mjs";export{getSolanaClusterDisplayName}from"./solana/getSolanaClusterDisplayName.mjs";export{ALL_WALLET_CLIENT_TYPES,SUPPORTED_CONNECTOR_TYPES}from"./types.mjs";export{DEFAULT_SUPPORTED_CHAINS,DEFAULT_SUPPORTED_CHAIN_IDS,chainDefs,getSupportedChainById}from"./chains/index.mjs";export{formatLamportsAmount,formatTokenAmount,formatWalletAddress,formatWeiAmount}from"./utils/formatters.mjs";export{getCountryCallingCode}from"libphonenumber-js/min";export{i as delegatedActions}from"./index-g0cxoRWQ.mjs";export{i as crossApp}from"./index-Bu3ySxLM.mjs";import"./client/AppApi.mjs";import"./client/CrossAppApi.mjs";import"./Token.mjs";import"jose";import"./client/DelegatedWalletsApi.mjs";import"./client/EmbeddedWalletApi.mjs";import"./embedded/EmbeddedBitcoinWalletProvider.mjs";import"./embedded/EmbeddedWalletProxy.mjs";import"./utils/sleep.mjs";import"./embedded/EventCallbackQueue.mjs";import"./embedded/withMfa.mjs";import"./embedded/EmbeddedWalletProvider.mjs";import"eventemitter3";import"./embedded/methods.mjs";import"./embedded/EmbeddedSolanaWalletProvider.mjs";import"./solana/getWalletPublicKeyFromTransaction.mjs";import"./solana/isVersionedTransaction.mjs";import"./client/MfaPromises.mjs";import"./client/PrivyInternal.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"./client/UserApi.mjs";import"./client/auth/AuthApi.mjs";import"./client/auth/CustomProviderApi.mjs";import"./client/auth/maybeCreateWalletOnLogin.mjs";import"./utils/shouldCreateEmbeddedEthWallet.mjs";import"./utils/shouldCreateEmbeddedSolWallet.mjs";import"./client/auth/EmailApi.mjs";import"./client/auth/FarcasterApi.mjs";import"./client/auth/FarcasterV2Api.mjs";import"./client/auth/GuestApi.mjs";import"./client/auth/OAuthApi.mjs";import"./pkce.mjs";import"./client/auth/PasskeyApi.mjs";import"./client/auth/PhoneApi.mjs";import"./client/auth/SiweApi.mjs";import"./client/auth/SmartWalletApi.mjs";import"./client/funding/FundingApi.mjs";import"./client/funding/CoinbaseOnRampApi.mjs";import"./client/funding/MoonpayOnRampApi.mjs";import"./client/mfa/MfaApi.mjs";import"./client/mfa/MfaPasskeyApi.mjs";import"./client/mfa/MfaSmsApi.mjs";import"./client/recovery/RecoveryApi.mjs";import"./client/recovery/RecoveryICloudApi.mjs";import"./client/recovery/RecoveryOAuthApi.mjs";import"./embedded/types.mjs";import"@ethersproject/abstract-signer";import"@ethersproject/providers";import"./embedded/gas/arbitrum.mjs";import"@ethersproject/bignumber";import"./chains/arbitrum.mjs";import"./chains/arbitrumGoerli.mjs";import"./chains/arbitrumSepolia.mjs";import"./embedded/gas/bsc.mjs";import"./embedded/gas/op-stack.mjs";import"@ethersproject/contracts";import"@ethersproject/transactions";import"./chains/base.mjs";import"./chains/baseGoerli.mjs";import"./chains/baseSepolia.mjs";import"./chains/optimism.mjs";import"./chains/optimismGoerli.mjs";import"./chains/optimismSepolia.mjs";import"./chains/zora.mjs";import"./chains/zoraSepolia.mjs";import"./chains/zoraTestnet.mjs";import"./embedded/gas/polygon.mjs";import"@ethersproject/units";import"./chains/polygon.mjs";import"./chains/polygonAmoy.mjs";import"./chains/polygonMumbai.mjs";import"libphonenumber-js/examples.mobile.json";import"./chains/avalanche.mjs";import"./chains/avalancheFuji.mjs";import"./chains/mainnet.mjs";import"./chains/sepolia.mjs";import"./chains/celo.mjs";import"./chains/berachainArtio.mjs";import"./chains/celoAlfajores.mjs";import"./chains/filecoin.mjs";import"./chains/filecoinCalibration.mjs";import"./chains/garnetHolesky.mjs";import"./chains/goerli.mjs";import"./chains/holesky.mjs";import"./chains/linea.mjs";import"./chains/lineaTestnet.mjs";import"./chains/redstone.mjs";import"./chains/redstoneHolesky.mjs";import"viem";import"./action/delegatedActions/delegateWallet.mjs";import"./action/delegatedActions/utils.mjs";import"./action/delegatedActions/revokeWallets.mjs";import"./action/crossApp/loginWithCrossAppAuth.mjs";import"./action/crossApp/linkWithCrossAppAuth.mjs";import"./index-DTAjYY8z.mjs";import"./action/crossApp/wallet/signMessage.mjs";import"./action/crossApp/wallet/utils/isCrossAppWalletSmart.mjs";import"./action/crossApp/wallet/utils/sendCrossAppRequest.mjs";import"./action/crossApp/wallet/utils/getCrossAppAccountByWalletAddress.mjs";import"./action/crossApp/wallet/utils/getProviderAccessTokenOrRelink.mjs";import"./action/crossApp/wallet/utils/throwIfNotLoggedIn.mjs";import"./action/crossApp/wallet/signTypedData.mjs";import"./utils/typedData/generateDomainType.mjs";import"./action/crossApp/wallet/sendTransaction.mjs";export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createSmartAccountClient as e}from"permissionless";import{
|
|
1
|
+
import{createSmartAccountClient as e}from"permissionless";import{toThirdwebSmartAccount as r,toLightSmartAccount as t,toBiconomySmartAccount as n,toEcdsaKernelSmartAccount as i,toSafeSmartAccount as o}from"permissionless/accounts";import{createPimlicoClient as s}from"permissionless/clients/pimlico";import{http as a}from"viem";import{toCoinbaseSmartAccount as c,entryPoint06Address as l,entryPoint07Address as p}from"viem/account-abstraction";import{THIRDWEB as m,COINBASE_SMART_WALLET as u,LIGHT_ACCOUNT as y,BICONOMY as w,KERNEL as d,SAFE as P}from"@privy-io/public-api";let v={address:l,version:"0.6"},f={address:p,version:"0.7"},h=({owner:e,smartWalletType:s,publicClient:a})=>{switch(s){case P:return o({client:a,entryPoint:f,owners:[e],version:"1.4.1"});case d:return i({client:a,version:"0.3.1",entryPoint:f,owners:[e]});case w:return n({client:a,owners:[e],entryPoint:v});case y:return t({client:a,entryPoint:v,owner:e,version:"1.1.0"});case u:return async function({client:e,owner:r}){let[t]=await r.request({method:"eth_accounts"});if(!t)throw Error("Unable to request embedded owner for eth_accounts");return await c({client:e,owners:[{type:"local",source:"privy",address:t,sign:async({hash:e})=>await r.request({method:"secp256k1_sign",params:[e]})}]})}({client:a,owner:e});case m:return r({client:a,entryPoint:f,owner:e});default:throw Error(`Invalid smart account type: ${s}.`)}},b=["rpc.zerodev.app","public.pimlico.io","api.pimlico.io"];const x=async({owner:r,smartWalletType:t,chain:n,publicClient:i,bundlerUrl:o,paymasterUrl:c,paymasterContext:l})=>{let p=await h({owner:r,smartWalletType:t,publicClient:i}),m=s({transport:a(o),entryPoint:p.entryPoint}),u=c?s({transport:a(c),entryPoint:p.entryPoint}):void 0;return e({account:p,chain:n,paymaster:u,paymasterContext:l,bundlerTransport:a(o),userOperation:{estimateFeesPerGas:async()=>{if(b.some((e=>o.includes(e))))return await m.getUserOperationGasPrice().then((e=>e.fast));{let e=await i.estimateFeesPerGas(),r=o.includes("api.developer.coinbase.com")?175n:150n;return{...e,maxFeePerGas:e.maxFeePerGas*r/100n,maxPriorityFeePerGas:e.maxPriorityFeePerGas*r/100n}}}}})};export{x as signerToSmartAccountClient};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@privy-io/js-sdk-core",
|
|
3
|
-
"version": "0.41.
|
|
3
|
+
"version": "0.41.5",
|
|
4
4
|
"description": "Vanilla JS client for the Privy Auth API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"authentication",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@ethersproject/transactions": "^5.7.0",
|
|
70
70
|
"@ethersproject/units": "^5.7.0",
|
|
71
71
|
"@privy-io/api-base": "^1.4.3",
|
|
72
|
-
"@privy-io/public-api": "2.18.
|
|
72
|
+
"@privy-io/public-api": "2.18.5",
|
|
73
73
|
"eventemitter3": "^5.0.1",
|
|
74
74
|
"fetch-retry": "^5.0.6",
|
|
75
75
|
"jose": "^4.15.5",
|