@privy-io/js-sdk-core 0.34.2 → 0.35.0-beta-20241120224355

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/cjs/AuthApi.js +1 -1
  2. package/dist/cjs/CoinbaseOnRampApi.js +1 -0
  3. package/dist/cjs/FarcasterV2Api.js +1 -0
  4. package/dist/cjs/FundingApi.js +1 -0
  5. package/dist/cjs/MoonpayOnRampApi.js +1 -0
  6. package/dist/cjs/Privy.js +1 -1
  7. package/dist/cjs/PrivyInternal.js +1 -1
  8. package/dist/cjs/chains/index.js +1 -1
  9. package/dist/cjs/funding/coinbase.js +1 -0
  10. package/dist/cjs/funding/moonpay.js +1 -0
  11. package/dist/cjs/index.js +1 -1
  12. package/dist/cjs/utils/formatters.js +1 -0
  13. package/dist/cjs/utils/getIsTokenUsdc.js +1 -0
  14. package/dist/cjs/utils/toSearchParams.js +1 -0
  15. package/dist/dts/AuthApi.d.mts +6 -0
  16. package/dist/dts/AuthApi.d.ts +6 -0
  17. package/dist/dts/CoinbaseOnRampApi.d.mts +12 -0
  18. package/dist/dts/CoinbaseOnRampApi.d.ts +12 -0
  19. package/dist/dts/Error.d.mts +1 -1
  20. package/dist/dts/Error.d.ts +1 -1
  21. package/dist/dts/FarcasterV2Api.d.mts +15 -0
  22. package/dist/dts/FarcasterV2Api.d.ts +15 -0
  23. package/dist/dts/FundingApi.d.mts +12 -0
  24. package/dist/dts/FundingApi.d.ts +12 -0
  25. package/dist/dts/MoonpayOnRampApi.d.mts +21 -0
  26. package/dist/dts/MoonpayOnRampApi.d.ts +21 -0
  27. package/dist/dts/Privy.d.mts +5 -0
  28. package/dist/dts/Privy.d.ts +5 -0
  29. package/dist/dts/chains/index.d.mts +1 -0
  30. package/dist/dts/chains/index.d.ts +1 -0
  31. package/dist/dts/funding/coinbase.d.mts +10 -0
  32. package/dist/dts/funding/coinbase.d.ts +10 -0
  33. package/dist/dts/funding/moonpay.d.mts +26 -0
  34. package/dist/dts/funding/moonpay.d.ts +26 -0
  35. package/dist/dts/index.d.mts +3 -1
  36. package/dist/dts/index.d.ts +3 -1
  37. package/dist/dts/utils/formatters.d.mts +22 -0
  38. package/dist/dts/utils/formatters.d.ts +22 -0
  39. package/dist/dts/utils/getIsTokenUsdc.d.mts +11 -0
  40. package/dist/dts/utils/getIsTokenUsdc.d.ts +11 -0
  41. package/dist/dts/utils/toSearchParams.d.mts +7 -0
  42. package/dist/dts/utils/toSearchParams.d.ts +7 -0
  43. package/dist/esm/AuthApi.mjs +1 -1
  44. package/dist/esm/CoinbaseOnRampApi.mjs +1 -0
  45. package/dist/esm/FarcasterV2Api.mjs +1 -0
  46. package/dist/esm/FundingApi.mjs +1 -0
  47. package/dist/esm/MoonpayOnRampApi.mjs +1 -0
  48. package/dist/esm/Privy.mjs +1 -1
  49. package/dist/esm/PrivyInternal.mjs +1 -1
  50. package/dist/esm/chains/index.mjs +1 -1
  51. package/dist/esm/funding/coinbase.mjs +1 -0
  52. package/dist/esm/funding/moonpay.mjs +1 -0
  53. package/dist/esm/index.mjs +1 -1
  54. package/dist/esm/utils/formatters.mjs +1 -0
  55. package/dist/esm/utils/getIsTokenUsdc.mjs +1 -0
  56. package/dist/esm/utils/toSearchParams.mjs +1 -0
  57. package/package.json +2 -2
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),r=require("./CustomProviderApi.js"),t=require("./EmailApi.js"),i=require("./FarcasterApi.js"),s=require("./GuestApi.js"),a=require("./OAuthApi.js"),n=require("./PasskeyApi.js"),l=require("./PhoneApi.js"),o=require("./SiweApi.js"),u=require("./SmartWalletApi.js");require("./Error.js"),require("./pkce.js"),require("jose");exports.default=class{_privyInternal;customProvider;phone;email;oauth;siwe;smartWallet;passkey;farcaster;guest;constructor(e,p,h){this._privyInternal=e,this.customProvider=new r.default(this._privyInternal),this.phone=new l.default(this._privyInternal),this.email=new t.default(this._privyInternal),this.oauth=new a.default(this._privyInternal,p,h),this.guest=new s.default(this._privyInternal),this.siwe=new o.default(this._privyInternal),this.smartWallet=new u.default(this._privyInternal),this.passkey=new n.default(this._privyInternal),this.farcaster=new i.default(this._privyInternal)}async logout(){try{const r=await this._privyInternal.session.getRefreshToken()??void 0;await this._privyInternal.fetch(e.Logout,{body:{refresh_token:r}})}catch(e){console.warn("Error destroying session")}await Promise.all([this._privyInternal.session.destroyLocalState({reason:"logout"}),this._privyInternal.destroyClientAnalyticsId()]),this._privyInternal.callbacks?.setUser?.(null)}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api"),r=require("./CustomProviderApi.js"),t=require("./EmailApi.js"),i=require("./FarcasterApi.js"),s=require("./FarcasterV2Api.js"),a=require("./GuestApi.js"),n=require("./OAuthApi.js"),l=require("./PasskeyApi.js"),o=require("./PhoneApi.js"),u=require("./SiweApi.js"),p=require("./SmartWalletApi.js");require("./Error.js"),require("./pkce.js"),require("jose");exports.default=class{_privyInternal;customProvider;phone;email;oauth;siwe;smartWallet;passkey;farcaster;farcasterV2;guest;constructor(e,h,y){this._privyInternal=e,this.customProvider=new r.default(this._privyInternal),this.phone=new o.default(this._privyInternal),this.email=new t.default(this._privyInternal),this.oauth=new n.default(this._privyInternal,h,y),this.guest=new a.default(this._privyInternal),this.siwe=new u.default(this._privyInternal),this.smartWallet=new p.default(this._privyInternal),this.passkey=new l.default(this._privyInternal),this.farcaster=new i.default(this._privyInternal),this.farcasterV2=new s.default(this._privyInternal)}async logout(){try{const r=await this._privyInternal.session.getRefreshToken()??void 0;await this._privyInternal.fetch(e.Logout,{body:{refresh_token:r}})}catch(e){console.warn("Error destroying session")}await Promise.all([this._privyInternal.session.destroyLocalState({reason:"logout"}),this._privyInternal.destroyClientAnalyticsId()]),this._privyInternal.callbacks?.setUser?.(null)}};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@privy-io/public-api");exports.default=class{_privyInternal;constructor(t){this._privyInternal=t}async initOnRampSession(e){return await this._privyInternal.fetch(t.CoinbaseOnRampInit,{body:e})}async getStatus(e){return await this._privyInternal.fetch(t.CoinbaseOnRampStatus,{query:{partnerUserId:e}})}};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@privy-io/public-api");exports.default=class{_privyInternal;constructor(e){this._privyInternal=e}async initializeAuth(){return await this._privyInternal.fetch(e.FarcasterV2Init,{body:{}})}async authenticate({message:t,signature:r,fid:a}){const i=await this._privyInternal.fetch(e.FarcasterV2Authenticate,{body:{message:t,signature:r,fid:a}});return await this._privyInternal.session.updateWithTokensResponse(i),this._privyInternal.callbacks?.setUser?.(i.user),i}};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./CoinbaseOnRampApi.js"),r=require("./MoonpayOnRampApi.js");require("@privy-io/public-api"),require("fetch-retry"),require("./Error.js"),require("./funding/moonpay.js"),require("./chains/arbitrum.js"),require("./chains/base.js"),require("./chains/mainnet.js"),require("./chains/optimism.js"),require("./chains/polygon.js");exports.default=class{moonpay;coinbase;constructor(i){this.moonpay=new r.default(i),this.coinbase=new e.default(i)}};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("fetch-retry"),e=require("@privy-io/public-api"),t=require("./Error.js"),a=require("./funding/moonpay.js");function n(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}require("./chains/arbitrum.js"),require("./chains/base.js"),require("./chains/mainnet.js"),require("./chains/optimism.js"),require("./chains/polygon.js");var i=n(r);exports.default=class{_privyInternal;constructor(r){this._privyInternal=r}async sign(r){return await this._privyInternal.fetch(e.MoonpayOnRampSign,{body:r})}async getTransactionStatus({transactionId:r,useSandbox:e}){const n=e?"sandbox":"prod",{url:s,key:o}=a.MoonpayEnvironments[n],c=await i.default(fetch,{retries:3,retryDelay:500})(`${s}/transactions/ext/${r}?apiKey=${o}`);if(!c.ok)throw new t.PrivyClientError({error:`Failed to fetch transaction status for Transaction ${r}`,code:"failed_to_fetch_moonpay_transaction_status"});const u=await c.json();return Array.isArray(u)?u.at(0):void 0}};
package/dist/cjs/Privy.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./AppApi.js"),r=require("./AuthApi.js"),i=require("./EmbeddedWalletApi.js"),s=require("./MfaApi.js"),t=require("./MfaPromises.js"),a=require("./PrivyInternal.js"),u=require("./RecoveryApi.js"),n=require("./UserApi.js");require("@privy-io/public-api"),require("./CustomProviderApi.js"),require("./EmailApi.js"),require("./FarcasterApi.js"),require("./GuestApi.js"),require("./OAuthApi.js"),require("./Error.js"),require("./pkce.js"),require("jose"),require("./PasskeyApi.js"),require("./PhoneApi.js"),require("./SiweApi.js"),require("./SmartWalletApi.js"),require("./chains/index.js"),require("./chains/arbitrum.js"),require("./chains/arbitrumGoerli.js"),require("./chains/arbitrumSepolia.js"),require("./chains/avalanche.js"),require("./chains/avalancheFuji.js"),require("./chains/base.js"),require("./chains/baseGoerli.js"),require("./chains/baseSepolia.js"),require("./chains/berachainArtio.js"),require("./chains/celo.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/mainnet.js"),require("./chains/optimism.js"),require("./chains/optimismGoerli.js"),require("./chains/optimismSepolia.js"),require("./chains/polygon.js"),require("./chains/polygonMumbai.js"),require("./chains/redstone.js"),require("./chains/redstoneHolesky.js"),require("./chains/sepolia.js"),require("./chains/zora.js"),require("./chains/zoraSepolia.js"),require("./chains/zoraTestnet.js"),require("./embedded/EmbeddedWalletProvider.js"),require("eventemitter3"),require("./embedded/errors.js"),require("./embedded/types.js"),require("./embedded/methods.js"),require("./embedded/utils/index.js"),require("@ethersproject/abstract-signer"),require("@ethersproject/providers"),require("./embedded/gas/arbitrum.js"),require("@ethersproject/bignumber"),require("./embedded/utils/ethers.js"),require("./embedded/gas/bsc.js"),require("./embedded/gas/op-stack.js"),require("@ethersproject/contracts"),require("@ethersproject/transactions"),require("./embedded/gas/polygon.js"),require("@ethersproject/units"),require("fetch-retry"),require("./chains/polygonAmoy.js"),require("./embedded/utils/gas.js"),require("./embedded/EmbeddedSolanaWalletProvider.js"),require("./embedded/EmbeddedWalletProxy.js"),require("./embedded/EventCallbackQueue.js"),require("./embedded/withMfa.js"),require("./embedded/EmbeddedBitcoinWalletProvider.js"),require("./MfaPasskeyApi.js"),require("./MfaSmsApi.js"),require("uuid"),require("@privy-io/api-base"),require("./Session.js"),require("js-cookie"),require("./Token.js"),require("./utils/allSettled.js"),require("./toAbortSignalTimeout.js"),require("./RecoveryICloudApi.js"),require("./RecoveryOAuthApi.js");exports.default=class{auth;user;embeddedWallet;recovery;mfa;app;mfaPromises;_privyInternal;constructor({clientId:d,...o}){this._privyInternal=new a.PrivyInternal({...o,appClientId:d}),this.user=new n.default(this._privyInternal),this.app=new e.default(this._privyInternal),this.auth=new r.default(this._privyInternal,o.storage,o.crypto),this.mfa=new s.default(this._privyInternal),this.mfaPromises=new t.default,this.embeddedWallet=new i.default(this._privyInternal,o.embeddedWalletMessagePoster,o.supportedChains,this.mfa,this.mfaPromises),this.recovery=new u.default(this._privyInternal,o.storage,o.crypto)}async initialize(){await this._privyInternal._initialize()}setMessagePoster(e){this.embeddedWallet.setMessagePoster(e)}addOAuthTokensListener(e){return this._privyInternal.session.on("oauth_tokens_granted",e),{unsubscribe:()=>{this._privyInternal.session.removeListener("oauth_tokens_granted",e)}}}setCallbacks(e){this._privyInternal.setCallbacks(e)}getAccessToken(){return this._privyInternal.getAccessToken()}getIdentityToken(){return this._privyInternal.getIdentityToken()}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./AppApi.js"),r=require("./AuthApi.js"),i=require("./EmbeddedWalletApi.js"),s=require("./FundingApi.js"),t=require("./MfaApi.js"),a=require("./MfaPromises.js"),n=require("./PrivyInternal.js"),u=require("./RecoveryApi.js"),d=require("./UserApi.js");require("@privy-io/public-api"),require("./CustomProviderApi.js"),require("./EmailApi.js"),require("./FarcasterApi.js"),require("./FarcasterV2Api.js"),require("./GuestApi.js"),require("./OAuthApi.js"),require("./Error.js"),require("./pkce.js"),require("jose"),require("./PasskeyApi.js"),require("./PhoneApi.js"),require("./SiweApi.js"),require("./SmartWalletApi.js"),require("./chains/index.js"),require("./chains/arbitrum.js"),require("./chains/arbitrumGoerli.js"),require("./chains/arbitrumSepolia.js"),require("./chains/avalanche.js"),require("./chains/avalancheFuji.js"),require("./chains/base.js"),require("./chains/baseGoerli.js"),require("./chains/baseSepolia.js"),require("./chains/berachainArtio.js"),require("./chains/celo.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/mainnet.js"),require("./chains/optimism.js"),require("./chains/optimismGoerli.js"),require("./chains/optimismSepolia.js"),require("./chains/polygon.js"),require("./chains/polygonMumbai.js"),require("./chains/redstone.js"),require("./chains/redstoneHolesky.js"),require("./chains/sepolia.js"),require("./chains/zora.js"),require("./chains/zoraSepolia.js"),require("./chains/zoraTestnet.js"),require("./embedded/EmbeddedWalletProvider.js"),require("eventemitter3"),require("./embedded/errors.js"),require("./embedded/types.js"),require("./embedded/methods.js"),require("./embedded/utils/index.js"),require("@ethersproject/abstract-signer"),require("@ethersproject/providers"),require("./embedded/gas/arbitrum.js"),require("@ethersproject/bignumber"),require("./embedded/utils/ethers.js"),require("./embedded/gas/bsc.js"),require("./embedded/gas/op-stack.js"),require("@ethersproject/contracts"),require("@ethersproject/transactions"),require("./embedded/gas/polygon.js"),require("@ethersproject/units"),require("fetch-retry"),require("./chains/polygonAmoy.js"),require("./embedded/utils/gas.js"),require("./embedded/EmbeddedSolanaWalletProvider.js"),require("./embedded/EmbeddedWalletProxy.js"),require("./embedded/EventCallbackQueue.js"),require("./embedded/withMfa.js"),require("./embedded/EmbeddedBitcoinWalletProvider.js"),require("./CoinbaseOnRampApi.js"),require("./MoonpayOnRampApi.js"),require("./funding/moonpay.js"),require("./MfaPasskeyApi.js"),require("./MfaSmsApi.js"),require("uuid"),require("@privy-io/api-base"),require("./Session.js"),require("js-cookie"),require("./Token.js"),require("./utils/allSettled.js"),require("./toAbortSignalTimeout.js"),require("./utils/toSearchParams.js"),require("./RecoveryICloudApi.js"),require("./RecoveryOAuthApi.js");exports.default=class{auth;user;embeddedWallet;recovery;mfa;app;mfaPromises;funding;_privyInternal;constructor({clientId:o,...l}){this._privyInternal=new n.PrivyInternal({...l,appClientId:o}),this.user=new d.default(this._privyInternal),this.app=new e.default(this._privyInternal),this.auth=new r.default(this._privyInternal,l.storage,l.crypto),this.mfa=new t.default(this._privyInternal),this.mfaPromises=new a.default,this.embeddedWallet=new i.default(this._privyInternal,l.embeddedWalletMessagePoster,l.supportedChains,this.mfa,this.mfaPromises),this.recovery=new u.default(this._privyInternal,l.storage,l.crypto),this.funding=new s.default(this._privyInternal)}async initialize(){await this._privyInternal._initialize()}setMessagePoster(e){this.embeddedWallet.setMessagePoster(e)}addOAuthTokensListener(e){return this._privyInternal.session.on("oauth_tokens_granted",e),{unsubscribe:()=>{this._privyInternal.session.removeListener("oauth_tokens_granted",e)}}}setCallbacks(e){this._privyInternal.setCallbacks(e)}getAccessToken(){return this._privyInternal.getAccessToken()}getIdentityToken(){return this._privyInternal.getIdentityToken()}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("fetch-retry"),t=require("uuid"),s=require("@privy-io/api-base"),i=require("@privy-io/public-api"),a=require("./Error.js"),r=require("./Session.js"),n=require("./toAbortSignalTimeout.js");function o(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=o(e);const h="privy:caid";exports.PrivyInternal=class{baseUrl;_config;appId;appClientId;_storage;_analyticsId;_sdkVersion="js-sdk-core:0.34.2";_fetch;nativeAppIdentifier;callbacks;_cache=new Map;session;constructor(e){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,"undefined"==typeof document&&(this.nativeAppIdentifier=e.nativeAppIdentifier),this.session=new r.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})}))}setCallbacks(e){this.callbacks={...this.callbacks,...e}}get isReady(){return Boolean(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 a.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,headers:r,options:n={onRequest:this._beforeRequest.bind(this)}}){const o=`${this.baseUrl}${i.getPathWithParams(e.path,s)}`,c=new Request(o,{method:e.method,body:JSON.stringify(t),headers:r}),h=await n.onRequest(c),l=await this._fetch(c,h),d=await l.json();if(l.status>299)throw new a.PrivyApiError(d);return d}async _beforeRequestWithoutInitialize(e){const 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");const 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{const e=await this._storage.get(h);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(h,this._analyticsId)}catch(e){console.error(`Unable to store clientId: ${this._analyticsId}`,e)}return this._analyticsId}async destroyClientAnalyticsId(){try{return await this._storage.del(h)}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(){const e=await this.session.getRefreshToken()??void 0,t=e??"key",s=this._cache.get(t);if(s)return await s;const i=this._refreshSession(e);this._cache.set(t,i);try{return await i}catch(e){throw e}finally{this._cache.delete(t)}}async _refreshSession(e){const t=await this.session.getToken();if(!this.session.hasRefreshCredentials(t,e??null))throw await this._initialize(),new a.PrivyApiError({code:s.PrivyErrorCode.MISSING_OR_INVALID_TOKEN,error:"No tokens found in storage"});try{const t=await this.fetch(i.RefreshSession,{body:{refresh_token:e},options:{onRequest:this.beforeRequestWithoutRefresh.bind(this)}}),s=t.session_update_action;return this.callbacks?.setUser?.(t.user),"set"===s&&await this.session.updateWithTokensResponse(t),"clear"===s&&(await this.session.destroyLocalState(),this.callbacks?.setUser?.(null)),"ignore"===s&&t.token&&(await this.session.storeToken(t.token),t.identity_token&&await this.session.storeIdentityToken(t.identity_token)),t}catch(e){throw e instanceof a.PrivyApiError&&e.code===s.PrivyErrorCode.MISSING_OR_INVALID_TOKEN&&(await this.session.destroyLocalState(),this.callbacks?.setUser?.(null)),e}}async getAccessToken(){const[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{const e="privy:__storage__test",t="blobby";await this._storage.put(e,t);const s=await this._storage.get(e);return await this._storage.del(e),s===t}catch(e){return console.error(e),!1}}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("fetch-retry"),t=require("uuid"),s=require("@privy-io/api-base"),i=require("@privy-io/public-api"),a=require("./Error.js"),r=require("./Session.js"),n=require("./toAbortSignalTimeout.js"),o=require("./utils/toSearchParams.js");function c(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 h=c(e);const l="privy:caid";exports.PrivyInternal=class{baseUrl;_config;appId;appClientId;_storage;_analyticsId;_sdkVersion="js-sdk-core:0.35.0-beta-20241120224355";_fetch;nativeAppIdentifier;callbacks;_cache=new Map;session;constructor(e){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,"undefined"==typeof document&&(this.nativeAppIdentifier=e.nativeAppIdentifier),this.session=new r.Session({storage:this._storage,isUsingServerCookies:!1,appId:e.appId}),this._fetch=h.default(fetch,{retries:3,retryDelay:500}),this.session.on("error_storing_tokens",(e=>{this.createAnalyticsEvent("error_updating_tokens_in_storage",{reason:e})}))}setCallbacks(e){this.callbacks={...this.callbacks,...e}}get isReady(){return Boolean(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 a.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:r,headers:n,options:c={onRequest:this._beforeRequest.bind(this)}}){const h=`${this.baseUrl}${i.getPathWithParams(e.path,s)}${o.toSearchParams(r)}`,l=new Request(h,{method:e.method,body:JSON.stringify(t),headers:n}),d=await c.onRequest(l),u=await this._fetch(l,d),p=await u.json();if(u.status>299)throw new a.PrivyApiError(p);return p}async _beforeRequestWithoutInitialize(e){const 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");const 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{const 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(){const e=await this.session.getRefreshToken()??void 0,t=e??"key",s=this._cache.get(t);if(s)return await s;const i=this._refreshSession(e);this._cache.set(t,i);try{return await i}catch(e){throw e}finally{this._cache.delete(t)}}async _refreshSession(e){const t=await this.session.getToken();if(!this.session.hasRefreshCredentials(t,e??null))throw await this._initialize(),new a.PrivyApiError({code:s.PrivyErrorCode.MISSING_OR_INVALID_TOKEN,error:"No tokens found in storage"});try{const t=await this.fetch(i.RefreshSession,{body:{refresh_token:e},options:{onRequest:this.beforeRequestWithoutRefresh.bind(this)}}),s=t.session_update_action;return this.callbacks?.setUser?.(t.user),"set"===s&&await this.session.updateWithTokensResponse(t),"clear"===s&&(await this.session.destroyLocalState(),this.callbacks?.setUser?.(null)),"ignore"===s&&t.token&&(await this.session.storeToken(t.token),t.identity_token&&await this.session.storeIdentityToken(t.identity_token)),t}catch(e){throw e instanceof a.PrivyApiError&&e.code===s.PrivyErrorCode.MISSING_OR_INVALID_TOKEN&&(await this.session.destroyLocalState(),this.callbacks?.setUser?.(null)),e}}async getAccessToken(){const[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{const e="privy:__storage__test",t="blobby";await this._storage.put(e,t);const s=await this._storage.get(e);return await this._storage.del(e),s===t}catch(e){return console.error(e),!1}}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./arbitrum.js"),i=require("./arbitrumGoerli.js"),r=require("./arbitrumSepolia.js"),o=require("./avalanche.js"),a=require("./avalancheFuji.js"),s=require("./base.js"),l=require("./baseGoerli.js"),t=require("./baseSepolia.js"),n=require("./berachainArtio.js"),u=require("./celo.js"),p=require("./celoAlfajores.js"),m=require("./filecoin.js"),j=require("./filecoinCalibration.js"),b=require("./garnetHolesky.js"),c=require("./goerli.js"),q=require("./holesky.js"),y=require("./linea.js"),S=require("./lineaTestnet.js"),g=require("./mainnet.js"),h=require("./optimism.js"),f=require("./optimismGoerli.js"),k=require("./optimismSepolia.js"),z=require("./polygon.js"),G=require("./polygonMumbai.js"),T=require("./redstone.js"),d=require("./redstoneHolesky.js"),v=require("./sepolia.js"),A=require("./zora.js"),H=require("./zoraSepolia.js"),_=require("./zoraTestnet.js");const C={mainnet:g.mainnet,goerli:c.goerli,sepolia:v.sepolia,arbitrum:e.arbitrum,arbitrumGoerli:i.arbitrumGoerli,arbitrumSepolia:r.arbitrumSepolia,optimism:h.optimism,optimismGoerli:f.optimismGoerli,optimismSepolia:k.optimismSepolia,polygon:z.polygon,polygonMumbai:G.polygonMumbai,celo:u.celo,celoAlfajores:p.celoAlfajores,filecoin:m.filecoin,filecoinCalibration:j.filecoinCalibration,base:s.base,baseGoerli:l.baseGoerli,baseSepolia:t.baseSepolia,linea:y.linea,lineaTestnet:S.lineaTestnet,avalanche:o.avalanche,avalancheFuji:a.avalancheFuji,holesky:q.holesky,redstone:T.redstone,garnetHolesky:b.garnetHolesky,redstoneHolesky:d.redstoneHolesky,zora:A.zora,zoraSepolia:H.zoraSepolia,zoraTestnet:_.zoraTestnet},D=[g.mainnet,c.goerli,v.sepolia,e.arbitrum,i.arbitrumGoerli,r.arbitrumSepolia,h.optimism,f.optimismGoerli,k.optimismSepolia,z.polygon,G.polygonMumbai,u.celo,p.celoAlfajores,m.filecoin,j.filecoinCalibration,s.base,l.baseGoerli,t.baseSepolia,n.berachainArtio,y.linea,S.lineaTestnet,o.avalanche,a.avalancheFuji,q.holesky,T.redstone,b.garnetHolesky,d.redstoneHolesky,A.zora,H.zoraSepolia,_.zoraTestnet],F=new Set(D.map((e=>e.id)));exports.DEFAULT_SUPPORTED_CHAINS=D,exports.DEFAULT_SUPPORTED_CHAIN_IDS=F,exports.chainDefs=C;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./arbitrum.js"),i=require("./arbitrumGoerli.js"),r=require("./arbitrumSepolia.js"),o=require("./avalanche.js"),a=require("./avalancheFuji.js"),s=require("./base.js"),l=require("./baseGoerli.js"),t=require("./baseSepolia.js"),n=require("./berachainArtio.js"),u=require("./celo.js"),p=require("./celoAlfajores.js"),m=require("./filecoin.js"),j=require("./filecoinCalibration.js"),b=require("./garnetHolesky.js"),c=require("./goerli.js"),q=require("./holesky.js"),y=require("./linea.js"),S=require("./lineaTestnet.js"),g=require("./mainnet.js"),f=require("./optimism.js"),h=require("./optimismGoerli.js"),d=require("./optimismSepolia.js"),k=require("./polygon.js"),z=require("./polygonMumbai.js"),G=require("./redstone.js"),T=require("./redstoneHolesky.js"),v=require("./sepolia.js"),A=require("./zora.js"),H=require("./zoraSepolia.js"),C=require("./zoraTestnet.js");const _={mainnet:g.mainnet,goerli:c.goerli,sepolia:v.sepolia,arbitrum:e.arbitrum,arbitrumGoerli:i.arbitrumGoerli,arbitrumSepolia:r.arbitrumSepolia,optimism:f.optimism,optimismGoerli:h.optimismGoerli,optimismSepolia:d.optimismSepolia,polygon:k.polygon,polygonMumbai:z.polygonMumbai,celo:u.celo,celoAlfajores:p.celoAlfajores,filecoin:m.filecoin,filecoinCalibration:j.filecoinCalibration,base:s.base,baseGoerli:l.baseGoerli,baseSepolia:t.baseSepolia,linea:y.linea,lineaTestnet:S.lineaTestnet,avalanche:o.avalanche,avalancheFuji:a.avalancheFuji,holesky:q.holesky,redstone:G.redstone,garnetHolesky:b.garnetHolesky,redstoneHolesky:T.redstoneHolesky,zora:A.zora,zoraSepolia:H.zoraSepolia,zoraTestnet:C.zoraTestnet},D=[g.mainnet,c.goerli,v.sepolia,e.arbitrum,i.arbitrumGoerli,r.arbitrumSepolia,f.optimism,h.optimismGoerli,d.optimismSepolia,k.polygon,z.polygonMumbai,u.celo,p.celoAlfajores,m.filecoin,j.filecoinCalibration,s.base,l.baseGoerli,t.baseSepolia,n.berachainArtio,y.linea,S.lineaTestnet,o.avalanche,a.avalancheFuji,q.holesky,G.redstone,b.garnetHolesky,T.redstoneHolesky,A.zora,H.zoraSepolia,C.zoraTestnet],F=new Set(D.map((e=>e.id)));exports.DEFAULT_SUPPORTED_CHAINS=D,exports.DEFAULT_SUPPORTED_CHAIN_IDS=F,exports.chainDefs=_,exports.getSupportedChainById=function(e){return D.find((i=>i.id===e))};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getCoinbaseOnRampUrl=function({input:e,amount:s,blockchain:t}){const r=new URL("https://pay.coinbase.com/buy/select-asset");return r.searchParams.set("appId",e.app_id),r.searchParams.set("sessionToken",e.session_token),r.searchParams.set("defaultExperience","buy"),r.searchParams.set("presetCryptoAmount",function(e){return e.startsWith(".")?`0${e}`:e}(s)),r.searchParams.set("defaultNetwork",t),r.searchParams.set("partnerUserId",e.partner_user_id),{url:r}};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../chains/arbitrum.js"),i=require("../chains/base.js"),r=require("../chains/mainnet.js"),n=require("../chains/optimism.js"),s=require("../chains/polygon.js");const o=new Set([r.mainnet.id,e.arbitrum.id,i.base.id,s.polygon.id]),t=new Set([r.mainnet.id,e.arbitrum.id,n.optimism.id,i.base.id,s.polygon.id]);exports.MoonpayEnvironments={prod:{url:"https://api.moonpay.com/v1",key:"pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL"},sandbox:{url:"https://api.moonpay.com/v1",key:"pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI"}},exports.isSupportedChainIdForMoonpay=function(e,i){switch(i){case"native-currency":return o.has(e);case"USDC":return t.has(e);default:return console.warn("Unknown asset passed to MoonPay Onramp"),!1}};
package/dist/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./Privy.js"),r=require("@privy-io/public-api"),i=require("./storage/LocalStorage.js"),t=require("./storage/InMemoryStorage.js"),s=require("./Error.js"),o=require("./embedded/errors.js"),a=require("./utils/getUserEmbeddedEthereumWallet.js"),d=require("./utils/getAllUserEmbeddedEthereumWallets.js"),u=require("./utils/getAllUserEmbeddedSolanaWallets.js"),n=require("./utils/getAllUserEmbeddedBitcoinWallets.js"),l=require("./utils/getUserSmartWallet.js"),c=require("./embedded/utils/index.js"),p=require("./utils/phoneNumberUtils.js"),m=require("./utils/getUserEmbeddedSolanaWallet.js"),j=require("./utils/toObjectKeys.js"),q=require("./embedded/utils/gas.js"),b=require("./embedded/utils/ethers.js"),E=require("./types.js"),h=require("./chains/index.js");require("./AppApi.js"),require("./AuthApi.js"),require("./CustomProviderApi.js"),require("./EmailApi.js"),require("./FarcasterApi.js"),require("./GuestApi.js"),require("./OAuthApi.js"),require("./pkce.js"),require("jose"),require("./PasskeyApi.js"),require("./PhoneApi.js"),require("./SiweApi.js"),require("./SmartWalletApi.js"),require("./EmbeddedWalletApi.js"),require("./embedded/EmbeddedWalletProvider.js"),require("eventemitter3"),require("./embedded/methods.js"),require("./embedded/EmbeddedSolanaWalletProvider.js"),require("./embedded/EmbeddedWalletProxy.js"),require("./embedded/EventCallbackQueue.js"),require("./embedded/withMfa.js"),require("./embedded/EmbeddedBitcoinWalletProvider.js"),require("./MfaApi.js"),require("./MfaPasskeyApi.js"),require("./MfaSmsApi.js"),require("./MfaPromises.js"),require("./PrivyInternal.js"),require("fetch-retry"),require("uuid"),require("@privy-io/api-base"),require("./Session.js"),require("js-cookie"),require("./Token.js"),require("./utils/allSettled.js"),require("./toAbortSignalTimeout.js"),require("./RecoveryApi.js"),require("./RecoveryICloudApi.js"),require("./RecoveryOAuthApi.js"),require("./UserApi.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("./chains/avalanche.js"),require("./chains/avalancheFuji.js"),require("./chains/berachainArtio.js"),require("./chains/celo.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/mainnet.js"),require("./chains/redstone.js"),require("./chains/redstoneHolesky.js"),require("./chains/sepolia.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=i.LocalStorage,exports.InMemoryCache=t.InMemoryCache,exports.PrivyApiError=s.PrivyApiError,exports.PrivyClientError=s.PrivyClientError,exports.createErrorFormatter=s.createErrorFormatter,exports.errorIndicatesMfaCanceled=s.errorIndicatesMfaCanceled,exports.EmbeddedProviderError=o.EmbeddedProviderError,exports.PrivyConnectorError=o.PrivyConnectorError,Object.defineProperty(exports,"PrivyEmbeddedWalletErrorCode",{enumerable:!0,get:function(){return 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=d.getAllUserEmbeddedEthereumWallets,exports.getAllUserEmbeddedSolanaWallets=u.getAllUserEmbeddedSolanaWallets,exports.getAllUserEmbeddedBitcoinWallets=n.getAllUserEmbeddedBitcoinWallets,exports.getUserSmartWallet=l.getUserSmartWallet,exports.getJsonRpcEndpointFromChain=c.getJsonRpcEndpointFromChain,exports.populateTransactionRequest=c.populateTransactionRequest,exports.throwIfInvalidRecoveryUpgradePath=c.throwIfInvalidRecoveryUpgradePath,exports.countryCodesAndNumbers=p.countryCodesAndNumbers,exports.formatPhoneNumber=p.formatPhoneNumber,exports.getCountryCallingCode=p.getCountryCallingCode,exports.getPhoneCountryCodeAndNumber=p.getPhoneCountryCodeAndNumber,exports.getPlaceholderPhoneNumber=p.getPlaceholderPhoneNumber,exports.lastFourDigits=p.lastFourDigits,exports.phoneNumberTypingFormatter=p.phoneNumberTypingFormatter,exports.validatePhoneNumber=p.validatePhoneNumber,exports.getUserEmbeddedSolanaWallet=m.getUserEmbeddedSolanaWallet,exports.toObjectKeys=j.toObjectKeys,exports.calculateTotalGasEstimate=q.calculateTotalGasEstimate,exports.QuantityToBigNumber=b.QuantityToBigNumber,exports.convertBigNumberish=b.convertBigNumberish,exports.toEthersUnsignedTransaction=b.toEthersUnsignedTransaction,exports.ALL_WALLET_CLIENT_TYPES=E.ALL_WALLET_CLIENT_TYPES,exports.SUPPORTED_CONNECTOR_TYPES=E.SUPPORTED_CONNECTOR_TYPES,exports.DEFAULT_SUPPORTED_CHAINS=h.DEFAULT_SUPPORTED_CHAINS,exports.DEFAULT_SUPPORTED_CHAIN_IDS=h.DEFAULT_SUPPORTED_CHAIN_IDS,exports.chainDefs=h.chainDefs;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./Privy.js"),r=require("@privy-io/public-api"),s=require("./storage/LocalStorage.js"),t=require("./storage/InMemoryStorage.js"),i=require("./Error.js"),o=require("./embedded/errors.js"),a=require("./utils/getUserEmbeddedEthereumWallet.js"),d=require("./utils/getAllUserEmbeddedEthereumWallets.js"),u=require("./utils/getAllUserEmbeddedSolanaWallets.js"),n=require("./utils/getAllUserEmbeddedBitcoinWallets.js"),l=require("./utils/getUserSmartWallet.js"),p=require("./embedded/utils/index.js"),c=require("./utils/phoneNumberUtils.js"),m=require("./utils/getUserEmbeddedSolanaWallet.js"),j=require("./utils/toObjectKeys.js"),q=require("./embedded/utils/gas.js"),b=require("./embedded/utils/ethers.js"),E=require("./utils/getIsTokenUsdc.js"),h=require("./types.js"),A=require("./chains/index.js"),g=require("./utils/formatters.js");require("./AppApi.js"),require("./AuthApi.js"),require("./CustomProviderApi.js"),require("./EmailApi.js"),require("./FarcasterApi.js"),require("./FarcasterV2Api.js"),require("./GuestApi.js"),require("./OAuthApi.js"),require("./pkce.js"),require("jose"),require("./PasskeyApi.js"),require("./PhoneApi.js"),require("./SiweApi.js"),require("./SmartWalletApi.js"),require("./EmbeddedWalletApi.js"),require("./embedded/EmbeddedWalletProvider.js"),require("eventemitter3"),require("./embedded/methods.js"),require("./embedded/EmbeddedSolanaWalletProvider.js"),require("./embedded/EmbeddedWalletProxy.js"),require("./embedded/EventCallbackQueue.js"),require("./embedded/withMfa.js"),require("./embedded/EmbeddedBitcoinWalletProvider.js"),require("./FundingApi.js"),require("./CoinbaseOnRampApi.js"),require("./MoonpayOnRampApi.js"),require("fetch-retry"),require("./funding/moonpay.js"),require("./chains/arbitrum.js"),require("./chains/base.js"),require("./chains/mainnet.js"),require("./chains/optimism.js"),require("./chains/polygon.js"),require("./MfaApi.js"),require("./MfaPasskeyApi.js"),require("./MfaSmsApi.js"),require("./MfaPromises.js"),require("./PrivyInternal.js"),require("uuid"),require("@privy-io/api-base"),require("./Session.js"),require("js-cookie"),require("./Token.js"),require("./utils/allSettled.js"),require("./toAbortSignalTimeout.js"),require("./utils/toSearchParams.js"),require("./RecoveryApi.js"),require("./RecoveryICloudApi.js"),require("./RecoveryOAuthApi.js"),require("./UserApi.js"),require("./embedded/types.js"),require("@ethersproject/abstract-signer"),require("@ethersproject/providers"),require("./embedded/gas/arbitrum.js"),require("@ethersproject/bignumber"),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/baseGoerli.js"),require("./chains/baseSepolia.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/polygonAmoy.js"),require("./chains/polygonMumbai.js"),require("./chains/avalanche.js"),require("./chains/avalancheFuji.js"),require("./chains/sepolia.js"),require("./chains/berachainArtio.js"),require("./chains/celo.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"),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=s.LocalStorage,exports.InMemoryCache=t.InMemoryCache,exports.PrivyApiError=i.PrivyApiError,exports.PrivyClientError=i.PrivyClientError,exports.createErrorFormatter=i.createErrorFormatter,exports.errorIndicatesMfaCanceled=i.errorIndicatesMfaCanceled,exports.EmbeddedProviderError=o.EmbeddedProviderError,exports.PrivyConnectorError=o.PrivyConnectorError,Object.defineProperty(exports,"PrivyEmbeddedWalletErrorCode",{enumerable:!0,get:function(){return 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=d.getAllUserEmbeddedEthereumWallets,exports.getAllUserEmbeddedSolanaWallets=u.getAllUserEmbeddedSolanaWallets,exports.getAllUserEmbeddedBitcoinWallets=n.getAllUserEmbeddedBitcoinWallets,exports.getUserSmartWallet=l.getUserSmartWallet,exports.getJsonRpcEndpointFromChain=p.getJsonRpcEndpointFromChain,exports.populateTransactionRequest=p.populateTransactionRequest,exports.throwIfInvalidRecoveryUpgradePath=p.throwIfInvalidRecoveryUpgradePath,exports.countryCodesAndNumbers=c.countryCodesAndNumbers,exports.formatPhoneNumber=c.formatPhoneNumber,exports.getCountryCallingCode=c.getCountryCallingCode,exports.getPhoneCountryCodeAndNumber=c.getPhoneCountryCodeAndNumber,exports.getPlaceholderPhoneNumber=c.getPlaceholderPhoneNumber,exports.lastFourDigits=c.lastFourDigits,exports.phoneNumberTypingFormatter=c.phoneNumberTypingFormatter,exports.validatePhoneNumber=c.validatePhoneNumber,exports.getUserEmbeddedSolanaWallet=m.getUserEmbeddedSolanaWallet,exports.toObjectKeys=j.toObjectKeys,exports.calculateTotalGasEstimate=q.calculateTotalGasEstimate,exports.QuantityToBigNumber=b.QuantityToBigNumber,exports.convertBigNumberish=b.convertBigNumberish,exports.toEthersUnsignedTransaction=b.toEthersUnsignedTransaction,exports.UsdcAddressMap=E.UsdcAddressMap,exports.getIsTokenUsdc=E.getIsTokenUsdc,exports.ALL_WALLET_CLIENT_TYPES=h.ALL_WALLET_CLIENT_TYPES,exports.SUPPORTED_CONNECTOR_TYPES=h.SUPPORTED_CONNECTOR_TYPES,exports.DEFAULT_SUPPORTED_CHAINS=A.DEFAULT_SUPPORTED_CHAINS,exports.DEFAULT_SUPPORTED_CHAIN_IDS=A.DEFAULT_SUPPORTED_CHAIN_IDS,exports.chainDefs=A.chainDefs,exports.getSupportedChainById=A.getSupportedChainById,exports.formatErc20TokenAmount=g.formatErc20TokenAmount,exports.formatWalletAddress=g.formatWalletAddress,exports.formatWeiAmount=g.formatWeiAmount;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("viem");exports.formatErc20TokenAmount=function({amount:r,decimals:t}){return e.formatUnits(BigInt(r),t)},exports.formatWalletAddress=function(e){return e?`${e.slice(0,5)}…${e.slice(-4)}`:""},exports.formatWeiAmount=function({wei:r,precision:t=3}){return parseFloat(e.formatEther(r)).toFixed(t).replace(/0+$/,"").replace(/\.$/,"")};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../chains/arbitrum.js"),i=require("../chains/arbitrumSepolia.js"),a=require("../chains/avalanche.js"),c=require("../chains/avalancheFuji.js"),s=require("../chains/base.js"),r=require("../chains/baseSepolia.js"),d=require("../chains/mainnet.js"),b=require("../chains/optimism.js"),n=require("../chains/optimismSepolia.js"),o=require("../chains/polygon.js"),f=require("../chains/polygonAmoy.js"),u=require("../chains/sepolia.js");const p={[d.mainnet.id]:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",[u.sepolia.id]:"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",[b.optimism.id]:"0x0b2c639c533813f4aa9d7837caf62653d097ff85",[n.optimismSepolia.id]:"0x5fd84259d66Cd46123540766Be93DFE6D43130D7",[o.polygon.id]:"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",[f.polygonAmoy.id]:"0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582",[s.base.id]:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",[r.baseSepolia.id]:"0x036CbD53842c5426634e7929541eC2318f3dCF7e",[a.avalanche.id]:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",[c.avalancheFuji.id]:"0x5425890298aed601595a70ab815c96711a31bc65",[e.arbitrum.id]:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",[i.arbitrumSepolia.id]:"0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"};exports.UsdcAddressMap=p,exports.getIsTokenUsdc=function(e,i){return e===p[i.id]};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.toSearchParams=function(r){const e=new URLSearchParams;for(const t in r)null!=r[t]&&e.append(t,String(r[t]));return Array.from(e).length?"?"+e.toString():""};
@@ -1,6 +1,7 @@
1
1
  import CustomProviderApi from './CustomProviderApi';
2
2
  import EmailApi from './EmailApi';
3
3
  import FarcasterApi from './FarcasterApi';
4
+ import FarcasterV2Api from './FarcasterV2Api';
4
5
  import GuestApi from './GuestApi';
5
6
  import OAuthApi from './OAuthApi';
6
7
  import PasskeyApi from './PasskeyApi';
@@ -40,6 +41,11 @@ export default class AuthApi {
40
41
  * APIs for login with Farcaster
41
42
  */
42
43
  readonly farcaster: FarcasterApi;
44
+ /**
45
+ * @experimental
46
+ * APIs for bare metal login with Farcaster
47
+ */
48
+ readonly farcasterV2: FarcasterV2Api;
43
49
  /**
44
50
  * APIs for guest login
45
51
  */
@@ -1,6 +1,7 @@
1
1
  import CustomProviderApi from './CustomProviderApi';
2
2
  import EmailApi from './EmailApi';
3
3
  import FarcasterApi from './FarcasterApi';
4
+ import FarcasterV2Api from './FarcasterV2Api';
4
5
  import GuestApi from './GuestApi';
5
6
  import OAuthApi from './OAuthApi';
6
7
  import PasskeyApi from './PasskeyApi';
@@ -40,6 +41,11 @@ export default class AuthApi {
40
41
  * APIs for login with Farcaster
41
42
  */
42
43
  readonly farcaster: FarcasterApi;
44
+ /**
45
+ * @experimental
46
+ * APIs for bare metal login with Farcaster
47
+ */
48
+ readonly farcasterV2: FarcasterV2Api;
43
49
  /**
44
50
  * APIs for guest login
45
51
  */
@@ -0,0 +1,12 @@
1
+ import { type CoinbaseOnRampInitInput } from '@privy-io/public-api';
2
+ export default class CoinbaseOnRampApi {
3
+ /**
4
+ * Creates a new on-ramp session in coinbase.
5
+ * @returns the session information for this on-ramp flow
6
+ */
7
+ initOnRampSession(args: CoinbaseOnRampInitInput): Promise<import("@privy-io/public-api").PrivyCoinbaseOnRampInitResponse>;
8
+ /**
9
+ * Fetch the status of a Coinbase on-ramp flow
10
+ */
11
+ getStatus(partnerUserId: string): Promise<import("@privy-io/public-api").PrivyCoinbaseOnRampStatusResponse>;
12
+ }
@@ -0,0 +1,12 @@
1
+ import { type CoinbaseOnRampInitInput } from '@privy-io/public-api';
2
+ export default class CoinbaseOnRampApi {
3
+ /**
4
+ * Creates a new on-ramp session in coinbase.
5
+ * @returns the session information for this on-ramp flow
6
+ */
7
+ initOnRampSession(args: CoinbaseOnRampInitInput): Promise<import("@privy-io/public-api").PrivyCoinbaseOnRampInitResponse>;
8
+ /**
9
+ * Fetch the status of a Coinbase on-ramp flow
10
+ */
11
+ getStatus(partnerUserId: string): Promise<import("@privy-io/public-api").PrivyCoinbaseOnRampStatusResponse>;
12
+ }
@@ -1,7 +1,7 @@
1
1
  import type { PrivyErrorCode } from '@privy-io/api-base';
2
2
  type AuthAction = 'login' | 'link';
3
3
  type Method = 'email' | 'sms' | 'oauth' | 'siwe' | 'passkey' | 'farcaster';
4
- export type ClientErrorCode = `failed_to_complete_${AuthAction}_with_oauth` | `${AuthAction}_with_oauth_returned_with_invalid_credentials` | `${AuthAction}_with_oauth_was_cancelled_by_user` | 'attempted_rpc_call_before_logged_in' | 'attempted_submit_otp_before_sending' | 'attempted_to_set_password_before_connected' | 'attempted_to_set_password_but_password_already_set' | `attempted_login_with_${Method}_while_already_logged_in` | `attempted_link_${Method}_before_logged_in` | `attempted_unlink_siwe_before_logged_in` | 'embedded_wallet_needs_recovery' | 'embedded_wallet_creation_error' | 'embedded_wallet_recovery_error' | 'embedded_wallet_set_password_error' | 'embedded_wallet_set_recovery_error' | 'unknown_embedded_wallet_error' | 'embedded_wallet_does_not_exist' | 'embedded_wallet_already_exists' | 'embedded_wallet_webview_not_loaded' | 'embedded_wallet_request_error' | 'no_passkey_found_for_challenge' | 'pkce_state_code_mismatch' | 'failed_to_create_passkey' | 'failed_to_generate_farcaster_uri' | 'failed_to_generate_farcaster_channel_token' | 'farcaster_polling_timeout' | 'farcaster_polling_canceled' | 'unsupported_recovery_method' | 'attempted_to_create_guest_account_for_logged_in_user' | 'attempted_to_read_storage_before_client_initialized' | 'third_party_auth_error' | 'invalid_native_app_id' | 'unsupported_mfa_method' | 'invalid_mfa_code' | 'invalid_passkey_response' | 'storage_error' | 'smart_wallet_client_error' | 'chain_not_supported' | 'mfa_canceled';
4
+ export type ClientErrorCode = `failed_to_complete_${AuthAction}_with_oauth` | `${AuthAction}_with_oauth_returned_with_invalid_credentials` | `${AuthAction}_with_oauth_was_cancelled_by_user` | 'attempted_rpc_call_before_logged_in' | 'attempted_submit_otp_before_sending' | 'attempted_to_set_password_before_connected' | 'attempted_to_set_password_but_password_already_set' | `attempted_login_with_${Method}_while_already_logged_in` | `attempted_link_${Method}_before_logged_in` | `attempted_unlink_siwe_before_logged_in` | 'embedded_wallet_needs_recovery' | 'embedded_wallet_creation_error' | 'embedded_wallet_recovery_error' | 'embedded_wallet_set_password_error' | 'embedded_wallet_set_recovery_error' | 'unknown_embedded_wallet_error' | 'embedded_wallet_does_not_exist' | 'embedded_wallet_already_exists' | 'embedded_wallet_webview_not_loaded' | 'embedded_wallet_request_error' | 'no_passkey_found_for_challenge' | 'pkce_state_code_mismatch' | 'failed_to_create_passkey' | 'failed_to_generate_farcaster_uri' | 'failed_to_generate_farcaster_channel_token' | 'farcaster_polling_timeout' | 'farcaster_polling_canceled' | 'unsupported_recovery_method' | 'attempted_to_create_guest_account_for_logged_in_user' | 'attempted_to_read_storage_before_client_initialized' | 'third_party_auth_error' | 'invalid_native_app_id' | 'unsupported_mfa_method' | 'invalid_mfa_code' | 'invalid_passkey_response' | 'storage_error' | 'smart_wallet_client_error' | 'chain_not_supported' | 'mfa_canceled' | 'failed_to_fetch_moonpay_transaction_status';
5
5
  export type ErrorBody<T extends PrivyErrorCode | ClientErrorCode> = {
6
6
  error: string;
7
7
  code: T;
@@ -1,7 +1,7 @@
1
1
  import type { PrivyErrorCode } from '@privy-io/api-base';
2
2
  type AuthAction = 'login' | 'link';
3
3
  type Method = 'email' | 'sms' | 'oauth' | 'siwe' | 'passkey' | 'farcaster';
4
- export type ClientErrorCode = `failed_to_complete_${AuthAction}_with_oauth` | `${AuthAction}_with_oauth_returned_with_invalid_credentials` | `${AuthAction}_with_oauth_was_cancelled_by_user` | 'attempted_rpc_call_before_logged_in' | 'attempted_submit_otp_before_sending' | 'attempted_to_set_password_before_connected' | 'attempted_to_set_password_but_password_already_set' | `attempted_login_with_${Method}_while_already_logged_in` | `attempted_link_${Method}_before_logged_in` | `attempted_unlink_siwe_before_logged_in` | 'embedded_wallet_needs_recovery' | 'embedded_wallet_creation_error' | 'embedded_wallet_recovery_error' | 'embedded_wallet_set_password_error' | 'embedded_wallet_set_recovery_error' | 'unknown_embedded_wallet_error' | 'embedded_wallet_does_not_exist' | 'embedded_wallet_already_exists' | 'embedded_wallet_webview_not_loaded' | 'embedded_wallet_request_error' | 'no_passkey_found_for_challenge' | 'pkce_state_code_mismatch' | 'failed_to_create_passkey' | 'failed_to_generate_farcaster_uri' | 'failed_to_generate_farcaster_channel_token' | 'farcaster_polling_timeout' | 'farcaster_polling_canceled' | 'unsupported_recovery_method' | 'attempted_to_create_guest_account_for_logged_in_user' | 'attempted_to_read_storage_before_client_initialized' | 'third_party_auth_error' | 'invalid_native_app_id' | 'unsupported_mfa_method' | 'invalid_mfa_code' | 'invalid_passkey_response' | 'storage_error' | 'smart_wallet_client_error' | 'chain_not_supported' | 'mfa_canceled';
4
+ export type ClientErrorCode = `failed_to_complete_${AuthAction}_with_oauth` | `${AuthAction}_with_oauth_returned_with_invalid_credentials` | `${AuthAction}_with_oauth_was_cancelled_by_user` | 'attempted_rpc_call_before_logged_in' | 'attempted_submit_otp_before_sending' | 'attempted_to_set_password_before_connected' | 'attempted_to_set_password_but_password_already_set' | `attempted_login_with_${Method}_while_already_logged_in` | `attempted_link_${Method}_before_logged_in` | `attempted_unlink_siwe_before_logged_in` | 'embedded_wallet_needs_recovery' | 'embedded_wallet_creation_error' | 'embedded_wallet_recovery_error' | 'embedded_wallet_set_password_error' | 'embedded_wallet_set_recovery_error' | 'unknown_embedded_wallet_error' | 'embedded_wallet_does_not_exist' | 'embedded_wallet_already_exists' | 'embedded_wallet_webview_not_loaded' | 'embedded_wallet_request_error' | 'no_passkey_found_for_challenge' | 'pkce_state_code_mismatch' | 'failed_to_create_passkey' | 'failed_to_generate_farcaster_uri' | 'failed_to_generate_farcaster_channel_token' | 'farcaster_polling_timeout' | 'farcaster_polling_canceled' | 'unsupported_recovery_method' | 'attempted_to_create_guest_account_for_logged_in_user' | 'attempted_to_read_storage_before_client_initialized' | 'third_party_auth_error' | 'invalid_native_app_id' | 'unsupported_mfa_method' | 'invalid_mfa_code' | 'invalid_passkey_response' | 'storage_error' | 'smart_wallet_client_error' | 'chain_not_supported' | 'mfa_canceled' | 'failed_to_fetch_moonpay_transaction_status';
5
5
  export type ErrorBody<T extends PrivyErrorCode | ClientErrorCode> = {
6
6
  error: string;
7
7
  code: T;
@@ -0,0 +1,15 @@
1
+ export default class FarcasterV2Api {
2
+ /**
3
+ * Begin a login / link flow with a farcaster.
4
+ */
5
+ initializeAuth(): Promise<import("@privy-io/public-api").PrivyFarcasterV2InitResponse>;
6
+ /**
7
+ * Authenticate with Privy via the Sign-In With Farcaster spec [FIP-11: Sign in with Farcaster](https://github.com/farcasterxyz/protocol/discussions/110).
8
+ */
9
+ authenticate({ message, signature, fid, }: {
10
+ message: string;
11
+ signature: string;
12
+ fid: number;
13
+ mode?: 'login-or-sign-up' | 'no-signup';
14
+ }): Promise<import("@privy-io/public-api").PrivyAuthenticatedUser>;
15
+ }
@@ -0,0 +1,15 @@
1
+ export default class FarcasterV2Api {
2
+ /**
3
+ * Begin a login / link flow with a farcaster.
4
+ */
5
+ initializeAuth(): Promise<import("@privy-io/public-api").PrivyFarcasterV2InitResponse>;
6
+ /**
7
+ * Authenticate with Privy via the Sign-In With Farcaster spec [FIP-11: Sign in with Farcaster](https://github.com/farcasterxyz/protocol/discussions/110).
8
+ */
9
+ authenticate({ message, signature, fid, }: {
10
+ message: string;
11
+ signature: string;
12
+ fid: number;
13
+ mode?: 'login-or-sign-up' | 'no-signup';
14
+ }): Promise<import("@privy-io/public-api").PrivyAuthenticatedUser>;
15
+ }
@@ -0,0 +1,12 @@
1
+ import CoinbaseOnRampApi from './CoinbaseOnRampApi';
2
+ import MoonpayOnRampApi from './MoonpayOnRampApi';
3
+ export default class FundingApi {
4
+ /**
5
+ * API for Moonpay On-ramp
6
+ */
7
+ readonly moonpay: MoonpayOnRampApi;
8
+ /**
9
+ * API for Coinbase On-ramp
10
+ */
11
+ readonly coinbase: CoinbaseOnRampApi;
12
+ }
@@ -0,0 +1,12 @@
1
+ import CoinbaseOnRampApi from './CoinbaseOnRampApi';
2
+ import MoonpayOnRampApi from './MoonpayOnRampApi';
3
+ export default class FundingApi {
4
+ /**
5
+ * API for Moonpay On-ramp
6
+ */
7
+ readonly moonpay: MoonpayOnRampApi;
8
+ /**
9
+ * API for Coinbase On-ramp
10
+ */
11
+ readonly coinbase: CoinbaseOnRampApi;
12
+ }
@@ -0,0 +1,21 @@
1
+ import { type PrivyMoonpayOnRampSignInput } from '@privy-io/public-api';
2
+ import { type MoonpayTransactionStatusResponse } from './funding/moonpay';
3
+ export default class MoonpayOnRampApi {
4
+ /**
5
+ * Sign Moonpay OnRamp arguments for a new flow
6
+ */
7
+ sign(args: PrivyMoonpayOnRampSignInput): Promise<{
8
+ signedUrl: string;
9
+ externalTransactionId: string;
10
+ }>;
11
+ /**
12
+ * Fetch the status of a Moonpay transaction
13
+ * @param transactionId
14
+ * @param useSandbox
15
+ * @returns
16
+ */
17
+ getTransactionStatus({ transactionId, useSandbox, }: {
18
+ transactionId: string;
19
+ useSandbox: boolean;
20
+ }): Promise<MoonpayTransactionStatusResponse | undefined>;
21
+ }
@@ -0,0 +1,21 @@
1
+ import { type PrivyMoonpayOnRampSignInput } from '@privy-io/public-api';
2
+ import { type MoonpayTransactionStatusResponse } from './funding/moonpay';
3
+ export default class MoonpayOnRampApi {
4
+ /**
5
+ * Sign Moonpay OnRamp arguments for a new flow
6
+ */
7
+ sign(args: PrivyMoonpayOnRampSignInput): Promise<{
8
+ signedUrl: string;
9
+ externalTransactionId: string;
10
+ }>;
11
+ /**
12
+ * Fetch the status of a Moonpay transaction
13
+ * @param transactionId
14
+ * @param useSandbox
15
+ * @returns
16
+ */
17
+ getTransactionStatus({ transactionId, useSandbox, }: {
18
+ transactionId: string;
19
+ useSandbox: boolean;
20
+ }): Promise<MoonpayTransactionStatusResponse | undefined>;
21
+ }
@@ -1,6 +1,7 @@
1
1
  import AppApi from './AppApi';
2
2
  import AuthApi from './AuthApi';
3
3
  import EmbeddedWalletApi from './EmbeddedWalletApi';
4
+ import FundingApi from './FundingApi';
4
5
  import MfaApi from './MfaApi';
5
6
  import MfaPromises from './MfaPromises';
6
7
  import RecoveryApi from './RecoveryApi';
@@ -85,6 +86,10 @@ export default class Privy {
85
86
  * Promises for MFA flows
86
87
  */
87
88
  readonly mfaPromises: MfaPromises;
89
+ /**
90
+ * APIs for Funding
91
+ */
92
+ readonly funding: FundingApi;
88
93
  /** Create a new `Privy` Client */
89
94
  constructor({ clientId, ...o }: PrivyOptions);
90
95
  /**
@@ -1,6 +1,7 @@
1
1
  import AppApi from './AppApi';
2
2
  import AuthApi from './AuthApi';
3
3
  import EmbeddedWalletApi from './EmbeddedWalletApi';
4
+ import FundingApi from './FundingApi';
4
5
  import MfaApi from './MfaApi';
5
6
  import MfaPromises from './MfaPromises';
6
7
  import RecoveryApi from './RecoveryApi';
@@ -85,6 +86,10 @@ export default class Privy {
85
86
  * Promises for MFA flows
86
87
  */
87
88
  readonly mfaPromises: MfaPromises;
89
+ /**
90
+ * APIs for Funding
91
+ */
92
+ readonly funding: FundingApi;
88
93
  /** Create a new `Privy` Client */
89
94
  constructor({ clientId, ...o }: PrivyOptions);
90
95
  /**
@@ -32,3 +32,4 @@ export declare const chainDefs: {
32
32
  };
33
33
  export declare const DEFAULT_SUPPORTED_CHAINS: readonly [import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain];
34
34
  export declare const DEFAULT_SUPPORTED_CHAIN_IDS: Set<number>;
35
+ export declare function getSupportedChainById(id: number): import("./types").Chain | undefined;
@@ -32,3 +32,4 @@ export declare const chainDefs: {
32
32
  };
33
33
  export declare const DEFAULT_SUPPORTED_CHAINS: readonly [import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain, import("./types").Chain];
34
34
  export declare const DEFAULT_SUPPORTED_CHAIN_IDS: Set<number>;
35
+ export declare function getSupportedChainById(id: number): import("./types").Chain | undefined;
@@ -0,0 +1,10 @@
1
+ import type { PrivyCoinbaseOnRampInitInput, PrivyCoinbaseOnRampInitResponse } from '@privy-io/public-api';
2
+ type SupportedBlockchains = PrivyCoinbaseOnRampInitInput['addresses'][0]['blockchains'][0];
3
+ export declare function getCoinbaseOnRampUrl({ input, amount, blockchain, }: {
4
+ input: PrivyCoinbaseOnRampInitResponse;
5
+ amount: string;
6
+ blockchain: SupportedBlockchains;
7
+ }): {
8
+ url: URL;
9
+ };
10
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { PrivyCoinbaseOnRampInitInput, PrivyCoinbaseOnRampInitResponse } from '@privy-io/public-api';
2
+ type SupportedBlockchains = PrivyCoinbaseOnRampInitInput['addresses'][0]['blockchains'][0];
3
+ export declare function getCoinbaseOnRampUrl({ input, amount, blockchain, }: {
4
+ input: PrivyCoinbaseOnRampInitResponse;
5
+ amount: string;
6
+ blockchain: SupportedBlockchains;
7
+ }): {
8
+ url: URL;
9
+ };
10
+ export {};
@@ -0,0 +1,26 @@
1
+ export declare const MoonpayEnvironments: {
2
+ readonly prod: {
3
+ readonly url: "https://api.moonpay.com/v1";
4
+ readonly key: "pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL";
5
+ };
6
+ readonly sandbox: {
7
+ readonly url: "https://api.moonpay.com/v1";
8
+ readonly key: "pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";
9
+ };
10
+ };
11
+ export type MoonpayTransactionStatusWithoutFailures = 'pending' | 'waitingAuthorization' | 'completed';
12
+ export type MoonpayTransactionStatus = MoonpayTransactionStatusWithoutFailures | 'failed' | 'serviceFailure';
13
+ export type MoonpayTransactionStatusResponse = {
14
+ status?: MoonpayTransactionStatus;
15
+ paymentMethod?: string;
16
+ cardPaymentType?: string;
17
+ currency?: {
18
+ code: string;
19
+ };
20
+ baseCurrencyAmount?: string;
21
+ quoteCurrencyAmount?: string;
22
+ feeAmount?: string;
23
+ extraFeeAmount?: string;
24
+ networkFeeAmount?: string;
25
+ };
26
+ export declare function isSupportedChainIdForMoonpay(chainId: number, asset: 'native-currency' | 'USDC'): boolean;
@@ -0,0 +1,26 @@
1
+ export declare const MoonpayEnvironments: {
2
+ readonly prod: {
3
+ readonly url: "https://api.moonpay.com/v1";
4
+ readonly key: "pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL";
5
+ };
6
+ readonly sandbox: {
7
+ readonly url: "https://api.moonpay.com/v1";
8
+ readonly key: "pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI";
9
+ };
10
+ };
11
+ export type MoonpayTransactionStatusWithoutFailures = 'pending' | 'waitingAuthorization' | 'completed';
12
+ export type MoonpayTransactionStatus = MoonpayTransactionStatusWithoutFailures | 'failed' | 'serviceFailure';
13
+ export type MoonpayTransactionStatusResponse = {
14
+ status?: MoonpayTransactionStatus;
15
+ paymentMethod?: string;
16
+ cardPaymentType?: string;
17
+ currency?: {
18
+ code: string;
19
+ };
20
+ baseCurrencyAmount?: string;
21
+ quoteCurrencyAmount?: string;
22
+ feeAmount?: string;
23
+ extraFeeAmount?: string;
24
+ networkFeeAmount?: string;
25
+ };
26
+ export declare function isSupportedChainIdForMoonpay(chainId: number, asset: 'native-currency' | 'USDC'): boolean;
@@ -1,7 +1,7 @@
1
1
  import Privy from './Privy';
2
2
  export type { OAuthProviderType } from '@privy-io/public-api';
3
- export { BICONOMY, COINBASE_SMART_WALLET, KERNEL, LIGHT_ACCOUNT, SAFE, type SmartWalletType, } from '@privy-io/public-api';
4
3
  export type { default as Storage } from './storage/Storage';
4
+ export { BICONOMY, COINBASE_SMART_WALLET, KERNEL, LIGHT_ACCOUNT, SAFE, type SmartWalletType, } from '@privy-io/public-api';
5
5
  export { LocalStorage } from './storage/LocalStorage';
6
6
  export { InMemoryCache } from './storage/InMemoryStorage';
7
7
  export type { ErrorMessageMap } from './Error';
@@ -21,6 +21,8 @@ export { populateTransactionRequest, throwIfInvalidRecoveryUpgradePath } from '.
21
21
  export { calculateTotalGasEstimate } from './embedded/utils/gas';
22
22
  export { QuantityToBigNumber, convertBigNumberish, toEthersUnsignedTransaction, } from './embedded/utils/ethers';
23
23
  export type { MfaMethod, MfaPromise, MfaSubmitArgs, MfaSubmitPromise } from './embedded/withMfa';
24
+ export { getIsTokenUsdc, UsdcAddressMap } from './utils/getIsTokenUsdc';
24
25
  export * from './types';
25
26
  export * from './chains';
27
+ export * from './utils/formatters';
26
28
  export default Privy;
@@ -1,7 +1,7 @@
1
1
  import Privy from './Privy';
2
2
  export type { OAuthProviderType } from '@privy-io/public-api';
3
- export { BICONOMY, COINBASE_SMART_WALLET, KERNEL, LIGHT_ACCOUNT, SAFE, type SmartWalletType, } from '@privy-io/public-api';
4
3
  export type { default as Storage } from './storage/Storage';
4
+ export { BICONOMY, COINBASE_SMART_WALLET, KERNEL, LIGHT_ACCOUNT, SAFE, type SmartWalletType, } from '@privy-io/public-api';
5
5
  export { LocalStorage } from './storage/LocalStorage';
6
6
  export { InMemoryCache } from './storage/InMemoryStorage';
7
7
  export type { ErrorMessageMap } from './Error';
@@ -21,6 +21,8 @@ export { populateTransactionRequest, throwIfInvalidRecoveryUpgradePath } from '.
21
21
  export { calculateTotalGasEstimate } from './embedded/utils/gas';
22
22
  export { QuantityToBigNumber, convertBigNumberish, toEthersUnsignedTransaction, } from './embedded/utils/ethers';
23
23
  export type { MfaMethod, MfaPromise, MfaSubmitArgs, MfaSubmitPromise } from './embedded/withMfa';
24
+ export { getIsTokenUsdc, UsdcAddressMap } from './utils/getIsTokenUsdc';
24
25
  export * from './types';
25
26
  export * from './chains';
27
+ export * from './utils/formatters';
26
28
  export default Privy;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Formats a wallet address by showing the first 5 characters, followed by an ellipsis,
3
+ * and then the last 4 characters.
4
+ * @param address
5
+ */
6
+ export declare function formatWalletAddress(address: string | undefined): string;
7
+ /**
8
+ * Converts a wei value into a native currency price, given the token symbol of the native
9
+ * currency. Returns a string with the native currency price of the wei value, rounded to 3
10
+ * decimals.
11
+ */
12
+ export declare function formatWeiAmount({ wei, precision }: {
13
+ wei: bigint;
14
+ precision?: number;
15
+ }): string;
16
+ /**
17
+ * Format an Erc20 token amount with a given number of declimal places.
18
+ */
19
+ export declare function formatErc20TokenAmount({ amount, decimals, }: {
20
+ amount: bigint | number;
21
+ decimals: number;
22
+ }): string;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Formats a wallet address by showing the first 5 characters, followed by an ellipsis,
3
+ * and then the last 4 characters.
4
+ * @param address
5
+ */
6
+ export declare function formatWalletAddress(address: string | undefined): string;
7
+ /**
8
+ * Converts a wei value into a native currency price, given the token symbol of the native
9
+ * currency. Returns a string with the native currency price of the wei value, rounded to 3
10
+ * decimals.
11
+ */
12
+ export declare function formatWeiAmount({ wei, precision }: {
13
+ wei: bigint;
14
+ precision?: number;
15
+ }): string;
16
+ /**
17
+ * Format an Erc20 token amount with a given number of declimal places.
18
+ */
19
+ export declare function formatErc20TokenAmount({ amount, decimals, }: {
20
+ amount: bigint | number;
21
+ decimals: number;
22
+ }): string;
@@ -0,0 +1,11 @@
1
+ import type { Hex } from 'viem';
2
+ import type { Chain } from '../chains';
3
+ export declare const UsdcAddressMap: Record<number, Hex>;
4
+ /**
5
+ * Helper function to determine if a token address is one of our known USDC addresses
6
+ *
7
+ * @param address {string} token address
8
+ * @param chain {Chain} chain where token lives
9
+ * @returns {boolean}
10
+ */
11
+ export declare function getIsTokenUsdc(address: string, chain: Chain): boolean;
@@ -0,0 +1,11 @@
1
+ import type { Hex } from 'viem';
2
+ import type { Chain } from '../chains';
3
+ export declare const UsdcAddressMap: Record<number, Hex>;
4
+ /**
5
+ * Helper function to determine if a token address is one of our known USDC addresses
6
+ *
7
+ * @param address {string} token address
8
+ * @param chain {Chain} chain where token lives
9
+ * @returns {boolean}
10
+ */
11
+ export declare function getIsTokenUsdc(address: string, chain: Chain): boolean;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Converts an object of query parameters into a query string.
3
+ * @param params - Object containing query parameters
4
+ * @example toSearchParams({foo: 'bar', baz: 1, zed: undefined, nil: null}) => '?foo=bar&baz=1'
5
+ * @example toSearchParams({}) => ''
6
+ */
7
+ export declare function toSearchParams(params?: Record<string, string | number | null | undefined>): string;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Converts an object of query parameters into a query string.
3
+ * @param params - Object containing query parameters
4
+ * @example toSearchParams({foo: 'bar', baz: 1, zed: undefined, nil: null}) => '?foo=bar&baz=1'
5
+ * @example toSearchParams({}) => ''
6
+ */
7
+ export declare function toSearchParams(params?: Record<string, string | number | null | undefined>): string;
@@ -1 +1 @@
1
- import{Logout as t}from"@privy-io/public-api";import r from"./CustomProviderApi.mjs";import i from"./EmailApi.mjs";import s from"./FarcasterApi.mjs";import e from"./GuestApi.mjs";import o from"./OAuthApi.mjs";import n from"./PasskeyApi.mjs";import a from"./PhoneApi.mjs";import p from"./SiweApi.mjs";import m from"./SmartWalletApi.mjs";import"./Error.mjs";import"./pkce.mjs";import"jose";class l{_privyInternal;customProvider;phone;email;oauth;siwe;smartWallet;passkey;farcaster;guest;constructor(t,l,h){this._privyInternal=t,this.customProvider=new r(this._privyInternal),this.phone=new a(this._privyInternal),this.email=new i(this._privyInternal),this.oauth=new o(this._privyInternal,l,h),this.guest=new e(this._privyInternal),this.siwe=new p(this._privyInternal),this.smartWallet=new m(this._privyInternal),this.passkey=new n(this._privyInternal),this.farcaster=new s(this._privyInternal)}async logout(){try{const r=await this._privyInternal.session.getRefreshToken()??void 0;await this._privyInternal.fetch(t,{body:{refresh_token:r}})}catch(t){console.warn("Error destroying session")}await Promise.all([this._privyInternal.session.destroyLocalState({reason:"logout"}),this._privyInternal.destroyClientAnalyticsId()]),this._privyInternal.callbacks?.setUser?.(null)}}export{l as default};
1
+ import{Logout as r}from"@privy-io/public-api";import t from"./CustomProviderApi.mjs";import i from"./EmailApi.mjs";import s from"./FarcasterApi.mjs";import e from"./FarcasterV2Api.mjs";import a from"./GuestApi.mjs";import o from"./OAuthApi.mjs";import n from"./PasskeyApi.mjs";import p from"./PhoneApi.mjs";import m from"./SiweApi.mjs";import l from"./SmartWalletApi.mjs";import"./Error.mjs";import"./pkce.mjs";import"jose";class h{_privyInternal;customProvider;phone;email;oauth;siwe;smartWallet;passkey;farcaster;farcasterV2;guest;constructor(r,h,y){this._privyInternal=r,this.customProvider=new t(this._privyInternal),this.phone=new p(this._privyInternal),this.email=new i(this._privyInternal),this.oauth=new o(this._privyInternal,h,y),this.guest=new a(this._privyInternal),this.siwe=new m(this._privyInternal),this.smartWallet=new l(this._privyInternal),this.passkey=new n(this._privyInternal),this.farcaster=new s(this._privyInternal),this.farcasterV2=new e(this._privyInternal)}async logout(){try{const t=await this._privyInternal.session.getRefreshToken()??void 0;await this._privyInternal.fetch(r,{body:{refresh_token:t}})}catch(r){console.warn("Error destroying session")}await Promise.all([this._privyInternal.session.destroyLocalState({reason:"logout"}),this._privyInternal.destroyClientAnalyticsId()]),this._privyInternal.callbacks?.setUser?.(null)}}export{h as default};
@@ -0,0 +1 @@
1
+ import{CoinbaseOnRampInit as t,CoinbaseOnRampStatus as r}from"@privy-io/public-api";class a{_privyInternal;constructor(t){this._privyInternal=t}async initOnRampSession(r){return await this._privyInternal.fetch(t,{body:r})}async getStatus(t){return await this._privyInternal.fetch(r,{query:{partnerUserId:t}})}}export{a as default};
@@ -0,0 +1 @@
1
+ import{FarcasterV2Init as t,FarcasterV2Authenticate as i}from"@privy-io/public-api";class e{_privyInternal;constructor(t){this._privyInternal=t}async initializeAuth(){return await this._privyInternal.fetch(t,{body:{}})}async authenticate({message:t,signature:e,fid:a}){const s=await this._privyInternal.fetch(i,{body:{message:t,signature:e,fid:a}});return await this._privyInternal.session.updateWithTokensResponse(s),this._privyInternal.callbacks?.setUser?.(s.user),s}}export{e as default};
@@ -0,0 +1 @@
1
+ import i from"./CoinbaseOnRampApi.mjs";import o from"./MoonpayOnRampApi.mjs";import"@privy-io/public-api";import"fetch-retry";import"./Error.mjs";import"./funding/moonpay.mjs";import"./chains/arbitrum.mjs";import"./chains/base.mjs";import"./chains/mainnet.mjs";import"./chains/optimism.mjs";import"./chains/polygon.mjs";class m{moonpay;coinbase;constructor(m){this.moonpay=new o(m),this.coinbase=new i(m)}}export{m as default};
@@ -0,0 +1 @@
1
+ import t from"fetch-retry";import{MoonpayOnRampSign as r}from"@privy-io/public-api";import{PrivyClientError as a}from"./Error.mjs";import{MoonpayEnvironments as o}from"./funding/moonpay.mjs";import"./chains/arbitrum.mjs";import"./chains/base.mjs";import"./chains/mainnet.mjs";import"./chains/optimism.mjs";import"./chains/polygon.mjs";class i{_privyInternal;constructor(t){this._privyInternal=t}async sign(t){return await this._privyInternal.fetch(r,{body:t})}async getTransactionStatus({transactionId:r,useSandbox:i}){const n=i?"sandbox":"prod",{url:s,key:e}=o[n],m=await t(fetch,{retries:3,retryDelay:500})(`${s}/transactions/ext/${r}?apiKey=${e}`);if(!m.ok)throw new a({error:`Failed to fetch transaction status for Transaction ${r}`,code:"failed_to_fetch_moonpay_transaction_status"});const c=await m.json();return Array.isArray(c)?c.at(0):void 0}}export{i as default};
@@ -1 +1 @@
1
- import i from"./AppApi.mjs";import e from"./AuthApi.mjs";import t from"./EmbeddedWalletApi.mjs";import s from"./MfaApi.mjs";import r from"./MfaPromises.mjs";import{PrivyInternal as m}from"./PrivyInternal.mjs";import o from"./RecoveryApi.mjs";import p from"./UserApi.mjs";import"@privy-io/public-api";import"./CustomProviderApi.mjs";import"./EmailApi.mjs";import"./FarcasterApi.mjs";import"./GuestApi.mjs";import"./OAuthApi.mjs";import"./Error.mjs";import"./pkce.mjs";import"jose";import"./PasskeyApi.mjs";import"./PhoneApi.mjs";import"./SiweApi.mjs";import"./SmartWalletApi.mjs";import"./chains/index.mjs";import"./chains/arbitrum.mjs";import"./chains/arbitrumGoerli.mjs";import"./chains/arbitrumSepolia.mjs";import"./chains/avalanche.mjs";import"./chains/avalancheFuji.mjs";import"./chains/base.mjs";import"./chains/baseGoerli.mjs";import"./chains/baseSepolia.mjs";import"./chains/berachainArtio.mjs";import"./chains/celo.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/mainnet.mjs";import"./chains/optimism.mjs";import"./chains/optimismGoerli.mjs";import"./chains/optimismSepolia.mjs";import"./chains/polygon.mjs";import"./chains/polygonMumbai.mjs";import"./chains/redstone.mjs";import"./chains/redstoneHolesky.mjs";import"./chains/sepolia.mjs";import"./chains/zora.mjs";import"./chains/zoraSepolia.mjs";import"./chains/zoraTestnet.mjs";import"./embedded/EmbeddedWalletProvider.mjs";import"eventemitter3";import"./embedded/errors.mjs";import"./embedded/types.mjs";import"./embedded/methods.mjs";import"./embedded/utils/index.mjs";import"@ethersproject/abstract-signer";import"@ethersproject/providers";import"./embedded/gas/arbitrum.mjs";import"@ethersproject/bignumber";import"./embedded/utils/ethers.mjs";import"./embedded/gas/bsc.mjs";import"./embedded/gas/op-stack.mjs";import"@ethersproject/contracts";import"@ethersproject/transactions";import"./embedded/gas/polygon.mjs";import"@ethersproject/units";import"fetch-retry";import"./chains/polygonAmoy.mjs";import"./embedded/utils/gas.mjs";import"./embedded/EmbeddedSolanaWalletProvider.mjs";import"./embedded/EmbeddedWalletProxy.mjs";import"./embedded/EventCallbackQueue.mjs";import"./embedded/withMfa.mjs";import"./embedded/EmbeddedBitcoinWalletProvider.mjs";import"./MfaPasskeyApi.mjs";import"./MfaSmsApi.mjs";import"uuid";import"@privy-io/api-base";import"./Session.mjs";import"js-cookie";import"./Token.mjs";import"./utils/allSettled.mjs";import"./toAbortSignalTimeout.mjs";import"./RecoveryICloudApi.mjs";import"./RecoveryOAuthApi.mjs";class a{auth;user;embeddedWallet;recovery;mfa;app;mfaPromises;_privyInternal;constructor({clientId:a,...n}){this._privyInternal=new m({...n,appClientId:a}),this.user=new p(this._privyInternal),this.app=new i(this._privyInternal),this.auth=new e(this._privyInternal,n.storage,n.crypto),this.mfa=new s(this._privyInternal),this.mfaPromises=new r,this.embeddedWallet=new t(this._privyInternal,n.embeddedWalletMessagePoster,n.supportedChains,this.mfa,this.mfaPromises),this.recovery=new o(this._privyInternal,n.storage,n.crypto)}async initialize(){await this._privyInternal._initialize()}setMessagePoster(i){this.embeddedWallet.setMessagePoster(i)}addOAuthTokensListener(i){return this._privyInternal.session.on("oauth_tokens_granted",i),{unsubscribe:()=>{this._privyInternal.session.removeListener("oauth_tokens_granted",i)}}}setCallbacks(i){this._privyInternal.setCallbacks(i)}getAccessToken(){return this._privyInternal.getAccessToken()}getIdentityToken(){return this._privyInternal.getIdentityToken()}}export{a as default};
1
+ import i from"./AppApi.mjs";import e from"./AuthApi.mjs";import t from"./EmbeddedWalletApi.mjs";import s from"./FundingApi.mjs";import m from"./MfaApi.mjs";import r from"./MfaPromises.mjs";import{PrivyInternal as o}from"./PrivyInternal.mjs";import p from"./RecoveryApi.mjs";import a from"./UserApi.mjs";import"@privy-io/public-api";import"./CustomProviderApi.mjs";import"./EmailApi.mjs";import"./FarcasterApi.mjs";import"./FarcasterV2Api.mjs";import"./GuestApi.mjs";import"./OAuthApi.mjs";import"./Error.mjs";import"./pkce.mjs";import"jose";import"./PasskeyApi.mjs";import"./PhoneApi.mjs";import"./SiweApi.mjs";import"./SmartWalletApi.mjs";import"./chains/index.mjs";import"./chains/arbitrum.mjs";import"./chains/arbitrumGoerli.mjs";import"./chains/arbitrumSepolia.mjs";import"./chains/avalanche.mjs";import"./chains/avalancheFuji.mjs";import"./chains/base.mjs";import"./chains/baseGoerli.mjs";import"./chains/baseSepolia.mjs";import"./chains/berachainArtio.mjs";import"./chains/celo.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/mainnet.mjs";import"./chains/optimism.mjs";import"./chains/optimismGoerli.mjs";import"./chains/optimismSepolia.mjs";import"./chains/polygon.mjs";import"./chains/polygonMumbai.mjs";import"./chains/redstone.mjs";import"./chains/redstoneHolesky.mjs";import"./chains/sepolia.mjs";import"./chains/zora.mjs";import"./chains/zoraSepolia.mjs";import"./chains/zoraTestnet.mjs";import"./embedded/EmbeddedWalletProvider.mjs";import"eventemitter3";import"./embedded/errors.mjs";import"./embedded/types.mjs";import"./embedded/methods.mjs";import"./embedded/utils/index.mjs";import"@ethersproject/abstract-signer";import"@ethersproject/providers";import"./embedded/gas/arbitrum.mjs";import"@ethersproject/bignumber";import"./embedded/utils/ethers.mjs";import"./embedded/gas/bsc.mjs";import"./embedded/gas/op-stack.mjs";import"@ethersproject/contracts";import"@ethersproject/transactions";import"./embedded/gas/polygon.mjs";import"@ethersproject/units";import"fetch-retry";import"./chains/polygonAmoy.mjs";import"./embedded/utils/gas.mjs";import"./embedded/EmbeddedSolanaWalletProvider.mjs";import"./embedded/EmbeddedWalletProxy.mjs";import"./embedded/EventCallbackQueue.mjs";import"./embedded/withMfa.mjs";import"./embedded/EmbeddedBitcoinWalletProvider.mjs";import"./CoinbaseOnRampApi.mjs";import"./MoonpayOnRampApi.mjs";import"./funding/moonpay.mjs";import"./MfaPasskeyApi.mjs";import"./MfaSmsApi.mjs";import"uuid";import"@privy-io/api-base";import"./Session.mjs";import"js-cookie";import"./Token.mjs";import"./utils/allSettled.mjs";import"./toAbortSignalTimeout.mjs";import"./utils/toSearchParams.mjs";import"./RecoveryICloudApi.mjs";import"./RecoveryOAuthApi.mjs";class n{auth;user;embeddedWallet;recovery;mfa;app;mfaPromises;funding;_privyInternal;constructor({clientId:n,...d}){this._privyInternal=new o({...d,appClientId:n}),this.user=new a(this._privyInternal),this.app=new i(this._privyInternal),this.auth=new e(this._privyInternal,d.storage,d.crypto),this.mfa=new m(this._privyInternal),this.mfaPromises=new r,this.embeddedWallet=new t(this._privyInternal,d.embeddedWalletMessagePoster,d.supportedChains,this.mfa,this.mfaPromises),this.recovery=new p(this._privyInternal,d.storage,d.crypto),this.funding=new s(this._privyInternal)}async initialize(){await this._privyInternal._initialize()}setMessagePoster(i){this.embeddedWallet.setMessagePoster(i)}addOAuthTokensListener(i){return this._privyInternal.session.on("oauth_tokens_granted",i),{unsubscribe:()=>{this._privyInternal.session.removeListener("oauth_tokens_granted",i)}}}setCallbacks(i){this._privyInternal.setCallbacks(i)}getAccessToken(){return this._privyInternal.getAccessToken()}getIdentityToken(){return this._privyInternal.getIdentityToken()}}export{n as default};
@@ -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 n,RefreshSession as r}from"@privy-io/public-api";import{PrivyClientError as o,PrivyApiError as c}from"./Error.mjs";import{Session as h}from"./Session.mjs";import l from"./toAbortSignalTimeout.mjs";import"eventemitter3";import"jose";import"js-cookie";import"./Token.mjs";import"./utils/allSettled.mjs";const d="privy:caid";class p{baseUrl;_config;appId;appClientId;_storage;_analyticsId;_sdkVersion="js-sdk-core:0.34.2";_fetch;nativeAppIdentifier;callbacks;_cache=new Map;session;constructor(e){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,"undefined"==typeof document&&(this.nativeAppIdentifier=e.nativeAppIdentifier),this.session=new h({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})}))}setCallbacks(t){this.callbacks={...this.callbacks,...t}}get isReady(){return Boolean(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,headers:a,options:n={onRequest:this._beforeRequest.bind(this)}}){const r=`${this.baseUrl}${i(t.path,s)}`,o=new Request(r,{method:t.method,body:JSON.stringify(e),headers:a}),h=await n.onRequest(o),l=await this._fetch(o,h),d=await l.json();if(l.status>299)throw new c(d);return d}async _beforeRequestWithoutInitialize(t){const 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");const 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{const t=await this._storage.get(d);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(d,this._analyticsId)}catch(t){console.error(`Unable to store clientId: ${this._analyticsId}`,t)}return this._analyticsId}async destroyClientAnalyticsId(){try{return await this._storage.del(d)}catch(t){console.error("Unable to delete clientId",t)}}async createAnalyticsEvent(t,e){try{await this.fetch(n,{body:{event_name:t,client_id:await this._getOrGenerateClientAnalyticsId(),payload:e},options:{onRequest:this.beforeRequestWithoutRefresh.bind(this)}})}catch(t){}}async refreshSession(){const t=await this.session.getRefreshToken()??void 0,e=t??"key",s=this._cache.get(e);if(s)return await s;const i=this._refreshSession(t);this._cache.set(e,i);try{return await i}catch(t){throw t}finally{this._cache.delete(e)}}async _refreshSession(t){const e=await this.session.getToken();if(!this.session.hasRefreshCredentials(e,t??null))throw await this._initialize(),new c({code:s.MISSING_OR_INVALID_TOKEN,error:"No tokens found in storage"});try{const e=await this.fetch(r,{body:{refresh_token:t},options:{onRequest:this.beforeRequestWithoutRefresh.bind(this)}}),s=e.session_update_action;return this.callbacks?.setUser?.(e.user),"set"===s&&await this.session.updateWithTokensResponse(e),"clear"===s&&(await this.session.destroyLocalState(),this.callbacks?.setUser?.(null)),"ignore"===s&&e.token&&(await this.session.storeToken(e.token),e.identity_token&&await this.session.storeIdentityToken(e.identity_token)),e}catch(t){throw t instanceof c&&t.code===s.MISSING_OR_INVALID_TOKEN&&(await this.session.destroyLocalState(),this.callbacks?.setUser?.(null)),t}}async getAccessToken(){const[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{const t="privy:__storage__test",e="blobby";await this._storage.put(t,e);const s=await this._storage.get(t);return await this._storage.del(t),s===e}catch(t){return console.error(t),!1}}}export{p as PrivyInternal};
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 n,RefreshSession as r}from"@privy-io/public-api";import{PrivyClientError as o,PrivyApiError as c}from"./Error.mjs";import{Session as h}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";const p="privy:caid";class _{baseUrl;_config;appId;appClientId;_storage;_analyticsId;_sdkVersion="js-sdk-core:0.35.0-beta-20241120224355";_fetch;nativeAppIdentifier;callbacks;_cache=new Map;session;constructor(e){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,"undefined"==typeof document&&(this.nativeAppIdentifier=e.nativeAppIdentifier),this.session=new h({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})}))}setCallbacks(t){this.callbacks={...this.callbacks,...t}}get isReady(){return Boolean(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:n,options:r={onRequest:this._beforeRequest.bind(this)}}){const o=`${this.baseUrl}${i(t.path,s)}${d(a)}`,h=new Request(o,{method:t.method,body:JSON.stringify(e),headers:n}),l=await r.onRequest(h),p=await this._fetch(h,l),_=await p.json();if(p.status>299)throw new c(_);return _}async _beforeRequestWithoutInitialize(t){const 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");const 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{const 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(n,{body:{event_name:t,client_id:await this._getOrGenerateClientAnalyticsId(),payload:e},options:{onRequest:this.beforeRequestWithoutRefresh.bind(this)}})}catch(t){}}async refreshSession(){const t=await this.session.getRefreshToken()??void 0,e=t??"key",s=this._cache.get(e);if(s)return await s;const i=this._refreshSession(t);this._cache.set(e,i);try{return await i}catch(t){throw t}finally{this._cache.delete(e)}}async _refreshSession(t){const e=await this.session.getToken();if(!this.session.hasRefreshCredentials(e,t??null))throw await this._initialize(),new c({code:s.MISSING_OR_INVALID_TOKEN,error:"No tokens found in storage"});try{const e=await this.fetch(r,{body:{refresh_token:t},options:{onRequest:this.beforeRequestWithoutRefresh.bind(this)}}),s=e.session_update_action;return this.callbacks?.setUser?.(e.user),"set"===s&&await this.session.updateWithTokensResponse(e),"clear"===s&&(await this.session.destroyLocalState(),this.callbacks?.setUser?.(null)),"ignore"===s&&e.token&&(await this.session.storeToken(e.token),e.identity_token&&await this.session.storeIdentityToken(e.identity_token)),e}catch(t){throw t instanceof c&&t.code===s.MISSING_OR_INVALID_TOKEN&&(await this.session.destroyLocalState(),this.callbacks?.setUser?.(null)),t}}async getAccessToken(){const[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{const t="privy:__storage__test",e="blobby";await this._storage.put(t,e);const s=await this._storage.get(t);return await this._storage.del(t),s===e}catch(t){return console.error(t),!1}}}export{_ as PrivyInternal};
@@ -1 +1 @@
1
- import{arbitrum as o}from"./arbitrum.mjs";import{arbitrumGoerli as m}from"./arbitrumGoerli.mjs";import{arbitrumSepolia as r}from"./arbitrumSepolia.mjs";import{avalanche as i}from"./avalanche.mjs";import{avalancheFuji as e}from"./avalancheFuji.mjs";import{base as t}from"./base.mjs";import{baseGoerli as s}from"./baseGoerli.mjs";import{baseSepolia as a}from"./baseSepolia.mjs";import{berachainArtio as p}from"./berachainArtio.mjs";import{celo as l}from"./celo.mjs";import{celoAlfajores as f}from"./celoAlfajores.mjs";import{filecoin as n}from"./filecoin.mjs";import{filecoinCalibration as j}from"./filecoinCalibration.mjs";import{garnetHolesky as b}from"./garnetHolesky.mjs";import{goerli as c}from"./goerli.mjs";import{holesky as u}from"./holesky.mjs";import{linea as y}from"./linea.mjs";import{lineaTestnet as S}from"./lineaTestnet.mjs";import{mainnet as g}from"./mainnet.mjs";import{optimism as h}from"./optimism.mjs";import{optimismGoerli as k}from"./optimismGoerli.mjs";import{optimismSepolia as z}from"./optimismSepolia.mjs";import{polygon as G}from"./polygon.mjs";import{polygonMumbai as d}from"./polygonMumbai.mjs";import{redstone as v}from"./redstone.mjs";import{redstoneHolesky as H}from"./redstoneHolesky.mjs";import{sepolia as T}from"./sepolia.mjs";import{zora as A}from"./zora.mjs";import{zoraSepolia as C}from"./zoraSepolia.mjs";import{zoraTestnet as F}from"./zoraTestnet.mjs";const M={mainnet:g,goerli:c,sepolia:T,arbitrum:o,arbitrumGoerli:m,arbitrumSepolia:r,optimism:h,optimismGoerli:k,optimismSepolia:z,polygon:G,polygonMumbai:d,celo:l,celoAlfajores:f,filecoin:n,filecoinCalibration:j,base:t,baseGoerli:s,baseSepolia:a,linea:y,lineaTestnet:S,avalanche:i,avalancheFuji:e,holesky:u,redstone:v,garnetHolesky:b,redstoneHolesky:H,zora:A,zoraSepolia:C,zoraTestnet:F},w=[g,c,T,o,m,r,h,k,z,G,d,l,f,n,j,t,s,a,p,y,S,i,e,u,v,b,H,A,C,F],x=new Set(w.map((o=>o.id)));export{w as DEFAULT_SUPPORTED_CHAINS,x as DEFAULT_SUPPORTED_CHAIN_IDS,M as chainDefs};
1
+ import{arbitrum as o}from"./arbitrum.mjs";import{arbitrumGoerli as m}from"./arbitrumGoerli.mjs";import{arbitrumSepolia as r}from"./arbitrumSepolia.mjs";import{avalanche as i}from"./avalanche.mjs";import{avalancheFuji as e}from"./avalancheFuji.mjs";import{base as t}from"./base.mjs";import{baseGoerli as s}from"./baseGoerli.mjs";import{baseSepolia as a}from"./baseSepolia.mjs";import{berachainArtio as p}from"./berachainArtio.mjs";import{celo as l}from"./celo.mjs";import{celoAlfajores as n}from"./celoAlfajores.mjs";import{filecoin as f}from"./filecoin.mjs";import{filecoinCalibration as j}from"./filecoinCalibration.mjs";import{garnetHolesky as b}from"./garnetHolesky.mjs";import{goerli as c}from"./goerli.mjs";import{holesky as u}from"./holesky.mjs";import{linea as y}from"./linea.mjs";import{lineaTestnet as S}from"./lineaTestnet.mjs";import{mainnet as g}from"./mainnet.mjs";import{optimism as d}from"./optimism.mjs";import{optimismGoerli as h}from"./optimismGoerli.mjs";import{optimismSepolia as k}from"./optimismSepolia.mjs";import{polygon as z}from"./polygon.mjs";import{polygonMumbai as G}from"./polygonMumbai.mjs";import{redstone as v}from"./redstone.mjs";import{redstoneHolesky as H}from"./redstoneHolesky.mjs";import{sepolia as T}from"./sepolia.mjs";import{zora as A}from"./zora.mjs";import{zoraSepolia as C}from"./zoraSepolia.mjs";import{zoraTestnet as F}from"./zoraTestnet.mjs";const M={mainnet:g,goerli:c,sepolia:T,arbitrum:o,arbitrumGoerli:m,arbitrumSepolia:r,optimism:d,optimismGoerli:h,optimismSepolia:k,polygon:z,polygonMumbai:G,celo:l,celoAlfajores:n,filecoin:f,filecoinCalibration:j,base:t,baseGoerli:s,baseSepolia:a,linea:y,lineaTestnet:S,avalanche:i,avalancheFuji:e,holesky:u,redstone:v,garnetHolesky:b,redstoneHolesky:H,zora:A,zoraSepolia:C,zoraTestnet:F},w=[g,c,T,o,m,r,d,h,k,z,G,l,n,f,j,t,s,a,p,y,S,i,e,u,v,b,H,A,C,F],x=new Set(w.map((o=>o.id)));function q(o){return w.find((m=>m.id===o))}export{w as DEFAULT_SUPPORTED_CHAINS,x as DEFAULT_SUPPORTED_CHAIN_IDS,M as chainDefs,q as getSupportedChainById};
@@ -0,0 +1 @@
1
+ function e({input:e,amount:s,blockchain:a}){const t=new URL("https://pay.coinbase.com/buy/select-asset");return t.searchParams.set("appId",e.app_id),t.searchParams.set("sessionToken",e.session_token),t.searchParams.set("defaultExperience","buy"),t.searchParams.set("presetCryptoAmount",function(e){return e.startsWith(".")?`0${e}`:e}(s)),t.searchParams.set("defaultNetwork",a),t.searchParams.set("partnerUserId",e.partner_user_id),{url:t}}export{e as getCoinbaseOnRampUrl};
@@ -0,0 +1 @@
1
+ import{arbitrum as o}from"../chains/arbitrum.mjs";import{base as i}from"../chains/base.mjs";import{mainnet as r}from"../chains/mainnet.mjs";import{optimism as t}from"../chains/optimism.mjs";import{polygon as n}from"../chains/polygon.mjs";const s={prod:{url:"https://api.moonpay.com/v1",key:"pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL"},sandbox:{url:"https://api.moonpay.com/v1",key:"pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI"}},a=new Set([r.id,o.id,i.id,n.id]),m=new Set([r.id,o.id,t.id,i.id,n.id]);function e(o,i){switch(i){case"native-currency":return a.has(o);case"USDC":return m.has(o);default:return console.warn("Unknown asset passed to MoonPay Onramp"),!1}}export{s as MoonpayEnvironments,e as isSupportedChainIdForMoonpay};
@@ -1 +1 @@
1
- import e from"./Privy.mjs";export{default}from"./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{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{getUserSmartWallet}from"./utils/getUserSmartWallet.mjs";export{getJsonRpcEndpointFromChain,populateTransactionRequest,throwIfInvalidRecoveryUpgradePath}from"./embedded/utils/index.mjs";export{countryCodesAndNumbers,formatPhoneNumber,getCountryCallingCode,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{ALL_WALLET_CLIENT_TYPES,SUPPORTED_CONNECTOR_TYPES}from"./types.mjs";export{DEFAULT_SUPPORTED_CHAINS,DEFAULT_SUPPORTED_CHAIN_IDS,chainDefs}from"./chains/index.mjs";import"./AppApi.mjs";import"./AuthApi.mjs";import"./CustomProviderApi.mjs";import"./EmailApi.mjs";import"./FarcasterApi.mjs";import"./GuestApi.mjs";import"./OAuthApi.mjs";import"./pkce.mjs";import"jose";import"./PasskeyApi.mjs";import"./PhoneApi.mjs";import"./SiweApi.mjs";import"./SmartWalletApi.mjs";import"./EmbeddedWalletApi.mjs";import"./embedded/EmbeddedWalletProvider.mjs";import"eventemitter3";import"./embedded/methods.mjs";import"./embedded/EmbeddedSolanaWalletProvider.mjs";import"./embedded/EmbeddedWalletProxy.mjs";import"./embedded/EventCallbackQueue.mjs";import"./embedded/withMfa.mjs";import"./embedded/EmbeddedBitcoinWalletProvider.mjs";import"./MfaApi.mjs";import"./MfaPasskeyApi.mjs";import"./MfaSmsApi.mjs";import"./MfaPromises.mjs";import"./PrivyInternal.mjs";import"fetch-retry";import"uuid";import"@privy-io/api-base";import"./Session.mjs";import"js-cookie";import"./Token.mjs";import"./utils/allSettled.mjs";import"./toAbortSignalTimeout.mjs";import"./RecoveryApi.mjs";import"./RecoveryICloudApi.mjs";import"./RecoveryOAuthApi.mjs";import"./UserApi.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"./chains/avalanche.mjs";import"./chains/avalancheFuji.mjs";import"./chains/berachainArtio.mjs";import"./chains/celo.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/mainnet.mjs";import"./chains/redstone.mjs";import"./chains/redstoneHolesky.mjs";import"./chains/sepolia.mjs";
1
+ import e from"./Privy.mjs";export{default}from"./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{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{getUserSmartWallet}from"./utils/getUserSmartWallet.mjs";export{getJsonRpcEndpointFromChain,populateTransactionRequest,throwIfInvalidRecoveryUpgradePath}from"./embedded/utils/index.mjs";export{countryCodesAndNumbers,formatPhoneNumber,getCountryCallingCode,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{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{formatErc20TokenAmount,formatWalletAddress,formatWeiAmount}from"./utils/formatters.mjs";import"./AppApi.mjs";import"./AuthApi.mjs";import"./CustomProviderApi.mjs";import"./EmailApi.mjs";import"./FarcasterApi.mjs";import"./FarcasterV2Api.mjs";import"./GuestApi.mjs";import"./OAuthApi.mjs";import"./pkce.mjs";import"jose";import"./PasskeyApi.mjs";import"./PhoneApi.mjs";import"./SiweApi.mjs";import"./SmartWalletApi.mjs";import"./EmbeddedWalletApi.mjs";import"./embedded/EmbeddedWalletProvider.mjs";import"eventemitter3";import"./embedded/methods.mjs";import"./embedded/EmbeddedSolanaWalletProvider.mjs";import"./embedded/EmbeddedWalletProxy.mjs";import"./embedded/EventCallbackQueue.mjs";import"./embedded/withMfa.mjs";import"./embedded/EmbeddedBitcoinWalletProvider.mjs";import"./FundingApi.mjs";import"./CoinbaseOnRampApi.mjs";import"./MoonpayOnRampApi.mjs";import"fetch-retry";import"./funding/moonpay.mjs";import"./chains/arbitrum.mjs";import"./chains/base.mjs";import"./chains/mainnet.mjs";import"./chains/optimism.mjs";import"./chains/polygon.mjs";import"./MfaApi.mjs";import"./MfaPasskeyApi.mjs";import"./MfaSmsApi.mjs";import"./MfaPromises.mjs";import"./PrivyInternal.mjs";import"uuid";import"@privy-io/api-base";import"./Session.mjs";import"js-cookie";import"./Token.mjs";import"./utils/allSettled.mjs";import"./toAbortSignalTimeout.mjs";import"./utils/toSearchParams.mjs";import"./RecoveryApi.mjs";import"./RecoveryICloudApi.mjs";import"./RecoveryOAuthApi.mjs";import"./UserApi.mjs";import"./embedded/types.mjs";import"@ethersproject/abstract-signer";import"@ethersproject/providers";import"./embedded/gas/arbitrum.mjs";import"@ethersproject/bignumber";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/baseGoerli.mjs";import"./chains/baseSepolia.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/polygonAmoy.mjs";import"./chains/polygonMumbai.mjs";import"./chains/avalanche.mjs";import"./chains/avalancheFuji.mjs";import"./chains/sepolia.mjs";import"./chains/berachainArtio.mjs";import"./chains/celo.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";
@@ -0,0 +1 @@
1
+ import{formatEther as e,formatUnits as i}from"viem";function r(e){return e?`${e.slice(0,5)}…${e.slice(-4)}`:""}function n({wei:i,precision:r=3}){return parseFloat(e(i)).toFixed(r).replace(/0+$/,"").replace(/\.$/,"")}function t({amount:e,decimals:r}){return i(BigInt(e),r)}export{t as formatErc20TokenAmount,r as formatWalletAddress,n as formatWeiAmount};
@@ -0,0 +1 @@
1
+ import{arbitrum as i}from"../chains/arbitrum.mjs";import{arbitrumSepolia as m}from"../chains/arbitrumSepolia.mjs";import{avalanche as a}from"../chains/avalanche.mjs";import{avalancheFuji as c}from"../chains/avalancheFuji.mjs";import{base as o}from"../chains/base.mjs";import{baseSepolia as f}from"../chains/baseSepolia.mjs";import{mainnet as e}from"../chains/mainnet.mjs";import{optimism as r}from"../chains/optimism.mjs";import{optimismSepolia as d}from"../chains/optimismSepolia.mjs";import{polygon as s}from"../chains/polygon.mjs";import{polygonAmoy as b}from"../chains/polygonAmoy.mjs";import{sepolia as n}from"../chains/sepolia.mjs";const p={[e.id]:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",[n.id]:"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",[r.id]:"0x0b2c639c533813f4aa9d7837caf62653d097ff85",[d.id]:"0x5fd84259d66Cd46123540766Be93DFE6D43130D7",[s.id]:"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",[b.id]:"0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582",[o.id]:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",[f.id]:"0x036CbD53842c5426634e7929541eC2318f3dCF7e",[a.id]:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",[c.id]:"0x5425890298aed601595a70ab815c96711a31bc65",[i.id]:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",[m.id]:"0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"};function t(i,m){return i===p[m.id]}export{p as UsdcAddressMap,t as getIsTokenUsdc};
@@ -0,0 +1 @@
1
+ function n(n){const r=new URLSearchParams;for(const t in n)null!=n[t]&&r.append(t,String(n[t]));return Array.from(r).length?"?"+r.toString():""}export{n as toSearchParams};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@privy-io/js-sdk-core",
3
- "version": "0.34.2",
3
+ "version": "0.35.0-beta-20241120224355",
4
4
  "description": "Vanilla JS client for the Privy Auth API",
5
5
  "keywords": [
6
6
  "authentication",
@@ -68,7 +68,7 @@
68
68
  "@ethersproject/transactions": "^5.7.0",
69
69
  "@ethersproject/units": "^5.7.0",
70
70
  "@privy-io/api-base": "^1.4.0",
71
- "@privy-io/public-api": "2.15.1",
71
+ "@privy-io/public-api": "2.15.2-beta-20241120224355",
72
72
  "eventemitter3": "^5.0.1",
73
73
  "fetch-retry": "^5.0.6",
74
74
  "jose": "^4.15.5",