@privy-io/js-sdk-core 0.66.0 → 0.67.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/Error.js.map +1 -1
- package/dist/cjs/action/depositAddress/generate.js +2 -0
- package/dist/cjs/action/depositAddress/generate.js.map +1 -0
- package/dist/cjs/action/depositAddress/index.js +1 -1
- package/dist/cjs/action/depositAddress/polling.js +2 -0
- package/dist/cjs/action/depositAddress/polling.js.map +1 -0
- package/dist/cjs/action/depositAddress/resolve-refund-address.js +2 -0
- package/dist/cjs/action/depositAddress/resolve-refund-address.js.map +1 -0
- package/dist/cjs/action/index.js +1 -1
- package/dist/cjs/client/PrivyInternal.js +1 -1
- package/dist/cjs/client/mfa/MfaApi.js +1 -1
- package/dist/cjs/client/mfa/MfaApi.js.map +1 -1
- package/dist/cjs/embedded/EmbeddedWalletProxy.js +1 -1
- package/dist/cjs/embedded/EmbeddedWalletProxy.js.map +1 -1
- package/dist/cjs/embedded/stack/walletRpc.js +1 -1
- package/dist/cjs/embedded/types.js.map +1 -1
- package/dist/cjs/index--nYkyGeH.js +2 -0
- package/dist/cjs/index--nYkyGeH.js.map +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/wallet-api/raw-sign.js +1 -1
- package/dist/cjs/wallet-api/raw-sign.js.map +1 -1
- package/dist/cjs/wallet-api/rpc.js +1 -1
- package/dist/cjs/wallet-api/rpc.js.map +1 -1
- package/dist/dts/index.d.mts +45 -5
- package/dist/dts/index.d.ts +45 -5
- package/dist/esm/Error.mjs.map +1 -1
- package/dist/esm/action/depositAddress/generate.mjs +2 -0
- package/dist/esm/action/depositAddress/generate.mjs.map +1 -0
- package/dist/esm/action/depositAddress/index.mjs +1 -1
- package/dist/esm/action/depositAddress/polling.mjs +2 -0
- package/dist/esm/action/depositAddress/polling.mjs.map +1 -0
- package/dist/esm/action/depositAddress/resolve-refund-address.mjs +2 -0
- package/dist/esm/action/depositAddress/resolve-refund-address.mjs.map +1 -0
- package/dist/esm/action/index.mjs +1 -1
- package/dist/esm/client/PrivyInternal.mjs +1 -1
- package/dist/esm/client/mfa/MfaApi.mjs +1 -1
- package/dist/esm/client/mfa/MfaApi.mjs.map +1 -1
- package/dist/esm/embedded/EmbeddedWalletProxy.mjs +1 -1
- package/dist/esm/embedded/EmbeddedWalletProxy.mjs.map +1 -1
- package/dist/esm/embedded/stack/walletRpc.mjs +1 -1
- package/dist/esm/embedded/types.mjs.map +1 -1
- package/dist/esm/index-jTjLf3Z-.mjs +2 -0
- package/dist/esm/index-jTjLf3Z-.mjs.map +1 -0
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/wallet-api/raw-sign.mjs +1 -1
- package/dist/esm/wallet-api/raw-sign.mjs.map +1 -1
- package/dist/esm/wallet-api/rpc.mjs +1 -1
- package/dist/esm/wallet-api/rpc.mjs.map +1 -1
- package/package.json +5 -5
package/dist/cjs/Error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Error.js","sources":["../../src/Error.ts"],"names":["PrivyApiError","Error","constructor","error","code","status","super","name","this","PrivyClientError","MoonpayApiError","response","messageMap","e","default"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Error.js","sources":["../../src/Error.ts"],"names":["PrivyApiError","Error","constructor","error","code","status","super","name","this","PrivyClientError","MoonpayApiError","response","messageMap","e","default"],"mappings":"aA0EO,MAAMA,UAAsBC,MAMjCC,WAAAA,EAAaC,MAAAA,EAAOC,KAAAA,EAAMC,OAAAA,IACxBC,MAAMH,GAAAA,KANCI,KAAO,gBAOdC,KAAKL,MAAQA,EACbK,KAAKJ,KAAOA,EACZI,KAAKH,OAASA,CAChB,EAGK,MAAMI,UAAyBR,MAIpCC,WAAAA,EAAaC,MAAAA,EAAOC,KAAAA,IAClBE,MAAMH,GACNK,KAAKJ,KAAOA,EACZI,KAAKL,MAAQA,CACf,EAGK,MAAMO,UAAwBT,MAKnCC,WAAAA,EAAaC,MAAAA,EAAOC,KAAAA,EAAMO,SAAAA,IACxBL,MAAMH,GACNK,KAAKJ,KAAOA,EACZI,KAAKL,MAAQA,EACbK,KAAKG,SAAWA,CAClB,4GA2CmCC,GAAgCC,GACnED,EArBAC,aAAqBb,GAqBKG,aApBLM,EAoBKN,EArBuBC,KAE1C,kBAmB8BQ,EAAWE,0CAE3C,SAAmCX,GACxC,OAAOA,GAAS,iBAAOA,GAAsB,SAAUA,GAAwB,iBAAfA,EAAMC,IAAI"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("@privy-io/routes"),r=require("./resolve-refund-address.js");exports.generateDepositAddress=async function(s){let{user:i}=await s.privy.user.get();if(!i)throw Error("NOT_AUTHENTICATED");let t=s.refundAddress;if(!t){let e=await r.resolveRefundAddress({privy:s.privy,caip2:s.sourceChain,onWalletCreated:s.onWalletCreated});if(!e.ok)throw Error(e.error);t=e.address}return await s.privy.fetchPrivyRoute(e.CreateDepositAddressQuote,{body:{source_chain:s.sourceChain,source_currency:s.sourceCurrency,destination_chain:s.destinationChain,destination_currency:s.destinationCurrency,destination_address:s.destinationAddress,refund_address:t,...null!=s.slippageBps?{slippage_bps:s.slippageBps}:{}}})};
|
|
2
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sources":["../../../../src/action/depositAddress/generate.ts"],"names":["async","opts","user","privy","get","Error","refundAddress","result","resolveRefundAddress","caip2","sourceChain","onWalletCreated","ok","error","address","fetchPrivyRoute","CreateDepositAddressQuote","body","source_chain","source_currency","sourceCurrency","destination_chain","destinationChain","destination_currency","destinationCurrency","destination_address","destinationAddress","refund_address","slippageBps","slippage_bps"],"mappings":"uHAMOA,eACLC,GAKA,IAAOC,KAAAA,SAAcD,EAAKE,MAAMD,KAAKE,MACrC,IAAKF,EACH,MAAUG,MAAM,qBAGlB,IAAIC,EAAgBL,EAAKK,cACzB,IAAKA,EAAe,CAClB,IAAMC,QAAeC,EAAAA,qBAAqB,CACxCL,MAAOF,EAAKE,MACZM,MAAOR,EAAKS,YACZC,gBAAiBV,EAAKU,kBAExB,IAAKJ,EAAOK,GACV,MAAMP,MAAUE,EAAOM,OAEzBP,EAAgBC,EAAOO,OAAO,CAGhC,aAAab,EAAKE,MAAMY,gBAAgBC,EAAAA,0BAA2B,CACjEC,KAAM,CACJC,aAAcjB,EAAKS,YACnBS,gBAAiBlB,EAAKmB,eACtBC,kBAAmBpB,EAAKqB,iBACxBC,qBAAsBtB,EAAKuB,oBAC3BC,oBAAqBxB,EAAKyB,mBAC1BC,eAAgBrB,KACQ,MAApBL,EAAK2B,YAAsB,CAACC,aAAc5B,EAAK2B,aAAe,CAAA,IAGxE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e
|
|
1
|
+
"use strict";require("@privy-io/routes");var e=require("./generate.js"),r=require("./resolve-refund-address.js"),s=require("./polling.js"),t=require("../../index--nYkyGeH.js");require("../../utils/poll.js"),require("../../utils/sleep.js"),exports.generateDepositAddress=e.generateDepositAddress,exports.resolveRefundAddress=r.resolveRefundAddress,exports.getDeposit=s.getDeposit,exports.waitForCompletion=s.waitForCompletion,exports.waitForDeposit=s.waitForDeposit,exports.getConfig=t.getConfig;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("@privy-io/routes"),t=require("../../utils/poll.js");function r(e,t){return Math.ceil(t/e)}function s(e){return"success"===e.status?e.result?{status:"success",order:e.result}:{status:"timeout"}:"aborted"===e.status?{status:"aborted",error:e.error}:{status:"timeout",error:e.error}}require("../../utils/sleep.js"),exports.getDeposit=async function(t){return await t.privy.fetchPrivyRoute(e.GetDepositAddressOrder,{params:{order_id:t.orderId}})},exports.waitForCompletion=async function(i){let o=i.pollIntervalMs??2e3,a=i.timeoutMs??18e5,u=i.signal??(new AbortController).signal;return s(await t.poll({operation:()=>i.privy.fetchPrivyRoute(e.GetDepositAddressOrder,{params:{order_id:i.orderId}}),until:e=>"executing"!==e.status,delay:o,interval:o,attempts:r(o,a),signal:u}))},exports.waitForDeposit=async function(i){let o=i.pollIntervalMs??2e3,a=i.timeoutMs??18e5,u=i.signal??(new AbortController).signal;return s(await t.poll({operation:async()=>{let t=await i.privy.fetchPrivyRoute(e.GetNextDepositAddressOrder,{params:{deposit_address_id:i.depositAddressId},query:{after:i.quoteCreatedAt}});if(t.order)return await i.privy.fetchPrivyRoute(e.GetDepositAddressOrder,{params:{order_id:t.order.id}})},until:e=>void 0!==e,delay:o,interval:o,attempts:r(o,a),signal:u}))};
|
|
2
|
+
//# sourceMappingURL=polling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polling.js","sources":["../../../../src/action/depositAddress/polling.ts"],"names":["getPollAttempts","pollIntervalMs","timeoutMs","Math","ceil","toPollingResult","result","status","order","error","async","opts","privy","fetchPrivyRoute","GetDepositAddressOrder","params","order_id","orderId","signal","AbortController","poll","operation","until","t","delay","interval","attempts","nextOrder","GetNextDepositAddressOrder","deposit_address_id","depositAddressId","query","after","quoteCreatedAt","id"],"mappings":"gFAeA,SAASA,EAAgBC,EAAwBC,GAC/C,OAAOC,KAAKC,KAAKF,EAAYD,EAC/B,CAEA,SAASI,EACPC,GAOK,MAEDA,YAAAA,EAAOC,OACJD,EAAOA,OACL,CAACC,OAAQ,UAAWC,MAAOF,EAAOA,QADd,CAACC,OAAQ,WAGhB,YAAlBD,EAAOC,OAA6B,CAACA,OAAQ,UAAWE,MAAOH,EAAOG,OACnE,CAACF,OAAQ,UAAWE,MAAOH,EAAOG,MAC3C,oDAEOC,eACLC,GAEA,aAAaA,EAAKC,MAAMC,gBAAgBC,EAAAA,uBAAwB,CAC9DC,OAAQ,CAACC,SAAUL,EAAKM,UAE5B,4BA8BOP,eACLC,GAEA,IAAMV,EAAiBU,EAAKV,gBAhEL,IAiEjBC,EAAYS,EAAKT,WAhED,KAiEhBgB,EAASP,EAAKO,SAAU,IAAIC,iBAAkBD,OAcpD,OAAOb,QAZce,EAAAA,KAAK,CACxBC,UAAW,IACTV,EAAKC,MAAMC,gBAAgBC,EAAAA,uBAAwB,CACjDC,OAAQ,CAACC,SAAUL,EAAKM,WAE5BK,MAAOC,GAAWf,cAAAA,EAAMD,OACxBiB,MAAOvB,EACPwB,SAAUxB,EACVyB,SAAU1B,EAAgBC,EAAgBC,GAC1CgB,OAAAA,IAIJ,yBAhDOR,eACLC,GAEA,IAAMV,EAAiBU,EAAKV,gBApCL,IAqCjBC,EAAYS,EAAKT,WApCD,KAqChBgB,EAASP,EAAKO,SAAU,IAAIC,iBAAkBD,OAoBpD,OAAOb,QAlBce,EAAAA,KAAK,CACxBC,UAAWX,UACT,IAAMiB,QAAkBhB,EAAKC,MAAMC,gBAAgBe,EAAAA,2BAA4B,CAC7Eb,OAAQ,CAACc,mBAAoBlB,EAAKmB,kBAClCC,MAAO,CAACC,MAAOrB,EAAKsB,kBAEtB,GAAKN,EAAUnB,MACf,aAAaG,EAAKC,MAAMC,gBAAgBC,EAAAA,uBAAwB,CAC9DC,OAAQ,CAACC,SAAUW,EAAUnB,MAAM0B,KACrC,EAEFZ,MAAOC,QAAWf,IAAAA,EAClBgB,MAAOvB,EACPwB,SAAUxB,EACVyB,SAAU1B,EAAgBC,EAAgBC,GAC1CgB,OAAAA,IAIJ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var r=require("@privy-io/routes");function t(r){return r.startsWith("eip155:")?"ethereum":r.startsWith("solana:")?"solana":r.startsWith("bip122:")?"bitcoin-segwit":r.startsWith("tron:")?"tron":void 0}exports.resolveRefundAddress=async function(e){let{user:i}=await e.privy.user.get();if(!i)return{ok:!1,error:"NOT_AUTHENTICATED"};let s=function(r,e){let i=t(r);if(!i)return;let s=e.linked_accounts.find((r=>"wallet"===r.type&&r.chain_type===i&&"address"in r&&r.address));return s&&"address"in s?s.address:void 0}(e.caip2,i);if(s)return{ok:!0,address:s};let a=t(e.caip2);if(!a)return{ok:!1,error:"UNSUPPORTED_CHAIN"};try{let t=await e.privy.fetchPrivyRoute(r.WalletCreate,{body:{chain_type:a}});return await(e.onWalletCreated?.()),{ok:!0,address:t.address}}catch{return{ok:!1,error:"REFUND_WALLET_CREATION_FAILED"}}};
|
|
2
|
+
//# sourceMappingURL=resolve-refund-address.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-refund-address.js","sources":["../../../../src/action/depositAddress/resolve-refund-address.ts"],"names":["chainTypeFromCaip2","caip2","r","startsWith","async","opts","user","privy","get","ok","error","existing","targetChainType","wallet","linked_accounts","find","a","type","chain_type","address","undefined","chainType","fetchPrivyRoute","WalletCreate","body","onWalletCreated"],"mappings":"+CAMA,SAASA,EAAmBC,GAAa,OACvCC,EAAUC,WAAW,WAAmB,WACpCF,EAAME,WAAW,WAAmB,SACpCF,EAAME,WAAW,WAAmB,iBACpCF,EAAME,WAAW,SAAiB,aAExC,8BAWOC,eAAoCC,GAKzC,IAAOC,KAAAA,SAAcD,EAAKE,MAAMD,KAAKE,MACrC,IAAKF,EAAM,MAAO,CAACG,IAAI,EAAOC,MAAO,qBAErC,IAAMC,EAjBR,SAAkCV,EAAeK,GAC/C,IAAMM,EAAkBZ,EAAmBC,GAC3C,IAAKW,EAAiB,OACtB,IAAMC,EAASP,EAAKQ,gBAAgBC,MACjCC,GAAMA,WAAAA,EAAEC,MAAqBD,EAAEE,aAAeN,GAAmB,YAAaI,GAAKA,EAAEG,UAExF,OAAON,GAAU,YAAaA,EAASA,EAAOM,aAAUC,CAC1D,CAPA,CAiB4Cf,EAAKJ,MAAOK,GACtD,GAAIK,EAAU,MAAO,CAACF,IAAI,EAAMU,QAASR,GAEzC,IAAMU,EAAYrB,EAAmBK,EAAKJ,OAC1C,IAAKoB,EAAW,MAAO,CAACZ,IAAI,EAAOC,MAAO,qBAE1C,IACE,IAAMG,QAAeR,EAAKE,MAAMe,gBAAgBC,EAAAA,aAAc,CAC5DC,KAAM,CAACN,WAAYG,KAGrB,aADMhB,EAAKoB,qBACJ,CAAChB,IAAI,EAAMU,QAASN,EAAOM,QACpC,CAAE,MACA,MAAO,CAACV,IAAI,EAAOC,MAAO,gCAC5B,CACF"}
|
package/dist/cjs/action/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("../index-BDWdfIuK.js"),s=require("../index-DzfqDJJ9.js"),r=require("
|
|
1
|
+
"use strict";var e=require("../index-BDWdfIuK.js"),s=require("../index-DzfqDJJ9.js"),r=require("../index--nYkyGeH.js");require("./delegatedActions/delegateWallet.js"),require("../Error.js"),require("../wallet-api/unified-wallet.js"),require("./delegatedActions/utils.js"),require("../utils/getAllUserEmbeddedEthereumWallets.js"),require("../utils/embedded-wallets.js"),require("../utils/getAllUserEmbeddedSolanaWallets.js"),require("../utils/getUserEmbeddedEthereumWallet.js"),require("../utils/getUserEmbeddedSolanaWallet.js"),require("./delegatedActions/revokeWallets.js"),require("./crossApp/loginWithCrossAppAuth.js"),require("./crossApp/linkWithCrossAppAuth.js"),require("../index-CARkJvRM.js"),require("./crossApp/wallet/signMessage.js"),require("./crossApp/wallet/utils/isCrossAppWalletSmart.js"),require("./crossApp/wallet/utils/sendCrossAppRequest.js"),require("./crossApp/wallet/utils/getCrossAppAccountByWalletAddress.js"),require("./crossApp/wallet/utils/getProviderAccessTokenOrRelink.js"),require("./crossApp/wallet/utils/throwIfNotLoggedIn.js"),require("./crossApp/wallet/signTypedData.js"),require("../utils/typedData/generateDomainType.js"),require("./crossApp/wallet/sendTransaction.js"),require("@privy-io/routes"),require("./depositAddress/generate.js"),require("./depositAddress/resolve-refund-address.js"),require("./depositAddress/polling.js"),require("../utils/poll.js"),require("../utils/sleep.js"),exports.delegatedActions=e.index,exports.crossApp=s.index,exports.depositAddress=r.index;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("fetch-retry"),t=require("@privy-io/api-base"),s=require("@privy-io/routes"),i=require("../Error.js"),r=require("../Session.js"),a=require("../toAbortSignalTimeout.js"),n=require("../utils/toSearchParams.js"),o=require("./logger.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("eventemitter3"),require("jose"),require("js-cookie"),require("../Token.js"),require("../utils/allSettled.js"),require("../utils/noop.js");var c=/*#__PURE__*/h(e);let l="privy:caid";exports.PrivyInternal=class{setCallbacks(e){this.callbacks={...this.callbacks,...e}}get isReady(){return!!this._config}get config(){return this._config}get caid(){return this._analyticsId}async _initialize(){if(this.isReady)this.callbacks?.setIsReady?.(!0);else{if(!await this.isStorageAccessible())throw new i.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._sdkVersion.startsWith("react-auth:")||this.createAnalyticsEvent("sdk_initialize",{})}}getPath(e,{params:t,query:i}){return`${this.baseUrl}${s.getPathWithParams(e.path,t)}${n.toSearchParams(i)}`}async fetch(e,{body:t,params:s,query:r,headers:a,onRequest:n=this._beforeRequest.bind(this)}){let o=new Request(this.getPath(e,{params:s,query:r}),{method:e.method,body:JSON.stringify(t),headers:a}),h=await n(o),c=await this._fetch(o,h),l=await c.json();if(c.status>299)throw new i.PrivyApiError({...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:a.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.getAccessTokenInternal(),this.beforeRequestWithoutRefresh(e)}async getAppConfig(){return await this.fetch(s.AppConfig,{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(l);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(l,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(l)}catch(e){this.logger.error("Unable to delete clientId",e)}}async createAnalyticsEvent(e,t){try{await this.fetch(s.AnalyticsEvent,{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 i.PrivyClientError({code:"storage_error",error:"Unable to access storage"});let t=await this.session.getRefreshToken()??void 0,s=t??"key",r=this._cache.get(s);if(r)return this.logger.debug("[privy:refresh] found in-flight session refresh request, deduping"),await r;let a=this._refreshSession(t,e);this._cache.set(s,a);try{return await a}finally{this._cache.delete(s)}}async _refreshSession(e,r){let a=await this.session.getCustomerAccessToken();if(!this.session.hasRefreshCredentials(a,e??null))throw this.logger.debug("[privy:refresh] missing tokens, skipping request"),await this._initialize(),new i.PrivyApiError({code:t.PrivyErrorCode.MISSING_OR_INVALID_TOKEN,error:"No tokens found in storage",status:401});try{this.logger.debug(`[privy:refresh] fetching: ${s.RefreshSession.path}`);let t=await this.fetch(s.RefreshSession,{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"),r||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"),r||this.callbacks?.setUser?.(t.user),t}catch(e){throw this.logger.debug(`[privy:refresh] error: ${e.message??"unknown error"}`),e instanceof i.PrivyApiError&&e.code===t.PrivyErrorCode.MISSING_OR_INVALID_TOKEN&&(await this.session.destroyLocalState(),r||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(e){this._sdkVersion="js-sdk-core:0.
|
|
1
|
+
"use strict";var e=require("fetch-retry"),t=require("@privy-io/api-base"),s=require("@privy-io/routes"),i=require("../Error.js"),r=require("../Session.js"),a=require("../toAbortSignalTimeout.js"),n=require("../utils/toSearchParams.js"),o=require("./logger.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("eventemitter3"),require("jose"),require("js-cookie"),require("../Token.js"),require("../utils/allSettled.js"),require("../utils/noop.js");var c=/*#__PURE__*/h(e);let l="privy:caid";exports.PrivyInternal=class{setCallbacks(e){this.callbacks={...this.callbacks,...e}}get isReady(){return!!this._config}get config(){return this._config}get caid(){return this._analyticsId}async _initialize(){if(this.isReady)this.callbacks?.setIsReady?.(!0);else{if(!await this.isStorageAccessible())throw new i.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._sdkVersion.startsWith("react-auth:")||this.createAnalyticsEvent("sdk_initialize",{})}}getPath(e,{params:t,query:i}){return`${this.baseUrl}${s.getPathWithParams(e.path,t)}${n.toSearchParams(i)}`}async fetch(e,{body:t,params:s,query:r,headers:a,onRequest:n=this._beforeRequest.bind(this)}){let o=new Request(this.getPath(e,{params:s,query:r}),{method:e.method,body:JSON.stringify(t),headers:a}),h=await n(o),c=await this._fetch(o,h),l=await c.json();if(c.status>299)throw new i.PrivyApiError({...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:a.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.getAccessTokenInternal(),this.beforeRequestWithoutRefresh(e)}async getAppConfig(){return await this.fetch(s.AppConfig,{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(l);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(l,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(l)}catch(e){this.logger.error("Unable to delete clientId",e)}}async createAnalyticsEvent(e,t){try{await this.fetch(s.AnalyticsEvent,{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 i.PrivyClientError({code:"storage_error",error:"Unable to access storage"});let t=await this.session.getRefreshToken()??void 0,s=t??"key",r=this._cache.get(s);if(r)return this.logger.debug("[privy:refresh] found in-flight session refresh request, deduping"),await r;let a=this._refreshSession(t,e);this._cache.set(s,a);try{return await a}finally{this._cache.delete(s)}}async _refreshSession(e,r){let a=await this.session.getCustomerAccessToken();if(!this.session.hasRefreshCredentials(a,e??null))throw this.logger.debug("[privy:refresh] missing tokens, skipping request"),await this._initialize(),new i.PrivyApiError({code:t.PrivyErrorCode.MISSING_OR_INVALID_TOKEN,error:"No tokens found in storage",status:401});try{this.logger.debug(`[privy:refresh] fetching: ${s.RefreshSession.path}`);let t=await this.fetch(s.RefreshSession,{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"),r||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"),r||this.callbacks?.setUser?.(t.user),t}catch(e){throw this.logger.debug(`[privy:refresh] error: ${e.message??"unknown error"}`),e instanceof i.PrivyApiError&&e.code===t.PrivyErrorCode.MISSING_OR_INVALID_TOKEN&&(await this.session.destroyLocalState(),r||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(e){this._sdkVersion="js-sdk-core:0.67.0",this._cache=new Map,this.logger=o.toLoggerWithLevel({level:e.logger?.level??e.logLevel??"ERROR",logger:e.logger??console}),this._storage=e.storage,this._crypto=e.crypto,this._analyticsId=null,this._getOrGenerateClientAnalyticsId(),this.baseUrl=e.baseUrl??"https://auth.privy.io",this.appId=e.appId,this.appClientId=e.appClientId,this._sdkVersion=e.sdkVersion??this._sdkVersion,this.callbacks=e.callbacks,this.nativeAppIdentifier=e.nativeAppIdentifier,this.session=new r.Session({storage:this._storage,isUsingServerCookies:!1,appId:e.appId}),this._fetch=c.default(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})}))}};
|
|
2
2
|
//# sourceMappingURL=PrivyInternal.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../Error.js"),r=require("./MfaPasskeyApi.js"),t=require("./MfaSmsApi.js");require("@privy-io/routes");exports.default=class{setProxy(e){this.proxy=e}async getAccessTokenInternal(){let r=await this.privyInternal.getAccessTokenInternal();if(!r)throw new e.PrivyClientError({error:"Missing access token",code:"attempted_rpc_call_before_logged_in"});return r}async verifyMfa(){if(!this.proxy)throw new e.PrivyClientError({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});return await this.proxy.verifyMfa({accessToken:await this.getAccessTokenInternal()})}async initEnrollMfa(r){if(!this.proxy)throw new e.PrivyClientError({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});return await this.proxy.initEnrollMfa({...r,accessToken:await this.getAccessTokenInternal()})}async submitEnrollMfa(r){if(!this.proxy)throw new e.PrivyClientError({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});let t=await this.proxy.submitEnrollMfa({...r,accessToken:await this.getAccessTokenInternal()}),i=await this.privyInternal.refreshSession();if(0===i.user.mfa_methods.length)try{await this.proxy.clearMfa({userId:i.user.id})}catch{}return t}async unenrollMfa(r){if(!this.proxy)throw new e.PrivyClientError({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});let t=await this.proxy.unenrollMfa({method:r,accessToken:await this.getAccessTokenInternal()}),i=await this.privyInternal.refreshSession();if(0===i.user.mfa_methods.length)try{await this.proxy.clearMfa({userId:i.user.id})}catch{}return t}async clearMfa(r){if(!this.proxy)throw new e.PrivyClientError({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});return await this.proxy.clearMfa(r)}constructor(e,i){this.proxy=i,this.privyInternal=e,this.sms=new t.default(e),this.passkey=new r.default(e)}};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../Error.js"),r=require("./MfaPasskeyApi.js"),t=require("./MfaSmsApi.js");require("@privy-io/routes");exports.default=class{setProxy(e){this.proxy=e}async getAccessTokenInternal(){let r=await this.privyInternal.getAccessTokenInternal();if(!r)throw new e.PrivyClientError({error:"Missing access token",code:"attempted_rpc_call_before_logged_in"});return r}async verifyMfa(){if(!this.proxy)throw new e.PrivyClientError({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});return await this.proxy.verifyMfa({accessToken:await this.getAccessTokenInternal()})}async initEnrollMfa(r){if(!this.proxy)throw new e.PrivyClientError({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});return await this.proxy.initEnrollMfa({...r,accessToken:await this.getAccessTokenInternal()})}async submitEnrollMfa(r){if(!this.proxy)throw new e.PrivyClientError({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});let t=await this.proxy.submitEnrollMfa({...r,accessToken:await this.getAccessTokenInternal()}),i=await this.privyInternal.refreshSession();if(0===i.user.mfa_methods.length)try{await this.proxy.clearMfa({userId:i.user.id})}catch{}return t}async unenrollMfa(r){if(!this.proxy)throw new e.PrivyClientError({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});let t=await this.proxy.unenrollMfa({method:r,accessToken:await this.getAccessTokenInternal()}),i=await this.privyInternal.refreshSession();if(0===i.user.mfa_methods.length)try{await this.proxy.clearMfa({userId:i.user.id})}catch{}return t}async unlinkPasskey({credentialId:r,removeAsMfa:t}){if(!this.proxy)throw new e.PrivyClientError({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});await this.proxy.unlinkPasskey({credentialId:r,removeAsMfa:t,accessToken:await this.getAccessTokenInternal()});let i=await this.privyInternal.refreshSession();if(0===i.user.mfa_methods.length)try{await this.proxy.clearMfa({userId:i.user.id})}catch{}}async clearMfa(r){if(!this.proxy)throw new e.PrivyClientError({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});return await this.proxy.clearMfa(r)}constructor(e,i){this.proxy=i,this.privyInternal=e,this.sms=new t.default(e),this.passkey=new r.default(e)}};
|
|
2
2
|
//# sourceMappingURL=MfaApi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MfaApi.js","sources":["../../../../src/client/mfa/MfaApi.ts"],"names":["setProxy","proxy","this","getAccessTokenInternal","accessToken","privyInternal","PrivyClientError","error","code","verifyMfa","initEnrollMfa","args","submitEnrollMfa","result","refreshed","refreshSession","user","mfa_methods","length","clearMfa","userId","id","unenrollMfa","method","constructor","sms","MfaSmsApi","passkey","MfaPasskeyApi"],"mappings":"kNA4CEA,QAAAA,CAASC,GACPC,KAAKD,MAAQA,CACf,CAKA,4BAAcE,GACZ,IAAMC,QAAoBF,KAAKG,cAAcF,yBAC7C,IAAKC,EACH,MAAM,IAAIE,EAAAA,iBAAiB,CACzBC,MAAO,uBACPC,KAAM,wCAGV,OAAOJ,CACT,CAMA,eAAaK,GACX,IAAKP,KAAKD,MACR,MAAM,IAAIK,mBAAiB,CACzBC,MAAO,wCACPC,KAAM,uCAIV,aAAaN,KAAKD,MAAMQ,UAAU,CAACL,kBAAmBF,KAAKC,0BAC7D,CAMA,mBAAaO,CAAcC,GACzB,IAAKT,KAAKD,MACR,MAAM,IAAIK,mBAAiB,CACzBC,MAAO,wCACPC,KAAM,uCAIV,aAAaN,KAAKD,MAAMS,cAAc,IACjCC,EACHP,kBAAmBF,KAAKC,0BAE5B,CAMA,qBAAaS,CAAgBD,GAC3B,IAAKT,KAAKD,MACR,MAAM,IAAIK,EAAAA,iBAAiB,CACzBC,MAAO,wCACPC,KAAM,uCAIV,IAAMK,QAAeX,KAAKD,MAAMW,gBAAgB,IAC3CD,EACHP,kBAAmBF,KAAKC,2BAGpBW,QAAkBZ,KAAKG,cAAcU,iBAE3C,GAAID,IAAAA,EAAUE,KAAKC,YAAYC,OAC7B,UACQhB,KAAKD,MAAMkB,SAAS,CAACC,OAAQN,EAAUE,KAAKK,IACpD,CAAE,MAEF,CAGF,OAAOR,CACT,CAMA,iBAAaS,CAAYC,GACvB,IAAKrB,KAAKD,MACR,MAAM,IAAIK,EAAAA,iBAAiB,CACzBC,MAAO,wCACPC,KAAM,uCAIV,IAAMK,QAAeX,KAAKD,MAAMqB,YAAY,CAC1CC,OAAAA,EACAnB,kBAAmBF,KAAKC,2BAGpBW,QAAkBZ,KAAKG,cAAcU,iBAE3C,GAAID,IAAAA,EAAUE,KAAKC,YAAYC,OAC7B,UACQhB,KAAKD,MAAMkB,SAAS,CAACC,OAAQN,EAAUE,KAAKK,IACpD,CAAE,MAEF,CAGF,OAAOR,CACT,CAKA,
|
|
1
|
+
{"version":3,"file":"MfaApi.js","sources":["../../../../src/client/mfa/MfaApi.ts"],"names":["setProxy","proxy","this","getAccessTokenInternal","accessToken","privyInternal","PrivyClientError","error","code","verifyMfa","initEnrollMfa","args","submitEnrollMfa","result","refreshed","refreshSession","user","mfa_methods","length","clearMfa","userId","id","unenrollMfa","method","unlinkPasskey","credentialId","removeAsMfa","constructor","sms","MfaSmsApi","passkey","MfaPasskeyApi"],"mappings":"kNA4CEA,QAAAA,CAASC,GACPC,KAAKD,MAAQA,CACf,CAKA,4BAAcE,GACZ,IAAMC,QAAoBF,KAAKG,cAAcF,yBAC7C,IAAKC,EACH,MAAM,IAAIE,EAAAA,iBAAiB,CACzBC,MAAO,uBACPC,KAAM,wCAGV,OAAOJ,CACT,CAMA,eAAaK,GACX,IAAKP,KAAKD,MACR,MAAM,IAAIK,mBAAiB,CACzBC,MAAO,wCACPC,KAAM,uCAIV,aAAaN,KAAKD,MAAMQ,UAAU,CAACL,kBAAmBF,KAAKC,0BAC7D,CAMA,mBAAaO,CAAcC,GACzB,IAAKT,KAAKD,MACR,MAAM,IAAIK,mBAAiB,CACzBC,MAAO,wCACPC,KAAM,uCAIV,aAAaN,KAAKD,MAAMS,cAAc,IACjCC,EACHP,kBAAmBF,KAAKC,0BAE5B,CAMA,qBAAaS,CAAgBD,GAC3B,IAAKT,KAAKD,MACR,MAAM,IAAIK,EAAAA,iBAAiB,CACzBC,MAAO,wCACPC,KAAM,uCAIV,IAAMK,QAAeX,KAAKD,MAAMW,gBAAgB,IAC3CD,EACHP,kBAAmBF,KAAKC,2BAGpBW,QAAkBZ,KAAKG,cAAcU,iBAE3C,GAAID,IAAAA,EAAUE,KAAKC,YAAYC,OAC7B,UACQhB,KAAKD,MAAMkB,SAAS,CAACC,OAAQN,EAAUE,KAAKK,IACpD,CAAE,MAEF,CAGF,OAAOR,CACT,CAMA,iBAAaS,CAAYC,GACvB,IAAKrB,KAAKD,MACR,MAAM,IAAIK,EAAAA,iBAAiB,CACzBC,MAAO,wCACPC,KAAM,uCAIV,IAAMK,QAAeX,KAAKD,MAAMqB,YAAY,CAC1CC,OAAAA,EACAnB,kBAAmBF,KAAKC,2BAGpBW,QAAkBZ,KAAKG,cAAcU,iBAE3C,GAAID,IAAAA,EAAUE,KAAKC,YAAYC,OAC7B,UACQhB,KAAKD,MAAMkB,SAAS,CAACC,OAAQN,EAAUE,KAAKK,IACpD,CAAE,MAEF,CAGF,OAAOR,CACT,CAMA,mBAAaW,EACXC,aAAAA,EACAC,YAAAA,IAKA,IAAKxB,KAAKD,MACR,MAAM,IAAIK,EAAAA,iBAAiB,CACzBC,MAAO,wCACPC,KAAM,6CAIJN,KAAKD,MAAMuB,cAAc,CAC7BC,aAAAA,EACAC,YAAAA,EACAtB,kBAAmBF,KAAKC,2BAI1B,IAAMW,QAAkBZ,KAAKG,cAAcU,iBAE3C,GAA0C,IAAtCD,EAAUE,KAAKC,YAAYC,OAC7B,UACQhB,KAAKD,MAAMkB,SAAS,CAACC,OAAQN,EAAUE,KAAKK,IACpD,CAAE,MAEF,CAEJ,CAKA,cAAaF,CAASR,GACpB,IAAKT,KAAKD,MACR,MAAM,IAAIK,EAAAA,iBAAiB,CACzBC,MAAO,wCACPC,KAAM,uCAIV,aAAaN,KAAKD,MAAMkB,SAASR,EACnC,CAzKA,WAAAgB,CAAmBtB,EAA8BJ,GAC/CC,KAAKD,MAAQA,EACbC,KAAKG,cAAgBA,EACrBH,KAAK0B,IAAM,IAAIC,EAAAA,QAAUxB,GACzBH,KAAK4B,QAAU,IAAIC,UAAc1B,EACnC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e,t=require("../utils/sleep.js"),i=require("./EventCallbackQueue.js"),r=require("./errors.js"),a=require("./withMfa.js");require("./types.js");let s=(e=0,()=>"id-"+e++),o=(e,t)=>"bigint"==typeof t?t.toString():t,n=async(e,{ms:t,msg:i})=>{let r,a=new Promise(((e,a)=>{r=setTimeout((()=>{a(Error(i))}),t??15e3)}));try{return await Promise.race([e,a])}finally{void 0!==r&&clearTimeout(r)}},l=new i.EventCallbacksQueue;exports.DEFAULT_WALLET_PROXY_TIMEOUT_MS=15e3,exports.EmbeddedWalletProxy=class{invokeWithMfa(e,t){return n(a.withMfa((i=>n(this.waitForReady().then((()=>e(i))),{msg:t.timeoutMsg,ms:t.timeoutMs})),this.mfa.rootPromise,this.mfa.submitPromise,(()=>this.mfa.emit("mfaRequired")),t.mfaAlwaysRequired??!1,4,3e5),{msg:"Operation reached timeout: MFA verification",ms:126e4})}reload(){return this.ready=!1,this._embeddedWalletMessagePoster.reload()}ping(e=15e3){return n(this.invoke("privy:iframe:ready",{}),{msg:"Ping reached timeout",ms:e})}create(e){return n(this.waitForReady().then((()=>this.invoke("privy:wallet:create",e))),{msg:"Operation reached timeout: create"})}rpc(e){return this.invokeWithMfa((t=>this.invoke("privy:wallet:rpc",{...t,...e})),{timeoutMsg:"Operation reached timeout: rpc"})}createSolana(e){return this.invokeWithMfa((t=>this.invoke("privy:solana-wallet:create",{...t,...e})),{timeoutMsg:"Operation reached timeout: create",timeoutMs:6e4})}createAdditionalSolana(e){return n(this.waitForReady().then((()=>this.invoke("privy:solana-wallet:create-additional",e))),{msg:"Operation reached timeout: create"})}solanaRpc(e){return this.invokeWithMfa((t=>this.invoke("privy:solana-wallet:rpc",{...t,...e})),{timeoutMsg:"Operation reached timeout: solana-rpc"})}delegateWallets(e){return this.invokeWithMfa((t=>this.invoke("privy:delegated-actions:consent",{...t,...e})),{timeoutMsg:"Operation reached timeout: delegated-actions:consent"})}verifyMfa(e){return this.invokeWithMfa((t=>this.invoke("privy:mfa:verify",{...t,...e})),{timeoutMsg:"Operation reached timeout: mfa:verify",mfaAlwaysRequired:!0})}initEnrollMfa(e){return this.invokeWithMfa((t=>this.invoke("privy:mfa:init-enrollment",{...t,...e})),{timeoutMsg:"Operation reached timeout: mfa:init-enrollment"})}submitEnrollMfa(e){return"passkey"===e.method?this.invokeWithMfa((t=>this.invoke("privy:mfa:submit-enrollment",{...t,...e})),{timeoutMsg:"Operation reached timeout: mfa:submit-enrollment"}):n(this.waitForReady().then((()=>this.invoke("privy:mfa:submit-enrollment",e))),{msg:"Operation reached timeout: mfa:submit-enrollment"})}unenrollMfa(e){return this.invokeWithMfa((t=>this.invoke("privy:mfa:unenroll",{...t,...e})),{timeoutMsg:"Operation reached timeout: mfa:unenroll",mfaAlwaysRequired:!0})}clearMfa(e){return n(this.waitForReady().then((()=>this.invoke("privy:mfa:clear",e))),{msg:"Operation reached timeout: mfa:clear"})}createWallet(e){return this.invokeWithMfa((t=>this.invoke("privy:wallets:create",{...t,...e})),{timeoutMsg:"Operation reached timeout: create",timeoutMs:6e4})}signWithUserSigner(e){return this.invokeWithMfa((t=>this.invoke("privy:user-signer:sign",{...t,...e})),{timeoutMsg:"Operation reached timeout: user-signer:sign"})}addWallet(e){return n(this.waitForReady().then((()=>this.invoke("privy:wallets:add",e))),{msg:"Operation reached timeout: wallets:add"})}setRecovery(e){return this.invokeWithMfa((t=>this.invoke("privy:wallets:set-recovery",{...t,...e})),{timeoutMsg:"Operation reached timeout: wallets:set-recovery",timeoutMs:6e4})}connect(e){return n(this.waitForReady().then((()=>this.invoke("privy:wallets:connect",e))),{msg:"Operation reached timeout: wallets:connect"})}recover(e){return this.invokeWithMfa((t=>this.invoke("privy:wallets:recover",{...t,...e})),{timeoutMsg:"Operation reached timeout: wallets:recover",timeoutMs:6e4})}rpcWallet(e){return this.invokeWithMfa((t=>this.invoke("privy:wallets:rpc",{...t,...e})),{timeoutMsg:"Operation reached timeout: wallets:rpc"})}handleEmbeddedWalletMessages(e){if(!e.event.startsWith("privy:"))return void console.warn(`Unsupported event type: ${e.event}`);let{reject:t,resolve:i}=l.dequeue(e.event,e.id);return void 0!==e.error?t(new r.PrivyIframeError(e.error.type,e.error.message)):i(e.data)}waitForReady(){return this.ready?Promise.resolve():new Promise((async(e,i)=>{for(;!this.ready;)this.invoke("privy:iframe:ready",{}).then((()=>{this.ready=!0,e()})).catch(i),await t.sleep(150)}))}invoke(e,t){let i=((e,t)=>`${e}${JSON.stringify(t,o)}`)(e,t);if("privy:wallet:create"===e||"privy:solana-wallet:create"===e){let e=this.cache.get(i);if(e)return e}let r=new Promise(((i,r)=>{let a=s();l.enqueue(a,{resolve:i,reject:r}),this._embeddedWalletMessagePoster.postMessage(JSON.stringify({id:a,event:e,data:t}),"*")})).finally((()=>{this.cache.delete(i)}));return this.cache.set(i,r),r}constructor(e,t){this.ready=!1,this.cache=new Map,this._embeddedWalletMessagePoster=e,this.mfa=t}};
|
|
1
|
+
"use strict";var e,t=require("../utils/sleep.js"),i=require("./EventCallbackQueue.js"),r=require("./errors.js"),a=require("./withMfa.js");require("./types.js");let s=(e=0,()=>"id-"+e++),o=(e,t)=>"bigint"==typeof t?t.toString():t,n=async(e,{ms:t,msg:i})=>{let r,a=new Promise(((e,a)=>{r=setTimeout((()=>{a(Error(i))}),t??15e3)}));try{return await Promise.race([e,a])}finally{void 0!==r&&clearTimeout(r)}},l=new i.EventCallbacksQueue;exports.DEFAULT_WALLET_PROXY_TIMEOUT_MS=15e3,exports.EmbeddedWalletProxy=class{invokeWithMfa(e,t){return n(a.withMfa((i=>n(this.waitForReady().then((()=>e(i))),{msg:t.timeoutMsg,ms:t.timeoutMs})),this.mfa.rootPromise,this.mfa.submitPromise,(()=>this.mfa.emit("mfaRequired")),t.mfaAlwaysRequired??!1,4,3e5),{msg:"Operation reached timeout: MFA verification",ms:126e4})}reload(){return this.ready=!1,this._embeddedWalletMessagePoster.reload()}ping(e=15e3){return n(this.invoke("privy:iframe:ready",{}),{msg:"Ping reached timeout",ms:e})}create(e){return n(this.waitForReady().then((()=>this.invoke("privy:wallet:create",e))),{msg:"Operation reached timeout: create"})}rpc(e){return this.invokeWithMfa((t=>this.invoke("privy:wallet:rpc",{...t,...e})),{timeoutMsg:"Operation reached timeout: rpc"})}createSolana(e){return this.invokeWithMfa((t=>this.invoke("privy:solana-wallet:create",{...t,...e})),{timeoutMsg:"Operation reached timeout: create",timeoutMs:6e4})}createAdditionalSolana(e){return n(this.waitForReady().then((()=>this.invoke("privy:solana-wallet:create-additional",e))),{msg:"Operation reached timeout: create"})}solanaRpc(e){return this.invokeWithMfa((t=>this.invoke("privy:solana-wallet:rpc",{...t,...e})),{timeoutMsg:"Operation reached timeout: solana-rpc"})}delegateWallets(e){return this.invokeWithMfa((t=>this.invoke("privy:delegated-actions:consent",{...t,...e})),{timeoutMsg:"Operation reached timeout: delegated-actions:consent"})}verifyMfa(e){return this.invokeWithMfa((t=>this.invoke("privy:mfa:verify",{...t,...e})),{timeoutMsg:"Operation reached timeout: mfa:verify",mfaAlwaysRequired:!0})}initEnrollMfa(e){return this.invokeWithMfa((t=>this.invoke("privy:mfa:init-enrollment",{...t,...e})),{timeoutMsg:"Operation reached timeout: mfa:init-enrollment"})}submitEnrollMfa(e){return"passkey"===e.method?this.invokeWithMfa((t=>this.invoke("privy:mfa:submit-enrollment",{...t,...e})),{timeoutMsg:"Operation reached timeout: mfa:submit-enrollment"}):n(this.waitForReady().then((()=>this.invoke("privy:mfa:submit-enrollment",e))),{msg:"Operation reached timeout: mfa:submit-enrollment"})}unenrollMfa(e){return this.invokeWithMfa((t=>this.invoke("privy:mfa:unenroll",{...t,...e})),{timeoutMsg:"Operation reached timeout: mfa:unenroll",mfaAlwaysRequired:!0})}unlinkPasskey(e){return this.invokeWithMfa((t=>this.invoke("privy:auth:unlink-passkey",{...t,...e})),{timeoutMsg:"Operation reached timeout: auth:unlink-passkey",mfaAlwaysRequired:!0})}clearMfa(e){return n(this.waitForReady().then((()=>this.invoke("privy:mfa:clear",e))),{msg:"Operation reached timeout: mfa:clear"})}createWallet(e){return this.invokeWithMfa((t=>this.invoke("privy:wallets:create",{...t,...e})),{timeoutMsg:"Operation reached timeout: create",timeoutMs:6e4})}signWithUserSigner(e){return this.invokeWithMfa((t=>this.invoke("privy:user-signer:sign",{...t,...e})),{timeoutMsg:"Operation reached timeout: user-signer:sign"})}addWallet(e){return n(this.waitForReady().then((()=>this.invoke("privy:wallets:add",e))),{msg:"Operation reached timeout: wallets:add"})}setRecovery(e){return this.invokeWithMfa((t=>this.invoke("privy:wallets:set-recovery",{...t,...e})),{timeoutMsg:"Operation reached timeout: wallets:set-recovery",timeoutMs:6e4})}connect(e){return n(this.waitForReady().then((()=>this.invoke("privy:wallets:connect",e))),{msg:"Operation reached timeout: wallets:connect"})}recover(e){return this.invokeWithMfa((t=>this.invoke("privy:wallets:recover",{...t,...e})),{timeoutMsg:"Operation reached timeout: wallets:recover",timeoutMs:6e4})}rpcWallet(e){return this.invokeWithMfa((t=>this.invoke("privy:wallets:rpc",{...t,...e})),{timeoutMsg:"Operation reached timeout: wallets:rpc"})}handleEmbeddedWalletMessages(e){if(!e.event.startsWith("privy:"))return void console.warn(`Unsupported event type: ${e.event}`);let{reject:t,resolve:i}=l.dequeue(e.event,e.id);return void 0!==e.error?t(new r.PrivyIframeError(e.error.type,e.error.message)):i(e.data)}waitForReady(){return this.ready?Promise.resolve():new Promise((async(e,i)=>{for(;!this.ready;)this.invoke("privy:iframe:ready",{}).then((()=>{this.ready=!0,e()})).catch(i),await t.sleep(150)}))}invoke(e,t){let i=((e,t)=>`${e}${JSON.stringify(t,o)}`)(e,t);if("privy:wallet:create"===e||"privy:solana-wallet:create"===e){let e=this.cache.get(i);if(e)return e}let r=new Promise(((i,r)=>{let a=s();l.enqueue(a,{resolve:i,reject:r}),this._embeddedWalletMessagePoster.postMessage(JSON.stringify({id:a,event:e,data:t}),"*")})).finally((()=>{this.cache.delete(i)}));return this.cache.set(i,r),r}constructor(e,t){this.ready=!1,this.cache=new Map,this._embeddedWalletMessagePoster=e,this.mfa=t}};
|
|
2
2
|
//# sourceMappingURL=EmbeddedWalletProxy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmbeddedWalletProxy.js","sources":["../../../src/embedded/EmbeddedWalletProxy.ts"],"names":["id","uniqueId","replacer","_key","value","toString","withTimeout","async","promise","ms","msg","timer","timeout","Promise","_","reject","setTimeout","Error","race","undefined","clearTimeout","EVENT_CALLBACK_QUEUE","EventCallbacksQueue","invokeWithMfa","callback","options","withMfa","i","this","waitForReady","then","response","timeoutMsg","timeoutMs","mfa","rootPromise","submitPromise","emit","mfaAlwaysRequired","MAX_RETRY_COUNT","reload","ready","_embeddedWalletMessagePoster","ping","invoke","create","data","rpc","t","mfaArgs","createSolana","createAdditionalSolana","solanaRpc","delegateWallets","verifyMfa","initEnrollMfa","submitEnrollMfa","method","unenrollMfa","clearMfa","createWallet","signWithUserSigner","addWallet","setRecovery","connect","recover","rpcWallet","handleEmbeddedWalletMessages","event","startsWith","console","warn","resolve","dequeue","e","error","PrivyIframeError","type","message","catch","sleep","key","JSON","stringify","serialize","cached","cache","get","res","eventId","enqueue","postMessage","finally","delete","set","constructor","embeddedWalletMessagePoster","Map"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EmbeddedWalletProxy.js","sources":["../../../src/embedded/EmbeddedWalletProxy.ts"],"names":["id","uniqueId","replacer","_key","value","toString","withTimeout","async","promise","ms","msg","timer","timeout","Promise","_","reject","setTimeout","Error","race","undefined","clearTimeout","EVENT_CALLBACK_QUEUE","EventCallbacksQueue","invokeWithMfa","callback","options","withMfa","i","this","waitForReady","then","response","timeoutMsg","timeoutMs","mfa","rootPromise","submitPromise","emit","mfaAlwaysRequired","MAX_RETRY_COUNT","reload","ready","_embeddedWalletMessagePoster","ping","invoke","create","data","rpc","t","mfaArgs","createSolana","createAdditionalSolana","solanaRpc","delegateWallets","verifyMfa","initEnrollMfa","submitEnrollMfa","method","unenrollMfa","unlinkPasskey","clearMfa","createWallet","signWithUserSigner","addWallet","setRecovery","connect","recover","rpcWallet","handleEmbeddedWalletMessages","event","startsWith","console","warn","resolve","dequeue","e","error","PrivyIframeError","type","message","catch","sleep","key","JSON","stringify","serialize","cached","cache","get","res","eventId","enqueue","postMessage","finally","delete","set","constructor","embeddedWalletMessagePoster","Map"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("../../utils/encodings.js"),t=require("../../wallet-api/rpc.js"),a=require("./wallet-api-eth-transaction.js"),s=require("./wallet-api-eth-typed-data.js");require("@privy-io/routes"),require("../../wallet-api/generate-authorization-signature.js"),require("canonicalize"),require("@privy-io/encoding"),require("../../
|
|
1
|
+
"use strict";var e=require("../../utils/encodings.js"),t=require("../../wallet-api/rpc.js"),a=require("./wallet-api-eth-transaction.js"),s=require("./wallet-api-eth-typed-data.js");require("@privy-io/routes"),require("../../Error.js"),require("../../wallet-api/generate-authorization-signature.js"),require("canonicalize"),require("@privy-io/encoding"),require("../../wallet-api/types.js"),require("@privy-io/ethereum"),exports.walletRpc=async function({context:r,account:i,rpcRequest:n}){switch(n.chainType){case"ethereum":return async function({context:r,account:i,rpcRequest:n}){switch(n.method){case"personal_sign":{let[e]=n.params,a=await t.rpc(r,r.signRequest,{chain_type:"ethereum",method:"personal_sign",wallet_id:i.id,params:e.startsWith("0x")?{message:e.slice(2),encoding:"hex"}:{message:e,encoding:"utf-8"}});if("personal_sign"!==a.method)throw Error("Unable to sign message");return{data:a.data.signature}}case"eth_signTransaction":{let[e]=n.params,s=await t.rpc(r,r.signRequest,{chain_type:"ethereum",method:"eth_signTransaction",wallet_id:i.id,params:{transaction:a.toWalletApiUnsignedEthTransaction(e)}});if("eth_signTransaction"!==s.method)throw Error("Unable to sign transaction");return{data:s.data.signed_transaction}}case"eth_signTypedData_v4":{let[,e]=n.params,a=await t.rpc(r,r.signRequest,{chain_type:"ethereum",method:n.method,wallet_id:i.id,params:{typed_data:s.toWalletApiTypedData(e)}});if("eth_signTypedData_v4"!==a.method)throw Error("Unable to sign typed data");return{data:a.data.signature}}case"eth_sign":{let[,a]=n.params,s=await t.rpc(r,r.signRequest,{chain_type:"ethereum",method:"secp256k1_sign",wallet_id:i.id,params:{hash:e.isHexEncoded(a)?a:e.bytesToHex(e.utf8ToBytes(a))}});if("secp256k1_sign"!==s.method)throw Error("Unable to sign message");return{data:s.data.signature}}case"secp256k1_sign":{let[a]=n.params,s=await t.rpc(r,r.signRequest,{chain_type:"ethereum",method:"secp256k1_sign",wallet_id:i.id,params:{hash:e.isHexEncoded(a)?a:e.bytesToHex(e.utf8ToBytes(a))}});if("secp256k1_sign"!==s.method)throw Error("Unable to sign message");return{data:s.data.signature}}case"csw_signUserOperation":case"eth_sendTransaction":case"eth_populateTransactionRequest":throw Error(`This wallet does not support the method: ${n.method}`)}}({context:r,account:i,rpcRequest:n.request});case"solana":return async function({context:e,account:a,rpcRequest:s}){if("signMessage"===s.method){let{message:r}=s.params,i=await t.rpc(e,e.signRequest,{chain_type:"solana",method:"signMessage",wallet_id:a.id,params:{message:r,encoding:"base64"}});if("signMessage"!==i.method)throw Error("Unable to sign message");return{data:i.data.signature}}}({context:r,account:i,rpcRequest:n.request})}};
|
|
2
2
|
//# sourceMappingURL=walletRpc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../src/embedded/types.ts"],"names":["SUPPORTED_JSON_RPC_METHODS","SUPPORTED_SOLANA_RPC_METHODS","method","includes","t"],"mappings":"aA2BO,MAAMA,EAA6B,CACxC,WACA,iCACA,sBACA,gBACA,uBACA,wBACA,kBAiOF,IAAMC,EAA+B,CAAC,
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../src/embedded/types.ts"],"names":["SUPPORTED_JSON_RPC_METHODS","SUPPORTED_SOLANA_RPC_METHODS","method","includes","t"],"mappings":"aA2BO,MAAMA,EAA6B,CACxC,WACA,iCACA,sBACA,gBACA,uBACA,wBACA,kBAiOF,IAAMC,EAA+B,CAAC,6CA2yBD,CACnC,QACA,4BACA,uBACA,uBACA,qBACA,cACA,yBACA,2GAhhCmCC,GAC5BF,EAA2BG,SAASD,sCA+NHE,GACjCH,EAA6BE,SAASD"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("@privy-io/routes"),r=require("./action/depositAddress/generate.js"),s=require("./action/depositAddress/resolve-refund-address.js"),t=require("./action/depositAddress/polling.js");async function i(r){let s=await r.fetchPrivyRoute(e.GetDepositConfig,{});return{currencies:s.currencies,chains:s.chains}}var o=/*#__PURE__*/Object.freeze({__proto__:null,generateDepositAddress:r.generateDepositAddress,getConfig:i,getDeposit:t.getDeposit,resolveRefundAddress:s.resolveRefundAddress,waitForCompletion:t.waitForCompletion,waitForDeposit:t.waitForDeposit});exports.getConfig=i,exports.index=o;
|
|
2
|
+
//# sourceMappingURL=index--nYkyGeH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index--nYkyGeH.js","sources":["../../src/action/depositAddress/index.ts"],"names":["async","getConfig","privy","result","fetchPrivyRoute","GetDepositConfig","currencies","chains"],"mappings":"+MAwBOA,eAAeC,EAAUC,GAC9B,IAAMC,QAAeD,EAAME,gBAAgBC,EAAAA,iBAAkB,CAAA,GAC7D,MAAO,CAACC,WAAYH,EAAOG,WAAYC,OAAQJ,EAAOI,OACxD"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./client/Privy.js"),r=require("./storage/LocalStorage.js"),t=require("./storage/InMemoryStorage.js"),s=require("./Error.js"),i=require("./embedded/errors.js"),o=require("./utils/getUserEmbeddedEthereumWallet.js"),a=require("./utils/getAllUserEmbeddedEthereumWallets.js"),l=require("./utils/getAllUserEmbeddedSolanaWallets.js"),n=require("./utils/getAllUserEmbeddedBitcoinWallets.js"),d=require("./utils/embedded-wallets.js"),u=require("./utils/entropy.js"),p=require("./utils/getUserSmartWallet.js"),c=require("./embedded/utils/index.js"),m=require("./embedded/stack/wallet-api-eth-transaction.js"),q=require("./utils/phoneNumberUtils.js"),j=require("./utils/getUserEmbeddedSolanaWallet.js"),g=require("./utils/toObjectKeys.js"),A=require("./utils/getIsTokenUsdc.js"),x=require("./utils/generateWalletIdempotencyKey.js"),b=require("./funding/moonpay.js"),y=require("./funding/coinbase.js"),E=require("./solana/client.js"),h=require("./solana/createSiwsMessage.js"),C=require("./solana/getSolanaRpcEndpointForCluster.js"),S=require("./solana/getSolanaUsdcMintAddressForCluster.js"),W=require("./solana/getSolanaClusterDisplayName.js"),f=require("./types.js"),P=require("@privy-io/chains"),v=require("./utils/formatters.js"),M=require("./wallet-api/generate-authorization-signature.js"),U=require("./wallet-api/create.js"),I=require("./wallet-api/rpc.js"),T=require("./wallet-api/raw-sign.js"),w=require("./wallet-api/get-wallet.js"),R=require("./wallet-api/update-wallet.js"),F=require("./wallet-api/unified-wallet.js"),N=require("./embedded/stack/session-signers.js"),O=require("./solana/ConnectedStandardSolanaWallet.js"),k=require("./utils/poll.js"),L=require("./index-DzfqDJJ9.js"),_=require("./index-BDWdfIuK.js"),D=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./client/Privy.js"),r=require("./storage/LocalStorage.js"),t=require("./storage/InMemoryStorage.js"),s=require("./Error.js"),i=require("./embedded/errors.js"),o=require("./utils/getUserEmbeddedEthereumWallet.js"),a=require("./utils/getAllUserEmbeddedEthereumWallets.js"),l=require("./utils/getAllUserEmbeddedSolanaWallets.js"),n=require("./utils/getAllUserEmbeddedBitcoinWallets.js"),d=require("./utils/embedded-wallets.js"),u=require("./utils/entropy.js"),p=require("./utils/getUserSmartWallet.js"),c=require("./embedded/utils/index.js"),m=require("./embedded/stack/wallet-api-eth-transaction.js"),q=require("./utils/phoneNumberUtils.js"),j=require("./utils/getUserEmbeddedSolanaWallet.js"),g=require("./utils/toObjectKeys.js"),A=require("./utils/getIsTokenUsdc.js"),x=require("./utils/generateWalletIdempotencyKey.js"),b=require("./funding/moonpay.js"),y=require("./funding/coinbase.js"),E=require("./solana/client.js"),h=require("./solana/createSiwsMessage.js"),C=require("./solana/getSolanaRpcEndpointForCluster.js"),S=require("./solana/getSolanaUsdcMintAddressForCluster.js"),W=require("./solana/getSolanaClusterDisplayName.js"),f=require("./types.js"),P=require("@privy-io/chains"),v=require("./utils/formatters.js"),M=require("./wallet-api/generate-authorization-signature.js"),U=require("./wallet-api/create.js"),I=require("./wallet-api/rpc.js"),T=require("./wallet-api/raw-sign.js"),w=require("./wallet-api/get-wallet.js"),R=require("./wallet-api/update-wallet.js"),F=require("./wallet-api/unified-wallet.js"),N=require("./embedded/stack/session-signers.js"),O=require("./solana/ConnectedStandardSolanaWallet.js"),k=require("./utils/poll.js"),L=require("./index-DzfqDJJ9.js"),_=require("./index-BDWdfIuK.js"),D=require("./index--nYkyGeH.js"),B=require("libphonenumber-js/min");require("./crypto/resolve.js"),require("./client/AppApi.js"),require("@privy-io/routes"),require("./client/CrossAppApi.js"),require("./Token.js"),require("jose"),require("./client/DelegatedWalletsApi.js"),require("./client/EmbeddedWalletApi.js"),require("./embedded/EmbeddedBitcoinWalletProvider.js"),require("./embedded/stack/walletCreate.js"),require("./embedded/EmbeddedWalletProxy.js"),require("./utils/sleep.js"),require("./embedded/EventCallbackQueue.js"),require("./embedded/withMfa.js"),require("./embedded/EmbeddedWalletProvider.js"),require("eventemitter3"),require("viem"),require("@privy-io/ethereum"),require("./embedded/stack/walletRpc.js"),require("./utils/encodings.js"),require("./embedded/stack/wallet-api-eth-typed-data.js"),require("./embedded/EmbeddedSolanaWalletProvider.js"),require("./solana/getWalletPublicKeyFromTransaction.js"),require("./solana/isVersionedTransaction.js"),require("./client/MfaPromises.js"),require("./client/PrivyInternal.js"),require("fetch-retry"),require("@privy-io/api-base"),require("./Session.js"),require("js-cookie"),require("./utils/allSettled.js"),require("./toAbortSignalTimeout.js"),require("./utils/toSearchParams.js"),require("./client/logger.js"),require("./utils/noop.js"),require("./client/UserApi.js"),require("./client/auth/AuthApi.js"),require("./client/auth/CustomProviderApi.js"),require("./client/auth/maybeCreateWalletOnLogin.js"),require("./utils/shouldCreateEmbeddedEthWallet.js"),require("./utils/shouldCreateEmbeddedSolWallet.js"),require("./client/auth/EmailApi.js"),require("./client/auth/FarcasterApi.js"),require("./client/auth/FarcasterV2Api.js"),require("./client/auth/GuestApi.js"),require("./client/auth/OAuthApi.js"),require("./pkce.js"),require("./client/auth/PasskeyApi.js"),require("./client/auth/PhoneApi.js"),require("./client/auth/SiweApi.js"),require("./client/auth/SiwsApi.js"),require("./client/auth/SmartWalletApi.js"),require("./client/funding/FundingApi.js"),require("./client/funding/CoinbaseOnRampApi.js"),require("./client/funding/MoonpayOnRampApi.js"),require("./client/mfa/MfaApi.js"),require("./client/mfa/MfaPasskeyApi.js"),require("./client/mfa/MfaSmsApi.js"),require("./client/recovery/RecoveryApi.js"),require("./client/recovery/RecoveryICloudApi.js"),require("./client/recovery/RecoveryOAuthApi.js"),require("./embedded/types.js"),require("viem/chains"),require("libphonenumber-js/examples.mobile.json"),require("canonicalize"),require("@privy-io/encoding"),require("./wallet-api/types.js"),require("./action/delegatedActions/utils.js"),require("./action/crossApp/loginWithCrossAppAuth.js"),require("./action/crossApp/linkWithCrossAppAuth.js"),require("./index-CARkJvRM.js"),require("./action/crossApp/wallet/signMessage.js"),require("./action/crossApp/wallet/utils/isCrossAppWalletSmart.js"),require("./action/crossApp/wallet/utils/sendCrossAppRequest.js"),require("./action/crossApp/wallet/utils/getCrossAppAccountByWalletAddress.js"),require("./action/crossApp/wallet/utils/getProviderAccessTokenOrRelink.js"),require("./action/crossApp/wallet/utils/throwIfNotLoggedIn.js"),require("./action/crossApp/wallet/signTypedData.js"),require("./utils/typedData/generateDomainType.js"),require("./action/crossApp/wallet/sendTransaction.js"),require("./action/delegatedActions/delegateWallet.js"),require("./action/delegatedActions/revokeWallets.js"),require("./action/depositAddress/generate.js"),require("./action/depositAddress/resolve-refund-address.js"),require("./action/depositAddress/polling.js");exports.default=e.default,exports.LocalStorage=r.LocalStorage,exports.InMemoryCache=t.InMemoryCache,exports.MoonpayApiError=s.MoonpayApiError,exports.PrivyApiError=s.PrivyApiError,exports.PrivyClientError=s.PrivyClientError,exports.createErrorFormatter=s.createErrorFormatter,exports.errorIndicatesMfaCanceled=s.errorIndicatesMfaCanceled,exports.EmbeddedProviderError=i.EmbeddedProviderError,exports.PrivyConnectorError=i.PrivyConnectorError,exports.PrivyEmbeddedWalletErrorCode=i.PrivyEmbeddedWalletErrorCode,exports.PrivyProviderRpcError=i.PrivyProviderRpcError,exports.ProviderErrors=i.ProviderErrors,exports.errorIndicatesMaxMfaRetries=i.errorIndicatesMaxMfaRetries,exports.errorIndicatesMfaRateLimit=i.errorIndicatesMfaRateLimit,exports.errorIndicatesMfaTimeout=i.errorIndicatesMfaTimeout,exports.errorIndicatesMfaVerificationFailed=i.errorIndicatesMfaVerificationFailed,exports.errorIndicatesRecoveryIsNeeded=i.errorIndicatesRecoveryIsNeeded,exports.getUserEmbeddedEthereumWallet=o.getUserEmbeddedEthereumWallet,exports.getUserEmbeddedWallet=o.getUserEmbeddedWallet,exports.getAllUserEmbeddedEthereumWallets=a.getAllUserEmbeddedEthereumWallets,exports.getAllUserEmbeddedSolanaWallets=l.getAllUserEmbeddedSolanaWallets,exports.getAllUserEmbeddedBitcoinWallets=n.getAllUserEmbeddedBitcoinWallets,exports.isEmbeddedWalletAccount=d.isEmbeddedWalletAccount,exports.getEntropyDetailsFromAccount=u.getEntropyDetailsFromAccount,exports.getEntropyDetailsFromUser=u.getEntropyDetailsFromUser,exports.getUserSmartWallet=p.getUserSmartWallet,exports.getJsonRpcEndpointFromChain=c.getJsonRpcEndpointFromChain,exports.throwIfInvalidRecoveryUpgradePath=c.throwIfInvalidRecoveryUpgradePath,exports.toWalletApiUnsignedEthTransaction=m.toWalletApiUnsignedEthTransaction,exports.countryCodesAndNumbers=q.countryCodesAndNumbers,exports.formatPhoneNumber=q.formatPhoneNumber,exports.getPhoneCountryCodeAndNumber=q.getPhoneCountryCodeAndNumber,exports.getPlaceholderPhoneNumber=q.getPlaceholderPhoneNumber,exports.lastFourDigits=q.lastFourDigits,exports.phoneNumberTypingFormatter=q.phoneNumberTypingFormatter,exports.validatePhoneNumber=q.validatePhoneNumber,exports.getUserEmbeddedSolanaWallet=j.getUserEmbeddedSolanaWallet,exports.toObjectKeys=g.toObjectKeys,exports.SolanaUsdcAddressMap=A.SolanaUsdcAddressMap,exports.UsdcAddressMap=A.UsdcAddressMap,exports.getIsTokenUsdc=A.getIsTokenUsdc,exports.generateWalletIdempotencyKey=x.generateWalletIdempotencyKey,exports.chainToMoonpayCurrency=b.chainToMoonpayCurrency,exports.fundingMethodToMoonpayPaymentMethod=b.fundingMethodToMoonpayPaymentMethod,exports.isSupportedChainIdForMoonpay=b.isSupportedChainIdForMoonpay,exports.getCoinbaseOnRampUrl=y.getCoinbaseOnRampUrl,exports.isSupportedChainIdForCoinbaseOnramp=y.isSupportedChainIdForCoinbaseOnramp,exports.toCoinbaseAssetId=y.toCoinbaseAssetId,exports.toCoinbaseBlockchainFromChainId=y.toCoinbaseBlockchainFromChainId,exports.SolanaClient=E.SolanaClient,exports.createSiwsMessage=h.createSiwsMessage,exports.getSolanaRpcEndpointForCluster=C.getSolanaRpcEndpointForCluster,exports.getSolanaUsdcMintAddressForCluster=S.getSolanaUsdcMintAddressForCluster,exports.getSolanaClusterDisplayName=W.getSolanaClusterDisplayName,exports.ALL_WALLET_CLIENT_TYPES=f.ALL_WALLET_CLIENT_TYPES,exports.SUPPORTED_CONNECTOR_TYPES=f.SUPPORTED_CONNECTOR_TYPES,exports.formatLamportsAmount=v.formatLamportsAmount,exports.formatTokenAmount=v.formatTokenAmount,exports.formatWalletAddress=v.formatWalletAddress,exports.formatWeiAmount=v.formatWeiAmount,exports.generateAuthorizationSignature=M.generateAuthorizationSignature,exports.create=U.create,exports.rpc=I.rpc,exports.rawSign=T.rawSign,exports.getWallet=w.getWallet,exports.updateWallet=R.updateWallet,exports.isUnifiedWallet=F.isUnifiedWallet,exports.addSessionSigners=N.addSessionSigners,exports.removeSessionSigners=N.removeSessionSigners,exports.ConnectedStandardSolanaWallet=O.ConnectedStandardSolanaWallet,exports.poll=k.poll,exports.crossApp=L.index,exports.delegatedActions=_.index,exports.depositAddress=D.index,Object.defineProperty(exports,"getCountryCallingCode",{enumerable:!0,get:function(){return B.getCountryCallingCode}}),exports.BICONOMY="biconomy",exports.COINBASE_SMART_WALLET="coinbase_smart_wallet",exports.KERNEL="kernel",exports.LIGHT_ACCOUNT="light_account",exports.NEXUS="nexus",exports.SAFE="safe",exports.THIRDWEB="thirdweb",Object.keys(P).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return P[e]}})}));
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"names":[],"mappings":"80SAewB,yCAEa,uCAEf,+BAEO,8BAMR,qBAJD,wBAEI"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("@privy-io/routes"),r=require("./generate-authorization-signature.js"),
|
|
1
|
+
"use strict";var e=require("@privy-io/routes"),r=require("../Error.js"),i=require("./generate-authorization-signature.js"),a=require("./types.js");require("canonicalize"),require("@privy-io/encoding"),exports.rawSign=async function(t,n,{wallet_id:o,...l}){let u=t.getCompiledPath(e.WalletRawSign,{params:{wallet_id:o}}),s=String(Date.now()+a.DEFAULT_EXPIRY_TIME_MS),d={version:1,url:u,method:e.WalletRawSign.method,headers:{"privy-app-id":t.app.appId,[a.PRIVY_REQUEST_EXPIRY_HEADER_NAME]:s},body:{...l}},{signature:p}=await i.generateAuthorizationSignature(n,d);if(Date.now()>Number(s))throw new r.PrivyClientError({error:"Wallet request expired before it could be sent. Please try again.",code:"embedded_wallet_request_expired"});return await t.fetchPrivyRoute(e.WalletRawSign,{body:l,params:{wallet_id:o},headers:{"privy-authorization-signature":p,[a.PRIVY_REQUEST_EXPIRY_HEADER_NAME]:s}})};
|
|
2
2
|
//# sourceMappingURL=raw-sign.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"raw-sign.js","sources":["../../../src/wallet-api/raw-sign.ts"],"names":["async","context","sign","wallet_id","request","url","getCompiledPath","WalletRawSign","params","requestExpiry","String","Date","now","DEFAULT_EXPIRY_TIME_MS","payload","version","method","headers","app","appId","PRIVY_REQUEST_EXPIRY_HEADER_NAME","body","signature","generateAuthorizationSignature","fetchPrivyRoute"],"mappings":"
|
|
1
|
+
{"version":3,"file":"raw-sign.js","sources":["../../../src/wallet-api/raw-sign.ts"],"names":["async","context","sign","wallet_id","request","url","getCompiledPath","WalletRawSign","params","requestExpiry","String","Date","now","DEFAULT_EXPIRY_TIME_MS","payload","version","method","headers","app","appId","PRIVY_REQUEST_EXPIRY_HEADER_NAME","body","signature","generateAuthorizationSignature","Number","PrivyClientError","error","code","fetchPrivyRoute"],"mappings":"yNAwBOA,eACLC,EACAC,GACCC,UAAAA,KAAcC,IAEf,IAAMC,EAAMJ,EAAQK,gBAAgBC,EAAAA,cAAe,CAACC,OAAQ,CAACL,UAAAA,KAEvDM,EAAgBC,OAAOC,KAAKC,MAAQC,EAAAA,wBAEpCC,EAAU,CACdC,QAAS,EACTV,IAAAA,EACAW,OAAQT,EAAAA,cAAcS,OACtBC,QAAS,CACP,eAAgBhB,EAAQiB,IAAIC,MAC5B,CAACC,EAAAA,kCAAmCX,GAEtCY,KAAM,IACDjB,KAIAkB,UAAAA,SAAmBC,EAAAA,+BAA+BrB,EAAMY,GAK/D,GAAIH,KAAKC,MAAQY,OAAOf,GACtB,MAAM,IAAIgB,EAAAA,iBAAiB,CACzBC,MAAO,oEACPC,KAAM,oCAIV,aAAa1B,EAAQ2B,gBAAgBrB,EAAAA,cAAe,CAClDc,KAAMjB,EACNI,OAAQ,CAACL,UAAWA,GACpBc,QAAS,CACP,gCAAiCK,EACjC,CAACF,EAAAA,kCAAmCX,IAG1C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("@privy-io/routes"),r=require("./generate-authorization-signature.js"),i=require("./types.js");require("canonicalize"),require("@privy-io/encoding"),
|
|
1
|
+
"use strict";var e=require("@privy-io/routes"),r=require("../Error.js"),t=require("./generate-authorization-signature.js"),i=require("./types.js");require("canonicalize"),require("@privy-io/encoding"),exports.rpc=async function(a,o,{wallet_id:n,...l}){let u=a.getCompiledPath(e.WalletRpc,{params:{wallet_id:n}}),p=String(Date.now()+i.DEFAULT_EXPIRY_TIME_MS),s={version:1,url:u,method:e.WalletRpc.method,headers:{"privy-app-id":a.app.appId,[i.PRIVY_REQUEST_EXPIRY_HEADER_NAME]:p},body:{...l}},{signature:d}=await t.generateAuthorizationSignature(o,s);if(Date.now()>Number(p))throw new r.PrivyClientError({error:"Wallet request expired before it could be sent. Please try again.",code:"embedded_wallet_request_expired"});return await a.fetchPrivyRoute(e.WalletRpc,{body:l,params:{wallet_id:n},headers:{"privy-authorization-signature":d,[i.PRIVY_REQUEST_EXPIRY_HEADER_NAME]:p}})};
|
|
2
2
|
//# sourceMappingURL=rpc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc.js","sources":["../../../src/wallet-api/rpc.ts"],"names":["async","context","sign","wallet_id","request","url","getCompiledPath","WalletRpc","params","requestExpiry","String","Date","now","DEFAULT_EXPIRY_TIME_MS","payload","version","method","headers","app","appId","PRIVY_REQUEST_EXPIRY_HEADER_NAME","body","signature","generateAuthorizationSignature","fetchPrivyRoute"],"mappings":"
|
|
1
|
+
{"version":3,"file":"rpc.js","sources":["../../../src/wallet-api/rpc.ts"],"names":["async","context","sign","wallet_id","request","url","getCompiledPath","WalletRpc","params","requestExpiry","String","Date","now","DEFAULT_EXPIRY_TIME_MS","payload","version","method","headers","app","appId","PRIVY_REQUEST_EXPIRY_HEADER_NAME","body","signature","generateAuthorizationSignature","Number","PrivyClientError","error","code","fetchPrivyRoute"],"mappings":"qNAqBOA,eACLC,EACAC,GACCC,UAAAA,KAAcC,IAGf,IAAMC,EAAMJ,EAAQK,gBAAgBC,YAAW,CAACC,OAAQ,CAACL,UAAAA,KAEnDM,EAAgBC,OAAOC,KAAKC,MAAQC,0BAEpCC,EAAU,CACdC,QAAS,EACTV,IAAAA,EACAW,OAAQT,EAAAA,UAAUS,OAClBC,QAAS,CACP,eAAgBhB,EAAQiB,IAAIC,MAC5B,CAACC,EAAAA,kCAAmCX,GAEtCY,KAAM,IACDjB,KAIAkB,UAAAA,SAAmBC,EAAAA,+BAA+BrB,EAAMY,GAK/D,GAAIH,KAAKC,MAAQY,OAAOf,GACtB,MAAM,IAAIgB,EAAAA,iBAAiB,CACzBC,MAAO,oEACPC,KAAM,oCAIV,aAAa1B,EAAQ2B,gBAAgBrB,EAAAA,UAAW,CAC9Cc,KAAMjB,EACNI,OAAQ,CACNL,UAAWA,GAEbc,QAAS,CACP,gCAAiCK,EACjC,CAACF,EAAAA,kCAAmCX,IAG1C"}
|
package/dist/dts/index.d.mts
CHANGED
|
@@ -327,7 +327,7 @@ declare class EmbeddedWalletProvider extends EventEmitter implements EIP1193Prov
|
|
|
327
327
|
|
|
328
328
|
type AuthAction = 'login' | 'link';
|
|
329
329
|
type Method = 'email' | 'sms' | 'oauth' | 'siwe' | 'passkey' | 'farcaster' | 'siws';
|
|
330
|
-
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_link_cross_app_before_logged_in' | 'attempted_login_with_cross_app_while_already_logged_in' | 'attempted_cross_app_request_before_logged_in' | 'attempted_update_before_logged_in' | 'attempted_update_email_without_a_linked_email' | 'attempted_update_phone_without_a_linked_phone' | 'cross_app_invalid_app' | 'cross_app_read_only' | 'cross_app_invalid_wallet' | 'cross_app_request_error' | `attempted_unlink_siwe_before_logged_in` | 'oauth_session_failed' | 'oauth_session_timeout' | 'user_signer_sign_error' | 'invalid_input' | 'embedded_wallet_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' | 'delegated_actions_before_logged_in' | 'delegated_actions_wallet_not_found' | 'delegated_actions_no_wallet_to_revoke' | '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' | 'unsupported_chain_type' | 'invalid_mfa_code' | 'invalid_passkey_response' | 'storage_error' | 'smart_wallet_client_error' | 'chain_not_supported' | 'mfa_canceled' | 'configuration_error' | 'failed_to_fetch_moonpay_transaction_status' | 'unsupported_wallet_type';
|
|
330
|
+
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_link_cross_app_before_logged_in' | 'attempted_login_with_cross_app_while_already_logged_in' | 'attempted_cross_app_request_before_logged_in' | 'attempted_update_before_logged_in' | 'attempted_update_email_without_a_linked_email' | 'attempted_update_phone_without_a_linked_phone' | 'cross_app_invalid_app' | 'cross_app_read_only' | 'cross_app_invalid_wallet' | 'cross_app_request_error' | `attempted_unlink_siwe_before_logged_in` | 'oauth_session_failed' | 'oauth_session_timeout' | 'user_signer_sign_error' | 'invalid_input' | 'embedded_wallet_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' | 'embedded_wallet_request_expired' | 'delegated_actions_before_logged_in' | 'delegated_actions_wallet_not_found' | 'delegated_actions_no_wallet_to_revoke' | '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' | 'unsupported_chain_type' | 'invalid_mfa_code' | 'invalid_passkey_response' | 'storage_error' | 'smart_wallet_client_error' | 'chain_not_supported' | 'mfa_canceled' | 'configuration_error' | 'failed_to_fetch_moonpay_transaction_status' | 'unsupported_wallet_type';
|
|
331
331
|
type ErrorBody<T extends PrivyErrorCode | ClientErrorCode> = {
|
|
332
332
|
error: string;
|
|
333
333
|
code: T;
|
|
@@ -520,7 +520,7 @@ interface bitcoin_signTransactionResponse extends BaseBitcoinRpcResponseType {
|
|
|
520
520
|
};
|
|
521
521
|
}
|
|
522
522
|
type BitcoinRpcResponseType = bitcoin_signResponse | bitcoin_signTransactionResponse;
|
|
523
|
-
type PrivyEventType = 'privy:iframe:ready' | 'privy:user-signer:sign' | 'privy:wallets:create' | 'privy:wallets:add' | 'privy:wallets:set-recovery' | 'privy:wallets:connect' | 'privy:wallets:recover' | 'privy:wallets:rpc' | 'privy:wallet:create' | 'privy:wallet:connect' | 'privy:wallet:recover' | 'privy:wallet:rpc' | 'privy:solana-wallet:create' | 'privy:solana-wallet:create-additional' | 'privy:solana-wallet:connect' | 'privy:solana-wallet:recover' | 'privy:solana-wallet:rpc' | 'privy:delegated-actions:consent' | 'privy:mfa:verify' | 'privy:mfa:init-enrollment' | 'privy:mfa:submit-enrollment' | 'privy:mfa:unenroll' | 'privy:mfa:clear';
|
|
523
|
+
type PrivyEventType = 'privy:iframe:ready' | 'privy:user-signer:sign' | 'privy:wallets:create' | 'privy:wallets:add' | 'privy:wallets:set-recovery' | 'privy:wallets:connect' | 'privy:wallets:recover' | 'privy:wallets:rpc' | 'privy:wallet:create' | 'privy:wallet:connect' | 'privy:wallet:recover' | 'privy:wallet:rpc' | 'privy:solana-wallet:create' | 'privy:solana-wallet:create-additional' | 'privy:solana-wallet:connect' | 'privy:solana-wallet:recover' | 'privy:solana-wallet:rpc' | 'privy:delegated-actions:consent' | 'privy:mfa:verify' | 'privy:mfa:init-enrollment' | 'privy:mfa:submit-enrollment' | 'privy:mfa:unenroll' | 'privy:mfa:clear' | 'privy:auth:unlink-passkey';
|
|
524
524
|
type EmbeddedWalletRecoveryOptions = LinkedAccountEmbeddedWallet['recovery_method'];
|
|
525
525
|
type IEmbeddedWalletRecoveryOptions = EmbeddedWalletRecoveryOptions | 'icloud-native';
|
|
526
526
|
type PasswordRecoveryInput = {
|
|
@@ -723,7 +723,9 @@ type MfaUnenrollResponseDataType = Record<string, never>;
|
|
|
723
723
|
type MfaUnenrollResponseEventType = PrivyResponseBaseEventType<'privy:mfa:unenroll', MfaUnenrollResponseDataType>;
|
|
724
724
|
type MfaClearResponseDataType = Record<string, never>;
|
|
725
725
|
type MfaClearResponseEventType = PrivyResponseBaseEventType<'privy:mfa:clear', MfaClearResponseDataType>;
|
|
726
|
-
type
|
|
726
|
+
type UnlinkPasskeyResponseDataType = Record<string, never>;
|
|
727
|
+
type UnlinkPasskeyResponseEventType = PrivyResponseBaseEventType<'privy:auth:unlink-passkey', UnlinkPasskeyResponseDataType>;
|
|
728
|
+
type PrivyResponseDataType = IframeReadyResponseDataType | UserSignerSignResponseDataType | WalletsCreateResponseDataType | WalletsAddResponseDataType | WalletsSetRecoveryResponseDataType | WalletsConnectResponseDataType | WalletsRecoverResponseDataType | WalletsRpcResponseDataType | WalletCreateResponseDataType | WalletConnectResponseDataType | WalletRecoverResponseDataType | WalletRpcResponseDataType | SolanaWalletCreateResponseDataType | SolanaWalletConnectResponseDataType | SolanaWalletRecoverResponseDataType | SolanaWalletRpcResponseDataType | DelegatedActionsConsentResponseDataType | MfaVerifyResponseDataType | MfaInitEnrollmentResponseDataType | MfaSubmitEnrollmentResponseDataType | MfaUnenrollResponseDataType | MfaClearResponseDataType | UnlinkPasskeyResponseDataType;
|
|
727
729
|
declare const PrivyIframeErrorTypes: readonly ["error", "invalid_request_arguments", "wallet_not_on_device", "invalid_recovery_pin", "insufficient_funds", "mfa_timeout", "missing_or_invalid_mfa", "mfa_verification_max_attempts_reached"];
|
|
728
730
|
type PrivyIframeErrorTypesType = (typeof PrivyIframeErrorTypes)[number];
|
|
729
731
|
type PrivyErrorResponseEventType = PrivyResponseBaseEventType<PrivyEventType, PrivyResponseDataType> & {
|
|
@@ -732,7 +734,7 @@ type PrivyErrorResponseEventType = PrivyResponseBaseEventType<PrivyEventType, Pr
|
|
|
732
734
|
message: string;
|
|
733
735
|
};
|
|
734
736
|
};
|
|
735
|
-
type PrivyResponseEvent = IframeReadyResponseEventType | PrivyErrorResponseEventType | UserSignerSignResponseEventType | WalletsCreateResponseEventType | WalletsAddResponseEventType | WalletsSetRecoveryResponseEventType | WalletsConnectResponseEventType | WalletsRecoverResponseEventType | WalletsRpcResponseEventType | WalletCreateResponseEventType | WalletConnectResponseEventType | WalletRecoverResponseEventType | WalletRpcResponseEventType | SolanaWalletCreateResponseEventType | SolanaWalletCreateAdditionalResponseEventType | SolanaWalletConnectResponseEventType | SolanaWalletRecoverResponseEventType | SolanaWalletRpcResponseEventType | DelegatedActionsConsentResponseEventType | MfaVerifyResponseEventType | MfaInitEnrollmentResponseEventType | MfaSubmitEnrollmentResponseEventType | MfaUnenrollResponseEventType | MfaClearResponseEventType;
|
|
737
|
+
type PrivyResponseEvent = IframeReadyResponseEventType | PrivyErrorResponseEventType | UserSignerSignResponseEventType | WalletsCreateResponseEventType | WalletsAddResponseEventType | WalletsSetRecoveryResponseEventType | WalletsConnectResponseEventType | WalletsRecoverResponseEventType | WalletsRpcResponseEventType | WalletCreateResponseEventType | WalletConnectResponseEventType | WalletRecoverResponseEventType | WalletRpcResponseEventType | SolanaWalletCreateResponseEventType | SolanaWalletCreateAdditionalResponseEventType | SolanaWalletConnectResponseEventType | SolanaWalletRecoverResponseEventType | SolanaWalletRpcResponseEventType | DelegatedActionsConsentResponseEventType | MfaVerifyResponseEventType | MfaInitEnrollmentResponseEventType | MfaSubmitEnrollmentResponseEventType | MfaUnenrollResponseEventType | MfaClearResponseEventType | UnlinkPasskeyResponseEventType;
|
|
736
738
|
type EmbeddedWalletMessagePoster = {
|
|
737
739
|
postMessage: (message: any, targetOrigin: string, transfer?: Transferable) => void;
|
|
738
740
|
reload: () => void;
|
|
@@ -1417,7 +1419,7 @@ type CoinbaseWalletClientType = (typeof COINBASE_WALLET_CLIENT_TYPES)[number];
|
|
|
1417
1419
|
type WalletConnectWalletClientType = (typeof WALLET_CONNECT_WALLET_CLIENT_TYPES)[number];
|
|
1418
1420
|
declare const UNKNOWN_WALLET_CLIENT_TYPES: readonly ["unknown"];
|
|
1419
1421
|
type UnknownWalletClientType = (typeof UNKNOWN_WALLET_CLIENT_TYPES)[number];
|
|
1420
|
-
declare const ALL_WALLET_CLIENT_TYPES: ("safe" | "metamask" | "phantom" | "brave_wallet" | "rainbow" | "coinbase_wallet" | "trust" | "uniswap" | "zerion" | "argent" | "spot" | "omni" | "cryptocom" | "blockchain" | "safepal" | "bitget_wallet" | "zengo" | "1inch" | "binance" | "exodus" | "mew_wallet" | "alphawallet" | "keyring_pro" | "mathwallet" | "unstoppable" | "obvious" | "ambire" | "internet_money_wallet" | "coin98" | "abc_wallet" | "arculus_wallet" | "haha" | "cling_wallet" | "broearn" | "copiosa" | "burrito_wallet" | "enjin_wallet" | "plasma_wallet" | "avacus" | "bee" | "pitaka" | "pltwallet" | "minerva" | "kryptogo" | "prema" | "slingshot" | "kriptonio" | "timeless" | "secux" | "bitizen" | "blocto" | "safemoon" | "
|
|
1422
|
+
declare const ALL_WALLET_CLIENT_TYPES: ("safe" | "privy" | "metamask" | "phantom" | "brave_wallet" | "rainbow" | "coinbase_wallet" | "trust" | "uniswap" | "zerion" | "argent" | "spot" | "omni" | "cryptocom" | "blockchain" | "safepal" | "bitget_wallet" | "zengo" | "1inch" | "binance" | "exodus" | "mew_wallet" | "alphawallet" | "keyring_pro" | "mathwallet" | "unstoppable" | "obvious" | "ambire" | "internet_money_wallet" | "coin98" | "abc_wallet" | "arculus_wallet" | "haha" | "cling_wallet" | "broearn" | "copiosa" | "burrito_wallet" | "enjin_wallet" | "plasma_wallet" | "avacus" | "bee" | "pitaka" | "pltwallet" | "minerva" | "kryptogo" | "prema" | "slingshot" | "kriptonio" | "timeless" | "secux" | "bitizen" | "blocto" | "safemoon" | "unknown")[];
|
|
1421
1423
|
type WalletClientType = InjectedWalletClientType | CoinbaseWalletClientType | WalletConnectWalletClientType | EmbeddedWalletClientType | UnknownWalletClientType;
|
|
1422
1424
|
declare const SUPPORTED_CONNECTOR_TYPES: readonly ["injected", "wallet_connect", "wallet_connect_v2", "coinbase_wallet", "embedded"];
|
|
1423
1425
|
type ConnectorType = (typeof SUPPORTED_CONNECTOR_TYPES)[number];
|
|
@@ -1861,6 +1863,14 @@ declare class MfaApi {
|
|
|
1861
1863
|
* event through the MfaApi instance.
|
|
1862
1864
|
*/
|
|
1863
1865
|
unenrollMfa(method: 'sms' | 'totp'): Promise<MfaUnenrollResponseDataType>;
|
|
1866
|
+
/**
|
|
1867
|
+
* Sends privy:auth:unlink-passkey event to the embedded wallet iframe to delete a specific
|
|
1868
|
+
* passkey by credential ID. Requires MFA verification.
|
|
1869
|
+
*/
|
|
1870
|
+
unlinkPasskey({ credentialId, removeAsMfa, }: {
|
|
1871
|
+
credentialId: string;
|
|
1872
|
+
removeAsMfa?: boolean;
|
|
1873
|
+
}): Promise<void>;
|
|
1864
1874
|
/**
|
|
1865
1875
|
* Sends privy:mfa:clear event to the embedded wallet iframe.
|
|
1866
1876
|
*/
|
|
@@ -2715,6 +2725,29 @@ type ResolveRefundAddressResult = {
|
|
|
2715
2725
|
error: ResolveRefundAddressError;
|
|
2716
2726
|
};
|
|
2717
2727
|
|
|
2728
|
+
declare function generateDepositAddress(opts: GenerateDepositAddressInput & {
|
|
2729
|
+
privy: Privy;
|
|
2730
|
+
onWalletCreated?: () => Promise<unknown>;
|
|
2731
|
+
}): Promise<DepositAddressQuote>;
|
|
2732
|
+
|
|
2733
|
+
declare function resolveRefundAddress(opts: {
|
|
2734
|
+
privy: Privy;
|
|
2735
|
+
caip2: string;
|
|
2736
|
+
onWalletCreated?: () => Promise<unknown>;
|
|
2737
|
+
}): Promise<ResolveRefundAddressResult>;
|
|
2738
|
+
|
|
2739
|
+
declare function getDeposit(opts: GetDepositInput & {
|
|
2740
|
+
privy: Privy;
|
|
2741
|
+
}): Promise<DepositAddressOrder>;
|
|
2742
|
+
declare function waitForDeposit(opts: WaitForDepositInput & {
|
|
2743
|
+
privy: Privy;
|
|
2744
|
+
}): Promise<DepositAddressPollingResult>;
|
|
2745
|
+
declare function waitForCompletion(opts: WaitForCompletionInput & {
|
|
2746
|
+
privy: Privy;
|
|
2747
|
+
}): Promise<DepositAddressPollingResult>;
|
|
2748
|
+
|
|
2749
|
+
declare function getConfig(privy: Privy): Promise<DepositConfig>;
|
|
2750
|
+
|
|
2718
2751
|
type index_CompletedDepositAddressOrder = CompletedDepositAddressOrder;
|
|
2719
2752
|
type index_DepositAddressOrder = DepositAddressOrder;
|
|
2720
2753
|
type index_DepositAddressPollingResult = DepositAddressPollingResult;
|
|
@@ -2727,7 +2760,14 @@ type index_ResolveRefundAddressError = ResolveRefundAddressError;
|
|
|
2727
2760
|
type index_ResolveRefundAddressResult = ResolveRefundAddressResult;
|
|
2728
2761
|
type index_WaitForCompletionInput = WaitForCompletionInput;
|
|
2729
2762
|
type index_WaitForDepositInput = WaitForDepositInput;
|
|
2763
|
+
declare const index_generateDepositAddress: typeof generateDepositAddress;
|
|
2764
|
+
declare const index_getConfig: typeof getConfig;
|
|
2765
|
+
declare const index_getDeposit: typeof getDeposit;
|
|
2766
|
+
declare const index_resolveRefundAddress: typeof resolveRefundAddress;
|
|
2767
|
+
declare const index_waitForCompletion: typeof waitForCompletion;
|
|
2768
|
+
declare const index_waitForDeposit: typeof waitForDeposit;
|
|
2730
2769
|
declare namespace index {
|
|
2770
|
+
export { index_generateDepositAddress as generateDepositAddress, index_getConfig as getConfig, index_getDeposit as getDeposit, index_resolveRefundAddress as resolveRefundAddress, index_waitForCompletion as waitForCompletion, index_waitForDeposit as waitForDeposit };
|
|
2731
2771
|
export type { index_CompletedDepositAddressOrder as CompletedDepositAddressOrder, index_DepositAddressOrder as DepositAddressOrder, index_DepositAddressPollingResult as DepositAddressPollingResult, index_DepositAddressQuote as DepositAddressQuote, index_DepositConfig as DepositConfig, index_GenerateDepositAddressInput as GenerateDepositAddressInput, index_GetDepositInput as GetDepositInput, index_IncompleteDepositAddressOrder as IncompleteDepositAddressOrder, index_ResolveRefundAddressError as ResolveRefundAddressError, index_ResolveRefundAddressResult as ResolveRefundAddressResult, index_WaitForCompletionInput as WaitForCompletionInput, index_WaitForDepositInput as WaitForDepositInput };
|
|
2732
2772
|
}
|
|
2733
2773
|
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -327,7 +327,7 @@ declare class EmbeddedWalletProvider extends EventEmitter implements EIP1193Prov
|
|
|
327
327
|
|
|
328
328
|
type AuthAction = 'login' | 'link';
|
|
329
329
|
type Method = 'email' | 'sms' | 'oauth' | 'siwe' | 'passkey' | 'farcaster' | 'siws';
|
|
330
|
-
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_link_cross_app_before_logged_in' | 'attempted_login_with_cross_app_while_already_logged_in' | 'attempted_cross_app_request_before_logged_in' | 'attempted_update_before_logged_in' | 'attempted_update_email_without_a_linked_email' | 'attempted_update_phone_without_a_linked_phone' | 'cross_app_invalid_app' | 'cross_app_read_only' | 'cross_app_invalid_wallet' | 'cross_app_request_error' | `attempted_unlink_siwe_before_logged_in` | 'oauth_session_failed' | 'oauth_session_timeout' | 'user_signer_sign_error' | 'invalid_input' | 'embedded_wallet_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' | 'delegated_actions_before_logged_in' | 'delegated_actions_wallet_not_found' | 'delegated_actions_no_wallet_to_revoke' | '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' | 'unsupported_chain_type' | 'invalid_mfa_code' | 'invalid_passkey_response' | 'storage_error' | 'smart_wallet_client_error' | 'chain_not_supported' | 'mfa_canceled' | 'configuration_error' | 'failed_to_fetch_moonpay_transaction_status' | 'unsupported_wallet_type';
|
|
330
|
+
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_link_cross_app_before_logged_in' | 'attempted_login_with_cross_app_while_already_logged_in' | 'attempted_cross_app_request_before_logged_in' | 'attempted_update_before_logged_in' | 'attempted_update_email_without_a_linked_email' | 'attempted_update_phone_without_a_linked_phone' | 'cross_app_invalid_app' | 'cross_app_read_only' | 'cross_app_invalid_wallet' | 'cross_app_request_error' | `attempted_unlink_siwe_before_logged_in` | 'oauth_session_failed' | 'oauth_session_timeout' | 'user_signer_sign_error' | 'invalid_input' | 'embedded_wallet_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' | 'embedded_wallet_request_expired' | 'delegated_actions_before_logged_in' | 'delegated_actions_wallet_not_found' | 'delegated_actions_no_wallet_to_revoke' | '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' | 'unsupported_chain_type' | 'invalid_mfa_code' | 'invalid_passkey_response' | 'storage_error' | 'smart_wallet_client_error' | 'chain_not_supported' | 'mfa_canceled' | 'configuration_error' | 'failed_to_fetch_moonpay_transaction_status' | 'unsupported_wallet_type';
|
|
331
331
|
type ErrorBody<T extends PrivyErrorCode | ClientErrorCode> = {
|
|
332
332
|
error: string;
|
|
333
333
|
code: T;
|
|
@@ -520,7 +520,7 @@ interface bitcoin_signTransactionResponse extends BaseBitcoinRpcResponseType {
|
|
|
520
520
|
};
|
|
521
521
|
}
|
|
522
522
|
type BitcoinRpcResponseType = bitcoin_signResponse | bitcoin_signTransactionResponse;
|
|
523
|
-
type PrivyEventType = 'privy:iframe:ready' | 'privy:user-signer:sign' | 'privy:wallets:create' | 'privy:wallets:add' | 'privy:wallets:set-recovery' | 'privy:wallets:connect' | 'privy:wallets:recover' | 'privy:wallets:rpc' | 'privy:wallet:create' | 'privy:wallet:connect' | 'privy:wallet:recover' | 'privy:wallet:rpc' | 'privy:solana-wallet:create' | 'privy:solana-wallet:create-additional' | 'privy:solana-wallet:connect' | 'privy:solana-wallet:recover' | 'privy:solana-wallet:rpc' | 'privy:delegated-actions:consent' | 'privy:mfa:verify' | 'privy:mfa:init-enrollment' | 'privy:mfa:submit-enrollment' | 'privy:mfa:unenroll' | 'privy:mfa:clear';
|
|
523
|
+
type PrivyEventType = 'privy:iframe:ready' | 'privy:user-signer:sign' | 'privy:wallets:create' | 'privy:wallets:add' | 'privy:wallets:set-recovery' | 'privy:wallets:connect' | 'privy:wallets:recover' | 'privy:wallets:rpc' | 'privy:wallet:create' | 'privy:wallet:connect' | 'privy:wallet:recover' | 'privy:wallet:rpc' | 'privy:solana-wallet:create' | 'privy:solana-wallet:create-additional' | 'privy:solana-wallet:connect' | 'privy:solana-wallet:recover' | 'privy:solana-wallet:rpc' | 'privy:delegated-actions:consent' | 'privy:mfa:verify' | 'privy:mfa:init-enrollment' | 'privy:mfa:submit-enrollment' | 'privy:mfa:unenroll' | 'privy:mfa:clear' | 'privy:auth:unlink-passkey';
|
|
524
524
|
type EmbeddedWalletRecoveryOptions = LinkedAccountEmbeddedWallet['recovery_method'];
|
|
525
525
|
type IEmbeddedWalletRecoveryOptions = EmbeddedWalletRecoveryOptions | 'icloud-native';
|
|
526
526
|
type PasswordRecoveryInput = {
|
|
@@ -723,7 +723,9 @@ type MfaUnenrollResponseDataType = Record<string, never>;
|
|
|
723
723
|
type MfaUnenrollResponseEventType = PrivyResponseBaseEventType<'privy:mfa:unenroll', MfaUnenrollResponseDataType>;
|
|
724
724
|
type MfaClearResponseDataType = Record<string, never>;
|
|
725
725
|
type MfaClearResponseEventType = PrivyResponseBaseEventType<'privy:mfa:clear', MfaClearResponseDataType>;
|
|
726
|
-
type
|
|
726
|
+
type UnlinkPasskeyResponseDataType = Record<string, never>;
|
|
727
|
+
type UnlinkPasskeyResponseEventType = PrivyResponseBaseEventType<'privy:auth:unlink-passkey', UnlinkPasskeyResponseDataType>;
|
|
728
|
+
type PrivyResponseDataType = IframeReadyResponseDataType | UserSignerSignResponseDataType | WalletsCreateResponseDataType | WalletsAddResponseDataType | WalletsSetRecoveryResponseDataType | WalletsConnectResponseDataType | WalletsRecoverResponseDataType | WalletsRpcResponseDataType | WalletCreateResponseDataType | WalletConnectResponseDataType | WalletRecoverResponseDataType | WalletRpcResponseDataType | SolanaWalletCreateResponseDataType | SolanaWalletConnectResponseDataType | SolanaWalletRecoverResponseDataType | SolanaWalletRpcResponseDataType | DelegatedActionsConsentResponseDataType | MfaVerifyResponseDataType | MfaInitEnrollmentResponseDataType | MfaSubmitEnrollmentResponseDataType | MfaUnenrollResponseDataType | MfaClearResponseDataType | UnlinkPasskeyResponseDataType;
|
|
727
729
|
declare const PrivyIframeErrorTypes: readonly ["error", "invalid_request_arguments", "wallet_not_on_device", "invalid_recovery_pin", "insufficient_funds", "mfa_timeout", "missing_or_invalid_mfa", "mfa_verification_max_attempts_reached"];
|
|
728
730
|
type PrivyIframeErrorTypesType = (typeof PrivyIframeErrorTypes)[number];
|
|
729
731
|
type PrivyErrorResponseEventType = PrivyResponseBaseEventType<PrivyEventType, PrivyResponseDataType> & {
|
|
@@ -732,7 +734,7 @@ type PrivyErrorResponseEventType = PrivyResponseBaseEventType<PrivyEventType, Pr
|
|
|
732
734
|
message: string;
|
|
733
735
|
};
|
|
734
736
|
};
|
|
735
|
-
type PrivyResponseEvent = IframeReadyResponseEventType | PrivyErrorResponseEventType | UserSignerSignResponseEventType | WalletsCreateResponseEventType | WalletsAddResponseEventType | WalletsSetRecoveryResponseEventType | WalletsConnectResponseEventType | WalletsRecoverResponseEventType | WalletsRpcResponseEventType | WalletCreateResponseEventType | WalletConnectResponseEventType | WalletRecoverResponseEventType | WalletRpcResponseEventType | SolanaWalletCreateResponseEventType | SolanaWalletCreateAdditionalResponseEventType | SolanaWalletConnectResponseEventType | SolanaWalletRecoverResponseEventType | SolanaWalletRpcResponseEventType | DelegatedActionsConsentResponseEventType | MfaVerifyResponseEventType | MfaInitEnrollmentResponseEventType | MfaSubmitEnrollmentResponseEventType | MfaUnenrollResponseEventType | MfaClearResponseEventType;
|
|
737
|
+
type PrivyResponseEvent = IframeReadyResponseEventType | PrivyErrorResponseEventType | UserSignerSignResponseEventType | WalletsCreateResponseEventType | WalletsAddResponseEventType | WalletsSetRecoveryResponseEventType | WalletsConnectResponseEventType | WalletsRecoverResponseEventType | WalletsRpcResponseEventType | WalletCreateResponseEventType | WalletConnectResponseEventType | WalletRecoverResponseEventType | WalletRpcResponseEventType | SolanaWalletCreateResponseEventType | SolanaWalletCreateAdditionalResponseEventType | SolanaWalletConnectResponseEventType | SolanaWalletRecoverResponseEventType | SolanaWalletRpcResponseEventType | DelegatedActionsConsentResponseEventType | MfaVerifyResponseEventType | MfaInitEnrollmentResponseEventType | MfaSubmitEnrollmentResponseEventType | MfaUnenrollResponseEventType | MfaClearResponseEventType | UnlinkPasskeyResponseEventType;
|
|
736
738
|
type EmbeddedWalletMessagePoster = {
|
|
737
739
|
postMessage: (message: any, targetOrigin: string, transfer?: Transferable) => void;
|
|
738
740
|
reload: () => void;
|
|
@@ -1417,7 +1419,7 @@ type CoinbaseWalletClientType = (typeof COINBASE_WALLET_CLIENT_TYPES)[number];
|
|
|
1417
1419
|
type WalletConnectWalletClientType = (typeof WALLET_CONNECT_WALLET_CLIENT_TYPES)[number];
|
|
1418
1420
|
declare const UNKNOWN_WALLET_CLIENT_TYPES: readonly ["unknown"];
|
|
1419
1421
|
type UnknownWalletClientType = (typeof UNKNOWN_WALLET_CLIENT_TYPES)[number];
|
|
1420
|
-
declare const ALL_WALLET_CLIENT_TYPES: ("safe" | "metamask" | "phantom" | "brave_wallet" | "rainbow" | "coinbase_wallet" | "trust" | "uniswap" | "zerion" | "argent" | "spot" | "omni" | "cryptocom" | "blockchain" | "safepal" | "bitget_wallet" | "zengo" | "1inch" | "binance" | "exodus" | "mew_wallet" | "alphawallet" | "keyring_pro" | "mathwallet" | "unstoppable" | "obvious" | "ambire" | "internet_money_wallet" | "coin98" | "abc_wallet" | "arculus_wallet" | "haha" | "cling_wallet" | "broearn" | "copiosa" | "burrito_wallet" | "enjin_wallet" | "plasma_wallet" | "avacus" | "bee" | "pitaka" | "pltwallet" | "minerva" | "kryptogo" | "prema" | "slingshot" | "kriptonio" | "timeless" | "secux" | "bitizen" | "blocto" | "safemoon" | "
|
|
1422
|
+
declare const ALL_WALLET_CLIENT_TYPES: ("safe" | "privy" | "metamask" | "phantom" | "brave_wallet" | "rainbow" | "coinbase_wallet" | "trust" | "uniswap" | "zerion" | "argent" | "spot" | "omni" | "cryptocom" | "blockchain" | "safepal" | "bitget_wallet" | "zengo" | "1inch" | "binance" | "exodus" | "mew_wallet" | "alphawallet" | "keyring_pro" | "mathwallet" | "unstoppable" | "obvious" | "ambire" | "internet_money_wallet" | "coin98" | "abc_wallet" | "arculus_wallet" | "haha" | "cling_wallet" | "broearn" | "copiosa" | "burrito_wallet" | "enjin_wallet" | "plasma_wallet" | "avacus" | "bee" | "pitaka" | "pltwallet" | "minerva" | "kryptogo" | "prema" | "slingshot" | "kriptonio" | "timeless" | "secux" | "bitizen" | "blocto" | "safemoon" | "unknown")[];
|
|
1421
1423
|
type WalletClientType = InjectedWalletClientType | CoinbaseWalletClientType | WalletConnectWalletClientType | EmbeddedWalletClientType | UnknownWalletClientType;
|
|
1422
1424
|
declare const SUPPORTED_CONNECTOR_TYPES: readonly ["injected", "wallet_connect", "wallet_connect_v2", "coinbase_wallet", "embedded"];
|
|
1423
1425
|
type ConnectorType = (typeof SUPPORTED_CONNECTOR_TYPES)[number];
|
|
@@ -1861,6 +1863,14 @@ declare class MfaApi {
|
|
|
1861
1863
|
* event through the MfaApi instance.
|
|
1862
1864
|
*/
|
|
1863
1865
|
unenrollMfa(method: 'sms' | 'totp'): Promise<MfaUnenrollResponseDataType>;
|
|
1866
|
+
/**
|
|
1867
|
+
* Sends privy:auth:unlink-passkey event to the embedded wallet iframe to delete a specific
|
|
1868
|
+
* passkey by credential ID. Requires MFA verification.
|
|
1869
|
+
*/
|
|
1870
|
+
unlinkPasskey({ credentialId, removeAsMfa, }: {
|
|
1871
|
+
credentialId: string;
|
|
1872
|
+
removeAsMfa?: boolean;
|
|
1873
|
+
}): Promise<void>;
|
|
1864
1874
|
/**
|
|
1865
1875
|
* Sends privy:mfa:clear event to the embedded wallet iframe.
|
|
1866
1876
|
*/
|
|
@@ -2715,6 +2725,29 @@ type ResolveRefundAddressResult = {
|
|
|
2715
2725
|
error: ResolveRefundAddressError;
|
|
2716
2726
|
};
|
|
2717
2727
|
|
|
2728
|
+
declare function generateDepositAddress(opts: GenerateDepositAddressInput & {
|
|
2729
|
+
privy: Privy;
|
|
2730
|
+
onWalletCreated?: () => Promise<unknown>;
|
|
2731
|
+
}): Promise<DepositAddressQuote>;
|
|
2732
|
+
|
|
2733
|
+
declare function resolveRefundAddress(opts: {
|
|
2734
|
+
privy: Privy;
|
|
2735
|
+
caip2: string;
|
|
2736
|
+
onWalletCreated?: () => Promise<unknown>;
|
|
2737
|
+
}): Promise<ResolveRefundAddressResult>;
|
|
2738
|
+
|
|
2739
|
+
declare function getDeposit(opts: GetDepositInput & {
|
|
2740
|
+
privy: Privy;
|
|
2741
|
+
}): Promise<DepositAddressOrder>;
|
|
2742
|
+
declare function waitForDeposit(opts: WaitForDepositInput & {
|
|
2743
|
+
privy: Privy;
|
|
2744
|
+
}): Promise<DepositAddressPollingResult>;
|
|
2745
|
+
declare function waitForCompletion(opts: WaitForCompletionInput & {
|
|
2746
|
+
privy: Privy;
|
|
2747
|
+
}): Promise<DepositAddressPollingResult>;
|
|
2748
|
+
|
|
2749
|
+
declare function getConfig(privy: Privy): Promise<DepositConfig>;
|
|
2750
|
+
|
|
2718
2751
|
type index_CompletedDepositAddressOrder = CompletedDepositAddressOrder;
|
|
2719
2752
|
type index_DepositAddressOrder = DepositAddressOrder;
|
|
2720
2753
|
type index_DepositAddressPollingResult = DepositAddressPollingResult;
|
|
@@ -2727,7 +2760,14 @@ type index_ResolveRefundAddressError = ResolveRefundAddressError;
|
|
|
2727
2760
|
type index_ResolveRefundAddressResult = ResolveRefundAddressResult;
|
|
2728
2761
|
type index_WaitForCompletionInput = WaitForCompletionInput;
|
|
2729
2762
|
type index_WaitForDepositInput = WaitForDepositInput;
|
|
2763
|
+
declare const index_generateDepositAddress: typeof generateDepositAddress;
|
|
2764
|
+
declare const index_getConfig: typeof getConfig;
|
|
2765
|
+
declare const index_getDeposit: typeof getDeposit;
|
|
2766
|
+
declare const index_resolveRefundAddress: typeof resolveRefundAddress;
|
|
2767
|
+
declare const index_waitForCompletion: typeof waitForCompletion;
|
|
2768
|
+
declare const index_waitForDeposit: typeof waitForDeposit;
|
|
2730
2769
|
declare namespace index {
|
|
2770
|
+
export { index_generateDepositAddress as generateDepositAddress, index_getConfig as getConfig, index_getDeposit as getDeposit, index_resolveRefundAddress as resolveRefundAddress, index_waitForCompletion as waitForCompletion, index_waitForDeposit as waitForDeposit };
|
|
2731
2771
|
export type { index_CompletedDepositAddressOrder as CompletedDepositAddressOrder, index_DepositAddressOrder as DepositAddressOrder, index_DepositAddressPollingResult as DepositAddressPollingResult, index_DepositAddressQuote as DepositAddressQuote, index_DepositConfig as DepositConfig, index_GenerateDepositAddressInput as GenerateDepositAddressInput, index_GetDepositInput as GetDepositInput, index_IncompleteDepositAddressOrder as IncompleteDepositAddressOrder, index_ResolveRefundAddressError as ResolveRefundAddressError, index_ResolveRefundAddressResult as ResolveRefundAddressResult, index_WaitForCompletionInput as WaitForCompletionInput, index_WaitForDepositInput as WaitForDepositInput };
|
|
2732
2772
|
}
|
|
2733
2773
|
|
package/dist/esm/Error.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Error.mjs","sources":["../../src/Error.ts"],"names":["PrivyApiError","Error","constructor","error","code","status","super","name","this","PrivyClientError","MoonpayApiError","response","createErrorFormatter","messageMap","e","default","errorIndicatesMfaCanceled"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Error.mjs","sources":["../../src/Error.ts"],"names":["PrivyApiError","Error","constructor","error","code","status","super","name","this","PrivyClientError","MoonpayApiError","response","createErrorFormatter","messageMap","e","default","errorIndicatesMfaCanceled"],"mappings":"AA0EO,MAAMA,UAAsBC,MAMjCC,WAAAA,EAAaC,MAAAA,EAAOC,KAAAA,EAAMC,OAAAA,IACxBC,MAAMH,GAAAA,KANCI,KAAO,gBAOdC,KAAKL,MAAQA,EACbK,KAAKJ,KAAOA,EACZI,KAAKH,OAASA,CAChB,EAGK,MAAMI,UAAyBR,MAIpCC,WAAAA,EAAaC,MAAAA,EAAOC,KAAAA,IAClBE,MAAMH,GACNK,KAAKJ,KAAOA,EACZI,KAAKL,MAAQA,CACf,EAGK,MAAMO,UAAwBT,MAKnCC,WAAAA,EAAaC,MAAAA,EAAOC,KAAAA,EAAMO,SAAAA,IACxBL,MAAMH,GACNK,KAAKJ,KAAOA,EACZI,KAAKL,MAAQA,EACbK,KAAKG,SAAWA,CAClB,QA2CWC,EAAwBC,GAAgCC,GACnED,EArBAC,aAAqBd,GAqBKG,aApBLM,EAoBKN,EArBuBC,KAE1C,kBAmB8BS,EAAWE,QAE3C,SAASC,EAA0Bb,GACxC,OAAOA,GAAS,iBAAOA,GAAsB,SAAUA,GAAwB,iBAAfA,EAAMC,IAAI"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{CreateDepositAddressQuote as r}from"@privy-io/routes";import{resolveRefundAddress as e}from"./resolve-refund-address.mjs";async function i(i){let{user:s}=await i.privy.user.get();if(!s)throw Error("NOT_AUTHENTICATED");let t=i.refundAddress;if(!t){let r=await e({privy:i.privy,caip2:i.sourceChain,onWalletCreated:i.onWalletCreated});if(!r.ok)throw Error(r.error);t=r.address}return await i.privy.fetchPrivyRoute(r,{body:{source_chain:i.sourceChain,source_currency:i.sourceCurrency,destination_chain:i.destinationChain,destination_currency:i.destinationCurrency,destination_address:i.destinationAddress,refund_address:t,...null!=i.slippageBps?{slippage_bps:i.slippageBps}:{}}})}export{i as generateDepositAddress};
|
|
2
|
+
//# sourceMappingURL=generate.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.mjs","sources":["../../../../src/action/depositAddress/generate.ts"],"names":["async","generateDepositAddress","opts","user","privy","get","Error","refundAddress","result","resolveRefundAddress","caip2","sourceChain","onWalletCreated","ok","error","address","fetchPrivyRoute","CreateDepositAddressQuote","body","source_chain","source_currency","sourceCurrency","destination_chain","destinationChain","destination_currency","destinationCurrency","destination_address","destinationAddress","refund_address","slippageBps","slippage_bps"],"mappings":"iIAMOA,eAAeC,EACpBC,GAKA,IAAOC,KAAAA,SAAcD,EAAKE,MAAMD,KAAKE,MACrC,IAAKF,EACH,MAAUG,MAAM,qBAGlB,IAAIC,EAAgBL,EAAKK,cACzB,IAAKA,EAAe,CAClB,IAAMC,QAAeC,EAAqB,CACxCL,MAAOF,EAAKE,MACZM,MAAOR,EAAKS,YACZC,gBAAiBV,EAAKU,kBAExB,IAAKJ,EAAOK,GACV,MAAMP,MAAUE,EAAOM,OAEzBP,EAAgBC,EAAOO,OAAO,CAGhC,aAAab,EAAKE,MAAMY,gBAAgBC,EAA2B,CACjEC,KAAM,CACJC,aAAcjB,EAAKS,YACnBS,gBAAiBlB,EAAKmB,eACtBC,kBAAmBpB,EAAKqB,iBACxBC,qBAAsBtB,EAAKuB,oBAC3BC,oBAAqBxB,EAAKyB,mBAC1BC,eAAgBrB,KACQ,MAApBL,EAAK2B,YAAsB,CAACC,aAAc5B,EAAK2B,aAAe,CAAA,IAGxE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import"@privy-io/routes";export{generateDepositAddress}from"./generate.mjs";export{resolveRefundAddress}from"./resolve-refund-address.mjs";export{getDeposit,waitForCompletion,waitForDeposit}from"./polling.mjs";export{g as getConfig}from"../../index-jTjLf3Z-.mjs";import"../../utils/poll.mjs";import"../../utils/sleep.mjs";
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{GetDepositAddressOrder as t,GetNextDepositAddressOrder as r}from"@privy-io/routes";import{poll as e}from"../../utils/poll.mjs";import"../../utils/sleep.mjs";function s(t,r){return Math.ceil(r/t)}function i(t){return"success"===t.status?t.result?{status:"success",order:t.result}:{status:"timeout"}:"aborted"===t.status?{status:"aborted",error:t.error}:{status:"timeout",error:t.error}}async function o(r){return await r.privy.fetchPrivyRoute(t,{params:{order_id:r.orderId}})}async function a(o){let a=o.pollIntervalMs??2e3,n=o.timeoutMs??18e5,u=o.signal??(new AbortController).signal;return i(await e({operation:async()=>{let e=await o.privy.fetchPrivyRoute(r,{params:{deposit_address_id:o.depositAddressId},query:{after:o.quoteCreatedAt}});if(e.order)return await o.privy.fetchPrivyRoute(t,{params:{order_id:e.order.id}})},until:t=>void 0!==t,delay:a,interval:a,attempts:s(a,n),signal:u}))}async function n(r){let o=r.pollIntervalMs??2e3,a=r.timeoutMs??18e5,n=r.signal??(new AbortController).signal;return i(await e({operation:()=>r.privy.fetchPrivyRoute(t,{params:{order_id:r.orderId}}),until:t=>"executing"!==t.status,delay:o,interval:o,attempts:s(o,a),signal:n}))}export{o as getDeposit,n as waitForCompletion,a as waitForDeposit};
|
|
2
|
+
//# sourceMappingURL=polling.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polling.mjs","sources":["../../../../src/action/depositAddress/polling.ts"],"names":["getPollAttempts","pollIntervalMs","timeoutMs","Math","ceil","toPollingResult","result","status","order","error","async","getDeposit","opts","privy","fetchPrivyRoute","GetDepositAddressOrder","params","order_id","orderId","waitForDeposit","signal","AbortController","poll","operation","nextOrder","GetNextDepositAddressOrder","deposit_address_id","depositAddressId","query","after","quoteCreatedAt","id","until","t","delay","interval","attempts","waitForCompletion"],"mappings":"oKAeA,SAASA,EAAgBC,EAAwBC,GAC/C,OAAOC,KAAKC,KAAKF,EAAYD,EAC/B,CAEA,SAASI,EACPC,GAOK,MAEDA,YAAAA,EAAOC,OACJD,EAAOA,OACL,CAACC,OAAQ,UAAWC,MAAOF,EAAOA,QADd,CAACC,OAAQ,WAGhB,YAAlBD,EAAOC,OAA6B,CAACA,OAAQ,UAAWE,MAAOH,EAAOG,OACnE,CAACF,OAAQ,UAAWE,MAAOH,EAAOG,MAC3C,CAEOC,eAAeC,EACpBC,GAEA,aAAaA,EAAKC,MAAMC,gBAAgBC,EAAwB,CAC9DC,OAAQ,CAACC,SAAUL,EAAKM,UAE5B,CAEOR,eAAeS,EACpBP,GAEA,IAAMX,EAAiBW,EAAKX,gBApCL,IAqCjBC,EAAYU,EAAKV,WApCD,KAqChBkB,EAASR,EAAKQ,SAAU,IAAIC,iBAAkBD,OAoBpD,OAAOf,QAlBciB,EAAK,CACxBC,UAAWb,UACT,IAAMc,QAAkBZ,EAAKC,MAAMC,gBAAgBW,EAA4B,CAC7ET,OAAQ,CAACU,mBAAoBd,EAAKe,kBAClCC,MAAO,CAACC,MAAOjB,EAAKkB,kBAEtB,GAAKN,EAAUhB,MACf,aAAaI,EAAKC,MAAMC,gBAAgBC,EAAwB,CAC9DC,OAAQ,CAACC,SAAUO,EAAUhB,MAAMuB,KACrC,EAEFC,MAAOC,QAAWzB,IAAAA,EAClB0B,MAAOjC,EACPkC,SAAUlC,EACVmC,SAAUpC,EAAgBC,EAAgBC,GAC1CkB,OAAAA,IAIJ,CAEOV,eAAe2B,EACpBzB,GAEA,IAAMX,EAAiBW,EAAKX,gBAhEL,IAiEjBC,EAAYU,EAAKV,WAhED,KAiEhBkB,EAASR,EAAKQ,SAAU,IAAIC,iBAAkBD,OAcpD,OAAOf,QAZciB,EAAK,CACxBC,UAAW,IACTX,EAAKC,MAAMC,gBAAgBC,EAAwB,CACjDC,OAAQ,CAACC,SAAUL,EAAKM,WAE5Bc,MAAOC,GAAWzB,cAAAA,EAAMD,OACxB2B,MAAOjC,EACPkC,SAAUlC,EACVmC,SAAUpC,EAAgBC,EAAgBC,GAC1CkB,OAAAA,IAIJ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{WalletCreate as t}from"@privy-io/routes";function r(t){return t.startsWith("eip155:")?"ethereum":t.startsWith("solana:")?"solana":t.startsWith("bip122:")?"bitcoin-segwit":t.startsWith("tron:")?"tron":void 0}async function e(e){let{user:i}=await e.privy.user.get();if(!i)return{ok:!1,error:"NOT_AUTHENTICATED"};let a=function(t,e){let i=r(t);if(!i)return;let a=e.linked_accounts.find((t=>"wallet"===t.type&&t.chain_type===i&&"address"in t&&t.address));return a&&"address"in a?a.address:void 0}(e.caip2,i);if(a)return{ok:!0,address:a};let s=r(e.caip2);if(!s)return{ok:!1,error:"UNSUPPORTED_CHAIN"};try{let r=await e.privy.fetchPrivyRoute(t,{body:{chain_type:s}});return await(e.onWalletCreated?.()),{ok:!0,address:r.address}}catch{return{ok:!1,error:"REFUND_WALLET_CREATION_FAILED"}}}export{e as resolveRefundAddress};
|
|
2
|
+
//# sourceMappingURL=resolve-refund-address.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-refund-address.mjs","sources":["../../../../src/action/depositAddress/resolve-refund-address.ts"],"names":["chainTypeFromCaip2","caip2","r","startsWith","async","resolveRefundAddress","opts","user","privy","get","ok","error","existing","targetChainType","wallet","linked_accounts","find","a","type","chain_type","address","undefined","chainType","fetchPrivyRoute","WalletCreate","body","onWalletCreated"],"mappings":"gDAMA,SAASA,EAAmBC,GAAa,OACvCC,EAAUC,WAAW,WAAmB,WACpCF,EAAME,WAAW,WAAmB,SACpCF,EAAME,WAAW,WAAmB,iBACpCF,EAAME,WAAW,SAAiB,aAExC,CAWOC,eAAeC,EAAqBC,GAKzC,IAAOC,KAAAA,SAAcD,EAAKE,MAAMD,KAAKE,MACrC,IAAKF,EAAM,MAAO,CAACG,IAAI,EAAOC,MAAO,qBAErC,IAAMC,EAjBR,SAAkCX,EAAeM,GAC/C,IAAMM,EAAkBb,EAAmBC,GAC3C,IAAKY,EAAiB,OACtB,IAAMC,EAASP,EAAKQ,gBAAgBC,MACjCC,GAAMA,WAAAA,EAAEC,MAAqBD,EAAEE,aAAeN,GAAmB,YAAaI,GAAKA,EAAEG,UAExF,OAAON,GAAU,YAAaA,EAASA,EAAOM,aAAUC,CAC1D,CAPA,CAiB4Cf,EAAKL,MAAOM,GACtD,GAAIK,EAAU,MAAO,CAACF,IAAI,EAAMU,QAASR,GAEzC,IAAMU,EAAYtB,EAAmBM,EAAKL,OAC1C,IAAKqB,EAAW,MAAO,CAACZ,IAAI,EAAOC,MAAO,qBAE1C,IACE,IAAMG,QAAeR,EAAKE,MAAMe,gBAAgBC,EAAc,CAC5DC,KAAM,CAACN,WAAYG,KAGrB,aADMhB,EAAKoB,qBACJ,CAAChB,IAAI,EAAMU,QAASN,EAAOM,QACpC,CAAE,MACA,MAAO,CAACV,IAAI,EAAOC,MAAO,gCAC5B,CACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{i as delegatedActions}from"../index-g0cxoRWQ.mjs";export{i as crossApp}from"../index-Bu3ySxLM.mjs";export{i as depositAddress}from"
|
|
1
|
+
export{i as delegatedActions}from"../index-g0cxoRWQ.mjs";export{i as crossApp}from"../index-Bu3ySxLM.mjs";export{i as depositAddress}from"../index-jTjLf3Z-.mjs";import"./delegatedActions/delegateWallet.mjs";import"../Error.mjs";import"../wallet-api/unified-wallet.mjs";import"./delegatedActions/utils.mjs";import"../utils/getAllUserEmbeddedEthereumWallets.mjs";import"../utils/embedded-wallets.mjs";import"../utils/getAllUserEmbeddedSolanaWallets.mjs";import"../utils/getUserEmbeddedEthereumWallet.mjs";import"../utils/getUserEmbeddedSolanaWallet.mjs";import"./delegatedActions/revokeWallets.mjs";import"./crossApp/loginWithCrossAppAuth.mjs";import"./crossApp/linkWithCrossAppAuth.mjs";import"../index-DTAjYY8z.mjs";import"./crossApp/wallet/signMessage.mjs";import"./crossApp/wallet/utils/isCrossAppWalletSmart.mjs";import"./crossApp/wallet/utils/sendCrossAppRequest.mjs";import"./crossApp/wallet/utils/getCrossAppAccountByWalletAddress.mjs";import"./crossApp/wallet/utils/getProviderAccessTokenOrRelink.mjs";import"./crossApp/wallet/utils/throwIfNotLoggedIn.mjs";import"./crossApp/wallet/signTypedData.mjs";import"../utils/typedData/generateDomainType.mjs";import"./crossApp/wallet/sendTransaction.mjs";import"@privy-io/routes";import"./depositAddress/generate.mjs";import"./depositAddress/resolve-refund-address.mjs";import"./depositAddress/polling.mjs";import"../utils/poll.mjs";import"../utils/sleep.mjs";
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
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.
|
|
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.67.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,2 +1,2 @@
|
|
|
1
|
-
import{PrivyClientError as e}from"../../Error.mjs";import t from"./MfaPasskeyApi.mjs";import r from"./MfaSmsApi.mjs";import"@privy-io/routes";class a{setProxy(e){this.proxy=e}async getAccessTokenInternal(){let t=await this.privyInternal.getAccessTokenInternal();if(!t)throw new e({error:"Missing access token",code:"attempted_rpc_call_before_logged_in"});return t}async verifyMfa(){if(!this.proxy)throw new e({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});return await this.proxy.verifyMfa({accessToken:await this.getAccessTokenInternal()})}async initEnrollMfa(t){if(!this.proxy)throw new e({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});return await this.proxy.initEnrollMfa({...t,accessToken:await this.getAccessTokenInternal()})}async submitEnrollMfa(t){if(!this.proxy)throw new e({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});let r=await this.proxy.submitEnrollMfa({...t,accessToken:await this.getAccessTokenInternal()}),a=await this.privyInternal.refreshSession();if(0===a.user.mfa_methods.length)try{await this.proxy.clearMfa({userId:a.user.id})}catch{}return r}async unenrollMfa(t){if(!this.proxy)throw new e({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});let r=await this.proxy.unenrollMfa({method:t,accessToken:await this.getAccessTokenInternal()}),a=await this.privyInternal.refreshSession();if(0===a.user.mfa_methods.length)try{await this.proxy.clearMfa({userId:a.user.id})}catch{}return r}async clearMfa(t){if(!this.proxy)throw new e({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});return await this.proxy.clearMfa(t)}constructor(e,a){this.proxy=a,this.privyInternal=e,this.sms=new r(e),this.passkey=new t(e)}}export{a as default};
|
|
1
|
+
import{PrivyClientError as e}from"../../Error.mjs";import t from"./MfaPasskeyApi.mjs";import r from"./MfaSmsApi.mjs";import"@privy-io/routes";class a{setProxy(e){this.proxy=e}async getAccessTokenInternal(){let t=await this.privyInternal.getAccessTokenInternal();if(!t)throw new e({error:"Missing access token",code:"attempted_rpc_call_before_logged_in"});return t}async verifyMfa(){if(!this.proxy)throw new e({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});return await this.proxy.verifyMfa({accessToken:await this.getAccessTokenInternal()})}async initEnrollMfa(t){if(!this.proxy)throw new e({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});return await this.proxy.initEnrollMfa({...t,accessToken:await this.getAccessTokenInternal()})}async submitEnrollMfa(t){if(!this.proxy)throw new e({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});let r=await this.proxy.submitEnrollMfa({...t,accessToken:await this.getAccessTokenInternal()}),a=await this.privyInternal.refreshSession();if(0===a.user.mfa_methods.length)try{await this.proxy.clearMfa({userId:a.user.id})}catch{}return r}async unenrollMfa(t){if(!this.proxy)throw new e({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});let r=await this.proxy.unenrollMfa({method:t,accessToken:await this.getAccessTokenInternal()}),a=await this.privyInternal.refreshSession();if(0===a.user.mfa_methods.length)try{await this.proxy.clearMfa({userId:a.user.id})}catch{}return r}async unlinkPasskey({credentialId:t,removeAsMfa:r}){if(!this.proxy)throw new e({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});await this.proxy.unlinkPasskey({credentialId:t,removeAsMfa:r,accessToken:await this.getAccessTokenInternal()});let a=await this.privyInternal.refreshSession();if(0===a.user.mfa_methods.length)try{await this.proxy.clearMfa({userId:a.user.id})}catch{}}async clearMfa(t){if(!this.proxy)throw new e({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});return await this.proxy.clearMfa(t)}constructor(e,a){this.proxy=a,this.privyInternal=e,this.sms=new r(e),this.passkey=new t(e)}}export{a as default};
|
|
2
2
|
//# sourceMappingURL=MfaApi.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MfaApi.mjs","sources":["../../../../src/client/mfa/MfaApi.ts"],"names":["MfaApi","setProxy","proxy","this","getAccessTokenInternal","accessToken","privyInternal","PrivyClientError","error","code","verifyMfa","initEnrollMfa","args","submitEnrollMfa","result","refreshed","refreshSession","user","mfa_methods","length","clearMfa","userId","id","unenrollMfa","method","constructor","sms","MfaSmsApi","passkey","MfaPasskeyApi"],"mappings":"oJAYqBA,EAgCnBC,QAAAA,CAASC,GACPC,KAAKD,MAAQA,CACf,CAKA,4BAAcE,GACZ,IAAMC,QAAoBF,KAAKG,cAAcF,yBAC7C,IAAKC,EACH,MAAM,IAAIE,EAAiB,CACzBC,MAAO,uBACPC,KAAM,wCAGV,OAAOJ,CACT,CAMA,eAAaK,GACX,IAAKP,KAAKD,MACR,MAAM,IAAIK,EAAiB,CACzBC,MAAO,wCACPC,KAAM,uCAIV,aAAaN,KAAKD,MAAMQ,UAAU,CAACL,kBAAmBF,KAAKC,0BAC7D,CAMA,mBAAaO,CAAcC,GACzB,IAAKT,KAAKD,MACR,MAAM,IAAIK,EAAiB,CACzBC,MAAO,wCACPC,KAAM,uCAIV,aAAaN,KAAKD,MAAMS,cAAc,IACjCC,EACHP,kBAAmBF,KAAKC,0BAE5B,CAMA,qBAAaS,CAAgBD,GAC3B,IAAKT,KAAKD,MACR,MAAM,IAAIK,EAAiB,CACzBC,MAAO,wCACPC,KAAM,uCAIV,IAAMK,QAAeX,KAAKD,MAAMW,gBAAgB,IAC3CD,EACHP,kBAAmBF,KAAKC,2BAGpBW,QAAkBZ,KAAKG,cAAcU,iBAE3C,GAAID,IAAAA,EAAUE,KAAKC,YAAYC,OAC7B,UACQhB,KAAKD,MAAMkB,SAAS,CAACC,OAAQN,EAAUE,KAAKK,IACpD,CAAE,MAEF,CAGF,OAAOR,CACT,CAMA,iBAAaS,CAAYC,GACvB,IAAKrB,KAAKD,MACR,MAAM,IAAIK,EAAiB,CACzBC,MAAO,wCACPC,KAAM,uCAIV,IAAMK,QAAeX,KAAKD,MAAMqB,YAAY,CAC1CC,OAAAA,EACAnB,kBAAmBF,KAAKC,2BAGpBW,QAAkBZ,KAAKG,cAAcU,iBAE3C,GAAID,IAAAA,EAAUE,KAAKC,YAAYC,OAC7B,UACQhB,KAAKD,MAAMkB,SAAS,CAACC,OAAQN,EAAUE,KAAKK,IACpD,CAAE,MAEF,CAGF,OAAOR,CACT,CAKA,
|
|
1
|
+
{"version":3,"file":"MfaApi.mjs","sources":["../../../../src/client/mfa/MfaApi.ts"],"names":["MfaApi","setProxy","proxy","this","getAccessTokenInternal","accessToken","privyInternal","PrivyClientError","error","code","verifyMfa","initEnrollMfa","args","submitEnrollMfa","result","refreshed","refreshSession","user","mfa_methods","length","clearMfa","userId","id","unenrollMfa","method","unlinkPasskey","credentialId","removeAsMfa","constructor","sms","MfaSmsApi","passkey","MfaPasskeyApi"],"mappings":"oJAYqBA,EAgCnBC,QAAAA,CAASC,GACPC,KAAKD,MAAQA,CACf,CAKA,4BAAcE,GACZ,IAAMC,QAAoBF,KAAKG,cAAcF,yBAC7C,IAAKC,EACH,MAAM,IAAIE,EAAiB,CACzBC,MAAO,uBACPC,KAAM,wCAGV,OAAOJ,CACT,CAMA,eAAaK,GACX,IAAKP,KAAKD,MACR,MAAM,IAAIK,EAAiB,CACzBC,MAAO,wCACPC,KAAM,uCAIV,aAAaN,KAAKD,MAAMQ,UAAU,CAACL,kBAAmBF,KAAKC,0BAC7D,CAMA,mBAAaO,CAAcC,GACzB,IAAKT,KAAKD,MACR,MAAM,IAAIK,EAAiB,CACzBC,MAAO,wCACPC,KAAM,uCAIV,aAAaN,KAAKD,MAAMS,cAAc,IACjCC,EACHP,kBAAmBF,KAAKC,0BAE5B,CAMA,qBAAaS,CAAgBD,GAC3B,IAAKT,KAAKD,MACR,MAAM,IAAIK,EAAiB,CACzBC,MAAO,wCACPC,KAAM,uCAIV,IAAMK,QAAeX,KAAKD,MAAMW,gBAAgB,IAC3CD,EACHP,kBAAmBF,KAAKC,2BAGpBW,QAAkBZ,KAAKG,cAAcU,iBAE3C,GAAID,IAAAA,EAAUE,KAAKC,YAAYC,OAC7B,UACQhB,KAAKD,MAAMkB,SAAS,CAACC,OAAQN,EAAUE,KAAKK,IACpD,CAAE,MAEF,CAGF,OAAOR,CACT,CAMA,iBAAaS,CAAYC,GACvB,IAAKrB,KAAKD,MACR,MAAM,IAAIK,EAAiB,CACzBC,MAAO,wCACPC,KAAM,uCAIV,IAAMK,QAAeX,KAAKD,MAAMqB,YAAY,CAC1CC,OAAAA,EACAnB,kBAAmBF,KAAKC,2BAGpBW,QAAkBZ,KAAKG,cAAcU,iBAE3C,GAAID,IAAAA,EAAUE,KAAKC,YAAYC,OAC7B,UACQhB,KAAKD,MAAMkB,SAAS,CAACC,OAAQN,EAAUE,KAAKK,IACpD,CAAE,MAEF,CAGF,OAAOR,CACT,CAMA,mBAAaW,EACXC,aAAAA,EACAC,YAAAA,IAKA,IAAKxB,KAAKD,MACR,MAAM,IAAIK,EAAiB,CACzBC,MAAO,wCACPC,KAAM,6CAIJN,KAAKD,MAAMuB,cAAc,CAC7BC,aAAAA,EACAC,YAAAA,EACAtB,kBAAmBF,KAAKC,2BAI1B,IAAMW,QAAkBZ,KAAKG,cAAcU,iBAE3C,GAA0C,IAAtCD,EAAUE,KAAKC,YAAYC,OAC7B,UACQhB,KAAKD,MAAMkB,SAAS,CAACC,OAAQN,EAAUE,KAAKK,IACpD,CAAE,MAEF,CAEJ,CAKA,cAAaF,CAASR,GACpB,IAAKT,KAAKD,MACR,MAAM,IAAIK,EAAiB,CACzBC,MAAO,wCACPC,KAAM,uCAIV,aAAaN,KAAKD,MAAMkB,SAASR,EACnC,CAzKA,WAAAgB,CAAmBtB,EAA8BJ,GAC/CC,KAAKD,MAAQA,EACbC,KAAKG,cAAgBA,EACrBH,KAAK0B,IAAM,IAAIC,EAAUxB,GACzBH,KAAK4B,QAAU,IAAIC,EAAc1B,EACnC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{sleep as e}from"../utils/sleep.mjs";import{EventCallbacksQueue as t}from"./EventCallbackQueue.mjs";import{PrivyIframeError as i}from"./errors.mjs";import{withMfa as r}from"./withMfa.mjs";import"./types.mjs";var a;const
|
|
1
|
+
import{sleep as e}from"../utils/sleep.mjs";import{EventCallbacksQueue as t}from"./EventCallbackQueue.mjs";import{PrivyIframeError as i}from"./errors.mjs";import{withMfa as r}from"./withMfa.mjs";import"./types.mjs";var a;const s=15e3;let o=(a=0,()=>"id-"+a++),n=(e,t)=>"bigint"==typeof t?t.toString():t,l=async(e,{ms:t,msg:i})=>{let r,a=new Promise(((e,a)=>{r=setTimeout((()=>{a(Error(i))}),t??15e3)}));try{return await Promise.race([e,a])}finally{void 0!==r&&clearTimeout(r)}},m=new t;class h{invokeWithMfa(e,t){return l(r((i=>l(this.waitForReady().then((()=>e(i))),{msg:t.timeoutMsg,ms:t.timeoutMs})),this.mfa.rootPromise,this.mfa.submitPromise,(()=>this.mfa.emit("mfaRequired")),t.mfaAlwaysRequired??!1,4,3e5),{msg:"Operation reached timeout: MFA verification",ms:126e4})}reload(){return this.ready=!1,this._embeddedWalletMessagePoster.reload()}ping(e=15e3){return l(this.invoke("privy:iframe:ready",{}),{msg:"Ping reached timeout",ms:e})}create(e){return l(this.waitForReady().then((()=>this.invoke("privy:wallet:create",e))),{msg:"Operation reached timeout: create"})}rpc(e){return this.invokeWithMfa((t=>this.invoke("privy:wallet:rpc",{...t,...e})),{timeoutMsg:"Operation reached timeout: rpc"})}createSolana(e){return this.invokeWithMfa((t=>this.invoke("privy:solana-wallet:create",{...t,...e})),{timeoutMsg:"Operation reached timeout: create",timeoutMs:6e4})}createAdditionalSolana(e){return l(this.waitForReady().then((()=>this.invoke("privy:solana-wallet:create-additional",e))),{msg:"Operation reached timeout: create"})}solanaRpc(e){return this.invokeWithMfa((t=>this.invoke("privy:solana-wallet:rpc",{...t,...e})),{timeoutMsg:"Operation reached timeout: solana-rpc"})}delegateWallets(e){return this.invokeWithMfa((t=>this.invoke("privy:delegated-actions:consent",{...t,...e})),{timeoutMsg:"Operation reached timeout: delegated-actions:consent"})}verifyMfa(e){return this.invokeWithMfa((t=>this.invoke("privy:mfa:verify",{...t,...e})),{timeoutMsg:"Operation reached timeout: mfa:verify",mfaAlwaysRequired:!0})}initEnrollMfa(e){return this.invokeWithMfa((t=>this.invoke("privy:mfa:init-enrollment",{...t,...e})),{timeoutMsg:"Operation reached timeout: mfa:init-enrollment"})}submitEnrollMfa(e){return"passkey"===e.method?this.invokeWithMfa((t=>this.invoke("privy:mfa:submit-enrollment",{...t,...e})),{timeoutMsg:"Operation reached timeout: mfa:submit-enrollment"}):l(this.waitForReady().then((()=>this.invoke("privy:mfa:submit-enrollment",e))),{msg:"Operation reached timeout: mfa:submit-enrollment"})}unenrollMfa(e){return this.invokeWithMfa((t=>this.invoke("privy:mfa:unenroll",{...t,...e})),{timeoutMsg:"Operation reached timeout: mfa:unenroll",mfaAlwaysRequired:!0})}unlinkPasskey(e){return this.invokeWithMfa((t=>this.invoke("privy:auth:unlink-passkey",{...t,...e})),{timeoutMsg:"Operation reached timeout: auth:unlink-passkey",mfaAlwaysRequired:!0})}clearMfa(e){return l(this.waitForReady().then((()=>this.invoke("privy:mfa:clear",e))),{msg:"Operation reached timeout: mfa:clear"})}createWallet(e){return this.invokeWithMfa((t=>this.invoke("privy:wallets:create",{...t,...e})),{timeoutMsg:"Operation reached timeout: create",timeoutMs:6e4})}signWithUserSigner(e){return this.invokeWithMfa((t=>this.invoke("privy:user-signer:sign",{...t,...e})),{timeoutMsg:"Operation reached timeout: user-signer:sign"})}addWallet(e){return l(this.waitForReady().then((()=>this.invoke("privy:wallets:add",e))),{msg:"Operation reached timeout: wallets:add"})}setRecovery(e){return this.invokeWithMfa((t=>this.invoke("privy:wallets:set-recovery",{...t,...e})),{timeoutMsg:"Operation reached timeout: wallets:set-recovery",timeoutMs:6e4})}connect(e){return l(this.waitForReady().then((()=>this.invoke("privy:wallets:connect",e))),{msg:"Operation reached timeout: wallets:connect"})}recover(e){return this.invokeWithMfa((t=>this.invoke("privy:wallets:recover",{...t,...e})),{timeoutMsg:"Operation reached timeout: wallets:recover",timeoutMs:6e4})}rpcWallet(e){return this.invokeWithMfa((t=>this.invoke("privy:wallets:rpc",{...t,...e})),{timeoutMsg:"Operation reached timeout: wallets:rpc"})}handleEmbeddedWalletMessages(e){if(!e.event.startsWith("privy:"))return void console.warn(`Unsupported event type: ${e.event}`);let{reject:t,resolve:r}=m.dequeue(e.event,e.id);return void 0!==e.error?t(new i(e.error.type,e.error.message)):r(e.data)}waitForReady(){return this.ready?Promise.resolve():new Promise((async(t,i)=>{for(;!this.ready;)this.invoke("privy:iframe:ready",{}).then((()=>{this.ready=!0,t()})).catch(i),await e(150)}))}invoke(e,t){let i=((e,t)=>`${e}${JSON.stringify(t,n)}`)(e,t);if("privy:wallet:create"===e||"privy:solana-wallet:create"===e){let e=this.cache.get(i);if(e)return e}let r=new Promise(((i,r)=>{let a=o();m.enqueue(a,{resolve:i,reject:r}),this._embeddedWalletMessagePoster.postMessage(JSON.stringify({id:a,event:e,data:t}),"*")})).finally((()=>{this.cache.delete(i)}));return this.cache.set(i,r),r}constructor(e,t){this.ready=!1,this.cache=new Map,this._embeddedWalletMessagePoster=e,this.mfa=t}}export{s as DEFAULT_WALLET_PROXY_TIMEOUT_MS,h as EmbeddedWalletProxy};
|
|
2
2
|
//# sourceMappingURL=EmbeddedWalletProxy.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmbeddedWalletProxy.mjs","sources":["../../../src/embedded/EmbeddedWalletProxy.ts"],"names":["id","DEFAULT_WALLET_PROXY_TIMEOUT_MS","uniqueId","replacer","_key","value","toString","withTimeout","async","promise","ms","msg","timer","timeout","Promise","_","reject","setTimeout","Error","race","undefined","clearTimeout","EVENT_CALLBACK_QUEUE","EventCallbacksQueue","EmbeddedWalletProxy","invokeWithMfa","callback","options","withMfa","i","this","waitForReady","then","response","timeoutMsg","timeoutMs","mfa","rootPromise","submitPromise","emit","mfaAlwaysRequired","MAX_RETRY_COUNT","reload","ready","_embeddedWalletMessagePoster","ping","invoke","create","data","rpc","t","mfaArgs","createSolana","createAdditionalSolana","solanaRpc","delegateWallets","verifyMfa","initEnrollMfa","submitEnrollMfa","method","unenrollMfa","clearMfa","createWallet","signWithUserSigner","addWallet","setRecovery","connect","recover","rpcWallet","handleEmbeddedWalletMessages","event","startsWith","console","warn","resolve","dequeue","e","error","PrivyIframeError","type","message","catch","sleep","key","JSON","stringify","serialize","cached","cache","get","res","eventId","enqueue","postMessage","finally","delete","set","constructor","embeddedWalletMessagePoster","Map"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EmbeddedWalletProxy.mjs","sources":["../../../src/embedded/EmbeddedWalletProxy.ts"],"names":["id","DEFAULT_WALLET_PROXY_TIMEOUT_MS","uniqueId","replacer","_key","value","toString","withTimeout","async","promise","ms","msg","timer","timeout","Promise","_","reject","setTimeout","Error","race","undefined","clearTimeout","EVENT_CALLBACK_QUEUE","EventCallbacksQueue","EmbeddedWalletProxy","invokeWithMfa","callback","options","withMfa","i","this","waitForReady","then","response","timeoutMsg","timeoutMs","mfa","rootPromise","submitPromise","emit","mfaAlwaysRequired","MAX_RETRY_COUNT","reload","ready","_embeddedWalletMessagePoster","ping","invoke","create","data","rpc","t","mfaArgs","createSolana","createAdditionalSolana","solanaRpc","delegateWallets","verifyMfa","initEnrollMfa","submitEnrollMfa","method","unenrollMfa","unlinkPasskey","clearMfa","createWallet","signWithUserSigner","addWallet","setRecovery","connect","recover","rpcWallet","handleEmbeddedWalletMessages","event","startsWith","console","warn","resolve","dequeue","e","error","PrivyIframeError","type","message","catch","sleep","key","JSON","stringify","serialize","cached","cache","get","res","eventId","enqueue","postMessage","finally","delete","set","constructor","embeddedWalletMessagePoster","Map"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
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"../../
|
|
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"../../Error.mjs";import"../../wallet-api/generate-authorization-signature.mjs";import"canonicalize";import"@privy-io/encoding";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":"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,
|
|
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,GAuyBlCK,EAAwB,CACnC,QACA,4BACA,uBACA,uBACA,qBACA,cACA,yBACA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{GetDepositConfig as e}from"@privy-io/routes";import{generateDepositAddress as r}from"./action/depositAddress/generate.mjs";import{resolveRefundAddress as o}from"./action/depositAddress/resolve-refund-address.mjs";import{getDeposit as s,waitForCompletion as t,waitForDeposit as i}from"./action/depositAddress/polling.mjs";async function n(r){let o=await r.fetchPrivyRoute(e,{});return{currencies:o.currencies,chains:o.chains}}var d=/*#__PURE__*/Object.freeze({__proto__:null,generateDepositAddress:r,getConfig:n,getDeposit:s,resolveRefundAddress:o,waitForCompletion:t,waitForDeposit:i});export{n as g,d as i};
|
|
2
|
+
//# sourceMappingURL=index-jTjLf3Z-.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-jTjLf3Z-.mjs","sources":["../../src/action/depositAddress/index.ts"],"names":["async","getConfig","privy","result","fetchPrivyRoute","GetDepositConfig","currencies","chains"],"mappings":"wUAwBOA,eAAeC,EAAUC,GAC9B,IAAMC,QAAeD,EAAME,gBAAgBC,EAAkB,CAAA,GAC7D,MAAO,CAACC,WAAYH,EAAOG,WAAYC,OAAQJ,EAAOI,OACxD"}
|
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{toWalletApiUnsignedEthTransaction}from"./embedded/stack/wallet-api-eth-transaction.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{poll}from"./utils/poll.mjs";export{i as crossApp}from"./index-Bu3ySxLM.mjs";export{i as delegatedActions}from"./index-g0cxoRWQ.mjs";export{i as depositAddress}from"./
|
|
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{toWalletApiUnsignedEthTransaction}from"./embedded/stack/wallet-api-eth-transaction.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{poll}from"./utils/poll.mjs";export{i as crossApp}from"./index-Bu3ySxLM.mjs";export{i as delegatedActions}from"./index-g0cxoRWQ.mjs";export{i as depositAddress}from"./index-jTjLf3Z-.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-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";import"./action/depositAddress/generate.mjs";import"./action/depositAddress/resolve-refund-address.mjs";import"./action/depositAddress/polling.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","NEXUS"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/index.ts"],"names":["BICONOMY","COINBASE_SMART_WALLET","KERNEL","LIGHT_ACCOUNT","SAFE","THIRDWEB","NEXUS"],"mappings":"isNAeO,MAAMA,EAAW,WAEXC,EAAwB,wBAExBC,EAAS,SAETC,EAAgB,gBAEhBC,EAAO,OAEPC,EAAW,WAEXC,EAAQ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{WalletRawSign as
|
|
1
|
+
import{WalletRawSign as e}from"@privy-io/routes";import{PrivyClientError as r}from"../Error.mjs";import{generateAuthorizationSignature as t}from"./generate-authorization-signature.mjs";import{PRIVY_REQUEST_EXPIRY_HEADER_NAME as i,DEFAULT_EXPIRY_TIME_MS as o}from"./types.mjs";import"canonicalize";import"@privy-io/encoding";async function a(a,p,{wallet_id:n,...d}){let m=a.getCompiledPath(e,{params:{wallet_id:n}}),s=String(Date.now()+o),l={version:1,url:m,method:e.method,headers:{"privy-app-id":a.app.appId,[i]:s},body:{...d}},{signature:u}=await t(p,l);if(Date.now()>Number(s))throw new r({error:"Wallet request expired before it could be sent. Please try again.",code:"embedded_wallet_request_expired"});return await a.fetchPrivyRoute(e,{body:d,params:{wallet_id:n},headers:{"privy-authorization-signature":u,[i]:s}})}export{a as rawSign};
|
|
2
2
|
//# sourceMappingURL=raw-sign.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"raw-sign.mjs","sources":["../../../src/wallet-api/raw-sign.ts"],"names":["async","rawSign","context","sign","wallet_id","request","url","getCompiledPath","WalletRawSign","params","requestExpiry","String","Date","now","DEFAULT_EXPIRY_TIME_MS","payload","version","method","headers","app","appId","PRIVY_REQUEST_EXPIRY_HEADER_NAME","body","signature","generateAuthorizationSignature","fetchPrivyRoute"],"mappings":"
|
|
1
|
+
{"version":3,"file":"raw-sign.mjs","sources":["../../../src/wallet-api/raw-sign.ts"],"names":["async","rawSign","context","sign","wallet_id","request","url","getCompiledPath","WalletRawSign","params","requestExpiry","String","Date","now","DEFAULT_EXPIRY_TIME_MS","payload","version","method","headers","app","appId","PRIVY_REQUEST_EXPIRY_HEADER_NAME","body","signature","generateAuthorizationSignature","Number","PrivyClientError","error","code","fetchPrivyRoute"],"mappings":"oUAwBOA,eAAeC,EACpBC,EACAC,GACCC,UAAAA,KAAcC,IAEf,IAAMC,EAAMJ,EAAQK,gBAAgBC,EAAe,CAACC,OAAQ,CAACL,UAAAA,KAEvDM,EAAgBC,OAAOC,KAAKC,MAAQC,GAEpCC,EAAU,CACdC,QAAS,EACTV,IAAAA,EACAW,OAAQT,EAAcS,OACtBC,QAAS,CACP,eAAgBhB,EAAQiB,IAAIC,MAC5BC,CAACA,GAAmCX,GAEtCY,KAAM,IACDjB,KAIAkB,UAAAA,SAAmBC,EAA+BrB,EAAMY,GAK/D,GAAIH,KAAKC,MAAQY,OAAOf,GACtB,MAAM,IAAIgB,EAAiB,CACzBC,MAAO,oEACPC,KAAM,oCAIV,aAAa1B,EAAQ2B,gBAAgBrB,EAAe,CAClDc,KAAMjB,EACNI,OAAQ,CAACL,UAAWA,GACpBc,QAAS,CACP,gCAAiCK,EACjCF,CAACA,GAAmCX,IAG1C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{WalletRpc as
|
|
1
|
+
import{WalletRpc as e}from"@privy-io/routes";import{PrivyClientError as r}from"../Error.mjs";import{generateAuthorizationSignature as t}from"./generate-authorization-signature.mjs";import{PRIVY_REQUEST_EXPIRY_HEADER_NAME as i,DEFAULT_EXPIRY_TIME_MS as o}from"./types.mjs";import"canonicalize";import"@privy-io/encoding";async function a(a,p,{wallet_id:n,...d}){let m=a.getCompiledPath(e,{params:{wallet_id:n}}),s=String(Date.now()+o),l={version:1,url:m,method:e.method,headers:{"privy-app-id":a.app.appId,[i]:s},body:{...d}},{signature:u}=await t(p,l);if(Date.now()>Number(s))throw new r({error:"Wallet request expired before it could be sent. Please try again.",code:"embedded_wallet_request_expired"});return await a.fetchPrivyRoute(e,{body:d,params:{wallet_id:n},headers:{"privy-authorization-signature":u,[i]:s}})}export{a as rpc};
|
|
2
2
|
//# sourceMappingURL=rpc.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc.mjs","sources":["../../../src/wallet-api/rpc.ts"],"names":["async","rpc","context","sign","wallet_id","request","url","getCompiledPath","WalletRpc","params","requestExpiry","String","Date","now","DEFAULT_EXPIRY_TIME_MS","payload","version","method","headers","app","appId","PRIVY_REQUEST_EXPIRY_HEADER_NAME","body","signature","generateAuthorizationSignature","fetchPrivyRoute"],"mappings":"
|
|
1
|
+
{"version":3,"file":"rpc.mjs","sources":["../../../src/wallet-api/rpc.ts"],"names":["async","rpc","context","sign","wallet_id","request","url","getCompiledPath","WalletRpc","params","requestExpiry","String","Date","now","DEFAULT_EXPIRY_TIME_MS","payload","version","method","headers","app","appId","PRIVY_REQUEST_EXPIRY_HEADER_NAME","body","signature","generateAuthorizationSignature","Number","PrivyClientError","error","code","fetchPrivyRoute"],"mappings":"gUAqBOA,eAAeC,EACpBC,EACAC,GACCC,UAAAA,KAAcC,IAGf,IAAMC,EAAMJ,EAAQK,gBAAgBC,EAAW,CAACC,OAAQ,CAACL,UAAAA,KAEnDM,EAAgBC,OAAOC,KAAKC,MAAQC,GAEpCC,EAAU,CACdC,QAAS,EACTV,IAAAA,EACAW,OAAQT,EAAUS,OAClBC,QAAS,CACP,eAAgBhB,EAAQiB,IAAIC,MAC5BC,CAACA,GAAmCX,GAEtCY,KAAM,IACDjB,KAIAkB,UAAAA,SAAmBC,EAA+BrB,EAAMY,GAK/D,GAAIH,KAAKC,MAAQY,OAAOf,GACtB,MAAM,IAAIgB,EAAiB,CACzBC,MAAO,oEACPC,KAAM,oCAIV,aAAa1B,EAAQ2B,gBAAgBrB,EAAW,CAC9Cc,KAAMjB,EACNI,OAAQ,CACNL,UAAWA,GAEbc,QAAS,CACP,gCAAiCK,EACjCF,CAACA,GAAmCX,IAG1C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@privy-io/js-sdk-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.67.0",
|
|
4
4
|
"description": "Vanilla JS client for the Privy Auth API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"authentication",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"not op_mini all"
|
|
51
51
|
],
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@privy-io/api-types": "0.
|
|
53
|
+
"@privy-io/api-types": "0.15.0",
|
|
54
54
|
"canonicalize": "^2.0.0",
|
|
55
55
|
"eventemitter3": "^5.0.1",
|
|
56
56
|
"fetch-retry": "^6.0.0",
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"js-cookie": "^3.0.5",
|
|
59
59
|
"libphonenumber-js": "^1.10.44",
|
|
60
60
|
"set-cookie-parser": "^2.6.0",
|
|
61
|
+
"@privy-io/ethereum": "0.1.4",
|
|
62
|
+
"@privy-io/routes": "0.2.4",
|
|
61
63
|
"@privy-io/api-base": "1.9.0",
|
|
62
|
-
"@privy-io/chains": "0.3.0",
|
|
63
64
|
"@privy-io/encoding": "0.1.3",
|
|
64
|
-
"@privy-io/
|
|
65
|
-
"@privy-io/routes": "0.2.3"
|
|
65
|
+
"@privy-io/chains": "0.3.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@metamask/eth-sig-util": "^8.2.0",
|