@privy-io/js-sdk-core 0.67.0 → 0.67.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client/PrivyInternal.js +1 -1
- package/dist/cjs/embedded/EventCallbackQueue.js +1 -1
- package/dist/cjs/embedded/EventCallbackQueue.js.map +1 -1
- package/dist/cjs/embedded/stack/wallet-api-eth-transaction.js +1 -1
- package/dist/cjs/embedded/stack/wallet-api-eth-transaction.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/solana/offchain-message.js +2 -0
- package/dist/cjs/solana/offchain-message.js.map +1 -0
- package/dist/dts/index.d.mts +34 -2
- package/dist/dts/index.d.ts +34 -2
- package/dist/esm/client/PrivyInternal.mjs +1 -1
- package/dist/esm/embedded/EventCallbackQueue.mjs +1 -1
- package/dist/esm/embedded/EventCallbackQueue.mjs.map +1 -1
- package/dist/esm/embedded/stack/wallet-api-eth-transaction.mjs +1 -1
- package/dist/esm/embedded/stack/wallet-api-eth-transaction.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/solana/offchain-message.mjs +2 -0
- package/dist/esm/solana/offchain-message.mjs.map +1 -0
- package/package.json +10 -10
|
@@ -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.67.
|
|
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.1",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";exports.EventCallbacksQueue=class{enqueue(e,a){this.callbacks[e]=a}dequeue(e,a){let r=this.callbacks[a];if(!r)throw Error(`cannot dequeue ${e} event: no event found for id ${a}`);switch(delete this.callbacks[a],e){case"privy:iframe:ready":case"privy:wallets:create":case"privy:user-signer:sign":case"privy:wallets:add":case"privy:wallets:set-recovery":case"privy:wallets:connect":case"privy:wallets:recover":case"privy:wallets:rpc":case"privy:wallet:create":case"privy:wallet:connect":case"privy:wallet:recover":case"privy:wallet:rpc":case"privy:solana-wallet:create":case"privy:solana-wallet:create-additional":case"privy:solana-wallet:connect":case"privy:solana-wallet:recover":case"privy:solana-wallet:rpc":case"privy:delegated-actions:consent":case"privy:mfa:verify":case"privy:mfa:init-enrollment":case"privy:mfa:submit-enrollment":case"privy:mfa:unenroll":case"privy:mfa:clear":return r;default:throw Error(`invalid wallet event type ${e}`)}}constructor(){this.callbacks={}}};
|
|
1
|
+
"use strict";exports.EventCallbacksQueue=class{enqueue(e,a){this.callbacks[e]=a}dequeue(e,a){let r=this.callbacks[a];if(!r)throw Error(`cannot dequeue ${e} event: no event found for id ${a}`);switch(delete this.callbacks[a],e){case"privy:iframe:ready":case"privy:wallets:create":case"privy:user-signer:sign":case"privy:wallets:add":case"privy:wallets:set-recovery":case"privy:wallets:connect":case"privy:wallets:recover":case"privy:wallets:rpc":case"privy:wallet:create":case"privy:wallet:connect":case"privy:wallet:recover":case"privy:wallet:rpc":case"privy:solana-wallet:create":case"privy:solana-wallet:create-additional":case"privy:solana-wallet:connect":case"privy:solana-wallet:recover":case"privy:solana-wallet:rpc":case"privy:delegated-actions:consent":case"privy:mfa:verify":case"privy:mfa:init-enrollment":case"privy:mfa:submit-enrollment":case"privy:mfa:unenroll":case"privy:mfa:clear":case"privy:auth:unlink-passkey":return r;default:throw Error(`invalid wallet event type ${e}`)}}constructor(){this.callbacks={}}};
|
|
2
2
|
//# sourceMappingURL=EventCallbackQueue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventCallbackQueue.js","sources":["../../../src/embedded/EventCallbackQueue.ts"],"names":["enqueue","eventId","callbacks","this","dequeue","event","Error","constructor"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EventCallbackQueue.js","sources":["../../../src/embedded/EventCallbackQueue.ts"],"names":["enqueue","eventId","callbacks","this","dequeue","event","Error","constructor"],"mappings":"yCAsCO,MAGLA,OAAAA,CAAQC,EAAiBC,GACvBC,KAAKD,UAAUD,GAAWC,CAC5B,CAkDAE,OAAAA,CAAQC,EAAuBJ,GAC7B,IAAMC,EAAYC,KAAKD,UAAUD,GAEjC,IAAKC,EAEH,MAAMI,MAAU,kBAAkBD,kCAAsCJ,KAK1E,cAFOE,KAAKD,UAAUD,GAEdI,GACN,IAAK,qBAEL,IAAK,uBAEL,IAAK,yBAEL,IAAK,oBAEL,IAAK,6BAEL,IAAK,wBAEL,IAAK,wBAEL,IAAK,oBAEL,IAAK,sBAEL,IAAK,uBAEL,IAAK,uBAEL,IAAK,mBAEL,IAAK,6BAEL,IAAK,wCAEL,IAAK,8BAEL,IAAK,8BAEL,IAAK,0BAEL,IAAK,kCAEL,IAAK,mBAEL,IAAK,4BAEL,IAAK,8BAEL,IAAK,qBAEL,IAAK,kBAEL,IAAK,4BA7CH,OAAOH,EA+CT,QACE,MAAMI,MAAU,6BAA6BD,KAEnD,CAAA,WAAAE,GAAAJ,KApHQD,UAA6D,CAAA,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("@privy-io/ethereum"),
|
|
1
|
+
"use strict";var e=require("@privy-io/ethereum"),r=require("../../utils/encodings.js");function t(e){if("number"==typeof e||"bigint"==typeof e){return`0x${BigInt(e).toString(16)}`}if("string"==typeof e){if(r.isHexEncoded(e))return e;if(!/^\d+$/.test(e))throw Error(`Invalid quantity string: must be hex (0x…) or decimal: ${e}`);return r.bytesToHex(r.utf8ToBytes(e))}}exports.toWalletApiUnsignedEthTransaction=function(i){return e.isTempoTransactionRequest(i)?{type:e.TEMPO_TXN_TYPE_NUMBER,from:i.from,chain_id:t(i.chainId),nonce:t(i.nonce),nonce_key:t(i.nonceKey),gas_limit:t(i.gasLimit),max_fee_per_gas:t(i.maxFeePerGas),max_priority_fee_per_gas:t(i.maxPriorityFeePerGas),fee_token:i.feeToken,valid_after:t(i.validAfter),valid_before:t(i.validBefore),fee_payer_signature:function(e){if(!e)return;let r=void 0!==e.yParity?e.yParity:void 0!==e.v?Number(e.v)-27:void 0;if(0!==r&&1!==r)throw Error("Tempo fee payer signatures require a valid yParity value");return{r:e.r,s:e.s,y_parity:r}}(i.feePayerSignature),access_list:function(e){if(e)return Array.isArray(e)?e.map((e=>"address"in e?{address:e.address,storage_keys:[...e.storageKeys]}:{address:e[0],storage_keys:[...e[1]]})):Object.entries(e).map((([e,r])=>({address:e,storage_keys:[...r]})))}(i.accessList),calls:i.calls.map((e=>({to:e.to,data:e.data,value:t(e.value)})))}:{from:i.from,to:i.to??void 0,nonce:t(i.nonce),chain_id:t(i.chainId),data:function(e){if(void 0!==e)return"string"==typeof e?r.isHexEncoded(e)?e:r.bytesToHex(r.utf8ToBytes(e)):r.bytesToHex(Buffer.from(Uint8Array.from(e)))}(i.data),value:t(i.value),type:i.type,gas_limit:t(i.gasLimit),gas_price:t(i.gasPrice),max_fee_per_gas:t(i.maxFeePerGas),max_priority_fee_per_gas:t(i.maxPriorityFeePerGas)}};
|
|
2
2
|
//# sourceMappingURL=wallet-api-eth-transaction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet-api-eth-transaction.js","sources":["../../../../src/embedded/stack/wallet-api-eth-transaction.ts"],"names":["quantityToHex","val","BigInt","toString","isHexEncoded","test","Error","bytesToHex","utf8ToBytes","transaction","
|
|
1
|
+
{"version":3,"file":"wallet-api-eth-transaction.js","sources":["../../../../src/embedded/stack/wallet-api-eth-transaction.ts"],"names":["quantityToHex","val","BigInt","toString","isHexEncoded","test","Error","bytesToHex","utf8ToBytes","transaction","e","type","TEMPO_TXN_TYPE_NUMBER","from","chain_id","chainId","nonce","nonce_key","nonceKey","gas_limit","gasLimit","max_fee_per_gas","maxFeePerGas","max_priority_fee_per_gas","maxPriorityFeePerGas","fee_token","feeToken","valid_after","validAfter","valid_before","validBefore","fee_payer_signature","signature","yParity","v","Number","r","s","y_parity","feePayerSignature","access_list","toWalletApiAccessList","accessList","Array","isArray","map","entry","address","storage_keys","storageKeys","Object","entries","calls","call","to","data","value","undefined","encodeTransactionData","Buffer","Uint8Array","gas_price","gasPrice"],"mappings":"uFAqIA,SAASA,EAAcC,GACrB,GAAmB,iBAARA,GAAoB,iBAAOA,EAAkB,CAEtD,MAAO,KADOC,OAAOD,GACHE,SAAS,KAAK,CAGlC,GAAI,iBAAOF,EAAkB,CAC3B,GAAIG,EAAAA,aAAaH,GAAM,OAAOA,EAK9B,IAAK,QAAQI,KAAKJ,GAChB,MAAMK,MAAU,0DAA0DL,KAE5E,OAAOM,EAAAA,WAAWC,EAAAA,YAAYP,GAChC,CAGF,2CAnIO,SACLQ,GAAqF,OAErFC,EAAAA,0BAA8BD,GA2BvB,CACLE,KAAMC,EAAAA,sBACNC,KA5B2CJ,EA4BzBI,KAClBC,SAAUd,EA7BiCS,EA6BPM,SACpCC,MAAOhB,EAAcS,EAAYO,OACjCC,UAAWjB,EA/BgCS,EA+BNS,UACrCC,UAAWnB,EAhCgCS,EAgCNW,UACrCC,gBAAiBrB,EAAcS,EAAYa,cAC3CC,yBAA0BvB,EAAcS,EAAYe,sBACpDC,UAAWhB,EAAYiB,SACvBC,YAAa3B,EAAcS,EAAYmB,YACvCC,aAAc7B,EArC6BS,EAqCHqB,aACxCC,oBA6BJ,SACEC,GAEA,IAAKA,EAAW,OAEhB,IAAMC,OAiB2B,IAAtBD,EAAUC,QAAgCD,EAAUC,aACpC,IAlBsBD,EAkB5BE,EAA0BC,OAAOH,EAAUE,GAAK,QAAA,EAhBrE,GAAID,IAAAA,GAAiBA,IAAAA,EACnB,MAAU3B,MAAM,4DAGlB,MAAO,CACL8B,EAAGJ,EAAUI,EACbC,EAAGL,EAAUK,EACbC,SAAUL,EAEd,CAhBA,CA7B2DxB,EAAY8B,mBACnEC,YAAaC,SAScC,GAC7B,GAAKA,EAAAA,OAELC,MAAUC,QAAQF,GACRA,EAAyCG,KAAInC,GAC/C,YAAaoC,EACR,CAACC,QAASD,EAAMC,QAASC,aAAc,IAAIF,EAAMG,cAGnD,CAACF,QAASD,EAAM,GAAIE,aAAc,IAAIF,EAAM,OAIhDI,OAAOC,QAAQT,GAAYG,KAAI,EAAEE,EAASE,MAAY,CAC3DF,QAAAA,EACAC,aAAc,IAAIC,MAEtB,CA1BiBR,CAAsBhC,EAAYiC,YAC/CU,MAxC2C3C,EAwCxB2C,MAAMP,KAAKQ,KAC5BC,GAAID,EAAKC,GACTC,KAAMF,EAAKE,KACXC,MAAOxD,EAAcqD,EAAKG,YAnCvB,CACL3C,KAAMJ,EAAYI,KAClByC,GAR4C7C,EAQ5B6C,SAAMG,EACtBzC,MAAOhB,EAAcS,EAAYO,OACjCF,SAAUd,EAAcS,EAAYM,SACpCwC,KAAMG,SAiFqBH,GAC7B,QAAoB,IAATA,EAAAA,MAIX,iBAAWA,EAEFnD,EAAAA,aAAamD,GAAQA,EAAOhD,EAAAA,WAAWC,EAAAA,YAAY+C,IAIrDhD,EAAAA,WAAWoD,OAAO9C,KAAK+C,WAAW/C,KAAK0C,IAChD,CA7FUG,CAXsCjD,EAWJ8C,MACxCC,MAAOxD,EAZqCS,EAYX+C,OACjC7C,KAAMF,EAAYE,KAClBQ,UAAWnB,EAdiCS,EAcPW,UACrCyC,UAAW7D,EAfiCS,EAePqD,UACrCzC,gBAAiBrB,EAhB2BS,EAgBDa,cAC3CC,yBAA0BvB,EAjBkBS,EAiBQe,sBAhBxD"}
|
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("./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]}})}));
|
|
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"),h=require("./solana/client.js"),E=require("./solana/createSiwsMessage.js"),C=require("./solana/getSolanaRpcEndpointForCluster.js"),S=require("./solana/getSolanaUsdcMintAddressForCluster.js"),f=require("./solana/getSolanaClusterDisplayName.js"),W=require("./solana/offchain-message.js"),P=require("./types.js"),v=require("@privy-io/chains"),M=require("./utils/formatters.js"),U=require("./wallet-api/generate-authorization-signature.js"),I=require("./wallet-api/create.js"),T=require("./wallet-api/rpc.js"),w=require("./wallet-api/raw-sign.js"),O=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"),k=require("./solana/ConnectedStandardSolanaWallet.js"),L=require("./utils/poll.js"),D=require("./index-DzfqDJJ9.js"),_=require("./index-BDWdfIuK.js"),B=require("./index--nYkyGeH.js"),K=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("@privy-io/encoding"),require("canonicalize"),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=h.SolanaClient,exports.createSiwsMessage=E.createSiwsMessage,exports.getSolanaRpcEndpointForCluster=C.getSolanaRpcEndpointForCluster,exports.getSolanaUsdcMintAddressForCluster=S.getSolanaUsdcMintAddressForCluster,exports.getSolanaClusterDisplayName=f.getSolanaClusterDisplayName,exports.buildSolanaOffchainMessage=W.buildSolanaOffchainMessage,exports.deriveSolanaApplicationDomain=W.deriveSolanaApplicationDomain,exports.parseSolanaOffchainMessage=W.parseSolanaOffchainMessage,exports.ALL_WALLET_CLIENT_TYPES=P.ALL_WALLET_CLIENT_TYPES,exports.SUPPORTED_CONNECTOR_TYPES=P.SUPPORTED_CONNECTOR_TYPES,exports.formatLamportsAmount=M.formatLamportsAmount,exports.formatTokenAmount=M.formatTokenAmount,exports.formatWalletAddress=M.formatWalletAddress,exports.formatWeiAmount=M.formatWeiAmount,exports.generateAuthorizationSignature=U.generateAuthorizationSignature,exports.create=I.create,exports.rpc=T.rpc,exports.rawSign=w.rawSign,exports.getWallet=O.getWallet,exports.updateWallet=R.updateWallet,exports.isUnifiedWallet=F.isUnifiedWallet,exports.addSessionSigners=N.addSessionSigners,exports.removeSessionSigners=N.removeSessionSigners,exports.ConnectedStandardSolanaWallet=k.ConnectedStandardSolanaWallet,exports.poll=L.poll,exports.crossApp=D.index,exports.delegatedActions=_.index,exports.depositAddress=B.index,Object.defineProperty(exports,"getCountryCallingCode",{enumerable:!0,get:function(){return K.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(v).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return v[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":"8jTAewB,yCAEa,uCAEf,+BAEO,8BAMR,qBAJD,wBAEI"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("@privy-io/encoding");let t="solana offchain";function n(t){let n=e.encoding.utf8.toBytes(t),r=new Uint8Array(32);return r.set(n.slice(0,32)),r}exports.buildSolanaOffchainMessage=function({message:r,signerPublicKey:i,domain:o}){let s=e.encoding.utf8.toBytes(r);if(32!==i.length)throw Error("Signer public key must be 32 bytes");let a=85+s.length;if(a>1232)throw Error(`Combined message length (${a}) exceeds maximum (1232)`);let l=n(o),c=new Uint8Array(a),g=0;c[0]=255,g+=1;let d=e.encoding.utf8.toBytes(t);return c.set(d,g),c[g+=d.length]=0,g+=1,c.set(l,g),c[g+=32]=1,c[g+=1]=1,g+=1,c.set(i,g),c[g+=32]=255&s.length,c[g+1]=s.length>>8&255,g+=2,c.set(s,g),c},exports.deriveSolanaApplicationDomain=n,exports.parseSolanaOffchainMessage=function(e){if(e.length<85)throw Error("Message too short to contain a valid off-chain preamble");let n=0;if(255!==e[0])throw Error("Invalid signing domain prefix");if(n+=1,(new TextDecoder).decode(e.slice(n,n+15))!==t)throw Error("Invalid signing domain text");let r=e[n+=15];n+=1;let i=e.slice(n,n+32),o=e[n+=32],s=e[n+=1];if(1!==s)throw Error(`Expected 1 signer, got ${s}`);n+=1;let a=e.slice(n,n+32),l=e[n+=32]|e[n+1]<<8;if(n+=2,e.length<n+l)throw Error("Message body is shorter than declared length");return{version:r,applicationDomain:i,format:o,signerPublicKey:a,message:(new TextDecoder).decode(e.slice(n,n+l))}};
|
|
2
|
+
//# sourceMappingURL=offchain-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offchain-message.js","sources":["../../../src/solana/offchain-message.ts"],"names":["SIGNING_DOMAIN_TEXT","deriveSolanaApplicationDomain","origin","encoded","encoding","utf8","toBytes","domain","Uint8Array","set","slice","message","signerPublicKey","messageBytes","length","Error","totalLength","PREAMBLE_LENGTH","applicationDomain","result","offset","domainTextBytes","i","bytes","SIGNING_DOMAIN_LENGTH","domainText","TextDecoder","decode","version","format","signerCount","messageLength"],"mappings":"iDAGA,IAAMA,EAAsB,kBAuBrB,SAASC,EAA8BC,GAC5C,IAAMC,EAAUC,WAASC,KAAKC,QAAQJ,GAChCK,EAAS,IAAIC,WAtBa,IAwBhC,OADAD,EAAOE,IAAIN,EAAQO,MAAM,EAvBO,KAwBzBH,CACT,oCAWO,UACLI,QAAAA,EACAC,gBAAAA,EACAL,OAAAA,IAMA,IAAMM,EAAeT,EAAAA,SAASC,KAAKC,QAAQK,GAE3C,GAAIC,KAAAA,EAAgBE,OAClB,MAAMC,MAAU,sCAGlB,IAAMC,EAAcC,GAAkBJ,EAAaC,OACnD,GAAIE,EA/CsB,KAgDxB,MAAUD,MACR,4BAA4BC,6BAIhC,IAAME,EAAoBjB,EAA8BM,GAClDY,EAAS,IAAIX,WAAWQ,GAC1BI,EAAS,EAGbD,EAHa,GAhEe,IAoE5BC,GAAU,EACV,IAAMC,EAAkBjB,EAAAA,SAASC,KAAKC,QAAQN,GAgC9C,OA/BAmB,EAAOV,IAAIY,EAAiBD,GAI5BD,EAHAC,GAAUC,EAAgBP,QApEL,EAwErBM,GAAU,EAGVD,EAAOV,IAAIS,EAAmBE,GAI9BD,EAHAC,GA3EgC,IACN,EAiF1BD,EAHAC,GAAU,GA7ES,EAiFnBA,GAAU,EAGVD,EAAOV,IAAIG,EAAiBQ,GAI5BD,EAHAC,GApFoB,IAuFHP,IAAAA,EAAaC,OAC9BK,EAAOC,EAAS,GAAKE,EAAcR,QAAU,EAAK,IAClDM,GAxF2B,EA2F3BD,EAAOV,IAAII,EAAcO,GAElBD,CACT,6EAcO,SAAoCI,GACzC,GAAIA,EAAMT,OAzGVU,GA0GE,MAAMT,MAAU,2DAGlB,IAAIK,EAAS,EAGb,GAAIG,MAAAA,EAHS,GAIX,MAAUR,MAAM,iCAOlB,GALAK,GAAU,GAKNK,IAHmBC,aAAcC,OACnCJ,EAAMb,MAAMU,EAAQA,EAASpB,OAEZA,EACjB,MAAMe,MAAU,+BAKlB,IAAMa,EAAUL,EAHhBH,GAAUpB,IAIVoB,GAAU,EAGV,IAAMF,EAAoBK,EAAMb,MAAMU,EAAQA,EA1Id,IA8I1BS,EAASN,EAHfH,GA3IgC,IAkJ1BU,EAAcP,EAHpBH,GAAU,GAIV,GAAoB,IAAhBU,EACF,MAAMf,MAAU,0BAA0Be,KAE5CV,GAAU,EAGV,IAAMR,EAAkBW,EAAMb,MAAMU,EAAQA,EAtJxB,IA0JdW,EAAgBR,EAHtBH,GAvJoB,IA0JoBG,EAAMH,EAAS,IAAO,EAI9D,GAHAA,GA1J2B,EA6JvBG,EAAMT,OAASM,EAASW,EAC1B,MAAUhB,MAAM,gDAIlB,MAAO,CAACa,QAAAA,EAASV,kBAAAA,EAAmBW,OAAAA,EAAQjB,gBAAAA,EAAiBD,SAF7C,IAAIe,aAAcC,OAAOJ,EAAMb,MAAMU,EAAQA,EAASW,IAGxE"}
|
package/dist/dts/index.d.mts
CHANGED
|
@@ -2420,6 +2420,38 @@ declare function getSolanaUsdcMintAddressForCluster({ name }: SolanaCluster): "E
|
|
|
2420
2420
|
*/
|
|
2421
2421
|
declare function getSolanaClusterDisplayName(name: Cluster): "Solana" | "Testnet" | "Devnet";
|
|
2422
2422
|
|
|
2423
|
+
/**
|
|
2424
|
+
* Derives a 32-byte application domain from an origin string.
|
|
2425
|
+
* UTF-8 encodes the origin and zero-pads (or truncates) to exactly 32 bytes.
|
|
2426
|
+
*/
|
|
2427
|
+
declare function deriveSolanaApplicationDomain(origin: string): Uint8Array;
|
|
2428
|
+
/**
|
|
2429
|
+
* Builds the full off-chain message bytes (preamble + body) per the Solana off-chain
|
|
2430
|
+
* message signing spec. The resulting bytes are what gets passed to `signMessage`.
|
|
2431
|
+
*
|
|
2432
|
+
* Uses format 1 (UTF-8) since SIWS messages contain newlines. This supports Ledger
|
|
2433
|
+
* hardware wallets via blind signing.
|
|
2434
|
+
*
|
|
2435
|
+
* @see https://github.com/solana-labs/solana/blob/master/docs/src/proposals/off-chain-message-signing.md
|
|
2436
|
+
*/
|
|
2437
|
+
declare function buildSolanaOffchainMessage({ message, signerPublicKey, domain, }: {
|
|
2438
|
+
message: string;
|
|
2439
|
+
signerPublicKey: Uint8Array;
|
|
2440
|
+
domain: string;
|
|
2441
|
+
}): Uint8Array;
|
|
2442
|
+
type ParsedSolanaOffchainMessage = {
|
|
2443
|
+
version: number;
|
|
2444
|
+
applicationDomain: Uint8Array;
|
|
2445
|
+
format: number;
|
|
2446
|
+
signerPublicKey: Uint8Array;
|
|
2447
|
+
message: string;
|
|
2448
|
+
};
|
|
2449
|
+
/**
|
|
2450
|
+
* Parses off-chain message bytes back into structured fields.
|
|
2451
|
+
* Validates the signing domain prefix and structure.
|
|
2452
|
+
*/
|
|
2453
|
+
declare function parseSolanaOffchainMessage(bytes: Uint8Array): ParsedSolanaOffchainMessage;
|
|
2454
|
+
|
|
2423
2455
|
/**
|
|
2424
2456
|
* Formats a wallet address by showing the first 5 characters, followed by an ellipsis,
|
|
2425
2457
|
* and then the last 4 characters.
|
|
@@ -3041,5 +3073,5 @@ declare const THIRDWEB: "thirdweb";
|
|
|
3041
3073
|
/** @deprecated {@link SmartWalletType} is a well-typed union, use the `'nexus'` literal instead */
|
|
3042
3074
|
declare const NEXUS: "nexus";
|
|
3043
3075
|
|
|
3044
|
-
export { ALL_WALLET_CLIENT_TYPES, BICONOMY, COINBASE_SMART_WALLET, ConnectedStandardSolanaWallet, EmbeddedBitcoinWalletProvider, EmbeddedProviderError, InMemoryCache, KERNEL, LIGHT_ACCOUNT, LocalStorage, MoonpayApiError, NEXUS, PrivyApiError, PrivyClientError, PrivyConnectorError, PrivyEmbeddedWalletErrorCode, PrivyProviderRpcError, ProviderErrors, SAFE, SUPPORTED_CONNECTOR_TYPES, SolanaClient, SolanaUsdcAddressMap, THIRDWEB, UsdcAddressMap, addSessionSigners, chainToMoonpayCurrency, countryCodesAndNumbers, create, createErrorFormatter, createSiwsMessage, index$1 as crossApp, Privy as default, index$3 as delegatedActions, index as depositAddress, errorIndicatesMaxMfaRetries, errorIndicatesMfaCanceled, errorIndicatesMfaRateLimit, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, errorIndicatesRecoveryIsNeeded, formatLamportsAmount, formatPhoneNumber, formatTokenAmount, formatWalletAddress, formatWeiAmount, fundingMethodToMoonpayPaymentMethod, generateAuthorizationSignature, generateWalletIdempotencyKey, getAllUserEmbeddedBitcoinWallets, getAllUserEmbeddedEthereumWallets, getAllUserEmbeddedSolanaWallets, getCoinbaseOnRampUrl, getEntropyDetailsFromAccount, getEntropyDetailsFromUser, getIsTokenUsdc, getJsonRpcEndpointFromChain, getPhoneCountryCodeAndNumber, getPlaceholderPhoneNumber, getSolanaClusterDisplayName, getSolanaRpcEndpointForCluster, getSolanaUsdcMintAddressForCluster, getUserEmbeddedEthereumWallet, getUserEmbeddedSolanaWallet, getUserEmbeddedWallet, getUserSmartWallet, getWallet, isEmbeddedWalletAccount, isSupportedChainIdForCoinbaseOnramp, isSupportedChainIdForMoonpay, isUnifiedWallet, lastFourDigits, phoneNumberTypingFormatter, poll, rawSign, removeSessionSigners, rpc, throwIfInvalidRecoveryUpgradePath, toCoinbaseAssetId, toCoinbaseBlockchainFromChainId, toObjectKeys, toWalletApiUnsignedEthTransaction, updateWallet, validatePhoneNumber };
|
|
3045
|
-
export type { Cluster, CoinbaseAssetId, CoinbaseWalletClientType, CompletedDepositAddressOrder, ConnectorType, CreateSiwsMessageOpts, DepositAddressOrder, DepositAddressPollingResult, DepositAddressQuote, DepositConfig, EIP1193Provider, EmbeddedWalletClientType, EmbeddedWalletConfig, EmbeddedWalletRecoveryOptions, EntropyIdVerifier, ErrorMessageMap, ExternalWallet, ExternalWalletMetadata, FundingMethod, FundingProvider, GenerateAuthorizationSignatureInput, GenerateAuthorizationSignatureOutput, GenerateDepositAddressInput, GetDepositInput, IdentifierString, IncompleteDepositAddressOrder, InjectedWalletClientType, LogLevel, Logger, MfaMethod, MfaPromise, MfaSubmitArgs, MfaSubmitPromise, MoonpayTransactionStatus, MoonpayTransactionStatusResponse, OAuthProviderType, OnNeedsRecovery, PaymentOption, PollOptions, PollResult, PreparedTransactionRequest, PrivyEmbeddedSolanaWalletProvider, PrivyEmbeddedWalletProvider, Quantity, ResolveRefundAddressError, ResolveRefundAddressResult, SetRecoveryInput, SmartWalletType, SolanaCluster, SolanaSignAndSendTransactionInput, SolanaSignAndSendTransactionMode, SolanaSignAndSendTransactionOptions, SolanaSignAndSendTransactionOutput, SolanaSignMessageInput, SolanaSignMessageOutput, SolanaSignTransactionInput, SolanaSignTransactionOptions, SolanaSignTransactionOutput, SolanaStandardWallet, SolanaTransactionCommitment, Storage, UnknownWalletClientType, UnsignedTransactionRequest, UnsignedTransactionRequestWithChainId, WaitForCompletionInput, WaitForDepositInput, WalletBranding, WalletClientType, WalletConnectWalletClientType };
|
|
3076
|
+
export { ALL_WALLET_CLIENT_TYPES, BICONOMY, COINBASE_SMART_WALLET, ConnectedStandardSolanaWallet, EmbeddedBitcoinWalletProvider, EmbeddedProviderError, InMemoryCache, KERNEL, LIGHT_ACCOUNT, LocalStorage, MoonpayApiError, NEXUS, PrivyApiError, PrivyClientError, PrivyConnectorError, PrivyEmbeddedWalletErrorCode, PrivyProviderRpcError, ProviderErrors, SAFE, SUPPORTED_CONNECTOR_TYPES, SolanaClient, SolanaUsdcAddressMap, THIRDWEB, UsdcAddressMap, addSessionSigners, buildSolanaOffchainMessage, chainToMoonpayCurrency, countryCodesAndNumbers, create, createErrorFormatter, createSiwsMessage, index$1 as crossApp, Privy as default, index$3 as delegatedActions, index as depositAddress, deriveSolanaApplicationDomain, errorIndicatesMaxMfaRetries, errorIndicatesMfaCanceled, errorIndicatesMfaRateLimit, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, errorIndicatesRecoveryIsNeeded, formatLamportsAmount, formatPhoneNumber, formatTokenAmount, formatWalletAddress, formatWeiAmount, fundingMethodToMoonpayPaymentMethod, generateAuthorizationSignature, generateWalletIdempotencyKey, getAllUserEmbeddedBitcoinWallets, getAllUserEmbeddedEthereumWallets, getAllUserEmbeddedSolanaWallets, getCoinbaseOnRampUrl, getEntropyDetailsFromAccount, getEntropyDetailsFromUser, getIsTokenUsdc, getJsonRpcEndpointFromChain, getPhoneCountryCodeAndNumber, getPlaceholderPhoneNumber, getSolanaClusterDisplayName, getSolanaRpcEndpointForCluster, getSolanaUsdcMintAddressForCluster, getUserEmbeddedEthereumWallet, getUserEmbeddedSolanaWallet, getUserEmbeddedWallet, getUserSmartWallet, getWallet, isEmbeddedWalletAccount, isSupportedChainIdForCoinbaseOnramp, isSupportedChainIdForMoonpay, isUnifiedWallet, lastFourDigits, parseSolanaOffchainMessage, phoneNumberTypingFormatter, poll, rawSign, removeSessionSigners, rpc, throwIfInvalidRecoveryUpgradePath, toCoinbaseAssetId, toCoinbaseBlockchainFromChainId, toObjectKeys, toWalletApiUnsignedEthTransaction, updateWallet, validatePhoneNumber };
|
|
3077
|
+
export type { Cluster, CoinbaseAssetId, CoinbaseWalletClientType, CompletedDepositAddressOrder, ConnectorType, CreateSiwsMessageOpts, DepositAddressOrder, DepositAddressPollingResult, DepositAddressQuote, DepositConfig, EIP1193Provider, EmbeddedWalletClientType, EmbeddedWalletConfig, EmbeddedWalletRecoveryOptions, EntropyIdVerifier, ErrorMessageMap, ExternalWallet, ExternalWalletMetadata, FundingMethod, FundingProvider, GenerateAuthorizationSignatureInput, GenerateAuthorizationSignatureOutput, GenerateDepositAddressInput, GetDepositInput, IdentifierString, IncompleteDepositAddressOrder, InjectedWalletClientType, LogLevel, Logger, MfaMethod, MfaPromise, MfaSubmitArgs, MfaSubmitPromise, MoonpayTransactionStatus, MoonpayTransactionStatusResponse, OAuthProviderType, OnNeedsRecovery, ParsedSolanaOffchainMessage, PaymentOption, PollOptions, PollResult, PreparedTransactionRequest, PrivyEmbeddedSolanaWalletProvider, PrivyEmbeddedWalletProvider, Quantity, ResolveRefundAddressError, ResolveRefundAddressResult, SetRecoveryInput, SmartWalletType, SolanaCluster, SolanaSignAndSendTransactionInput, SolanaSignAndSendTransactionMode, SolanaSignAndSendTransactionOptions, SolanaSignAndSendTransactionOutput, SolanaSignMessageInput, SolanaSignMessageOutput, SolanaSignTransactionInput, SolanaSignTransactionOptions, SolanaSignTransactionOutput, SolanaStandardWallet, SolanaTransactionCommitment, Storage, UnknownWalletClientType, UnsignedTransactionRequest, UnsignedTransactionRequestWithChainId, WaitForCompletionInput, WaitForDepositInput, WalletBranding, WalletClientType, WalletConnectWalletClientType };
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -2420,6 +2420,38 @@ declare function getSolanaUsdcMintAddressForCluster({ name }: SolanaCluster): "E
|
|
|
2420
2420
|
*/
|
|
2421
2421
|
declare function getSolanaClusterDisplayName(name: Cluster): "Solana" | "Testnet" | "Devnet";
|
|
2422
2422
|
|
|
2423
|
+
/**
|
|
2424
|
+
* Derives a 32-byte application domain from an origin string.
|
|
2425
|
+
* UTF-8 encodes the origin and zero-pads (or truncates) to exactly 32 bytes.
|
|
2426
|
+
*/
|
|
2427
|
+
declare function deriveSolanaApplicationDomain(origin: string): Uint8Array;
|
|
2428
|
+
/**
|
|
2429
|
+
* Builds the full off-chain message bytes (preamble + body) per the Solana off-chain
|
|
2430
|
+
* message signing spec. The resulting bytes are what gets passed to `signMessage`.
|
|
2431
|
+
*
|
|
2432
|
+
* Uses format 1 (UTF-8) since SIWS messages contain newlines. This supports Ledger
|
|
2433
|
+
* hardware wallets via blind signing.
|
|
2434
|
+
*
|
|
2435
|
+
* @see https://github.com/solana-labs/solana/blob/master/docs/src/proposals/off-chain-message-signing.md
|
|
2436
|
+
*/
|
|
2437
|
+
declare function buildSolanaOffchainMessage({ message, signerPublicKey, domain, }: {
|
|
2438
|
+
message: string;
|
|
2439
|
+
signerPublicKey: Uint8Array;
|
|
2440
|
+
domain: string;
|
|
2441
|
+
}): Uint8Array;
|
|
2442
|
+
type ParsedSolanaOffchainMessage = {
|
|
2443
|
+
version: number;
|
|
2444
|
+
applicationDomain: Uint8Array;
|
|
2445
|
+
format: number;
|
|
2446
|
+
signerPublicKey: Uint8Array;
|
|
2447
|
+
message: string;
|
|
2448
|
+
};
|
|
2449
|
+
/**
|
|
2450
|
+
* Parses off-chain message bytes back into structured fields.
|
|
2451
|
+
* Validates the signing domain prefix and structure.
|
|
2452
|
+
*/
|
|
2453
|
+
declare function parseSolanaOffchainMessage(bytes: Uint8Array): ParsedSolanaOffchainMessage;
|
|
2454
|
+
|
|
2423
2455
|
/**
|
|
2424
2456
|
* Formats a wallet address by showing the first 5 characters, followed by an ellipsis,
|
|
2425
2457
|
* and then the last 4 characters.
|
|
@@ -3041,5 +3073,5 @@ declare const THIRDWEB: "thirdweb";
|
|
|
3041
3073
|
/** @deprecated {@link SmartWalletType} is a well-typed union, use the `'nexus'` literal instead */
|
|
3042
3074
|
declare const NEXUS: "nexus";
|
|
3043
3075
|
|
|
3044
|
-
export { ALL_WALLET_CLIENT_TYPES, BICONOMY, COINBASE_SMART_WALLET, ConnectedStandardSolanaWallet, EmbeddedBitcoinWalletProvider, EmbeddedProviderError, InMemoryCache, KERNEL, LIGHT_ACCOUNT, LocalStorage, MoonpayApiError, NEXUS, PrivyApiError, PrivyClientError, PrivyConnectorError, PrivyEmbeddedWalletErrorCode, PrivyProviderRpcError, ProviderErrors, SAFE, SUPPORTED_CONNECTOR_TYPES, SolanaClient, SolanaUsdcAddressMap, THIRDWEB, UsdcAddressMap, addSessionSigners, chainToMoonpayCurrency, countryCodesAndNumbers, create, createErrorFormatter, createSiwsMessage, index$1 as crossApp, Privy as default, index$3 as delegatedActions, index as depositAddress, errorIndicatesMaxMfaRetries, errorIndicatesMfaCanceled, errorIndicatesMfaRateLimit, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, errorIndicatesRecoveryIsNeeded, formatLamportsAmount, formatPhoneNumber, formatTokenAmount, formatWalletAddress, formatWeiAmount, fundingMethodToMoonpayPaymentMethod, generateAuthorizationSignature, generateWalletIdempotencyKey, getAllUserEmbeddedBitcoinWallets, getAllUserEmbeddedEthereumWallets, getAllUserEmbeddedSolanaWallets, getCoinbaseOnRampUrl, getEntropyDetailsFromAccount, getEntropyDetailsFromUser, getIsTokenUsdc, getJsonRpcEndpointFromChain, getPhoneCountryCodeAndNumber, getPlaceholderPhoneNumber, getSolanaClusterDisplayName, getSolanaRpcEndpointForCluster, getSolanaUsdcMintAddressForCluster, getUserEmbeddedEthereumWallet, getUserEmbeddedSolanaWallet, getUserEmbeddedWallet, getUserSmartWallet, getWallet, isEmbeddedWalletAccount, isSupportedChainIdForCoinbaseOnramp, isSupportedChainIdForMoonpay, isUnifiedWallet, lastFourDigits, phoneNumberTypingFormatter, poll, rawSign, removeSessionSigners, rpc, throwIfInvalidRecoveryUpgradePath, toCoinbaseAssetId, toCoinbaseBlockchainFromChainId, toObjectKeys, toWalletApiUnsignedEthTransaction, updateWallet, validatePhoneNumber };
|
|
3045
|
-
export type { Cluster, CoinbaseAssetId, CoinbaseWalletClientType, CompletedDepositAddressOrder, ConnectorType, CreateSiwsMessageOpts, DepositAddressOrder, DepositAddressPollingResult, DepositAddressQuote, DepositConfig, EIP1193Provider, EmbeddedWalletClientType, EmbeddedWalletConfig, EmbeddedWalletRecoveryOptions, EntropyIdVerifier, ErrorMessageMap, ExternalWallet, ExternalWalletMetadata, FundingMethod, FundingProvider, GenerateAuthorizationSignatureInput, GenerateAuthorizationSignatureOutput, GenerateDepositAddressInput, GetDepositInput, IdentifierString, IncompleteDepositAddressOrder, InjectedWalletClientType, LogLevel, Logger, MfaMethod, MfaPromise, MfaSubmitArgs, MfaSubmitPromise, MoonpayTransactionStatus, MoonpayTransactionStatusResponse, OAuthProviderType, OnNeedsRecovery, PaymentOption, PollOptions, PollResult, PreparedTransactionRequest, PrivyEmbeddedSolanaWalletProvider, PrivyEmbeddedWalletProvider, Quantity, ResolveRefundAddressError, ResolveRefundAddressResult, SetRecoveryInput, SmartWalletType, SolanaCluster, SolanaSignAndSendTransactionInput, SolanaSignAndSendTransactionMode, SolanaSignAndSendTransactionOptions, SolanaSignAndSendTransactionOutput, SolanaSignMessageInput, SolanaSignMessageOutput, SolanaSignTransactionInput, SolanaSignTransactionOptions, SolanaSignTransactionOutput, SolanaStandardWallet, SolanaTransactionCommitment, Storage, UnknownWalletClientType, UnsignedTransactionRequest, UnsignedTransactionRequestWithChainId, WaitForCompletionInput, WaitForDepositInput, WalletBranding, WalletClientType, WalletConnectWalletClientType };
|
|
3076
|
+
export { ALL_WALLET_CLIENT_TYPES, BICONOMY, COINBASE_SMART_WALLET, ConnectedStandardSolanaWallet, EmbeddedBitcoinWalletProvider, EmbeddedProviderError, InMemoryCache, KERNEL, LIGHT_ACCOUNT, LocalStorage, MoonpayApiError, NEXUS, PrivyApiError, PrivyClientError, PrivyConnectorError, PrivyEmbeddedWalletErrorCode, PrivyProviderRpcError, ProviderErrors, SAFE, SUPPORTED_CONNECTOR_TYPES, SolanaClient, SolanaUsdcAddressMap, THIRDWEB, UsdcAddressMap, addSessionSigners, buildSolanaOffchainMessage, chainToMoonpayCurrency, countryCodesAndNumbers, create, createErrorFormatter, createSiwsMessage, index$1 as crossApp, Privy as default, index$3 as delegatedActions, index as depositAddress, deriveSolanaApplicationDomain, errorIndicatesMaxMfaRetries, errorIndicatesMfaCanceled, errorIndicatesMfaRateLimit, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, errorIndicatesRecoveryIsNeeded, formatLamportsAmount, formatPhoneNumber, formatTokenAmount, formatWalletAddress, formatWeiAmount, fundingMethodToMoonpayPaymentMethod, generateAuthorizationSignature, generateWalletIdempotencyKey, getAllUserEmbeddedBitcoinWallets, getAllUserEmbeddedEthereumWallets, getAllUserEmbeddedSolanaWallets, getCoinbaseOnRampUrl, getEntropyDetailsFromAccount, getEntropyDetailsFromUser, getIsTokenUsdc, getJsonRpcEndpointFromChain, getPhoneCountryCodeAndNumber, getPlaceholderPhoneNumber, getSolanaClusterDisplayName, getSolanaRpcEndpointForCluster, getSolanaUsdcMintAddressForCluster, getUserEmbeddedEthereumWallet, getUserEmbeddedSolanaWallet, getUserEmbeddedWallet, getUserSmartWallet, getWallet, isEmbeddedWalletAccount, isSupportedChainIdForCoinbaseOnramp, isSupportedChainIdForMoonpay, isUnifiedWallet, lastFourDigits, parseSolanaOffchainMessage, phoneNumberTypingFormatter, poll, rawSign, removeSessionSigners, rpc, throwIfInvalidRecoveryUpgradePath, toCoinbaseAssetId, toCoinbaseBlockchainFromChainId, toObjectKeys, toWalletApiUnsignedEthTransaction, updateWallet, validatePhoneNumber };
|
|
3077
|
+
export type { Cluster, CoinbaseAssetId, CoinbaseWalletClientType, CompletedDepositAddressOrder, ConnectorType, CreateSiwsMessageOpts, DepositAddressOrder, DepositAddressPollingResult, DepositAddressQuote, DepositConfig, EIP1193Provider, EmbeddedWalletClientType, EmbeddedWalletConfig, EmbeddedWalletRecoveryOptions, EntropyIdVerifier, ErrorMessageMap, ExternalWallet, ExternalWalletMetadata, FundingMethod, FundingProvider, GenerateAuthorizationSignatureInput, GenerateAuthorizationSignatureOutput, GenerateDepositAddressInput, GetDepositInput, IdentifierString, IncompleteDepositAddressOrder, InjectedWalletClientType, LogLevel, Logger, MfaMethod, MfaPromise, MfaSubmitArgs, MfaSubmitPromise, MoonpayTransactionStatus, MoonpayTransactionStatusResponse, OAuthProviderType, OnNeedsRecovery, ParsedSolanaOffchainMessage, PaymentOption, PollOptions, PollResult, PreparedTransactionRequest, PrivyEmbeddedSolanaWalletProvider, PrivyEmbeddedWalletProvider, Quantity, ResolveRefundAddressError, ResolveRefundAddressResult, SetRecoveryInput, SmartWalletType, SolanaCluster, SolanaSignAndSendTransactionInput, SolanaSignAndSendTransactionMode, SolanaSignAndSendTransactionOptions, SolanaSignAndSendTransactionOutput, SolanaSignMessageInput, SolanaSignMessageOutput, SolanaSignTransactionInput, SolanaSignTransactionOptions, SolanaSignTransactionOutput, SolanaStandardWallet, SolanaTransactionCommitment, Storage, UnknownWalletClientType, UnsignedTransactionRequest, UnsignedTransactionRequestWithChainId, WaitForCompletionInput, WaitForDepositInput, WalletBranding, WalletClientType, WalletConnectWalletClientType };
|
|
@@ -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.67.
|
|
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.1",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
|
-
class e{enqueue(e,a){this.callbacks[e]=a}dequeue(e,a){let r=this.callbacks[a];if(!r)throw Error(`cannot dequeue ${e} event: no event found for id ${a}`);switch(delete this.callbacks[a],e){case"privy:iframe:ready":case"privy:wallets:create":case"privy:user-signer:sign":case"privy:wallets:add":case"privy:wallets:set-recovery":case"privy:wallets:connect":case"privy:wallets:recover":case"privy:wallets:rpc":case"privy:wallet:create":case"privy:wallet:connect":case"privy:wallet:recover":case"privy:wallet:rpc":case"privy:solana-wallet:create":case"privy:solana-wallet:create-additional":case"privy:solana-wallet:connect":case"privy:solana-wallet:recover":case"privy:solana-wallet:rpc":case"privy:delegated-actions:consent":case"privy:mfa:verify":case"privy:mfa:init-enrollment":case"privy:mfa:submit-enrollment":case"privy:mfa:unenroll":case"privy:mfa:clear":return r;default:throw Error(`invalid wallet event type ${e}`)}}constructor(){this.callbacks={}}}export{e as EventCallbacksQueue};
|
|
1
|
+
class e{enqueue(e,a){this.callbacks[e]=a}dequeue(e,a){let r=this.callbacks[a];if(!r)throw Error(`cannot dequeue ${e} event: no event found for id ${a}`);switch(delete this.callbacks[a],e){case"privy:iframe:ready":case"privy:wallets:create":case"privy:user-signer:sign":case"privy:wallets:add":case"privy:wallets:set-recovery":case"privy:wallets:connect":case"privy:wallets:recover":case"privy:wallets:rpc":case"privy:wallet:create":case"privy:wallet:connect":case"privy:wallet:recover":case"privy:wallet:rpc":case"privy:solana-wallet:create":case"privy:solana-wallet:create-additional":case"privy:solana-wallet:connect":case"privy:solana-wallet:recover":case"privy:solana-wallet:rpc":case"privy:delegated-actions:consent":case"privy:mfa:verify":case"privy:mfa:init-enrollment":case"privy:mfa:submit-enrollment":case"privy:mfa:unenroll":case"privy:mfa:clear":case"privy:auth:unlink-passkey":return r;default:throw Error(`invalid wallet event type ${e}`)}}constructor(){this.callbacks={}}}export{e as EventCallbacksQueue};
|
|
2
2
|
//# sourceMappingURL=EventCallbackQueue.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventCallbackQueue.mjs","sources":["../../../src/embedded/EventCallbackQueue.ts"],"names":["EventCallbacksQueue","enqueue","eventId","callbacks","this","dequeue","event","Error","constructor"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EventCallbackQueue.mjs","sources":["../../../src/embedded/EventCallbackQueue.ts"],"names":["EventCallbacksQueue","enqueue","eventId","callbacks","this","dequeue","event","Error","constructor"],"mappings":"AAsCO,MAAMA,EAGXC,OAAAA,CAAQC,EAAiBC,GACvBC,KAAKD,UAAUD,GAAWC,CAC5B,CAkDAE,OAAAA,CAAQC,EAAuBJ,GAC7B,IAAMC,EAAYC,KAAKD,UAAUD,GAEjC,IAAKC,EAEH,MAAMI,MAAU,kBAAkBD,kCAAsCJ,KAK1E,cAFOE,KAAKD,UAAUD,GAEdI,GACN,IAAK,qBAEL,IAAK,uBAEL,IAAK,yBAEL,IAAK,oBAEL,IAAK,6BAEL,IAAK,wBAEL,IAAK,wBAEL,IAAK,oBAEL,IAAK,sBAEL,IAAK,uBAEL,IAAK,uBAEL,IAAK,mBAEL,IAAK,6BAEL,IAAK,wCAEL,IAAK,8BAEL,IAAK,8BAEL,IAAK,0BAEL,IAAK,kCAEL,IAAK,mBAEL,IAAK,4BAEL,IAAK,8BAEL,IAAK,qBAEL,IAAK,kBAEL,IAAK,4BA7CH,OAAOH,EA+CT,QACE,MAAMI,MAAU,6BAA6BD,KAEnD,CAAA,WAAAE,GAAAJ,KApHQD,UAA6D,CAAA,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{TEMPO_TXN_TYPE_NUMBER as e,isTempoTransactionRequest as r}from"@privy-io/ethereum";import{isHexEncoded as
|
|
1
|
+
import{TEMPO_TXN_TYPE_NUMBER as e,isTempoTransactionRequest as r}from"@privy-io/ethereum";import{isHexEncoded as a,bytesToHex as i,utf8ToBytes as t}from"../../utils/encodings.mjs";function o(o){return r(o)?{type:e,from:o.from,chain_id:s(o.chainId),nonce:s(o.nonce),nonce_key:s(o.nonceKey),gas_limit:s(o.gasLimit),max_fee_per_gas:s(o.maxFeePerGas),max_priority_fee_per_gas:s(o.maxPriorityFeePerGas),fee_token:o.feeToken,valid_after:s(o.validAfter),valid_before:s(o.validBefore),fee_payer_signature:function(e){if(!e)return;let r=void 0!==e.yParity?e.yParity:void 0!==e.v?Number(e.v)-27:void 0;if(0!==r&&1!==r)throw Error("Tempo fee payer signatures require a valid yParity value");return{r:e.r,s:e.s,y_parity:r}}(o.feePayerSignature),access_list:function(e){if(e)return Array.isArray(e)?e.map((e=>"address"in e?{address:e.address,storage_keys:[...e.storageKeys]}:{address:e[0],storage_keys:[...e[1]]})):Object.entries(e).map((([e,r])=>({address:e,storage_keys:[...r]})))}(o.accessList),calls:o.calls.map((e=>({to:e.to,data:e.data,value:s(e.value)})))}:{from:o.from,to:o.to??void 0,nonce:s(o.nonce),chain_id:s(o.chainId),data:function(e){if(void 0!==e)return"string"==typeof e?a(e)?e:i(t(e)):i(Buffer.from(Uint8Array.from(e)))}(o.data),value:s(o.value),type:o.type,gas_limit:s(o.gasLimit),gas_price:s(o.gasPrice),max_fee_per_gas:s(o.maxFeePerGas),max_priority_fee_per_gas:s(o.maxPriorityFeePerGas)}}function s(e){if("number"==typeof e||"bigint"==typeof e){return`0x${BigInt(e).toString(16)}`}if("string"==typeof e){if(a(e))return e;if(!/^\d+$/.test(e))throw Error(`Invalid quantity string: must be hex (0x…) or decimal: ${e}`);return i(t(e))}}export{o as toWalletApiUnsignedEthTransaction};
|
|
2
2
|
//# sourceMappingURL=wallet-api-eth-transaction.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet-api-eth-transaction.mjs","sources":["../../../../src/embedded/stack/wallet-api-eth-transaction.ts"],"names":["toWalletApiUnsignedEthTransaction","transaction","
|
|
1
|
+
{"version":3,"file":"wallet-api-eth-transaction.mjs","sources":["../../../../src/embedded/stack/wallet-api-eth-transaction.ts"],"names":["toWalletApiUnsignedEthTransaction","transaction","e","type","TEMPO_TXN_TYPE_NUMBER","from","chain_id","quantityToHex","chainId","nonce","nonce_key","nonceKey","gas_limit","gasLimit","max_fee_per_gas","maxFeePerGas","max_priority_fee_per_gas","maxPriorityFeePerGas","fee_token","feeToken","valid_after","validAfter","valid_before","validBefore","fee_payer_signature","signature","yParity","v","Number","Error","r","s","y_parity","feePayerSignature","access_list","toWalletApiAccessList","accessList","Array","isArray","map","entry","address","storage_keys","storageKeys","Object","entries","calls","call","to","data","value","undefined","encodeTransactionData","isHexEncoded","bytesToHex","utf8ToBytes","Buffer","Uint8Array","gas_price","gasPrice","val","BigInt","toString","test"],"mappings":"oLAqBO,SAASA,EACdC,GAAqF,OAErFC,EAA8BD,GA2BvB,CACLE,KAAMC,EACNC,KA5B2CJ,EA4BzBI,KAClBC,SAAUC,EA7BiCN,EA6BPO,SACpCC,MAAOF,EAAcN,EAAYQ,OACjCC,UAAWH,EA/BgCN,EA+BNU,UACrCC,UAAWL,EAhCgCN,EAgCNY,UACrCC,gBAAiBP,EAAcN,EAAYc,cAC3CC,yBAA0BT,EAAcN,EAAYgB,sBACpDC,UAAWjB,EAAYkB,SACvBC,YAAab,EAAcN,EAAYoB,YACvCC,aAAcf,EArC6BN,EAqCHsB,aACxCC,oBA6BJ,SACEC,GAEA,IAAKA,EAAW,OAEhB,IAAMC,OAiB2B,IAAtBD,EAAUC,QAAgCD,EAAUC,aACpC,IAlBsBD,EAkB5BE,EAA0BC,OAAOH,EAAUE,GAAK,QAAA,EAhBrE,GAAID,IAAAA,GAAiBA,IAAAA,EACnB,MAAUG,MAAM,4DAGlB,MAAO,CACLC,EAAGL,EAAUK,EACbC,EAAGN,EAAUM,EACbC,SAAUN,EAEd,CAhBA,CA7B2DzB,EAAYgC,mBACnEC,YAAaC,SAScC,GAC7B,GAAKA,EAAAA,OAELC,MAAUC,QAAQF,GACRA,EAAyCG,KAAIrC,GAC/C,YAAasC,EACR,CAACC,QAASD,EAAMC,QAASC,aAAc,IAAIF,EAAMG,cAGnD,CAACF,QAASD,EAAM,GAAIE,aAAc,IAAIF,EAAM,OAIhDI,OAAOC,QAAQT,GAAYG,KAAI,EAAEE,EAASE,MAAY,CAC3DF,QAAAA,EACAC,aAAc,IAAIC,MAEtB,CA1BiBR,CAAsBlC,EAAYmC,YAC/CU,MAxC2C7C,EAwCxB6C,MAAMP,KAAKQ,KAC5BC,GAAID,EAAKC,GACTC,KAAMF,EAAKE,KACXC,MAAO3C,EAAcwC,EAAKG,YAnCvB,CACL7C,KAAMJ,EAAYI,KAClB2C,GAR4C/C,EAQ5B+C,SAAMG,EACtB1C,MAAOF,EAAcN,EAAYQ,OACjCH,SAAUC,EAAcN,EAAYO,SACpCyC,KAAMG,SAiFqBH,GAC7B,QAAoB,IAATA,EAAAA,MAIX,iBAAWA,EAEFI,EAAaJ,GAAQA,EAAOK,EAAWC,EAAYN,IAIrDK,EAAWE,OAAOnD,KAAKoD,WAAWpD,KAAK4C,IAChD,CA7FUG,CAXsCnD,EAWJgD,MACxCC,MAAO3C,EAZqCN,EAYXiD,OACjC/C,KAAMF,EAAYE,KAClBS,UAAWL,EAdiCN,EAcPY,UACrC6C,UAAWnD,EAfiCN,EAeP0D,UACrC7C,gBAAiBP,EAhB2BN,EAgBDc,cAC3CC,yBAA0BT,EAjBkBN,EAiBQgB,sBAhBxD,CAyGA,SAASV,EAAcqD,GACrB,GAAmB,iBAARA,GAAoB,iBAAOA,EAAkB,CAEtD,MAAO,KADOC,OAAOD,GACHE,SAAS,KAAK,CAGlC,GAAI,iBAAOF,EAAkB,CAC3B,GAAIP,EAAaO,GAAM,OAAOA,EAK9B,IAAK,QAAQG,KAAKH,GAChB,MAAM/B,MAAU,0DAA0D+B,KAE5E,OAAON,EAAWC,EAAYK,GAChC,CAGF"}
|
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"./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"
|
|
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{buildSolanaOffchainMessage,deriveSolanaApplicationDomain,parseSolanaOffchainMessage}from"./solana/offchain-message.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"@privy-io/encoding";import"canonicalize";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",o="coinbase_smart_wallet",r="kernel",s="light_account",m="safe",a="thirdweb",l="nexus";export{t as BICONOMY,o as COINBASE_SMART_WALLET,r 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":"g0NAeO,MAAMA,EAAW,WAEXC,EAAwB,wBAExBC,EAAS,SAETC,EAAgB,gBAEhBC,EAAO,OAEPC,EAAW,WAEXC,EAAQ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{encoding as e}from"@privy-io/encoding";let t="solana offchain";function r(t){let r=e.utf8.toBytes(t),i=new Uint8Array(32);return i.set(r.slice(0,32)),i}function i({message:i,signerPublicKey:n,domain:o}){let s=e.utf8.toBytes(i);if(32!==n.length)throw Error("Signer public key must be 32 bytes");let l=85+s.length;if(l>1232)throw Error(`Combined message length (${l}) exceeds maximum (1232)`);let a=r(o),g=new Uint8Array(l),c=0;g[0]=255,c+=1;let h=e.utf8.toBytes(t);return g.set(h,c),g[c+=h.length]=0,c+=1,g.set(a,c),g[c+=32]=1,g[c+=1]=1,c+=1,g.set(n,c),g[c+=32]=255&s.length,g[c+1]=s.length>>8&255,c+=2,g.set(s,c),g}function n(e){if(e.length<85)throw Error("Message too short to contain a valid off-chain preamble");let r=0;if(255!==e[0])throw Error("Invalid signing domain prefix");if(r+=1,(new TextDecoder).decode(e.slice(r,r+15))!==t)throw Error("Invalid signing domain text");let i=e[r+=15];r+=1;let n=e.slice(r,r+32),o=e[r+=32],s=e[r+=1];if(1!==s)throw Error(`Expected 1 signer, got ${s}`);r+=1;let l=e.slice(r,r+32),a=e[r+=32]|e[r+1]<<8;if(r+=2,e.length<r+a)throw Error("Message body is shorter than declared length");return{version:i,applicationDomain:n,format:o,signerPublicKey:l,message:(new TextDecoder).decode(e.slice(r,r+a))}}export{i as buildSolanaOffchainMessage,r as deriveSolanaApplicationDomain,n as parseSolanaOffchainMessage};
|
|
2
|
+
//# sourceMappingURL=offchain-message.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offchain-message.mjs","sources":["../../../src/solana/offchain-message.ts"],"names":["SIGNING_DOMAIN_TEXT","deriveSolanaApplicationDomain","origin","encoded","encoding","utf8","toBytes","domain","Uint8Array","set","slice","buildSolanaOffchainMessage","message","signerPublicKey","messageBytes","length","Error","totalLength","PREAMBLE_LENGTH","applicationDomain","result","offset","domainTextBytes","i","parseSolanaOffchainMessage","bytes","SIGNING_DOMAIN_LENGTH","domainText","TextDecoder","decode","version","format","signerCount","messageLength"],"mappings":"8CAGA,IAAMA,EAAsB,kBAuBrB,SAASC,EAA8BC,GAC5C,IAAMC,EAAUC,EAASC,KAAKC,QAAQJ,GAChCK,EAAS,IAAIC,WAtBa,IAwBhC,OADAD,EAAOE,IAAIN,EAAQO,MAAM,EAvBO,KAwBzBH,CACT,CAWO,SAASI,GACdC,QAAAA,EACAC,gBAAAA,EACAN,OAAAA,IAMA,IAAMO,EAAeV,EAASC,KAAKC,QAAQM,GAE3C,GAAIC,KAAAA,EAAgBE,OAClB,MAAMC,MAAU,sCAGlB,IAAMC,EAAcC,GAAkBJ,EAAaC,OACnD,GAAIE,EA/CsB,KAgDxB,MAAUD,MACR,4BAA4BC,6BAIhC,IAAME,EAAoBlB,EAA8BM,GAClDa,EAAS,IAAIZ,WAAWS,GAC1BI,EAAS,EAGbD,EAHa,GAhEe,IAoE5BC,GAAU,EACV,IAAMC,EAAkBlB,EAASC,KAAKC,QAAQN,GAgC9C,OA/BAoB,EAAOX,IAAIa,EAAiBD,GAI5BD,EAHAC,GAAUC,EAAgBP,QApEL,EAwErBM,GAAU,EAGVD,EAAOX,IAAIU,EAAmBE,GAI9BD,EAHAC,GA3EgC,IACN,EAiF1BD,EAHAC,GAAU,GA7ES,EAiFnBA,GAAU,EAGVD,EAAOX,IAAII,EAAiBQ,GAI5BD,EAHAC,GApFoB,IAuFHP,IAAAA,EAAaC,OAC9BK,EAAOC,EAAS,GAAKE,EAAcR,QAAU,EAAK,IAClDM,GAxF2B,EA2F3BD,EAAOX,IAAIK,EAAcO,GAElBD,CACT,CAcO,SAASI,EAA2BC,GACzC,GAAIA,EAAMV,OAzGVW,GA0GE,MAAMV,MAAU,2DAGlB,IAAIK,EAAS,EAGb,GAAII,MAAAA,EAHS,GAIX,MAAUT,MAAM,iCAOlB,GALAK,GAAU,GAKNM,IAHmBC,aAAcC,OACnCJ,EAAMf,MAAMW,EAAQA,EAASrB,OAEZA,EACjB,MAAMgB,MAAU,+BAKlB,IAAMc,EAAUL,EAHhBJ,GAAUrB,IAIVqB,GAAU,EAGV,IAAMF,EAAoBM,EAAMf,MAAMW,EAAQA,EA1Id,IA8I1BU,EAASN,EAHfJ,GA3IgC,IAkJ1BW,EAAcP,EAHpBJ,GAAU,GAIV,GAAoB,IAAhBW,EACF,MAAMhB,MAAU,0BAA0BgB,KAE5CX,GAAU,EAGV,IAAMR,EAAkBY,EAAMf,MAAMW,EAAQA,EAtJxB,IA0JdY,EAAgBR,EAHtBJ,GAvJoB,IA0JoBI,EAAMJ,EAAS,IAAO,EAI9D,GAHAA,GA1J2B,EA6JvBI,EAAMV,OAASM,EAASY,EAC1B,MAAUjB,MAAM,gDAIlB,MAAO,CAACc,QAAAA,EAASX,kBAAAA,EAAmBY,OAAAA,EAAQlB,gBAAAA,EAAiBD,SAF7C,IAAIgB,aAAcC,OAAOJ,EAAMf,MAAMW,EAAQA,EAASY,IAGxE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@privy-io/js-sdk-core",
|
|
3
|
-
"version": "0.67.
|
|
3
|
+
"version": "0.67.1",
|
|
4
4
|
"description": "Vanilla JS client for the Privy Auth API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"authentication",
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
"fetch-retry": "^6.0.0",
|
|
57
57
|
"jose": "^4.15.5",
|
|
58
58
|
"js-cookie": "^3.0.5",
|
|
59
|
-
"libphonenumber-js": "^1.10
|
|
59
|
+
"libphonenumber-js": "^1.12.10",
|
|
60
60
|
"set-cookie-parser": "^2.6.0",
|
|
61
|
-
"@privy-io/
|
|
62
|
-
"@privy-io/
|
|
63
|
-
"@privy-io/api-base": "1.9.0",
|
|
61
|
+
"@privy-io/api-base": "1.9.1",
|
|
62
|
+
"@privy-io/chains": "0.3.0",
|
|
64
63
|
"@privy-io/encoding": "0.1.3",
|
|
65
|
-
"@privy-io/
|
|
64
|
+
"@privy-io/ethereum": "0.1.5",
|
|
65
|
+
"@privy-io/routes": "0.2.5"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@metamask/eth-sig-util": "^8.2.0",
|
|
@@ -79,21 +79,21 @@
|
|
|
79
79
|
"@swc/core": "^1.10.0",
|
|
80
80
|
"@swc/plugin-styled-components": "^6.0.1",
|
|
81
81
|
"@tsconfig/node16-strictest-esm": "^1.0.3",
|
|
82
|
-
"@types/jest": "^29.5.
|
|
82
|
+
"@types/jest": "^29.5.14",
|
|
83
83
|
"@types/js-cookie": "^3.0.3",
|
|
84
84
|
"@types/set-cookie-parser": "^2.4.7",
|
|
85
85
|
"@types/text-encoding": "^0.0.37",
|
|
86
|
-
"@wallet-standard/base": "
|
|
86
|
+
"@wallet-standard/base": "^1.1.0",
|
|
87
87
|
"@wallet-standard/core": "*",
|
|
88
88
|
"@wallet-standard/features": "*",
|
|
89
89
|
"glob": "^10.3.12",
|
|
90
90
|
"jest": "^29.7.0",
|
|
91
|
-
"msw": "^2.
|
|
91
|
+
"msw": "^2.10.4",
|
|
92
92
|
"rollup": "4.60.1",
|
|
93
93
|
"rollup-plugin-copy": "3.5.0",
|
|
94
94
|
"rollup-plugin-dts": "^6.1.1",
|
|
95
95
|
"text-encoding": "^0.7.0",
|
|
96
|
-
"ts-jest": "^29.
|
|
96
|
+
"ts-jest": "^29.2.6",
|
|
97
97
|
"typescript": "~6.0.2",
|
|
98
98
|
"@privy-io/build-config": "1.0.0",
|
|
99
99
|
"@privy-io/tsconfig": "0.0.0"
|