@privy-io/js-sdk-core 0.61.3 → 0.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client/EmbeddedWalletApi.js +1 -1
- package/dist/cjs/client/EmbeddedWalletApi.js.map +1 -1
- package/dist/cjs/client/Privy.js +1 -1
- package/dist/cjs/client/Privy.js.map +1 -1
- package/dist/cjs/client/PrivyInternal.js +1 -1
- package/dist/cjs/client/PrivyInternal.js.map +1 -1
- package/dist/cjs/client/auth/OAuthApi.js +1 -1
- package/dist/cjs/client/auth/OAuthApi.js.map +1 -1
- package/dist/cjs/client/recovery/RecoveryApi.js.map +1 -1
- package/dist/cjs/client/recovery/RecoveryOAuthApi.js +1 -1
- package/dist/cjs/client/recovery/RecoveryOAuthApi.js.map +1 -1
- package/dist/cjs/crypto/resolve.js +2 -0
- package/dist/cjs/crypto/resolve.js.map +1 -0
- package/dist/cjs/embedded/EmbeddedSolanaWalletProvider.js +1 -1
- package/dist/cjs/embedded/EmbeddedSolanaWalletProvider.js.map +1 -1
- package/dist/cjs/embedded/EmbeddedWalletProvider.js +1 -1
- package/dist/cjs/embedded/EmbeddedWalletProvider.js.map +1 -1
- package/dist/cjs/embedded/index.js +1 -1
- package/dist/cjs/embedded/stack/wallet-api-eth-transaction.js +1 -1
- package/dist/cjs/embedded/stack/wallet-api-eth-transaction.js.map +1 -1
- package/dist/cjs/embedded/stack/walletRpc.js +1 -1
- package/dist/cjs/embedded/stack/walletRpc.js.map +1 -1
- package/dist/cjs/embedded/types.js.map +1 -1
- package/dist/cjs/embedded/utils/index.js +1 -1
- package/dist/cjs/embedded/utils/index.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/pkce.js +1 -1
- package/dist/cjs/pkce.js.map +1 -1
- package/dist/cjs/smart-wallets.js +1 -1
- package/dist/cjs/smart-wallets.js.map +1 -1
- package/dist/cjs/solana/client.js +1 -1
- package/dist/cjs/solana/client.js.map +1 -1
- package/dist/dts/index.d.mts +41 -7
- package/dist/dts/index.d.ts +41 -7
- package/dist/dts/smart-wallets.d.mts +2 -1
- package/dist/dts/smart-wallets.d.ts +2 -1
- package/dist/esm/client/EmbeddedWalletApi.mjs +1 -1
- package/dist/esm/client/EmbeddedWalletApi.mjs.map +1 -1
- package/dist/esm/client/Privy.mjs +1 -1
- package/dist/esm/client/Privy.mjs.map +1 -1
- package/dist/esm/client/PrivyInternal.mjs +1 -1
- package/dist/esm/client/PrivyInternal.mjs.map +1 -1
- package/dist/esm/client/auth/OAuthApi.mjs +1 -1
- package/dist/esm/client/auth/OAuthApi.mjs.map +1 -1
- package/dist/esm/client/recovery/RecoveryApi.mjs.map +1 -1
- package/dist/esm/client/recovery/RecoveryOAuthApi.mjs +1 -1
- package/dist/esm/client/recovery/RecoveryOAuthApi.mjs.map +1 -1
- package/dist/esm/crypto/resolve.mjs +2 -0
- package/dist/esm/crypto/resolve.mjs.map +1 -0
- package/dist/esm/embedded/EmbeddedSolanaWalletProvider.mjs +1 -1
- package/dist/esm/embedded/EmbeddedSolanaWalletProvider.mjs.map +1 -1
- package/dist/esm/embedded/EmbeddedWalletProvider.mjs +1 -1
- package/dist/esm/embedded/EmbeddedWalletProvider.mjs.map +1 -1
- package/dist/esm/embedded/index.mjs +1 -1
- package/dist/esm/embedded/stack/wallet-api-eth-transaction.mjs +1 -1
- package/dist/esm/embedded/stack/wallet-api-eth-transaction.mjs.map +1 -1
- package/dist/esm/embedded/stack/walletRpc.mjs +1 -1
- package/dist/esm/embedded/stack/walletRpc.mjs.map +1 -1
- package/dist/esm/embedded/types.mjs.map +1 -1
- package/dist/esm/embedded/utils/index.mjs +1 -1
- package/dist/esm/embedded/utils/index.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/pkce.mjs +1 -1
- package/dist/esm/pkce.mjs.map +1 -1
- package/dist/esm/smart-wallets.mjs +1 -1
- package/dist/esm/smart-wallets.mjs.map +1 -1
- package/dist/esm/solana/client.mjs +1 -1
- package/dist/esm/solana/client.mjs.map +1 -1
- package/dist/esm/toAbortSignalTimeout.mjs.map +1 -1
- package/package.json +8 -10
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"./AppApi.mjs";import
|
|
1
|
+
import{resolveCryptoFns as e}from"../crypto/resolve.mjs";import t from"./AppApi.mjs";import i from"./CrossAppApi.mjs";import r from"./DelegatedWalletsApi.mjs";import m from"./EmbeddedWalletApi.mjs";import s from"./MfaPromises.mjs";import{PrivyInternal as o}from"./PrivyInternal.mjs";import a from"./UserApi.mjs";import p from"./auth/AuthApi.mjs";import l from"./funding/FundingApi.mjs";import n from"./mfa/MfaApi.mjs";import d from"./recovery/RecoveryApi.mjs";import"@privy-io/routes";import"../Token.mjs";import"jose";import"@privy-io/chains";import"../Error.mjs";import"../embedded/EmbeddedBitcoinWalletProvider.mjs";import"../wallet-api/unified-wallet.mjs";import"../embedded/errors.mjs";import"../embedded/types.mjs";import"../embedded/stack/walletCreate.mjs";import"../wallet-api/create.mjs";import"../embedded/utils/index.mjs";import"viem";import"viem/chains";import"../embedded/EmbeddedWalletProxy.mjs";import"../utils/sleep.mjs";import"../embedded/EventCallbackQueue.mjs";import"../embedded/withMfa.mjs";import"../embedded/EmbeddedWalletProvider.mjs";import"eventemitter3";import"@privy-io/ethereum";import"../embedded/stack/walletRpc.mjs";import"../utils/encodings.mjs";import"../wallet-api/rpc.mjs";import"../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"@privy-io/encoding";import"../wallet-api/types.mjs";import"../embedded/stack/wallet-api-eth-transaction.mjs";import"../embedded/stack/wallet-api-eth-typed-data.mjs";import"../embedded/EmbeddedSolanaWalletProvider.mjs";import"../solana/getWalletPublicKeyFromTransaction.mjs";import"../solana/isVersionedTransaction.mjs";import"fetch-retry";import"@privy-io/api-base";import"../Session.mjs";import"js-cookie";import"../utils/allSettled.mjs";import"../toAbortSignalTimeout.mjs";import"../utils/toSearchParams.mjs";import"./logger.mjs";import"../utils/noop.mjs";import"./auth/CustomProviderApi.mjs";import"./auth/maybeCreateWalletOnLogin.mjs";import"../utils/getUserEmbeddedEthereumWallet.mjs";import"../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../utils/embedded-wallets.mjs";import"../utils/getUserEmbeddedSolanaWallet.mjs";import"../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../utils/shouldCreateEmbeddedEthWallet.mjs";import"../utils/shouldCreateEmbeddedSolWallet.mjs";import"./auth/EmailApi.mjs";import"./auth/FarcasterApi.mjs";import"./auth/FarcasterV2Api.mjs";import"./auth/GuestApi.mjs";import"./auth/OAuthApi.mjs";import"../pkce.mjs";import"./auth/PasskeyApi.mjs";import"./auth/PhoneApi.mjs";import"./auth/SiweApi.mjs";import"./auth/SiwsApi.mjs";import"./auth/SmartWalletApi.mjs";import"./funding/CoinbaseOnRampApi.mjs";import"./funding/MoonpayOnRampApi.mjs";import"../funding/moonpay.mjs";import"./mfa/MfaPasskeyApi.mjs";import"./mfa/MfaSmsApi.mjs";import"./recovery/RecoveryICloudApi.mjs";import"./recovery/RecoveryOAuthApi.mjs";class h{async initialize(){await this._privyInternal._initialize()}setMessagePoster(e){this.embeddedWallet.setMessagePoster(e)}addOAuthTokensListener(e){return this._privyInternal.session.on("oauth_tokens_granted",e),{unsubscribe:()=>{this._privyInternal.session.removeListener("oauth_tokens_granted",e)}}}setCallbacks(e){this._privyInternal.setCallbacks(e)}getAccessToken(){return this._privyInternal.getAccessToken()}getIdentityToken(){return this._privyInternal.getIdentityToken()}getCompiledPath(e,t){return this._privyInternal.getPath(e,t)}async fetchPrivyRoute(e,t){return this._privyInternal.fetch(e,t)}get logger(){return this._privyInternal.logger}constructor({clientId:h,...j}){let u=e(j.crypto);this._privyInternal=new o({...j,appClientId:h,crypto:u}),this.mfa=new n(this._privyInternal),this.mfaPromises=new s,this.app=new t(this._privyInternal),this.embeddedWallet=new m(this._privyInternal,j.embeddedWalletMessagePoster,j.supportedChains,this.mfa,this.mfaPromises,this.app),this.user=new a(this._privyInternal),this.auth=new p(this._privyInternal,this.embeddedWallet,j.storage,u,this.mfa),this.recovery=new d(this._privyInternal,j.storage,u),this.funding=new l(this._privyInternal),this.delegated=new r(this._privyInternal),this.crossApp=new i(this._privyInternal,j.storage)}}export{h as default};
|
|
2
2
|
//# sourceMappingURL=Privy.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Privy.mjs","sources":["../../../src/client/Privy.ts"],"names":["Privy","initialize","this","_privyInternal","_initialize","setMessagePoster","poster","embeddedWallet","addOAuthTokensListener","listener","session","on","unsubscribe","removeListener","setCallbacks","callbacks","getAccessToken","getIdentityToken","getCompiledPath","r","opts","getPath","fetchPrivyRoute","fetch","logger","constructor","clientId","o","PrivyInternal","appClientId","mfa","MfaApi","mfaPromises","MfaPromises","app","AppApi","EmbeddedWalletApi","embeddedWalletMessagePoster","supportedChains","user","UserApi","auth","AuthApi","storage","
|
|
1
|
+
{"version":3,"file":"Privy.mjs","sources":["../../../src/client/Privy.ts"],"names":["Privy","initialize","this","_privyInternal","_initialize","setMessagePoster","poster","embeddedWallet","addOAuthTokensListener","listener","session","on","unsubscribe","removeListener","setCallbacks","callbacks","getAccessToken","getIdentityToken","getCompiledPath","r","opts","getPath","fetchPrivyRoute","fetch","logger","constructor","clientId","o","crypto","resolveCryptoFns","PrivyInternal","appClientId","mfa","MfaApi","mfaPromises","MfaPromises","app","AppApi","EmbeddedWalletApi","embeddedWalletMessagePoster","supportedChains","user","UserApi","auth","AuthApi","storage","recovery","RecoveryApi","funding","FundingApi","delegated","DelegatedWalletsApi","crossApp","CrossAppApi"],"mappings":"kyFAiFe,MAAMA,EAqGnB,gBAAaC,SACLC,KAAKC,eAAeC,aAC5B,CAEA,gBAAAC,CAAwBC,GACtBJ,KAAKK,eAAeF,iBAAiBC,EACvC,CAQA,sBAAAE,CAA8BC,GAE5B,OADAP,KA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gBwB,EAAEkB,QACzD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"fetch-retry";import{
|
|
1
|
+
import e from"fetch-retry";import{PrivyErrorCode as t}from"@privy-io/api-base";import{getPathWithParams as s,AppConfig as i,AnalyticsEvent as r,RefreshSession as a}from"@privy-io/routes";import{PrivyClientError as o,PrivyApiError as n}from"../Error.mjs";import{Session as h}from"../Session.mjs";import c from"../toAbortSignalTimeout.mjs";import{toSearchParams as l}from"../utils/toSearchParams.mjs";import{toLoggerWithLevel as g}from"./logger.mjs";import"eventemitter3";import"jose";import"js-cookie";import"../Token.mjs";import"../utils/allSettled.mjs";import"../utils/noop.mjs";let d="privy:caid";class p{setCallbacks(e){this.callbacks={...this.callbacks,...e}}get isReady(){return!!this._config}get config(){return this._config}get caid(){return this._analyticsId}async _initialize(){if(this.isReady)this.callbacks?.setIsReady?.(!0);else{if(!await this.isStorageAccessible())throw new 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._sdkVersion.startsWith("react-auth:")||this.createAnalyticsEvent("sdk_initialize",{})}}getPath(e,{params:t,query:i}){return`${this.baseUrl}${s(e.path,t)}${l(i)}`}async fetch(e,{body:t,params:s,query:i,headers:r,onRequest:a=this._beforeRequest.bind(this)}){let o=new Request(this.getPath(e,{params:s,query:i}),{method:e.method,body:JSON.stringify(t),headers:r}),h=await a(o),c=await this._fetch(o,h),l=await c.json();if(c.status>299)throw new n({...l,status:c.status});return l}async _beforeRequestWithoutInitialize(e){let t=await this.session.getPrivyAccessToken()??await this.session.getCustomerAccessToken(),s=new Headers(e.headers);s.set("privy-app-id",this.appId),this.appClientId&&s.set("privy-client-id",this.appClientId),s.set("privy-client",this._sdkVersion),t&&s.set("Authorization",`Bearer ${t}`),s.set("Content-Type","application/json"),s.set("Accept","application/json");let i=await this._getOrGenerateClientAnalyticsId();return i&&s.set("privy-ca-id",i),this.nativeAppIdentifier&&s.set("x-native-app-identifier",this.nativeAppIdentifier),{signal:c(2e4),headers:s,credentials:"include"}}async beforeRequestWithoutRefresh(e){return await this._initialize(),this._beforeRequestWithoutInitialize(e)}async _beforeRequest(e){return await this._initialize(),await this.getAccessTokenInternal(),this.beforeRequestWithoutRefresh(e)}async getAppConfig(){return await this.fetch(i,{params:{app_id:this.appId},onRequest:this._beforeRequestWithoutInitialize.bind(this)})}async _getOrGenerateClientAnalyticsId(){if(this._analyticsId)return this._analyticsId;try{let e=await this._storage.get(d);if("string"==typeof e&&e.length>0)return this._analyticsId=e,e}catch(e){this.logger.error("Unable to load clientId",e)}try{this._analyticsId=this._crypto.randomUUID()}catch(e){this.logger.error("Unable to generate uuidv4",e)}if(this._analyticsId){try{await this._storage.put(d,this._analyticsId)}catch(e){this.logger.error(`Unable to store clientId: ${this._analyticsId}`,e)}return this._analyticsId}}async destroyClientAnalyticsId(){try{return await this._storage.del(d)}catch(e){this.logger.error("Unable to delete clientId",e)}}async createAnalyticsEvent(e,t){try{await this.fetch(r,{body:{event_name:e,client_id:await this._getOrGenerateClientAnalyticsId(),payload:t},onRequest:this.beforeRequestWithoutRefresh.bind(this)})}catch(e){}}async refreshSession(e=!1){if(!await this.isStorageAccessible())throw new o({code:"storage_error",error:"Unable to access storage"});let t=await this.session.getRefreshToken()??void 0,s=t??"key",i=this._cache.get(s);if(i)return this.logger.debug("[privy:refresh] found in-flight session refresh request, deduping"),await i;let r=this._refreshSession(t,e);this._cache.set(s,r);try{return await r}finally{this._cache.delete(s)}}async _refreshSession(e,s){let i=await this.session.getCustomerAccessToken();if(!this.session.hasRefreshCredentials(i,e??null))throw this.logger.debug("[privy:refresh] missing tokens, skipping request"),await this._initialize(),new n({code:t.MISSING_OR_INVALID_TOKEN,error:"No tokens found in storage",status:401});try{this.logger.debug(`[privy:refresh] fetching: ${a.path}`);let t=await this.fetch(a,{body:{refresh_token:e},onRequest:this.beforeRequestWithoutRefresh.bind(this)}),i=t.session_update_action;return this.logger.debug(`[privy:refresh] response: ${i}`),"set"===i&&(await this.session.updateWithTokensResponse(t),this.logger.debug("[privy:refresh] tokens stored")),"clear"===i&&(await this.session.destroyLocalState(),this.logger.debug("[privy:refresh] tokens cleared"),s||this.callbacks?.setUser?.(null)),"ignore"===i&&(t.token&&(await this.session.storeCustomerAccessToken(t.token),this.logger.debug("[privy:refresh] token stored (CAT)")),t.privy_access_token&&(await this.session.storePrivyAccessToken(t.privy_access_token),this.logger.debug("[privy:refresh] token stored (PAT)")),t.identity_token&&(this.logger.debug("[privy:refresh] token stored (IDT)"),await this.session.storeIdentityToken(t.identity_token))),this.logger.debug("[privy:refresh] returning response"),s||this.callbacks?.setUser?.(t.user),t}catch(e){throw this.logger.debug(`[privy:refresh] error: ${e.message??"unknown error"}`),e instanceof n&&e.code===t.MISSING_OR_INVALID_TOKEN&&(await this.session.destroyLocalState(),s||this.callbacks?.setUser?.(null)),e}}async getAccessToken(){let[e,t]=await Promise.all([this.session.getCustomerAccessToken(),this.session.getRefreshToken()]);if(e&&!this.session.tokenIsActive(e)&&this.session.hasRefreshCredentials(e,t)){let t=await this.refreshSession(),s=await this.session.getCustomerAccessToken();return t.token||this.logger.debug("[privy:getAccessToken] expected token received null"),t.token===e&&this.logger.debug("[privy:getAccessToken] expected new token in response received existing"),s===e&&this.logger.debug("[privy:getAccessToken] expected new token in storage received existing"),t.token??s}return e&&!this.session.tokenIsActive(e)?(this.logger.debug("[privy:getAccessToken] unable to refresh inactive token"),this.callbacks?.setUser?.(null),await this.session.destroyLocalState(),null):e}async getAccessTokenInternal(){let e=await this.getAccessToken();return await this.session.getPrivyAccessToken()??e}async getIdentityToken(){return await this.session.getIdentityToken()}async isStorageAccessible(){try{let e=`privy:__storage__test-${this._crypto.randomUUID()}`,t="blobby";await this._storage.put(e,t);let s=await this._storage.get(e);return await this._storage.del(e),s===t}catch(e){return this.logger.error(e),!1}}constructor(t){this._sdkVersion="js-sdk-core:0.62.0",this._cache=new Map,this.logger=g({level:t.logger?.level??t.logLevel??"ERROR",logger:t.logger??console}),this._storage=t.storage,this._crypto=t.crypto,this._analyticsId=null,this._getOrGenerateClientAnalyticsId(),this.baseUrl=t.baseUrl??"https://auth.privy.io",this.appId=t.appId,this.appClientId=t.appClientId,this._sdkVersion=t.sdkVersion??this._sdkVersion,this.callbacks=t.callbacks,this.nativeAppIdentifier=t.nativeAppIdentifier,this.session=new h({storage:this._storage,isUsingServerCookies:!1,appId:t.appId}),this._fetch=e(globalThis.fetch,{retries:3,retryDelay:e=>3**e*500,retryOn:[408,409,425,500,502,503,504]}),this.session.on("error_storing_tokens",(e=>{this.createAnalyticsEvent("error_updating_tokens_in_storage",{reason:e})}))}}export{p as PrivyInternal};
|
|
2
2
|
//# sourceMappingURL=PrivyInternal.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrivyInternal.mjs","sources":["../../../src/client/PrivyInternal.ts"],"names":["CLIENT_ANALYTICS_ID_KEY","PrivyInternal","setCallbacks","callbacks","this","isReady","_config","config","caid","_analyticsId","_initialize","setIsReady","isStorageAccessible","PrivyClientError","code","error","getAppConfig","custom_api_url","baseUrl","session","isUsingServerCookies","_sdkVersion","startsWith","createAnalyticsEvent","getPath","r","params","query","getPathWithParams","path","toSearchParams","fetch","body","headers","onRequest","_beforeRequest","bind","request","Request","method","JSON","stringify","requestInit","res","_fetch","json","status","PrivyApiError","_beforeRequestWithoutInitialize","token","getPrivyAccessToken","getCustomerAccessToken","Headers","set","appId","appClientId","_getOrGenerateClientAnalyticsId","nativeAppIdentifier","signal","toAbortSignalTimeout","credentials","beforeRequestWithoutRefresh","getAccessTokenInternal","AppConfig","app_id","clientAnalyticsId","_storage","get","length","e","logger","
|
|
1
|
+
{"version":3,"file":"PrivyInternal.mjs","sources":["../../../src/client/PrivyInternal.ts"],"names":["CLIENT_ANALYTICS_ID_KEY","PrivyInternal","setCallbacks","callbacks","this","isReady","_config","config","caid","_analyticsId","_initialize","setIsReady","isStorageAccessible","PrivyClientError","code","error","getAppConfig","custom_api_url","baseUrl","session","isUsingServerCookies","_sdkVersion","startsWith","createAnalyticsEvent","getPath","r","params","query","getPathWithParams","path","toSearchParams","fetch","body","headers","onRequest","_beforeRequest","bind","request","Request","method","JSON","stringify","requestInit","res","_fetch","json","status","PrivyApiError","_beforeRequestWithoutInitialize","token","getPrivyAccessToken","getCustomerAccessToken","Headers","set","appId","appClientId","_getOrGenerateClientAnalyticsId","nativeAppIdentifier","signal","toAbortSignalTimeout","credentials","beforeRequestWithoutRefresh","getAccessTokenInternal","AppConfig","app_id","clientAnalyticsId","_storage","get","length","e","logger","_crypto","randomUUID","put","destroyClientAnalyticsId","del","name","properties","AnalyticsEvent","event_name","client_id","payload","refreshSession","skipCallbacks","refreshToken","getRefreshToken","undefined","key","cached","_cache","debug","promise","_refreshSession","delete","hasRefreshCredentials","PrivyErrorCode","MISSING_OR_INVALID_TOKEN","RefreshSession","refresh_token","session_update_action","updateWithTokensResponse","destroyLocalState","setUser","storeCustomerAccessToken","privy_access_token","storePrivyAccessToken","identity_token","storeIdentityToken","user","message","s","getAccessToken","Promise","all","tokenIsActive","tokenFromStorage","cat","getIdentityToken","value","valueFromStorage","constructor","o","Map","toLoggerWithLevel","level","logLevel","console","storage","crypto","sdkVersion","Session","rfetch","globalThis","retries","retryDelay","attempt","retryOn","on","reason"],"mappings":"okBA8DA,IAAMA,EAA0B,aAOzB,MAAMC,EAuHJC,YAAAA,CAAaC,GAClBC,KAAKD,UAAY,IAAIC,KAAKD,aAAcA,EAC1C,CAOA,WAAIE,GACF,QAAeD,KAAKE,OACtB,CAKA,UAAIC,GACF,OAAOH,KAAKE,OAAO,CAUrB,QAAIE,GACF,OAAOJ,KAAKK,YAAY,CAQ1B,iBAAaC,GAEX,GAAIN,KAAKC,QACPD,KAAKD,WAAWQ,cAAa,OAD/B,CAKA,UAAYP,KAAKQ,sBACf,MAAM,IAAIC,EAAiB,CACzBC,KAA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E,GAAa,GAAKkE,EAAU,IAExCC,QAAS,CACP,IACA,IACA,IACA,IACA,IACA,IACA,OAKJpI,KAAKe,QAAQsH,GAAG,wBAAwBpE,IACjCjE,KAAKmB,qBAAqB,mCAAoC,CACjEmH,OAAAA,GACF,GAEJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{OAuthInit as e,OAuthAuthenticate as t,OAuthLink as i,OAuthUnlink as s}from"@privy-io/routes";import{PrivyClientError as r}from"../../Error.mjs";import{createCodeVerifier as a,createStateCode as o,deriveCodeChallengeFromCodeVerifier as l,CODE_VERIFIER_KEY as d,STATE_CODE_KEY as n}from"../../pkce.mjs";import{maybeCreateWalletOnLogin as h}from"./maybeCreateWalletOnLogin.mjs";import"jose";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/embedded-wallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class m{async generateURL(t,i){let s=a(),r=o(),h=await l({codeVerifier:s,digest:this._crypto
|
|
1
|
+
import{OAuthInit as e,OAuthAuthenticate as t,OAuthLink as i,OAuthUnlink as s}from"@privy-io/routes";import{PrivyClientError as r}from"../../Error.mjs";import{createCodeVerifier as a,createStateCode as o,deriveCodeChallengeFromCodeVerifier as l,CODE_VERIFIER_KEY as d,STATE_CODE_KEY as n}from"../../pkce.mjs";import{maybeCreateWalletOnLogin as h}from"./maybeCreateWalletOnLogin.mjs";import"jose";import"../../utils/getUserEmbeddedEthereumWallet.mjs";import"../../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../../utils/embedded-wallets.mjs";import"../../utils/getUserEmbeddedSolanaWallet.mjs";import"../../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../../utils/shouldCreateEmbeddedEthWallet.mjs";import"../../utils/shouldCreateEmbeddedSolWallet.mjs";class m{async generateURL(t,i){let s=a(),r=o(),h=await l({codeVerifier:s,digest:this._crypto.digest});return await Promise.all([this._storage.put(d,s),this._storage.put(n,r)]),this._privyInternal.fetch(e,{body:{redirect_to:i,provider:t,code_challenge:h,state_code:r}})}async loginWithCode(e,i,s,a,o,l){let[m,p]=await Promise.all([this._storage.get(d),this._storage.get(n)]);if(p!==i)throw this._privyInternal.createAnalyticsEvent("possible_phishing_attempt",{flow:"oauth",provider:s,storedStateCode:p??"",returnedStateCode:i??""}),new r({code:"pkce_state_code_mismatch",error:"Unexpected auth flow. This may be a phishing attempt."});let _=await this._privyInternal.fetch(t,{body:{authorization_code:e,code_type:a,state_code:p,code_verifier:m,mode:o}});await this._privyInternal.session.updateWithTokensResponse(_);let c=await h(this._embedded,_,l?.embedded);return await Promise.all([this._storage.del(d),this._storage.del(n)]),this._privyInternal.callbacks?.setUser?.(c.user),c}async linkWithCode(e,t,s,a){let[o,l]=await Promise.all([this._storage.get(d),this._storage.get(n)]);if(l!==t)throw this._privyInternal.createAnalyticsEvent("possible_phishing_attempt",{flow:"oauth",provider:s,storedStateCode:l??"",returnedStateCode:t??""}),new r({code:"pkce_state_code_mismatch",error:"Unexpected auth flow. This may be a phishing attempt."});let h=await this._privyInternal.fetch(i,{body:{authorization_code:e,code_type:a,state_code:l,code_verifier:o}});await this._privyInternal.session.processOAuthTokens(h.oauth_tokens);let m=await this._privyInternal.refreshSession();return await Promise.all([this._storage.del(d),this._storage.del(n)]),{user:m.user,identity_token:m.identity_token}}async unlink(e,t){await this._privyInternal.fetch(s,{body:{provider:e,subject:t}});let i=await this._privyInternal.refreshSession();return{user:i.user,identity_token:i.identity_token}}constructor(e,t,i,s){this._privyInternal=e,this._embedded=t,this._storage=i,this._crypto=s}}export{m as default};
|
|
2
2
|
//# sourceMappingURL=OAuthApi.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthApi.mjs","sources":["../../../../src/client/auth/OAuthApi.ts"],"names":["OAuthApi","generateURL","provider","redirectURI","codeVerifier","createCodeVerifier","stateCode","createStateCode","codeChallenge","deriveCodeChallengeFromCodeVerifier","digest","this","_crypto","Promise","all","_storage","put","CODE_VERIFIER_KEY","STATE_CODE_KEY","_privyInternal","fetch","OAuthInit","body","redirect_to","code_challenge","state_code","loginWithCode","authorizationCode","returnedStateCode","codeType","mode","opts","storedStateCode","get","createAnalyticsEvent","flow","PrivyClientError","code","error","res","OAuthAuthenticate","authorization_code","code_type","code_verifier","session","updateWithTokensResponse","sessionWithWallets","maybeCreateWalletOnLogin","_embedded","embedded","del","callbacks","setUser","user","linkWithCode","linkResponse","OAuthLink","processOAuthTokens","oauth_tokens","refreshSession","identity_token","unlink","subject","OAuthUnlink","constructor","privyInternal","storage","crypto"],"mappings":"4vBAkBe,MAAMA,EA2CnB,iBAAaC,CAAYC,EAA2BC,GAClD,IAAMC,EAAeC,IACfC,EAAYC,IACZC,QAAsBC,EAAoC,CAC9DL,aAAAA,EACAM,OAAQC,KAAKC,
|
|
1
|
+
{"version":3,"file":"OAuthApi.mjs","sources":["../../../../src/client/auth/OAuthApi.ts"],"names":["OAuthApi","generateURL","provider","redirectURI","codeVerifier","createCodeVerifier","stateCode","createStateCode","codeChallenge","deriveCodeChallengeFromCodeVerifier","digest","this","_crypto","Promise","all","_storage","put","CODE_VERIFIER_KEY","STATE_CODE_KEY","_privyInternal","fetch","OAuthInit","body","redirect_to","code_challenge","state_code","loginWithCode","authorizationCode","returnedStateCode","codeType","mode","opts","storedStateCode","get","createAnalyticsEvent","flow","PrivyClientError","code","error","res","OAuthAuthenticate","authorization_code","code_type","code_verifier","session","updateWithTokensResponse","sessionWithWallets","maybeCreateWalletOnLogin","_embedded","embedded","del","callbacks","setUser","user","linkWithCode","linkResponse","OAuthLink","processOAuthTokens","oauth_tokens","refreshSession","identity_token","unlink","subject","OAuthUnlink","constructor","privyInternal","storage","crypto"],"mappings":"4vBAkBe,MAAMA,EA2CnB,iBAAa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If,KAGpB,GAAIc,IAAoBJ,EAStB,MAPKjB,KAAKQ,eAAee,qBAAqB,4BAA6B,CACzEC,KAAM,QACNjC,SAAUA,EACV8B,gBAAiBA,GAAmB,GACpCJ,kBAAmBA,GAAqB,KAGpC,IAAIQ,EAAiB,CACzBC,KAAM,2BACNC,MAAO,0DAIX,IAAMiB,QAAqB5C,KAAKQ,eAAeC,MAAMoC,EAAW,CAC9DlC,KAAM,CACJmB,mBAAoBd,EACpBe,UAAWb,EACXJ,WAAYO,EACZW,cAAevC,WAIbO,KAAKQ,eAAeyB,QAAQa,mBAAmBF,EAAaG,cAGlE,IAAMnB,QAAY5B,KAAKQ,eAAewC,iBAGtC,aADM9C,QAAQC,IAAI,CAACH,KAAKI,SAASmC,IAAIjC,GAAoBN,KAAKI,SAASmC,IAAIhC,KACpE,CAACmC,KAAMd,EAAIc,KAAMO,eAAgBrB,EAAIqB,eAC9C,CAQA,YAAaC,CAAO3D,EAA2B4D,SACvCnD,KAAKQ,eAAeC,MAAM2C,EAAa,CAACzC,KAAM,CAACpB,SAAAA,EAAU4D,QAAAA,KAG/D,IAAMvB,QAAY5B,KAAKQ,eAAewC,iBAEtC,MAAO,CAACN,KAAMd,EAAIc,KAAMO,eAAgBrB,EAAIqB,eAC9C,CAnKA,WAAAI,CACEC,EACAhB,EACAiB,EACAC,GAEAxD,KAAKQ,eAAiB8C,EACtBtD,KAAKqC,UAAYC,EACjBtC,KAAKI,SAAWmD,EAChBvD,KAAKC,QAAUuD,CACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecoveryApi.mjs","sources":["../../../../src/client/recovery/RecoveryApi.ts"],"names":["RecoveryApi","getRecoveryKeyMaterial","address","chain_type","this","_privyInternal","fetch","RecoveryKeyMaterial","body","params","constructor","privyInternal","storage","crypto","auth","RecoveryOAuthApi","icloudAuth","RecoveryICloudApi"],"mappings":"sMAQqBA,
|
|
1
|
+
{"version":3,"file":"RecoveryApi.mjs","sources":["../../../../src/client/recovery/RecoveryApi.ts"],"names":["RecoveryApi","getRecoveryKeyMaterial","address","chain_type","this","_privyInternal","fetch","RecoveryKeyMaterial","body","params","constructor","privyInternal","storage","crypto","auth","RecoveryOAuthApi","icloudAuth","RecoveryICloudApi"],"mappings":"sMAQqBA,EA8BnB,4BAAaC,CAAuBC,EAAiBC,GACnD,OAAOC,KAAKC,eAAeC,MAAMC,EAAqB,CACpDC,KAAM,CACJL,WAAAA,GAEFM,OAAQ,CACNP,QAAAA,IAGN,CAtBA,WAAAQ,CAAmBC,EAA8BC,EAAkBC,GACjET,KAAKC,eAAiBM,EAEtBP,KAAKU,KAAO,IAAIC,EAAiBX,KAAKC,eAAgBO,EAASC,GAC/DT,KAAKY,WAAa,IAAIC,EAAkBb,KAAKC,eAC/C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{RecoveryOAuthInit as t,RecoveryOAuthAuthenticate as e}from"@privy-io/routes";import{PrivyClientError as r}from"../../Error.mjs";import{createCodeVerifier as i,createStateCode as o,deriveCodeChallengeFromCodeVerifier as a,CODE_VERIFIER_KEY as s,STATE_CODE_KEY as h}from"../../pkce.mjs";import"jose";class c{async generateURL(e){let r=i(),c=o(),_=await a({codeVerifier:r,digest:this._crypto
|
|
1
|
+
import{RecoveryOAuthInit as t,RecoveryOAuthAuthenticate as e}from"@privy-io/routes";import{PrivyClientError as r}from"../../Error.mjs";import{createCodeVerifier as i,createStateCode as o,deriveCodeChallengeFromCodeVerifier as a,CODE_VERIFIER_KEY as s,STATE_CODE_KEY as h}from"../../pkce.mjs";import"jose";class c{async generateURL(e){let r=i(),c=o(),_=await a({codeVerifier:r,digest:this._crypto.digest});return await Promise.all([this._storage.put(s,r),this._storage.put(h,c)]),this._privyInternal.fetch(t,{body:{redirect_to:e,code_challenge:_,state_code:c}})}async authorize(t,i){let[o,a]=await Promise.all([this._storage.get(s),this._storage.get(h)]);if(a!==i)throw this._privyInternal.createAnalyticsEvent("possible_phishing_attempt",{flow:"recovery_oauth",storedStateCode:a??"",returnedStateCode:i??""}),new r({code:"pkce_state_code_mismatch",error:"Unexpected auth flow. This may be a phishing attempt."});let c=await this._privyInternal.fetch(e,{body:{authorization_code:t,state_code:a,code_verifier:o}});return await Promise.all([this._storage.del(s),this._storage.del(h)]),c}constructor(t,e,r){this._privyInternal=t,this._storage=e,this._crypto=r}}export{c as default};
|
|
2
2
|
//# sourceMappingURL=RecoveryOAuthApi.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecoveryOAuthApi.mjs","sources":["../../../../src/client/recovery/RecoveryOAuthApi.ts"],"names":["RecoveryOAuthApi","generateURL","redirectURI","codeVerifier","createCodeVerifier","stateCode","createStateCode","codeChallenge","deriveCodeChallengeFromCodeVerifier","digest","this","_crypto","Promise","all","_storage","put","CODE_VERIFIER_KEY","STATE_CODE_KEY","_privyInternal","fetch","RecoveryOAuthInit","body","redirect_to","code_challenge","state_code","authorize","authorizationCode","returnedStateCode","storedStateCode","get","createAnalyticsEvent","flow","PrivyClientError","code","error","res","RecoveryOAuthAuthenticate","authorization_code","code_verifier","del","constructor","privyInternal","storage","crypto"],"mappings":"uTAcqBA,
|
|
1
|
+
{"version":3,"file":"RecoveryOAuthApi.mjs","sources":["../../../../src/client/recovery/RecoveryOAuthApi.ts"],"names":["RecoveryOAuthApi","generateURL","redirectURI","codeVerifier","createCodeVerifier","stateCode","createStateCode","codeChallenge","deriveCodeChallengeFromCodeVerifier","digest","this","_crypto","Promise","all","_storage","put","CODE_VERIFIER_KEY","STATE_CODE_KEY","_privyInternal","fetch","RecoveryOAuthInit","body","redirect_to","code_challenge","state_code","authorize","authorizationCode","returnedStateCode","storedStateCode","get","createAnalyticsEvent","flow","PrivyClientError","code","error","res","RecoveryOAuthAuthenticate","authorization_code","code_verifier","del","constructor","privyInternal","storage","crypto"],"mappings":"uTAcqBA,EA+BnB,iBAAaC,CAAYC,GACvB,IAAMC,EAAeC,IACfC,EAAYC,IACZC,QAAsBC,EAAoC,CAC9DL,aAAAA,EACAM,OAAQC,KAAKC,QAAQF,SAQvB,aALMG,QAAQC,IAAI,CAChBH,KAAKI,SAASC,IAAIC,EAAmBb,GACrCO,KAAKI,SAASC,IAAIE,EAAgBZ,KAG7BK,KAAKQ,eAAeC,MAAMC,EAAmB,CAClDC,KAAM,CACJC,YAAapB,EACbqB,eAAgBhB,EAChBiB,WAAYnB,IAGlB,CAQA,eAAaoB,CAAUC,EAA2BC,GAChD,IAAOxB,EAAcyB,SAAyBhB,QAAQC,IAAI,CACxDH,KAAKI,SAASe,IAAIb,GAClBN,KAAKI,SAASe,IAAIZ,KAGpB,GAAIW,IAAoBD,EAQtB,MANKjB,KAAKQ,eAAeY,qBAAqB,4BAA6B,CACzEC,KAAM,iBACNH,gBAAiBA,GAAmB,GACpCD,kBAAmBA,GAAqB,KAGpC,IAAIK,EAAiB,CACzBC,KAAM,2BACNC,MAAO,0DAIX,IAAMC,QAAYzB,KAAKQ,eAAeC,MAAMiB,EAA2B,CACrEf,KAAM,CACJgB,mBAAoBX,EACpBF,WAAYI,EACZU,cAAenC,KAMnB,aAFMS,QAAQC,IAAI,CAACH,KAAKI,SAASyB,IAAIvB,GAAoBN,KAAKI,SAASyB,IAAItB,KAEpEkB,CACT,CAvEA,WAAAK,CAAmBC,EAA8BC,EAAkBC,GACjEjC,KAAKQ,eAAiBuB,EACtB/B,KAAKI,SAAW4B,EAChBhC,KAAKC,QAAUgC,CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.mjs","sources":["../../../src/crypto/resolve.ts"],"names":["resolveCryptoFns","overrides","digest","alg","data","globalThis","crypto","subtle","randomUUID"],"mappings":"AAQO,SAASA,EAAiBC,GAC/B,MAAO,CACLC,OAAQD,GAAWC,UAAYC,EAAKC,IAASC,WAAWC,OAAOC,OAAOL,OAAOC,EAAKC,IAClFI,WAAYP,GAAWO,YAAAA,KAAqBH,WAAWC,OAAOE,cAElE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{PrivyClientError as e}from"../Error.mjs";import{getWalletPublicKeyFromTransaction as t}from"../solana/getWalletPublicKeyFromTransaction.mjs";import{isVersionedTransaction as r}from"../solana/isVersionedTransaction.mjs";import{isUnifiedWallet as a}from"../wallet-api/unified-wallet.mjs";import{errorIndicatesRecoveryIsNeeded as s}from"./errors.mjs";import{walletRpc as
|
|
1
|
+
import{PrivyClientError as e}from"../Error.mjs";import{getWalletPublicKeyFromTransaction as t}from"../solana/getWalletPublicKeyFromTransaction.mjs";import{isVersionedTransaction as r}from"../solana/isVersionedTransaction.mjs";import{isUnifiedWallet as a}from"../wallet-api/unified-wallet.mjs";import{errorIndicatesRecoveryIsNeeded as s}from"./errors.mjs";import{walletRpc as i}from"./stack/walletRpc.mjs";import"./types.mjs";import"../utils/encodings.mjs";import"../wallet-api/rpc.mjs";import"@privy-io/routes";import"../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"@privy-io/encoding";import"../wallet-api/types.mjs";import"./stack/wallet-api-eth-transaction.mjs";import"@privy-io/ethereum";import"./stack/wallet-api-eth-typed-data.mjs";class n{async request(t){if(!await this._privyInternal.getAccessTokenInternal())throw new e({error:"Missing access token",code:"attempted_rpc_call_before_logged_in"});switch(t.method){case"signAndSendTransaction":return await this.handleSignAndSendTransaction(t);case"signTransaction":return await this.handleSignTransaction(t);default:return await this.handleIFrameRpc(t)}}get _publicKey(){return this._account.address}async connectAndRecover(t){if("privy-v2"!==this._account.recovery_method)try{await this._proxy.connect({entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,accessToken:t})}catch(r){let a=s(r);if(a&&"privy"===this._account.recovery_method)await this._proxy.recover({entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,accessToken:t});else{if(!a||!this._onNeedsRecovery)throw r;{let t;await new Promise((async(r,a)=>{t=setTimeout((()=>a(new e({code:"embedded_wallet_recovery_error",error:"User-owned recovery timed out"}))),12e4),await(this._onNeedsRecovery?.({recoveryMethod:this._account.recovery_method,onRecovered:()=>r(!0)}))})).finally((()=>clearTimeout(t)))}}}}async signMessageRpc(e,t){let r=this._account;if(!a(r))return(await this._proxy.rpcWallet({accessToken:t,request:e,chainType:"solana",hdWalletIndex:this._account.wallet_index,entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier})).response.data;{let{data:a}=await i({context:{app:this._app,fetchPrivyRoute:(...e)=>this._privyInternal.fetch(...e),getCompiledPath:(...e)=>this._privyInternal.getPath(...e),signRequest:({message:e})=>this._proxy.signWithUserSigner({accessToken:t,message:e})},account:r,rpcRequest:{chainType:"solana",request:e}});return{signature:a}}}async handleIFrameRpc(t){try{let e=await this._privyInternal.getAccessTokenInternal();if(!e)throw Error("Missing privy token. User must be logged in");return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_started",{method:t.method,address:this._account.address}),await this.connectAndRecover(e),await this.signMessageRpc(t,e)}catch(r){console.error(r);let a=r instanceof Error?r.message:"Unable to make wallet request";throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_failed",{method:t.method,address:this._account.address,error:a}),new e({code:"embedded_wallet_request_error",error:a})}}async handleSignAndSendTransaction(a){try{let e=await this._privyInternal.getAccessTokenInternal();if(!e)throw Error("Missing privy token. User must be logged in");this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_started",{method:a.method,address:this._account.address}),await this.connectAndRecover(e);let{transaction:s,connection:i,options:n}=a.params,o=t(s,this._account.address),c=r(s)?Buffer.from(s.message.serialize()):s.serializeMessage(),{signature:d}=await this.signMessageRpc({method:"signMessage",params:{message:c.toString("base64")}},e);return s.addSignature(o,Buffer.from(d,"base64")),{signature:await i.sendRawTransaction(s.serialize(),n)}}catch(t){console.error(t);let r=t instanceof Error?t.message:"Unable to make wallet request";throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_failed",{method:a.method,address:this._account.address,error:r}),new e({code:"embedded_wallet_request_error",error:r})}}async handleSignTransaction(a){try{let e=await this._privyInternal.getAccessTokenInternal();if(!e)throw Error("Missing privy token. User must be logged in");this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_started",{method:a.method,address:this._account.address}),await this.connectAndRecover(e);let{transaction:s}=a.params,i=t(s,this._account.address),n=r(s)?Buffer.from(s.message.serialize()):s.serializeMessage(),{signature:o}=await this.signMessageRpc({method:"signMessage",params:{message:n.toString("base64")}},e);return s.addSignature(i,Buffer.from(o,"base64")),{signedTransaction:s}}catch(t){console.error(t);let r=t instanceof Error?t.message:"Unable to make wallet request";throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_failed",{method:a.method,address:this._account.wallet_index,error:r}),new e({code:"embedded_wallet_request_error",error:r})}}toJSON(){return`PrivyEmbeddedSolanaProvider { address: '${this._account.address}', request: [Function] }`}constructor({proxy:e,privyInternal:t,account:r,entropyId:a,entropyIdVerifier:s,onNeedsRecovery:i,app:n}){this._proxy=e,this._privyInternal=t,this._account=r,this._entropyId=a,this._entropyIdVerifier=s,this._onNeedsRecovery=i,this._app=n}}export{n as EmbeddedSolanaWalletProvider};
|
|
2
2
|
//# sourceMappingURL=EmbeddedSolanaWalletProvider.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmbeddedSolanaWalletProvider.mjs","sources":["../../../src/embedded/EmbeddedSolanaWalletProvider.ts"],"names":["EmbeddedSolanaWalletProvider","request","this","_privyInternal","getAccessTokenInternal","PrivyClientError","error","code","method","handleSignAndSendTransaction","handleSignTransaction","handleIFrameRpc","_publicKey","_account","address","connectAndRecover","token","recovery_method","_proxy","connect","entropyId","_entropyId","entropyIdVerifier","_entropyIdVerifier","accessToken","e","needsRecovery","errorIndicatesRecoveryIsNeeded","recover","_onNeedsRecovery","timeout","Promise","async","res","rej","setTimeout","recoveryMethod","onRecovered","finally","clearTimeout","signMessageRpc","account","isUnifiedWallet","rpcWallet","chainType","hdWalletIndex","wallet_index","response","data","walletRpc","context","app","_app","fetchPrivyRoute","args","fetch","getCompiledPath","getPath","signRequest","message","signWithUserSigner","rpcRequest","signature","Error","createAnalyticsEvent","console","transaction","tx","connection","options","params","walletPublicKey","getWalletPublicKeyFromTransaction","serializedMessage","isVersionedTransaction","Buffer","from","serialize","serializeMessage","toString","addSignature","sendRawTransaction","signedTransaction","toJSON","constructor","proxy","privyInternal","onNeedsRecovery"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EmbeddedSolanaWalletProvider.mjs","sources":["../../../src/embedded/EmbeddedSolanaWalletProvider.ts"],"names":["EmbeddedSolanaWalletProvider","request","this","_privyInternal","getAccessTokenInternal","PrivyClientError","error","code","method","handleSignAndSendTransaction","handleSignTransaction","handleIFrameRpc","_publicKey","_account","address","connectAndRecover","token","recovery_method","_proxy","connect","entropyId","_entropyId","entropyIdVerifier","_entropyIdVerifier","accessToken","e","needsRecovery","errorIndicatesRecoveryIsNeeded","recover","_onNeedsRecovery","timeout","Promise","async","res","rej","setTimeout","recoveryMethod","onRecovered","finally","clearTimeout","signMessageRpc","account","isUnifiedWallet","rpcWallet","chainType","hdWalletIndex","wallet_index","response","data","walletRpc","context","app","_app","fetchPrivyRoute","args","fetch","getCompiledPath","getPath","signRequest","message","signWithUserSigner","rpcRequest","signature","Error","createAnalyticsEvent","console","transaction","tx","connection","options","params","walletPublicKey","getWalletPublicKeyFromTransaction","serializedMessage","isVersionedTransaction","Buffer","from","serialize","serializeMessage","toString","addSignature","sendRawTransaction","signedTransaction","toJSON","constructor","proxy","privyInternal","onNeedsRecovery"],"mappings":"kwBA8EO,MAAMA,EA8DX,aAAMC,CAAQA,GAGZ,UAF0BC,KAAKC,eAAeC,yBAG5C,MAAM,IAAIC,EAAiB,CACzBC,MAAO,uBACPC,KAAM,wCAIV,OAAQN,EAAQO,QACd,IAAK,yBACH,aAAaN,KAAKO,6BAA6BR,GACjD,IAAK,kBACH,aAAaC,KAAKQ,sBAAsBT,GAC1C,QACE,aAAaC,KAAKS,gBAAgBV,GAExC,CAOA,cAAWW,GACT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SAASC,iCAAiC,CAzQnGsE,WAAAA,EACEC,MAAAA,EACAC,cAAAA,EACA7C,QAAAA,EACArB,UAAAA,EACAE,kBAAAA,EACAiE,gBAAAA,EACApC,IAAAA,IAEAjD,KAAKgB,OAASmE,EACdnF,KAAKC,eAAiBmF,EACtBpF,KAAKW,SAAW4B,EAChBvC,KAAKmB,WAAaD,EAClBlB,KAAKqB,mBAAqBD,EAC1BpB,KAAK2B,iBAAmB0D,EACxBrF,KAAKkD,KAAOD,CACd"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"eventemitter3";import{toHex as t}from"viem";import{toViemTransactionSerializable as r,STRING_TO_NUMBER_TXN_TYPE as a}from"@privy-io/ethereum";import{PrivyClientError as i}from"../Error.mjs";import{isUnifiedWallet as s}from"../wallet-api/unified-wallet.mjs";import{EmbeddedProviderError as n,errorIndicatesRecoveryIsNeeded as o}from"./errors.mjs";import{walletRpc as h}from"./stack/walletRpc.mjs";import{getPublicClient as c}from"./utils/index.mjs";import"./types.mjs";import"../utils/encodings.mjs";import"../wallet-api/rpc.mjs";import"@privy-io/routes";import"../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"@privy-io/encoding";import"../wallet-api/types.mjs";import"./stack/wallet-api-eth-transaction.mjs";import"./stack/wallet-api-eth-typed-data.mjs";let d=new Set(["eth_sign","personal_sign","eth_signTypedData_v4","csw_signUserOperation","secp256k1_sign"]);class p extends e{async request(e){if(d.has(e.method))return this.handleIFrameRpc(e);switch(e.method){case"eth_accounts":case"eth_requestAccounts":return this._account.address?[this._account.address]:[];case"eth_chainId":return`0x${this._chainId.toString(16)}`;case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(e);case"eth_estimateGas":return this.handleEstimateGas(e);case"eth_signTransaction":{let t=e.params?.[0];return this.handleSignTransaction(t)}case"eth_sendTransaction":{let t=e.params?.[0];return this.handleSendTransaction(t)}case"eth_populateTransactionRequest":{let t=e.params?.[0];return this.handlePopulateTransaction(t)}default:return this.handleJsonRpc(e)}}ensureChainId(e){let t={chainId:this._chainId,...e};return this.internalSwitchEthereumChain(t.chainId),t}internalSwitchEthereumChain(e){e&&Number(e)!==this._chainId&&(this._chainId=Number(e),this._client=c(this._chainId,this._chains,{rpcUrls:[]},{appId:this._privyInternal.appId}),this.emit("chainChanged",e))}async handlePopulateTransaction(e){let t=this.ensureChainId(e),i=r(t),{type:s,...n}=await this._client.prepareTransactionRequest({account:t.from??this._account.address,...i});return{...n,type:a[s]}}async handleSignTransaction(e){let r={...e};for(let e of Object.keys(r)){let a=r[e];a&&"bigint"==typeof a&&(r[e]=t(a))}return await this.handleIFrameRpc({method:"eth_signTransaction",params:[r]})}async handleSendTransaction(e){let t=await this.handlePopulateTransaction(e),r=await this.handleSignTransaction(t);return await this.handleJsonRpc({method:"eth_sendRawTransaction",params:[r]})}async handleEstimateGas(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for eth_estimateGas");let t=e.params?.[0],a=this.ensureChainId(t),i=r(a);return await this._client.estimateGas({account:a.from??this._account.address,...i})}handleSwitchEthereumChain(e){let t;if(!e.params||!Array.isArray(e.params))throw new n(`Invalid params for ${e.method}`,4200);if("string"==typeof e.params[0])t=e.params[0];else{if(!("chainId"in e.params[0])||"string"!=typeof e.params[0].chainId)throw new n(`Invalid params for ${e.method}`,4200);t=e.params[0].chainId}this.internalSwitchEthereumChain(t)}async handleIFrameRpc(e){try{let t=await this._privyInternal.getAccessTokenInternal();if(!t)throw Error("Missing privy token. User must be logged in");this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_started",{method:e.method,address:this._account.address});let r=this._account;if(s(r)){let{data:a}=await h({context:{app:this._appApi,fetchPrivyRoute:(...e)=>this._privyInternal.fetch(...e),getCompiledPath:(...e)=>this._privyInternal.getPath(...e),signRequest:({message:e})=>this._walletProxy.signWithUserSigner({accessToken:t,message:e})},account:r,rpcRequest:{chainType:"ethereum",request:e}});return a}try{await this._walletProxy.connect({entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,accessToken:t})}catch(e){let r=o(e);if(r&&"privy"===this._account.recovery_method)await this._walletProxy.recover({entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,accessToken:t});else{if(!r||!this._onNeedsRecovery)throw e;{let e;await new Promise((async(t,r)=>{e=setTimeout((()=>r(new i({code:"embedded_wallet_recovery_error",error:"User-owned recovery timed out"}))),12e4),await(this._onNeedsRecovery?.({recoveryMethod:this._account.recovery_method,onRecovered:()=>t(!0)}))})).finally((()=>clearTimeout(e)))}}}return(await this._walletProxy.rpcWallet({accessToken:t,request:e,entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,hdWalletIndex:this._account.wallet_index,chainType:"ethereum"})).response.data}catch(t){console.error(t);let r=t instanceof Error?t.message:"Unable to make wallet request";throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_failed",{method:e.method,address:this._account.address,error:r}),new i({code:"embedded_wallet_request_error",error:r})}}async handleJsonRpc(e){return this._client.request(e)}toJSON(){return`PrivyEIP1193Provider { address: '${this._account.address}', chainId: ${this._chainId}, request: [Function] }`}constructor({walletProxy:e,privyInternal:t,account:r,entropyId:a,entropyIdVerifier:i,chains:s,onNeedsRecovery:n,chainId:o=s[0].id,appApi:h}){super(),this._walletProxy=e,this._privyInternal=t,this._account=r,this._entropyId=a,this._entropyIdVerifier=i,this._chainId=o,this._chains=s,this._onNeedsRecovery=n,this._client=c(o,s,{rpcUrls:[]},{appId:h.appId}),this._appApi=h}}export{p as EmbeddedWalletProvider};
|
|
1
|
+
import e from"eventemitter3";import{toHex as t}from"viem";import{toViemTransactionSerializable as r,STRING_TO_NUMBER_TXN_TYPE as a}from"@privy-io/ethereum";import{PrivyClientError as i}from"../Error.mjs";import{isUnifiedWallet as s}from"../wallet-api/unified-wallet.mjs";import{EmbeddedProviderError as n,errorIndicatesRecoveryIsNeeded as o}from"./errors.mjs";import{walletRpc as h}from"./stack/walletRpc.mjs";import{getPublicClient as c}from"./utils/index.mjs";import"./types.mjs";import"../utils/encodings.mjs";import"../wallet-api/rpc.mjs";import"@privy-io/routes";import"../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"@privy-io/encoding";import"../wallet-api/types.mjs";import"./stack/wallet-api-eth-transaction.mjs";import"./stack/wallet-api-eth-typed-data.mjs";import"viem/chains";let d=new Set(["eth_sign","personal_sign","eth_signTypedData_v4","csw_signUserOperation","secp256k1_sign"]);class p extends e{async request(e){if(d.has(e.method))return this.handleIFrameRpc(e);switch(e.method){case"eth_accounts":case"eth_requestAccounts":return this._account.address?[this._account.address]:[];case"eth_chainId":return`0x${this._chainId.toString(16)}`;case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(e);case"eth_estimateGas":return this.handleEstimateGas(e);case"eth_signTransaction":{let t=e.params?.[0];return this.handleSignTransaction(t)}case"eth_sendTransaction":{let t=e.params?.[0];return this.handleSendTransaction(t)}case"eth_populateTransactionRequest":{let t=e.params?.[0];return this.handlePopulateTransaction(t)}default:return this.handleJsonRpc(e)}}ensureChainId(e){let t={chainId:this._chainId,...e};return this.internalSwitchEthereumChain(t.chainId),t}internalSwitchEthereumChain(e){e&&Number(e)!==this._chainId&&(this._chainId=Number(e),this._client=c(this._chainId,this._chains,{rpcUrls:[]},{appId:this._privyInternal.appId}),this.emit("chainChanged",e))}async handlePopulateTransaction(e){let t=this.ensureChainId(e),i=r(t),{type:s,...n}=await this._client.prepareTransactionRequest({account:t.from??this._account.address,...i});return{...n,type:a[s]}}async handleSignTransaction(e){let r={...e};for(let e of Object.keys(r)){let a=r[e];a&&"bigint"==typeof a&&(r[e]=t(a))}return await this.handleIFrameRpc({method:"eth_signTransaction",params:[r]})}async handleSendTransaction(e){let t=await this.handlePopulateTransaction(e),r=await this.handleSignTransaction(t);return await this.handleJsonRpc({method:"eth_sendRawTransaction",params:[r]})}async handleEstimateGas(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for eth_estimateGas");let t=e.params?.[0],a=this.ensureChainId(t),i=r(a);return await this._client.estimateGas({account:a.from??this._account.address,...i})}handleSwitchEthereumChain(e){let t;if(!e.params||!Array.isArray(e.params))throw new n(`Invalid params for ${e.method}`,4200);if("string"==typeof e.params[0])t=e.params[0];else{if(!("chainId"in e.params[0])||"string"!=typeof e.params[0].chainId)throw new n(`Invalid params for ${e.method}`,4200);t=e.params[0].chainId}this.internalSwitchEthereumChain(t)}async handleIFrameRpc(e){try{let t=await this._privyInternal.getAccessTokenInternal();if(!t)throw Error("Missing privy token. User must be logged in");this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_started",{method:e.method,address:this._account.address});let r=this._account;if(s(r)){let{data:a}=await h({context:{app:this._appApi,fetchPrivyRoute:(...e)=>this._privyInternal.fetch(...e),getCompiledPath:(...e)=>this._privyInternal.getPath(...e),signRequest:({message:e})=>this._walletProxy.signWithUserSigner({accessToken:t,message:e})},account:r,rpcRequest:{chainType:"ethereum",request:e}});return a}try{await this._walletProxy.connect({entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,accessToken:t})}catch(e){let r=o(e);if(r&&"privy"===this._account.recovery_method)await this._walletProxy.recover({entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,accessToken:t});else{if(!r||!this._onNeedsRecovery)throw e;{let e;await new Promise((async(t,r)=>{e=setTimeout((()=>r(new i({code:"embedded_wallet_recovery_error",error:"User-owned recovery timed out"}))),12e4),await(this._onNeedsRecovery?.({recoveryMethod:this._account.recovery_method,onRecovered:()=>t(!0)}))})).finally((()=>clearTimeout(e)))}}}return(await this._walletProxy.rpcWallet({accessToken:t,request:e,entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,hdWalletIndex:this._account.wallet_index,chainType:"ethereum"})).response.data}catch(t){console.error(t);let r=t instanceof Error?t.message:"Unable to make wallet request";throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_failed",{method:e.method,address:this._account.address,error:r}),new i({code:"embedded_wallet_request_error",error:r})}}async handleJsonRpc(e){return this._client.request(e)}toJSON(){return`PrivyEIP1193Provider { address: '${this._account.address}', chainId: ${this._chainId}, request: [Function] }`}constructor({walletProxy:e,privyInternal:t,account:r,entropyId:a,entropyIdVerifier:i,chains:s,onNeedsRecovery:n,chainId:o=s[0].id,appApi:h}){super(),this._walletProxy=e,this._privyInternal=t,this._account=r,this._entropyId=a,this._entropyIdVerifier=i,this._chainId=o,this._chains=s,this._onNeedsRecovery=n,this._client=c(o,s,{rpcUrls:[]},{appId:h.appId}),this._appApi=h}}export{p as EmbeddedWalletProvider};
|
|
2
2
|
//# sourceMappingURL=EmbeddedWalletProvider.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmbeddedWalletProvider.mjs","sources":["../../../src/embedded/EmbeddedWalletProvider.ts"],"names":["IFRAME_PASSTHROUGH_RPC_METHODS","Set","EmbeddedWalletProvider","EventEmitter","request","has","method","this","handleIFrameRpc","_account","address","_chainId","toString","handleSwitchEthereumChain","handleEstimateGas","data","params","handleSignTransaction","handleSendTransaction","handlePopulateTransaction","handleJsonRpc","ensureChainId","tx","ensureTxChainId","chainId","internalSwitchEthereumChain","Number","_client","getPublicClient","_chains","rpcUrls","appId","_privyInternal","emit","txRequest","viemTxn","toViemTransactionSerializable","type","preparedTxn","prepareTransactionRequest","account","from","STRING_TO_NUMBER_TXN_TYPE","serializable","key","Object","keys","val","toHex","populatedTx","signedTx","Array","isArray","Error","estimateGas","args","newChain","EmbeddedProviderError","token","getAccessTokenInternal","createAnalyticsEvent","isUnifiedWallet","walletRpc","context","app","_appApi","fetchPrivyRoute","fetch","getCompiledPath","getPath","signRequest","message","_walletProxy","signWithUserSigner","accessToken","rpcRequest","chainType","connect","entropyId","_entropyId","entropyIdVerifier","_entropyIdVerifier","e","needsRecovery","errorIndicatesRecoveryIsNeeded","recovery_method","recover","_onNeedsRecovery","timeout","Promise","async","res","rej","setTimeout","PrivyClientError","code","error","recoveryMethod","onRecovered","finally","clearTimeout","rpcWallet","hdWalletIndex","wallet_index","response","console","toJSON","constructor","walletProxy","privyInternal","chains","onNeedsRecovery","id","appApi","super"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EmbeddedWalletProvider.mjs","sources":["../../../src/embedded/EmbeddedWalletProvider.ts"],"names":["IFRAME_PASSTHROUGH_RPC_METHODS","Set","EmbeddedWalletProvider","EventEmitter","request","has","method","this","handleIFrameRpc","_account","address","_chainId","toString","handleSwitchEthereumChain","handleEstimateGas","data","params","handleSignTransaction","handleSendTransaction","handlePopulateTransaction","handleJsonRpc","ensureChainId","tx","ensureTxChainId","chainId","internalSwitchEthereumChain","Number","_client","getPublicClient","_chains","rpcUrls","appId","_privyInternal","emit","txRequest","viemTxn","toViemTransactionSerializable","type","preparedTxn","prepareTransactionRequest","account","from","STRING_TO_NUMBER_TXN_TYPE","serializable","key","Object","keys","val","toHex","populatedTx","signedTx","Array","isArray","Error","estimateGas","args","newChain","EmbeddedProviderError","token","getAccessTokenInternal","createAnalyticsEvent","isUnifiedWallet","walletRpc","context","app","_appApi","fetchPrivyRoute","fetch","getCompiledPath","getPath","signRequest","message","_walletProxy","signWithUserSigner","accessToken","rpcRequest","chainType","connect","entropyId","_entropyId","entropyIdVerifier","_entropyIdVerifier","e","needsRecovery","errorIndicatesRecoveryIsNeeded","recovery_method","recover","_onNeedsRecovery","timeout","Promise","async","res","rej","setTimeout","PrivyClientError","code","error","recoveryMethod","onRecovered","finally","clearTimeout","rpcWallet","hdWalletIndex","wallet_index","response","console","toJSON","constructor","walletProxy","privyInternal","chains","onNeedsRecovery","id","appApi","super"],"mappings":"ozBA0EA,IAAMA,EAAiC,IAAIC,IAAI,CAC7C,WACA,gBACA,uBACA,wBACA,mBAGK,MAAMC,UAA+BC,EAiD1C,aAAMC,CAAQA,GAGZ,GAAIJ,EAA+BK,IAAID,EAAQE,QAC7C,OAAOC,KAAKC,gBAAgBJ,GAG9B,OAAQA,EAAQE,QACd,IAAK,eACL,IAAK,sBACH,OAAOC,KAAKE,SAASC,QAAU,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,EAAUyB,aAAiB3C,MAAQ2C,EAAMzB,QAAU,gCAOzD,MANKhE,KAAKyB,eAAe4B,qBAAqB,iCAAkC,CAC9EtD,OAAQF,EAAQE,OAChBI,QAASH,KAAKE,SAASC,QACvBsF,MAAOzB,IAGH,IAAIuB,EAAiB,CAACC,KAAM,gCAAiCC,MAAOzB,GAC5E,CACF,CAEA,mBAAcnD,CAAchB,GAC1B,OAAOG,KAAKoB,QAAQvB,QAAQA,EAC9B,CAEAsG,MAAAA,GAEE,MAAO,oCAAoCnG,KAAKE,SAASC,sBAAsBH,KAAKI,iCACtF,CAvRAgG,WAAAA,EACEC,YAAAA,EACAC,cAAAA,EACArE,QAAAA,EACAsC,UAAAA,EACAE,kBAAAA,EACA8B,OAAAA,EACAC,gBAAAA,EACAvF,QAAAA,EAAUsF,EAAO,GAAGE,GACpBC,OAAAA,IAEAC,QACA3G,KAAKiE,aAAeoC,EACpBrG,KAAKyB,eAAiB6E,EACtBtG,KAAKE,SAAW+B,EAChBjC,KAAKwE,WAAaD,EAClBvE,KAAK0E,mBAAqBD,EAC1BzE,KAAKI,SAAWa,EAChBjB,KAAKsB,QAAUiF,EACfvG,KAAKgF,iBAAmBwB,EACxBxG,KAAKoB,QAAUC,EAAgBJ,EAASsF,EAAQ,CAAChF,QAAS,IAAK,CAACC,MAAOkF,EAAOlF,QAC9ExB,KAAK0D,QAAUgD,CACjB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{EmbeddedWalletProvider}from"./EmbeddedWalletProvider.mjs";export{EmbeddedSolanaWalletProvider}from"./EmbeddedSolanaWalletProvider.mjs";export{EmbeddedWalletProxy}from"./EmbeddedWalletProxy.mjs";import"eventemitter3";import"viem";import"@privy-io/ethereum";import"../Error.mjs";import"../wallet-api/unified-wallet.mjs";import"./errors.mjs";import"./types.mjs";import"./stack/walletRpc.mjs";import"../utils/encodings.mjs";import"../wallet-api/rpc.mjs";import"@privy-io/routes";import"../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"@privy-io/encoding";import"../wallet-api/types.mjs";import"./stack/wallet-api-eth-transaction.mjs";import"./stack/wallet-api-eth-typed-data.mjs";import"./utils/index.mjs";import"../solana/getWalletPublicKeyFromTransaction.mjs";import"../solana/isVersionedTransaction.mjs";import"../utils/sleep.mjs";import"./EventCallbackQueue.mjs";import"./withMfa.mjs";
|
|
1
|
+
export{EmbeddedWalletProvider}from"./EmbeddedWalletProvider.mjs";export{EmbeddedSolanaWalletProvider}from"./EmbeddedSolanaWalletProvider.mjs";export{EmbeddedWalletProxy}from"./EmbeddedWalletProxy.mjs";import"eventemitter3";import"viem";import"@privy-io/ethereum";import"../Error.mjs";import"../wallet-api/unified-wallet.mjs";import"./errors.mjs";import"./types.mjs";import"./stack/walletRpc.mjs";import"../utils/encodings.mjs";import"../wallet-api/rpc.mjs";import"@privy-io/routes";import"../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"@privy-io/encoding";import"../wallet-api/types.mjs";import"./stack/wallet-api-eth-transaction.mjs";import"./stack/wallet-api-eth-typed-data.mjs";import"./utils/index.mjs";import"viem/chains";import"../solana/getWalletPublicKeyFromTransaction.mjs";import"../solana/isVersionedTransaction.mjs";import"../utils/sleep.mjs";import"./EventCallbackQueue.mjs";import"./withMfa.mjs";
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{TEMPO_TXN_TYPE_NUMBER as e,isTempoTransactionRequest as r}from"@privy-io/ethereum";import{isHexEncoded as i,bytesToHex as t,utf8ToBytes as a}from"../../utils/encodings.mjs";function o(o){return r(o)?{type:e,from:o.from,chain_id:n(o.chainId),nonce:n(o.nonce),nonce_key:n(o.nonceKey),gas_limit:n(o.gasLimit),max_fee_per_gas:n(o.maxFeePerGas),max_priority_fee_per_gas:n(o.maxPriorityFeePerGas),fee_token:o.feeToken,valid_after:n(o.validAfter),valid_before:n(o.validBefore),calls:o.calls.map((e=>({to:e.to,data:e.data,value:n(e.value)})))}:{from:o.from,to:o.to??void 0,nonce:n(o.nonce),chain_id:n(o.chainId),data:function(e){if(void 0!==e)return"string"==typeof e?i(e)?e:t(a(e)):t(Buffer.from(Uint8Array.from(e)))}(o.data),value:n(o.value),type:o.type,gas_limit:n(o.gasLimit),gas_price:n(o.gasPrice),max_fee_per_gas:n(o.maxFeePerGas),max_priority_fee_per_gas:n(o.maxPriorityFeePerGas)}}function n(e){if("number"==typeof e||"bigint"==typeof e){return`0x${BigInt(e).toString(16)}`}if("string"==typeof e){if(i(e))return e;if(!/^\d+$/.test(e))throw Error(`Invalid quantity string: must be hex (0x…) or decimal: ${e}`);return t(a(e))}}export{o as toWalletApiUnsignedEthTransaction};
|
|
2
2
|
//# sourceMappingURL=wallet-api-eth-transaction.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet-api-eth-transaction.mjs","sources":["../../../../src/embedded/stack/wallet-api-eth-transaction.ts"],"names":["toWalletApiUnsignedEthTransaction","transaction","from","
|
|
1
|
+
{"version":3,"file":"wallet-api-eth-transaction.mjs","sources":["../../../../src/embedded/stack/wallet-api-eth-transaction.ts"],"names":["toWalletApiUnsignedEthTransaction","transaction","isTempoTransactionRequest","type","TEMPO_TXN_TYPE_NUMBER","from","chain_id","quantityToHex","chainId","nonce","nonce_key","nonceKey","gas_limit","gasLimit","max_fee_per_gas","maxFeePerGas","max_priority_fee_per_gas","maxPriorityFeePerGas","fee_token","feeToken","valid_after","validAfter","valid_before","validBefore","calls","map","e","call","to","data","value","undefined","encodeTransactionData","isHexEncoded","bytesToHex","utf8ToBytes","Buffer","Uint8Array","gas_price","gasPrice","val","BigInt","toString","test","Error"],"mappings":"oLAoBO,SAASA,EACdC,GAAqF,OAEjFC,EAA0BD,GA2BvB,CACLE,KAAMC,EACNC,KAAMJ,EAAYI,KAClBC,SAAUC,EA7BiCN,EA6BPO,SACpCC,MAAOF,EAAcN,EAAYQ,OACjCC,UAAWH,EAAcN,EAA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alletApiUnsignedEthTransaction as
|
|
1
|
+
import{isHexEncoded as e,bytesToHex as t,utf8ToBytes as a}from"../../utils/encodings.mjs";import{rpc as s}from"../../wallet-api/rpc.mjs";import{toWalletApiUnsignedEthTransaction as i}from"./wallet-api-eth-transaction.mjs";import{toWalletApiTypedData as r}from"./wallet-api-eth-typed-data.mjs";import"@privy-io/routes";import"../../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"@privy-io/encoding";import"../../Error.mjs";import"../../wallet-api/types.mjs";import"@privy-io/ethereum";async function n({context:n,account:o,rpcRequest:c}){switch(c.chainType){case"ethereum":return async function({context:n,account:o,rpcRequest:c}){switch(c.method){case"personal_sign":{let[e]=c.params,t=await s(n,n.signRequest,{chain_type:"ethereum",method:"personal_sign",wallet_id:o.id,params:e.startsWith("0x")?{message:e.slice(2),encoding:"hex"}:{message:e,encoding:"utf-8"}});if("personal_sign"!==t.method)throw Error("Unable to sign message");return{data:t.data.signature}}case"eth_signTransaction":{let[e]=c.params,t=await s(n,n.signRequest,{chain_type:"ethereum",method:"eth_signTransaction",wallet_id:o.id,params:{transaction:i(e)}});if("eth_signTransaction"!==t.method)throw Error("Unable to sign transaction");return{data:t.data.signed_transaction}}case"eth_signTypedData_v4":{let[,e]=c.params,t=await s(n,n.signRequest,{chain_type:"ethereum",method:c.method,wallet_id:o.id,params:{typed_data:r(e)}});if("eth_signTypedData_v4"!==t.method)throw Error("Unable to sign typed data");return{data:t.data.signature}}case"eth_sign":{let[,i]=c.params,r=await s(n,n.signRequest,{chain_type:"ethereum",method:"secp256k1_sign",wallet_id:o.id,params:{hash:e(i)?i:t(a(i))}});if("secp256k1_sign"!==r.method)throw Error("Unable to sign message");return{data:r.data.signature}}case"secp256k1_sign":{let[i]=c.params,r=await s(n,n.signRequest,{chain_type:"ethereum",method:"secp256k1_sign",wallet_id:o.id,params:{hash:e(i)?i:t(a(i))}});if("secp256k1_sign"!==r.method)throw Error("Unable to sign message");return{data:r.data.signature}}case"csw_signUserOperation":case"eth_sendTransaction":case"eth_populateTransactionRequest":throw Error(`This wallet does not support the method: ${c.method}`)}}({context:n,account:o,rpcRequest:c.request});case"solana":return async function({context:e,account:t,rpcRequest:a}){if("signMessage"===a.method){let{message:i}=a.params,r=await s(e,e.signRequest,{chain_type:"solana",method:"signMessage",wallet_id:t.id,params:{message:i,encoding:"base64"}});if("signMessage"!==r.method)throw Error("Unable to sign message");return{data:r.data.signature}}}({context:n,account:o,rpcRequest:c.request})}}export{n as walletRpc};
|
|
2
2
|
//# sourceMappingURL=walletRpc.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walletRpc.mjs","sources":["../../../../src/embedded/stack/walletRpc.ts"],"names":["async","walletRpc","context","account","rpcRequest","chainType","method","message","params","response","walletApiRpc","signRequest","chain_type","wallet_id","id","startsWith","slice","encoding","Error","data","signature","transactionRequest","transaction","toWalletApiUnsignedEthTransaction","signed_transaction","typedData","typed_data","toWalletApiTypedData","hash","isHexEncoded","bytesToHex","utf8ToBytes","ethereumWalletRpc","request","messageBase64","solanaWalletRpc"],"mappings":"
|
|
1
|
+
{"version":3,"file":"walletRpc.mjs","sources":["../../../../src/embedded/stack/walletRpc.ts"],"names":["async","walletRpc","context","account","rpcRequest","chainType","method","message","params","response","walletApiRpc","signRequest","chain_type","wallet_id","id","startsWith","slice","encoding","Error","data","signature","transactionRequest","transaction","toWalletApiUnsignedEthTransaction","signed_transaction","typedData","typed_data","toWalletApiTypedData","hash","isHexEncoded","bytesToHex","utf8ToBytes","ethereumWalletRpc","request","messageBase64","solanaWalletRpc"],"mappings":"kgBA+BOA,eAAeC,GACpBC,QAAAA,EACAC,QAAAA,EACAC,WAAAA,IAEA,OAAQA,EAAWC,WACjB,IAAK,WACH,OAYNL,gBACEE,QAAAA,EACAC,QAAAA,EACAC,WAAAA,IAEA,OAAQA,EAAWE,QACjB,IAAK,gBAAiB,CACpB,IAAOC,GAAWH,EAAWI,OACvBC,QAAiBC,EAAaR,EAASA,EAA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AQ,iBACRO,UAAWV,EAAQW,GACnBN,OAAQ,CACNoB,KAAMC,EAAatB,GAAWA,EAAUuB,EAAWC,EAAYxB,OAInE,GAAIE,mBAAAA,EAASH,OACX,MAAMY,MAAU,0BAGlB,MAAO,CAACC,KAAMV,EAASU,KAAKC,UAC9B,CACA,IAAK,wBACL,IAAK,sBACL,IAAK,iCACH,MAAMF,MAAU,4CAA4Cd,EAAWE,UAE7E,CA5Ga0B,CAAkB,CAAC9B,QAAAA,EAASC,QAAAA,EAASC,WAAYA,EAAW6B,UACrE,IAAK,SACH,OAkHNjC,gBACEE,QAAAA,EACAC,QAAAA,EACAC,WAAAA,IAEA,GACO,gBADCA,EAAWE,OACG,CAClB,IAAOC,QAAS2B,GAAiB9B,EAAWI,OAEtCC,QAAiBC,EAAaR,EAASA,EAAQS,YAAa,CAChEC,WAAY,SACZN,OAAQ,cACRO,UAAWV,EAAQW,GACnBN,OAAQ,CAACD,QAAS2B,EAAejB,SAAU,YAG7C,GAAIR,gBAAAA,EAASH,OACX,MAAMY,MAAU,0BAGlB,MAAO,CAACC,KAAMV,EAASU,KAAKC,UAC9B,CAEJ,CAzIae,CAAgB,CAACjC,QAAAA,EAASC,QAAAA,EAASC,WAAYA,EAAW6B,UAEvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","sources":["../../../src/embedded/types.ts"],"names":["SUPPORTED_JSON_RPC_METHODS","isSupportedRpcMethod","method","includes","SUPPORTED_SOLANA_RPC_METHODS","isSupportedSolanaRpcMethod","t","PrivyIframeErrorTypes"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.mjs","sources":["../../../src/embedded/types.ts"],"names":["SUPPORTED_JSON_RPC_METHODS","isSupportedRpcMethod","method","includes","SUPPORTED_SOLANA_RPC_METHODS","isSupportedSolanaRpcMethod","t","PrivyIframeErrorTypes"],"mappings":"AA2BO,MAAMA,EAA6B,CACxC,WACA,iCACA,sBACA,gBACA,uBACA,wBACA,kBAIWC,EAAwBC,GAC5BF,EAA2BG,SAASD,GA4N7C,IAAME,EAA+B,CAAC,eAG/B,MAAMC,EAA6BC,GACjCF,EAA6BD,SAASD,GAoxBlCK,EAAwB,CACnC,QACA,4BACA,uBACA,uBACA,qBACA,cACA,yBACA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createPublicClient as r,http as e}from"viem";import{
|
|
1
|
+
import{createPublicClient as r,http as e}from"viem";import{tempo as t,tempoModerato as p}from"viem/chains";import{PrivyConnectorError as i}from"../errors.mjs";import"../types.mjs";const o=(t,p,o,c)=>{let s=Number(t),n=p.find((r=>r.id===s));if(!n)throw new i(`Unsupported chainId ${t}`,4901);return r({transport:e(l(n,o,c.appId)),chain:n})},c=(o,c,s,n)=>{let d=Number(o),a=d===t.id?t:d===p.id?p:void 0;if(!a)throw new i(`Not a Tempo chainId: ${o}`,4901);let h=c.find((r=>r.id===d));return r({transport:e(h?l(h,s,n.appId):a.rpcUrls.default.http[0]),chain:a})},l=(r,e,t)=>{let p,o=r.id,c=Number(r.id);if(r.rpcUrls.privyWalletOverride&&r.rpcUrls.privyWalletOverride.http[0])p=r.rpcUrls.privyWalletOverride.http[0];else if(e.rpcUrls&&e.rpcUrls[c])p=e.rpcUrls[c];else if(r.rpcUrls.privy?.http[0]){let e=new URL(r.rpcUrls.privy.http[0]);e.searchParams.append("privyAppId",t),p=e.toString()}else p=r.rpcUrls.public?.http[0]?r.rpcUrls.public.http[0]:r.rpcUrls.default?.http[0];if(!p)throw new i(`No RPC url found for ${o}`);return p};function s({currentRecoveryMethod:r,upgradeToRecoveryMethod:e}){switch(r){case"privy":case"user-passcode":case"recovery-encryption-key":return!0;case"icloud":case"google-drive":if(r===e)throw Error("Cannot upgrade to the existing cloud platform");return!0;default:throw Error("Unknown recovery method")}}export{l as getJsonRpcEndpointFromChain,o as getPublicClient,c as getTempoPublicClient,s as throwIfInvalidRecoveryUpgradePath};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../src/embedded/utils/index.ts"],"names":["getPublicClient","chainId","chains","rpcConfig","options","chainIdInt","Number","chain","find","r","id","PrivyConnectorError","createPublicClient","transport","http","getJsonRpcEndpointFromChain","appId","
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../src/embedded/utils/index.ts"],"names":["getPublicClient","chainId","chains","rpcConfig","options","chainIdInt","Number","chain","find","r","id","PrivyConnectorError","createPublicClient","transport","http","getJsonRpcEndpointFromChain","appId","getTempoPublicClient","tempoChain","tempo","tempoModerato","undefined","privyChain","rpcUrls","default","privyAppId","rpcUrl","privyWalletOverride","privy","tempUrl","URL","searchParams","append","toString","public","throwIfInvalidRecoveryUpgradePath","currentRecoveryMethod","upgradeToRecoveryMethod","Error"],"mappings":"0LAaaA,EAAkB,CAC7BC,EACAC,EACAC,EACAC,KAEA,IAAMC,EAAaC,OAAOL,GACpBM,EAAQL,EAAOM,MAAKC,GAAWF,EAAMG,KAAOL,IAClD,IAAKE,EACH,MAAM,IAAII,EAAoB,uBAAuBV,IAAW,MAIlE,OAAOW,EAA6D,CAClEC,UAAWC,EAFDC,EAA4BR,EAAOJ,EAAWC,EAAQY,QAGhET,MAAAA,GACF,EAgCWU,EAAuB,CAClChB,EACAC,EACAC,EACAC,KAEA,IAAMC,EAAaC,OAAOL,GACpBiB,EACJb,IAAec,EAAMT,GAAKS,EAAQd,IAAee,EAAcV,GAAKU,OAAgBC,EACtF,IAAKH,EACH,MAAM,IAAIP,EAAoB,wBAAwBV,IAAW,MAGnE,IAAMqB,EAAapB,EAAOM,MAAMD,GAAUA,EAAMG,KAAOL,IAKvD,OAAOO,EAAmB,CACxBC,UAAWC,EALDQ,EACRP,EAA4BO,EAAYnB,EAAWC,EAAQY,OAC3DE,EAAWK,QAAQC,QAAQV,KAAK,IAIlCP,MAAOW,GACT,EAQWH,EAA8B,CACzCR,EACAJ,EACAsB,KAAAA,IAKIC,EAHEzB,EAAUM,EAAMG,GAChBL,EAAaC,OAAOC,EAAMG,IAGhC,GAAIH,EAAMgB,QAAQI,qBAAuBpB,EAAMgB,QAAQI,oBAAoBb,KAAK,GAC9EY,EAASnB,EAAMgB,QAAQI,oBAAoBb,KAAK,QAC3C,GAAIX,EAAUoB,SAAWpB,EAAUoB,QAAQlB,GAChDqB,EAASvB,EAAUoB,QAAQlB,QACtB,GAAIE,EAAMgB,QAAQK,OAAUd,KAAK,GAAI,CAC1C,IAAMe,EAAU,IAAIC,IAAIvB,EAAMgB,QAAQK,MAASd,KAAK,IACpDe,EAAQE,aAAaC,OAAO,aAAcP,GAC1CC,EAASG,EAAQI,UACnB,MACEP,EADSnB,EAAMgB,QAAQW,QAAWpB,KAAK,GAC9BP,EAAMgB,QAAQW,OAAUpB,KAAK,GAE7BP,EAAMgB,QAAQC,SAAYV,KAAK,GAG1C,IAAKY,EACH,MAAM,IAAIf,EAAoB,wBAAwBV,KAExD,OAAOyB,GASF,SAASS,GACdC,sBAAAA,EACAC,wBAAAA,IAKA,OAAQD,GAIN,IAAK,QACL,IAAK,gBACL,IAAK,0BACH,OAAO,EAET,IAAK,SACL,IAAK,eACH,GAAIA,IAA0BC,EAC5B,MAAMC,MAAU,iDAElB,OAAO,EACT,QACE,MAAMA,MAAU,2BAEtB"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"./client/Privy.mjs";export{LocalStorage}from"./storage/LocalStorage.mjs";export{InMemoryCache}from"./storage/InMemoryStorage.mjs";export{MoonpayApiError,PrivyApiError,PrivyClientError,createErrorFormatter,errorIndicatesMfaCanceled}from"./Error.mjs";export{EmbeddedProviderError,PrivyConnectorError,PrivyEmbeddedWalletErrorCode,PrivyProviderRpcError,ProviderErrors,errorIndicatesMaxMfaRetries,errorIndicatesMfaRateLimit,errorIndicatesMfaTimeout,errorIndicatesMfaVerificationFailed,errorIndicatesRecoveryIsNeeded}from"./embedded/errors.mjs";export{getUserEmbeddedEthereumWallet,getUserEmbeddedWallet}from"./utils/getUserEmbeddedEthereumWallet.mjs";export{getAllUserEmbeddedEthereumWallets}from"./utils/getAllUserEmbeddedEthereumWallets.mjs";export{getAllUserEmbeddedSolanaWallets}from"./utils/getAllUserEmbeddedSolanaWallets.mjs";export{getAllUserEmbeddedBitcoinWallets}from"./utils/getAllUserEmbeddedBitcoinWallets.mjs";export{isEmbeddedWalletAccount}from"./utils/embedded-wallets.mjs";export{getEntropyDetailsFromAccount,getEntropyDetailsFromUser}from"./utils/entropy.mjs";export{getUserSmartWallet}from"./utils/getUserSmartWallet.mjs";export{getJsonRpcEndpointFromChain,throwIfInvalidRecoveryUpgradePath}from"./embedded/utils/index.mjs";export{countryCodesAndNumbers,formatPhoneNumber,getPhoneCountryCodeAndNumber,getPlaceholderPhoneNumber,lastFourDigits,phoneNumberTypingFormatter,validatePhoneNumber}from"./utils/phoneNumberUtils.mjs";export{getUserEmbeddedSolanaWallet}from"./utils/getUserEmbeddedSolanaWallet.mjs";export{toObjectKeys}from"./utils/toObjectKeys.mjs";export{SolanaUsdcAddressMap,UsdcAddressMap,getIsTokenUsdc}from"./utils/getIsTokenUsdc.mjs";export{generateWalletIdempotencyKey}from"./utils/generateWalletIdempotencyKey.mjs";export{chainToMoonpayCurrency,fundingMethodToMoonpayPaymentMethod,isSupportedChainIdForMoonpay}from"./funding/moonpay.mjs";export{getCoinbaseOnRampUrl,isSupportedChainIdForCoinbaseOnramp,toCoinbaseAssetId,toCoinbaseBlockchainFromChainId}from"./funding/coinbase.mjs";export{SolanaClient}from"./solana/client.mjs";export{createSiwsMessage}from"./solana/createSiwsMessage.mjs";export{getSolanaRpcEndpointForCluster}from"./solana/getSolanaRpcEndpointForCluster.mjs";export{getSolanaUsdcMintAddressForCluster}from"./solana/getSolanaUsdcMintAddressForCluster.mjs";export{getSolanaClusterDisplayName}from"./solana/getSolanaClusterDisplayName.mjs";export{ALL_WALLET_CLIENT_TYPES,SUPPORTED_CONNECTOR_TYPES}from"./types.mjs";export*from"@privy-io/chains";export{formatLamportsAmount,formatTokenAmount,formatWalletAddress,formatWeiAmount}from"./utils/formatters.mjs";export{generateAuthorizationSignature}from"./wallet-api/generate-authorization-signature.mjs";export{create}from"./wallet-api/create.mjs";export{rpc}from"./wallet-api/rpc.mjs";export{rawSign}from"./wallet-api/raw-sign.mjs";export{getWallet}from"./wallet-api/get-wallet.mjs";export{updateWallet}from"./wallet-api/update-wallet.mjs";export{isUnifiedWallet}from"./wallet-api/unified-wallet.mjs";export{addSessionSigners,removeSessionSigners}from"./embedded/stack/session-signers.mjs";export{ConnectedStandardSolanaWallet}from"./solana/ConnectedStandardSolanaWallet.mjs";export{i as crossApp}from"./index-Bu3ySxLM.mjs";export{i as delegatedActions}from"./index-g0cxoRWQ.mjs";export{getCountryCallingCode}from"libphonenumber-js/min";import"./client/AppApi.mjs";import"@privy-io/routes";import"./client/CrossAppApi.mjs";import"./Token.mjs";import"jose";import"./client/DelegatedWalletsApi.mjs";import"./client/EmbeddedWalletApi.mjs";import"./embedded/EmbeddedBitcoinWalletProvider.mjs";import"./embedded/stack/walletCreate.mjs";import"./embedded/EmbeddedWalletProxy.mjs";import"./utils/sleep.mjs";import"./embedded/EventCallbackQueue.mjs";import"./embedded/withMfa.mjs";import"./embedded/EmbeddedWalletProvider.mjs";import"eventemitter3";import"viem";import"@privy-io/ethereum";import"./embedded/stack/walletRpc.mjs";import"./utils/encodings.mjs";import"./embedded/stack/wallet-api-eth-transaction.mjs";import"./embedded/stack/wallet-api-eth-typed-data.mjs";import"./embedded/EmbeddedSolanaWalletProvider.mjs";import"./solana/getWalletPublicKeyFromTransaction.mjs";import"./solana/isVersionedTransaction.mjs";import"./client/MfaPromises.mjs";import"./client/PrivyInternal.mjs";import"fetch-retry";import"
|
|
1
|
+
import e from"./client/Privy.mjs";export{LocalStorage}from"./storage/LocalStorage.mjs";export{InMemoryCache}from"./storage/InMemoryStorage.mjs";export{MoonpayApiError,PrivyApiError,PrivyClientError,createErrorFormatter,errorIndicatesMfaCanceled}from"./Error.mjs";export{EmbeddedProviderError,PrivyConnectorError,PrivyEmbeddedWalletErrorCode,PrivyProviderRpcError,ProviderErrors,errorIndicatesMaxMfaRetries,errorIndicatesMfaRateLimit,errorIndicatesMfaTimeout,errorIndicatesMfaVerificationFailed,errorIndicatesRecoveryIsNeeded}from"./embedded/errors.mjs";export{getUserEmbeddedEthereumWallet,getUserEmbeddedWallet}from"./utils/getUserEmbeddedEthereumWallet.mjs";export{getAllUserEmbeddedEthereumWallets}from"./utils/getAllUserEmbeddedEthereumWallets.mjs";export{getAllUserEmbeddedSolanaWallets}from"./utils/getAllUserEmbeddedSolanaWallets.mjs";export{getAllUserEmbeddedBitcoinWallets}from"./utils/getAllUserEmbeddedBitcoinWallets.mjs";export{isEmbeddedWalletAccount}from"./utils/embedded-wallets.mjs";export{getEntropyDetailsFromAccount,getEntropyDetailsFromUser}from"./utils/entropy.mjs";export{getUserSmartWallet}from"./utils/getUserSmartWallet.mjs";export{getJsonRpcEndpointFromChain,throwIfInvalidRecoveryUpgradePath}from"./embedded/utils/index.mjs";export{countryCodesAndNumbers,formatPhoneNumber,getPhoneCountryCodeAndNumber,getPlaceholderPhoneNumber,lastFourDigits,phoneNumberTypingFormatter,validatePhoneNumber}from"./utils/phoneNumberUtils.mjs";export{getUserEmbeddedSolanaWallet}from"./utils/getUserEmbeddedSolanaWallet.mjs";export{toObjectKeys}from"./utils/toObjectKeys.mjs";export{SolanaUsdcAddressMap,UsdcAddressMap,getIsTokenUsdc}from"./utils/getIsTokenUsdc.mjs";export{generateWalletIdempotencyKey}from"./utils/generateWalletIdempotencyKey.mjs";export{chainToMoonpayCurrency,fundingMethodToMoonpayPaymentMethod,isSupportedChainIdForMoonpay}from"./funding/moonpay.mjs";export{getCoinbaseOnRampUrl,isSupportedChainIdForCoinbaseOnramp,toCoinbaseAssetId,toCoinbaseBlockchainFromChainId}from"./funding/coinbase.mjs";export{SolanaClient}from"./solana/client.mjs";export{createSiwsMessage}from"./solana/createSiwsMessage.mjs";export{getSolanaRpcEndpointForCluster}from"./solana/getSolanaRpcEndpointForCluster.mjs";export{getSolanaUsdcMintAddressForCluster}from"./solana/getSolanaUsdcMintAddressForCluster.mjs";export{getSolanaClusterDisplayName}from"./solana/getSolanaClusterDisplayName.mjs";export{ALL_WALLET_CLIENT_TYPES,SUPPORTED_CONNECTOR_TYPES}from"./types.mjs";export*from"@privy-io/chains";export{formatLamportsAmount,formatTokenAmount,formatWalletAddress,formatWeiAmount}from"./utils/formatters.mjs";export{generateAuthorizationSignature}from"./wallet-api/generate-authorization-signature.mjs";export{create}from"./wallet-api/create.mjs";export{rpc}from"./wallet-api/rpc.mjs";export{rawSign}from"./wallet-api/raw-sign.mjs";export{getWallet}from"./wallet-api/get-wallet.mjs";export{updateWallet}from"./wallet-api/update-wallet.mjs";export{isUnifiedWallet}from"./wallet-api/unified-wallet.mjs";export{addSessionSigners,removeSessionSigners}from"./embedded/stack/session-signers.mjs";export{ConnectedStandardSolanaWallet}from"./solana/ConnectedStandardSolanaWallet.mjs";export{i as crossApp}from"./index-Bu3ySxLM.mjs";export{i as delegatedActions}from"./index-g0cxoRWQ.mjs";export{getCountryCallingCode}from"libphonenumber-js/min";import"./crypto/resolve.mjs";import"./client/AppApi.mjs";import"@privy-io/routes";import"./client/CrossAppApi.mjs";import"./Token.mjs";import"jose";import"./client/DelegatedWalletsApi.mjs";import"./client/EmbeddedWalletApi.mjs";import"./embedded/EmbeddedBitcoinWalletProvider.mjs";import"./embedded/stack/walletCreate.mjs";import"./embedded/EmbeddedWalletProxy.mjs";import"./utils/sleep.mjs";import"./embedded/EventCallbackQueue.mjs";import"./embedded/withMfa.mjs";import"./embedded/EmbeddedWalletProvider.mjs";import"eventemitter3";import"viem";import"@privy-io/ethereum";import"./embedded/stack/walletRpc.mjs";import"./utils/encodings.mjs";import"./embedded/stack/wallet-api-eth-transaction.mjs";import"./embedded/stack/wallet-api-eth-typed-data.mjs";import"./embedded/EmbeddedSolanaWalletProvider.mjs";import"./solana/getWalletPublicKeyFromTransaction.mjs";import"./solana/isVersionedTransaction.mjs";import"./client/MfaPromises.mjs";import"./client/PrivyInternal.mjs";import"fetch-retry";import"@privy-io/api-base";import"./Session.mjs";import"js-cookie";import"./utils/allSettled.mjs";import"./toAbortSignalTimeout.mjs";import"./utils/toSearchParams.mjs";import"./client/logger.mjs";import"./utils/noop.mjs";import"./client/UserApi.mjs";import"./client/auth/AuthApi.mjs";import"./client/auth/CustomProviderApi.mjs";import"./client/auth/maybeCreateWalletOnLogin.mjs";import"./utils/shouldCreateEmbeddedEthWallet.mjs";import"./utils/shouldCreateEmbeddedSolWallet.mjs";import"./client/auth/EmailApi.mjs";import"./client/auth/FarcasterApi.mjs";import"./client/auth/FarcasterV2Api.mjs";import"./client/auth/GuestApi.mjs";import"./client/auth/OAuthApi.mjs";import"./pkce.mjs";import"./client/auth/PasskeyApi.mjs";import"./client/auth/PhoneApi.mjs";import"./client/auth/SiweApi.mjs";import"./client/auth/SiwsApi.mjs";import"./client/auth/SmartWalletApi.mjs";import"./client/funding/FundingApi.mjs";import"./client/funding/CoinbaseOnRampApi.mjs";import"./client/funding/MoonpayOnRampApi.mjs";import"./client/mfa/MfaApi.mjs";import"./client/mfa/MfaPasskeyApi.mjs";import"./client/mfa/MfaSmsApi.mjs";import"./client/recovery/RecoveryApi.mjs";import"./client/recovery/RecoveryICloudApi.mjs";import"./client/recovery/RecoveryOAuthApi.mjs";import"./embedded/types.mjs";import"viem/chains";import"libphonenumber-js/examples.mobile.json";import"canonicalize";import"@privy-io/encoding";import"./wallet-api/types.mjs";import"./action/delegatedActions/utils.mjs";import"./action/crossApp/loginWithCrossAppAuth.mjs";import"./action/crossApp/linkWithCrossAppAuth.mjs";import"./index-DTAjYY8z.mjs";import"./action/crossApp/wallet/signMessage.mjs";import"./action/crossApp/wallet/utils/isCrossAppWalletSmart.mjs";import"./action/crossApp/wallet/utils/sendCrossAppRequest.mjs";import"./action/crossApp/wallet/utils/getCrossAppAccountByWalletAddress.mjs";import"./action/crossApp/wallet/utils/getProviderAccessTokenOrRelink.mjs";import"./action/crossApp/wallet/utils/throwIfNotLoggedIn.mjs";import"./action/crossApp/wallet/signTypedData.mjs";import"./utils/typedData/generateDomainType.mjs";import"./action/crossApp/wallet/sendTransaction.mjs";import"./action/delegatedActions/delegateWallet.mjs";import"./action/delegatedActions/revokeWallets.mjs";const t="biconomy",r="coinbase_smart_wallet",o="kernel",s="light_account",m="safe",a="thirdweb",l="nexus";export{t as BICONOMY,r as COINBASE_SMART_WALLET,o as KERNEL,s as LIGHT_ACCOUNT,l as NEXUS,m as SAFE,a as THIRDWEB,e as default};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/index.ts"],"names":["BICONOMY","COINBASE_SMART_WALLET","KERNEL","LIGHT_ACCOUNT","SAFE","THIRDWEB"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/index.ts"],"names":["BICONOMY","COINBASE_SMART_WALLET","KERNEL","LIGHT_ACCOUNT","SAFE","THIRDWEB","NEXUS"],"mappings":"66MAeO,MAAMA,EAAW,WAEXC,EAAwB,wBAExBC,EAAS,SAETC,EAAgB,gBAEhBC,EAAO,OAEPC,EAAW,WAEXC,EAAQ"}
|
package/dist/esm/pkce.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{base64url as e}from"jose";const
|
|
1
|
+
import{base64url as e}from"jose";const n="privy:state_code",r="privy:code_verifier";async function t(e,n){let r=(new TextEncoder).encode(e);return new Uint8Array(await n("SHA-256",r))}function o(e){return crypto.getRandomValues(new Uint8Array(e))}function i(){return e.encode(o(36))}function c(){return i()}async function u({codeVerifier:n,method:r="S256",digest:o}){if("S256"!=r)return n;{let r=await t(n,o);return e.encode(r)}}export{r as CODE_VERIFIER_KEY,n as STATE_CODE_KEY,i as createCodeVerifier,t as createHashBuffer,c as createStateCode,u as deriveCodeChallengeFromCodeVerifier,o as randomBytes};
|
|
2
2
|
//# sourceMappingURL=pkce.mjs.map
|
package/dist/esm/pkce.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pkce.mjs","sources":["../../src/pkce.ts"],"names":["STATE_CODE_KEY","CODE_VERIFIER_KEY","async","createHashBuffer","message","digest","data","TextEncoder","encode","Uint8Array","randomBytes","size","crypto","getRandomValues","createCodeVerifier","base64url","createStateCode","deriveCodeChallengeFromCodeVerifier","codeVerifier","method","
|
|
1
|
+
{"version":3,"file":"pkce.mjs","sources":["../../src/pkce.ts"],"names":["STATE_CODE_KEY","CODE_VERIFIER_KEY","async","createHashBuffer","message","digest","data","TextEncoder","encode","Uint8Array","randomBytes","size","crypto","getRandomValues","createCodeVerifier","base64url","createStateCode","deriveCodeChallengeFromCodeVerifier","codeVerifier","method","hashBuffer"],"mappings":"iCAQO,MAAMA,EAAiB,mBACjBC,EAAoB,sBAG1BC,eAAeC,EAAiBC,EAAiBC,GACtD,IAAMC,GAAO,IAAIC,aAAcC,OAAOJ,GAEtC,OAAO,IAAIK,iBADQJ,EAAO,UAAWC,GAEvC,CAEO,SAASI,EAAYC,GAC1B,OAAOC,OAAOC,gBAAgB,IAAIJ,WAAWE,GAC/C,CAOO,SAASG,IASd,OAAOC,EAAUP,OAAOE,EAAY,IACtC,CAWO,SAASM,IAId,OAAOF,GACT,CAOOZ,eAAee,GACpBC,aAAAA,EACAC,OAAAA,EAzDoC,OA0DpCd,OAAAA,IAMA,GAAIc,QAAAA,EAQF,OAAOD,GANP,IAAME,QAAmBjB,EAAiBe,EAAcb,GACxD,OAAOU,EAAUP,OAAOY,EAC1B,CAMF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createSmartAccountClient as e}from"permissionless";import{
|
|
1
|
+
import{createSmartAccountClient as e}from"permissionless";import{toNexusSmartAccount as r,toThirdwebSmartAccount as t,toLightSmartAccount as n,toBiconomySmartAccount as a,toKernelSmartAccount as s,toSafeSmartAccount as i}from"permissionless/accounts";import{createPimlicoClient as o}from"permissionless/clients/pimlico";import{http as c}from"viem";import{entryPoint07Address as l,entryPoint06Address as m,toCoinbaseSmartAccount as p}from"viem/account-abstraction";let u={address:m,version:"0.6"},y={address:l,version:"0.7"},P=({owner:e,smartWalletType:o,smartWalletVersion:c,publicClient:l})=>{switch(o){case"safe":return i({client:l,entryPoint:y,owners:[e],version:"1.4.1"});case"kernel":return s({client:l,version:"0.3.1",entryPoint:y,useMetaFactory:"optional",owners:[e]});case"biconomy":return a({client:l,owners:[e],entryPoint:u});case"light_account":return n({client:l,entryPoint:u,owner:e,version:"1.1.0"});case"coinbase_smart_wallet":return async function({client:e,owner:r,version:t}){let[n]=await r.request({method:"eth_accounts"});if(!n)throw Error("Unable to request embedded owner for eth_accounts");return await p({client:e,owners:[{type:"local",source:"privy",address:n,sign:async({hash:e})=>await r.request({method:"secp256k1_sign",params:[e]})}],version:t})}({client:l,owner:e,version:c??"1"});case"thirdweb":return t({client:l,entryPoint:y,owner:e});case"nexus":return r({client:l,owners:[e],version:"1.0.0",entryPoint:y});default:throw Error(`Invalid smart account type: ${o}.`)}};const d=async({owner:r,smartWalletType:t,smartWalletVersion:n,chain:a,publicClient:s,bundlerUrl:i,paymasterUrl:l,paymasterContext:m})=>{let p=await P({owner:r,smartWalletType:t,smartWalletVersion:n,publicClient:s}),u=o({transport:c(i),entryPoint:p.entryPoint}),y=l?o({transport:c(l),entryPoint:p.entryPoint}):void 0;return e({account:p,chain:a,paymaster:y,paymasterContext:m,bundlerTransport:c(i),userOperation:{estimateFeesPerGas:async()=>{if(["public.pimlico.io","api.pimlico.io"].some((e=>i.includes(e))))return await u.getUserOperationGasPrice().then((e=>e.fast));if(["rpc.zerodev.app"].some((e=>i.includes(e))))return(await u.request({method:"zd_getUserOperationGasPrice",params:[]})).fast;if(["g.alchemy.com"].some((e=>i.includes(e)))){let[e,r]=await Promise.all([s.getBlock({blockTag:"latest"}),u.request({method:"rundler_maxPriorityFeePerGas",params:[]})]);if(!e.baseFeePerGas||!r)throw Error("Failed to get block or maxPriorityFeePerGasEstimate");return{maxFeePerGas:150n*e.baseFeePerGas/100n+BigInt(r.toString()),maxPriorityFeePerGas:BigInt(r.toString())}}{let e=await s.estimateFeesPerGas(),r=i.includes("api.developer.coinbase.com")?175n:150n;return{...e,maxFeePerGas:e.maxFeePerGas*r/100n,maxPriorityFeePerGas:e.maxPriorityFeePerGas*r/100n}}}}})};export{d as signerToSmartAccountClient};
|
|
2
2
|
//# sourceMappingURL=smart-wallets.mjs.map
|